@orion-agents/orion-code 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +39 -28
  3. package/README.zh-CN.md +32 -25
  4. package/dist/commands/model-command-handlers.d.ts.map +1 -1
  5. package/dist/commands/model-command-handlers.js +59 -14
  6. package/dist/commands/model-command-handlers.js.map +1 -1
  7. package/dist/commands/types.d.ts +6 -0
  8. package/dist/commands/types.d.ts.map +1 -1
  9. package/dist/commands/types.js.map +1 -1
  10. package/dist/commands/workflow-command-handlers.d.ts +1 -1
  11. package/dist/commands/workflow-command-handlers.d.ts.map +1 -1
  12. package/dist/commands/workflow-command-handlers.js +42 -3
  13. package/dist/commands/workflow-command-handlers.js.map +1 -1
  14. package/dist/commands/workflow-commands.d.ts.map +1 -1
  15. package/dist/commands/workflow-commands.js +2 -2
  16. package/dist/commands/workflow-commands.js.map +1 -1
  17. package/dist/runtime/agent-runtime-controller.d.ts +16 -2
  18. package/dist/runtime/agent-runtime-controller.d.ts.map +1 -1
  19. package/dist/runtime/agent-runtime-controller.js +115 -6
  20. package/dist/runtime/agent-runtime-controller.js.map +1 -1
  21. package/dist/runtime/agent-runtime-protocol.d.ts +3 -0
  22. package/dist/runtime/agent-runtime-protocol.d.ts.map +1 -1
  23. package/dist/runtime/agent-runtime-protocol.js.map +1 -1
  24. package/dist/runtime/agent-runtime-runner.d.ts +8 -0
  25. package/dist/runtime/agent-runtime-runner.d.ts.map +1 -1
  26. package/dist/runtime/orion-session-runner.d.ts +4 -0
  27. package/dist/runtime/orion-session-runner.d.ts.map +1 -1
  28. package/dist/runtime/orion-session-runner.js +15 -0
  29. package/dist/runtime/orion-session-runner.js.map +1 -1
  30. package/dist/runtime/plan-review.d.ts +38 -0
  31. package/dist/runtime/plan-review.d.ts.map +1 -0
  32. package/dist/runtime/plan-review.js +173 -0
  33. package/dist/runtime/plan-review.js.map +1 -0
  34. package/dist/runtime/product-bootstrap.d.ts.map +1 -1
  35. package/dist/runtime/product-bootstrap.js +28 -6
  36. package/dist/runtime/product-bootstrap.js.map +1 -1
  37. package/dist/runtime/product-orion-runtime.d.ts.map +1 -1
  38. package/dist/runtime/product-orion-runtime.js +14 -35
  39. package/dist/runtime/product-orion-runtime.js.map +1 -1
  40. package/dist/runtime/protocol/runtime-protocol-v1.d.ts +73 -0
  41. package/dist/runtime/protocol/runtime-protocol-v1.d.ts.map +1 -1
  42. package/dist/runtime/protocol/runtime-protocol-v1.js +37 -0
  43. package/dist/runtime/protocol/runtime-protocol-v1.js.map +1 -1
  44. package/dist/runtime/release-receipts.d.ts +5 -3
  45. package/dist/runtime/release-receipts.d.ts.map +1 -1
  46. package/dist/runtime/release-receipts.js +42 -1
  47. package/dist/runtime/release-receipts.js.map +1 -1
  48. package/dist/runtime/session-composer-control.d.ts +136 -0
  49. package/dist/runtime/session-composer-control.d.ts.map +1 -0
  50. package/dist/runtime/session-composer-control.js +532 -0
  51. package/dist/runtime/session-composer-control.js.map +1 -0
  52. package/dist/runtime/thread-projection.d.ts +17 -0
  53. package/dist/runtime/thread-projection.d.ts.map +1 -1
  54. package/dist/runtime/thread-projection.js +87 -0
  55. package/dist/runtime/thread-projection.js.map +1 -1
  56. package/dist/runtime/ui-events.d.ts +6 -1
  57. package/dist/runtime/ui-events.d.ts.map +1 -1
  58. package/dist/runtime/ui-events.js.map +1 -1
  59. package/dist/services/session-storage.d.ts +36 -0
  60. package/dist/services/session-storage.d.ts.map +1 -1
  61. package/dist/services/session-storage.js +77 -1
  62. package/dist/services/session-storage.js.map +1 -1
  63. package/dist/web/event-hub.js +10 -0
  64. package/dist/web/event-hub.js.map +1 -1
  65. package/dist/web/file-read-service.d.ts +9 -0
  66. package/dist/web/file-read-service.d.ts.map +1 -1
  67. package/dist/web/file-read-service.js +17 -7
  68. package/dist/web/file-read-service.js.map +1 -1
  69. package/dist/web/git-read-model-service.d.ts +8 -0
  70. package/dist/web/git-read-model-service.d.ts.map +1 -1
  71. package/dist/web/git-read-model-service.js +28 -2
  72. package/dist/web/git-read-model-service.js.map +1 -1
  73. package/dist/web/protocol.d.ts +142 -0
  74. package/dist/web/protocol.d.ts.map +1 -1
  75. package/dist/web/protocol.js +207 -0
  76. package/dist/web/protocol.js.map +1 -1
  77. package/dist/web/server.d.ts.map +1 -1
  78. package/dist/web/server.js +45 -8
  79. package/dist/web/server.js.map +1 -1
  80. package/dist/web/terminal-manager.d.ts +1 -0
  81. package/dist/web/terminal-manager.d.ts.map +1 -1
  82. package/dist/web/terminal-manager.js +41 -9
  83. package/dist/web/terminal-manager.js.map +1 -1
  84. package/dist/web/workbench-controller.d.ts +26 -9
  85. package/dist/web/workbench-controller.d.ts.map +1 -1
  86. package/dist/web/workbench-controller.js +545 -29
  87. package/dist/web/workbench-controller.js.map +1 -1
  88. package/dist/web-client/assets/{DiffViewer-DpKoD07C.js → DiffViewer-eaQNsnCh.js} +1 -1
  89. package/dist/web-client/assets/FilesPanel-DYs1MhoM.js +2 -0
  90. package/dist/web-client/assets/{GitPanel-D20StcdG.js → GitPanel-CnU4XVr7.js} +1 -1
  91. package/dist/web-client/assets/{ReviewPanel-3MVWbMQV.js → ReviewPanel-BDxG670T.js} +1 -1
  92. package/dist/web-client/assets/{TerminalPanel-BLQ592Fb.js → TerminalPanel-Q5mSSsoK.js} +15 -13
  93. package/dist/web-client/assets/index-BWV5sIvw.css +1 -0
  94. package/dist/web-client/assets/index-VVUKj6FE.js +17 -0
  95. package/dist/web-client/index.html +2 -2
  96. package/docs/architecture/agent-mode-permission-contract.md +87 -0
  97. package/docs/architecture/v0.3.1-web-api.yaml +53 -5
  98. package/docs/architecture/v0.3.2-web-api.yaml +3029 -0
  99. package/docs/migration/v0.3.1-to-v0.3.2.md +94 -0
  100. package/docs/plan/v0.3.1-web-workbench-professional-shell-plan.md +1 -1
  101. package/docs/plan/v0.3.2-web-workbench-layout-and-composer-plan.md +869 -0
  102. package/docs/readme.md +12 -2
  103. package/docs/test/v0.3.1-web-workbench-e2e-plan.md +1 -1
  104. package/docs/test/v0.3.2-web-workbench-e2e-plan.md +100 -0
  105. package/npm-shrinkwrap.json +2 -2
  106. package/package.json +6 -1
  107. package/dist/web-client/assets/FilesPanel-BkoLmgjR.js +0 -2
  108. package/dist/web-client/assets/index-BkIDl_xk.js +0 -16
  109. package/dist/web-client/assets/index-DXMpnWE8.css +0 -1
