@adhdev/daemon-core 0.9.77-rc.34 → 0.9.77-rc.36
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 +1 -0
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli-adapters/provider-cli-adapter.ts +18 -3
- package/src/commands/router.ts +7 -1
- package/src/mesh/mesh-events.ts +8 -1
|
@@ -163,6 +163,7 @@ export declare class ProviderCliAdapter implements CliAdapter {
|
|
|
163
163
|
private finishResponse;
|
|
164
164
|
private maybeCommitVisibleIdleTranscript;
|
|
165
165
|
private commitCurrentTranscript;
|
|
166
|
+
private invokeCliScript;
|
|
166
167
|
private runParseSession;
|
|
167
168
|
private runDetectStatus;
|
|
168
169
|
private runParseApproval;
|
package/dist/index.js
CHANGED
|
@@ -1484,12 +1484,14 @@ Do NOT retry on this node. Consider reassigning to a different node or asking th
|
|
|
1484
1484
|
return "";
|
|
1485
1485
|
}
|
|
1486
1486
|
function injectMeshSystemMessage(components, args) {
|
|
1487
|
+
let completedTaskForLedger = null;
|
|
1487
1488
|
if (args.event === "agent:generating_completed") {
|
|
1488
1489
|
const sessionId = resolveEventSessionId(args.metadataEvent, args.sourceInstanceId);
|
|
1489
1490
|
const nodeId = readNonEmptyString(args.nodeId) || readNonEmptyString(args.metadataEvent.meshNodeId);
|
|
1490
1491
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
1491
1492
|
if (sessionId) {
|
|
1492
|
-
updateSessionTaskStatus(args.meshId, sessionId, "completed");
|
|
1493
|
+
const completedTask = updateSessionTaskStatus(args.meshId, sessionId, "completed");
|
|
1494
|
+
completedTaskForLedger = completedTask ? { id: completedTask.id } : null;
|
|
1493
1495
|
if (nodeId && providerType) {
|
|
1494
1496
|
setTimeout(() => {
|
|
1495
1497
|
tryAssignQueueTask(components, args.meshId, nodeId, sessionId, providerType);
|
|
@@ -1502,6 +1504,7 @@ function injectMeshSystemMessage(components, args) {
|
|
|
1502
1504
|
const providerType = readNonEmptyString(args.metadataEvent.providerType);
|
|
1503
1505
|
const completedTask = sessionId ? updateSessionTaskStatus(args.meshId, sessionId, "completed") : null;
|
|
1504
1506
|
if (completedTask) {
|
|
1507
|
+
completedTaskForLedger = { id: completedTask.id };
|
|
1505
1508
|
try {
|
|
1506
1509
|
appendLedgerEntry(args.meshId, {
|
|
1507
1510
|
kind: "task_completed",
|
|
@@ -1513,7 +1516,8 @@ function injectMeshSystemMessage(components, args) {
|
|
|
1513
1516
|
nodeLabel: args.nodeLabel,
|
|
1514
1517
|
taskId: completedTask.id,
|
|
1515
1518
|
completedViaReady: true,
|
|
1516
|
-
providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0
|
|
1519
|
+
providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
|
|
1520
|
+
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0
|
|
1517
1521
|
}
|
|
1518
1522
|
});
|
|
1519
1523
|
} catch (e) {
|
|
@@ -1556,7 +1560,9 @@ function injectMeshSystemMessage(components, args) {
|
|
|
1556
1560
|
payload: {
|
|
1557
1561
|
event: args.event,
|
|
1558
1562
|
nodeLabel: args.nodeLabel,
|
|
1559
|
-
|
|
1563
|
+
taskId: completedTaskForLedger?.id || void 0,
|
|
1564
|
+
providerSessionId: readNonEmptyString(args.metadataEvent.providerSessionId) || void 0,
|
|
1565
|
+
finalSummary: readNonEmptyString(args.metadataEvent.finalSummary) || void 0
|
|
1560
1566
|
}
|
|
1561
1567
|
});
|
|
1562
1568
|
} catch (e) {
|
|
@@ -1671,7 +1677,8 @@ function handleMeshForwardEvent(components, payload) {
|
|
|
1671
1677
|
metadataEvent: {
|
|
1672
1678
|
targetSessionId: readNonEmptyString(payload.targetSessionId) || readNonEmptyString(payload.sessionId) || readNonEmptyString(payload.instanceId),
|
|
1673
1679
|
providerType: readNonEmptyString(payload.providerType),
|
|
1674
|
-
providerSessionId: readNonEmptyString(payload.providerSessionId)
|
|
1680
|
+
providerSessionId: readNonEmptyString(payload.providerSessionId),
|
|
1681
|
+
finalSummary: readNonEmptyString(payload.finalSummary) || readNonEmptyString(payload.summary)
|
|
1675
1682
|
}
|
|
1676
1683
|
});
|
|
1677
1684
|
}
|
|
@@ -2919,7 +2926,7 @@ ${lastSnapshot}`;
|
|
|
2919
2926
|
}
|
|
2920
2927
|
getFreshParsedStatusCache() {
|
|
2921
2928
|
const cached = this.parsedStatusCache;
|
|
2922
|
-
if (cached && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.screenText === this.lastScreenText && cached.currentStatus === this.currentStatus && cached.activeModal === this.activeModal && cached.cliName === this.cliName) {
|
|
2929
|
+
if (cached && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.accumulatedRawBuffer === this.accumulatedRawBuffer && cached.screenText === this.lastScreenText && cached.currentStatus === this.currentStatus && cached.activeModal === this.activeModal && cached.cliName === this.cliName) {
|
|
2923
2930
|
return cached.result;
|
|
2924
2931
|
}
|
|
2925
2932
|
return null;
|
|
@@ -3894,6 +3901,11 @@ ${lastSnapshot}`;
|
|
|
3894
3901
|
};
|
|
3895
3902
|
}
|
|
3896
3903
|
// ─── Script Execution ──────────────────────────
|
|
3904
|
+
invokeCliScript(script, input) {
|
|
3905
|
+
const hasStateFactory = typeof this.cliScripts?.createState === "function";
|
|
3906
|
+
const expectsStateArgument = hasStateFactory || this.scriptState !== null || script.length >= 2;
|
|
3907
|
+
return expectsStateArgument ? script(this.scriptState, input) : script(input);
|
|
3908
|
+
}
|
|
3897
3909
|
runParseSession() {
|
|
3898
3910
|
if (typeof this.cliScripts?.parseSession !== "function") {
|
|
3899
3911
|
this.parseErrorMessage = `${this.cliType} parseSession unavailable`;
|
|
@@ -3914,7 +3926,10 @@ ${lastSnapshot}`;
|
|
|
3914
3926
|
scope: this.currentTurnScope,
|
|
3915
3927
|
runtimeSettings: this.runtimeSettings
|
|
3916
3928
|
});
|
|
3917
|
-
const session = this.
|
|
3929
|
+
const session = this.invokeCliScript(
|
|
3930
|
+
this.cliScripts.parseSession,
|
|
3931
|
+
{ ...input, tail, tailScreen: buildCliScreenSnapshot(tail) }
|
|
3932
|
+
);
|
|
3918
3933
|
this.parseErrorMessage = null;
|
|
3919
3934
|
return session && typeof session === "object" ? session : null;
|
|
3920
3935
|
} catch (e) {
|
|
@@ -3928,7 +3943,7 @@ ${lastSnapshot}`;
|
|
|
3928
3943
|
if (!this.cliScripts?.detectStatus) return null;
|
|
3929
3944
|
try {
|
|
3930
3945
|
const screenText = this.terminalScreen.getText();
|
|
3931
|
-
const status = this.cliScripts.detectStatus
|
|
3946
|
+
const status = this.invokeCliScript(this.cliScripts.detectStatus, {
|
|
3932
3947
|
tail: text.slice(-500),
|
|
3933
3948
|
screenText,
|
|
3934
3949
|
rawBuffer: this.accumulatedRawBuffer,
|
|
@@ -3947,7 +3962,7 @@ ${lastSnapshot}`;
|
|
|
3947
3962
|
try {
|
|
3948
3963
|
const screenText = this.terminalScreen.getText();
|
|
3949
3964
|
const buffer = screenText || this.accumulatedBuffer;
|
|
3950
|
-
return this.cliScripts.parseApproval
|
|
3965
|
+
return this.invokeCliScript(this.cliScripts.parseApproval, {
|
|
3951
3966
|
buffer,
|
|
3952
3967
|
screenText,
|
|
3953
3968
|
rawBuffer: this.accumulatedRawBuffer,
|
|
@@ -4003,7 +4018,7 @@ ${lastSnapshot}`;
|
|
|
4003
4018
|
const screenText = this.readTerminalScreenText();
|
|
4004
4019
|
const parseScreenText = this.getParseScreenText(screenText);
|
|
4005
4020
|
const cached = this.parsedStatusCache;
|
|
4006
|
-
if (cached && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.screenText === parseScreenText && cached.currentStatus === this.currentStatus && cached.activeModal === this.activeModal && cached.cliName === this.cliName) {
|
|
4021
|
+
if (cached && cached.responseBuffer === this.responseBuffer && cached.currentTurnScope === this.currentTurnScope && cached.recentOutputBuffer === this.recentOutputBuffer && cached.accumulatedBuffer === this.accumulatedBuffer && cached.accumulatedRawBuffer === this.accumulatedRawBuffer && cached.screenText === parseScreenText && cached.currentStatus === this.currentStatus && cached.activeModal === this.activeModal && cached.cliName === this.cliName) {
|
|
4007
4022
|
return cached.result;
|
|
4008
4023
|
}
|
|
4009
4024
|
const parsed = this.runParseSession();
|
|
@@ -4031,6 +4046,7 @@ ${lastSnapshot}`;
|
|
|
4031
4046
|
currentTurnScope: this.currentTurnScope,
|
|
4032
4047
|
recentOutputBuffer: this.recentOutputBuffer,
|
|
4033
4048
|
accumulatedBuffer: this.accumulatedBuffer,
|
|
4049
|
+
accumulatedRawBuffer: this.accumulatedRawBuffer,
|
|
4034
4050
|
screenText: parseScreenText,
|
|
4035
4051
|
currentStatus: this.currentStatus,
|
|
4036
4052
|
activeModal: this.activeModal,
|
|
@@ -24145,7 +24161,13 @@ var DaemonCommandRouter = class {
|
|
|
24145
24161
|
appendLedgerEntry2(meshId, {
|
|
24146
24162
|
kind: "node_removed",
|
|
24147
24163
|
nodeId,
|
|
24148
|
-
payload: {
|
|
24164
|
+
payload: {
|
|
24165
|
+
worktree: !!node?.isLocalWorktree,
|
|
24166
|
+
sessionCleanupMode,
|
|
24167
|
+
workspace: typeof node?.workspace === "string" ? node.workspace : void 0,
|
|
24168
|
+
daemonId: typeof node?.daemonId === "string" ? node.daemonId : void 0,
|
|
24169
|
+
worktreeBranch: typeof node?.worktreeBranch === "string" ? node.worktreeBranch : void 0
|
|
24170
|
+
}
|
|
24149
24171
|
});
|
|
24150
24172
|
} catch {
|
|
24151
24173
|
}
|