pilotswarm-sdk 0.2.0 → 0.2.2

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.
Files changed (173) hide show
  1. package/dist/agent-loader.d.ts +9 -0
  2. package/dist/agent-loader.d.ts.map +1 -1
  3. package/dist/agent-loader.js +3 -0
  4. package/dist/agent-loader.js.map +1 -1
  5. package/dist/child-notifications.d.ts +10 -0
  6. package/dist/child-notifications.d.ts.map +1 -1
  7. package/dist/child-notifications.js +15 -1
  8. package/dist/child-notifications.js.map +1 -1
  9. package/dist/client.d.ts +2 -2
  10. package/dist/client.d.ts.map +1 -1
  11. package/dist/client.js +14 -20
  12. package/dist/client.js.map +1 -1
  13. package/dist/cms-migrations.d.ts.map +1 -1
  14. package/dist/cms-migrations.js +321 -0
  15. package/dist/cms-migrations.js.map +1 -1
  16. package/dist/cms.d.ts +132 -8
  17. package/dist/cms.d.ts.map +1 -1
  18. package/dist/cms.js +142 -6
  19. package/dist/cms.js.map +1 -1
  20. package/dist/duroxide-schema-migration.d.ts +19 -0
  21. package/dist/duroxide-schema-migration.d.ts.map +1 -0
  22. package/dist/duroxide-schema-migration.js +122 -0
  23. package/dist/duroxide-schema-migration.js.map +1 -0
  24. package/dist/facts-migrations.d.ts.map +1 -1
  25. package/dist/facts-migrations.js +923 -0
  26. package/dist/facts-migrations.js.map +1 -1
  27. package/dist/facts-store.d.ts +278 -28
  28. package/dist/facts-store.d.ts.map +1 -1
  29. package/dist/facts-store.js +262 -32
  30. package/dist/facts-store.js.map +1 -1
  31. package/dist/facts-tools.d.ts +8 -1
  32. package/dist/facts-tools.d.ts.map +1 -1
  33. package/dist/facts-tools.js +458 -25
  34. package/dist/facts-tools.js.map +1 -1
  35. package/dist/graph-store.d.ts +243 -0
  36. package/dist/graph-store.d.ts.map +1 -0
  37. package/dist/graph-store.js +63 -0
  38. package/dist/graph-store.js.map +1 -0
  39. package/dist/graph-tools.d.ts +47 -0
  40. package/dist/graph-tools.d.ts.map +1 -0
  41. package/dist/graph-tools.js +554 -0
  42. package/dist/graph-tools.js.map +1 -0
  43. package/dist/horizon-env.d.ts +61 -0
  44. package/dist/horizon-env.d.ts.map +1 -0
  45. package/dist/horizon-env.js +120 -0
  46. package/dist/horizon-env.js.map +1 -0
  47. package/dist/index.d.ts +15 -4
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +10 -2
  50. package/dist/index.js.map +1 -1
  51. package/dist/inspect-tools.d.ts +2 -2
  52. package/dist/inspect-tools.d.ts.map +1 -1
  53. package/dist/inspect-tools.js +303 -6
  54. package/dist/inspect-tools.js.map +1 -1
  55. package/dist/knowledge-index.d.ts +33 -2
  56. package/dist/knowledge-index.d.ts.map +1 -1
  57. package/dist/knowledge-index.js +90 -19
  58. package/dist/knowledge-index.js.map +1 -1
  59. package/dist/managed-session.d.ts.map +1 -1
  60. package/dist/managed-session.js +61 -2
  61. package/dist/managed-session.js.map +1 -1
  62. package/dist/management-client.d.ts +81 -3
  63. package/dist/management-client.d.ts.map +1 -1
  64. package/dist/management-client.js +97 -20
  65. package/dist/management-client.js.map +1 -1
  66. package/dist/orchestration/agents.d.ts +4 -1
  67. package/dist/orchestration/agents.d.ts.map +1 -1
  68. package/dist/orchestration/agents.js +27 -4
  69. package/dist/orchestration/agents.js.map +1 -1
  70. package/dist/orchestration/index.d.ts +2 -2
  71. package/dist/orchestration/index.js +1 -1
  72. package/dist/orchestration/lifecycle.d.ts +3 -0
  73. package/dist/orchestration/lifecycle.d.ts.map +1 -1
  74. package/dist/orchestration/lifecycle.js +6 -1
  75. package/dist/orchestration/lifecycle.js.map +1 -1
  76. package/dist/orchestration/queue.d.ts.map +1 -1
  77. package/dist/orchestration/queue.js +10 -1
  78. package/dist/orchestration/queue.js.map +1 -1
  79. package/dist/orchestration/runtime.d.ts +1 -1
  80. package/dist/orchestration/state.d.ts +1 -0
  81. package/dist/orchestration/state.d.ts.map +1 -1
  82. package/dist/orchestration/state.js +1 -0
  83. package/dist/orchestration/state.js.map +1 -1
  84. package/dist/orchestration/turn.d.ts +2 -2
  85. package/dist/orchestration/turn.d.ts.map +1 -1
  86. package/dist/orchestration/turn.js +42 -12
  87. package/dist/orchestration/turn.js.map +1 -1
  88. package/dist/orchestration-registry.d.ts.map +1 -1
  89. package/dist/orchestration-registry.js +4 -2
  90. package/dist/orchestration-registry.js.map +1 -1
  91. package/dist/orchestration-version.d.ts +1 -1
  92. package/dist/orchestration-version.js +1 -1
  93. package/dist/orchestration.d.ts +2 -2
  94. package/dist/orchestration.js +1 -1
  95. package/dist/orchestration_1_0_46.d.ts +1 -1
  96. package/dist/orchestration_1_0_47.d.ts +1 -1
  97. package/dist/orchestration_1_0_48.d.ts +1 -1
  98. package/dist/orchestration_1_0_49.d.ts +1 -1
  99. package/dist/orchestration_1_0_50.d.ts +1 -1
  100. package/dist/orchestration_1_0_52/agents.d.ts +38 -0
  101. package/dist/orchestration_1_0_52/agents.d.ts.map +1 -0
  102. package/dist/orchestration_1_0_52/agents.js +735 -0
  103. package/dist/orchestration_1_0_52/agents.js.map +1 -0
  104. package/dist/orchestration_1_0_52/index.d.ts +24 -0
  105. package/dist/orchestration_1_0_52/index.d.ts.map +1 -0
  106. package/dist/orchestration_1_0_52/index.js +13 -0
  107. package/dist/orchestration_1_0_52/index.js.map +1 -0
  108. package/dist/orchestration_1_0_52/lifecycle.d.ts +38 -0
  109. package/dist/orchestration_1_0_52/lifecycle.d.ts.map +1 -0
  110. package/dist/orchestration_1_0_52/lifecycle.js +504 -0
  111. package/dist/orchestration_1_0_52/lifecycle.js.map +1 -0
  112. package/dist/orchestration_1_0_52/queue.d.ts +7 -0
  113. package/dist/orchestration_1_0_52/queue.d.ts.map +1 -0
  114. package/dist/orchestration_1_0_52/queue.js +635 -0
  115. package/dist/orchestration_1_0_52/queue.js.map +1 -0
  116. package/dist/orchestration_1_0_52/runtime.d.ts +29 -0
  117. package/dist/orchestration_1_0_52/runtime.d.ts.map +1 -0
  118. package/dist/orchestration_1_0_52/runtime.js +190 -0
  119. package/dist/orchestration_1_0_52/runtime.js.map +1 -0
  120. package/dist/orchestration_1_0_52/state.d.ts +124 -0
  121. package/dist/orchestration_1_0_52/state.d.ts.map +1 -0
  122. package/dist/orchestration_1_0_52/state.js +104 -0
  123. package/dist/orchestration_1_0_52/state.js.map +1 -0
  124. package/dist/orchestration_1_0_52/turn.d.ts +6 -0
  125. package/dist/orchestration_1_0_52/turn.d.ts.map +1 -0
  126. package/dist/orchestration_1_0_52/turn.js +834 -0
  127. package/dist/orchestration_1_0_52/turn.js.map +1 -0
  128. package/dist/orchestration_1_0_52/utils.d.ts +22 -0
  129. package/dist/orchestration_1_0_52/utils.d.ts.map +1 -0
  130. package/dist/orchestration_1_0_52/utils.js +226 -0
  131. package/dist/orchestration_1_0_52/utils.js.map +1 -0
  132. package/dist/resourcemgr-tools.d.ts +2 -2
  133. package/dist/resourcemgr-tools.d.ts.map +1 -1
  134. package/dist/resourcemgr-tools.js +1 -1
  135. package/dist/resourcemgr-tools.js.map +1 -1
  136. package/dist/session-dumper.d.ts +2 -2
  137. package/dist/session-dumper.d.ts.map +1 -1
  138. package/dist/session-dumper.js.map +1 -1
  139. package/dist/session-manager.d.ts +8 -2
  140. package/dist/session-manager.d.ts.map +1 -1
  141. package/dist/session-manager.js +86 -4
  142. package/dist/session-manager.js.map +1 -1
  143. package/dist/session-messages.d.ts +2 -2
  144. package/dist/session-messages.d.ts.map +1 -1
  145. package/dist/session-messages.js +0 -6
  146. package/dist/session-messages.js.map +1 -1
  147. package/dist/session-proxy.d.ts +47 -2
  148. package/dist/session-proxy.d.ts.map +1 -1
  149. package/dist/session-proxy.js +79 -59
  150. package/dist/session-proxy.js.map +1 -1
  151. package/dist/storage-config.d.ts +62 -0
  152. package/dist/storage-config.d.ts.map +1 -0
  153. package/dist/storage-config.js +138 -0
  154. package/dist/storage-config.js.map +1 -0
  155. package/dist/storage-providers.d.ts +25 -0
  156. package/dist/storage-providers.d.ts.map +1 -0
  157. package/dist/storage-providers.js +150 -0
  158. package/dist/storage-providers.js.map +1 -0
  159. package/dist/sweeper-tools.d.ts +2 -2
  160. package/dist/sweeper-tools.d.ts.map +1 -1
  161. package/dist/system-agents.d.ts +2 -2
  162. package/dist/system-agents.d.ts.map +1 -1
  163. package/dist/types.d.ts +103 -2
  164. package/dist/types.d.ts.map +1 -1
  165. package/dist/types.js.map +1 -1
  166. package/dist/worker.d.ts +5 -4
  167. package/dist/worker.d.ts.map +1 -1
  168. package/dist/worker.js +108 -33
  169. package/dist/worker.js.map +1 -1
  170. package/package.json +3 -1
  171. package/plugins/mgmt/agents/agent-tuner.agent.md +56 -4
  172. package/plugins/mgmt/agents/facts-manager.agent.md +81 -3
  173. package/plugins/mgmt/skills/graph-debug/SKILL.md +133 -0
