@skaile/workspaces 4.3.0 → 4.4.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 (129) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/app-sdk/index.js +1 -1
  3. package/dist/{asset-feeds-SUK47KWR.js → asset-feeds-OBOI2POB.js} +4 -4
  4. package/dist/{asset-feeds-SUK47KWR.js.map → asset-feeds-OBOI2POB.js.map} +1 -1
  5. package/dist/asset-manager/index.js +1 -1
  6. package/dist/bridge/drivers/claude-sdk.js +4 -4
  7. package/dist/bridge/drivers/codex.js +2 -2
  8. package/dist/bridge/drivers/continue.js +2 -2
  9. package/dist/bridge/drivers/echo.js +3 -3
  10. package/dist/bridge/drivers/gemini.js +4 -4
  11. package/dist/bridge/drivers/goose.js +2 -2
  12. package/dist/bridge/drivers/omp.js +1 -1
  13. package/dist/bridge/drivers/opencode.js +2 -2
  14. package/dist/bridge/drivers/qwen.js +4 -4
  15. package/dist/bridge/index.js +5 -5
  16. package/dist/{chunk-67IZGZI2.js → chunk-3IU5B3YX.js} +3 -3
  17. package/dist/{chunk-67IZGZI2.js.map → chunk-3IU5B3YX.js.map} +1 -1
  18. package/dist/{chunk-GMKNGIIB.js → chunk-3UAE2BVU.js} +39 -5
  19. package/dist/chunk-3UAE2BVU.js.map +1 -0
  20. package/dist/{chunk-OJ4GNQO5.js → chunk-52FI7RXZ.js} +2 -2
  21. package/dist/{chunk-OJ4GNQO5.js.map → chunk-52FI7RXZ.js.map} +1 -1
  22. package/dist/{chunk-2EDBRUFS.js → chunk-53MOGLIA.js} +5 -5
  23. package/dist/{chunk-2EDBRUFS.js.map → chunk-53MOGLIA.js.map} +1 -1
  24. package/dist/{chunk-V7VHX7MK.js → chunk-62ETRVY3.js} +2 -2
  25. package/dist/{chunk-V7VHX7MK.js.map → chunk-62ETRVY3.js.map} +1 -1
  26. package/dist/{chunk-ZKIVYTU6.js → chunk-A4UG5BWS.js} +6 -6
  27. package/dist/{chunk-ZKIVYTU6.js.map → chunk-A4UG5BWS.js.map} +1 -1
  28. package/dist/{chunk-2CDYYL6T.js → chunk-BC7BBIDJ.js} +3 -3
  29. package/dist/{chunk-2CDYYL6T.js.map → chunk-BC7BBIDJ.js.map} +1 -1
  30. package/dist/{chunk-3VUCSJBJ.js → chunk-D7PYQMNK.js} +3 -3
  31. package/dist/{chunk-3VUCSJBJ.js.map → chunk-D7PYQMNK.js.map} +1 -1
  32. package/dist/{chunk-HKLCMOK4.js → chunk-EPQHIC6E.js} +3 -3
  33. package/dist/{chunk-HKLCMOK4.js.map → chunk-EPQHIC6E.js.map} +1 -1
  34. package/dist/{chunk-TZUAFEYN.js → chunk-FPV4E5DK.js} +3 -3
  35. package/dist/{chunk-TZUAFEYN.js.map → chunk-FPV4E5DK.js.map} +1 -1
  36. package/dist/{chunk-IXQC4ADP.js → chunk-FWDTBQCO.js} +3 -3
  37. package/dist/{chunk-IXQC4ADP.js.map → chunk-FWDTBQCO.js.map} +1 -1
  38. package/dist/{chunk-643F3GNV.js → chunk-HFS22LN2.js} +3 -3
  39. package/dist/{chunk-643F3GNV.js.map → chunk-HFS22LN2.js.map} +1 -1
  40. package/dist/{chunk-GB2CMJ3R.js → chunk-IFXO3KZT.js} +170 -38
  41. package/dist/chunk-IFXO3KZT.js.map +1 -0
  42. package/dist/{chunk-O552FCP7.js → chunk-JHBLSPAI.js} +3 -3
  43. package/dist/{chunk-O552FCP7.js.map → chunk-JHBLSPAI.js.map} +1 -1
  44. package/dist/{chunk-7J3FBC6T.js → chunk-JUAC5QL4.js} +2 -2
  45. package/dist/{chunk-7J3FBC6T.js.map → chunk-JUAC5QL4.js.map} +1 -1
  46. package/dist/{chunk-T3LXTYWS.js → chunk-NXH7TTWK.js} +6 -6
  47. package/dist/{chunk-T3LXTYWS.js.map → chunk-NXH7TTWK.js.map} +1 -1
  48. package/dist/{chunk-PX5M5WDS.js → chunk-O3XVKALH.js} +6 -6
  49. package/dist/{chunk-PX5M5WDS.js.map → chunk-O3XVKALH.js.map} +1 -1
  50. package/dist/{chunk-7YNBVDGL.js → chunk-TAZQ232B.js} +3 -3
  51. package/dist/{chunk-7YNBVDGL.js.map → chunk-TAZQ232B.js.map} +1 -1
  52. package/dist/{chunk-DY3R7FYY.js → chunk-V2P4ECNY.js} +4 -4
  53. package/dist/chunk-V2P4ECNY.js.map +1 -0
  54. package/dist/{chunk-6CMMJFPV.js → chunk-VC4TWNOT.js} +4 -4
  55. package/dist/{chunk-6CMMJFPV.js.map → chunk-VC4TWNOT.js.map} +1 -1
  56. package/dist/{chunk-6SBTX44S.js → chunk-YDPT2X6G.js} +4 -4
  57. package/dist/{chunk-6SBTX44S.js.map → chunk-YDPT2X6G.js.map} +1 -1
  58. package/dist/cli/index.js +34 -34
  59. package/dist/connectors/index.js +6 -6
  60. package/dist/{ensure-sources-V62XWSYD.js → ensure-sources-XQ4WQAIB.js} +4 -4
  61. package/dist/{ensure-sources-V62XWSYD.js.map → ensure-sources-XQ4WQAIB.js.map} +1 -1
  62. package/dist/factory-assets/connectors/box.js +6 -6
  63. package/dist/factory-assets/connectors/deploy.js +6 -6
  64. package/dist/factory-assets/connectors/devserver.js +6 -6
  65. package/dist/factory-assets/connectors/flow/adapter.js +6 -6
  66. package/dist/factory-assets/connectors/flow/run-flow.js +7 -7
  67. package/dist/factory-assets/connectors/flow.js +6 -6
  68. package/dist/factory-assets/connectors/git.js +6 -6
  69. package/dist/factory-assets/connectors/gmail.js +6 -6
  70. package/dist/factory-assets/connectors/googledrive.js +6 -6
  71. package/dist/factory-assets/connectors/local.js +6 -6
  72. package/dist/factory-assets/connectors/mattermost.js +6 -6
  73. package/dist/factory-assets/connectors/memory.js +6 -6
  74. package/dist/factory-assets/connectors/minio.js +6 -6
  75. package/dist/factory-assets/connectors/postgres.js +6 -6
  76. package/dist/factory-assets/connectors/s3.js +6 -6
  77. package/dist/factory-assets/connectors/sharepoint.js +6 -6
  78. package/dist/factory-assets/connectors/sqlite.js +6 -6
  79. package/dist/factory-assets/connectors/static-server.js +6 -6
  80. package/dist/factory-assets/connectors/tunnel.js +6 -6
  81. package/dist/factory-assets/connectors/webdav.js +6 -6
  82. package/dist/factory-assets/connectors/xstate-store.js +6 -6
  83. package/dist/factory-assets/connectors/xstate.js +6 -6
  84. package/dist/{helpers-ZXSNIPEH.js → helpers-AFXYIAYJ.js} +4 -4
  85. package/dist/{helpers-ZXSNIPEH.js.map → helpers-AFXYIAYJ.js.map} +1 -1
  86. package/dist/{library-publish-OHNV7TCD.js → library-publish-ZDLQ5PHJ.js} +6 -6
  87. package/dist/{library-publish-OHNV7TCD.js.map → library-publish-ZDLQ5PHJ.js.map} +1 -1
  88. package/dist/{open-library-VXKQ4KNY.js → open-library-Q44MES2N.js} +5 -5
  89. package/dist/{open-library-VXKQ4KNY.js.map → open-library-Q44MES2N.js.map} +1 -1
  90. package/dist/{project-GOQYIOKG.js → project-2UJVJYPS.js} +5 -5
  91. package/dist/{project-GOQYIOKG.js.map → project-2UJVJYPS.js.map} +1 -1
  92. package/dist/runner/index.js +10 -10
  93. package/dist/runner/src/resource-handler.d.ts +40 -1
  94. package/dist/runner/src/resource-handler.d.ts.map +1 -1
  95. package/dist/sdk/asset-manager.js +1 -1
  96. package/dist/sdk/bridge.js +5 -5
  97. package/dist/sdk/index.js +10 -10
  98. package/dist/sdk/runner.js +10 -10
  99. package/dist/sdk/session.js +2 -2
  100. package/dist/sdk/store.js +1 -1
  101. package/dist/sdk/types.js +1 -1
  102. package/dist/session/index.js +2 -2
  103. package/dist/{setup-7DVYP3TP.js → setup-LPTQRR6B.js} +10 -10
  104. package/dist/{setup-7DVYP3TP.js.map → setup-LPTQRR6B.js.map} +1 -1
  105. package/dist/{source-4SAPYPNW.js → source-KSNC6ZYY.js} +6 -6
  106. package/dist/{source-4SAPYPNW.js.map → source-KSNC6ZYY.js.map} +1 -1
  107. package/dist/{source-manifest-publish-UEMPQCE5.js → source-manifest-publish-QQYA6ZGP.js} +7 -7
  108. package/dist/{source-manifest-publish-UEMPQCE5.js.map → source-manifest-publish-QQYA6ZGP.js.map} +1 -1
  109. package/dist/store/index.js +1 -1
  110. package/dist/store/src/index.d.ts +1 -1
  111. package/dist/store/src/index.d.ts.map +1 -1
  112. package/dist/store/src/resource-client.d.ts +32 -2
  113. package/dist/store/src/resource-client.d.ts.map +1 -1
  114. package/dist/tui/index.js +10 -10
  115. package/dist/types/index.js +1 -1
  116. package/dist/types/src/events.d.ts +95 -1
  117. package/dist/types/src/events.d.ts.map +1 -1
  118. package/dist/types/src/index.d.ts +1 -1
  119. package/dist/types/src/index.d.ts.map +1 -1
  120. package/dist/types/src/protocol.d.ts +3 -3
  121. package/dist/types/src/protocol.d.ts.map +1 -1
  122. package/dist/types/src/version.d.ts +11 -1
  123. package/dist/types/src/version.d.ts.map +1 -1
  124. package/dist/workspace-plugin/adapters/mcp.js +2 -2
  125. package/dist/workspace-plugin/index.js +1 -1
  126. package/package.json +1 -1
  127. package/dist/chunk-DY3R7FYY.js.map +0 -1
  128. package/dist/chunk-GB2CMJ3R.js.map +0 -1
  129. package/dist/chunk-GMKNGIIB.js.map +0 -1
