@skaile/workspaces 6.16.0 → 6.16.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 (29) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{agent-file-refresh-76NNFB4W.js → agent-file-refresh-VRD2SNJW.js} +4 -4
  3. package/dist/{agent-file-refresh-76NNFB4W.js.map → agent-file-refresh-VRD2SNJW.js.map} +1 -1
  4. package/dist/{chunk-65SOXO7I.js → chunk-3CRZJR7E.js} +3 -3
  5. package/dist/{chunk-65SOXO7I.js.map → chunk-3CRZJR7E.js.map} +1 -1
  6. package/dist/{chunk-6KV34G6A.js → chunk-K4763755.js} +2 -2
  7. package/dist/{chunk-6KV34G6A.js.map → chunk-K4763755.js.map} +1 -1
  8. package/dist/{chunk-7IW5E6LB.js → chunk-SMCG4PMP.js} +4 -4
  9. package/dist/{chunk-7IW5E6LB.js.map → chunk-SMCG4PMP.js.map} +1 -1
  10. package/dist/{chunk-ZII54C3E.js → chunk-U6UFPOEK.js} +63 -29
  11. package/dist/chunk-U6UFPOEK.js.map +1 -0
  12. package/dist/cli/index.js +12 -12
  13. package/dist/factory-assets/connectors/flow/run-flow.js +1 -1
  14. package/dist/{library-publish-F3AKF66O.js → library-publish-YHYGA6G5.js} +4 -4
  15. package/dist/{library-publish-F3AKF66O.js.map → library-publish-YHYGA6G5.js.map} +1 -1
  16. package/dist/{project-GFQP4TW6.js → project-BOAHGBMI.js} +5 -5
  17. package/dist/{project-GFQP4TW6.js.map → project-BOAHGBMI.js.map} +1 -1
  18. package/dist/runner/index.js +2 -2
  19. package/dist/runner/src/external-mcp.d.ts +32 -7
  20. package/dist/runner/src/external-mcp.d.ts.map +1 -1
  21. package/dist/sdk/index.js +2 -2
  22. package/dist/sdk/runner.js +2 -2
  23. package/dist/{source-P6JPZYWP.js → source-J2MJIHDS.js} +5 -5
  24. package/dist/{source-P6JPZYWP.js.map → source-J2MJIHDS.js.map} +1 -1
  25. package/dist/{source-manifest-publish-XBFHEURV.js → source-manifest-publish-6MYDXCKZ.js} +5 -5
  26. package/dist/{source-manifest-publish-XBFHEURV.js.map → source-manifest-publish-6MYDXCKZ.js.map} +1 -1
  27. package/dist/tui/index.js +2 -2
  28. package/package.json +1 -1
  29. package/dist/chunk-ZII54C3E.js.map +0 -1
@@ -4,7 +4,7 @@ import { findAiAssetsRoot } from './chunk-3A7JUOY2.js';
4
4
  import { startModelEndpoint, ModelEndpointError } from './chunk-3UYKT62L.js';
5
5
  import { WebSocketServerTransport } from './chunk-CU5WY6HN.js';
6
6
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
7
- import { resolveFlowPath } from './chunk-6KV34G6A.js';
7
+ import { resolveFlowPath } from './chunk-K4763755.js';
8
8
  import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-SFBLZOV5.js';
9
9
  import { ConnectFailureCarryOver, registerBuiltinConnectors, listConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, fleetMountConnectingMessage, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, TRUSTED_GIT_CA_ENV, writeUserGitconfigInclude, buildFlowToolDefs, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, driveOrchestratorTurn, buildSdkFlowTools } from './chunk-QUIK7L3Z.js';
10
10
  import { loadYamlConnectorDeclarations, withMaterializedConnectorDeclarations, SecretProviderChain, ConnectorStartupError, isKnownSecretRef, EnvSecretProvider, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, deriveSingleMaterializedConnectorDeclaration } from './chunk-H3PY5DFL.js';
