@skaile/workspaces 1.11.0 → 1.12.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.
@@ -9,7 +9,7 @@ import { deployCatalogEntry, undeployCatalogEntry } from './chunk-LV2HPH3C.js';
9
9
  import { registerBuiltinConnectors, buildConnectorPromptSection, findMissingPackages, installNpmPackages, ConnectorManager, ConnectorStartupError, buildSdkConnectorTools, buildSdkFlowTools } from './chunk-UFGWIXRA.js';
10
10
  import { loadConnectorDeclarations, SecretProviderChain, PreMintedSecretProvider, InMemorySecretProvider, resolvedConfigToDeclarations, deriveSingleMaterializedConnectorDeclaration } from './chunk-Y6FV73IH.js';
11
11
  import { renderStimulusPrompt, buildOrchestratorPrompt } from './chunk-3EBFDMZC.js';
12
- import { PROTOCOL_VERSION } from './chunk-XJOPAGZX.js';
12
+ import { PROTOCOL_VERSION } from './chunk-TSB46BHR.js';
13
13
  import { resolveSettings, resolveApiKey, providerEnvKey } from './chunk-5NZ56R63.js';
14
14
  import { resolveRuntimeAssets } from './chunk-7J7LQP6T.js';
15
15
  import { resolveSkWorkspaceConfig, resolveAgentDir, cloudConfigFromProfile, stageMaterializedSkills, loadMcpServerDeclarations, COMPACTION_DEFAULTS, validateAssetRecipeAttr, deriveSingleMaterializedMcpDeclaration } from './chunk-ISA7R7PK.js';
@@ -4545,13 +4545,23 @@ async function startAgentServer(opts) {
4545
4545
  );
4546
4546
  }
4547
4547
  const effectiveCloudConfig = cloudConfigFromProfile(profile);