@@ -1,28 +1,28 @@
1
- import { WorkspacePlugin } from './chunk-V7VHX7MK.js';
2
- import { buildWorkspaceToolDefs } from './chunk-HKLCMOK4.js';
1
+ import { WorkspacePlugin } from './chunk-62ETRVY3.js';
2
+ import { buildWorkspaceToolDefs } from './chunk-EPQHIC6E.js';
3
3
  import { findAiAssetsRoot } from './chunk-7IRJ4K4F.js';
4
4
  import { WebSocketServerTransport } from './chunk-73ZXUUL6.js';
5
5
  import { assembleSystemPrompt, buildCapabilitiesPromptSection } from './chunk-W3UDISS2.js';
6
6
  import { prepareNativePolicy, codexInstanceEnvironment, parseCodexCredential, parseCodexRefreshInput, parseCodexRefreshResult } from './chunk-45LLHKQ2.js';
7
- import { resolveFlowPath } from './chunk-IXQC4ADP.js';
7
+ import { resolveFlowPath } from './chunk-FWDTBQCO.js';
8
8
  import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-7BUZQVRR.js';
9
- import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-PX5M5WDS.js';
9
+ import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-O3XVKALH.js';
10
10
  import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-KW7YIRYL.js';
11
- import { EventNormalizer } from './chunk-6SBTX44S.js';
11
+ import { EventNormalizer } from './chunk-YDPT2X6G.js';
12
12
  import { probeResumeTranscript } from './chunk-WLFRA5RM.js';
