@skaile/workspaces 0.28.1 → 0.29.0

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 (63) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/asset-manager/index.js +1 -1
  3. package/dist/{chunk-FBVUGRTU.js → chunk-3OKP6F2J.js} +3 -3
  4. package/dist/{chunk-FBVUGRTU.js.map → chunk-3OKP6F2J.js.map} +1 -1
  5. package/dist/{chunk-U5L6F5NZ.js → chunk-CBNMIKUO.js} +2 -2
  6. package/dist/{chunk-U5L6F5NZ.js.map → chunk-CBNMIKUO.js.map} +1 -1
  7. package/dist/{chunk-DGM74UP4.js → chunk-CMG3GJ6B.js} +35 -3
  8. package/dist/chunk-CMG3GJ6B.js.map +1 -0
  9. package/dist/{chunk-XHBPQ7QP.js → chunk-FENG6OO6.js} +46 -20
  10. package/dist/chunk-FENG6OO6.js.map +1 -0
  11. package/dist/{chunk-BSVLAHHH.js → chunk-TDZGENVP.js} +118 -13
  12. package/dist/chunk-TDZGENVP.js.map +1 -0
  13. package/dist/{chunk-UAW7VRAL.js → chunk-XFQ2OXYR.js} +2 -2
  14. package/dist/{chunk-UAW7VRAL.js.map → chunk-XFQ2OXYR.js.map} +1 -1
  15. package/dist/cli/index.js +6 -6
  16. package/dist/connectors/config.js +1 -1
  17. package/dist/connectors/index.js +2 -2
  18. package/dist/connectors/src/config.d.ts +46 -1
  19. package/dist/connectors/src/config.d.ts.map +1 -1
  20. package/dist/connectors/src/index.d.ts +1 -1
  21. package/dist/connectors/src/index.d.ts.map +1 -1
  22. package/dist/factory-assets/connectors/deploy.js +2 -2
  23. package/dist/factory-assets/connectors/devserver.js +2 -2
  24. package/dist/factory-assets/connectors/flow/adapter.js +2 -2
  25. package/dist/factory-assets/connectors/flow/run-flow.js +3 -3
  26. package/dist/factory-assets/connectors/flow.js +2 -2
  27. package/dist/factory-assets/connectors/git.js +2 -2
  28. package/dist/factory-assets/connectors/gmail.js +2 -2
  29. package/dist/factory-assets/connectors/googledrive/driver.d.ts +0 -12
  30. package/dist/factory-assets/connectors/googledrive/driver.d.ts.map +1 -1
  31. package/dist/factory-assets/connectors/googledrive.js +2 -2
  32. package/dist/factory-assets/connectors/local.js +2 -2
  33. package/dist/factory-assets/connectors/mattermost.js +2 -2
  34. package/dist/factory-assets/connectors/memory.js +2 -2
  35. package/dist/factory-assets/connectors/minio.js +2 -2
  36. package/dist/factory-assets/connectors/postgres.js +2 -2
  37. package/dist/factory-assets/connectors/s3.js +2 -2
  38. package/dist/factory-assets/connectors/sharepoint/driver.d.ts.map +1 -1
  39. package/dist/factory-assets/connectors/sharepoint.js +2 -2
  40. package/dist/factory-assets/connectors/sqlite.js +2 -2
  41. package/dist/factory-assets/connectors/static-server.js +2 -2
  42. package/dist/factory-assets/connectors/tunnel.js +2 -2
  43. package/dist/factory-assets/connectors/webdav/driver.d.ts +2 -0
  44. package/dist/factory-assets/connectors/webdav/driver.d.ts.map +1 -1
  45. package/dist/factory-assets/connectors/webdav.js +2 -2
  46. package/dist/factory-assets/connectors/xstate-store.js +2 -2
  47. package/dist/factory-assets/connectors/xstate.js +2 -2
  48. package/dist/runner/index.js +4 -4
  49. package/dist/runner/src/capability-roundtrip.d.ts +23 -0
  50. package/dist/runner/src/capability-roundtrip.d.ts.map +1 -1
  51. package/dist/runner/src/runner-capabilities.d.ts.map +1 -1
  52. package/dist/runner/src/serve.d.ts.map +1 -1
  53. package/dist/runner/src/session-resource-handlers.d.ts +23 -0
  54. package/dist/runner/src/session-resource-handlers.d.ts.map +1 -0
  55. package/dist/sdk/asset-manager.js +1 -1
  56. package/dist/sdk/index.js +4 -4
  57. package/dist/sdk/runner.js +4 -4
  58. package/dist/tui/index.js +4 -4
  59. package/dist/workspace-plugin/index.js +1 -1
  60. package/package.json +1 -1
  61. package/dist/chunk-BSVLAHHH.js.map +0 -1
  62. package/dist/chunk-DGM74UP4.js.map +0 -1
  63. package/dist/chunk-XHBPQ7QP.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { WorkspacePlugin } from './chunk-UAW7VRAL.js';
