@sema-agent/client-core 0.75.1 → 0.76.1

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 (65) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +11 -1
  3. package/dist/adapt/arms.js +137 -35
  4. package/dist/adapt/ids.d.ts +29 -2
  5. package/dist/adapt/ids.js +29 -2
  6. package/dist/adapt/panelTasks.d.ts +4 -3
  7. package/dist/adapt/panelTasks.js +29 -11
  8. package/dist/adapt/textStream.js +5 -5
  9. package/dist/adapt/toolCards.js +2 -2
  10. package/dist/adapt/turnFlags.js +5 -5
  11. package/dist/adapt.d.ts +1 -1
  12. package/dist/adapt.js +8 -8
  13. package/dist/adapter/downstream/eventToSdkMessage.d.ts +57 -0
  14. package/dist/adapter/downstream/eventToSdkMessage.js +125 -17
  15. package/dist/adapter/runStream.js +14 -5
  16. package/dist/adapter/types.d.ts +12 -0
  17. package/dist/adapter/types.js +30 -0
  18. package/dist/agentsWireCaps.d.ts +15 -2
  19. package/dist/approvalsStreamLiveCapability.js +15 -35
  20. package/dist/deviceExecutorManagementCapability.js +15 -35
  21. package/dist/engineAgentPanelStore.js +13 -1
  22. package/dist/engineCapReader.d.ts +77 -0
  23. package/dist/engineCapReader.js +87 -0
  24. package/dist/engineErrorCodes.d.ts +4 -0
  25. package/dist/engineErrorCodes.js +14 -0
  26. package/dist/executionLaneCapability.js +15 -38
  27. package/dist/fleet/fleetRowAgentType.js +1 -1
  28. package/dist/hitl/approvalOutcomeNote.d.ts +0 -10
  29. package/dist/hitl/approvalOutcomeNote.js +35 -8
  30. package/dist/hitl/approvalResolution.d.ts +148 -0
  31. package/dist/hitl/approvalResolution.js +199 -0
  32. package/dist/hitl/approvalsFeed.d.ts +100 -2
  33. package/dist/hitl/approvalsFeed.js +234 -18
  34. package/dist/hitl/livePendingAsk.d.ts +26 -6
  35. package/dist/hitl/livePendingAsk.js +52 -12
  36. package/dist/hitl/persistedRulesWire.d.ts +20 -0
  37. package/dist/hitl/persistedRulesWire.js +23 -0
  38. package/dist/index.d.ts +8 -0
  39. package/dist/index.js +25 -1
  40. package/dist/mcpLiveness.d.ts +179 -0
  41. package/dist/mcpLiveness.js +218 -0
  42. package/dist/mcpPanel.d.ts +17 -0
  43. package/dist/mcpPanel.js +21 -0
  44. package/dist/mcpProbeCapability.d.ts +84 -0
  45. package/dist/mcpProbeCapability.js +124 -0
  46. package/dist/memoryComplianceCapability.d.ts +73 -0
  47. package/dist/memoryComplianceCapability.js +109 -0
  48. package/dist/memoryEntriesWire.d.ts +302 -0
  49. package/dist/memoryEntriesWire.js +595 -0
  50. package/dist/memoryOriginCapability.d.ts +68 -0
  51. package/dist/memoryOriginCapability.js +102 -0
  52. package/dist/memorySpecWire.d.ts +175 -0
  53. package/dist/memorySpecWire.js +320 -0
  54. package/dist/peerLaneCapability.d.ts +62 -0
  55. package/dist/peerLaneCapability.js +100 -0
  56. package/dist/permissionRulesWriteCapability.d.ts +64 -0
  57. package/dist/permissionRulesWriteCapability.js +98 -0
  58. package/dist/seam.d.ts +53 -5
  59. package/dist/seam.js +10 -1
  60. package/dist/selfOrchestrationDenial.js +7 -2
  61. package/dist/sqlEngineCapability.js +15 -35
  62. package/dist/webSearchBackendCapability.js +15 -35
  63. package/dist/writeProtectionCapability.js +15 -35
  64. package/docs/INTEGRATION-CLIENTS.md +148 -15
  65. package/package.json +1 -1
@@ -31,7 +31,7 @@
31
31
  */
32
32
  import { capForDisplay } from './fleetTaskDesc.js';
33
33
  import { engineWireTarget } from './engineWireTarget.js';