13
13
  import { CodexNativeStateUnavailable } from './chunk-LOO5CB5M.js';
14
- import { dispatchCapability } from './chunk-7YNBVDGL.js';
14
+ import { dispatchCapability } from './chunk-TAZQ232B.js';
15
15
  import { classifyClaudeSdkError } from './chunk-GAH4YRCI.js';
16
- import { createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv } from './chunk-7J3FBC6T.js';
16
+ import { createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv } from './chunk-JUAC5QL4.js';
17
17
  import { loadFlow } from './chunk-NWZQMJTI.js';
18
18
  import { parseFlowDefinition } from './chunk-53ORCYPJ.js';
19
19
  import { renderStimulusPrompt } from './chunk-2D5BYAL6.js';
20
- import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-DY3R7FYY.js';
20
+ import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-V2P4ECNY.js';
21
21
  import { resolveSettings, loadProviderRegistry } from './chunk-UJPVUN6H.js';
22
22
  import { resolveRuntimeAssets } from './chunk-REILIKVM.js';
23
23
  import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
24
24
  import { resolveSkWorkspaceConfig, resolveAgentDir, stageMaterializedSkills, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration } from './chunk-K27T47OO.js';
25
- import { withFsDeadline, fsDeadlineMs, FsDeadlineError, tryWithFsDeadline } from './chunk-MKZOK4JU.js';
25
+ import { withFsDeadline, FsDeadlineError, fsDeadlineMs, tryWithFsDeadline } from './chunk-MKZOK4JU.js';
26
26
  import { parseAssetRef } from './chunk-GEEW6SY2.js';