1
+ import { WorkspacePlugin } from './chunk-XFQ2OXYR.js';
2
2
  import { WebSocketServerTransport } from './chunk-WQ7DE5UC.js';
3
3
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
4
4
  import { PROTOCOL_VERSION } from './chunk-TDSRLMDB.js';
@@ -6,8 +6,8 @@ import { EventNormalizer } from './chunk-AKSR434V.js';
6
6
  import { classifyClaudeSdkError } from './chunk-PAYAFNXG.js';
7
7
  import { createDriver } from './chunk-ZEKWHJBB.js';
8
8
  import { deployCatalogEntry, undeployCatalogEntry } from './chunk-LV2HPH3C.js';
9
- import { registerBuiltinConnectors, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildConnectorPromptSection, buildSdkConnectorTools } from './chunk-XHBPQ7QP.js';
10
- import { loadConnectorDeclarations, PreMintedSecretProvider, InMemorySecretProvider } from './chunk-DGM74UP4.js';
9
+ import { registerBuiltinConnectors, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildConnectorPromptSection, buildSdkConnectorTools } from './chunk-FENG6OO6.js';
10
+ import { loadConnectorDeclarations, PreMintedSecretProvider, InMemorySecretProvider } from './chunk-CMG3GJ6B.js';
11
11
  import { renderStimulusPrompt, buildOrchestratorPrompt } from './chunk-DEYYRFQU.js';
12
12
  import { resolveSettings, resolveApiKey, providerEnvKey } from './chunk-M4KLIEIJ.js';
13
13
  import { resolveRuntimeAssets } from './chunk-FWHOU3CX.js';
@@ -2198,6 +2198,15 @@ function buildClientCapabilityHandler(args) {
2198
2198
  });
2199
2199
  };
2200
2200
  }
2201
+ async function dispatchRunnerCapabilityInvocation(cmd, deps) {
2202
+ try {
2203
+ const result = await deps.invoke(cmd.name, cmd.input);
2204
+ deps.emit({ type: "capability_result", callId: cmd.callId, result });
2205
+ } catch (err) {
2206
+ const message = err instanceof Error ? err.message : String(err);
2207
+ deps.emit({ type: "capability_result", callId: cmd.callId, result: { error: message } });
2208
+ }
2209
+ }
2201
2210
  function resolveCapabilityResult(pending, cmd) {
2202
2211
  const entry = pending.get(cmd.callId);
2203
2212
  if (!entry) return false;
@@ -2613,7 +2622,11 @@ var preMintedTokenSchema = z5.object({
2613
2622
  }).optional();
2614
2623
  var mountDeclarationInput = z5.strictObject({
2615
2624
  declaration: requiredUnknown,
2616
- preMintedToken: preMintedTokenSchema
2625
+ preMintedToken: preMintedTokenSchema,
2626
+ // The platform attaches a workspace-migration directive on add_mount; the
2627
+ // handler ignores it for now (replace-workspace hot-migration is a follow-up).
2628
+ // Accepted here so a real platform add_mount payload validates.
2629
+ migration: z5.unknown().optional()
2617
2630
  });
2618
2631
  var connectorDeclarationInput = z5.strictObject({
2619
2632
  declaration: requiredUnknown,
@@ -2769,6 +2782,76 @@ function buildRunnerCapabilities(handlers) {
2769
2782
  })
2770
2783
  ];
2771
2784
  }
