@adhdev/daemon-core 0.9.82-rc.427 → 0.9.82-rc.429
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/commands/med-family/types.d.ts +2 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +65 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -7
- package/dist/index.mjs.map +1 -1
- package/dist/repo-mesh-types.d.ts +61 -0
- package/package.json +2 -2
- package/src/commands/cli-manager.ts +10 -1
- package/src/commands/med-family/mesh-crud.ts +11 -1
- package/src/commands/med-family/types.ts +2 -1
- package/src/commands/router.ts +37 -3
- package/src/config/mesh-config.ts +27 -1
- package/src/index.ts +4 -1
- package/src/repo-mesh-types.ts +89 -0
package/dist/index.mjs
CHANGED
|
@@ -38,6 +38,20 @@ function resolveNodeSchedulingPriority(nodePolicy) {
|
|
|
38
38
|
function resolveAutoConvergeCodeChange(policy) {
|
|
39
39
|
return policy?.autoConvergeCodeChange === true;
|
|
40
40
|
}
|
|
41
|
+
function resolveMagiSessionCleanupMode(value) {
|
|
42
|
+
if (value === void 0 || value === null) return DEFAULT_MESH_POLICY.magiSessionCleanup;
|
|
43
|
+
if (typeof value === "boolean") return value ? "stop_and_delete" : "preserve";
|
|
44
|
+
return value === "preserve" || value === "stop_and_delete" ? value : DEFAULT_MESH_POLICY.magiSessionCleanup;
|
|
45
|
+
}
|
|
46
|
+
function magiAutoLaunchedSessionCleanupDecision(args) {
|
|
47
|
+
const marker = typeof args.recordMarker === "string" ? args.recordMarker.trim() : "";
|
|
48
|
+
const expected = typeof args.expectedTaskId === "string" ? args.expectedTaskId.trim() : "";
|
|
49
|
+
if (args.isCoordinatorSession) return { allow: false, reason: "auto_launch_marker_skip_coordinator_session" };
|
|
50
|
+
if (!expected) return { allow: false, reason: "auto_launch_marker_mismatch" };
|
|
51
|
+
if (!marker) return { allow: false, reason: "auto_launch_marker_absent_session_not_auto_launched" };
|
|
52
|
+
if (marker !== expected) return { allow: false, reason: "auto_launch_marker_mismatch" };
|
|
53
|
+
return { allow: true, reason: "auto_launch_marker_match" };
|
|
54
|
+
}
|
|
41
55
|
function resolveMaxReadonlyParallelTasks(maxParallelTasks, multiplier) {
|
|
42
56
|
const raw = Number(multiplier);
|
|
43
57
|
const mult = Number.isFinite(raw) && raw >= 1 ? Math.floor(raw) : DEFAULT_MESH_READONLY_MULTIPLIER;
|
|
@@ -77,6 +91,7 @@ function mergeAndNormalizePolicy(base, patch) {
|
|
|
77
91
|
if (!SESSION_CLEANUP_MODES.has(policy.sessionCleanupOnNodeRemove)) {
|
|
78
92
|
policy.sessionCleanupOnNodeRemove = "preserve";
|
|
79
93
|
}
|
|
94
|
+
policy.magiSessionCleanup = resolveMagiSessionCleanupMode(policy.magiSessionCleanup);
|
|
80
95
|
if (!SPAWNED_SESSION_VISIBILITY_MODES.has(policy.spawnedSessionVisibility)) {
|
|
81
96
|
policy.spawnedSessionVisibility = DEFAULT_MESH_POLICY.spawnedSessionVisibility;
|
|
82
97
|
}
|
|
@@ -144,6 +159,11 @@ var init_repo_mesh_types = __esm({
|
|
|
144
159
|
spawnedSessionVisibility: "hidden",
|
|
145
160
|
delegatedWorkerAutoApprove: true,
|
|
146
161
|
sessionCleanupOnNodeRemove: "preserve",
|
|
162
|
+
// MAGI auto-launches a worker session per pinned replica target with no idle
|
|
163
|
+
// session; those stay idle-LIVE after their turn. Default ON (stop_and_delete)
|
|
164
|
+
// so repeated reviews don't pile up idle worker sessions. Only marker-verified
|
|
165
|
+
// auto-launched sessions are cleaned — see RepoMeshMagiSessionCleanupMode.
|
|
166
|
+
magiSessionCleanup: "stop_and_delete",
|
|
147
167
|
autoFastForward: { enabled: true },
|
|
148
168
|
maxTaskRetries: 1
|
|
149
169
|
};
|
|
@@ -384,10 +404,10 @@ function readInjected(value) {
|
|
|
384
404
|
}
|
|
385
405
|
function getDaemonBuildInfo() {
|
|
386
406
|
if (cached) return cached;
|
|
387
|
-
const commit = readInjected(true ? "
|
|
388
|
-
const commitShort = readInjected(true ? "
|
|
389
|
-
const version = readInjected(true ? "0.9.82-rc.
|
|
390
|
-
const builtAt = readInjected(true ? "2026-06-
|
|
407
|
+
const commit = readInjected(true ? "5278a1a4b75ca08a30a9f98e7e5888daa84e37e2" : void 0) ?? "unknown";
|
|
408
|
+
const commitShort = readInjected(true ? "5278a1a4" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
409
|
+
const version = readInjected(true ? "0.9.82-rc.429" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
410
|
+
const builtAt = readInjected(true ? "2026-06-30T03:05:39.361Z" : void 0);
|
|
391
411
|
cached = builtAt ? { commit, commitShort, version, builtAt } : { commit, commitShort, version };
|
|
392
412
|
return cached;
|
|
393
413
|
}
|
|
@@ -2950,6 +2970,18 @@ function normalizeReplicaCount(value) {
|
|
|
2950
2970
|
const n = Math.floor(value);
|
|
2951
2971
|
return n >= 1 ? n : void 0;
|
|
2952
2972
|
}
|
|
2973
|
+
function normalizeMagiPanelDefaultKind(raw) {
|
|
2974
|
+
if (raw == null) return void 0;
|
|
2975
|
+
const s2 = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
2976
|
+
if (s2 === "claim_audit" || s2 === "rca" || s2 === "design") return s2;
|
|
2977
|
+
if (s2 === "freeform") {
|
|
2978
|
+
console.warn(
|
|
2979
|
+
"[magi] panel defaultKind='freeform' rejected \u2014 freeform contributes no structured claims to cross-verification; dropping (use claim_audit / rca / design, or omit)."
|
|
2980
|
+
);
|
|
2981
|
+
return void 0;
|
|
2982
|
+
}
|
|
2983
|
+
return void 0;
|
|
2984
|
+
}
|
|
2953
2985
|
function normalizeMagiPanel(config) {
|
|
2954
2986
|
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
2955
2987
|
throw new Error("invalid_magi_panel: config must be an object");
|
|
@@ -2983,10 +3015,12 @@ function normalizeMagiPanel(config) {
|
|
|
2983
3015
|
});
|
|
2984
3016
|
const description = typeof raw.description === "string" && raw.description.trim() ? raw.description.trim().slice(0, 200) : void 0;
|
|
2985
3017
|
const defaultN = normalizeReplicaCount(raw.defaultN);
|
|
3018
|
+
const defaultKind = normalizeMagiPanelDefaultKind(raw.defaultKind);
|
|
2986
3019
|
return {
|
|
2987
3020
|
...description ? { description } : {},
|
|
2988
3021
|
members,
|
|
2989
3022
|
...defaultN !== void 0 ? { defaultN } : {},
|
|
3023
|
+
...defaultKind !== void 0 ? { defaultKind } : {},
|
|
2990
3024
|
// dedupExempt is always meaningful for a MAGI panel (intentional same-prompt
|
|
2991
3025
|
// fan-out). Persist it true unless the caller explicitly disables it.
|
|
2992
3026
|
dedupExempt: raw.dedupExempt === false ? false : true
|
|
@@ -44003,12 +44037,14 @@ var DaemonCliManager = class {
|
|
|
44003
44037
|
this.adapters.set(key2, cliInstance.getAdapter());
|
|
44004
44038
|
const launchMeshNodeId = typeof settings?.meshNodeId === "string" ? settings.meshNodeId.trim() : "";
|
|
44005
44039
|
const launchMeshNodeFor = typeof settings?.meshNodeFor === "string" ? settings.meshNodeFor.trim() : "";
|
|
44006
|
-
|
|
44040
|
+
const launchAutoLaunchedForQueueTaskId = typeof settings?.autoLaunchedForQueueTaskId === "string" ? settings.autoLaunchedForQueueTaskId.trim() : "";
|
|
44041
|
+
if (launchMeshNodeId || launchMeshNodeFor || launchAutoLaunchedForQueueTaskId) {
|
|
44007
44042
|
try {
|
|
44008
44043
|
cliInstance.getAdapter().updateRuntimeMeta?.({
|
|
44009
44044
|
...launchMeshNodeId ? { meshNodeId: launchMeshNodeId } : {},
|
|
44010
44045
|
...launchMeshNodeFor ? { meshNodeFor: launchMeshNodeFor } : {},
|
|
44011
|
-
...settings?.launchedByCoordinator === true ? { launchedByCoordinator: true } : {}
|
|
44046
|
+
...settings?.launchedByCoordinator === true ? { launchedByCoordinator: true } : {},
|
|
44047
|
+
...launchAutoLaunchedForQueueTaskId ? { autoLaunchedForQueueTaskId: launchAutoLaunchedForQueueTaskId } : {}
|
|
44012
44048
|
});
|
|
44013
44049
|
} catch {
|
|
44014
44050
|
}
|
|
@@ -49108,6 +49144,8 @@ var meshCrudHandlers = {
|
|
|
49108
49144
|
if (!node) return { success: false, error: `Node '${nodeId}' not found in mesh` };
|
|
49109
49145
|
const mode = ctx.normalizeMeshSessionCleanupMode(args?.mode ?? mesh?.policy?.sessionCleanupOnNodeRemove);
|
|
49110
49146
|
const sessionIds = Array.isArray(args?.sessionIds) ? args.sessionIds.map((id) => typeof id === "string" ? id.trim() : "").filter(Boolean) : void 0;
|
|
49147
|
+
const source = args?.source === "magi_session_cleanup" ? "magi_session_cleanup" : "mesh_cleanup_sessions";
|
|
49148
|
+
const requireAutoLaunchedForTaskIds = args?.requireAutoLaunchedForTaskIds && typeof args.requireAutoLaunchedForTaskIds === "object" && !Array.isArray(args.requireAutoLaunchedForTaskIds) ? args.requireAutoLaunchedForTaskIds : void 0;
|
|
49111
49149
|
const result = await ctx.cleanupMeshSessions({
|
|
49112
49150
|
meshId,
|
|
49113
49151
|
nodeId,
|
|
@@ -49115,7 +49153,8 @@ var meshCrudHandlers = {
|
|
|
49115
49153
|
mode,
|
|
49116
49154
|
sessionIds,
|
|
49117
49155
|
dryRun: args?.dryRun === true,
|
|
49118
|
-
source
|
|
49156
|
+
source,
|
|
49157
|
+
requireAutoLaunchedForTaskIds
|
|
49119
49158
|
});
|
|
49120
49159
|
return result;
|
|
49121
49160
|
} catch (e) {
|
|
@@ -55015,6 +55054,7 @@ var DaemonCommandRouter = class {
|
|
|
55015
55054
|
const skippedLiveSessionIds = [];
|
|
55016
55055
|
const skippedCoordinatorSessionIds = [];
|
|
55017
55056
|
const skippedLiveSessionReasons = [];
|
|
55057
|
+
const skippedMarkerMismatchSessionIds = [];
|
|
55018
55058
|
const actedLiveDelegateSessionIds = [];
|
|
55019
55059
|
const deleteUnsupportedSessionIds = [];
|
|
55020
55060
|
const recordsRemainSessionIds = [];
|
|
@@ -55057,6 +55097,19 @@ var DaemonCommandRouter = class {
|
|
|
55057
55097
|
skippedCoordinatorSessionIds.push(sessionId);
|
|
55058
55098
|
continue;
|
|
55059
55099
|
}
|
|
55100
|
+
if (args.requireAutoLaunchedForTaskIds) {
|
|
55101
|
+
const decision = magiAutoLaunchedSessionCleanupDecision({
|
|
55102
|
+
recordMarker: readStringValue(record?.meta?.autoLaunchedForQueueTaskId),
|
|
55103
|
+
expectedTaskId: args.requireAutoLaunchedForTaskIds[sessionId],
|
|
55104
|
+
isCoordinatorSession: coordinatorSession
|
|
55105
|
+
});
|
|
55106
|
+
if (!decision.allow) {
|
|
55107
|
+
skippedSessionIds.push(sessionId);
|
|
55108
|
+
skippedMarkerMismatchSessionIds.push(sessionId);
|
|
55109
|
+
skippedLiveSessionReasons.push({ sessionId, reason: decision.reason });
|
|
55110
|
+
continue;
|
|
55111
|
+
}
|
|
55112
|
+
}
|
|
55060
55113
|
const matchedByWorkspaceOnly = !recordNodeId;
|
|
55061
55114
|
const isWorktreeNodeRemoval = cleanupSource === "mesh_remove_node" && args.node?.isLocalWorktree === true;
|
|
55062
55115
|
const cleanWorkspaceOnlyForWorktree = isWorktreeNodeRemoval && matchedByWorkspaceOnly;
|
|
@@ -55140,6 +55193,7 @@ var DaemonCommandRouter = class {
|
|
|
55140
55193
|
skippedSessionIds,
|
|
55141
55194
|
skippedLiveSessionIds,
|
|
55142
55195
|
skippedCoordinatorSessionIds,
|
|
55196
|
+
...skippedMarkerMismatchSessionIds.length ? { skippedMarkerMismatchSessionIds } : {},
|
|
55143
55197
|
...actedLiveDelegateSessionIds.length ? { actedLiveDelegateSessionIds } : {},
|
|
55144
55198
|
...skippedLiveSessionReasons.length ? { skippedLiveSessionReasons } : {},
|
|
55145
55199
|
...deleteUnsupported ? {
|
|
@@ -65092,6 +65146,7 @@ export {
|
|
|
65092
65146
|
loadState,
|
|
65093
65147
|
logCommand,
|
|
65094
65148
|
machineCoreFromDaemonId,
|
|
65149
|
+
magiAutoLaunchedSessionCleanupDecision,
|
|
65095
65150
|
markSessionDeliveriesTerminal,
|
|
65096
65151
|
markSetupComplete,
|
|
65097
65152
|
markStaleDirectDispatches,
|
|
@@ -65166,6 +65221,7 @@ export {
|
|
|
65166
65221
|
resolveDelegatedWorkerAutoApprove,
|
|
65167
65222
|
resolveDeliveryDecision,
|
|
65168
65223
|
resolveGitRepository,
|
|
65224
|
+
resolveMagiSessionCleanupMode,
|
|
65169
65225
|
resolveMaxParallelTasks,
|
|
65170
65226
|
resolveMeshHostStatus,
|
|
65171
65227
|
resolveMeshNodeAttribution,
|