@adhdev/daemon-core 0.9.76-rc.25 → 0.9.76-rc.26
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 +88 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +88 -3
- package/dist/index.mjs.map +1 -1
- package/dist/providers/provider-instance-manager.d.ts +1 -0
- package/dist/providers/provider-instance.d.ts +2 -0
- package/dist/shared-types.d.ts +4 -0
- package/package.json +1 -1
- package/src/commands/router.ts +68 -1
- package/src/providers/cli-provider-instance.ts +23 -1
- package/src/providers/provider-instance-manager.ts +20 -1
- package/src/providers/provider-instance.ts +2 -0
- package/src/shared-types.ts +4 -0
- package/src/status/reporter.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -15457,7 +15457,19 @@ var CliProviderInstance = class {
|
|
|
15457
15457
|
}
|
|
15458
15458
|
}
|
|
15459
15459
|
pushEvent(event) {
|
|
15460
|
-
|
|
15460
|
+
const enrichedEvent = {
|
|
15461
|
+
...event,
|
|
15462
|
+
instanceId: typeof event.instanceId === "string" && event.instanceId.trim() ? event.instanceId : this.instanceId,
|
|
15463
|
+
targetSessionId: typeof event.targetSessionId === "string" && event.targetSessionId.trim() ? event.targetSessionId : this.instanceId,
|
|
15464
|
+
providerType: typeof event.providerType === "string" && event.providerType.trim() ? event.providerType : this.type,
|
|
15465
|
+
workspaceName: typeof event.workspaceName === "string" && event.workspaceName.trim() ? event.workspaceName : this.workingDir,
|
|
15466
|
+
providerSessionId: typeof event.providerSessionId === "string" && event.providerSessionId.trim() ? event.providerSessionId : this.providerSessionId
|
|
15467
|
+
};
|
|
15468
|
+
if (this.context?.emitProviderEvent) {
|
|
15469
|
+
this.context.emitProviderEvent(enrichedEvent);
|
|
15470
|
+
return;
|
|
15471
|
+
}
|
|
15472
|
+
this.events.push(enrichedEvent);
|
|
15461
15473
|
}
|
|
15462
15474
|
flushEvents() {
|
|
15463
15475
|
const events = [...this.events];
|
|
@@ -21179,6 +21191,40 @@ function normalizeReleaseChannel(value) {
|
|
|
21179
21191
|
function resolveUpgradeChannel(args) {
|
|
21180
21192
|
return normalizeReleaseChannel(args?.channel) || normalizeReleaseChannel(args?.updatePolicy?.channel) || normalizeReleaseChannel(args?.npmTag) || normalizeReleaseChannel(loadConfig().updateChannel) || "stable";
|
|
21181
21193
|
}
|
|
21194
|
+
function readProviderPriorityFromPolicy(policy) {
|
|
21195
|
+
const record = policy && typeof policy === "object" && !Array.isArray(policy) ? policy : {};
|
|
21196
|
+
const raw = record.providerPriority;
|
|
21197
|
+
if (!Array.isArray(raw)) return [];
|
|
21198
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21199
|
+
return raw.map((type) => typeof type === "string" ? type.trim() : "").filter(Boolean).filter((type) => {
|
|
21200
|
+
if (seen.has(type)) return false;
|
|
21201
|
+
seen.add(type);
|
|
21202
|
+
return true;
|
|
21203
|
+
});
|
|
21204
|
+
}
|
|
21205
|
+
async function resolveProviderTypeFromPriority(args) {
|
|
21206
|
+
if (!args.providerPriority.length) {
|
|
21207
|
+
return { error: `Node '${args.nodeId}' has no providerPriority policy; pass cliType explicitly or configure node.policy.providerPriority` };
|
|
21208
|
+
}
|
|
21209
|
+
const failed = [];
|
|
21210
|
+
for (const requestedType of args.providerPriority) {
|
|
21211
|
+
const normalizedType = args.providerLoader.resolveAlias(requestedType);
|
|
21212
|
+
if (!args.providerLoader.isMachineProviderEnabled(normalizedType)) {
|
|
21213
|
+
failed.push(`${requestedType}: disabled`);
|
|
21214
|
+
continue;
|
|
21215
|
+
}
|
|
21216
|
+
const detected = await detectCLI(normalizedType, args.providerLoader, { includeVersion: false });
|
|
21217
|
+
args.providerLoader.setCliDetectionResults([{
|
|
21218
|
+
id: normalizedType,
|
|
21219
|
+
installed: !!detected,
|
|
21220
|
+
path: detected?.path
|
|
21221
|
+
}], false);
|
|
21222
|
+
args.onStatusChange?.();
|
|
21223
|
+
if (detected) return { providerType: normalizedType };
|
|
21224
|
+
failed.push(`${requestedType}: not detected`);
|
|
21225
|
+
}
|
|
21226
|
+
return { error: `No usable provider detected for node '${args.nodeId}' from providerPriority: ${failed.join("; ")}` };
|
|
21227
|
+
}
|
|
21182
21228
|
function loadYamlModule() {
|
|
21183
21229
|
return yaml;
|
|
21184
21230
|
}
|
|
@@ -22123,7 +22169,7 @@ var DaemonCommandRouter = class {
|
|
|
22123
22169
|
// ─── Mesh Coordinator Launch ───
|
|
22124
22170
|
case "launch_mesh_coordinator": {
|
|
22125
22171
|
const meshId = typeof args?.meshId === "string" ? args.meshId.trim() : "";
|
|
22126
|
-
|
|
22172
|
+
let cliType = typeof args?.cliType === "string" ? args.cliType.trim() : "";
|
|
22127
22173
|
if (!meshId) return { success: false, error: "meshId required" };
|
|
22128
22174
|
try {
|
|
22129
22175
|
const { buildCoordinatorSystemPrompt: buildCoordinatorSystemPrompt2 } = await Promise.resolve().then(() => (init_coordinator_prompt(), coordinator_prompt_exports));
|
|
@@ -22151,6 +22197,25 @@ var DaemonCommandRouter = class {
|
|
|
22151
22197
|
}
|
|
22152
22198
|
const workspace = typeof coordinatorNode.workspace === "string" ? coordinatorNode.workspace.trim() : "";
|
|
22153
22199
|
if (!workspace) return { success: false, error: "Coordinator node workspace required", meshId, cliType };
|
|
22200
|
+
if (!cliType) {
|
|
22201
|
+
const resolved = await resolveProviderTypeFromPriority({
|
|
22202
|
+
nodeId: String(coordinatorNode.id || coordinatorNode.nodeId || preferredCoordinatorNodeId || "coordinator"),
|
|
22203
|
+
providerPriority: readProviderPriorityFromPolicy(coordinatorNode.policy),
|
|
22204
|
+
providerLoader: this.deps.providerLoader,
|
|
22205
|
+
onStatusChange: this.deps.onStatusChange
|
|
22206
|
+
});
|
|
22207
|
+
if (!resolved.providerType) {
|
|
22208
|
+
return {
|
|
22209
|
+
success: false,
|
|
22210
|
+
code: "mesh_coordinator_provider_priority_unusable",
|
|
22211
|
+
error: resolved.error || "No usable provider found from node providerPriority",
|
|
22212
|
+
meshId,
|
|
22213
|
+
cliType,
|
|
22214
|
+
workspace
|
|
22215
|
+
};
|
|
22216
|
+
}
|
|
22217
|
+
cliType = resolved.providerType;
|
|
22218
|
+
}
|
|
22154
22219
|
const providerMeta = this.deps.providerLoader.resolve?.(cliType) || this.deps.providerLoader.getMeta(cliType);
|
|
22155
22220
|
const coordinatorSetup = resolveMeshCoordinatorSetup({
|
|
22156
22221
|
provider: providerMeta,
|
|
@@ -22465,6 +22530,12 @@ var DaemonStatusReporter = class {
|
|
|
22465
22530
|
if (providerType) {
|
|
22466
22531
|
payload.providerType = providerType;
|
|
22467
22532
|
}
|
|
22533
|
+
if (typeof event.providerSessionId === "string" && event.providerSessionId.trim()) {
|
|
22534
|
+
payload.providerSessionId = event.providerSessionId.trim();
|
|
22535
|
+
}
|
|
22536
|
+
if (typeof event.workspaceName === "string" && event.workspaceName.trim()) {
|
|
22537
|
+
payload.workspaceName = event.workspaceName.trim();
|
|
22538
|
+
}
|
|
22468
22539
|
if (typeof event.duration === "number" && Number.isFinite(event.duration)) {
|
|
22469
22540
|
payload.duration = event.duration;
|
|
22470
22541
|
}
|
|
@@ -23712,7 +23783,10 @@ var ProviderInstanceManager = class {
|
|
|
23712
23783
|
this.instances.get(id).dispose();
|
|
23713
23784
|
}
|
|
23714
23785
|
this.instances.set(id, instance);
|
|
23715
|
-
await instance.init(
|
|
23786
|
+
await instance.init({
|
|
23787
|
+
...context,
|
|
23788
|
+
emitProviderEvent: (event) => this.emitProviderEvent(instance.type, id, event)
|
|
23789
|
+
});
|
|
23716
23790
|
}
|
|
23717
23791
|
/**
|
|
23718
23792
|
* Instance remove
|
|
@@ -23874,6 +23948,17 @@ var ProviderInstanceManager = class {
|
|
|
23874
23948
|
onEvent(listener) {
|
|
23875
23949
|
this.eventListeners.push(listener);
|
|
23876
23950
|
}
|
|
23951
|
+
emitProviderEvent(providerType, instanceId, event) {
|
|
23952
|
+
const payload = {
|
|
23953
|
+
...event,
|
|
23954
|
+
providerType,
|
|
23955
|
+
instanceId: typeof event.instanceId === "string" && event.instanceId.trim() ? event.instanceId : instanceId,
|
|
23956
|
+
targetSessionId: typeof event.targetSessionId === "string" && event.targetSessionId.trim() ? event.targetSessionId : instanceId
|
|
23957
|
+
};
|
|
23958
|
+
for (const listener of this.eventListeners) {
|
|
23959
|
+
listener(payload);
|
|
23960
|
+
}
|
|
23961
|
+
}
|
|
23877
23962
|
emitPendingEvents(providerType, state, extra = {}) {
|
|
23878
23963
|
for (const event of state.pendingEvents) {
|
|
23879
23964
|
for (const listener of this.eventListeners) {
|