@wix/pathgrade 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/pathgrade.js +2 -0
- package/dist/affected/anchor.d.ts +18 -0
- package/dist/affected/anchor.js +42 -0
- package/dist/affected/config.d.ts +25 -0
- package/dist/affected/config.js +98 -0
- package/dist/affected/format.d.ts +45 -0
- package/dist/affected/format.js +87 -0
- package/dist/affected/git.d.ts +33 -0
- package/dist/affected/git.js +68 -0
- package/dist/affected/glob.d.ts +17 -0
- package/dist/affected/glob.js +25 -0
- package/dist/affected/meta.d.ts +26 -0
- package/dist/affected/meta.js +158 -0
- package/dist/affected/select.d.ts +30 -0
- package/dist/affected/select.js +101 -0
- package/dist/affected/sidecar.d.ts +32 -0
- package/dist/affected/sidecar.js +86 -0
- package/dist/affected/types.d.ts +43 -0
- package/dist/affected/types.js +7 -0
- package/dist/agents/claude/ask-user-answer-store.d.ts +28 -0
- package/dist/agents/claude/ask-user-answer-store.js +29 -0
- package/dist/agents/claude/ask-user-bridge.d.ts +56 -0
- package/dist/agents/claude/ask-user-bridge.js +162 -0
- package/dist/agents/claude/sdk-message-projector.d.ts +43 -0
- package/dist/agents/claude/sdk-message-projector.js +208 -0
- package/dist/agents/claude/sdk-options.d.ts +52 -0
- package/dist/agents/claude/sdk-options.js +79 -0
- package/dist/agents/claude.d.ts +56 -0
- package/dist/agents/claude.js +143 -0
- package/dist/agents/codex-app-server/agent.d.ts +35 -0
- package/dist/agents/codex-app-server/agent.js +388 -0
- package/dist/agents/codex-app-server/fixtures/app-server-client.d.ts +19 -0
- package/dist/agents/codex-app-server/fixtures/app-server-client.js +104 -0
- package/dist/agents/codex-app-server/fixtures/run-gate.d.ts +25 -0
- package/dist/agents/codex-app-server/fixtures/run-gate.js +48 -0
- package/dist/agents/codex-app-server/protocol/ClientRequest.d.ts +27 -0
- package/dist/agents/codex-app-server/protocol/ClientRequest.js +7 -0
- package/dist/agents/codex-app-server/protocol/DynamicToolCallParams.d.ts +9 -0
- package/dist/agents/codex-app-server/protocol/DynamicToolCallParams.js +4 -0
- package/dist/agents/codex-app-server/protocol/GrantedPermissionProfile.d.ts +6 -0
- package/dist/agents/codex-app-server/protocol/GrantedPermissionProfile.js +7 -0
- package/dist/agents/codex-app-server/protocol/McpElicitationRequestParams.d.ts +23 -0
- package/dist/agents/codex-app-server/protocol/McpElicitationRequestParams.js +8 -0
- package/dist/agents/codex-app-server/protocol/Op.d.ts +11 -0
- package/dist/agents/codex-app-server/protocol/Op.js +5 -0
- package/dist/agents/codex-app-server/protocol/PermissionsRequestApprovalParams.d.ts +10 -0
- package/dist/agents/codex-app-server/protocol/PermissionsRequestApprovalParams.js +6 -0
- package/dist/agents/codex-app-server/protocol/PermissionsRequestApprovalResponse.d.ts +15 -0
- package/dist/agents/codex-app-server/protocol/PermissionsRequestApprovalResponse.js +4 -0
- package/dist/agents/codex-app-server/protocol/SandboxMode.d.ts +1 -0
- package/dist/agents/codex-app-server/protocol/SandboxMode.js +4 -0
- package/dist/agents/codex-app-server/protocol/ServerRequest.d.ts +42 -0
- package/dist/agents/codex-app-server/protocol/ServerRequest.js +7 -0
- package/dist/agents/codex-app-server/protocol/ThreadStartParams.d.ts +45 -0
- package/dist/agents/codex-app-server/protocol/ThreadStartParams.js +10 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputAnswer.d.ts +6 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputAnswer.js +4 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputOption.d.ts +7 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputOption.js +4 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputParams.d.ts +10 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputParams.js +4 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputQuestion.d.ts +12 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputQuestion.js +4 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputResponse.d.ts +9 -0
- package/dist/agents/codex-app-server/protocol/ToolRequestUserInputResponse.js +4 -0
- package/dist/agents/codex-app-server/protocol/TurnCompletedNotification.d.ts +5 -0
- package/dist/agents/codex-app-server/protocol/TurnCompletedNotification.js +4 -0
- package/dist/agents/codex-app-server/protocol/index.d.ts +16 -0
- package/dist/agents/codex-app-server/protocol/index.js +11 -0
- package/dist/agents/codex-app-server/transport.d.ts +84 -0
- package/dist/agents/codex-app-server/transport.js +246 -0
- package/dist/agents/codex-app-server/wire-translators.d.ts +19 -0
- package/dist/agents/codex-app-server/wire-translators.js +52 -0
- package/dist/agents/codex.d.ts +7 -0
- package/dist/agents/codex.js +164 -0
- package/dist/agents/cursor.d.ts +39 -0
- package/dist/agents/cursor.js +233 -0
- package/dist/agents/registry.d.ts +17 -0
- package/dist/agents/registry.js +27 -0
- package/dist/agents/transcript-agent.d.ts +14 -0
- package/dist/agents/transcript-agent.js +59 -0
- package/dist/analytics/engine.d.ts +18 -0
- package/dist/analytics/engine.js +66 -0
- package/dist/commands/affected.d.ts +31 -0
- package/dist/commands/affected.js +150 -0
- package/dist/commands/analyze.d.ts +21 -0
- package/dist/commands/analyze.js +167 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.js +242 -0
- package/dist/commands/preview-reactions.d.ts +10 -0
- package/dist/commands/preview-reactions.js +88 -0
- package/dist/commands/preview.d.ts +5 -0
- package/dist/commands/preview.js +17 -0
- package/dist/commands/report.d.ts +39 -0
- package/dist/commands/report.js +108 -0
- package/dist/commands/run-args.d.ts +22 -0
- package/dist/commands/run-args.js +69 -0
- package/dist/commands/run-changed.d.ts +26 -0
- package/dist/commands/run-changed.js +138 -0
- package/dist/commands/validate.d.ts +13 -0
- package/dist/commands/validate.js +233 -0
- package/dist/core/mcp-mock.d.ts +3 -0
- package/dist/core/mcp-mock.js +23 -0
- package/dist/core/mcp-mock.types.d.ts +15 -0
- package/dist/core/mcp-mock.types.js +1 -0
- package/dist/core/skills.d.ts +15 -0
- package/dist/core/skills.js +76 -0
- package/dist/evals/discovery.d.ts +7 -0
- package/dist/evals/discovery.js +69 -0
- package/dist/mcp-mock-server.d.ts +1 -0
- package/dist/mcp-mock-server.js +116 -0
- package/dist/pathgrade.d.ts +10 -0
- package/dist/pathgrade.js +243 -0
- package/dist/plugin/index.d.ts +9 -0
- package/dist/plugin/index.js +81 -0
- package/dist/plugin/lifecycle.d.ts +45 -0
- package/dist/plugin/lifecycle.js +146 -0
- package/dist/plugin/reporter.d.ts +36 -0
- package/dist/plugin/reporter.js +275 -0
- package/dist/plugin/setup.d.ts +1 -0
- package/dist/plugin/setup.js +3 -0
- package/dist/providers/copy-filter.d.ts +18 -0
- package/dist/providers/copy-filter.js +66 -0
- package/dist/providers/credentials.d.ts +36 -0
- package/dist/providers/credentials.js +202 -0
- package/dist/providers/mcp-config.d.ts +34 -0
- package/dist/providers/mcp-config.js +55 -0
- package/dist/providers/sandbox-exec.d.ts +8 -0
- package/dist/providers/sandbox-exec.js +82 -0
- package/dist/providers/sandbox.d.ts +22 -0
- package/dist/providers/sandbox.js +158 -0
- package/dist/providers/sandboxed-claude-spawn.d.ts +24 -0
- package/dist/providers/sandboxed-claude-spawn.js +57 -0
- package/dist/providers/workspace.d.ts +15 -0
- package/dist/providers/workspace.js +73 -0
- package/dist/reporters/browser.d.ts +2 -0
- package/dist/reporters/browser.js +85 -0
- package/dist/reporters/cli.d.ts +2 -0
- package/dist/reporters/cli.js +131 -0
- package/dist/reporters/diagnostics.d.ts +46 -0
- package/dist/reporters/diagnostics.js +147 -0
- package/dist/reporters/github-comment.d.ts +67 -0
- package/dist/reporters/github-comment.js +252 -0
- package/dist/reporters/loader.d.ts +8 -0
- package/dist/reporters/loader.js +36 -0
- package/dist/reporters/results-path.d.ts +2 -0
- package/dist/reporters/results-path.js +10 -0
- package/dist/reporters/verbose-emitter.d.ts +69 -0
- package/dist/reporters/verbose-emitter.js +103 -0
- package/dist/sdk/agent-crash.d.ts +19 -0
- package/dist/sdk/agent-crash.js +20 -0
- package/dist/sdk/agent-resolution.d.ts +12 -0
- package/dist/sdk/agent-resolution.js +21 -0
- package/dist/sdk/agent-result-log.d.ts +19 -0
- package/dist/sdk/agent-result-log.js +45 -0
- package/dist/sdk/agent.d.ts +4 -0
- package/dist/sdk/agent.js +354 -0
- package/dist/sdk/ask-bus/bus.d.ts +21 -0
- package/dist/sdk/ask-bus/bus.js +129 -0
- package/dist/sdk/ask-bus/handler.d.ts +31 -0
- package/dist/sdk/ask-bus/handler.js +244 -0
- package/dist/sdk/ask-bus/parsers.d.ts +9 -0
- package/dist/sdk/ask-bus/parsers.js +30 -0
- package/dist/sdk/ask-bus/projection.d.ts +26 -0
- package/dist/sdk/ask-bus/projection.js +45 -0
- package/dist/sdk/ask-bus/types.d.ts +69 -0
- package/dist/sdk/ask-bus/types.js +1 -0
- package/dist/sdk/chat.d.ts +29 -0
- package/dist/sdk/chat.js +93 -0
- package/dist/sdk/conversation-window.d.ts +14 -0
- package/dist/sdk/conversation-window.js +38 -0
- package/dist/sdk/converse.d.ts +42 -0
- package/dist/sdk/converse.js +329 -0
- package/dist/sdk/eval-runtime.d.ts +10 -0
- package/dist/sdk/eval-runtime.js +17 -0
- package/dist/sdk/evaluate.d.ts +13 -0
- package/dist/sdk/evaluate.js +325 -0
- package/dist/sdk/index.d.ts +31 -0
- package/dist/sdk/index.js +20 -0
- package/dist/sdk/judge-pipeline.d.ts +7 -0
- package/dist/sdk/judge-pipeline.js +178 -0
- package/dist/sdk/judge-prompt-builder.d.ts +7 -0
- package/dist/sdk/judge-prompt-builder.js +76 -0
- package/dist/sdk/judge-tool-runner.d.ts +19 -0
- package/dist/sdk/judge-tool-runner.js +51 -0
- package/dist/sdk/judge-tool-session.d.ts +47 -0
- package/dist/sdk/judge-tool-session.js +213 -0
- package/dist/sdk/judge-tools.d.ts +29 -0
- package/dist/sdk/judge-tools.js +283 -0
- package/dist/sdk/managed-session.d.ts +50 -0
- package/dist/sdk/managed-session.js +110 -0
- package/dist/sdk/persona.d.ts +5 -0
- package/dist/sdk/persona.js +33 -0
- package/dist/sdk/reaction-loader.d.ts +4 -0
- package/dist/sdk/reaction-loader.js +119 -0
- package/dist/sdk/reaction-preview.d.ts +6 -0
- package/dist/sdk/reaction-preview.js +94 -0
- package/dist/sdk/run-scorer.d.ts +10 -0
- package/dist/sdk/run-scorer.js +124 -0
- package/dist/sdk/runtime-policy.d.ts +21 -0
- package/dist/sdk/runtime-policy.js +89 -0
- package/dist/sdk/scorer-utils.d.ts +6 -0
- package/dist/sdk/scorer-utils.js +39 -0
- package/dist/sdk/scorers.d.ts +64 -0
- package/dist/sdk/scorers.js +80 -0
- package/dist/sdk/snapshots.d.ts +41 -0
- package/dist/sdk/snapshots.js +148 -0
- package/dist/sdk/types.d.ts +416 -0
- package/dist/sdk/types.js +17 -0
- package/dist/sdk/visible-turn.d.ts +4 -0
- package/dist/sdk/visible-turn.js +23 -0
- package/dist/tool-events.d.ts +45 -0
- package/dist/tool-events.js +167 -0
- package/dist/types.d.ts +372 -0
- package/dist/types.js +37 -0
- package/dist/utils/cli.d.ts +55 -0
- package/dist/utils/cli.js +131 -0
- package/dist/utils/env.d.ts +8 -0
- package/dist/utils/env.js +26 -0
- package/dist/utils/llm-mocks.d.ts +43 -0
- package/dist/utils/llm-mocks.js +108 -0
- package/dist/utils/llm-providers/anthropic.d.ts +2 -0
- package/dist/utils/llm-providers/anthropic.js +132 -0
- package/dist/utils/llm-providers/cli.d.ts +20 -0
- package/dist/utils/llm-providers/cli.js +162 -0
- package/dist/utils/llm-providers/openai.d.ts +2 -0
- package/dist/utils/llm-providers/openai.js +56 -0
- package/dist/utils/llm-types.d.ts +107 -0
- package/dist/utils/llm-types.js +1 -0
- package/dist/utils/llm.d.ts +36 -0
- package/dist/utils/llm.js +209 -0
- package/dist/utils/shutdown.d.ts +15 -0
- package/dist/utils/shutdown.js +41 -0
- package/dist/utils/timeout.d.ts +8 -0
- package/dist/utils/timeout.js +32 -0
- package/dist/viewer.html +1178 -0
- package/package.json +88 -0
- package/templates/eval.ts.template +28 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { BaseAgent, getRuntimeEnv, getWorkspacePath, } from '../../types.js';
|
|
2
|
+
import { requireAskBusForLiveBatches, } from '../../sdk/ask-bus/bus.js';
|
|
3
|
+
import { toAskUserToolEvent } from '../../sdk/ask-bus/projection.js';
|
|
4
|
+
import { spawnAppServerTransport, } from './transport.js';
|
|
5
|
+
import { normalizeUpstreamQuestion, toWireAnswerMap, } from './wire-translators.js';
|
|
6
|
+
const DEFAULT_MODEL = 'gpt-5.3-codex';
|
|
7
|
+
const TURN_COMPLETED_METHOD = 'turn/completed';
|
|
8
|
+
function projectItemIntoTurn(item, turn) {
|
|
9
|
+
if (item.type === 'agentMessage') {
|
|
10
|
+
const msg = item;
|
|
11
|
+
if (msg.text) {
|
|
12
|
+
turn.assistantMessageParts.push(msg.text);
|
|
13
|
+
}
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (item.type === 'commandExecution') {
|
|
17
|
+
const cmd = item;
|
|
18
|
+
turn.nonAskToolEvents.push({
|
|
19
|
+
action: 'run_shell',
|
|
20
|
+
provider: 'codex',
|
|
21
|
+
providerToolName: 'commandExecution',
|
|
22
|
+
turnNumber: turn.turnNumber,
|
|
23
|
+
arguments: { command: cmd.command },
|
|
24
|
+
summary: `run_shell: ${cmd.command}`,
|
|
25
|
+
confidence: 'high',
|
|
26
|
+
rawSnippet: JSON.stringify(cmd),
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (item.type === 'fileChange') {
|
|
31
|
+
const fc = item;
|
|
32
|
+
for (const change of fc.changes ?? []) {
|
|
33
|
+
turn.nonAskToolEvents.push({
|
|
34
|
+
action: 'edit_file',
|
|
35
|
+
provider: 'codex',
|
|
36
|
+
providerToolName: 'fileChange',
|
|
37
|
+
turnNumber: turn.turnNumber,
|
|
38
|
+
arguments: { file_path: change.path },
|
|
39
|
+
summary: `edit_file: ${change.path}`,
|
|
40
|
+
confidence: 'high',
|
|
41
|
+
rawSnippet: JSON.stringify(change),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export class CodexAppServerAgent extends BaseAgent {
|
|
48
|
+
deps;
|
|
49
|
+
constructor(deps = {}) {
|
|
50
|
+
super();
|
|
51
|
+
this.deps = deps;
|
|
52
|
+
}
|
|
53
|
+
async createSession(runtime, _runCommand, options) {
|
|
54
|
+
const askBus = requireAskBusForLiveBatches(options, 'CodexAppServerAgent');
|
|
55
|
+
const workspacePath = getWorkspacePath(runtime);
|
|
56
|
+
const runtimeEnv = getRuntimeEnv(runtime);
|
|
57
|
+
const model = options?.model ?? DEFAULT_MODEL;
|
|
58
|
+
const sandboxMode = this.deps.sandboxMode ?? 'workspace-write';
|
|
59
|
+
let handle = null;
|
|
60
|
+
let threadId = null;
|
|
61
|
+
let turnCounter = 0;
|
|
62
|
+
let closeInfo = null;
|
|
63
|
+
let activeTurn = null;
|
|
64
|
+
let disposed = false;
|
|
65
|
+
const ensureTransport = async () => {
|
|
66
|
+
if (disposed)
|
|
67
|
+
throw new Error('CodexAppServerAgent session disposed');
|
|
68
|
+
if (handle)
|
|
69
|
+
return handle.transport;
|
|
70
|
+
const factory = this.deps.createTransport
|
|
71
|
+
?? (async (ctx) => spawnAppServerTransport({ cwd: ctx.workspacePath, env: ctx.env }));
|
|
72
|
+
handle = await factory({ workspacePath, env: runtimeEnv });
|
|
73
|
+
const transport = handle.transport;
|
|
74
|
+
transport.onServerRequest((req) => this.dispatchServerRequest(req, {
|
|
75
|
+
transport,
|
|
76
|
+
askBus,
|
|
77
|
+
activeTurn: () => activeTurn,
|
|
78
|
+
onPermissionGrant: this.deps.onPermissionGrant,
|
|
79
|
+
}));
|
|
80
|
+
transport.onClose((info) => {
|
|
81
|
+
closeInfo = info;
|
|
82
|
+
});
|
|
83
|
+
transport.onNotification((n) => {
|
|
84
|
+
if (process.env.PATHGRADE_CODEX_DEBUG) {
|
|
85
|
+
console.error(`[codex app-server] notification method=${n.method} params=${JSON.stringify(n.params).slice(0, 300)}`);
|
|
86
|
+
}
|
|
87
|
+
if (n.method !== 'item/completed')
|
|
88
|
+
return;
|
|
89
|
+
const turn = activeTurn;
|
|
90
|
+
if (!turn)
|
|
91
|
+
return;
|
|
92
|
+
const params = n.params;
|
|
93
|
+
if (!params?.item)
|
|
94
|
+
return;
|
|
95
|
+
projectItemIntoTurn(params.item, turn);
|
|
96
|
+
});
|
|
97
|
+
await transport.sendRequest('initialize', {
|
|
98
|
+
clientInfo: { name: 'pathgrade', version: '0.5.0', title: null },
|
|
99
|
+
capabilities: { experimentalApi: true, optOutNotificationMethods: null },
|
|
100
|
+
});
|
|
101
|
+
// Upstream ClientNotification = { method: "initialized" }: send it
|
|
102
|
+
// before any thread/start so the handshake matches the v0.124
|
|
103
|
+
// contract and is forward-compatible with servers that enforce it.
|
|
104
|
+
transport.sendNotification('initialized', null);
|
|
105
|
+
return transport;
|
|
106
|
+
};
|
|
107
|
+
const runTurn = async (message) => {
|
|
108
|
+
const t = await ensureTransport();
|
|
109
|
+
turnCounter += 1;
|
|
110
|
+
const turn = {
|
|
111
|
+
turnNumber: turnCounter,
|
|
112
|
+
askBatchIds: [],
|
|
113
|
+
nonAskToolEvents: [],
|
|
114
|
+
assistantMessageParts: [],
|
|
115
|
+
turnFailed: false,
|
|
116
|
+
};
|
|
117
|
+
activeTurn = turn;
|
|
118
|
+
try {
|
|
119
|
+
if (threadId === null) {
|
|
120
|
+
const resp = await t.sendRequest('thread/start', buildThreadStartParams({ cwd: workspacePath, model, sandboxMode }));
|
|
121
|
+
threadId = resp.thread.id;
|
|
122
|
+
}
|
|
123
|
+
// Wait for TurnCompleted OR subprocess crash OR dispatcher failure.
|
|
124
|
+
const turnCompletion = new Promise((resolve, reject) => {
|
|
125
|
+
let settled = false;
|
|
126
|
+
const off = t.onNotification((n) => {
|
|
127
|
+
if (settled)
|
|
128
|
+
return;
|
|
129
|
+
if (n.method === TURN_COMPLETED_METHOD) {
|
|
130
|
+
settled = true;
|
|
131
|
+
off();
|
|
132
|
+
closeOff();
|
|
133
|
+
resolve();
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const closeOff = t.onClose((info) => {
|
|
137
|
+
if (settled)
|
|
138
|
+
return;
|
|
139
|
+
settled = true;
|
|
140
|
+
off();
|
|
141
|
+
closeOff();
|
|
142
|
+
reject(Object.assign(new Error('app-server exited'), {
|
|
143
|
+
exitCode: info.exitCode ?? 1,
|
|
144
|
+
signal: info.signal,
|
|
145
|
+
pid: info.pid,
|
|
146
|
+
}));
|
|
147
|
+
});
|
|
148
|
+
turn.signalFailure = (msg) => {
|
|
149
|
+
if (settled)
|
|
150
|
+
return;
|
|
151
|
+
settled = true;
|
|
152
|
+
off();
|
|
153
|
+
closeOff();
|
|
154
|
+
turn.turnFailed = true;
|
|
155
|
+
turn.failureMessage = msg;
|
|
156
|
+
resolve();
|
|
157
|
+
};
|
|
158
|
+
// If already closed, settle immediately.
|
|
159
|
+
if (closeInfo) {
|
|
160
|
+
if (!settled) {
|
|
161
|
+
settled = true;
|
|
162
|
+
off();
|
|
163
|
+
closeOff();
|
|
164
|
+
reject(Object.assign(new Error('app-server exited'), {
|
|
165
|
+
exitCode: closeInfo.exitCode ?? 1,
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
const startTurnResp = t
|
|
171
|
+
.sendRequest('turn/start', {
|
|
172
|
+
threadId,
|
|
173
|
+
input: [{ type: 'text', text: message, text_elements: [] }],
|
|
174
|
+
})
|
|
175
|
+
.catch((err) => {
|
|
176
|
+
// A JSON-RPC error on turn/start means the server will
|
|
177
|
+
// never send turn/completed — short-circuit the turn
|
|
178
|
+
// through the existing signalFailure path instead of
|
|
179
|
+
// waiting for an outer timeout.
|
|
180
|
+
const msg = err instanceof Error
|
|
181
|
+
? err.message
|
|
182
|
+
: typeof err === 'string'
|
|
183
|
+
? err
|
|
184
|
+
: 'turn/start failed';
|
|
185
|
+
turn.signalFailure?.(msg);
|
|
186
|
+
});
|
|
187
|
+
try {
|
|
188
|
+
await turnCompletion;
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
const info = err;
|
|
192
|
+
return assembleTurnResult({
|
|
193
|
+
askBus,
|
|
194
|
+
activeTurn: turn,
|
|
195
|
+
exitCode: info.exitCode ?? 1,
|
|
196
|
+
message: info.message ?? 'app-server exited',
|
|
197
|
+
pid: info.pid,
|
|
198
|
+
signal: info.signal,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
void startTurnResp;
|
|
202
|
+
if (turn.turnFailed) {
|
|
203
|
+
return assembleTurnResult({
|
|
204
|
+
askBus,
|
|
205
|
+
activeTurn: turn,
|
|
206
|
+
exitCode: 1,
|
|
207
|
+
message: turn.failureMessage ?? 'turn failed',
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
return assembleTurnResult({
|
|
211
|
+
askBus,
|
|
212
|
+
activeTurn: turn,
|
|
213
|
+
exitCode: 0,
|
|
214
|
+
message: turn.assistantMessageParts.join('\n\n'),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
finally {
|
|
218
|
+
activeTurn = null;
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const dispose = async () => {
|
|
222
|
+
if (disposed)
|
|
223
|
+
return;
|
|
224
|
+
disposed = true;
|
|
225
|
+
const turn = activeTurn;
|
|
226
|
+
if (turn) {
|
|
227
|
+
turn.signalFailure?.('session disposed');
|
|
228
|
+
}
|
|
229
|
+
activeTurn = null;
|
|
230
|
+
if (handle) {
|
|
231
|
+
try {
|
|
232
|
+
await handle.close();
|
|
233
|
+
}
|
|
234
|
+
catch (err) {
|
|
235
|
+
console.warn(`CodexAppServerAgent: handle.close() threw during dispose: ${String(err)}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const guardDisposed = () => {
|
|
240
|
+
if (disposed) {
|
|
241
|
+
throw new Error('CodexAppServerAgent session disposed');
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
return {
|
|
245
|
+
start: async ({ message }) => {
|
|
246
|
+
guardDisposed();
|
|
247
|
+
return runTurn(message);
|
|
248
|
+
},
|
|
249
|
+
reply: async ({ message }) => {
|
|
250
|
+
guardDisposed();
|
|
251
|
+
return runTurn(message);
|
|
252
|
+
},
|
|
253
|
+
dispose,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
dispatchServerRequest(req, ctx) {
|
|
257
|
+
const { transport, askBus, activeTurn, onPermissionGrant } = ctx;
|
|
258
|
+
switch (req.method) {
|
|
259
|
+
case 'item/tool/requestUserInput':
|
|
260
|
+
void handleRequestUserInput(req, { transport, askBus, activeTurn });
|
|
261
|
+
return;
|
|
262
|
+
case 'item/permissions/requestApproval': {
|
|
263
|
+
const params = (req.params ?? {});
|
|
264
|
+
transport.sendResponse(req.id, {
|
|
265
|
+
permissions: params.permissions ?? {},
|
|
266
|
+
scope: 'turn',
|
|
267
|
+
strictAutoReview: false,
|
|
268
|
+
});
|
|
269
|
+
const turn = activeTurn();
|
|
270
|
+
if (onPermissionGrant) {
|
|
271
|
+
onPermissionGrant({
|
|
272
|
+
type: 'permissions_granted',
|
|
273
|
+
turnNumber: turn?.turnNumber ?? 0,
|
|
274
|
+
requested: params.permissions ?? {},
|
|
275
|
+
scope: 'turn',
|
|
276
|
+
strictAutoReview: false,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
case 'item/commandExecution/requestApproval':
|
|
282
|
+
case 'item/fileChange/requestApproval':
|
|
283
|
+
case 'applyPatchApproval':
|
|
284
|
+
case 'execCommandApproval':
|
|
285
|
+
transport.sendResponse(req.id, { decision: 'approved', scope: 'turn' });
|
|
286
|
+
return;
|
|
287
|
+
case 'item/tool/call':
|
|
288
|
+
transport.sendResponse(req.id, { status: 'declined' });
|
|
289
|
+
return;
|
|
290
|
+
case 'mcpServer/elicitation/request':
|
|
291
|
+
transport.sendResponse(req.id, { action: 'decline' });
|
|
292
|
+
return;
|
|
293
|
+
case 'account/chatgptAuthTokens/refresh': {
|
|
294
|
+
const message = 'codex app-server requires OPENAI_API_KEY for pathgrade and honors OPENAI_BASE_URL when set; ChatGPT/cached auth unsupported under transport=app-server';
|
|
295
|
+
transport.sendErrorResponse(req.id, -32001, message);
|
|
296
|
+
const turn = activeTurn();
|
|
297
|
+
if (turn) {
|
|
298
|
+
turn.turnFailed = true;
|
|
299
|
+
turn.failureMessage = message;
|
|
300
|
+
turn.signalFailure?.(message);
|
|
301
|
+
}
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
default:
|
|
305
|
+
transport.sendErrorResponse(req.id, -32601, `pathgrade: unknown server-request method '${req.method}'`);
|
|
306
|
+
console.warn(`CodexAppServerAgent: unknown server-request method '${req.method}' rejected`);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
async function handleRequestUserInput(req, ctx) {
|
|
312
|
+
const { transport, askBus, activeTurn } = ctx;
|
|
313
|
+
const params = req.params;
|
|
314
|
+
const turn = activeTurn();
|
|
315
|
+
const turnNumber = turn?.turnNumber ?? 0;
|
|
316
|
+
const questions = params.questions.map(normalizeUpstreamQuestion);
|
|
317
|
+
const handle = askBus.emit({
|
|
318
|
+
batchId: params.itemId,
|
|
319
|
+
turnNumber,
|
|
320
|
+
source: 'codex-app-server',
|
|
321
|
+
lifecycle: 'live',
|
|
322
|
+
sourceTool: 'request_user_input',
|
|
323
|
+
toolUseId: params.itemId,
|
|
324
|
+
questions,
|
|
325
|
+
});
|
|
326
|
+
if (turn)
|
|
327
|
+
turn.askBatchIds.push(params.itemId);
|
|
328
|
+
let resolution;
|
|
329
|
+
try {
|
|
330
|
+
resolution = await handle.resolution;
|
|
331
|
+
}
|
|
332
|
+
catch (err) {
|
|
333
|
+
console.warn(`CodexAppServerAgent: ask_user batch ${params.itemId} failed to resolve: ${String(err)}`);
|
|
334
|
+
transport.sendResponse(req.id, { answers: toWireAnswerMap(null, params.questions) });
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
transport.sendResponse(req.id, {
|
|
338
|
+
answers: toWireAnswerMap(resolution, params.questions),
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
function buildThreadStartParams(opts) {
|
|
342
|
+
return {
|
|
343
|
+
cwd: opts.cwd,
|
|
344
|
+
approvalPolicy: 'never',
|
|
345
|
+
sandbox: opts.sandboxMode,
|
|
346
|
+
ephemeral: true,
|
|
347
|
+
experimentalRawEvents: false,
|
|
348
|
+
persistExtendedHistory: false,
|
|
349
|
+
model: opts.model,
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function assembleTurnResult(args) {
|
|
353
|
+
const { askBus, activeTurn, exitCode, message, pid, signal } = args;
|
|
354
|
+
const askBatchIds = new Set(activeTurn.askBatchIds);
|
|
355
|
+
const askEvents = askBus
|
|
356
|
+
.snapshot()
|
|
357
|
+
.filter((s) => askBatchIds.has(s.batchId))
|
|
358
|
+
.map((s) => toAskUserToolEvent(s));
|
|
359
|
+
const toolEvents = [...askEvents, ...activeTurn.nonAskToolEvents];
|
|
360
|
+
const rawOutput = exitCode === 0
|
|
361
|
+
? message
|
|
362
|
+
: [
|
|
363
|
+
message,
|
|
364
|
+
pid !== undefined ? `pid=${pid}` : '',
|
|
365
|
+
signal ? `signal=${signal}` : '',
|
|
366
|
+
`exitCode=${exitCode}`,
|
|
367
|
+
]
|
|
368
|
+
.filter(Boolean)
|
|
369
|
+
.join(' ');
|
|
370
|
+
return {
|
|
371
|
+
rawOutput,
|
|
372
|
+
assistantMessage: exitCode === 0 ? message : '',
|
|
373
|
+
visibleAssistantMessage: exitCode === 0 ? message : '',
|
|
374
|
+
visibleAssistantMessageSource: 'assistant_message',
|
|
375
|
+
exitCode,
|
|
376
|
+
traceOutput: rawOutput,
|
|
377
|
+
toolEvents,
|
|
378
|
+
...(exitCode !== 0
|
|
379
|
+
? {
|
|
380
|
+
crashInfo: {
|
|
381
|
+
...(pid !== undefined ? { pid } : {}),
|
|
382
|
+
...(signal !== undefined ? { signal } : {}),
|
|
383
|
+
exitCode,
|
|
384
|
+
},
|
|
385
|
+
}
|
|
386
|
+
: {}),
|
|
387
|
+
};
|
|
388
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChildProcessWithoutNullStreams } from 'child_process';
|
|
2
|
+
export declare function spawnCodexAppServer(binaryPath?: string, extraArgs?: string[]): Promise<ChildProcessWithoutNullStreams>;
|
|
3
|
+
/**
|
|
4
|
+
* Minimal JSON-RPC 2.0 client over a line-delimited stdio child process.
|
|
5
|
+
* Drift detector only — not the production driver. Slice #6 ships the driver
|
|
6
|
+
* that reuses this helper's transport contract.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AppServerClient {
|
|
9
|
+
private nextId;
|
|
10
|
+
private pending;
|
|
11
|
+
private readonly proc;
|
|
12
|
+
private readonly rl;
|
|
13
|
+
private closed;
|
|
14
|
+
constructor(proc: ChildProcessWithoutNullStreams);
|
|
15
|
+
private handleLine;
|
|
16
|
+
request(method: string, params: unknown, timeoutMs?: number): Promise<unknown>;
|
|
17
|
+
notify(method: string, params: unknown): void;
|
|
18
|
+
close(): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { spawn } from 'child_process';
|
|
2
|
+
import { createInterface } from 'readline';
|
|
3
|
+
export async function spawnCodexAppServer(binaryPath = 'codex', extraArgs = []) {
|
|
4
|
+
const proc = spawn(binaryPath, ['app-server', ...extraArgs], {
|
|
5
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
6
|
+
env: process.env,
|
|
7
|
+
});
|
|
8
|
+
// Surface spawn errors synchronously.
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const onErr = (err) => reject(err);
|
|
11
|
+
proc.once('error', onErr);
|
|
12
|
+
// Give it a microtask to attach before returning.
|
|
13
|
+
setImmediate(() => {
|
|
14
|
+
proc.off('error', onErr);
|
|
15
|
+
resolve(proc);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Minimal JSON-RPC 2.0 client over a line-delimited stdio child process.
|
|
21
|
+
* Drift detector only — not the production driver. Slice #6 ships the driver
|
|
22
|
+
* that reuses this helper's transport contract.
|
|
23
|
+
*/
|
|
24
|
+
export class AppServerClient {
|
|
25
|
+
nextId = 1;
|
|
26
|
+
pending = new Map();
|
|
27
|
+
proc;
|
|
28
|
+
rl;
|
|
29
|
+
closed = false;
|
|
30
|
+
constructor(proc) {
|
|
31
|
+
this.proc = proc;
|
|
32
|
+
this.rl = createInterface({ input: proc.stdout });
|
|
33
|
+
this.rl.on('line', (line) => this.handleLine(line));
|
|
34
|
+
this.proc.stderr.on('data', () => {
|
|
35
|
+
// Surface stderr to help diagnose drift failures in CI.
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
handleLine(line) {
|
|
39
|
+
const trimmed = line.trim();
|
|
40
|
+
if (!trimmed)
|
|
41
|
+
return;
|
|
42
|
+
let parsed;
|
|
43
|
+
try {
|
|
44
|
+
parsed = JSON.parse(trimmed);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (typeof parsed.id === 'number') {
|
|
50
|
+
const resolver = this.pending.get(parsed.id);
|
|
51
|
+
if (resolver) {
|
|
52
|
+
this.pending.delete(parsed.id);
|
|
53
|
+
resolver(parsed);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
request(method, params, timeoutMs = 10_000) {
|
|
58
|
+
if (this.closed)
|
|
59
|
+
throw new Error('AppServerClient closed');
|
|
60
|
+
const id = this.nextId++;
|
|
61
|
+
const payload = JSON.stringify({ jsonrpc: '2.0', id, method, params });
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
const timer = setTimeout(() => {
|
|
64
|
+
this.pending.delete(id);
|
|
65
|
+
reject(new Error(`codex app-server request '${method}' timed out after ${timeoutMs}ms`));
|
|
66
|
+
}, timeoutMs);
|
|
67
|
+
this.pending.set(id, (response) => {
|
|
68
|
+
clearTimeout(timer);
|
|
69
|
+
if (response.error) {
|
|
70
|
+
reject(new Error(`codex app-server '${method}' returned error ${response.error.code}: ${response.error.message}`));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
resolve(response.result);
|
|
74
|
+
});
|
|
75
|
+
this.proc.stdin.write(`${payload}\n`);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
notify(method, params) {
|
|
79
|
+
const payload = JSON.stringify({ jsonrpc: '2.0', method, params });
|
|
80
|
+
this.proc.stdin.write(`${payload}\n`);
|
|
81
|
+
}
|
|
82
|
+
async close() {
|
|
83
|
+
if (this.closed)
|
|
84
|
+
return;
|
|
85
|
+
this.closed = true;
|
|
86
|
+
this.rl.close();
|
|
87
|
+
try {
|
|
88
|
+
this.proc.stdin.end();
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// ignore
|
|
92
|
+
}
|
|
93
|
+
const exitPromise = new Promise((resolve) => {
|
|
94
|
+
this.proc.once('exit', () => resolve());
|
|
95
|
+
});
|
|
96
|
+
// Give the process a moment to exit gracefully before killing.
|
|
97
|
+
const killTimer = setTimeout(() => {
|
|
98
|
+
if (!this.proc.killed)
|
|
99
|
+
this.proc.kill('SIGTERM');
|
|
100
|
+
}, 2_000);
|
|
101
|
+
await exitPromise;
|
|
102
|
+
clearTimeout(killTimer);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ProtocolFixtureRunInputs {
|
|
2
|
+
env: Record<string, string | undefined>;
|
|
3
|
+
codexOnPath: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface ProtocolFixtureRunDecision {
|
|
6
|
+
shouldRun: boolean;
|
|
7
|
+
skipReason?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Decide whether the protocol fixture suite should run given the environment.
|
|
11
|
+
* Pure function for easy unit testing; probes live in
|
|
12
|
+
* {@link probeProtocolFixturePreconditions}. The driver only uses the
|
|
13
|
+
* PATH-installed `codex` binary, so the gate no longer checks for the npm
|
|
14
|
+
* package (it is not a dependency post-v0.124 hardening).
|
|
15
|
+
*/
|
|
16
|
+
export declare function decideProtocolFixtureRun(inputs: ProtocolFixtureRunInputs): ProtocolFixtureRunDecision;
|
|
17
|
+
/**
|
|
18
|
+
* Wrap a skip reason in a human-readable message that vitest will print when
|
|
19
|
+
* the suite is skipped. Callers pass this to `describe.skip()` or equivalent.
|
|
20
|
+
*/
|
|
21
|
+
export declare function protocolFixtureSkipMessage(reason: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Live prerequisite probes. Result is consumed by `decideProtocolFixtureRun`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function probeProtocolFixturePreconditions(): ProtocolFixtureRunInputs;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Decide whether the protocol fixture suite should run given the environment.
|
|
4
|
+
* Pure function for easy unit testing; probes live in
|
|
5
|
+
* {@link probeProtocolFixturePreconditions}. The driver only uses the
|
|
6
|
+
* PATH-installed `codex` binary, so the gate no longer checks for the npm
|
|
7
|
+
* package (it is not a dependency post-v0.124 hardening).
|
|
8
|
+
*/
|
|
9
|
+
export function decideProtocolFixtureRun(inputs) {
|
|
10
|
+
if (inputs.env.PATHGRADE_RUN_PROTOCOL_FIXTURES !== '1') {
|
|
11
|
+
return {
|
|
12
|
+
shouldRun: false,
|
|
13
|
+
skipReason: 'PATHGRADE_RUN_PROTOCOL_FIXTURES is not set to "1"; local `npm test` stays fast',
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (!inputs.codexOnPath) {
|
|
17
|
+
return {
|
|
18
|
+
shouldRun: false,
|
|
19
|
+
skipReason: 'codex binary not found on PATH',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return { shouldRun: true };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Wrap a skip reason in a human-readable message that vitest will print when
|
|
26
|
+
* the suite is skipped. Callers pass this to `describe.skip()` or equivalent.
|
|
27
|
+
*/
|
|
28
|
+
export function protocolFixtureSkipMessage(reason) {
|
|
29
|
+
return `codex app-server protocol fixture suite skipped: ${reason}`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Live prerequisite probes. Result is consumed by `decideProtocolFixtureRun`.
|
|
33
|
+
*/
|
|
34
|
+
export function probeProtocolFixturePreconditions() {
|
|
35
|
+
const codexOnPath = (() => {
|
|
36
|
+
try {
|
|
37
|
+
execSync('command -v codex', { stdio: 'ignore' });
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
})();
|
|
44
|
+
return {
|
|
45
|
+
env: process.env,
|
|
46
|
+
codexOnPath,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 8 client-request methods the pathgrade driver may send to the Codex
|
|
3
|
+
* app-server. Scoped to this driver's surface rather than the full upstream
|
|
4
|
+
* protocol; phantom response-shaped entries are deliberately excluded because
|
|
5
|
+
* JSON-RPC responses to server-initiated requests flow through
|
|
6
|
+
* `transport.sendResponse(req.id, …)`, not through this union.
|
|
7
|
+
*
|
|
8
|
+
* - initialize
|
|
9
|
+
* - thread/start
|
|
10
|
+
* - turn/start
|
|
11
|
+
* - turn/interrupt
|
|
12
|
+
* - thread/inject_items
|
|
13
|
+
* - thread/read
|
|
14
|
+
* - thread/list
|
|
15
|
+
* - review/start
|
|
16
|
+
*/
|
|
17
|
+
export type ClientRequestMethod = 'initialize' | 'thread/start' | 'turn/start' | 'turn/interrupt' | 'thread/inject_items' | 'thread/read' | 'thread/list' | 'review/start';
|
|
18
|
+
/**
|
|
19
|
+
* JSON-RPC 2.0 client→server request envelope the driver constructs.
|
|
20
|
+
* Generic over the params type for the chosen method.
|
|
21
|
+
*/
|
|
22
|
+
export interface ClientRequest<TParams> {
|
|
23
|
+
jsonrpc: '2.0';
|
|
24
|
+
id: number | string;
|
|
25
|
+
method: ClientRequestMethod;
|
|
26
|
+
params: TParams;
|
|
27
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Pathgrade-local composition; not a single upstream file.
|
|
2
|
+
// Upstream ships the discriminated union at
|
|
3
|
+
// `codex-rs/app-server-protocol/schema/typescript/ClientRequest.ts`
|
|
4
|
+
// (top-level, NOT `typescript/v2/`). This module enumerates the subset of
|
|
5
|
+
// method names the pathgrade Codex app-server driver actually sends. Refresh
|
|
6
|
+
// from openai/codex@rust-v0.124.0 when bumping the vendored version.
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Vendored from openai/codex@rust-v0.124.0
|
|
2
|
+
// Source: codex-rs/app-server-protocol/schema/typescript/v2/GrantedPermissionProfile.ts
|
|
3
|
+
// GENERATED CODE in upstream; do not modify locally either.
|
|
4
|
+
//
|
|
5
|
+
// `AdditionalFileSystemPermissions` and `AdditionalNetworkPermissions` are modelled as
|
|
6
|
+
// opaque aliases until the driver needs to destructure them.
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type JsonValue = unknown;
|
|
2
|
+
export type McpElicitationSchema = unknown;
|
|
3
|
+
export type McpElicitationRequestParams = {
|
|
4
|
+
threadId: string;
|
|
5
|
+
/**
|
|
6
|
+
* Active Codex turn when this elicitation was observed, if app-server could
|
|
7
|
+
* correlate one. Nullable because MCP models elicitation as a standalone
|
|
8
|
+
* server-to-client request identified by the MCP server request id.
|
|
9
|
+
*/
|
|
10
|
+
turnId: string | null;
|
|
11
|
+
serverName: string;
|
|
12
|
+
} & ({
|
|
13
|
+
mode: 'form';
|
|
14
|
+
_meta: JsonValue | null;
|
|
15
|
+
message: string;
|
|
16
|
+
requestedSchema: McpElicitationSchema;
|
|
17
|
+
} | {
|
|
18
|
+
mode: 'url';
|
|
19
|
+
_meta: JsonValue | null;
|
|
20
|
+
message: string;
|
|
21
|
+
url: string;
|
|
22
|
+
elicitationId: string;
|
|
23
|
+
});
|