27
27
  import { resolveLogStoreConfig, createLogStoreFromConfig, OnLogBridgeSink, WsLogSink } from './chunk-FTG7CRFD.js';
28
28
  import { registryEntries, resolveEntryBaseUrl } from './chunk-ILG4BXYE.js';
@@ -31,9 +31,9 @@ import { __require } from './chunk-NSBPE2FW.js';
31
31
  import pc from 'picocolors';
32
32
  import { Marked } from 'marked';
33
33
  import { markedTerminal } from 'marked-terminal';
34
- import fs4, { readFile, stat, rm, unlink, mkdir, writeFile, readdir, realpath, lstat, rename, readlink, mkdtemp } from 'fs/promises';
34
+ import fs4, { readFile, readdir, lstat, stat, rm, unlink, mkdir, writeFile, realpath, rename, readlink, mkdtemp } from 'fs/promises';
35
35
  import { createHash, randomBytes, timingSafeEqual, randomUUID } from 'crypto';
36
- import path4, { join, resolve, relative, sep, isAbsolute, dirname, basename } from 'path';
36
+ import path4, { join, resolve, relative, sep, isAbsolute, basename, dirname } from 'path';
37
37
  import { existsSync, lstatSync, realpathSync, readFileSync, mkdirSync, writeFileSync, watch, chmodSync, accessSync, constants } from 'fs';
38
38
  import { homedir } from 'os';
39
39
  import * as z7 from 'zod';
@@ -3144,6 +3144,30 @@ function rejectCapabilityOnApprovalDeny(pending, callId, feedback) {
3144
3144
  entry.reject(new Error(feedback ?? "declined by user"));
3145
3145
  return true;
3146
3146
  }
