@moxt-ai/mobius 0.0.71 → 0.0.72
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/dist/acp/acp-error.d.ts +17 -0
- package/dist/acp/acp-error.d.ts.map +1 -0
- package/dist/acp/acp-error.js +28 -0
- package/dist/acp/acp-error.js.map +1 -0
- package/dist/acp/codex/agent.d.ts +26 -0
- package/dist/acp/codex/agent.d.ts.map +1 -0
- package/dist/acp/codex/agent.js +397 -0
- package/dist/acp/codex/agent.js.map +1 -0
- package/dist/acp/codex/app-server-client.d.ts +45 -0
- package/dist/acp/codex/app-server-client.d.ts.map +1 -0
- package/dist/acp/codex/app-server-client.js +195 -0
- package/dist/acp/codex/app-server-client.js.map +1 -0
- package/dist/acp/codex/app-server-protocol.d.ts +191 -0
- package/dist/acp/codex/app-server-protocol.d.ts.map +1 -0
- package/dist/acp/codex/app-server-protocol.js +172 -0
- package/dist/acp/codex/app-server-protocol.js.map +1 -0
- package/dist/acp/codex/items.d.ts +17 -0
- package/dist/acp/codex/items.d.ts.map +1 -0
- package/dist/acp/codex/items.js +141 -0
- package/dist/acp/codex/items.js.map +1 -0
- package/dist/acp/in-process/acp-endpoint.d.ts +33 -0
- package/dist/acp/in-process/acp-endpoint.d.ts.map +1 -0
- package/dist/acp/in-process/acp-endpoint.js +2 -0
- package/dist/acp/in-process/acp-endpoint.js.map +1 -0
- package/dist/acp/session-manager.d.ts +4 -15
- package/dist/acp/session-manager.d.ts.map +1 -1
- package/dist/acp/session-manager.js +49 -35
- package/dist/acp/session-manager.js.map +1 -1
- package/dist/agent-catalog/acp-readiness-probe.d.ts +2 -2
- package/dist/agent-catalog/acp-readiness-probe.d.ts.map +1 -1
- package/dist/agent-catalog/acp-readiness-probe.js +55 -0
- package/dist/agent-catalog/acp-readiness-probe.js.map +1 -1
- package/dist/agent-catalog/agent-diagnostics.d.ts.map +1 -1
- package/dist/agent-catalog/agent-diagnostics.js +4 -1
- package/dist/agent-catalog/agent-diagnostics.js.map +1 -1
- package/dist/agent-catalog/agent-discovery.d.ts +4 -4
- package/dist/agent-catalog/agent-discovery.d.ts.map +1 -1
- package/dist/agent-catalog/agent-discovery.js.map +1 -1
- package/dist/agent-catalog/agent-settings-adapter.d.ts +8 -8
- package/dist/agent-catalog/agent-settings-adapter.d.ts.map +1 -1
- package/dist/agent-catalog/agent-settings-adapter.js.map +1 -1
- package/dist/agent-catalog/agent-specification.d.ts +21 -0
- package/dist/agent-catalog/agent-specification.d.ts.map +1 -1
- package/dist/agent-catalog/agent-specification.js +25 -0
- package/dist/agent-catalog/agent-specification.js.map +1 -1
- package/dist/agent-catalog/agents/codex-agent.d.ts +5 -9
- package/dist/agent-catalog/agents/codex-agent.d.ts.map +1 -1
- package/dist/agent-catalog/agents/codex-agent.js +9 -18
- package/dist/agent-catalog/agents/codex-agent.js.map +1 -1
- package/dist/agent-catalog/discover-agent.d.ts.map +1 -1
- package/dist/agent-catalog/discover-agent.js +11 -6
- package/dist/agent-catalog/discover-agent.js.map +1 -1
- package/dist/agent-catalog/executable-discovery.d.ts.map +1 -1
- package/dist/agent-catalog/executable-discovery.js +2 -2
- package/dist/agent-catalog/executable-discovery.js.map +1 -1
- package/dist/agent-catalog/local-agent.d.ts +25 -11
- package/dist/agent-catalog/local-agent.d.ts.map +1 -1
- package/dist/agent-catalog/local-agent.js +32 -12
- package/dist/agent-catalog/local-agent.js.map +1 -1
- package/dist/agent-installation/fixed-installation-executor.d.ts.map +1 -1
- package/dist/agent-installation/fixed-installation-executor.js +3 -1
- package/dist/agent-installation/fixed-installation-executor.js.map +1 -1
- package/dist/cli.js +5065 -4061
- package/dist/cli.js.map +4 -4
- package/dist/config.d.ts +5 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/index.js +1109 -105
- package/dist/index.js.map +4 -4
- package/dist/native-sessions/codex-history.d.ts +3 -3
- package/dist/native-sessions/codex-history.d.ts.map +1 -1
- package/dist/native-sessions/codex-history.js +1 -1
- package/dist/native-sessions/codex-history.js.map +1 -1
- package/dist/pairing/pair-local-machine.d.ts.map +1 -1
- package/dist/pairing/pair-local-machine.js.map +1 -1
- package/dist/run-daemon.js +1 -1
- package/dist/run-daemon.js.map +1 -1
- package/dist/runtime.js +8965 -7961
- package/dist/runtime.js.map +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { decodeAppServerMessage } from "./app-server-protocol.js";
|
|
3
|
+
const INITIALIZE_TIMEOUT_MILLISECONDS = 30_000;
|
|
4
|
+
const OUTPUT_LIMIT_BYTES = 32 * 1_024 * 1_024;
|
|
5
|
+
/** A failure in the Codex app-server boundary, reported with a stable code. */
|
|
6
|
+
export class CodexAppServerError extends Error {
|
|
7
|
+
code;
|
|
8
|
+
constructor(code, message, options = {}) {
|
|
9
|
+
super(message, options);
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.name = "CodexAppServerError";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Owns one `codex app-server` child process and the newline-delimited JSON-RPC conversation over its
|
|
16
|
+
* stdio. The app-server omits the `jsonrpc` field on the wire in both directions.
|
|
17
|
+
*/
|
|
18
|
+
export class CodexAppServerClient {
|
|
19
|
+
#child;
|
|
20
|
+
#handlers;
|
|
21
|
+
#pending = new Map();
|
|
22
|
+
#processExit;
|
|
23
|
+
#failure = null;
|
|
24
|
+
#nextRequestId = 1;
|
|
25
|
+
#pendingBuffer = "";
|
|
26
|
+
#receivedBytes = 0;
|
|
27
|
+
#closed = false;
|
|
28
|
+
constructor(options) {
|
|
29
|
+
this.#handlers = options.handlers;
|
|
30
|
+
this.#child = spawn(options.command, ["app-server"], {
|
|
31
|
+
cwd: options.cwd,
|
|
32
|
+
detached: process.platform !== "win32",
|
|
33
|
+
env: { ...process.env, ...options.environment },
|
|
34
|
+
shell: false,
|
|
35
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
36
|
+
});
|
|
37
|
+
const stdin = this.#child.stdin;
|
|
38
|
+
const stdout = this.#child.stdout;
|
|
39
|
+
const stderr = this.#child.stderr;
|
|
40
|
+
if (stdin === null || stdout === null || stderr === null) {
|
|
41
|
+
this.#child.kill("SIGKILL");
|
|
42
|
+
throw new CodexAppServerError("codex_app_server_unavailable", "The Codex app-server is unavailable");
|
|
43
|
+
}
|
|
44
|
+
stdout.setEncoding("utf8");
|
|
45
|
+
stdout.on("data", (chunk) => {
|
|
46
|
+
this.#consume(chunk);
|
|
47
|
+
});
|
|
48
|
+
stderr.setEncoding("utf8");
|
|
49
|
+
stderr.on("data", (chunk) => {
|
|
50
|
+
process.stderr.write(`[codex-app-server] ${chunk}`);
|
|
51
|
+
});
|
|
52
|
+
this.#processExit = new Promise((resolve) => {
|
|
53
|
+
this.#child.once("error", resolve);
|
|
54
|
+
this.#child.once("exit", resolve);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
child = () => this.#child;
|
|
58
|
+
#fail = (error) => {
|
|
59
|
+
this.#failure ??= error;
|
|
60
|
+
for (const [id, pending] of this.#pending) {
|
|
61
|
+
this.#pending.delete(id);
|
|
62
|
+
pending.completion.reject(error);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
#exitedFailure = (method) => this.#failure ??
|
|
66
|
+
new CodexAppServerError("codex_app_server_exited", `The Codex app-server stopped during ${method}`);
|
|
67
|
+
#consume = (chunk) => {
|
|
68
|
+
try {
|
|
69
|
+
this.#receivedBytes += Buffer.byteLength(chunk);
|
|
70
|
+
if (this.#receivedBytes > OUTPUT_LIMIT_BYTES) {
|
|
71
|
+
throw new CodexAppServerError("codex_app_server_output_limit", "The Codex app-server produced too much output");
|
|
72
|
+
}
|
|
73
|
+
this.#pendingBuffer += chunk;
|
|
74
|
+
let newline = this.#pendingBuffer.indexOf("\n");
|
|
75
|
+
while (newline >= 0) {
|
|
76
|
+
const line = this.#pendingBuffer.slice(0, newline);
|
|
77
|
+
this.#pendingBuffer = this.#pendingBuffer.slice(newline + 1);
|
|
78
|
+
newline = this.#pendingBuffer.indexOf("\n");
|
|
79
|
+
if (line.trim().length === 0) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const value = JSON.parse(line);
|
|
83
|
+
this.#dispatch(decodeAppServerMessage(value));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
this.#fail(error instanceof CodexAppServerError
|
|
88
|
+
? error
|
|
89
|
+
: new CodexAppServerError("codex_app_server_protocol_error", "The Codex app-server sent an unreadable message", { cause: error }));
|
|
90
|
+
this.#child.kill("SIGKILL");
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
// Handler failures are recorded as the app-server's terminal failure: an ACP client that cannot
|
|
94
|
+
// accept an update or answer an approval has no way to resume the conversation.
|
|
95
|
+
#runHandler = (operation) => {
|
|
96
|
+
void operation.catch((error) => {
|
|
97
|
+
this.#fail(error instanceof CodexAppServerError
|
|
98
|
+
? error
|
|
99
|
+
: new CodexAppServerError("codex_app_server_client_error", "Mobius could not process a Codex app-server message", { cause: error }));
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
#dispatch = (message) => {
|
|
103
|
+
if (message.kind === "result-response") {
|
|
104
|
+
const pending = this.#pending.get(message.id);
|
|
105
|
+
if (pending === undefined) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
this.#pending.delete(message.id);
|
|
109
|
+
pending.completion.resolve(message.result);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (message.kind === "error-response") {
|
|
113
|
+
const pending = this.#pending.get(message.id);
|
|
114
|
+
if (pending === undefined) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.#pending.delete(message.id);
|
|
118
|
+
pending.completion.reject(new CodexAppServerError("codex_app_server_request_failed", message.message, {
|
|
119
|
+
cause: { code: message.code },
|
|
120
|
+
}));
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (message.kind === "server-request") {
|
|
124
|
+
this.#runHandler(this.#handlers.onServerRequest({ id: message.id, method: message.method, params: message.params }));
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
this.#runHandler(this.#handlers.onNotification(message.method, message.params));
|
|
128
|
+
};
|
|
129
|
+
/** Sends a request and waits for its response, bounded by the caller's cancellation signal. */
|
|
130
|
+
request = async (method, params, signal) => {
|
|
131
|
+
signal.throwIfAborted();
|
|
132
|
+
if (this.#closed) {
|
|
133
|
+
throw new CodexAppServerError("codex_app_server_closed", "The Codex app-server is closed");
|
|
134
|
+
}
|
|
135
|
+
const id = this.#nextRequestId;
|
|
136
|
+
this.#nextRequestId += 1;
|
|
137
|
+
const completion = Promise.withResolvers();
|
|
138
|
+
this.#pending.set(id, { completion });
|
|
139
|
+
const abort = () => {
|
|
140
|
+
if (this.#pending.delete(id)) {
|
|
141
|
+
completion.reject(signal.reason ?? new Error("Codex app-server request was cancelled"));
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
145
|
+
try {
|
|
146
|
+
this.#write({ id, method, params });
|
|
147
|
+
return await Promise.race([completion.promise, this.#processExit.then(() => this.#exitedFailure(method))]);
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
signal.removeEventListener("abort", abort);
|
|
151
|
+
this.#pending.delete(id);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
notify = (method, params) => {
|
|
155
|
+
this.#write({ method, params });
|
|
156
|
+
};
|
|
157
|
+
respond = (id, result) => {
|
|
158
|
+
this.#write({ id, result });
|
|
159
|
+
};
|
|
160
|
+
respondWithError = (id, code, message) => {
|
|
161
|
+
this.#write({ error: { code, message }, id });
|
|
162
|
+
};
|
|
163
|
+
#write = (message) => {
|
|
164
|
+
if (this.#closed) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const stdin = this.#child.stdin;
|
|
168
|
+
if (stdin === null || stdin.destroyed) {
|
|
169
|
+
throw new CodexAppServerError("codex_app_server_closed", "The Codex app-server input is closed");
|
|
170
|
+
}
|
|
171
|
+
stdin.write(`${JSON.stringify(message)}\n`);
|
|
172
|
+
};
|
|
173
|
+
/** Performs the `initialize` / `initialized` handshake. */
|
|
174
|
+
initialize = async (signal) => {
|
|
175
|
+
await this.request("initialize", { clientInfo: { name: "mobius", version: "1.0.0" } }, AbortSignal.any([signal, AbortSignal.timeout(INITIALIZE_TIMEOUT_MILLISECONDS)]));
|
|
176
|
+
this.notify("initialized", undefined);
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Rejects every in-flight request and marks the conversation closed without waiting on the
|
|
180
|
+
* process. Process teardown stays with the caller, which owns the process tree: it stops the
|
|
181
|
+
* app-server and every tool subprocess it started.
|
|
182
|
+
*/
|
|
183
|
+
detach = () => {
|
|
184
|
+
if (this.#closed) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
this.#closed = true;
|
|
188
|
+
this.#fail(new CodexAppServerError("codex_app_server_closed", "The Codex app-server is closed"));
|
|
189
|
+
const stdin = this.#child.stdin;
|
|
190
|
+
if (stdin !== null && !stdin.destroyed) {
|
|
191
|
+
stdin.end();
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=app-server-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-server-client.js","sourceRoot":"","sources":["../../../src/acp/codex/app-server-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,+BAA+B,GAAG,MAAM,CAAC;AAC/C,MAAM,kBAAkB,GAAG,EAAE,GAAG,KAAK,GAAG,KAAK,CAAC;AAE9C,+EAA+E;AAC/E,MAAM,OAAO,mBAAoB,SAAQ,KAAK;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
3
|
+
readonly kind: "error-response";
|
|
4
|
+
readonly id: number | string;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly code: number;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: "result-response";
|
|
9
|
+
readonly id: number | string;
|
|
10
|
+
readonly result: unknown;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: "server-request";
|
|
13
|
+
readonly id: number | string;
|
|
14
|
+
readonly method: string;
|
|
15
|
+
readonly params: unknown;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: "notification";
|
|
18
|
+
readonly method: string;
|
|
19
|
+
readonly params: unknown;
|
|
20
|
+
};
|
|
21
|
+
export declare function decodeAppServerMessage(value: unknown): AppServerMessage;
|
|
22
|
+
export type ThreadItem = z.infer<typeof threadItemSchema>;
|
|
23
|
+
export declare const threadItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
text: z.ZodString;
|
|
26
|
+
type: z.ZodLiteral<"agentMessage">;
|
|
27
|
+
phase: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
28
|
+
commentary: "commentary";
|
|
29
|
+
final_answer: "final_answer";
|
|
30
|
+
}>>>;
|
|
31
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
32
|
+
content: z.ZodArray<z.ZodUnknown>;
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
type: z.ZodLiteral<"userMessage">;
|
|
35
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
36
|
+
aggregatedOutput: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
37
|
+
command: z.ZodString;
|
|
38
|
+
cwd: z.ZodString;
|
|
39
|
+
durationMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
40
|
+
exitCode: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
41
|
+
id: z.ZodString;
|
|
42
|
+
processId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
|
+
status: z.ZodEnum<{
|
|
44
|
+
completed: "completed";
|
|
45
|
+
declined: "declined";
|
|
46
|
+
failed: "failed";
|
|
47
|
+
inProgress: "inProgress";
|
|
48
|
+
}>;
|
|
49
|
+
type: z.ZodLiteral<"commandExecution">;
|
|
50
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
+
changes: z.ZodArray<z.ZodObject<{
|
|
52
|
+
diff: z.ZodString;
|
|
53
|
+
kind: z.ZodUnknown;
|
|
54
|
+
path: z.ZodString;
|
|
55
|
+
}, z.core.$strip>>;
|
|
56
|
+
id: z.ZodString;
|
|
57
|
+
status: z.ZodEnum<{
|
|
58
|
+
completed: "completed";
|
|
59
|
+
declined: "declined";
|
|
60
|
+
failed: "failed";
|
|
61
|
+
inProgress: "inProgress";
|
|
62
|
+
}>;
|
|
63
|
+
type: z.ZodLiteral<"fileChange">;
|
|
64
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
65
|
+
arguments: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
66
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
result: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
69
|
+
server: z.ZodString;
|
|
70
|
+
status: z.ZodEnum<{
|
|
71
|
+
completed: "completed";
|
|
72
|
+
failed: "failed";
|
|
73
|
+
inProgress: "inProgress";
|
|
74
|
+
}>;
|
|
75
|
+
tool: z.ZodString;
|
|
76
|
+
type: z.ZodLiteral<"mcpToolCall">;
|
|
77
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
78
|
+
arguments: z.ZodOptional<z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
79
|
+
contentItems: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
namespace: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
82
|
+
status: z.ZodEnum<{
|
|
83
|
+
completed: "completed";
|
|
84
|
+
failed: "failed";
|
|
85
|
+
inProgress: "inProgress";
|
|
86
|
+
}>;
|
|
87
|
+
success: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
88
|
+
tool: z.ZodString;
|
|
89
|
+
type: z.ZodLiteral<"dynamicToolCall">;
|
|
90
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
+
content: z.ZodArray<z.ZodString>;
|
|
92
|
+
id: z.ZodString;
|
|
93
|
+
summary: z.ZodArray<z.ZodString>;
|
|
94
|
+
type: z.ZodLiteral<"reasoning">;
|
|
95
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
96
|
+
id: z.ZodString;
|
|
97
|
+
text: z.ZodString;
|
|
98
|
+
type: z.ZodLiteral<"plan">;
|
|
99
|
+
}, z.core.$strip>], "type">;
|
|
100
|
+
export declare const turnSchema: z.ZodObject<{
|
|
101
|
+
durationMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
102
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
103
|
+
message: z.ZodString;
|
|
104
|
+
}, z.core.$strip>>>;
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
status: z.ZodEnum<{
|
|
107
|
+
completed: "completed";
|
|
108
|
+
failed: "failed";
|
|
109
|
+
inProgress: "inProgress";
|
|
110
|
+
interrupted: "interrupted";
|
|
111
|
+
}>;
|
|
112
|
+
}, z.core.$strip>;
|
|
113
|
+
export declare const turnNotificationSchema: z.ZodObject<{
|
|
114
|
+
thread: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
}, z.core.$strip>>>;
|
|
117
|
+
threadId: z.ZodString;
|
|
118
|
+
turn: z.ZodObject<{
|
|
119
|
+
durationMs: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
120
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
121
|
+
message: z.ZodString;
|
|
122
|
+
}, z.core.$strip>>>;
|
|
123
|
+
id: z.ZodString;
|
|
124
|
+
status: z.ZodEnum<{
|
|
125
|
+
completed: "completed";
|
|
126
|
+
failed: "failed";
|
|
127
|
+
inProgress: "inProgress";
|
|
128
|
+
interrupted: "interrupted";
|
|
129
|
+
}>;
|
|
130
|
+
}, z.core.$strip>;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
export declare const commandApprovalParamsSchema: z.ZodObject<{
|
|
133
|
+
command: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
134
|
+
commandActions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnknown>>>;
|
|
135
|
+
cwd: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
136
|
+
itemId: z.ZodString;
|
|
137
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
138
|
+
threadId: z.ZodString;
|
|
139
|
+
turnId: z.ZodString;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
export declare const fileChangeApprovalParamsSchema: z.ZodObject<{
|
|
142
|
+
grantRoot: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
143
|
+
itemId: z.ZodString;
|
|
144
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
145
|
+
threadId: z.ZodString;
|
|
146
|
+
turnId: z.ZodString;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
declare const userInputQuestionSchema: z.ZodObject<{
|
|
149
|
+
header: z.ZodString;
|
|
150
|
+
id: z.ZodString;
|
|
151
|
+
options: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
152
|
+
description: z.ZodString;
|
|
153
|
+
label: z.ZodString;
|
|
154
|
+
}, z.core.$strip>>>>;
|
|
155
|
+
question: z.ZodString;
|
|
156
|
+
}, z.core.$strip>;
|
|
157
|
+
export declare const requestUserInputParamsSchema: z.ZodObject<{
|
|
158
|
+
itemId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
159
|
+
questions: z.ZodArray<z.ZodObject<{
|
|
160
|
+
header: z.ZodString;
|
|
161
|
+
id: z.ZodString;
|
|
162
|
+
options: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
163
|
+
description: z.ZodString;
|
|
164
|
+
label: z.ZodString;
|
|
165
|
+
}, z.core.$strip>>>>;
|
|
166
|
+
question: z.ZodString;
|
|
167
|
+
}, z.core.$strip>>;
|
|
168
|
+
threadId: z.ZodString;
|
|
169
|
+
turnId: z.ZodString;
|
|
170
|
+
}, z.core.$strip>;
|
|
171
|
+
export declare const mcpElicitationParamsSchema: z.ZodObject<{
|
|
172
|
+
message: z.ZodString;
|
|
173
|
+
mode: z.ZodUnion<[z.ZodEnum<{
|
|
174
|
+
form: "form";
|
|
175
|
+
url: "url";
|
|
176
|
+
}>, z.ZodString]>;
|
|
177
|
+
requestedSchema: z.ZodOptional<z.ZodUnknown>;
|
|
178
|
+
serverName: z.ZodString;
|
|
179
|
+
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
180
|
+
turnId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
181
|
+
url: z.ZodOptional<z.ZodString>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export declare const threadStartResponseSchema: z.ZodObject<{
|
|
184
|
+
thread: z.ZodObject<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
}, z.core.$strip>;
|
|
188
|
+
export type McpElicitationParams = z.infer<typeof mcpElicitationParamsSchema>;
|
|
189
|
+
export type UserInputQuestion = z.infer<typeof userInputQuestionSchema>;
|
|
190
|
+
export {};
|
|
191
|
+
//# sourceMappingURL=app-server-protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-server-protocol.d.ts","sourceRoot":"","sources":["../../../src/acp/codex/app-server-protocol.ts"],"names":[],"mappings":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EH,eAAO,MAAM,8BAA8B;;;;;;iBAMzC,CAAC;AAMH,QAAA,MAAM,uBAAuB;;;;;;;;iBAK3B,CAAC;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;iBAKvC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;iBAQrC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;iBAEpC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// The subset of the Codex app-server protocol Mobius drives. The surface is generated by
|
|
2
|
+
// `codex app-server generate-ts` and is not stable across Codex versions, so Mobius declares only the
|
|
3
|
+
// methods and fields it actually reads and validates every inbound payload at the boundary.
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const boundedText = (maximum) => z.string().max(maximum);
|
|
6
|
+
const jsonValue = z.lazy(() => z.unknown());
|
|
7
|
+
const requestIdSchema = z
|
|
8
|
+
.union([z.number(), z.string()])
|
|
9
|
+
.refine((value) => typeof value === "number" || value.length <= 256);
|
|
10
|
+
const errorResponseSchema = z.object({
|
|
11
|
+
error: z.object({ code: z.number(), message: boundedText(4_096) }),
|
|
12
|
+
id: requestIdSchema,
|
|
13
|
+
});
|
|
14
|
+
const resultResponseSchema = z.object({ id: requestIdSchema, result: z.unknown() });
|
|
15
|
+
const serverRequestSchema = z.object({
|
|
16
|
+
id: requestIdSchema,
|
|
17
|
+
method: z.string(),
|
|
18
|
+
params: z.unknown().optional(),
|
|
19
|
+
});
|
|
20
|
+
const serverNotificationSchema = z.object({
|
|
21
|
+
method: z.string(),
|
|
22
|
+
params: z.unknown().optional(),
|
|
23
|
+
});
|
|
24
|
+
export function decodeAppServerMessage(value) {
|
|
25
|
+
const record = z.record(z.string(), z.unknown()).parse(value);
|
|
26
|
+
const error = errorResponseSchema.safeParse(record);
|
|
27
|
+
if (error.success) {
|
|
28
|
+
return {
|
|
29
|
+
code: error.data.error.code,
|
|
30
|
+
id: error.data.id,
|
|
31
|
+
kind: "error-response",
|
|
32
|
+
message: error.data.error.message,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const result = resultResponseSchema.safeParse(record);
|
|
36
|
+
if (result.success) {
|
|
37
|
+
return { id: result.data.id, kind: "result-response", result: result.data.result };
|
|
38
|
+
}
|
|
39
|
+
const request = serverRequestSchema.safeParse(record);
|
|
40
|
+
if (request.success) {
|
|
41
|
+
return {
|
|
42
|
+
id: request.data.id,
|
|
43
|
+
kind: "server-request",
|
|
44
|
+
method: request.data.method,
|
|
45
|
+
params: request.data.params ?? {},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const notification = serverNotificationSchema.parse(record);
|
|
49
|
+
return { kind: "notification", method: notification.method, params: notification.params ?? {} };
|
|
50
|
+
}
|
|
51
|
+
const turnStatusSchema = z.enum(["inProgress", "completed", "interrupted", "failed"]);
|
|
52
|
+
const messagePhaseSchema = z.enum(["commentary", "final_answer"]);
|
|
53
|
+
const commandExecutionStatusSchema = z.enum(["inProgress", "completed", "failed", "declined"]);
|
|
54
|
+
const patchApplyStatusSchema = z.enum(["inProgress", "completed", "failed", "declined"]);
|
|
55
|
+
const mcpToolCallStatusSchema = z.enum(["inProgress", "completed", "failed"]);
|
|
56
|
+
const dynamicToolCallStatusSchema = z.enum(["inProgress", "completed", "failed"]);
|
|
57
|
+
const fileUpdateChangeSchema = z.object({
|
|
58
|
+
diff: boundedText(1_000_000),
|
|
59
|
+
kind: z.unknown(),
|
|
60
|
+
path: boundedText(4_096),
|
|
61
|
+
});
|
|
62
|
+
// `ThreadItem` is an open union: a newer Codex can add a variant at any time. Decode the shape Mobius
|
|
63
|
+
// reads and skip anything else rather than failing the whole stream.
|
|
64
|
+
export const threadItemSchema = z.discriminatedUnion("type", [
|
|
65
|
+
z.object({
|
|
66
|
+
id: boundedText(256),
|
|
67
|
+
text: boundedText(1_000_000),
|
|
68
|
+
type: z.literal("agentMessage"),
|
|
69
|
+
phase: messagePhaseSchema.nullish(),
|
|
70
|
+
}),
|
|
71
|
+
z.object({ content: z.array(z.unknown()).max(10_000), id: boundedText(256), type: z.literal("userMessage") }),
|
|
72
|
+
z.object({
|
|
73
|
+
aggregatedOutput: boundedText(4_000_000).nullish(),
|
|
74
|
+
command: boundedText(32_768),
|
|
75
|
+
cwd: boundedText(4_096),
|
|
76
|
+
durationMs: z.number().nullish(),
|
|
77
|
+
exitCode: z.number().nullish(),
|
|
78
|
+
id: boundedText(256),
|
|
79
|
+
processId: z.string().nullish(),
|
|
80
|
+
status: commandExecutionStatusSchema,
|
|
81
|
+
type: z.literal("commandExecution"),
|
|
82
|
+
}),
|
|
83
|
+
z.object({
|
|
84
|
+
changes: z.array(fileUpdateChangeSchema).max(10_000),
|
|
85
|
+
id: boundedText(256),
|
|
86
|
+
status: patchApplyStatusSchema,
|
|
87
|
+
type: z.literal("fileChange"),
|
|
88
|
+
}),
|
|
89
|
+
z.object({
|
|
90
|
+
arguments: jsonValue.optional(),
|
|
91
|
+
error: z.unknown().nullish(),
|
|
92
|
+
id: boundedText(256),
|
|
93
|
+
result: z.unknown().nullish(),
|
|
94
|
+
server: boundedText(256),
|
|
95
|
+
status: mcpToolCallStatusSchema,
|
|
96
|
+
tool: boundedText(256),
|
|
97
|
+
type: z.literal("mcpToolCall"),
|
|
98
|
+
}),
|
|
99
|
+
z.object({
|
|
100
|
+
arguments: jsonValue.optional(),
|
|
101
|
+
contentItems: z.array(z.unknown()).max(10_000).nullish(),
|
|
102
|
+
id: boundedText(256),
|
|
103
|
+
namespace: z.string().nullish(),
|
|
104
|
+
status: dynamicToolCallStatusSchema,
|
|
105
|
+
success: z.boolean().nullish(),
|
|
106
|
+
tool: boundedText(256),
|
|
107
|
+
type: z.literal("dynamicToolCall"),
|
|
108
|
+
}),
|
|
109
|
+
z.object({
|
|
110
|
+
content: z.array(boundedText(1_000_000)).max(1_000),
|
|
111
|
+
id: boundedText(256),
|
|
112
|
+
summary: z.array(boundedText(1_000_000)).max(1_000),
|
|
113
|
+
type: z.literal("reasoning"),
|
|
114
|
+
}),
|
|
115
|
+
z.object({ id: boundedText(256), text: boundedText(1_000_000), type: z.literal("plan") }),
|
|
116
|
+
]);
|
|
117
|
+
export const turnSchema = z.object({
|
|
118
|
+
durationMs: z.number().nullish(),
|
|
119
|
+
error: z.object({ message: boundedText(4_096) }).nullish(),
|
|
120
|
+
id: boundedText(256),
|
|
121
|
+
status: turnStatusSchema,
|
|
122
|
+
});
|
|
123
|
+
export const turnNotificationSchema = z.object({
|
|
124
|
+
thread: z.object({ id: boundedText(256) }).nullish(),
|
|
125
|
+
threadId: boundedText(256),
|
|
126
|
+
turn: turnSchema,
|
|
127
|
+
});
|
|
128
|
+
export const commandApprovalParamsSchema = z.object({
|
|
129
|
+
command: z.string().nullish(),
|
|
130
|
+
commandActions: z.array(z.unknown()).max(1_000).nullish(),
|
|
131
|
+
cwd: z.string().nullish(),
|
|
132
|
+
itemId: boundedText(256),
|
|
133
|
+
reason: z.string().nullish(),
|
|
134
|
+
threadId: boundedText(256),
|
|
135
|
+
turnId: boundedText(256),
|
|
136
|
+
});
|
|
137
|
+
export const fileChangeApprovalParamsSchema = z.object({
|
|
138
|
+
grantRoot: z.string().nullish(),
|
|
139
|
+
itemId: boundedText(256),
|
|
140
|
+
reason: z.string().nullish(),
|
|
141
|
+
threadId: boundedText(256),
|
|
142
|
+
turnId: boundedText(256),
|
|
143
|
+
});
|
|
144
|
+
const userInputOptionSchema = z.object({
|
|
145
|
+
description: boundedText(4_096),
|
|
146
|
+
label: boundedText(1_024),
|
|
147
|
+
});
|
|
148
|
+
const userInputQuestionSchema = z.object({
|
|
149
|
+
header: boundedText(1_024),
|
|
150
|
+
id: boundedText(256),
|
|
151
|
+
options: z.array(userInputOptionSchema).max(1_000).nullish(),
|
|
152
|
+
question: boundedText(4_096),
|
|
153
|
+
});
|
|
154
|
+
export const requestUserInputParamsSchema = z.object({
|
|
155
|
+
itemId: boundedText(256).nullish(),
|
|
156
|
+
questions: z.array(userInputQuestionSchema).max(1_000),
|
|
157
|
+
threadId: boundedText(256),
|
|
158
|
+
turnId: boundedText(256),
|
|
159
|
+
});
|
|
160
|
+
export const mcpElicitationParamsSchema = z.object({
|
|
161
|
+
message: boundedText(4_096),
|
|
162
|
+
mode: z.enum(["form", "url"]).or(z.string()),
|
|
163
|
+
requestedSchema: z.unknown().optional(),
|
|
164
|
+
serverName: boundedText(256),
|
|
165
|
+
threadId: boundedText(256).nullish(),
|
|
166
|
+
turnId: boundedText(256).nullish(),
|
|
167
|
+
url: z.string().optional(),
|
|
168
|
+
});
|
|
169
|
+
export const threadStartResponseSchema = z.object({
|
|
170
|
+
thread: z.object({ id: boundedText(256) }),
|
|
171
|
+
});
|
|
172
|
+
//# sourceMappingURL=app-server-protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-server-protocol.js","sourceRoot":"","sources":["../../../src/acp/codex/app-server-protocol.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,sGAAsG;AACtG,4FAA4F;AAC5F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,OAAe,EAAe,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC9E,MAAM,SAAS,GAAuB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAEhE,MAAM,eAAe,GAAG,CAAC;KACpB,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;KAC/B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,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WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;CAC7C,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ToolCallUpdate } from "@agentclientprotocol/sdk";
|
|
2
|
+
import { type ThreadItem } from "./app-server-protocol.ts";
|
|
3
|
+
/** The ACP tool-call payload for one app-server item: `tool_call` when it opens, `tool_call_update`
|
|
4
|
+
* for every later snapshot. Both carry the same fields. */
|
|
5
|
+
export declare function toolCallUpdate(item: ThreadItem): ToolCallUpdate | null;
|
|
6
|
+
/** Parses an untrusted app-server item, returning null when the shape is not one Mobius presents. */
|
|
7
|
+
export declare function decodeThreadItem(value: unknown): ThreadItem | null;
|
|
8
|
+
/**
|
|
9
|
+
* The `_meta` Mobius attaches to streamed agent text. `phase` distinguishes commentary from the
|
|
10
|
+
* final answer so the activity tracker can render progress separately.
|
|
11
|
+
*/
|
|
12
|
+
export declare function agentMessageMeta(phase: "commentary" | "final_answer" | null | undefined): {
|
|
13
|
+
readonly codex: {
|
|
14
|
+
readonly phase: string;
|
|
15
|
+
};
|
|
16
|
+
} | null;
|
|
17
|
+
//# sourceMappingURL=items.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../src/acp/codex/items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiD,cAAc,EAAY,MAAM,0BAA0B,CAAC;AAExH,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,0BAA0B,CAAC;AA+H7E;4DAC4D;AAC5D,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,cAAc,GAAG,IAAI,CAetE;AAED,qGAAqG;AACrG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAGlE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC5B,KAAK,EAAE,YAAY,GAAG,cAAc,GAAG,IAAI,GAAG,SAAS,GACxD;IAAE,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAAG,IAAI,CAKvD"}
|