95 Commits
Author SHA1 Message Date
chenchenandClaude Opus 4.8 c3f51fe479 feat: wire swarm stop to runtime + add events SSE stream (#45/#46)
契约已冻结(agent_swarm#14 runtime-contract v1 / #15 event-schema v1),HM 侧据此
落地两项原本 deferred 的能力,叠在读侧适配(PR #59)之上:

- stop(#45):HeicodeStopSwarm 真实调用运行时冻结路径
  POST /api/agent/swarm/deployments/{deployment_id}/stop,复用 agent_runtime_client
  的配置/URL/信封解析;Bearer SWARM_RUNTIME_SERVICE_TOKEN + X-Idempotency-Key 幂等。
  仅 SWARM_RUNTIME_ENABLED=true 且配齐 base_url+token 时发起,否则 POLICY_REJECTED,
  绝不伪造 accepted;终态不抢写,由 swarm.stopped 回调写回。
- events SSE(#46 读侧):GET /api/heicode/swarms/:id/events/stream?after=,与
  events?after 同源(HM 持久化回调事件,按 user_id 收口 + payload 脱敏),命中终态
  (swarm.completed/failed/stopped)/客户端断开/超时(30min)收流。不调运行时。
- docs:刷新 heicode-swarm-deferred.md(登记冻结契约、读侧/stop/SSE 已落地、唯一剩余
  计费缺口 #60)与 heicode-desktop-client-api.md §5.2(SSE + stop 端点)。

影响面:Client(新增 SSE 端点 + stop 行为变化)、agent_swarm(按冻结契约调用其 stop)。
不涉及 Manager↔AM、密钥、计费扣费逻辑(计费缺口 #60 仍阻塞于 agent_swarm#16)。
测试:callSwarmRuntimeStop(httptest 校验路径/鉴权/幂等头/信封解析/错误路径/runtime
id 回退)+ swarmEventIsTerminal;go build ./... 与 controller 测试全绿。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 21:43:00 +08:00
chenchenandClaude Opus 4.8 292504735e feat(swarm): add goal_summary to swarm status view (#45/#28 consumer ask)
@Mem0ried 客户端 consumer 验收(#59)指出 GET /swarms/:id 缺 goal_summary —— Run 列表
只能显示 deployment_id/status,体验差。补:swarmDeploymentView 增加 goal_summary,从持久化
plan_json 顶层 objective 提取,折叠空白为单行 + 截断(200 rune)+ RedactText 兜底;取不到
(无 plan / 无 objective / 坏 JSON)返回空串,不臆造。list 与 detail 同走 swarmDeploymentView,
两处都带上。

文档 docs/integration/heicode-desktop-client-api.md §5.2 状态样例补 goal_summary 字段说明。
测试 TestSwarmGoalSummary 覆盖:空/坏 JSON/无 objective→空;多行多空格折叠;误入 sk- 被脱敏;
超长截断带省略号。go build ./... 与 controller 测试全绿。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 21:17:32 +08:00
chenchenandClaude Opus 4.8 56a9b02a25 feat(swarm): adopt frozen agent_swarm contract v1 (read-side) (#45/#46)
按 agent_swarm#14/#15 冻结契约做 HM 读侧适配(客户端 #28 消费):
- 注册 6 类新事件(event-schema v1):swarm.completed/failed/stopped、approval.approved/rejected、
  handoff.created(categories + requiredFields 两表;必填先最小集,待 agent_swarm PR #28 §4 精校)。
- AgentCallbackEvent 增 Sequence(per-swarm 严格递增序号),回调入库透传 envelope.sequence;
  事件视图暴露 sequence 供客户端去重/排序。游标仍用稳定 id(next_after)避免 sequence 未全量
  上线时回归。
- 脱敏键补 credential_ref/signing_secret_ref(envelope 按设计透传 azkv:// 引用,客户端视图剔除)。
- artifact.created → 扁平视图 {uri,checksum,task_id,size_bytes?,created_at}(无 secret_ref;
  size 未知省略不伪造)。
- 状态展示映射 §4.1:display_status(blocked→degraded;不臆造 preparing/verifying)。

测试:状态映射、artifact 视图(脱敏 + size 省略)、6 类事件注册;controller+model 全回归通过,
go build/vet 干净。文档 §5.2 更新。

未含(下一 PR):stop 真实运行时接入(写路径,复用 agentRuntimeClientConfigForMode("swarm"))。

Affects: Manager only(只读查询契约适配)。AgentCallbackEvent 加列(AutoMigrate);无计费改动。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 18:01:32 +08:00
FastheiandGitHub 3af911257f Merge pull request #56 from xmindlab-heicode/feat/agent-endpoint-security-scheme
feat(agent): return A2A endpoint security scheme/profile (#55)
2026-06-10 16:27:34 +08:00
chenchenandClaude Opus 4.8 2500f17189 feat(agent): return A2A endpoint security scheme/profile (#55)
客户端 #25/#55:A2A 直连方需 Manager 在 agent endpoint 元数据给出安全通道信息,才能在
生产强制 HTTPS。agent 对象(列表/详情/部署/状态返回)新增 security:
- scheme: http | https(从 subdomain 推断)
- security_profile: none | tls(显式 https→tls;http 或裸主机→none)
- secure: profile != none

保守口径:无法确证 TLS 即 none,宁可客户端在生产拒绝也不回传"看似安全"的明文端点。
客户端置 HEICODE_AGENT_REQUIRE_SECURE=1 即据此强制(secure=false→拒绝)。AM 上 HTTPS/mTLS
listener(azgy)后 profile 自动变 tls,客户端无需改包。元数据不含任何 secret_ref。

纯函数 agentEndpointSecurity + 单测;文档 §5/§6 更新。Manager only,无计费/审计改动。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 15:37:28 +08:00
FastheiandGitHub 33f60922cb Merge branch 'main' into feat/preflight-confirm-audit-version 2026-06-10 15:36:14 +08:00
FastheiandGitHub 2332749013 Merge pull request #53 from xmindlab-heicode/feat/hm-swarm-query-phase1
feat(swarm): HM-side Swarm Run read-only query — Phase1 (#45)
2026-06-10 15:33:40 +08:00
chenchenandClaude Opus 4.8 19640b44f5 fix(preflight): address #41 review — persisted confirmation, deploy ready re-check, template-aware version
回应 Fasthei 复审(PR #51 CHANGES_REQUESTED):
1. 持久化确认记录(强一致):新增 model.PreflightConfirmation 表 + InsertPreflightConfirmation +
   PreflightConfirmationExists。confirm 时落库(默认 TTL=HEICODE_PREFLIGHT_CONFIRMATION_TTL_SECONDS
   =3600s,可设 0 不过期),写失败直接报错(非 best-effort)。部署侧要求该版本存在未过期确认记录
   → 杜绝直接拿 GET version 绕过 confirm/审计。
2. 部署重新校验 Ready:verifyDeployPreflight 增加 summary.Ready 检查 —— 预算/agent_slot 等
   易变项不进版本哈希,故部署时重查,防 confirm 后余额耗尽/槽位占满仍启动。
3. 版本哈希纳入模板安全面:computePreflightVersion 加 tplDigest(definition+model+name 摘要),
   管理员改同一 template_key 的 definition/model 后旧确认失效。补 TestComputePreflightVersion_ChangesOnTemplateEdit。
4. 审计降为附加流:强一致确认记录作为部署门禁;审计 preflight.confirmed 互补。

测试:PreflightConfirmationExists(命中/版本不符/跨用户/过期/不过期/空参)、PreflightBindingKey、
模板变更翻转版本。TestMain + 生产迁移注册 PreflightConfirmation。controller+model 全回归通过。
文档 §4.1.1 更新。

Affects: Manager only(新增 preflight_confirmations 表 + 部署门禁强化)。无计费改动。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 15:28:07 +08:00
chenchen 64ba58357f Merge remote-tracking branch 'origin/main' into feat/preflight-confirm-audit-version 2026-06-10 15:21:37 +08:00
chenchenandClaude Opus 4.8 b9d9eddf7b fix(swarm): address #45 review — payload redaction, user-scoped events, no fake stop
回应 Fasthei 复审(PR #53 CHANGES_REQUESTED):
1. 事件 payload 脱敏:swarmEventView 经 sanitizeSwarmPayload —— 递归剔除
   secret_ref/credentials/token/api_key/private_key/access_key/password 及 plan/payload/
   permission_manifest/env 大字段,再跑 RedactText 兜底。绝不下发 azkv:// secret_ref 或
   sk-/Bearer(approval.requested 等 envelope 携带的凭据引用)。加 TestSanitizeSwarmPayload_*。
2. user 作用域:model.ListSwarmCallbackEventsAfter 增加 userID 参数 + WHERE user_id,
   controller 传入当前用户;防 runtime_swarm_id/deployment_id 碰撞或误写导致跨用户事件泄漏。
   测试补 user 隔离用例。
3. stop 不伪造成功:移除「开关打开返回 accepted:true」路径;未启用→POLICY_REJECTED,
   启用也→NOT_IMPLEMENTED(未转发运行时),直到 agent_swarm#2 冻结接上真实 stop。

文档 §5.2 同步(脱敏 / user 作用域 / stop 语义)。go build/vet 干净,controller+model 全回归通过。

Affects: Manager only(只读查询脱敏 + 写端点安全语义)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 14:23:58 +08:00
chenchenandClaude Opus 4.8 06f0971465 docs(telemetry): reframe enablement gate as privacy-disclosure-published, not legal signoff (#44)
去掉「法务/产品签字」「需真人」表述:开启遥测的前置是「隐私披露文档已发布且经 PR 评审通过」
这一文档/评审条件,不是人工法务签字。符合团队留言只写技术结论/条件的约定。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 13:42:53 +08:00
chenchenandClaude Opus 4.8 612cccecb7 docs(telemetry): production enablement checklist 定稿 (#44)
#44 的「生产开启 telemetry 前置 checklist 定稿」工程交付:
docs/integration/telemetry-production-enablement-checklist.md。

涵盖:① 代码侧控制核验(默认 off/410、白名单 #42、8KiB 上限、保留期 #43、服务端脱敏、
不计费)② 生产配置确认(HEICODE_TELEMETRY_ENABLED/RETENTION_DAYS 等)③ 隐私/法务
签字硬前置(设备 ID 可关联账号披露 + 法务签字,owner=文档/合规,口径 @Fasthei;跟踪 #34)
④ 上线/回滚验证(410 基线→开启→抽查脱敏→回滚演练)⑤ 结论门。docs README 已索引。

完成 #44 的 checklist 定稿 DoD;隐私披露(#34)与法务签字仍是开启的人工前置。Docs only。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 13:38:07 +08:00
chenchenandClaude Opus 4.8 59b13ba824 feat(swarm): HM-side Swarm Run read-only query — Phase1 (#45)
#45 Phase1 的只读查询(list/status/events?after/artifacts),全部基于 HM 已持久化的
运行时回调数据(Swarm → HM 带签名回调,见 agent_callback.go),**无需实时调 Swarm**,
因此不被 agent_swarm#2 契约冻结阻塞、返工风险低:

- GET /api/heicode/swarms — 列出当前用户的 swarm 运行(AgentDeployment, sub_mode=swarm 或有 runtime_swarm_id)
- GET /api/heicode/swarms/:id — 状态(:id = deployment_id/swarm_id/correlation_id 任一)
- GET /api/heicode/swarms/:id/events?after=&limit= — 事件增量拉取(id 游标 next_after,oldest-first)
  新增 model.ListSwarmCallbackEventsAfter(按 deployment_id/swarm_id + id>after)
- GET /api/heicode/swarms/:id/artifacts — 从已存事件(event_type 含 artifact)派生
- POST /api/heicode/swarms/:id/stop — 唯一写操作;在 agent_swarm#2 冻结 + SWARM_RUNTIME_ENABLED=true
  前默认关闭并明确提示(不臆造未冻结写接口)

字段口径对齐 agent_swarm/docs/integration/runtime-contract.md(deployment_id↔swarm_id↔
manager_deployment_id;状态机 waiting_approval→running→…)。所有查询按 user 作用域,视图脱敏
(不含 plan/payload 大字段与凭据)。

测试:TestListSwarmCallbackEventsAfter(游标/过滤/空标识);TestMain 迁移 AgentDeployment +
AgentCallbackEvent。go build/vet 干净,controller+model 全套回归通过。文档 §5.2。

Affects: Manager only(新增只读查询端点 + 一个 gated 写端点)。无计费/审计 schema 改动;
不依赖未冻结契约。stop 真实接入随 agent_swarm#2 冻结落地。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 13:24:34 +08:00
zsbgnw12andGitHub da55285414 Merge pull request #50 from xmindlab-heicode/docs/hm-swarm-refresh-agent-swarm
docs(swarm): refresh HM-side swarm docs to current agent_swarm (repo name + model + contract)
2026-06-10 13:11:23 +08:00
zsbgnw12andGitHub 9ff0a7f9c5 Merge pull request #38 from xmindlab-heicode/docs/client-api-available-models-telemetry-usage
docs(client-api): available-models + config + telemetry + agent usage + #30 billing semantics (#35)
2026-06-10 13:11:19 +08:00
chenchenandClaude Opus 4.8 9a073e5b41 feat(preflight): confirm + audit + tamper-proof version check (#41)
完成 preflight EPIC(#29)的最后一子项 #41:

- POST /api/heicode/preflight/confirm:重算摘要 → 仅 ready 时可确认 → 派生防篡改
  版本哈希 → 写审计事件 preflight.confirmed(谁/何时/哪个 version)→ 返回 version。
- 防篡改版本 computePreflightVersion:在**稳定安全面**(template + 资源
  binding_id/type/provider/name/status/has_secret + 高危 enum + 必需缺失项)上做
  sha256,刻意排除易变预算数字/agent_slot,避免版本无意义抖动。
- 部署校验:POST /api/heicode/agents 新增可选 preflight_version。默认仅在带了它时
  校验(向后兼容);HEICODE_PREFLIGHT_REQUIRED=true 时强制。确认后资源/模板/高危面
  漂移或被篡改 → 版本不匹配 → 部署拒绝。
- 重构:抽出 buildPreflightSummary(GET/confirm/deploy 共用);GET 现也回 version。

测试:版本确定性/稳定性(不随预算变)、资源篡改翻转版本、normalizeBindingIDs。
go build/vet 干净,controller preflight 测试全过。文档 §4.1/§4.1.1 更新。

Affects: Manager only(新增 confirm 端点 + 部署可选校验,默认向后兼容)。
无计费/审计 schema 改动(复用既有 agent_audit_events)。

Closes #41

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 12:55:40 +08:00
chenchenandClaude Opus 4.8 699fa5ef44 docs(swarm): refresh HM-side swarm docs to current agent_swarm state
HM 端文档里的蜂群描述还是旧的(错仓名 + 旧模型),据实更新为当前 agent_swarm:

- 仓名:`HeiCode-Swarm` → `agent_swarm`(GitHub xmindlab-heicode/agent_swarm;产品名 HeiCode Swarm)。
- 模型:旧「HM 主导编排 / 仅 /tasks」→ 当前 Master-Agent 编排(分解→派发专家并行→协作/移交→评审/重做→汇总;Orchestrator FastAPI + Redis + WebSocket + Prometheus)。
- 契约:agent_swarm 已起草正式契约 docs/integration/runtime-contract.md(对齐 heicode-am-contract),待 Manager Runtime Team 评审冻结;已实现 create/status/tasks/logs/events/metrics/workflow/diagnostics/stop/approvals(带 deployment_id)。
- issue 引用:`agent_swarm#1`(执行面缺口,已关闭)→ 活动 EPIC `agent_swarm#2`(主链路接入契约冻结);HM 侧前置 #45/#46。

文件:
- docs/integration/heicode-swarm-deferred.md:勘误抬头 + §1 模型/接入状态 + §2 归属表(仓名/契约/接口) + §4 收尾据实更新。
- heicode/docker-compose.azure-vm.yml:SWARM_RUNTIME_* 注释更正(agent_swarm,deferred,当前关闭)。
- Heicode-Manager-生产配置与账号交接清单.md §7 + Orchestrator 地址标签:加勘误 banner,保留 env 历史记录但标注为旧模型/当前关闭。
- docs/deployment/Heicode-Manager-更换部署服务配置清单.md §2.2:加勘误 banner。

HM 不实现 swarm runtime 的裁定不变;仅把"蜂群现状"事实对齐。未改 env 变量名/行为(SWARM_RUNTIME_* 仍 disabled),未动 legacy-teardown 历史记录。Docs/注释 only。

Affects: 文档/注释 only。无代码、无计费/审计/部署行为改动。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 12:15:57 +08:00
chenchenandClaude Opus 4.8 df83588720 docs(client-api): add budget_remaining to agent usage §5.1 (#9)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 11:36:14 +08:00
chenchenandClaude Opus 4.8 4502d6b5bc feat(preflight): read-only preflight checklist + execution summary (#39, #40)
新增 GET /api/heicode/preflight?template_id=&binding_ids=1,2,3 —— agent 启动前的统一
确认层(#29 EPIC 的 #39 缺失项检测 + #40 可读执行摘要):

- #39 缺失项检测:必需资源类别(git/sk/project_document/cloud_account)未绑定、budget
  (余额≤0)、agent_slot(在跑数达 tier 上限)。ready = missing 为空。
- #40 可读执行摘要:agent 角色、脱敏资源视图、高危操作、预算(剩余额度/quota_per_unit/
  tier 上限/当前在跑数)、审批策略。
  - 红线:resources 只暴露 type/provider/name/status/has_secret(布尔),绝不含
    secret_ref/channelId/base_url/price。
  - 高危操作固定 enum:production_deploy/db_write/cloud_resource_delete/
    production_secret/large_budget,由已绑资源类型推导,均 requires_approval。

判定逻辑抽为纯函数 computePreflight,单测覆盖:全缺失、就绪、槽位满、高危 enum、
敏感字段不泄露(序列化断言)。复用既有 ResourceBinding/模板/GetUserMaxAgents/部署门禁
口径,不改部署/计费逻辑。文档补 §4.1。

#41(confirm + 审计 + 防篡改版本校验)作为后续 POST /preflight/confirm 实现。

Affects: Manager only(新增只读端点)。无 Client/Swarm 代码改动,无计费/审计 schema 改动。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 11:29:34 +08:00
chenchenandClaude Opus 4.8 d2d9a22ae4 docs(client-api): add available-models, config, telemetry, agent usage + hidden-token billing semantics (#35, #30)
Bring docs/integration/heicode-desktop-client-api.md in lock-step with merged
endpoints:

- §3.1 /api/heicode/available-models: logged-in user model list is the single
  source of truth (no local presets / no CodeGW channel backend); exposes only
  model_id/display_name/default; forbidden fields enumerated.
- §5.1 /api/heicode/agents/{id}/usage: token-name aggregation, time window,
  empty-data semantics, relation to billing logs. Includes the #30 hidden agent
  model token billing-collection semantics: UnlimitedQuota only waives the
  token's own remaining-quota cap, it does NOT bypass user.Quota — HM still
  checks user quota and settles to wallet/subscription via the billing
  expression; token revoked on stop/delete; hidden from user UI but auditable.
- §7.1 /api/heicode/config: telemetry enabled/endpoint/max_batch/flush/retention_days.
- §7.2 /api/heicode/telemetry/events: default-off 410 kill switch, V2 device
  signature, top-level array 1-20 / <=256KB, server redaction, context field
  whitelist (#32), 4xx-drop/5xx-retry, retention; production enable-gate note.
- Updated §10 endpoint inventory.

Docs-only; no code change. heicodeDocs org-level sync tracked in #34.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 00:45:29 +08:00
FastheiandGitHub 932b429a5d Merge pull request #15 from xmindlab-heicode/docs/hm-only-doc-sync
docs: 清理旧 HM 编排文档并新增蜂群 deferred 跟踪(HM-only 仓 + 模板 Agent 模型)
2026-06-08 17:42:43 +08:00
cbbdd66c2e docs(reference): correct permission-modes precision per official en page (#16)
Verified against code.claude.com/docs/en/permission-modes and fixed 6 points:
1. acceptEdits: add PowerShell tool auto-approvals (Set-Content/Add-Content/
   Clear-Content/Remove-Item + aliases) and env-prefix/process-wrapper note.
2. Protected paths: .claude exception is ONLY .claude/worktrees (was wrongly
   widened to commands/agents/skills); add per-mode protected-write table.
3. defaultMode:"auto" ignored from project files since v2.1.142+.
4. dontAsk: read-only Bash commands also run without allow rules; explicit ask
   rules are denied (not prompted).
5. auto conversational boundary: stays in force until user lifts it; Claude's own
   judgment doesn't lift it; lost on context compaction; use deny rule for hard.
6. auto consecutive-failure fallback: 3-in-a-row / 20-total pauses & re-prompts;
   -p non-interactive aborts the session. Plus dropped broad allow-rules on entry.

Co-authored-by: chenchen <chenchen@xinghanlab.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 15:26:52 +08:00
chenchenandClaude Opus 4.8 09331752f2 docs: address review — add swarm-deferred tracking entry + migration mapping
Per Fasthei's CHANGES_REQUESTED on #15: deleting all sub/swarm docs left no
tracking entry for the still-in-development swarm capability. Adds
docs/integration/heicode-swarm-deferred.md stating HM does not implement swarm
runtime, the old HM-orchestrated sub/swarm model is deprecated, new swarm work
lives on AM/Swarm side, and a per-file migration mapping (deprecated / deferred
/ superseded) for all 11 deleted docs. Links it from docs/README.md so deletion
no longer drops context.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 15:19:17 +08:00
chenchenandClaude Opus 4.8 11f399826c docs: 删除已废弃的蜂群 / 旧计划文档
蜂群(swarm)旧版已弃、新版未出 → 删全部蜂群文档;附带删除旧执行/改造计划与旧项目交接稿(均为已废弃旧产物,由 HM owner 确认)。docs/README 当前索引不引用它们,无死链。

删除:
- docs/heicode-manager-sub-swarm-progress-checklist.md
- docs/heicode-manager-swarm-gap-analysis.md
- docs/heicode-manager-standalone-execution-plan.md
- docs/integration/agent-manager-swarm-runtime-change-request.md
- docs/integration/heicode-manager-swarm-runtime-env-template.md
- docs/integration/AgentManager蜂群Runtime接口实现要求.md
- docs/integration/AgentManager蜂群Runtime联调待确认与补充要求.md
- docs/integration/蜂群模式-AgentManager对接任务清单.md
- docs/Heicode-Manager-agent统一改造落地计划.md
- Heicode-Manager-项目说明与踩坑交接.md

影响面:仅文档。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 13:29:06 +08:00
chenchenandClaude Opus 4.8 c9767eb6bb docs: 同步文档到当前实际(HM-only 仓 + 模板 Agent 模型)
- 根 README/CLAUDE/AGENTS:本仓已从 monorepo 拆分,只剩 Heicode Manager(heicode/ Go 网关 + docs/)。重写仓库地图为 HM-only;客户端指向 heicode-{mac,win}os-release-dev 独立仓;移除指向已删文档的死链(vision/milestones/agent-platform-api-design/cc-haha-AGENTS);开发闭环改为 heicode/。
- 删除 docs/integration/agent-platform-request-contract.md(已被 AM 契约取代);docs/README 索引去掉该条。
- product-package 03/12:执行闭环去掉「Heicode 生成/判断子环节」旧编排说法,改为客户端直连 agent、agent 自驱、模型走 HM /v1。

影响面:仅文档。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-08 13:03:48 +08:00
zsbgnw12andGitHub 696dfecc9d docs(heicode): set Azure Key Vault as secret-store baseline
Align Manager docs with code-enforced azkv:// secret_ref baseline.

Reviewed: docs-only, no code/runtime impact. Follow-up required in heicodeDocs to remove OpenBao/vault:// drift.
2026-06-07 22:49:58 +08:00
chenchenandClaude Opus 4.8 c220dc75da docs(reference): make Claude controls digest clearer & complete
Adds a reading guide, the full 6 permission modes (incl. dontAsk) + auto-mode
admin enablement toggle, confirmed role facts (UsageView roles; full matrix is
external; iam pages 404), deep permission-rule syntax (Bash spacing, Read/Edit
anchors, MCP/Agent), real MCP credential mechanisms (headersHelper/${VAR}/OAuth),
expanded usage/cost/attribution/analytics, plus two big appendices: verbatim
config examples (A1–A10) and step-by-step end-to-end flows (managed-settings
lifecycle, MCP allow/deny worked example, auto-mode force-push decision, auth
credential selection). Sourced from re-fetching the 6 core docs + permission-
modes/permissions/mcp/costs/monitoring-usage/analytics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 17:04:29 +08:00
chenchenandClaude Opus 4.8 5dc99946f0 docs(design): HM product tiers (Individual/Teams/Enterprise) + commercialization boundaries
Aligns HM's capabilities to three tiers mirroring Claude's proven split, grounded
in HM's existing primitives. Defines positioning + billing per tier, a capability
× tier matrix (use layer = Individual; manage/allocate = Teams; compliance/hard-
enforcement/private = Enterprise) with HM code landing points, the Teams-hook vs
Enterprise-moat rationale, HM's differentiators over Claude (gateway-side hard
cost control, signed per-org policy push, server-side hard enforcement, native
agent catalog), a P0–P3 rollout mapping, and the open pricing decisions to settle.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 16:53:44 +08:00
chenchenandClaude Opus 4.8 12f3cf21df docs(reference): add Individual/Teams/Enterprise tier breakdown to Claude digest
Expands §1.2 into a proper three-tier section: positioning per tier, a
capability × tier table (with source + whether the doc is explicit), the
billing differences, and the documented contradiction (authentication lists
"managed policy settings" as Enterprise-only while the server-managed-settings
feature page says Teams+ can use it). Also flags that most controls hinge on
provider (Anthropic-direct + admin write access) rather than subscription tier.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 16:41:58 +08:00
chenchenandClaude Opus 4.8 edb7090055 docs(reference): faithful Claude Code enterprise controls digest (zh)
Standalone reading reference faithfully consolidating the six official Claude
docs (admin-setup, authentication, server-managed-settings, settings,
managed-mcp, auto-mode-config): auth methods + precedence, roles/seats/admin,
settings scope precedence & merge rules, server-managed-settings mechanism,
full managed-only/permissions/model/sandbox/MCP key reference, managed-mcp
seven modes + allow/deny evaluation, auto-mode classifier, usage/audit, and
quick-reference tables. No HM design — pure Claude reference for study.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 16:34:29 +08:00
chenchenandClaude Opus 4.8 88240dc79e docs(design): HM team-control design referencing Claude Code enterprise paradigm
Synthesizes Claude's admin-setup/authentication/server-managed-settings/settings/
managed-mcp/auto-mode docs into a team-management design for HM, mapped onto the
analogy (client≈Claude Code, HM≈Claude.ai admin console, AM≈cloud agent) and
grounded in HM's existing primitives (new-api users/groups/sk-token model-limits/
quota, plus our V2 device auth, resource bindings, agent templates, /v1 gateway).
Covers org/team/seat model, roles, allocation, managed-settings push over the V2
channel, managed agent/tool catalog, auth/SSO, auto-mode, audit, and a phased plan.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 16:27:50 +08:00
chenchenandClaude Opus 4.8 c05b27de6a revert: drop outbound env-key logging; root cause was AM stale prod image
Token IS transmitted by HM (confirmed); the agent didn't enforce it because AM
hadn't deployed the image containing the §5 check to production. So the debug
log is unnecessary — removed. Contract §0.1 updated: token-check is "code-ready,
pending AM prod image", not a HM gap. UI access-token/direct-URL display kept.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 00:28:53 +08:00
chenchenandClaude Opus 4.8 c171bb70ee docs(integration): record 2026-06-04 end-to-end re-test against AM's updated runtime
AM shipped its updated runtime + fixes; live re-test confirms deploy → running
→ direct /health & /message/send (task completed) → stop → delete all pass, and
HM's per-agent access_token is minted + returned (non-empty UUID). Two AM-side
gaps remain: (1) the running agent does NOT enforce X-Agent-Access-Token
(no-token request still 200, agent card auth_required=None) — token isolation
not actually active; (2) subdomain is http:// (token + api_key in cleartext).
Contract §0.1 and client doc status notes updated accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 23:50:09 +08:00
chenchenandClaude Opus 4.8 f128f4d03f docs(integration): professional accuracy pass on client + AM contract
- AM contract: fix stale lifecycle path defaults in the env-override table
  (/agents/{agent_id}, /agents/{agent_id}/stop — matches code, not the old
  /api/agent/... values); correct the self-check create line to POST /agents;
  align the verify-endpoint example to the real production response shape
  (user_id is a string, agent_id included, miss returns {valid:false}).
- Client API: §0 overview now states HM mints the per-agent access_token
  (AM no longer "returns" it).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 22:42:55 +08:00
chenchenandClaude Opus 4.8 b01bba53f0 docs(agent): lock client↔agent auth to option ① (agent-local token compare)
Per the chosen design, the agent authorizes callers by comparing the request
header X-Agent-Access-Token against its env AGENT_ACCESS_TOKEN (constant-time),
no HM round-trip. AM contract §3.1 now states ① as the agreed integration with
Python pseudo-code; the /agent-access/verify endpoint is demoted to an optional
fallback. Client API §6 spells out the client's job: send X-Agent-Access-Token
on every direct-connect request.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 22:23:41 +08:00
chenchenandClaude Opus 4.8 e326964362 feat(agent): per-agent client↔agent access token for per-user authorization
HM now mints a random per-agent access token at deploy, injects it into the
agent env (AGENT_ACCESS_TOKEN + HEICODE_AGENT_ID) and returns it to the
deploying client (agent list access_token). Only the owning user receives it,
so only they can drive the agent — closing the gap where any valid sk- could
drive any agent and exfiltrate its mounted resources.

AM authorizes the caller either locally (compare to its env token) or via the
new public POST /api/heicode/agent-access/verify {agent_id, access_token} ->
{valid, user_id} (constant-time compare, no info leak on miss). AM may opt out.

Docs: AM contract §3.1 + client API §6 updated; access_token no longer empty.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 21:58:10 +08:00
chenchenandClaude Opus 4.8 b7d1927a5b docs(integration): update AM contract to current state + real-test results
- new §0.1 联调结果: real production test outcomes — create POST /agents works
  (returns access_info.domain/namespace), DELETE /agents/{id} 500s (AM
  UnboundLocalError bug), POST /agents/{id}/stop 404 (no endpoint), agent stays
  Pending / subdomain unreachable. The 3 AM-side blockers listed up top.
- OPENAI_API_KEY is now injected (a minted user new-api sk-, billed to the user,
  revoked on delete; verified working at /v1) — §1.1 env + §2 updated.
- §3 client<->agent: now documents AM's A2A protocol (message/send · stream),
  api_key auth, and flags the per-user isolation security gap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 17:36:23 +08:00
chenchenandClaude Opus 4.8 0b2aeac51d docs(integration): update client API doc to production-verified reality
Ran the full desktop-client flow against production (real account) and updated
the doc to the verified responses:
- capabilities model = gpt-5.4; modes still returned but ignored.
- agent object: access_token is "" (AM issues none — connect via A2A api_key),
  subdomain is a host (dep-xxx.taijiagnet.com), status starts Pending; real
  binding_ids; shown as "生产实测" examples.
- §4: clarified the template `model` field is a role-tier hint (opus), not the
  runtime model (gpt-5.4 injected at deploy).
- §5: stop currently fails / delete returns runtime_cleanup:"failed" (AM stop
  missing + delete bug); HM removes the local record regardless.
- §6: must wait for status=running / health 200 before connecting; noted the
  agent currently stays Pending and the subdomain isn't reachable yet (AM side).
- top banner: per-endpoint production verification note.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 17:07:30 +08:00
chenchenandClaude Opus 4.8 1d81002c2d fix(agent): default MODEL_NAME=gpt-5.4 for started agents (not template tier)
Preset templates carry a Claude-style frontmatter model (opus/sonnet) which is
NOT a model on the HM gateway. Passing it as MODEL_NAME would make the agent's
model calls fail. Now MODEL_NAME defaults to the gateway model gpt-5.4
(env AGENT_RUNTIME_DEFAULT_MODEL); a non-Claude-tier template model is honored.
Tests + AM contract doc updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 16:25:21 +08:00
chenchenandClaude Opus 4.8 b33bcf90bd feat(device): desktop client self-logout endpoint
POST /api/devices/logout (UserOrV2DeviceAuth): a device-signed client revokes its
OWN bound token via the signed X-Heicode-Device-Id (cannot touch other devices);
a session/JWT caller may pass {device_id}. Idempotent. The existing DELETE
/api/devices/:id revoke is session-only, so device clients had no self-logout —
this closes that gap. Documented in the client API doc §1.1.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 16:15:47 +08:00
chenchenandClaude Opus 4.8 27459bb476 fix(agent): align AM lifecycle paths to /agents/{id} (real-test: create works)
Real production test (user account) confirmed HM->AM POST /agents creates a real
agent (returned subdomain + status). But stop/delete still used the old
/api/agent/agents/{id} defaults and 404'd. Aligned status/stop/delete defaults to
the same namespace as create: /agents/{id}, /agents/{id}/stop. AM contract doc
notes these are HM's best guess pending AM's confirmation of the real lifecycle
endpoints (their doc only specified create).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 15:41:34 +08:00
chenchenandClaude Opus 4.8 074a3cc7e7 feat(agent): align HM to AM's coding_a2a_agent contract
Adapt HM's template-agent integration to AM's actual CODING_A2A API (per their
doc), keeping it isolated in agent_template_runtime.go:

- start payload -> AM's POST /agents { name, template:"coding_a2a_agent",
  framework:"A2A", config:{user_id,...}, env } with the template .md folded into
  env.AGENT_INSTRUCTION_TEXT, template_key -> AGENT_ROLE_NAME, model gateway via
  OPENAI_BASE_URL + MODEL_NAME (OPENAI_API_KEY left to the client per A2A request).
- response parse -> access_info.domain/external_ip -> subdomain, namespace/name
  -> runtime_id; AM issues no access_token (client uses A2A api_key).
- env names aligned to AM: GIT_DEFAULT_BRANCH, POSTGRES_* (was PG_*),
  AZURE_BLOB_ACCOUNT_NAME/CONTAINER/ACCOUNT_KEY (was BLOB_*); source keys aligned
  to the resource-binding form (db_name/username/database_password/access_key).
  Only AM-supported types (git/mysql/postgres/azure-blob); vm/redis/mongo/bucket
  now rejected as unsupported until AM adds them.
- frontend: resources page splits DB into MySQL/PostgreSQL (correct provider),
  drops vm; deploy page hides unsupported resource types.
- docs: AM contract + client doc updated to the real env names, payload, and the
  A2A direct-connect (message/send · message/stream) + api_key auth.
- tests updated for the new env names + AM payload/response shape. All green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 15:30:33 +08:00
chenchenandClaude Opus 4.8 e21cc1e81e docs(integration): HM<->AM interface contract for the template-agent model
Hand-off doc for the agent_management team: the 4 endpoints AM must implement
(start/status/stop/delete) with exact request/response (grounded in the isolated
adapter agent_template_runtime.go), the env naming convention AM templates must
read (git/vm/db/blob/bucket), AM's responsibilities (inject .env, validate the
agent access token, models via HM /v1/*, no secret leakage), the client<->agent
direct SSE contract AM needs to define, security requirements, the env-overridable
paths, and a joint integration checklist.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 14:47:34 +08:00
chenchenandClaude Opus 4.8 479cd61a07 docs(integration): complete + correct the desktop client API doc
Review of the client doc against the real code found and fixed:
- §1 auth was not self-contained (deferred the canonical to the deprecated doc).
  Inlined the full signing contract verified against middleware/device_signature.go:
  the exact header set, the fixed-order canonical string (method/path/ts/nonce/
  fingerprint/eph_pubkey/sha256(body)), ed25519(sha256(canonical)), the heicode-aead-v1
  encrypted-body rules, and the X-Heicode-Auth-Error / X-Heicode-Server-Time failure
  headers.
- §2 auth mismatch (accuracy bug): /api/user/self is UserAuth (session/JWT), NOT
  device-signed — a device-only client cannot call it. Marked it optional and
  clarified the two different auth schemes (/api/user/self* vs /api/heicode/*).
- §8: documented that failures return HTTP 200 with success:false (client MUST
  read success), and that error.retryable is always false (decide retry by code).
- §10 inventory: corrected /api/user/self auth + added /self/models.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 10:57:43 +08:00
chenchenandClaude Opus 4.8 15b17f39b0 docs: remove obsolete 普通 sub (old model) integration docs
The 普通 sub task-orchestration model was replaced by the template-agent model
and its backend deleted. Removed the now-obsolete docs describing it:
- heicode-desktop-sub-agile-api.md, heicode-desktop-subagile-e2e-demo.md
- heicode-desktop-unified-api.md, heicode-sub-mode-flow-spec.md
- 普通sub敏捷模式-AgentManager对接任务清单.md
- AgentManager普通sub{产物回调缺失问题,剩余补充要求,联调整改要求}.md

Fixed dangling references in the new docs (client-api / template-agent-model).
Swarm (蜂群) docs kept — different mode, out of scope.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 09:56:17 +08:00
chenchenandClaude Opus 4.8 c4e84258b7 docs(integration): desktop client API doc for the template-agent model
New authoritative client doc (heicode-desktop-client-api.md): the desktop client
lists its agents from HM, gets each agent's subdomain + access_token, and
connects to the agent directly over SSE; models for both client and agent go
through HM /v1/*. Grounded in the production-verified responses (19 Chinese
templates, agent list/deploy/status shapes, error codes). Marks the old
unified-api doc (sub task-orchestration) as superseded.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 00:41:07 +08:00
chenchenandClaude Opus 4.8 b40a29102e docs(integration): correct teardown after dependency analysis (avoid over-deletion)
Verified the old-model code surface against the repo. Found the new template-agent
model is an EVOLUTION of the existing deployment control plane, not greenfield —
so several files are mixed and must NOT be whole-deleted:

- agent_runtime_client.go: AM HTTP client (config/url/headers/create/stop/status/
  health) is reused by the new StartAgent/StopAgent AND by capabilities; only
  withDisplayStatus + artifact/budget helpers are old.
- agent_control_plane.go: AgentCreate/List/Get/StopUserDeployment + AgentDeployment
  table are the backbone the new agent record reuses; only per-deployment task
  sub-handlers and the withDisplayStatus calls (1191/1200/1222) are old.
- agent_task_bridge.go: resolveResourceBindingIntoGrant is reused for env assembly.
- AgentDeployment table: KEEP and extend (subdomain/access_token/binding_ids)
  instead of new heicode_agent table + DropTable. Reconciled the model doc to match.
- Added agent_runtime_http_smoke_test.go to the sync-fix list.

Adds a §0.0 dependency/impact analysis answering: coverage, shared-feature impact,
and impact on the new APIs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 21:37:07 +08:00
chenchenandClaude Opus 4.8 c062b67bd9 docs(integration): legacy teardown checklist for old sub task-orchestration
Concrete deletion plan for the old sub task model now that sub uses the
template-agent + direct-connect model. Maps real code surface (verified against
the repo) into delete / trim / evaluate buckets:

- routes (registerHeicodeTaskRoutes, deployment-targets, old user/deployments)
- controllers (heicode_task_create/client_routes/project_artifacts/artifact_edits/
  cloud_deploy delete; agent_runtime_client/task_bridge/callback/control_plane trim)
- models + DB tables/columns (AgentArtifact/Revision/CloudDeployment drop;
  AgentDeployment/SKSnapshot/CallbackEvent evaluate) with GORM/cross-DB drop notes
- frontend pages/routes/sidebar/i18n
- ordered teardown steps + verification + open questions to confirm before deleting

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 21:28:16 +08:00
chenchenandClaude Opus 4.8 69d164436d docs(integration): HM refactor spec for template-agent + direct-connect model
New simplified model: user deploys a template agent (resources injected into
its .env by HM from KV) via the HM web console; AM returns a unique subdomain +
access token; the desktop client connects DIRECTLY to the agent over SSE (HM out
of the data path). Both ends still call HM /v1/* for models.

Doc organizes the HM-side changes into: keep / add / modify / delete, plus the
agent record data model, the AM contract points, auth & secret handling, the
locked decisions, and rollout order. The old sub task-orchestration stack
(tasks/workflow/display_status/git_ref/artifact-download/lease/revision) is
marked for removal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 21:17:02 +08:00
chenchenandClaude Opus 4.8 4ae9841f6b docs(integration): add pre-flight, account, run-info & full endpoint inventory
Close the remaining coverage gaps in the client-facing API doc (verified against
real routes in router/api-router.go):

- §2.1 NEW "sub 可用性就绪闸门": the 4-gate composite the client must pass before
  enabling sub (capabilities.enabled + device-bound + active git binding + balance),
  with pseudo-code and per-gate data source — directly answers "客户端判断 sub 是否可用".
- §2.2 NEW account/balance: GET /api/user/self (+/self/groups,/self/models),
  quota/used_quota/request_count, model intersection rule.
- §2 capabilities: documented every field (runtime_kind/model_selection/supports_*).
- §4.2 NEW run-info interfaces with response shapes: logs(user/debug),
  timeline(events incl delivery.pushed), events, metrics, diagnostics, sk-snapshots.
- §12 NEW full endpoint inventory by flow stage (①startup ②create ③monitor
  ④approve ⑤artifacts ⑥iterate ⑦deploy ⑧resources) with 🟢/🟡/🔴 status — a
  coverage checklist mapping every real route so nothing is silently missing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 12:20:44 +08:00