@skaile/workspaces 4.8.0 → 4.9.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 (160) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{asset-feeds-YDCXFTJ7.js → asset-feeds-23UCAOLX.js} +7 -7
  3. package/dist/{asset-feeds-YDCXFTJ7.js.map → asset-feeds-23UCAOLX.js.map} +1 -1
  4. package/dist/asset-manager/catalog-deployer.js +3 -3
  5. package/dist/asset-manager/index.js +6 -6
  6. package/dist/asset-manager/installer.js +4 -4
  7. package/dist/bridge/codex-app-server.js +4 -4
  8. package/dist/bridge/drivers/claude-sdk.js +5 -5
  9. package/dist/bridge/drivers/codex.js +6 -6
  10. package/dist/bridge/drivers/continue.js +6 -6
  11. package/dist/bridge/drivers/echo.js +1 -1
  12. package/dist/bridge/drivers/gemini.js +4 -4
  13. package/dist/bridge/drivers/goose.js +6 -6
  14. package/dist/bridge/drivers/omp.js +1 -1
  15. package/dist/bridge/drivers/opencode.js +6 -6
  16. package/dist/bridge/drivers/qwen.js +4 -4
  17. package/dist/bridge/index.js +6 -6
  18. package/dist/{chunk-TCANYRAF.js → chunk-2DGIAWKU.js} +185 -31
  19. package/dist/chunk-2DGIAWKU.js.map +1 -0
  20. package/dist/{chunk-VRBEMXEM.js → chunk-2LT4CWA5.js} +3 -3
  21. package/dist/{chunk-VRBEMXEM.js.map → chunk-2LT4CWA5.js.map} +1 -1
  22. package/dist/{chunk-J2NEKEZK.js → chunk-2PGVW3FL.js} +3 -3
  23. package/dist/{chunk-J2NEKEZK.js.map → chunk-2PGVW3FL.js.map} +1 -1
  24. package/dist/{chunk-GKP22MGV.js → chunk-5DHAVCKW.js} +2 -2
  25. package/dist/{chunk-GKP22MGV.js.map → chunk-5DHAVCKW.js.map} +1 -1
  26. package/dist/{chunk-Q5WGUPC5.js → chunk-5PF5OIQK.js} +3 -3
  27. package/dist/{chunk-Q5WGUPC5.js.map → chunk-5PF5OIQK.js.map} +1 -1
  28. package/dist/{chunk-BCXZ74DM.js → chunk-5WNQPXEG.js} +4 -4
  29. package/dist/{chunk-BCXZ74DM.js.map → chunk-5WNQPXEG.js.map} +1 -1
  30. package/dist/{chunk-GKX3QDPN.js → chunk-6BUJARLT.js} +3 -3
  31. package/dist/{chunk-GKX3QDPN.js.map → chunk-6BUJARLT.js.map} +1 -1
  32. package/dist/{chunk-TKHJXUG3.js → chunk-6J3L2CZ7.js} +4 -4
  33. package/dist/{chunk-TKHJXUG3.js.map → chunk-6J3L2CZ7.js.map} +1 -1
  34. package/dist/{chunk-NV6R6HJR.js → chunk-ERYOLF7V.js} +5 -5
  35. package/dist/{chunk-NV6R6HJR.js.map → chunk-ERYOLF7V.js.map} +1 -1
  36. package/dist/{chunk-DS7B54NF.js → chunk-F4PCBWPB.js} +3 -3
  37. package/dist/{chunk-DS7B54NF.js.map → chunk-F4PCBWPB.js.map} +1 -1
  38. package/dist/{chunk-IUVPPJ4T.js → chunk-FSRWPLIQ.js} +3 -3
  39. package/dist/{chunk-IUVPPJ4T.js.map → chunk-FSRWPLIQ.js.map} +1 -1
  40. package/dist/{chunk-U4LC6PLI.js → chunk-HA3XJN65.js} +3 -3
  41. package/dist/{chunk-U4LC6PLI.js.map → chunk-HA3XJN65.js.map} +1 -1
  42. package/dist/{chunk-HR2AGPLJ.js → chunk-HUF4ON2C.js} +4 -4
  43. package/dist/{chunk-HR2AGPLJ.js.map → chunk-HUF4ON2C.js.map} +1 -1
  44. package/dist/{chunk-IECSLI55.js → chunk-I7IWIVXY.js} +3 -3
  45. package/dist/{chunk-IECSLI55.js.map → chunk-I7IWIVXY.js.map} +1 -1
  46. package/dist/{chunk-UKFLK6V2.js → chunk-I7SQIWYX.js} +3 -3
  47. package/dist/{chunk-UKFLK6V2.js.map → chunk-I7SQIWYX.js.map} +1 -1
  48. package/dist/{chunk-RRX33TOZ.js → chunk-JBKXLCMG.js} +119 -14
  49. package/dist/chunk-JBKXLCMG.js.map +1 -0
  50. package/dist/{chunk-DYT3AQBM.js → chunk-JUZJUKWM.js} +3 -3
  51. package/dist/{chunk-DYT3AQBM.js.map → chunk-JUZJUKWM.js.map} +1 -1
  52. package/dist/{chunk-HKOC273F.js → chunk-P2G6XSJ3.js} +82 -8
  53. package/dist/chunk-P2G6XSJ3.js.map +1 -0
  54. package/dist/{chunk-DN2V47ER.js → chunk-PAYS6YCK.js} +9 -9
  55. package/dist/{chunk-DN2V47ER.js.map → chunk-PAYS6YCK.js.map} +1 -1
  56. package/dist/{chunk-NMSHQUBY.js → chunk-Q3AK4IQG.js} +5 -5
  57. package/dist/{chunk-NMSHQUBY.js.map → chunk-Q3AK4IQG.js.map} +1 -1
  58. package/dist/{chunk-EYH5ADRU.js → chunk-QJDVOKQO.js} +4 -4
  59. package/dist/{chunk-EYH5ADRU.js.map → chunk-QJDVOKQO.js.map} +1 -1
  60. package/dist/{chunk-AZSRDONR.js → chunk-SJYOKKYO.js} +3 -3
  61. package/dist/{chunk-AZSRDONR.js.map → chunk-SJYOKKYO.js.map} +1 -1
  62. package/dist/{chunk-74QHEAUT.js → chunk-T4IXZOG2.js} +6 -6
  63. package/dist/{chunk-74QHEAUT.js.map → chunk-T4IXZOG2.js.map} +1 -1
  64. package/dist/{chunk-FVYRWGUC.js → chunk-UJ5O5KQB.js} +7 -7
  65. package/dist/{chunk-FVYRWGUC.js.map → chunk-UJ5O5KQB.js.map} +1 -1
  66. package/dist/{chunk-SU5LVG6T.js → chunk-UM4LDXV5.js} +3 -3
  67. package/dist/{chunk-SU5LVG6T.js.map → chunk-UM4LDXV5.js.map} +1 -1
  68. package/dist/{chunk-2GCUBS2W.js → chunk-WLPL7CRM.js} +2 -2
  69. package/dist/{chunk-2GCUBS2W.js.map → chunk-WLPL7CRM.js.map} +1 -1
  70. package/dist/{chunk-5GYFYGVW.js → chunk-WQ5BCHQS.js} +2 -2
  71. package/dist/{chunk-5GYFYGVW.js.map → chunk-WQ5BCHQS.js.map} +1 -1
  72. package/dist/{chunk-2BLQJDYI.js → chunk-XHKM7OMR.js} +7 -7
  73. package/dist/{chunk-2BLQJDYI.js.map → chunk-XHKM7OMR.js.map} +1 -1
  74. package/dist/{chunk-4P352BUX.js → chunk-ZYAVNMKA.js} +5 -5
  75. package/dist/{chunk-4P352BUX.js.map → chunk-ZYAVNMKA.js.map} +1 -1
  76. package/dist/cli/index.js +49 -49
  77. package/dist/connectors/config.js +4 -4
  78. package/dist/connectors/index.js +9 -9
  79. package/dist/core/index.js +3 -3
  80. package/dist/core/runtime-assets.js +2 -2
  81. package/dist/core/src/index.d.ts +1 -1
  82. package/dist/core/src/index.d.ts.map +1 -1
  83. package/dist/core/src/workspace-config.d.ts +47 -3
  84. package/dist/core/src/workspace-config.d.ts.map +1 -1
  85. package/dist/core/workspace-config.js +1 -1
  86. package/dist/deploy/index.js +3 -3
  87. package/dist/{ensure-sources-65WPFIET.js → ensure-sources-AGDLO3RW.js} +9 -9
  88. package/dist/{ensure-sources-65WPFIET.js.map → ensure-sources-AGDLO3RW.js.map} +1 -1
  89. package/dist/factory-assets/connectors/box.js +9 -9
  90. package/dist/factory-assets/connectors/deploy.js +9 -9
  91. package/dist/factory-assets/connectors/devserver.js +9 -9
  92. package/dist/factory-assets/connectors/flow/adapter.js +9 -9
  93. package/dist/factory-assets/connectors/flow/engine.js +4 -4
  94. package/dist/factory-assets/connectors/flow/run-flow.js +10 -10
  95. package/dist/factory-assets/connectors/flow.js +9 -9
  96. package/dist/factory-assets/connectors/git/CONNECTOR.md +2 -1
  97. package/dist/factory-assets/connectors/git/driver.d.ts +25 -0
  98. package/dist/factory-assets/connectors/git/driver.d.ts.map +1 -1
  99. package/dist/factory-assets/connectors/git.js +9 -9
  100. package/dist/factory-assets/connectors/gmail.js +9 -9
  101. package/dist/factory-assets/connectors/googledrive.js +9 -9
  102. package/dist/factory-assets/connectors/local.js +9 -9
  103. package/dist/factory-assets/connectors/mattermost.js +9 -9
  104. package/dist/factory-assets/connectors/memory.js +9 -9
  105. package/dist/factory-assets/connectors/minio.js +9 -9
  106. package/dist/factory-assets/connectors/postgres.js +9 -9
  107. package/dist/factory-assets/connectors/s3.js +9 -9
  108. package/dist/factory-assets/connectors/sharepoint.js +9 -9
  109. package/dist/factory-assets/connectors/sqlite.js +9 -9
  110. package/dist/factory-assets/connectors/static-server.js +9 -9
  111. package/dist/factory-assets/connectors/tunnel.js +9 -9
  112. package/dist/factory-assets/connectors/webdav.js +9 -9
  113. package/dist/factory-assets/connectors/xstate-store.js +9 -9
  114. package/dist/factory-assets/connectors/xstate.js +9 -9
  115. package/dist/{flows-JRWDV3MG.js → flows-EO5CO3A3.js} +6 -6
  116. package/dist/{flows-JRWDV3MG.js.map → flows-EO5CO3A3.js.map} +1 -1
  117. package/dist/{helpers-3BHWBCBI.js → helpers-4H73P3WO.js} +9 -9
  118. package/dist/{helpers-3BHWBCBI.js.map → helpers-4H73P3WO.js.map} +1 -1
  119. package/dist/library/index.js +4 -4
  120. package/dist/library/install.js +3 -3
  121. package/dist/{library-publish-VKBT4JEX.js → library-publish-WTVCH5UI.js} +13 -13
  122. package/dist/{library-publish-VKBT4JEX.js.map → library-publish-WTVCH5UI.js.map} +1 -1
  123. package/dist/{open-library-PSLL6ULI.js → open-library-KS4IT4C7.js} +11 -11
  124. package/dist/{open-library-PSLL6ULI.js.map → open-library-KS4IT4C7.js.map} +1 -1
  125. package/dist/{paths-LH7LD4CC.js → paths-HWWTOYUY.js} +6 -6
  126. package/dist/{paths-LH7LD4CC.js.map → paths-HWWTOYUY.js.map} +1 -1
  127. package/dist/{plugin-store-A6VLQHCT.js → plugin-store-VJYXFXP5.js} +5 -5
  128. package/dist/{plugin-store-A6VLQHCT.js.map → plugin-store-VJYXFXP5.js.map} +1 -1
  129. package/dist/{project-KVTNJKED.js → project-DWCNGU56.js} +10 -10
  130. package/dist/{project-KVTNJKED.js.map → project-DWCNGU56.js.map} +1 -1
  131. package/dist/resolver/index.js +3 -3
  132. package/dist/runner/index.js +14 -14
  133. package/dist/runner/src/serve-credentials.d.ts +66 -0
  134. package/dist/runner/src/serve-credentials.d.ts.map +1 -1
  135. package/dist/runner/src/serve.d.ts.map +1 -1
  136. package/dist/runner/src/skill-staging.d.ts +17 -0
  137. package/dist/runner/src/skill-staging.d.ts.map +1 -1
  138. package/dist/sdk/asset-manager.js +6 -6
  139. package/dist/sdk/bridge.js +6 -6
  140. package/dist/sdk/core.js +3 -3
  141. package/dist/sdk/flow.js +4 -4
  142. package/dist/sdk/index.js +14 -14
  143. package/dist/sdk/resolver.js +3 -3
  144. package/dist/sdk/runner.js +14 -14
  145. package/dist/{setup-47UHZ7EG.js → setup-EPDRYWWI.js} +13 -13
  146. package/dist/{setup-47UHZ7EG.js.map → setup-EPDRYWWI.js.map} +1 -1
  147. package/dist/{skills-ZO66BL2Y.js → skills-DNCI6ITW.js} +5 -5
  148. package/dist/{skills-ZO66BL2Y.js.map → skills-DNCI6ITW.js.map} +1 -1
  149. package/dist/{source-5Q33HOPF.js → source-7TLL7GO7.js} +12 -12
  150. package/dist/{source-5Q33HOPF.js.map → source-7TLL7GO7.js.map} +1 -1
  151. package/dist/{source-manifest-publish-XHEAWRMG.js → source-manifest-publish-NX3JBMUT.js} +14 -14
  152. package/dist/{source-manifest-publish-XHEAWRMG.js.map → source-manifest-publish-NX3JBMUT.js.map} +1 -1
  153. package/dist/tui/index.js +14 -14
  154. package/dist/workspace-plugin/adapters/mcp.js +5 -5
  155. package/dist/workspace-plugin/adapters/omp.js +7 -7
  156. package/dist/workspace-plugin/index.js +1 -1
  157. package/package.json +1 -1
  158. package/dist/chunk-HKOC273F.js.map +0 -1
  159. package/dist/chunk-RRX33TOZ.js.map +0 -1
  160. package/dist/chunk-TCANYRAF.js.map +0 -1
