@sema-agent/client-core 0.11.7 → 0.11.9
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 +40 -8
- package/dist/adapter/downstream/terminalToSdkResult.d.ts +5 -3
- package/dist/adapter/downstream/terminalToSdkResult.js +42 -11
- package/dist/effortWire.js +4 -9
- package/dist/fleet/fleetProjection.d.ts +8 -0
- package/dist/fleet/fleetProjection.js +9 -0
- package/dist/headlessPermissionModeWire.d.ts +0 -2
- package/dist/headlessPermissionModeWire.js +4 -7
- package/dist/seatContract.d.ts +0 -13
- package/dist/seatContract.js +5 -2
- package/dist/toolResult.js +5 -0
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -23,7 +23,9 @@ Renamed from **`@sema-agent/wire-cc-adapter`** (0.1.x, deprecated — see *Migra
|
|
|
23
23
|
|
|
24
24
|
## Scope
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
**Version:** 0.11.9
|
|
27
|
+
|
|
28
|
+
- **Today** — the adapter seam, the whole `adapt()` pipeline (all 14 A-layer arms plus the
|
|
27
29
|
B/D/E tool-card layers), the notification/caps/model families, the adapter kernel (stream driver
|
|
28
30
|
+ downstream projectors), the request-shaping surface **for both lanes** (interactive and the
|
|
29
31
|
headless `-p` print lane), the fleet/panel projections and the subagent wire family, the workflow
|
|
@@ -39,9 +41,22 @@ Renamed from **`@sema-agent/wire-cc-adapter`** (0.1.x, deprecated — see *Migra
|
|
|
39
41
|
|
|
40
42
|
## Dependencies
|
|
41
43
|
|
|
42
|
-
- **
|
|
43
|
-
-
|
|
44
|
-
|
|
44
|
+
- **Runtime dependencies:** `diff` (jsdiff 9 — zero transitive deps, pure JS, browser-safe). It is
|
|
45
|
+
the T20 client-side hunk computation; core ruled that hunks belong to the client, so keeping it
|
|
46
|
+
out of this package would mean three re-implementations (TUI / web / desktop). The portability
|
|
47
|
+
guard pins the runtime dependency set with an *equality* check, so this list cannot drift.
|
|
48
|
+
`sideEffects: false`.
|
|
49
|
+
- **Peers:**
|
|
50
|
+
- `@sema-agent/agent-types` — the CC session vocabulary (`SDKMessage` and friends). **Type-only**:
|
|
51
|
+
it ships no runtime code at all.
|
|
52
|
+
- `@sema-agent/sdk` — the wire contract. **Value-level, not type-only**: `AgentClient`,
|
|
53
|
+
`SseIdleError`, `probeHealth`, `APIError` and `TaskStopConflictError` are imported as values in
|
|
54
|
+
five modules, and the browser bundle really bundles the SDK through (the portability guard would
|
|
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
|
|
57
|
+
installed SDK at that line still exports every value-level symbol this package imports and still
|
|
58
|
+
declares `TaskStats.costMicroUsd` (the key `costOrNull` reads). A floor nobody ever ran is a
|
|
59
|
+
promise, not a contract.
|
|
45
60
|
- The direction is constitutional: **sdk (wire) + agent-types (vocabulary) → this package**,
|
|
46
61
|
and neither depends back.
|
|
47
62
|
|
|
@@ -181,13 +196,30 @@ both sides — what it records is why a compensation exists and when it can be d
|
|
|
181
196
|
|
|
182
197
|
```bash
|
|
183
198
|
npm install
|
|
184
|
-
node scripts/run-client-core-
|
|
185
|
-
node scripts/run-client-core-portability-test.mjs # 39 checks: kernel + A-layer + index closures, browser bundle
|
|
186
|
-
node scripts/run-client-core-diff-test.mjs # 1397 checks: differential + replay-id + ledger
|
|
199
|
+
npm test # = node scripts/run-client-core-all-gates.mjs — runs every suite below
|
|
187
200
|
```
|
|
188
201
|
|
|
202
|
+
`npm test` is a **collecting** runner, not a `&&` chain: a suite that exits 3 (SKIP, its material is
|
|
203
|
+
absent) does not short-circuit the ones after it, and the runner prints the three-part verdict
|
|
204
|
+
itself (FAILED names + skipped names + arithmetic reconciliation). All-SKIP reports exit 3, never 0.
|
|
205
|
+
|
|
206
|
+
| Suite | What it guards |
|
|
207
|
+
|---|---|
|
|
208
|
+
| `scripts/run-client-core-pure-test.mjs` | Consumer-view behaviour of every moved-in module; segment floors (B1–B8 + C) that only move up |
|
|
209
|
+
| `scripts/run-client-core-portability-test.mjs` | Kernel / A-layer / index import closures, the runtime-dependency equality gate, barrel reachability, and a real esbuild `--platform=browser` bundle |
|
|
210
|
+
| `scripts/run-client-core-diff-test.mjs` | Differential equivalence against the CLI reference bridge + replay-id invariant + ledger round-trip |
|
|
211
|
+
| `scripts/run-seat-contract-keys-test.mjs` | The seat IPC contract: verb list ↔ SPEC ↔ types, element-wise |
|
|
212
|
+
| `scripts/run-approval-frame-keys-test.mjs` | The tool-approval frame key mirror, element-wise against the SDK's runtime anchor |
|
|
213
|
+
| `scripts/run-print-bash-iserror-test.mjs` | The print lane's Bash `is_error` authority (structured over regex) |
|
|
214
|
+
| `scripts/run-sdk-floor-test.mjs` | The SDK version floor — and, more to the point, that the *installed* type declarations still carry the keys this package reads |
|
|
215
|
+
| `scripts/run-engine-vocab-floor-test.mjs` | Engine-mirrored vocabularies (structured card whitelist, self-reported tool face, control verbs, recogniser sets) against the *installed* `@sema-agent/core` |
|
|
216
|
+
| `scripts/run-public-surface-test.mjs` | The outward promises: the npm export surface baseline, the peer floor witness, and this README's claims |
|
|
217
|
+
|
|
189
218
|
Each suite carries a floor that only moves up — a refactor that stops executing a group of
|
|
190
|
-
assertions is a failure, not a quieter pass.
|
|
219
|
+
assertions is a failure, not a quieter pass. Guards anchor on the **installed artefact's content**
|
|
220
|
+
rather than on a version number, a directory name or a count: a version string can lie, a type
|
|
221
|
+
declaration cannot, and a count has no discriminating power when the content changes but the
|
|
222
|
+
cardinality does not.
|
|
191
223
|
|
|
192
224
|
The portability guard walks the value-level import closure of the stream driver (asserting zero
|
|
193
225
|
Node builtins, zero react, zero shell debug edge, closure size under its ceiling) and then really
|
|
@@ -49,9 +49,11 @@
|
|
|
49
49
|
* timeout salvage:写出窗兑现的 r.result(非空)骑 additive `result` 字段——CC error 帧无
|
|
50
50
|
* result,但把引擎已救回的最终文本静默丢弃对 -p 消费者是净损失。
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* 成本取数 = `TaskStats.costMicroUsd`(整数 micro-USD 单轨,SDK 1.0.0 / server 1.319.0 /
|
|
53
|
+
* core 2.0.0 起;legacy float `costUsd` 已删,见 costOrNull 头注)。零成本 is AMBIGUOUS
|
|
54
|
+
* (free vs. no MODEL_COST_* configured): disambiguate upstream via
|
|
55
|
+
* Capabilities.pricingConfigured (contract 02 §2.10 VERIFY); this projector converts
|
|
56
|
+
* the integer to USD (/1e6) and passes it through verbatim otherwise.
|
|
55
57
|
*/
|
|
56
58
|
import type { AgentEvent } from '@sema-agent/sdk';
|
|
57
59
|
import { type SDKMessage, type EmitContext } from '../types.js';
|
|
@@ -21,14 +21,41 @@ function elapsedMs(ctx) {
|
|
|
21
21
|
return typeof ctx.startedAtMs === 'number' ? Math.max(0, Date.now() - ctx.startedAtMs) : 0;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* micro-USD → USD。引擎账面的成本单位是 **micro-USD**(百万分之一美元,整数轨:1e6 micro = 1 USD;
|
|
25
|
+
* 整数是为了不吃 FP 漂移)。CC 的输出面字段 `total_cost_usd` / `costUSD` 单位是 **USD**(字段名即
|
|
26
|
+
* 单位),所以出口一律 `/1e6`。非有限值(NaN/Infinity)不上账 —— Infinity 比 undefined 更糟,它会被
|
|
27
|
+
* 当成真数字参与求和,把一条离谱账悄悄摊进总计(与 SDK `taskCostMicroUsd()` 的规约逐条同义;
|
|
28
|
+
* `mapModelUsage()` 里的 `costMicroUsd / 1e6` 是同一换算的既有用法,两处此后共用本函数)。
|
|
29
|
+
*
|
|
30
|
+
* 为什么不直接调 SDK 的 `taskCostMicroUsd()`:本文件在 `runStream` **可移植闭包**内,portability 门
|
|
31
|
+
* 对该闭包断言「值级外部包 = 空集」(EXPECTED_PACKAGES_KERNEL),值级 import SDK 会当场红。故就地
|
|
32
|
+
* 复刻规约,单一真源以 SDK 那份注释为准。
|
|
33
|
+
*/
|
|
34
|
+
function microUsdToUsd(micro) {
|
|
35
|
+
return typeof micro === 'number' && Number.isFinite(micro) ? micro / 1e6 : null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* P1-5 — `total_cost_usd` truthfulness: 成本 `0` is AMBIGUOUS (free vs. no MODEL_COST_* configured
|
|
25
39
|
* on the worker — the local TOC engine ships unconfigured, so `-p --output-format json` was reporting a
|
|
26
40
|
* fake `0`). Emit the number only when it is a REAL positive cost; otherwise `null` (JSON consumers see
|
|
27
41
|
* "unknown", never a fabricated zero). CC's schema field is numeric — number-guarded readers
|
|
28
42
|
* (replEntry cost fold) already treat non-number as absent.
|
|
43
|
+
*
|
|
44
|
+
* 🔴 键迁移([2006] cli 自查最重命中,2026-07-29):取数源从 legacy float `TaskStats.costUsd` 换成
|
|
45
|
+
* 整数 `TaskStats.costMicroUsd`。`costUsd` 已被 **core 2.0.0 / server 1.319.0 / SDK 1.0.0 同批删除**
|
|
46
|
+
* (发端、适配、类型三层),对 core 2.0.0+ 引擎该键恒 undefined ⇒ 本函数恒 null ⇒ `sema -p
|
|
47
|
+
* --output-format json` 的 `total_cost_usd` **恒 null**,而账其实一直在 `costMicroUsd` 上
|
|
48
|
+
* (本文件 `mapModelUsage()` 早就在读它 = 两代键并存的实锤)。devDep 此前钉 SDK `^0.1.7`(0.x 的 caret 是精确锁)
|
|
49
|
+
* ⇒ 类型层看到的还是「两轨都在」的旧声明,对 1.0.0 才报 TS2345 —— 校旧物的门抓不住这类断链,故
|
|
50
|
+
* 另有 `run-sdk-floor-test.mjs` 断言实装 SDK 地板 ≥ 1.1。
|
|
51
|
+
*
|
|
52
|
+
* 老引擎只发 float `costUsd` 时**不做兼容换算**:单轨之后读到 undefined(当场可见「不知道」)好过
|
|
53
|
+
* 把一笔来源可疑的账静默吸收成看起来正常的数字(SDK normalize.ts 的 BREAKING 留档同款裁定;
|
|
54
|
+
* 本仓 [clean-cut-no-legacy-compat])。
|
|
29
55
|
*/
|
|
30
|
-
function costOrNull(
|
|
31
|
-
|
|
56
|
+
function costOrNull(stats) {
|
|
57
|
+
const usd = microUsdToUsd(stats?.costMicroUsd);
|
|
58
|
+
return usd !== null && usd > 0 ? usd : null;
|
|
32
59
|
}
|
|
33
60
|
// 件2a(中断事故修复批 G,2026-07-15,症状2 第一环):参数放宽 TaskStats | undefined + 全链守卫。
|
|
34
61
|
// 409 active-run 拒绝时引擎的 done 帧本体是 {status:'failed', errorMessage, activeTaskId} —— NO stats
|
|
@@ -51,7 +78,7 @@ function mapModelUsage(stats) {
|
|
|
51
78
|
cacheReadInputTokens: num(m.cacheReadTokens),
|
|
52
79
|
cacheCreationInputTokens: num(m.cacheWriteTokens),
|
|
53
80
|
webSearchRequests: 0,
|
|
54
|
-
costUSD:
|
|
81
|
+
costUSD: microUsdToUsd(m.costMicroUsd) ?? 0, // ⇐ 与 costOrNull 同一个换算口(旧写法 num(...)/1e6 逐值等价)
|
|
55
82
|
contextWindow: 0,
|
|
56
83
|
maxOutputTokens: 0,
|
|
57
84
|
};
|
|
@@ -79,7 +106,11 @@ export function doneToSdkResult(ev, ctx) {
|
|
|
79
106
|
modelUsage = {
|
|
80
107
|
[r.model]: {
|
|
81
108
|
...usage,
|
|
82
|
-
|
|
109
|
+
// 键迁移(见 costOrNull 头注):legacy float `costUsd` → 整数 `costMicroUsd`(/1e6 → USD)。
|
|
110
|
+
// ⚠️ 这一处**类型门抓不到**:TaskStats 带 `[key: string]: unknown` 开集索引,`typeof
|
|
111
|
+
// stats?.costUsd === 'number'` 的旧写法在 SDK 1.x 下照样编译得过,只是恒假 ⇒ 合成行的
|
|
112
|
+
// costUSD 静默恒 0(比报错更隐蔽)。tsc 只红了 6 处直传,这处靠人核。
|
|
113
|
+
costUSD: microUsdToUsd(stats?.costMicroUsd) ?? 0,
|
|
83
114
|
contextWindow: 0,
|
|
84
115
|
maxOutputTokens: 0,
|
|
85
116
|
},
|
|
@@ -129,7 +160,7 @@ export function doneToSdkResult(ev, ctx) {
|
|
|
129
160
|
is_error: true,
|
|
130
161
|
num_turns: stats?.turns ?? 0,
|
|
131
162
|
stop_reason: null,
|
|
132
|
-
total_cost_usd: costOrNull(stats
|
|
163
|
+
total_cost_usd: costOrNull(stats), // P1-5: null when unknown, never a fake 0
|
|
133
164
|
usage,
|
|
134
165
|
modelUsage,
|
|
135
166
|
permission_denials: [],
|
|
@@ -178,7 +209,7 @@ export function doneToSdkResult(ev, ctx) {
|
|
|
178
209
|
is_error: true,
|
|
179
210
|
num_turns: stats?.turns ?? 0,
|
|
180
211
|
stop_reason: null,
|
|
181
|
-
total_cost_usd: costOrNull(stats
|
|
212
|
+
total_cost_usd: costOrNull(stats),
|
|
182
213
|
usage,
|
|
183
214
|
modelUsage,
|
|
184
215
|
permission_denials: [],
|
|
@@ -207,7 +238,7 @@ export function doneToSdkResult(ev, ctx) {
|
|
|
207
238
|
is_error: true,
|
|
208
239
|
num_turns: stats?.turns ?? 0,
|
|
209
240
|
stop_reason: null,
|
|
210
|
-
total_cost_usd: costOrNull(stats
|
|
241
|
+
total_cost_usd: costOrNull(stats),
|
|
211
242
|
usage,
|
|
212
243
|
modelUsage,
|
|
213
244
|
permission_denials: [],
|
|
@@ -256,7 +287,7 @@ export function doneToSdkResult(ev, ctx) {
|
|
|
256
287
|
is_error: true,
|
|
257
288
|
num_turns: stats?.turns ?? 0, // 件2a 同款守卫 —— park 帧多数不带 stats,不炸
|
|
258
289
|
stop_reason: null,
|
|
259
|
-
total_cost_usd: costOrNull(stats
|
|
290
|
+
total_cost_usd: costOrNull(stats),
|
|
260
291
|
usage,
|
|
261
292
|
modelUsage,
|
|
262
293
|
permission_denials: [],
|
|
@@ -280,7 +311,7 @@ export function doneToSdkResult(ev, ctx) {
|
|
|
280
311
|
is_error: true,
|
|
281
312
|
num_turns: stats?.turns ?? 0,
|
|
282
313
|
stop_reason: null,
|
|
283
|
-
total_cost_usd: costOrNull(stats
|
|
314
|
+
total_cost_usd: costOrNull(stats),
|
|
284
315
|
usage,
|
|
285
316
|
modelUsage,
|
|
286
317
|
permission_denials: [],
|
|
@@ -308,7 +339,7 @@ export function doneToSdkResult(ev, ctx) {
|
|
|
308
339
|
})(),
|
|
309
340
|
...degradedField,
|
|
310
341
|
stop_reason: null, // dropped (contract 02 §2.10)
|
|
311
|
-
total_cost_usd: costOrNull(stats
|
|
342
|
+
total_cost_usd: costOrNull(stats), // P1-5: 零成本 = "unconfigured pricing" → null, never a fake 0
|
|
312
343
|
usage,
|
|
313
344
|
// MF-25/P1-5 — the per-model usage split (wire `stats.modelUsage`, or the synthesized current-model row).
|
|
314
345
|
modelUsage,
|
package/dist/effortWire.js
CHANGED
|
@@ -19,15 +19,10 @@
|
|
|
19
19
|
* is a ThinkingLevel (off|minimal|low|medium|high|xhigh|max); `auto` (let engine default), `ultracode` (a
|
|
20
20
|
* separate mode, future slice), numeric and unset all OMIT — the engine then uses its own default.
|
|
21
21
|
*/
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
'medium',
|
|
27
|
-
'high',
|
|
28
|
-
'xhigh',
|
|
29
|
-
'max',
|
|
30
|
-
]);
|
|
22
|
+
const REASONING_EFFORT_TUPLE = ['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
23
|
+
const _effortPins = [true, true];
|
|
24
|
+
void _effortPins;
|
|
25
|
+
const REASONING_EFFORTS = new Set(REASONING_EFFORT_TUPLE);
|
|
31
26
|
/**
|
|
32
27
|
* Project a picked `EffortValue` (string level | number | undefined) → the wire `reasoningEffort`, or
|
|
33
28
|
* undefined to OMIT. Returns the value verbatim iff it is a core ThinkingLevel; everything else (auto,
|
|
@@ -130,6 +130,14 @@ export declare function deriveAgentLabel(agentType: string | undefined, agentNam
|
|
|
130
130
|
*
|
|
131
131
|
* 集合 = core `RESERVED_AGENT_NAMES`(subagent.ts)的 CC-parity PascalCase 形 + goal 模式的
|
|
132
132
|
* `DeclareDone`。引擎 ≥ core 1.176 经 `canonicalToolName` 发 PascalCase。
|
|
133
|
+
*
|
|
134
|
+
* 🔴 [2006] A-CC-4(2026-07-29):此表此前**零门看守**,而 core 早已把子代委派工具改名成
|
|
135
|
+
* `Agent`(`DEFAULT_SUBAGENT_TOOL_NAME`;`Task`/`Fork` 退成 `OLD_TO_NEW` 旧名,`Fork` 还进了
|
|
136
|
+
* `TOMBSTONED_TOOLS`)。表里缺 `Agent` ⇒ 今天绝大多数 fleet 行的 description(引擎发的正是
|
|
137
|
+
* canonical 形 `Agent`)**压制不掉**,控制面动词照样泄漏进行正文 —— 正是本函数存在的理由被
|
|
138
|
+
* 静默架空。看守从此是 engine-vocab 门对**实装 core** `RESERVED_AGENT_NAMES` 的等值门;
|
|
139
|
+
* `Fork` 作为**登记旧名**保留(老引擎仍可能发;压制集多一个只多压制、不误伤真工具),
|
|
140
|
+
* 而"登记"本身要过门 —— 登记项必须是 core 认过的改名/墓碑词。
|
|
133
141
|
*/
|
|
134
142
|
export declare const CONTROL_TOOL_VERBS: ReadonlySet<string>;
|
|
135
143
|
/** 行的活动正文:控制面动词 ⇒ 空(187 从不显示它),否则原样。 */
|
|
@@ -82,8 +82,17 @@ export function deriveAgentLabel(agentType, agentName, name, id) {
|
|
|
82
82
|
*
|
|
83
83
|
* 集合 = core `RESERVED_AGENT_NAMES`(subagent.ts)的 CC-parity PascalCase 形 + goal 模式的
|
|
84
84
|
* `DeclareDone`。引擎 ≥ core 1.176 经 `canonicalToolName` 发 PascalCase。
|
|
85
|
+
*
|
|
86
|
+
* 🔴 [2006] A-CC-4(2026-07-29):此表此前**零门看守**,而 core 早已把子代委派工具改名成
|
|
87
|
+
* `Agent`(`DEFAULT_SUBAGENT_TOOL_NAME`;`Task`/`Fork` 退成 `OLD_TO_NEW` 旧名,`Fork` 还进了
|
|
88
|
+
* `TOMBSTONED_TOOLS`)。表里缺 `Agent` ⇒ 今天绝大多数 fleet 行的 description(引擎发的正是
|
|
89
|
+
* canonical 形 `Agent`)**压制不掉**,控制面动词照样泄漏进行正文 —— 正是本函数存在的理由被
|
|
90
|
+
* 静默架空。看守从此是 engine-vocab 门对**实装 core** `RESERVED_AGENT_NAMES` 的等值门;
|
|
91
|
+
* `Fork` 作为**登记旧名**保留(老引擎仍可能发;压制集多一个只多压制、不误伤真工具),
|
|
92
|
+
* 而"登记"本身要过门 —— 登记项必须是 core 认过的改名/墓碑词。
|
|
85
93
|
*/
|
|
86
94
|
export const CONTROL_TOOL_VERBS = new Set([
|
|
95
|
+
'Agent',
|
|
87
96
|
'Task',
|
|
88
97
|
'Fork',
|
|
89
98
|
'StructuredOutput',
|
|
@@ -30,8 +30,6 @@ import { type PermissionMode, type PermissionModeField } from './permissionWireC
|
|
|
30
30
|
import { type EnvLike } from './hostEnv.js';
|
|
31
31
|
/** 部署旋钮 env 键名(settings.json env 块 → 1a-envseed → process.env 同车道)。 */
|
|
32
32
|
export declare const HEADLESS_PERMISSION_MODE_ENV = "SEMA_HEADLESS_PERMISSION_MODE";
|
|
33
|
-
/** wire 词表(permissionWireCaps.PermissionMode 的运行时镜像;大小写敏感——与 CC flag choices 一致)。
|
|
34
|
-
* 'auto'(分类器批3,[907]):server ≥1.209 五模式表认;老 server coerce 未知词 → "default" 只紧不松。 */
|
|
35
33
|
export declare const HEADLESS_PERMISSION_WIRE_MODES: readonly PermissionMode[];
|
|
36
34
|
export type HeadlessPermissionResolution = {
|
|
37
35
|
/** 直接展开进 TaskRequest 的字段({} = 不 stamp,现状 absent-mode)。 */
|
|
@@ -32,13 +32,10 @@ import { hostEnv } from './hostEnv.js';
|
|
|
32
32
|
export const HEADLESS_PERMISSION_MODE_ENV = 'SEMA_HEADLESS_PERMISSION_MODE';
|
|
33
33
|
/** wire 词表(permissionWireCaps.PermissionMode 的运行时镜像;大小写敏感——与 CC flag choices 一致)。
|
|
34
34
|
* 'auto'(分类器批3,[907]):server ≥1.209 五模式表认;老 server coerce 未知词 → "default" 只紧不松。 */
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
'bypassPermissions',
|
|
40
|
-
'auto',
|
|
41
|
-
];
|
|
35
|
+
const HEADLESS_PERMISSION_WIRE_MODE_TUPLE = ['default', 'plan', 'acceptEdits', 'bypassPermissions', 'auto'];
|
|
36
|
+
const _headlessPermissionModePins = [true, true];
|
|
37
|
+
void _headlessPermissionModePins;
|
|
38
|
+
export const HEADLESS_PERMISSION_WIRE_MODES = HEADLESS_PERMISSION_WIRE_MODE_TUPLE;
|
|
42
39
|
/**
|
|
43
40
|
* argv 里的 `--permission-mode <v>` / `--permission-mode=<v>`(后者/后出现者赢,commander 同语义)与
|
|
44
41
|
* `--dangerously-skip-permissions`(= bypassPermissions;`--permission-mode` 在场时让位)。
|
package/dist/seatContract.d.ts
CHANGED
|
@@ -255,23 +255,10 @@ export interface StartSessionOptions {
|
|
|
255
255
|
* ComposerMode 加一档而宿主闭集门不认的那天,红在编译期而不是用户提交那一刻。
|
|
256
256
|
*/
|
|
257
257
|
export type PermissionModeIntent = "default" | "plan" | "acceptEdits" | "bypassPermissions" | "auto";
|
|
258
|
-
/** The closed set the inbound gate checks. CLOSED deliberately, unlike `outcome` above: this word
|
|
259
|
-
* ORIGINATES in our own renderer and goes OUT to a wire that 400s on anything else, so an unknown
|
|
260
|
-
* value is a local bug we want reported at the door — not an unknown future wire word we must
|
|
261
|
-
* tolerate. (The direction of travel is what decides open vs closed, not the field's shape.) */
|
|
262
258
|
export declare const PERMISSION_MODE_INTENTS: readonly PermissionModeIntent[];
|
|
263
259
|
/** Per-task attachment cap — the server's own limit (`attachmentIds` > 16 ⇒ 400). Gated here so the
|
|
264
260
|
* seat gets a precise local error instead of a wire 400 halfway through a turn. */
|
|
265
261
|
export declare const ATTACHMENT_IDS_PER_TASK_CAP = 16;
|
|
266
|
-
/** The per-turn `reasoningEffort` accept-set — core's ThinkingLevel tiers, re-exported from the
|
|
267
|
-
* package's own wire projection (`effortWire.ReasoningEffort`) rather than re-typed here.
|
|
268
|
-
*
|
|
269
|
-
* CLOSED for the same reason `PERMISSION_MODE_INTENTS` is: the word ORIGINATES in our own composer
|
|
270
|
-
* and travels OUT to a wire that 400s (fail-loud) on an unknown tier — so an unknown value is a
|
|
271
|
-
* local bug we want reported at the seat's door, not a future wire word to tolerate. `ultracode` is
|
|
272
|
-
* deliberately NOT a tier here: in CC it is a standalone `settings.ultracode` preset boolean that
|
|
273
|
-
* COEXISTS with `xhigh` (see `SeatTurnSettings`), and folding it into this axis is exactly how the
|
|
274
|
-
* orchestration axis gets eaten by the reasoning axis. */
|
|
275
262
|
export declare const SEAT_REASONING_EFFORTS: readonly ReasoningEffort[];
|
|
276
263
|
/** The `settings` sub-object a seat turn may carry. A CLOSED set with its own name list + pin,
|
|
277
264
|
* exactly like the top-level request: `SEND_MESSAGE_REQUEST_KEYS` checks `keyof SendMessageRequest`
|
package/dist/seatContract.js
CHANGED
|
@@ -118,13 +118,14 @@ export const CHROME_EVENT_KINDS = [
|
|
|
118
118
|
* ORIGINATES in our own renderer and goes OUT to a wire that 400s on anything else, so an unknown
|
|
119
119
|
* value is a local bug we want reported at the door — not an unknown future wire word we must
|
|
120
120
|
* tolerate. (The direction of travel is what decides open vs closed, not the field's shape.) */
|
|
121
|
-
|
|
121
|
+
const PERMISSION_MODE_INTENT_TUPLE = [
|
|
122
122
|
"default",
|
|
123
123
|
"plan",
|
|
124
124
|
"acceptEdits",
|
|
125
125
|
"bypassPermissions",
|
|
126
126
|
"auto",
|
|
127
127
|
];
|
|
128
|
+
export const PERMISSION_MODE_INTENTS = PERMISSION_MODE_INTENT_TUPLE;
|
|
128
129
|
/** Per-task attachment cap — the server's own limit (`attachmentIds` > 16 ⇒ 400). Gated here so the
|
|
129
130
|
* seat gets a precise local error instead of a wire 400 halfway through a turn. */
|
|
130
131
|
export const ATTACHMENT_IDS_PER_TASK_CAP = 16;
|
|
@@ -137,7 +138,7 @@ export const ATTACHMENT_IDS_PER_TASK_CAP = 16;
|
|
|
137
138
|
* deliberately NOT a tier here: in CC it is a standalone `settings.ultracode` preset boolean that
|
|
138
139
|
* COEXISTS with `xhigh` (see `SeatTurnSettings`), and folding it into this axis is exactly how the
|
|
139
140
|
* orchestration axis gets eaten by the reasoning axis. */
|
|
140
|
-
|
|
141
|
+
const SEAT_REASONING_EFFORT_TUPLE = [
|
|
141
142
|
"off",
|
|
142
143
|
"minimal",
|
|
143
144
|
"low",
|
|
@@ -146,6 +147,7 @@ export const SEAT_REASONING_EFFORTS = [
|
|
|
146
147
|
"xhigh",
|
|
147
148
|
"max",
|
|
148
149
|
];
|
|
150
|
+
export const SEAT_REASONING_EFFORTS = SEAT_REASONING_EFFORT_TUPLE;
|
|
149
151
|
export const SEAT_TURN_SETTINGS_KEYS = ["ultracode"];
|
|
150
152
|
// ───────────────────────────── validators (CC dual-gate posture) ─────────────────────────────
|
|
151
153
|
export function isLocalSessionRecord(s) {
|
|
@@ -423,5 +425,6 @@ const _seatContractPins = [
|
|
|
423
425
|
true, true, true, true, true, true, true, true, true,
|
|
424
426
|
true, true, true, true, true, true, true, true,
|
|
425
427
|
true, true,
|
|
428
|
+
true, true, true, true,
|
|
426
429
|
];
|
|
427
430
|
void _seatContractPins;
|
package/dist/toolResult.js
CHANGED
|
@@ -46,6 +46,11 @@ export const STRUCTURED_DETAIL_TYPES = new Set([
|
|
|
46
46
|
'update',
|
|
47
47
|
'bash',
|
|
48
48
|
'notebook-edit',
|
|
49
|
+
// 🔴 [2006] A-CC-3(2026-07-29):`notebook` = Read 读 .ipynb 的投影卡(core RB-227,filePath +
|
|
50
|
+
// projected cells)。此前本表漏它而 core 照发 `tool_end.structured` ⇒ `structuredDetailType()`
|
|
51
|
+
// 返 undefined ⇒ 那张卡退回**正则解模型面文本**([assert-absence-check-fallback-layers] 同族)。
|
|
52
|
+
// 看守从「size===30 计数钉」换成对**实装 core** `CC_DETAIL_TYPES` 的等值门(engine-vocab 门)。
|
|
53
|
+
'notebook',
|
|
49
54
|
'text',
|
|
50
55
|
'grep',
|
|
51
56
|
'glob',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/client-core",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.9",
|
|
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",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc -p tsconfig.json",
|
|
23
|
+
"prepare": "npm run build",
|
|
23
24
|
"test": "node scripts/run-client-core-all-gates.mjs"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
@@ -27,11 +28,11 @@
|
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"@sema-agent/agent-types": ">=0.2.0",
|
|
30
|
-
"@sema-agent/sdk": ">=0.1.
|
|
31
|
+
"@sema-agent/sdk": ">=0.1.9"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@sema-agent/agent-types": "^0.2.0",
|
|
34
|
-
"@sema-agent/sdk": "^
|
|
35
|
+
"@sema-agent/sdk": "^1.1.0",
|
|
35
36
|
"esbuild": "^0.27.4",
|
|
36
37
|
"typescript": "^6.0.2"
|
|
37
38
|
}
|