@skaile/workspaces 4.26.0 → 4.27.1

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 (133) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{asset-feeds-72RJOE4E.js → asset-feeds-2KMVU67Q.js} +4 -4
  3. package/dist/{asset-feeds-72RJOE4E.js.map → asset-feeds-2KMVU67Q.js.map} +1 -1
  4. package/dist/asset-manager/index.js +1 -1
  5. package/dist/bridge/drivers/claude-sdk.js +20 -8
  6. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  7. package/dist/bridge/drivers/codex.js +2 -2
  8. package/dist/bridge/drivers/continue.js +3 -3
  9. package/dist/bridge/drivers/echo.js +3 -5
  10. package/dist/bridge/drivers/echo.js.map +1 -1
  11. package/dist/bridge/drivers/gemini.js +5 -5
  12. package/dist/bridge/drivers/goose.js +3 -3
  13. package/dist/bridge/drivers/omp.js +22 -8
  14. package/dist/bridge/drivers/omp.js.map +1 -1
  15. package/dist/bridge/drivers/opencode.js +3 -3
  16. package/dist/bridge/drivers/qwen.js +5 -5
  17. package/dist/bridge/index.js +5 -4
  18. package/dist/bridge/src/capability-dispatch.d.ts +16 -31
  19. package/dist/bridge/src/capability-dispatch.d.ts.map +1 -1
  20. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
  21. package/dist/bridge/src/drivers/echo.d.ts.map +1 -1
  22. package/dist/bridge/src/drivers/omp.d.ts.map +1 -1
  23. package/dist/bridge/src/index.d.ts +1 -0
  24. package/dist/bridge/src/index.d.ts.map +1 -1
  25. package/dist/bridge/src/reconfigure-model-ref.d.ts +37 -0
  26. package/dist/bridge/src/reconfigure-model-ref.d.ts.map +1 -0
  27. package/dist/bridge/src/types.d.ts +10 -2
  28. package/dist/bridge/src/types.d.ts.map +1 -1
  29. package/dist/{chunk-EZOFQW3G.js → chunk-2L4KARVG.js} +5 -5
  30. package/dist/{chunk-EZOFQW3G.js.map → chunk-2L4KARVG.js.map} +1 -1
  31. package/dist/{chunk-H4XNX2FG.js → chunk-746DTX5S.js} +2 -2
  32. package/dist/{chunk-H4XNX2FG.js.map → chunk-746DTX5S.js.map} +1 -1
  33. package/dist/{chunk-OQRSSFTU.js → chunk-A2F7D47N.js} +4 -4
  34. package/dist/{chunk-OQRSSFTU.js.map → chunk-A2F7D47N.js.map} +1 -1
  35. package/dist/{chunk-Y6QVVKFN.js → chunk-AVYBLJ3A.js} +3 -3
  36. package/dist/{chunk-Y6QVVKFN.js.map → chunk-AVYBLJ3A.js.map} +1 -1
  37. package/dist/{chunk-IN466NSZ.js → chunk-BADVX5LG.js} +3 -3
  38. package/dist/{chunk-IN466NSZ.js.map → chunk-BADVX5LG.js.map} +1 -1
  39. package/dist/{chunk-SSODNBSC.js → chunk-CCHZLELJ.js} +3 -3
  40. package/dist/{chunk-SSODNBSC.js.map → chunk-CCHZLELJ.js.map} +1 -1
  41. package/dist/{chunk-SB4U7HLP.js → chunk-DOKEJ6H3.js} +6 -6
  42. package/dist/{chunk-SB4U7HLP.js.map → chunk-DOKEJ6H3.js.map} +1 -1
  43. package/dist/{chunk-PIY5NTXY.js → chunk-GKE66NTN.js} +3 -3
  44. package/dist/{chunk-PIY5NTXY.js.map → chunk-GKE66NTN.js.map} +1 -1
  45. package/dist/{chunk-XZCRIPWT.js → chunk-H3YO74Z5.js} +3 -3
  46. package/dist/{chunk-XZCRIPWT.js.map → chunk-H3YO74Z5.js.map} +1 -1
  47. package/dist/{chunk-IRGI7Q62.js → chunk-IQID7X6P.js} +2 -2
  48. package/dist/{chunk-IRGI7Q62.js.map → chunk-IQID7X6P.js.map} +1 -1
  49. package/dist/{chunk-2JGUFDKZ.js → chunk-JBSCY34V.js} +3 -3
  50. package/dist/{chunk-2JGUFDKZ.js.map → chunk-JBSCY34V.js.map} +1 -1
  51. package/dist/{chunk-47MUF565.js → chunk-LFYAU2H3.js} +6 -6
  52. package/dist/{chunk-47MUF565.js.map → chunk-LFYAU2H3.js.map} +1 -1
  53. package/dist/{chunk-IBMQMJ4X.js → chunk-MNJFBKFR.js} +3 -3
  54. package/dist/{chunk-IBMQMJ4X.js.map → chunk-MNJFBKFR.js.map} +1 -1
  55. package/dist/{chunk-JIPPMYOM.js → chunk-NLUW3IJL.js} +3 -3
  56. package/dist/{chunk-JIPPMYOM.js.map → chunk-NLUW3IJL.js.map} +1 -1
  57. package/dist/{chunk-YR3CLEQG.js → chunk-OGOQYOM4.js} +6 -6
  58. package/dist/{chunk-YR3CLEQG.js.map → chunk-OGOQYOM4.js.map} +1 -1
  59. package/dist/{chunk-UKUKVQO3.js → chunk-QJN462RG.js} +84 -23
  60. package/dist/chunk-QJN462RG.js.map +1 -0
  61. package/dist/chunk-TJRNJVGU.js +59 -0
  62. package/dist/chunk-TJRNJVGU.js.map +1 -0
  63. package/dist/{chunk-D3UARV3Z.js → chunk-TRRFUVDJ.js} +8 -7
  64. package/dist/chunk-TRRFUVDJ.js.map +1 -0
  65. package/dist/{chunk-IHFQTKUP.js → chunk-YOA4YBMR.js} +2 -2
  66. package/dist/{chunk-IHFQTKUP.js.map → chunk-YOA4YBMR.js.map} +1 -1
  67. package/dist/cli/index.js +33 -32
  68. package/dist/cli/index.js.map +1 -1
  69. package/dist/connectors/index.js +6 -5
  70. package/dist/{ensure-sources-HEOQJ4CS.js → ensure-sources-WQNMDENC.js} +4 -4
  71. package/dist/{ensure-sources-HEOQJ4CS.js.map → ensure-sources-WQNMDENC.js.map} +1 -1
  72. package/dist/factory-assets/connectors/box.js +6 -5
  73. package/dist/factory-assets/connectors/deploy.js +6 -5
  74. package/dist/factory-assets/connectors/devserver.js +6 -5
  75. package/dist/factory-assets/connectors/flow/adapter.js +6 -5
  76. package/dist/factory-assets/connectors/flow/run-flow.js +7 -6
  77. package/dist/factory-assets/connectors/flow.js +6 -5
  78. package/dist/factory-assets/connectors/git.js +6 -5
  79. package/dist/factory-assets/connectors/gmail.js +6 -5
  80. package/dist/factory-assets/connectors/googledrive.js +6 -5
  81. package/dist/factory-assets/connectors/local.js +6 -5
  82. package/dist/factory-assets/connectors/mattermost.js +6 -5
  83. package/dist/factory-assets/connectors/memory.js +6 -5
  84. package/dist/factory-assets/connectors/minio.js +6 -5
  85. package/dist/factory-assets/connectors/postgres.js +6 -5
  86. package/dist/factory-assets/connectors/s3.js +6 -5
  87. package/dist/factory-assets/connectors/sharepoint.js +6 -5
  88. package/dist/factory-assets/connectors/sqlite.js +6 -5
  89. package/dist/factory-assets/connectors/static-server.js +6 -5
  90. package/dist/factory-assets/connectors/tunnel.js +6 -5
  91. package/dist/factory-assets/connectors/webdav.js +6 -5
  92. package/dist/factory-assets/connectors/xstate-store.js +6 -5
  93. package/dist/factory-assets/connectors/xstate.js +6 -5
  94. package/dist/{helpers-VZJCQSLY.js → helpers-JLK7VJJK.js} +4 -4
  95. package/dist/{helpers-VZJCQSLY.js.map → helpers-JLK7VJJK.js.map} +1 -1
  96. package/dist/{library-publish-VBLSTO7S.js → library-publish-KTCHVGLN.js} +6 -6
  97. package/dist/{library-publish-VBLSTO7S.js.map → library-publish-KTCHVGLN.js.map} +1 -1
  98. package/dist/{open-library-SJ54ZBGJ.js → open-library-TJWAJRJS.js} +5 -5
  99. package/dist/{open-library-SJ54ZBGJ.js.map → open-library-TJWAJRJS.js.map} +1 -1
  100. package/dist/{project-GLZR4SLT.js → project-JBMJ44HH.js} +5 -5
  101. package/dist/{project-GLZR4SLT.js.map → project-JBMJ44HH.js.map} +1 -1
  102. package/dist/runner/index.js +9 -8
  103. package/dist/runner/src/capability-registry.d.ts +4 -5
  104. package/dist/runner/src/capability-registry.d.ts.map +1 -1
  105. package/dist/runner/src/capability-roundtrip.d.ts +2 -1
  106. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  107. package/dist/runner/src/codex-tools.d.ts.map +1 -1
  108. package/dist/runner/src/define-capability.d.ts +9 -0
  109. package/dist/runner/src/define-capability.d.ts.map +1 -1
  110. package/dist/runner/src/reconfigure-handler.d.ts +22 -5
  111. package/dist/runner/src/reconfigure-handler.d.ts.map +1 -1
  112. package/dist/runner/src/serve.d.ts +35 -0
  113. package/dist/runner/src/serve.d.ts.map +1 -1
  114. package/dist/runner/src/session-capability-wiring.d.ts +2 -0
  115. package/dist/runner/src/session-capability-wiring.d.ts.map +1 -1
  116. package/dist/sdk/asset-manager.js +1 -1
  117. package/dist/sdk/bridge.js +5 -4
  118. package/dist/sdk/index.js +9 -8
  119. package/dist/sdk/index.js.map +1 -1
  120. package/dist/sdk/runner.js +9 -8
  121. package/dist/{setup-X73AWRMD.js → setup-6QBZIBW2.js} +10 -9
  122. package/dist/setup-6QBZIBW2.js.map +1 -0
  123. package/dist/{source-HYXJO2IE.js → source-AEBW5RRF.js} +6 -6
  124. package/dist/{source-HYXJO2IE.js.map → source-AEBW5RRF.js.map} +1 -1
  125. package/dist/{source-manifest-publish-V5LCVOYZ.js → source-manifest-publish-E2FTXASK.js} +7 -7
  126. package/dist/{source-manifest-publish-V5LCVOYZ.js.map → source-manifest-publish-E2FTXASK.js.map} +1 -1
  127. package/dist/tui/index.js +9 -8
  128. package/dist/tui/index.js.map +1 -1
  129. package/dist/workspace-plugin/index.js +1 -1
  130. package/package.json +1 -1
  131. package/dist/chunk-D3UARV3Z.js.map +0 -1
  132. package/dist/chunk-UKUKVQO3.js.map +0 -1
  133. package/dist/setup-X73AWRMD.js.map +0 -1
