@adhdev/daemon-core 0.9.82-rc.127 → 0.9.82-rc.128
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/index.js +24 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/commands/chat-commands.ts +30 -7
package/package.json
CHANGED
|
@@ -412,9 +412,9 @@ function buildCliMessageSourceProvenance(args: {
|
|
|
412
412
|
ptyMessageCount: ptyMessages.length,
|
|
413
413
|
returnedMessageCount: returnedMessages.length,
|
|
414
414
|
safeMapping: args.safeMapping === true,
|
|
415
|
-
// true when
|
|
416
|
-
//
|
|
417
|
-
ptyMessagesSuppressed: args.selected === 'native-history',
|
|
415
|
+
// true when PTY message bodies are suppressed and must not be treated as
|
|
416
|
+
// chat content. PTY may still contribute status/approval/screen evidence.
|
|
417
|
+
ptyMessagesSuppressed: args.selected === 'native-history' || args.ptyStatusApprovalOnly === true,
|
|
418
418
|
},
|
|
419
419
|
};
|
|
420
420
|
}
|
|
@@ -441,6 +441,19 @@ function buildNativeHistoryFallbackReason(args: {
|
|
|
441
441
|
return 'native_history_not_selected';
|
|
442
442
|
}
|
|
443
443
|
|
|
444
|
+
function isUnsafeNativeTranscriptFallback(reason?: string): boolean {
|
|
445
|
+
const value = String(reason || '').trim();
|
|
446
|
+
return value.startsWith('native_history_unavailable')
|
|
447
|
+
|| value === 'native_history_not_safely_mapped'
|
|
448
|
+
|| value === 'native_history_stale'
|
|
449
|
+
|| value === 'native_history_partial';
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
function coerceUnsafeNativeFallbackStatus(status: string, activeModal: unknown): string {
|
|
453
|
+
if (status === 'waiting_approval' && activeModal) return status;
|
|
454
|
+
return 'idle';
|
|
455
|
+
}
|
|
456
|
+
|
|
444
457
|
function supportsCliNativeTranscript(providerType: string, provider?: ProviderModule): boolean {
|
|
445
458
|
if (CLI_NATIVE_TRANSCRIPT_PROVIDERS.has(providerType)) return true;
|
|
446
459
|
return provider?.category === 'cli' && isNativeSourceCanonicalHistory(provider?.canonicalHistory);
|
|
@@ -1354,6 +1367,7 @@ export async function handleReadChat(h: CommandHelpers, args: any): Promise<Comm
|
|
|
1354
1367
|
let selectedProviderSessionId = providerSessionId;
|
|
1355
1368
|
let selectedTranscriptAuthority = transcriptAuthority;
|
|
1356
1369
|
let selectedCoverage = coverage;
|
|
1370
|
+
let selectedStatus = returnedStatus;
|
|
1357
1371
|
const sessionWorkspace = typeof (h.currentSession as any)?.workspace === 'string'
|
|
1358
1372
|
? (h.currentSession as any).workspace
|
|
1359
1373
|
: typeof adapter.workingDir === 'string'
|
|
@@ -1496,6 +1510,14 @@ export async function handleReadChat(h: CommandHelpers, args: any): Promise<Comm
|
|
|
1496
1510
|
safeMapping,
|
|
1497
1511
|
freshEnough,
|
|
1498
1512
|
});
|
|
1513
|
+
const unsafeNativeFallback = adapter.cliType === 'codex-cli'
|
|
1514
|
+
&& isUnsafeNativeTranscriptFallback(fallbackReason);
|
|
1515
|
+
if (unsafeNativeFallback) {
|
|
1516
|
+
selectedMessages = [];
|
|
1517
|
+
selectedTranscriptAuthority = undefined;
|
|
1518
|
+
selectedCoverage = undefined;
|
|
1519
|
+
selectedStatus = coerceUnsafeNativeFallbackStatus(returnedStatus, activeModal);
|
|
1520
|
+
}
|
|
1499
1521
|
messageSource = buildCliMessageSourceProvenance({
|
|
1500
1522
|
selected: 'pty-parser',
|
|
1501
1523
|
provider: adapter.cliType,
|
|
@@ -1512,10 +1534,10 @@ export async function handleReadChat(h: CommandHelpers, args: any): Promise<Comm
|
|
|
1512
1534
|
unavailableReason,
|
|
1513
1535
|
nativeMessages,
|
|
1514
1536
|
ptyMessages: returnedMessages,
|
|
1515
|
-
returnedMessages,
|
|
1537
|
+
returnedMessages: unsafeNativeFallback ? [] : returnedMessages,
|
|
1516
1538
|
safeMapping,
|
|
1517
1539
|
freshEnough,
|
|
1518
|
-
ptyStatusApprovalOnly:
|
|
1540
|
+
ptyStatusApprovalOnly: unsafeNativeFallback,
|
|
1519
1541
|
});
|
|
1520
1542
|
}
|
|
1521
1543
|
}
|
|
@@ -1523,7 +1545,7 @@ export async function handleReadChat(h: CommandHelpers, args: any): Promise<Comm
|
|
|
1523
1545
|
LOG.debug('Command', `[read_chat] cli-like parsed provider=${adapter.cliType} target=${String(args?.targetSessionId || '')} adapterStatus=${String(adapterStatus.status || '')} parsedStatus=${String(parsedRecord.status || '')} parsedMsgCount=${parsedRecord.messages.length} returnedMsgCount=${returnedMessages.length}`);
|
|
1524
1546
|
return buildReadChatCommandResult({
|
|
1525
1547
|
messages: selectedMessages,
|
|
1526
|
-
status:
|
|
1548
|
+
status: selectedStatus,
|
|
1527
1549
|
activeModal,
|
|
1528
1550
|
messageSource,
|
|
1529
1551
|
transcriptProvenance: messageSource,
|
|
@@ -1532,7 +1554,7 @@ export async function handleReadChat(h: CommandHelpers, args: any): Promise<Comm
|
|
|
1532
1554
|
targetSessionId: String(args?.targetSessionId || ''),
|
|
1533
1555
|
adapterStatus: String(adapterStatus.status || ''),
|
|
1534
1556
|
parsedStatus: String(parsedRecord.status || ''),
|
|
1535
|
-
returnedStatus: String(
|
|
1557
|
+
returnedStatus: String(selectedStatus || ''),
|
|
1536
1558
|
selectedMessageSource: (messageSource as any).selected,
|
|
1537
1559
|
messageSource,
|
|
1538
1560
|
shouldPreferAdapterMessages: supportsCliNativeTranscript(providerType, provider)
|
|
@@ -1541,6 +1563,7 @@ export async function handleReadChat(h: CommandHelpers, args: any): Promise<Comm
|
|
|
1541
1563
|
&& typeof (messageSource as any).fallbackReason === 'string'
|
|
1542
1564
|
&& (messageSource as any).fallbackReason.startsWith('native_history_')
|
|
1543
1565
|
&& (messageSource as any).fallbackReason !== 'native_history_not_checked'
|
|
1566
|
+
&& !isUnsafeNativeTranscriptFallback((messageSource as any).fallbackReason)
|
|
1544
1567
|
&& !(selectedTranscriptAuthority === 'provider' && selectedCoverage === 'full'),
|
|
1545
1568
|
parsedMsgCount: parsedRecord.messages.length,
|
|
1546
1569
|
returnedMsgCount: selectedMessages.length,
|