@skaile/workspaces 4.29.1 → 4.30.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 (145) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/app-sdk/index.js +1 -1
  3. package/dist/{asset-feeds-46K7CTW2.js → asset-feeds-YB5ROSAE.js} +4 -4
  4. package/dist/{asset-feeds-46K7CTW2.js.map → asset-feeds-YB5ROSAE.js.map} +1 -1
  5. package/dist/asset-manager/index.js +1 -1
  6. package/dist/bridge/drivers/claude-sdk.js +132 -15
  7. package/dist/bridge/drivers/claude-sdk.js.map +1 -1
  8. package/dist/bridge/drivers/codex.js +3 -3
  9. package/dist/bridge/drivers/continue.js +4 -4
  10. package/dist/bridge/drivers/echo.js +3 -3
  11. package/dist/bridge/drivers/gemini.js +6 -6
  12. package/dist/bridge/drivers/goose.js +4 -4
  13. package/dist/bridge/drivers/omp.js +5 -5
  14. package/dist/bridge/drivers/opencode.js +4 -4
  15. package/dist/bridge/drivers/qwen.js +6 -6
  16. package/dist/bridge/index.js +6 -6
  17. package/dist/bridge/src/drivers/claude-sdk.d.ts +35 -0
  18. package/dist/bridge/src/drivers/claude-sdk.d.ts.map +1 -1
  19. package/dist/bridge/src/error-classifier.d.ts +13 -0
  20. package/dist/bridge/src/error-classifier.d.ts.map +1 -1
  21. package/dist/bridge/src/normalizer.d.ts.map +1 -1
  22. package/dist/bridge/src/types.d.ts +19 -1
  23. package/dist/bridge/src/types.d.ts.map +1 -1
  24. package/dist/{chunk-C56FCYFU.js → chunk-2ICKARYU.js} +3 -3
  25. package/dist/{chunk-C56FCYFU.js.map → chunk-2ICKARYU.js.map} +1 -1
  26. package/dist/{chunk-6ZELKHAI.js → chunk-3AX5PZRA.js} +4 -4
  27. package/dist/{chunk-6ZELKHAI.js.map → chunk-3AX5PZRA.js.map} +1 -1
  28. package/dist/{chunk-X5CW2HDM.js → chunk-3TK7CZVL.js} +3 -3
  29. package/dist/{chunk-X5CW2HDM.js.map → chunk-3TK7CZVL.js.map} +1 -1
  30. package/dist/{chunk-SZEICOXM.js → chunk-7HJ3YLRF.js} +5 -5
  31. package/dist/chunk-7HJ3YLRF.js.map +1 -0
  32. package/dist/{chunk-3LIUBF5P.js → chunk-7VQGUNXJ.js} +2 -2
  33. package/dist/{chunk-3LIUBF5P.js.map → chunk-7VQGUNXJ.js.map} +1 -1
  34. package/dist/{chunk-7NC3VL6Z.js → chunk-DDCRSE5P.js} +4 -4
  35. package/dist/{chunk-7NC3VL6Z.js.map → chunk-DDCRSE5P.js.map} +1 -1
  36. package/dist/{chunk-T57M3SST.js → chunk-ECTQR7IM.js} +6 -6
  37. package/dist/{chunk-T57M3SST.js.map → chunk-ECTQR7IM.js.map} +1 -1
  38. package/dist/{chunk-H5EGBMZ5.js → chunk-FAQRNZ44.js} +2 -2
  39. package/dist/chunk-FAQRNZ44.js.map +1 -0
  40. package/dist/{chunk-ERDK4ATM.js → chunk-FF5L6IV3.js} +3 -3
  41. package/dist/{chunk-ERDK4ATM.js.map → chunk-FF5L6IV3.js.map} +1 -1
  42. package/dist/{chunk-G3YTK6UI.js → chunk-FRX2BO3V.js} +159 -26
  43. package/dist/chunk-FRX2BO3V.js.map +1 -0
  44. package/dist/{chunk-GYBCW4S7.js → chunk-L2GKM47Q.js} +6 -6
  45. package/dist/{chunk-GYBCW4S7.js.map → chunk-L2GKM47Q.js.map} +1 -1
  46. package/dist/{chunk-NGQVRFQJ.js → chunk-LUC6OEWM.js} +3 -3
  47. package/dist/{chunk-NGQVRFQJ.js.map → chunk-LUC6OEWM.js.map} +1 -1
  48. package/dist/{chunk-HFVK7FKK.js → chunk-M42SMH7V.js} +3 -3
  49. package/dist/{chunk-HFVK7FKK.js.map → chunk-M42SMH7V.js.map} +1 -1
  50. package/dist/{chunk-DJZRPPFJ.js → chunk-MX7LCQUQ.js} +4 -4
  51. package/dist/chunk-MX7LCQUQ.js.map +1 -0
  52. package/dist/{chunk-7SLRVWKR.js → chunk-NP3WH7JF.js} +3 -3
  53. package/dist/{chunk-7SLRVWKR.js.map → chunk-NP3WH7JF.js.map} +1 -1
  54. package/dist/{chunk-LIEOC4JE.js → chunk-NQCQTAMQ.js} +8 -8
  55. package/dist/chunk-NQCQTAMQ.js.map +1 -0
  56. package/dist/{chunk-Q2AOHZFF.js → chunk-PM6DO25W.js} +7 -6
  57. package/dist/chunk-PM6DO25W.js.map +1 -0
  58. package/dist/{chunk-PJY4J37J.js → chunk-RXTKWTZV.js} +3 -3
  59. package/dist/{chunk-PJY4J37J.js.map → chunk-RXTKWTZV.js.map} +1 -1
  60. package/dist/{chunk-XEBSA7YU.js → chunk-SM3UPDXE.js} +6 -6
  61. package/dist/{chunk-XEBSA7YU.js.map → chunk-SM3UPDXE.js.map} +1 -1
  62. package/dist/{chunk-DMXEFYND.js → chunk-UKIL4XH5.js} +3 -3
  63. package/dist/{chunk-DMXEFYND.js.map → chunk-UKIL4XH5.js.map} +1 -1
  64. package/dist/{chunk-5UQNCPIP.js → chunk-VYNIZDAD.js} +3 -3
  65. package/dist/{chunk-5UQNCPIP.js.map → chunk-VYNIZDAD.js.map} +1 -1
  66. package/dist/{chunk-BGY4KTU6.js → chunk-XBSQ4KMC.js} +10 -3
  67. package/dist/chunk-XBSQ4KMC.js.map +1 -0
  68. package/dist/{chunk-ZKX5KY2K.js → chunk-ZVVZ67EH.js} +2 -2
  69. package/dist/{chunk-ZKX5KY2K.js.map → chunk-ZVVZ67EH.js.map} +1 -1
  70. package/dist/cli/index.js +36 -36
  71. package/dist/connectors/index.js +8 -8
  72. package/dist/connectors-shared/index.js +2 -2
  73. package/dist/{ensure-sources-HH4CCGY5.js → ensure-sources-3VOIO6IM.js} +4 -4
  74. package/dist/{ensure-sources-HH4CCGY5.js.map → ensure-sources-3VOIO6IM.js.map} +1 -1
  75. package/dist/factory-assets/connectors/box.js +8 -8
  76. package/dist/factory-assets/connectors/deploy.js +8 -8
  77. package/dist/factory-assets/connectors/devserver.js +8 -8
  78. package/dist/factory-assets/connectors/flow/adapter.js +8 -8
  79. package/dist/factory-assets/connectors/flow/run-flow.d.ts +20 -0
  80. package/dist/factory-assets/connectors/flow/run-flow.d.ts.map +1 -1
  81. package/dist/factory-assets/connectors/flow/run-flow.js +9 -9
  82. package/dist/factory-assets/connectors/flow.js +8 -8
  83. package/dist/factory-assets/connectors/git.js +8 -8
  84. package/dist/factory-assets/connectors/gmail.js +8 -8
  85. package/dist/factory-assets/connectors/googledrive.js +8 -8
  86. package/dist/factory-assets/connectors/local.js +8 -8
  87. package/dist/factory-assets/connectors/mattermost.js +8 -8
  88. package/dist/factory-assets/connectors/memory.js +8 -8
  89. package/dist/factory-assets/connectors/minio.js +8 -8
  90. package/dist/factory-assets/connectors/postgres.js +8 -8
  91. package/dist/factory-assets/connectors/s3.js +8 -8
  92. package/dist/factory-assets/connectors/sharepoint.js +8 -8
  93. package/dist/factory-assets/connectors/sqlite.js +8 -8
  94. package/dist/factory-assets/connectors/static-server.js +8 -8
  95. package/dist/factory-assets/connectors/tunnel.js +8 -8
  96. package/dist/factory-assets/connectors/webdav.js +8 -8
  97. package/dist/factory-assets/connectors/xstate-store.js +8 -8
  98. package/dist/factory-assets/connectors/xstate.js +8 -8
  99. package/dist/{helpers-BKOX66EA.js → helpers-G7AQV3NN.js} +4 -4
  100. package/dist/{helpers-BKOX66EA.js.map → helpers-G7AQV3NN.js.map} +1 -1
  101. package/dist/{library-publish-PCY3ULAA.js → library-publish-YOF75HVC.js} +6 -6
  102. package/dist/{library-publish-PCY3ULAA.js.map → library-publish-YOF75HVC.js.map} +1 -1
  103. package/dist/{open-library-R73XWQNW.js → open-library-DAIEAPNR.js} +5 -5
  104. package/dist/{open-library-R73XWQNW.js.map → open-library-DAIEAPNR.js.map} +1 -1
  105. package/dist/{project-7RHUAYUZ.js → project-IKHGSG4I.js} +5 -5
  106. package/dist/{project-7RHUAYUZ.js.map → project-IKHGSG4I.js.map} +1 -1
  107. package/dist/runner/index.js +12 -12
  108. package/dist/runner/src/agent.d.ts.map +1 -1
  109. package/dist/runner/src/flow-turn-dispatch.d.ts +4 -3
  110. package/dist/runner/src/flow-turn-dispatch.d.ts.map +1 -1
  111. package/dist/runner/src/init-build-hold.d.ts +60 -0
  112. package/dist/runner/src/init-build-hold.d.ts.map +1 -0
  113. package/dist/runner/src/serve.d.ts +14 -0
  114. package/dist/runner/src/serve.d.ts.map +1 -1
  115. package/dist/sdk/asset-manager.js +1 -1
  116. package/dist/sdk/bridge.js +6 -6
  117. package/dist/sdk/index.js +12 -12
  118. package/dist/sdk/runner.js +12 -12
  119. package/dist/sdk/session.js +2 -2
  120. package/dist/sdk/types.js +1 -1
  121. package/dist/session/index.js +2 -2
  122. package/dist/{setup-MYJDFOCG.js → setup-234UBMJX.js} +11 -11
  123. package/dist/{setup-MYJDFOCG.js.map → setup-234UBMJX.js.map} +1 -1
  124. package/dist/{source-SKGXVE7I.js → source-VAKNCLQY.js} +6 -6
  125. package/dist/{source-SKGXVE7I.js.map → source-VAKNCLQY.js.map} +1 -1
  126. package/dist/{source-manifest-publish-QSZRNMSM.js → source-manifest-publish-FEFRWILI.js} +7 -7
  127. package/dist/{source-manifest-publish-QSZRNMSM.js.map → source-manifest-publish-FEFRWILI.js.map} +1 -1
  128. package/dist/tui/index.js +12 -12
  129. package/dist/types/index.js +1 -1
  130. package/dist/types/src/events.d.ts +31 -0
  131. package/dist/types/src/events.d.ts.map +1 -1
  132. package/dist/types/src/index.d.ts +1 -1
  133. package/dist/types/src/index.d.ts.map +1 -1
  134. package/dist/types/src/version.d.ts +16 -1
  135. package/dist/types/src/version.d.ts.map +1 -1
  136. package/dist/workspace-plugin/adapters/mcp.js +2 -2
  137. package/dist/workspace-plugin/index.js +1 -1
  138. package/package.json +1 -1
  139. package/dist/chunk-BGY4KTU6.js.map +0 -1
  140. package/dist/chunk-DJZRPPFJ.js.map +0 -1
  141. package/dist/chunk-G3YTK6UI.js.map +0 -1
  142. package/dist/chunk-H5EGBMZ5.js.map +0 -1
  143. package/dist/chunk-LIEOC4JE.js.map +0 -1
  144. package/dist/chunk-Q2AOHZFF.js.map +0 -1
  145. package/dist/chunk-SZEICOXM.js.map +0 -1
