@sema-agent/client-core 0.11.10 → 0.11.12

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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ Renamed from **`@sema-agent/wire-cc-adapter`** (0.1.x, deprecated — see *Migra
23
23
 
24
24
  ## Scope
25
25
 
26
- **Version:** 0.11.10
26
+ **Version:** 0.11.12
27
27
 
28
28
  - **Today** — the adapter seam, the whole `adapt()` pipeline (all 14 A-layer arms plus the
29
29
  B/D/E tool-card layers), the notification/caps/model families, the adapter kernel (stream driver
@@ -53,7 +53,7 @@ Renamed from **`@sema-agent/wire-cc-adapter`** (0.1.x, deprecated — see *Migra
53
53
  `SseIdleError`, `probeHealth`, `APIError` and `TaskStopConflictError` are imported as values in
54
54
  five modules, and the browser bundle really bundles the SDK through (the portability guard would
55
55
  exit 3 rather than quietly mark it external).
56
- - The declared floor is `>=0.1.9`, and it is *witnessed*: the guard checks that an actually
56
+ - The declared floor is `>=2.0.0`, and it is *witnessed*: the guard checks that an actually
57
57
  installed SDK at that line still exports every value-level symbol this package imports and still
58
58
  declares `TaskStats.costMicroUsd` (the key `costOrNull` reads). A floor nobody ever ran is a
59
59
  promise, not a contract.
@@ -100,7 +100,7 @@ export async function* withHeadlessR1Reconnect(live, deps) {
100
100
  if (t === 'error') {
101
101
  // STREAM_MAX_DURATION cap 帧(server streamSseLog):SDK parseSse 已锁存 Last-Event-ID
102
102
  // 并自动重开(同一次 openEvents 内部,计入同一次预算)——本帧是车道协议杂音,不下发。
103
- debugLog(`runs.events lane frame type=error code=${String(rec?.code ?? '')} — SDK resumes with Last-Event-ID internally`);
103
+ debugLog(`runs.events lane frame type=error code=${String(rec?.errorCode ?? rec?.code ?? '')} — SDK resumes with Last-Event-ID internally`);
104
104
  continue;
105
105
  }
106
106
  const seq = typeof rec?.id === 'string' && /^\d+$/.test(rec.id) ? Number(rec.id) : undefined;
@@ -140,6 +140,10 @@ export function observeCancelByDeny(settle, taskId) {
140
140
  hostLog('debug', `[hitl-ask] cancel-by-deny settled for run ${taskId} (session unlocked)`);
141
141
  })
142
142
  .catch((e) => {
143
+ // ⚠️ 这里的 `.code` 是 **client-core 自家 HitlSafetyError 的契约属性**(hitlBridge.ts,词表
144
+ // binding_mismatch|no_pending|wrong_gate|bad_plan_edit)—— 不是 SDK 错误的 `errorCode`。
145
+ // 2026-07-30 `.code` 普查曾把本处误判成 SDK 属性名病改成 errorCode,pure 门 B7 腿当场拦下
146
+ // (反向修复);判 `.code` 读点的病与否,先看**谁抛的**,别按属性名模式匹配。
143
147
  if (e?.code === 'no_pending') {
144
148
  hostLog('debug', `[hitl-ask] cancel-by-deny no_pending for run ${taskId} (benign — already resolved)`);
145
149
  return;
@@ -134,10 +134,14 @@ export function mergeTaskOutput(prev, fresh) {
134
134
  */
135
135
  export function classifyTaskStopConflict(e) {
136
136
  const detail = e instanceof Error ? e.message : String(e);
137
- const raw = e?.code;
138
- // typed 优先:SDK ≥0.0.11x 恒给 TaskStopConflictError `code` errorCode 原文。
139
- // 兜底(老 SDK / typed 抛点):code 非串时从 message 里认字面 —— 与手抄版同姿势,只是
140
- // 现在是**回落**而不是主判据。
137
+ const raw = e?.errorCode;
138
+ // typed 优先:SDK typed 错误(APIError 族)的机器码属性是 **`errorCode`**(peer 地板 >=2.0.0 恒有)。
139
+ // 🔴 2026-07-30 提货批实锤:此前这里读 `.code` —— 那是 0.x SDK 的属性名,1.0.0 错误层级重做后
140
+ // typed 类只带 `.errorCode`,于是五形分类整体塌 `unknown_conflict`。本仓 pure 门没抓到,因为
141
+ // 测试 fixture 也是手搓 `{status, code}` 老形 —— 实现与 fixture 同错互证(假绿)。壳的
142
+ // run-bulk-stop-engine-rows 门用**真 SDK** 打假 HTTP 引擎才现形(跨仓交叉验证)。修后 fixture
143
+ // 改锚实装 SDK 的 TaskStopConflictError 真类,fixture 再也漂不动。
144
+ // 兜底(非 typed 抛点):errorCode 非串时从 message 里认字面 —— 回落,不是主判据。
141
145
  const code = typeof raw === 'string'
142
146
  ? raw
143
147
  : (STOP_CONFLICT_CODES.find(c => detail.includes(c)) ?? '');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/client-core",
3
- "version": "0.11.10",
3
+ "version": "0.11.12",
4
4
  "description": "Client-side session runtime shared by every sema human client (TUI / web / desktop): sema wire frames (AgentEvent) -> CC session vocabulary (SDKMessage) with dual-plane output (transcript/chrome), deterministic transcript ids, lane discipline as a type, and the notification/dedup ledgers. Every CC-skin shape is collected here so the wire itself stays neutral. Blackboard [1832] design axioms; [1651]/[1652]/[1653] signed seam design. Renamed from @sema-agent/wire-cc-adapter (0.1.x).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,11 +28,11 @@
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@sema-agent/agent-types": ">=0.2.0",
31
- "@sema-agent/sdk": ">=0.1.9"
31
+ "@sema-agent/sdk": ">=2.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@sema-agent/agent-types": "^0.2.0",
35
- "@sema-agent/sdk": "^1.1.0",
35
+ "@sema-agent/sdk": "^2.0.0",
36
36
  "esbuild": "^0.27.4",
37
37
  "typescript": "^6.0.2"
38
38
  }