@gobing-ai/ts-ai-runner 0.5.32 → 0.6.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 +6 -2
- package/dist/ai-runner.d.ts +12 -0
- package/dist/ai-runner.d.ts.map +1 -1
- package/dist/ai-runner.js +36 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/testing/fake-turn-agent.d.ts +2 -0
- package/dist/testing/fake-turn-agent.d.ts.map +1 -0
- package/dist/testing/fake-turn-agent.js +114 -0
- package/dist/testing/fake-turn-driver.d.ts +22 -0
- package/dist/testing/fake-turn-driver.d.ts.map +1 -0
- package/dist/testing/fake-turn-driver.js +66 -0
- package/dist/turn-session.d.ts +201 -0
- package/dist/turn-session.d.ts.map +1 -0
- package/dist/turn-session.js +452 -0
- package/package.json +8 -4
- package/src/ai-runner.ts +55 -0
- package/src/index.ts +1 -0
- package/src/testing/fake-turn-agent.ts +123 -0
- package/src/testing/fake-turn-driver.ts +99 -0
- package/src/turn-session.ts +627 -0
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ bun add @gobing-ai/ts-ai-runner
|
|
|
29
29
|
| `MessageStore` / `DrainedMessage` | ai-runner-owned orchestration persistence port and minimal message view consumed by `TeamOrchestrator` |
|
|
30
30
|
| `TeamAgentProcess` | Manages a long-running agent subprocess with pipe-mode stdin/stdout |
|
|
31
31
|
| `TeamOrchestrator` | Loads specs, starts/stops agents, routes durable/live messages, and emits lifecycle events |
|
|
32
|
+
| `AiRunner.openTurnSession()` | Opens a correlated warm-turn session over one long-lived agent process: one turn at a time, typed refusals (never throws), acceptance separate from outcome, deterministic settlement (`success`/`failure`/`interrupted`/`not-started`/`outcome-unknown`/`contract-violation`), bounded cancel grace. 0.x ships the contract only — `TURN_SESSION_DRIVERS` is empty; real per-agent drivers land with qualification evidence. |
|
|
32
33
|
| `AgentEvents` / `AiRunnerProcessEvents` | Typed event maps for agent and process-level observability |
|
|
33
34
|
| `AGENT_SHIMS` / `TIER1_PRIORITY` / `TIER2_AGENTS` / `DISPLAY_ORDER` | Agent registry constants |
|
|
34
35
|
| `isAgentName()` | Type guard for supported agent identifiers |
|
|
@@ -929,8 +930,11 @@ safe to call more than once; the maker is not usable afterwards.
|
|
|
929
930
|
|
|
930
931
|
## Boundary Notes
|
|
931
932
|
|
|
932
|
-
-
|
|
933
|
-
|
|
933
|
+
- The turn-session facade (task 1284) owns only process/protocol mechanics (ADR-145): consumers own
|
|
934
|
+
policy, receipts and validation. `TURN_SESSION_DRIVERS` registers a driver only with recorded
|
|
935
|
+
`verifiedAgainst` qualification evidence; the scripted fake in `@gobing-ai/ts-ai-runner/testing`
|
|
936
|
+
is for consumer tests, never library code.
|
|
937
|
+
- This package is a command adapter, not an agent orchestration framework.- It does not install agent CLIs or manage credentials.
|
|
934
938
|
- It does not parse agent responses beyond process result capture.
|
|
935
939
|
- It keeps subprocess launching behind `ProcessExecutor` / `PipeProcess`, so tests can stay deterministic.
|
|
936
940
|
- Team-mode persistence is consumed through the ai-runner-owned `MessageStore` port; `InboxMessageDao` from `@gobing-ai/ts-db/inbox` is one structural provider. Host apps own migrations and adapter lifecycle, and `@gobing-ai/ts-db` is a development dependency of this package (only the DB-backed integration test resolves the concrete DAO).
|
package/dist/ai-runner.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type ProcessExecutor, type ProcessOutputChunk, type TracerPort } from '
|
|
|
3
3
|
import { type AgentName, type PromptOptions, type ShimCommand } from './agents/shims';
|
|
4
4
|
import type { AgentEvents, AiRunnerProcessEvents } from './events';
|
|
5
5
|
import { type QuotaAttribution } from './quota';
|
|
6
|
+
import { type OpenTurnSessionResult, type TurnBinary, type TurnSessionDriver, type TurnSessionPolicy } from './turn-session';
|
|
6
7
|
/** Result returned by every AI runner dispatch method. */
|
|
7
8
|
export interface AgentRunResult {
|
|
8
9
|
/** Process exit code; null indicates signal or timeout termination. */
|
|
@@ -116,6 +117,17 @@ export declare class AiRunner {
|
|
|
116
117
|
buildPromptCommand(agent: AgentName, promptOptions: PromptOptions, options?: AgentRunOptions): ShimCommand;
|
|
117
118
|
/** Run an agent authentication command, or return null when unsupported. */
|
|
118
119
|
runAuthCommand(agent: AgentName, options?: AgentRunOptions): Promise<AgentRunResult> | null;
|
|
120
|
+
/** Open a correlated warm-turn session (task 1284). Expected refusals are typed, never throws. */
|
|
121
|
+
openTurnSession(agent: AgentName, options: {
|
|
122
|
+
policy: TurnSessionPolicy;
|
|
123
|
+
/** Test/injection seam; defaults to the built-in registry (empty in 0.x). */
|
|
124
|
+
driver?: TurnSessionDriver;
|
|
125
|
+
/** Pre-resolved binary identity; defaults to probing the shim's version command. */
|
|
126
|
+
binary?: TurnBinary;
|
|
127
|
+
handshakeTimeoutMs?: number;
|
|
128
|
+
}): Promise<OpenTurnSessionResult>;
|
|
129
|
+
/** Probe the agent binary for qualification: path + best-effort semver from the version command. */
|
|
130
|
+
private resolveTurnBinary;
|
|
119
131
|
private invoke;
|
|
120
132
|
}
|
|
121
133
|
/**
|
package/dist/ai-runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-runner.d.ts","sourceRoot":"","sources":["../src/ai-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,QAAQ,EAAa,KAAK,MAAM,EAAc,MAAM,qBAAqB,CAAC;AAC5G,OAAO,EAGH,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAEvB,KAAK,UAAU,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,SAAS,EAAgB,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEnE,OAAO,EAGH,KAAK,gBAAgB,EAExB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3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KG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAC/B,WAAW,CAKb"}
|
package/dist/ai-runner.js
CHANGED
|
@@ -4,6 +4,7 @@ import { getAgentShim } from './agents/shims.js';
|
|
|
4
4
|
import { buildIdentityPreamble } from './identity.js';
|
|
5
5
|
import { buildQuotaObservation, classifyQuotaErrorRecord, QuotaObservationProducer, } from './quota.js';
|
|
6
6
|
import { translateSlashCommand } from './slash-command.js';
|
|
7
|
+
import { openTurnSessionWithDriver, TURN_SESSION_DRIVERS, } from './turn-session.js';
|
|
7
8
|
/**
|
|
8
9
|
* Public environment-variable contract for agent run correlation.
|
|
9
10
|
*
|
|
@@ -117,6 +118,41 @@ export class AiRunner {
|
|
|
117
118
|
const command = getAgentShim(agent).getAuthCommand();
|
|
118
119
|
return command === null ? null : this.invoke(agent, 'auth', command, options, true);
|
|
119
120
|
}
|
|
121
|
+
/** Open a correlated warm-turn session (task 1284). Expected refusals are typed, never throws. */
|
|
122
|
+
async openTurnSession(agent, options) {
|
|
123
|
+
// Driver lookup BEFORE any binary probe: an unsupported agent must not spawn (AC1).
|
|
124
|
+
const driver = options.driver ?? TURN_SESSION_DRIVERS.get(agent);
|
|
125
|
+
if (driver === undefined) {
|
|
126
|
+
return {
|
|
127
|
+
ok: false,
|
|
128
|
+
reason: 'unsupported-agent',
|
|
129
|
+
detail: `no turn-session driver registered for agent '${agent}' (registry: ${[...TURN_SESSION_DRIVERS.keys()].join(', ') || 'empty'})`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
const binary = options.binary ?? (await this.resolveTurnBinary(agent));
|
|
133
|
+
return await openTurnSessionWithDriver({
|
|
134
|
+
agent,
|
|
135
|
+
driver,
|
|
136
|
+
policy: options.policy,
|
|
137
|
+
binary,
|
|
138
|
+
processExecutor: this.processExecutor,
|
|
139
|
+
...(options.handshakeTimeoutMs !== undefined ? { handshakeTimeoutMs: options.handshakeTimeoutMs } : {}),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** Probe the agent binary for qualification: path + best-effort semver from the version command. */
|
|
143
|
+
async resolveTurnBinary(agent) {
|
|
144
|
+
const command = getAgentShim(agent).getVersionCommand();
|
|
145
|
+
const result = await this.processExecutor.run({
|
|
146
|
+
command: command.command,
|
|
147
|
+
args: command.args,
|
|
148
|
+
label: `ai-runner.${agent}.version`,
|
|
149
|
+
rejectOnError: false,
|
|
150
|
+
forceBuffered: true,
|
|
151
|
+
...(this.defaultCwd !== undefined ? { cwd: this.defaultCwd } : {}),
|
|
152
|
+
});
|
|
153
|
+
const match = /[0-9]+\.[0-9]+\.[0-9]+[^\s]*/.exec(result.stdout);
|
|
154
|
+
return { path: command.command, version: match?.[0] ?? null };
|
|
155
|
+
}
|
|
120
156
|
async invoke(agent, operation, command, options, forceBuffered) {
|
|
121
157
|
const label = `ai-runner.${agent}.${operation}`;
|
|
122
158
|
this.logger.debug('invoke', { label, command: command.command, args: command.args.join(' ') });
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-turn-agent.d.ts","sourceRoot":"","sources":["../../src/testing/fake-turn-agent.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scripted fake turn agent for turn-session tests (task 1284). A REAL child process: it speaks a
|
|
3
|
+
* JSONL protocol over stdin/stdout, replaying a script passed as `argv[2]` (JSON array). Only for
|
|
4
|
+
* tests via `./testing` — never imported by library code.
|
|
5
|
+
*
|
|
6
|
+
* Protocol (parent → child):
|
|
7
|
+
* {"type":"turn","turnId":...,"prompt":...,"correlation":{...}} start replaying the script
|
|
8
|
+
* {"type":"cancel","reason":...} flush pending sleeps (unless ignored)
|
|
9
|
+
* Protocol (child → parent):
|
|
10
|
+
* {"ctl":"ready","nativeSessionId":...} handshake (auto-emitted at startup)
|
|
11
|
+
* {"turn":T,"type":"accepted"} | {"turn":T,"type":"output","data":...}
|
|
12
|
+
* {"turn":T,"type":"terminal","kind":"success"|"failure",...}
|
|
13
|
+
* {"ctl":"exit"} echoes are the raw scripted `stray` lines.
|
|
14
|
+
*/
|
|
15
|
+
import { createInterface } from 'node:readline';
|
|
16
|
+
const script = JSON.parse(process.argv[2] ?? '[]');
|
|
17
|
+
const readyAction = script.find((action) => action.op === 'ready');
|
|
18
|
+
const turnActions = script.filter((action) => action.op !== 'ready');
|
|
19
|
+
/** Skip the startup ready frame when the script dies immediately (broken-agent handshake test). */
|
|
20
|
+
const startsWithExit = script[0]?.op === 'exit';
|
|
21
|
+
let currentTurnId = null;
|
|
22
|
+
let ignoreCancel = false;
|
|
23
|
+
let flushing = false;
|
|
24
|
+
/** Pending sleep timers mapped to their resolvers so a cancel can wake them (not just clear them). */
|
|
25
|
+
const sleepers = new Map();
|
|
26
|
+
function send(line) {
|
|
27
|
+
process.stdout.write(`${JSON.stringify(line)}\n`);
|
|
28
|
+
}
|
|
29
|
+
// Parent may drop stdout (kill/close) while frames are in flight — exit instead of crashing on EPIPE.
|
|
30
|
+
process.stdout.on('error', () => process.exit(0));
|
|
31
|
+
// Handshake: explicit ready action first (nativeSessionId control), else the default.
|
|
32
|
+
if (readyAction !== undefined) {
|
|
33
|
+
send({
|
|
34
|
+
ctl: 'ready',
|
|
35
|
+
...(readyAction.nativeSessionId !== undefined ? { nativeSessionId: readyAction.nativeSessionId } : {}),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else if (!startsWithExit) {
|
|
39
|
+
send({ ctl: 'ready', nativeSessionId: 'fake-session-1' });
|
|
40
|
+
}
|
|
41
|
+
function sleep(ms) {
|
|
42
|
+
return new Promise((resolve) => {
|
|
43
|
+
const timer = setTimeout(() => {
|
|
44
|
+
sleepers.delete(timer);
|
|
45
|
+
resolve();
|
|
46
|
+
}, ms);
|
|
47
|
+
sleepers.set(timer, resolve);
|
|
48
|
+
if (flushing) {
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
sleepers.delete(timer);
|
|
51
|
+
resolve();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async function replay() {
|
|
56
|
+
for (const action of turnActions) {
|
|
57
|
+
if (action.op === 'accept')
|
|
58
|
+
send({ turn: currentTurnId, type: 'accepted' });
|
|
59
|
+
else if (action.op === 'output')
|
|
60
|
+
send({ turn: currentTurnId, type: 'output', data: action.data ?? '' });
|
|
61
|
+
else if (action.op === 'terminal')
|
|
62
|
+
send({
|
|
63
|
+
turn: currentTurnId,
|
|
64
|
+
type: 'terminal',
|
|
65
|
+
kind: action.kind ?? 'success',
|
|
66
|
+
...(action.nativeTurnId !== undefined ? { nativeTurnId: action.nativeTurnId } : {}),
|
|
67
|
+
...(action.finalText !== undefined ? { finalText: action.finalText } : {}),
|
|
68
|
+
});
|
|
69
|
+
else if (action.op === 'stray' && action.line !== undefined)
|
|
70
|
+
send(action.line);
|
|
71
|
+
else if (action.op === 'flood')
|
|
72
|
+
// Written by the child so the >1MiB line never passes through argv (macOS E2BIG limit).
|
|
73
|
+
send({ turn: currentTurnId, type: 'output', data: 'x'.repeat(1024 * 1024 + 64) });
|
|
74
|
+
else if (action.op === 'sleep')
|
|
75
|
+
await sleep(action.ms ?? 0);
|
|
76
|
+
else if (action.op === 'ignore-cancel')
|
|
77
|
+
ignoreCancel = true;
|
|
78
|
+
else if (action.op === 'exit')
|
|
79
|
+
process.exit(action.code ?? 0);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const rl = createInterface({ input: process.stdin });
|
|
83
|
+
rl.on('line', (raw) => {
|
|
84
|
+
let frame;
|
|
85
|
+
try {
|
|
86
|
+
frame = JSON.parse(raw);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (frame.type === 'turn' && typeof frame.turnId === 'string') {
|
|
92
|
+
currentTurnId = frame.turnId;
|
|
93
|
+
flushing = false;
|
|
94
|
+
void replay();
|
|
95
|
+
}
|
|
96
|
+
else if (frame.type === 'cancel') {
|
|
97
|
+
if (ignoreCancel)
|
|
98
|
+
return;
|
|
99
|
+
// Answering cancel: wake pending sleeps so the scripted terminal arrives promptly.
|
|
100
|
+
flushing = true;
|
|
101
|
+
for (const [timer, resolve] of sleepers) {
|
|
102
|
+
clearTimeout(timer);
|
|
103
|
+
resolve();
|
|
104
|
+
}
|
|
105
|
+
sleepers.clear();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
rl.on('close', () => {
|
|
109
|
+
process.exit(0);
|
|
110
|
+
});
|
|
111
|
+
// Scripts that lead with `exit` run at startup (direct child drives and handshake tests);
|
|
112
|
+
// turn-dependent actions replay with a null turnId in that mode.
|
|
113
|
+
if (startsWithExit)
|
|
114
|
+
void replay();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fake turn-session driver for tests (task 1284). Spawns a REAL child process
|
|
3
|
+
* (`fake-turn-agent.ts`) that replays a scripted JSONL protocol across the process boundary,
|
|
4
|
+
* so sessions are exercised end-to-end — never against an in-process stub of the transport.
|
|
5
|
+
* Exported from the `./testing` subpath only; never imported by library code.
|
|
6
|
+
*/
|
|
7
|
+
import type { TurnSessionDriver } from '../turn-session';
|
|
8
|
+
/** One scripted child action (see `fake-turn-agent.ts` for the wire semantics). */
|
|
9
|
+
export interface FakeTurnAction {
|
|
10
|
+
op: 'ready' | 'accept' | 'output' | 'terminal' | 'stray' | 'sleep' | 'ignore-cancel' | 'flood' | 'exit';
|
|
11
|
+
nativeSessionId?: string;
|
|
12
|
+
data?: string;
|
|
13
|
+
kind?: 'success' | 'failure';
|
|
14
|
+
nativeTurnId?: string;
|
|
15
|
+
finalText?: string;
|
|
16
|
+
line?: Record<string, unknown>;
|
|
17
|
+
ms?: number;
|
|
18
|
+
code?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Build a turn-session driver over the scripted child. `overrides` tailors qualify/agent for refusal tests. */
|
|
21
|
+
export declare function createFakeTurnSessionDriver(actions: FakeTurnAction[], overrides?: Partial<Pick<TurnSessionDriver, 'qualify' | 'agent'>>): TurnSessionDriver;
|
|
22
|
+
//# sourceMappingURL=fake-turn-driver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-turn-driver.d.ts","sourceRoot":"","sources":["../../src/testing/fake-turn-driver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAA6B,iBAAiB,EAAoC,MAAM,iBAAiB,CAAC;AAGtH,mFAAmF;AACnF,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,eAAe,GAAG,OAAO,GAAG,MAAM,CAAC;IACxG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAsBD,gHAAgH;AAChH,wBAAgB,2BAA2B,CACvC,OAAO,EAAE,cAAc,EAAE,EACzB,SAAS,GAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,OAAO,CAAC,CAAM,GACtE,iBAAiB,CAoDnB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { TurnProtocolError } from '../turn-session.js';
|
|
2
|
+
/** Path of the child script: source tree in dev/checkouts, compiled sibling in built packages. */
|
|
3
|
+
function fakeTurnAgentPath() {
|
|
4
|
+
// No node:path/node:fs (runtime-boundaries rule): import.meta.dir is already absolute, so a
|
|
5
|
+
// separator-safe marker check picks the compiled sibling in built packages.
|
|
6
|
+
const isBuilt = import.meta.dir.replace(/\\/g, '/').includes('/dist/');
|
|
7
|
+
return `${import.meta.dir}/fake-turn-agent.${isBuilt ? 'js' : 'ts'}`;
|
|
8
|
+
}
|
|
9
|
+
/** Build a turn-session driver over the scripted child. `overrides` tailors qualify/agent for refusal tests. */
|
|
10
|
+
export function createFakeTurnSessionDriver(actions, overrides = {}) {
|
|
11
|
+
const scriptJson = JSON.stringify(actions);
|
|
12
|
+
const driver = {
|
|
13
|
+
agent: overrides.agent ?? 'pi',
|
|
14
|
+
qualify: overrides.qualify ?? (() => ({ qualified: true })),
|
|
15
|
+
spawnArgv: (_binary, _policy) => ({
|
|
16
|
+
command: process.execPath,
|
|
17
|
+
args: [fakeTurnAgentPath(), scriptJson],
|
|
18
|
+
}),
|
|
19
|
+
handshake: async (pull) => {
|
|
20
|
+
const raw = await pull(2_000);
|
|
21
|
+
if (raw === null)
|
|
22
|
+
return null; // EOF or timeout before ready
|
|
23
|
+
const frame = JSON.parse(raw);
|
|
24
|
+
if (frame.ctl !== 'ready')
|
|
25
|
+
return null;
|
|
26
|
+
return frame.nativeSessionId !== undefined ? { nativeSessionId: frame.nativeSessionId } : null;
|
|
27
|
+
},
|
|
28
|
+
encodeTurn: (input) => `${JSON.stringify({ type: 'turn', ...input })}\n`,
|
|
29
|
+
decode: (line) => {
|
|
30
|
+
let frame;
|
|
31
|
+
try {
|
|
32
|
+
frame = JSON.parse(line);
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
throw new TurnProtocolError(`malformed frame: ${line.slice(0, 80)}`);
|
|
36
|
+
}
|
|
37
|
+
if (frame.ctl !== undefined)
|
|
38
|
+
return []; // control frames (ready) are handshake-only
|
|
39
|
+
if (frame.type !== 'accepted' && frame.type !== 'output' && frame.type !== 'terminal') {
|
|
40
|
+
throw new TurnProtocolError(`unknown frame type: ${String(frame.type)}`);
|
|
41
|
+
}
|
|
42
|
+
return [
|
|
43
|
+
{
|
|
44
|
+
turnId: frame.turn ?? null,
|
|
45
|
+
type: frame.type,
|
|
46
|
+
...(frame.data !== undefined ? { data: frame.data } : {}),
|
|
47
|
+
...(frame.type === 'terminal'
|
|
48
|
+
? {
|
|
49
|
+
terminal: {
|
|
50
|
+
kind: frame.kind === 'failure' ? 'failure' : 'success',
|
|
51
|
+
...(frame.nativeTurnId !== undefined ? { nativeTurnId: frame.nativeTurnId } : {}),
|
|
52
|
+
...(frame.nativeSessionId !== undefined
|
|
53
|
+
? { nativeSessionId: frame.nativeSessionId }
|
|
54
|
+
: {}),
|
|
55
|
+
...(frame.finalText !== undefined ? { finalText: frame.finalText } : {}),
|
|
56
|
+
...(frame.reason !== undefined ? { reason: frame.reason } : {}),
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
: {}),
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
},
|
|
63
|
+
encodeCancel: (reason) => `${JSON.stringify({ type: 'cancel', reason })}\n`,
|
|
64
|
+
};
|
|
65
|
+
return driver;
|
|
66
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import type { ProcessExecutor } from '@gobing-ai/ts-runtime';
|
|
2
|
+
import type { AgentName } from './agents/shims';
|
|
3
|
+
/**
|
|
4
|
+
* Correlated warm-turn session facade (task 1284, design `fleet-task-turn-execution.md` §4–5,
|
|
5
|
+
* ADR-145): ts-ai-runner owns the process/protocol mechanics of one long-lived agent session;
|
|
6
|
+
* consumers (Spur) own policy, receipts and validation. 0.x ships the CONTRACT with no
|
|
7
|
+
* real-agent driver registered — claude/pi/codex drivers land with their qualification
|
|
8
|
+
* evidence in Spur tasks 1276–1278.
|
|
9
|
+
*/
|
|
10
|
+
/** Terminal classification of one turn. Exactly one outcome per turn, never upgraded after resolution. */
|
|
11
|
+
export type TurnOutcomeKind = 'success' | 'failure' | 'interrupted' | 'not-started' | 'outcome-unknown' | 'contract-violation';
|
|
12
|
+
/** Correlation carried on every turn: the runner-level ids plus the caller's per-request identity. */
|
|
13
|
+
export interface TurnCorrelation {
|
|
14
|
+
readonly runId: string;
|
|
15
|
+
readonly executionId: string;
|
|
16
|
+
readonly requestId: string;
|
|
17
|
+
readonly attempt: number;
|
|
18
|
+
}
|
|
19
|
+
/** Durable session placement; digested into `policyDigest` for consumer-side reuse checks. */
|
|
20
|
+
export interface TurnSessionPolicy {
|
|
21
|
+
workspace: string;
|
|
22
|
+
role: string;
|
|
23
|
+
model?: string;
|
|
24
|
+
provider?: string;
|
|
25
|
+
reasoning?: string;
|
|
26
|
+
tools?: readonly string[];
|
|
27
|
+
permissions?: string;
|
|
28
|
+
}
|
|
29
|
+
/** One resolved turn. `nativeSessionId`/`nativeTurnId` are present only when the driver observed them. */
|
|
30
|
+
export interface TurnOutcome {
|
|
31
|
+
kind: TurnOutcomeKind;
|
|
32
|
+
turnId: string;
|
|
33
|
+
correlation: TurnCorrelation;
|
|
34
|
+
nativeSessionId?: string;
|
|
35
|
+
nativeTurnId?: string;
|
|
36
|
+
reason?: string;
|
|
37
|
+
finalText?: string;
|
|
38
|
+
startedAt: string;
|
|
39
|
+
acceptedAt?: string;
|
|
40
|
+
firstOutputAt?: string;
|
|
41
|
+
terminalAt: string;
|
|
42
|
+
}
|
|
43
|
+
/** Turn progress events surfaced live on a handle; `terminal` is the last event. */
|
|
44
|
+
export type TurnEvent = {
|
|
45
|
+
type: 'accepted';
|
|
46
|
+
turnId: string;
|
|
47
|
+
at: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'output';
|
|
50
|
+
turnId: string;
|
|
51
|
+
at: string;
|
|
52
|
+
data?: unknown;
|
|
53
|
+
} | {
|
|
54
|
+
type: 'diagnostic';
|
|
55
|
+
turnId: string;
|
|
56
|
+
at: string;
|
|
57
|
+
data?: unknown;
|
|
58
|
+
} | {
|
|
59
|
+
type: 'terminal';
|
|
60
|
+
turnId: string;
|
|
61
|
+
at: string;
|
|
62
|
+
outcome: TurnOutcome;
|
|
63
|
+
};
|
|
64
|
+
/** One started turn: acceptance and outcome are SEPARATE promises (acceptance ≠ completion). */
|
|
65
|
+
export interface TurnHandle {
|
|
66
|
+
readonly turnId: string;
|
|
67
|
+
/** Resolves once the agent accepted the turn; `null` when the process died before acceptance. */
|
|
68
|
+
readonly accepted: Promise<{
|
|
69
|
+
acceptedAt: string;
|
|
70
|
+
} | null>;
|
|
71
|
+
/** Resolves exactly once to the terminal outcome. */
|
|
72
|
+
readonly outcome: Promise<TurnOutcome>;
|
|
73
|
+
/** Live event stream; completes when the outcome resolves. */
|
|
74
|
+
readonly events: AsyncIterable<TurnEvent>;
|
|
75
|
+
/** Request cancellation; resolves with the final outcome (deterministic, bounded by the grace). */
|
|
76
|
+
cancel(reason: string, options?: {
|
|
77
|
+
graceMs?: number;
|
|
78
|
+
}): Promise<TurnOutcome>;
|
|
79
|
+
}
|
|
80
|
+
/** An open session over one agent process. Admits ONE active turn; busy is an error, not a queue. */
|
|
81
|
+
export interface TurnSession {
|
|
82
|
+
readonly agent: AgentName;
|
|
83
|
+
/** sha256 of the canonical-JSON policy (stable key order) — consumers compare digests for reuse. */
|
|
84
|
+
readonly policyDigest: string;
|
|
85
|
+
readonly nativeSessionId?: string;
|
|
86
|
+
readonly state: 'ready' | 'busy' | 'closed';
|
|
87
|
+
startTurn(input: {
|
|
88
|
+
prompt: string;
|
|
89
|
+
correlation: TurnCorrelation;
|
|
90
|
+
timeoutMs?: number;
|
|
91
|
+
signal?: AbortSignal;
|
|
92
|
+
}): TurnHandle;
|
|
93
|
+
close(): Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
/** Resolved agent binary identity a driver qualifies and spawns. */
|
|
96
|
+
export interface TurnBinary {
|
|
97
|
+
path: string;
|
|
98
|
+
/** `null` when the version could not be probed — drivers decide whether that qualifies. */
|
|
99
|
+
version: string | null;
|
|
100
|
+
}
|
|
101
|
+
/** A wire-level terminal extracted from one decoded line. */
|
|
102
|
+
export interface TurnWireTerminal {
|
|
103
|
+
kind: 'success' | 'failure';
|
|
104
|
+
nativeTurnId?: string;
|
|
105
|
+
nativeSessionId?: string;
|
|
106
|
+
finalText?: string;
|
|
107
|
+
reason?: string;
|
|
108
|
+
}
|
|
109
|
+
/** One decoded protocol frame routed by `turnId` (`null` = foreign/unattributable → diagnostic). */
|
|
110
|
+
export interface TurnWireEvent {
|
|
111
|
+
turnId: string | null;
|
|
112
|
+
type: 'accepted' | 'output' | 'diagnostic' | 'terminal';
|
|
113
|
+
data?: unknown;
|
|
114
|
+
terminal?: TurnWireTerminal;
|
|
115
|
+
}
|
|
116
|
+
/** Thrown by `TurnSessionDriver.decode` on a malformed frame — settles the turn `contract-violation`. */
|
|
117
|
+
export declare class TurnProtocolError extends Error {
|
|
118
|
+
constructor(message: string);
|
|
119
|
+
}
|
|
120
|
+
/** Handshake result: the native session id when the agent reported one during startup. */
|
|
121
|
+
export type TurnHandshake = {
|
|
122
|
+
nativeSessionId?: string;
|
|
123
|
+
} | null;
|
|
124
|
+
/**
|
|
125
|
+
* Per-agent driver behind the session facade. Real drivers are registered only with recorded
|
|
126
|
+
* `verifiedAgainst` qualification evidence (anti-pattern: registration without evidence).
|
|
127
|
+
*/
|
|
128
|
+
export interface TurnSessionDriver {
|
|
129
|
+
readonly agent: AgentName;
|
|
130
|
+
qualify(binary: TurnBinary): {
|
|
131
|
+
qualified: true;
|
|
132
|
+
} | {
|
|
133
|
+
qualified: false;
|
|
134
|
+
reason: string;
|
|
135
|
+
};
|
|
136
|
+
spawnArgv(binary: TurnBinary, policy: TurnSessionPolicy): {
|
|
137
|
+
command: string;
|
|
138
|
+
args: string[];
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Consume startup lines until the agent is ready; reject/throw on a bad handshake. Absent =
|
|
142
|
+
* no handshake. Pull via `pull(timeoutMs)` — NOT `for await` over a stream — because an
|
|
143
|
+
* early `return`/`break` in a for-await CLOSES the shared iterator the session pump needs.
|
|
144
|
+
*/
|
|
145
|
+
handshake?(pull: (timeoutMs: number) => Promise<string | null>): Promise<TurnHandshake>;
|
|
146
|
+
encodeTurn(input: {
|
|
147
|
+
turnId: string;
|
|
148
|
+
prompt: string;
|
|
149
|
+
correlation: TurnCorrelation;
|
|
150
|
+
}): string;
|
|
151
|
+
/** Decode one stdout line into zero or more frames; throws {@link TurnProtocolError} on malformed input. */
|
|
152
|
+
decode(line: string): TurnWireEvent[];
|
|
153
|
+
encodeCancel(reason: string): string;
|
|
154
|
+
}
|
|
155
|
+
/** Outcome of {@link AiRunner.openTurnSession}: an open session or a typed failure reason. */
|
|
156
|
+
export type OpenTurnSessionResult = {
|
|
157
|
+
ok: true;
|
|
158
|
+
session: TurnSession;
|
|
159
|
+
} | {
|
|
160
|
+
ok: false;
|
|
161
|
+
reason: 'unsupported-agent' | 'unqualified-version' | 'spawn-failed' | 'handshake-failed';
|
|
162
|
+
detail: string;
|
|
163
|
+
};
|
|
164
|
+
/** Built-in driver registry. Empty in 0.x by design — real drivers land with qualification evidence. */
|
|
165
|
+
export declare const TURN_SESSION_DRIVERS: ReadonlyMap<AgentName, TurnSessionDriver>;
|
|
166
|
+
/** How long `cancel()` waits for native terminal evidence before resolving `outcome-unknown`. */
|
|
167
|
+
export declare const TURN_CANCEL_GRACE_MS = 5000;
|
|
168
|
+
/** Handshake bound for `openTurnSession`. */
|
|
169
|
+
export declare const TURN_HANDSHAKE_TIMEOUT_MS = 10000;
|
|
170
|
+
/** Max buffered stdout line; overflow is a protocol contract violation. */
|
|
171
|
+
export declare const TURN_MAX_LINE_BYTES: number;
|
|
172
|
+
/** `startTurn` while another turn is active — no hidden queue, by design. */
|
|
173
|
+
export declare class TurnSessionBusyError extends Error {
|
|
174
|
+
constructor(turnId: string);
|
|
175
|
+
}
|
|
176
|
+
/** `startTurn` on a closed session. */
|
|
177
|
+
export declare class TurnSessionClosedError extends Error {
|
|
178
|
+
constructor();
|
|
179
|
+
}
|
|
180
|
+
/** sha256 over the canonical JSON (recursively sorted keys) of the policy — stable digest contract. */
|
|
181
|
+
export declare function turnSessionPolicyDigest(policy: TurnSessionPolicy): string;
|
|
182
|
+
/**
|
|
183
|
+
* Line-buffered stdout reader with the bounded-buffer invariant (overflow invokes `onOverflow`
|
|
184
|
+
* and ends the iteration). The single reader of the process stdout stream — both the handshake
|
|
185
|
+
* and the session pump pull from the SAME generator.
|
|
186
|
+
*/
|
|
187
|
+
export declare function readLines(stream: ReadableStream<Uint8Array>): AsyncGenerator<string>;
|
|
188
|
+
/**
|
|
189
|
+
* Open a turn session: driver lookup → qualification → spawn → handshake → session. Expected
|
|
190
|
+
* refusals are typed values, never throws (R1). `resolveBinary`/`resolveDriver` are seams:
|
|
191
|
+
* `AiRunner.openTurnSession` binds them to its agent resolution; tests bind the fake driver.
|
|
192
|
+
*/
|
|
193
|
+
export declare function openTurnSessionWithDriver(options: {
|
|
194
|
+
agent: AgentName;
|
|
195
|
+
driver: TurnSessionDriver | undefined;
|
|
196
|
+
policy: TurnSessionPolicy;
|
|
197
|
+
binary: TurnBinary;
|
|
198
|
+
processExecutor: ProcessExecutor;
|
|
199
|
+
handshakeTimeoutMs?: number;
|
|
200
|
+
}): Promise<OpenTurnSessionResult>;
|
|
201
|
+
//# sourceMappingURL=turn-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-session.d.ts","sourceRoot":"","sources":["../src/turn-session.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;GAMG;AAEH,0GAA0G;AAC1G,MAAM,MAAM,eAAe,GACrB,SAAS,GACT,SAAS,GACT,aAAa,GACb,aAAa,GACb,iBAAiB,GACjB,oBAAoB,CAAC;AAE3B,sGAAs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