@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,244 @@
|
|
|
1
|
+
function isAskUserReaction(reaction) {
|
|
2
|
+
return 'whenAsked' in reaction;
|
|
3
|
+
}
|
|
4
|
+
function isTextReaction(reaction) {
|
|
5
|
+
return 'when' in reaction;
|
|
6
|
+
}
|
|
7
|
+
function toAskUserQuestion(q) {
|
|
8
|
+
return {
|
|
9
|
+
id: q.id,
|
|
10
|
+
header: q.header,
|
|
11
|
+
question: q.question,
|
|
12
|
+
isOther: q.isOther,
|
|
13
|
+
isSecret: q.isSecret,
|
|
14
|
+
options: q.options === null ? null : q.options.map((o) => ({ ...o })),
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function testRegExp(rx, input) {
|
|
18
|
+
const previousLastIndex = rx.lastIndex;
|
|
19
|
+
try {
|
|
20
|
+
rx.lastIndex = 0;
|
|
21
|
+
return rx.test(input);
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
rx.lastIndex = previousLastIndex;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function matchesWhenAsked(reaction, question) {
|
|
28
|
+
if (reaction.whenAsked instanceof RegExp) {
|
|
29
|
+
return testRegExp(reaction.whenAsked, question.question);
|
|
30
|
+
}
|
|
31
|
+
return reaction.whenAsked(question);
|
|
32
|
+
}
|
|
33
|
+
function matchesTextReaction(reaction, question) {
|
|
34
|
+
if (!testRegExp(reaction.when, question.question))
|
|
35
|
+
return false;
|
|
36
|
+
return reaction.unless ? !testRegExp(reaction.unless, question.question) : true;
|
|
37
|
+
}
|
|
38
|
+
function normalizeAnswer(raw) {
|
|
39
|
+
if (raw === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
if (typeof raw === 'string')
|
|
42
|
+
return [raw];
|
|
43
|
+
return [...raw];
|
|
44
|
+
}
|
|
45
|
+
function callReactionAnswer(reaction, question) {
|
|
46
|
+
if (typeof reaction.answer === 'function') {
|
|
47
|
+
// Authoring-bug throws propagate intentionally.
|
|
48
|
+
const raw = reaction.answer(question);
|
|
49
|
+
return normalizeAnswer(raw);
|
|
50
|
+
}
|
|
51
|
+
return normalizeAnswer(reaction.answer);
|
|
52
|
+
}
|
|
53
|
+
function tryReactionsForQuestion(question, reactions, firedOnce, shadowedByQuestion) {
|
|
54
|
+
let primary;
|
|
55
|
+
for (let reactionIndex = 0; reactionIndex < reactions.length; reactionIndex++) {
|
|
56
|
+
const reaction = reactions[reactionIndex];
|
|
57
|
+
if (!isAskUserReaction(reaction))
|
|
58
|
+
continue;
|
|
59
|
+
if (reaction.once && firedOnce.has(reactionIndex))
|
|
60
|
+
continue;
|
|
61
|
+
if (!matchesWhenAsked(reaction, question))
|
|
62
|
+
continue;
|
|
63
|
+
const values = callReactionAnswer(reaction, question);
|
|
64
|
+
if (values === undefined)
|
|
65
|
+
continue;
|
|
66
|
+
if (!primary) {
|
|
67
|
+
primary = { reactionIndex, values };
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
let set = shadowedByQuestion.get(question.id);
|
|
71
|
+
if (!set) {
|
|
72
|
+
set = new Set();
|
|
73
|
+
shadowedByQuestion.set(question.id, set);
|
|
74
|
+
}
|
|
75
|
+
set.add(reactionIndex);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return primary;
|
|
79
|
+
}
|
|
80
|
+
function tryLegacyTextReactionsForQuestion(question, reactions, firedOnce, shadowedByQuestion) {
|
|
81
|
+
let primary;
|
|
82
|
+
for (let reactionIndex = 0; reactionIndex < reactions.length; reactionIndex++) {
|
|
83
|
+
const reaction = reactions[reactionIndex];
|
|
84
|
+
if (!isTextReaction(reaction))
|
|
85
|
+
continue;
|
|
86
|
+
if (reaction.once && firedOnce.has(reactionIndex))
|
|
87
|
+
continue;
|
|
88
|
+
if (!matchesTextReaction(reaction, question))
|
|
89
|
+
continue;
|
|
90
|
+
if (!primary) {
|
|
91
|
+
primary = { reactionIndex, values: [reaction.reply] };
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
let set = shadowedByQuestion.get(question.id);
|
|
95
|
+
if (!set) {
|
|
96
|
+
set = new Set();
|
|
97
|
+
shadowedByQuestion.set(question.id, set);
|
|
98
|
+
}
|
|
99
|
+
set.add(reactionIndex);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return primary;
|
|
103
|
+
}
|
|
104
|
+
function applyFallback(question, disposition) {
|
|
105
|
+
if (disposition === 'decline') {
|
|
106
|
+
return {
|
|
107
|
+
answer: { questionId: question.id, values: [], source: 'declined' },
|
|
108
|
+
unmatched: false,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (disposition === 'first-option') {
|
|
112
|
+
if (question.isSecret) {
|
|
113
|
+
return {
|
|
114
|
+
answer: { questionId: question.id, values: [], source: 'declined' },
|
|
115
|
+
unmatched: true,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (question.options && question.options.length > 0) {
|
|
119
|
+
return {
|
|
120
|
+
answer: {
|
|
121
|
+
questionId: question.id,
|
|
122
|
+
values: [question.options[0].label],
|
|
123
|
+
source: 'fallback',
|
|
124
|
+
},
|
|
125
|
+
unmatched: false,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
// No options — degrades to 'error'.
|
|
129
|
+
return {
|
|
130
|
+
answer: { questionId: question.id, values: [], source: 'declined' },
|
|
131
|
+
unmatched: true,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
// 'error' — respond declined so the handle resolves; caller ends the turn.
|
|
135
|
+
return {
|
|
136
|
+
answer: { questionId: question.id, values: [], source: 'declined' },
|
|
137
|
+
unmatched: true,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export function createAskUserHandler(ctx) {
|
|
141
|
+
const previewByBatch = new Map();
|
|
142
|
+
let unmatchedError = null;
|
|
143
|
+
const buildPreviewEntries = (batch, firedReactionIndexes, shadowedIndexes, resolvedAnswersByReaction) => {
|
|
144
|
+
const entries = [];
|
|
145
|
+
for (let reactionIndex = 0; reactionIndex < ctx.reactions.length; reactionIndex++) {
|
|
146
|
+
const reaction = ctx.reactions[reactionIndex];
|
|
147
|
+
if (!isAskUserReaction(reaction))
|
|
148
|
+
continue;
|
|
149
|
+
const fired = firedReactionIndexes.has(reactionIndex);
|
|
150
|
+
const shadowed = shadowedIndexes.has(reactionIndex);
|
|
151
|
+
const whenAskedMatched = fired || shadowed
|
|
152
|
+
|| batch.questions.some((q) => matchesWhenAsked(reaction, toAskUserQuestion(q)));
|
|
153
|
+
let status;
|
|
154
|
+
if (fired)
|
|
155
|
+
status = 'fired';
|
|
156
|
+
else if (shadowed)
|
|
157
|
+
status = 'shadowed';
|
|
158
|
+
else
|
|
159
|
+
status = 'no-match';
|
|
160
|
+
const entry = {
|
|
161
|
+
kind: 'ask_user',
|
|
162
|
+
reactionIndex,
|
|
163
|
+
whenAskedMatched,
|
|
164
|
+
fired,
|
|
165
|
+
status,
|
|
166
|
+
};
|
|
167
|
+
if (fired) {
|
|
168
|
+
const values = resolvedAnswersByReaction.get(reactionIndex);
|
|
169
|
+
if (values !== undefined)
|
|
170
|
+
entry.resolvedAnswers = [...values];
|
|
171
|
+
}
|
|
172
|
+
entries.push(entry);
|
|
173
|
+
}
|
|
174
|
+
return entries;
|
|
175
|
+
};
|
|
176
|
+
const handler = (batch, respond) => {
|
|
177
|
+
const answers = [];
|
|
178
|
+
const firedReactionIndexes = new Set();
|
|
179
|
+
const shadowedByQuestion = new Map();
|
|
180
|
+
const resolvedAnswersByReaction = new Map();
|
|
181
|
+
const firedOnceThisBatch = new Set();
|
|
182
|
+
let anyUnmatched = false;
|
|
183
|
+
for (const rawQuestion of batch.questions) {
|
|
184
|
+
const question = toAskUserQuestion(rawQuestion);
|
|
185
|
+
const currentFired = new Set(ctx.firedOnce);
|
|
186
|
+
for (const idx of firedOnceThisBatch)
|
|
187
|
+
currentFired.add(idx);
|
|
188
|
+
const reactionHit = tryReactionsForQuestion(question, ctx.reactions, currentFired, shadowedByQuestion) ?? tryLegacyTextReactionsForQuestion(question, ctx.reactions, currentFired, shadowedByQuestion);
|
|
189
|
+
if (reactionHit) {
|
|
190
|
+
answers.push({
|
|
191
|
+
questionId: question.id,
|
|
192
|
+
values: reactionHit.values,
|
|
193
|
+
source: 'reaction',
|
|
194
|
+
});
|
|
195
|
+
firedReactionIndexes.add(reactionHit.reactionIndex);
|
|
196
|
+
resolvedAnswersByReaction.set(reactionHit.reactionIndex, reactionHit.values);
|
|
197
|
+
const reaction = ctx.reactions[reactionHit.reactionIndex];
|
|
198
|
+
if (reaction.once) {
|
|
199
|
+
firedOnceThisBatch.add(reactionHit.reactionIndex);
|
|
200
|
+
}
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
const fallback = applyFallback(question, ctx.onUnmatchedAskUser);
|
|
204
|
+
answers.push(fallback.answer);
|
|
205
|
+
if (fallback.unmatched)
|
|
206
|
+
anyUnmatched = true;
|
|
207
|
+
}
|
|
208
|
+
// Commit once-retirement after batch completes (global across conversation).
|
|
209
|
+
for (const idx of firedOnceThisBatch)
|
|
210
|
+
ctx.firedOnce.add(idx);
|
|
211
|
+
const shadowedIndexes = new Set();
|
|
212
|
+
for (const set of shadowedByQuestion.values()) {
|
|
213
|
+
for (const idx of set)
|
|
214
|
+
shadowedIndexes.add(idx);
|
|
215
|
+
}
|
|
216
|
+
previewByBatch.set(batch.batchId, buildPreviewEntries(batch, firedReactionIndexes, shadowedIndexes, resolvedAnswersByReaction));
|
|
217
|
+
if (batch.lifecycle === 'post-hoc') {
|
|
218
|
+
// Observability only — bus drops any respond() call at the wire.
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
const resolution = { answers };
|
|
222
|
+
respond(resolution);
|
|
223
|
+
if (anyUnmatched && ctx.onUnmatchedAskUser === 'error') {
|
|
224
|
+
unmatchedError = {
|
|
225
|
+
batchId: batch.batchId,
|
|
226
|
+
turnNumber: batch.turnNumber,
|
|
227
|
+
questionTexts: batch.questions.map((q) => q.question),
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
else if (anyUnmatched && ctx.onUnmatchedAskUser === 'first-option') {
|
|
231
|
+
// 'first-option' falls through to 'error' when no options / isSecret.
|
|
232
|
+
unmatchedError = {
|
|
233
|
+
batchId: batch.batchId,
|
|
234
|
+
turnNumber: batch.turnNumber,
|
|
235
|
+
questionTexts: batch.questions.map((q) => q.question),
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
return {
|
|
240
|
+
handler,
|
|
241
|
+
previewByBatch,
|
|
242
|
+
getUnmatchedError: () => unmatchedError,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AskBatch } from './types.js';
|
|
2
|
+
import type { ToolRequestUserInputParams } from '../../agents/codex-app-server/protocol/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parse Codex `ToolRequestUserInputParams` (the `item/tool/requestUserInput`
|
|
5
|
+
* server-request params) into a normalized `AskBatch` with
|
|
6
|
+
* `lifecycle: 'live'`. Used by the Codex `app-server` driver (slice #6) and by
|
|
7
|
+
* the adapter-layer parity test (slice #9).
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildAskBatchFromCodexRequestUserInput(params: ToolRequestUserInputParams, turnNumber: number): AskBatch;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse Codex `ToolRequestUserInputParams` (the `item/tool/requestUserInput`
|
|
3
|
+
* server-request params) into a normalized `AskBatch` with
|
|
4
|
+
* `lifecycle: 'live'`. Used by the Codex `app-server` driver (slice #6) and by
|
|
5
|
+
* the adapter-layer parity test (slice #9).
|
|
6
|
+
*/
|
|
7
|
+
export function buildAskBatchFromCodexRequestUserInput(params, turnNumber) {
|
|
8
|
+
const questions = params.questions.map((q) => ({
|
|
9
|
+
id: q.id,
|
|
10
|
+
...(q.header ? { header: q.header } : {}),
|
|
11
|
+
question: q.question,
|
|
12
|
+
options: q.options === null
|
|
13
|
+
? null
|
|
14
|
+
: q.options.map((o) => ({
|
|
15
|
+
label: o.label,
|
|
16
|
+
...(o.description ? { description: o.description } : {}),
|
|
17
|
+
})),
|
|
18
|
+
isOther: q.isOther,
|
|
19
|
+
isSecret: q.isSecret,
|
|
20
|
+
}));
|
|
21
|
+
return {
|
|
22
|
+
batchId: params.itemId,
|
|
23
|
+
turnNumber,
|
|
24
|
+
source: 'codex-app-server',
|
|
25
|
+
lifecycle: 'live',
|
|
26
|
+
sourceTool: 'request_user_input',
|
|
27
|
+
toolUseId: params.itemId,
|
|
28
|
+
questions,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ToolEvent } from '../../tool-events.js';
|
|
2
|
+
import type { AskAnswerSource, AskBatchSnapshot } from './types.js';
|
|
3
|
+
export interface AskUserToolEventQuestionArgument {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly header?: string;
|
|
6
|
+
readonly question: string;
|
|
7
|
+
readonly isOther: boolean;
|
|
8
|
+
readonly isSecret: boolean;
|
|
9
|
+
readonly options: ReadonlyArray<{
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
}> | null;
|
|
13
|
+
readonly answer?: {
|
|
14
|
+
readonly values: readonly string[];
|
|
15
|
+
readonly source: AskAnswerSource;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface AskUserToolEventArguments {
|
|
19
|
+
readonly batchId: string;
|
|
20
|
+
readonly questions: readonly AskUserToolEventQuestionArgument[];
|
|
21
|
+
}
|
|
22
|
+
export type AskUserToolEvent = Omit<ToolEvent, 'action' | 'arguments'> & {
|
|
23
|
+
readonly action: 'ask_user';
|
|
24
|
+
readonly arguments: AskUserToolEventArguments;
|
|
25
|
+
};
|
|
26
|
+
export declare function toAskUserToolEvent(snapshot: AskBatchSnapshot): AskUserToolEvent;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { buildSummary } from '../../tool-events.js';
|
|
2
|
+
function providerFromSource(source) {
|
|
3
|
+
if (source === 'codex-app-server')
|
|
4
|
+
return 'codex';
|
|
5
|
+
return source;
|
|
6
|
+
}
|
|
7
|
+
export function toAskUserToolEvent(snapshot) {
|
|
8
|
+
const answersById = new Map();
|
|
9
|
+
if (snapshot.resolution) {
|
|
10
|
+
for (const a of snapshot.resolution.answers) {
|
|
11
|
+
answersById.set(a.questionId, { values: a.values, source: a.source });
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const questions = snapshot.questions.map((q) => {
|
|
15
|
+
const answer = answersById.get(q.id);
|
|
16
|
+
return {
|
|
17
|
+
id: q.id,
|
|
18
|
+
...(q.header ? { header: q.header } : {}),
|
|
19
|
+
question: q.question,
|
|
20
|
+
isOther: q.isOther,
|
|
21
|
+
isSecret: q.isSecret,
|
|
22
|
+
options: q.options === null
|
|
23
|
+
? null
|
|
24
|
+
: q.options.map((o) => ({
|
|
25
|
+
label: o.label,
|
|
26
|
+
...(o.description ? { description: o.description } : {}),
|
|
27
|
+
})),
|
|
28
|
+
...(answer ? { answer: { values: [...answer.values], source: answer.source } } : {}),
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
const args = {
|
|
32
|
+
batchId: snapshot.batchId,
|
|
33
|
+
questions,
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
action: 'ask_user',
|
|
37
|
+
provider: providerFromSource(snapshot.source),
|
|
38
|
+
providerToolName: snapshot.sourceTool,
|
|
39
|
+
turnNumber: snapshot.turnNumber,
|
|
40
|
+
arguments: args,
|
|
41
|
+
summary: buildSummary('ask_user', snapshot.sourceTool, args),
|
|
42
|
+
confidence: 'high',
|
|
43
|
+
rawSnippet: '',
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export type AskSource = 'claude' | 'codex-app-server' | 'cursor';
|
|
2
|
+
/**
|
|
3
|
+
* Lifecycle of a question batch — determines whether answers flow back and when.
|
|
4
|
+
*
|
|
5
|
+
* - 'live' — mid-turn, synchronous. Driver MUST await resolution before
|
|
6
|
+
* proceeding (Codex app-server ToolRequestUserInput).
|
|
7
|
+
* - 'post-hoc' — the agent already moved past this question by the time
|
|
8
|
+
* pathgrade saw it. Observable but unresolvable (Claude denial;
|
|
9
|
+
* Cursor v1). Codex exec simply doesn't emit; no dedicated tag.
|
|
10
|
+
*/
|
|
11
|
+
export type AskLifecycle = 'live' | 'post-hoc';
|
|
12
|
+
export interface AskOption {
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly description?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AskQuestion {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly header?: string;
|
|
19
|
+
readonly question: string;
|
|
20
|
+
readonly options: readonly AskOption[] | null;
|
|
21
|
+
readonly isOther: boolean;
|
|
22
|
+
readonly isSecret: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface AskBatch {
|
|
25
|
+
readonly batchId: string;
|
|
26
|
+
readonly turnNumber: number;
|
|
27
|
+
readonly source: AskSource;
|
|
28
|
+
readonly lifecycle: AskLifecycle;
|
|
29
|
+
readonly sourceTool: string;
|
|
30
|
+
readonly toolUseId?: string;
|
|
31
|
+
readonly questions: readonly AskQuestion[];
|
|
32
|
+
}
|
|
33
|
+
export type AskAnswerSource = 'reaction' | 'fallback' | 'declined';
|
|
34
|
+
export interface AskAnswer {
|
|
35
|
+
readonly questionId: string;
|
|
36
|
+
readonly values: readonly string[];
|
|
37
|
+
readonly source: AskAnswerSource;
|
|
38
|
+
}
|
|
39
|
+
export interface AskResolution {
|
|
40
|
+
readonly answers: readonly AskAnswer[];
|
|
41
|
+
}
|
|
42
|
+
export interface AskAnswerSnapshot {
|
|
43
|
+
readonly questionId: string;
|
|
44
|
+
/** isSecret answers with source='reaction' or 'fallback' appear here as ['<redacted>']. */
|
|
45
|
+
readonly values: readonly string[];
|
|
46
|
+
readonly source: AskAnswerSource;
|
|
47
|
+
}
|
|
48
|
+
export interface AskResolutionSnapshot {
|
|
49
|
+
readonly answers: readonly AskAnswerSnapshot[];
|
|
50
|
+
}
|
|
51
|
+
export interface AskBatchSnapshot extends AskBatch {
|
|
52
|
+
readonly resolution: AskResolutionSnapshot | null;
|
|
53
|
+
}
|
|
54
|
+
export type AskHandler = (batch: AskBatch, respond: (resolution: AskResolution) => void) => void;
|
|
55
|
+
export type Unsubscribe = () => void;
|
|
56
|
+
export interface AskHandle {
|
|
57
|
+
readonly batchId: string;
|
|
58
|
+
/**
|
|
59
|
+
* Resolves to the resolution the first subscriber provided, or null for
|
|
60
|
+
* post-hoc batches. Always resolves — never pending forever.
|
|
61
|
+
* Timeout-bounded for 'live' lifecycle.
|
|
62
|
+
*/
|
|
63
|
+
readonly resolution: Promise<AskResolution | null>;
|
|
64
|
+
}
|
|
65
|
+
export interface AskBus {
|
|
66
|
+
emit(batch: AskBatch): AskHandle;
|
|
67
|
+
onAsk(handler: AskHandler): Unsubscribe;
|
|
68
|
+
snapshot(turnNumber?: number): readonly AskBatchSnapshot[];
|
|
69
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AgentTurnResult, CommandResult, LogEntry } from '../types.js';
|
|
2
|
+
import type { ChatSession, Message } from './types.js';
|
|
3
|
+
import type { VerboseEmitter } from '../reporters/verbose-emitter.js';
|
|
4
|
+
export interface ChatSessionDeps {
|
|
5
|
+
/** Mutable reference to the trial's messages array */
|
|
6
|
+
messages: Message[];
|
|
7
|
+
/** Mutable reference to the trial's log array */
|
|
8
|
+
log: LogEntry[];
|
|
9
|
+
/** Run a command in the trial workspace */
|
|
10
|
+
exec: (cmd: string) => Promise<CommandResult>;
|
|
11
|
+
/** Send a reply to the agent with per-turn timeout handling */
|
|
12
|
+
sendTurn: (message: string) => Promise<AgentTurnResult>;
|
|
13
|
+
/** Verbose event sink (no-op when disabled) */
|
|
14
|
+
verbose?: VerboseEmitter;
|
|
15
|
+
}
|
|
16
|
+
export declare class ChatSessionImpl implements ChatSession {
|
|
17
|
+
private _turn;
|
|
18
|
+
private _done;
|
|
19
|
+
private _lastMessage;
|
|
20
|
+
private deps;
|
|
21
|
+
constructor(firstTurnResult: AgentTurnResult, deps: ChatSessionDeps);
|
|
22
|
+
get turn(): number;
|
|
23
|
+
get done(): boolean;
|
|
24
|
+
get lastMessage(): string;
|
|
25
|
+
get messages(): Message[];
|
|
26
|
+
reply(message: string): Promise<void>;
|
|
27
|
+
hasFile(pattern: string): Promise<boolean>;
|
|
28
|
+
end(): void;
|
|
29
|
+
}
|
package/dist/sdk/chat.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { buildModelAgentResultLogEntry } from './agent-result-log.js';
|
|
2
|
+
import { getVisibleAssistantMessage } from './visible-turn.js';
|
|
3
|
+
export class ChatSessionImpl {
|
|
4
|
+
_turn;
|
|
5
|
+
_done = false;
|
|
6
|
+
_lastMessage;
|
|
7
|
+
deps;
|
|
8
|
+
constructor(firstTurnResult, deps) {
|
|
9
|
+
this._turn = 1;
|
|
10
|
+
this._lastMessage = getVisibleAssistantMessage(firstTurnResult);
|
|
11
|
+
this.deps = deps;
|
|
12
|
+
}
|
|
13
|
+
get turn() {
|
|
14
|
+
return this._turn;
|
|
15
|
+
}
|
|
16
|
+
get done() {
|
|
17
|
+
return this._done;
|
|
18
|
+
}
|
|
19
|
+
get lastMessage() {
|
|
20
|
+
return this._lastMessage;
|
|
21
|
+
}
|
|
22
|
+
get messages() {
|
|
23
|
+
return this.deps.messages;
|
|
24
|
+
}
|
|
25
|
+
async reply(message) {
|
|
26
|
+
if (this._done) {
|
|
27
|
+
throw new Error('Cannot reply() on a done ChatSession');
|
|
28
|
+
}
|
|
29
|
+
const timestamp = () => new Date().toISOString();
|
|
30
|
+
const turnNumber = this._turn + 1;
|
|
31
|
+
this.deps.messages.push({ role: 'user', content: message });
|
|
32
|
+
this.deps.log.push({
|
|
33
|
+
type: 'user_reply',
|
|
34
|
+
timestamp: timestamp(),
|
|
35
|
+
instruction: message,
|
|
36
|
+
turn_number: turnNumber,
|
|
37
|
+
});
|
|
38
|
+
this.deps.verbose?.turnStart({
|
|
39
|
+
turn: turnNumber,
|
|
40
|
+
kind: 'user_reply',
|
|
41
|
+
message: message,
|
|
42
|
+
});
|
|
43
|
+
let turnResult;
|
|
44
|
+
const turnStart = Date.now();
|
|
45
|
+
try {
|
|
46
|
+
turnResult = await this.deps.sendTurn(message);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
this._done = true;
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
const response = getVisibleAssistantMessage(turnResult);
|
|
53
|
+
const durationMs = Date.now() - turnStart;
|
|
54
|
+
this.deps.log.push(buildModelAgentResultLogEntry({
|
|
55
|
+
timestamp: timestamp(),
|
|
56
|
+
turnNumber,
|
|
57
|
+
durationMs,
|
|
58
|
+
turnResult,
|
|
59
|
+
assistantMessage: response,
|
|
60
|
+
}));
|
|
61
|
+
for (const toolEvent of turnResult.toolEvents) {
|
|
62
|
+
this.deps.log.push({
|
|
63
|
+
type: 'tool_event',
|
|
64
|
+
timestamp: timestamp(),
|
|
65
|
+
tool_event: toolEvent,
|
|
66
|
+
});
|
|
67
|
+
this.deps.verbose?.toolEvent({
|
|
68
|
+
action: toolEvent.action,
|
|
69
|
+
summary: toolEvent.summary,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
this.deps.messages.push({ role: 'agent', content: response });
|
|
73
|
+
this.deps.verbose?.turnEnd({
|
|
74
|
+
turn: turnNumber,
|
|
75
|
+
durationMs,
|
|
76
|
+
outputLines: response.split('\n').length,
|
|
77
|
+
messagePreview: response,
|
|
78
|
+
});
|
|
79
|
+
if (turnResult.exitCode !== 0) {
|
|
80
|
+
this._done = true;
|
|
81
|
+
throw new Error(`Agent exited with code ${turnResult.exitCode}`);
|
|
82
|
+
}
|
|
83
|
+
this._turn = turnNumber;
|
|
84
|
+
this._lastMessage = response;
|
|
85
|
+
}
|
|
86
|
+
async hasFile(pattern) {
|
|
87
|
+
const result = await this.deps.exec(`ls -d ${pattern} 2>/dev/null`);
|
|
88
|
+
return result.stdout.trim().length > 0;
|
|
89
|
+
}
|
|
90
|
+
end() {
|
|
91
|
+
this._done = true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { LLMPort } from '../utils/llm-types.js';
|
|
2
|
+
import type { Message } from './types.js';
|
|
3
|
+
export interface ConversationWindowOptions {
|
|
4
|
+
/** Number of recent messages (not turn pairs) to keep verbatim. Default: 4 */
|
|
5
|
+
windowSize?: number;
|
|
6
|
+
/** Model to use for summarization. Default: 'claude-haiku-4-5-20251001' */
|
|
7
|
+
model?: string;
|
|
8
|
+
/** LLM port for summarization calls. */
|
|
9
|
+
llm?: LLMPort;
|
|
10
|
+
}
|
|
11
|
+
export interface ConversationWindow {
|
|
12
|
+
getHistory(messages: Message[]): Promise<string>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createConversationWindow(opts?: ConversationWindowOptions): ConversationWindow;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function createConversationWindow(opts = {}) {
|
|
2
|
+
const windowSize = opts.windowSize ?? 4;
|
|
3
|
+
const model = opts.model ?? 'claude-haiku-4-5-20251001';
|
|
4
|
+
const llm = opts.llm;
|
|
5
|
+
let cachedSummary = null;
|
|
6
|
+
let summarizedUpTo = 0; // number of messages already summarized
|
|
7
|
+
return {
|
|
8
|
+
async getHistory(messages) {
|
|
9
|
+
// If all messages fit within the window, return them verbatim
|
|
10
|
+
if (messages.length <= windowSize) {
|
|
11
|
+
return formatMessages(messages);
|
|
12
|
+
}
|
|
13
|
+
// No LLM — can't summarize, return all messages verbatim
|
|
14
|
+
if (!llm) {
|
|
15
|
+
return formatMessages(messages);
|
|
16
|
+
}
|
|
17
|
+
// Split: older messages get summarized, recent messages stay verbatim
|
|
18
|
+
const cutoff = messages.length - windowSize;
|
|
19
|
+
const olderMessages = messages.slice(0, cutoff);
|
|
20
|
+
const recentMessages = messages.slice(cutoff);
|
|
21
|
+
// Only re-summarize if there are new messages beyond what we've already summarized
|
|
22
|
+
if (cutoff > summarizedUpTo || cachedSummary === null) {
|
|
23
|
+
const toSummarize = cachedSummary
|
|
24
|
+
? `Previous summary: ${cachedSummary}\n\nNew messages:\n${formatMessages(messages.slice(summarizedUpTo, cutoff))}`
|
|
25
|
+
: formatMessages(olderMessages);
|
|
26
|
+
const response = await llm.call(`Summarize this conversation concisely in one paragraph, preserving key facts and decisions:\n\n${toSummarize}`, { model });
|
|
27
|
+
cachedSummary = response.text.trim();
|
|
28
|
+
summarizedUpTo = cutoff;
|
|
29
|
+
}
|
|
30
|
+
return `## Earlier Context (Summary)\n${cachedSummary}\n\n## Recent Conversation\n${formatMessages(recentMessages)}`;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function formatMessages(messages) {
|
|
35
|
+
return messages
|
|
36
|
+
.map(m => `${m.role === 'user' ? 'User' : 'Agent'}: ${m.content}`)
|
|
37
|
+
.join('\n\n');
|
|
38
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AgentTurnResult, LogEntry } from '../types.js';
|
|
2
|
+
import type { AgentName, AgentTransport, ConversationResult, ConverseOptions, EvalResult, Scorer, Message } from './types.js';
|
|
3
|
+
import type { VerboseEmitter } from '../reporters/verbose-emitter.js';
|
|
4
|
+
import type { AskBus } from './ask-bus/types.js';
|
|
5
|
+
export interface ConversationDeps {
|
|
6
|
+
/** Send a message to the agent, returns response string. Throws on failure. */
|
|
7
|
+
sendTurn: (message: string) => Promise<string | AgentTurnResult>;
|
|
8
|
+
/** Check file existence in workspace */
|
|
9
|
+
hasFile: (pattern: string) => Promise<boolean>;
|
|
10
|
+
/** Workspace path */
|
|
11
|
+
workspace: string;
|
|
12
|
+
/** Mutable messages array — runner appends user/agent entries */
|
|
13
|
+
messages: Message[];
|
|
14
|
+
/** Mutable log array */
|
|
15
|
+
log: LogEntry[];
|
|
16
|
+
/** Generate persona reply when no reaction matches */
|
|
17
|
+
personaReply?: () => Promise<string>;
|
|
18
|
+
/** Run step scorers */
|
|
19
|
+
runStepScorers?: (scorers: Scorer[]) => Promise<EvalResult>;
|
|
20
|
+
/** Verbose event sink (no-op when disabled) */
|
|
21
|
+
verbose?: VerboseEmitter;
|
|
22
|
+
/** Per-conversation ask-user bus. When omitted, ask_user reactions never fire. */
|
|
23
|
+
askBus?: AskBus;
|
|
24
|
+
/**
|
|
25
|
+
* Resolved agent name. Surfaced for transport-aware preflight checks.
|
|
26
|
+
*/
|
|
27
|
+
agentName?: AgentName;
|
|
28
|
+
/**
|
|
29
|
+
* Resolved transport (codex only). When `'exec'`, a preflight guard fails
|
|
30
|
+
* fast at conversation start if any `AskUserReaction` is present without
|
|
31
|
+
* `allowUnreachableReactions: true`.
|
|
32
|
+
*/
|
|
33
|
+
transport?: AgentTransport;
|
|
34
|
+
/**
|
|
35
|
+
* Per-turn timeout in seconds. Used to format the agent-timeout error
|
|
36
|
+
* message thrown after `pushModelAgentMessage` records the partial turn.
|
|
37
|
+
* Optional for callers that supply their own thrown errors via `sendTurn`.
|
|
38
|
+
*/
|
|
39
|
+
agentTimeoutSec?: number;
|
|
40
|
+
}
|
|
41
|
+
export declare function runConversation(opts: ConverseOptions, deps: ConversationDeps): Promise<ConversationResult>;
|
|
42
|
+
export { previewReactions } from './reaction-preview.js';
|