@@ -1,25 +1,25 @@
1
- import { WorkspacePlugin } from './chunk-ZKX5KY2K.js';
2
- import { buildWorkspaceToolDefs } from './chunk-PJY4J37J.js';
1
+ import { WorkspacePlugin } from './chunk-ZVVZ67EH.js';
2
+ import { buildWorkspaceToolDefs } from './chunk-RXTKWTZV.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-SZEICOXM.js';
7
+ import { resolveFlowPath } from './chunk-7HJ3YLRF.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, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-LIEOC4JE.js';
9
+ import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-NQCQTAMQ.js';
10
10
  import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-2JANXYTJ.js';
11
- import { EventNormalizer } from './chunk-Q2AOHZFF.js';
11
+ import { EventNormalizer } from './chunk-PM6DO25W.js';
12
12
  import { probeResumeTranscript, transcriptStoreForRuntime } from './chunk-6S5KL76M.js';
13
13
  import { scopeReconfigureModel } from './chunk-TJRNJVGU.js';
14
14
  import { CodexNativeStateUnavailable } from './chunk-LOO5CB5M.js';
15
- import { dispatchCapability } from './chunk-ERDK4ATM.js';
16
- import { classifyClaudeSdkError } from './chunk-BGY4KTU6.js';
15
+ import { dispatchCapability } from './chunk-FF5L6IV3.js';
16
+ import { classifyClaudeSdkError } from './chunk-XBSQ4KMC.js';
17
17
  import { agentExecRequested } from './chunk-YROR332M.js';
