@sema-agent/client-core 0.24.1 → 0.25.0

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/dist/index.d.ts CHANGED
@@ -167,6 +167,7 @@ export * from './modelWireCaps.js';
167
167
  export * from './permissionWireCaps.js';
168
168
  export * from './promptProfileWireCaps.js';
169
169
  export * from './retainBackgroundWireCaps.js';
170
+ export * from './oneShotWireCaps.js';
170
171
  export * from './rewindWireCaps.js';
171
172
  export * from './selfOrchestrationWireCaps.js';
172
173
  export * from './skillsWireCaps.js';
package/dist/index.js CHANGED
@@ -188,6 +188,7 @@ export * from './modelWireCaps.js';
188
188
  export * from './permissionWireCaps.js';
189
189
  export * from './promptProfileWireCaps.js';
190
190
  export * from './retainBackgroundWireCaps.js';
191
+ export * from './oneShotWireCaps.js';
191
192
  export * from './rewindWireCaps.js';
192
193
  export * from './selfOrchestrationWireCaps.js';
193
194
  export * from './skillsWireCaps.js';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * src/oneShotWireCaps.ts — PURE projection: the headless `-p` submission's one-shot declaration →
3
+ * the TOP-LEVEL `TaskRequest.oneShot` boolean the SERVICE consumes(server ≥7.12.0 wire-types:
4
+ * boolean 才投影进 TaskSpec、缺席不写键、非 boolean 400)。Mirrors retainBackgroundWireCaps
5
+ * (the verified top-of-body wire pattern)。
6
+ *
7
+ * 语义(SDK `TaskRequest.oneShot` 契约,core ≥5.23.0 `TaskSpec.oneShot`):
8
+ * `true` = 本次提交是一次性的 —— 不存在一个后续回合能接住异步的后台通知(原型就是 headless
9
+ * `sema -p`:回合一结束进程就退了)。core 只把它当**给模型的指引**用:`RunWorkflow`/委派回执里
10
+ * 那句「结束回合等通知」改成「用 `TaskOutput({block:true})` 主动阻塞等」。不发,headless 调用方
11
+ * 会丢后台结果;发了也只是尽力而为,不是完成契约。
12
+ *
13
+ * 提交体是**开集**:还没接这个键的老 worker 收下 `oneShot: true`、回 200、键被静默忽略(=现状
14
+ * 行为,零回归)——所以本键与姊妹键 `interactiveTools`/`retainBackgroundProcesses` 同款,发送侧
15
+ * 不做能力位前置门(`capabilities.oneShot` 是「键被消费」的观测位,同步 caps 缓存在 `-p` 单回合
16
+ * 车道上探测大概率未回,前置门会把键变死键)。
17
+ *
18
+ * 三问(宪法 NO-SHIP 检查):
19
+ * 谁需要:headless `-p` 用户 —— 模型在 `-p` 里收到「结束回合等通知」的指引会白等(没有下一
20
+ * 回合),后台委派/workflow 的结果就丢了;stamp 后 core 换发 block-wait 指引。
21
+ * 谁受害:无 —— 键只改模型指引文案,不授予权限、不改门;交互车道不 stamp(有后续回合,
22
+ * 指引「等通知」本来就对)。
23
+ * 补偿机制:`SEMA_HEADLESS_ONE_SHOT=0|false|no|off` 逃生口 ⇒ 不 stamp ⇒ 引擎缺省(交互态
24
+ * 指引)生效;老引擎静默忽略本键。
25
+ *
26
+ * 语义:缺省 ON —— unset / 未识别值 ⇒ `true`(stamp);显式 truthy(1/true/yes/on)⇒ `true`;
27
+ * 只有显式 falsy(0/false/no/off)⇒ `undefined`(不 stamp)。返回型刻意是 `true | undefined`
28
+ * —— opt-out 一律表达为**不 stamp**,绝不发 `false`(形状诚实,与缺席在 wire 上同义,发小的
29
+ * 那个)。PURE — callers pass `env`;caller gates to LIVE mode(mock request shape 不变)。
30
+ */
31
+ import { type EnvLike } from './hostEnv.js';
32
+ /** The env key the shell reads(SEMA_ 命名空间;`-p` 车道 per-request 意图面,非引擎部署面)。 */
33
+ export declare const ONE_SHOT_ENV: "SEMA_HEADLESS_ONE_SHOT";
34
+ /**
35
+ * ENV source → `true`(缺省 ON = `-p` 提交的一次性本性),只有显式 falsy 逃生口
36
+ * ({@link envFlagOff} 拼写集)⇒ `undefined`(不 stamp ⇒ 引擎缺省交互态指引)。
37
+ */
38
+ export declare function oneShotFromEnv(env?: EnvLike): true | undefined;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * src/oneShotWireCaps.ts — PURE projection: the headless `-p` submission's one-shot declaration →
3
+ * the TOP-LEVEL `TaskRequest.oneShot` boolean the SERVICE consumes(server ≥7.12.0 wire-types:
4
+ * boolean 才投影进 TaskSpec、缺席不写键、非 boolean 400)。Mirrors retainBackgroundWireCaps
5
+ * (the verified top-of-body wire pattern)。
6
+ *
7
+ * 语义(SDK `TaskRequest.oneShot` 契约,core ≥5.23.0 `TaskSpec.oneShot`):
8
+ * `true` = 本次提交是一次性的 —— 不存在一个后续回合能接住异步的后台通知(原型就是 headless
9
+ * `sema -p`:回合一结束进程就退了)。core 只把它当**给模型的指引**用:`RunWorkflow`/委派回执里
10
+ * 那句「结束回合等通知」改成「用 `TaskOutput({block:true})` 主动阻塞等」。不发,headless 调用方
11
+ * 会丢后台结果;发了也只是尽力而为,不是完成契约。
12
+ *
13
+ * 提交体是**开集**:还没接这个键的老 worker 收下 `oneShot: true`、回 200、键被静默忽略(=现状
14
+ * 行为,零回归)——所以本键与姊妹键 `interactiveTools`/`retainBackgroundProcesses` 同款,发送侧
15
+ * 不做能力位前置门(`capabilities.oneShot` 是「键被消费」的观测位,同步 caps 缓存在 `-p` 单回合
16
+ * 车道上探测大概率未回,前置门会把键变死键)。
17
+ *
18
+ * 三问(宪法 NO-SHIP 检查):
19
+ * 谁需要:headless `-p` 用户 —— 模型在 `-p` 里收到「结束回合等通知」的指引会白等(没有下一
20
+ * 回合),后台委派/workflow 的结果就丢了;stamp 后 core 换发 block-wait 指引。
21
+ * 谁受害:无 —— 键只改模型指引文案,不授予权限、不改门;交互车道不 stamp(有后续回合,
22
+ * 指引「等通知」本来就对)。
23
+ * 补偿机制:`SEMA_HEADLESS_ONE_SHOT=0|false|no|off` 逃生口 ⇒ 不 stamp ⇒ 引擎缺省(交互态
24
+ * 指引)生效;老引擎静默忽略本键。
25
+ *
26
+ * 语义:缺省 ON —— unset / 未识别值 ⇒ `true`(stamp);显式 truthy(1/true/yes/on)⇒ `true`;
27
+ * 只有显式 falsy(0/false/no/off)⇒ `undefined`(不 stamp)。返回型刻意是 `true | undefined`
28
+ * —— opt-out 一律表达为**不 stamp**,绝不发 `false`(形状诚实,与缺席在 wire 上同义,发小的
29
+ * 那个)。PURE — callers pass `env`;caller gates to LIVE mode(mock request shape 不变)。
30
+ */
31
+ import { hostEnv } from './hostEnv.js';
32
+ import { envFlagOff } from './envFlag.js';
33
+ /** The env key the shell reads(SEMA_ 命名空间;`-p` 车道 per-request 意图面,非引擎部署面)。 */
34
+ export const ONE_SHOT_ENV = 'SEMA_HEADLESS_ONE_SHOT';
35
+ /**
36
+ * ENV source → `true`(缺省 ON = `-p` 提交的一次性本性),只有显式 falsy 逃生口
37
+ * ({@link envFlagOff} 拼写集)⇒ `undefined`(不 stamp ⇒ 引擎缺省交互态指引)。
38
+ */
39
+ export function oneShotFromEnv(env = hostEnv()) {
40
+ return envFlagOff(env[ONE_SHOT_ENV]) ? undefined : true;
41
+ }
@@ -86,6 +86,8 @@ export interface TaskRequestInput {
86
86
  finalVerification?: boolean;
87
87
  limits?: Record<string, unknown>;
88
88
  interactiveTools?: false;
89
+ /** 一次性提交声明(`true|undefined` 型:opt-out=不传,绝不发 false——wire 上与缺席同义,发小的那个)。 */
90
+ oneShot?: true;
89
91
  /** rewind 三件(E18);端自己判空。 */
90
92
  rewind?: Record<string, unknown>;
91
93
  /** 仓库坐标串(scan/code-review 场景;今日唯一供给方 web 的 Repository 输入=url/`owner/name` 串。
@@ -38,6 +38,7 @@ export const REQUEST_FIELD_MATRIX = [
38
38
  { field: 'finalVerification', lanes: ['print'], live: true, why: 'P1-1 终验:无人值守车道才需要引擎自证;交互 REPL 由人当场看结果。#106 裁 B(让位+告知)后交互面默认关' },
39
39
  { field: 'limits', lanes: ['print'], live: true, why: 'P2-3-b:`-p` 的预算护栏(--max-* flag 族),交互 REPL 由人随时 Esc' },
40
40
  { field: 'interactiveTools', lanes: ['print'], live: true, why: '[909]B 件3:无人值守 stamp false,从 roster 源头灭掉 AskUserQuestion/plan 门。交互车道 stamp false 等于自废武功' },
41
+ { field: 'oneShot', lanes: ['print'], live: true, why: 'SDK TaskRequest.oneShot(server ≥7.12.0 消费):`-p` 提交是一次性的——没有后续回合接住异步后台通知,core 据此把「结束回合等通知」指引换成 block-wait;交互车道有后续回合,stamp true 就是谎报。老 worker 静默忽略(开集提交体),故发送侧不设能力位前置门(oneShotWireCaps 头注)' },
41
42
  // ── interactive 车道独有 ────────────────────────────────────────────────────────────────────
42
43
  // ⚠️ 「interactive」**不等于**「TUI」:web 的 BFF lane 也报 `interactive`
43
44
  // (`sema-web-client` `WEB_REQUEST_LANE`)。下面多数条目的理由写的是壳的 TUI 面 —— 它们是
@@ -146,6 +147,7 @@ export function buildTaskRequest(input, lane) {
146
147
  ...(on('interactiveTools', input.interactiveTools) && input.interactiveTools === false
147
148
  ? { interactiveTools: false }
148
149
  : {}),
150
+ ...(on('oneShot', input.oneShot) && input.oneShot === true ? { oneShot: true } : {}),
149
151
  ...(Object.keys(settingsOut).length > 0 ? { settings: settingsOut } : {}),
150
152
  };
151
153
  return out;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/client-core",
3
- "version": "0.24.1",
3
+ "version": "0.25.0",
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",