dominds 1.25.15 → 1.25.17
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/cli/create.d.ts +1 -1
- package/dist/cli/create.js +2 -2
- package/dist/cli/disable.d.ts +1 -1
- package/dist/cli/disable.js +2 -2
- package/dist/cli/doctor.d.ts +1 -1
- package/dist/cli/doctor.js +2 -2
- package/dist/cli/enable.d.ts +1 -1
- package/dist/cli/enable.js +2 -2
- package/dist/cli/install.d.ts +1 -1
- package/dist/cli/install.js +2 -2
- package/dist/cli/manual.d.ts +1 -1
- package/dist/cli/manual.js +2 -2
- package/dist/cli/read.d.ts +1 -1
- package/dist/cli/read.js +1 -2
- package/dist/cli/tui.d.ts +1 -1
- package/dist/cli/tui.js +2 -2
- package/dist/cli/uninstall.d.ts +1 -1
- package/dist/cli/uninstall.js +2 -2
- package/dist/cli/update.d.ts +1 -1
- package/dist/cli/update.js +2 -2
- package/dist/cli/validate-team-def.d.ts +1 -1
- package/dist/cli/validate-team-def.js +2 -2
- package/dist/cli/webui.d.ts +1 -1
- package/dist/cli/webui.js +1 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +14 -20
- package/dist/llm/kernel-driver/drive.js +70 -31
- package/dist/llm/kernel-driver/flow.js +142 -40
- package/dist/llm/kernel-driver/reply-guidance.d.ts +2 -1
- package/dist/llm/kernel-driver/reply-guidance.js +11 -6
- package/dist/llm/kernel-driver/types.d.ts +2 -1
- package/dist/persistence.js +168 -79
- package/dist/runtime/driver-messages.js +3 -1
- package/dist/runtime/reply-prompt-copy.js +8 -6
- package/dist/server/dominds-self-update.js +7 -5
- package/package.json +3 -3
package/dist/cli/create.d.ts
CHANGED
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
* - Template can be a short name (resolved via DOMINDS_TEMPLATE_BASE) or a git URL.
|
|
11
11
|
* - rtws directory is `process.cwd()`. Use 'dominds -C <dir> create ...' to create under another base dir.
|
|
12
12
|
*/
|
|
13
|
-
declare function main(): Promise<void>;
|
|
13
|
+
declare function main(argv?: readonly string[]): Promise<void>;
|
|
14
14
|
export { main };
|
package/dist/cli/create.js
CHANGED
|
@@ -201,9 +201,9 @@ async function runGit(args, cwd) {
|
|
|
201
201
|
const detail = res.signal ? `signal ${res.signal}` : `exit code ${String(res.code)}`;
|
|
202
202
|
throw new Error(`git failed (${detail}): ${res.cmd}`);
|
|
203
203
|
}
|
|
204
|
-
async function main() {
|
|
204
|
+
async function main(argv = process.argv.slice(2)) {
|
|
205
205
|
try {
|
|
206
|
-
const parsed = parseArgs(
|
|
206
|
+
const parsed = parseArgs(argv);
|
|
207
207
|
switch (parsed.kind) {
|
|
208
208
|
case 'help':
|
|
209
209
|
printHelp();
|
package/dist/cli/disable.d.ts
CHANGED
package/dist/cli/disable.js
CHANGED
|
@@ -33,10 +33,10 @@ function parseArgs(argv) {
|
|
|
33
33
|
throw new Error('disable requires exactly one <appId>');
|
|
34
34
|
return { appId: positional[0] };
|
|
35
35
|
}
|
|
36
|
-
async function main() {
|
|
36
|
+
async function main(argv = process.argv.slice(2)) {
|
|
37
37
|
let args;
|
|
38
38
|
try {
|
|
39
|
-
args = parseArgs(
|
|
39
|
+
args = parseArgs(argv);
|
|
40
40
|
}
|
|
41
41
|
catch (err) {
|
|
42
42
|
console.error(err instanceof Error ? err.message : String(err));
|
package/dist/cli/doctor.d.ts
CHANGED
|
@@ -41,5 +41,5 @@ declare function runDoctor(params: {
|
|
|
41
41
|
issues: ReadonlyArray<AppsResolutionIssue>;
|
|
42
42
|
diagnoses: ReadonlyArray<AppDiagnosis>;
|
|
43
43
|
}>;
|
|
44
|
-
declare function main(): Promise<void>;
|
|
44
|
+
declare function main(argv?: readonly string[]): Promise<void>;
|
|
45
45
|
export { main, runDoctor };
|
package/dist/cli/doctor.js
CHANGED
|
@@ -240,10 +240,10 @@ function printDiagnosis(params) {
|
|
|
240
240
|
console.log(` - ${action}`);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
-
async function main() {
|
|
243
|
+
async function main(argv = process.argv.slice(2)) {
|
|
244
244
|
let args;
|
|
245
245
|
try {
|
|
246
|
-
args = parseArgs(
|
|
246
|
+
args = parseArgs(argv);
|
|
247
247
|
}
|
|
248
248
|
catch (err) {
|
|
249
249
|
console.error(err instanceof Error ? err.message : String(err));
|
package/dist/cli/enable.d.ts
CHANGED
package/dist/cli/enable.js
CHANGED
|
@@ -33,10 +33,10 @@ function parseArgs(argv) {
|
|
|
33
33
|
throw new Error('enable requires exactly one <appId>');
|
|
34
34
|
return { appId: positional[0] };
|
|
35
35
|
}
|
|
36
|
-
async function main() {
|
|
36
|
+
async function main(argv = process.argv.slice(2)) {
|
|
37
37
|
let args;
|
|
38
38
|
try {
|
|
39
|
-
args = parseArgs(
|
|
39
|
+
args = parseArgs(argv);
|
|
40
40
|
}
|
|
41
41
|
catch (err) {
|
|
42
42
|
console.error(err instanceof Error ? err.message : String(err));
|
package/dist/cli/install.d.ts
CHANGED
package/dist/cli/install.js
CHANGED
|
@@ -119,11 +119,11 @@ async function resolveInstallSource(params) {
|
|
|
119
119
|
}
|
|
120
120
|
return { kind: 'npx', spec: params.specOrPath };
|
|
121
121
|
}
|
|
122
|
-
async function main() {
|
|
122
|
+
async function main(argv = process.argv.slice(2)) {
|
|
123
123
|
const rtwsRootAbs = process.cwd();
|
|
124
124
|
let args;
|
|
125
125
|
try {
|
|
126
|
-
args = parseArgs(
|
|
126
|
+
args = parseArgs(argv);
|
|
127
127
|
}
|
|
128
128
|
catch (err) {
|
|
129
129
|
console.error(err instanceof Error ? err.message : String(err));
|
package/dist/cli/manual.d.ts
CHANGED
package/dist/cli/manual.js
CHANGED
|
@@ -134,9 +134,9 @@ function listAvailableToolsets() {
|
|
|
134
134
|
}
|
|
135
135
|
console.log(`Available toolsets: ${names.map((name) => `\`${name}\``).join(', ')}`);
|
|
136
136
|
}
|
|
137
|
-
async function main() {
|
|
137
|
+
async function main(argv = process.argv.slice(2)) {
|
|
138
138
|
try {
|
|
139
|
-
const parsed = parseArgs(
|
|
139
|
+
const parsed = parseArgs(argv);
|
|
140
140
|
if (parsed.list || !parsed.toolsetId) {
|
|
141
141
|
listAvailableToolsets();
|
|
142
142
|
return;
|
package/dist/cli/read.d.ts
CHANGED
package/dist/cli/read.js
CHANGED
|
@@ -437,8 +437,7 @@ function resolveTargetMemberIds(team, memberId) {
|
|
|
437
437
|
throw new Error('No team members found.');
|
|
438
438
|
return [fallback.id];
|
|
439
439
|
}
|
|
440
|
-
async function main() {
|
|
441
|
-
const args = process.argv.slice(2);
|
|
440
|
+
async function main(args = process.argv.slice(2)) {
|
|
442
441
|
let parsed;
|
|
443
442
|
try {
|
|
444
443
|
parsed = parseArgs(args);
|
package/dist/cli/tui.d.ts
CHANGED
package/dist/cli/tui.js
CHANGED
|
@@ -166,10 +166,10 @@ function parseArgs(argv) {
|
|
|
166
166
|
}
|
|
167
167
|
return out;
|
|
168
168
|
}
|
|
169
|
-
async function main() {
|
|
169
|
+
async function main(argv = process.argv.slice(2)) {
|
|
170
170
|
try {
|
|
171
171
|
(0, process_title_1.setRtwsProcessTitle)();
|
|
172
|
-
const args = parseArgs(
|
|
172
|
+
const args = parseArgs(argv);
|
|
173
173
|
// Handle version flag
|
|
174
174
|
if (args.version) {
|
|
175
175
|
showVersion();
|
package/dist/cli/uninstall.d.ts
CHANGED
package/dist/cli/uninstall.js
CHANGED
|
@@ -48,10 +48,10 @@ function parseArgs(argv) {
|
|
|
48
48
|
throw new Error('uninstall requires exactly one <appId>');
|
|
49
49
|
return { appId: positional[0], purge };
|
|
50
50
|
}
|
|
51
|
-
async function main() {
|
|
51
|
+
async function main(argv = process.argv.slice(2)) {
|
|
52
52
|
let args;
|
|
53
53
|
try {
|
|
54
|
-
args = parseArgs(
|
|
54
|
+
args = parseArgs(argv);
|
|
55
55
|
}
|
|
56
56
|
catch (err) {
|
|
57
57
|
console.error(err instanceof Error ? err.message : String(err));
|
package/dist/cli/update.d.ts
CHANGED
package/dist/cli/update.js
CHANGED
|
@@ -36,10 +36,10 @@ function parseArgs(argv) {
|
|
|
36
36
|
throw new Error('update accepts at most one <appId>');
|
|
37
37
|
return { appId: positional[0] ?? null };
|
|
38
38
|
}
|
|
39
|
-
async function main() {
|
|
39
|
+
async function main(argv = process.argv.slice(2)) {
|
|
40
40
|
let args;
|
|
41
41
|
try {
|
|
42
|
-
args = parseArgs(
|
|
42
|
+
args = parseArgs(argv);
|
|
43
43
|
}
|
|
44
44
|
catch (err) {
|
|
45
45
|
console.error(err instanceof Error ? err.message : String(err));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export declare function main(): Promise<void>;
|
|
2
|
+
export declare function main(argv?: readonly string[]): Promise<void>;
|
|
@@ -50,10 +50,10 @@ function resolveTargetMemberIds(team, memberId) {
|
|
|
50
50
|
throw new Error('No team members found.');
|
|
51
51
|
return [fallback.id];
|
|
52
52
|
}
|
|
53
|
-
async function main() {
|
|
53
|
+
async function main(argv = process.argv.slice(2)) {
|
|
54
54
|
let parsed;
|
|
55
55
|
try {
|
|
56
|
-
parsed = parseArgs(
|
|
56
|
+
parsed = parseArgs(argv);
|
|
57
57
|
}
|
|
58
58
|
catch (err) {
|
|
59
59
|
console.error('Error:', err instanceof Error ? err.message : String(err));
|
package/dist/cli/webui.d.ts
CHANGED
package/dist/cli/webui.js
CHANGED
|
@@ -63,9 +63,8 @@ function openInBrowser(url) {
|
|
|
63
63
|
}
|
|
64
64
|
(0, child_process_1.spawn)('xdg-open', [url], { stdio: 'ignore', detached: true }).unref();
|
|
65
65
|
}
|
|
66
|
-
async function main() {
|
|
66
|
+
async function main(args = process.argv.slice(2)) {
|
|
67
67
|
(0, process_title_1.setRtwsProcessTitle)();
|
|
68
|
-
const args = process.argv.slice(2);
|
|
69
68
|
let port;
|
|
70
69
|
let host = 'localhost';
|
|
71
70
|
let mode = process.env.NODE_ENV === 'dev' ? 'dev' : 'prod';
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -158,11 +158,11 @@ function printVersion() {
|
|
|
158
158
|
console.log('dominds (version unknown)');
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
async function main() {
|
|
161
|
+
async function main(argv = process.argv.slice(2)) {
|
|
162
162
|
const baseCwd = process.cwd();
|
|
163
163
|
let parsed;
|
|
164
164
|
try {
|
|
165
|
-
parsed = (0, rtws_cli_1.extractGlobalRtwsChdir)({ argv
|
|
165
|
+
parsed = (0, rtws_cli_1.extractGlobalRtwsChdir)({ argv, baseCwd });
|
|
166
166
|
}
|
|
167
167
|
catch (err) {
|
|
168
168
|
console.error('Error:', err instanceof Error ? err.message : String(err));
|
|
@@ -317,52 +317,46 @@ async function main() {
|
|
|
317
317
|
async function runSubcommand(subcommand, args) {
|
|
318
318
|
try {
|
|
319
319
|
(0, process_title_1.setRtwsProcessTitle)();
|
|
320
|
-
// Save original argv
|
|
321
|
-
const originalArgv = process.argv;
|
|
322
|
-
// Set argv to simulate direct execution of the subcommand
|
|
323
|
-
process.argv = ['node', subcommand, ...args];
|
|
324
320
|
if (subcommand === 'webui') {
|
|
325
|
-
await (0, webui_1.main)();
|
|
321
|
+
await (0, webui_1.main)(args);
|
|
326
322
|
}
|
|
327
323
|
else if (subcommand === 'tui') {
|
|
328
|
-
await (0, tui_1.main)();
|
|
324
|
+
await (0, tui_1.main)(args);
|
|
329
325
|
}
|
|
330
326
|
else if (subcommand === 'read') {
|
|
331
|
-
await (0, read_1.main)();
|
|
327
|
+
await (0, read_1.main)(args);
|
|
332
328
|
}
|
|
333
329
|
else if (subcommand === 'manual') {
|
|
334
|
-
await (0, manual_1.main)();
|
|
330
|
+
await (0, manual_1.main)(args);
|
|
335
331
|
}
|
|
336
332
|
else if (subcommand === 'validate_team_def') {
|
|
337
|
-
await (0, validate_team_def_1.main)();
|
|
333
|
+
await (0, validate_team_def_1.main)(args);
|
|
338
334
|
}
|
|
339
335
|
else if (subcommand === 'create') {
|
|
340
|
-
await (0, create_1.main)();
|
|
336
|
+
await (0, create_1.main)(args);
|
|
341
337
|
}
|
|
342
338
|
else if (subcommand === 'install') {
|
|
343
|
-
await (0, install_1.main)();
|
|
339
|
+
await (0, install_1.main)(args);
|
|
344
340
|
}
|
|
345
341
|
else if (subcommand === 'doctor') {
|
|
346
|
-
await (0, doctor_1.main)();
|
|
342
|
+
await (0, doctor_1.main)(args);
|
|
347
343
|
}
|
|
348
344
|
else if (subcommand === 'enable') {
|
|
349
|
-
await (0, enable_1.main)();
|
|
345
|
+
await (0, enable_1.main)(args);
|
|
350
346
|
}
|
|
351
347
|
else if (subcommand === 'disable') {
|
|
352
|
-
await (0, disable_1.main)();
|
|
348
|
+
await (0, disable_1.main)(args);
|
|
353
349
|
}
|
|
354
350
|
else if (subcommand === 'uninstall') {
|
|
355
|
-
await (0, uninstall_1.main)();
|
|
351
|
+
await (0, uninstall_1.main)(args);
|
|
356
352
|
}
|
|
357
353
|
else if (subcommand === 'update') {
|
|
358
|
-
await (0, update_1.main)();
|
|
354
|
+
await (0, update_1.main)(args);
|
|
359
355
|
}
|
|
360
356
|
else {
|
|
361
357
|
console.error(`Error: Subcommand '${subcommand}' not implemented`);
|
|
362
358
|
process.exit(1);
|
|
363
359
|
}
|
|
364
|
-
// Restore original argv
|
|
365
|
-
process.argv = originalArgv;
|
|
366
360
|
}
|
|
367
361
|
catch (err) {
|
|
368
362
|
console.error(`Failed to execute subcommand '${subcommand}':`, err);
|
|
@@ -302,28 +302,28 @@ function getUserOriginPromptMsgId(prompt) {
|
|
|
302
302
|
? prompt.msgId
|
|
303
303
|
: undefined;
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
return
|
|
305
|
+
function samePendingUserInterjectionCoordinate(left, right) {
|
|
306
|
+
return left.msgId === right.msgId && left.course === right.course && left.genseq === right.genseq;
|
|
307
307
|
}
|
|
308
308
|
async function maybeResolveAnsweredUserInterjection(args) {
|
|
309
309
|
if (args.userPromptMsgId === undefined ||
|
|
310
310
|
args.assistantSayingContent === null ||
|
|
311
311
|
args.assistantSayingContent.trim() === '' ||
|
|
312
312
|
args.assistantSayingGenseq === null) {
|
|
313
|
-
return;
|
|
313
|
+
return undefined;
|
|
314
314
|
}
|
|
315
315
|
for (const rawGenseq of args.functionCallGenseqs) {
|
|
316
316
|
if (!Number.isFinite(rawGenseq) || rawGenseq <= 0) {
|
|
317
317
|
continue;
|
|
318
318
|
}
|
|
319
319
|
if (args.assistantSayingGenseq <= Math.floor(rawGenseq)) {
|
|
320
|
-
return;
|
|
320
|
+
return undefined;
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
const latest = await persistence_1.DialogPersistence.loadDialogLatest(args.dlg.id, args.dlg.status);
|
|
324
324
|
const pending = latest?.pendingUserInterjectionReply;
|
|
325
|
-
if (pending === undefined ||
|
|
326
|
-
return;
|
|
325
|
+
if (pending === undefined || pending.msgId !== args.userPromptMsgId) {
|
|
326
|
+
return undefined;
|
|
327
327
|
}
|
|
328
328
|
const course = args.dlg.activeGenCourseOrUndefined ?? args.dlg.currentCourse;
|
|
329
329
|
const answerIdSource = [
|
|
@@ -369,14 +369,18 @@ async function maybeResolveAnsweredUserInterjection(args) {
|
|
|
369
369
|
const userPromptMsgId = args.userPromptMsgId;
|
|
370
370
|
if (previousPending === undefined ||
|
|
371
371
|
userPromptMsgId === undefined ||
|
|
372
|
-
|
|
372
|
+
userPromptMsgId !== pending.msgId ||
|
|
373
|
+
!samePendingUserInterjectionCoordinate(previousPending, pending)) {
|
|
373
374
|
return { kind: 'noop' };
|
|
374
375
|
}
|
|
376
|
+
const next = { ...previous };
|
|
377
|
+
delete next.pendingUserInterjectionReply;
|
|
375
378
|
return {
|
|
376
|
-
kind: '
|
|
377
|
-
|
|
379
|
+
kind: 'replace',
|
|
380
|
+
next,
|
|
378
381
|
};
|
|
379
382
|
}, args.dlg.status);
|
|
383
|
+
return answer;
|
|
380
384
|
}
|
|
381
385
|
async function persistAndEmitRuntimeGuide(dlg, content) {
|
|
382
386
|
await dlg.addChatMessages({
|
|
@@ -2207,6 +2211,9 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
|
|
|
2207
2211
|
let lastFunctionCallGenseq = null;
|
|
2208
2212
|
let lastAssistantReplyTarget;
|
|
2209
2213
|
let lastBusinessContinuation = { kind: 'none' };
|
|
2214
|
+
let answeredUserInterjection;
|
|
2215
|
+
let currentPromptIsUserInterjection = false;
|
|
2216
|
+
let currentUserInterjectionReply;
|
|
2210
2217
|
let fbrConclusion;
|
|
2211
2218
|
let pubRemindersVer = dlg.remindersVer;
|
|
2212
2219
|
let lastToolRoundStopDiagnostics;
|
|
@@ -2455,6 +2462,8 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
|
|
|
2455
2462
|
}
|
|
2456
2463
|
}
|
|
2457
2464
|
lastBusinessContinuation = currentBusinessContinuation;
|
|
2465
|
+
currentPromptIsUserInterjection = false;
|
|
2466
|
+
currentUserInterjectionReply = undefined;
|
|
2458
2467
|
let generationBodyError;
|
|
2459
2468
|
let immediateFollowupTriggerExpectation;
|
|
2460
2469
|
const q4hAnswerCallId = normalizeQ4HAnswerCallId(currentPrompt?.q4hAnswerCallId);
|
|
@@ -2476,9 +2485,10 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
|
|
|
2476
2485
|
language: promptLanguage,
|
|
2477
2486
|
});
|
|
2478
2487
|
const deferredReplyReassertionDirective = replyGuidance.deferredReplyReassertionDirective;
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2488
|
+
currentPromptIsUserInterjection =
|
|
2489
|
+
currentPrompt.origin === 'user' &&
|
|
2490
|
+
replyGuidance.suppressInterDialogReplyGuidance &&
|
|
2491
|
+
deferredReplyReassertionDirective !== undefined;
|
|
2482
2492
|
if (currentPromptIsUserInterjection) {
|
|
2483
2493
|
// WARNING:
|
|
2484
2494
|
// User interjection suppression is a reversible state transition, not a one-shot
|
|
@@ -2490,13 +2500,29 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
|
|
|
2490
2500
|
// Legacy blocked-Continue paths may also re-enter here. A repeated interjection MUST
|
|
2491
2501
|
// re-arm the deferred state and re-materialize the suppression guide, even when the
|
|
2492
2502
|
// underlying reply directive itself did not change.
|
|
2503
|
+
const deferredDirective = deferredReplyReassertionDirective;
|
|
2504
|
+
if (deferredDirective === undefined) {
|
|
2505
|
+
throw new Error(`kernel-driver user interjection invariant violation: missing deferred reply directive for dialog=${dlg.id.valueOf()} msgId=${currentPrompt.msgId}`);
|
|
2506
|
+
}
|
|
2493
2507
|
const existingDeferredReplyReassertion = await persistence_1.DialogPersistence.getDeferredReplyReassertion(dlg.id, dlg.status);
|
|
2508
|
+
currentUserInterjectionReply = {
|
|
2509
|
+
msgId: currentPrompt.msgId,
|
|
2510
|
+
course: (0, storage_1.toDialogCourseNumber)(dlg.activeGenCourseOrUndefined ?? dlg.currentCourse),
|
|
2511
|
+
genseq: (0, storage_1.toCallSiteGenseqNo)(dlg.activeGenSeq),
|
|
2512
|
+
};
|
|
2494
2513
|
const nextDeferredReplyReassertion = {
|
|
2495
2514
|
reason: 'user_interjection_with_parked_original_task',
|
|
2496
|
-
directive:
|
|
2515
|
+
directive: deferredDirective,
|
|
2516
|
+
userInterjection: currentUserInterjectionReply,
|
|
2497
2517
|
};
|
|
2498
2518
|
const mustRearmDeferredReplyReassertion = existingDeferredReplyReassertion === undefined ||
|
|
2499
2519
|
existingDeferredReplyReassertion.resumeGuideSurfaced === true ||
|
|
2520
|
+
existingDeferredReplyReassertion.userInterjection.msgId !==
|
|
2521
|
+
nextDeferredReplyReassertion.userInterjection.msgId ||
|
|
2522
|
+
existingDeferredReplyReassertion.userInterjection.course !==
|
|
2523
|
+
nextDeferredReplyReassertion.userInterjection.course ||
|
|
2524
|
+
existingDeferredReplyReassertion.userInterjection.genseq !==
|
|
2525
|
+
nextDeferredReplyReassertion.userInterjection.genseq ||
|
|
2500
2526
|
!hasSameReplyDirective(existingDeferredReplyReassertion.directive, nextDeferredReplyReassertion.directive);
|
|
2501
2527
|
if (mustRearmDeferredReplyReassertion) {
|
|
2502
2528
|
await persistence_1.DialogPersistence.setDeferredReplyReassertion(dlg.id, nextDeferredReplyReassertion, dlg.status);
|
|
@@ -2528,13 +2554,15 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
|
|
|
2528
2554
|
throw new Error(`kernel-driver reply guidance invariant violation: missing prompt content for dialog=${dlg.id.valueOf()} msgId=${currentPrompt.msgId}`);
|
|
2529
2555
|
}
|
|
2530
2556
|
if (currentPromptIsUserInterjection) {
|
|
2557
|
+
if (currentUserInterjectionReply === undefined) {
|
|
2558
|
+
throw new Error(`kernel-driver user interjection invariant violation: missing pending reply coordinate for dialog=${dlg.id.valueOf()} msgId=${currentPrompt.msgId}`);
|
|
2559
|
+
}
|
|
2560
|
+
const pendingUserInterjectionReply = currentUserInterjectionReply;
|
|
2531
2561
|
await persistence_1.DialogPersistence.mutateDialogLatest(dlg.id, () => ({
|
|
2532
2562
|
kind: 'patch',
|
|
2533
2563
|
patch: {
|
|
2534
2564
|
pendingUserInterjectionReply: {
|
|
2535
|
-
|
|
2536
|
-
course: (0, storage_1.toDialogCourseNumber)(dlg.activeGenCourseOrUndefined ?? dlg.currentCourse),
|
|
2537
|
-
genseq: (0, storage_1.toCallSiteGenseqNo)(dlg.activeGenSeq),
|
|
2565
|
+
...pendingUserInterjectionReply,
|
|
2538
2566
|
},
|
|
2539
2567
|
},
|
|
2540
2568
|
}), dlg.status);
|
|
@@ -3217,6 +3245,31 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
|
|
|
3217
3245
|
lastFunctionCallGenseq = callGenseq;
|
|
3218
3246
|
}
|
|
3219
3247
|
}
|
|
3248
|
+
const userInterjectionMsgIdForVisibleAnswer = currentPrompt?.origin === 'user' && !isQ4HAnswerPrompt
|
|
3249
|
+
? currentPrompt.msgId
|
|
3250
|
+
: currentGenerationBelongsToUserToolChain
|
|
3251
|
+
? currentUserPromptMsgId
|
|
3252
|
+
: undefined;
|
|
3253
|
+
if (userInterjectionMsgIdForVisibleAnswer !== undefined) {
|
|
3254
|
+
const streamedCurrentRoundSayingContent = batchOutputs.length === 0 &&
|
|
3255
|
+
lastAssistantSayingGenseq !== previousAssistantSayingGenseq
|
|
3256
|
+
? lastAssistantSayingContent
|
|
3257
|
+
: null;
|
|
3258
|
+
const streamedCurrentRoundSayingGenseq = batchOutputs.length === 0 &&
|
|
3259
|
+
lastAssistantSayingGenseq !== previousAssistantSayingGenseq
|
|
3260
|
+
? lastAssistantSayingGenseq
|
|
3261
|
+
: null;
|
|
3262
|
+
const answer = await maybeResolveAnsweredUserInterjection({
|
|
3263
|
+
dlg,
|
|
3264
|
+
userPromptMsgId: userInterjectionMsgIdForVisibleAnswer,
|
|
3265
|
+
assistantSayingContent: currentRoundAssistantSayingContent ?? streamedCurrentRoundSayingContent,
|
|
3266
|
+
assistantSayingGenseq: currentRoundAssistantSayingGenseq ?? streamedCurrentRoundSayingGenseq,
|
|
3267
|
+
functionCallGenseqs: currentRoundFunctionCallGenseqs,
|
|
3268
|
+
});
|
|
3269
|
+
if (answer !== undefined) {
|
|
3270
|
+
answeredUserInterjection = answer;
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3220
3273
|
const routed = await executeFunctionRound({
|
|
3221
3274
|
dlg,
|
|
3222
3275
|
agent,
|
|
@@ -3234,21 +3287,6 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
|
|
|
3234
3287
|
newMsgs.push(...routed.pairedMessages);
|
|
3235
3288
|
}
|
|
3236
3289
|
await dlg.addChatMessages(...newMsgs);
|
|
3237
|
-
const streamedCurrentRoundSayingContent = batchOutputs.length === 0 && lastAssistantSayingGenseq !== previousAssistantSayingGenseq
|
|
3238
|
-
? lastAssistantSayingContent
|
|
3239
|
-
: null;
|
|
3240
|
-
const streamedCurrentRoundSayingGenseq = batchOutputs.length === 0 && lastAssistantSayingGenseq !== previousAssistantSayingGenseq
|
|
3241
|
-
? lastAssistantSayingGenseq
|
|
3242
|
-
: null;
|
|
3243
|
-
if (currentPrompt?.origin === 'user' && !isQ4HAnswerPrompt) {
|
|
3244
|
-
await maybeResolveAnsweredUserInterjection({
|
|
3245
|
-
dlg,
|
|
3246
|
-
userPromptMsgId: currentPrompt.msgId,
|
|
3247
|
-
assistantSayingContent: currentRoundAssistantSayingContent ?? streamedCurrentRoundSayingContent,
|
|
3248
|
-
assistantSayingGenseq: currentRoundAssistantSayingGenseq ?? streamedCurrentRoundSayingGenseq,
|
|
3249
|
-
functionCallGenseqs: currentRoundFunctionCallGenseqs,
|
|
3250
|
-
});
|
|
3251
|
-
}
|
|
3252
3290
|
const persistedFbrState = await loadDialogFbrState(dlg);
|
|
3253
3291
|
if (persistedFbrState) {
|
|
3254
3292
|
if (persistedFbrState.phase === 'finalization') {
|
|
@@ -3674,6 +3712,7 @@ async function driveDialogStreamCore(dlg, callbacks, humanPrompt, driveOptions)
|
|
|
3674
3712
|
lastFunctionCallGenseq,
|
|
3675
3713
|
lastAssistantReplyTarget,
|
|
3676
3714
|
lastBusinessContinuation,
|
|
3715
|
+
answeredUserInterjection,
|
|
3677
3716
|
fbrConclusion,
|
|
3678
3717
|
};
|
|
3679
3718
|
}
|