@@ -7,8 +7,8 @@
7
7
  <meta name="theme-color" content="#0b0d12" />
8
8
  <meta name="description" content="Orion Code local Web Workbench" />
9
9
  <title>Orion Code</title>
10
- <script type="module" crossorigin src="/assets/index-BkIDl_xk.js"></script>
11
- <link rel="stylesheet" crossorigin href="/assets/index-DXMpnWE8.css">
10
+ <script type="module" crossorigin src="/assets/index-VVUKj6FE.js"></script>
11
+ <link rel="stylesheet" crossorigin href="/assets/index-BWV5sIvw.css">
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
@@ -0,0 +1,87 @@
1
+ # Agent Mode、Permission 与 Composer Control 合同
2
+
3
+ 本文冻结 Orion Code v0.3.2 的 Agent mode、Session permission、model/effort、Context 与
4
+ Plan review 边界。它是产品语义说明;wire contract 以
5
+ [`v0.3.2 OpenAPI`](v0.3.2-web-api.yaml)和 TypeScript discriminated union 为准。
6
+
7
+ ## 独立状态轴
8
+
9
+ | 状态轴 | 值 | 权威源 | 生效边界 |
10
+ | ---------- | ------------------------------------------ | ------------------------------ | --------------------------------- |
11
+ | Agent mode | `build` / `plan` / `auto` | active Session runtime | idle 时立即;active turn 后继请求 |
12
+ | Permission | project default / `ask` / `allow` / `deny` | Session composer preferences | 下一个 ToolGateway admission |
13
+ | Model | registry model id | Session metadata + coordinator | idle 时原子切换;busy 时延迟 |
14
+ | Effort | `auto` 或模型支持的 level | Session metadata | 与模型相同 |
15
+ | Context | usage/capacity/source/revision | Runtime projection | event/snapshot revision |
16
+
17
+ Mode 不授予 Authority。`auto` 只在已有 Authority 内减少交互确认;显式 deny、capability、policy、
18
+ sandbox 和 containment 优先。`allow` 需要用户风险确认,也不会跳过这些边界。
19
+
20
+ BUILD、PLAN、AUTO 使用同一个完整 Tool registry。Goal 是叠加在 base mode 上的目标生命周期,
21
+ 不会改变此授权合同。
22
+
23
+ ## 授权优先级
24
+
25
+ Tool authorization 按以下顺序解析:
26
+
27
+ 1. tool-owned hard denial 始终优先;
28
+ 2. 显式 project/machine/session `deny` 始终优先;
29
+ 3. AUTO 或 Session Allow 只批准剩余且已满足 Authority 的 invocation;
30
+ 4. 其余情况再应用 durable grant、工具专用 edit 规则和 interactive confirmation。
31
+
32
+ Workspace containment、OS sandbox、command safety、input validation 与 runtime capability guard
33
+ 在所有模式中都保持启用。AUTO 是 prompt-free,不是 policy-free。WebSearch/WebFetch、MCP 和
34
+ `subtask` research 也遵循相同规则;需要禁止网络时必须配置显式 capability/tool deny,不能依赖
35
+ PLAN 或 BUILD 名称暗示限制。
36
+
37
+ ## Source 与作用域
38
+
39
+ 权限必须同时展示 effective value、Session override、project default 和 source。清除 override
40
+ 恢复 project default,不写 global setting。模型与 Effort 属于当前 Session;Settings 中的
41
+ default model 只影响新 Session。页面不能把“当前 Session”与“全局默认”混为一谈。
42
+
43
+ ## 并发与失败
44
+
45
+ 所有 mutation 使用 UUID requestId,并绑定 active workspace/session/context 与 control revision。
46
+
47
+ - 同 requestId + 同 body 只执行一次;同 requestId + 不同 body 返回冲突;
48
+ - stale context/session/control/queue/plan revision 返回 409,且零 Runtime/provider/tool/file 副作用;
49
+ - active turn 中允许接受 deferred model/mode,但 UI 必须显示 pending;
50
+ - compact、metadata persist 或 runtime rebind 任一步失败时回滚到 last-good;
51
+ - 客户端不能在网络恢复、replay reset 或 409 后自动重放高风险 mutation。
52
+
53
+ ## Plan review
54
+
55
+ PLAN turn 只提交 durable PlanReceipt 并进入 `awaiting_review`。只有 exact plan digest 的:
56
+
57
+ - `approve`:durably resolve,然后创建独立 BUILD request;
58
+ - `continue`:携带非空 feedback,durably resolve,然后创建独立 PLAN request;
59
+ - `cancel`:durably cancel,不创建执行 request。
60
+
61
+ 刷新、SSE 重连和 Host restart 通过 Thread projection 恢复 review。corrupt/missing receipt、stale
62
+ digest 或 active turn 均 fail-closed。UI 不重算 Plan digest,也不把按钮点击本身当作 durable receipt。
63
+
64
+ ## Context 与结构化引用
65
+
66
+ Context usage 必须带 source (`provider` / `estimated`)、capacity、used、revision 与模型身份。
67
+ estimated 值显示 `~`;没有 Runtime breakdown 时浏览器不从 transcript 反推 system/tools/messages。
68
+
69
+ 结构化引用仅携带 opaque identity、revision 与 digest。Host 在 prompt assembly 时重新解析并验证:
70
+
71
+ - workspace containment 与 symlink/non-regular 边界;
72
+ - sensitive file deny 与 browser-safe derivative;
73
+ - stale revision/digest;
74
+ - 单引用 64KiB、总引用 256KiB;
75
+ - prompt manifest 与最终 request digest。
76
+
77
+ 任何失败都会阻止发送;原始敏感内容不得进入 DOM、SSE、截图或 release evidence。
78
+
79
+ ## 可观测性与兼容性
80
+
81
+ 每个已调度 Tool invocation 都投影 typed permission decision。durable receipt、trace 和 renderer-neutral
82
+ tool activity 必须携带 authorization source,例如 `mode_auto`、`allowlist_allow`、`config_allow` 或
83
+ `user`。TUI、terminal、print 与 Web 只显示 Runtime 已验证的 provenance,不从模式文案反推授权。
84
+
85
+ 本合同延续 v0.3.0 的兼容性决策:AUTO 允许 Authority 内的无人值守执行,但仍受 hard denial 与
86
+ 显式边界约束。未来如增加独立 network-policy 轴,必须作为新的 typed policy 出现,不能静默重载
87
+ workflow mode 或 Session permission。
@@ -56,6 +56,7 @@ paths:
56
56
  project, without activating or constructing its Runtime.