@@ -1,31 +1,31 @@
1
- import { WorkspacePlugin } from './chunk-GKP22MGV.js';
2
- import { buildWorkspaceToolDefs } from './chunk-UKFLK6V2.js';
1
+ import { WorkspacePlugin } from './chunk-5DHAVCKW.js';
2
+ import { buildWorkspaceToolDefs } from './chunk-I7SQIWYX.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-74QHEAUT.js';
7
+ import { resolveFlowPath } from './chunk-T4IXZOG2.js';
8
8
  import { findAiAssetsRoot as findAiAssetsRoot$1, deployCatalogEntry, undeployCatalogEntry } from './chunk-7BUZQVRR.js';
9
- import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-RRX33TOZ.js';
10
- import { loadConnectorDeclarations, SecretProviderChain, ConnectorStartupError, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-DYT3AQBM.js';
11
- import { EventNormalizer } from './chunk-U4LC6PLI.js';
9
+ import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, buildSdkConnectorTools, buildLazySdkFlowTools, describeFlowOperations, buildConnectorToolDefs, buildFlowToolDefs, driveOrchestratorTurn, SessionNodeExecutor, SessionSubpromptRunner, ClassifierSubpromptRunner, SessionInlineSubFlowRunner, buildSdkFlowTools } from './chunk-JBKXLCMG.js';
10
+ import { loadConnectorDeclarations, SecretProviderChain, ConnectorStartupError, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, isKnownSecretRef, deriveSingleMaterializedConnectorDeclaration } from './chunk-JUZJUKWM.js';
11
+ import { EventNormalizer } from './chunk-HA3XJN65.js';
12
12
  import { probeResumeTranscript } from './chunk-OUJVFZWJ.js';
