stitchkit 0.130.0 → 0.131.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/CHANGELOG.md +48 -0
- package/dist/agent-executor/acp/v1-connect.d.ts +40 -26
- package/dist/agent-executor/acp/v1-connect.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-driver.d.ts +10 -4
- package/dist/agent-executor/acp/v1-driver.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-handlers.d.ts +6 -2
- package/dist/agent-executor/acp/v1-handlers.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-probe.d.ts +38 -0
- package/dist/agent-executor/acp/v1-probe.d.ts.map +1 -0
- package/dist/agent-executor/acp/v1-protocol.d.ts +15 -0
- package/dist/agent-executor/acp/v1-protocol.d.ts.map +1 -1
- package/dist/agent-executor/acp/v1-session.d.ts +9 -7
- package/dist/agent-executor/acp/v1-session.d.ts.map +1 -1
- package/dist/agent-executor/claude/cli-driver.d.ts +7 -7
- package/dist/agent-executor/claude/cli-driver.d.ts.map +1 -1
- package/dist/agent-executor/claude/limits.d.ts +6 -4
- package/dist/agent-executor/claude/limits.d.ts.map +1 -1
- package/dist/agent-executor/claude/session.d.ts +3 -3
- package/dist/agent-executor/claude/session.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/controls.d.ts +1 -0
- package/dist/agent-executor/claude-sdk/controls.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/driver.d.ts +51 -50
- package/dist/agent-executor/claude-sdk/driver.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/probe.d.ts +3 -3
- package/dist/agent-executor/claude-sdk/probe.d.ts.map +1 -1
- package/dist/agent-executor/claude-sdk/query-loop.d.ts +2 -1
- package/dist/agent-executor/claude-sdk/query-loop.d.ts.map +1 -1
- package/dist/agent-executor/codex/classify.d.ts.map +1 -1
- package/dist/agent-executor/codex/connect.d.ts +9 -7
- package/dist/agent-executor/codex/connect.d.ts.map +1 -1
- package/dist/agent-executor/codex/control-client.d.ts +112 -87
- package/dist/agent-executor/codex/control-client.d.ts.map +1 -1
- package/dist/agent-executor/codex/control-read-methods.d.ts +7 -0
- package/dist/agent-executor/codex/control-read-methods.d.ts.map +1 -0
- package/dist/agent-executor/codex/driver.d.ts +42 -31
- package/dist/agent-executor/codex/driver.d.ts.map +1 -1
- package/dist/agent-executor/codex/event-routing.d.ts +14 -0
- package/dist/agent-executor/codex/event-routing.d.ts.map +1 -0
- package/dist/agent-executor/codex/handlers.d.ts +9 -4
- package/dist/agent-executor/codex/handlers.d.ts.map +1 -1
- package/dist/agent-executor/codex/limits.d.ts +9 -3
- package/dist/agent-executor/codex/limits.d.ts.map +1 -1
- package/dist/agent-executor/codex/notifications.d.ts +183 -0
- package/dist/agent-executor/codex/notifications.d.ts.map +1 -0
- package/dist/agent-executor/codex/pagination.d.ts +54 -0
- package/dist/agent-executor/codex/pagination.d.ts.map +1 -0
- package/dist/agent-executor/codex/protocol.d.ts +586 -144
- package/dist/agent-executor/codex/protocol.d.ts.map +1 -1
- package/dist/agent-executor/codex/request-answers.d.ts +4 -2
- package/dist/agent-executor/codex/request-answers.d.ts.map +1 -1
- package/dist/agent-executor/codex/responses.d.ts +855 -0
- package/dist/agent-executor/codex/responses.d.ts.map +1 -0
- package/dist/agent-executor/codex/session-bind.d.ts +410 -0
- package/dist/agent-executor/codex/session-bind.d.ts.map +1 -0
- package/dist/agent-executor/codex/session-controls.d.ts +21 -169
- package/dist/agent-executor/codex/session-controls.d.ts.map +1 -1
- package/dist/agent-executor/codex/session-types.d.ts +190 -0
- package/dist/agent-executor/codex/session-types.d.ts.map +1 -0
- package/dist/agent-executor/codex/session.d.ts +5 -53
- package/dist/agent-executor/codex/session.d.ts.map +1 -1
- package/dist/agent-executor/codex/shared-server.d.ts +7 -5
- package/dist/agent-executor/codex/shared-server.d.ts.map +1 -1
- package/dist/agent-executor/codex/shared-thread.d.ts +8 -8
- package/dist/agent-executor/codex/shared-thread.d.ts.map +1 -1
- package/dist/agent-executor/codex/thread-controls.d.ts +61 -36
- package/dist/agent-executor/codex/thread-controls.d.ts.map +1 -1
- package/dist/agent-executor/codex/thread-list-query.d.ts +5 -0
- package/dist/agent-executor/codex/thread-list-query.d.ts.map +1 -0
- package/dist/agent-executor/codex/thread-open.d.ts +66 -0
- package/dist/agent-executor/codex/thread-open.d.ts.map +1 -0
- package/dist/agent-executor/codex/turn-input.d.ts +25 -7
- package/dist/agent-executor/codex/turn-input.d.ts.map +1 -1
- package/dist/agent-executor/codex/unix-socket-target.d.ts +12 -3
- package/dist/agent-executor/codex/unix-socket-target.d.ts.map +1 -1
- package/dist/agent-executor/codex/ws-frame.d.ts +4 -1
- package/dist/agent-executor/codex/ws-frame.d.ts.map +1 -1
- package/dist/agent-executor/contract.d.ts +3 -1
- package/dist/agent-executor/contract.d.ts.map +1 -1
- package/dist/agent-executor/engine-process.d.ts +4 -4
- package/dist/agent-executor/engine-process.d.ts.map +1 -1
- package/dist/agent-executor/engine.d.ts +3 -3
- package/dist/agent-executor/engine.d.ts.map +1 -1
- package/dist/agent-executor/handoff.d.ts.map +1 -1
- package/dist/agent-executor/hello.d.ts +7 -0
- package/dist/agent-executor/hello.d.ts.map +1 -1
- package/dist/agent-executor/json-rpc-peer.d.ts +9 -4
- package/dist/agent-executor/json-rpc-peer.d.ts.map +1 -1
- package/dist/agent-executor/leases.d.ts +1 -1
- package/dist/agent-executor/leases.d.ts.map +1 -1
- package/dist/agent-executor/plan-limits.d.ts +12 -1
- package/dist/agent-executor/plan-limits.d.ts.map +1 -1
- package/dist/agent-executor/profile.d.ts +7 -0
- package/dist/agent-executor/profile.d.ts.map +1 -1
- package/dist/agent-executor/session-primitives.d.ts +8 -0
- package/dist/agent-executor/session-primitives.d.ts.map +1 -1
- package/dist/agent-executor/testing/consumer-stubs.d.ts +45 -0
- package/dist/agent-executor/testing/consumer-stubs.d.ts.map +1 -0
- package/dist/agent-executor/testing/fake-claude-sdk-query.d.ts +88 -0
- package/dist/agent-executor/testing/fake-claude-sdk-query.d.ts.map +1 -0
- package/dist/agent-executor/testing/fake-codex-app-server.d.ts +56 -0
- package/dist/agent-executor/testing/fake-codex-app-server.d.ts.map +1 -0
- package/dist/agent-executor/testing/fixtures.d.ts +26 -0
- package/dist/agent-executor/testing/fixtures.d.ts.map +1 -0
- package/dist/agent-executor/testing/replay-driver.d.ts +8 -8
- package/dist/agent-executor/testing/replay-driver.d.ts.map +1 -1
- package/dist/agent-executor/testing/replay-runner.d.ts +3 -2
- package/dist/agent-executor/testing/replay-runner.d.ts.map +1 -1
- package/dist/agent-executor/testing/replay-transcript.d.ts +5 -3
- package/dist/agent-executor/testing/replay-transcript.d.ts.map +1 -1
- package/dist/agent-runtime/branch-observations.d.ts +5 -5
- package/dist/entrypoints/agent-executor/acp.d.ts +2 -1
- package/dist/entrypoints/agent-executor/acp.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/acp.js +284 -82
- package/dist/entrypoints/agent-executor/claude-sdk.d.ts +4 -0
- package/dist/entrypoints/agent-executor/claude-sdk.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/claude-sdk.js +58 -32
- package/dist/entrypoints/agent-executor/claude.d.ts +2 -2
- package/dist/entrypoints/agent-executor/claude.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/claude.js +25 -20
- package/dist/entrypoints/agent-executor/codex.d.ts +11 -6
- package/dist/entrypoints/agent-executor/codex.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/codex.js +2223 -1803
- package/dist/entrypoints/agent-executor/testing.d.ts +4 -0
- package/dist/entrypoints/agent-executor/testing.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor/testing.js +880 -18
- package/dist/entrypoints/agent-executor.d.ts +3 -3
- package/dist/entrypoints/agent-executor.d.ts.map +1 -1
- package/dist/entrypoints/agent-executor.js +42 -8
- package/dist/entrypoints/process.js +3 -3
- package/dist/{index-jrn3prgm.js → index-32vaajec.js} +29 -4
- package/dist/{index-p1qmpq0p.js → index-64e9p079.js} +92 -56
- package/dist/{index-dbp6xemn.js → index-g2d9kws8.js} +199 -3
- package/dist/index-gm9yz82v.js +56 -0
- package/dist/index-j15dhkda.js +749 -0
- package/dist/{index-1q0n6zek.js → index-kwsr7j5k.js} +84 -44
- package/llms/agent-executor-acp.txt +5 -5
- package/llms/agent-executor-claude-sdk.txt +3 -1
- package/llms/agent-executor-claude.txt +2 -2
- package/llms/agent-executor-codex.txt +13 -10
- package/llms/agent-executor-testing.txt +5 -1
- package/llms/agent-executor.txt +4 -4
- package/llms/stitchkit.txt +75 -74
- package/llms/{upgrading-0.128.0-0.130.0.txt → upgrading-0.128.0-0.131.0.txt} +56 -3
- package/llms/upgrading.txt +1 -1
- package/llms-full.txt +160 -97
- package/llms.txt +8 -8
- package/package.json +3 -3
- package/dist/index-2s8sy57y.js +0 -229
package/dist/index-2s8sy57y.js
DELETED
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createBoundedChannel2
|
|
3
|
-
} from "./index-09f7w2qq.js";
|
|
4
|
-
import {
|
|
5
|
-
ExecutorStartupPhaseSchema2,
|
|
6
|
-
engineEnvironment2
|
|
7
|
-
} from "./index-dbp6xemn.js";
|
|
8
|
-
import {
|
|
9
|
-
runNativeCommand2
|
|
10
|
-
} from "./index-pzhqydxb.js";
|
|
11
|
-
import {
|
|
12
|
-
jsonDataRefusal
|
|
13
|
-
} from "./index-m6w6jtda.js";
|
|
14
|
-
import {
|
|
15
|
-
abortReason,
|
|
16
|
-
linkAbortSignals
|
|
17
|
-
} from "./index-rptj3qnc.js";
|
|
18
|
-
|
|
19
|
-
// src/agent-executor/session-primitives.ts
|
|
20
|
-
import { createHash } from "node:crypto";
|
|
21
|
-
import { z } from "zod";
|
|
22
|
-
var TURN_QUEUE = { maxItems: 65536, maxBytes: 64 * 1024 * 1024 };
|
|
23
|
-
var MAX_DATE_MS = 8640000000000000;
|
|
24
|
-
var SAFE_JSON_LIMITS = {
|
|
25
|
-
maxDepth: 100,
|
|
26
|
-
maxNodes: 1e5,
|
|
27
|
-
omitObjectUndefined: true,
|
|
28
|
-
zodJson: true
|
|
29
|
-
};
|
|
30
|
-
function nonEmptyString(value) {
|
|
31
|
-
return typeof value === "string" && value.trim().length > 0 ? value : undefined;
|
|
32
|
-
}
|
|
33
|
-
function epochSecondsToIso(seconds) {
|
|
34
|
-
if (seconds === null || seconds === undefined)
|
|
35
|
-
return;
|
|
36
|
-
const ms = seconds * 1000;
|
|
37
|
-
if (!Number.isFinite(ms) || Math.abs(ms) > MAX_DATE_MS)
|
|
38
|
-
return;
|
|
39
|
-
return new Date(ms).toISOString();
|
|
40
|
-
}
|
|
41
|
-
function createTurnDeltaChannel() {
|
|
42
|
-
return createBoundedChannel2({
|
|
43
|
-
policy: "ordered",
|
|
44
|
-
...TURN_QUEUE,
|
|
45
|
-
sizeOf: (delta) => JSON.stringify(delta).length
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function normalizeDeltaIdentifiers(delta) {
|
|
49
|
-
if (delta.type === "tool-call" || delta.type === "tool-result") {
|
|
50
|
-
const callId = nonEmptyString(delta.callId) ?? delta.itemId;
|
|
51
|
-
const toolName = nonEmptyString(delta.toolName) ?? "unknown";
|
|
52
|
-
if (callId === delta.callId && toolName === delta.toolName)
|
|
53
|
-
return delta;
|
|
54
|
-
return { ...delta, callId, toolName };
|
|
55
|
-
}
|
|
56
|
-
if (delta.type === "request") {
|
|
57
|
-
const callId = nonEmptyString(delta.callId);
|
|
58
|
-
const toolName = delta.toolName === undefined ? undefined : nonEmptyString(delta.toolName) ?? "tool";
|
|
59
|
-
if (callId === delta.callId && toolName === delta.toolName)
|
|
60
|
-
return delta;
|
|
61
|
-
const { callId: _callId, toolName: _toolName, ...rest } = delta;
|
|
62
|
-
return {
|
|
63
|
-
...rest,
|
|
64
|
-
...callId !== undefined && { callId },
|
|
65
|
-
...toolName !== undefined && { toolName }
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return delta;
|
|
69
|
-
}
|
|
70
|
-
function offerTurnDelta(channel, delta) {
|
|
71
|
-
if (channel === undefined)
|
|
72
|
-
return;
|
|
73
|
-
const result = channel.offer(normalizeDeltaIdentifiers(delta));
|
|
74
|
-
if (result.outcome === "refused" && result.reason !== "not-open") {
|
|
75
|
-
channel.fail(new Error(`The turn's delta queue refused a delta (${result.reason})`));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function sessionAbort(caller) {
|
|
79
|
-
if (caller?.aborted)
|
|
80
|
-
throw abortReason(caller);
|
|
81
|
-
const own = new AbortController;
|
|
82
|
-
const link = caller ? linkAbortSignals(caller, own.signal) : { signal: own.signal, release: () => {
|
|
83
|
-
return;
|
|
84
|
-
} };
|
|
85
|
-
return { signal: link.signal, abort: () => own.abort(), release: link.release };
|
|
86
|
-
}
|
|
87
|
-
function runEngineCli(input) {
|
|
88
|
-
return runNativeCommand2({
|
|
89
|
-
executable: input.executable,
|
|
90
|
-
args: [...input.prefix, ...input.args],
|
|
91
|
-
env: engineEnvironment2(input.profile, input.ambient),
|
|
92
|
-
envPolicy: "declared-only",
|
|
93
|
-
capture: true,
|
|
94
|
-
maxOutputBytes: 1024 * 1024,
|
|
95
|
-
timeoutMs: 30000
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
function errorText(error) {
|
|
99
|
-
return error instanceof Error ? error.message : String(error);
|
|
100
|
-
}
|
|
101
|
-
async function stopConnection(connection, primary) {
|
|
102
|
-
let stopFailure;
|
|
103
|
-
try {
|
|
104
|
-
await connection.engine.stop();
|
|
105
|
-
} catch (error) {
|
|
106
|
-
stopFailure = { error };
|
|
107
|
-
}
|
|
108
|
-
await connection.reading;
|
|
109
|
-
if (stopFailure === undefined)
|
|
110
|
-
return;
|
|
111
|
-
if (primary === undefined)
|
|
112
|
-
throw stopFailure.error;
|
|
113
|
-
throw new AggregateError([primary.error, stopFailure.error], `${errorText(primary.error)}; stopping the engine also failed: ${errorText(stopFailure.error)}`, { cause: primary.error });
|
|
114
|
-
}
|
|
115
|
-
async function withEphemeralConnection(connect, use) {
|
|
116
|
-
const stop = new AbortController;
|
|
117
|
-
const connection = await connect(stop.signal);
|
|
118
|
-
let answer;
|
|
119
|
-
try {
|
|
120
|
-
answer = await use(connection);
|
|
121
|
-
} catch (error) {
|
|
122
|
-
stop.abort();
|
|
123
|
-
await stopConnection(connection, { error });
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
stop.abort();
|
|
127
|
-
try {
|
|
128
|
-
await stopConnection(connection);
|
|
129
|
-
} catch {}
|
|
130
|
-
return answer;
|
|
131
|
-
}
|
|
132
|
-
function safeJsonValue(value) {
|
|
133
|
-
const snapshot = {};
|
|
134
|
-
const refusal = jsonDataRefusal(value, SAFE_JSON_LIMITS, snapshot);
|
|
135
|
-
if (refusal !== undefined) {
|
|
136
|
-
throw new TypeError(`Expected bounded JSON data (refused: ${refusal})`);
|
|
137
|
-
}
|
|
138
|
-
return z.json().parse(snapshot.value);
|
|
139
|
-
}
|
|
140
|
-
function invokeSafely(invoke) {
|
|
141
|
-
try {
|
|
142
|
-
const result = invoke();
|
|
143
|
-
if (typeof result === "object" && result !== null && "then" in result && typeof result.then === "function") {
|
|
144
|
-
Promise.resolve(result).catch(() => {
|
|
145
|
-
return;
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
} catch {}
|
|
149
|
-
}
|
|
150
|
-
function emitStartupPhase(callback, phase) {
|
|
151
|
-
if (callback === undefined)
|
|
152
|
-
return;
|
|
153
|
-
const parsed = ExecutorStartupPhaseSchema2.parse(phase);
|
|
154
|
-
invokeSafely(() => callback(parsed));
|
|
155
|
-
}
|
|
156
|
-
function clampUniqueWindowName(prefix, suffix, seenNames, disambiguatorSeed, maxChars = 256) {
|
|
157
|
-
const maxPrefix = Math.max(1, maxChars - suffix.length);
|
|
158
|
-
let candidate = prefix.length > maxPrefix ? `${prefix.slice(0, maxPrefix)}${suffix}`.slice(0, maxChars) : `${prefix}${suffix}`;
|
|
159
|
-
if (!seenNames.has(candidate)) {
|
|
160
|
-
seenNames.add(candidate);
|
|
161
|
-
return candidate;
|
|
162
|
-
}
|
|
163
|
-
const digest = createHash("sha256").update(disambiguatorSeed).digest("hex").slice(0, 8);
|
|
164
|
-
const tag = `#${digest}${suffix}`;
|
|
165
|
-
const room = Math.max(1, maxChars - tag.length);
|
|
166
|
-
candidate = `${prefix.slice(0, room)}${tag}`.slice(0, maxChars);
|
|
167
|
-
let index = 2;
|
|
168
|
-
while (seenNames.has(candidate)) {
|
|
169
|
-
const indexedTag = `#${digest}_${index}${suffix}`;
|
|
170
|
-
const indexedRoom = Math.max(1, maxChars - indexedTag.length);
|
|
171
|
-
candidate = `${prefix.slice(0, indexedRoom)}${indexedTag}`.slice(0, maxChars);
|
|
172
|
-
index += 1;
|
|
173
|
-
}
|
|
174
|
-
seenNames.add(candidate);
|
|
175
|
-
return candidate;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// src/agent-executor/engine-requests.ts
|
|
179
|
-
function holdEngineRequest(turn, request) {
|
|
180
|
-
if (turn.state.interruptRequested) {
|
|
181
|
-
request.resolve(request.refusal);
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const offered = request.delta();
|
|
185
|
-
turn.pending.set(request.interactionId, {
|
|
186
|
-
detail: request.detail,
|
|
187
|
-
answeredBy: request.answeredBy,
|
|
188
|
-
resolve: request.resolve
|
|
189
|
-
});
|
|
190
|
-
offerTurnDelta(turn.channel, offered);
|
|
191
|
-
}
|
|
192
|
-
function answerEngineRequest(turn, interactionId, answer) {
|
|
193
|
-
const waiting = turn.pending.get(interactionId);
|
|
194
|
-
if (waiting === undefined)
|
|
195
|
-
return false;
|
|
196
|
-
waiting.resolve(answer);
|
|
197
|
-
turn.pending.delete(interactionId);
|
|
198
|
-
offerTurnDelta(turn.channel, {
|
|
199
|
-
type: "request-resolved",
|
|
200
|
-
turnId: turn.state.turnId,
|
|
201
|
-
itemId: `resolved:${interactionId}`,
|
|
202
|
-
raw: waiting.answeredBy,
|
|
203
|
-
interactionId
|
|
204
|
-
});
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
function drainEngineRequests(turn, answer) {
|
|
208
|
-
if (turn === undefined)
|
|
209
|
-
return;
|
|
210
|
-
for (const [interactionId, waiting] of [...turn.pending]) {
|
|
211
|
-
answerEngineRequest(turn, interactionId, answer(waiting));
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function endEngineTurn(turn, answer, deltas) {
|
|
215
|
-
if (turn === undefined)
|
|
216
|
-
return;
|
|
217
|
-
drainEngineRequests(turn, answer);
|
|
218
|
-
for (const delta of deltas)
|
|
219
|
-
offerTurnDelta(turn.channel, delta);
|
|
220
|
-
turn.channel.close();
|
|
221
|
-
}
|
|
222
|
-
function loseEngineTurn(turn, answer, error) {
|
|
223
|
-
if (turn === undefined)
|
|
224
|
-
return;
|
|
225
|
-
drainEngineRequests(turn, answer);
|
|
226
|
-
turn.channel.fail(error);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
export { nonEmptyString, epochSecondsToIso, createTurnDeltaChannel, offerTurnDelta, sessionAbort, runEngineCli, stopConnection, withEphemeralConnection, safeJsonValue, invokeSafely, emitStartupPhase, clampUniqueWindowName, holdEngineRequest, answerEngineRequest, drainEngineRequests, endEngineTurn, loseEngineTurn };
|