2785
+
2786
+ // runner/src/session-resource-handlers.ts
2787
+ function asDeclaration(declaration) {
2788
+ if (declaration !== null && typeof declaration === "object" && typeof declaration.id === "string" && typeof declaration.driver === "string") {
2789
+ return declaration;
2790
+ }
2791
+ return null;
2792
+ }
2793
+ function toPreMinted(token) {
2794
+ return { ok: true, token: token.token, expiresAt: token.expiresAt ?? null };
2795
+ }
2796
+ function buildSessionResourceHandlers(deps) {
2797
+ const { getResourceManager, getPreMintedSecrets, emitResourcesAvailable, log } = deps;
2798
+ async function add(kind, input) {
2799
+ const rm = getResourceManager();
2800
+ if (!rm) return { ok: false, code: "no_session", message: "session resources not ready" };
2801
+ const decl = asDeclaration(input.declaration);
2802
+ if (!decl) {
2803
+ return { ok: false, code: "invalid_declaration", message: "declaration missing id/driver" };
2804
+ }
2805
+ if (input.preMintedToken) {
2806
+ getPreMintedSecrets()?.set(kind, decl.id, toPreMinted(input.preMintedToken));
2807
+ }
2808
+ try {
2809
+ await rm.connect(decl);
2810
+ } catch (err) {
2811
+ const message = err instanceof Error ? err.message : String(err);
2812
+ log(`[session-resource] runner.add_${kind} failed for ${decl.id}: ${message}`);
2813
+ return { ok: false, code: "connect_failed", message };
2814
+ }
2815
+ emitResourcesAvailable();
2816
+ log(`[session-resource] runner.add_${kind} connected ${decl.id}`);
2817
+ return { ok: true, id: decl.id };
2818
+ }
2819
+ return {
2820
+ addConnector: (input) => add("connector", input),
2821
+ addMount: (input) => add("mount", input),
2822
+ removeResource: async (input) => {
2823
+ const rm = getResourceManager();
2824
+ if (!rm) return { ok: false, code: "no_session", message: "session resources not ready" };
2825
+ if (!rm.has(input.id)) {
2826
+ return { ok: false, code: "not_found", message: `no resource with id ${input.id}` };
2827
+ }
2828
+ try {
2829
+ await rm.disconnect(input.id);
2830
+ } catch (err) {
2831
+ const message = err instanceof Error ? err.message : String(err);
2832
+ log(`[session-resource] runner.remove_resource failed for ${input.id}: ${message}`);
2833
+ return { ok: false, code: "disconnect_failed", message };
2834
+ }
2835
+ const ps = getPreMintedSecrets();
2836
+ ps?.unset("connector", input.id);
2837
+ ps?.unset("mount", input.id);
2838
+ emitResourcesAvailable();
2839
+ log(`[session-resource] runner.remove_resource removed ${input.id}`);
2840
+ return { ok: true };
2841
+ },
2842
+ updateCredential: async (input) => {
2843
+ const ps = getPreMintedSecrets();
2844
+ if (!ps) return { ok: false, code: "no_session", message: "session resources not ready" };
2845
+ const rm = getResourceManager();
2846
+ if (rm && !rm.has(input.id)) {
2847
+ return { ok: false, code: "not_found", message: `no resource with id ${input.id}` };
2848
+ }
2849
+ ps.set(input.kind, input.id, input.mint);
2850
+ log(`[session-resource] runner.update_credential staged ${input.kind}:${input.id}`);
2851
+ return { ok: true };
2852
+ }
2853
+ };
2854
+ }
2772
2855
  var CLAUDE_CODE_CREDENTIALS_KEY = "CLAUDE_CODE_CREDENTIALS_JSON";
