dominds 1.25.16 → 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/persistence.js +118 -52
- package/dist/server/dominds-self-update.js +7 -5
- package/package.json +1 -1
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);
|
package/dist/persistence.js
CHANGED
|
@@ -345,7 +345,7 @@ async function normalizeIdleWhileReplyObligationPending(dialogId, status, previo
|
|
|
345
345
|
executionMarker: healedExecutionMarker,
|
|
346
346
|
};
|
|
347
347
|
}
|
|
348
|
-
const quarantiningMainDialogs = new
|
|
348
|
+
const quarantiningMainDialogs = new Map();
|
|
349
349
|
const PERSISTABLE_DIALOG_STATUSES = ['running', 'completed', 'archived'];
|
|
350
350
|
const RUN_STATUS_DIR = 'run';
|
|
351
351
|
const DONE_STATUS_DIR = 'done';
|
|
@@ -5458,74 +5458,119 @@ class DialogPersistence {
|
|
|
5458
5458
|
static async quarantineMalformedDialog(dialogId, status, reason, error) {
|
|
5459
5459
|
const mainDialogId = dialogId.rootId === dialogId.selfId ? dialogId : new dialog_1.DialogID(dialogId.rootId);
|
|
5460
5460
|
const quarantineKey = `${status}|${mainDialogId.selfId}`;
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
quarantiningMainDialogs.add(quarantineKey);
|
|
5465
|
-
let quarantined = false;
|
|
5466
|
-
try {
|
|
5467
|
-
await prepareDialogQuarantineHook?.({
|
|
5468
|
-
dialogId,
|
|
5469
|
-
mainDialogId,
|
|
5470
|
-
status,
|
|
5471
|
-
reason,
|
|
5472
|
-
error,
|
|
5473
|
-
});
|
|
5474
|
-
this.quarantinedMainDialogScopes.add(this.getMainDialogWriteBackCancelScopeKey(mainDialogId, status));
|
|
5475
|
-
this.cancelMainDialogWriteBacks(mainDialogId, status);
|
|
5476
|
-
const sourcePath = this.getMainDialogPath(mainDialogId, status);
|
|
5477
|
-
if (!(await this.pathExists(sourcePath))) {
|
|
5478
|
-
return;
|
|
5479
|
-
}
|
|
5480
|
-
let destinationPath = this.getMalformedMainDialogPath(mainDialogId, status);
|
|
5481
|
-
if (await this.pathExists(destinationPath)) {
|
|
5482
|
-
destinationPath = path.join(this.getDialogsRootDir(), this.MALFORMED_DIR, `${mainDialogId.selfId}__${(0, node_crypto_1.randomUUID)()}`);
|
|
5483
|
-
}
|
|
5484
|
-
await fs.promises.mkdir(path.dirname(destinationPath), { recursive: true });
|
|
5485
|
-
await fs.promises.rename(sourcePath, destinationPath);
|
|
5486
|
-
quarantined = true;
|
|
5487
|
-
log_1.log.warn(`Quarantined malformed dialog ${mainDialogId.selfId}`, undefined, {
|
|
5488
|
-
status,
|
|
5489
|
-
reason,
|
|
5490
|
-
sourcePath,
|
|
5491
|
-
destinationPath,
|
|
5492
|
-
errorMessage: error.message,
|
|
5493
|
-
dialogId: dialogId.valueOf(),
|
|
5494
|
-
mainDialogId: mainDialogId.valueOf(),
|
|
5495
|
-
});
|
|
5496
|
-
dialogsQuarantinedBroadcaster?.({
|
|
5497
|
-
type: 'dialogs_quarantined',
|
|
5498
|
-
status: 'quarantining',
|
|
5499
|
-
fromStatus: assertPersistableDialogStatus(status, 'DialogPersistence.quarantineMalformedDialog(fromStatus)'),
|
|
5500
|
-
rootId: mainDialogId.selfId,
|
|
5501
|
-
dialogId: dialogId.selfId,
|
|
5502
|
-
reason,
|
|
5503
|
-
timestamp: (0, time_1.formatUnifiedTimestamp)(new Date()),
|
|
5504
|
-
});
|
|
5461
|
+
const activeQuarantine = quarantiningMainDialogs.get(quarantineKey);
|
|
5462
|
+
if (activeQuarantine) {
|
|
5463
|
+
return await activeQuarantine;
|
|
5505
5464
|
}
|
|
5506
|
-
|
|
5465
|
+
const quarantinePromise = Promise.resolve().then(async () => {
|
|
5466
|
+
let quarantined = false;
|
|
5467
|
+
let writeBackCancelScopeKey = null;
|
|
5507
5468
|
try {
|
|
5508
|
-
await
|
|
5469
|
+
await prepareDialogQuarantineHook?.({
|
|
5509
5470
|
dialogId,
|
|
5510
5471
|
mainDialogId,
|
|
5511
5472
|
status,
|
|
5512
5473
|
reason,
|
|
5513
5474
|
error,
|
|
5514
|
-
|
|
5475
|
+
});
|
|
5476
|
+
writeBackCancelScopeKey = this.getMainDialogWriteBackCancelScopeKey(mainDialogId, status);
|
|
5477
|
+
this.quarantinedMainDialogScopes.add(writeBackCancelScopeKey);
|
|
5478
|
+
this.cancelMainDialogWriteBacks(mainDialogId, status);
|
|
5479
|
+
const sourcePath = this.getMainDialogPath(mainDialogId, status);
|
|
5480
|
+
if (!(await this.pathExists(sourcePath))) {
|
|
5481
|
+
return true;
|
|
5482
|
+
}
|
|
5483
|
+
let destinationPath = this.getMalformedMainDialogPath(mainDialogId, status);
|
|
5484
|
+
if (await this.pathExists(destinationPath)) {
|
|
5485
|
+
destinationPath = path.join(this.getDialogsRootDir(), this.MALFORMED_DIR, `${mainDialogId.selfId}__${(0, node_crypto_1.randomUUID)()}`);
|
|
5486
|
+
}
|
|
5487
|
+
await fs.promises.mkdir(path.dirname(destinationPath), { recursive: true });
|
|
5488
|
+
try {
|
|
5489
|
+
await this.renameWithRetry(sourcePath, destinationPath);
|
|
5490
|
+
}
|
|
5491
|
+
catch (renameError) {
|
|
5492
|
+
log_1.log.error('Failed to quarantine malformed dialog; dialog remains in its source status', renameError, {
|
|
5493
|
+
status,
|
|
5494
|
+
reason,
|
|
5495
|
+
sourcePath,
|
|
5496
|
+
destinationPath,
|
|
5497
|
+
errorMessage: error.message,
|
|
5498
|
+
dialogId: dialogId.valueOf(),
|
|
5499
|
+
mainDialogId: mainDialogId.valueOf(),
|
|
5500
|
+
renameErrorCode: getErrorCode(renameError),
|
|
5501
|
+
});
|
|
5502
|
+
return false;
|
|
5503
|
+
}
|
|
5504
|
+
quarantined = true;
|
|
5505
|
+
log_1.log.warn(`Quarantined malformed dialog ${mainDialogId.selfId}`, undefined, {
|
|
5506
|
+
status,
|
|
5507
|
+
reason,
|
|
5508
|
+
sourcePath,
|
|
5509
|
+
destinationPath,
|
|
5510
|
+
errorMessage: error.message,
|
|
5511
|
+
dialogId: dialogId.valueOf(),
|
|
5512
|
+
mainDialogId: mainDialogId.valueOf(),
|
|
5513
|
+
});
|
|
5514
|
+
dialogsQuarantinedBroadcaster?.({
|
|
5515
|
+
type: 'dialogs_quarantined',
|
|
5516
|
+
status: 'quarantining',
|
|
5517
|
+
fromStatus: assertPersistableDialogStatus(status, 'DialogPersistence.quarantineMalformedDialog(fromStatus)'),
|
|
5518
|
+
rootId: mainDialogId.selfId,
|
|
5519
|
+
dialogId: dialogId.selfId,
|
|
5520
|
+
reason,
|
|
5521
|
+
timestamp: (0, time_1.formatUnifiedTimestamp)(new Date()),
|
|
5515
5522
|
});
|
|
5516
5523
|
}
|
|
5517
5524
|
finally {
|
|
5518
|
-
|
|
5525
|
+
try {
|
|
5526
|
+
if (!quarantined && writeBackCancelScopeKey) {
|
|
5527
|
+
this.quarantinedMainDialogScopes.delete(writeBackCancelScopeKey);
|
|
5528
|
+
}
|
|
5529
|
+
await finalizeDialogQuarantineHook?.({
|
|
5530
|
+
dialogId,
|
|
5531
|
+
mainDialogId,
|
|
5532
|
+
status,
|
|
5533
|
+
reason,
|
|
5534
|
+
error,
|
|
5535
|
+
quarantined,
|
|
5536
|
+
});
|
|
5537
|
+
}
|
|
5538
|
+
finally {
|
|
5539
|
+
const active = quarantiningMainDialogs.get(quarantineKey);
|
|
5540
|
+
if (active === quarantinePromise) {
|
|
5541
|
+
quarantiningMainDialogs.delete(quarantineKey);
|
|
5542
|
+
}
|
|
5543
|
+
}
|
|
5519
5544
|
}
|
|
5520
|
-
|
|
5545
|
+
return quarantined;
|
|
5546
|
+
});
|
|
5547
|
+
quarantiningMainDialogs.set(quarantineKey, quarantinePromise);
|
|
5548
|
+
return await quarantinePromise;
|
|
5521
5549
|
}
|
|
5522
5550
|
static async quarantineMalformedRuntimeState(dialogId, status, reason, detail) {
|
|
5523
|
-
await this.quarantineMalformedDialog(dialogId, status, reason, new Error(detail));
|
|
5551
|
+
const quarantined = await this.quarantineMalformedDialog(dialogId, status, reason, new Error(detail));
|
|
5552
|
+
if (!quarantined) {
|
|
5553
|
+
throw new Error(`Failed to quarantine malformed runtime state ` +
|
|
5554
|
+
`(rootId=${dialogId.rootId}, selfId=${dialogId.selfId}, status=${status}, reason=${reason}): ` +
|
|
5555
|
+
detail);
|
|
5556
|
+
}
|
|
5524
5557
|
}
|
|
5525
5558
|
static async rethrowAfterQuarantiningDialogPersistenceProblem(dialogId, status, reason, error) {
|
|
5526
5559
|
const persistenceError = (0, persistence_errors_1.findDomindsPersistenceFileError)(error);
|
|
5527
5560
|
if (persistenceError) {
|
|
5528
|
-
|
|
5561
|
+
try {
|
|
5562
|
+
await this.quarantineMalformedDialog(dialogId, status, reason, persistenceError);
|
|
5563
|
+
}
|
|
5564
|
+
catch (quarantineError) {
|
|
5565
|
+
log_1.log.error('Failed to complete malformed dialog quarantine', quarantineError, {
|
|
5566
|
+
status,
|
|
5567
|
+
reason,
|
|
5568
|
+
dialogId: dialogId.valueOf(),
|
|
5569
|
+
mainDialogId: dialogId.rootId,
|
|
5570
|
+
persistenceErrorMessage: persistenceError.message,
|
|
5571
|
+
quarantineErrorCode: getErrorCode(quarantineError),
|
|
5572
|
+
});
|
|
5573
|
+
}
|
|
5529
5574
|
throw persistenceError;
|
|
5530
5575
|
}
|
|
5531
5576
|
throw error;
|
|
@@ -5664,6 +5709,13 @@ class DialogPersistence {
|
|
|
5664
5709
|
}
|
|
5665
5710
|
}
|
|
5666
5711
|
catch (error) {
|
|
5712
|
+
if (getErrorCode(error) === 'ENOENT') {
|
|
5713
|
+
log_1.log.debug(`🔍 listDialogs: Directory disappeared while scanning ${dirPath}`, undefined, {
|
|
5714
|
+
status,
|
|
5715
|
+
dirPath,
|
|
5716
|
+
});
|
|
5717
|
+
return;
|
|
5718
|
+
}
|
|
5667
5719
|
// Directory enumeration failures are filesystem-level access/I/O problems, not evidence
|
|
5668
5720
|
// that a specific dialog record is malformed. If we cannot even read this directory,
|
|
5669
5721
|
// attempting to quarantine a child dialog via move/rename is unlikely to be reliable.
|
|
@@ -5708,6 +5760,13 @@ class DialogPersistence {
|
|
|
5708
5760
|
entries = await fs.promises.readdir(dirPath, { withFileTypes: true });
|
|
5709
5761
|
}
|
|
5710
5762
|
catch (error) {
|
|
5763
|
+
if (getErrorCode(error) === 'ENOENT') {
|
|
5764
|
+
log_1.log.debug(`listMainDialogIds: Directory disappeared while scanning ${dirPath}`, undefined, {
|
|
5765
|
+
status,
|
|
5766
|
+
dirPath,
|
|
5767
|
+
});
|
|
5768
|
+
return;
|
|
5769
|
+
}
|
|
5711
5770
|
log_1.log.warn(`listMainDialogIds: Error reading directory ${dirPath}:`, error);
|
|
5712
5771
|
return;
|
|
5713
5772
|
}
|
|
@@ -5868,6 +5927,13 @@ class DialogPersistence {
|
|
|
5868
5927
|
entries = await fs.promises.readdir(dirPath, { withFileTypes: true });
|
|
5869
5928
|
}
|
|
5870
5929
|
catch (err) {
|
|
5930
|
+
if (getErrorCode(err) === 'ENOENT') {
|
|
5931
|
+
log_1.log.debug(`🔍 listAllDialogIds: Directory disappeared while scanning ${dirPath}`, undefined, {
|
|
5932
|
+
status,
|
|
5933
|
+
dirPath,
|
|
5934
|
+
});
|
|
5935
|
+
return;
|
|
5936
|
+
}
|
|
5871
5937
|
// This is an environment/filesystem failure rather than confirmed dialog corruption. We log
|
|
5872
5938
|
// loudly and keep enumeration partial instead of fabricating a quarantine target that may
|
|
5873
5939
|
// not even be reachable through the same broken directory path.
|
|
@@ -32,6 +32,8 @@ const PROXY_URL_ENV_KEYS = new Set([
|
|
|
32
32
|
'npm_config_https_proxy',
|
|
33
33
|
]);
|
|
34
34
|
const IDLE_RESTART_STATE = { kind: 'idle' };
|
|
35
|
+
const PROCESS_START_ARGV = [...process.argv];
|
|
36
|
+
const PROCESS_START_EXEC_ARGV = [...process.execArgv];
|
|
35
37
|
const PROCESS_START_CWD = process.cwd();
|
|
36
38
|
let runtimeConfig = null;
|
|
37
39
|
let latestObservation = { kind: 'unknown' };
|
|
@@ -76,7 +78,7 @@ function compareVersions(a, b) {
|
|
|
76
78
|
function detectRunKind(mode) {
|
|
77
79
|
if (mode !== 'production')
|
|
78
80
|
return 'disabled';
|
|
79
|
-
const scriptPath = (
|
|
81
|
+
const scriptPath = (PROCESS_START_ARGV[1] ?? '').replace(/\\/g, '/');
|
|
80
82
|
if (scriptPath.includes('/_npx/') && scriptPath.includes('/node_modules/dominds/')) {
|
|
81
83
|
return 'npx';
|
|
82
84
|
}
|
|
@@ -111,7 +113,7 @@ async function getComparableRealPath(absPath) {
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
function getCurrentProcessEntrypoint() {
|
|
114
|
-
const entrypoint =
|
|
116
|
+
const entrypoint = PROCESS_START_ARGV[1];
|
|
115
117
|
if (typeof entrypoint !== 'string' || entrypoint.trim() === '') {
|
|
116
118
|
throw new Error('Cannot restart Dominds because the current process entrypoint is unavailable');
|
|
117
119
|
}
|
|
@@ -119,10 +121,10 @@ function getCurrentProcessEntrypoint() {
|
|
|
119
121
|
}
|
|
120
122
|
function buildCurrentProcessRestartArgs() {
|
|
121
123
|
getCurrentProcessEntrypoint();
|
|
122
|
-
return [...
|
|
124
|
+
return [...PROCESS_START_EXEC_ARGV, ...PROCESS_START_ARGV.slice(1)];
|
|
123
125
|
}
|
|
124
126
|
function buildCurrentDomindsCliArgs() {
|
|
125
|
-
return
|
|
127
|
+
return PROCESS_START_ARGV.slice(2);
|
|
126
128
|
}
|
|
127
129
|
function getNpxWorkspaceDirAbs() {
|
|
128
130
|
const entrypoint = getCurrentProcessEntrypoint().replace(/\\/g, '/');
|
|
@@ -683,7 +685,7 @@ async function queryLatestVersion() {
|
|
|
683
685
|
}
|
|
684
686
|
}
|
|
685
687
|
async function findRunningDomindsPackageRootAbs() {
|
|
686
|
-
const scriptPath =
|
|
688
|
+
const scriptPath = PROCESS_START_ARGV[1];
|
|
687
689
|
if (typeof scriptPath !== 'string' || scriptPath.trim() === '')
|
|
688
690
|
return null;
|
|
689
691
|
const scriptPathAbs = path_1.default.isAbsolute(scriptPath)
|