pilotswarm-sdk 0.5.64 → 0.5.65
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/activity-routing.d.ts +21 -0
- package/dist/activity-routing.d.ts.map +1 -0
- package/dist/activity-routing.js +32 -0
- package/dist/activity-routing.js.map +1 -0
- package/dist/agent-discovery.d.ts +35 -0
- package/dist/agent-discovery.d.ts.map +1 -0
- package/dist/agent-discovery.js +107 -0
- package/dist/agent-discovery.js.map +1 -0
- package/dist/client.d.ts +9 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +94 -12
- package/dist/client.js.map +1 -1
- package/dist/managed-session.d.ts.map +1 -1
- package/dist/managed-session.js +21 -13
- package/dist/managed-session.js.map +1 -1
- package/dist/native-subagents.d.ts +1 -1
- package/dist/native-subagents.d.ts.map +1 -1
- package/dist/native-subagents.js +11 -6
- package/dist/native-subagents.js.map +1 -1
- package/dist/orchestration/agents.d.ts +8 -3
- package/dist/orchestration/agents.d.ts.map +1 -1
- package/dist/orchestration/agents.js +87 -36
- package/dist/orchestration/agents.js.map +1 -1
- package/dist/orchestration/index.d.ts +2 -2
- package/dist/orchestration/index.js +1 -1
- package/dist/orchestration/lifecycle.js +1 -1
- package/dist/orchestration/lifecycle.js.map +1 -1
- package/dist/orchestration/runtime.d.ts +1 -1
- package/dist/orchestration/runtime.d.ts.map +1 -1
- package/dist/orchestration/runtime.js +18 -4
- package/dist/orchestration/runtime.js.map +1 -1
- package/dist/orchestration/turn.d.ts.map +1 -1
- package/dist/orchestration/turn.js +3 -5
- package/dist/orchestration/turn.js.map +1 -1
- package/dist/orchestration-registry.d.ts.map +1 -1
- package/dist/orchestration-registry.js +12 -2
- package/dist/orchestration-registry.js.map +1 -1
- package/dist/orchestration-version.d.ts +1 -1
- package/dist/orchestration-version.js +1 -1
- package/dist/orchestration.d.ts +2 -2
- package/dist/orchestration.js +1 -1
- package/dist/orchestration_1_0_46.d.ts +1 -1
- package/dist/orchestration_1_0_47.d.ts +1 -1
- package/dist/orchestration_1_0_48.d.ts +1 -1
- package/dist/orchestration_1_0_49.d.ts +1 -1
- package/dist/orchestration_1_0_50.d.ts +1 -1
- package/dist/orchestration_1_0_73/agents.d.ts +61 -0
- package/dist/orchestration_1_0_73/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_73/agents.js +843 -0
- package/dist/orchestration_1_0_73/agents.js.map +1 -0
- package/dist/orchestration_1_0_73/index.d.ts +24 -0
- package/dist/orchestration_1_0_73/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_73/index.js +13 -0
- package/dist/orchestration_1_0_73/index.js.map +1 -0
- package/dist/orchestration_1_0_73/lifecycle.d.ts +51 -0
- package/dist/orchestration_1_0_73/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_73/lifecycle.js +981 -0
- package/dist/orchestration_1_0_73/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_73/queue.d.ts +20 -0
- package/dist/orchestration_1_0_73/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_73/queue.js +894 -0
- package/dist/orchestration_1_0_73/queue.js.map +1 -0
- package/dist/orchestration_1_0_73/runtime.d.ts +31 -0
- package/dist/orchestration_1_0_73/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_73/runtime.js +230 -0
- package/dist/orchestration_1_0_73/runtime.js.map +1 -0
- package/dist/orchestration_1_0_73/state.d.ts +214 -0
- package/dist/orchestration_1_0_73/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_73/state.js +178 -0
- package/dist/orchestration_1_0_73/state.js.map +1 -0
- package/dist/orchestration_1_0_73/turn.d.ts +34 -0
- package/dist/orchestration_1_0_73/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_73/turn.js +1435 -0
- package/dist/orchestration_1_0_73/turn.js.map +1 -0
- package/dist/orchestration_1_0_73/utils.d.ts +39 -0
- package/dist/orchestration_1_0_73/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_73/utils.js +322 -0
- package/dist/orchestration_1_0_73/utils.js.map +1 -0
- package/dist/orchestration_1_0_74/agents.d.ts +61 -0
- package/dist/orchestration_1_0_74/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_74/agents.js +889 -0
- package/dist/orchestration_1_0_74/agents.js.map +1 -0
- package/dist/orchestration_1_0_74/index.d.ts +24 -0
- package/dist/orchestration_1_0_74/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_74/index.js +13 -0
- package/dist/orchestration_1_0_74/index.js.map +1 -0
- package/dist/orchestration_1_0_74/lifecycle.d.ts +51 -0
- package/dist/orchestration_1_0_74/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_74/lifecycle.js +981 -0
- package/dist/orchestration_1_0_74/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_74/queue.d.ts +20 -0
- package/dist/orchestration_1_0_74/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_74/queue.js +894 -0
- package/dist/orchestration_1_0_74/queue.js.map +1 -0
- package/dist/orchestration_1_0_74/runtime.d.ts +31 -0
- package/dist/orchestration_1_0_74/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_74/runtime.js +232 -0
- package/dist/orchestration_1_0_74/runtime.js.map +1 -0
- package/dist/orchestration_1_0_74/state.d.ts +214 -0
- package/dist/orchestration_1_0_74/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_74/state.js +178 -0
- package/dist/orchestration_1_0_74/state.js.map +1 -0
- package/dist/orchestration_1_0_74/turn.d.ts +34 -0
- package/dist/orchestration_1_0_74/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_74/turn.js +1435 -0
- package/dist/orchestration_1_0_74/turn.js.map +1 -0
- package/dist/orchestration_1_0_74/utils.d.ts +39 -0
- package/dist/orchestration_1_0_74/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_74/utils.js +322 -0
- package/dist/orchestration_1_0_74/utils.js.map +1 -0
- package/dist/orchestration_1_0_75/agents.d.ts +61 -0
- package/dist/orchestration_1_0_75/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_75/agents.js +887 -0
- package/dist/orchestration_1_0_75/agents.js.map +1 -0
- package/dist/orchestration_1_0_75/index.d.ts +24 -0
- package/dist/orchestration_1_0_75/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_75/index.js +13 -0
- package/dist/orchestration_1_0_75/index.js.map +1 -0
- package/dist/orchestration_1_0_75/lifecycle.d.ts +51 -0
- package/dist/orchestration_1_0_75/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_75/lifecycle.js +981 -0
- package/dist/orchestration_1_0_75/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_75/queue.d.ts +20 -0
- package/dist/orchestration_1_0_75/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_75/queue.js +894 -0
- package/dist/orchestration_1_0_75/queue.js.map +1 -0
- package/dist/orchestration_1_0_75/runtime.d.ts +31 -0
- package/dist/orchestration_1_0_75/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_75/runtime.js +239 -0
- package/dist/orchestration_1_0_75/runtime.js.map +1 -0
- package/dist/orchestration_1_0_75/state.d.ts +214 -0
- package/dist/orchestration_1_0_75/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_75/state.js +178 -0
- package/dist/orchestration_1_0_75/state.js.map +1 -0
- package/dist/orchestration_1_0_75/turn.d.ts +34 -0
- package/dist/orchestration_1_0_75/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_75/turn.js +1435 -0
- package/dist/orchestration_1_0_75/turn.js.map +1 -0
- package/dist/orchestration_1_0_75/utils.d.ts +39 -0
- package/dist/orchestration_1_0_75/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_75/utils.js +322 -0
- package/dist/orchestration_1_0_75/utils.js.map +1 -0
- package/dist/orchestration_1_0_76/agents.d.ts +61 -0
- package/dist/orchestration_1_0_76/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_76/agents.js +865 -0
- package/dist/orchestration_1_0_76/agents.js.map +1 -0
- package/dist/orchestration_1_0_76/index.d.ts +24 -0
- package/dist/orchestration_1_0_76/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_76/index.js +13 -0
- package/dist/orchestration_1_0_76/index.js.map +1 -0
- package/dist/orchestration_1_0_76/lifecycle.d.ts +51 -0
- package/dist/orchestration_1_0_76/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_76/lifecycle.js +981 -0
- package/dist/orchestration_1_0_76/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_76/queue.d.ts +20 -0
- package/dist/orchestration_1_0_76/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_76/queue.js +894 -0
- package/dist/orchestration_1_0_76/queue.js.map +1 -0
- package/dist/orchestration_1_0_76/runtime.d.ts +31 -0
- package/dist/orchestration_1_0_76/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_76/runtime.js +239 -0
- package/dist/orchestration_1_0_76/runtime.js.map +1 -0
- package/dist/orchestration_1_0_76/state.d.ts +214 -0
- package/dist/orchestration_1_0_76/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_76/state.js +178 -0
- package/dist/orchestration_1_0_76/state.js.map +1 -0
- package/dist/orchestration_1_0_76/turn.d.ts +34 -0
- package/dist/orchestration_1_0_76/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_76/turn.js +1435 -0
- package/dist/orchestration_1_0_76/turn.js.map +1 -0
- package/dist/orchestration_1_0_76/utils.d.ts +39 -0
- package/dist/orchestration_1_0_76/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_76/utils.js +322 -0
- package/dist/orchestration_1_0_76/utils.js.map +1 -0
- package/dist/orchestration_1_0_77/agents.d.ts +66 -0
- package/dist/orchestration_1_0_77/agents.d.ts.map +1 -0
- package/dist/orchestration_1_0_77/agents.js +895 -0
- package/dist/orchestration_1_0_77/agents.js.map +1 -0
- package/dist/orchestration_1_0_77/index.d.ts +24 -0
- package/dist/orchestration_1_0_77/index.d.ts.map +1 -0
- package/dist/orchestration_1_0_77/index.js +13 -0
- package/dist/orchestration_1_0_77/index.js.map +1 -0
- package/dist/orchestration_1_0_77/lifecycle.d.ts +51 -0
- package/dist/orchestration_1_0_77/lifecycle.d.ts.map +1 -0
- package/dist/orchestration_1_0_77/lifecycle.js +981 -0
- package/dist/orchestration_1_0_77/lifecycle.js.map +1 -0
- package/dist/orchestration_1_0_77/queue.d.ts +20 -0
- package/dist/orchestration_1_0_77/queue.d.ts.map +1 -0
- package/dist/orchestration_1_0_77/queue.js +894 -0
- package/dist/orchestration_1_0_77/queue.js.map +1 -0
- package/dist/orchestration_1_0_77/runtime.d.ts +31 -0
- package/dist/orchestration_1_0_77/runtime.d.ts.map +1 -0
- package/dist/orchestration_1_0_77/runtime.js +239 -0
- package/dist/orchestration_1_0_77/runtime.js.map +1 -0
- package/dist/orchestration_1_0_77/state.d.ts +214 -0
- package/dist/orchestration_1_0_77/state.d.ts.map +1 -0
- package/dist/orchestration_1_0_77/state.js +178 -0
- package/dist/orchestration_1_0_77/state.js.map +1 -0
- package/dist/orchestration_1_0_77/turn.d.ts +34 -0
- package/dist/orchestration_1_0_77/turn.d.ts.map +1 -0
- package/dist/orchestration_1_0_77/turn.js +1433 -0
- package/dist/orchestration_1_0_77/turn.js.map +1 -0
- package/dist/orchestration_1_0_77/utils.d.ts +39 -0
- package/dist/orchestration_1_0_77/utils.d.ts.map +1 -0
- package/dist/orchestration_1_0_77/utils.js +322 -0
- package/dist/orchestration_1_0_77/utils.js.map +1 -0
- package/dist/reserved-tool-names.d.ts +5 -0
- package/dist/reserved-tool-names.d.ts.map +1 -0
- package/dist/reserved-tool-names.js +102 -0
- package/dist/reserved-tool-names.js.map +1 -0
- package/dist/session-manager.d.ts +25 -1
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +275 -93
- package/dist/session-manager.js.map +1 -1
- package/dist/session-proxy.d.ts +28 -3
- package/dist/session-proxy.d.ts.map +1 -1
- package/dist/session-proxy.js +174 -70
- package/dist/session-proxy.js.map +1 -1
- package/dist/session-store.d.ts +2 -0
- package/dist/session-store.d.ts.map +1 -1
- package/dist/session-store.js +18 -2
- package/dist/session-store.js.map +1 -1
- package/dist/types.d.ts +17 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/worker.d.ts +9 -3
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +110 -99
- package/dist/worker.js.map +1 -1
- package/package.json +4 -3
- package/plugins/system/agents/default.agent.md +4 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Capability routing for the complete named-agent handoff contract.
|
|
2
|
+
*
|
|
3
|
+
* Old orchestration callers omit this contract and retain their exact activity
|
|
4
|
+
* names, inputs and descriptors. Orchestrations 1.0.75 and later opt into it.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AGENT_HANDOFF_CAPABILITY = "pilotswarm.agent-handoff.v2";
|
|
7
|
+
export type ActivityRoutingContract = "agent-handoff-v2";
|
|
8
|
+
export declare const HANDOFF_ACTIVITY_NAMES: {
|
|
9
|
+
readonly runTurn: "runTurnV3";
|
|
10
|
+
readonly runTurn2: "runTurnEpochV3";
|
|
11
|
+
readonly resolveAgentConfig: "resolveAgentConfigV2";
|
|
12
|
+
readonly resolveAgentForRequiredTool: "resolveAgentForRequiredToolV2";
|
|
13
|
+
readonly spawnChildSession: "spawnChildSessionV2";
|
|
14
|
+
readonly getSessionStatus: "getSessionStatusV2";
|
|
15
|
+
readonly listChildSessions: "listChildSessionsV2";
|
|
16
|
+
};
|
|
17
|
+
export declare function routedActivityName(name: keyof typeof HANDOFF_ACTIVITY_NAMES, contract?: ActivityRoutingContract): string;
|
|
18
|
+
export declare function routeHandoffActivity(task: any, contract?: ActivityRoutingContract): any;
|
|
19
|
+
/** Retain legacy handlers for already-scheduled work while registering the new contract. */
|
|
20
|
+
export declare function registerHandoffActivity(runtime: any, name: keyof typeof HANDOFF_ACTIVITY_NAMES, handler: any, versionedHandler?: any): void;
|
|
21
|
+
//# sourceMappingURL=activity-routing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-routing.d.ts","sourceRoot":"","sources":["../src/activity-routing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,gCAAgC,CAAC;AACtE,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AACzD,eAAO,MAAM,sBAAsB;;;;;;;;CAQzB,CAAC;AAEX,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,OAAO,sBAAsB,EAAE,QAAQ,CAAC,EAAE,uBAAuB,GAAG,MAAM,CAExH;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,uBAAuB,GAAG,GAAG,CAMvF;AAED,4FAA4F;AAC5F,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,OAAO,sBAAsB,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,MAAU,GAAG,IAAI,CAG/I"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Capability routing for the complete named-agent handoff contract.
|
|
2
|
+
*
|
|
3
|
+
* Old orchestration callers omit this contract and retain their exact activity
|
|
4
|
+
* names, inputs and descriptors. Orchestrations 1.0.75 and later opt into it.
|
|
5
|
+
*/
|
|
6
|
+
export const AGENT_HANDOFF_CAPABILITY = "pilotswarm.agent-handoff.v2";
|
|
7
|
+
export const HANDOFF_ACTIVITY_NAMES = {
|
|
8
|
+
runTurn: "runTurnV3",
|
|
9
|
+
runTurn2: "runTurnEpochV3",
|
|
10
|
+
resolveAgentConfig: "resolveAgentConfigV2",
|
|
11
|
+
resolveAgentForRequiredTool: "resolveAgentForRequiredToolV2",
|
|
12
|
+
spawnChildSession: "spawnChildSessionV2",
|
|
13
|
+
getSessionStatus: "getSessionStatusV2",
|
|
14
|
+
listChildSessions: "listChildSessionsV2",
|
|
15
|
+
};
|
|
16
|
+
export function routedActivityName(name, contract) {
|
|
17
|
+
return contract ? HANDOFF_ACTIVITY_NAMES[name] : name;
|
|
18
|
+
}
|
|
19
|
+
export function routeHandoffActivity(task, contract) {
|
|
20
|
+
if (!contract)
|
|
21
|
+
return task;
|
|
22
|
+
if (typeof task.withTag !== "function") {
|
|
23
|
+
throw new Error("Agent handoff requires Duroxide activity tag routing support");
|
|
24
|
+
}
|
|
25
|
+
return task.withTag(AGENT_HANDOFF_CAPABILITY);
|
|
26
|
+
}
|
|
27
|
+
/** Retain legacy handlers for already-scheduled work while registering the new contract. */
|
|
28
|
+
export function registerHandoffActivity(runtime, name, handler, versionedHandler = handler) {
|
|
29
|
+
runtime.registerActivity(name, handler);
|
|
30
|
+
runtime.registerActivity(HANDOFF_ACTIVITY_NAMES[name], versionedHandler);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=activity-routing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-routing.js","sourceRoot":"","sources":["../src/activity-routing.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,6BAA6B,CAAC;AAEtE,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,OAAO,EAAE,WAAW;IACpB,QAAQ,EAAE,gBAAgB;IAC1B,kBAAkB,EAAE,sBAAsB;IAC1C,2BAA2B,EAAE,+BAA+B;IAC5D,iBAAiB,EAAE,qBAAqB;IACxC,gBAAgB,EAAE,oBAAoB;IACtC,iBAAiB,EAAE,qBAAqB;CAClC,CAAC;AAEX,MAAM,UAAU,kBAAkB,CAAC,IAAyC,EAAE,QAAkC;IAC5G,OAAO,QAAQ,CAAC,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAS,EAAE,QAAkC;IAC9E,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAClD,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,uBAAuB,CAAC,OAAY,EAAE,IAAyC,EAAE,OAAY,EAAE,gBAAgB,GAAG,OAAO;IACrI,OAAO,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** A selectable blueprint, with metadata from exactly the copy spawning binds. */
|
|
2
|
+
export interface AgentDiscoveryEntry {
|
|
3
|
+
/** Pass this reference unchanged to spawn_agent. */
|
|
4
|
+
agent_name: string;
|
|
5
|
+
name: string;
|
|
6
|
+
qualifiedName: string;
|
|
7
|
+
namespace: string | null;
|
|
8
|
+
description: string | null;
|
|
9
|
+
tools: string[];
|
|
10
|
+
skills: string[];
|
|
11
|
+
/** Server names only. Connection details and credentials are never listed. */
|
|
12
|
+
mcpServers: string[];
|
|
13
|
+
initialRequiredTool: string | null;
|
|
14
|
+
source: "static" | "published";
|
|
15
|
+
scope: "cluster" | "user";
|
|
16
|
+
system: boolean;
|
|
17
|
+
creatable: boolean;
|
|
18
|
+
id: string | null;
|
|
19
|
+
parent: string | null;
|
|
20
|
+
}
|
|
21
|
+
export declare function listAgentDefinitionsForCaller(opts: {
|
|
22
|
+
userAgents: any[];
|
|
23
|
+
systemAgents?: any[];
|
|
24
|
+
getCallerOwnerKey: () => Promise<string | null>;
|
|
25
|
+
systemOnly?: boolean;
|
|
26
|
+
}): Promise<AgentDiscoveryEntry[]>;
|
|
27
|
+
/** Live getters keep discovery consistent with worker package polling. */
|
|
28
|
+
export declare function createAgentDiscoveryTool(opts: {
|
|
29
|
+
getUserAgents: () => any[];
|
|
30
|
+
getSystemAgents: () => any[];
|
|
31
|
+
getCallerOwnerKey: (durableSessionId?: string) => Promise<string | null>;
|
|
32
|
+
}): import("@github/copilot-sdk").Tool<{
|
|
33
|
+
systemOnly?: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
//# sourceMappingURL=agent-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-discovery.d.ts","sourceRoot":"","sources":["../src/agent-discovery.ts"],"names":[],"mappings":"AAGA,kFAAkF;AAClF,MAAM,WAAW,mBAAmB;IAChC,oDAAoD;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,8EAA8E;IAC9E,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC/B,KAAK,EAAE,SAAS,GAAG,MAAM,CAAC;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,wBAAsB,6BAA6B,CAAC,IAAI,EAAE;IACtD,UAAU,EAAE,GAAG,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE,GAAG,EAAE,CAAC;IACrB,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAChD,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAqEjC;AAED,0EAA0E;AAC1E,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC3C,aAAa,EAAE,MAAM,GAAG,EAAE,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,EAAE,CAAC;IAC7B,iBAAiB,EAAE,CAAC,gBAAgB,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC5E;iBAgB4C,OAAO;GAUnD"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { defineTool } from "@github/copilot-sdk";
|
|
2
|
+
import { resolveAgentDefinitionForCaller } from "./session-proxy.js";
|
|
3
|
+
export async function listAgentDefinitionsForCaller(opts) {
|
|
4
|
+
// Snapshot the arrays: worker package refresh mutates them in place while
|
|
5
|
+
// owner lookup awaits the catalog. A listing must use one coherent set.
|
|
6
|
+
const userAgents = [...opts.userAgents];
|
|
7
|
+
const systemAgents = [...(opts.systemAgents ?? [])];
|
|
8
|
+
let ownerKey;
|
|
9
|
+
const getCallerOwnerKey = () => ownerKey ??= Promise.resolve()
|
|
10
|
+
.then(opts.getCallerOwnerKey).catch(() => null);
|
|
11
|
+
const candidates = [];
|
|
12
|
+
for (const candidate of opts.systemOnly ? systemAgents : userAgents) {
|
|
13
|
+
// Do not even generate aliases from invisible metadata. A foreign
|
|
14
|
+
// name can fuzzy-match a public role; returning that reference would
|
|
15
|
+
// disclose the foreign name despite selecting a public definition.
|
|
16
|
+
const visible = await resolveAgentDefinitionForCaller({
|
|
17
|
+
agentName: candidate.name,
|
|
18
|
+
userAgents: opts.systemOnly ? [] : [candidate],
|
|
19
|
+
systemAgents: opts.systemOnly ? [candidate] : [],
|
|
20
|
+
getCallerOwnerKey,
|
|
21
|
+
});
|
|
22
|
+
if (visible)
|
|
23
|
+
candidates.push(candidate);
|
|
24
|
+
}
|
|
25
|
+
const references = new Set();
|
|
26
|
+
for (const agent of candidates) {
|
|
27
|
+
if (!agent.name)
|
|
28
|
+
continue;
|
|
29
|
+
references.add(agent.name);
|
|
30
|
+
if (agent.namespace)
|
|
31
|
+
references.add(`${agent.namespace}:${agent.name}`);
|
|
32
|
+
if (agent.packageScope !== "user")
|
|
33
|
+
references.add(`__shared:${agent.name}`);
|
|
34
|
+
}
|
|
35
|
+
// IDs are existing resolver aliases. They can reach a public copy hidden
|
|
36
|
+
// behind both an own-copy shadow and another namespace's same-name role.
|
|
37
|
+
for (const agent of candidates) {
|
|
38
|
+
if (!agent.id)
|
|
39
|
+
continue;
|
|
40
|
+
references.add(agent.id);
|
|
41
|
+
if (agent.packageScope !== "user")
|
|
42
|
+
references.add(`__shared:${agent.id}`);
|
|
43
|
+
}
|
|
44
|
+
const seen = new Set();
|
|
45
|
+
const entries = [];
|
|
46
|
+
for (const agentName of references) {
|
|
47
|
+
const resolved = await resolveAgentDefinitionForCaller({
|
|
48
|
+
agentName, userAgents: opts.systemOnly ? [] : userAgents, systemAgents, getCallerOwnerKey,
|
|
49
|
+
});
|
|
50
|
+
if (!resolved || (opts.systemOnly ? resolved.creatable !== false : resolved.creatable === false))
|
|
51
|
+
continue;
|
|
52
|
+
const selected = candidates.find(agent => agent.name === resolved.name
|
|
53
|
+
&& agent.packageId === resolved.packageId
|
|
54
|
+
&& agent.namespace === resolved.namespace
|
|
55
|
+
&& agent.prompt === resolved.prompt);
|
|
56
|
+
if (!selected || seen.has(selected))
|
|
57
|
+
continue;
|
|
58
|
+
seen.add(selected);
|
|
59
|
+
entries.push({
|
|
60
|
+
agent_name: agentName,
|
|
61
|
+
name: resolved.name,
|
|
62
|
+
qualifiedName: agentName,
|
|
63
|
+
namespace: resolved.namespace ?? null,
|
|
64
|
+
description: selected.description || null,
|
|
65
|
+
tools: [...(resolved.tools ?? [])],
|
|
66
|
+
skills: [...(selected.skills ?? [])],
|
|
67
|
+
mcpServers: Array.isArray(selected.mcpServers)
|
|
68
|
+
? [...selected.mcpServers] : Object.keys(selected.mcpServers ?? {}),
|
|
69
|
+
initialRequiredTool: resolved.initialRequiredTool ?? null,
|
|
70
|
+
source: resolved.packageId ? "published" : "static",
|
|
71
|
+
scope: resolved.packageScope === "user" ? "user" : "cluster",
|
|
72
|
+
system: resolved.system === true,
|
|
73
|
+
creatable: resolved.creatable !== false,
|
|
74
|
+
id: resolved.id ?? null,
|
|
75
|
+
parent: resolved.parent ?? null,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return entries.sort((a, b) => a.name.localeCompare(b.name) || a.agent_name.localeCompare(b.agent_name));
|
|
79
|
+
}
|
|
80
|
+
/** Live getters keep discovery consistent with worker package polling. */
|
|
81
|
+
export function createAgentDiscoveryTool(opts) {
|
|
82
|
+
return defineTool("ps_list_agents", {
|
|
83
|
+
description: "Discover the named agent blueprints available to this session: static deployment agents and enabled published agents visible to its owner. " +
|
|
84
|
+
"Before choosing a generic child or native task, inspect this list if you do not already have an adequate current catalog. " +
|
|
85
|
+
"Match the job to each role's description, declared tools, skills and source access; pass its exact agent_name to spawn_agent with task for the assignment. " +
|
|
86
|
+
"A named agent loads its own instructions, tools and startup requirement. Tools listed here are declarations; session defaults may also apply. " +
|
|
87
|
+
"If no listed specialist fits, choose the appropriate generic or native delegation. " +
|
|
88
|
+
"These are blueprints, not running children; use check_agents for children already spawned. " +
|
|
89
|
+
"systemOnly is for inspecting worker-managed definitions, which cannot be spawned.",
|
|
90
|
+
parameters: {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {
|
|
93
|
+
systemOnly: { type: "boolean", description: "Inspect worker-managed definitions only. These are not spawn targets. Default false." },
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
handler: async (args, invocation) => {
|
|
97
|
+
const agents = await listAgentDefinitionsForCaller({
|
|
98
|
+
userAgents: opts.getUserAgents(),
|
|
99
|
+
systemAgents: opts.getSystemAgents(),
|
|
100
|
+
getCallerOwnerKey: () => opts.getCallerOwnerKey(invocation?.durableSessionId),
|
|
101
|
+
systemOnly: args.systemOnly === true,
|
|
102
|
+
});
|
|
103
|
+
return JSON.stringify({ agents, total: agents.length }, null, 2);
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=agent-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-discovery.js","sourceRoot":"","sources":["../src/agent-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAC;AAuBrE,MAAM,CAAC,KAAK,UAAU,6BAA6B,CAAC,IAKnD;IACG,0EAA0E;IAC1E,wEAAwE;IACxE,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,CAAC;IACpD,IAAI,QAA4C,CAAC;IACjD,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,QAAQ,KAAK,OAAO,CAAC,OAAO,EAAE;SACzD,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,UAAU,GAAU,EAAE,CAAC;IAC7B,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;QAClE,kEAAkE;QAClE,qEAAqE;QACrE,mEAAmE;QACnE,MAAM,OAAO,GAAG,MAAM,+BAA+B,CAAC;YAClD,SAAS,EAAE,SAAS,CAAC,IAAI;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAC9C,YAAY,EAAE,IAAI,CAAC,UAAU,CAAC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,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,gBAAgB,CAAC;gBAC7E,UAAU,EAAE,IAAI,CAAC,UAAU,KAAK,IAAI;aACvC,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACrE,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -136,6 +136,12 @@ export declare class PilotSwarmClient {
|
|
|
136
136
|
start(): Promise<void>;
|
|
137
137
|
private _resolveCreationModel;
|
|
138
138
|
stop(): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Creation and first send may land on different API processes. Restore the
|
|
141
|
+
* child boundary from durable lineage before starting an orchestration;
|
|
142
|
+
* otherwise the child silently becomes a root with a reset nesting budget.
|
|
143
|
+
*/
|
|
144
|
+
private _restoreLineageForStart;
|
|
139
145
|
/** @internal — ensure orchestration exists, update CMS, enqueue prompt. */
|
|
140
146
|
private _ensureOrchestrationAndSend;
|
|
141
147
|
/** @internal */
|
|
@@ -162,7 +168,9 @@ export declare class PilotSwarmClient {
|
|
|
162
168
|
/** @internal */
|
|
163
169
|
private _getLatestResponse;
|
|
164
170
|
/** @internal */
|
|
165
|
-
_getSessionInfo(sessionId: string
|
|
171
|
+
_getSessionInfo(sessionId: string, options?: {
|
|
172
|
+
includeResultSource?: boolean;
|
|
173
|
+
}): Promise<PilotSwarmSessionInfo>;
|
|
166
174
|
/** @internal */
|
|
167
175
|
private _waitForTurnResult;
|
|
168
176
|
}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACR,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EAEzB,qBAAqB,EAErB,gBAAgB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;;;;OAQG;IACH,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAC/D,EAAE,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAkCtC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAYhE;;;;;;;;OAQG;IACG,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAa/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAK9B,kHAAkH;IAC5G,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAKpD,OAAO,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAM/C,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,YAAY;YAON,KAAK;IAqBnB,OAAO,CAAC,SAAS;CAYpB"}
|
package/dist/client.js
CHANGED
|
@@ -13,6 +13,7 @@ import { createRequire } from "node:module";
|
|
|
13
13
|
const require = createRequire(import.meta.url);
|
|
14
14
|
const { SqliteProvider, Client } = require("duroxide");
|
|
15
15
|
const WAIT_POLL_SLICE_MS = 10_000;
|
|
16
|
+
const MAX_SESSION_LINEAGE_HOPS = 128;
|
|
16
17
|
function createAbortError(message, reason) {
|
|
17
18
|
if (reason instanceof Error)
|
|
18
19
|
return reason;
|
|
@@ -70,6 +71,11 @@ export function projectSerializableSessionConfig(fullConfig, fallbackWaitThresho
|
|
|
70
71
|
workingDirectory: fullConfig?.workingDirectory,
|
|
71
72
|
waitThreshold: fullConfig?.waitThreshold ?? fallbackWaitThreshold,
|
|
72
73
|
boundAgentName: fullConfig?.boundAgentName,
|
|
74
|
+
boundAgentPackageId: fullConfig?.boundAgentPackageId,
|
|
75
|
+
boundAgentSource: fullConfig?.boundAgentSource,
|
|
76
|
+
...(fullConfig?.namedAgentToolAdditions !== undefined
|
|
77
|
+
? { namedAgentToolAdditions: fullConfig.namedAgentToolAdditions } : {}),
|
|
78
|
+
detachedPackageToolPolicy: fullConfig?.detachedPackageToolPolicy,
|
|
73
79
|
promptLayering: fullConfig?.promptLayering,
|
|
74
80
|
childContract: fullConfig?.childContract,
|
|
75
81
|
toolNames: allNames.length ? allNames : undefined,
|
|
@@ -155,6 +161,13 @@ export class PilotSwarmClient {
|
|
|
155
161
|
contextTier: resolvedConfig.contextTier,
|
|
156
162
|
systemMessage: resolvedConfig.systemMessage,
|
|
157
163
|
boundAgentName: resolvedConfig.boundAgentName,
|
|
164
|
+
boundAgentPackageId: resolvedConfig.boundAgentPackageId,
|
|
165
|
+
boundAgentSource: resolvedConfig.boundAgentSource,
|
|
166
|
+
...(!isSubAgent && (resolvedConfig.boundAgentName || agentId) ? {
|
|
167
|
+
namedAgentToolAdditions: resolvedConfig.namedAgentToolAdditions
|
|
168
|
+
?? projectSerializableSessionConfig(resolvedConfig, undefined).toolNames ?? [],
|
|
169
|
+
} : {}),
|
|
170
|
+
detachedPackageToolPolicy: resolvedConfig.detachedPackageToolPolicy,
|
|
158
171
|
promptLayering: resolvedConfig.promptLayering,
|
|
159
172
|
childContract: resolvedConfig.childContract,
|
|
160
173
|
tools: resolvedConfig.tools,
|
|
@@ -177,11 +190,15 @@ export class PilotSwarmClient {
|
|
|
177
190
|
contextTier: resolvedConfig.contextTier ?? undefined,
|
|
178
191
|
modelResolutionSource: resolved?.source,
|
|
179
192
|
parentSessionId: config?.parentSessionId,
|
|
193
|
+
...(agentId ? { agentId } : {}),
|
|
180
194
|
owner: config?.owner ?? null,
|
|
181
195
|
groupId: config?.groupId ?? null,
|
|
182
196
|
visibility: config?.visibility ?? null,
|
|
183
197
|
creationConfig: configForRow
|
|
184
|
-
?
|
|
198
|
+
? {
|
|
199
|
+
...JSON.parse(JSON.stringify(projectSerializableSessionConfig(configForRow, this.config.waitThreshold))),
|
|
200
|
+
...(config?.nestingLevel !== undefined ? { bootstrapNestingLevel: config.nestingLevel } : {}),
|
|
201
|
+
}
|
|
185
202
|
: null,
|
|
186
203
|
});
|
|
187
204
|
if (resolved) {
|
|
@@ -554,6 +571,50 @@ export class PilotSwarmClient {
|
|
|
554
571
|
this.started = false;
|
|
555
572
|
}
|
|
556
573
|
// ─── Internal ────────────────────────────────────────────
|
|
574
|
+
/**
|
|
575
|
+
* Creation and first send may land on different API processes. Restore the
|
|
576
|
+
* child boundary from durable lineage before starting an orchestration;
|
|
577
|
+
* otherwise the child silently becomes a root with a reset nesting budget.
|
|
578
|
+
*/
|
|
579
|
+
async _restoreLineageForStart(sessionId, row, bootstrapNestingLevel) {
|
|
580
|
+
const invalid = (detail) => Object.assign(new Error(`Cannot restore session lineage for "${sessionId}": ${detail}`), { code: "SESSION_LINEAGE_INVALID" });
|
|
581
|
+
if (!row)
|
|
582
|
+
throw invalid("the session is missing from the catalog.");
|
|
583
|
+
const parentSessionId = row.parentSessionId || undefined;
|
|
584
|
+
const visited = new Set([sessionId]);
|
|
585
|
+
let current = row;
|
|
586
|
+
let depth = 0;
|
|
587
|
+
while (current.parentSessionId) {
|
|
588
|
+
const parentId = current.parentSessionId;
|
|
589
|
+
if (visited.has(parentId))
|
|
590
|
+
throw invalid(`a parent cycle includes "${parentId}".`);
|
|
591
|
+
if (depth >= MAX_SESSION_LINEAGE_HOPS)
|
|
592
|
+
throw invalid(`the parent chain exceeds ${MAX_SESSION_LINEAGE_HOPS} hops.`);
|
|
593
|
+
visited.add(parentId);
|
|
594
|
+
const parent = await this._catalog.getSession(parentId);
|
|
595
|
+
if (!parent)
|
|
596
|
+
throw invalid(`parent session "${parentId}" is missing from the catalog.`);
|
|
597
|
+
current = parent;
|
|
598
|
+
depth++;
|
|
599
|
+
}
|
|
600
|
+
// Logical depth can differ from physical ancestry (managed system
|
|
601
|
+
// sessions start their own delegation budget). Preserve an explicit
|
|
602
|
+
// create depth across processes; older rows fall back to ancestry.
|
|
603
|
+
if (bootstrapNestingLevel !== undefined
|
|
604
|
+
&& (typeof bootstrapNestingLevel !== "number" || !Number.isSafeInteger(bootstrapNestingLevel) || bootstrapNestingLevel < 0)) {
|
|
605
|
+
throw invalid("the stored bootstrap nesting level must be a non-negative integer.");
|
|
606
|
+
}
|
|
607
|
+
const nestingLevel = this.nestingLevels.get(sessionId) ?? bootstrapNestingLevel ?? depth;
|
|
608
|
+
if (!Number.isSafeInteger(nestingLevel) || nestingLevel < 0) {
|
|
609
|
+
throw invalid("the explicit nesting level must be a non-negative integer.");
|
|
610
|
+
}
|
|
611
|
+
if (parentSessionId)
|
|
612
|
+
this.parentSessionIds.set(sessionId, parentSessionId);
|
|
613
|
+
else
|
|
614
|
+
this.parentSessionIds.delete(sessionId);
|
|
615
|
+
this.nestingLevels.set(sessionId, nestingLevel);
|
|
616
|
+
return { parentSessionId, nestingLevel };
|
|
617
|
+
}
|
|
557
618
|
/** @internal — ensure orchestration exists, update CMS, enqueue prompt. */
|
|
558
619
|
async _ensureOrchestrationAndSend(sessionId, prompt, opts) {
|
|
559
620
|
if (!this.duroxideClient)
|
|
@@ -585,12 +646,21 @@ export class PilotSwarmClient {
|
|
|
585
646
|
// waitThreshold must inherit the row's creation-time value, not this
|
|
586
647
|
// process's default. The default applies only if neither side set it.
|
|
587
648
|
let serializableConfig;
|
|
649
|
+
let bootstrapNestingLevel;
|
|
588
650
|
trace(`[client] ensureOrchestrationAndSend start session=${sessionId} active=${this.activeOrchestrations.has(sessionId)}`);
|
|
589
651
|
const cmsRow = await this._catalog.getSession(sessionId);
|
|
590
652
|
{
|
|
591
653
|
const stored = this._catalog.getSessionCreationConfig
|
|
592
|
-
? await this._catalog.getSessionCreationConfig(sessionId).catch(
|
|
654
|
+
? await this._catalog.getSessionCreationConfig(sessionId).catch(error => {
|
|
655
|
+
// Missing legacy metadata is supported; an unreadable start
|
|
656
|
+
// record cannot silently reset a persisted delegation budget.
|
|
657
|
+
if (!this.activeOrchestrations.has(sessionId))
|
|
658
|
+
throw error;
|
|
659
|
+
return null;
|
|
660
|
+
})
|
|
593
661
|
: null;
|
|
662
|
+
const { bootstrapNestingLevel: storedDepth, ...storedSessionConfig } = stored ?? {};
|
|
663
|
+
bootstrapNestingLevel = storedDepth;
|
|
594
664
|
if (stored && !fullConfig) {
|
|
595
665
|
trace(`[client] creation config restored from catalog row (in-memory config miss)`);
|
|
596
666
|
}
|
|
@@ -598,9 +668,16 @@ export class PilotSwarmClient {
|
|
|
598
668
|
? JSON.parse(JSON.stringify(projectSerializableSessionConfig(fullConfig, undefined)))
|
|
599
669
|
: {};
|
|
600
670
|
const merged = {
|
|
601
|
-
...
|
|
671
|
+
...storedSessionConfig,
|
|
602
672
|
...overrides,
|
|
603
673
|
};
|
|
674
|
+
// A partial resume may explicitly replace root tool additions before
|
|
675
|
+
// the first message, while retaining its durable named binding.
|
|
676
|
+
if ((merged.boundAgentName || merged.namedAgentToolAdditions !== undefined) && !cmsRow?.parentSessionId && fullConfig
|
|
677
|
+
&& fullConfig.namedAgentToolAdditions === undefined
|
|
678
|
+
&& (fullConfig.toolNames !== undefined || fullConfig.tools !== undefined)) {
|
|
679
|
+
merged.namedAgentToolAdditions = overrides.toolNames ?? [];
|
|
680
|
+
}
|
|
604
681
|
if (merged.waitThreshold == null)
|
|
605
682
|
merged.waitThreshold = this.config.waitThreshold;
|
|
606
683
|
serializableConfig = merged;
|
|
@@ -629,8 +706,10 @@ export class PilotSwarmClient {
|
|
|
629
706
|
}
|
|
630
707
|
}
|
|
631
708
|
if (!this.activeOrchestrations.has(sessionId)) {
|
|
632
|
-
const parentSessionId = this.
|
|
633
|
-
|
|
709
|
+
const { parentSessionId, nestingLevel } = await this._restoreLineageForStart(sessionId, cmsRow, bootstrapNestingLevel);
|
|
710
|
+
// Explicit local identity keeps its precedence; another process
|
|
711
|
+
// reconstructs the named agent's startup contract from the row.
|
|
712
|
+
const agentId = this.sessionAgentIds.get(sessionId) ?? cmsRow?.agentId;
|
|
634
713
|
const input = {
|
|
635
714
|
sessionId,
|
|
636
715
|
config: serializableConfig,
|
|
@@ -650,7 +729,7 @@ export class PilotSwarmClient {
|
|
|
650
729
|
...(parentSessionId ? { parentSessionId } : {}),
|
|
651
730
|
...(nestingLevel != null ? { nestingLevel } : {}),
|
|
652
731
|
...(this.systemSessions.has(sessionId) ? { isSystem: true } : {}),
|
|
653
|
-
...(
|
|
732
|
+
...(agentId ? { agentId } : {}),
|
|
654
733
|
...(this._sessionPolicy ? { sessionPolicy: this._sessionPolicy } : {}),
|
|
655
734
|
...(this._allowedAgentNames.length > 0 ? { allowedAgentNames: this._allowedAgentNames } : {}),
|
|
656
735
|
};
|
|
@@ -758,7 +837,7 @@ export class PilotSwarmClient {
|
|
|
758
837
|
}
|
|
759
838
|
}
|
|
760
839
|
/** @internal */
|
|
761
|
-
async _getSessionInfo(sessionId) {
|
|
840
|
+
async _getSessionInfo(sessionId, options) {
|
|
762
841
|
const cmsRow = await this._catalog.getSession(sessionId);
|
|
763
842
|
// Merge with live customStatus for real-time fields
|
|
764
843
|
const orchestrationId = `session-${sessionId}`;
|
|
@@ -852,6 +931,11 @@ export class PilotSwarmClient {
|
|
|
852
931
|
const effectiveError = (status === "error" || status === "failed")
|
|
853
932
|
? (orchStatus.status === "Failed" ? orchStatus.error : (cmsRow?.lastError ?? undefined))
|
|
854
933
|
: undefined;
|
|
934
|
+
const completedResponse = customStatus.turnResult?.type === "completed"
|
|
935
|
+
? customStatus.turnResult
|
|
936
|
+
: latestResponse?.type === "completed" ? latestResponse : undefined;
|
|
937
|
+
const resultSource = completedResponse ? "response"
|
|
938
|
+
: orchStatus.status === "Completed" ? "orchestration" : undefined;
|
|
855
939
|
return {
|
|
856
940
|
sessionId,
|
|
857
941
|
status,
|
|
@@ -882,11 +966,9 @@ export class PilotSwarmClient {
|
|
|
882
966
|
contextUsage: customStatus?.contextUsage && typeof customStatus.contextUsage === "object"
|
|
883
967
|
? customStatus.contextUsage
|
|
884
968
|
: undefined,
|
|
885
|
-
result:
|
|
886
|
-
?
|
|
887
|
-
|
|
888
|
-
? latestResponse.content
|
|
889
|
-
: (orchStatus.status === "Completed" ? orchStatus.output : undefined),
|
|
969
|
+
result: completedResponse ? completedResponse.content
|
|
970
|
+
: (orchStatus.status === "Completed" ? orchStatus.output : undefined),
|
|
971
|
+
...(options?.includeResultSource && resultSource ? { resultSource } : {}),
|
|
890
972
|
error: effectiveError,
|
|
891
973
|
};
|
|
892
974
|
}
|