@sema-agent/sdk 0.0.74 → 0.0.76
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/client.d.ts +48 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +55 -2
- package/dist/client.js.map +1 -1
- package/dist/control-client.d.ts +21 -0
- package/dist/control-client.d.ts.map +1 -1
- package/dist/control-client.js +42 -1
- package/dist/control-client.js.map +1 -1
- package/dist/control-types.d.ts +108 -0
- package/dist/control-types.d.ts.map +1 -1
- package/dist/control-types.js +15 -0
- package/dist/control-types.js.map +1 -1
- package/dist/errors.d.ts +88 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +105 -8
- package/dist/errors.js.map +1 -1
- package/dist/events.d.ts +154 -16
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +1 -0
- package/dist/events.js.map +1 -1
- package/dist/health.d.ts +44 -0
- package/dist/health.d.ts.map +1 -1
- package/dist/health.js +32 -0
- package/dist/health.js.map +1 -1
- package/dist/idempotency.d.ts +8 -0
- package/dist/idempotency.d.ts.map +1 -1
- package/dist/idempotency.js +8 -0
- package/dist/idempotency.js.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/approvals.d.ts +43 -0
- package/dist/resources/approvals.d.ts.map +1 -1
- package/dist/resources/approvals.js +23 -3
- package/dist/resources/approvals.js.map +1 -1
- package/dist/resources/assistant.d.ts +23 -0
- package/dist/resources/assistant.d.ts.map +1 -1
- package/dist/resources/assistant.js +22 -0
- package/dist/resources/assistant.js.map +1 -1
- package/dist/resources/control/auth-providers.d.ts +17 -0
- package/dist/resources/control/auth-providers.d.ts.map +1 -1
- package/dist/resources/control/auth-providers.js +6 -0
- package/dist/resources/control/auth-providers.js.map +1 -1
- package/dist/resources/control/config.d.ts +22 -0
- package/dist/resources/control/config.d.ts.map +1 -1
- package/dist/resources/control/config.js +12 -0
- package/dist/resources/control/config.js.map +1 -1
- package/dist/resources/control/fleet.d.ts +15 -0
- package/dist/resources/control/fleet.d.ts.map +1 -1
- package/dist/resources/control/fleet.js +8 -0
- package/dist/resources/control/fleet.js.map +1 -1
- package/dist/resources/control/images.d.ts +20 -0
- package/dist/resources/control/images.d.ts.map +1 -1
- package/dist/resources/control/images.js +10 -0
- package/dist/resources/control/images.js.map +1 -1
- package/dist/resources/control/lifecycle.d.ts +8 -0
- package/dist/resources/control/lifecycle.d.ts.map +1 -1
- package/dist/resources/control/lifecycle.js +3 -0
- package/dist/resources/control/lifecycle.js.map +1 -1
- package/dist/resources/control/publish.d.ts +12 -0
- package/dist/resources/control/publish.d.ts.map +1 -1
- package/dist/resources/control/publish.js +6 -0
- package/dist/resources/control/publish.js.map +1 -1
- package/dist/resources/control/secrets.d.ts +28 -0
- package/dist/resources/control/secrets.d.ts.map +1 -1
- package/dist/resources/control/secrets.js +16 -0
- package/dist/resources/control/secrets.js.map +1 -1
- package/dist/resources/control/users.d.ts +22 -0
- package/dist/resources/control/users.d.ts.map +1 -1
- package/dist/resources/control/users.js +12 -0
- package/dist/resources/control/users.js.map +1 -1
- package/dist/resources/control/versioning.d.ts +12 -0
- package/dist/resources/control/versioning.d.ts.map +1 -1
- package/dist/resources/control/versioning.js +6 -0
- package/dist/resources/control/versioning.js.map +1 -1
- package/dist/resources/control/workers.d.ts +14 -0
- package/dist/resources/control/workers.d.ts.map +1 -1
- package/dist/resources/control/workers.js +7 -0
- package/dist/resources/control/workers.js.map +1 -1
- package/dist/resources/elicitations.d.ts +43 -0
- package/dist/resources/elicitations.d.ts.map +1 -1
- package/dist/resources/elicitations.js +8 -0
- package/dist/resources/elicitations.js.map +1 -1
- package/dist/resources/fleet.d.ts +90 -0
- package/dist/resources/fleet.d.ts.map +1 -1
- package/dist/resources/fleet.js +27 -4
- package/dist/resources/fleet.js.map +1 -1
- package/dist/resources/images.d.ts +34 -0
- package/dist/resources/images.d.ts.map +1 -1
- package/dist/resources/images.js +29 -3
- package/dist/resources/images.js.map +1 -1
- package/dist/resources/leader.d.ts +10 -0
- package/dist/resources/leader.d.ts.map +1 -1
- package/dist/resources/leader.js +4 -0
- package/dist/resources/leader.js.map +1 -1
- package/dist/resources/memory.d.ts +37 -0
- package/dist/resources/memory.d.ts.map +1 -1
- package/dist/resources/memory.js +28 -0
- package/dist/resources/memory.js.map +1 -1
- package/dist/resources/models.d.ts +12 -0
- package/dist/resources/models.d.ts.map +1 -1
- package/dist/resources/models.js +4 -0
- package/dist/resources/models.js.map +1 -1
- package/dist/resources/ops.d.ts +16 -0
- package/dist/resources/ops.d.ts.map +1 -1
- package/dist/resources/ops.js +6 -0
- package/dist/resources/ops.js.map +1 -1
- package/dist/resources/policy.d.ts +8 -0
- package/dist/resources/policy.d.ts.map +1 -1
- package/dist/resources/policy.js +1 -0
- package/dist/resources/policy.js.map +1 -1
- package/dist/resources/questions.d.ts +57 -0
- package/dist/resources/questions.d.ts.map +1 -1
- package/dist/resources/questions.js +9 -0
- package/dist/resources/questions.js.map +1 -1
- package/dist/resources/runs.d.ts +143 -0
- package/dist/resources/runs.d.ts.map +1 -1
- package/dist/resources/runs.js +129 -2
- package/dist/resources/runs.js.map +1 -1
- package/dist/resources/session-sync.d.ts +61 -0
- package/dist/resources/session-sync.d.ts.map +1 -1
- package/dist/resources/session-sync.js +54 -1
- package/dist/resources/session-sync.js.map +1 -1
- package/dist/resources/sessions.d.ts +74 -0
- package/dist/resources/sessions.d.ts.map +1 -1
- package/dist/resources/sessions.js +64 -2
- package/dist/resources/sessions.js.map +1 -1
- package/dist/resources/side-query.d.ts +18 -0
- package/dist/resources/side-query.d.ts.map +1 -1
- package/dist/resources/side-query.js +1 -0
- package/dist/resources/side-query.js.map +1 -1
- package/dist/resources/tasks.d.ts +19 -0
- package/dist/resources/tasks.d.ts.map +1 -1
- package/dist/resources/tasks.js +21 -2
- package/dist/resources/tasks.js.map +1 -1
- package/dist/resources/tool-approvals.d.ts +53 -0
- package/dist/resources/tool-approvals.d.ts.map +1 -1
- package/dist/resources/tool-approvals.js +10 -0
- package/dist/resources/tool-approvals.js.map +1 -1
- package/dist/resources/trace.d.ts +23 -0
- package/dist/resources/trace.d.ts.map +1 -1
- package/dist/resources/trace.js +27 -2
- package/dist/resources/trace.js.map +1 -1
- package/dist/resources/usage.d.ts +21 -0
- package/dist/resources/usage.d.ts.map +1 -1
- package/dist/resources/usage.js +8 -0
- package/dist/resources/usage.js.map +1 -1
- package/dist/resources/workflows.d.ts +48 -0
- package/dist/resources/workflows.d.ts.map +1 -1
- package/dist/resources/workflows.js +40 -3
- package/dist/resources/workflows.js.map +1 -1
- package/dist/settings.d.ts +90 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +24 -0
- package/dist/settings.js.map +1 -1
- package/dist/sse.d.ts +36 -0
- package/dist/sse.d.ts.map +1 -1
- package/dist/sse.js +53 -8
- package/dist/sse.js.map +1 -1
- package/dist/sync.d.ts +56 -0
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +48 -4
- package/dist/sync.js.map +1 -1
- package/dist/transport.d.ts +32 -0
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +40 -8
- package/dist/transport.js.map +1 -1
- package/dist/types.d.ts +691 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/resources/ops.d.ts
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
|
+
/** ops — 运维观测只读面三件(server 真码实拆,SDK 全覆盖批 2026-07-17):
|
|
2
|
+
* metrics — `/metrics`(Prometheus 文本)+ `/metrics/summary` + `/metrics/plan-cache`(server.ts:960 区)。
|
|
3
|
+
* 鉴权=全量 authToken **或** 只读 metricsToken(server 侧双门;SDK 用构造时的 authToken——
|
|
4
|
+
* metricsToken-only 部署请以该 token 作 authToken 构造一个只读 client)。
|
|
5
|
+
* outcomes — `GET /v1/outcomes`(server.ts:4418):任务结局台账;多租下 operator-only(403),File sink=501
|
|
6
|
+
* (诚实:直读 JSONL 数据集)。
|
|
7
|
+
* sendfileLinks — `GET /v1/sendfile-links`(server.ts:4620):SendUserFile 分发链接台账;principal 调用方
|
|
8
|
+
* 钉死本人 scope(?scope= 被忽略),fleet 凭证可选 scope(缺省单用户哨兵 "_")。 */
|
|
1
9
|
import type { Transport } from "../transport.js";
|
|
2
10
|
export declare class MetricsResource {
|
|
3
11
|
private readonly t;
|
|
4
12
|
constructor(t: Transport);
|
|
13
|
+
/** GET /metrics — Prometheus 文本原文(`text/plain; version=0.0.4`)。404=metrics 关闭。 */
|
|
5
14
|
prometheus(opts?: {
|
|
6
15
|
signal?: AbortSignal;
|
|
7
16
|
}): Promise<string>;
|
|
17
|
+
/** GET /metrics/summary — 指标汇总 JSON(`{model, ...metrics.summarize()}`,开集)。 */
|
|
8
18
|
summary(opts?: {
|
|
9
19
|
signal?: AbortSignal;
|
|
10
20
|
}): Promise<{
|
|
11
21
|
model: string;
|
|
12
22
|
[k: string]: unknown;
|
|
13
23
|
}>;
|
|
24
|
+
/** GET /metrics/plan-cache — per-scope objective 复发探针 dump(core design/42;开集)。 */
|
|
14
25
|
planCache(opts?: {
|
|
15
26
|
signal?: AbortSignal;
|
|
16
27
|
}): Promise<{
|
|
17
28
|
scopes: Record<string, unknown>;
|
|
18
29
|
}>;
|
|
19
30
|
}
|
|
31
|
+
/** 一条任务结局行(server outcomeSink.summary 投影;开集——机械信号只读底座,design/73 §7)。 */
|
|
20
32
|
export interface OutcomeRow {
|
|
21
33
|
taskSignature?: string;
|
|
22
34
|
[k: string]: unknown;
|
|
@@ -24,6 +36,7 @@ export interface OutcomeRow {
|
|
|
24
36
|
export declare class OutcomesResource {
|
|
25
37
|
private readonly t;
|
|
26
38
|
constructor(t: Transport);
|
|
39
|
+
/** GET /v1/outcomes?signature=&includeAborted= — 结局台账 `{outcomes: rows}`。 */
|
|
27
40
|
list(opts?: {
|
|
28
41
|
signature?: string;
|
|
29
42
|
includeAborted?: boolean;
|
|
@@ -32,6 +45,7 @@ export declare class OutcomesResource {
|
|
|
32
45
|
outcomes: OutcomeRow[];
|
|
33
46
|
}>;
|
|
34
47
|
}
|
|
48
|
+
/** 一条 sendfile 分发链接台账行(server sendFileLedger 投影;开集)。 */
|
|
35
49
|
export interface SendfileLinkRow {
|
|
36
50
|
id: string;
|
|
37
51
|
[k: string]: unknown;
|
|
@@ -39,6 +53,8 @@ export interface SendfileLinkRow {
|
|
|
39
53
|
export declare class SendfileLinksResource {
|
|
40
54
|
private readonly t;
|
|
41
55
|
constructor(t: Transport);
|
|
56
|
+
/** GET /v1/sendfile-links — 台账分页。`limit` 1..100(缺省 50);`before` = 上页 `nextBefore`/行 `id`
|
|
57
|
+
* (uuidv7,坏形 400 fail-loud——F6 修后绝不静默降级);`scope` 仅 fleet 凭证生效。 */
|
|
42
58
|
list(opts?: {
|
|
43
59
|
limit?: number;
|
|
44
60
|
before?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../src/resources/ops.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../src/resources/ops.ts"],"names":[],"mappings":"AAAA;;;;;;;yEAOyE;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAAD,CAAC,EAAE,SAAS;IAEzC,kFAAkF;IAC5E,UAAU,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAMlE,8EAA8E;IACxE,OAAO,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC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ANGED
|
@@ -3,15 +3,18 @@ export class MetricsResource {
|
|
|
3
3
|
constructor(t) {
|
|
4
4
|
this.t = t;
|
|
5
5
|
}
|
|
6
|
+
/** GET /metrics — Prometheus 文本原文(`text/plain; version=0.0.4`)。404=metrics 关闭。 */
|
|
6
7
|
async prometheus(opts) {
|
|
7
8
|
const res = await this.t.openRaw({ method: "GET", path: "/metrics", accept: "text/plain", ...(opts?.signal ? { signal: opts.signal } : {}) });
|
|
8
9
|
if (!res.ok)
|
|
9
10
|
throw new Error(`GET /metrics → HTTP ${res.status}`);
|
|
10
11
|
return res.text();
|
|
11
12
|
}
|
|
13
|
+
/** GET /metrics/summary — 指标汇总 JSON(`{model, ...metrics.summarize()}`,开集)。 */
|
|
12
14
|
async summary(opts) {
|
|
13
15
|
return this.t.request({ method: "GET", path: "/metrics/summary", signal: opts?.signal });
|
|
14
16
|
}
|
|
17
|
+
/** GET /metrics/plan-cache — per-scope objective 复发探针 dump(core design/42;开集)。 */
|
|
15
18
|
async planCache(opts) {
|
|
16
19
|
return this.t.request({ method: "GET", path: "/metrics/plan-cache", signal: opts?.signal });
|
|
17
20
|
}
|
|
@@ -21,6 +24,7 @@ export class OutcomesResource {
|
|
|
21
24
|
constructor(t) {
|
|
22
25
|
this.t = t;
|
|
23
26
|
}
|
|
27
|
+
/** GET /v1/outcomes?signature=&includeAborted= — 结局台账 `{outcomes: rows}`。 */
|
|
24
28
|
async list(opts) {
|
|
25
29
|
const q = new URLSearchParams();
|
|
26
30
|
if (opts?.signature)
|
|
@@ -36,6 +40,8 @@ export class SendfileLinksResource {
|
|
|
36
40
|
constructor(t) {
|
|
37
41
|
this.t = t;
|
|
38
42
|
}
|
|
43
|
+
/** GET /v1/sendfile-links — 台账分页。`limit` 1..100(缺省 50);`before` = 上页 `nextBefore`/行 `id`
|
|
44
|
+
* (uuidv7,坏形 400 fail-loud——F6 修后绝不静默降级);`scope` 仅 fleet 凭证生效。 */
|
|
39
45
|
async list(opts) {
|
|
40
46
|
const q = new URLSearchParams();
|
|
41
47
|
if (opts?.limit !== undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../src/resources/ops.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,CAAY;QAAZ,MAAC,GAAD,CAAC,CAAW;IAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../src/resources/ops.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,CAAY;QAAZ,MAAC,GAAD,CAAC,CAAW;IAAG,CAAC;IAE7C,kFAAkF;IAClF,KAAK,CAAC,UAAU,CAAC,IAA+B;QAC9C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9I,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAClE,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAED,8EAA8E;IAC9E,KAAK,CAAC,OAAO,CAAC,IAA+B;QAC3C,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,kFAAkF;IAClF,KAAK,CAAC,SAAS,CAAC,IAA+B;QAC7C,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE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CAAC;QAC/C,IAAI,IAAI,EAAE,KAAK;YAAE,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,MAAM,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAClH,CAAC;CACF"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
/** policy — §permissions 面板的**只读**数据源(service `GET /v1/policy`,实测形态 the pinned wire contract)。
|
|
2
|
+
*
|
|
3
|
+
* `get` = `GET /v1/policy` → `PolicyInfo`(生效自治档 + 命令策略表 + 审批条件 + 上限)。
|
|
4
|
+
* CLI `/permissions` 面板渲它显「现在能自动做什么、哪些要审批、上限多少」(取代静态占位,真实反映 worker 策略)。
|
|
5
|
+
*
|
|
6
|
+
* 🔴 只读快照:client **绝不**据此放行/重算决策(命令准入/审批 enforcement 100% 在 worker;面板只 inspect)。
|
|
7
|
+
* 失败由 caller fail-safe(空 policy → 面板显「策略不可达」,绝不阻断)。 */
|
|
1
8
|
import type { Transport } from "../transport.js";
|
|
2
9
|
import type { PolicyInfo } from "../types.js";
|
|
3
10
|
export declare class PolicyResource {
|
|
4
11
|
private readonly t;
|
|
5
12
|
constructor(t: Transport);
|
|
13
|
+
/** GET /v1/policy — 当前生效策略快照(autonomy/commandPolicy/approvalRequire/limits)。 */
|
|
6
14
|
get(opts?: {
|
|
7
15
|
signal?: AbortSignal;
|
|
8
16
|
}): Promise<PolicyInfo>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/resources/policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/resources/policy.ts"],"names":[],"mappings":"AAAA;;;;;;2DAM2D;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAAD,CAAC,EAAE,SAAS;IAEzC,gFAAgF;IAC1E,GAAG,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC;CAGhE"}
|
package/dist/resources/policy.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/resources/policy.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,CAAY;QAAZ,MAAC,GAAD,CAAC,CAAW;IAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/resources/policy.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,cAAc;IACI;IAA7B,YAA6B,CAAY;QAAZ,MAAC,GAAD,CAAC,CAAW;IAAG,CAAC;IAE7C,gFAAgF;IAChF,KAAK,CAAC,GAAG,CAAC,IAA+B;QACvC,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACrF,CAAC;CACF"}
|
|
@@ -1,29 +1,77 @@
|
|
|
1
|
+
/** questions — §4④ (tool-panorama) live-stream AskUserQuestion HITL (core 1.16x `RunnerDeps.onQuestion`
|
|
2
|
+
* seam; service `question.ts`, SHIPPED behind `ASK_QUESTION_ENABLED` — single-user turnkey defaults ON per core
|
|
3
|
+
* pinned posture). The SIBLING of {@link import("./elicitations.js").ElicitationsResource}: elicitation is an
|
|
4
|
+
* INBOUND-MCP-server ask; this is the AGENT's OWN `AskUserQuestion` tool — a structured multiple-choice question
|
|
5
|
+
* to the END USER (which approach? which of these?). core EMITS the call; the deployment routes it to a live human
|
|
6
|
+
* over the run's stream and returns their {@link QuestionAnswer}.
|
|
7
|
+
*
|
|
8
|
+
* 🔴 LIVE-ONLY + SAME-REPLICA (the `steer()`-class of HITL, NOT the durable approval/checkpoint class): the parked
|
|
9
|
+
* promise is in-memory, so a respond that lands on another replica / after answer / after the TTL (5 min) finds
|
|
10
|
+
* nothing → 404. The durable-disconnected-human variant is wired SEPARATELY upstream (`QUESTION_AWAITS_RESUME` — the
|
|
11
|
+
* ask suspends and a resume carries the answer); a crash loses an in-flight LIVE question (acceptable for an
|
|
12
|
+
* interactive shell — core then proceeds with the headless "no answer" default so the run never hangs).
|
|
13
|
+
*
|
|
14
|
+
* 🔴 The `question`/`question_complete` FRAMES are NOT delivered as `AgentEvent` arms — they are a DISTINCT
|
|
15
|
+
* vocabulary that interleaves on the live token stream (exactly like elicitation). Tail them off `tasks.streamRaw`
|
|
16
|
+
* and dispatch on the SSE `event:` name (the payload also carries `type`, so a name-stripping proxy still works);
|
|
17
|
+
* parse the `data:` with this resource's {@link QuestionFrame} type. Then resolve via {@link QuestionsResource.respond}.
|
|
18
|
+
*
|
|
19
|
+
* 🔴 UNTRUSTED: the model-authored `questions` are service secret-redacted before streaming, but remain UNTRUSTED
|
|
20
|
+
* for display (the shell renders them; NEVER re-feed to a model). The ANSWER fence is CORE's — core echoes a
|
|
21
|
+
* `selected` value ONLY if it is one of the offered option labels (`selected ⊆ options`) and wraps the free-text
|
|
22
|
+
* `note` in an untrusted-DATA fence (design/80 D-F), so a wire answer can never be read as instructions. */
|
|
1
23
|
import type { Transport } from "../transport.js";
|
|
24
|
+
/** One offered choice (core `AskQuestionOption`, ask-question.ts:25). */
|
|
2
25
|
export interface AskQuestionOption {
|
|
26
|
+
/** The choice text the user picks. */
|
|
3
27
|
label: string;
|
|
28
|
+
/** What this option means / its trade-off. */
|
|
4
29
|
description: string;
|
|
5
30
|
}
|
|
31
|
+
/** A single model-authored question (core `AskQuestion`, ask-question.ts:32). UNTRUSTED-for-display. */
|
|
6
32
|
export interface AskQuestion {
|
|
33
|
+
/** The full question. */
|
|
7
34
|
question: string;
|
|
35
|
+
/** A short header/label (≤ ~12 chars) for UIs. Also the KEY the answer echoes back in {@link QuestionAnswerItem}. */
|
|
8
36
|
header: string;
|
|
37
|
+
/** 2-4 mutually-exclusive choices (unless `multiSelect`). */
|
|
9
38
|
options: AskQuestionOption[];
|
|
39
|
+
/** Allow selecting more than one option. */
|
|
10
40
|
multiSelect?: boolean;
|
|
11
41
|
}
|
|
42
|
+
/** A live question frame interleaved on the run's `tasks.streamRaw` connection (service `QuestionFrame`
|
|
43
|
+
* question.ts:37-46). `type` IS the SSE `event:` name AND is echoed in the payload. The shell renders the
|
|
44
|
+
* `question` frame as a multiple-choice dialog and dismisses it on `question_complete`. */
|
|
12
45
|
export interface QuestionFrame {
|
|
13
46
|
type: "question" | "question_complete";
|
|
47
|
+
/** The id to echo back to {@link QuestionsResource.respond}. */
|
|
14
48
|
questionId: string;
|
|
49
|
+
/** "question" only: the model's structured questions, secret-redacted. UNTRUSTED — never re-feed to a model.
|
|
50
|
+
* Absent on an over-cap payload (the ask then headless-defaults; the shell never sees it to render). */
|
|
15
51
|
questions?: AskQuestion[];
|
|
52
|
+
/** "question_complete" only: how it resolved (dialog dismiss reason). `answered` = a human responded;
|
|
53
|
+
* `unanswered` = ttl / abort / throttle released it (the model got the headless default). Cosmetic. */
|
|
16
54
|
outcome?: "answered" | "unanswered";
|
|
17
55
|
[k: string]: unknown;
|
|
18
56
|
}
|
|
57
|
+
/** One question's answer (core `QuestionAnswerItem`, ask-question.ts:63). `selected` is the option label(s) the
|
|
58
|
+
* user clicked — echoed EXACTLY (core fences `selected ⊆ options`); `note` is the optional free-text (off-list
|
|
59
|
+
* input / annotations), untrusted-fenced by core. Keyed by the question's `header`. */
|
|
19
60
|
export interface QuestionAnswerItem {
|
|
20
61
|
header: string;
|
|
62
|
+
/** The chosen option label(s). Single-select → a one-element array; multiSelect → 0..n labels. MUST echo the
|
|
63
|
+
* exact labels the user saw (core rejects any `selected` not in the offered options). */
|
|
21
64
|
selected: string[];
|
|
65
|
+
/** Optional free-text note / off-list ("Other") input. Core wraps it in an untrusted-DATA fence. */
|
|
22
66
|
note?: string;
|
|
23
67
|
}
|
|
68
|
+
/** The shell's answer to a {@link QuestionFrame} (= core's `QuestionAnswer`, ask-question.ts:69). The service
|
|
69
|
+
* validates only this OUTER shape (`answers[]` of `{header, selected:string[], note?}`); core owns the semantic
|
|
70
|
+
* fence (`selected ⊆ options`, `note` untrusted). */
|
|
24
71
|
export interface QuestionAnswer {
|
|
25
72
|
answers: QuestionAnswerItem[];
|
|
26
73
|
}
|
|
74
|
+
/** The 200 ack from a successful respond (service `respond`, question.ts:226). */
|
|
27
75
|
export interface QuestionRespondAck {
|
|
28
76
|
questionId: string;
|
|
29
77
|
delivery: "applied";
|
|
@@ -31,6 +79,15 @@ export interface QuestionRespondAck {
|
|
|
31
79
|
export declare class QuestionsResource {
|
|
32
80
|
private readonly t;
|
|
33
81
|
constructor(t: Transport);
|
|
82
|
+
/** POST /v1/questions/:id/respond — resolve a parked LIVE AskUserQuestion with the user's selection. The
|
|
83
|
+
* resolved value flows back to the model on the still-open task connection (the model's AskUserQuestion tool
|
|
84
|
+
* call returns it).
|
|
85
|
+
*
|
|
86
|
+
* 🔴 OWNER-GATED with a 404 (NO existence oracle): a non-owner AND an unknown/answered/expired/wrong-replica id
|
|
87
|
+
* both get 404 — never branch a "does this id exist" decision off the status. A malformed body is a 400
|
|
88
|
+
* (existence-independent, like steer/elicit). A worker without `ASK_QUESTION_ENABLED` → 501.
|
|
89
|
+
*
|
|
90
|
+
* Not a submit / not idempotent (it resolves an in-flight promise exactly once) → NO SDK retry. */
|
|
34
91
|
respond(id: string, answer: QuestionAnswer, opts?: {
|
|
35
92
|
signal?: AbortSignal;
|
|
36
93
|
}): Promise<QuestionRespondAck>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/resources/questions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"questions.d.ts","sourceRoot":"","sources":["../../src/resources/questions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;6GAqB6G;AAC7G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,yEAAyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wGAAwG;AACxG,MAAM,WAAW,WAAW;IAC1B,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,qHAAqH;IACrH,MAAM,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,4CAA4C;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;4FAE4F;AAC5F,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,GAAG,mBAAmB,CAAC;IACvC,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB;6GACyG;IACzG,SAAS,CAAC,EAAE,WAAW,EAAE,CAAC;IAC1B;4GACwG;IACxG,OAAO,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;IACpC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAED;;wFAEwF;AACxF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf;8FAC0F;IAC1F,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,oGAAoG;IACpG,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;sDAEsD;AACtD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED,kFAAkF;AAClF,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,CAAC;gBAAD,CAAC,EAAE,SAAS;IAEzC;;;;;;;;wGAQoG;IAC9F,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAQhH"}
|
|
@@ -3,6 +3,15 @@ export class QuestionsResource {
|
|
|
3
3
|
constructor(t) {
|
|
4
4
|
this.t = t;
|
|
5
5
|
}
|
|
6
|
+
/** POST /v1/questions/:id/respond — resolve a parked LIVE AskUserQuestion with the user's selection. The
|
|
7
|
+
* resolved value flows back to the model on the still-open task connection (the model's AskUserQuestion tool
|
|
8
|
+
* call returns it).
|
|
9
|
+
*
|
|
10
|
+
* 🔴 OWNER-GATED with a 404 (NO existence oracle): a non-owner AND an unknown/answered/expired/wrong-replica id
|
|
11
|
+
* both get 404 — never branch a "does this id exist" decision off the status. A malformed body is a 400
|
|
12
|
+
* (existence-independent, like steer/elicit). A worker without `ASK_QUESTION_ENABLED` → 501.
|
|
13
|
+
*
|
|
14
|
+
* Not a submit / not idempotent (it resolves an in-flight promise exactly once) → NO SDK retry. */
|
|
6
15
|
async respond(id, answer, opts) {
|
|
7
16
|
return this.t.request({
|
|
8
17
|
method: "POST",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"questions.js","sourceRoot":"","sources":["../../src/resources/questions.ts"],"names":[],"mappings":"AAqFA,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,CAAY;QAAZ,MAAC,GAAD,CAAC,CAAW;IAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"questions.js","sourceRoot":"","sources":["../../src/resources/questions.ts"],"names":[],"mappings":"AAqFA,MAAM,OAAO,iBAAiB;IACC;IAA7B,YAA6B,CAAY;QAAZ,MAAC,GAAD,CAAC,CAAW;IAAG,CAAC;IAE7C;;;;;;;;wGAQoG;IACpG,KAAK,CAAC,OAAO,CAAC,EAAU,EAAE,MAAsB,EAAE,IAA+B;QAC/E,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAqB;YACxC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,iBAAiB,kBAAkB,CAAC,EAAE,CAAC,UAAU;YACvD,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,IAAI,EAAE,MAAM;SACrB,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/resources/runs.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
/** runs — asynchronous + resumable. create (POST /v1/runs → 202) / get (GET /v1/runs/:id) / events (GET
|
|
2
|
+
* /v1/runs/:id/events, SSE Last-Event-ID resume) / cancel (POST /v1/runs/:id/cancel — LIVE, service ced3d88 /
|
|
3
|
+
* the pinned wire contract; the SDK verb runs.cancel(id) lands at M1.5: 202 ack → run settles failed+errorCode:"cancelled"). */
|
|
1
4
|
import type { Transport } from "../transport.js";
|
|
2
5
|
import type { TaskRequest, RunReceipt, RunRecord, CancelAck } from "../types.js";
|
|
3
6
|
import type { AgentEvent } from "../events.js";
|
|
7
|
+
/** server 1.89 subagent-steer receipt (2xx body). `note` = the CC-verbatim queued copy. `marker` = the
|
|
8
|
+
* engine-minted delivery marker (server 1.214 subagent verb region, server.js:1828/1832 — present on both
|
|
9
|
+
* steer and resume 200s). */
|
|
4
10
|
export interface SubagentSteerReceipt {
|
|
5
11
|
taskId: string;
|
|
6
12
|
target: string;
|
|
@@ -9,6 +15,11 @@ export interface SubagentSteerReceipt {
|
|
|
9
15
|
note?: string;
|
|
10
16
|
marker?: string;
|
|
11
17
|
}
|
|
18
|
+
/** server 1.244 ([1488]③b) subagent-output 200 body. `content` = the engine TaskOutput-tool text (the
|
|
19
|
+
* child's final assistant body once terminal — UNTRUSTED model output, same posture as a run `result`).
|
|
20
|
+
* `output` = the engine registry's UnifiedTaskOutput projection, passed through verbatim: `status`
|
|
21
|
+
* (pending/running/completed/failed/killed), `retrieval_status` ("success" once readable), plus
|
|
22
|
+
* error/stoppedBy/partial_result when set. */
|
|
12
23
|
export interface SubagentOutputResult {
|
|
13
24
|
taskId: string;
|
|
14
25
|
target: string;
|
|
@@ -24,12 +35,19 @@ export interface SubagentOutputResult {
|
|
|
24
35
|
details?: unknown;
|
|
25
36
|
};
|
|
26
37
|
}
|
|
38
|
+
/** K-1c manual-compact 202 ack (server 1.214 server.js:1657 — exact literal shape: `status:"running"`,
|
|
39
|
+
* `delivery:"accepted"`, `note` = the "compaction will run at the next turn boundary…" copy). The ack is an
|
|
40
|
+
* ACCEPTANCE, not an outcome: compaction runs at the next turn boundary and a `compacted{trigger:"manual"}`
|
|
41
|
+
* event rides the run stream ONLY if anything was summarized (mooted/failed → no event, see trace). */
|
|
27
42
|
export interface CompactAck {
|
|
28
43
|
taskId: string;
|
|
29
44
|
status?: string;
|
|
30
45
|
delivery?: string;
|
|
31
46
|
note?: string;
|
|
32
47
|
}
|
|
48
|
+
/** Detach 202 ack (server 1.214 server.js:1703 — exact literal shape: `toolCallId` echoed,
|
|
49
|
+
* `delivery:"requested"`, `note` = the fail-safe no-op copy). Fire-and-forget semantics: acceptance only —
|
|
50
|
+
* the authoritative outcome is the tool call's own `tool_end.structured {detached:true, task_id}`. */
|
|
33
51
|
export interface DetachAck {
|
|
34
52
|
taskId: string;
|
|
35
53
|
toolCallId?: string;
|
|
@@ -39,6 +57,12 @@ export interface DetachAck {
|
|
|
39
57
|
export declare class RunsResource {
|
|
40
58
|
private readonly t;
|
|
41
59
|
constructor(t: Transport);
|
|
60
|
+
/** server 1.246 ([1499] accept-phase, [1498]⑥ two-拍 rollout) — `?session=` on the legacy run faces.
|
|
61
|
+
* principal answers "whose data"; session answers "which conversation" ([1493]). Pass your conversation's
|
|
62
|
+
* sessionId (the one POST /v1/runs bound) on get/events/cancel/steer/compact/detach and the subagent
|
|
63
|
+
* verbs: today a MISMATCH on a session-bound run 404s (a match/absence passes; absence logs a server-side
|
|
64
|
+
* migration warning), and the enforcement train will 404 absence too — so new code should always send it.
|
|
65
|
+
* NB send a real sessionId or nothing: an EMPTY string counts as present-and-mismatched (404). */
|
|
42
66
|
private sessionQs;
|
|
43
67
|
create(req: TaskRequest, opts?: {
|
|
44
68
|
idempotencyKey?: string | null;
|
|
@@ -48,19 +72,50 @@ export declare class RunsResource {
|
|
|
48
72
|
session?: string;
|
|
49
73
|
signal?: AbortSignal;
|
|
50
74
|
}): Promise<RunRecord>;
|
|
75
|
+
/** Cancel a durable async run (LIVE). 202 ack (`cancelling` or terminal no-op); the run settles
|
|
76
|
+
* to failed+errorCode:"cancelled". 409 = suspended (cancel by DENYING its approval instead); 404 = non-owner/
|
|
77
|
+
* unknown (no existence leak). Server-side idempotent; not a submit → no SDK retry. */
|
|
51
78
|
cancel(taskId: string, opts?: {
|
|
52
79
|
session?: string;
|
|
53
80
|
signal?: AbortSignal;
|
|
54
81
|
}): Promise<CancelAck>;
|
|
82
|
+
/** core 1.207 / server 1.78 — DETACH an in-flight tool call (the CC ctrl+b tool-level semantic): the engine
|
|
83
|
+
* adopts the RUNNING process into a background task (spool pre-filled with captured output), the tool call
|
|
84
|
+
* returns early with `Command moved to background; task_id=b*…` (+ `tool_end.structured
|
|
85
|
+
* {type:"bash", detached:true, task_id}`), and the run's turn continues. Fire-and-forget create-then-abort
|
|
86
|
+
* semantics: early/late requests are safe (after completion = no-op). 202 = accepted; 409
|
|
87
|
+
* `detach.not_running` = no such in-flight call; 404 = non-owner/unknown (no existence leak).
|
|
88
|
+
* Works on the sync interactive leg too (server 1.78 registers the live handle). `toolCallId` <= 256 chars. */
|
|
55
89
|
detach(taskId: string, toolCallId: string, opts?: {
|
|
56
90
|
session?: string;
|
|
57
91
|
signal?: AbortSignal;
|
|
58
92
|
}): Promise<DetachAck>;
|
|
93
|
+
/** K-1c (core 1.156 `TaskStream.compact()` / server 1.214 server.js:1596) — MANUAL COMPACT a RUNNING durable
|
|
94
|
+
* run (the CC `/compact` semantic): the engine summarizes the context at the next turn boundary; if anything
|
|
95
|
+
* was summarized a `compacted{trigger:"manual"}` event rides the run's event stream. `instructions` (≤2048
|
|
96
|
+
* code points, non-empty when present — else 400) focuses the summary ("keep the file list", CC parity).
|
|
97
|
+
*
|
|
98
|
+
* Fire-and-forget acceptance: 202 {@link CompactAck} means QUEUED, not compacted — the outcome arrives (or
|
|
99
|
+
* doesn't: mooted/failed compactions emit NO event) on the stream. 🔴 REPLICA-LOCAL like steer/detach:
|
|
100
|
+
* 409 `compact.not_running` = the run settled OR lives on another replica; 501 = no run store (gate on
|
|
101
|
+
* `capabilities.manualCompact`, don't trial-by-501); 404 = non-owner/unknown (no existence leak).
|
|
102
|
+
* Not a submit / server treats repeat calls as fresh asks → NO SDK retry. */
|
|
59
103
|
compact(taskId: string, opts?: {
|
|
60
104
|
instructions?: string;
|
|
61
105
|
session?: string;
|
|
62
106
|
signal?: AbortSignal;
|
|
63
107
|
}): Promise<CompactAck>;
|
|
108
|
+
/** design/80 D-A — STEER a RUNNING durable run: inject mid-flight direction (the core of *supervision* vs mere
|
|
109
|
+
* approve/deny). AT-MOST-ONCE — steer is NOT idempotent, so NO submit/retry. `trusted` is NOT a body field:
|
|
110
|
+
* the server derives it from the authenticated operator (the BFF's operator role), never a client-set flag.
|
|
111
|
+
* 🔴 STEER ITSELF IS LIVE/SHIPPED (service §K-6, runStore-gated): 200 = injected into the live run;
|
|
112
|
+
* 202 = PARKED on a checkpoint (delivered when the run next runs); a durable-`suspended` run → typed
|
|
113
|
+
* `SteeringNotRunningError` (`steering.not_running`, 409); a trusted text carrying a control-plane escape →
|
|
114
|
+
* `SteeringInvalidContentError` (`steering.invalid_content`, 422). 🔴 ONE narrow caveat (NOT "steer is a draft"):
|
|
115
|
+
* the per-call `mode` arg is currently a NO-OP — core's steer is HARNESS-LEVEL (`setSteeringMode`), set globally
|
|
116
|
+
* on the runner, not switched per steer call; the `mode` mapping is pending D-A core (search [76]). Sending `mode`
|
|
117
|
+
* is harmless (ignored); steer delivery itself works today. `mode` semantics (when wired): "all" = drain ALL
|
|
118
|
+
* queued steers at the next turn boundary; "one-at-a-time" (default) = one per turn, FIFO. */
|
|
64
119
|
steer(taskId: string, steer: {
|
|
65
120
|
text: string;
|
|
66
121
|
mode?: "all" | "one-at-a-time";
|
|
@@ -68,30 +123,115 @@ export declare class RunsResource {
|
|
|
68
123
|
session?: string;
|
|
69
124
|
signal?: AbortSignal;
|
|
70
125
|
}): Promise<unknown>;
|
|
126
|
+
/** core 1.219 C2 / server 1.89 — STEER a RUNNING SUBAGENT of this run (the CC "enter the agent's view and
|
|
127
|
+
* type to it" semantic, `AGe` pendingMessages: the message drains at the subagent's NEXT TOOL ROUND).
|
|
128
|
+
* `target` = the delegating tool call's id (`parentToolCallId`, stamped on every forwarded subagent
|
|
129
|
+
* content event) or the agentName (ambiguous name → 409). 🔴 BODY SHAPE differs from the main-run steer:
|
|
130
|
+
* `{ content }` (server SubagentSteerRegistry contract), NOT `{ text }`. Receipt: 200 with
|
|
131
|
+
* `{ taskId, target, status, delivery, note }` — `note` carries the CC-verbatim
|
|
132
|
+
* "Message queued for delivery to <name> at its next tool round."; a settled/unknown subagent →
|
|
133
|
+
* `steering.not_running` 409 (same typed error family as the main-run verb). AT-MOST-ONCE (no retry). */
|
|
71
134
|
steerSubagent(taskId: string, target: string, steer: {
|
|
72
135
|
content: string;
|
|
73
136
|
}, opts?: {
|
|
74
137
|
session?: string;
|
|
75
138
|
signal?: AbortSignal;
|
|
76
139
|
}): Promise<SubagentSteerReceipt>;
|
|
140
|
+
/** server 1.214 (server.js:1774 subagent-verb region, `verb === "resume"` arm) — RESUME/REVIVE a SETTLED
|
|
141
|
+
* subagent of this run with a follow-up message (the CC "keep talking to the finished agent" semantic):
|
|
142
|
+
* the engine re-opens the subagent's retained session in the background and delivers `content` as its next
|
|
143
|
+
* user turn. Same addressing as {@link steerSubagent} (`target` = parentToolCallId or agentName; ambiguous
|
|
144
|
+
* name → 409 `steering.ambiguous_target`), same `{ content }` body (non-empty, else 400), same
|
|
145
|
+
* {@link SubagentSteerReceipt} 200 (note = "Message queued for delivery to <name>; it will continue in the
|
|
146
|
+
* background.", + `marker`).
|
|
147
|
+
*
|
|
148
|
+
* 🔴 Requires the PARENT run to have retained subagent sessions — the typed-409 family tells you why not:
|
|
149
|
+
* `resume.retain_off` (run didn't set retainSubagentSessions) / `resume.evicted` / `resume.cap` /
|
|
150
|
+
* `resume.session_not_found` (retention lapsed) / `steering.still_running` (it's in flight — STEER instead)
|
|
151
|
+
* / `steering.not_running` (no match on this replica / run settled). Gate on `capabilities.subagentResume`.
|
|
152
|
+
* 404 = non-owner/unknown run (no existence leak). AT-MOST-ONCE (no retry). */
|
|
77
153
|
resumeSubagent(taskId: string, target: string, message: {
|
|
78
154
|
content: string;
|
|
79
155
|
}, opts?: {
|
|
80
156
|
session?: string;
|
|
81
157
|
signal?: AbortSignal;
|
|
82
158
|
}): Promise<SubagentSteerReceipt>;
|
|
159
|
+
/** server 1.244 ([1488]③b) — read a BACKGROUND child's final report / current status. `target` = the
|
|
160
|
+
* agent handle (a… domain, `background_agent` ONLY — wa… workflow-agent observation rows read via the
|
|
161
|
+
* workflow journal face, and other task kinds 404 here) from the parent's spawn (bg children are NEVER
|
|
162
|
+
* in the run store — GET /v1/runs/:handle 404s
|
|
163
|
+
* with guidance; THIS verb is the read face: the engine TaskRegistry's TaskOutput-tool projection over HTTP).
|
|
164
|
+
* 200 `{ taskId, target, content, output }`: `content` = the TaskOutput text (the child's final assistant
|
|
165
|
+
* body once terminal; honest status text while running), `output` = the registry's UnifiedTaskOutput
|
|
166
|
+
* (status/retrieval_status/partial flags verbatim). Non-blocking (no long-poll). server 1.250: no longer
|
|
167
|
+
* replica-local — a full in-process miss falls back to the durable agent record (cross-instance /
|
|
168
|
+
* post-restart): terminal = final snapshot served, still-running-elsewhere = honest "outcome unknown
|
|
169
|
+
* here". 404 = unknown run / non-owner / unknown handle / no durable row (one indistinguishable arm, no oracle).
|
|
170
|
+
*
|
|
171
|
+
* 🔴 server 1.245 [1493]: this is a CONVERSATION-CONTENT read, so it is SESSION-scoped, not just
|
|
172
|
+
* principal-scoped — pass `session` (your own conversation's sessionId, the one POST /v1/runs returned). A
|
|
173
|
+
* session-bound run served to a caller that omits or mismatches the session → 404 (fail-closed): a sibling
|
|
174
|
+
* session sharing your principal must not read another conversation's child. (Operators/trace bypass.)
|
|
175
|
+
* Gate on `capabilities.subagentOutput`. */
|
|
83
176
|
subagentOutput(taskId: string, target: string, opts?: {
|
|
84
177
|
session?: string;
|
|
85
178
|
signal?: AbortSignal;
|
|
86
179
|
}): Promise<SubagentOutputResult>;
|
|
180
|
+
/** server 1.246 ([1499]) — the GENERIC background task-handle read (CC TaskOutput 对位): serves
|
|
181
|
+
* background_bash (stdout — whether a read consumes the output cursor depends on the handle's shape:
|
|
182
|
+
* spooled handles re-read in full, cursor-only handles return only new bytes; trust the projection's own
|
|
183
|
+
* flags), monitor (batches), and background_agent (final report). A workflow handle 404s (its read face is
|
|
184
|
+
* the workflow journal). 🔴 `target` is the CANONICAL task handle only (b…/m…/a… task_id from the spawn) —
|
|
185
|
+
* the in-engine tools' agent-name / legacy-id resolution is NOT on the wire (404). 🔴 NO server-side
|
|
186
|
+
* filter: `?filter=` is REFUSED with 400 on both verbs (wire-supplied regexes don't run on the server) —
|
|
187
|
+
* fetch the output and apply your regex locally, knowing the wire serves the CLIPPED projection (matches
|
|
188
|
+
* inside a clipped middle are not recoverable, and a cursor-only bash leg consumes what it serves; the
|
|
189
|
+
* in-engine tool filters before clipping and keeps full fidelity). SESSION-
|
|
190
|
+
* scoped like {@link subagentOutput} — pass your conversation's `session`; a session-bound run without/with
|
|
191
|
+
* a mismatched one → 404 fail-closed (operators bypass). Non-blocking. server 1.250: an `a*` handle is
|
|
192
|
+
* no longer replica-local — a full in-process miss falls back to the durable record (cross-instance /
|
|
193
|
+
* post-restart): terminal rows serve the final snapshot, a row still running on another replica answers
|
|
194
|
+
* an honest "outcome unknown here" (never fabricated liveness). `b*`/`m*` handles stay replica-local
|
|
195
|
+
* (no durable face). Gate on
|
|
196
|
+
* `capabilities.taskHandles`. */
|
|
87
197
|
taskOutput(taskId: string, target: string, opts?: {
|
|
88
198
|
session?: string;
|
|
89
199
|
signal?: AbortSignal;
|
|
90
200
|
}): Promise<SubagentOutputResult>;
|
|
201
|
+
/** server 1.246 ([1499]) — stop a background task handle (CC TaskStop 对位): bash kill / monitor stop /
|
|
202
|
+
* agent abort, attributed "user" (`output.stoppedBy`). Idempotent on a terminal handle — the 200
|
|
203
|
+
* `output.status` tells you what actually happened. 🔴 A kill that does NOT land is a 409
|
|
204
|
+
* `stop.not_landed` (body carries the honest projection: `output.status` stays "running") — never a 200;
|
|
205
|
+
* treat only 200 as stopped. server 1.250 durable arm: an `a*` handle NOT attached to this replica
|
|
206
|
+
* (cross-instance / post-restart) answers from the durable record — terminal row = 200 already-terminal
|
|
207
|
+
* (idempotent-honest), still-running-elsewhere = 409 `stop.not_local` (no kill was attempted; distinct
|
|
208
|
+
* from not_landed). Same session scoping + kind set + canonical-handle
|
|
209
|
+
* addressing as {@link taskOutput} (a workflow handle 404s — stop workflows via their cancel face). Gate
|
|
210
|
+
* on `capabilities.taskHandles`. */
|
|
91
211
|
taskStop(taskId: string, target: string, opts?: {
|
|
92
212
|
session?: string;
|
|
93
213
|
signal?: AbortSignal;
|
|
94
214
|
}): Promise<SubagentOutputResult>;
|
|
215
|
+
/** server 1.251(S2,core 1.370 `bgAgentId`)— a background child's per-agent **live tail** (SSE):
|
|
216
|
+
* `GET /v1/runs/:id/subagents/:handle/stream`. The "tail" half of replay+tail — {@link subagentOutput}
|
|
217
|
+
* (+AgentTranscript in-engine) is the replay half. Frames: `meta` (once — carries `status` and
|
|
218
|
+
* `live:"replica-local"`; on a TERMINAL child the stream ends right after it, go read the replay face),
|
|
219
|
+
* `forward` (content: text_delta / reasoning_delta / tool_start / tool_end / task_progress — same
|
|
220
|
+
* projection discipline as the main run stream's forward branch, plus a bus-level
|
|
221
|
+
* `{type:"lagged",dropped}` marker when a slow consumer dropped frames — honest, never silent), and
|
|
222
|
+
* `heartbeat` (ignore), and `{type:"task_settled",status,seq?}` — the child settled MID-stream (the server
|
|
223
|
+
* writes it and ends the stream; the full story continues on the replay face). Live frames are REPLICA-LOCAL (produced only where the host run executes) — a
|
|
224
|
+
* child running on another replica yields heartbeats only. Same addressing/gates/404-shape as
|
|
225
|
+
* {@link subagentOutput} (session-enforced). Stop-cycle `seq` (server 1.255 + core 1.373): the
|
|
226
|
+
* `task_settled` frame carries the settle-minted generation number (1 = first settle; ≥2 = a revived
|
|
227
|
+
* child settling again) — the real-time revive discriminator. The `meta` frame's optional `seq` appears
|
|
228
|
+
* ONLY when the probe served a terminal durable row cross-instance/post-restart (in-process polls do not
|
|
229
|
+
* project it — its absence does NOT mean "never settled"). Consumption notes (server 1.253): after a `task_settled`
|
|
230
|
+
* close, a REVIVED child (stop-cycle seq≥2) = open a NEW stream; after a `lagged` marker the dropped
|
|
231
|
+
* frames are NOT recoverable on this lane — rebuild from the replay face, then re-tail. NESTED bg
|
|
232
|
+
* children's frames merge into the OUTERMOST handle's stream (core overwrites bgAgentId per bg boundary;
|
|
233
|
+
* discriminate nested frames by parentToolCallId) — a nested handle's own stream carries meta+heartbeat
|
|
234
|
+
* only. Gate on `capabilities.subagentStream`. */
|
|
95
235
|
subagentStream(taskId: string, target: string, opts?: {
|
|
96
236
|
session?: string;
|
|
97
237
|
signal?: AbortSignal;
|
|
@@ -99,6 +239,9 @@ export declare class RunsResource {
|
|
|
99
239
|
event: string;
|
|
100
240
|
data: Record<string, unknown>;
|
|
101
241
|
}>;
|
|
242
|
+
/** Resumable event stream. Internally: SSE + Last-Event-ID auto-reconnect; on a 416 (evicted past retention,
|
|
243
|
+
* body `{error,retainedFrom}` — match status, no RESUME_EVICTED code) → full-sync via trace.turns then resume
|
|
244
|
+
* from `retainedFrom` (sse.ts). Established-stream drops do NOT count as retries. */
|
|
102
245
|
events(taskId: string, opts?: {
|
|
103
246
|
session?: string;
|
|
104
247
|
signal?: AbortSignal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/resources/runs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runs.d.ts","sourceRoot":"","sources":["../../src/resources/runs.ts"],"names":[],"mappings":"AAAA;;iIAEiI;AACjI,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C;;8BAE8B;AAC9B,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;+CAI+C;AAC/C,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,KAAK,CAA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