13
13
  import { CodexNativeStateUnavailable } from './chunk-LOO5CB5M.js';
14
14
  import { dispatchCapability } from './chunk-3GKBSHUG.js';
15
15
  import { classifyClaudeSdkError } from './chunk-GAH4YRCI.js';
16
- import { createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv } from './chunk-5GYFYGVW.js';
17
- import { loadFlow } from './chunk-AZSRDONR.js';
16
+ import { createDriver, catalogLayer, providerCredentialEnvName, toMergedRegistry, registryCredentialEnv, AI_PROVIDER_PRESETS } from './chunk-WQ5BCHQS.js';
17
+ import { loadFlow } from './chunk-SJYOKKYO.js';
18
18
  import { parseFlowDefinition } from './chunk-REYJKU7T.js';
19
19
  import { renderStimulusPrompt } from './chunk-2D5BYAL6.js';
20
20
  import { withActivityLabelJsonSchema, TOOL_ACTIVITY_PROMPT_SECTION, SESSION_ROOT_CONNECTOR_ID, PROTOCOL_VERSION } from './chunk-QAH24E5U.js';
21
- import { resolveSettings, loadProviderRegistry } from './chunk-BCXZ74DM.js';
22
- import { resolveRuntimeAssets } from './chunk-SU5LVG6T.js';
21
+ import { resolveSettings, loadProviderRegistry } from './chunk-5WNQPXEG.js';
22
+ import { resolveRuntimeAssets } from './chunk-UM4LDXV5.js';
23
23
  import { resolveDriverPaths } from './chunk-K5GBV4SA.js';