@@ -3498,6 +3498,8 @@ function warnUnresolvedRecipeMarkers(recipeLog, declId, resolvedCommand, resolve
3498
3498
  var PASSTHROUGH_INPUT_ZOD = {
3499
3499
  parse: (v) => v
3500
3500
  };
3501
+ var MCP_TOOL_CALL_TIMEOUT_MS = 15 * 6e4;
3502
+ var MCP_TOOL_CALL_MAX_TOTAL_MS = 2 * 60 * 6e4;
3501
3503
  function isMcpAuthError(err) {
3502
3504
  if (!err || typeof err !== "object") return false;
3503
3505
  const code = err.code ?? err.status;
@@ -3650,7 +3652,8 @@ var ExternalMcpManager = class {
3650
3652
  const snapshot = lazy ? await readMcpToolsSnapshot(decl) : void 0;
3651
3653
  if (snapshot) return this.registerFromSnapshot(decl, snapshot);
3652
3654
  const client = await this.connectWithReauth(decl);
3653
- const server = { id: decl.id, decl, client, tools: [], toolNames: [] };
3655
+ const server = { id: decl.id, decl, tools: [], toolNames: [] };
3656
+ this.adoptClient(server, client);
3654
3657
  const toolNames = [];
3655
3658
  try {
3656
3659
  const { tools } = await client.listTools();
@@ -3663,6 +3666,7 @@ var ExternalMcpManager = class {
3663
3666
  if (lazy) await writeMcpToolsSnapshot(decl, tools);
3664
3667
  } catch (err) {
3665
3668
  for (const name of toolNames) this.registry.deregister(name);
3669
+ server.removed = true;
3666
3670
  try {
3667
3671
  await client.close();
3668
3672
  } catch {
@@ -3704,25 +3708,27 @@ var ExternalMcpManager = class {
3704
3708
  return { id: decl.id, toolNames: [...server.toolNames] };
3705
3709
  }
3706
3710
  /**
3707
- * The server's live client, starting a lazy server on first use. Concurrent
3708
- * first calls share one connect; a failed connect is not cached, so the next
3709
- * call tries again.
3711
+ * The server's live client, starting it on first use (a lazy server) or after
3712
+ * its connection closed. Concurrent calls share one connect; a failed connect
3713
+ * is not cached, so the next call tries again.
3710
3714
  */
3711
3715
  ensureClient(server) {
3712
3716
  if (server.client) return Promise.resolve(server.client);
3713
3717
  if (server.removed) return Promise.reject(new Error(`MCP server '${server.id}' was removed`));
3714
- server.connectInFlight ??= this.startLazyServer(server).finally(() => {
3718
+ server.connectInFlight ??= this.startServer(server).finally(() => {
3715
3719
  server.connectInFlight = void 0;
3716
3720
  });
3717
3721
  return server.connectInFlight;
3718
3722
  }
3719
- async startLazyServer(server) {
3723
+ async startServer(server) {
3724
+ const restart = server.closedAt !== void 0;
3725
+ const what = restart ? "restart" : "lazy start";
3720
3726
  let client;
3721
3727
  let tools;
3722
3728
  try {
3723
3729
  client = await this.connectWithReauth(server.decl);
3724
3730
  } catch (err) {
3725
- this.log.error("MCP server lazy start failed", err, { id: server.id });
3731
+ this.log.error(`MCP server ${what} failed`, err, { id: server.id });
3726
3732
  throw new Error(`MCP server '${server.id}' failed to start: ${errMessage(err)}`);
3727
3733
  }
3728
3734
  try {
@@ -3730,28 +3736,54 @@ var ExternalMcpManager = class {
3730
3736
  } catch (err) {
3731
3737
  await client.close().catch(() => {
3732
3738
  });
3733
- this.log.error("MCP server lazy start failed", err, { id: server.id });
3739
+ this.log.error(`MCP server ${what} failed`, err, { id: server.id });
3734
3740
  throw new Error(`MCP server '${server.id}' failed to start: ${errMessage(err)}`);
3735
3741
  }
3736
- server.client = client;
3742
+ const downMs = restart ? Date.now() - server.closedAt : void 0;
3743
+ this.adoptClient(server, client);
3737
3744
  if (server.removed) throw new Error(`MCP server '${server.id}' was removed`);
3738
3745
  if (!sameToolList(server.tools, tools)) this.reregisterTools(server, tools);
3739
- this.log.info("MCP server registered (runner-managed)", {
3740
- id: server.id,
3741
- transport: "stdio",
3742
- toolCount: server.toolNames.length,
3743
- tools: server.toolNames,
3744
- lazy: true,
3745
- started: true
3746
- });
3746
+ this.log.info(
3747
+ restart ? "MCP server restarted (runner-managed)" : "MCP server registered (runner-managed)",
3748
+ {
3749
+ id: server.id,
3750
+ transport: server.decl.transport ?? "stdio",
3751
+ toolCount: server.toolNames.length,
3752
+ tools: server.toolNames,
3753
+ ...restart ? { downMs } : { lazy: true, started: true }
3754
+ }
3755
+ );
3747
3756
  return client;
3748
3757
  }
3758
+ /**
3759
+ * Make `client` the server's live client and watch it: when its transport
3760
+ * closes on its own (the stdio process exited), drop it so the next tool call
3761
+ * starts the server again instead of failing with `Not connected` for the
3762
+ * rest of the session. The client it replaces (401 reconnect, or a restart
3763
+ * racing one) is closed, and its close is ignored.
3764
+ */
3765
+ adoptClient(server, client) {
3766
+ const previous = server.client;
3767
+ server.client = client;
3768
+ server.closedAt = void 0;
3769
+ if (previous && previous !== client) void previous.close().catch(() => {
3770
+ });
3771
+ client.onclose = () => {
3772
+ if (server.client !== client || server.removed) return;
3773
+ server.client = void 0;
3774
+ server.closedAt = Date.now();
3775
+ this.log.warn("MCP server connection closed; the next tool call restarts it", {
3776
+ id: server.id,
3777
+ transport: server.decl.transport ?? "stdio"
3778
+ });
3779
+ };
3780
+ }
3749
3781
  /**
3750
3782
  * The snapshot disagreed with what the started server advertises: replace the
3751
3783
  * registered capabilities with the live list and rewrite the snapshot.
3752
3784
  */
3753
3785
  reregisterTools(server, tools) {
3754
- this.log.warn("MCP tools snapshot is stale; re-registering from the live server", {
3786
+ this.log.warn("MCP tool list changed; re-registering from the live server", {
3755
3787
  id: server.id,
3756
3788
  snapshotCount: server.tools.length,
3757
3789
  liveCount: tools.length
@@ -3764,7 +3796,7 @@ var ExternalMcpManager = class {
3764
3796
  this.registry.register(cap, "agent");
3765
3797
  server.toolNames.push(cap.name);
3766
3798
  }
3767
- void writeMcpToolsSnapshot(server.decl, tools);
3799
+ if (isLazyDeclaration(server.decl)) void writeMcpToolsSnapshot(server.decl, tools);
3768
3800
  }
3769
3801
  /**
3770
3802
  * Deregister a running MCP server's tools and close its client.
@@ -3848,12 +3880,7 @@ var ExternalMcpManager = class {
3848
3880
  this.log.warn("MCP reconnect after 401 failed", { id: server.id, error: errMessage(err) });
3849
3881
  return false;
3850
3882
  }
3851
- const old = server.client;
3852
- server.client = next;
3853
- try {
3854
- await old?.close();
3855
- } catch {
3856
- }
3883
+ this.adoptClient(server, next);
3857
3884
  this.log.info("MCP server reconnected after 401 re-mint", { id: server.id });
3858
3885
  return true;
3859
3886
  }
@@ -3884,7 +3911,14 @@ var ExternalMcpManager = class {
3884
3911
  const call = { name: tool.name, arguments: input ?? {} };
3885
3912
  const invoke = async () => {
3886
3913
  const client = await untilAborted(this.ensureClient(server), ctx.signal);
3887
- return ctx.signal ? client.callTool(call, void 0, { signal: ctx.signal }) : client.callTool(call);
3914
+ return client.callTool(call, void 0, {
3915
+ ...ctx.signal ? { signal: ctx.signal } : {},
3916
+ timeout: MCP_TOOL_CALL_TIMEOUT_MS,
3917
+ resetTimeoutOnProgress: true,
3918
+ maxTotalTimeout: MCP_TOOL_CALL_MAX_TOTAL_MS,
3919
+ onprogress: () => {
3920
+ }
3921
+ });
3888
3922
  };
3889
3923
  let result;
3890
3924
  try {
@@ -16394,5 +16428,5 @@ function touchSession(state) {
16394
16428
  }
16395
16429
 
16396
16430
  export { AgentRunError, CLAUDE_CODE_CREDENTIALS_KEY, CONNECTOR_MUTATE_NOT_READY, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, DEFAULT_FLOW_MUTATE_CONNECTOR_WAIT_MS, DEFAULT_MAX_FINISHED_TREES, DEFAULT_RUN_LIMITS, MOUNT_LIST_MAX_DEPTH, MOUNT_LIST_MAX_ENTRIES, MOUNT_READ_DEADLINE_FACTOR, MOUNT_READ_MAX_CHUNK_BYTES, MOUNT_STAT_BUDGET_MS, MOUNT_STAT_MAX_ENTRIES, MOUNT_TREE_OP_DEADLINE_FACTOR, MOUNT_WRITE_MAX_CHUNK_BYTES, MarkdownStreamer, PreInitRingSink, ResourceOperationError, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, WRITE_RANGE_PARTIAL_TTL_MS, WS_AUTH_TOKEN_ENV, WS_AUTH_TOKEN_FILE_ENV, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildCompositionRunSnapshot, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, canonicalJson, capabilityLogInstance, capabilitySignatureInputs, clearPreInitRingSink, clearSession, compositionRunSnapshotPath, computeCapabilitySignature, computeDirectoryTotals, computeRevisionHash, connectorRefreshKind, createAgentSession, createFinalTextFallback, createFlowConnectorReadiness, createInMemoryRunStore, createManagedCodexSubpromptHarness, createRunController, createSessionStimulusBus, defineCapability, deleteSession, describeComposition, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowStartNeedsHarnessRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, harnessActiveAfterTurnEnd, hasNonTerminalFlow, hashAgentFiles, hostOpResumeStimulus, installPreInitRingSink, instanceForSession, instanceSessionOverrides, isSessionRootPathAllowed, listSessions, loadAgentManifest, loadCompositionRunSnapshot, loadManagedCodexHostConfig, loadSession, loadSessionById, logConnectorReport, manifestModelForHarness, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickChatFlowTarget, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, reconnectedRunNeedsAgentTurn, recreateKeepingLiveFlows, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, rejectPendingCapabilityCallsOnDisconnect, resetRunnerLogStore, resolveAgentInstance, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveInstanceAgentDir, resolveSessionId, restoredRunHasWorkToResume, runAgentChat, saveCompositionRunSnapshot, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, takeRunnerWsAuthToken, toActiveFlowTarget, touchSession, unresolvedCredentialNotices, validateInputResponse, verifyConventionItems, writeClaudeCodeCredentialsFile, writeRangeChunk, writeRangePartialPath };
16397
- //# sourceMappingURL=chunk-ZII54C3E.js.map
16398
- //# sourceMappingURL=chunk-ZII54C3E.js.map
16431
+ //# sourceMappingURL=chunk-U6UFPOEK.js.map
16432
+ //# sourceMappingURL=chunk-U6UFPOEK.js.map