@adhdev/daemon-core 0.9.82-rc.500 → 0.9.82-rc.502
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 +53 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -6
- package/dist/index.mjs.map +1 -1
- package/dist/providers/cli-provider-instance.d.ts +26 -0
- package/package.json +3 -3
- package/src/mesh/mesh-events-pending.ts +34 -0
- package/src/providers/cli-provider-instance.ts +72 -1
package/dist/index.js
CHANGED
|
@@ -417,10 +417,10 @@ function readInjected(value) {
|
|
|
417
417
|
}
|
|
418
418
|
function getDaemonBuildInfo() {
|
|
419
419
|
if (cached) return cached;
|
|
420
|
-
const commit = readInjected(true ? "
|
|
421
|
-
const commitShort = readInjected(true ? "
|
|
422
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
423
|
-
const builtAt = readInjected(true ? "2026-07-
|
|
420
|
+
const commit = readInjected(true ? "697af741759b27253991842eccf35716fbd33205" : void 0) ?? "unknown";
|
|
421
|
+
const commitShort = readInjected(true ? "697af741" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
422
|
+
const version = readInjected(true ? "0.9.82-rc.502" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
423
|
+
const builtAt = readInjected(true ? "2026-07-12T08:56:31.769Z" : void 0);
|
|
424
424
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
425
425
|
return cached;
|
|
426
426
|
}
|
|
@@ -8949,6 +8949,7 @@ function stampPendingEventV2(event, hint) {
|
|
|
8949
8949
|
});
|
|
8950
8950
|
if (!stamp) return event;
|
|
8951
8951
|
const dispatchedBySelfFallback = selfFallback && stamp.scope === "broadcast";
|
|
8952
|
+
const selfFallbackTarget = dispatchedBySelfFallback && !readNonEmptyString2(event.targetCoordinatorDaemonId) && !readNonEmptyString2(event.targetCoordinatorSessionId) ? readNonEmptyString2(stamp.dispatchedBy.daemonId) : void 0;
|
|
8952
8953
|
return {
|
|
8953
8954
|
...event,
|
|
8954
8955
|
protocolVersion: stamp.protocolVersion,
|
|
@@ -8956,7 +8957,8 @@ function stampPendingEventV2(event, hint) {
|
|
|
8956
8957
|
scope: stamp.scope,
|
|
8957
8958
|
dispatchedBy: stamp.dispatchedBy,
|
|
8958
8959
|
...stamp.intendedFor ? { intendedFor: stamp.intendedFor } : {},
|
|
8959
|
-
...dispatchedBySelfFallback ? { dispatchedBySelfFallback: true } : {}
|
|
8960
|
+
...dispatchedBySelfFallback ? { dispatchedBySelfFallback: true } : {},
|
|
8961
|
+
...selfFallbackTarget ? { targetCoordinatorDaemonId: selfFallbackTarget } : {}
|
|
8960
8962
|
};
|
|
8961
8963
|
}
|
|
8962
8964
|
function readCoordinatorIdentityFromWire(raw) {
|
|
@@ -45979,6 +45981,15 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
45979
45981
|
// R4b miss: collapse at boot+8s, dispatch at boot+12.4s > the 12s boot window).
|
|
45980
45982
|
// Anchoring on the collapse moment makes the window cover dispatch-delay+turn.
|
|
45981
45983
|
startupGraceCollapseAt = null;
|
|
45984
|
+
// ANTIGRAVITY-PREMATURE-COMPLETION gate: wall-clock when the CURRENT mesh task
|
|
45985
|
+
// was injected/attached (attachMeshAssignment). The injected task counts as having
|
|
45986
|
+
// genuinely entered generating only once a turn STARTS after this moment
|
|
45987
|
+
// (currentTurnStartedAt > meshTaskInjectedAt) — because currentTurnStartedAt
|
|
45988
|
+
// persists from the PRIOR turn and forceSendMessage pre-binds currentTurnTaskId at
|
|
45989
|
+
// inject time, so neither alone distinguishes "injected but not yet generating"
|
|
45990
|
+
// from "genuinely generating". This timestamp is that discriminator. 0 = no task
|
|
45991
|
+
// injected since boot (ad-hoc/non-mesh turns fall back to the plain turn-started check).
|
|
45992
|
+
meshTaskInjectedAt = 0;
|
|
45982
45993
|
settings = {};
|
|
45983
45994
|
monitor;
|
|
45984
45995
|
generatingDebounceTimer = null;
|
|
@@ -46393,6 +46404,9 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
46393
46404
|
*/
|
|
46394
46405
|
attachMeshAssignment(assignment) {
|
|
46395
46406
|
if (!assignment?.meshId) return;
|
|
46407
|
+
if (assignment.taskId && assignment.taskId.trim()) {
|
|
46408
|
+
this.meshTaskInjectedAt = Date.now();
|
|
46409
|
+
}
|
|
46396
46410
|
this.settings = {
|
|
46397
46411
|
...this.settings,
|
|
46398
46412
|
meshNodeFor: assignment.meshId,
|
|
@@ -46867,7 +46881,8 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
46867
46881
|
}
|
|
46868
46882
|
const externalMessages = this.readExternalCompletionMessages();
|
|
46869
46883
|
if (externalMessages) {
|
|
46870
|
-
const
|
|
46884
|
+
const injectedTaskGenerating = this.injectedTaskHasStartedGenerating();
|
|
46885
|
+
const present = injectedTaskGenerating && turnClosed && this.completionHasFinalAssistantMessage(externalMessages, turnStartedAt);
|
|
46871
46886
|
const lastVisibleAssistant = this.lastVisibleAssistantSummary(externalMessages);
|
|
46872
46887
|
if (lastVisibleAssistant) {
|
|
46873
46888
|
this.lastCompletionSummary = { content: lastVisibleAssistant, receivedAt: Date.now() };
|
|
@@ -47175,6 +47190,38 @@ var CliProviderInstance = class _CliProviderInstance {
|
|
|
47175
47190
|
const scalar = this.settings.meshActiveTaskId;
|
|
47176
47191
|
return typeof scalar === "string" && scalar.trim() ? scalar : void 0;
|
|
47177
47192
|
}
|
|
47193
|
+
/**
|
|
47194
|
+
* ANTIGRAVITY-PREMATURE-COMPLETION gate: has the CURRENTLY-injected task actually
|
|
47195
|
+
* entered generating (a real onTurnStarted for it)? Used to reject stale external-
|
|
47196
|
+
* native completion evidence that predates the injected task's turn.
|
|
47197
|
+
*
|
|
47198
|
+
* The injected task's id is the session scalar `meshActiveTaskId`, stamped by
|
|
47199
|
+
* attachMeshAssignment BEFORE the PTY turn starts. That stamp also records
|
|
47200
|
+
* `meshTaskInjectedAt`. The turn that has genuinely started is marked by
|
|
47201
|
+
* `adapter.currentTurnStartedAt` (set ONLY by onTurnStarted). Two naive signals both
|
|
47202
|
+
* FAIL for a reused-idle session:
|
|
47203
|
+
* - `currentTurnStartedAt > 0` alone: it persists from the PRIOR turn, so it is
|
|
47204
|
+
* already > 0 the instant a new task is injected (pre-onTurnStarted).
|
|
47205
|
+
* - `currentTurnTaskId === meshActiveTaskId` alone: forceSendMessage (the mesh
|
|
47206
|
+
* inject path) pre-binds currentTurnTaskId to the new taskId at inject time,
|
|
47207
|
+
* BEFORE the turn starts, so this matches prematurely too.
|
|
47208
|
+
* The robust discriminator is TEMPORAL: the producing turn must have STARTED AFTER
|
|
47209
|
+
* the injection — `currentTurnStartedAt > meshTaskInjectedAt`. Only then has the
|
|
47210
|
+
* injected task's own onTurnStarted fired.
|
|
47211
|
+
* - No injected task since boot (meshTaskInjectedAt === 0, e.g. an ad-hoc/dashboard
|
|
47212
|
+
* turn or a non-mesh session): fall back to the plain "a turn has started" check
|
|
47213
|
+
* so non-mesh completion is unaffected.
|
|
47214
|
+
* Fails CLOSED for the injected-but-not-started window; open once the injected turn is
|
|
47215
|
+
* genuinely underway (preserving the rc.480/481 completion-fires win).
|
|
47216
|
+
*/
|
|
47217
|
+
injectedTaskHasStartedGenerating() {
|
|
47218
|
+
const turnStartedAt = typeof this.adapter?.currentTurnStartedAt === "number" ? this.adapter.currentTurnStartedAt : 0;
|
|
47219
|
+
const turnStarted = Number.isFinite(turnStartedAt) && turnStartedAt > 0;
|
|
47220
|
+
if (this.meshTaskInjectedAt <= 0) {
|
|
47221
|
+
return turnStarted;
|
|
47222
|
+
}
|
|
47223
|
+
return turnStarted && turnStartedAt > this.meshTaskInjectedAt;
|
|
47224
|
+
}
|
|
47178
47225
|
// EVTTRACE correlation context for this session's completion lifecycle. taskId is
|
|
47179
47226
|
// the primary grep anchor; instanceId is the session fallback.
|
|
47180
47227
|
meshTraceCtx(event = "agent:generating_completed") {
|