@@ -387,6 +387,7 @@ export function createSessionProxy(ctx, sessionId, affinityKey, config) {
387
387
  ...(turnMeta?.parentSessionId ? { parentSessionId: turnMeta.parentSessionId } : {}),
388
388
  ...(turnMeta?.nestingLevel != null ? { nestingLevel: turnMeta.nestingLevel } : {}),
389
389
  ...(turnMeta?.requiredTool ? { requiredTool: turnMeta.requiredTool } : {}),
390
+ ...(turnMeta?.cycleOrigin ? { cycleOrigin: turnMeta.cycleOrigin } : {}),
390
391
  ...(turnMeta?.retryCount != null ? { retryCount: turnMeta.retryCount } : {}),
391
392
  ...(turnMeta?.clientMessageIds && turnMeta.clientMessageIds.length > 0
392
393
  ? { clientMessageIds: turnMeta.clientMessageIds }
@@ -427,6 +428,47 @@ export function buildRunTurnConfig(inputConfig, hostname, fallbackAgentIdentity)
427
428
  }
428
429
  return runConfig;
429
430
  }
431
+ /**
432
+ * Derive the app-assigned HARVESTER role from the bound agent definition
433
+ * (enhancedfactstore 07 §1.5 / P4 review BLOCKER#2).
434
+ *
435
+ * The harvester role is a property of the AGENT, not of a session: it is
436
+ * resolved from the worker's static, loaded agent definitions every turn by
437
+ * matching the session's resolved identity (agentIdentity / boundAgentName)
438
+ * against each agent's CANONICAL identifier (id / name). Because the agent list
439
+ * is static worker configuration, this is deterministic and replay-safe.
440
+ *
441
+ * Deriving it here (rather than trusting a persisted `isHarvester`) means the
442
+ * role can NEVER be inherited from a parent session or smuggled in via a stale
443
+ * serialized config — a child only becomes a harvester if its OWN bound agent
444
+ * declares `harvester: true`. System agents (e.g. facts-manager) that should be
445
+ * harvester-capable get the tools through the SessionManager gating, not here.
446
+ *
447
+ * SECURITY (P5 review BLOCKER#2): `title` is display metadata, NOT an
448
+ * authorization key — matching on it would let a non-harvester whose title
449
+ * normalizes to a harvester's identity receive the privileged crawl queue
450
+ * (`facts_read_uncrawled` / `facts_mark_crawled`, which read facts across ALL
451
+ * scopes). We match only `id` / `name`, and we FAIL CLOSED on ambiguity: when
452
+ * more than one loaded agent resolves to the same normalized identity, the
453
+ * privileged role is granted only if EVERY one of them declares `harvester`.
454
+ */
455
+ export function resolveHarvesterRole(identity, boundAgentName, userAgents, systemAgents) {
456
+ const norm = (v) => (v || "").toLowerCase().replace(/[^a-z0-9]+/g, "");
457
+ const target = norm(identity) || norm(boundAgentName);
458
+ if (!target)
459
+ return false;
460
+ const agents = [...(userAgents ?? []), ...(systemAgents ?? [])];
461
+ // Canonical identifiers ONLY — never `title`.
462
+ const matches = agents.filter((a) => {
463
+ const candidates = [a.id, a.name].map(norm).filter(Boolean);
464
+ return candidates.includes(target);
465
+ });
466
+ if (matches.length === 0)
467
+ return false;
468
+ // Fail closed on a normalized-id/name collision: do not let an ambiguous
469
+ // match between a harvester and a non-harvester escalate to the role.
470
+ return matches.every((a) => a.harvester === true);
471
+ }
430
472
  // ─── SessionManagerProxy ─────────────────────────────────────────