4548
+ const diskProfileHasAgentSettings = (p) => !!p && !!(p.driver || p.provider || p.model || p.cloud || p.cloud_config || p.thinking || p.effort);
4549
+ function resolveEffectiveCloudForSession() {
4550
+ if (effectiveCloud !== "default" || !wireAgentConfig) {
4551
+ return { cloud: effectiveCloud, cloudConfig: effectiveCloudConfig };
4552
+ }
4553
+ const raw = wireAgentConfig.cloud ?? "default";
4554
+ const cloud = SUPPORTED_CLOUDS.includes(raw) ? raw : "default";
4555
+ return { cloud, cloudConfig: wireAgentConfig.cloudConfig };
4556
+ }
4548
4557
  function buildSessionConfig(secretProvider2, apiKey, cloudSecrets, fallbackConnectorDeclarations) {
4558
+ const { cloud: sessionCloud, cloudConfig: sessionCloudConfig } = resolveEffectiveCloudForSession();
4549
4559
  return {
4550
4560
  projectDir: opts.projectDir,
4551
4561
  agentDir,
4552
- driver: opts.driver,
4553
- model: opts.model,
4554
- provider: opts.provider,
4562
+ driver: opts.driver ?? wireAgentConfig?.driver,
4563
+ model: opts.model ?? wireAgentConfig?.model,
4564
+ provider: opts.provider ?? wireAgentConfig?.provider,
4555
4565
  promptsDir: opts.promptsDir,
4556
4566
  sessionId,
4557
4567
  resumeSessionId,
@@ -4565,9 +4575,11 @@ async function startAgentServer(opts) {
4565
4575
  // plus the platform-resolved credential bundle (Vertex SA JSON already
4566
4576
  // materialized to a file path by resolveCloudSecretBundle). Omitted
4567
4577
  // entirely for `default` so the session config stays byte-identical.
4568
- ...effectiveCloud !== "default" ? { cloud: effectiveCloud } : {},
4569
- ...effectiveCloudConfig ? { cloudConfig: effectiveCloudConfig } : {},
4578
+ ...sessionCloud !== "default" ? { cloud: sessionCloud } : {},
4579
+ ...sessionCloudConfig ? { cloudConfig: sessionCloudConfig } : {},
4570
4580
  ...cloudSecrets ? { cloudSecrets } : {},
4581
+ ...wireAgentConfig?.thinking ? { thinking: wireAgentConfig.thinking } : {},
4582
+ ...wireAgentConfig?.effort ? { effort: wireAgentConfig.effort } : {},
4571
4583
  // Protocol v2 `<CAPABILITIES>` block — joins each registered capability's
4572
4584
  // `promptFragment` (framework first, then client, then agent-side
4573
4585
  // surfaces). Built lazily inside `buildSessionConfig` so newly registered
@@ -4645,12 +4657,14 @@ async function startAgentServer(opts) {
4645
4657
  let secretProvider;
4646
4658
  let runtimeIdentity;
4647
4659
  let preMintedSecrets;
4660
+ let wireAgentConfig;
4661
+ let appliedWireAgentConfigKey;
4648
4662
  const stagedSkillDirs = /* @__PURE__ */ new Set();
4649
4663
  await restageMaterializedSkills(false);
4650
4664
  async function restageMaterializedSkills(allowRestart) {
4651
4665
  try {
4652
4666
  const { skillsDir } = resolveDriverPaths({
4653
- driver: opts.driver ?? wsConfig.agent_config?.default?.driver ?? "claude-sdk"
4667
+ driver: opts.driver ?? wsConfig.agent_config?.default?.driver ?? wireAgentConfig?.driver ?? "claude-sdk"
4654
4668
  });
4655
4669
  const declared = (wsConfig.dependencies ?? []).flatMap((dep) => {
4656
4670
  try {
@@ -5152,13 +5166,14 @@ async function startAgentServer(opts) {
5152
5166
  async function buildSessionFromInit(secrets, fallbackConnectorDeclarations) {
5153
5167
  let apiKeyFromSecrets;
5154
5168
  let cloudSecrets;
5155
- if (effectiveCloud === "default") {
5156
- const effectiveProvider = opts.provider ?? "anthropic";
5169
+ const { cloud: initCloud } = resolveEffectiveCloudForSession();
5170
+ if (initCloud === "default") {
5171
+ const effectiveProvider = opts.provider ?? wireAgentConfig?.provider ?? "anthropic";
5157
5172
  const envKey = providerEnvKey(effectiveProvider);
5158
5173
  apiKeyFromSecrets = secrets?.[envKey];
5159
5174
  } else {
5160
5175
  ({ cloudSecrets } = resolveCloudSecretBundle({
5161
- cloud: effectiveCloud,
5176
+ cloud: initCloud,
5162
5177
  secrets,
5163
5178
  projectDir: opts.projectDir
5164
5179
  }));
@@ -5170,6 +5185,7 @@ async function startAgentServer(opts) {
5170
5185
  fallbackConnectorDeclarations
5171
5186
  );
5172
5187
  let needsWireFallbackRecreate = false;
5188
+ const agentSessionExistedBeforeThisInit = !!agentSession;
5173
5189
  if (!agentSession) {
5174
5190
  agentSession = await createAgentSession(sessionConfig);
5175
5191
  emitSystemPromptComposed(agentSession, sendEvent);
@@ -5180,6 +5196,7 @@ async function startAgentServer(opts) {
5180
5196
  captureBakedMcpServers();
5181
5197
  emitResourcesAvailable();
5182
5198
  agentSession.startWatching();
5199
+ appliedWireAgentConfigKey = wireAgentConfig ? JSON.stringify(wireAgentConfig) : void 0;
5183
5200
  log("[serve] session built from session_init envelope");
5184
5201
  } else if ((fallbackConnectorDeclarations?.length ?? 0) > 0 && !agentSession.resourceManager) {
5185
5202
  log(
@@ -5187,6 +5204,15 @@ async function startAgentServer(opts) {
5187
5204
  );
5188
5205
  needsWireFallbackRecreate = true;
5189
5206
  }
5207
+ const wireKey = wireAgentConfig ? JSON.stringify(wireAgentConfig) : void 0;
5208
+ let needsWireAgentConfigRecreate = false;
5209
+ if (agentSessionExistedBeforeThisInit && wireKey && wireKey !== appliedWireAgentConfigKey) {
5210
+ log(
5211
+ `[serve] session_init: recreating eagerly-built session to apply wire agentConfig (driver=${wireAgentConfig.driver ?? "(default)"} model=${wireAgentConfig.model ?? "(default)"})`
5212
+ );
5213
+ needsWireAgentConfigRecreate = true;
5214
+ appliedWireAgentConfigKey = wireKey;
5215
+ }
5190
5216
  wireSessionCapabilities({
5191
5217
  capabilityRegistry,
5192
5218
  remoteCapabilityInvoker,
@@ -5200,7 +5226,7 @@ async function startAgentServer(opts) {
5200
5226
  attachSkillInstance,
5201
5227
  log
5202
5228
  });
5203
- return { needsWireFallbackRecreate };
5229
+ return { needsWireFallbackRecreate, needsWireAgentConfigRecreate };
5204
5230
  }
5205
5231
  async function recreateAgentSession(overrides) {
5206
5232
  const disposedManager = agentSession.resourceManager;
@@ -5379,7 +5405,7 @@ async function startAgentServer(opts) {
5379
5405
  async function attachSkillInstance(name) {
5380
5406
  try {
5381
5407
  const { skillsDir } = resolveDriverPaths({
5382
- driver: opts.driver ?? wsConfig.agent_config?.default?.driver ?? "claude-sdk"
5408
+ driver: opts.driver ?? wsConfig.agent_config?.default?.driver ?? wireAgentConfig?.driver ?? "claude-sdk"
5383
5409
  });
5384
5410
  const staged = stageMaterializedSkills(opts.projectDir, skillsDir, {
5385
5411
  declared: [name]
@@ -5455,6 +5481,7 @@ async function startAgentServer(opts) {
5455
5481
  aiProviderConfigId = cmd.resolvedConfig.aiProviderConfigId;
5456
5482
  log(`[serve] stashed aiProviderConfigId=${aiProviderConfigId}`);
5457
5483
  }
5484
+ wireAgentConfig = diskProfileHasAgentSettings(profile) ? void 0 : cmd.resolvedConfig.agentConfig ?? wireAgentConfig;
5458
5485
  if (aiProviderConfigId && initialAiCredentialExpiresAt) {
5459
5486
  aiCredentialRefreshScheduler.schedule(initialAiCredentialExpiresAt);
5460
5487
  }
@@ -5463,10 +5490,7 @@ async function startAgentServer(opts) {
5463
5490
  capabilitySignature: computeCapabilitySignature(capabilityRegistry.list())
5464
5491
  });
5465
5492
  const buildSession = async () => {
5466
- const { needsWireFallbackRecreate } = await buildSessionFromInit(
5467
- cmd.secrets,
5468
- resolvedConfigToDeclarations(cmd.resolvedConfig)
5469
- );
5493
+ const { needsWireFallbackRecreate, needsWireAgentConfigRecreate } = await buildSessionFromInit(cmd.secrets, resolvedConfigToDeclarations(cmd.resolvedConfig));
5470
5494
  const cfg = {
5471
5495
  aiResources: cmd.resolvedConfig.aiResources,
5472
5496
  subagents: cmd.resolvedConfig.subagents,
@@ -5505,7 +5529,8 @@ async function startAgentServer(opts) {
5505
5529
  pendingResumeSessionId = cfgResumeSessionId;
5506
5530
  }
5507
5531
  }
5508
- if (pendingResumeSessionId || cfg.subagents || needsWireFallbackRecreate) {
5532
+ if (pendingResumeSessionId || cfg.subagents || needsWireFallbackRecreate || needsWireAgentConfigRecreate) {
5533
+ log("[serve] session_init: consolidated session recreate");
5509
5534
  await recreateSessionForInit(pendingResumeSessionId);
5510
5535
  }
5511
5536
  if (cfg.sharedState) {
@@ -6178,5 +6203,5 @@ function touchSession(state) {
6178
6203
  }
6179
6204
 
6180
6205
  export { CLAUDE_CODE_CREDENTIALS_KEY, COMPILE_MANIFEST_FILENAME, CapabilityRegistry, DEFAULT_CAPABILITY_CALL_TIMEOUT_MS, DEFAULT_COALESCE_MS, MarkdownStreamer, PreInitRingSink, agentDefinitionExists, bootstrapCapabilityRegistry, bootstrapRunnerLogStore, buildAgentResources, buildClientCapabilityHandler, buildConnectorTokenMediator, buildContextSection, buildEnvironmentSection, buildResourcesAvailablePayload, buildStoreSnapshotReplay, builtinCapabilities, capabilityLogInstance, clearPreInitRingSink, clearSession, compileComposition, computeCapabilitySignature, connectorRefreshKind, createAgentSession, createSessionStimulusBus, defineCapability, deleteSession, dispatchRunnerCapabilityInvocation, emitSystemPromptComposed, ensureGitConfigInclude, extractClaudeAiOauthExpiresAt, getPreInitRingSink, handleMountResourceRequest, handleResourceRequest, hostOpResumeStimulus, installPreInitRingSink, listSessions, loadAgentManifest, loadCompileManifest, loadCompileManifestFromDir, loadSession, loadSessionById, mcpAuthSecretKey, newSession, pickRepointedManager, planFlowMutate, registerCompositionCapabilities, rejectCapabilityOnApprovalDeny, resetRunnerLogStore, resolveAgentComposition, resolveAgentMixins, resolveBinding, resolveCapabilityCallTimeoutMs, resolveCapabilityResult, resolveComposition, resolveMixin, runAgentChat, saveSession, setCurrentSession, startAgentServer, stimulusFromMetas, touchSession, writeClaudeCodeCredentialsFile };
6181
- //# sourceMappingURL=chunk-MTNGINBO.js.map
6182
- //# sourceMappingURL=chunk-MTNGINBO.js.map
6206
+ //# sourceMappingURL=chunk-SORYPIC3.js.map
6207
+ //# sourceMappingURL=chunk-SORYPIC3.js.map