@@ -1,20 +1,21 @@
1
- import { WorkspacePlugin } from './chunk-H4XNX2FG.js';
1
+ import { WorkspacePlugin } from './chunk-746DTX5S.js';
2
2
  import { buildWorkspaceToolDefs } from './chunk-HMUFI3L5.js';
3
3
  import { findAiAssetsRoot } from './chunk-7IH3RKKK.js';
4
4
  import { WebSocketServerTransport } from './chunk-5LKOAX7I.js';
5
5
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
6
6
  import { prepareNativePolicy, codexInstanceEnvironment, parseCodexCredential, parseCodexRefreshInput, parseCodexRefreshResult } from './chunk-PE3A6FFW.js';
7
- import { resolveFlowPath } from './chunk-IBMQMJ4X.js';
7
+ import { resolveFlowPath } from './chunk-MNJFBKFR.js';
8
8
  import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-Q6NDQ6BH.js';
9
- import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-EZOFQW3G.js';
9
+ import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-2L4KARVG.js';
10
10
  import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-2OLNNQKT.js';
11
- import { EventNormalizer } from './chunk-IN466NSZ.js';
11
+ import { EventNormalizer } from './chunk-BADVX5LG.js';
12
12
  import { probeResumeTranscript, transcriptStoreForRuntime } from './chunk-6S5KL76M.js';
