@agent-compose/sdk 0.7.0 → 0.8.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 +66 -39
- package/dist/agent/__tests__/runtime-json-schema.test.d.ts +10 -0
- package/dist/agent/agent-context.d.ts +21 -1
- package/dist/agent/agent-loop.d.ts +24 -1
- package/dist/client.d.ts +338 -534
- package/dist/directives.d.ts +112 -0
- package/dist/display.d.ts +242 -0
- package/dist/errors.d.ts +24 -1
- package/dist/index.d.ts +24 -12
- package/dist/index.js +3545 -1667
- package/dist/pause/wrappers.d.ts +31 -9
- package/dist/runtimes/_acp-client.d.ts +46 -1
- package/dist/runtimes/_cli-agent.d.ts +49 -4
- package/dist/runtimes/_jsonl-guard.d.ts +103 -0
- package/dist/runtimes/amp.d.ts +2 -2
- package/dist/runtimes/claude-code.d.ts +59 -0
- package/dist/runtimes/claude-code.test.d.ts +14 -0
- package/dist/runtimes/claude.d.ts +16 -0
- package/dist/runtimes/claude.test.d.ts +8 -0
- package/dist/runtimes/codex.d.ts +9 -3
- package/dist/runtimes/cursor.d.ts +2 -2
- package/dist/runtimes/droid.d.ts +2 -2
- package/dist/runtimes/jsonl-guard.test.d.ts +19 -0
- package/dist/runtimes/openai-desktop.js +2691 -864
- package/dist/runtimes/opencode.d.ts +2 -2
- package/dist/runtimes/vercel.js +12 -1
- package/dist/sandbox/devbox.d.ts +42 -0
- package/dist/sandbox/exec-stream.d.ts +14 -0
- package/dist/sandbox/network-policy.d.ts +100 -0
- package/dist/sandbox/provider-def.d.ts +79 -0
- package/dist/sandbox/providers/desktop.d.ts +10 -0
- package/dist/sandbox/providers/e2b.d.ts +17 -0
- package/dist/sandbox/providers/local.d.ts +11 -0
- package/dist/sandbox/providers/vercel.d.ts +18 -0
- package/dist/sandbox/registry.d.ts +45 -0
- package/dist/sandbox/sizes.d.ts +68 -0
- package/dist/sandbox.d.ts +24 -299
- package/dist/step-invocation/__tests__/foreground-recovery.test.d.ts +1 -0
- package/dist/step-invocation/invoker.d.ts +10 -0
- package/dist/step-invocation/protocol.d.ts +5 -0
- package/dist/types/api-compliance.d.ts +71 -0
- package/dist/types/api-conversations.d.ts +492 -0
- package/dist/types/api-factory.d.ts +309 -0
- package/dist/types/api-projects.d.ts +131 -0
- package/dist/types/api-runs.d.ts +377 -0
- package/dist/types/api-scopes.d.ts +102 -0
- package/dist/types/conversation-stream.d.ts +191 -0
- package/dist/types/execution-context.d.ts +12 -2
- package/dist/types/protocol.d.ts +30 -1
- package/dist/types/sandbox-environment.d.ts +8 -5
- package/dist/types/sandbox.d.ts +74 -4
- package/dist/types/workflow-metadata.d.ts +33 -8
- package/dist/types/workflow-plan.d.ts +10 -0
- package/dist/types/workflow.d.ts +18 -205
- package/dist/utils/bundler.d.ts +12 -1
- package/dist/workflow-steps/index.d.ts +1 -1
- package/dist/workflow-steps/observability.d.ts +8 -1
- package/dist/workflow-steps/runner.d.ts +3 -3
- package/dist/workflow-steps/step.d.ts +15 -1
- package/dist/workflow-steps/types.d.ts +19 -5
- package/dist/workflow-steps/workflow.d.ts +22 -1
- package/dist/workflows/engine.d.ts +3 -2
- package/dist/workflows/invoke-child.d.ts +2 -2
- package/package.json +1 -1
- package/src/agent/agent-context.ts +186 -3
- package/src/agent/agent-loop.ts +31 -2
- package/src/client.ts +909 -621
- package/src/directives.ts +184 -0
- package/src/display.ts +788 -0
- package/src/errors.ts +39 -0
- package/src/index.ts +104 -10
- package/src/pause/wrappers.ts +44 -9
- package/src/runtimes/_acp-client.ts +72 -3
- package/src/runtimes/_cli-agent.ts +159 -36
- package/src/runtimes/_jsonl-guard.ts +219 -0
- package/src/runtimes/claude-code.ts +246 -0
- package/src/runtimes/claude.ts +32 -2
- package/src/runtimes/codex.ts +55 -3
- package/src/runtimes/openai-desktop.ts +59 -14
- package/src/sandbox/devbox.ts +48 -0
- package/src/sandbox/exec-stream.ts +48 -0
- package/src/sandbox/network-policy.ts +181 -0
- package/src/sandbox/provider-def.ts +94 -0
- package/src/sandbox/providers/desktop.ts +57 -0
- package/src/sandbox/providers/e2b.ts +354 -0
- package/src/sandbox/providers/local.ts +106 -0
- package/src/sandbox/providers/vercel.ts +331 -0
- package/src/sandbox/registry.ts +198 -0
- package/src/sandbox/sizes.ts +95 -0
- package/src/sandbox.ts +59 -1275
- package/src/step-invocation/invoker.ts +151 -28
- package/src/step-invocation/protocol.ts +8 -0
- package/src/types/api-compliance.ts +79 -0
- package/src/types/api-conversations.ts +522 -0
- package/src/types/api-factory.ts +336 -0
- package/src/types/api-projects.ts +140 -0
- package/src/types/api-runs.ts +412 -0
- package/src/types/api-scopes.ts +102 -0
- package/src/types/conversation-stream.ts +231 -0
- package/src/types/execution-context.ts +10 -2
- package/src/types/protocol.ts +33 -0
- package/src/types/sandbox-environment.ts +28 -9
- package/src/types/sandbox.ts +73 -4
- package/src/types/workflow-metadata.ts +35 -8
- package/src/types/workflow-plan.ts +11 -0
- package/src/types/workflow.ts +25 -292
- package/src/utils/bundler.ts +32 -5
- package/src/utils/errors.ts +16 -1
- package/src/workflow-steps/index.ts +1 -0
- package/src/workflow-steps/observability.ts +19 -8
- package/src/workflow-steps/runner.ts +4 -4
- package/src/workflow-steps/step.ts +49 -1
- package/src/workflow-steps/types.ts +20 -5
- package/src/workflow-steps/workflow.ts +22 -1
- package/src/workflows/engine.ts +3 -2
- package/src/workflows/invoke-child.ts +2 -2
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloud-session UI directives — the typed marker contract between the
|
|
3
|
+
* `agentc` CLI running INSIDE a cloud session's sandbox and the server's
|
|
4
|
+
* cloud executor.
|
|
5
|
+
*
|
|
6
|
+
* A converged cloud session drives a coding CLI whose only platform surface
|
|
7
|
+
* is `agentc` invoked over Bash — it has no typed platform tools, so it
|
|
8
|
+
* could never produce the transcript parts the dashboard renders as rich
|
|
9
|
+
* cards (`get_run_changes` → the inline diff reviewer) or acts on
|
|
10
|
+
* (`navigate_dashboard` → armed-tab navigation). The bridge:
|
|
11
|
+
*
|
|
12
|
+
* 1. `agentc navigate|display …` PRINTS one marker line to stdout —
|
|
13
|
+
* `[[ac:directive:v1 {"kind":…}]]` — and nothing else happens locally.
|
|
14
|
+
* 2. The marker rides back to the server inside the streamed tool_result
|
|
15
|
+
* (the coding CLI echoes the command's output).
|
|
16
|
+
* 3. The cloud executor scans TOOL RESULTS (never model text) for
|
|
17
|
+
* markers, executes each directive server-side through the SAME
|
|
18
|
+
* platform tool executors a platform turn uses (validation, factory
|
|
19
|
+
* gating, result shapes all identical), and persists the resulting
|
|
20
|
+
* tool_call + tool_result pair into the transcript.
|
|
21
|
+
* 4. Existing consumers act unchanged: the dashboard's diff-card /
|
|
22
|
+
* run-card renderers key on tool names, and navigation stays gated by
|
|
23
|
+
* the requesting tab's armed window + client-side URL re-validation.
|
|
24
|
+
*
|
|
25
|
+
* The kind set is CLOSED, but no longer purely read-only. `ask` is the ONE
|
|
26
|
+
* write-bearing directive: it inserts a bounded mentions row as the session
|
|
27
|
+
* owner (who could ping the same member from the dashboard anyway) and
|
|
28
|
+
* persists an ask card. Everything else stays read-scope — run lookups,
|
|
29
|
+
* change-set listing, server-gated file reads (preview / table_file /
|
|
30
|
+
* file_diff), or the navigate directive (validated URL, acted on
|
|
31
|
+
* client-side, cannot submit anything). Markers are data in untrusted
|
|
32
|
+
* output — the parser is hostile-input safe and hard-capped.
|
|
33
|
+
*/
|
|
34
|
+
/** Marker frame. v1 is part of the prefix: unknown future versions parse
|
|
35
|
+
* as no-match (fail closed) rather than as a v1 directive. */
|
|
36
|
+
export declare const DIRECTIVE_MARKER_PREFIX = "[[ac:directive:v1 ";
|
|
37
|
+
export declare const DIRECTIVE_MARKER_SUFFIX = "]]";
|
|
38
|
+
/** Max directives honoured per tool result — one command emits one marker;
|
|
39
|
+
* anything past this in a single output is echo/noise, not intent. */
|
|
40
|
+
export declare const MAX_DIRECTIVES_PER_OUTPUT = 4;
|
|
41
|
+
export type CloudDirective =
|
|
42
|
+
/** Take the requesting user's dashboard tab to a relative page. */
|
|
43
|
+
{
|
|
44
|
+
kind: "navigate";
|
|
45
|
+
url: string;
|
|
46
|
+
}
|
|
47
|
+
/** Render one run's detail into the transcript (`get_run` shape). */
|
|
48
|
+
| {
|
|
49
|
+
kind: "run";
|
|
50
|
+
runId: string;
|
|
51
|
+
workflow?: string;
|
|
52
|
+
}
|
|
53
|
+
/** Render one run's change-set — the dashboard's inline diff reviewer
|
|
54
|
+
* (`get_run_changes` shape). */
|
|
55
|
+
| {
|
|
56
|
+
kind: "run_changes";
|
|
57
|
+
runId: string;
|
|
58
|
+
workflow?: string;
|
|
59
|
+
}
|
|
60
|
+
/** Sandboxed inline HTML preview of a drive file, frozen (and size-capped)
|
|
61
|
+
* server-side at display time (`display_preview` shape). */
|
|
62
|
+
| {
|
|
63
|
+
kind: "preview";
|
|
64
|
+
path: string;
|
|
65
|
+
}
|
|
66
|
+
/** Sortable table card sourced from a drive .csv/.json file, read and
|
|
67
|
+
* capped server-side (`display_table` shape). */
|
|
68
|
+
| {
|
|
69
|
+
kind: "table_file";
|
|
70
|
+
path: string;
|
|
71
|
+
}
|
|
72
|
+
/** File-level revision diff card; selectors resolve against
|
|
73
|
+
* `factory_file_revisions` server-side (`display_diff` shape). */
|
|
74
|
+
| {
|
|
75
|
+
kind: "file_diff";
|
|
76
|
+
path: string;
|
|
77
|
+
from: string;
|
|
78
|
+
to: string;
|
|
79
|
+
}
|
|
80
|
+
/** Interactive question card gated on a named approver — resolution and
|
|
81
|
+
* the mentions ping are server-authoritative (`display_ask` shape). The
|
|
82
|
+
* one write-bearing directive (see the module header). */
|
|
83
|
+
| {
|
|
84
|
+
kind: "ask";
|
|
85
|
+
prompt: string;
|
|
86
|
+
approver: string;
|
|
87
|
+
options?: Array<{
|
|
88
|
+
id: string;
|
|
89
|
+
label: string;
|
|
90
|
+
}>;
|
|
91
|
+
};
|
|
92
|
+
/** Revision selectors the `file_diff` directive accepts: a literal
|
|
93
|
+
* `factory_file_revisions.id`, `head`, `prev`, or `head~N` (N ≤ 999).
|
|
94
|
+
* Exported so the CLI validates with the same rule it emits under. */
|
|
95
|
+
export declare const REVISION_SELECTOR_RE: RegExp;
|
|
96
|
+
/** Ask directive bounds — tighter than the promoter-path ask marker, sized
|
|
97
|
+
* to fit the 1024-char directive body. */
|
|
98
|
+
export declare const ASK_DIRECTIVE_PROMPT_MAX = 500;
|
|
99
|
+
export declare const ASK_DIRECTIVE_MAX_OPTIONS = 6;
|
|
100
|
+
export declare const ASK_DIRECTIVE_OPTION_ID_MAX = 50;
|
|
101
|
+
export declare const ASK_DIRECTIVE_OPTION_LABEL_MAX = 60;
|
|
102
|
+
export declare const ASK_APPROVER_MIN = 3;
|
|
103
|
+
export declare const ASK_APPROVER_MAX = 320;
|
|
104
|
+
/** One marker line for `agentc` to print. */
|
|
105
|
+
export declare function renderDirectiveMarker(directive: CloudDirective): string;
|
|
106
|
+
/**
|
|
107
|
+
* Extract every valid v1 directive from one command output. Hostile-input
|
|
108
|
+
* safe: malformed JSON, unknown kinds, oversized fields, and unterminated
|
|
109
|
+
* markers are skipped silently; at most MAX_DIRECTIVES_PER_OUTPUT come
|
|
110
|
+
* back. Never throws.
|
|
111
|
+
*/
|
|
112
|
+
export declare function parseDirectiveMarkers(text: string): CloudDirective[];
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The display palette (ADR-0040 §7, CLI-first amendment) — the typed marker
|
|
3
|
+
* contract between `agentc display` and the session executors.
|
|
4
|
+
*
|
|
5
|
+
* A native-harness session (Claude Code / codex running in-sandbox, or the
|
|
6
|
+
* local bridge daemon) has no typed platform tools — its platform surface is
|
|
7
|
+
* the `agentc` CLI. To keep RENDERING parity with platform sessions, the
|
|
8
|
+
* model is given an explicit palette of display commands
|
|
9
|
+
* (`agentc display run|changes|document|plan|image|table|chart|ask …`) whose stdout is a one-line
|
|
10
|
+
* TYPED MARKER. The executors (server cloud-executor, CLI bridge daemon)
|
|
11
|
+
* detect these markers in tool results and persist the SAME `MessagePart`
|
|
12
|
+
* shapes the platform harness's tools produce — so the dashboard renders the
|
|
13
|
+
* same rich cards (run card, reviewed-changes diff, document tile, plan
|
|
14
|
+
* checklist) with NO new renderer vocabulary beyond the additive
|
|
15
|
+
* `display_*` tool names.
|
|
16
|
+
*
|
|
17
|
+
* Known agentc invocations are ALSO auto-promoted without an explicit
|
|
18
|
+
* display call: `agentc run dispatch` → the dispatched-run card (the exact
|
|
19
|
+
* `dispatch_workflow` part shapes turn.ts persists), `agentc run get` → the
|
|
20
|
+
* run card, `agentc files read` → the document tile. Claude Code's own
|
|
21
|
+
* TodoWrite tool additionally forwards as a durable `plan` part (the same
|
|
22
|
+
* shape the ACP daemon posts), so converged sessions get the plan checklist
|
|
23
|
+
* for free.
|
|
24
|
+
*
|
|
25
|
+
* Everything here is pure and executor-agnostic: the promoter takes the
|
|
26
|
+
* runtime's tool_use / tool_result events and returns plain part-shaped
|
|
27
|
+
* objects that are structurally identical to the server's `MessagePart`
|
|
28
|
+
* union (pinned by tests on both sides). Promotion is strictly a REWRITE of
|
|
29
|
+
* the pair's shape — it never suppresses data: an unrecognized command,
|
|
30
|
+
* unparseable arguments, or a missing marker all fall back to the raw pair.
|
|
31
|
+
*/
|
|
32
|
+
export declare const DISPLAY_MARKER_KEY = "acDisplay";
|
|
33
|
+
export declare const DISPLAY_MARKER_VERSION = "v1";
|
|
34
|
+
export type DisplayPlanStatus = "pending" | "in_progress" | "completed";
|
|
35
|
+
export interface DisplayPlanEntry {
|
|
36
|
+
content: string;
|
|
37
|
+
status: DisplayPlanStatus;
|
|
38
|
+
}
|
|
39
|
+
/** Plan bounds — mirror the server's BridgePartSchema (entries ≤ 64,
|
|
40
|
+
* content ≤ 1000) so a marker-built plan part is always postable. */
|
|
41
|
+
export declare const PLAN_MAX_ENTRIES = 64;
|
|
42
|
+
export declare const PLAN_ENTRY_MAX_CHARS = 1000;
|
|
43
|
+
export type DisplayTableCell = string | number | boolean | null;
|
|
44
|
+
export interface DisplayTableColumn {
|
|
45
|
+
key: string;
|
|
46
|
+
label: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DisplayTableData {
|
|
49
|
+
columns: DisplayTableColumn[];
|
|
50
|
+
rows: Array<Record<string, DisplayTableCell>>;
|
|
51
|
+
truncated: boolean;
|
|
52
|
+
}
|
|
53
|
+
export type DisplayChartKind = "bar" | "line";
|
|
54
|
+
export interface DisplayChartPoint {
|
|
55
|
+
x: string | number;
|
|
56
|
+
y: number;
|
|
57
|
+
}
|
|
58
|
+
export interface DisplayChartSeries {
|
|
59
|
+
label: string;
|
|
60
|
+
points: DisplayChartPoint[];
|
|
61
|
+
}
|
|
62
|
+
export interface DisplayAskOption {
|
|
63
|
+
id: string;
|
|
64
|
+
label: string;
|
|
65
|
+
}
|
|
66
|
+
export type DisplayMarker = {
|
|
67
|
+
kind: "run";
|
|
68
|
+
runId: string;
|
|
69
|
+
} | {
|
|
70
|
+
kind: "changes";
|
|
71
|
+
runId: string;
|
|
72
|
+
factorySlug?: string;
|
|
73
|
+
endedAt?: string | null;
|
|
74
|
+
} | {
|
|
75
|
+
kind: "document";
|
|
76
|
+
path: string;
|
|
77
|
+
factorySlug?: string;
|
|
78
|
+
preview?: string | null;
|
|
79
|
+
} | {
|
|
80
|
+
kind: "plan";
|
|
81
|
+
entries: DisplayPlanEntry[];
|
|
82
|
+
} | {
|
|
83
|
+
kind: "image";
|
|
84
|
+
path: string;
|
|
85
|
+
factorySlug?: string;
|
|
86
|
+
} | {
|
|
87
|
+
kind: "table";
|
|
88
|
+
columns: DisplayTableColumn[];
|
|
89
|
+
rows: Array<Record<string, DisplayTableCell>>;
|
|
90
|
+
truncated: boolean;
|
|
91
|
+
} | {
|
|
92
|
+
kind: "chart";
|
|
93
|
+
chartKind: DisplayChartKind;
|
|
94
|
+
series: DisplayChartSeries[];
|
|
95
|
+
xLabel?: string;
|
|
96
|
+
yLabel?: string;
|
|
97
|
+
} | {
|
|
98
|
+
kind: "ask";
|
|
99
|
+
askId: string;
|
|
100
|
+
prompt: string;
|
|
101
|
+
options?: DisplayAskOption[];
|
|
102
|
+
freeText: boolean;
|
|
103
|
+
};
|
|
104
|
+
/** Clamp raw plan entries to the marker/part bounds; invalid rows drop. */
|
|
105
|
+
export declare function clampPlanEntries(raw: unknown): DisplayPlanEntry[];
|
|
106
|
+
/** Table bounds — mirror the pinned `display_table` output shape. */
|
|
107
|
+
export declare const TABLE_MAX_COLUMNS = 12;
|
|
108
|
+
export declare const TABLE_MAX_ROWS = 100;
|
|
109
|
+
export declare const TABLE_CELL_MAX_CHARS = 200;
|
|
110
|
+
/**
|
|
111
|
+
* Clamp raw table input to the marker/part bounds. Accepts an array of flat
|
|
112
|
+
* objects (columns inferred from the key union, first-seen order) or a
|
|
113
|
+
* `{ columns, rows }` object. Null when nothing tabular survives — the CLI
|
|
114
|
+
* hard-errors, the parser treats the marker as not-a-marker.
|
|
115
|
+
*/
|
|
116
|
+
export declare function clampTableData(raw: unknown): DisplayTableData | null;
|
|
117
|
+
/** Chart bounds — mirror the pinned `display_chart` output shape. */
|
|
118
|
+
export declare const CHART_MAX_SERIES = 4;
|
|
119
|
+
export declare const CHART_MAX_POINTS_PER_SERIES = 60;
|
|
120
|
+
export declare const CHART_LABEL_MAX_CHARS = 40;
|
|
121
|
+
/** Clamp raw chart series to the marker/part bounds; invalid series and
|
|
122
|
+
* non-finite points drop. Empty result → the CLI hard-errors / the parser
|
|
123
|
+
* rejects the marker. */
|
|
124
|
+
export declare function clampChartSeries(raw: unknown): DisplayChartSeries[];
|
|
125
|
+
/** Clamp an axis label to the chart bound; undefined when unusable. */
|
|
126
|
+
export declare function clampChartAxisLabel(raw: unknown): string | undefined;
|
|
127
|
+
/** Ask bounds — mirror the pinned `display_ask` output shape (the
|
|
128
|
+
* promoter path; the approver directive has its own tighter caps in
|
|
129
|
+
* directives.ts). */
|
|
130
|
+
export declare const ASK_PROMPT_MAX_CHARS = 1000;
|
|
131
|
+
export declare const ASK_MAX_OPTIONS = 8;
|
|
132
|
+
export declare const ASK_OPTION_ID_MAX_CHARS = 100;
|
|
133
|
+
export declare const ASK_OPTION_LABEL_MAX_CHARS = 200;
|
|
134
|
+
/** Normalize + clamp ask options. Accepts `["a","b"]` (id = label) or
|
|
135
|
+
* `[{ id, label }]`; invalid entries drop, duplicate ids drop. */
|
|
136
|
+
export declare function clampAskOptions(raw: unknown): DisplayAskOption[];
|
|
137
|
+
/** One-line JSON marker — exactly what `agentc display` prints. */
|
|
138
|
+
export declare function serializeDisplayMarker(marker: DisplayMarker): string;
|
|
139
|
+
/** Parse one line as a display marker; null when it isn't one (or fails
|
|
140
|
+
* validation — a malformed marker is not a marker). */
|
|
141
|
+
export declare function parseDisplayMarker(line: string): DisplayMarker | null;
|
|
142
|
+
/** First display marker in a tool result's text output (the CLI prints
|
|
143
|
+
* exactly one; scanning lines keeps it robust to surrounding stderr/echo). */
|
|
144
|
+
export declare function findDisplayMarker(text: string): DisplayMarker | null;
|
|
145
|
+
export type AgentcInvocation = {
|
|
146
|
+
verb: "display-run";
|
|
147
|
+
runId: string;
|
|
148
|
+
} | {
|
|
149
|
+
verb: "display-changes";
|
|
150
|
+
runId: string;
|
|
151
|
+
factorySlug?: string;
|
|
152
|
+
} | {
|
|
153
|
+
verb: "display-document";
|
|
154
|
+
path: string;
|
|
155
|
+
factorySlug?: string;
|
|
156
|
+
} | {
|
|
157
|
+
verb: "display-plan";
|
|
158
|
+
} | {
|
|
159
|
+
verb: "display-image";
|
|
160
|
+
path: string;
|
|
161
|
+
factorySlug?: string;
|
|
162
|
+
}
|
|
163
|
+
/** Directive verb — detection only arms the tool_call promotion; the
|
|
164
|
+
* result keeps its raw output so the directive marker reaches the cloud
|
|
165
|
+
* executor. Same for table `source:"file"`, diff, and ask-with-approver. */
|
|
166
|
+
| {
|
|
167
|
+
verb: "display-preview";
|
|
168
|
+
path: string;
|
|
169
|
+
} | {
|
|
170
|
+
verb: "display-table";
|
|
171
|
+
source: "inline" | "file";
|
|
172
|
+
path?: string;
|
|
173
|
+
} | {
|
|
174
|
+
verb: "display-chart";
|
|
175
|
+
chartKind: DisplayChartKind;
|
|
176
|
+
} | {
|
|
177
|
+
verb: "display-diff";
|
|
178
|
+
path: string;
|
|
179
|
+
from: string;
|
|
180
|
+
to: string;
|
|
181
|
+
} | {
|
|
182
|
+
verb: "display-ask";
|
|
183
|
+
prompt: string;
|
|
184
|
+
approver?: string;
|
|
185
|
+
} | {
|
|
186
|
+
verb: "run-dispatch";
|
|
187
|
+
templateName: string;
|
|
188
|
+
input?: unknown;
|
|
189
|
+
} | {
|
|
190
|
+
verb: "run-get";
|
|
191
|
+
runId: string;
|
|
192
|
+
} | {
|
|
193
|
+
verb: "files-read";
|
|
194
|
+
path: string;
|
|
195
|
+
factorySlug?: string;
|
|
196
|
+
};
|
|
197
|
+
/** Minimal shell-word split: whitespace-separated, single/double quotes
|
|
198
|
+
* group. Unclosed quotes swallow the rest (matching sh's prompt-for-more
|
|
199
|
+
* by simply taking what's there — promotion is best-effort). */
|
|
200
|
+
export declare function shellWords(command: string): string[];
|
|
201
|
+
export declare function detectAgentcInvocation(command: string): AgentcInvocation | null;
|
|
202
|
+
/** Plain part shapes, structurally identical to the server's `MessagePart`
|
|
203
|
+
* union (and the bridge POST schema) — pinned by shape-fidelity tests on
|
|
204
|
+
* the server side. */
|
|
205
|
+
export type PromotedPart = {
|
|
206
|
+
type: "tool_call";
|
|
207
|
+
toolName: string;
|
|
208
|
+
input: Record<string, unknown>;
|
|
209
|
+
toolCallId: string;
|
|
210
|
+
} | {
|
|
211
|
+
type: "tool_result";
|
|
212
|
+
toolCallId: string;
|
|
213
|
+
output: unknown;
|
|
214
|
+
isError: boolean;
|
|
215
|
+
} | {
|
|
216
|
+
type: "plan";
|
|
217
|
+
entries: DisplayPlanEntry[];
|
|
218
|
+
};
|
|
219
|
+
export interface DisplayPromoterContext {
|
|
220
|
+
/** The session's factory id (cloud sessions know it from the session row)
|
|
221
|
+
* — stamped onto document/changes parts when the command names no
|
|
222
|
+
* `--factory` slug, so the renderer can resolve the drive link. */
|
|
223
|
+
factoryId?: string;
|
|
224
|
+
}
|
|
225
|
+
export interface DisplayPromoter {
|
|
226
|
+
/** Promote a tool_use event. Non-null → persist these parts INSTEAD of
|
|
227
|
+
* the default mapping (the promoted tool_call reuses the toolUseId, so
|
|
228
|
+
* the eventual result still pairs). Null → not a promotable call. */
|
|
229
|
+
promoteToolUse(msg: {
|
|
230
|
+
toolName: string;
|
|
231
|
+
toolInput: unknown;
|
|
232
|
+
toolUseId: string;
|
|
233
|
+
}): PromotedPart[] | null;
|
|
234
|
+
/** Promote the matching tool_result. Non-null → persist these parts
|
|
235
|
+
* instead of the default mapping. Null → no promotion pending. */
|
|
236
|
+
promoteToolResult(msg: {
|
|
237
|
+
toolUseId: string;
|
|
238
|
+
output: unknown;
|
|
239
|
+
isError?: boolean;
|
|
240
|
+
}): PromotedPart[] | null;
|
|
241
|
+
}
|
|
242
|
+
export declare function createDisplayPromoter(ctx?: DisplayPromoterContext): DisplayPromoter;
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
|
+
/** Stable machine-readable denial codes on membership/capability-gated
|
|
2
|
+
* mutations (ADR-0045). Reads never carry a code — a visibility denial is
|
|
3
|
+
* a plain 404, indistinguishable from a missing id. */
|
|
4
|
+
export type AuthzErrorCode = "role_read_only" | "owner_required" | "capability_required" | "membership_required" | "last_owner" | "approver_only";
|
|
1
5
|
/** Thrown by AgentComposeClient when the server returns a non-2xx response. */
|
|
2
6
|
export declare class AgentComposeError extends Error {
|
|
3
7
|
readonly status: number;
|
|
4
|
-
|
|
8
|
+
/** Parsed `Retry-After` response header, in milliseconds, when the server
|
|
9
|
+
* sent one (rate-limit 429s do). Pollers use it to honor the server's own
|
|
10
|
+
* estimate of when the limit window clears instead of guessing. */
|
|
11
|
+
readonly retryAfterMs?: number;
|
|
12
|
+
/** Stable error code on gated-mutation 403s (ADR-0045) — one of
|
|
13
|
+
* `AuthzErrorCode` when the denial is a membership/capability gate;
|
|
14
|
+
* undefined otherwise. */
|
|
15
|
+
readonly code?: string;
|
|
16
|
+
/** The missing capability on a `capability_required` denial
|
|
17
|
+
* (e.g. "write", "invoke", "see_runs"). */
|
|
18
|
+
readonly capability?: string;
|
|
19
|
+
constructor(status: number, message: string, opts?: {
|
|
20
|
+
retryAfterMs?: number;
|
|
21
|
+
code?: string;
|
|
22
|
+
capability?: string;
|
|
23
|
+
});
|
|
5
24
|
}
|
|
25
|
+
/** Parse a `Retry-After` header into milliseconds. Accepts both RFC 9110
|
|
26
|
+
* forms — delta-seconds (`"120"`) and HTTP-date — and returns `undefined`
|
|
27
|
+
* for anything unparseable so callers fall back to their own backoff. */
|
|
28
|
+
export declare function parseRetryAfterMs(header: string | null | undefined): number | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,25 +12,31 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export { defineRuntime } from "./types/runtime.js";
|
|
14
14
|
export { defineWorkflow } from "./types/workflow.js";
|
|
15
|
-
export type { WorkflowDefinition } from "./types/workflow.js";
|
|
16
15
|
export { defineSandboxEnvironment } from "./types/sandbox-environment.js";
|
|
17
16
|
export type { SandboxEnvironmentDefinition } from "./types/sandbox-environment.js";
|
|
18
17
|
export type { AgentRuntime, McpServerConfig, ModelExecutionContract, ToolCallGateResult, RuntimeOptions, } from "./types/runtime.js";
|
|
19
|
-
export type {
|
|
18
|
+
export type { WorkflowRun, AgentBudget, WorkflowHooks, SnapshotConfig, BootSnapshot, ReuseSnapshot, IOSchema, OutputSchema, } from "./types/workflow.js";
|
|
20
19
|
export type { ConnectorRequestRules } from "./types/workflow-metadata.js";
|
|
21
20
|
export type { RunSnapshotEntry } from "./client.js";
|
|
22
|
-
export type { WorkflowPlan, WorkflowStepPlan } from "./types/workflow-plan.js";
|
|
21
|
+
export type { WorkflowPlan, WorkflowStepPlan, WorkflowStepDeliverable } from "./types/workflow-plan.js";
|
|
23
22
|
export type { BaseExecutionContext, InvokeChild } from "./types/execution-context.js";
|
|
24
23
|
export { RequestContext, ReservedKeyError, NonSerialisableValueError, AC_RESERVED_PREFIX, AC_TEAM_ID, AC_RUN_ID, AC_WORKFLOW_ID, AC_FACTORY_ID, AC_API_KEY_SCOPES, AC_PARENT_RUN_ID, AC_ABORT_SIGNAL, } from "./request-context/index.js";
|
|
25
24
|
export type { RequestContextReserved, RequestContextWire, } from "./request-context/index.js";
|
|
26
25
|
export { Verdict, runProcessorChain, denyTools, humanApproval, requireScope, redactPattern, createGatePauseProcessor, createAskHumanProcessor, ASK_USER_QUESTION_TOOL, } from "./processors/index.js";
|
|
27
26
|
export type { Processor, ProcessorContext, ProcessorVerdict, ToolCall, GatePausePolicy, GatePauseApproval, GatePauseConnection, } from "./processors/index.js";
|
|
28
27
|
export type { AgentMessage, AgentMessageInit, AgentMessageText, AgentMessageThinking, AgentMessageToolUse, AgentMessageToolResult, AgentMessageDone, AgentMessageError, AgentMessageUsage, AgentStatus, } from "./types/protocol.js";
|
|
29
|
-
export type { SandboxProvider, DesktopSandboxProvider, } from "./types/sandbox.js";
|
|
28
|
+
export type { SandboxProvider, DesktopSandboxProvider, SandboxPtyOpts, SandboxPtyHandle, } from "./types/sandbox.js";
|
|
30
29
|
export { AgentComposeClient } from "./client.js";
|
|
31
|
-
export type { RegisterResult, RegisterWorkflowInput, RuntimeSourceInput, TemplateSourceRef, InvokeWorkflowOptions, InvokeAndWaitOptions, InvokeResult, ListSnapshotsOptions, TemplateRow, ListTemplatesOptions, CreateFactoryInput, UpdateFactoryInput, SecretOptions, SetSecretResult, SecretListEntry, CreateApiKeyInput, StreamRunLogsOptions, TeamMember, Mention, CreateMentionsInput, EventSubjectType, EventRow, ReportEventInput, ListEventsOptions, ListEventsResult, RunLogLine, ListRunLogsOptions, RegisteredRuntime, RunState, RunStatus, FactoryRow, SnapshotListEntry, SnapshotListResponse, ApiKey, ApiKeyCreated, UsageRollupRow, UsageResponse, CancelRunResponse, RequestAgentPauseOptions, RequestAgentPauseResponse, SendAgentMessageOptions, SendAgentMessageResponse, AnswerSteerOptions, ResumePauseOptions, ResumePauseResponse, ResumePauseSuccess, ResumePausePending, ResumePauseActor, } from "./client.js";
|
|
30
|
+
export type { RegisterResult, RegisterWorkflowInput, RuntimeSourceInput, TemplateSourceRef, InvokeWorkflowOptions, InvokeAndWaitOptions, InvokeResult, ListSnapshotsOptions, TemplateRow, ListTemplatesOptions, CreateFactoryInput, UpdateFactoryInput, SecretOptions, SetSecretResult, SecretListEntry, CreateApiKeyInput, StreamRunLogsOptions, TeamMember, Mention, CreateMentionsInput, EventSubjectType, EventRow, ReportEventInput, ListEventsOptions, ListEventsResult, RunLogLine, ListRunLogsOptions, RunListEntry, ListRunsOptions, RunDetail, FundingLane, RunFundingStamp, RunFundingUsageRow, RunFundingResponse, RegisteredRuntime, RunState, RunStatus, FactoryRow, SnapshotListEntry, SnapshotListResponse, ApiKey, ApiKeyCreated, UsageRollupRow, UsageResponse, CancelRunResponse, RequestAgentPauseOptions, RequestAgentPauseResponse, SendAgentMessageOptions, SendAgentMessageResponse, AnswerSteerOptions, ResumePauseOptions, ResumePauseResponse, ResumePauseSuccess, ResumePausePending, ResumePauseActor, ConversationMessagePart, ConversationRow, ConversationMessageRow, ConversationsPage, ConversationDetail, ConversationThread, ConversationPageContext, SendConversationMessageInput, SendConversationMessageResult, ConversationTurnState, ConversationPresenceSnapshot, StreamConversationOptions, AgentListRow, CreateCloudSessionInput, CloudSessionCreated, SessionPreview, PreviewOpened, OpenPreviewInput, SessionForked, SessionFileChange, SessionChangeSet, SessionMergeReportDetail, SessionMergeReport, SessionDiscardReport, ChannelSessionStatus, ChannelSessionRow, ChannelSessionsResponse, SessionChannelMessagePosted, FactoryFileSearchRow, FactoryFolderSearchRow, SearchFactoryFilesOptions, FactoryFileSearchResult, PublicFileLinkState, ConversationMemberRole, ConversationMember, DocumentCapability, TemplateCapability, ScopeGrant, ArtifactScope, RunContext, SetScopeGrantsInput, SetTemplateScopeInput, TemplateDetail, Project, ProjectsPage, ProjectRole, ProjectMember, ProjectObject, ProjectObjectsPage, ProjectSkippedFile, ProjectPreviewFile, ProjectAddPreview, AddProjectObjectInput, AddProjectObjectResult, RefreshProjectObjectResult, ComplianceScopeKind, ComplianceStatus, ComplianceSession, ComplianceAccess, RequestComplianceSessionInput, ListComplianceSessionsOptions, ComplianceSessionsPage, ListComplianceAccessesOptions, ComplianceAccessesPage, } from "./client.js";
|
|
32
31
|
export { parseSseStream } from "./sse.js";
|
|
32
|
+
export { renderDirectiveMarker, parseDirectiveMarkers, DIRECTIVE_MARKER_PREFIX, DIRECTIVE_MARKER_SUFFIX, MAX_DIRECTIVES_PER_OUTPUT, REVISION_SELECTOR_RE, ASK_DIRECTIVE_PROMPT_MAX, ASK_DIRECTIVE_MAX_OPTIONS, ASK_DIRECTIVE_OPTION_ID_MAX, ASK_DIRECTIVE_OPTION_LABEL_MAX, ASK_APPROVER_MIN, ASK_APPROVER_MAX, } from "./directives.js";
|
|
33
|
+
export type { CloudDirective } from "./directives.js";
|
|
34
|
+
export { normalizeConversationStreamEvent } from "./types/conversation-stream.js";
|
|
35
|
+
export type { ConversationStreamEvent, ConversationStreamAuthor, ConversationPartEvent, ConversationPartPartialEvent, ConversationMessageDoneEvent, ConversationErrorEvent, ConversationReactionEvent, ConversationMessageDeletedEvent, ConversationReplayContinueEvent, ConversationTurnStateEvent, ConversationPresenceEvent, ConversationSessionStatusEvent, ConversationPresenceClient, ConversationAgentPresence, } from "./types/conversation-stream.js";
|
|
36
|
+
export { AcpClientPeer, normalizeSessionUpdate, ACP_PROTOCOL_VERSION } from "./runtimes/_acp-client.js";
|
|
37
|
+
export type { AcpAvailableCommand, AcpClientPeerDeps, AcpSessionCaps } from "./runtimes/_acp-client.js";
|
|
33
38
|
export { AgentComposeError } from "./errors.js";
|
|
39
|
+
export type { AuthzErrorCode } from "./errors.js";
|
|
34
40
|
export { formatError } from "./utils/errors.js";
|
|
35
41
|
export { bundleWorkflow, BUNDLER_VERSION, WorkflowSourceValidationError, assertDefaultExportIsDefineWorkflow, } from "./utils/bundler.js";
|
|
36
42
|
export type { BundledWorkflow, WorkflowManifest } from "./utils/bundler.js";
|
|
@@ -41,9 +47,10 @@ export { default as claudeRuntime } from "./runtimes/claude.js";
|
|
|
41
47
|
export { createVercelRuntime, VercelRunner, listVercelRuntimeModels } from "./runtimes/vercel.js";
|
|
42
48
|
export type { VercelRuntimeConfig, VercelRuntimeModel } from "./runtimes/vercel.js";
|
|
43
49
|
export type { GatewayModelId } from "ai";
|
|
44
|
-
export { createCodexRuntime } from "./runtimes/codex.js";
|
|
50
|
+
export { createCodexRuntime, codexSpec } from "./runtimes/codex.js";
|
|
45
51
|
export type { CodexRuntimeConfig } from "./runtimes/codex.js";
|
|
46
52
|
export { default as codexRuntime } from "./runtimes/codex.js";
|
|
53
|
+
export type { CliReasoningEffort } from "./runtimes/_cli-agent.js";
|
|
47
54
|
export { createAmpRuntime } from "./runtimes/amp.js";
|
|
48
55
|
export type { AmpRuntimeConfig } from "./runtimes/amp.js";
|
|
49
56
|
export { default as ampRuntime } from "./runtimes/amp.js";
|
|
@@ -56,23 +63,26 @@ export { default as cursorRuntime } from "./runtimes/cursor.js";
|
|
|
56
63
|
export { createDroidRuntime, droidSpec } from "./runtimes/droid.js";
|
|
57
64
|
export type { DroidRuntimeConfig } from "./runtimes/droid.js";
|
|
58
65
|
export { default as droidRuntime } from "./runtimes/droid.js";
|
|
66
|
+
export { createClaudeCodeRuntime, claudeCodeSpec, CLAUDE_CODE_ACP_ADAPTER, CLAUDE_CODE_THINKING_TOKENS } from "./runtimes/claude-code.js";
|
|
67
|
+
export type { ClaudeCodeRuntimeConfig } from "./runtimes/claude-code.js";
|
|
68
|
+
export { default as claudeCodeRuntime } from "./runtimes/claude-code.js";
|
|
59
69
|
export { bashTool, codingTools, editTool, readTool, writeTool } from "./tools/index.js";
|
|
60
70
|
export type { CodingTool } from "./tools/index.js";
|
|
61
71
|
export type { RunEvent } from "./types/events.js";
|
|
62
|
-
export { createSandbox, reconnectSandbox, killAllSandboxes, killSandboxById, getSandboxQuotas, listOwnedSandboxes, deleteSandboxSnapshot, snapshotResolves, makeSandboxProvider, makeDesktopSandboxProvider, parseSseExecStream, AGENT_COMPOSE_TAG, SANDBOX_VCPUS, DEFAULT_SANDBOX_SIZE, E2B_TEMPLATE_SIZES, isE2bSupportedSize, e2bMachineSpec, e2bBaseTemplate, e2bAgentEnvTemplate, isPlatformE2bTemplateAlias } from "./sandbox.js";
|
|
72
|
+
export { createSandbox, reconnectSandbox, killAllSandboxes, killSandboxById, getSandboxQuotas, listOwnedSandboxes, deleteSandboxSnapshot, snapshotResolves, makeSandboxProvider, makeDesktopSandboxProvider, parseSseExecStream, AGENT_COMPOSE_TAG, SANDBOX_VCPUS, DEFAULT_SANDBOX_SIZE, E2B_TEMPLATE_SIZES, isE2bSupportedSize, e2bMachineSpec, e2bBaseTemplate, e2bAgentEnvTemplate, isPlatformE2bTemplateAlias, E2B_DEVBOX_TEMPLATE, E2B_DEVBOX_SPEC, E2B_DEVBOX_RECIPE_VERSION, e2bDevboxTemplateRef } from "./sandbox.js";
|
|
63
73
|
export { SandboxUnavailableError, SANDBOX_UNAVAILABLE_PREFIX } from "./sandbox-errors.js";
|
|
64
74
|
export type { SandboxCreateOpts, SandboxNetworkPolicy, SandboxNetworkHeaderTransform, SandboxNetworkAllowRule, SandboxNetworkSubnetPolicy, SandboxProviderName, SandboxQuotaResult, OwnedSandboxResult, OwnedSandbox, SandboxSize, ParseSseExecStreamOptions, SandboxCommandRunOptions, SandboxCommandResult, } from "./sandbox.js";
|
|
65
|
-
export type { SandboxResources } from "./types/workflow-metadata.js";
|
|
75
|
+
export type { SandboxResources, DriveMergePolicy } from "./types/workflow-metadata.js";
|
|
66
76
|
export { runWorkflow, WorkflowError, EngineError, classifyError, parseNameVersion } from "./workflows/engine.js";
|
|
67
77
|
export type { WorkflowResult, RunWorkflowOptions, EngineSubsystem } from "./workflows/engine.js";
|
|
68
78
|
export { buildInvokeChild } from "./workflows/invoke-child.js";
|
|
69
79
|
export { defineStep, isWorkflow, runWorkflowSteps, runWorkflowSingleStep, StepValidationError, WorkflowInputValidationError, WorkflowOutputValidationError, } from "./workflow-steps/index.js";
|
|
70
|
-
export type { Step, StepContext, StepRunResult, Workflow, DefineStepOpts, StepWorkflowDefinition, WorkflowBuilder, RunWorkflowStepsOpts, RunWorkflowStepsResult, RunWorkflowSingleStepOpts, RunWorkflowSingleStepResult, StepObservability, SubStepEvent, } from "./workflow-steps/index.js";
|
|
80
|
+
export type { Step, StepContext, StepDeliverable, StepRunResult, Workflow, DefineStepOpts, StepWorkflowDefinition, WorkflowBuilder, RunWorkflowStepsOpts, RunWorkflowStepsResult, RunWorkflowSingleStepOpts, RunWorkflowSingleStepResult, StepObservability, SubStepEvent, } from "./workflow-steps/index.js";
|
|
71
81
|
export { invokeStep, launchStep, reconnectStep, serveStep, parseStepResult, buildStepEnvs, StepExecutionError, STEP_RESULT_PREFIX, STEP_PAUSE_PREFIX, STEP_ENV, RUNNER_BUNDLE_PATH, RUNNER_COMMAND, stepInputPath, requestContextPath, } from "./step-invocation/index.js";
|
|
72
82
|
export { PauseError, PauseExpiredError, PauseSchemaError, PauseRequestError, } from "./pause/errors.js";
|
|
73
83
|
export type { PauseErrorCode } from "./pause/errors.js";
|
|
74
84
|
export type { PauseRequest } from "./pause/pause-core.js";
|
|
75
|
-
export type { WaitForEventRequest } from "./pause/wrappers.js";
|
|
85
|
+
export type { WaitForEventRequest, DecisionRequest } from "./pause/wrappers.js";
|
|
76
86
|
export { requestPauseAndAwait } from "./agent/pause-client.js";
|
|
77
87
|
export type { PauseDecision, RequestPauseOptions } from "./agent/pause-client.js";
|
|
78
88
|
export type { StepRequest, StepResult, StepInvocationError, StepPauseRequest, StepHandler, StepHandlerResult, ServeStepRequest, RunningStep, InvokeStepOptions, } from "./step-invocation/index.js";
|
|
@@ -80,7 +90,9 @@ export { agentLoop, parseAgentStatus, DEFAULT_CLAUDE_MODEL } from "./agent/agent
|
|
|
80
90
|
export type { AgentLifecycleEvent, AgentLoopOpts, AgentLoopResult } from "./agent/agent-loop.js";
|
|
81
91
|
export { agent } from "./agent/run-agent.js";
|
|
82
92
|
export type { AgentOpts } from "./agent/run-agent.js";
|
|
83
|
-
export { AGENT_COMPOSE_MANUAL, buildAgentContextDoc, writeAgentContext } from "./agent/agent-context.js";
|
|
84
|
-
export type { AgentConnectorInfo } from "./agent/agent-context.js";
|
|
93
|
+
export { AGENT_COMPOSE_MANUAL, buildAgentContextDoc, writeAgentContext, buildAddedSessionBrief } from "./agent/agent-context.js";
|
|
94
|
+
export type { AgentConnectorInfo, AddedSessionBriefParams } from "./agent/agent-context.js";
|
|
85
95
|
export { AgentMessageSchema, parseAgentResponse } from "./agent/protocol.js";
|
|
86
96
|
export { importSourceModule, TMP_DIR, LATEST_VERSION } from "./utils/source-loader.js";
|
|
97
|
+
export { DISPLAY_MARKER_KEY, DISPLAY_MARKER_VERSION, PLAN_MAX_ENTRIES, PLAN_ENTRY_MAX_CHARS, TABLE_MAX_COLUMNS, TABLE_MAX_ROWS, TABLE_CELL_MAX_CHARS, CHART_MAX_SERIES, CHART_MAX_POINTS_PER_SERIES, CHART_LABEL_MAX_CHARS, ASK_PROMPT_MAX_CHARS, ASK_MAX_OPTIONS, ASK_OPTION_ID_MAX_CHARS, ASK_OPTION_LABEL_MAX_CHARS, serializeDisplayMarker, parseDisplayMarker, findDisplayMarker, clampPlanEntries, clampTableData, clampChartSeries, clampChartAxisLabel, clampAskOptions, detectAgentcInvocation, shellWords, createDisplayPromoter, } from "./display.js";
|
|
98
|
+
export type { DisplayMarker, DisplayPlanEntry, DisplayPlanStatus, DisplayTableCell, DisplayTableColumn, DisplayTableData, DisplayChartKind, DisplayChartPoint, DisplayChartSeries, DisplayAskOption, AgentcInvocation, PromotedPart, DisplayPromoter, DisplayPromoterContext, } from "./display.js";
|