@sema-agent/sdk 31.0.0 → 33.0.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/README.md +136 -0
- package/dist/device/index.d.ts +2 -1
- package/dist/device/index.d.ts.map +1 -1
- package/dist/device/index.js +4 -2
- package/dist/device/index.js.map +1 -1
- package/dist/errors.d.ts +66 -14
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +41 -14
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +82 -25
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +8 -0
- package/dist/events.js.map +1 -1
- package/dist/idempotency.d.ts +2 -1
- package/dist/idempotency.d.ts.map +1 -1
- package/dist/idempotency.js +2 -1
- package/dist/idempotency.js.map +1 -1
- package/dist/index.d.ts +24 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/normalize.d.ts +2 -2
- package/dist/normalize.d.ts.map +1 -1
- package/dist/normalize.js +0 -1
- package/dist/normalize.js.map +1 -1
- package/dist/resources/approvals.d.ts +68 -10
- package/dist/resources/approvals.d.ts.map +1 -1
- package/dist/resources/approvals.js +61 -3
- package/dist/resources/approvals.js.map +1 -1
- package/dist/resources/assistant.d.ts +9 -5
- package/dist/resources/assistant.d.ts.map +1 -1
- package/dist/resources/assistant.js +9 -4
- package/dist/resources/assistant.js.map +1 -1
- package/dist/resources/attachments.d.ts +7 -1
- package/dist/resources/attachments.d.ts.map +1 -1
- package/dist/resources/attachments.js +7 -1
- package/dist/resources/attachments.js.map +1 -1
- package/dist/resources/fleet.d.ts +7 -5
- package/dist/resources/fleet.d.ts.map +1 -1
- package/dist/resources/fleet.js.map +1 -1
- package/dist/resources/memory.d.ts +24 -10
- package/dist/resources/memory.d.ts.map +1 -1
- package/dist/resources/memory.js +24 -10
- package/dist/resources/memory.js.map +1 -1
- package/dist/resources/rules.d.ts +18 -11
- package/dist/resources/rules.d.ts.map +1 -1
- package/dist/resources/runs.d.ts +5 -1
- package/dist/resources/runs.d.ts.map +1 -1
- package/dist/resources/runs.js +3 -1
- package/dist/resources/runs.js.map +1 -1
- package/dist/resources/session-sync.d.ts +2 -2
- package/dist/resources/session-sync.js +2 -2
- package/dist/resources/sessions.d.ts +47 -10
- package/dist/resources/sessions.d.ts.map +1 -1
- package/dist/resources/sessions.js +46 -6
- package/dist/resources/sessions.js.map +1 -1
- package/dist/resources/side-query.d.ts +5 -2
- package/dist/resources/side-query.d.ts.map +1 -1
- package/dist/resources/side-query.js.map +1 -1
- package/dist/resources/tasks.d.ts +7 -6
- package/dist/resources/tasks.d.ts.map +1 -1
- package/dist/resources/tasks.js +7 -6
- package/dist/resources/tasks.js.map +1 -1
- package/dist/resources/tool-approvals.d.ts +69 -21
- package/dist/resources/tool-approvals.d.ts.map +1 -1
- package/dist/resources/tool-approvals.js +43 -10
- package/dist/resources/tool-approvals.js.map +1 -1
- package/dist/settings.d.ts +28 -11
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +3 -3
- package/dist/sse.d.ts +6 -4
- package/dist/sse.d.ts.map +1 -1
- package/dist/sse.js.map +1 -1
- package/dist/types.d.ts +339 -106
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +32 -0
- package/dist/types.js.map +1 -1
- package/openapi.yaml +640 -174
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
* null" may be correct — check for a normalizer at the boundary before widening it to `| null`.
|
|
58
58
|
*/
|
|
59
59
|
import type { SemaSettings } from "./settings.js";
|
|
60
|
-
import type { ApprovalDecidedBy } from "./resources/approvals.js";
|
|
60
|
+
import type { ApprovalDecidedBy, ApprovalDecidedVia } from "./resources/approvals.js";
|
|
61
61
|
import type { ASK_ORIGINS, AllowRuleShadow, ApprovalFrameFamily, ApprovalRequestFrame, AskOrigin, AutoModeFallbackCause, BoundGrantAbsence, BoundSkillGrants, ClassifierUnavailable, DenialLimitFallback, PersistedRuleMandate, RuleOffer, RuleOffersAbsence, ToolApprovalCardWord, ToolApprovalFrame } from "./resources/tool-approvals.js";
|
|
62
62
|
/** Authenticated end-user identity. Opaque to the service (used as memory scope + session owner). The SDK
|
|
63
63
|
* normalizes; the service does not interpret the value but does refuse one that is not a principal name: empty or whitespace-only, control / line-separator /
|
|
@@ -453,7 +453,12 @@ export interface TaskRequest {
|
|
|
453
453
|
userAttachments?: UserAttachment[];
|
|
454
454
|
/** D-1(server ≥1.289):预上传附件句柄(`client.attachments.upload()` 的 id)。提交时绑定会话并在
|
|
455
455
|
* 执行环境工作目录 `attachments/` 物化;objective 尾部追加文件清单告知(内容不进 durable 流)。
|
|
456
|
-
* ≤16/task;未知/他人 id → 400。⚠️ 键名 attachmentIds——`attachments` 已被系统提醒配置键占用。
|
|
456
|
+
* ≤16/task;未知/他人 id → 400。⚠️ 键名 attachmentIds——`attachments` 已被系统提醒配置键占用。
|
|
457
|
+
* 🔴 **server ≥7.142.0 三只 409**(新提交;都落 {@link import("./errors.js").AttachmentRejectedError},机读位经 `err.extra`,{@link import("./errors.js").AttachmentBindRefusalExtra}):
|
|
458
|
+
* `attachment.bound_elsewhere`(`id`)—— 附件**一经绑定不改绑**:已绑在别的会话上(此前同属主下后绑会把它挪过来)⇒ 每个会话各上传一次;
|
|
459
|
+
* `attachment.bundle_lane_not_isolated`(`id` · `lane`)—— 项目包({@link import("./resources/attachments.js").PROJECT_BUNDLE_MIME})只绑进**隔离**车道的会话;
|
|
460
|
+
* `attachment.bundle_seed_fixed`(`id`)—— 一只会话一只种子:会话已有种子,或同一提交体带第二只项目包。体里任一只被拒 ⇒ 其余一只都不绑。续跑腿重放存量体时不 4xx(该 id 跳过)。
|
|
461
|
+
* 隔离车道上的附件(server ≥7.142.0)由恢复点放进工作区。 */
|
|
457
462
|
attachmentIds?: string[];
|
|
458
463
|
/** G3([816]③/[820]③,server ≥1.291):壳供 per-session scratchpad 路径(壳自己的约定路径,如 CC 形
|
|
459
464
|
* `/tmp/claude-<uid>/<proj>/<sid>/scratchpad`)。接受后 server 让事实(envFacts.scratchpadDir)/写门豁免(exemptDirs)/
|
|
@@ -486,7 +491,10 @@ export interface TaskRequest {
|
|
|
486
491
|
* · **没变的**:`cascade:true` 不带停驻 opt-in,撞限仍 `failed`,级上停在审批门上仍 `failed` + `unexpected.suspended` + `nestedPause`(见 {@link TaskResult.terminal} 的 failed 臂);验证器自己那一腿撞限仍失败。 */
|
|
487
492
|
verify?: boolean;
|
|
488
493
|
verifyRounds?: number;
|
|
489
|
-
/** Quality-gate cascade (cheap→strong). Mutually exclusive with verify. Not on `stream`.
|
|
494
|
+
/** Quality-gate cascade (cheap→strong). Mutually exclusive with verify. Not on `stream`.
|
|
495
|
+
* 🔴 server ≥7.142.0:结果上 `attempts[].diagnostics` 过结果脱敏器、每级的 `gateError` 与 `terminal.message` 同一只脱敏(凭据片段换 `«redacted…»`;键集 / 条数 / 序不变);
|
|
496
|
+
* 每级的失败码 `attempts[].errorCode` 与 `terminal.code` 同一只出口封口折:出了本服务码形的(驱动原生码、长得像凭据的串)读作 `internal.store_error`(原码只进运维线索)。
|
|
497
|
+
* 按 `attempts[].errorCode` 读驱动原生码的端改读同一读法。 */
|
|
490
498
|
cascade?: boolean;
|
|
491
499
|
/** §sandbox-image-select(P0.5):送**镜像 profile 意图**(≤128 chars),service 内部按 trusted
|
|
492
500
|
* principal 用 `latestPublished(profile, viewer)` **fail-closed** 解析 digest + 再准入 → per-pod 起像(复用 select 同 visibility)。
|
|
@@ -1340,52 +1348,40 @@ export interface WorkspaceCacheCapability {
|
|
|
1340
1348
|
*/
|
|
1341
1349
|
export type ParkedRunStatus = "suspended" | "needs_review";
|
|
1342
1350
|
/**
|
|
1343
|
-
*
|
|
1344
|
-
*
|
|
1351
|
+
* **run 回执三键**(server 名 `SyncRunReceipt`,`http/sync-submit-body.ts`;与它逐键同,测试对拍)—— 手里**没有**引擎结果时同步体的全部内容:
|
|
1352
|
+
* 去 `GET /v1/runs/:taskId` 读行。{@link SyncReceiptBody} 是它在同步体上的那一臂(多一个可选的 `replay`)。
|
|
1345
1353
|
*/
|
|
1346
|
-
export interface
|
|
1347
|
-
/** 同步腿提交时铸的 durable run id —— `GET /v1/runs/:taskId` 的 poll
|
|
1354
|
+
export interface SyncRunReceipt {
|
|
1355
|
+
/** 同步腿提交时铸的 durable run id —— `GET /v1/runs/:taskId` 的 poll 键。 */
|
|
1348
1356
|
taskId: string;
|
|
1349
|
-
/**
|
|
1357
|
+
/** 提交的会话。 */
|
|
1350
1358
|
sessionId: string;
|
|
1359
|
+
/** 对外词 = `GET /v1/runs/:id` 行上的 `status`。 */
|
|
1360
|
+
status: RunStatus;
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* S-173(K-24;server ≥7.104.0)—— 同步提交撞 park 时叠在结果上的 **poll 回执三键**(修前 park 体的全部内容,值逐字不变;
|
|
1364
|
+
* 与 server `http/sync-submit-body.ts` 的同名接口逐键同、同继承 {@link SyncRunReceipt},测试对拍):`status` 收窄到 park 两词。
|
|
1365
|
+
*/
|
|
1366
|
+
export interface SyncParkReceipt extends SyncRunReceipt {
|
|
1351
1367
|
/** 对外词 = `GET /v1/runs/:id` 行上的 `status`(park 两词之一)。 */
|
|
1352
1368
|
status: ParkedRunStatus;
|
|
1353
1369
|
}
|
|
1354
1370
|
/**
|
|
1355
|
-
* `POST /v1/tasks`(非流式)
|
|
1356
|
-
*
|
|
1357
|
-
* **一条规则**(server ≥7.104.0,契约 §5.0c):200 体**恒** = 结果本身(出口封口 + 脱敏后的引擎结果,即 {@link TaskResult});run
|
|
1358
|
-
* **停在门上**(`terminal.kind === "paused"`)时再叠 {@link SyncParkReceipt} 三键 —— 所以在 7.104.0 上 `status` **只在 park 时在场**,
|
|
1359
|
-
* 终局体不带它(不给终局造 `terminal.kind` 之外的第二真源)。同一次 park 在 `/v1/tasks/stream` 的 `done.result` 上除身份键外逐字相同;
|
|
1360
|
-
* 恢复凭据从不在体上(`paused.token` 摘掉)。
|
|
1361
|
-
*
|
|
1362
|
-
* ⚠️ **三代同一个型,如实登记**(本包支持地板 7.52.0 ⇒ 下面三代都还在支持面内或经账本回放可达;与 {@link TaskResult.terminal} 同款:型面按现行代声明,老代的差别写在这里,
|
|
1363
|
-
* 不把 `terminal` 做成可选去逼每个现行读点处理一个不存在的缺席分支):
|
|
1364
|
-
* · **server ≤7.63**:平面形(见 {@link LegacyPlaneTaskResult})—— `status` 是**终局词**(`completed` / `failed` / `blocked` /
|
|
1365
|
-
* park 两词),**没有** `terminal`,码在退役平面键(`r["errorCode"]` 经开集索引读);
|
|
1366
|
-
* · **7.64–7.103**:终局体 = 现行 `terminal` 形、无 `status`;**park 体只有**回执三键 `{ taskId, sessionId, status }`(`terminal` /
|
|
1367
|
-
* `stats` 运行期缺席);
|
|
1368
|
-
* · **≥7.104**:上面那条规则。
|
|
1369
|
-
* ⇒ 所以 `status` 的词 = park 两词 ∪ ≤7.63 平面词(`LegacyPlaneTaskResult["status"]`,本包对那一代的既有声明,不另抄一份)。
|
|
1370
|
-
* **三代通用读法**(测试 `server-7104-wire` ④bis 三代样例都编译得过、读得对):
|
|
1371
|
-
* ```ts
|
|
1372
|
-
* const r = await client.tasks.submit(req);
|
|
1373
|
-
* if (r.status === "suspended" || r.status === "needs_review") pollLater(r.taskId); // 三代都在 park 时带回执词
|
|
1374
|
-
* else if (r.terminal === undefined) legacyFlat(r.status, r["errorCode"]); // ≤7.63 平面形
|
|
1375
|
-
* else render(r.terminal); // ≥7.64
|
|
1376
|
-
* ```
|
|
1377
|
-
* 🔴 判代用 `r.terminal === undefined`,**别用** `"terminal" in r`:`terminal` 在型上是必填,`in` 的假支会被收成 `never`
|
|
1378
|
-
* (那一支里 `r.status` 编译不过)。
|
|
1371
|
+
* `POST /v1/tasks`(非流式)200 体的**引擎结果臂**(K-24;server 名 `SyncSubmitBody`,`http/sync-submit-body.ts` `buildSyncSubmitBody` 单点铸)。
|
|
1379
1372
|
*
|
|
1380
|
-
*
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1383
|
-
*
|
|
1384
|
-
*
|
|
1373
|
+
* 体 = 结果本身(出口封口 + 脱敏后的引擎结果,即 {@link TaskResult});run **停在门上**(`terminal.kind === "paused"`)时再叠 {@link SyncParkReceipt} 三键(server ≥7.104.0,契约 §5.0c)——
|
|
1374
|
+
* 所以 `status` **只在 park 时在场**、只取 park 两词,终局体不带它(不给终局造 `terminal.kind` 之外的第二真源)。同一次 park 在 `/v1/tasks/stream` 的
|
|
1375
|
+
* `done.result` 上除身份键外逐字相同;恢复凭据从不在体上(`paused.token` 摘掉)。server ≥7.142.0 起,同键重放一条**有结果**的行就是这只信封 + `replay: true`。
|
|
1376
|
+
*
|
|
1377
|
+
* 别的代不在本型上,在 {@link SyncSubmitOutcome} 的另两臂:server ≤7.63 答平面形 {@link LegacyPlaneTaskResult}(没有 `terminal`);7.64.0–7.103.x 的 park 只答
|
|
1378
|
+
* 回执三键({@link SyncReceiptBody},没有 `stats`)。判形读 {@link SyncSubmitOutcome} 的注。
|
|
1385
1379
|
*/
|
|
1386
1380
|
export interface SyncSubmitResult extends TaskResult {
|
|
1387
|
-
/**
|
|
1388
|
-
status?: ParkedRunStatus
|
|
1381
|
+
/** park 时的回执词(两词之一);终局体缺席。 */
|
|
1382
|
+
status?: ParkedRunStatus;
|
|
1383
|
+
/** server ≥7.125.0:只在同键重放体上在场,恒 `true`(从不发 `false`)。只说「这是重放」,不说形。 */
|
|
1384
|
+
replay?: true;
|
|
1389
1385
|
}
|
|
1390
1386
|
/**
|
|
1391
1387
|
* `abortCause` 的闭集三词(server ≥7.112.0 / S-947;契约 §5.0d)—— **谁让这条 run 停下来**:server 发起的中止的机读成因。每个词有一个真站点:
|
|
@@ -1506,15 +1502,23 @@ export interface TaskResult {
|
|
|
1506
1502
|
* 成本/总览面板据此知"哪个模型跑的"。live 实测引擎真回传(@sema-agent/server 1.3.0+)。 */
|
|
1507
1503
|
model?: string;
|
|
1508
1504
|
/** Present when the task was run behind the verify gate.
|
|
1509
|
-
* ⚠️ This type declares only `verdict` / `rounds` / `findings
|
|
1505
|
+
* ⚠️ This type declares only `verdict` / `rounds` / `findings` (and, server ≥7.143.0, `allowanceExhausted`). The engine's outcome can carry more on the wire
|
|
1510
1506
|
* (`unverifiedReason`, and `verifierPause` when the verifier itself paused); they are not typed here yet.
|
|
1511
1507
|
* From server 7.141.0 on, `verifierPause` never carries the verifier session's resume credential `checkpointToken`
|
|
1512
1508
|
* outward (the exit seal strips it on every outward path, the same seal as the run's own pause token); a ≤7.140.x
|
|
1513
|
-
* server could still send it. Do not read, store or forward a `checkpointToken` found under `verification`.
|
|
1509
|
+
* server could still send it. Do not read, store or forward a `checkpointToken` found under `verification`.
|
|
1510
|
+
* 🔴 server ≥7.142.0:`findings` 的每一条与 `evidence` 过本服务的结果脱敏器(与 `result` 同一只)—— 认出的凭据片段换成 `«redacted…»` 记号,条数与顺序不变,判词 / 轮数逐字;
|
|
1511
|
+
* 升级前落盘的存量行在读面上同样脱。按条数与判词分支照旧,逐字比对 / 存档原文的要改按记号之外的文本比。 */
|
|
1514
1512
|
verification?: {
|
|
1515
1513
|
verdict: "PASS" | "FAIL" | "PARTIAL" | "unverified";
|
|
1516
1514
|
rounds: number;
|
|
1517
1515
|
findings: string[];
|
|
1516
|
+
/** server ≥7.143.0(core 7.61.0 `AllowanceExhausted`)—— 任务的上限封住整个实现侧(实现腿与各轮修复合计):某条轴已花光 ⇒ 不再派修复,判词停在那次 `FAIL`,带本键点名那条轴。
|
|
1517
|
+
* `remaining` 在场即余额(花光时 `0`);前面有一腿没报价而任务带美元上限 ⇒ 美元轴余额算不出,读作没有余额(`axis: "cost"`,不带 `remaining`)。缺席 = 没有轴花光(或老 server:那一代每轮修复整份重拿上限)。 */
|
|
1518
|
+
allowanceExhausted?: {
|
|
1519
|
+
axis: "cost" | "tokens" | "turns";
|
|
1520
|
+
remaining?: number;
|
|
1521
|
+
};
|
|
1518
1522
|
};
|
|
1519
1523
|
/** [1543] SDK-M 补键(core 真域逐字,engine 一直在发、此前封闭接口读不到):
|
|
1520
1524
|
* salvagedOutput = degenerate/timeout 终态抢救出的最后模型文本(render as partial);
|
|
@@ -1800,6 +1804,11 @@ export interface ModelPlane {
|
|
|
1800
1804
|
catalog: "absent" | "adopted" | "refused" | (string & {});
|
|
1801
1805
|
refusalCode?: "config.model_route_endpoint_missing" | "config.gateway_fallback_without_primary" | (string & {});
|
|
1802
1806
|
gap?: "endpoint_missing" | "lane_credential_missing" | (string & {});
|
|
1807
|
+
/** server ≥7.143.0 —— **最新到达的目录候选**被模型面组拒的码(在场 ⇔ 那一份被组拒;值 = 契约包 `MODEL_PLANE_REFUSAL_CODES` 之一,**开集读**)。
|
|
1808
|
+
* `catalog: "refused"` 而本键缺席 ⇔ 最新到达的候选被候选判官整拒(读同一应答的 `candidateRejected`)。同一只路由判官的码可能同时出现在本键与 {@link refusalCode}:
|
|
1809
|
+
* 本键指最新到达的候选目录,那一键指此刻在服的那张表。要问「最新候选落没落」读 `/health` 的世代账。
|
|
1810
|
+
* (同版起 `catalog: "refused"` 的模型面那一半改读最新到达的候选:更新的候选到了而没走到模型面那一判时,旧候选的组拒不再让 `catalog` 答 `refused`。) */
|
|
1811
|
+
planeRefusalCode?: "config.default_model_missing" | "config.model_refused_name_minted" | "config.model_route_endpoint_missing" | "config.gateway_fallback_without_primary" | "config.catalog_replaces_env_models" | (string & {});
|
|
1803
1812
|
}
|
|
1804
1813
|
/**
|
|
1805
1814
|
* `GET /v1/models` 顶层 `candidateRejected`(server ≥7.126.0;**additive,present-iff**):**最近一次配置候选被候选判官整拒的结论**。
|
|
@@ -2591,27 +2600,17 @@ export interface RunRecord {
|
|
|
2591
2600
|
* 续跑认领会把旗清零(撞上 suspend 的取消不许在恢复之后再杀一遍)。⇒ **别**把 `cancelRequested` 翻回 `false` 读成「取消完成」—— 等终态 `status` + `errorCode:"cancelled"`。
|
|
2592
2601
|
* `POST /v1/runs/:id/cancel` 的受理体带同一个键({@link CancelAck.cancelRequested},同一个谓词)。< 7.73.0 缺席。 */
|
|
2593
2602
|
cancelRequested?: boolean;
|
|
2594
|
-
/** 🔴 server ≥7.125.0(additive;契约 §0.7)—— **提交幂等重放体的判别位**:只在 `POST /v1/tasks` 的 200 重放体与 `POST /v1/tasks/stream` 的 `done.result` 重放体上在场(值恒 `true`,见 {@link RunReplayRecord}),
|
|
2595
|
-
* `GET /v1/runs/:id` 与 `GET /v1/runs?idempotencyKey=` 上**缺席**(那是读面本身),从不发 `false`。按 `replay === true` 分流;结果读 `result`(嵌套的 {@link TaskResult})。 */
|
|
2596
|
-
replay?: true;
|
|
2597
2603
|
}
|
|
2598
2604
|
/**
|
|
2599
|
-
*
|
|
2600
|
-
*
|
|
2601
|
-
*
|
|
2602
|
-
*
|
|
2603
|
-
*
|
|
2604
|
-
* 🔴 **它不是 {@link TaskResult}**:首答是引擎结果(`terminal` / `stats` 在顶层,`result` 是字符串),重放时手里只有行 ⇒ 体是行读面:`result` 是**嵌套**的 {@link TaskResult}(或在 run 还没有结果时缺席),
|
|
2605
|
-
* **没有**顶层 `terminal` / `stats`,也**没有** `wiringManifest`(起手接线回执是首帧的活捕获、不落行)与 `notice`。判别位 `replay === true`(两形不会同时匹配)。
|
|
2606
|
-
* 在飞合流(同进程里同键的并发请求)到的那一份不是重放:与首答逐字节同体、**没有** `replay` 键。
|
|
2607
|
-
*
|
|
2608
|
-
* 流式腿的一个窄形:这条腿**已开流之后**才发现命中(建行那一刻撞上另一副本先落的行)时,已发出的 `x-task-id` 头 / `meta` 帧带的是本腿现铸、没建成的那枚 id —— 终帧重放体里的 `taskId` 才是命中的那条 run 的真 id,以终帧为准。
|
|
2609
|
-
*
|
|
2610
|
-
* 只有**建得出行**的提交才有行可放:要有 run 店,且 `POST /v1/tasks` / `/v1/tasks/stream` 带 `sessionId`(`POST /v1/runs` 恒建行);没有行的提交落定之后同键重试会再跑一遍。
|
|
2611
|
-
* 重放体读不到(属主不符 / 键指向别的行)⇒ 409 `conflict.run_exists`({@link import("./errors.js").ConflictError},体里不回显那一行的任何标识)。
|
|
2605
|
+
* 同步体的 **run 回执臂**(手里没有引擎结果 ⇒ 体 = {@link SyncRunReceipt} 三键,去 `GET /v1/runs/:taskId` 读行)。三个生产者:
|
|
2606
|
+
* · 7.64.0–7.103.x 的 park(那一代 park 体只有这三键);
|
|
2607
|
+
* · server ≥7.142.0 的同键重放,行上还**没有**结果(还在跑;或失联 —— 失联行的 `status` 读作 `failed`),带 `replay: true`;
|
|
2608
|
+
* · server 7.125.0–7.141.x 的同键重放:那一代回的是行读面 + `replay: true` —— 三键的超集、没有 `stats`,落在本臂;读法同样是读三键、再去读行
|
|
2609
|
+
* (那一代的读面键这里不声明:本型只承诺三键,别的键在旧字节上可能在,要读就显式按开集读)。
|
|
2612
2610
|
*/
|
|
2613
|
-
export interface
|
|
2614
|
-
|
|
2611
|
+
export interface SyncReceiptBody extends SyncRunReceipt {
|
|
2612
|
+
/** server ≥7.125.0:只在同键重放体上在场,恒 `true`。 */
|
|
2613
|
+
replay?: true;
|
|
2615
2614
|
}
|
|
2616
2615
|
/**
|
|
2617
2616
|
* **提交在 SSE 已开流之后被拒**时的 `done.result`(`POST /v1/tasks/stream`)—— 状态行已经发出,拒绝只能编码成终帧的三键 `{ status: "failed", errorCode, errorMessage }`
|
|
@@ -2628,37 +2627,44 @@ export interface SubmitRefusalDoneResult {
|
|
|
2628
2627
|
errorCode: string;
|
|
2629
2628
|
errorMessage: string;
|
|
2630
2629
|
}
|
|
2631
|
-
/**
|
|
2630
|
+
/** 两只拒绝臂在 wire 上没有 `replay` 键;联合里给它们补上「`replay` 读得出、恒缺席」,于是 `r.replay` 在每一臂上都读得出
|
|
2631
|
+
* (各臂接口本身不声明 `replay`——它们镜像 wire 键)。 */
|
|
2632
2632
|
type NotReplay = {
|
|
2633
2633
|
replay?: undefined;
|
|
2634
2634
|
};
|
|
2635
|
+
/** 平面形({@link LegacyPlaneTaskResult})在同步体上可带的重放标:server ≥7.142.0 同键重放一条**行上存的是平面形结果**的 run(≤7.63 写下的行;
|
|
2636
|
+
* 读盘面原样交回,不改形)⇒ 体 = 那份平面形 + `replay: true`。接口本身不声明 `replay`(它也是 `RunRecord.result` 的读盘形),只在同步体联合里补上。 */
|
|
2637
|
+
type LegacyReplayMark = {
|
|
2638
|
+
replay?: true;
|
|
2639
|
+
};
|
|
2635
2640
|
/**
|
|
2636
|
-
* `POST /v1/tasks
|
|
2637
|
-
* ·
|
|
2638
|
-
* ·
|
|
2639
|
-
*
|
|
2641
|
+
* `POST /v1/tasks`(同步腿)200 体的**可判别联合**(32.0.0)—— **一条规则**(server ≥7.142.0):**手里有没有引擎结果**。
|
|
2642
|
+
* · 有(`"stats" in r`)⇒ 引擎结果:{@link SyncSubmitResult}(停在门上再叠回执三键;`"terminal" in r` 不成立 ⇒ server ≤7.63 的平面形 {@link LegacyPlaneTaskResult});
|
|
2643
|
+
* · 没有 ⇒ run 回执三键 {@link SyncReceiptBody}:去 `GET /v1/runs/:taskId` 读行。
|
|
2644
|
+
* 同键重放(server ≥7.125.0)= 首答的信封 + `replay: true`(server ≥7.142.0;行上有结果 ⇒ 引擎结果 —— 行上存的是 ≤7.63 的平面形就是平面形,没有 ⇒ 回执三键)。`replay: true` 只说「这是同键重放」,不说形。
|
|
2645
|
+
* server 7.125.0–7.141.x 的重放体是行读面 + `replay: true`:没有 `stats`,落回执臂 —— 读三键、再读行,正是它该有的读法。
|
|
2640
2646
|
* ```ts
|
|
2641
2647
|
* const r = await client.tasks.submit(req);
|
|
2642
|
-
* if (
|
|
2643
|
-
* else
|
|
2648
|
+
* if (!("stats" in r)) pollLater(r.taskId, r.status); // run 回执:GET /v1/runs/:taskId
|
|
2649
|
+
* else if (!("terminal" in r)) legacyFlat(r.status); // ≤7.63 平面形
|
|
2650
|
+
* else render(r.terminal); // 引擎结果(park 时 r.status 是 park 词)
|
|
2644
2651
|
* ```
|
|
2652
|
+
* 同进程里同键的**并发**请求被合流到的那一份不是重放:与首答逐字节同体、没有 `replay` 键。
|
|
2645
2653
|
*/
|
|
2646
|
-
export type SyncSubmitOutcome =
|
|
2654
|
+
export type SyncSubmitOutcome = SyncSubmitResult | (LegacyPlaneTaskResult & LegacyReplayMark) | SyncReceiptBody;
|
|
2647
2655
|
/**
|
|
2648
|
-
*
|
|
2649
|
-
* · {@link
|
|
2650
|
-
* · {@link ActiveRunConflictDoneResult} —— 会话已有活跃 run
|
|
2651
|
-
* · {@link LegacyPlaneTaskResult} —— 只在 durable 账本回放腿上、跨 7.64.0 升级过的部署:升级前落盘的旧平面形;
|
|
2652
|
-
* · {@link RunReplayRecord} —— server ≥7.125.0 同键重放(该 run 已落行):读面 + `replay: true`;
|
|
2656
|
+
* 流式提交(`POST /v1/tasks/stream`)终帧 `done.result` 的**可判别联合**(`AgentEvent` 的 `done` 臂读它)—— spec `Event_done.result` 的 `oneOf` 同表:
|
|
2657
|
+
* · {@link SyncSubmitOutcome} —— 一条 run 的结果,与同步体同三臂(durable 账本回放腿上、跨 7.64.0 升级过的部署可能读到平面形);
|
|
2658
|
+
* · {@link ActiveRunConflictDoneResult} —— 会话已有活跃 run 的拒绝信封(`conflict.session_active_run`,必带 `activeTaskId`);
|
|
2653
2659
|
* · {@link SubmitRefusalDoneResult} —— 开流后才被拒的 `{status:"failed", errorCode, errorMessage}`。
|
|
2654
|
-
*
|
|
2655
|
-
*
|
|
2660
|
+
* **窄化顺序**(按键分家,server ≥7.142.0 起同键重放也是首答的信封):`"stats" in r` ⇒ 引擎结果(再按 `"terminal" in r` 分现行因由形与平面形);`"activeTaskId" in r` ⇒ 会话占用冲突;
|
|
2661
|
+
* `"taskId" in r` ⇒ run 回执(去读行);其余 ⇒ 拒绝三键。帧上的 `replay: true` 与 `result.replay` 都只说「这是重放」,不说形。
|
|
2656
2662
|
* 🔴 **在飞合流的拒绝(server ≥7.125.0 起与首发同形)**:同进程在飞合流的跟随方,若**首请求被拒**(会话占用 409 / `conflict.run_exists` / device 放置拒 / 同步腿零工作拒),`done.result` 与首发那一帧是**同一只投影**
|
|
2657
|
-
* (会话占用 ⇒ 冲突臂,其余 ⇒ 拒绝三键),帧上带 `replay: true`、`result` 上没有 ——
|
|
2658
|
-
* **≤7.124.x** 的跟随方拿到的是首请求的 **JSON 拒绝体原样**(键是 `error` / `errorCode` / …,**没有** `status` / `errorMessage`)
|
|
2663
|
+
* (会话占用 ⇒ 冲突臂,其余 ⇒ 拒绝三键),帧上带 `replay: true`、`result` 上没有 —— 按 `errorCode` 判、`errorMessage` 读句子即可。
|
|
2664
|
+
* **≤7.124.x** 的跟随方拿到的是首请求的 **JSON 拒绝体原样**(键是 `error` / `errorCode` / …,**没有** `status` / `errorMessage`),不在这些臂的形里:带 `activeTaskId` 的会落进冲突臂的窄化却读不到 `errorMessage`。
|
|
2659
2665
|
* 老 server 的读法:拒绝类终帧一律先按 `errorCode` 判,`errorMessage` 缺席时回落读 `error` —— 这条回落分支只为 ≤7.124.x,支持底线抬过 7.124.x 之后可删。
|
|
2660
2666
|
*/
|
|
2661
|
-
export type DoneFrameResult =
|
|
2667
|
+
export type DoneFrameResult = SyncSubmitOutcome | (ActiveRunConflictDoneResult & NotReplay) | (SubmitRefusalDoneResult & NotReplay);
|
|
2662
2668
|
/** Run list item (`GET /v1/tasks` items) — the live cheap `runSummary` shape (service Drift 1).
|
|
2663
2669
|
* NOTE wire names: `id` (not taskId), `startedAt` (not createdAt), `costMicroUsd` (micro-USD); no sessionId. */
|
|
2664
2670
|
export interface TaskSummary {
|
|
@@ -4669,6 +4675,10 @@ export interface Capabilities extends EngineCapabilityBits {
|
|
|
4669
4675
|
/** server ≥7.133.0:请求 `settings.hooks[]` 的**组来源**键 `source`(托管 / 非托管车道:`managedPolicy` / `managedPlugin:<name>` 跑在独立托管车道)这台部署受不受理——与 {@link hooks} 同一谓词。
|
|
4670
4676
|
* 见位才给组标 `source`;位缺席 / `false` = 静默剥掉(托管车道语义不生效,不是拒)。 */
|
|
4671
4677
|
managedHookGroups?: boolean;
|
|
4678
|
+
/** server ≥7.142.0:请求 {@link import("./settings.js").SemaSettings.allowedHttpHookUrls} / {@link import("./settings.js").SemaSettings.httpHookAllowedEnvVars}(契约包 http hook 两张名单)这台部署读不读、
|
|
4679
|
+
* 在 http 条目**拨出之前**执行不执行 —— 与 {@link hooks} **同一谓词**(单用户真;多租户 `settings.hooks` 整只被忽略 ⇒ 假)。
|
|
4680
|
+
* **见位才发**:位缺席 = 老 server(≤7.141.x),两键是集外键 ⇒ 新提交答 `400 request.body_shape`。 */
|
|
4681
|
+
httpHookAllowlists?: boolean;
|
|
4672
4682
|
/** server ≥7.133.0:**只收紧座位表**恒受理——请求 `settings.readDenyPatterns` / `settings.writeProtectedExtra` / `settings.complianceAdditionalDenies` / `settings.permissions.neverAuto` 四键
|
|
4673
4683
|
* (见 {@link SemaSettings} 对应成员):每座 = 部署表 ∪ 请求列表,**只增不减**,空数组 ≡ 没送。恒 `true`;**位缺席 = 老 server —— 对这四键答 400 `request.body_shape`,见位才发**。 */
|
|
4674
4684
|
tightenOnlySeats?: boolean;
|
|
@@ -4699,6 +4709,10 @@ export interface Capabilities extends EngineCapabilityBits {
|
|
|
4699
4709
|
* 层的读法见 {@link import("./settings.js").SettingsPermissions.deny})。不随部署形变(单用户与多租户两形同值)。
|
|
4700
4710
|
* **见位才发**:位缺席 = 老 server —— 带层条目新提交 400、续跑 409(响亮拒,不静默读丢),只发纯串。 */
|
|
4701
4711
|
layers?: boolean;
|
|
4712
|
+
/** server ≥7.143.0 · **恒真的版本位**:请求 `settings.permissions.allow` 也受理带出处层的条目 `{ rule, layer }`(与 `deny` / `ask` 同一只条目型,{@link import("./settings.js").SettingsPermissions.allow};
|
|
4713
|
+
* `userSettings` 层要根的规则读在执行环境的配置根上)。与 {@link layers} 同一只对象、同一条读法:不随部署形变。
|
|
4714
|
+
* **见位才发**:位缺席 = 老 server —— allow 桶的带层条目新提交 400、续跑 409,只发纯串。 */
|
|
4715
|
+
layeredAllow?: boolean;
|
|
4702
4716
|
/** server ≥7.133.0:**这位调用方**的信任档(按调用方、按凭据读,**不是**版本位)—— 请求里「不经人答就生效」的规则表(`settings.permissions` 各桶、被按名点用的自带技能的 `allowedTools` / `disallowedTools`)按它准入:
|
|
4703
4717
|
* `allow` 放宽免问面,要 `global`;`deny` / `ask` 只收紧,任何档都收。取值:`global`(单用户 turnkey;多租户持部署 service 凭据;多租户登录令牌的 scope 角色 ≥ 治理域写角色)/ `project`
|
|
4704
4718
|
* (其余:低角色 / 无角色令牌 / 直连门 principal 令牌 / 没验过的凭据)。**开集读**:词表属主在契约包(`MinTrust`),不认识的词按 `project` 处置(fail-closed)。
|
|
@@ -4843,6 +4857,11 @@ export interface Capabilities extends EngineCapabilityBits {
|
|
|
4843
4857
|
* live `respond` 静默丢 + 200,照老形发(不带这只键)。与 {@link approvalDecisionNote} 同族:只答「这个二进制认识这个键」,不挂设施谓词。
|
|
4844
4858
|
*/
|
|
4845
4859
|
approvalDecidedBy?: boolean;
|
|
4860
|
+
/**
|
|
4861
|
+
* server ≥7.143.0(`routes/capabilities.ts` 的能力对象**硬编码 true**,恒真的版本位,与 {@link approvalDecidedBy} 同族)—— 四条决定口(live `respond`、耐久 ask 账、耐久 `decide`、`plan_review`)
|
|
4862
|
+
* 收决定体的出处座位 `decidedVia`({@link import("./resources/approvals.js").ApprovalDecidedVia};只许在 `decidedBy: "policy"` 旁)。**见位才发**:位缺席 = 老 server(对它 400 或静默丢)。
|
|
4863
|
+
*/
|
|
4864
|
+
approvalDecidedVia?: boolean;
|
|
4846
4865
|
/**
|
|
4847
4866
|
* server ≥7.120.0(`routes/capabilities.ts` 的能力对象**硬编码 true**,恒真的谓词类位,与 {@link approvalDecidedBy} 同族)—— 会话**历史读面**
|
|
4848
4867
|
* (`GET /v1/sessions/:id` 的 `messages[]`,各种取法)与 live 帧、账本帧走**同一只脱敏**:密钥形读成 `«redacted:…»` 占位(行为见 `sessions.get` 注)。
|
|
@@ -5039,6 +5058,18 @@ export interface Capabilities extends EngineCapabilityBits {
|
|
|
5039
5058
|
* ⇒ 四口 501 `capability.memory_optout_grant_required`)。
|
|
5040
5059
|
* 🔴 位为假时是 **501**(换部署形态),与 {@link memoryConsolidationDriver} 的 404(开旋钮)分家。 */
|
|
5041
5060
|
memoryOptOutGrant?: boolean;
|
|
5061
|
+
/** 🔴 server ≥7.142.0:会话记忆同步触发口 `POST /v1/sessions/:id/memory/sync`({@link import("./resources/sessions.js").SessionsResource.syncMemory},`sessions.syncMemory`)这台部署有没有 ——
|
|
5062
|
+
* 要三件同时在:本机同步腿(file 记忆引擎 + `MEMORY_SYNC_URL`)、持久 run 店、会话归属面。位为 `false` 时口答 501(缺哪件答哪只码:`feature.memory_sync_disabled` /
|
|
5063
|
+
* `capability.run_store_required` / `capability.session_ownership_required`)。**见位才调**;位缺席 = 老 server(口不存在)。 */
|
|
5064
|
+
sessionMemorySync?: boolean;
|
|
5065
|
+
/** 🔴 server ≥7.142.0:**记忆同步中心**的身份位 —— `{ identity }` ⇔ 这台是 DB 记忆平面(`MEMORY_ENGINE_BACKEND=pg|mysql`)的中心、有同步执行位、且运维声明了同步身份 `MEMORY_SYNC_SERVE_IDENTITY`;
|
|
5066
|
+
* 否则 `false`(不是中心,或没声明身份 —— 后者的同步口答 501 `feature.memory_sync_serve_disabled`)。复合位(server 复合成员表 `memorySyncServe: ["identity"]`),没有 `true` 这个值。
|
|
5067
|
+
* `identity` = 客户端到达本中心同步口用的基址的**规范形**(小写协议与主机、无缺省端口、无尾斜杠、无查询 / 片段 / 凭据),逐字:本机壳把它原样作为 `sessions.syncMemory` 的 `target`
|
|
5068
|
+
* (「会话要去的那台引擎」);中心侧同步口拿入站 `peer` 按串与它比。位缺席 = 老 server。 */
|
|
5069
|
+
memorySyncServe?: false | MemorySyncServeCapability;
|
|
5070
|
+
/** 🔴 server ≥7.142.0:导出读面 `GET /v1/memory/export`({@link import("./resources/memory.js").MemoryResource.exportScope},`memory.exportScope`)在不在(DB 记忆平面才有)。
|
|
5071
|
+
* 位为 `false` ⇒ 口答 501 `capability.memory_store_required`。本版起该 501 读能力事实,不再读后端名。位缺席 = 老 server。 */
|
|
5072
|
+
memoryExport?: boolean;
|
|
5042
5073
|
/**
|
|
5043
5074
|
* server ≥7.119.0(`routes/capabilities.ts` 的能力对象,值 = 引擎 `PERMISSION_MODES` **全集**,引擎序)—— 这台 worker 的请求面**收的权限模式词**:今天六词
|
|
5044
5075
|
* `default` / `acceptEdits` / `plan` / `auto` / `bypassPermissions` / `dontAsk`。顶层 {@link TaskRequest.permissionMode}、`settings.permissions.defaultMode`、
|
|
@@ -5593,7 +5624,11 @@ export interface ScenarioSkill {
|
|
|
5593
5624
|
* 三族行形与决议路由各不相同,**分数组不混编**(数组名即路由判据)。
|
|
5594
5625
|
*/
|
|
5595
5626
|
export interface PendingList {
|
|
5596
|
-
|
|
5627
|
+
/** 决断口是 `POST /v1/approvals/:id/decide` 的**全部**行 —— server ≥7.143.0 起两族(每一行自报族名 `kind`,闭集 {@link APPROVAL_QUEUE_KINDS}):
|
|
5628
|
+
* 停驻门 {@link PendingCheckpoint}(`kind: "checkpoint"`;门的 `:id` = 行的 `sessionId`,决断 {@link import("./resources/approvals.js").ApprovalsResource.decide})·
|
|
5629
|
+
* 被扣的跨会话来信 {@link PeerInboundPendingRow}(`kind: "peer_inbound"`;门的 `:id` = 行的 `id`,决断 {@link import("./resources/approvals.js").ApprovalsResource.decidePeerInbound})。
|
|
5630
|
+
* 🔴 **先按 `kind` 分支,再读那一族的键**(门的 `:id` 读 {@link import("./resources/approvals.js").approvalDoorIdOf});不认识的 `kind` 跳过该行、不要拿它去决断。≤7.142.x 的 server 只有停驻门、行上不带 `kind`。 */
|
|
5631
|
+
pending: Array<PendingCheckpoint | PeerInboundPendingRow>;
|
|
5597
5632
|
serverNowMs?: number;
|
|
5598
5633
|
livePending?: LivePendingRow[];
|
|
5599
5634
|
crashConverged?: CrashConvergedRow[];
|
|
@@ -5612,7 +5647,9 @@ export interface CrashConvergedRow {
|
|
|
5612
5647
|
expiresAtMs: number;
|
|
5613
5648
|
/** 判别常量:这张卡**已不可再决**。 */
|
|
5614
5649
|
decision: "denied";
|
|
5615
|
-
/** 成因(决断口 410 `gone.ask` 体的 `cause` 是同一个词):`crashed_before_park` = 进程崩了;`shutdown_before_park`(server ≥7.108.0)= 腿被有序关停截断。
|
|
5650
|
+
/** 成因(决断口 410 `gone.ask` 体的 `cause` 是同一个词):`crashed_before_park` = 进程崩了;`shutdown_before_park`(server ≥7.108.0)= 腿被有序关停截断。
|
|
5651
|
+
* 🔴 server ≥7.142.0(local 车道;键与闭集不变,值变):有序关停截断、收尾结束时仍未结清的**后台 / 委派子代**卡此前在这里读 `crashed_before_park`(审计账的关停记号按腿落、子代卡的腿不在视野里),
|
|
5652
|
+
* 现在读 `shutdown_before_park` —— 有序关停是进程的事实,三个读面一个词;上一版已收敛过的组升级后照新规则重投影(终态问账行不改写,历史问上两处的词可能不同)。两词处置相同。 */
|
|
5616
5653
|
cause: Extract<import("./errors.js").AskRowEndingCause, "crashed_before_park" | "shutdown_before_park">;
|
|
5617
5654
|
/** `pending` = 工具零执行可机械证明;`decided` = 人当时已答、可能有半截副作用。 */
|
|
5618
5655
|
orphanState: "pending" | "decided";
|
|
@@ -5623,6 +5660,63 @@ export interface CrashConvergedRow {
|
|
|
5623
5660
|
/** pending 臂 = 续跑(引擎的 resume 补偿腿)安全,壳可默认自动续;decided 臂 = 留人工确认。 */
|
|
5624
5661
|
resumeSafe: boolean;
|
|
5625
5662
|
}
|
|
5663
|
+
/**
|
|
5664
|
+
* 运维审批队列 `pending[]` 的**行族闭集**(server ≥7.143.0;server `approval-queue-kind.ts` 的 `APPROVAL_QUEUE_KINDS`,逐词同序)—— 同一扇决断门(`POST /v1/approvals/:id/decide`)后面是哪一种卡:
|
|
5665
|
+
* · `checkpoint` —— 停驻门(durable park):行 = {@link PendingCheckpoint},门的 `:id` = 行的 `sessionId`;
|
|
5666
|
+
* · `peer_inbound` —— 被扣住、等收信方审的跨会话来信:行 = {@link PeerInboundPendingRow},门的 `:id` = 行的 `id`(`peer_inbound:` 前缀)。
|
|
5667
|
+
* `/v1/approvals/stream` 的 `pending` / `resolved` 帧同带 `kind`。加一族 = server 下一版 + 本表同批加员(同源锚当场红)。
|
|
5668
|
+
*/
|
|
5669
|
+
export declare const APPROVAL_QUEUE_KINDS: readonly ["checkpoint", "peer_inbound"];
|
|
5670
|
+
/** {@link APPROVAL_QUEUE_KINDS} 的成员型。 */
|
|
5671
|
+
export type ApprovalQueueKind = (typeof APPROVAL_QUEUE_KINDS)[number];
|
|
5672
|
+
/** `peer_inbound` 族决断门 id 的前缀(server `PEER_INBOUND_ID_PREFIX`)—— 一个 id 是不是这一族**只**看它(停驻门的 id 是会话 id,不含 `:`,两族 id 空间不交)。 */
|
|
5673
|
+
export declare const PEER_INBOUND_ID_PREFIX = "peer_inbound:";
|
|
5674
|
+
/** `peer_inbound` 行的投递车道(server `org-delivery-gate.ts` 的 `PEER_INBOUND_LANES`):`session` = 收信会话自己的信箱 · `principal_inbox` = 收信主体的收件箱。 */
|
|
5675
|
+
export declare const PEER_INBOUND_LANES: readonly ["session", "principal_inbox"];
|
|
5676
|
+
/** {@link PEER_INBOUND_LANES} 的成员型。 */
|
|
5677
|
+
export type PeerInboundLane = (typeof PEER_INBOUND_LANES)[number];
|
|
5678
|
+
/**
|
|
5679
|
+
* `peer_inbound` 行的扣信成因 —— **只有收信人能答的那几因**(core `PEER_HELD_REVIEW_CAUSES`,逐词同序;server 只把这几因的卡投进审批席):
|
|
5680
|
+
* 发信方的权限档与收信方对不上 —— `mode-mismatch`(两档不同)· `no-mode-asserted`(发信方没声明档)· `invalid-mode-attestation`(声明读不成形)。
|
|
5681
|
+
* 部署策略扣下的信(`CROSS_SESSION_INBOUND=hold`)与设置类成因**不进**审批席:组织策略不由收信方逐封越过(server 列与决两面都不收)。
|
|
5682
|
+
*/
|
|
5683
|
+
export declare const PEER_INBOUND_HOLD_CAUSES: readonly ["mode-mismatch", "no-mode-asserted", "invalid-mode-attestation"];
|
|
5684
|
+
/** {@link PEER_INBOUND_HOLD_CAUSES} 的成员型。 */
|
|
5685
|
+
export type PeerInboundHoldCause = (typeof PEER_INBOUND_HOLD_CAUSES)[number];
|
|
5686
|
+
/**
|
|
5687
|
+
* 运维队列的**被扣跨会话来信**行(server ≥7.143.0;server `peer-inbound-face.ts` 的 `PeerInboundPendingRow`,键逐键同)。键全是 core 那只进程级 held 队列上那张卡的投影:
|
|
5688
|
+
* · `id` —— 决断门 `POST /v1/approvals/:id/decide` 的 `:id`(不透明串,`peer_inbound:` 前缀;原样回传,别解析);
|
|
5689
|
+
* · `recipientSessionId` —— 收信会话(刻意**不**叫 `sessionId`:那个名字在本数组里是停驻门的 `:id`,不分族的消费方会决到同会话的停驻卡上);
|
|
5690
|
+
* · `cause` / `lane` —— 扣信成因({@link PEER_INBOUND_HOLD_CAUSES})与投递车道;
|
|
5691
|
+
* · `content` / `fromName` —— 信的存储正文(`[summary] message`)与发信方显示名,**已过凭据脱敏**(显示面;按不可信文本渲);
|
|
5692
|
+
* · `fromSession` / `fromScope` —— 发信会话 / 跨主体投递的发信 scope,在场才带;
|
|
5693
|
+
* · `sentAt` / `heldAt` —— epoch ms。
|
|
5694
|
+
* **没有** `sessionId` / `toolCallId` / `riskDescriptor` / `deadline`(到期计时在 core 队列里,卡上不带;别按 `heldAt` 自算截止)。
|
|
5695
|
+
* 只有收信方本人列得出、决得了(operator 不多看:一封信是收信人的,不是运维治理面)。行是**本副本**的进程内投影(跨副本看不到,同 `livePending`)。
|
|
5696
|
+
*/
|
|
5697
|
+
export interface PeerInboundPendingRow {
|
|
5698
|
+
kind: "peer_inbound";
|
|
5699
|
+
id: string;
|
|
5700
|
+
recipientSessionId: string;
|
|
5701
|
+
lane: PeerInboundLane;
|
|
5702
|
+
cause: PeerInboundHoldCause;
|
|
5703
|
+
content: string;
|
|
5704
|
+
sentAt: number;
|
|
5705
|
+
heldAt: number;
|
|
5706
|
+
fromSession?: string;
|
|
5707
|
+
fromName?: string;
|
|
5708
|
+
fromScope?: string;
|
|
5709
|
+
}
|
|
5710
|
+
/** `peer_inbound` 族决断的结局词(server ≥7.143.0;core `PeerHeldSettleOutcome` 去 `gone` —— `gone` 不上 wire,它答 404)。`delivered` = 信已交到收信会话;其余照 core 的词义原样转。 */
|
|
5711
|
+
export declare const PEER_INBOUND_DECIDE_OUTCOMES: readonly ["delivered", "released_pending", "dropped", "dropped_by_policy", "denied", "expired", "decided_elsewhere"];
|
|
5712
|
+
/** {@link PEER_INBOUND_DECIDE_OUTCOMES} 的成员型。 */
|
|
5713
|
+
export type PeerInboundDecideOutcome = (typeof PEER_INBOUND_DECIDE_OUTCOMES)[number];
|
|
5714
|
+
/** `POST /v1/approvals/:id/decide` 的 `peer_inbound` 臂 200 体(server `PeerInboundDecideReply`,键逐键同):`outcome` = core `settle` 的答案原词。 */
|
|
5715
|
+
export interface PeerInboundDecideResult {
|
|
5716
|
+
kind: "peer_inbound";
|
|
5717
|
+
id: string;
|
|
5718
|
+
outcome: PeerInboundDecideOutcome;
|
|
5719
|
+
}
|
|
5626
5720
|
/** #315(server ≥7.43)—— `GET /v1/approvals` 信封第二顶层键 `livePending` 的行:streamApproval 窗内的
|
|
5627
5721
|
* **流内 ask**(此前对轮询消费端结构性不可见)。🔴 决议口=`POST /v1/tool-approvals/{id}/respond`,
|
|
5628
5722
|
* **不是** /decide(那是 durable 行的门)——数组名即路由判据,两数组不混编。可选旗标 only-if-true
|
|
@@ -5693,6 +5787,9 @@ export interface LivePendingRow {
|
|
|
5693
5787
|
* `live_pending` 帧、`GET /v1/tool-approvals/:id` 的 `pending` 臂同带这一位。重启后问账里仍待决的卡**回到** `livePending[]`(此前重启后卡不在列表、应答 404)。
|
|
5694
5788
|
*/
|
|
5695
5789
|
consumerState?: "absent";
|
|
5790
|
+
/** server ≥7.143.0 —— 起服从问账**接管**的行(见 {@link consumerState}),行上的问是本版之前铸的(卡信封里没有活面事实座)⇒ 顶层 `mandated` / `mandate` / `origin` 不带、带本键说「不知道」;
|
|
5791
|
+
* 与 {@link frame} 上的 `liveFactsUnknown` 同一个事实(那一格是重放帧,见 {@link import("./resources/tool-approvals.js").ApprovalRequestFrame.liveFactsUnknown})。恒 `true` 或缺席。 */
|
|
5792
|
+
liveFactsUnknown?: true;
|
|
5696
5793
|
}
|
|
5697
5794
|
/** S-02(server ≥7.52)—— decide 409 `approval_stale` 拒体的 additive 指路键 `currentPending`:本会话
|
|
5698
5795
|
* **当前** pending 的三件 D-1 坐标(与 §7b 队列行同名同形),壳一跳重定位免整队重拉。🔴 恒不含
|
|
@@ -5706,6 +5803,8 @@ export interface ApprovalStaleCurrentPending {
|
|
|
5706
5803
|
boundInputHash?: string;
|
|
5707
5804
|
}
|
|
5708
5805
|
export interface PendingCheckpoint {
|
|
5806
|
+
/** 行族名(server ≥7.143.0 恒 `"checkpoint"`;≤7.142.x 缺席 —— 那一代只有这一族)。见 {@link PendingList.pending}。 */
|
|
5807
|
+
kind?: "checkpoint";
|
|
5709
5808
|
/** The decide handle: POST /v1/approvals/:sessionId/decide. */
|
|
5710
5809
|
sessionId: string;
|
|
5711
5810
|
/** Principal / 多租户 owner scope; "_" = submitted without one. */
|
|
@@ -5817,6 +5916,9 @@ export interface PendingCheckpoint {
|
|
|
5817
5916
|
askClass?: AskClass;
|
|
5818
5917
|
/** K-37 扩项(server ≥7.109.0):这一 park 住的问属于的全部类(非空,首员 = {@link askClass});读整只集合。 */
|
|
5819
5918
|
classes?: AskClass[];
|
|
5919
|
+
/** server ≥7.143.0(core 7.61.0)—— **谁问的、为什么问**(park 行孪生座 `PendingAction.tool_approval.askReasons`,经 server `readAskReasons` —— 与活卡帧 / 卡面**同一只**窄读,逐字同值)。
|
|
5920
|
+
* 读法与缺席见 {@link import("./resources/tool-approvals.js").ToolApprovalFrame.askReasons}。 */
|
|
5921
|
+
askReasons?: import("./resources/tool-approvals.js").AskReason[];
|
|
5820
5922
|
/** S-30①(server ≥7.53;core 5.60.0 #438):**bidi 在场位** —— 这条 park 行的执行载荷里含至少一个
|
|
5821
5923
|
* DIRECTIONAL 格式控制符(Trojan Source:人眼读到的顺序 ≠ 真正执行的字节顺序)。值**完全由 core 供**
|
|
5822
5924
|
* (park mint 时 `PendingAction.hasBidiControls`,反范式成 durable 行的 `has_bidi_controls` 列;server
|
|
@@ -5828,7 +5930,10 @@ export interface PendingCheckpoint {
|
|
|
5828
5930
|
hasBidiControls?: true;
|
|
5829
5931
|
/** design/80 D-1 — the TWO binding values the human implicitly approves; the consumer reads them here and
|
|
5830
5932
|
* echoes them VERBATIM into `decide` (TOCTOU guard: "I'm approving THIS pending action, not one swapped in").
|
|
5831
|
-
*
|
|
5933
|
+
* 🔴 server ≥7.143.0: BOTH are REQUIRED in `decide` ({@link ApprovalDecision}; a missing one ⇒ 400 `decide_requires_binding` naming it in
|
|
5934
|
+
* `missingKeys`) and the server no longer fills either from the row parked now. A tool-approval row WITHOUT `boundInputHash` (parked before
|
|
5935
|
+
* the engine minted input digests — the pre-binding epoch) cannot be settled through `decide` at all: end it with `runs.cancel`, or let it
|
|
5936
|
+
* expire. (≤7.142.x filled a missing hash from the row parked at that moment.)
|
|
5832
5937
|
* = `toolCallId` of the action the human saw (the bound call). */
|
|
5833
5938
|
boundCallId?: string;
|
|
5834
5939
|
/** SERVER-MINTED OPAQUE sha256 over the pending action's args at mint time. Echo VERBATIM; NEVER recompute
|
|
@@ -6025,8 +6130,121 @@ export interface SessionSummary {
|
|
|
6025
6130
|
/** server ≥7.91.0(additive,老 server 缺席):会话活动词,由最近 run 的状态经 server 与 peer 目录**同一张**映射表派生
|
|
6026
6131
|
* (running → `active`;suspended / needs_review → `blocked`;无非终态 run → `idle`)。壳的会话列表 / peer 行 tempo 同源。 */
|
|
6027
6132
|
tempo?: "active" | "idle" | "blocked";
|
|
6133
|
+
/** 🔴 server ≥7.142.0(additive;契约 §17.2 订正)—— **这只会话的存档读不出**:present-iff 会话头的叶子读不出,值 {@link SessionUnreadable}(键闭集只有 `errorCode`)。
|
|
6134
|
+
* 只在文件后端(`DB_BACKEND=local`)上出现:会话头坏了 / 整份截在会话头半截 ⇒ `corrupt_session`;权限不对、I/O 故障 ⇒ `internal.error` —— 值 = 读口打开这只会话时答的那个码
|
|
6135
|
+
* (同一只会话的 `GET /v1/sessions/:id` 与 `…/head` 答 500 带同码)。此前这些会话从列表里**消失**;本版起照样列,行上的格出自会话行(属主 / 标题 / 置顶 / 时间 / `rowTag` / run 四位 / `tempo`,与好行同读),
|
|
6136
|
+
* `objectivePreview: null`(`?q=` 搜索不命中它们)。**出路**:按本键在场分支(灰显 / 提示读不出 / 只给删除);`DELETE /v1/sessions/:id` 对属主照常删;从留存副本恢复存档或修好权限后标记随之消失。
|
|
6137
|
+
* SQL 后端的行从不带它(叶子是会话行上一列,一行坏事件照旧在列表里)。缺席 = 读得出,或老 server(≤7.141.x 文件后端上这种会话不在列表里)。 */
|
|
6138
|
+
unreadable?: SessionUnreadable;
|
|
6028
6139
|
[k: string]: unknown;
|
|
6029
6140
|
}
|
|
6141
|
+
/** {@link SessionSummary.unreadable} 的值(server ≥7.142.0;server 自铸登记 `sessionsListRowUnreadableKey`,键闭集)。 */
|
|
6142
|
+
export interface SessionUnreadable {
|
|
6143
|
+
/** 读口打开这只会话时答的码:`corrupt_session`(会话头坏 / 截在头里)或 `internal.error`(I/O 级读不出)—— 与全局兜底答码同一张表。按码分支,开集串。 */
|
|
6144
|
+
errorCode: string;
|
|
6145
|
+
}
|
|
6146
|
+
/** {@link Capabilities.memorySyncServe} 在场形(server ≥7.142.0)。 */
|
|
6147
|
+
export interface MemorySyncServeCapability {
|
|
6148
|
+
/** 本中心声明的同步身份(`MEMORY_SYNC_SERVE_IDENTITY`,规范形)—— 逐字作 `sessions.syncMemory` 的 `target`。 */
|
|
6149
|
+
identity: string;
|
|
6150
|
+
}
|
|
6151
|
+
/** `sessions.syncMemory` 的请求体(server ≥7.142.0):**恰一键** `target`(多键 / 少键 ⇒ 400 `request.body_shape`)。 */
|
|
6152
|
+
export interface SessionMemorySyncRequest {
|
|
6153
|
+
/** 会话要去的那台引擎的同步身份 —— 那台 `GET /v1/capabilities` 上 `memorySyncServe.identity`,逐字。不是同步身份规范形 ⇒ 400 `request.field_invalid`(`field: "target"`,`reason` ∈ {@link import("./errors.js").MEMORY_SYNC_IDENTITY_FLAWS})。 */
|
|
6154
|
+
target: string;
|
|
6155
|
+
}
|
|
6156
|
+
/**
|
|
6157
|
+
* `sessions.syncMemory` 的 `409 conflict.session_memory_unobserved` 体的 `reason`(server ≥7.143.0 **恒在场**;server 自铸登记 `sessionMemoryUnobservedReason`,**判序 = 读的先后**):
|
|
6158
|
+
* 读集照旧只读会话**最近一条已结 run** 的记忆观测,不往更早的 run 找;读集取不到时按这五词说为什么 ——
|
|
6159
|
+
* · `no_settled_run` —— 会话还没有已结 run;
|
|
6160
|
+
* · `run_result_missing` —— 最近一条已结 run 的记录里没有结果(实例丢了被收割、停驻过期被收割,或在引擎答出之前抛);
|
|
6161
|
+
* · `run_result_unobserved` —— 记录里有结果、结果里没有记忆观测(引擎在准备阶段拒了 / 失败了它,引擎答出之前被取消,或更早版本的引擎写下的结果);
|
|
6162
|
+
* · `memory_not_mounted` —— 观测在,说那一条**配了记忆而没挂上**(引擎 `memoryless`:`mount-failed` / `no-backend`)—— 🔴 **≤7.142.x 这一形答 200 空报告**(`scopes: []`),本版起 409:
|
|
6163
|
+
* 挂载失败时那一腿本该读哪几层不可知,`[]` 只留给本会话没配记忆(`none`)。反复出现 ⇒ 读那条 run 的 `result.effectiveMemoryScopes.reason`,查挂载故障;
|
|
6164
|
+
* · `no_leaf` —— 观测在、说得出读集,会话还没有叶子(没有可对齐的会话版本)。
|
|
6165
|
+
* 出路一律:在会话里跑一条任务(上一条被拒的先修好拒因)/ 等在飞的 run 结束,再同步。**按 `errorCode` + `reason` 分支,不比句子**(句子由 `reason` 定,本版换过三句);
|
|
6166
|
+
* 闭集,读不懂的词按「读集取不到」处置。≤7.142.x 的 server 不带 `reason`。
|
|
6167
|
+
*/
|
|
6168
|
+
export declare const SESSION_MEMORY_UNOBSERVED_REASONS: readonly ["no_settled_run", "run_result_missing", "run_result_unobserved", "memory_not_mounted", "no_leaf"];
|
|
6169
|
+
/** {@link SESSION_MEMORY_UNOBSERVED_REASONS} 的成员型。 */
|
|
6170
|
+
export type SessionMemoryUnobservedReason = (typeof SESSION_MEMORY_UNOBSERVED_REASONS)[number];
|
|
6171
|
+
/** `409 conflict.session_memory_unobserved` 的拒体(落 {@link import("./errors.js").ConflictError};值经 `err.extra` 到达):`reason`(server ≥7.143.0 恒在场)· 有在飞 run 时另带 `activeTaskId`(同 `err.activeTaskId`)。 */
|
|
6172
|
+
export interface SessionMemoryUnobservedExtra {
|
|
6173
|
+
reason?: SessionMemoryUnobservedReason;
|
|
6174
|
+
activeTaskId?: string;
|
|
6175
|
+
}
|
|
6176
|
+
/** 一层同步落下的一条改动(引擎 `PatchReport.applied` 的一项)。 */
|
|
6177
|
+
export interface MemorySyncAppliedOp {
|
|
6178
|
+
op: "add" | "update" | "delete";
|
|
6179
|
+
id: string;
|
|
6180
|
+
slug?: string;
|
|
6181
|
+
}
|
|
6182
|
+
/** 一层同步里没对上的一条(服务端报的或本地的;引擎 `MemorySyncClientConflict`)。 */
|
|
6183
|
+
export interface MemorySyncConflict {
|
|
6184
|
+
side: "server" | "local";
|
|
6185
|
+
id: string;
|
|
6186
|
+
reason: string;
|
|
6187
|
+
baseRev?: string;
|
|
6188
|
+
currentRev?: string;
|
|
6189
|
+
}
|
|
6190
|
+
/**
|
|
6191
|
+
* 记忆同步报告的**一层**(一个 scope、一个结局;引擎 `memorySyncReportOf` 铸,server 原样上 wire)。按 `outcome` 判别(闭集四臂):
|
|
6192
|
+
* · `synced` —— 这一层到了(`applied` 的条数不说到没到,`outcome` 说;重放的调用什么都不落也算 `synced`);
|
|
6193
|
+
* · `incomplete` —— 没到全:`why: "conflicts"`(最后一次调用有冲突,`conflicts` 全列)/ `"truncated"`(被截断、还要再跑);`warnings?` = 客户端拒收的服务端答复;
|
|
6194
|
+
* · `refused` —— 发请求之前就拒了:`code` ∈ `config.memory_sync_cursor_mismatch`(游标绑在别的轴上;`detail.axis` / `detail.found` / `detail.want`)/ `config.memory_sync_store`;`outs` = 拒句点名的两条出路(都归宿主);
|
|
6195
|
+
* · `failed` —— 这一层的调用抛了(`error` = 消息原文;一层失败只结束这一层,别的层照跑)。
|
|
6196
|
+
*/
|
|
6197
|
+
export type MemorySyncLayerReport = {
|
|
6198
|
+
scope: string;
|
|
6199
|
+
/** 这一层所有调用落下的改动,两半,调用序。 */
|
|
6200
|
+
applied: {
|
|
6201
|
+
server: MemorySyncAppliedOp[];
|
|
6202
|
+
local: MemorySyncAppliedOp[];
|
|
6203
|
+
};
|
|
6204
|
+
} & ({
|
|
6205
|
+
outcome: "synced";
|
|
6206
|
+
} | {
|
|
6207
|
+
outcome: "incomplete";
|
|
6208
|
+
why: "conflicts" | "truncated";
|
|
6209
|
+
conflicts: MemorySyncConflict[];
|
|
6210
|
+
warnings?: string[];
|
|
6211
|
+
} | {
|
|
6212
|
+
outcome: "refused";
|
|
6213
|
+
code: "config.memory_sync_cursor_mismatch" | "config.memory_sync_store";
|
|
6214
|
+
/** `axis`:游标在哪一轴上被拒 —— server ≥7.143.0(引擎 7.61.0)多一轴 `incarnation`(中心层分区的化身对不上:中心库重建 / 从备份恢复之后,升级前写下的带基线游标读作 `absent`;
|
|
6215
|
+
* 出路同另三轴 = 删这一层的游标,下一轮从空基线重收敛)—— 输出闭集放宽。`want`(server ≥7.143.0):这一次调用在那一轴上的值(scope / 传输的对端 / 本机店的身份 / 答话那份对端状态的化身;
|
|
6216
|
+
* 带凭据的只给凭据记号),与拒句里的同一份。 */
|
|
6217
|
+
detail?: {
|
|
6218
|
+
axis: "scope" | "peer" | "store" | "incarnation";
|
|
6219
|
+
found: "absent" | "other";
|
|
6220
|
+
want?: string;
|
|
6221
|
+
};
|
|
6222
|
+
outs: [string, string];
|
|
6223
|
+
message: string;
|
|
6224
|
+
} | {
|
|
6225
|
+
outcome: "failed";
|
|
6226
|
+
error: string;
|
|
6227
|
+
});
|
|
6228
|
+
/**
|
|
6229
|
+
* `POST /v1/sessions/:id/memory/sync` 的 200 体(server ≥7.142.0;引擎 `MemorySyncRoundReport`,server 原样上 wire)—— 轮级两臂,按 `"refused" in r` 判:
|
|
6230
|
+
* · `layers` —— 逐层结局({@link MemorySyncLayerReport});读集里没有对应层的 scope 没同步(没被本机同步腿覆盖);
|
|
6231
|
+
* · `refused` —— 整轮拒、一层没跑、零请求:`config.memory_sync_target_mismatch`(目标不是本机同步腿到达的那台)/ `session_active`(会话有在飞 run,或读完记忆观测之后又受理了 run / 会话记录前进了 —— 等它静下来再调)。
|
|
6232
|
+
* 公共三键:`target`(你给的)、`sourceRevision`(这次同步对着的会话版本 = 会话头的叶子;fork 时拿它对齐)、`scopes`(会话的读集,序同它)。
|
|
6233
|
+
*/
|
|
6234
|
+
export type SessionMemorySyncReport = {
|
|
6235
|
+
target: string;
|
|
6236
|
+
sourceRevision: string;
|
|
6237
|
+
scopes: string[];
|
|
6238
|
+
} & ({
|
|
6239
|
+
layers: MemorySyncLayerReport[];
|
|
6240
|
+
refused?: never;
|
|
6241
|
+
} | {
|
|
6242
|
+
refused: {
|
|
6243
|
+
code: "config.memory_sync_target_mismatch" | "session_active";
|
|
6244
|
+
message: string;
|
|
6245
|
+
};
|
|
6246
|
+
layers?: never;
|
|
6247
|
+
});
|
|
6030
6248
|
/** `GET /v1/sessions` 的分页信封(service handleSessionList,keyset)。`nextCursor` 缺 = 末页。 */
|
|
6031
6249
|
export interface SessionListPage {
|
|
6032
6250
|
sessions: SessionSummary[];
|
|
@@ -6386,8 +6604,8 @@ export interface SessionBackgroundStopResult {
|
|
|
6386
6604
|
* · `lastCaptureAt` —— 答它的各店取最大;**`committedCount` 缺席**(只看它:`foldedCount` 独立缺席不压 `lastCaptureAt`)、或没有一只店答它(各店都没有贡献)⇒ 缺席;
|
|
6387
6605
|
* · `captureOptedOut` —— **任一店有采集记录**即 `true`(带该店的 `optOutSource: "record"`);全部店答 `false` 才是 `false`;有店的记录读不出(且没有店有记录)⇒ 缺席 + `optOutSource: "fault"`(不补 false)。
|
|
6388
6606
|
* 只有一只店(**单店部署**,或给了层座只答那一层住的店)⇒ 逐键就是那只店的答案,与 7.139.x 字节同。7.139.x 及以前只读部署的店:写进个人层的那一半读成 0,7.140.0 起数字会变大 —— 这是改对了。
|
|
6389
|
-
*
|
|
6390
|
-
*
|
|
6607
|
+
* 🔁 **server ≥7.143.0 折叠交引擎**:7.140.0–7.142.x 由 server 折的那一段是过渡形,7.143.0 起不带层座的读答**引擎的部署对象**在每只店上折成的那一份(上面的逐键律与键对读者不变);
|
|
6608
|
+
* 店集读**盘上**的 —— 个人挂载上有店就算(配置不点名个人层也算),所以 7.140.0–7.142.x 的已知限制(店集按此刻的配置算:换过 `MEMORY_SCOPE` 之后留在个人挂载那只店里的贡献读不到)7.143.0 起不再成立。 */
|
|
6391
6609
|
export interface SessionMemoryStatus {
|
|
6392
6610
|
/** TRUE = 存在一条单向 capture opt-out 记录;FALSE = 记录店可读且无记录(capture 开着)。
|
|
6393
6611
|
* **缺席** = 记录店失败 —— indeterminate(伴随 `optOutSource: "fault"`)。 */
|
|
@@ -6428,7 +6646,8 @@ export interface SessionMemoryStatusResponse extends SessionMemoryStatus {
|
|
|
6428
6646
|
autoConsolidationArmed?: boolean;
|
|
6429
6647
|
/**
|
|
6430
6648
|
* server ≥7.141.0 · **这台部署的记忆同步停驻读数**({@link SessionMemorySync};部署事实:有同步腿 ⇔ 在场;不随会话、不随 `?scope=`)。
|
|
6431
|
-
* `parked: []` = 在同步;每行一层停驻 —— 该层的同步游标被同步引擎在 scope / 对端 /
|
|
6649
|
+
* `parked: []` = 在同步;每行一层停驻 —— 该层的同步游标被同步引擎在 scope / 对端 / 店任一轴拒(server ≥7.143.0 另一轴:中心层分区的**化身**,中心库重建 / 恢复之后升级前的带基线游标读作 `absent`;
|
|
6650
|
+
* 停驻层每一轮仍发一次请求、被中心在写之前拒),或读不成游标:文件不动、每一轮照样停,直到删掉它。
|
|
6432
6651
|
* 缺席 = 本部署没有同步腿,或老 server(≤7.140.x)。游标的盘路径不上 wire(运维行 `memory_sync_layer_parked` 带它)。
|
|
6433
6652
|
*/
|
|
6434
6653
|
memorySync?: SessionMemorySync;
|
|
@@ -6844,8 +7063,11 @@ export interface CheckpointSummary {
|
|
|
6844
7063
|
/** §assistant-scheduler 归因(core 1.114.0 source-tag 持久化 + summarizeCheckpoint 投影自动带;the pinned wire contract)。
|
|
6845
7064
|
* echo-only triage 显示 —— **core 门控不读、跨副本持久化带着、跨后端 byte-identical**。单收件箱跨任务聚合时,
|
|
6846
7065
|
* 消费方据此显「这条 ask 属哪个任务/用户」。缺则 OMIT(旧 worker / 未持久化场景)。 */
|
|
6847
|
-
/**
|
|
6848
|
-
|
|
7066
|
+
/** 发起这一问的那条腿的**会话** id(core 7.61.0 / server ≥7.143.0 换名,取代 `sourceTaskId`、值不变、零别名;delegated worker-unforgeable)。它名一只会话,**不名任务** ——
|
|
7067
|
+
* 发起这一问的腿的 agent id 是 {@link agentId}。老引擎停驻的行缺席。 */
|
|
7068
|
+
sourceSessionId?: string;
|
|
7069
|
+
/** 停驻的那条腿是委派子代时它的 agent id(core 7.61.0;后台子代 = 注册表行 id,否则它的会话 id;宿主的行缺席)。echo-only。 */
|
|
7070
|
+
agentId?: string;
|
|
6849
7071
|
/** 发起此 ask 的 end-user principal(per-ask 用户归因;与多租户 `scope` 不同层 —— scope=租户命名空间, principal=具体用户)。 */
|
|
6850
7072
|
principal?: string;
|
|
6851
7073
|
/** §assistant-scheduler 下批(service b96b76b):ask 创建时间(epoch ms)→ 面板显「挂了多久」。
|
|
@@ -7021,7 +7243,7 @@ export interface AssistantTask {
|
|
|
7021
7243
|
/** §4c plan_review 请求体(3-state)。editedPlan 仅 decision==="edit" 时必带, 其余禁带(→ 400, BFF 也会守)。
|
|
7022
7244
|
* 🔴 **体键是闭集**(server ≥7.86.0 / S-438):受理集之外的顶层键 ⇒ 400 `request.body_shape` + `unknownKeys` /
|
|
7023
7245
|
* `unsupportedKeys` 两张机读表(拼错的 `permissionModeAfter` 从此响亮拒,而不是静默丢掉一条安全轴的表态)。 */
|
|
7024
|
-
export interface PlanReviewRequest {
|
|
7246
|
+
export interface PlanReviewRequest extends ResumeRestatement {
|
|
7025
7247
|
decision: "approve" | "edit" | "reject";
|
|
7026
7248
|
/** operator 改写后的 plan; REQUIRED iff decision==="edit", 否则禁带。 */
|
|
7027
7249
|
editedPlan?: string;
|
|
@@ -7067,6 +7289,21 @@ export interface PlanReviewRequest {
|
|
|
7067
7289
|
* 🔴 **没有能力位可探,按 server 版本发**:`capabilities().approvalDecidedBy`(≥7.118.0)**不覆盖这一口** —— ≤7.125.x 的 `plan_review` 对它答 `400 request.body_shape` 并在 `unsupportedKeys` 里列名;缺席时照老形发(不带这只键)。
|
|
7068
7290
|
*/
|
|
7069
7291
|
decidedBy?: ApprovalDecidedBy;
|
|
7292
|
+
/** 策略决定从哪只座上答出来的(server ≥7.143.0,能力位 `approvalDecidedVia`;只许在 `decidedBy: "policy"` 旁,见 {@link import("./resources/approvals.js").ApprovalDecidedVia})。直连门部署带它 ⇒ 400。 */
|
|
7293
|
+
decidedVia?: ApprovalDecidedVia;
|
|
7294
|
+
}
|
|
7295
|
+
/**
|
|
7296
|
+
* **续跑重述**(server ≥7.143.0)—— 续跑四门(`/decide` · `plan_review` · `assistant.resume` · `sessions.wake`)的请求体收提交体同键的 `mcpServers` / `a2aPeers`:
|
|
7297
|
+
* · 键在场(非 `null`)⇒ 这张表**取代**停驻任务存下的提交体里的同名表(本次续跑读它;续跑受理后随续跑输入写回,之后不送的续跑重放的也是它);值形与 `POST /v1/tasks` 同一只判官(坏形同码同句 400);
|
|
7298
|
+
* · 键缺席或 `null` ⇒ **冻结读法**:重放提交时存下的表(与上一版逐字同)。两键各自独立;空数组是一张空表,不是缺席。
|
|
7299
|
+
* 任务停在一只 MCP 调用上、目标台不在送去的表里 ⇒ 引擎判(本服务逐字过境,落 {@link import("./errors.js").SubagentResumeConflictError}):工具不在了 `resume.tool_unavailable`(卡重开、可再决)·
|
|
7300
|
+
* 同名而已不是批准时那一只 `resume.tool_contract_mismatch`(同样重开)· 还是那一只而它的面或声明变了 `resume.target_moved`(这次调用不执行、批准用掉,须重新发起)。
|
|
7301
|
+
* 不读重述的路:SLA 到期拒扫、live 卡答复口的停驻赎回。`/decide` 命中停驻后台子代的卡 ⇒ `400 decide.parked_restatement_unsupported`;直连门部署 `/decide` / `plan_review` 送两键 ⇒ `400 restatement_not_in_proof`。
|
|
7302
|
+
* 🔴 **补偿**:壳在**每次**续跑送它此刻的整张表 —— 不送的续跑仍按提交时的表重连(含已删的台,本服务不替它判);老 server(≤7.142.x)`/decide` / `plan_review` 对两键 400,`/resume` / `/wake` 忽略。
|
|
7303
|
+
*/
|
|
7304
|
+
export interface ResumeRestatement {
|
|
7305
|
+
mcpServers?: NonNullable<TaskRequest["mcpServers"]> | null;
|
|
7306
|
+
a2aPeers?: NonNullable<TaskRequest["a2aPeers"]> | null;
|
|
7070
7307
|
}
|
|
7071
7308
|
/** §4b/§4c/§4d 决策端点的返回。status 形如 "completed"|"failed"|"suspended"|"needs_review"|"preempting"|…
|
|
7072
7309
|
* —— 开放串, 不窄化。🔴 facade 审计(2026-07-24,SDK 全量核查批次②-9):此前只声明 `{status}` 一个字段,
|
|
@@ -7541,10 +7778,11 @@ export interface EntryProvenanceAccount {
|
|
|
7541
7778
|
* 动词自己点名层的(导出的 `scopes`、外源列表的 `scopes`、operator 抹除的 `select.scope` / `expectedScopes`)按点名的层定店。**不点名层**的动词 ——
|
|
7542
7779
|
* 条目 id 的出处(`memory.provenance`)、店级账本(`memory.originClearances` / `memory.originClear`)、`select.ids` 而不带 `expectedScopes` 的 operator 抹除 ——
|
|
7543
7780
|
* 多这一个可选键 `scope`(层键,串),**只用来定店**:GET 口走查询串 `?scope=<层键>`,POST 口走体里的 `"scope": "<层键>"`;operator 抹除口**不加这个键**(体原样交引擎,层由 `select.scope` 或 `expectedScopes` 定,不是本键)。
|
|
7544
|
-
*
|
|
7781
|
+
* 会话记忆状态(`sessions.memoryStatus`)不点名层时不拒 —— 一只会话可以跨两只店:server ≥7.143.0 答**引擎的部署对象在每只店上折成的那一份**(7.140.0–7.142.x 由本服务折);给了层座就只答那一层住的店(那只店上的引擎答案)。
|
|
7782
|
+
* 会话自助抹除(`sessions.eraseMemory`)**没有**层座(server 7.143.0 退役:抹除交整个部署,见 {@link SessionMemoryEraseRequest})。
|
|
7545
7783
|
*
|
|
7546
|
-
* 🔴
|
|
7547
|
-
* (句子点名哪几层住哪只店;{@link import("./errors.js").BadRequestError});**单店部署**(SQL
|
|
7784
|
+
* 🔴 **两店部署才要**:server ≥7.143.0 起本部署的店集 = **盘上的**(个人挂载上有店就算,配置不再点名个人层也算;7.140.0–7.142.x 由配置点名的层推)。两只店都在时,不带层座的条目 id / 店级账本请求 ⇒ 400 `request.memory_layer`
|
|
7785
|
+
* (句子点名哪几层住哪只店;{@link import("./errors.js").BadRequestError});**单店部署**(SQL 记忆后端,或个人挂载上没有店)上不带层座的请求答法与 7.139.x 逐字同,**不需要**这个键。
|
|
7548
7786
|
* 老 server(<7.140.0)不认这个键:每个动词都答在部署的店上 —— 对个人层那是错的店,不是错的键。
|
|
7549
7787
|
*
|
|
7550
7788
|
* 🔴 本包**一个字不替你校**:在场就原样上线,**空串也上线**(⇒ server 答 400 `request.field_invalid`:`scope` 在场而不是非空串);判官只有 server 一只。
|
|
@@ -7588,32 +7826,27 @@ export interface MemoryErasureRequest {
|
|
|
7588
7826
|
* 同一个 `requestId` 换了授权集重发 ⇒ 证据腿先按集拒(缺席与在场是两个集)。
|
|
7589
7827
|
* ⚠️ **<7.138.0 的 server 静默忽略它、不收窄**(抹除口把体原样交引擎,而 core ≤7.58.0 的 `eraseMemoryEntries` 不读这个键)—— 别在老 server 上把它当唯一护栏。
|
|
7590
7828
|
*
|
|
7591
|
-
* 🔴 **server ≥7.
|
|
7592
|
-
*
|
|
7829
|
+
* 🔴 **server ≥7.143.0:抹除交引擎的部署对象**(一个 `requestId` 在整个部署里只名一次请求):`select.ids` / `select.sessionId` 不带它 ⇒ 每只店各擦各的那一份、收执合成一份;
|
|
7830
|
+
* 集里的层分住两只店 ⇒ `400 config.memory_erasure_scope`(什么都没删);个人层的抹除照常执行(7.140.0–7.142.x 的 `409 memory.erasure_store_unjudged` 退役)。operator 抹除口的体里没有顶层 `scope` 键。
|
|
7593
7831
|
*/
|
|
7594
7832
|
expectedScopes?: string[];
|
|
7595
7833
|
}
|
|
7596
7834
|
/**
|
|
7597
|
-
* `POST /v1/sessions/:id/memory/erase`(会话所有者**自助**抹除,契约 §12.5)的请求体 ——
|
|
7598
|
-
* (
|
|
7835
|
+
* `POST /v1/sessions/:id/memory/erase`(会话所有者**自助**抹除,契约 §12.5)的请求体 —— 型面**具名两键**:`requestId` · `allowUnevidenced?`
|
|
7836
|
+
* (前两键发布字节 server 7.107.0 `dist/http/routes/sessions.js:508-523` 逐键判;本包不给写第三键的 affordance)。
|
|
7599
7837
|
*
|
|
7600
7838
|
* 🔴 **没有 `select`**:自助面的选择子由**路径**铸成 `{ sessionId: <这个会话> }`(硬限本会话;抹别的范围走 operator 面
|
|
7601
7839
|
* {@link MemoryErasureRequest})。体里出现 `select` ⇒ 400 `request.body_shape`(响亮拒,不静默忽略)。
|
|
7602
|
-
* ⚠️ `select` 之外的未知键 server **不拒**:静默忽略、不转发(`:526` 只取两键)—— 所以随包 spec 对这只体是「开集 + 禁 `select`」,
|
|
7840
|
+
* ⚠️ `select` 之外的未知键 server **不拒**:静默忽略、不转发(`:526` 只取两键)—— 所以随包 spec 对这只体是「开集 + 禁 `select` / `scope`」,
|
|
7603
7841
|
* 不是闭形(codex r1 F1)。别指望 server 替你挡住拼错的键名。
|
|
7604
|
-
* 🔴 **`requestId` 的语义与 {@link MemoryErasureRequest.requestId} 相同**(同一个 core 动词
|
|
7605
|
-
*
|
|
7606
|
-
*
|
|
7607
|
-
*
|
|
7608
|
-
*
|
|
7609
|
-
*
|
|
7610
|
-
* (7.139.x 在这一形上 200、擦掉部署店那一半,收执不提个人店那一半);单店部署不受影响;
|
|
7611
|
-
* · **`scope` 点名一个住在部署的店上的层**(例:`local`)⇒ 落部署的店执行、答 200,**收执只覆盖部署的店**(层座不进引擎、不进收执),**不判**这只会话在个人店里的那一半 —— 那一半原样、收执不提;
|
|
7612
|
-
* · **`scope` 点名住在个人店的层** ⇒ 409 `memory.erasure_store_unjudged`;`scope` 在场而不是非空串 ⇒ 400 `request.field_invalid`;读不出的层键 ⇒ 400 `request.memory_layer`。
|
|
7613
|
-
* 已知限制(随引擎的部署级抹除请求身份一并收):按会话抹除已在部署的店上执行过、这只会话之后又往个人店写过 ⇒ 原样重放同一个 `requestId` 答 409(「什么都没删」说的是这一次调用,第一次的删除照旧有效);
|
|
7614
|
-
* 要拿到收敛的应答,带 `scope` 点名一个住在部署的店上的层、用同一个 `requestId` 重放 —— 选择子不变,引擎按第一次钉下的 id 集重答一张新收执(`at` 是这一次的)。
|
|
7842
|
+
* 🔴 **`requestId` 的语义与 {@link MemoryErasureRequest.requestId} 相同**(同一个 core 动词):证据腿上它是这次抹除的**幂等身份**,重试必须带**同一个**;server 与引擎都从不替你铸。
|
|
7843
|
+
* 读法见 {@link MemoryErasureAttestation} 顶注的两腿律。⚠️ 与 {@link MemoryOriginClearRequest.requestId}(审计归属)**同名不同义**。
|
|
7844
|
+
*
|
|
7845
|
+
* 🔴 **抹除答整个部署(server ≥7.143.0)**:按会话抹除交引擎的**部署对象** —— 执行之前读遍本部署每只店的锚,这只会话在每只店里的那一份各擦各的,收执合成一份;
|
|
7846
|
+
* 一个 `requestId` 在整个部署里只名一次请求(同一个 id 头一回换了选择子或执行在另一只店 ⇒ `409 memory.erasure_selector_mismatch`,什么都没删)。
|
|
7847
|
+
* ⚰️ 7.140.0–7.142.x 的层座 `scope` **退役**(没有「落哪只店」可点;sdk 33.0.0 同删、零别名):体带它 ⇒ `400 request.body_shape`;同批的 `409 memory.erasure_store_unjudged` 退役(那些请求现在照常执行)。
|
|
7615
7848
|
*/
|
|
7616
|
-
export interface SessionMemoryEraseRequest
|
|
7849
|
+
export interface SessionMemoryEraseRequest {
|
|
7617
7850
|
/** 非空串(缺席 / 空串 / 非串 ⇒ 400 `request.request_id_required`)。 */
|
|
7618
7851
|
requestId: string;
|
|
7619
7852
|
/** 证据面缺席时的降级授权 —— 一次**人的**签字;缺席时 SDK **不补** `false`(体里就没有这个键)。非布尔 ⇒ 400 `request.field_invalid`。 */
|