@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
package/dist/index.mjs
CHANGED
|
@@ -4596,6 +4596,9 @@ var init_provider_cli_adapter = __esm({
|
|
|
4596
4596
|
isWaitingForResponse = false;
|
|
4597
4597
|
activeModal = null;
|
|
4598
4598
|
parseErrorMessage = null;
|
|
4599
|
+
providerSessionId = null;
|
|
4600
|
+
providerErrorMessage = null;
|
|
4601
|
+
providerErrorReason = null;
|
|
4599
4602
|
responseTimeout = null;
|
|
4600
4603
|
idleTimeout = null;
|
|
4601
4604
|
ready = false;
|
|
@@ -5397,6 +5400,10 @@ ${lastSnapshot}`;
|
|
|
5397
5400
|
this.applyHoldGenerating(ctx, recentInteractiveActivity);
|
|
5398
5401
|
return;
|
|
5399
5402
|
}
|
|
5403
|
+
if (status === "error") {
|
|
5404
|
+
this.applyError(ctx, session);
|
|
5405
|
+
return;
|
|
5406
|
+
}
|
|
5400
5407
|
if (status === "waiting_approval") {
|
|
5401
5408
|
this.applyWaitingApproval(ctx);
|
|
5402
5409
|
return;
|
|
@@ -5541,6 +5548,45 @@ ${lastSnapshot}`;
|
|
|
5541
5548
|
}, this.timeouts.generatingIdle);
|
|
5542
5549
|
this.onStatusChange?.();
|
|
5543
5550
|
}
|
|
5551
|
+
applyError(ctx, session) {
|
|
5552
|
+
this.clearIdleFinishCandidate("provider_error");
|
|
5553
|
+
if (this.responseTimeout) {
|
|
5554
|
+
clearTimeout(this.responseTimeout);
|
|
5555
|
+
this.responseTimeout = null;
|
|
5556
|
+
}
|
|
5557
|
+
if (this.idleTimeout) {
|
|
5558
|
+
clearTimeout(this.idleTimeout);
|
|
5559
|
+
this.idleTimeout = null;
|
|
5560
|
+
}
|
|
5561
|
+
if (this.approvalExitTimeout) {
|
|
5562
|
+
clearTimeout(this.approvalExitTimeout);
|
|
5563
|
+
this.approvalExitTimeout = null;
|
|
5564
|
+
}
|
|
5565
|
+
this.isWaitingForResponse = false;
|
|
5566
|
+
this.responseSettleIgnoreUntil = 0;
|
|
5567
|
+
this.submitRetryUsed = false;
|
|
5568
|
+
this.submitRetryPromptSnippet = "";
|
|
5569
|
+
this.finishRetryCount = 0;
|
|
5570
|
+
this.currentTurnScope = null;
|
|
5571
|
+
this.activeModal = null;
|
|
5572
|
+
this.providerErrorMessage = typeof session.errorMessage === "string" && session.errorMessage.trim() ? session.errorMessage.trim() : "Provider reported an error";
|
|
5573
|
+
this.providerErrorReason = typeof session.errorReason === "string" && session.errorReason.trim() ? session.errorReason.trim() : "provider_error";
|
|
5574
|
+
this.setStatus("error", this.providerErrorReason);
|
|
5575
|
+
this.recordTrace("provider_error", {
|
|
5576
|
+
errorMessage: this.providerErrorMessage,
|
|
5577
|
+
errorReason: this.providerErrorReason,
|
|
5578
|
+
parsedStatus: ctx.parsedStatus || ctx.status,
|
|
5579
|
+
messageCount: ctx.parsedMessages.length,
|
|
5580
|
+
...buildCliTraceParseSnapshot({
|
|
5581
|
+
accumulatedBuffer: this.accumulatedBuffer,
|
|
5582
|
+
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
5583
|
+
responseBuffer: this.responseBuffer,
|
|
5584
|
+
partialResponse: this.responseBuffer,
|
|
5585
|
+
scope: this.currentTurnScope
|
|
5586
|
+
})
|
|
5587
|
+
});
|
|
5588
|
+
this.onStatusChange?.();
|
|
5589
|
+
}
|
|
5544
5590
|
applyIdle(ctx, now) {
|
|
5545
5591
|
const { modal, lastParsedAssistant, prevStatus } = ctx;
|
|
5546
5592
|
if (prevStatus === "waiting_approval") {
|
|
@@ -5787,6 +5833,7 @@ ${lastSnapshot}`;
|
|
|
5787
5833
|
{ ...input, tail, tailScreen: buildCliScreenSnapshot(tail) }
|
|
5788
5834
|
);
|
|
5789
5835
|
this.parseErrorMessage = null;
|
|
5836
|
+
if (session && typeof session === "object") this.applyParsedSessionMetadata(session);
|
|
5790
5837
|
return session && typeof session === "object" ? session : null;
|
|
5791
5838
|
} catch (e) {
|
|
5792
5839
|
const message = e?.message || String(e);
|
|
@@ -5843,6 +5890,15 @@ ${lastSnapshot}`;
|
|
|
5843
5890
|
});
|
|
5844
5891
|
return !!lastAssistant;
|
|
5845
5892
|
}
|
|
5893
|
+
applyParsedSessionMetadata(parsed) {
|
|
5894
|
+
const providerSessionId = typeof parsed?.providerSessionId === "string" && parsed.providerSessionId.trim() ? parsed.providerSessionId.trim() : "";
|
|
5895
|
+
if (providerSessionId) {
|
|
5896
|
+
this.providerSessionId = providerSessionId;
|
|
5897
|
+
this.updateRuntimeMeta({ providerSessionId });
|
|
5898
|
+
}
|
|
5899
|
+
this.providerErrorMessage = typeof parsed?.errorMessage === "string" && parsed.errorMessage.trim() ? parsed.errorMessage.trim() : null;
|
|
5900
|
+
this.providerErrorReason = typeof parsed?.errorReason === "string" && parsed.errorReason.trim() ? parsed.errorReason.trim() : null;
|
|
5901
|
+
}
|
|
5846
5902
|
parsedStatusHasFinalStandardAssistantMessage(parsed) {
|
|
5847
5903
|
const messages = Array.isArray(parsed?.messages) ? parsed.messages : [];
|
|
5848
5904
|
const lastAssistant = [...messages].reverse().find((message) => {
|
|
@@ -5925,8 +5981,9 @@ ${lastSnapshot}`;
|
|
|
5925
5981
|
queuedAt: message.queuedAt,
|
|
5926
5982
|
source: message.source
|
|
5927
5983
|
})),
|
|
5928
|
-
errorMessage: this.parseErrorMessage || void 0,
|
|
5929
|
-
errorReason: this.parseErrorMessage ? "parse_error" : void 0,
|
|
5984
|
+
errorMessage: this.parseErrorMessage || this.providerErrorMessage || void 0,
|
|
5985
|
+
errorReason: this.parseErrorMessage ? "parse_error" : this.providerErrorReason || void 0,
|
|
5986
|
+
providerSessionId: this.providerSessionId || void 0,
|
|
5930
5987
|
...bufferState ? { bufferState } : {}
|
|
5931
5988
|
};
|
|
5932
5989
|
}
|
|
@@ -5957,7 +6014,7 @@ ${lastSnapshot}`;
|
|
|
5957
6014
|
lastOutputAt: this.lastOutputAt
|
|
5958
6015
|
}),
|
|
5959
6016
|
activeModal,
|
|
5960
|
-
providerSessionId: typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0,
|
|
6017
|
+
providerSessionId: this.providerSessionId || (typeof parsed.providerSessionId === "string" ? parsed.providerSessionId : void 0),
|
|
5961
6018
|
errorMessage: typeof parsed.errorMessage === "string" && parsed.errorMessage.trim() ? parsed.errorMessage.trim() : void 0,
|
|
5962
6019
|
errorReason: typeof parsed.errorReason === "string" && parsed.errorReason.trim() ? parsed.errorReason.trim() : void 0,
|
|
5963
6020
|
...bufferState ? { bufferState } : {},
|
|
@@ -19794,6 +19851,13 @@ var CliProviderInstance = class {
|
|
|
19794
19851
|
this.errorMessage = void 0;
|
|
19795
19852
|
this.errorReason = void 0;
|
|
19796
19853
|
}
|
|
19854
|
+
const adapterProviderSessionId = normalizeProviderSessionId(
|
|
19855
|
+
this.provider,
|
|
19856
|
+
typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
|
|
19857
|
+
);
|
|
19858
|
+
if (adapterProviderSessionId) {
|
|
19859
|
+
this.promoteProviderSessionId(adapterProviderSessionId);
|
|
19860
|
+
}
|
|
19797
19861
|
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, Date.now());
|
|
19798
19862
|
const visibleStatus = parseErrorMessage || parsedStatus?.status === "error" ? "error" : autoApproveActive ? "generating" : adapterStatus.status;
|
|
19799
19863
|
const parsedProviderSessionId = normalizeProviderSessionId(
|
|
@@ -20178,6 +20242,13 @@ var CliProviderInstance = class {
|
|
|
20178
20242
|
detectStatusTransition() {
|
|
20179
20243
|
const now = Date.now();
|
|
20180
20244
|
const adapterStatus = this.adapter.getStatus({ allowParse: false });
|
|
20245
|
+
const adapterProviderSessionId = normalizeProviderSessionId(
|
|
20246
|
+
this.provider,
|
|
20247
|
+
typeof adapterStatus?.providerSessionId === "string" ? adapterStatus.providerSessionId : ""
|
|
20248
|
+
);
|
|
20249
|
+
if (adapterProviderSessionId) {
|
|
20250
|
+
this.promoteProviderSessionId(adapterProviderSessionId);
|
|
20251
|
+
}
|
|
20181
20252
|
const parsedStatus = null;
|
|
20182
20253
|
const rawStatus = adapterStatus.status;
|
|
20183
20254
|
const autoApproveActive = this.maybeAutoApproveStatus(adapterStatus, now);
|
|
@@ -20259,6 +20330,29 @@ var CliProviderInstance = class {
|
|
|
20259
20330
|
}
|
|
20260
20331
|
} else if (newStatus === "idle" && this.lastStatus === "starting") {
|
|
20261
20332
|
this.pushEvent({ event: "agent:ready", chatTitle, timestamp: now });
|
|
20333
|
+
} else if (newStatus === "error") {
|
|
20334
|
+
if (this.generatingDebounceTimer) {
|
|
20335
|
+
clearTimeout(this.generatingDebounceTimer);
|
|
20336
|
+
this.generatingDebounceTimer = null;
|
|
20337
|
+
}
|
|
20338
|
+
this.generatingDebouncePending = null;
|
|
20339
|
+
if (this.completedDebounceTimer) {
|
|
20340
|
+
clearTimeout(this.completedDebounceTimer);
|
|
20341
|
+
this.completedDebounceTimer = null;
|
|
20342
|
+
}
|
|
20343
|
+
this.completedDebouncePending = null;
|
|
20344
|
+
this.errorMessage = adapterStatus.errorMessage || this.errorMessage;
|
|
20345
|
+
this.errorReason = adapterStatus.errorReason || this.errorReason;
|
|
20346
|
+
this.pushEvent({
|
|
20347
|
+
event: "agent:stopped",
|
|
20348
|
+
chatTitle,
|
|
20349
|
+
timestamp: now,
|
|
20350
|
+
finalSummary: adapterStatus.errorMessage || adapterStatus.errorReason || "Provider reported an error",
|
|
20351
|
+
completionDiagnostic: {
|
|
20352
|
+
reason: adapterStatus.errorReason || "provider_error",
|
|
20353
|
+
errorMessage: adapterStatus.errorMessage || void 0
|
|
20354
|
+
}
|
|
20355
|
+
});
|
|
20262
20356
|
} else if (newStatus === "stopped") {
|
|
20263
20357
|
if (this.generatingDebounceTimer) {
|
|
20264
20358
|
clearTimeout(this.generatingDebounceTimer);
|