stitchkit 0.68.11 → 0.69.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 +30 -1
- package/dist/agent-runtime/coding-tool-contract.d.ts +155 -0
- package/dist/agent-runtime/coding-tool-contract.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tool-files.d.ts +3 -0
- package/dist/agent-runtime/coding-tool-files.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tool-paths.d.ts +19 -0
- package/dist/agent-runtime/coding-tool-paths.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tool-search-patch.d.ts +3 -0
- package/dist/agent-runtime/coding-tool-search-patch.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tool-shell.d.ts +3 -0
- package/dist/agent-runtime/coding-tool-shell.d.ts.map +1 -0
- package/dist/agent-runtime/coding-tools.d.ts +17 -0
- package/dist/agent-runtime/coding-tools.d.ts.map +1 -0
- package/dist/agent-runtime/compaction.d.ts +2 -0
- package/dist/agent-runtime/compaction.d.ts.map +1 -1
- package/dist/agent-runtime/contained-files.d.ts +31 -0
- package/dist/agent-runtime/contained-files.d.ts.map +1 -0
- package/dist/agent-runtime/control-schema.d.ts +1074 -0
- package/dist/agent-runtime/control-schema.d.ts.map +1 -0
- package/dist/agent-runtime/conversations.d.ts +128 -0
- package/dist/agent-runtime/conversations.d.ts.map +1 -0
- package/dist/agent-runtime/event-schema.d.ts +96 -0
- package/dist/agent-runtime/event-schema.d.ts.map +1 -1
- package/dist/agent-runtime/harness-contract.d.ts +169 -0
- package/dist/agent-runtime/harness-contract.d.ts.map +1 -0
- package/dist/agent-runtime/harness-control.d.ts +25 -0
- package/dist/agent-runtime/harness-control.d.ts.map +1 -0
- package/dist/agent-runtime/harness-file-resources.d.ts +33 -0
- package/dist/agent-runtime/harness-file-resources.d.ts.map +1 -0
- package/dist/agent-runtime/harness-resources.d.ts +5 -0
- package/dist/agent-runtime/harness-resources.d.ts.map +1 -0
- package/dist/agent-runtime/harness.d.ts +12 -0
- package/dist/agent-runtime/harness.d.ts.map +1 -0
- package/dist/agent-runtime/history.d.ts +2 -0
- package/dist/agent-runtime/history.d.ts.map +1 -1
- package/dist/agent-runtime/models.d.ts +199 -0
- package/dist/agent-runtime/models.d.ts.map +1 -1
- package/dist/agent-runtime/prompt.d.ts +2 -0
- package/dist/agent-runtime/prompt.d.ts.map +1 -1
- package/dist/agent-runtime/run-execution.d.ts.map +1 -1
- package/dist/agent-runtime/runtime.d.ts +11 -3
- package/dist/agent-runtime/runtime.d.ts.map +1 -1
- package/dist/agent-runtime/schemas.d.ts +49 -0
- package/dist/agent-runtime/schemas.d.ts.map +1 -1
- package/dist/agent-runtime/sqlite.d.ts +2 -0
- package/dist/agent-runtime/sqlite.d.ts.map +1 -1
- package/dist/agent-runtime/store-driver.d.ts +61 -212
- package/dist/agent-runtime/store-driver.d.ts.map +1 -1
- package/dist/agent-runtime/store.d.ts +368 -1
- package/dist/agent-runtime/store.d.ts.map +1 -1
- package/dist/agent-runtime/terminal-commit.d.ts +12 -1
- package/dist/agent-runtime/terminal-commit.d.ts.map +1 -1
- package/dist/agent-runtime/terminal-status.d.ts +8 -0
- package/dist/agent-runtime/terminal-status.d.ts.map +1 -1
- package/dist/agent-runtime-browser.d.ts +1 -0
- package/dist/agent-runtime-browser.d.ts.map +1 -1
- package/dist/agent-runtime-browser.js +217 -1
- package/dist/agent-runtime-coding-tools.d.ts +2 -0
- package/dist/agent-runtime-coding-tools.d.ts.map +1 -0
- package/dist/agent-runtime-coding-tools.js +706 -0
- package/dist/agent-runtime-harness.d.ts +2 -0
- package/dist/agent-runtime-harness.d.ts.map +1 -0
- package/dist/agent-runtime-harness.js +700 -0
- package/dist/agent-runtime-openrouter.d.ts +14 -1
- package/dist/agent-runtime-openrouter.d.ts.map +1 -1
- package/dist/agent-runtime-openrouter.js +211 -0
- package/dist/agent-runtime-sqlite-bun.js +4 -3
- package/dist/agent-runtime-sqlite-node.js +4 -3
- package/dist/agent-runtime.d.ts +5 -3
- package/dist/agent-runtime.d.ts.map +1 -1
- package/dist/agent-runtime.js +106 -2580
- package/dist/application/diagnostic-journal-contract.d.ts +164 -0
- package/dist/application/diagnostic-journal-contract.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-manager.d.ts +12 -0
- package/dist/application/diagnostic-journal-manager.d.ts.map +1 -0
- package/dist/application/diagnostic-journal-storage.d.ts +29 -0
- package/dist/application/diagnostic-journal-storage.d.ts.map +1 -0
- package/dist/application/diagnostic-journal.d.ts +11 -0
- package/dist/application/diagnostic-journal.d.ts.map +1 -0
- package/dist/application.d.ts +2 -0
- package/dist/application.d.ts.map +1 -1
- package/dist/application.js +561 -17
- package/dist/browser/socket-io.d.ts.map +1 -1
- package/dist/cli.js +8 -6
- package/dist/{index-8vpzxg55.js → index-10gbbbaa.js} +103 -2
- package/dist/index-3eqrkqhg.js +2565 -0
- package/dist/{index-hcx9yypn.js → index-444747ww.js} +7 -7
- package/dist/{index-hxh98zbm.js → index-d1jsvkyk.js} +1 -1
- package/dist/index-es0h4w26.js +63 -0
- package/dist/{index-grgvpbch.js → index-gqdfpv4n.js} +4 -2
- package/dist/{index-bt5179zb.js → index-h7ctj1kp.js} +5 -3
- package/dist/{index-y2ctppmg.js → index-h8vn1jcr.js} +7 -73
- package/dist/{index-hqza5nde.js → index-hsabxjz0.js} +78 -77
- package/dist/index-kg9xx84n.js +73 -0
- package/dist/{index-hb0mncmj.js → index-kxxyvkka.js} +2 -2
- package/dist/{index-2t6zt5cg.js → index-mbxds404.js} +7 -5
- package/dist/{index-f24xg2cw.js → index-p1be103g.js} +1 -1
- package/dist/{index-xyvxez9r.js → index-q7gdep2c.js} +5 -5
- package/dist/{index-t23p2b68.js → index-t4dpby6e.js} +1 -1
- package/dist/index-tg3m2ec5.js +157 -0
- package/dist/index-v3dpzpjw.js +92 -0
- package/dist/{index-eqqyd9v8.js → index-wwst0td5.js} +2 -46
- package/dist/{index-ysphyxax.js → index-x1th9s8c.js} +23 -2
- package/dist/index-xxsq3ca1.js +51 -0
- package/dist/{index-22tjt2rk.js → index-zh459sfj.js} +1 -1
- package/dist/index.js +51 -37
- package/dist/internal/ai-sdk-typed.d.ts +14 -0
- package/dist/internal/ai-sdk-typed.d.ts.map +1 -0
- package/dist/node.js +5 -5
- package/dist/observability/index.js +4 -4
- package/dist/realtime/request.d.ts +5 -0
- package/dist/realtime/request.d.ts.map +1 -1
- package/dist/remote.js +6 -6
- package/dist/server/index.js +9 -9
- package/dist/testing.js +5 -5
- package/dist/tool-invoker.js +6 -5
- package/dist/tools.js +21 -17
- package/llms-full.txt +342 -27
- package/package.json +10 -2
- package/dist/{index-pgsyp3xh.js → index-x18ndp4p.js} +3 -3
package/README.md
CHANGED
|
@@ -103,6 +103,15 @@ cursor but no execution, persistence or sink graph.
|
|
|
103
103
|
Durable embedded storage is isolated behind
|
|
104
104
|
`stitchkit/agent-runtime/sqlite/bun` and `stitchkit/agent-runtime/sqlite/node`;
|
|
105
105
|
neither runtime-specific built-in leaks into the neutral or browser entrypoint.
|
|
106
|
+
Externally supervised sessions can compose the same runtime through
|
|
107
|
+
`stitchkit/agent-runtime/harness`; optional explicit-root lazy resources, signed approval
|
|
108
|
+
continuations and reconnectable control compose there. Bounded direct file, search, guarded patch,
|
|
109
|
+
shell and opaque-artifact tools live in the peer-free
|
|
110
|
+
`stitchkit/agent-runtime/coding-tools` leaf. Neither surface owns process placement,
|
|
111
|
+
restart, credentials, model catalogs or OS isolation.
|
|
112
|
+
The separately installed `@stitchkit/tui` package adds a maintained Bun/OpenTUI host over those
|
|
113
|
+
headless contracts; its `@stitchkit/tui/core` entrypoint exposes renderer-neutral terminal state
|
|
114
|
+
without React, OpenTUI or agent-runtime imports. Neither enters the core dependency graph.
|
|
106
115
|
|
|
107
116
|
## Managed application kernel
|
|
108
117
|
|
|
@@ -339,7 +348,7 @@ import { parseSSE } from 'stitchkit' // client: Response → AsyncGene
|
|
|
339
348
|
| **MCP Tools** | `createMcpHandler()` / `mountMcp()` — MCP tools from contracts |
|
|
340
349
|
| **Agent Tools** | `mountAgent()` — Vercel AI SDK tools from contracts |
|
|
341
350
|
| **Agent Runtime** | `createAgentRuntime()` — optional durable history, stream loop, coordination and fencing |
|
|
342
|
-
| **Application Kernel** | `createApplication()`
|
|
351
|
+
| **Application Kernel** | `createApplication()` plus optional bounded local diagnostics — process-local resources, readiness, schedules and bounded shutdown |
|
|
343
352
|
| **Typed Client** | `createClient()` / `createClients()` — typed fetch from contracts |
|
|
344
353
|
| **Cursor Pagination** | `createCursorQuery()` — `react-query-kit` infinite query from a contract method |
|
|
345
354
|
| **WebSocket** | `createSocketIOClient()` / `createSocketIOServer()` — typed Socket.IO wrappers |
|
|
@@ -426,6 +435,9 @@ peer — an install pulls in only what the project actually uses.
|
|
|
426
435
|
| `@modelcontextprotocol/client` | development dependency, optional | Only consumers that run MCP client integration tests or build an MCP host. |
|
|
427
436
|
| `@modelcontextprotocol/ext-apps` | peer, optional | Only MCP Apps (`ui://` resources and UI metadata). |
|
|
428
437
|
| `ai` | peer, optional | `stitchkit/tools` agent tools and the optional server-only `stitchkit/agent-runtime`. |
|
|
438
|
+
| Headless harness | optional surface | `stitchkit/agent-runtime/harness`; uses the same optional `ai` peer and canonical runtime. |
|
|
439
|
+
| Agent coding tools | optional surface | `stitchkit/agent-runtime/coding-tools`; peer-free, host-authorized direct file and shell tools. |
|
|
440
|
+
| `@stitchkit/tui` | separate optional package | Renderer-neutral `./core` state plus a Bun/OpenTUI terminal controller, commands, model/session pickers and authenticated local attachment over a caller-composed harness. |
|
|
429
441
|
| `@openrouter/ai-sdk-provider` | peer, optional | Only `stitchkit/agent-runtime/openrouter`; neutral runtime imports do not resolve it. |
|
|
430
442
|
| SQLite | runtime built-in, optional | `bun:sqlite` through `stitchkit/agent-runtime/sqlite/bun`, or `node:sqlite` on Node ≥ 22.5 through the Node leaf. |
|
|
431
443
|
| `grammy` | peer, optional | Only `stitchkit/application/grammy`; the neutral application kernel does not resolve it. |
|
|
@@ -455,6 +467,23 @@ external infrastructure configured through `DATABASE_URL`.
|
|
|
455
467
|
The template owns a committed Bun lockfile and an explicit Stitchkit catalog
|
|
456
468
|
range, so framework and scaffolder releases advance independently.
|
|
457
469
|
|
|
470
|
+
For a minimal terminal coding-agent host, choose the second explicit profile:
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
bun create stitchkit my-agent --template agent
|
|
474
|
+
cd my-agent
|
|
475
|
+
cp .env.example .env
|
|
476
|
+
# Fill OPENROUTER_API_KEY, then choose a live model in the terminal.
|
|
477
|
+
bun run dev
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
Its editable `stitchkit.agent.ts` composes `@stitchkit/tui`, OpenRouter, durable SQLite history,
|
|
481
|
+
lazy skills and direct approval-gated coding tools over the same headless Agent harness. `/model`
|
|
482
|
+
searches the full tool-capable catalog and shows weekly popularity independently from sourced
|
|
483
|
+
benchmark observations. `/status` exposes the local session ID so another process can `send` or
|
|
484
|
+
`interrupt` through the terminal's existing controller. The renderer and provider dependencies do
|
|
485
|
+
not enter Stitchkit core or the default application. → [ADR 0133](./docs/decisions/0133-agent-tui-is-an-optional-package-over-one-controller.md)
|
|
486
|
+
|
|
458
487
|
## Documentation — two roads
|
|
459
488
|
|
|
460
489
|
This README is the quick start. Where you go next depends on what you're doing:
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AgentCodingToolLimitsSchema: z.ZodObject<{
|
|
3
|
+
maxPathBytes: z.ZodInt;
|
|
4
|
+
maxReadBytes: z.ZodInt;
|
|
5
|
+
maxWriteBytes: z.ZodInt;
|
|
6
|
+
maxShellArguments: z.ZodInt;
|
|
7
|
+
maxShellArgumentBytes: z.ZodInt;
|
|
8
|
+
maxShellOutputBytes: z.ZodInt;
|
|
9
|
+
maxArtifactBytes: z.ZodInt;
|
|
10
|
+
maxSearchResults: z.ZodInt;
|
|
11
|
+
maxSearchFiles: z.ZodInt;
|
|
12
|
+
maxSearchDepth: z.ZodInt;
|
|
13
|
+
shellTimeoutMs: z.ZodInt;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export declare const AgentCodingToolAuthorizationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
16
|
+
operation: z.ZodLiteral<"read">;
|
|
17
|
+
path: z.ZodString;
|
|
18
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
19
|
+
operation: z.ZodLiteral<"write">;
|
|
20
|
+
path: z.ZodString;
|
|
21
|
+
bytes: z.ZodInt;
|
|
22
|
+
overwrite: z.ZodBoolean;
|
|
23
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
24
|
+
operation: z.ZodLiteral<"search">;
|
|
25
|
+
query: z.ZodString;
|
|
26
|
+
mode: z.ZodEnum<{
|
|
27
|
+
content: "content";
|
|
28
|
+
path: "path";
|
|
29
|
+
}>;
|
|
30
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
31
|
+
operation: z.ZodLiteral<"patch">;
|
|
32
|
+
path: z.ZodString;
|
|
33
|
+
baseSha256: z.ZodString;
|
|
34
|
+
resultSha256: z.ZodString;
|
|
35
|
+
resultBytes: z.ZodInt;
|
|
36
|
+
replacements: z.ZodInt;
|
|
37
|
+
dryRun: z.ZodBoolean;
|
|
38
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
39
|
+
operation: z.ZodLiteral<"artifact-read">;
|
|
40
|
+
reference: z.ZodString;
|
|
41
|
+
offset: z.ZodInt;
|
|
42
|
+
maxBytes: z.ZodInt;
|
|
43
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
44
|
+
operation: z.ZodLiteral<"shell">;
|
|
45
|
+
executable: z.ZodString;
|
|
46
|
+
args: z.ZodArray<z.ZodString>;
|
|
47
|
+
cwd: z.ZodString;
|
|
48
|
+
}, z.core.$strict>], "operation">;
|
|
49
|
+
export type AgentCodingToolLimits = z.infer<typeof AgentCodingToolLimitsSchema>;
|
|
50
|
+
export type AgentCodingToolAuthorization = z.infer<typeof AgentCodingToolAuthorizationSchema>;
|
|
51
|
+
export interface AgentCodingToolConfig {
|
|
52
|
+
root: string;
|
|
53
|
+
authorize(input: AgentCodingToolAuthorization): boolean | Promise<boolean>;
|
|
54
|
+
executables?: Readonly<Record<string, string>>;
|
|
55
|
+
environment?: Readonly<Record<string, string>>;
|
|
56
|
+
artifacts?: AgentCodingArtifactStore;
|
|
57
|
+
search?: {
|
|
58
|
+
/** Directory basenames omitted from workspace search at every depth. */
|
|
59
|
+
excludeDirectories?: readonly string[];
|
|
60
|
+
};
|
|
61
|
+
limits?: Partial<AgentCodingToolLimits>;
|
|
62
|
+
}
|
|
63
|
+
export interface AgentCodingArtifactStore {
|
|
64
|
+
write(input: {
|
|
65
|
+
mediaType: string;
|
|
66
|
+
data: Uint8Array;
|
|
67
|
+
}): {
|
|
68
|
+
reference: string;
|
|
69
|
+
} | Promise<{
|
|
70
|
+
reference: string;
|
|
71
|
+
}>;
|
|
72
|
+
read(input: {
|
|
73
|
+
reference: string;
|
|
74
|
+
offset: number;
|
|
75
|
+
maxBytes: number;
|
|
76
|
+
}): {
|
|
77
|
+
data: Uint8Array;
|
|
78
|
+
totalBytes?: number;
|
|
79
|
+
} | Promise<{
|
|
80
|
+
data: Uint8Array;
|
|
81
|
+
totalBytes?: number;
|
|
82
|
+
}>;
|
|
83
|
+
}
|
|
84
|
+
export interface AgentCodingToolDefinition {
|
|
85
|
+
name: string;
|
|
86
|
+
description: string;
|
|
87
|
+
identity: {
|
|
88
|
+
serviceName: string;
|
|
89
|
+
action: string;
|
|
90
|
+
method: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
91
|
+
};
|
|
92
|
+
input: z.ZodObject;
|
|
93
|
+
output: z.ZodType;
|
|
94
|
+
transports?: readonly ('MCP' | 'AGENT' | 'CLI')[];
|
|
95
|
+
handler(context: {
|
|
96
|
+
params: undefined;
|
|
97
|
+
input: unknown;
|
|
98
|
+
signal?: AbortSignal;
|
|
99
|
+
[key: string]: unknown;
|
|
100
|
+
}): unknown | Promise<unknown>;
|
|
101
|
+
}
|
|
102
|
+
export declare const FileReadInputSchema: z.ZodObject<{
|
|
103
|
+
path: z.ZodString;
|
|
104
|
+
offset: z.ZodDefault<z.ZodInt>;
|
|
105
|
+
maxBytes: z.ZodOptional<z.ZodInt>;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
export declare const FileReadOutputSchema: z.ZodObject<{
|
|
108
|
+
path: z.ZodString;
|
|
109
|
+
text: z.ZodString;
|
|
110
|
+
bytes: z.ZodInt;
|
|
111
|
+
sha256: z.ZodString;
|
|
112
|
+
truncated: z.ZodBoolean;
|
|
113
|
+
nextOffset: z.ZodOptional<z.ZodInt>;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
export declare const FileWriteInputSchema: z.ZodObject<{
|
|
116
|
+
path: z.ZodString;
|
|
117
|
+
content: z.ZodString;
|
|
118
|
+
overwrite: z.ZodDefault<z.ZodBoolean>;
|
|
119
|
+
}, z.core.$strict>;
|
|
120
|
+
export declare const FileWriteOutputSchema: z.ZodObject<{
|
|
121
|
+
path: z.ZodString;
|
|
122
|
+
bytes: z.ZodInt;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
export declare function createShellInputSchema(executableNames: readonly string[]): z.ZodObject<{
|
|
125
|
+
executable: z.ZodEnum<{
|
|
126
|
+
[x: string]: string;
|
|
127
|
+
}>;
|
|
128
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
129
|
+
cwd: z.ZodDefault<z.ZodString>;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
export declare const ShellInputSchema: z.ZodObject<{
|
|
132
|
+
executable: z.ZodString;
|
|
133
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
134
|
+
cwd: z.ZodDefault<z.ZodString>;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
export declare const ShellOutputSchema: z.ZodObject<{
|
|
137
|
+
executable: z.ZodString;
|
|
138
|
+
exitCode: z.ZodNullable<z.ZodInt>;
|
|
139
|
+
signal: z.ZodNullable<z.ZodString>;
|
|
140
|
+
stdout: z.ZodString;
|
|
141
|
+
stderr: z.ZodString;
|
|
142
|
+
outcome: z.ZodEnum<{
|
|
143
|
+
cancelled: "cancelled";
|
|
144
|
+
exited: "exited";
|
|
145
|
+
"output-limit": "output-limit";
|
|
146
|
+
timeout: "timeout";
|
|
147
|
+
}>;
|
|
148
|
+
artifact: z.ZodOptional<z.ZodObject<{
|
|
149
|
+
reference: z.ZodString;
|
|
150
|
+
bytes: z.ZodInt;
|
|
151
|
+
truncated: z.ZodBoolean;
|
|
152
|
+
}, z.core.$strict>>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
export declare function resolveCodingToolLimits(input: Partial<AgentCodingToolLimits> | undefined): AgentCodingToolLimits;
|
|
155
|
+
//# sourceMappingURL=coding-tool-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-tool-contract.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;kBAc7B,CAAC;AAEZ,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCA4C7C,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3E,WAAW,CAAC,EAAE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,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC,EAAE,CAAC;IAClD,OAAO,CAAC,OAAO,EAAE;QACf,MAAM,EAAE,SAAS,CAAC;QAClB,KAAK,EAAE,OAAO,CAAC;QACf,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,mBAAmB;;;;kBAMrB,CAAC;AAEZ,eAAO,MAAM,oBAAoB;;;;;;;kBAStB,CAAC;AAEZ,eAAO,MAAM,oBAAoB;;;;kBAMtB,CAAC;AAEZ,eAAO,MAAM,qBAAqB;;;kBAEvB,CAAC;AAEZ,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE;;;;;;mBAWxE;AAED,eAAO,MAAM,gBAAgB;;;;kBAMlB,CAAC;AAEZ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;kBAiBnB,CAAC;AAgBZ,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,SAAS,GAChD,qBAAqB,CAEvB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type AgentCodingToolConfig, type AgentCodingToolDefinition, type AgentCodingToolLimits } from './coding-tool-contract.js';
|
|
2
|
+
export declare function createFileCodingTools(config: AgentCodingToolConfig, limits: AgentCodingToolLimits): readonly AgentCodingToolDefinition[];
|
|
3
|
+
//# sourceMappingURL=coding-tool-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-tool-files.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-files.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAK3B,MAAM,wBAAwB,CAAC;AAwBhC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC5B,SAAS,yBAAyB,EAAE,CAyEtC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type AgentCodingToolAuthorization, type AgentCodingToolConfig } from './coding-tool-contract.js';
|
|
2
|
+
export declare function existingCodingPath(root: string, requested: string, maxPathBytes: number): Promise<{
|
|
3
|
+
absolute: string;
|
|
4
|
+
relative: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function writableCodingPath(root: string, requested: string, maxPathBytes: number): Promise<{
|
|
7
|
+
absolute: string;
|
|
8
|
+
relative: string;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function editableCodingPath(root: string, requested: string, maxPathBytes: number): Promise<{
|
|
11
|
+
absolute: string;
|
|
12
|
+
relative: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function authorizeCodingTool(config: AgentCodingToolConfig, request: AgentCodingToolAuthorization): Promise<void>;
|
|
15
|
+
export declare function atomicCodingReplace(target: string, content: string, mode?: number): Promise<void>;
|
|
16
|
+
/** Serialize framework-owned compare-and-replace transactions for one canonical target. */
|
|
17
|
+
export declare function withCodingPathLock<T>(target: string, work: () => Promise<T>): Promise<T>;
|
|
18
|
+
export declare function textOccurrences(source: string, search: string): number;
|
|
19
|
+
//# sourceMappingURL=coding-tool-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-tool-paths.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-paths.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,4BAA4B,EAEjC,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAC;AAoBhC,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAKrB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAarB;AAED,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM;;;GAQrB;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,qBAAqB,EAC7B,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,IAAI,CAAC,CAGf;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC,CAYf;AAID,2FAA2F;AAC3F,wBAAsB,kBAAkB,CAAC,CAAC,EACxC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACrB,OAAO,CAAC,CAAC,CAAC,CAeZ;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUtE"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AgentCodingToolConfig, AgentCodingToolDefinition, AgentCodingToolLimits } from './coding-tool-contract.js';
|
|
2
|
+
export declare function createSearchAndPatchCodingTools(config: AgentCodingToolConfig, limits: AgentCodingToolLimits): readonly AgentCodingToolDefinition[];
|
|
3
|
+
//# sourceMappingURL=coding-tool-search-patch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-tool-search-patch.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-search-patch.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,wBAAwB,CAAC;AA2DhC,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC5B,SAAS,yBAAyB,EAAE,CAmHtC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type AgentCodingToolConfig, type AgentCodingToolDefinition, type AgentCodingToolLimits } from './coding-tool-contract.js';
|
|
2
|
+
export declare function createShellCodingTool(config: AgentCodingToolConfig, limits: AgentCodingToolLimits): AgentCodingToolDefinition;
|
|
3
|
+
//# sourceMappingURL=coding-tool-shell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-tool-shell.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tool-shell.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAG3B,MAAM,wBAAwB,CAAC;AA+GhC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,GAC5B,yBAAyB,CAiD3B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AgentCodingToolConfig, type AgentCodingToolDefinition } from './coding-tool-contract.js';
|
|
2
|
+
export * from './coding-tool-contract.js';
|
|
3
|
+
export declare const AGENT_CODING_TOOL_NAMES: {
|
|
4
|
+
applyPatch: string;
|
|
5
|
+
readFile: string;
|
|
6
|
+
readOutput: string;
|
|
7
|
+
runCommand: string;
|
|
8
|
+
searchFiles: string;
|
|
9
|
+
writeFile: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Direct Agent runtime-tool definitions for a host-authorized coding profile.
|
|
13
|
+
* The root is a path boundary, not an OS sandbox; the host must still isolate
|
|
14
|
+
* the process when it needs protection from arbitrary executable behavior.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createAgentCodingTools(config: AgentCodingToolConfig): readonly AgentCodingToolDefinition[];
|
|
17
|
+
//# sourceMappingURL=coding-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coding-tools.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/coding-tools.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAE/B,MAAM,wBAAwB,CAAC;AAMhC,cAAc,wBAAwB,CAAC;AAEvC,eAAO,MAAM,uBAAuB;;;;;;;CAOQ,CAAC;AAE7C;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,qBAAqB,GAC5B,SAAS,yBAAyB,EAAE,CA6EtC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ZodType, z } from 'zod';
|
|
2
2
|
import type { AgentMessage, AgentSnapshot, AgentUsage } from './schemas.js';
|
|
3
3
|
import type { AgentRuntimeStore } from './store.js';
|
|
4
|
+
import { type AgentHistoryEvidencePolicy } from './terminal-status.js';
|
|
4
5
|
export interface AgentCompactionContext<SUMMARY> {
|
|
5
6
|
conversationId: string;
|
|
6
7
|
snapshot: AgentSnapshot;
|
|
@@ -11,6 +12,7 @@ export interface AgentCompactionContext<SUMMARY> {
|
|
|
11
12
|
export interface StructuredCompactionConfig<SUMMARY_SCHEMA extends ZodType> {
|
|
12
13
|
schema: SUMMARY_SCHEMA;
|
|
13
14
|
keepRecentTurns: number;
|
|
15
|
+
evidencePolicy?: AgentHistoryEvidencePolicy;
|
|
14
16
|
/** Total summarize/CAS attempts. A conflict always recomputes from a fresh snapshot. */
|
|
15
17
|
maxAttempts?: number;
|
|
16
18
|
threshold(input: AgentSnapshot): boolean | Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/compaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAA4B,MAAM,SAAS,CAAC;
|
|
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,CAAC;IACjB,mBAAmB,CAAC,CAAC,OAAO,EAAE,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,YAAY,GAAG,kBAAkB,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;IAClF,QAAQ,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB;AAwDD,wBAAgB,oBAAoB,CAAC,cAAc,SAAS,OAAO,EACjE,MAAM,EAAE,0BAA0B,CAAC,cAAc,CAAC,WAU7B;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,eAAe,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;CAC3C,KAAG,OAAO,CAAC,qBAAqB,CAAC,CA2DnC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface ContainedFile {
|
|
2
|
+
absolute: string;
|
|
3
|
+
relative: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ContainedFileScan {
|
|
6
|
+
files: readonly ContainedFile[];
|
|
7
|
+
truncated: boolean;
|
|
8
|
+
skippedDirectories: number;
|
|
9
|
+
skippedSymlinks: number;
|
|
10
|
+
}
|
|
11
|
+
/** Open the final path without following a replacement symlink and allocate only within budget. */
|
|
12
|
+
export declare function readContainedUtf8File(absolute: string, maxBytes: number): Promise<{
|
|
13
|
+
text: string;
|
|
14
|
+
bytes: number;
|
|
15
|
+
mode: number;
|
|
16
|
+
}>;
|
|
17
|
+
/** One deterministic, symlink-refusing walker for harness resources and workspace search. */
|
|
18
|
+
export declare function walkContainedFiles(input: {
|
|
19
|
+
root: string;
|
|
20
|
+
maxDepth: number;
|
|
21
|
+
maxFiles: number;
|
|
22
|
+
}): Promise<readonly ContainedFile[]>;
|
|
23
|
+
/** Bounded workspace scan that can omit known trees and symlinks without following either. */
|
|
24
|
+
export declare function scanContainedFiles(input: {
|
|
25
|
+
root: string;
|
|
26
|
+
maxDepth: number;
|
|
27
|
+
maxFiles: number;
|
|
28
|
+
symlinks: 'refuse' | 'skip';
|
|
29
|
+
excludeDirectory?: (relative: string) => boolean;
|
|
30
|
+
}): Promise<ContainedFileScan>;
|
|
31
|
+
//# sourceMappingURL=contained-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contained-files.d.ts","sourceRoot":"","sources":["../../src/agent-runtime/contained-files.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,mGAAmG;AACnG,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CA2BxD;AAOD,6FAA6F;AAC7F,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAIpC;AAED,8FAA8F;AAC9F,wBAAsB,kBAAkB,CAAC,KAAK,EAAE;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAClD,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+C7B"}
|