57
57
  parameters:
58
58
  - $ref: '#/components/parameters/WorkspaceId'
59
+ - $ref: '#/components/parameters/ContextWorkspaceId'
59
60
  - $ref: '#/components/parameters/ExpectedContextRevision'
60
61
  - $ref: '#/components/parameters/CollectionCursor'
61
62
  - $ref: '#/components/parameters/PageSize'
@@ -74,6 +75,7 @@ paths:
74
75
  description: Return a bounded Git/project summary without activating the workspace Runtime.
75
76
  parameters:
76
77
  - $ref: '#/components/parameters/WorkspaceId'
78
+ - $ref: '#/components/parameters/ContextWorkspaceId'
77
79
  - $ref: '#/components/parameters/ExpectedContextRevision'
78
80
  responses:
79
81
  '200':
@@ -653,6 +655,8 @@ paths:
653
655
  application/json:
654
656
  schema:
655
657
  type: object
658
+ properties:
659
+ performance: { $ref: '#/components/schemas/WebPerformanceCounters' }
656
660
  additionalProperties: true
657
661
  '409': { $ref: '#/components/responses/ContextConflict' }
658
662
  /settings:
@@ -893,6 +897,27 @@ components:
893
897
  code: context_revision_conflict
894
898
  detail: The active Context changed before the request was admitted.