13
+ import { scopeReconfigureModel } from './chunk-TJRNJVGU.js';
13
14
  import { CodexNativeStateUnavailable } from './chunk-LOO5CB5M.js';
14
- import { dispatchCapability } from './chunk-D3UARV3Z.js';
15
+ import { dispatchCapability } from './chunk-TRRFUVDJ.js';
15
16
  import { classifyClaudeSdkError } from './chunk-BGY4KTU6.js';
16
17
  import { agentExecRequested } from './chunk-YROR332M.js';
17
- import { toAgentEffort, createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS, AgentDriver } from './chunk-IRGI7Q62.js';
18
+ import { toAgentEffort, createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS, AgentDriver } from './chunk-IQID7X6P.js';
18
19
  import { loadFlow } from './chunk-KTCMBEEB.js';
19
20
  import { parseFlowDefinition } from './chunk-ALLCAFHQ.js';
20
21
  import { renderStimulusPrompt } from './chunk-D6YOE2DB.js';
@@ -863,7 +864,6 @@ async function prepareCodexTools(options) {
863
864
  const { result } = await cancellable(
864
865
  dispatchCapability(
865
866
  hooks,
866
- randomUUID(),
867
867
  call.params.name,
868
868
  call.params.arguments ?? {},
869
869
  () => {
@@ -3400,13 +3400,15 @@ var CapabilityRegistry = class {
3400
3400
  * error still reaches the caller unchanged. `SKAILE_LOG_CONTENT=1` adds the
3401
3401
  * content back on a developer machine (see `log-content.ts`).
3402
3402
  *
3403
- * `baseCtx.callId` (the bridge's dispatch call id) correlates the rows; a random id is
3404
- * used when the caller has none.
3403
+ * `baseCtx.callId` (the bridge's dispatch call id) correlates the rows and is
3404
+ * forwarded to the handler as `ctx.callId`; a random id is used when the caller
3405
+ * has none.
3405
3406
  *
3406
3407
  * @throws when the capability is unknown or the input fails validation
3407
3408
  */
3408
3409
  async invoke(name, input, baseCtx) {
3409
3410
  const { callId: givenCallId, ...handlerCtx } = baseCtx;
3411
+ const callId = givenCallId ?? randomUUID();
3410
3412
  handlerCtx.signal?.throwIfAborted();
3411
3413
  const cap = this.resolve(name);
3412
3414
  if (!cap) {
@@ -3417,7 +3419,6 @@ var CapabilityRegistry = class {
3417
3419
  subkind: cap.origin.kind,
3418
3420
  instance: capabilityLogInstance(cap)
3419
3421
  });
3420
- const callId = givenCallId ?? randomUUID();
3421
3422
  const withContent = isContentLoggingEnabled();
3422
3423
  const startedAt = performance.now();
3423
3424
  const durationMs = () => Math.round(performance.now() - startedAt);
@@ -3429,7 +3430,7 @@ var CapabilityRegistry = class {
3429
3430
  });
3430
3431
  try {
3431
3432
  const validated = cap.inputZod.parse(input);
3432
- const result = await cap.handler(validated, { ...handlerCtx, log });
3433
+ const result = await cap.handler(validated, { ...handlerCtx, callId, log });
3433
3434
  log.info("ok", {
3434
3435
  callId,
3435
3436
  outcome: "ok",
@@ -3513,8 +3514,8 @@ function resolveCapabilityCallTimeoutMs(cap, approvalTimeoutMs) {
3513
3514
  function buildClientCapabilityHandler(args) {
3514
3515
  const timeoutMs = args.timeoutMs ?? DEFAULT_CAPABILITY_CALL_TIMEOUT_MS;
3515
3516
  const gen = args.generateCallId ?? (() => `cap-${Date.now()}-${Math.floor(Math.random() * 1e9)}`);
3516
- return async (input) => {
3517
- const callId = gen();
3517
+ return async (input, ctx) => {
3518
+ const callId = ctx?.callId ?? gen();
3518
3519
  if (args.wire.fireAndForget) {
3519
3520
  args.emit({
3520
3521
  type: "capability_invoked",
@@ -3525,6 +3526,11 @@ function buildClientCapabilityHandler(args) {
3525
3526
  });
3526
3527
  return {};
3527
3528
  }
3529
+ if (args.pending.has(callId)) {
3530
+ throw new Error(
3531
+ `Capability ${args.wire.name} (callId=${callId}) rejected: a call with this id is already in flight`
3532
+ );
3533
+ }
3528
3534
  return new Promise((resolve4, reject) => {
3529
3535
  const timer = setTimeout(() => {
3530
3536
  args.pending.delete(callId);
@@ -4512,7 +4518,8 @@ function driverAppliesReconfigure(driver) {
4512
4518
  function applyReconfigurePatch(config, patch) {
4513
4519
  if (patch.model !== void 0) {
4514
4520
  config.model = patch.model;
4515
- if (config.modelRef !== void 0) config.modelRef = patch.model;
4521
+ if (patch.modelRef !== void 0) config.modelRef = patch.modelRef;
4522
+ else if (config.modelRef !== void 0) config.modelRef = patch.model;
4516
4523
  }
4517
4524
  if (patch.thinking !== void 0) config.thinking = patch.thinking;
4518
4525
  if (patch.effort !== void 0) config.effort = patch.effort;
@@ -4523,7 +4530,7 @@ function carryLiveReconfigure(config, patch, wireAgentConfigChanged) {
4523
4530
  return patch;
4524
4531
  }
4525
4532
  function buildReconfigureHandler(deps) {
4526
- const { getDriver, rememberPatch, log } = deps;
4533
+ const { getDriver, getModelSelection, rememberPatch, log } = deps;
4527
4534
  return async (patch) => {
4528
4535
  const fields = Object.keys(patch).join(", ");
4529
4536
  const driver = getDriver();
@@ -4546,8 +4553,18 @@ function buildReconfigureHandler(deps) {
4546
4553
  message: `The ${driverId} driver cannot change ${fields} live; the change applies when the session next starts.`
4547
4554
  };
4548
4555
  }
4556
+ let modelRef;
4557
+ const selection = patch.model !== void 0 ? getModelSelection?.() : void 0;
4558
+ if (patch.model !== void 0 && selection) {
4559
+ const scope = scopeReconfigureModel({ ...selection, model: patch.model });
4560
+ if (!scope.ok) {
4561
+ log(`[reconfigure] ${scope.message} (${fields} not applied)`);
4562
+ return { ok: false, code: scope.code, message: scope.message };
4563
+ }
4564
+ modelRef = scope.modelRef;
4565
+ }
4549
4566
  driver.reconfigure(patch);
4550
- rememberPatch(patch);
4567
+ rememberPatch(modelRef === void 0 ? patch : { ...patch, modelRef });
4551
4568
  const model = driver.getModel() ?? null;
4552
4569
  log(`[reconfigure] driver ${driverId} took ${fields} (model=${model ?? "(default)"})`);
4553
4570
  return { ok: true, model };
@@ -7150,6 +7167,7 @@ function wireSessionCapabilities(deps) {
7150
7167
  registerLiveAttachedMcp,
7151
7168
  scheduleDriverRestartForToolChanges,
7152
7169
  getDriver,
7170
+ getModelSelection,
7153
7171
  rememberReconfigure,
7154
7172
  log
7155
7173
  } = deps;
@@ -7211,6 +7229,7 @@ function wireSessionCapabilities(deps) {
7211
7229
  }),
7212
7230
  reconfigure: buildReconfigureHandler({
7213
7231
  getDriver,
7232
+ getModelSelection,
7214
7233
  rememberPatch: rememberReconfigure,
7215
7234
  log
7216
7235
  })
@@ -7489,6 +7508,29 @@ async function setUpFlowConnector(deps) {
7489
7508
  const handle = await deps.connect(manager);
7490
7509
  return { manager, handle, recreated };
7491
7510
  }
7511
+ async function recreateKeepingLiveFlows(flows, deps) {
7512
+ const live = [];
7513
+ for (const { runId, connectorId, flowDef, adapter, handle } of flows) {
7514
+ const execution = adapter.getExecution(handle);
7515
+ if (isTerminalFlowStatus(execution.status)) continue;
7516
+ live.push({ runId, connectorId, flowDef, execution: structuredClone(execution) });
7517
+ }
7518
+ await deps.recreate();
7519
+ const reconnected = [];
7520
+ for (const snapshot of live) {
7521
+ if (deps.hasConnector(snapshot.connectorId)) continue;
7522
+ try {
7523
+ await deps.reconnect(snapshot);
7524
+ reconnected.push(snapshot.runId);
7525
+ } catch (err) {
7526
+ deps.warn("flow run could not be reconnected after the driver recreate", {
7527
+ runId: snapshot.runId,
7528
+ error: err instanceof Error ? err.message : String(err)
7529
+ });
7530
+ }
7531
+ }
7532
+ return reconnected;
7533
+ }
7492
7534
  async function buildStoreSnapshotReplay(manager, activeFlows) {
7493
7535
  const events = [];
7494
7536
  for (const { runId, adapter, handle } of activeFlows) {
@@ -8967,7 +9009,7 @@ async function startAgentServer(opts) {
8967
9009
  return { resumeSessionId: prevSessionId };
8968
9010
  });
8969
9011
  }
8970
- async function createActiveFlow(flowDef, seedOrExecution) {
9012
+ async function createActiveFlow(flowDef, seedOrExecution, { recreateDriver = true } = {}) {
8971
9013
  const bus = getOrCreateStimulusBus();
8972
9014
  const nodeExecutor = new SessionNodeExecutor({ workspaceDir: opts.projectDir });
8973
9015
  const managedSubprompts = sessionConfig.managedCodex?.subpromptModels;
@@ -9051,7 +9093,7 @@ async function startAgentServer(opts) {
9051
9093
  const seedRunId = "execution" in seedOrExecution ? seedOrExecution.execution.runId : seedOrExecution.seed.runId;
9052
9094
  const connectorId = `flow:${seedRunId}`;
9053
9095
  const { manager, handle } = await setUpFlowConnector({
9054
- recreateForFlowTools: recreateDriverForFlowTools,
9096
+ recreateForFlowTools: recreateDriver ? recreateDriverForFlowTools : async () => false,
9055
9097
  resolveManager: ensureResourceManagerForFlow,
9056
9098
  connect: (m) => m.connect({
9057
9099
  id: connectorId,
@@ -9355,6 +9397,11 @@ async function startAgentServer(opts) {
9355
9397
  registerLiveAttachedMcp,
9356
9398
  scheduleDriverRestartForToolChanges,
9357
9399
  getDriver: () => driver ?? null,
9400
+ // The selector the live driver runs: the last scoped patch, else the build's.
9401
+ getModelSelection: () => agentSession ? {
9402
+ registry: agentSession.registry,
9403
+ modelRef: liveReconfigurePatch?.modelRef ?? agentSession.modelRef
9404
+ } : void 0,
9358
9405
  rememberReconfigure: (patch) => {
9359
9406
  liveReconfigurePatch = { ...liveReconfigurePatch, ...patch };
9360
9407
  applyReconfigurePatch(sessionConfig, patch);
@@ -9372,6 +9419,18 @@ async function startAgentServer(opts) {
9372
9419
  });
9373
9420
  }
9374
9421
  async function recreateAgentSessionInner(overrides) {
9422
+ const reconnected = await recreateKeepingLiveFlows(activeFlows.values(), {
9423
+ recreate: () => rebuildAgentSession(overrides),
9424
+ hasConnector: (id) => resourceManager?.has(id) ?? false,
9425
+ reconnect: (live) => createActiveFlow(live.flowDef, { execution: live.execution }, { recreateDriver: false }),
9426
+ warn: (message, fields) => serverLog.warn(message, fields)
9427
+ });
9428
+ if (reconnected.length > 0) {
9429
+ serverLog.info("flow runs reconnected after the driver recreate", { runIds: reconnected });
9430
+ }
9431
+ emitAvailability();
9432
+ }
9433
+ async function rebuildAgentSession(overrides) {
9375
9434
  const disposedManager = agentSession.resourceManager;
9376
9435
  const disposeStartedAt = Date.now();
9377
9436
  await agentSession.dispose();
@@ -9404,7 +9463,6 @@ async function startAgentServer(opts) {
9404
9463
  }
9405
9464
  resourceManager = repointed;
9406
9465
  agentSession.startWatching();
9407
- emitAvailability();
9408
9466
  }
9409
9467
  async function recreateSessionForInit(pendingResumeSessionId) {
9410
9468
  await recreateAgentSession({
@@ -10275,7 +10333,10 @@ async function startAgentServer(opts) {
10275
10333
  await dispatchRunnerCapabilityInvocation(
10276
10334
  { callId: cmd.callId, name: cmd.name, input: cmd.input },
10277
10335
  {
10278
- invoke: (name, input) => capabilityRegistry.invoke(name, input, { sessionId, callId: cmd.callId }),
10336
+ // No `callId` here: the platform's id belongs to the platform's pending
10337
+ // map, and a client-origin cap would otherwise emit its own outbound
10338
+ // `capability_invoked` under it. The registry mints a fresh one.
10339
+ invoke: (name, input) => capabilityRegistry.invoke(name, input, { sessionId }),
10279
10340
  // `capability_result` is a CapabilityEvent; `sendEvent` and
10280
10341
  // `ServerTransport.send` are typed to AgentEvent alone though both
10281
10342
  // unions ride one wire. Widening that is a consumer-breaking change.
@@ -10601,6 +10662,6 @@ function touchSession(state) {
10601
10662
  return { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
10602
10663
  }
10603
10664
 
10604
- export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_STAT_BUDGET_MS, MOUNT_STAT_MAX_ENTRIES, MOUNT_TREE_OP_DEADLINE_FACTOR, MarkdownStreamer, PreInitRingSink, ResourceOperationError, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, WS_AUTH_TOKEN_ENV, WS_AUTH_TOKEN_FILE_ENV, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, computeDirectoryTotals, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createManagedCodexSubpromptDriver, createSessionStimulusBus, defineCapability, deleteSession, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowRunDrivesTurns, flowStartNeedsDriverRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isSessionRootPathAllowed, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadManagedCodexHostConfig, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickChatFlowTarget, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, rejectPendingCapabilityCallsOnDisconnect, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, takeRunnerWsAuthToken, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
10605
- //# sourceMappingURL=chunk-UKUKVQO3.js.map
10606
- //# sourceMappingURL=chunk-UKUKVQO3.js.map
10665
+ export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_STAT_BUDGET_MS, MOUNT_STAT_MAX_ENTRIES, MOUNT_TREE_OP_DEADLINE_FACTOR, MarkdownStreamer, PreInitRingSink, ResourceOperationError, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, WS_AUTH_TOKEN_ENV, WS_AUTH_TOKEN_FILE_ENV, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, computeDirectoryTotals, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createManagedCodexSubpromptDriver, createSessionStimulusBus, defineCapability, deleteSession, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowRunDrivesTurns, flowStartNeedsDriverRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isSessionRootPathAllowed, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadManagedCodexHostConfig, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickChatFlowTarget, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, recreateKeepingLiveFlows, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, rejectPendingCapabilityCallsOnDisconnect, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, takeRunnerWsAuthToken, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
10666
+ //# sourceMappingURL=chunk-QJN462RG.js.map
10667
+ //# sourceMappingURL=chunk-QJN462RG.js.map