@adhdev/daemon-core 0.9.82-rc.109 → 0.9.82-rc.110
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-adapters/provider-cli-adapter.d.ts +5 -0
- package/dist/cli-adapters/provider-cli-shared.d.ts +4 -0
- package/dist/index.js +97 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +60 -3
- package/src/cli-adapters/provider-cli-shared.ts +4 -0
- package/src/providers/cli-provider-instance.ts +31 -0
|
@@ -35,6 +35,9 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
35
35
|
private isWaitingForResponse;
|
|
36
36
|
private activeModal;
|
|
37
37
|
private parseErrorMessage;
|
|
38
|
+
private providerSessionId;
|
|
39
|
+
private providerErrorMessage;
|
|
40
|
+
private providerErrorReason;
|
|
38
41
|
private responseTimeout;
|
|
39
42
|
private idleTimeout;
|
|
40
43
|
private ready;
|
|
@@ -164,6 +167,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
164
167
|
private applyHoldGenerating;
|
|
165
168
|
private applyWaitingApproval;
|
|
166
169
|
private applyGenerating;
|
|
170
|
+
private applyError;
|
|
167
171
|
private applyIdle;
|
|
168
172
|
private finishResponse;
|
|
169
173
|
private maybeCommitVisibleIdleTranscript;
|
|
@@ -174,6 +178,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
174
178
|
private runParseApproval;
|
|
175
179
|
private hasActionableApproval;
|
|
176
180
|
private parsedStatusHasFinalAssistantMessage;
|
|
181
|
+
private applyParsedSessionMetadata;
|
|
177
182
|
private parsedStatusHasFinalStandardAssistantMessage;
|
|
178
183
|
private shouldKeepCodexTurnOpenForFinish;
|
|
179
184
|
private rescheduleCodexFinishCheck;
|
|
@@ -36,6 +36,7 @@ export interface CliSessionStatus {
|
|
|
36
36
|
}>;
|
|
37
37
|
errorMessage?: string;
|
|
38
38
|
errorReason?: string;
|
|
39
|
+
providerSessionId?: string;
|
|
39
40
|
bufferState?: {
|
|
40
41
|
responseBuffer?: {
|
|
41
42
|
truncated: boolean;
|
|
@@ -67,6 +68,9 @@ export interface ParsedSession {
|
|
|
67
68
|
buttons: string[];
|
|
68
69
|
} | null;
|
|
69
70
|
parsedStatus: string | null;
|
|
71
|
+
errorMessage?: string;
|
|
72
|
+
errorReason?: string;
|
|
73
|
+
providerSessionId?: string;
|
|
70
74
|
transcriptAuthority?: 'provider' | 'daemon';
|
|
71
75
|
coverage?: 'full' | 'tail' | 'current-turn';
|
|
72
76
|
}
|
package/dist/index.js
CHANGED
|
@@ -4601,6 +4601,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
4601
4601
|
isWaitingForResponse = false;
|
|
4602
4602
|
activeModal = null;
|
|
4603
4603
|
parseErrorMessage = null;
|
|
4604
|
+
providerSessionId = null;
|
|
4605
|
+
providerErrorMessage = null;
|
|
4606
|
+
providerErrorReason = null;
|
|
4604
4607
|
responseTimeout = null;
|
|
4605
4608
|
idleTimeout = null;
|
|
4606
4609
|
ready = false;
|
|
@@ -5402,6 +5405,10 @@ ${lastSnapshot}`;
|
|
|
5402
5405
|
this.applyHoldGenerating(ctx, recentInteractiveActivity);
|
|
5403
5406
|
return;
|
|
5404
5407
|
}
|
|
5408
|
+
if (status === "error") {
|
|
5409
|
+
this.applyError(ctx, session);
|
|
5410
|
+
return;
|
|
5411
|
+
}
|
|
5405
5412
|
if (status === "waiting_approval") {
|
|
5406
5413
|
this.applyWaitingApproval(ctx);
|
|
5407
5414
|
return;
|
|
@@ -5546,6 +5553,45 @@ ${lastSnapshot}`;
|
|
|
5546
5553
|
}, this.timeouts.generatingIdle);
|
|
5547
5554
|
this.onStatusChange?.();
|
|
5548
5555
|
}
|
|
5556
|
+
applyError(ctx, session) {
|
|
5557
|
+
this.clearIdleFinishCandidate("provider_error");
|
|
5558
|
+
if (this.responseTimeout) {
|
|
5559
|
+
clearTimeout(this.responseTimeout);
|
|
5560
|
+
this.responseTimeout = null;
|
|
5561
|
+
}
|
|
5562
|
+
if (this.idleTimeout) {
|
|
5563
|
+
clearTimeout(this.idleTimeout);
|
|
5564
|
+
this.idleTimeout = null;
|
|
5565
|
+
}
|
|
5566
|
+
if (this.approvalExitTimeout) {
|
|
5567
|
+
clearTimeout(this.approvalExitTimeout);
|
|
5568
|
+
this.approvalExitTimeout = null;
|
|
5569
|
+
}
|
|
5570
|
+
this.isWaitingForResponse = false;
|
|
5571
|
+
this.responseSettleIgnoreUntil = 0;
|
|
5572
|
+
this.submitRetryUsed = false;
|
|
5573
|
+
this.submitRetryPromptSnippet = "";
|
|
5574
|
+
this.finishRetryCount = 0;
|
|
5575
|
+
this.currentTurnScope = null;
|
|
5576
|
+
this.activeModal = null;
|
|
5577
|
+
this.providerErrorMessage = typeof session.errorMessage === "string" && session.errorMessage.trim() ? session.errorMessage.trim() : "Provider reported an error";
|
|
5578
|
+
this.providerErrorReason = typeof session.errorReason === "string" && session.errorReason.trim() ? session.errorReason.trim() : "provider_error";
|
|
5579
|
+
this.setStatus("error", this.providerErrorReason);
|
|
5580
|
+
this.recordTrace("provider_error", {
|
|
5581
|
+
errorMessage: this.providerErrorMessage,
|
|
5582
|
+
errorReason: this.providerErrorReason,
|
|
5583
|
+
parsedStatus: ctx.parsedStatus || ctx.status,
|
|
5584
|
+
messageCount: ctx.parsedMessages.length,
|
|
5585
|
+
...buildCliTraceParseSnapshot({
|
|
5586
|
+
accumulatedBuffer: this.accumulatedBuffer,
|
|
5587
|
+
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
5588
|
+
responseBuffer: this.responseBuffer,
|
|
5589
|
+
partialResponse: this.responseBuffer,
|
|
5590
|
+
scope: this.currentTurnScope
|
|
5591
|
+
})
|
|
5592
|
+
});
|
|
5593
|
+
this.onStatusChange?.();
|
|
5594
|
+
}
|
|
5549
5595
|
applyIdle(ctx, now) {
|
|
5550
5596
|
const { modal, lastParsedAssistant, prevStatus } = ctx;
|
|
5551
5597
|
if (prevStatus === "waiting_approval") {
|
|
@@ -5792,6 +5838,7 @@ ${lastSnapshot}`;
|
|
|
5792
5838
|
{ ...input, tail, tailScreen: buildCliScreenSnapshot(tail) }
|
|
5793
5839
|
);
|
|
5794
5840
|
this.parseErrorMessage = null;
|
|
5841
|
+
if (session && typeof session === "object") this.applyParsedSessionMetadata(session);
|
|
5795
5842
|
return session && typeof session === "object" ? session : null;
|
|
5796
5843
|
} catch (e) {
|
|
5797
5844
|
const message = e?.message || String(e);
|
|
@@ -5848,6 +5895,15 @@ ${lastSnapshot}`;
|
|
|
5848
5895
|
});
|
|
5849
5896
|
return !!lastAssistant;
|
|
5850
5897
|
}
|
|
5898
|
+
applyParsedSessionMetadata(parsed) {
|
|
5899
|
+
const providerSessionId = typeof parsed?.providerSessionId === "string" && parsed.providerSessionId.trim() ? parsed.providerSessionId.trim() : "";
|
|
5900
|
+
if (providerSessionId) {
|
|
5901
|
+
this.providerSessionId = providerSessionId;
|
|
5902
|
+
this.updateRuntimeMeta({ providerSessionId });
|
|
5903
|
+
}
|
|
5904
|
+
this.providerErrorMessage = typeof parsed?.errorMessage === "string" && parsed.errorMessage.trim() ? parsed.errorMessage.trim() : null;
|
|
5905
|
+
this.providerErrorReason = typeof parsed?.errorReason === "string" && parsed.errorReason.trim() ? parsed.errorReason.trim() : null;
|
|
5906
|
+
}
|
|
5851
5907
|
parsedStatusHasFinalStandardAssistantMessage(parsed) {
|
|
5852
5908
|
const messages = Array.isArray(parsed?.messages) ? parsed.messages : [];
|
|
5853
5909
|
const lastAssistant = [...messages].reverse().find((message) => {
|
|
@@ -5930,8 +5986,9 @@ ${lastSnapshot}`;
|
|
|
5930
5986
|
queuedAt: message.queuedAt,
|
|
5931
5987
|
source: message.source
|
|
5932
5988
|
})),
|
|
5933
|
-
errorMessage: this.parseErrorMessage || void 0,
|
|
5934
|
-
errorReason: this.parseErrorMessage ? "parse_error" : void 0,
|
|
5989
|
+
errorMessage: this.parseErrorMessage || this.providerErrorMessage || void 0,
|
|
5990
|
+
errorReason: this.parseErrorMessage ? "parse_error" : this.providerErrorReason || void 0,
|
|
5991
|
+
providerSessionId: this.providerSessionId || void 0,
|
|
5935
5992
|
...bufferState ? { bufferState } : {}
|
|
5936
5993
|
};
|
|
5937
5994
|
}
|
|
@@ -5962,7 +6019,7 @@ ${lastSnapshot}`;
|
|
|
5962
6019
|
lastOutputAt: this.lastOutputAt
|
|
5963
6020
|
}),
|
|
5964
6021
|
activeModal,
|
|
5965
|
-
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0,
|
|
6022
|
+
providerSessionId: this.providerSessionId || (typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0),
|
|
5966
6023
|
errorMessage: typeof parsed.errorMessage === "string" && parsed.errorMessage.trim() ? parsed.errorMessage.trim() : void 0,
|
|
5967
6024
|
errorReason: typeof parsed.errorReason === "string" && parsed.errorReason.trim() ? parsed.errorReason.trim() : void 0,
|
|
5968
6025
|
...bufferState ? { bufferState } : {},
|
|
@@ -20053,6 +20110,13 @@ var CliProviderInstance = class {
|
|
|
20053
20110
|
this.errorMessage = void 0;
|
|
20054
20111
|
this.errorReason = void 0;
|
|
20055
20112
|
}
|
|
20113
|
+
const adapterProviderSessionId = normalizeProviderSessionId(
|
|
20114
|
+
this.provider,
|
|
20115
|
+
typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
|
|
20116
|
+
);
|
|
20117
|
+
if (adapterProviderSessionId) {
|
|
20118
|
+
this.promoteProviderSessionId(adapterProviderSessionId);
|
|
20119
|
+
}
|
|
20056
20120
|
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
|
|
20057
20121
|
const visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
|
|
20058
20122
|
const parsedProviderSessionId = normalizeProviderSessionId(
|
|
@@ -20437,6 +20501,13 @@ var CliProviderInstance = class {
|
|
|
20437
20501
|
detectStatusTransition() {
|
|
20438
20502
|
const now = Date.now();
|
|
20439
20503
|
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
20504
|
+
const adapterProviderSessionId = normalizeProviderSessionId(
|
|
20505
|
+
this.provider,
|
|
20506
|
+
typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
|
|
20507
|
+
);
|
|
20508
|
+
if (adapterProviderSessionId) {
|
|
20509
|
+
this.promoteProviderSessionId(adapterProviderSessionId);
|
|
20510
|
+
}
|
|
20440
20511
|
const parsedStatus = null;
|
|
20441
20512
|
const rawStatus = adapterStatus.status;
|
|
20442
20513
|
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, now);
|
|
@@ -20518,6 +20589,29 @@ var CliProviderInstance = class {
|
|
|
20518
20589
|
}
|
|
20519
20590
|
} else if (newStatus === "idle" && this.lastStatus === "starting") {
|
|
20520
20591
|
this.pushEvent({ event: "agent:ready", chatTitle, timestamp: now });
|
|
20592
|
+
} else if (newStatus === "error") {
|
|
20593
|
+
if (this.generatingDebounceTimer) {
|
|
20594
|
+
clearTimeout(this.generatingDebounceTimer);
|
|
20595
|
+
this.generatingDebounceTimer = null;
|
|
20596
|
+
}
|
|
20597
|
+
this.generatingDebouncePending = null;
|
|
20598
|
+
if (this.completedDebounceTimer) {
|
|
20599
|
+
clearTimeout(this.completedDebounceTimer);
|
|
20600
|
+
this.completedDebounceTimer = null;
|
|
20601
|
+
}
|
|
20602
|
+
this.completedDebouncePending = null;
|
|
20603
|
+
this.errorMessage = adapterStatus.errorMessage || this.errorMessage;
|
|
20604
|
+
this.errorReason = adapterStatus.errorReason || this.errorReason;
|
|
20605
|
+
this.pushEvent({
|
|
20606
|
+
event: "agent:stopped",
|
|
20607
|
+
chatTitle,
|
|
20608
|
+
timestamp: now,
|
|
20609
|
+
finalSummary: adapterStatus.errorMessage || adapterStatus.errorReason || "Provider reported an error",
|
|
20610
|
+
completionDiagnostic: {
|
|
20611
|
+
reason: adapterStatus.errorReason || "provider_error",
|
|
20612
|
+
errorMessage: adapterStatus.errorMessage || void 0
|
|
20613
|
+
}
|
|
20614
|
+
});
|
|
20521
20615
|
} else if (newStatus === "stopped") {
|
|
20522
20616
|
if (this.generatingDebounceTimer) {
|
|
20523
20617
|
clearTimeout(this.generatingDebounceTimer);
|