24
- import { resolveSkWorkspaceConfig, resolveAgentDir, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration, stageMaterializedSkills, unstageSkill } from './chunk-HKOC273F.js';
24
+ import { resolveSkWorkspaceConfig, resolveAgentDir, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration, stageMaterializedSkills, readSkillAllowList, isStagedSkillMarkerFor, unstageSkill } from './chunk-P2G6XSJ3.js';
25
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
- import { registryEntries, resolveEntryBaseUrl } from './chunk-ILG4BXYE.js';
28
+ import { registryEntries, resolveEntryBaseUrl, parseModelRef, isEntryEnabled, parseCredentialRef } from './chunk-ILG4BXYE.js';
29
29
  import { getLogStore, registerLogStore, resetLogStore, createLogger, isUnwritableStreamError, markStreamBroken, isBrokenPipeError } from './chunk-W4IPN3DD.js';
30
30
  import { __require } from './chunk-NSBPE2FW.js';
31
31
  import pc from 'picocolors';
@@ -4355,6 +4355,49 @@ async function detachStagedSkill(deps, name) {
4355
4355
  };
4356
4356
  }
4357
4357
  }
4358
+ async function pathState(path5) {
4359
+ try {
4360
+ await withFsDeadline(`lstat ${path5}`, () => lstat(path5));
4361
+ return "present";
4362
+ } catch (err) {
4363
+ return err?.code === "ENOENT" ? "absent" : "unknown";
4364
+ }
4365
+ }
4366
+ async function removeUnlistedStagedSkills(deps, skillsDir) {
4367
+ const allowed = await readSkillAllowList(deps.projectDir);
4368
+ if (!allowed) return [];
4369
+ const root = join(deps.projectDir, skillsDir);
4370
+ const entries = await tryWithFsDeadline(
4371
+ `readdir ${root}`,
4372
+ () => readdir(root, { withFileTypes: true }),
4373
+ []
4374
+ );
4375
+ const removed = [];
4376
+ for (const entry of entries) {
4377
+ if (!entry.isDirectory() || allowed.has(entry.name)) continue;
4378
+ try {
4379
+ const dir = join(root, entry.name);
4380
+ if (await pathState(join(deps.projectDir, ".skaile/assets/skill", entry.name)) !== "absent") {
4381
+ continue;
4382
+ }
4383
+ const knownStaged = await isStillOurs(deps.stagedSkillDirs.get(entry.name), dir);
4384
+ if (!knownStaged && !await isStagedSkillMarkerFor(dir, entry.name).catch(() => false))
4385
+ continue;
4386
+ const result = await unstageSkill(deps.projectDir, skillsDir, entry.name, {
4387
+ knownStaged,
4388
+ keepAsset: true
4389
+ });
4390
+ if ("reason" in result || !result.removedStaged) continue;
4391
+ deps.stagedSkillDirs.delete(result.name);
4392
+ removed.push(result.name);
4393
+ } catch (err) {
4394
+ deps.log(
4395
+ `[serve] could not remove unlisted skill "${entry.name}" (left in place): ${err instanceof Error ? err.message : String(err)}`
4396
+ );
4397
+ }
4398
+ }
4399
+ return removed;
4400
+ }
4358
4401
 