34
- import { snapshotCapsGeneration, capsGenerationStillCurrent } from './engineCapsGenerationGuard.js';
34
+ import { createEngineCapReader } from './engineCapReader.js';
35
35
  /**
36
36
  * caps 回体 → 本格读数;**畸形一律 `undefined`**(= 这一格不写 ⇒ 读口答 `unobserved`)。
37
37
  *
@@ -109,7 +109,16 @@ export function projectWriteProtectionPosture(wiring) {
109
109
  ...(dropped !== undefined ? { droppedDefaultRows: dropped } : {}),
110
110
  };
111
111
  }
112
- const readingByBase = new Map();
112
+ /**
113
+ * 本格的 per-baseUrl 读账 + tee / 读口 / 失效口 / 测试钩四口 —— 各只能力位读器**共用同一份实现**
114
+ * ({@link createEngineCapReader});本文件只留这一格真正不同的部分:投影函数 {@link projectWriteProtectionCapability}、doctor 措辞表,以及本位自己的判据助手(如有)。
115
+ * 🔴 Map 在工厂闭包里,**一只读器一张**:收到读不懂的回体只删自己这一格,绝不连坐别的能力面。
116
+ */
117
+ const reader = createEngineCapReader({
118
+ name: 'writeProtection',
119
+ project: projectWriteProtectionCapability,
120
+ makeUnobserved: () => ({ kind: 'unobserved' }),
121
+ });
113
122
  /**
114
123
  * 宿主 caps probe 的**读面 tee** 落点(与 `noteEngineCapsForSqlEngine` 并列)。绝不 throw ——
115
124
  * 读面腿不许反噬 caps 探测链。
@@ -128,38 +137,11 @@ const readingByBase = new Map();
128
137
  * 有任何东西变坏。🔴 **tee 自己抓号是假判据**(陈旧那一发在这里读到的是新代号,永远像当代的)。
129
138
  */
130
139
  export function noteEngineCapsForWriteProtection(baseUrl, caps, opts) {
131
- if (typeof baseUrl !== 'string' || baseUrl === '')
132
- return;
133
- // 🔴 代际只在入口**快照一次**(异源对抗复审 R3):opts 是调用方的对象,回体上的 getter 能在投影中途改它;首末两次核对都用这份快照,
134
- // 读 opts / 读代际抛出 ⇒ 不动格(与陈旧代际同一处置)。
135
- const gen = snapshotCapsGeneration(opts);
136
- if (gen === null)
137
- return; // 调用方 opts 的 getter 抛出 = 供给坏了 ⇒ 不动格
138
- if (!capsGenerationStillCurrent(baseUrl, gen))
139
- return;
140
- let reading;
141
- try {
142
- reading = projectWriteProtectionCapability(caps);
143
- }
144
- catch {
145
- // 🔴 0.74.2 同形存量(CC-69 复审 R1 族扫):抛 getter / Proxy 的回体 = 畸形,与「投影答 undefined」同一处置 —— 删格,不许留着上一台的读数。
146
- reading = undefined;
147
- }
148
- // 🔴 投影之后**再核一次代际**(异源对抗复审 R2):投影会执行回体上不可信的 getter,它可以在中途让这一格换代
149
- // (invalidate + 新代际的 tee 已写入);此时无论投影返回还是抛出,都不许动新代际的格。
150
- if (!capsGenerationStillCurrent(baseUrl, gen))
151
- return;
152
- if (reading === undefined) {
153
- readingByBase.delete(baseUrl);
154
- return;
155
- }
156
- readingByBase.set(baseUrl, reading);
140
+ reader.note(baseUrl, caps, opts);
157
141
  }
158
142
  /** 本进程观测到的写保护姿态;这一格空缺 ⇒ `{kind:'unobserved'}`(**绝不**折成 `none`)。 */
159
143
  export function observedWriteProtection(baseUrl = engineWireTarget()?.baseUrl) {
160
- if (typeof baseUrl !== 'string' || baseUrl === '')
161
- return { kind: 'unobserved' };
162
- return readingByBase.get(baseUrl) ?? { kind: 'unobserved' };
144
+ return reader.observed(baseUrl);
163
145
  }
164
146
  /** 单行 UNTRUSTED 座的展示上限(UTF-16 单元;与 SQL 那一格同值同理由)。 */
165
147
  const WP_DETAIL_MAX = 40;
@@ -232,11 +214,9 @@ export function writeProtectionPostureDetail(posture) {
232
214
  * 空串 ⇒ no-op;绝不 throw(它跑在引擎温切路径上)。
233
215
  */
234
216
  export function forgetWriteProtectionReading(baseUrl) {
235
- if (typeof baseUrl !== 'string' || baseUrl === '')
236
- return;
237
- readingByBase.delete(baseUrl);
217
+ reader.forget(baseUrl);
238
218
  }
239
219
  /** 测试钩子。 */
240
220
  export function __resetWriteProtectionReadingsForTests() {
241
- readingByBase.clear();
221
+ reader.__resetForTests();
242
222
  }