2773
2856
  async function writeClaudeCodeCredentialsFile(home, json) {
2774
2857
  const claudeDir = join(home, ".claude");
@@ -3624,6 +3707,17 @@ async function startAgentServer(opts) {
3624
3707
  }
3625
3708
  }
3626
3709
  async function handleCommand(cmd) {
3710
+ const inbound = cmd;
3711
+ if (inbound.type === "capability_invoked") {
3712
+ await dispatchRunnerCapabilityInvocation(
3713
+ { callId: inbound.callId ?? "", name: inbound.name ?? "", input: inbound.input },
3714
+ {
3715
+ invoke: (name, input) => capabilityRegistry.invoke(name, input, { sessionId }),
3716
+ emit: (event) => sendEvent(event)
3717
+ }
3718
+ );
3719
+ return;
3720
+ }
3627
3721
  switch (cmd.type) {
3628
3722
  case "session_init": {
3629
3723
  if (cmd.protocolVersion.major !== PROTOCOL_VERSION.major) {
@@ -3713,12 +3807,23 @@ async function startAgentServer(opts) {
3713
3807
  agentSession.startWatching();
3714
3808
  capabilityRegistry.setRemoteInvoker(remoteCapabilityInvoker);
3715
3809
  const runnerCaps = buildRunnerCapabilities({
3716
- // setLogLevel is left undefined the cap's built-in fallback
3717
- // calls `getLogStore()?.setLevel(...)` directly, which matches
3718
- // the legacy `set_log_level` AgentCommand body 1:1.
3719
- // Other handlers (addMount / addConnector / removeResource /
3720
- // updateCredential / setState / lifecycle) remain stubs;
3721
- // wiring is tracked under AF-PV3 / F-RUNNER-CAPS.
3810
+ // Resource hot-plug handlers, wired to the live session's
3811
+ // ConnectorManager + PreMintedSecretProvider via getters because
3812
+ // both are lazily (re)assigned in this scope.
3813
+ ...buildSessionResourceHandlers({
3814
+ getResourceManager: () => resourceManager,
3815
+ getPreMintedSecrets: () => preMintedSecrets,
3816
+ emitResourcesAvailable: () => {
3817
+ sendEvent({
3818
+ type: "resources_available",
3819
+ ...splitConnectorsForWire(resourceManager)
3820
+ });
3821
+ },
3822
+ log
3823
+ })
3824
+ // setLogLevel left undefined — the cap's built-in fallback calls
3825
+ // getLogStore()?.setLevel(...) directly. setState / lifecycle
3826
+ // remain stubs (not resource hot-plug; out of Sprint 2 scope).
3722
3827
  });
3723
3828
  for (const cap of runnerCaps) {
3724
3829
  capabilityRegistry.register(cap, "agent");
@@ -4527,6 +4632,6 @@ function touchSession(state) {
4527
4632
  return { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
4528
4633
  }
4529
4634
 
4530
- export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildContextSection, buildEnvironmentSection, builtinCapabilities, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, createAgentSession, createSessionStimulusBus, defineCapability, deleteSession, emitSystemPromptComposed, ensureGitConfigInclude, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, installPreInitRingSink, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, newSession, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, touchSession, writeClaudeCodeCredentialsFile };
4531
- //# sourceMappingURL=chunk-BSVLAHHH.js.map
4532
- //# sourceMappingURL=chunk-BSVLAHHH.js.map
4635
+ export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildContextSection, buildEnvironmentSection, builtinCapabilities, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, createAgentSession, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, installPreInitRingSink, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, newSession, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, touchSession, writeClaudeCodeCredentialsFile };
4636
+ //# sourceMappingURL=chunk-TDZGENVP.js.map
4637
+ //# sourceMappingURL=chunk-TDZGENVP.js.map