3147
+ var ResourceOperationError = class extends Error {
3148
+ constructor(message, code) {
3149
+ super(message);
3150
+ this.code = code;
3151
+ this.name = "ResourceOperationError";
3152
+ }
3153
+ code;
3154
+ };
3155
+ function unsupportedOperation(operation, target) {
3156
+ return new ResourceOperationError(
3157
+ `Unsupported operation for ${target}: ${operation}`,
3158
+ "unsupported_operation"
3159
+ );
3160
+ }
3161
+ function errorResponse(command, resourceId, err) {
3162
+ return {
3163
+ type: "resource_response",
3164
+ requestId: command.requestId,
3165
+ resourceId,
3166
+ operation: command.operation,
3167
+ error: err instanceof Error ? err.message : String(err),
3168
+ ...err instanceof ResourceOperationError ? { code: err.code } : {}
3169
+ };
3170
+ }
3147
3171
  async function handleResourceRequest(command, manager, emit) {
3148
3172
  const { requestId, connectorId, operation, path: path5, options, content } = command;
3149
3173
  try {
@@ -3173,22 +3197,96 @@ async function handleResourceRequest(command, manager, emit) {
3173
3197
  options
3174
3198
  );
3175
3199
  break;
3200
+ default:
3201
+ throw unsupportedOperation(operation, "connector");
3176
3202
  }
3177
3203
  emit({ type: "resource_response", requestId, resourceId: connectorId, operation, data });
3178
3204
  } catch (err) {
3179
- emit({
3180
- type: "resource_response",
3181
- requestId,
3182
- resourceId: connectorId,
3183
- operation,
3184
- error: err instanceof Error ? err.message : String(err)
3185
- });
3205
+ emit(errorResponse(command, connectorId, err));
3186
3206
  }
3187
3207
  }
3188
3208
  var MOUNT_LIST_MAX_DEPTH = 32;
3189
3209
  var MOUNT_LIST_MAX_ENTRIES = 1e4;
3190
3210
  var MOUNT_TREE_OP_DEADLINE_FACTOR = 4;
3191
3211
  var MOUNT_READ_DEADLINE_FACTOR = 4;
3212
+ var MOUNT_STAT_MAX_ENTRIES = 5e4;
3213
+ var MOUNT_STAT_BUDGET_MS = 1e4;
3214
+ var MOUNT_STAT_CONCURRENCY = 16;
3215
+ function lowerCap(requested, cap) {
3216
+ return typeof requested === "number" && Number.isFinite(requested) && requested > 0 ? Math.min(Math.floor(requested), cap) : cap;
3217
+ }
3218
+ function isoTime(time) {
3219
+ const ms = time.getTime();
3220
+ return Number.isFinite(ms) && ms > 0 ? time.toISOString() : void 0;
3221
+ }
3222
+ async function computeDirectoryTotals(root, opts, clock = Date.now) {
3223
+ const deadline = clock() + opts.budgetMs;
3224
+ const totals = { files: 0, directories: 0, bytes: 0, partial: false };
3225
+ const markPartial = (why) => {
3226
+ totals.partial = true;
3227
+ if (why && (!totals.stoppedBy || why !== "depth")) totals.stoppedBy = why;
3228
+ };
3229
+ let stopped = false;
3230
+ let seen = 0;
3231
+ const pending = [{ abs: root, depth: 0 }];
3232
+ while (pending.length > 0 && !stopped) {
3233
+ if (clock() >= deadline) {
3234
+ markPartial("time");
3235
+ break;
3236
+ }
3237
+ const { abs, depth } = pending.pop();
3238
+ let dirents;
3239
+ try {
3240
+ dirents = await withFsDeadline(`readdir ${abs}`, () => readdir(abs, { withFileTypes: true }));
3241
+ } catch (err) {
3242
+ if (err instanceof FsDeadlineError || abs === root) throw err;
3243
+ if (err.code === "ENOENT") {
3244
+ totals.directories--;
3245
+ continue;
3246
+ }
3247
+ totals.unreadable = (totals.unreadable ?? 0) + 1;
3248
+ markPartial();
3249
+ continue;
3250
+ }
3251
+ const files = [];
3252
+ for (const e of dirents) {
3253
+ if (!opts.includeHidden && e.name.startsWith(".")) continue;
3254
+ if (seen >= opts.maxEntries) {
3255
+ markPartial("entries");
3256
+ stopped = true;
3257
+ break;
3258
+ }
3259
+ seen++;
3260
+ if (e.isDirectory()) {
3261
+ totals.directories++;
3262
+ if (depth + 1 > opts.maxDepth) markPartial("depth");
3263
+ else pending.push({ abs: join(abs, e.name), depth: depth + 1 });
3264
+ } else {
3265
+ totals.files++;
3266
+ files.push(join(abs, e.name));
3267
+ }
3268
+ }
3269
+ for (let i = 0; i < files.length; i += MOUNT_STAT_CONCURRENCY) {
3270
+ if (clock() >= deadline) {
3271
+ markPartial("time");
3272
+ stopped = true;
3273
+ break;
3274
+ }
3275
+ const sizes = await Promise.all(
3276
+ files.slice(i, i + MOUNT_STAT_CONCURRENCY).map(async (file) => {
3277
+ try {
3278
+ return (await withFsDeadline(`lstat ${file}`, () => lstat(file))).size;
3279
+ } catch (err) {
3280
+ if (err instanceof FsDeadlineError) throw err;
3281
+ return 0;
3282
+ }
3283
+ })
3284
+ );
3285
+ for (const size of sizes) totals.bytes += size;
3286
+ }
3287
+ }
3288
+ return totals;
3289
+ }
3192
3290
  function getMimeType(filename) {
3193
3291
  return mime.getType(filename) ?? "application/octet-stream";
3194
3292
  }
