ai4ai 0.0.3 → 0.0.5
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 -0
- package/README.zh-CN.md +6 -0
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/dist/adapters/claude/adapter.d.ts +10 -1
- package/claude-plugin/dist/adapters/claude/adapter.js +35 -10
- package/claude-plugin/dist/adapters/claude/journal.d.ts +8 -0
- package/claude-plugin/dist/adapters/claude/journal.js +4 -1
- package/claude-plugin/dist/adapters/claude/plugin.js +198 -91
- package/claude-plugin/dist/adapters/claude/worker.js +30 -8
- package/claude-plugin/dist/adapters/codex/adapter.d.ts +26 -19
- package/claude-plugin/dist/adapters/codex/adapter.js +283 -187
- package/claude-plugin/dist/adapters/codex/app-server.js +1 -1
- package/claude-plugin/dist/adapters/codex/control.d.ts +36 -1
- package/claude-plugin/dist/adapters/codex/control.js +74 -4
- package/claude-plugin/dist/adapters/codex/native-handoff.d.ts +60 -0
- package/claude-plugin/dist/adapters/codex/native-handoff.js +138 -0
- package/claude-plugin/dist/adapters/codex/runner.js +35 -32
- package/claude-plugin/dist/adapters/codex/tui-daemon-watch.js +60 -49
- package/claude-plugin/dist/adapters/declarations.d.ts +0 -1
- package/claude-plugin/dist/adapters/declarations.js +0 -1
- package/claude-plugin/dist/adapters/dsh/adapter.d.ts +39 -2
- package/claude-plugin/dist/adapters/dsh/adapter.js +164 -37
- package/claude-plugin/dist/adapters/dsh/plugin.d.ts +3 -1
- package/claude-plugin/dist/adapters/dsh/plugin.js +33 -22
- package/claude-plugin/dist/adapters/executors.d.ts +25 -2
- package/claude-plugin/dist/adapters/executors.js +58 -4
- package/claude-plugin/dist/adapters/external.d.ts +21 -0
- package/claude-plugin/dist/adapters/external.js +128 -18
- package/claude-plugin/dist/adapters/opencode/adapter.d.ts +13 -2
- package/claude-plugin/dist/adapters/opencode/adapter.js +53 -10
- package/claude-plugin/dist/adapters/opencode/journal.d.ts +2 -0
- package/claude-plugin/dist/adapters/opencode/journal.js +8 -3
- package/claude-plugin/dist/adapters/opencode/plugin.js +2 -2
- package/claude-plugin/dist/adapters/supervisor.js +64 -20
- package/claude-plugin/dist/adapters/types.d.ts +7 -0
- package/claude-plugin/dist/contract/schema.d.ts +8 -17
- package/claude-plugin/dist/contract/schema.js +3 -4
- package/claude-plugin/dist/contract/states.d.ts +11 -0
- package/claude-plugin/dist/contract/states.js +9 -0
- package/claude-plugin/dist/contract/types.d.ts +3 -3
- package/claude-plugin/dist/contract/validate.js +24 -14
- package/claude-plugin/dist/contract/version.d.ts +1 -1
- package/claude-plugin/dist/contract/version.js +1 -1
- package/claude-plugin/dist/core/dsh-selection.d.ts +43 -0
- package/claude-plugin/dist/core/dsh-selection.js +78 -0
- package/claude-plugin/dist/core/handoff.d.ts +42 -0
- package/claude-plugin/dist/core/handoff.js +63 -0
- package/claude-plugin/dist/core/index.d.ts +2 -0
- package/claude-plugin/dist/core/index.js +1 -0
- package/claude-plugin/dist/core/operations.js +33 -1
- package/claude-plugin/dist/core/session-probe.js +11 -22
- package/claude-plugin/dist/core/store.d.ts +8 -3
- package/claude-plugin/dist/core/store.js +17 -3
- package/claude-plugin/request-schema.json +1 -2
- package/dist/adapters/claude/adapter.d.ts +10 -1
- package/dist/adapters/claude/adapter.js +35 -10
- package/dist/adapters/claude/journal.d.ts +8 -0
- package/dist/adapters/claude/journal.js +4 -1
- package/dist/adapters/claude/plugin.js +198 -91
- package/dist/adapters/claude/worker.js +30 -8
- package/dist/adapters/codex/adapter.d.ts +26 -19
- package/dist/adapters/codex/adapter.js +283 -187
- package/dist/adapters/codex/app-server.js +1 -1
- package/dist/adapters/codex/control.d.ts +36 -1
- package/dist/adapters/codex/control.js +74 -4
- package/dist/adapters/codex/native-handoff.d.ts +60 -0
- package/dist/adapters/codex/native-handoff.js +138 -0
- package/dist/adapters/codex/runner.js +35 -32
- package/dist/adapters/codex/tui-daemon-watch.js +60 -49
- package/dist/adapters/declarations.d.ts +0 -1
- package/dist/adapters/declarations.js +0 -1
- package/dist/adapters/dsh/adapter.d.ts +39 -2
- package/dist/adapters/dsh/adapter.js +164 -37
- package/dist/adapters/dsh/plugin.d.ts +3 -1
- package/dist/adapters/dsh/plugin.js +33 -22
- package/dist/adapters/executors.d.ts +25 -2
- package/dist/adapters/executors.js +58 -4
- package/dist/adapters/external.d.ts +21 -0
- package/dist/adapters/external.js +128 -18
- package/dist/adapters/opencode/adapter.d.ts +13 -2
- package/dist/adapters/opencode/adapter.js +53 -10
- package/dist/adapters/opencode/journal.d.ts +2 -0
- package/dist/adapters/opencode/journal.js +8 -3
- package/dist/adapters/opencode/plugin.js +2 -2
- package/dist/adapters/supervisor.js +64 -20
- package/dist/adapters/types.d.ts +7 -0
- package/dist/contract/schema.d.ts +8 -17
- package/dist/contract/schema.js +3 -4
- package/dist/contract/states.d.ts +11 -0
- package/dist/contract/states.js +9 -0
- package/dist/contract/types.d.ts +3 -3
- package/dist/contract/validate.js +24 -14
- package/dist/contract/version.d.ts +1 -1
- package/dist/contract/version.js +1 -1
- package/dist/core/dsh-selection.d.ts +43 -0
- package/dist/core/dsh-selection.js +78 -0
- package/dist/core/handoff.d.ts +42 -0
- package/dist/core/handoff.js +63 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +1 -0
- package/dist/core/operations.js +33 -1
- package/dist/core/session-probe.js +11 -22
- package/dist/core/store.d.ts +8 -3
- package/dist/core/store.js +17 -3
- package/docs/contract.md +25 -15
- package/opencode-plugin/dist/adapters/claude/adapter.d.ts +10 -1
- package/opencode-plugin/dist/adapters/claude/adapter.js +35 -10
- package/opencode-plugin/dist/adapters/claude/journal.d.ts +8 -0
- package/opencode-plugin/dist/adapters/claude/journal.js +4 -1
- package/opencode-plugin/dist/adapters/claude/plugin.js +198 -91
- package/opencode-plugin/dist/adapters/claude/worker.js +30 -8
- package/opencode-plugin/dist/adapters/codex/adapter.d.ts +26 -19
- package/opencode-plugin/dist/adapters/codex/adapter.js +283 -187
- package/opencode-plugin/dist/adapters/codex/app-server.js +1 -1
- package/opencode-plugin/dist/adapters/codex/control.d.ts +36 -1
- package/opencode-plugin/dist/adapters/codex/control.js +74 -4
- package/opencode-plugin/dist/adapters/codex/native-handoff.d.ts +60 -0
- package/opencode-plugin/dist/adapters/codex/native-handoff.js +138 -0
- package/opencode-plugin/dist/adapters/codex/runner.js +35 -32
- package/opencode-plugin/dist/adapters/codex/tui-daemon-watch.js +60 -49
- package/opencode-plugin/dist/adapters/declarations.d.ts +0 -1
- package/opencode-plugin/dist/adapters/declarations.js +0 -1
- package/opencode-plugin/dist/adapters/dsh/adapter.d.ts +39 -2
- package/opencode-plugin/dist/adapters/dsh/adapter.js +164 -37
- package/opencode-plugin/dist/adapters/dsh/plugin.d.ts +3 -1
- package/opencode-plugin/dist/adapters/dsh/plugin.js +33 -22
- package/opencode-plugin/dist/adapters/executors.d.ts +25 -2
- package/opencode-plugin/dist/adapters/executors.js +58 -4
- package/opencode-plugin/dist/adapters/external.d.ts +21 -0
- package/opencode-plugin/dist/adapters/external.js +128 -18
- package/opencode-plugin/dist/adapters/opencode/adapter.d.ts +13 -2
- package/opencode-plugin/dist/adapters/opencode/adapter.js +53 -10
- package/opencode-plugin/dist/adapters/opencode/journal.d.ts +2 -0
- package/opencode-plugin/dist/adapters/opencode/journal.js +8 -3
- package/opencode-plugin/dist/adapters/opencode/plugin.js +2 -2
- package/opencode-plugin/dist/adapters/supervisor.js +64 -20
- package/opencode-plugin/dist/adapters/types.d.ts +7 -0
- package/opencode-plugin/dist/contract/schema.d.ts +8 -17
- package/opencode-plugin/dist/contract/schema.js +3 -4
- package/opencode-plugin/dist/contract/states.d.ts +11 -0
- package/opencode-plugin/dist/contract/states.js +9 -0
- package/opencode-plugin/dist/contract/types.d.ts +3 -3
- package/opencode-plugin/dist/contract/validate.js +24 -14
- package/opencode-plugin/dist/contract/version.d.ts +1 -1
- package/opencode-plugin/dist/contract/version.js +1 -1
- package/opencode-plugin/dist/core/dsh-selection.d.ts +43 -0
- package/opencode-plugin/dist/core/dsh-selection.js +78 -0
- package/opencode-plugin/dist/core/handoff.d.ts +42 -0
- package/opencode-plugin/dist/core/handoff.js +63 -0
- package/opencode-plugin/dist/core/index.d.ts +2 -0
- package/opencode-plugin/dist/core/index.js +1 -0
- package/opencode-plugin/dist/core/operations.js +33 -1
- package/opencode-plugin/dist/core/session-probe.js +11 -22
- package/opencode-plugin/dist/core/store.d.ts +8 -3
- package/opencode-plugin/dist/core/store.js +17 -3
- package/opencode-plugin/package.json +1 -1
- package/package.json +1 -1
- package/claude-plugin/dist/adapters/codex/tui-restart-watch.d.ts +0 -2
- package/claude-plugin/dist/adapters/codex/tui-restart-watch.js +0 -330
- package/claude-plugin/dist/tmux/backend.d.ts +0 -55
- package/claude-plugin/dist/tmux/backend.js +0 -161
- package/dist/adapters/codex/tui-restart-watch.d.ts +0 -2
- package/dist/adapters/codex/tui-restart-watch.js +0 -330
- package/dist/tmux/backend.d.ts +0 -55
- package/dist/tmux/backend.js +0 -161
- package/opencode-plugin/dist/adapters/codex/tui-restart-watch.d.ts +0 -2
- package/opencode-plugin/dist/adapters/codex/tui-restart-watch.js +0 -330
- package/opencode-plugin/dist/tmux/backend.d.ts +0 -55
- package/opencode-plugin/dist/tmux/backend.js +0 -161
|
@@ -2,7 +2,7 @@ import { mkdir, writeFile } from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { normalizePolicy } from '../core/policy.js';
|
|
4
4
|
import { newExecutorId, ownedBy } from '../core/operations.js';
|
|
5
|
-
import { enqueueTurn, executorDir, launch, lifecycleOfStatus, pidAlive, readLog, readStatus, requestStop, } from './executors.js';
|
|
5
|
+
import { enqueueTurn, executorDir, launch, lifecycleOfStatus, pidAlive, readLog, readStatus, requestStop, turnPlacement, } from './executors.js';
|
|
6
6
|
import { sessionActivity, sessionPointer } from '../core/session-probe.js';
|
|
7
7
|
/**
|
|
8
8
|
* Base for adapters whose spawn carrier is a detached OS process.
|
|
@@ -15,6 +15,15 @@ import { sessionActivity, sessionPointer } from '../core/session-probe.js';
|
|
|
15
15
|
export class ExternalExecutorAdapter {
|
|
16
16
|
/** Adapter-specific context/model/reasoning-effort extraction from the carrier output. */
|
|
17
17
|
statusDetails(_record, _status, _log, _ctx) { return {}; }
|
|
18
|
+
/**
|
|
19
|
+
* Model a resumed turn must keep: the explicit request override, or the
|
|
20
|
+
* effective value the carrier would use (environment/settings). Persisted at
|
|
21
|
+
* spawn time so a follow-up turn started by a supervisor whose caller lacked
|
|
22
|
+
* that environment still selects the same model.
|
|
23
|
+
*/
|
|
24
|
+
persistedModel(request, _ctx) { return request.model; }
|
|
25
|
+
/** Reasoning effort the resumed turn must keep (same rationale as persistedModel). */
|
|
26
|
+
persistedReasoningEffort(request, _ctx) { return request.reasoningEffort; }
|
|
18
27
|
async writeTask(ctx, executorId, name, text) {
|
|
19
28
|
const directory = executorDir(ctx.home, executorId);
|
|
20
29
|
await mkdir(directory, { recursive: true });
|
|
@@ -37,17 +46,24 @@ export class ExternalExecutorAdapter {
|
|
|
37
46
|
for (const executorId of ids) {
|
|
38
47
|
const carrier = await this.carrier(request, ctx, executorId);
|
|
39
48
|
const taskFile = await this.writeTask(ctx, executorId, 'spawn.prompt', request.task ?? '');
|
|
49
|
+
const model = await this.persistedModel(request, ctx);
|
|
50
|
+
const reasoningEffort = await this.persistedReasoningEffort(request, ctx);
|
|
40
51
|
const record = {
|
|
41
52
|
format: 2, kind: 'executor', executorId, parent: ctx.identity, harness: this.harness,
|
|
42
53
|
surface: 'headless', policy: normalizePolicy(request.policy), isolation: request.isolation ?? 'inherit',
|
|
43
54
|
state: 'running', createdAt: new Date().toISOString(),
|
|
55
|
+
...(model ? { model } : {}),
|
|
56
|
+
...(reasoningEffort ? { reasoningEffort } : {}),
|
|
44
57
|
carrier: { detached: true, command: [carrier.command, ...carrier.args] },
|
|
45
58
|
};
|
|
46
59
|
created.push(record);
|
|
47
60
|
await ctx.store.addExecutors([record]);
|
|
48
61
|
await launch({
|
|
49
62
|
executorId, harness: this.harness, home: ctx.home, command: carrier.command, args: carrier.args,
|
|
50
|
-
...(carrier.env ? { env: carrier.env } : {}), ...(carrier.envExclude ? { envExclude: carrier.envExclude } : {}),
|
|
63
|
+
...(carrier.env ? { env: carrier.env } : {}), ...(carrier.envExclude ? { envExclude: carrier.envExclude } : {}),
|
|
64
|
+
...(carrier.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}),
|
|
65
|
+
supervisorProtocol: 2,
|
|
66
|
+
cwd: ctx.identity.workspace, taskFile,
|
|
51
67
|
...(carrier.sessionRegex ? { sessionRegex: carrier.sessionRegex } : {}),
|
|
52
68
|
});
|
|
53
69
|
}
|
|
@@ -122,30 +138,124 @@ export class ExternalExecutorAdapter {
|
|
|
122
138
|
},
|
|
123
139
|
};
|
|
124
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Deliver a follow-up turn to an owned executor.
|
|
143
|
+
*
|
|
144
|
+
* Only a running executor with a live protocol-2 supervisor is served: the
|
|
145
|
+
* turn is queued for that supervisor and resumes the same native session.
|
|
146
|
+
* Idle/exited executors fail structurally instead of silently starting a new
|
|
147
|
+
* session (which would lose the previous context).
|
|
148
|
+
*/
|
|
125
149
|
async message(request, ctx) {
|
|
126
150
|
const record = await this.executorFor(request, ctx);
|
|
127
151
|
if (!record)
|
|
128
152
|
return { status: 'unauthorized', reason: 'Target is not owned by this caller' };
|
|
129
153
|
const observed = await this.observe(record, ctx);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
154
|
+
// Same lifecycle vocabulary as status/list (one raw status -> one state).
|
|
155
|
+
if (observed.state !== 'running') {
|
|
156
|
+
return {
|
|
157
|
+
status: 'failed',
|
|
158
|
+
reason: `Executor is ${observed.state}; a message is only queued for a running executor. Start a new executor instead.`,
|
|
159
|
+
durable: true,
|
|
160
|
+
state: observed.state,
|
|
161
|
+
error: { code: 'message-executor-not-running', message: `Executor state is ${observed.state}` },
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (!pidAlive(observed.status.supervisorPid)) {
|
|
165
|
+
return {
|
|
166
|
+
status: 'failed',
|
|
167
|
+
reason: 'The detached supervisor is not alive; start a new executor instead of messaging a stale record',
|
|
168
|
+
durable: true,
|
|
169
|
+
state: 'running',
|
|
170
|
+
error: { code: 'message-executor-not-running', message: 'Supervisor is not alive' },
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
if ((observed.status.protocol ?? 1) < 2) {
|
|
174
|
+
// v0.0.3 supervisors ignore per-turn command/args and would silently start
|
|
175
|
+
// a new session. Refuse instead of losing context.
|
|
176
|
+
return {
|
|
177
|
+
status: 'failed',
|
|
178
|
+
reason: 'This executor was started by an older supervisor that cannot resume its native session; start a new executor',
|
|
179
|
+
durable: true,
|
|
180
|
+
state: 'running',
|
|
181
|
+
error: { code: 'message-executor-protocol-too-old', message: `Supervisor protocol ${observed.status.protocol ?? 1} < 2` },
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
const sessionId = await this.awaitSessionId(ctx.home, record, observed.status);
|
|
185
|
+
if (!sessionId) {
|
|
186
|
+
return {
|
|
187
|
+
status: 'failed',
|
|
188
|
+
reason: 'The executor has not reported a native session id yet; the message was not queued (a session-less turn would lose context)',
|
|
189
|
+
durable: true,
|
|
190
|
+
state: 'running',
|
|
191
|
+
error: { code: 'message-session-unknown', message: 'No session id observed within the bounded wait' },
|
|
192
|
+
};
|
|
136
193
|
}
|
|
137
|
-
// Idle executor: continue its native session in a fresh detached turn. The
|
|
138
|
-
// carrier owns the resume flags so a platform never receives two
|
|
139
|
-
// conflicting session selectors (for example two `--session` values).
|
|
140
|
-
const sessionId = observed.status.sessionId;
|
|
141
194
|
const file = await this.writeTask(ctx, record.executorId, `message-${request.operationId}.prompt`, request.task ?? '');
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
...(
|
|
195
|
+
// The message schema forbids model/effort; merge the values recorded at
|
|
196
|
+
// spawn so the resumed turn keeps the original route.
|
|
197
|
+
const resume = {
|
|
198
|
+
...request,
|
|
199
|
+
...(record.model ? { model: record.model } : {}),
|
|
200
|
+
...(record.reasoningEffort ? { reasoningEffort: record.reasoningEffort } : {}),
|
|
201
|
+
};
|
|
202
|
+
let carrier;
|
|
203
|
+
try {
|
|
204
|
+
carrier = await this.carrier(resume, ctx, record.executorId, sessionId);
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
const code = error?.code;
|
|
208
|
+
return {
|
|
209
|
+
status: 'failed',
|
|
210
|
+
reason: `Could not build a resume command for the existing session; the executor was left untouched: ${error instanceof Error ? error.message : 'unknown error'}`,
|
|
211
|
+
durable: true,
|
|
212
|
+
state: 'running',
|
|
213
|
+
error: {
|
|
214
|
+
code: typeof code === 'string' ? code : 'message-resume-failed',
|
|
215
|
+
message: error instanceof Error ? error.message : 'unknown error',
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
const queued = await enqueueTurn(ctx.home, record.executorId, {
|
|
220
|
+
inputFile: path.basename(file),
|
|
221
|
+
command: carrier.command,
|
|
222
|
+
args: carrier.args,
|
|
223
|
+
...(carrier.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}),
|
|
147
224
|
});
|
|
148
|
-
|
|
225
|
+
// Recheck after publication: the supervisor may have exited in between.
|
|
226
|
+
// This is a best-effort narrowing of a file-based TOCTOU window, not a
|
|
227
|
+
// claim that none exists.
|
|
228
|
+
const after = await readStatus(ctx.home, record.executorId);
|
|
229
|
+
const placement = await turnPlacement(ctx.home, record.executorId, queued);
|
|
230
|
+
if (!pidAlive(after?.supervisorPid)) {
|
|
231
|
+
return {
|
|
232
|
+
status: 'failed',
|
|
233
|
+
reason: `The supervisor exited after the message was queued (${placement === 'pending' ? 'message file remains queued' : 'message was already claimed or consumed'})`,
|
|
234
|
+
durable: true,
|
|
235
|
+
state: 'running',
|
|
236
|
+
error: { code: 'message-supervisor-exited', message: `Supervisor exited; queue placement: ${placement}` },
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
return {
|
|
240
|
+
status: 'accepted',
|
|
241
|
+
reason: placement === 'pending'
|
|
242
|
+
? 'Message queued for the executor next turn in its existing native session'
|
|
243
|
+
: 'Message was already claimed by the executor for its next turn in its existing native session',
|
|
244
|
+
durable: true,
|
|
245
|
+
state: 'running',
|
|
246
|
+
sessionId,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/** Bounded wait for the carrier's session id; never guesses or reuses first-turn args. */
|
|
250
|
+
async awaitSessionId(home, record, status, timeoutMs = 2000) {
|
|
251
|
+
let sessionId = status.sessionId ?? record.sessionId;
|
|
252
|
+
const deadline = Date.now() + timeoutMs;
|
|
253
|
+
while (!sessionId && Date.now() < deadline) {
|
|
254
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
255
|
+
const raw = await readStatus(home, record.executorId);
|
|
256
|
+
sessionId = raw?.sessionId ?? sessionId;
|
|
257
|
+
}
|
|
258
|
+
return sessionId;
|
|
149
259
|
}
|
|
150
260
|
async cancel(request, ctx) {
|
|
151
261
|
const record = await this.executorFor(request, ctx);
|
|
@@ -1,12 +1,23 @@
|
|
|
1
|
-
import type { AdapterContext, CarrierCommand, StatusDetails } from '../external.js';
|
|
1
|
+
import type { AdapterContext, CarrierCommand, StatusDetails, NativeOutcome } from '../external.js';
|
|
2
2
|
import { ExternalExecutorAdapter } from '../external.js';
|
|
3
|
-
import type { CapabilityDeclaration } from '../../contract/types.js';
|
|
3
|
+
import type { CapabilityDeclaration, Request } from '../../contract/types.js';
|
|
4
4
|
import type { HarnessId, Os } from '../../contract/states.js';
|
|
5
5
|
import type { ExecutorRecord } from '../../core/store.js';
|
|
6
6
|
import type { LogLine, ExecutorStatus } from '../executors.js';
|
|
7
7
|
export declare class OpenCodeAdapter extends ExternalExecutorAdapter {
|
|
8
8
|
readonly harness: HarnessId;
|
|
9
9
|
capabilities(os: Os): CapabilityDeclaration[];
|
|
10
|
+
/**
|
|
11
|
+
* The carrier selects `request.model || AI4AI_OPENCODE_MODEL`; persist that
|
|
12
|
+
* effective value so a resumed turn keeps the same model even when the
|
|
13
|
+
* supervisor's environment differs from the spawning caller's.
|
|
14
|
+
*/
|
|
15
|
+
protected persistedModel(request: Request): string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* OpenCode's detached `run` has no reasoning-effort selector; the model is
|
|
18
|
+
* the only per-request override the carrier can apply.
|
|
19
|
+
*/
|
|
20
|
+
spawn(request: Request, ctx: AdapterContext): Promise<NativeOutcome>;
|
|
10
21
|
protected carrier(request: Parameters<ExternalExecutorAdapter['spawn']>[0], ctx: AdapterContext, _executorId: string, resumeSessionId?: string): Promise<CarrierCommand>;
|
|
11
22
|
protected statusDetails(_record: ExecutorRecord, status: ExecutorStatus, log: LogLine[], ctx: AdapterContext): Promise<StatusDetails>;
|
|
12
23
|
}
|
|
@@ -84,22 +84,65 @@ function isOpenCodeExecutable(executable) {
|
|
|
84
84
|
export class OpenCodeAdapter extends ExternalExecutorAdapter {
|
|
85
85
|
harness = 'opencode';
|
|
86
86
|
capabilities(os) {
|
|
87
|
+
// Linux and macOS were exercised in this release. macOS used the OpenCode
|
|
88
|
+
// 2.3.2 binary at ~/data/opencode-2.3.2, not the older 1.19.6 on PATH:
|
|
89
|
+
// handoff (pending→scheduled→applied→completed, same session) and the
|
|
90
|
+
// detached carrier (spawn/status/message×2/stop/error) both completed.
|
|
91
|
+
// The test used a free OpenCode Go model because the account's weekly
|
|
92
|
+
// quota was exhausted; the handoff mechanism is model-agnostic.
|
|
87
93
|
const verified = os === 'linux' || os === 'darwin';
|
|
88
94
|
const reason = os === 'linux'
|
|
89
95
|
? 'The native plugin replacement supplies a fresh window containing only the task material (restart) and was exercised on Linux with a real handoff (pending, scheduled, applied, completed) and a successor turn; the detached carrier and status mapping were also exercised.'
|
|
90
96
|
: os === 'darwin'
|
|
91
|
-
? '
|
|
97
|
+
? 'macOS was exercised with OpenCode 2.3.2 (not the older 1.19.6 on PATH): the native plugin handoff completed in the same session (pending→scheduled→applied→completed) with the old codeword absent from the replaced context, and the detached carrier completed spawn/status/message×2/stop/error. A free OpenCode Go model was used because the account weekly quota was exhausted; the mechanism is model-agnostic.'
|
|
92
98
|
: 'In-harness plugin implements a restart-equivalent in-session handoff; detached opencode run processes implement spawn. Native Windows is out of scope (WSL counts as Linux).';
|
|
93
99
|
const level = verified ? 'supported' : 'not-tested';
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
// The native plugin runs inside an interactive session and its API exposes
|
|
101
|
+
// no surface signal, so it declares `tui` only rather than fabricating a
|
|
102
|
+
// headless identity. A detached `opencode run` executor cannot replace its
|
|
103
|
+
// context in place (the shared external adapter refuses), so headless
|
|
104
|
+
// handoff is declared unsupported instead of over-claiming.
|
|
105
|
+
const common = {
|
|
106
|
+
spawn: { availability: level, maxConcurrent: 4 },
|
|
107
|
+
status: { availability: level, model: level, reasoningEffort: 'unsupported', context: verified ? 'limited' : 'not-tested', percentSource: 'derived' },
|
|
108
|
+
};
|
|
109
|
+
return [
|
|
110
|
+
declaration({
|
|
111
|
+
harness: 'opencode', os, interface: 'tui', reason,
|
|
112
|
+
handoff: { availability: level, modes: ['restart'] },
|
|
113
|
+
...common,
|
|
114
|
+
...(verified ? { evidence: `matrix:opencode/${os}/tui/2026-11-21` } : {}),
|
|
115
|
+
}),
|
|
116
|
+
declaration({
|
|
117
|
+
harness: 'opencode', os, interface: 'headless',
|
|
118
|
+
reason: 'A detached opencode run executor cannot replace its own context in place; spawn and status use the same carrier. Use the interactive TUI for handoff.',
|
|
119
|
+
handoff: { availability: 'unsupported', modes: [] },
|
|
120
|
+
...common,
|
|
121
|
+
...(verified ? { evidence: `matrix:opencode/${os}/headless/2026-11-21` } : {}),
|
|
122
|
+
}),
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The carrier selects `request.model || AI4AI_OPENCODE_MODEL`; persist that
|
|
127
|
+
* effective value so a resumed turn keeps the same model even when the
|
|
128
|
+
* supervisor's environment differs from the spawning caller's.
|
|
129
|
+
*/
|
|
130
|
+
persistedModel(request) {
|
|
131
|
+
return request.model || process.env.AI4AI_OPENCODE_MODEL || undefined;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* OpenCode's detached `run` has no reasoning-effort selector; the model is
|
|
135
|
+
* the only per-request override the carrier can apply.
|
|
136
|
+
*/
|
|
137
|
+
async spawn(request, ctx) {
|
|
138
|
+
if (request.reasoningEffort !== undefined) {
|
|
139
|
+
return {
|
|
140
|
+
status: 'unsupported',
|
|
141
|
+
reason: 'opencode detached runs have no reasoning-effort selector; omit reasoningEffort and configure the model instead',
|
|
142
|
+
unavailable: ['spawn.reasoningEffort'],
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return super.spawn(request, ctx);
|
|
103
146
|
}
|
|
104
147
|
async carrier(request, ctx, _executorId, resumeSessionId) {
|
|
105
148
|
// One session selector only: resume the existing session or create one.
|
|
@@ -14,6 +14,8 @@ export interface OpenCodeRecord {
|
|
|
14
14
|
reason: string;
|
|
15
15
|
/** The native handoff replaces the window without a summary model call. */
|
|
16
16
|
mechanism?: 'restart';
|
|
17
|
+
/** Explicit proof mechanism; absent on records written before 0.0.5. */
|
|
18
|
+
proofMechanism?: 'surface-replacement' | 'native-compaction' | 'new-session';
|
|
17
19
|
successor?: Identity;
|
|
18
20
|
}
|
|
19
21
|
export declare function openCodeResult(record: OpenCodeRecord, operation?: Request['operation']): Result;
|
|
@@ -13,7 +13,7 @@ export function openCodeResult(record, operation = 'handoff') {
|
|
|
13
13
|
state: lifecycle.state,
|
|
14
14
|
...(lifecycle.handoff ? { handoff: lifecycle.handoff } : {}),
|
|
15
15
|
...(record.phase === 'completed' && record.successor
|
|
16
|
-
? { proof: { source: record.source, successor: record.successor, mechanism: 'new-session', nativeEvidence: record.compactID } }
|
|
16
|
+
? { proof: { source: record.source, successor: record.successor, mechanism: record.proofMechanism ?? 'new-session', nativeEvidence: record.compactID } }
|
|
17
17
|
: {}),
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -82,7 +82,7 @@ export class OpenCodeJournal {
|
|
|
82
82
|
format: 2, operationId: request.operationId, fingerprint: fingerprint(request), request, source: identity,
|
|
83
83
|
compactID: `msg_ai4ai_compact_${token}`, deliveryID: `msg_ai4ai_task_${token}`,
|
|
84
84
|
sourceMessage: native?.messageID ?? '', sourceCall: native?.callID ?? '', phase: 'pending',
|
|
85
|
-
mechanism: 'restart',
|
|
85
|
+
mechanism: 'restart', proofMechanism: 'surface-replacement',
|
|
86
86
|
reason: 'Finish the source turn; the native replacement supplies a fresh window containing only the task material',
|
|
87
87
|
};
|
|
88
88
|
await commit(record);
|
|
@@ -94,9 +94,14 @@ export class OpenCodeJournal {
|
|
|
94
94
|
const prior = this.latest(records, operationId);
|
|
95
95
|
if (!prior || !from.includes(prior.phase))
|
|
96
96
|
throw new Error('Native operation changed; no replay or competing transition');
|
|
97
|
+
const successor = { ...prior.source, generation: prior.compactID };
|
|
98
|
+
// The replacement keeps the native session; a different session here
|
|
99
|
+
// would make the record a false success.
|
|
100
|
+
if (successor.session !== prior.source.session)
|
|
101
|
+
throw new Error('OpenCode handoff successor changed the native session id; no transition recorded');
|
|
97
102
|
const next = {
|
|
98
103
|
...prior, phase: to, reason,
|
|
99
|
-
...(to === 'applied' || to === 'completed' ? { successor
|
|
104
|
+
...(to === 'applied' || to === 'completed' ? { successor } : {}),
|
|
100
105
|
};
|
|
101
106
|
await commit(next);
|
|
102
107
|
return next;
|
|
@@ -10,7 +10,7 @@ import { REQUEST_SCHEMA } from '../../contract/schema.js';
|
|
|
10
10
|
import { TOOL_DESCRIPTION, TOOL_NAME, normalizeToolRequest } from '../../contract/tool.js';
|
|
11
11
|
import { Ai4aiStore } from '../../core/store.js';
|
|
12
12
|
import { activeRecord } from '../../core/journal.js';
|
|
13
|
-
import { execute } from '../../core/operations.js';
|
|
13
|
+
import { currentOs, execute } from '../../core/operations.js';
|
|
14
14
|
import { openCodeSessionUsage, sessionActivity, sessionPointer } from '../../core/session-probe.js';
|
|
15
15
|
import { probeOpenCodeConfig } from '../../core/config-probe.js';
|
|
16
16
|
import { firstVerified } from '../../core/ladder.js';
|
|
@@ -180,7 +180,7 @@ export default Plugin.define({
|
|
|
180
180
|
return { content: JSON.stringify(await external(request, caller)) };
|
|
181
181
|
}
|
|
182
182
|
if (request.operation === 'capabilities')
|
|
183
|
-
return { content: JSON.stringify(result(request, 'completed', 'OpenCode plugin declares the ai4ai session capabilities', { durable: false })) };
|
|
183
|
+
return { content: JSON.stringify(result(request, 'completed', 'OpenCode plugin declares the ai4ai session capabilities', { durable: false, capabilities: new OpenCodeAdapter().capabilities(currentOs()) })) };
|
|
184
184
|
if (request.operation === 'cancel' || request.operation === 'stop') {
|
|
185
185
|
const records = await journal.rows(caller);
|
|
186
186
|
const prior = [...records].reverse().find(record => !terminal(record));
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Reattachment is purely file-based, which is what makes the lifecycle detached.
|
|
9
9
|
*/
|
|
10
10
|
import { createWriteStream, readFileSync } from 'node:fs';
|
|
11
|
-
import { mkdir, readFile, rename, writeFile } from 'node:fs/promises';
|
|
11
|
+
import { mkdir, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises';
|
|
12
12
|
import path from 'node:path';
|
|
13
13
|
import { spawn } from 'node:child_process';
|
|
14
14
|
const index = process.argv.indexOf('--dir');
|
|
@@ -54,10 +54,11 @@ const touchActivity = (force = false) => {
|
|
|
54
54
|
void persist();
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
+
const spec = JSON.parse(await readFile(file('spec.json'), 'utf8'));
|
|
57
58
|
await mkdir(directory, { recursive: true });
|
|
58
|
-
|
|
59
|
+
const protocol = typeof spec.supervisorProtocol === 'number' && Number.isSafeInteger(spec.supervisorProtocol) ? spec.supervisorProtocol : 1;
|
|
60
|
+
let status = { state: 'starting', startedAt: new Date().toISOString(), turns: 0, supervisorPid: process.pid, protocol };
|
|
59
61
|
await atomic('status.json', status);
|
|
60
|
-
const spec = JSON.parse(await readFile(file('spec.json'), 'utf8'));
|
|
61
62
|
const log = createWriteStream(file('log.ndjson'), { flags: 'a' });
|
|
62
63
|
const record = (stream, text) => {
|
|
63
64
|
for (const line of String(text).split(/\r?\n/)) {
|
|
@@ -75,10 +76,26 @@ const observeSession = (line) => {
|
|
|
75
76
|
void persist();
|
|
76
77
|
}
|
|
77
78
|
};
|
|
78
|
-
|
|
79
|
+
/** Windows: end the whole tree so killing cmd.exe does not orphan node. */
|
|
80
|
+
function terminateTree(child) {
|
|
81
|
+
if (process.platform === 'win32' && child.pid) {
|
|
82
|
+
const killer = spawn('taskkill', ['/PID', String(child.pid), '/T', '/F'], { stdio: 'ignore', windowsHide: true });
|
|
83
|
+
killer.on('error', () => { try {
|
|
84
|
+
child.kill();
|
|
85
|
+
}
|
|
86
|
+
catch { /* already gone */ } });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
child.kill('SIGTERM');
|
|
91
|
+
}
|
|
92
|
+
catch { /* already gone */ }
|
|
93
|
+
}
|
|
94
|
+
function runTurn(command, args, inputFile, verbatim = false) {
|
|
79
95
|
return new Promise(resolve => {
|
|
80
96
|
const child = spawn(command, args, {
|
|
81
97
|
cwd: spec.cwd, env: { ...process.env, ...(spec.env ?? {}) }, stdio: ['pipe', 'pipe', 'pipe'], shell: false, windowsHide: true,
|
|
98
|
+
...(verbatim ? { windowsVerbatimArguments: true } : {}),
|
|
82
99
|
});
|
|
83
100
|
status = { ...status, state: 'running', ...(child.pid ? { pid: child.pid } : {}), turns: (status.turns ?? 0) + 1 };
|
|
84
101
|
void persist();
|
|
@@ -89,14 +106,8 @@ function runTurn(command, args, inputFile) {
|
|
|
89
106
|
stopping = true;
|
|
90
107
|
status = { ...status, state: 'stopping' };
|
|
91
108
|
void persist();
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
catch { /* already gone */ }
|
|
96
|
-
setTimeout(() => { try {
|
|
97
|
-
child.kill('SIGKILL');
|
|
98
|
-
}
|
|
99
|
-
catch { /* already gone */ } }, 10000).unref();
|
|
109
|
+
terminateTree(child);
|
|
110
|
+
setTimeout(() => terminateTree(child), 10000).unref();
|
|
100
111
|
}, 400);
|
|
101
112
|
timer.unref?.();
|
|
102
113
|
child.stdout.on('data', data => {
|
|
@@ -122,21 +133,51 @@ function runTurn(command, args, inputFile) {
|
|
|
122
133
|
child.stdin.end();
|
|
123
134
|
});
|
|
124
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Claim the oldest queued message with an atomic rename.
|
|
138
|
+
*
|
|
139
|
+
* Enqueue writes one O_EXCL file per message, so no read-modify-write is
|
|
140
|
+
* shared. `rename` is the claim: exactly one consumer can move a given name,
|
|
141
|
+
* and a claimed file is left in `inbox/claimed` until it has been read.
|
|
142
|
+
*/
|
|
125
143
|
async function nextQueuedTurn() {
|
|
144
|
+
const inbox = file('inbox');
|
|
145
|
+
const claimed = path.join(inbox, 'claimed');
|
|
146
|
+
let entries;
|
|
126
147
|
try {
|
|
127
|
-
|
|
128
|
-
if (!lines.length)
|
|
129
|
-
return undefined;
|
|
130
|
-
const next = JSON.parse(lines[0]);
|
|
131
|
-
await writeFile(file('inbox.jsonl'), lines.slice(1).join('\n') + (lines.length > 1 ? '\n' : ''));
|
|
132
|
-
return next;
|
|
148
|
+
entries = await readdir(inbox, { withFileTypes: true });
|
|
133
149
|
}
|
|
134
150
|
catch {
|
|
135
151
|
return undefined;
|
|
136
152
|
}
|
|
153
|
+
const names = entries.filter(entry => entry.isFile() && entry.name.endsWith('.json')).map(entry => entry.name).sort();
|
|
154
|
+
for (const name of names) {
|
|
155
|
+
const source = path.join(inbox, name);
|
|
156
|
+
const target = path.join(claimed, name);
|
|
157
|
+
try {
|
|
158
|
+
await mkdir(claimed, { recursive: true });
|
|
159
|
+
await rename(source, target);
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
try {
|
|
165
|
+
const value = JSON.parse(await readFile(target, 'utf8'));
|
|
166
|
+
await rm(target, { force: true });
|
|
167
|
+
return value;
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return undefined;
|
|
137
174
|
}
|
|
138
175
|
let exitCode = 0;
|
|
139
|
-
let turn = {
|
|
176
|
+
let turn = {
|
|
177
|
+
...(spec.inputFile ? { inputFile: spec.inputFile } : {}),
|
|
178
|
+
extraArgs: [],
|
|
179
|
+
...(spec.windowsVerbatimArguments ? { windowsVerbatimArguments: true } : {}),
|
|
180
|
+
};
|
|
140
181
|
for (;;) {
|
|
141
182
|
if (stopRequested()) {
|
|
142
183
|
// A stop before the next turn starts: there is no child to reap, so the
|
|
@@ -144,7 +185,10 @@ for (;;) {
|
|
|
144
185
|
status = { ...status, state: 'stopped', exitCode: null, signal: null, endedAt: new Date().toISOString() };
|
|
145
186
|
break;
|
|
146
187
|
}
|
|
147
|
-
const
|
|
188
|
+
const command = turn.command ?? spec.command;
|
|
189
|
+
const args = [...(turn.args ?? spec.args ?? []), ...(turn.args ? [] : turn.extraArgs ?? [])];
|
|
190
|
+
const verbatim = turn.windowsVerbatimArguments ?? spec.windowsVerbatimArguments === true;
|
|
191
|
+
const result = await runTurn(command, args, turn.inputFile, verbatim);
|
|
148
192
|
if (result.stopping) {
|
|
149
193
|
// The supervisor killed the child on request; record how it terminated so
|
|
150
194
|
// status can report a real signal/exit code instead of a bare `stopped`.
|
package/dist/adapters/types.d.ts
CHANGED
|
@@ -47,6 +47,13 @@ export interface Adapter {
|
|
|
47
47
|
/** Declarations for every surface the adapter targets on this OS. */
|
|
48
48
|
capabilities(os: Os): CapabilityDeclaration[];
|
|
49
49
|
handoff(request: Request, ctx: AdapterContext): Promise<NativeOutcome>;
|
|
50
|
+
/**
|
|
51
|
+
* Re-query a pending handoff the adapter or its detached watcher owns.
|
|
52
|
+
* Returning `undefined` means "no newer observation"; a terminal outcome is
|
|
53
|
+
* written back in place so the same operationId eventually completes instead
|
|
54
|
+
* of returning a stale pending result forever.
|
|
55
|
+
*/
|
|
56
|
+
reconcileHandoff?(request: Request, ctx: AdapterContext): Promise<NativeOutcome | undefined>;
|
|
50
57
|
spawn(request: Request, ctx: AdapterContext): Promise<NativeOutcome>;
|
|
51
58
|
status(request: Request, ctx: AdapterContext): Promise<NativeOutcome>;
|
|
52
59
|
message(request: Request, ctx: AdapterContext): Promise<NativeOutcome>;
|
|
@@ -11,7 +11,7 @@ export declare const REQUEST_SCHEMA: {
|
|
|
11
11
|
readonly maxItems: 32;
|
|
12
12
|
readonly uniqueItems: true;
|
|
13
13
|
readonly items: {
|
|
14
|
-
readonly enum: readonly ["handoff", "spawn", "status", "message", "cancel", "stop", "list", "surface-preserve", "surface-cross", "spawn-isolation", "spawn-policy", "model-override", "reasoning-effort-override"
|
|
14
|
+
readonly enum: readonly ["handoff", "spawn", "status", "message", "cancel", "stop", "list", "surface-preserve", "surface-cross", "spawn-isolation", "spawn-policy", "model-override", "reasoning-effort-override"];
|
|
15
15
|
};
|
|
16
16
|
readonly description: "Feature names this caller requires; the request fails when the harness does not declare them.";
|
|
17
17
|
};
|
|
@@ -668,7 +668,7 @@ export declare const RESULT_SCHEMA: {
|
|
|
668
668
|
readonly required: readonly ["harness", "workspace", "surface", "session", "generation", "agent"];
|
|
669
669
|
};
|
|
670
670
|
readonly mechanism: {
|
|
671
|
-
readonly enum: readonly ["
|
|
671
|
+
readonly enum: readonly ["surface-replacement", "native-compaction", "new-session"];
|
|
672
672
|
};
|
|
673
673
|
readonly nativeEvidence: {
|
|
674
674
|
readonly type: "string";
|
|
@@ -722,11 +722,8 @@ export declare const RESULT_SCHEMA: {
|
|
|
722
722
|
readonly crossSurface: {
|
|
723
723
|
readonly enum: readonly ["supported", "limited", "unsupported", "not-tested"];
|
|
724
724
|
};
|
|
725
|
-
readonly tmuxFallback: {
|
|
726
|
-
readonly enum: readonly ["off", "experimental"];
|
|
727
|
-
};
|
|
728
725
|
};
|
|
729
|
-
readonly required: readonly ["availability", "modes", "modelOverride", "reasoningEffortOverride", "crossSurface"
|
|
726
|
+
readonly required: readonly ["availability", "modes", "modelOverride", "reasoningEffortOverride", "crossSurface"];
|
|
730
727
|
};
|
|
731
728
|
readonly spawn: {
|
|
732
729
|
readonly type: "object";
|
|
@@ -965,7 +962,7 @@ export declare const TOOL_INPUT_SCHEMA: {
|
|
|
965
962
|
readonly maxItems: 32;
|
|
966
963
|
readonly uniqueItems: true;
|
|
967
964
|
readonly items: {
|
|
968
|
-
readonly enum: readonly ["handoff", "spawn", "status", "message", "cancel", "stop", "list", "surface-preserve", "surface-cross", "spawn-isolation", "spawn-policy", "model-override", "reasoning-effort-override"
|
|
965
|
+
readonly enum: readonly ["handoff", "spawn", "status", "message", "cancel", "stop", "list", "surface-preserve", "surface-cross", "spawn-isolation", "spawn-policy", "model-override", "reasoning-effort-override"];
|
|
969
966
|
};
|
|
970
967
|
readonly description: "Feature names this caller requires; the request fails when the harness does not declare them.";
|
|
971
968
|
};
|
|
@@ -1072,7 +1069,7 @@ export declare const SCHEMAS: {
|
|
|
1072
1069
|
readonly maxItems: 32;
|
|
1073
1070
|
readonly uniqueItems: true;
|
|
1074
1071
|
readonly items: {
|
|
1075
|
-
readonly enum: readonly ["handoff", "spawn", "status", "message", "cancel", "stop", "list", "surface-preserve", "surface-cross", "spawn-isolation", "spawn-policy", "model-override", "reasoning-effort-override"
|
|
1072
|
+
readonly enum: readonly ["handoff", "spawn", "status", "message", "cancel", "stop", "list", "surface-preserve", "surface-cross", "spawn-isolation", "spawn-policy", "model-override", "reasoning-effort-override"];
|
|
1076
1073
|
};
|
|
1077
1074
|
readonly description: "Feature names this caller requires; the request fails when the harness does not declare them.";
|
|
1078
1075
|
};
|
|
@@ -1696,7 +1693,7 @@ export declare const SCHEMAS: {
|
|
|
1696
1693
|
readonly required: readonly ["harness", "workspace", "surface", "session", "generation", "agent"];
|
|
1697
1694
|
};
|
|
1698
1695
|
readonly mechanism: {
|
|
1699
|
-
readonly enum: readonly ["
|
|
1696
|
+
readonly enum: readonly ["surface-replacement", "native-compaction", "new-session"];
|
|
1700
1697
|
};
|
|
1701
1698
|
readonly nativeEvidence: {
|
|
1702
1699
|
readonly type: "string";
|
|
@@ -1750,11 +1747,8 @@ export declare const SCHEMAS: {
|
|
|
1750
1747
|
readonly crossSurface: {
|
|
1751
1748
|
readonly enum: readonly ["supported", "limited", "unsupported", "not-tested"];
|
|
1752
1749
|
};
|
|
1753
|
-
readonly tmuxFallback: {
|
|
1754
|
-
readonly enum: readonly ["off", "experimental"];
|
|
1755
|
-
};
|
|
1756
1750
|
};
|
|
1757
|
-
readonly required: readonly ["availability", "modes", "modelOverride", "reasoningEffortOverride", "crossSurface"
|
|
1751
|
+
readonly required: readonly ["availability", "modes", "modelOverride", "reasoningEffortOverride", "crossSurface"];
|
|
1758
1752
|
};
|
|
1759
1753
|
readonly spawn: {
|
|
1760
1754
|
readonly type: "object";
|
|
@@ -2054,11 +2048,8 @@ export declare const SCHEMAS: {
|
|
|
2054
2048
|
readonly crossSurface: {
|
|
2055
2049
|
readonly enum: readonly ["supported", "limited", "unsupported", "not-tested"];
|
|
2056
2050
|
};
|
|
2057
|
-
readonly tmuxFallback: {
|
|
2058
|
-
readonly enum: readonly ["off", "experimental"];
|
|
2059
|
-
};
|
|
2060
2051
|
};
|
|
2061
|
-
readonly required: readonly ["availability", "modes", "modelOverride", "reasoningEffortOverride", "crossSurface"
|
|
2052
|
+
readonly required: readonly ["availability", "modes", "modelOverride", "reasoningEffortOverride", "crossSurface"];
|
|
2062
2053
|
};
|
|
2063
2054
|
readonly spawn: {
|
|
2064
2055
|
readonly type: "object";
|
package/dist/contract/schema.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FEATURES } from './version.js';
|
|
2
|
-
import { AVAILABILITY, CONTEXT_VERIFICATION, HANDOFF_MODES, HANDOFF_PHASES, HARNESSES, ISOLATION, LIFECYCLE_STATES, AUTOCOMPACT_SOURCES, FIELD_STATE_KEYS, FIELD_STATE_VALUES, SOURCE_LABELS, MODEL_VERIFICATION, OPERATIONS, OSES, PERCENT_SOURCE, STATES, SURFACES, } from './states.js';
|
|
2
|
+
import { AVAILABILITY, CONTEXT_VERIFICATION, HANDOFF_MODES, HANDOFF_PHASES, HARNESSES, ISOLATION, LIFECYCLE_STATES, AUTOCOMPACT_SOURCES, FIELD_STATE_KEYS, FIELD_STATE_VALUES, LEGACY_PROOF_MECHANISM, PROOF_MECHANISMS, SOURCE_LABELS, MODEL_VERIFICATION, OPERATIONS, OSES, PERCENT_SOURCE, STATES, SURFACES, } from './states.js';
|
|
3
3
|
const id = { type: 'string', pattern: '^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$' };
|
|
4
4
|
const boundedText = { type: 'string', minLength: 1, maxLength: 16384 };
|
|
5
5
|
const shortText = { type: 'string', minLength: 1, maxLength: 4096 };
|
|
@@ -136,9 +136,8 @@ const capabilitySchema = {
|
|
|
136
136
|
modelOverride: { enum: [...AVAILABILITY] },
|
|
137
137
|
reasoningEffortOverride: { enum: [...AVAILABILITY] },
|
|
138
138
|
crossSurface: { enum: [...AVAILABILITY] },
|
|
139
|
-
tmuxFallback: { enum: ['off', 'experimental'] },
|
|
140
139
|
},
|
|
141
|
-
required: ['availability', 'modes', 'modelOverride', 'reasoningEffortOverride', 'crossSurface'
|
|
140
|
+
required: ['availability', 'modes', 'modelOverride', 'reasoningEffortOverride', 'crossSurface'],
|
|
142
141
|
},
|
|
143
142
|
spawn: {
|
|
144
143
|
type: 'object', additionalProperties: false,
|
|
@@ -235,7 +234,7 @@ export const RESULT_SCHEMA = {
|
|
|
235
234
|
properties: {
|
|
236
235
|
source: IDENTITY_SCHEMA,
|
|
237
236
|
successor: IDENTITY_SCHEMA,
|
|
238
|
-
mechanism: { enum: [
|
|
237
|
+
mechanism: { enum: [...PROOF_MECHANISMS, LEGACY_PROOF_MECHANISM] },
|
|
239
238
|
nativeEvidence: shortText,
|
|
240
239
|
},
|
|
241
240
|
required: ['source', 'successor', 'mechanism', 'nativeEvidence'],
|