431
473
  // The orchestration's view of the SessionManager singleton.
432
474
  // Operations that don't require session affinity.
@@ -532,6 +574,24 @@ userAgents,
532
574
  factStore,
533
575
  /** Worker node identifier — written on every CMS event for worker tracking. */
534
576
  workerNodeId) {
577
+ // Shared config for every activity-layer internal PilotSwarmClient /
578
+ // PilotSwarmManagementClient. Carries the FULL facts/CMS target (07 P3) so
579
+ // these clients resolve the SAME store as the worker — otherwise
580
+ // parent-triggered deleteSession / cleanup / reads would hit the wrong DB
581
+ // when facts live on an enhanced (HorizonDB) store.
582
+ const internalClientConfig = () => ({
583
+ store: storeUrl,
584
+ ...(clientConfig?.storageConfig != null && { storageConfig: clientConfig.storageConfig }),
585
+ cmsSchema,
586
+ ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
587
+ ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
588
+ ...(clientConfig?.cmsFactsDatabaseUrl != null && { cmsFactsDatabaseUrl: clientConfig.cmsFactsDatabaseUrl }),
589
+ ...(clientConfig?.enhancedFactsDatabaseUrl != null && { enhancedFactsDatabaseUrl: clientConfig.enhancedFactsDatabaseUrl }),
590
+ ...(clientConfig?.factsProvider != null && { factsProvider: clientConfig.factsProvider }),
591
+ ...(clientConfig?.enhancedFactsSchema != null && { enhancedFactsSchema: clientConfig.enhancedFactsSchema }),
592
+ ...(clientConfig?.useManagedIdentity != null && { useManagedIdentity: clientConfig.useManagedIdentity }),
593
+ ...(clientConfig?.aadDbUser != null && { aadDbUser: clientConfig.aadDbUser }),
594
+ });
535
595
  // ── runTurn ──────────────────────────────────────────────
536
596
  runtime.registerActivity("runTurn", async (activityCtx, input) => {
537
597
  activityCtx.traceInfo(`[runTurn] session=${input.sessionId}`);
@@ -555,6 +615,7 @@ workerNodeId) {
555
615
  "pilotswarm.has_parent_session": Boolean(input.parentSessionId),
556
616
  ...(input.parentSessionId ? { "pilotswarm.parent_session_id": input.parentSessionId } : {}),
557
617
  ...(input.requiredTool ? { "pilotswarm.required_tool": input.requiredTool } : {}),
618
+ ...(input.cycleOrigin ? { "pilotswarm.cycle_origin": input.cycleOrigin } : {}),
558
619
  ...(input.config.model ? { "pilotswarm.model": input.config.model } : {}),
559
620
  ...(input.config.reasoningEffort ? { "pilotswarm.reasoning_effort": input.config.reasoningEffort } : {}),
560
621
  ...(workerNodeId ? { "pilotswarm.worker_node_id": workerNodeId } : {}),
@@ -571,6 +632,12 @@ workerNodeId) {
571
632
  fallbackAgentIdentity = row?.agentId ?? undefined;
572
633
  }
573
634
  const runConfig = buildRunTurnConfig(input.config, hostname, fallbackAgentIdentity);
635
+ // Derive the app-assigned harvester role authoritatively from the bound
636
+ // agent definition EVERY turn (enhancedfactstore 07 §1.5 / BLOCKER#2).
637
+ // It is a property of the agent, resolved from static worker config, so
638
+ // it survives hydration, is replay-safe, and can never be inherited from
639
+ // a parent or trusted from a stale serialized config.
640
+ runConfig.isHarvester = resolveHarvesterRole(runConfig.agentIdentity, runConfig.boundAgentName, userAgents, systemAgents);
574
641
  const trace = activityTrace(activityCtx, "runTurn");
575
642
  const failForMissingState = async (message) => {
576
643
  if (catalog) {
@@ -653,12 +720,7 @@ workerNodeId) {
653
720
  if (!storeUrl)
654
721
  throw new Error("No storeUrl — cannot create PilotSwarmClient");
655
722
  inlineSdkClientPromise = (async () => {
656
- const startedClient = new PilotSwarmClient({
657
- store: storeUrl,
658
- cmsSchema,
659
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
660
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
661
- });
723
+ const startedClient = new PilotSwarmClient(internalClientConfig());
662
724
  await startedClient.start();
663
725
  inlineSdkClient = startedClient;
664
726
  return startedClient;
@@ -819,7 +881,7 @@ workerNodeId) {
819
881
  // still apply. The parent is responsible for closing
820
882
  // each instance with complete_agent / cancel_agent /
821
883
  // delete_agent when it no longer needs the child.
822
- const { boundAgentName: _parentBoundAgentName, promptLayering: _parentPromptLayering, ...parentConfig } = input.config;
884
+ const { boundAgentName: _parentBoundAgentName, promptLayering: _parentPromptLayering, isHarvester: _parentIsHarvester, ...parentConfig } = input.config;
823
885
  const childConfig = {
824
886
  ...parentConfig,
825
887
  ...(agentModel ? { model: agentModel } : {}),
@@ -1353,6 +1415,7 @@ workerNodeId) {
1353
1415
  modelSummary: sessionManager.getModelSummary(),
1354
1416
  bootstrap: input.bootstrap,
1355
1417
  requiredTool: input.requiredTool,
1418
+ cycleOrigin: input.cycleOrigin,
1356
1419
  controlToolBridge,
1357
1420
  });
1358
1421
  };
@@ -1977,10 +2040,7 @@ workerNodeId) {
1977
2040
  if (!storeUrl)
1978
2041
  throw new Error("No storeUrl — cannot create PilotSwarmClient");
1979
2042
  const sdkClient = new PilotSwarmClient({
1980
- store: storeUrl,
1981
- cmsSchema,
1982
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
1983
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
2043
+ ...internalClientConfig(),
1984
2044
  traceWriter: (message) => trace(message),
1985
2045
  });
1986
2046
  try {
@@ -2101,12 +2161,7 @@ workerNodeId) {
2101
2161
  activityCtx.traceInfo(`[sendToSession] session=${input.sessionId} msg="${input.message.slice(0, 60)}"`);
2102
2162
  if (!storeUrl)
2103
2163
  throw new Error("No storeUrl — cannot create PilotSwarmClient");
2104
- const sdkClient = new PilotSwarmClient({
2105
- store: storeUrl,
2106
- cmsSchema,
2107
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
2108
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
2109
- });
2164
+ const sdkClient = new PilotSwarmClient(internalClientConfig());
2110
2165
  try {
2111
2166
  await sdkClient.start();
2112
2167
  const info = await sdkClient._getSessionInfo(input.sessionId);
@@ -2136,12 +2191,7 @@ workerNodeId) {
2136
2191
  activityCtx.traceInfo(`[sendCommandToSession] session=${input.sessionId} cmd=${input.command?.cmd}`);
2137
2192
  if (!storeUrl)
2138
2193
  throw new Error("No storeUrl — cannot create PilotSwarmClient");
2139
- const sdkClient = new PilotSwarmClient({
2140
- store: storeUrl,
2141
- cmsSchema,
2142
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
2143
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
2144
- });
2194
+ const sdkClient = new PilotSwarmClient(internalClientConfig());
2145
2195
  try {
2146
2196
  await sdkClient.start();
2147
2197
  const orchestrationId = `session-${input.sessionId}`;
@@ -2158,12 +2208,7 @@ workerNodeId) {
2158
2208
  activityCtx.traceInfo(`[getSessionStatus] session=${input.sessionId}`);
2159
2209
  if (!storeUrl)
2160
2210
  throw new Error("No storeUrl — cannot create PilotSwarmClient");
2161
- const sdkClient = new PilotSwarmClient({
2162
- store: storeUrl,
2163
- cmsSchema,
2164
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
2165
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
2166
- });
2211
+ const sdkClient = new PilotSwarmClient(internalClientConfig());
2167
2212
  try {
2168
2213
  await sdkClient.start();
2169
2214
  const info = await sdkClient._getSessionInfo(input.sessionId);
@@ -2186,12 +2231,7 @@ workerNodeId) {
2186
2231
  activityCtx.traceInfo(`[getOrchestrationStats] session=${input.sessionId}`);
2187
2232
  if (!storeUrl)
2188
2233
  throw new Error("No storeUrl — cannot create PilotSwarmManagementClient");
2189
- const managementClient = new PilotSwarmManagementClient({
2190
- store: storeUrl,
2191
- cmsSchema,
2192
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
2193
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
2194
- });
2234
+ const managementClient = new PilotSwarmManagementClient(internalClientConfig());
2195
2235
  try {
2196
2236
  await managementClient.start();
2197
2237
  return await managementClient.getOrchestrationStats(input.sessionId);
@@ -2206,12 +2246,7 @@ workerNodeId) {
2206
2246
  activityCtx.traceInfo(`[listSessions]`);
2207
2247
  if (!storeUrl)
2208
2248
  throw new Error("No storeUrl — cannot create PilotSwarmClient");
2209
- const sdkClient = new PilotSwarmClient({
2210
- store: storeUrl,
2211
- cmsSchema,
2212
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
2213
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
2214
- });
2249
+ const sdkClient = new PilotSwarmClient(internalClientConfig());
2215
2250
  try {
2216
2251
  await sdkClient.start();
2217
2252
  const sessions = (await sdkClient.listSessions()).filter((session) => matchesSessionOwnerFilters(session, input));
@@ -2236,12 +2271,7 @@ workerNodeId) {
2236
2271
  activityCtx.traceInfo(`[listChildSessions] parent=${input.parentSessionId}`);
2237
2272
  if (!storeUrl)
2238
2273
  throw new Error("No storeUrl — cannot create PilotSwarmClient");
2239
- const sdkClient = new PilotSwarmClient({
2240
- store: storeUrl,
2241
- cmsSchema,
2242
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
2243
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
2244
- });
2274
+ const sdkClient = new PilotSwarmClient(internalClientConfig());
2245
2275
  try {
2246
2276
  await sdkClient.start();
2247
2277
  const sessions = await sdkClient.listSessions();
@@ -2310,12 +2340,7 @@ workerNodeId) {
2310
2340
  activityCtx.traceInfo(`[cancelSession] session=${input.sessionId} reason=${input.reason ?? "none"}`);
2311
2341
  if (!storeUrl)
2312
2342
  throw new Error("No storeUrl — cannot create PilotSwarmClient");
2313
- const sdkClient = new PilotSwarmClient({
2314
- store: storeUrl,
2315
- cmsSchema,
2316
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
2317
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
2318
- });
2343
+ const sdkClient = new PilotSwarmClient(internalClientConfig());
2319
2344
  try {
2320
2345
  await sdkClient.start();
2321
2346
  const orchestrationId = `session-${input.sessionId}`;
@@ -2343,12 +2368,7 @@ workerNodeId) {
2343
2368
  activityCtx.traceInfo(`[deleteSession] session=${input.sessionId} reason=${input.reason ?? "none"}`);
2344
2369
  if (!storeUrl)
2345
2370
  throw new Error("No storeUrl — cannot create PilotSwarmClient");
2346
- const sdkClient = new PilotSwarmClient({
2347
- store: storeUrl,
2348
- cmsSchema,
2349
- ...(clientConfig?.duroxideSchema != null && { duroxideSchema: clientConfig.duroxideSchema }),
2350
- ...(clientConfig?.factsSchema != null && { factsSchema: clientConfig.factsSchema }),
2351
- });
2371
+ const sdkClient = new PilotSwarmClient(internalClientConfig());
2352
2372
  try {
2353
2373
  await sdkClient.start();
2354
2374
  // This does both: CMS soft-delete + duroxide cancel