@@ -3214,7 +3312,10 @@ async function handleMountResourceRequest(command, manager, emit) {
3214
3312
  const entry = manager.get(mountId);
3215
3313
  const mountPath = entry.handle.mountPath;
3216
3314
  if (!mountPath) {
3217
- throw new Error(`Connector "${mountId}" has no projected mount directory`);
3315
+ throw new ResourceOperationError(
3316
+ `Connector "${mountId}" has no projected mount directory`,
3317
+ "unsupported_operation"
3318
+ );
3218
3319
  }
3219
3320
  const targetPath = reqPath ? resolve(mountPath, reqPath) : mountPath;
3220
3321
  const rel = relative(mountPath, targetPath);
@@ -3315,6 +3416,49 @@ async function handleMountResourceRequest(command, manager, emit) {
3315
3416
  data = true;
3316
3417
  break;
3317
3418
  }
3419
+ case "mkdir": {
3420
+ if (rel === "") throw new Error("A folder path is required");
3421
+ const parentDir = dirname(targetPath);
3422
+ await withFsDeadline(`mkdir ${parentDir}`, () => mkdir(parentDir, { recursive: true }));
3423
+ try {
3424
+ await withFsDeadline(`mkdir ${targetPath}`, () => mkdir(targetPath));
3425
+ } catch (mkdirErr) {
3426
+ if (mkdirErr.code === "EEXIST") {
3427
+ throw new ResourceOperationError(
3428
+ `"${rel.split(sep).join("/")}" already exists`,
3429
+ "already_exists"
3430
+ );
3431
+ }
3432
+ throw mkdirErr;
3433
+ }
3434
+ data = true;
3435
+ break;
3436
+ }
3437
+ case "stat": {
3438
+ const statOptions = options;
3439
+ const st = await withFsDeadline(`stat ${targetPath}`, () => stat(targetPath));
3440
+ const isDir = st.isDirectory();
3441
+ const result = {
3442
+ name: rel === "" ? "" : basename(targetPath),
3443
+ path: rel.split(sep).join("/"),
3444
+ type: isDir ? "directory" : "file"
3445
+ };
3446
+ if (!isDir) result.size = st.size;
3447
+ const modifiedAt = isoTime(st.mtime);
3448
+ if (modifiedAt) result.modifiedAt = modifiedAt;
3449
+ const createdAt = isoTime(st.birthtime);
3450
+ if (createdAt) result.createdAt = createdAt;
3451
+ if (isDir && statOptions?.recursive) {
3452
+ result.totals = await computeDirectoryTotals(targetPath, {
3453
+ includeHidden: Boolean(statOptions.includeHidden),
3454
+ maxEntries: lowerCap(statOptions.maxEntries, MOUNT_STAT_MAX_ENTRIES),
3455
+ budgetMs: lowerCap(statOptions.timeoutMs, MOUNT_STAT_BUDGET_MS),
3456
+ maxDepth: MOUNT_LIST_MAX_DEPTH
3457
+ });
3458
+ }
3459
+ data = result;
3460
+ break;
3461
+ }
3318
3462
  case "delete": {
3319
3463
  const st = await withFsDeadline(`stat ${targetPath}`, () => stat(targetPath));
3320
3464
  if (st.isDirectory()) {
@@ -3330,17 +3474,11 @@ async function handleMountResourceRequest(command, manager, emit) {
3330
3474
  break;
3331
3475
  }
3332
3476
  default:
3333
- throw new Error(`Unsupported operation for mount: ${operation}`);
3477
+ throw unsupportedOperation(operation, "mount");
3334
3478
  }
3335
3479
  emit({ type: "resource_response", requestId, resourceId: mountId, operation, data });
3336
3480
  } catch (err) {
3337
- emit({
3338
- type: "resource_response",
3339
- requestId,
3340
- resourceId: mountId,
3341
- operation,
3342
- error: err instanceof Error ? err.message : String(err)
3343
- });
3481
+ emit(errorResponse(command, mountId, err));
3344
3482
  }
3345
3483
  }