18
- import { toAgentEffort, createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS, AgentDriver } from './chunk-H5EGBMZ5.js';
18
+ import { toAgentEffort, createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS, AgentDriver } from './chunk-FAQRNZ44.js';
19
19
  import { loadFlow } from './chunk-YVWUHPQW.js';
20
20
  import { parseFlowDefinition } from './chunk-DIQDYNXZ.js';
21
21
  import { renderStimulusPrompt } from './chunk-K3IBZ2UZ.js';
22
- import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-DJZRPPFJ.js';
22
+ import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-MX7LCQUQ.js';
23
23
  import { resolveSettings, loadProviderRegistry } from './chunk-UWU572Q6.js';
24
24
  import { resolveRuntimeAssets } from './chunk-5RHPNNWP.js';
25
25
  import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
@@ -3031,7 +3031,7 @@ ${message}`;
3031
3031
  process.stdout.write("\n");
3032
3032
  driver.kill();
3033
3033
  resolve4();
3034
- } else if (event.type === "error") {
3034
+ } else if (event.type === "error" && event.retrying !== true) {
3035
3035
  driver.off("agent-event", onEvent);
3036
3036
  const err = Object.assign(new Error(String(event.error)), {
3037
3037
  detail: event.detail
@@ -4800,6 +4800,86 @@ var DriverSwapGate = class {
4800
4800
  }
4801
4801
  };
4802
4802
 
4803
+ // runner/src/init-build-hold.ts
4804
+ var DEFAULT_CONNECTOR_MUTATE_INIT_HOLD_MS = 1e4;
4805
+ function resolveConnectorMutateInitHoldMs(env = process.env) {
4806
+ const parsed = Number.parseInt(env.SKAILE_CONNECTOR_MUTATE_INIT_HOLD_MS ?? "", 10);
4807
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : DEFAULT_CONNECTOR_MUTATE_INIT_HOLD_MS;
4808
+ }
4809
+ function createInitBuildHold(now = Date.now) {
4810
+ let current = null;
4811
+ let tail = Promise.resolve();
4812
+ let held = 0;
4813
+ const building = () => current !== null && !current.done;
4814
+ async function awaitNewestBuild() {
4815
+ for (; ; ) {
4816
+ const build = current;
4817
+ if (!build) return null;
4818
+ if (!build.done) await build.settled;
4819
+ if (current === build) return build.error;
4820
+ }
4821
+ }
4822
+ return {
4823
+ beginBuild() {
4824
+ let resolve4;
4825
+ const build = {
4826
+ done: false,
4827
+ error: null,
4828
+ settled: new Promise((r) => {
4829
+ resolve4 = r;
4830
+ })
4831
+ };
4832
+ current = build;
4833
+ const settle = (error) => {
4834
+ if (build.done) return;
4835
+ build.done = true;
4836
+ build.error = error;
4837
+ resolve4();
4838
+ };
4839
+ return { succeed: () => settle(null), fail: (error) => settle(error) };
4840
+ },
4841
+ run(task, deadlineMs) {
4842
+ if (held === 0 && !building()) {
4843
+ if (current?.error) return task({ kind: "failed", error: current.error });
4844
+ return task({ kind: "ready", remainingMs: void 0 });
4845
+ }
4846
+ held++;
4847
+ const arrivedAt = now();
4848
+ const previous = tail;
4849
+ const turn = previous.then(awaitNewestBuild);
4850
+ let timer;
4851
+ const deadline = deadlineMs === void 0 ? null : new Promise((resolve4) => {
4852
+ timer = setTimeout(() => resolve4("timeout"), deadlineMs);
4853
+ timer.unref?.();
4854
+ });
4855
+ let markStarted;
4856
+ const started = new Promise((resolve4) => {
4857
+ markStarted = resolve4;
4858
+ });
4859
+ const result = (async () => {
4860
+ const first = deadline ? await Promise.race([turn, deadline]) : await turn;
4861
+ clearTimeout(timer);
4862
+ if (first === "timeout") {
4863
+ void turn.then(markStarted);
4864
+ return task({ kind: "timeout", waitedMs: now() - arrivedAt });
4865
+ }
4866
+ markStarted();
4867
+ if (first) return task({ kind: "failed", error: first });
4868
+ return task({
4869
+ kind: "ready",
4870
+ remainingMs: deadlineMs === void 0 ? void 0 : Math.max(0, deadlineMs - (now() - arrivedAt))
4871
+ });
4872
+ })();
4873
+ tail = started;
4874
+ void Promise.allSettled([turn, result]).then(() => {
4875
+ held--;
4876
+ });
4877
+ return result;
4878
+ },
4879
+ held: () => held
4880
+ };
4881
+ }
4882
+
4803
4883
  // runner/src/pending-turns.ts
4804
4884
  var PendingTurns = class {
4805
4885
  constructor(emitIdle) {
@@ -5004,7 +5084,7 @@ function awaitAgentEnd(driver, prompt, timeoutMs) {
5004
5084
  const onEvent = (raw) => {
5005
5085
  const event = raw;
5006
5086
  if (event.type === "agent_end") done();
5007
- else if (event.type === "error")
5087
+ else if (event.type === "error" && event.retrying !== true)
5008
5088
  done(new Error(event.error ?? event.message ?? "Agent error"));
5009
5089
  };
5010
5090
  const done = (err) => {
@@ -7954,6 +8034,7 @@ function hostOpResumeStimulus(op, payload) {
7954
8034
  return null;
7955
8035
  }
7956
8036
  }
8037
+ var CONNECTOR_MUTATE_NOT_READY = "connector_mutate before resources ready";
7957
8038
  function toActiveFlowTarget(entry) {
7958
8039
  return {
7959
8040
  runId: entry.runId,
@@ -7972,14 +8053,59 @@ async function executeConnectorMutate(cmd, deps) {
7972
8053
  acked = true;
7973
8054
  deps.sendEvent({ type: "connector_mutate_response", requestId: cmd.requestId, ...r });
7974
8055
  };
7975
- try {
7976
- await deps.sessionReady;
7977
- } catch (err) {
7978
- const message = `Session not available: ${err.message}`;
7979
- deps.sendEvent({ type: "error", message, fatal: true });
7980
- respond({ ok: false, code: "session_unavailable", error: message });
8056
+ const sessionAvailable = async () => {
8057
+ try {
8058
+ await deps.sessionReady;
8059
+ return true;
8060
+ } catch (err) {
8061
+ const message = `Session not available: ${err.message}`;
8062
+ deps.sendEvent({ type: "error", message, fatal: true });
8063
+ respond({ ok: false, code: "session_unavailable", error: message });
8064
+ return false;
8065
+ }
8066
+ };
8067
+ if (!deps.initBuildHold) {
8068
+ if (await sessionAvailable())
8069
+ await applyConnectorMutate(cmd, deps, respond, deps.connectorWaitMs);
7981
8070
  return;
7982
8071
  }
8072
+ await deps.initBuildHold.run(
8073
+ async (outcome) => {
8074
+ switch (outcome.kind) {
8075
+ case "timeout":
8076
+ deps.log.warn("connector_mutate held past its deadline during session_init", {
8077
+ id: cmd.id,
8078
+ op: cmd.op,
8079
+ waitedMs: outcome.waitedMs
8080
+ });
8081
+ respond({
8082
+ ok: false,
8083
+ code: "op_failed",
8084
+ error: `${CONNECTOR_MUTATE_NOT_READY} (held ${outcome.waitedMs}ms while session_init built the session)`
8085
+ });
8086
+ return;
8087
+ case "failed":
8088
+ respond({
8089
+ ok: false,
8090
+ code: "session_unavailable",
8091
+ error: `Session not available: ${outcome.error.message}`
8092
+ });
8093
+ return;
8094
+ case "ready":
8095
+ if (!await sessionAvailable()) return;
8096
+ await applyConnectorMutate(
8097
+ cmd,
8098
+ deps,
8099
+ respond,
8100
+ outcome.remainingMs === void 0 ? deps.connectorWaitMs : Math.min(deps.connectorWaitMs, outcome.remainingMs)
8101
+ );
8102
+ return;
8103
+ }
8104
+ },
8105
+ cmd.requestId ? deps.initBuildHoldMs : void 0
8106
+ );
8107
+ }
8108
+ async function applyConnectorMutate(cmd, deps, respond, connectorWaitMs) {
7983
8109
  const payload = cmd.payload ?? {};
7984
8110
  const planContext = () => {
7985
8111
  const targetExists = deps.hasConnector(cmd.id);
@@ -7998,19 +8124,19 @@ async function executeConnectorMutate(cmd, deps) {
7998
8124
  const flowTargeted = cmd.id === "flow" || cmd.id.startsWith("flow:");
7999
8125
  if (plan.kind === "dispatch" && flowTargeted && !deps.hasConnector(plan.dispatchId)) {
8000
8126
  const ready = await deps.waitForFlowConnector(
8001
- deps.connectorWaitMs,
8127
+ connectorWaitMs,
8002
8128
  cmd.id === "flow" ? void 0 : () => deps.hasConnector(cmd.id)
8003
8129
  );
8004
8130
  if (!ready) {
8005
8131
  deps.log.warn("connector_mutate timed out waiting for the flow connector", {
8006
8132
  id: cmd.id,
8007
8133
  op: cmd.op,
8008
- waitedMs: deps.connectorWaitMs
8134
+ waitedMs: connectorWaitMs
8009
8135
  });
8010
8136
  respond({
8011
8137
  ok: false,
8012
8138
  code: "connector_unavailable",
8013
- error: `Connector not found: "${cmd.id}" (waited ${deps.connectorWaitMs}ms)`
8139
+ error: `Connector not found: "${cmd.id}" (waited ${connectorWaitMs}ms)`
8014
8140
  });
8015
8141
  return;
8016
8142
  }
@@ -8395,6 +8521,7 @@ async function startAgentServer(opts) {
8395
8521
  ...observation.limitType ? { limitType: observation.limitType } : {},
8396
8522
  ...typeof observation.utilization === "number" ? { utilization: observation.utilization } : {},
8397
8523
  ...typeof observation.resetsAt === "number" ? { resetsAt: observation.resetsAt } : {},
8524
+ ...observation.cause ? { cause: observation.cause } : {},
8398
8525
  observedAt: (/* @__PURE__ */ new Date()).toISOString()
8399
8526
  });
8400
8527
  };
@@ -8962,6 +9089,8 @@ async function startAgentServer(opts) {
8962
9089
  }
8963
9090
  const flowConnectorReadiness = createFlowConnectorReadiness(() => getOnlyActiveFlow() !== null);
8964
9091
  const flowMutateConnectorWaitMs = resolveFlowMutateConnectorWaitMs();
9092
+ const initBuildHold = createInitBuildHold();
9093
+ const connectorMutateInitHoldMs = resolveConnectorMutateInitHoldMs();
8965
9094
  async function ensureDriverStarted() {
8966
9095
  for (let attempt = 0; attempt < DRIVER_START_ATTEMPTS; attempt += 1) {
8967
9096
  if (driverStarted) return;
@@ -10035,13 +10164,15 @@ async function startAgentServer(opts) {
10035
10164
  }
10036
10165
  resolveSessionReady();
10037
10166
  };
10038
- void buildSession().catch((err) => {
10167
+ const initBuild = initBuildHold.beginBuild();
10168
+ void buildSession().then(initBuild.succeed, (err) => {
10039
10169
  const errMsg = err instanceof Error ? err.message : String(err);
10040
10170
  if (thisInit === initGeneration) initAcknowledged = false;
10041
10171
  logPhase("session_ready", initReceivedAt, { ready: false });
10042
10172
  log(`[serve] session_init failed to build session: ${errMsg}`);
10043
10173
  sendEvent({ type: "error", message: errMsg, fatal: true });
10044
10174
  rejectSessionReady(err instanceof Error ? err : new Error(errMsg));
10175
+ initBuild.fail(err instanceof Error ? err : new Error(errMsg));
10045
10176
  if (managedHost) {
10046
10177
  runtimeRejected = true;
10047
10178
  void cleanup().finally(async () => {
@@ -10194,12 +10325,12 @@ async function startAgentServer(opts) {
10194
10325
  sessionReady,
10195
10326
  sendEvent,
10196
10327
  assertResourcesReady: () => {
10197
- if (!resourceManager) throw new Error("connector_mutate before resources ready");
10328
+ if (!resourceManager) throw new Error(CONNECTOR_MUTATE_NOT_READY);
10198
10329
  },
10199
10330
  hasConnector: (id) => resourceManager?.has?.(id) ?? false,
10200
10331
  isFlowConnector: (id) => resourceManager?.has?.(id) === true && resourceManager.get(id).connector?.name === "flow",
10201
10332
  executeOp: (id, op, args) => {
10202
- if (!resourceManager) throw new Error("connector_mutate before resources ready");
10333
+ if (!resourceManager) throw new Error(CONNECTOR_MUTATE_NOT_READY);
10203
10334
  return resourceManager.executeOp(id, op, args);
10204
10335
  },
10205
10336
  flowState: () => {
@@ -10213,6 +10344,8 @@ async function startAgentServer(opts) {
10213
10344
  createActiveFlow: async (flowDef, seedOrExecution) => toActiveFlowTarget(await createActiveFlow(flowDef, seedOrExecution)),
10214
10345
  waitForFlowConnector: (timeoutMs, isSatisfied) => flowConnectorReadiness.wait(timeoutMs, isSatisfied),
10215
10346
  connectorWaitMs: flowMutateConnectorWaitMs,
10347
+ initBuildHold,
10348
+ initBuildHoldMs: connectorMutateInitHoldMs,
10216
10349
  signalStimulus: kickFlowTurn,
10217
10350
  log: serverLog
10218
10351
  });
@@ -10734,6 +10867,6 @@ function touchSession(state) {
10734
10867
  return { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
10735
10868
  }
10736
10869
 
10737
- 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, restoredRunHasWorkToResume, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, takeRunnerWsAuthToken, toActiveFlowTarget, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
10738
- //# sourceMappingURL=chunk-G3YTK6UI.js.map
10739
- //# sourceMappingURL=chunk-G3YTK6UI.js.map
10870
+ export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CONNECTOR_MUTATE_NOT_READY, 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, restoredRunHasWorkToResume, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, takeRunnerWsAuthToken, toActiveFlowTarget, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
10871
+ //# sourceMappingURL=chunk-FRX2BO3V.js.map
10872
+ //# sourceMappingURL=chunk-FRX2BO3V.js.map