895
899
  schemas:
900
+ WebPerformanceCounters:
901
+ type: object
902
+ additionalProperties: false
903
+ required: [files, git]
904
+ properties:
905
+ files:
906
+ type: object
907
+ additionalProperties: false
908
+ required: [readOperations, bytesRead, itemsParsed]
909
+ properties:
910
+ readOperations: { type: integer, minimum: 0 }
911
+ bytesRead: { type: integer, minimum: 0 }
912
+ itemsParsed: { type: integer, minimum: 0 }
913
+ git:
914
+ type: object
915
+ additionalProperties: false
916
+ required: [processCount, bytesRead, itemsParsed]
917
+ properties:
918
+ processCount: { type: integer, minimum: 0 }
919
+ bytesRead: { type: integer, minimum: 0 }
920
+ itemsParsed: { type: integer, minimum: 0 }
896
921
  HealthResponse:
897
922
  type: object
898
923
  additionalProperties: false
@@ -1113,10 +1138,14 @@ components:
1113
1138
  FileNode:
1114
1139
  type: object
1115
1140
  additionalProperties: false
1116
- required: [id, name, kind, modifiedAt, sensitive, readable]
1141
+ required: [id, name, displayPath, kind, modifiedAt, sensitive, readable]
1117
1142
  properties:
1118
1143
  id: { type: string, minLength: 1 }
1119
1144
  name: { type: string, minLength: 1 }
1145
+ displayPath:
1146
+ type: string
1147
+ minLength: 1
1148
+ description: Sanitized workspace-relative display metadata; requests still use opaque id.
1120
1149
  kind: { type: string, enum: [file, directory, symlink] }
1121
1150
  sizeBytes: { type: integer, minimum: 0 }
1122
1151
  modifiedAt: { type: string, format: date-time }
@@ -1260,13 +1289,32 @@ components:
1260
1289
  ReviewVerification:
1261
1290
  type: object
1262
1291
  additionalProperties: false
1263
- required: [callId, toolName, state, outputBytes, hasArtifact]
1264
- properties:
1265
- callId: { type: string }
1266
- toolName: { type: string }
1292
+ required:
1293
+ - callId
1294
+ - sessionId
1295
+ - threadId
1296
+ - sequence
1297
+ - toolName
1298
+ - state
1299
+ - terminal
1300
+ - success
1301
+ - outputBytes
1302
+ - hasArtifact
1303
+ - executionPolicyDigest
1304
+ - receiptDigest
1305
+ properties:
1306
+ callId: { type: string, minLength: 1 }
1307
+ sessionId: { type: string, minLength: 1 }
1308
+ threadId: { type: string, minLength: 1 }
1309
+ sequence: { type: integer, minimum: 1 }
1310
+ toolName: { type: string, minLength: 1 }
1267
1311
  state: { type: string, enum: [success, error, skipped] }
1312
+ terminal: { type: string, enum: [completed, failed, interrupted, indeterminate] }
1313
+ success: { type: boolean }
1268
1314
  outputBytes: { type: integer, minimum: 0 }
1269
1315
  hasArtifact: { type: boolean }
1316
+ executionPolicyDigest: { type: string, pattern: '^[a-f0-9]{64}$' }
1317
+ receiptDigest: { type: string, pattern: '^[a-f0-9]{64}$' }
1270
1318
  ReviewSnapshot:
1271
1319
  type: object
1272
1320
  additionalProperties: false