3346
3484
  var SESSION_ROOT_WRITABLE_FILES = ["skaile.yaml"];
@@ -3401,7 +3539,7 @@ async function handleSessionRootResourceRequest(command, rootDir, emit) {
3401
3539
  const { requestId, connectorId, operation, path: reqPath, content } = command;
3402
3540
  try {
3403
3541
  if (operation !== "write" && operation !== "delete") {
3404
- throw new Error(`Unsupported operation for the session root: ${operation}`);
3542
+ throw unsupportedOperation(operation, "the session root");
3405
3543
  }
3406
3544
  if (!reqPath) throw new Error("A path is required for the session root");
3407
3545
  if (isAbsolute(reqPath)) throw new Error("Absolute paths are not allowed for the session root");
@@ -3450,13 +3588,7 @@ async function handleSessionRootResourceRequest(command, rootDir, emit) {
3450
3588
  }
3451
3589
  emit({ type: "resource_response", requestId, resourceId: connectorId, operation, data });
3452
3590
  } catch (err) {
3453
- emit({
3454
- type: "resource_response",
3455
- requestId,
3456
- resourceId: connectorId,
3457
- operation,
3458
- error: err instanceof Error ? err.message : String(err)
3459
- });
3591
+ emit(errorResponse(command, connectorId, err));
3460
3592
  }
3461
3593
  }
3462
3594
  async function dispatchResourceRequest(command, deps) {
@@ -8668,6 +8800,6 @@ function touchSession(state) {
8668
8800
  return { ...state, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
8669
8801
  }
8670
8802
 
8671
- 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_TREE_OP_DEADLINE_FACTOR, MarkdownStreamer, PreInitRingSink, SESSION_ROOT_WRITABLE_DIRS, SESSION_ROOT_WRITABLE_FILES, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createFlowConnectorReadiness, createManagedCodexSubpromptDriver, createSessionStimulusBus, defineCapability, deleteSession, dispatchResourceRequest, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureClaudeSettingsDisablesConnectors, ensureGitConfigInclude, executeConnectorMutate, extractClaudeAiOauthExpiresAt, flowStartNeedsDriverRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isSessionRootPathAllowed, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadManagedCodexHostConfig, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
8672
- //# sourceMappingURL=chunk-GB2CMJ3R.js.map
8673
- //# sourceMappingURL=chunk-GB2CMJ3R.js.map
8803
+ 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, 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, flowStartNeedsDriverRestart, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, handleSessionRootResourceRequest, hasNonTerminalFlow, hostOpResumeStimulus, installPreInitRingSink, isSessionRootPathAllowed, isTerminalFlowStatus, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadManagedCodexHostConfig, loadSession, loadSessionById, mcpAuthSecretKey, newSession, nulTailPaddingLength, pickFlowToolTarget, pickRepointedManager, planFlowMutate, prepareCodexTools, reconcilePendingDecisions, registerActiveFlow, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveFlowMutateConnectorWaitMs, resolveMixin, runAgentChat, saveSession, setCurrentSession, setUpFlowConnector, startAgentServer, stimulusFromMetas, supportsLiveToolUpdates, touchSession, validateInputResponse, writeClaudeCodeCredentialsFile };
8804
+ //# sourceMappingURL=chunk-IFXO3KZT.js.map
8805
+ //# sourceMappingURL=chunk-IFXO3KZT.js.map