cueline 0.3.0 → 0.3.2
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/CHANGELOG.md +47 -0
- package/README.ja.md +8 -11
- package/README.ko.md +8 -11
- package/README.md +8 -11
- package/README.zh-CN.md +8 -11
- package/README.zh-TW.md +8 -11
- package/dist/src/api-controller-handoff.d.ts +1 -1
- package/dist/src/api-controller-handoff.js +60 -7
- package/dist/src/api-controller-handoff.js.map +1 -1
- package/dist/src/browser/browser-adapter.d.ts +22 -0
- package/dist/src/browser/codex-iab/chatgpt-client.js +95 -0
- package/dist/src/browser/codex-iab/chatgpt-client.js.map +1 -1
- package/dist/src/core/controller-loop.js +68 -4
- package/dist/src/core/controller-loop.js.map +1 -1
- package/dist/src/core/run-status.d.ts +1 -1
- package/dist/src/core/run-status.js +55 -13
- package/dist/src/core/run-status.js.map +1 -1
- package/dist/src/core/state-machine.d.ts +1 -0
- package/dist/src/core/state-machine.js +6 -0
- package/dist/src/core/state-machine.js.map +1 -1
- package/dist/src/core/submitted-turn-recovery.d.ts +4 -0
- package/dist/src/core/submitted-turn-recovery.js +27 -0
- package/dist/src/core/submitted-turn-recovery.js.map +1 -0
- package/dist/src/diagnostics/run-doctor.js +9 -1
- package/dist/src/diagnostics/run-doctor.js.map +1 -1
- package/dist/src/jobs/status.js +11 -1
- package/dist/src/jobs/status.js.map +1 -1
- package/dist/src/mcp/server.d.ts +10 -0
- package/dist/src/mcp/server.js +520 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/docs/state-and-recovery.md +4 -1
- package/package.json +1 -1
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
import { createInterface } from "node:readline";
|
|
2
|
+
import { claimCueLineCallerJob, continueCueLineRun, diagnoseCueLineRun, listCueLineRuns, loadCueLineRunStatus, startCueLineCallerJob, startCueLineRun, } from "../api.js";
|
|
3
|
+
import { safeCueLineRunStatus } from "../cli/run-status-view.js";
|
|
4
|
+
import { CueLineError } from "../core/errors.js";
|
|
5
|
+
import { MAX_TIMER_DELAY_MS } from "../core/timing.js";
|
|
6
|
+
import { CUELINE_VERSION } from "../version.js";
|
|
7
|
+
export const CUELINE_MCP_PROTOCOL_VERSION = "2025-11-25";
|
|
8
|
+
const MAX_MESSAGE_BYTES = 1024 * 1024;
|
|
9
|
+
const JSON_RPC_VERSION = "2.0";
|
|
10
|
+
const stringProperty = (description) => ({
|
|
11
|
+
type: "string",
|
|
12
|
+
minLength: 1,
|
|
13
|
+
description,
|
|
14
|
+
});
|
|
15
|
+
const positiveIntegerProperty = (description, maximum) => ({
|
|
16
|
+
type: "integer",
|
|
17
|
+
minimum: 1,
|
|
18
|
+
...(maximum === undefined ? {} : { maximum }),
|
|
19
|
+
description,
|
|
20
|
+
});
|
|
21
|
+
const runtimeProperties = {
|
|
22
|
+
conversationUrl: stringProperty("Exact persisted ChatGPT conversation URL, when already known."),
|
|
23
|
+
browserOptions: {
|
|
24
|
+
type: "object",
|
|
25
|
+
properties: {
|
|
26
|
+
timeoutMs: positiveIntegerProperty("Browser turn timeout.", MAX_TIMER_DELAY_MS),
|
|
27
|
+
pollIntervalMs: positiveIntegerProperty("Browser observation polling interval.", MAX_TIMER_DELAY_MS),
|
|
28
|
+
stableMs: {
|
|
29
|
+
type: "integer",
|
|
30
|
+
minimum: 0,
|
|
31
|
+
maximum: MAX_TIMER_DELAY_MS,
|
|
32
|
+
description: "Required stable observation duration.",
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
description: "JSON-safe CodexIabAdapterOptions; the Browser binding remains host-injected.",
|
|
37
|
+
},
|
|
38
|
+
routingConfig: {
|
|
39
|
+
type: "object",
|
|
40
|
+
description: "Inline CueLine RoutingConfig validated by the existing API.",
|
|
41
|
+
},
|
|
42
|
+
routingConfigPath: stringProperty("Path to a CueLine routing configuration file."),
|
|
43
|
+
home: stringProperty("CueLine durable state home."),
|
|
44
|
+
cwd: stringProperty("Workspace used by the existing CueLine runtime."),
|
|
45
|
+
defaultTimeoutMs: positiveIntegerProperty("Default timeout for one process job.", MAX_TIMER_DELAY_MS),
|
|
46
|
+
maxRounds: positiveIntegerProperty("Durable total controller round limit."),
|
|
47
|
+
maxJobEvidenceChars: positiveIntegerProperty("Per-job controller evidence character limit."),
|
|
48
|
+
maxRepairAttempts: {
|
|
49
|
+
type: "integer",
|
|
50
|
+
minimum: 0,
|
|
51
|
+
description: "Maximum bounded controller-envelope repair attempts.",
|
|
52
|
+
},
|
|
53
|
+
cancellationPollIntervalMs: positiveIntegerProperty("Cancellation polling interval.", MAX_TIMER_DELAY_MS),
|
|
54
|
+
runTimeoutMs: positiveIntegerProperty("Timeout for this run advancement call.", MAX_TIMER_DELAY_MS),
|
|
55
|
+
executor: {
|
|
56
|
+
type: "string",
|
|
57
|
+
enum: ["caller", "process"],
|
|
58
|
+
description: "Execution mode. Caller remains the default.",
|
|
59
|
+
},
|
|
60
|
+
allowProcessExecution: {
|
|
61
|
+
type: "boolean",
|
|
62
|
+
description: "Must be true in this call whenever executor is process.",
|
|
63
|
+
},
|
|
64
|
+
maxConcurrency: positiveIntegerProperty("Maximum process advice concurrency."),
|
|
65
|
+
laneConcurrency: {
|
|
66
|
+
type: "object",
|
|
67
|
+
additionalProperties: positiveIntegerProperty("Per-lane concurrency limit."),
|
|
68
|
+
description: "Per-lane process advice concurrency limits.",
|
|
69
|
+
},
|
|
70
|
+
archiveControllerConversationOnComplete: {
|
|
71
|
+
type: "boolean",
|
|
72
|
+
description: "Durable opt-in controller conversation archive policy.",
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
const runIdProperty = stringProperty("Exact durable CueLine run ID.");
|
|
76
|
+
const jobIdProperty = stringProperty("Exact durable CueLine job ID.");
|
|
77
|
+
const callerIdProperty = {
|
|
78
|
+
type: "string",
|
|
79
|
+
minLength: 1,
|
|
80
|
+
maxLength: 256,
|
|
81
|
+
description: "Stable explicit identity for this MCP client's caller work.",
|
|
82
|
+
};
|
|
83
|
+
const TOOLS = [
|
|
84
|
+
{
|
|
85
|
+
name: "cueline_start_run",
|
|
86
|
+
description: "Create a durable CueLine run without sending a browser turn. Process execution requires executor=process and allowProcessExecution=true in this call.",
|
|
87
|
+
inputSchema: {
|
|
88
|
+
type: "object",
|
|
89
|
+
properties: {
|
|
90
|
+
...runtimeProperties,
|
|
91
|
+
request: stringProperty("Exact user request for the controller."),
|
|
92
|
+
runId: runIdProperty,
|
|
93
|
+
},
|
|
94
|
+
required: ["request"],
|
|
95
|
+
additionalProperties: false,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "cueline_continue_run",
|
|
100
|
+
description: "Advance the same durable CueLine run through the existing API. Process runs require allowProcessExecution=true again in every continuation call.",
|
|
101
|
+
inputSchema: {
|
|
102
|
+
type: "object",
|
|
103
|
+
properties: {
|
|
104
|
+
...runtimeProperties,
|
|
105
|
+
runId: runIdProperty,
|
|
106
|
+
reconcileRequestId: stringProperty("Exact pending controller request ID to reconcile."),
|
|
107
|
+
abandonOtherPendingTurns: {
|
|
108
|
+
type: "boolean",
|
|
109
|
+
description: "Explicitly abandon other legacy pending turns during exact reconciliation.",
|
|
110
|
+
},
|
|
111
|
+
manualSendConfirmed: {
|
|
112
|
+
type: "boolean",
|
|
113
|
+
description: "Confirm the exact manually submitted controller turn.",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
required: ["runId"],
|
|
117
|
+
additionalProperties: false,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "cueline_run_status",
|
|
122
|
+
description: "Return the metadata-only run status allowlist; never returns prompts, task bodies, caller identities, workdirs, or worker output.",
|
|
123
|
+
inputSchema: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: { runId: runIdProperty, home: runtimeProperties.home },
|
|
126
|
+
required: ["runId"],
|
|
127
|
+
additionalProperties: false,
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "cueline_run_doctor",
|
|
132
|
+
description: "Diagnose one durable run with stable finding codes, bounded evidence, and one safe next action.",
|
|
133
|
+
inputSchema: {
|
|
134
|
+
type: "object",
|
|
135
|
+
properties: { runId: runIdProperty, home: runtimeProperties.home },
|
|
136
|
+
required: ["runId"],
|
|
137
|
+
additionalProperties: false,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "cueline_claim_caller_job",
|
|
142
|
+
description: "Atomically claim one caller work job. Reuse the same explicit callerId for this MCP client; initialize clientInfo is descriptive, not identity proof.",
|
|
143
|
+
inputSchema: {
|
|
144
|
+
type: "object",
|
|
145
|
+
properties: {
|
|
146
|
+
runId: runIdProperty,
|
|
147
|
+
jobId: jobIdProperty,
|
|
148
|
+
callerId: callerIdProperty,
|
|
149
|
+
ttlMs: {
|
|
150
|
+
type: "integer",
|
|
151
|
+
minimum: 1_000,
|
|
152
|
+
maximum: 86_400_000,
|
|
153
|
+
description: "Caller work claim lifetime.",
|
|
154
|
+
},
|
|
155
|
+
home: runtimeProperties.home,
|
|
156
|
+
},
|
|
157
|
+
required: ["runId", "jobId", "callerId"],
|
|
158
|
+
additionalProperties: false,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "cueline_start_caller_job",
|
|
163
|
+
description: "Durably start exactly one claimed caller work job with the claim ID, caller ID, and fencing token returned by claim.",
|
|
164
|
+
inputSchema: {
|
|
165
|
+
type: "object",
|
|
166
|
+
properties: {
|
|
167
|
+
runId: runIdProperty,
|
|
168
|
+
jobId: jobIdProperty,
|
|
169
|
+
claimId: stringProperty("Exact claim ID returned by cueline_claim_caller_job."),
|
|
170
|
+
callerId: callerIdProperty,
|
|
171
|
+
fencingToken: positiveIntegerProperty("Exact fencing token returned by the claim."),
|
|
172
|
+
home: runtimeProperties.home,
|
|
173
|
+
},
|
|
174
|
+
required: ["runId", "jobId", "claimId", "callerId", "fencingToken"],
|
|
175
|
+
additionalProperties: false,
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: "cueline_list_runs",
|
|
180
|
+
description: "List sanitized persisted run summaries without controller text, conversation URLs, job tasks, or worker output.",
|
|
181
|
+
inputSchema: {
|
|
182
|
+
type: "object",
|
|
183
|
+
properties: { home: runtimeProperties.home },
|
|
184
|
+
additionalProperties: false,
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
function isObject(value) {
|
|
189
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
190
|
+
}
|
|
191
|
+
function requestId(value) {
|
|
192
|
+
if (typeof value === "string")
|
|
193
|
+
return value;
|
|
194
|
+
return typeof value === "number" && Number.isSafeInteger(value) ? value : null;
|
|
195
|
+
}
|
|
196
|
+
function errorResponse(id, code, message) {
|
|
197
|
+
return { jsonrpc: JSON_RPC_VERSION, id, error: { code, message } };
|
|
198
|
+
}
|
|
199
|
+
function resultResponse(id, result) {
|
|
200
|
+
return { jsonrpc: JSON_RPC_VERSION, id, result };
|
|
201
|
+
}
|
|
202
|
+
function validateSchema(value, schema, path = "arguments") {
|
|
203
|
+
if (schema.enum !== undefined && !schema.enum.some((candidate) => Object.is(candidate, value))) {
|
|
204
|
+
return [`${path} must be one of ${schema.enum.map(String).join(", ")}`];
|
|
205
|
+
}
|
|
206
|
+
if (schema.type === "object") {
|
|
207
|
+
if (!isObject(value))
|
|
208
|
+
return [`${path} must be an object`];
|
|
209
|
+
const errors = [];
|
|
210
|
+
for (const required of schema.required ?? []) {
|
|
211
|
+
if (!Object.hasOwn(value, required))
|
|
212
|
+
errors.push(`${path}.${required} is required`);
|
|
213
|
+
}
|
|
214
|
+
for (const [key, item] of Object.entries(value)) {
|
|
215
|
+
const property = schema.properties?.[key];
|
|
216
|
+
if (property !== undefined) {
|
|
217
|
+
errors.push(...validateSchema(item, property, `${path}.${key}`));
|
|
218
|
+
}
|
|
219
|
+
else if (schema.additionalProperties === false) {
|
|
220
|
+
errors.push(`${path}.${key} is not allowed`);
|
|
221
|
+
}
|
|
222
|
+
else if (isObject(schema.additionalProperties)) {
|
|
223
|
+
errors.push(...validateSchema(item, schema.additionalProperties, `${path}.${key}`));
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return errors;
|
|
227
|
+
}
|
|
228
|
+
if (schema.type === "array") {
|
|
229
|
+
if (!Array.isArray(value))
|
|
230
|
+
return [`${path} must be an array`];
|
|
231
|
+
return schema.items === undefined
|
|
232
|
+
? []
|
|
233
|
+
: value.flatMap((item, index) => validateSchema(item, schema.items, `${path}[${index}]`));
|
|
234
|
+
}
|
|
235
|
+
if (schema.type === "string") {
|
|
236
|
+
if (typeof value !== "string")
|
|
237
|
+
return [`${path} must be a string`];
|
|
238
|
+
if (schema.minLength !== undefined && value.length < schema.minLength) {
|
|
239
|
+
return [`${path} must contain at least ${schema.minLength} character(s)`];
|
|
240
|
+
}
|
|
241
|
+
if (schema.maxLength !== undefined && value.length > schema.maxLength) {
|
|
242
|
+
return [`${path} must contain at most ${schema.maxLength} character(s)`];
|
|
243
|
+
}
|
|
244
|
+
return [];
|
|
245
|
+
}
|
|
246
|
+
if (schema.type === "boolean") {
|
|
247
|
+
return typeof value === "boolean" ? [] : [`${path} must be a boolean`];
|
|
248
|
+
}
|
|
249
|
+
if (schema.type === "integer" || schema.type === "number") {
|
|
250
|
+
if (typeof value !== "number" ||
|
|
251
|
+
!Number.isFinite(value) ||
|
|
252
|
+
(schema.type === "integer" && !Number.isSafeInteger(value))) {
|
|
253
|
+
return [`${path} must be a finite ${schema.type}`];
|
|
254
|
+
}
|
|
255
|
+
if (schema.minimum !== undefined && value < schema.minimum) {
|
|
256
|
+
return [`${path} must be at least ${schema.minimum}`];
|
|
257
|
+
}
|
|
258
|
+
if (schema.maximum !== undefined && value > schema.maximum) {
|
|
259
|
+
return [`${path} must be at most ${schema.maximum}`];
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return [];
|
|
263
|
+
}
|
|
264
|
+
function runtimeOptions(args, options) {
|
|
265
|
+
const exposedKeys = Object.keys(runtimeProperties);
|
|
266
|
+
const values = {};
|
|
267
|
+
for (const key of exposedKeys) {
|
|
268
|
+
if (Object.hasOwn(args, key))
|
|
269
|
+
values[key] = args[key];
|
|
270
|
+
}
|
|
271
|
+
if (Object.hasOwn(values, "routingConfig")) {
|
|
272
|
+
values.routingConfig = values.routingConfig;
|
|
273
|
+
}
|
|
274
|
+
if (options.browser !== undefined)
|
|
275
|
+
values.browser = options.browser;
|
|
276
|
+
if (options.environment !== undefined)
|
|
277
|
+
values.environment = options.environment;
|
|
278
|
+
if (options.signal !== undefined)
|
|
279
|
+
values.signal = options.signal;
|
|
280
|
+
return values;
|
|
281
|
+
}
|
|
282
|
+
async function boundedRunResult(result, runtime) {
|
|
283
|
+
const run = safeCueLineRunStatus(await loadCueLineRunStatus(result.runId, runtime));
|
|
284
|
+
return {
|
|
285
|
+
runId: result.runId,
|
|
286
|
+
status: result.status,
|
|
287
|
+
...(result.finalDeliveryText === undefined
|
|
288
|
+
? {}
|
|
289
|
+
: { finalDeliveryText: result.finalDeliveryText }),
|
|
290
|
+
...(result.cancelledReason === undefined ? {} : { cancelledReason: result.cancelledReason }),
|
|
291
|
+
run,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
async function executeTool(name, args, options) {
|
|
295
|
+
const runtime = runtimeOptions(args, options);
|
|
296
|
+
switch (name) {
|
|
297
|
+
case "cueline_start_run": {
|
|
298
|
+
const result = await startCueLineRun({
|
|
299
|
+
...runtime,
|
|
300
|
+
request: args.request,
|
|
301
|
+
...(args.runId === undefined ? {} : { runId: args.runId }),
|
|
302
|
+
});
|
|
303
|
+
return boundedRunResult(result, runtime);
|
|
304
|
+
}
|
|
305
|
+
case "cueline_continue_run": {
|
|
306
|
+
const result = await continueCueLineRun({
|
|
307
|
+
...runtime,
|
|
308
|
+
runId: args.runId,
|
|
309
|
+
...(args.reconcileRequestId === undefined
|
|
310
|
+
? {}
|
|
311
|
+
: { reconcileRequestId: args.reconcileRequestId }),
|
|
312
|
+
...(args.abandonOtherPendingTurns === undefined
|
|
313
|
+
? {}
|
|
314
|
+
: { abandonOtherPendingTurns: args.abandonOtherPendingTurns }),
|
|
315
|
+
...(args.manualSendConfirmed === undefined
|
|
316
|
+
? {}
|
|
317
|
+
: { manualSendConfirmed: args.manualSendConfirmed }),
|
|
318
|
+
});
|
|
319
|
+
return boundedRunResult(result, runtime);
|
|
320
|
+
}
|
|
321
|
+
case "cueline_run_status":
|
|
322
|
+
return safeCueLineRunStatus(await loadCueLineRunStatus(args.runId, runtime));
|
|
323
|
+
case "cueline_run_doctor":
|
|
324
|
+
return { ...(await diagnoseCueLineRun(args.runId, runtime)) };
|
|
325
|
+
case "cueline_claim_caller_job":
|
|
326
|
+
// MCP clientInfo is unauthenticated metadata. The explicit callerId remains
|
|
327
|
+
// the durable identity and must be reused in every fenced proof.
|
|
328
|
+
return {
|
|
329
|
+
...(await claimCueLineCallerJob(args.runId, args.jobId, {
|
|
330
|
+
...runtime,
|
|
331
|
+
callerId: args.callerId,
|
|
332
|
+
...(args.ttlMs === undefined ? {} : { ttlMs: args.ttlMs }),
|
|
333
|
+
})),
|
|
334
|
+
};
|
|
335
|
+
case "cueline_start_caller_job":
|
|
336
|
+
return {
|
|
337
|
+
...(await startCueLineCallerJob(args.runId, args.jobId, {
|
|
338
|
+
claimId: args.claimId,
|
|
339
|
+
callerId: args.callerId,
|
|
340
|
+
fencingToken: args.fencingToken,
|
|
341
|
+
}, runtime)),
|
|
342
|
+
};
|
|
343
|
+
case "cueline_list_runs":
|
|
344
|
+
return { runs: await listCueLineRuns(runtime) };
|
|
345
|
+
default:
|
|
346
|
+
throw new CueLineError("MCP_TOOL_NOT_FOUND", `Unknown tool: ${name}`);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function toolResult(value, isError = false) {
|
|
350
|
+
return {
|
|
351
|
+
content: [{ type: "text", text: JSON.stringify(value) }],
|
|
352
|
+
structuredContent: value,
|
|
353
|
+
...(isError ? { isError: true } : {}),
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function toolError(error) {
|
|
357
|
+
const value = error instanceof CueLineError
|
|
358
|
+
? { error: { code: error.code, message: error.message } }
|
|
359
|
+
: {
|
|
360
|
+
error: {
|
|
361
|
+
code: "MCP_TOOL_EXECUTION_FAILED",
|
|
362
|
+
message: "CueLine tool execution failed.",
|
|
363
|
+
},
|
|
364
|
+
};
|
|
365
|
+
return toolResult(value, true);
|
|
366
|
+
}
|
|
367
|
+
class CueLineMcpSession {
|
|
368
|
+
options;
|
|
369
|
+
#initializeAnswered = false;
|
|
370
|
+
#initialized = false;
|
|
371
|
+
#callerId;
|
|
372
|
+
constructor(options) {
|
|
373
|
+
this.options = options;
|
|
374
|
+
}
|
|
375
|
+
#bindCallerId(toolName, args) {
|
|
376
|
+
if (toolName !== "cueline_claim_caller_job" &&
|
|
377
|
+
toolName !== "cueline_start_caller_job")
|
|
378
|
+
return;
|
|
379
|
+
const callerId = args.callerId;
|
|
380
|
+
if (this.#callerId === undefined) {
|
|
381
|
+
// clientInfo is descriptive, so the first explicit callerId binds this
|
|
382
|
+
// stdio client session without weakening the durable API proof.
|
|
383
|
+
this.#callerId = callerId;
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
if (this.#callerId !== callerId) {
|
|
387
|
+
throw new CueLineError("MCP_CALLER_ID_MISMATCH", "This MCP client session is already bound to a different callerId.");
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
async handle(value) {
|
|
391
|
+
if (!isObject(value))
|
|
392
|
+
return errorResponse(null, -32600, "Invalid Request");
|
|
393
|
+
const id = requestId(value.id);
|
|
394
|
+
if (value.jsonrpc !== JSON_RPC_VERSION || typeof value.method !== "string") {
|
|
395
|
+
return errorResponse(id, -32600, "Invalid Request");
|
|
396
|
+
}
|
|
397
|
+
const hasId = Object.hasOwn(value, "id");
|
|
398
|
+
if (hasId && id === null)
|
|
399
|
+
return errorResponse(null, -32600, "Invalid Request");
|
|
400
|
+
if (!hasId) {
|
|
401
|
+
if (value.method === "notifications/initialized" && this.#initializeAnswered) {
|
|
402
|
+
this.#initialized = true;
|
|
403
|
+
}
|
|
404
|
+
return undefined;
|
|
405
|
+
}
|
|
406
|
+
if (value.method === "ping")
|
|
407
|
+
return resultResponse(id, {});
|
|
408
|
+
if (value.method === "initialize") {
|
|
409
|
+
if (this.#initializeAnswered) {
|
|
410
|
+
return errorResponse(id, -32600, "Server is already initialized");
|
|
411
|
+
}
|
|
412
|
+
if (!isObject(value.params)) {
|
|
413
|
+
return errorResponse(id, -32602, "Invalid initialize parameters");
|
|
414
|
+
}
|
|
415
|
+
const clientInfo = value.params.clientInfo;
|
|
416
|
+
if (typeof value.params.protocolVersion !== "string" ||
|
|
417
|
+
!isObject(value.params.capabilities) ||
|
|
418
|
+
!isObject(clientInfo) ||
|
|
419
|
+
typeof clientInfo.name !== "string" ||
|
|
420
|
+
typeof clientInfo.version !== "string") {
|
|
421
|
+
return errorResponse(id, -32602, "Invalid initialize parameters");
|
|
422
|
+
}
|
|
423
|
+
this.#initializeAnswered = true;
|
|
424
|
+
return resultResponse(id, {
|
|
425
|
+
protocolVersion: CUELINE_MCP_PROTOCOL_VERSION,
|
|
426
|
+
capabilities: { tools: { listChanged: false } },
|
|
427
|
+
serverInfo: {
|
|
428
|
+
name: "cueline",
|
|
429
|
+
version: CUELINE_VERSION,
|
|
430
|
+
description: "CueLine bounded durable-run tools over stdio.",
|
|
431
|
+
},
|
|
432
|
+
instructions: "Caller work requires an explicit stable callerId plus the exact returned claim ID and fencing token. Process execution is never enabled by default.",
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
if (!this.#initializeAnswered || !this.#initialized) {
|
|
436
|
+
return errorResponse(id, -32002, "Server not initialized");
|
|
437
|
+
}
|
|
438
|
+
if (value.method === "tools/list") {
|
|
439
|
+
if (value.params !== undefined && !isObject(value.params)) {
|
|
440
|
+
return errorResponse(id, -32602, "Invalid tools/list parameters");
|
|
441
|
+
}
|
|
442
|
+
if (isObject(value.params) && value.params.cursor !== undefined) {
|
|
443
|
+
return errorResponse(id, -32602, "Invalid tools/list cursor");
|
|
444
|
+
}
|
|
445
|
+
return resultResponse(id, { tools: TOOLS });
|
|
446
|
+
}
|
|
447
|
+
if (value.method === "tools/call") {
|
|
448
|
+
const params = value.params;
|
|
449
|
+
if (!isObject(params) ||
|
|
450
|
+
typeof params.name !== "string" ||
|
|
451
|
+
(params.arguments !== undefined && !isObject(params.arguments))) {
|
|
452
|
+
return errorResponse(id, -32602, "Invalid tools/call parameters");
|
|
453
|
+
}
|
|
454
|
+
const tool = TOOLS.find((candidate) => candidate.name === params.name);
|
|
455
|
+
if (tool === undefined) {
|
|
456
|
+
return errorResponse(id, -32602, `Unknown tool: ${params.name}`);
|
|
457
|
+
}
|
|
458
|
+
const args = (params.arguments ?? {});
|
|
459
|
+
const validationErrors = validateSchema(args, tool.inputSchema);
|
|
460
|
+
if (validationErrors.length > 0) {
|
|
461
|
+
return resultResponse(id, toolError(new CueLineError("MCP_TOOL_INPUT_INVALID", validationErrors.join("; "))));
|
|
462
|
+
}
|
|
463
|
+
try {
|
|
464
|
+
this.#bindCallerId(tool.name, args);
|
|
465
|
+
return resultResponse(id, toolResult(await executeTool(tool.name, args, this.options)));
|
|
466
|
+
}
|
|
467
|
+
catch (error) {
|
|
468
|
+
return resultResponse(id, toolError(error));
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
return errorResponse(id, -32601, "Method not found");
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
async function writeResponse(output, response) {
|
|
475
|
+
const line = `${JSON.stringify(response)}\n`;
|
|
476
|
+
await new Promise((resolve, reject) => {
|
|
477
|
+
output.write(line, (error) => {
|
|
478
|
+
if (error)
|
|
479
|
+
reject(error);
|
|
480
|
+
else
|
|
481
|
+
resolve();
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
export async function serveCueLineMcp(options = {}) {
|
|
486
|
+
const input = options.input ?? process.stdin;
|
|
487
|
+
const output = options.output ?? process.stdout;
|
|
488
|
+
const lines = createInterface({ input, crlfDelay: Infinity, terminal: false });
|
|
489
|
+
const session = new CueLineMcpSession(options);
|
|
490
|
+
const abort = () => lines.close();
|
|
491
|
+
if (options.signal?.aborted)
|
|
492
|
+
return;
|
|
493
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
494
|
+
try {
|
|
495
|
+
for await (const line of lines) {
|
|
496
|
+
let response;
|
|
497
|
+
if (Buffer.byteLength(line, "utf8") > MAX_MESSAGE_BYTES) {
|
|
498
|
+
response = errorResponse(null, -32600, "Invalid Request");
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
try {
|
|
502
|
+
response = await session.handle(JSON.parse(line));
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
if (error instanceof SyntaxError)
|
|
506
|
+
response = errorResponse(null, -32700, "Parse error");
|
|
507
|
+
else
|
|
508
|
+
throw error;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
if (response !== undefined)
|
|
512
|
+
await writeResponse(output, response);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
finally {
|
|
516
|
+
options.signal?.removeEventListener("abort", abort);
|
|
517
|
+
lines.close();
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,oBAAoB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AAI,CAAC;oBACH,QAAQ,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;gBACpD,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,IAAI,KAAK,YAAY,WAAW;wBAAE,QAAQ,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;;wBACnF,MAAM,KAAK,CAAC;gBACnB,CAAC;YACH,CAAC;YACD,IAAI,QAAQ,KAAK,SAAS;gBAAE,MAAM,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACpD,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;AACH,CAAC"}
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CUELINE_VERSION = "0.3.
|
|
1
|
+
export declare const CUELINE_VERSION = "0.3.2";
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const CUELINE_VERSION = "0.3.
|
|
1
|
+
export const CUELINE_VERSION = "0.3.2";
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -66,7 +66,7 @@ The run event log still records the controller-visible job transitions. A status
|
|
|
66
66
|
|
|
67
67
|
`runtime.json.fence` selects the authoritative owner-heartbeat record under `runtime.json.epochs/`. A live controller refreshes only its selected epoch and removes its own record on normal exit. If a mutation lock is abandoned, recovery rotates the fence before reuse; a paused old writer can then modify only its old epoch and cannot overwrite or release the new owner. An explicit takeover first records the operator's exact expected owner and heartbeat under `runtime.json.takeover-intents/`, including rejected race attempts. While holding the same mutation lock as runtime-authored event appends, a successful takeover then atomically replaces the exact stale lease and embeds the retired owner's last authoritative event sequence in the new lease. That lease replacement is the commit boundary: a failed replacement leaves the old owner authoritative. Before the replacement lease is removed, embedded cutoffs are also mirrored to immutable records under `runtime.json.retired-owners/`. Owner-tagged events after a committed cutoff remain on disk for audit but are excluded from state, status, reconciliation, and job metadata replay. Legacy `runtime.json` records are migrated on the first mutation. Creation and dead-owner retirement remain atomic and owner-checked so two sessions cannot both claim the run. `cueline run status <run-id> --json` combines event replay, lease ownership, cancellation requests, and job state.
|
|
68
68
|
|
|
69
|
-
- `phase: controller_response_pending`, `controller.pendingTurns === 1`, missing runtime ownership, and `safeNextAction:
|
|
69
|
+
- `phase: controller_response_pending`, `controller.pendingTurns === 1`, missing runtime ownership, and `safeNextAction: recover_submitted_turn` mean the exact normally submitted request has durable write-ahead and message-count baselines for one read-only recovery observation. `continueCueLineRun` first reopens the exact conversation when necessary. It retries only when the hydrated page still equals the baseline, the request message is absent, and Pro is idle. Other normally submitted turns remain `safeNextAction: observe`; `safeNextAction: reconcile` is reserved for ambiguous, manually submitted, or multiple pending turns.
|
|
70
70
|
- `phase: prompt_not_sent` and `safeNextAction: retry` mean the sole exact request is proven unsent by the built-in write-ahead contract or request-correlated `definitely_not_sent` failure evidence. CueLine abandons that attempt without consuming the round and reuses the same round number. A generic `requested` record is not enough.
|
|
71
71
|
- `controller.responseAccepted: true` means no newer turn is pending and a controller response was accepted. `lastAcceptedAction` and `lastAcceptedJobKeys` summarize what that accepted response ordered without dumping its full task text.
|
|
72
72
|
- `phase: jobs_running` plus `runtime.ownership: active` means local jobs are executing under the original loop.
|
|
@@ -94,6 +94,8 @@ The command does not drive the browser or send a message. It requires exactly on
|
|
|
94
94
|
|
|
95
95
|
The next continuation creates exactly one new request ID for the same round. The regenerated prompt must match the abandoned checkpoint hash after substituting only the new request ID for the abandoned request ID. Any other content change records `CONTROLLER_NOT_SENT_PROMPT_MISMATCH` and freezes the run for manual review. A crash after the retry request is written resumes the same deterministic retry identity. Repeating the confirmation command is idempotent and never appends another confirmation, abandonment, or send.
|
|
96
96
|
|
|
97
|
+
A normally `submitted` turn cannot use operator assertion alone. `continueCueLineRun`, or `confirmControllerTurnNotSent` with a Browser adapter, must freshly observe the exact conversation and prove all three conditions above. Counts below the durable baseline, including an initial `0/0` page during conversation hydration, remain unobservable and cannot authorize abandonment or retry.
|
|
98
|
+
|
|
97
99
|
Status exposes `operatorConfirmation`, `abandonedRequestId`, `retryRequestId`, `promptHash`, and `resendBlockedReason`. Before the retry, `safeNextAction` is `retry`; after submission it is the normal `observe`. If later DOM or response evidence shows that the abandoned request actually appeared, CueLine records `CONTROLLER_NOT_SENT_CONFIRMATION_CONFLICT` or `CONTROLLER_NOT_SENT_RESPONSE_CONFLICT`, changes `safeNextAction` to `manual_review`, and refuses automatic resend or command acceptance.
|
|
98
100
|
|
|
99
101
|
Existing manual-send path is distinct:
|
|
@@ -117,6 +119,7 @@ Always run `cueline run status <run-id> --json` before continuation. `continueCu
|
|
|
117
119
|
- a non-terminal or locally `failed` run with no pending controller turn can be marked resumed and driven for additional rounds
|
|
118
120
|
- `maxRounds` is a durable total-run contract, not a per-continuation allowance; continuation reuses the created value and cannot widen or shrink it
|
|
119
121
|
- when the built-in write-ahead contract or a request-correlated failure proves the exact sole pending request `definitely_not_sent`, CueLine records that attempt as abandoned and safely retries without consuming the controller round
|
|
122
|
+
- when a restarted normally submitted turn has a durable user-message baseline, continuation may reclassify it from a fresh hydrated, baseline-equal, request-absent, Pro-idle observation; the append-only recovery creates one retry with `retry_of_request_id` and never authorizes a retry of that retry
|
|
120
123
|
- a pending controller turn is reconciled read-only from the exact conversation before any new prompt is sent
|
|
121
124
|
- built-in caller/IAB submission returns `awaiting_controller` after one durable send and exact URL capture; each later continuation performs one non-blocking observation and returns the same status again if Pro is unfinished. Observation never presses `Answer now`, `Respond now`, `Stop`, or an equivalent interruption control
|
|
122
125
|
- inline reconciliation requires the page's last user message to equal the persisted prompt, a completed assistant response, and both Pro model checks
|
package/package.json
CHANGED