4359
4402
  // runner/src/flow-turn-dispatch.ts
4360
4403
  var FLOW_TURN_COMPACTION_TIMEOUT = "Flow turn abandoned: a compaction held the driver";
@@ -5160,6 +5203,67 @@ async function dispatchRefreshToExposedGitMounts(manager, log) {
5160
5203
  );
5161
5204
  }
5162
5205
  var CLAUDE_CODE_CREDENTIALS_KEY = "CLAUDE_CODE_CREDENTIALS_JSON";
5206
+ var DEFAULT_CLAUDE_AI_OAUTH_SCOPES = ["user:inference", "user:profile"];
5207
+ function selectClaudeCodeCredentialsSecret(secrets, selection) {
5208
+ const legacy = secrets[CLAUDE_CODE_CREDENTIALS_KEY];
5209
+ if (legacy) return { key: CLAUDE_CODE_CREDENTIALS_KEY, value: legacy };
5210
+ if (!selection?.registry) return void 0;
5211
+ if (selection.driver && selection.driver !== "claude-sdk") return void 0;
5212
+ const entries = registryEntries(selection.registry).map(
5213
+ ([id, entry2]) => [id, { ...entry2, kind: entryKind(entry2) }]
5214
+ );
5215
+ const registry = Object.fromEntries(entries);
5216
+ const named = selection.modelRef?.trim();
5217
+ const selected = named ? parseModelRef(named, registry) : void 0;
5218
+ const providerId = named && entries.some(([id]) => id === named) ? named : selected?.providerId ?? entries.find(
5219
+ ([, entry2]) => (entry2.kind === "llm" || entry2.kind === "embed") && isEntryEnabled(entry2)
5220
+ )?.[0];
5221
+ const entry = entries.find(([id]) => id === providerId)?.[1];
5222
+ if (!entry || !isClaudeSubscriptionEndpoint(entry)) return void 0;
5223
+ if (entry.credential?.kind !== "oauth" || !entry.credential.ref) return void 0;
5224
+ const ref = parseCredentialRef(entry.credential.ref);
5225
+ if (ref?.form !== "platform") return void 0;
5226
+ const value = secrets[ref.configId];
5227
+ return value ? { key: ref.configId, value } : void 0;
5228
+ }
5229
+ function entryKind(entry) {
5230
+ return entry.kind ?? (entry.preset ? AI_PROVIDER_PRESETS[entry.preset]?.kind : void 0);
5231
+ }
5232
+ function isClaudeSubscriptionEndpoint(entry) {
5233
+ if (entryKind(entry) !== "llm") return false;
5234
+ const preset = entry.preset ? AI_PROVIDER_PRESETS[entry.preset] : void 0;
5235
+ const surface = entry.surface ?? preset?.surface;
5236
+ const transport = entry.transport ?? preset?.transport ?? "direct";
5237
+ return surface === "anthropic-messages" && transport === "direct";
5238
+ }
5239
+ function claudeAiOauthScopesState(json) {
5240
+ let parsed;
5241
+ try {
5242
+ parsed = JSON.parse(json);
5243
+ } catch {
5244
+ return "unparseable";
5245
+ }
5246
+ if (!parsed || typeof parsed !== "object") return "unparseable";
5247
+ const scopes = parsed.claudeAiOauth?.scopes;
5248
+ return Array.isArray(scopes) && scopes.length > 0 ? "ok" : "missing";
5249
+ }
5250
+ async function writeProvisionedClaudeCodeCredentials(home, source, warn) {
5251
+ const state = claudeAiOauthScopesState(source.value);
5252
+ if (state === "missing") {
5253
+ warn(
5254
+ "Claude Code credentials blob has no claudeAiOauth.scopes \u2014 Claude Code will report 'Not logged in'; re-capture or rotate the seat",
5255
+ { key: source.key }
5256
+ );
5257
+ } else if (state === "unparseable") {
5258
+ warn(
5259
+ "Claude Code credentials blob is not a JSON object \u2014 Claude Code cannot read it; the platform sent malformed material for this secret",
5260
+ { key: source.key }
5261
+ );
5262
+ }
5263
+ return writeClaudeCodeCredentialsFile(home, source.value);
5264
+ }
5265
+ var credentialsLog;
5266
+ var scopesRepairLogged = /* @__PURE__ */ new Set();
5163
5267
  async function writeClaudeCodeCredentialsFile(home, json) {
5164
5268
  const claudeDir = join(home, ".claude");
5165
5269
  await mkdir(claudeDir, { recursive: true, mode: 448 });
@@ -5204,6 +5308,17 @@ async function mergeAndRewriteCredentialsFile(home, accessToken, expiresAt) {
5204
5308
  const oauthBlock = merged.claudeAiOauth ?? {};
5205
5309
  oauthBlock.accessToken = accessToken;
5206
5310
  if (expiresAt) oauthBlock.expiresAt = expiresAt;
5311
+ if (!Array.isArray(oauthBlock.scopes) || oauthBlock.scopes.length === 0) {
5312
+ oauthBlock.scopes = [...DEFAULT_CLAUDE_AI_OAUTH_SCOPES];
5313
+ if (!scopesRepairLogged.has(credPath)) {
5314
+ scopesRepairLogged.add(credPath);
5315
+ credentialsLog ??= createLogger({ kind: "runner", subkind: "credentials" });
5316
+ credentialsLog.info("added default scopes to a claudeAiOauth block that had none", {
5317
+ path: credPath,
5318
+ scopes: DEFAULT_CLAUDE_AI_OAUTH_SCOPES
5319
+ });
5320
+ }
5321
+ }
5207
5322
  merged.claudeAiOauth = oauthBlock;
5208
5323
  merged.accessToken = accessToken;
5209
5324
  return writeClaudeCodeCredentialsFile(home, JSON.stringify(merged));
@@ -7057,9 +7172,13 @@ async function startAgentServer(opts) {
7057
7172
  const stageDeclaredSkills = createCoalescedTask(
7058
7173
  withSkillFsLock,
7059
7174
  async (skillsDir, declared) => {
7060
- const names = await stageMaterializedSkills(opts.projectDir, skillsDir, { declared });
7175
+ const removed = await removeUnlistedStagedSkills(
7176
+ { projectDir: opts.projectDir, stagedSkillDirs, log },
7177
+ skillsDir
7178
+ );
7179
+ const names = declared.length > 0 ? await stageMaterializedSkills(opts.projectDir, skillsDir, { declared }) : [];
7061
7180
  await recordStagedSkills(stagedSkillDirs, opts.projectDir, skillsDir, names);
7062
- return names;
7181
+ return { removed, staged: names };
7063
7182
  }
7064
7183
  );
7065
7184
  await restageMaterializedSkills(false);
@@ -7075,17 +7194,26 @@ async function startAgentServer(opts) {
7075
7194
  return [];
7076
7195
  }
7077
7196
  });
7078
- if (declared.length === 0) return;
7079
7197
  const previouslyStaged = new Set(stagedSkillDirs.keys());
7080
- const staged = await stageDeclaredSkills(skillsDir, declared);
7198
+ const { removed, staged } = await stageDeclaredSkills(skillsDir, declared);
7081
7199
  const newlyStaged = staged.filter((s) => !previouslyStaged.has(s));
7082
- if (newlyStaged.length === 0) return;
7083
- log(`[serve] staged ${newlyStaged.length} materialized skill(s): ${newlyStaged.join(", ")}`);
7084
- if (allowRestart && driverStarted) {
7085
- await restartDriverForSkillChanges(
7086
- newlyStaged.map((s) => ({ name: s, action: "add" }))
7200
+ if (removed.length > 0) {
7201
+ log(
7202
+ `[serve] removed ${removed.length} skill(s) the host no longer allows: ${removed.join(", ")}`
7203
+ );
7204
+ }
7205
+ if (newlyStaged.length > 0) {
7206
+ log(
7207
+ `[serve] staged ${newlyStaged.length} materialized skill(s): ${newlyStaged.join(", ")}`
7087
7208
  );
7088
7209
  }
7210
+ if (removed.length === 0 && newlyStaged.length === 0) return;
7211
+ if (allowRestart && driverStarted) {
7212
+ await restartDriverForSkillChanges([
7213
+ ...removed.map((s) => ({ name: s, action: "remove" })),
7214
+ ...newlyStaged.map((s) => ({ name: s, action: "add" }))
7215
+ ]);
7216
+ }
7089
7217
  } catch (err) {
7090
7218
  log(
7091
7219
  `[serve] restageMaterializedSkills failed (non-fatal): ${err instanceof Error ? err.message : String(err)}`
@@ -7709,17 +7837,21 @@ async function startAgentServer(opts) {
7709
7837
  capabilityRegistry.register(stub, "client");
7710
7838
  }
7711
7839
  }
7712
- async function provisionInitSecrets(secrets) {
7840
+ async function provisionInitSecrets(secrets, selection) {
7713
7841
  let initialAiCredentialExpiresAt = null;
7714
7842
  if (secrets) {
7715
- const ccdValue = secrets[CLAUDE_CODE_CREDENTIALS_KEY];
7716
- if (ccdValue) {
7843
+ const source = selectClaudeCodeCredentialsSecret(secrets, selection);
7844
+ if (source) {
7717
7845
  const home = process.env.HOME ?? homedir();
7718
7846
  if (home) {
7719
7847
  try {
7720
- await writeClaudeCodeCredentialsFile(home, ccdValue);
7848
+ await writeProvisionedClaudeCodeCredentials(
7849
+ home,
7850
+ source,
7851
+ (message, meta) => serverLog.warn(message, meta)
7852
+ );
7721
7853
  log(
7722
- `[serve] wrote Claude Code credentials file to ${home}/.claude/.credentials.json (mode 0600)`
7854
+ `[serve] wrote Claude Code credentials file to ${home}/.claude/.credentials.json (mode 0600) from ${source.key === CLAUDE_CODE_CREDENTIALS_KEY ? source.key : `registry credential platform:${source.key}`}`
7723
7855
  );
7724
7856
  await guardClaudeAiConnectors(home, serverLog);
7725
7857
  } catch (err) {
@@ -7727,7 +7859,7 @@ async function startAgentServer(opts) {
7727
7859
  log(`[serve] failed to write Claude Code credentials file: ${errMsg}`);
7728
7860
  }
7729
7861
  }
7730
- initialAiCredentialExpiresAt = extractClaudeAiOauthExpiresAt(ccdValue);
7862
+ initialAiCredentialExpiresAt = extractClaudeAiOauthExpiresAt(source.value);
7731
7863
  }
7732
7864
  const otherSecrets = Object.fromEntries(
7733
7865
  Object.entries(secrets).filter(([k]) => k !== CLAUDE_CODE_CREDENTIALS_KEY)
@@ -8178,8 +8310,6 @@ async function startAgentServer(opts) {
8178
8310
  ...managedHost ? { runtimeFeatures: supportedRuntimeFeatures } : {}
8179
8311
  });
8180
8312
  preMintedSecrets = new PreMintedSecretProvider(cmd.credentials);
8181
- const initialAiCredentialExpiresAt = await provisionInitSecrets(cmd.secrets);
8182
- if (managedCodex) secretsProvisioned = true;
8183
8313
  if (cmd.resolvedConfig.aiProviderConfigId) {
8184
8314
  aiProviderConfigId = cmd.resolvedConfig.aiProviderConfigId;
8185
8315
  log(`[serve] stashed aiProviderConfigId=${aiProviderConfigId}`);
@@ -8187,6 +8317,30 @@ async function startAgentServer(opts) {
8187
8317
  }
8188
8318
  const wireCandidate = cmd.resolvedConfig.agentConfig ?? wireAgentConfig;
8189
8319
  wireAgentConfig = managedCodex ? cmd.resolvedConfig.agentConfig : diskProfileHasAgentSettings(profile) ? wireCandidate?.registry ? { registry: wireCandidate.registry } : void 0 : wireCandidate;
8320
+ let credentialsSelection;
8321
+ if (!managedCodex && wireAgentConfig?.registry && cmd.secrets && !cmd.secrets[CLAUDE_CODE_CREDENTIALS_KEY]) {
8322
+ const driver2 = opts.driver ?? wireAgentConfig?.driver;
8323
+ const model = opts.model ?? wireAgentConfig?.model;
8324
+ let settings;
8325
+ try {
8326
+ settings = await resolveSettings(opts.projectDir, { driver: driver2, model });
8327
+ } catch (err) {
8328
+ serverLog.warn(
8329
+ `[serve] credentials selection: settings unreadable: ${err instanceof Error ? err.message : String(err)}`
8330
+ );
8331
+ settings = { driver: driver2 ?? profile?.driver, model: model ?? profile?.model };
8332
+ }
8333
+ credentialsSelection = {
8334
+ driver: settings.driver ?? "omp",
8335
+ registry: wireAgentConfig?.registry,
8336
+ modelRef: wireAgentConfig?.modelRef?.trim() || settings.model?.trim() || void 0
8337
+ };
8338
+ }
8339
+ const initialAiCredentialExpiresAt = await provisionInitSecrets(
8340
+ cmd.secrets,
8341
+ credentialsSelection
8342
+ );
8343
+ if (managedCodex) secretsProvisioned = true;
8190
8344
  if (!managedCodex && aiProviderConfigId && initialAiCredentialExpiresAt) {
8191
8345
  aiCredentialRefreshScheduler.schedule(initialAiCredentialExpiresAt);
8192
8346
  }
@@ -8964,5 +9118,5 @@ function touchSession(state) {
8964
9118
  }
8965
9119
 
8966
9120
  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 };
8967
- //# sourceMappingURL=chunk-TCANYRAF.js.map
8968
- //# sourceMappingURL=chunk-TCANYRAF.js.map
9121
+ //# sourceMappingURL=chunk-2DGIAWKU.js.map
9122
+ //# sourceMappingURL=chunk-2DGIAWKU.js.map