@theokit/sdk 5.8.0 → 5.9.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 (46) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/{agent-7ERQNV66.js → agent-6STOEBGQ.js} +4 -4
  3. package/dist/{agent-7ERQNV66.js.map → agent-6STOEBGQ.js.map} +1 -1
  4. package/dist/{agent-3RcPVGMo.d.cts → agent-Dh2YHSLj.d.cts} +12 -0
  5. package/dist/{agent-LNTR4QH5.cjs → agent-ZM4FDDL7.cjs} +5 -5
  6. package/dist/{agent-LNTR4QH5.cjs.map → agent-ZM4FDDL7.cjs.map} +1 -1
  7. package/dist/{agent-lS68mYIL.d.ts → agent-enXXu447.d.ts} +12 -0
  8. package/dist/{chunk-AOHRKGAA.cjs → chunk-5WR33BHA.cjs} +4 -4
  9. package/dist/{chunk-AOHRKGAA.cjs.map → chunk-5WR33BHA.cjs.map} +1 -1
  10. package/dist/{chunk-2STSX2SY.cjs → chunk-BM6PDJW3.cjs} +9 -9
  11. package/dist/{chunk-2STSX2SY.cjs.map → chunk-BM6PDJW3.cjs.map} +1 -1
  12. package/dist/{chunk-XW4POZ6V.cjs → chunk-C7GKRGKN.cjs} +34 -13
  13. package/dist/chunk-C7GKRGKN.cjs.map +1 -0
  14. package/dist/{chunk-3CU5J7V3.js → chunk-PYFBS6OQ.js} +4 -4
  15. package/dist/{chunk-3CU5J7V3.js.map → chunk-PYFBS6OQ.js.map} +1 -1
  16. package/dist/{chunk-FRL35MFN.js → chunk-UKBBYVNS.js} +3 -3
  17. package/dist/{chunk-FRL35MFN.js.map → chunk-UKBBYVNS.js.map} +1 -1
  18. package/dist/{chunk-W4VQMXBZ.js → chunk-ZDYDBXSD.js} +34 -13
  19. package/dist/chunk-ZDYDBXSD.js.map +1 -0
  20. package/dist/{cron-DJv8zMa3.d.ts → cron-DTuaPMVI.d.ts} +1 -1
  21. package/dist/{cron-CGxoEKlx.d.cts → cron-QTgcwcZt.d.cts} +1 -1
  22. package/dist/cron.cjs +4 -4
  23. package/dist/cron.d.cts +2 -2
  24. package/dist/cron.d.ts +2 -2
  25. package/dist/cron.js +3 -3
  26. package/dist/eval.cjs +3 -3
  27. package/dist/eval.js +2 -2
  28. package/dist/index.cjs +21 -21
  29. package/dist/index.d.cts +3 -3
  30. package/dist/index.d.ts +3 -3
  31. package/dist/index.js +5 -5
  32. package/dist/subagents-loader-5TZCAIYQ.cjs +16 -0
  33. package/dist/{subagents-loader-7GE7YUDI.cjs.map → subagents-loader-5TZCAIYQ.cjs.map} +1 -1
  34. package/dist/subagents-loader-PEV3PD4Q.js +7 -0
  35. package/dist/{subagents-loader-S2PMZY7J.js.map → subagents-loader-PEV3PD4Q.js.map} +1 -1
  36. package/dist/subagents-loader.cjs +2 -2
  37. package/dist/subagents-loader.d.cts +1 -1
  38. package/dist/subagents-loader.d.ts +1 -1
  39. package/dist/subagents-loader.js +1 -1
  40. package/dist/types/agent.d.ts +12 -0
  41. package/docs/error-codes.md +7 -6
  42. package/package.json +1 -1
  43. package/dist/chunk-W4VQMXBZ.js.map +0 -1
  44. package/dist/chunk-XW4POZ6V.cjs.map +0 -1
  45. package/dist/subagents-loader-7GE7YUDI.cjs +0 -16
  46. package/dist/subagents-loader-S2PMZY7J.js +0 -7
package/dist/index.cjs CHANGED
@@ -9,8 +9,8 @@ require('./chunk-D5KXKBEN.cjs');
9
9
  var chunkMPQJE3G4_cjs = require('./chunk-MPQJE3G4.cjs');
10
10
  require('./chunk-6PB5AQCY.cjs');
11
11
  require('./chunk-VTYY7XL5.cjs');
12
- var chunkAOHRKGAA_cjs = require('./chunk-AOHRKGAA.cjs');
13
- var chunk2STSX2SY_cjs = require('./chunk-2STSX2SY.cjs');
12
+ var chunk5WR33BHA_cjs = require('./chunk-5WR33BHA.cjs');
13
+ var chunkBM6PDJW3_cjs = require('./chunk-BM6PDJW3.cjs');
14
14
  var chunkJ6GXS5A2_cjs = require('./chunk-J6GXS5A2.cjs');
15
15
  require('./chunk-PSLCVSCS.cjs');
16
16
  require('./chunk-BUUUWQMB.cjs');
@@ -54,7 +54,7 @@ require('./chunk-OF2CLCTH.cjs');
54
54
  var chunkZF2LDKQQ_cjs = require('./chunk-ZF2LDKQQ.cjs');
55
55
  var chunkGHHIJEFX_cjs = require('./chunk-GHHIJEFX.cjs');
56
56
  var chunkJLRLCBJ4_cjs = require('./chunk-JLRLCBJ4.cjs');
57
- require('./chunk-XW4POZ6V.cjs');
57
+ require('./chunk-C7GKRGKN.cjs');
58
58
  var chunkTY56BKSK_cjs = require('./chunk-TY56BKSK.cjs');
59
59
  require('./chunk-MPR2ISL2.cjs');
60
60
  var chunkJ5623RIV_cjs = require('./chunk-J5623RIV.cjs');
@@ -76,8 +76,8 @@ var os = require('os');
76
76
  // src/agent-factory.ts
77
77
  function createAgentFactory(common) {
78
78
  return {
79
- forSession: (agentId, overrides) => chunk2STSX2SY_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
80
- getOrCreate: (agentId, overrides) => chunk2STSX2SY_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
79
+ forSession: (agentId, overrides) => chunkBM6PDJW3_cjs.Agent.create(mergeAgentOptions(common, overrides, agentId)),
80
+ getOrCreate: (agentId, overrides) => chunkBM6PDJW3_cjs.Agent.getOrCreate(agentId, mergeAgentOptions(common, overrides, agentId))
81
81
  };
82
82
  }
83
83
  function mergeAgentOptions(common, overrides, agentId) {
@@ -1373,7 +1373,7 @@ var Memory = {
1373
1373
  return await peer.IndexManager.open(openArgs);
1374
1374
  }
1375
1375
  const { IndexManager } = await import('./index-manager-ZGJN25FD.cjs');
1376
- openArgs.embedding = await resolveEmbedding(opts.embedding, chunk2STSX2SY_cjs.MEMORY_EMBEDDING_ADAPTERS);
1376
+ openArgs.embedding = await resolveEmbedding(opts.embedding, chunkBM6PDJW3_cjs.MEMORY_EMBEDDING_ADAPTERS);
1377
1377
  return await IndexManager.open(openArgs);
1378
1378
  },
1379
1379
  /**
@@ -1384,7 +1384,7 @@ var Memory = {
1384
1384
  */
1385
1385
  async runDreamingSweep(opts) {
1386
1386
  const peer = await tryLoadSdkMemoryPeer();
1387
- const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunk2STSX2SY_cjs.MEMORY_EMBEDDING_ADAPTERS;
1387
+ const catalog = peer !== null ? peer.MEMORY_EMBEDDING_ADAPTERS : chunkBM6PDJW3_cjs.MEMORY_EMBEDDING_ADAPTERS;
1388
1388
  const sweepArgs = await buildDreamingSweepArgs(opts, catalog);
1389
1389
  const result = peer !== null ? (
1390
1390
  // biome-ignore lint/suspicious/noExplicitAny: peer is dynamically loaded — structural compat ensured by sdk-memory
@@ -1994,7 +1994,7 @@ function guardSessionDestruction(sessionId, live) {
1994
1994
  // src/session-messages.ts
1995
1995
  async function readSessionMessages2(options) {
1996
1996
  const cwd = options.cwd ?? process.cwd();
1997
- const baseDir = chunk2STSX2SY_cjs.resolveSessionDir({ sessionDir: options.sessionDir });
1997
+ const baseDir = chunkBM6PDJW3_cjs.resolveSessionDir({ sessionDir: options.sessionDir });
1998
1998
  return chunkYIFFF23U_cjs.readSessionMessages(new chunkB3XXQX6L_cjs.FsSessionStore({ baseDir, cwd }), options.sessionId);
1999
1999
  }
2000
2000
 
@@ -2011,7 +2011,7 @@ function isBuiltAgent(m) {
2011
2011
  return typeof m.send === "function";
2012
2012
  }
2013
2013
  async function materialize(def, index) {
2014
- const { Agent: Agent2 } = await import('./agent-LNTR4QH5.cjs');
2014
+ const { Agent: Agent2 } = await import('./agent-ZM4FDDL7.cjs');
2015
2015
  return Agent2.create({
2016
2016
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
2017
2017
  // here means "declare nothing and let the default apply" — forwarding the literal would create
@@ -2153,7 +2153,7 @@ var FIXTURE_USER = {
2153
2153
  };
2154
2154
  var FIXTURE_MODELS = [
2155
2155
  {
2156
- id: chunk2STSX2SY_cjs.DEFAULT_AGENTIC_MODEL_ID,
2156
+ id: chunkBM6PDJW3_cjs.DEFAULT_AGENTIC_MODEL_ID,
2157
2157
  name: "Gemini 2.0 Flash",
2158
2158
  displayName: "Gemini 2.0 Flash",
2159
2159
  parameters: [
@@ -2356,7 +2356,7 @@ var Theokit = class {
2356
2356
  envVars: p.envVars
2357
2357
  }));
2358
2358
  },
2359
- embeddingAdapters: () => Object.entries(chunk2STSX2SY_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
2359
+ embeddingAdapters: () => Object.entries(chunkBM6PDJW3_cjs.MEMORY_EMBEDDING_ADAPTERS).map(([id, adapter]) => ({
2360
2360
  id,
2361
2361
  transport: adapter.transport,
2362
2362
  defaultModel: adapter.defaultModel
@@ -2575,43 +2575,43 @@ Object.defineProperty(exports, "fn", {
2575
2575
  });
2576
2576
  Object.defineProperty(exports, "Cron", {
2577
2577
  enumerable: true,
2578
- get: function () { return chunkAOHRKGAA_cjs.Cron; }
2578
+ get: function () { return chunk5WR33BHA_cjs.Cron; }
2579
2579
  });
2580
2580
  Object.defineProperty(exports, "Agent", {
2581
2581
  enumerable: true,
2582
- get: function () { return chunk2STSX2SY_cjs.Agent; }
2582
+ get: function () { return chunkBM6PDJW3_cjs.Agent; }
2583
2583
  });
2584
2584
  Object.defineProperty(exports, "AgentBuilder", {
2585
2585
  enumerable: true,
2586
- get: function () { return chunk2STSX2SY_cjs.AgentBuilder; }
2586
+ get: function () { return chunkBM6PDJW3_cjs.AgentBuilder; }
2587
2587
  });
2588
2588
  Object.defineProperty(exports, "Tool", {
2589
2589
  enumerable: true,
2590
- get: function () { return chunk2STSX2SY_cjs.Tool; }
2590
+ get: function () { return chunkBM6PDJW3_cjs.Tool; }
2591
2591
  });
2592
2592
  Object.defineProperty(exports, "ToolError", {
2593
2593
  enumerable: true,
2594
- get: function () { return chunk2STSX2SY_cjs.ToolError; }
2594
+ get: function () { return chunkBM6PDJW3_cjs.ToolError; }
2595
2595
  });
2596
2596
  Object.defineProperty(exports, "UsageAccumulator", {
2597
2597
  enumerable: true,
2598
- get: function () { return chunk2STSX2SY_cjs.UsageAccumulator; }
2598
+ get: function () { return chunkBM6PDJW3_cjs.UsageAccumulator; }
2599
2599
  });
2600
2600
  Object.defineProperty(exports, "computeCost", {
2601
2601
  enumerable: true,
2602
- get: function () { return chunk2STSX2SY_cjs.computeCost; }
2602
+ get: function () { return chunkBM6PDJW3_cjs.computeCost; }
2603
2603
  });
2604
2604
  Object.defineProperty(exports, "getPricingEntry", {
2605
2605
  enumerable: true,
2606
- get: function () { return chunk2STSX2SY_cjs.getPricingEntry; }
2606
+ get: function () { return chunkBM6PDJW3_cjs.getPricingEntry; }
2607
2607
  });
2608
2608
  Object.defineProperty(exports, "managedSettingsPathFor", {
2609
2609
  enumerable: true,
2610
- get: function () { return chunk2STSX2SY_cjs.managedSettingsPathFor; }
2610
+ get: function () { return chunkBM6PDJW3_cjs.managedSettingsPathFor; }
2611
2611
  });
2612
2612
  Object.defineProperty(exports, "readManagedSettings", {
2613
2613
  enumerable: true,
2614
- get: function () { return chunk2STSX2SY_cjs.readManagedSettings; }
2614
+ get: function () { return chunkBM6PDJW3_cjs.readManagedSettings; }
2615
2615
  });
2616
2616
  Object.defineProperty(exports, "emitRunEvent", {
2617
2617
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -2,15 +2,15 @@ import { T as TheokitAgentError, E as ErrorMetadata } from './errors-base-B5g01n
2
2
  export { a as ErrorCode } from './errors-base-B5g01neU.cjs';
3
3
  import { H as RunEvent, j as CostBreakdown, au as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as RunEventSink$1, S as SDKMessage } from './run-DsA5Ip2i.cjs';
4
4
  export { A as AgentConversationTurn, e as AssistantMessage, f as CompletionCheck, g as CompletionCheckResult, h as ConversationStep, i as ConversationTurn, j as CostBreakdown, k as CostSource, l as CostStatus, D as DoomLoopThresholds, E as EnvPolicy, G as GenerateOptions, m as GenerateRunResult, I as ImageBlock, n as InputProcessorContext, o as InteractionUpdate, p as McpAuthConfig, q as McpHttpServerConfig, r as McpOAuthConfig, s as McpStdioServerConfig, t as MessageOrigin, u as ModelParameterValue, O as OutputProcessorContext, v as PartialToolCallUpdate, w as ProcessorControls, x as ProcessorTripwire, y as ProcessorViolation, z as RunCompactBoundaryEvent, B as RunCompletionCheckEvent, F as RunErrorDetail, H as RunEvent, J as RunGitInfo, K as RunMemoryDegradedEvent, L as RunOperation, N as RunPermissionDeniedEvent, Q as RunRateLimitEvent, U as RunStatus, V as RunTaskCompletedEvent, W as RunTaskStartedEvent, X as RunTaskUpdatedEvent, Y as RunTimelineEvent, Z as RunToCompletionOptions, _ as RunToCompletionResult, $ as RunToolProgressEvent, a0 as RunTripwireEvent, a1 as SDKAssistantMessage, a2 as SDKImage, a3 as SDKImageDimension, a4 as SDKObjectDelta, a5 as SDKRequestMessage, a6 as SDKStatusMessage, a7 as SDKSystemMessage, a8 as SDKTaskMessage, a9 as SDKThinkingMessage, aa as SDKToolUseMessage, ab as SDKUserMessage, ac as SDKUserMessageEvent, ad as SendOptions, ae as ShellCommand, af as ShellConversationTurn, ag as ShellOutput, ah as ShellOutputDeltaUpdate, ai as StepCompletedUpdate, aj as StepStartedUpdate, ak as StreamToCompletionResult, al as SummaryCompletedUpdate, am as SummaryStartedUpdate, an as SummaryUpdate, ao as TextBlock, ap as TextDeltaUpdate, aq as ThinkingCompletedUpdate, ar as ThinkingDeltaUpdate, as as ThinkingMessage, at as TokenDeltaUpdate, au as TokenUsage, av as ToolCall, aw as ToolCallCompletedUpdate, ax as ToolCallStartedUpdate, ay as ToolContextMessage, az as ToolResult, aA as ToolResultGuardOptions, aB as ToolUseBlock, aC as TurnEndedUpdate, aD as UserMessage, aE as UserMessageAppendedUpdate } from './run-DsA5Ip2i.cjs';
5
- import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, k as Skill, B as BudgetTracker, l as MemoryProvider, m as PreToolCallDecision } from './agent-3RcPVGMo.cjs';
6
- export { n as ActiveMemoryPassArgs, o as ActiveMemoryPassResult, p as AgentSubagentDescription, q as AgentToolDescription, r as BudgetCheck, s as BudgetTotal, t as BudgetUsageEvent, u as BuiltinToolName, v as CloudEnv, w as CloudRepo, x as CompatSource, y as CompatSourceAdapter, z as CompatSurface, D as CreateSkillSpec, H as HookApprovalGate, E as HookApprovalRequest, F as HookName, J as LlmCallContext, K as MemoryProviderAgentRef, N as MemoryProviderFactory, O as MemoryProviderHandle, Q as MemoryProviderInitOptions, R as PluginContext, T as PluginHookDisposer, U as PostAssistantReplyContext, V as PostToolCallContext, W as PreToolCallContext, X as PreUserSendContext, Y as PreUserSendResult, Z as ProviderTransform, _ as ProviderTransformContext, $ as RecordSessionSummaryArgs, a0 as SessionLifecycleContext, a1 as SessionRecord, a2 as SessionStore, a3 as SettingSource, a4 as Skill, a5 as SkillsResolver, a6 as SkillsResolverContext, a7 as SystemPromptContext, a8 as SystemPromptMemoryFact, a9 as TelemetrySettings, aa as ToolCallSummary, ab as ToolContext, ac as ToolResultTransformContext, ad as TransformContext } from './agent-3RcPVGMo.cjs';
5
+ import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, k as Skill, B as BudgetTracker, l as MemoryProvider, m as PreToolCallDecision } from './agent-Dh2YHSLj.cjs';
6
+ export { n as ActiveMemoryPassArgs, o as ActiveMemoryPassResult, p as AgentSubagentDescription, q as AgentToolDescription, r as BudgetCheck, s as BudgetTotal, t as BudgetUsageEvent, u as BuiltinToolName, v as CloudEnv, w as CloudRepo, x as CompatSource, y as CompatSourceAdapter, z as CompatSurface, D as CreateSkillSpec, H as HookApprovalGate, E as HookApprovalRequest, F as HookName, J as LlmCallContext, K as MemoryProviderAgentRef, N as MemoryProviderFactory, O as MemoryProviderHandle, Q as MemoryProviderInitOptions, R as PluginContext, T as PluginHookDisposer, U as PostAssistantReplyContext, V as PostToolCallContext, W as PreToolCallContext, X as PreUserSendContext, Y as PreUserSendResult, Z as ProviderTransform, _ as ProviderTransformContext, $ as RecordSessionSummaryArgs, a0 as SessionLifecycleContext, a1 as SessionRecord, a2 as SessionStore, a3 as SettingSource, a4 as Skill, a5 as SkillsResolver, a6 as SkillsResolverContext, a7 as SystemPromptContext, a8 as SystemPromptMemoryFact, a9 as TelemetrySettings, aa as ToolCallSummary, ab as ToolContext, ac as ToolResultTransformContext, ad as TransformContext } from './agent-Dh2YHSLj.cjs';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
9
  import { S as StructuredOutputError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-BWOJeWTZ.cjs';
10
10
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, I as IntegrationNotConnectedError, m as InvalidTaskIdError, M as MemoryAdapterError, n as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, T as TaskNotFoundError, U as UnknownAgentError, o as UnsupportedBudgetOperationError, p as UnsupportedRunOperationError, q as UnsupportedTaskOperationError, r as isTransientError } from './errors-BWOJeWTZ.cjs';
11
11
  import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-dNwjwCt5.cjs';
12
12
  export { A as AgentMemory, e as AgentOperation, f as ContextBudget, g as ContextManagerKind, h as ContextSnapshot, i as ContextSource, j as ContextSourceStatus, F as ForkOptions, k as ForkResult, I as InvalidateCacheOptions, l as MemoryAdapter, m as MemoryAdapterCapabilities, n as MemoryContext, o as MemoryFact, p as MemoryRevision, q as MemoryToolSchema, r as MemoryTurnMessage, s as PersonalityPreset, t as ProviderCapability, u as ProviderRoute, R as ResolvedProviderRoute, v as RunUntilIterator, w as SDKAgentPlugins, x as SDKAgentSkillDetail, y as SDKAgentSkills, z as SDKArtifact, B as SDKContextManager, D as SDKPluginMetadata, E as SDKProvidersManager, H as SystemPromptSkillRef, V as Verdict } from './sdk-agent-dNwjwCt5.cjs';
13
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-CGxoEKlx.cjs';
13
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-QTgcwcZt.cjs';
14
14
  import { StepResult } from './workflow.cjs';
15
15
  export { Workflow, agentStep, fn } from './workflow.cjs';
16
16
 
package/dist/index.d.ts CHANGED
@@ -2,15 +2,15 @@ import { T as TheokitAgentError, E as ErrorMetadata } from './errors-base-B5g01n
2
2
  export { a as ErrorCode } from './errors-base-B5g01neU.js';
3
3
  import { H as RunEvent, j as CostBreakdown, au as TokenUsage, R as RunResult, M as ModelSelection, C as CustomTool, a as McpServerConfig, T as ToolResultContentBlock, b as Run, P as Processor, c as PermissionMode, d as RunEventSink$1, S as SDKMessage } from './run-DsA5Ip2i.js';
4
4
  export { A as AgentConversationTurn, e as AssistantMessage, f as CompletionCheck, g as CompletionCheckResult, h as ConversationStep, i as ConversationTurn, j as CostBreakdown, k as CostSource, l as CostStatus, D as DoomLoopThresholds, E as EnvPolicy, G as GenerateOptions, m as GenerateRunResult, I as ImageBlock, n as InputProcessorContext, o as InteractionUpdate, p as McpAuthConfig, q as McpHttpServerConfig, r as McpOAuthConfig, s as McpStdioServerConfig, t as MessageOrigin, u as ModelParameterValue, O as OutputProcessorContext, v as PartialToolCallUpdate, w as ProcessorControls, x as ProcessorTripwire, y as ProcessorViolation, z as RunCompactBoundaryEvent, B as RunCompletionCheckEvent, F as RunErrorDetail, H as RunEvent, J as RunGitInfo, K as RunMemoryDegradedEvent, L as RunOperation, N as RunPermissionDeniedEvent, Q as RunRateLimitEvent, U as RunStatus, V as RunTaskCompletedEvent, W as RunTaskStartedEvent, X as RunTaskUpdatedEvent, Y as RunTimelineEvent, Z as RunToCompletionOptions, _ as RunToCompletionResult, $ as RunToolProgressEvent, a0 as RunTripwireEvent, a1 as SDKAssistantMessage, a2 as SDKImage, a3 as SDKImageDimension, a4 as SDKObjectDelta, a5 as SDKRequestMessage, a6 as SDKStatusMessage, a7 as SDKSystemMessage, a8 as SDKTaskMessage, a9 as SDKThinkingMessage, aa as SDKToolUseMessage, ab as SDKUserMessage, ac as SDKUserMessageEvent, ad as SendOptions, ae as ShellCommand, af as ShellConversationTurn, ag as ShellOutput, ah as ShellOutputDeltaUpdate, ai as StepCompletedUpdate, aj as StepStartedUpdate, ak as StreamToCompletionResult, al as SummaryCompletedUpdate, am as SummaryStartedUpdate, an as SummaryUpdate, ao as TextBlock, ap as TextDeltaUpdate, aq as ThinkingCompletedUpdate, ar as ThinkingDeltaUpdate, as as ThinkingMessage, at as TokenDeltaUpdate, au as TokenUsage, av as ToolCall, aw as ToolCallCompletedUpdate, ax as ToolCallStartedUpdate, ay as ToolContextMessage, az as ToolResult, aA as ToolResultGuardOptions, aB as ToolUseBlock, aC as TurnEndedUpdate, aD as UserMessage, aE as UserMessageAppendedUpdate } from './run-DsA5Ip2i.js';
5
- import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, k as Skill, B as BudgetTracker, l as MemoryProvider, m as PreToolCallDecision } from './agent-lS68mYIL.js';
6
- export { n as ActiveMemoryPassArgs, o as ActiveMemoryPassResult, p as AgentSubagentDescription, q as AgentToolDescription, r as BudgetCheck, s as BudgetTotal, t as BudgetUsageEvent, u as BuiltinToolName, v as CloudEnv, w as CloudRepo, x as CompatSource, y as CompatSourceAdapter, z as CompatSurface, D as CreateSkillSpec, H as HookApprovalGate, E as HookApprovalRequest, F as HookName, J as LlmCallContext, K as MemoryProviderAgentRef, N as MemoryProviderFactory, O as MemoryProviderHandle, Q as MemoryProviderInitOptions, R as PluginContext, T as PluginHookDisposer, U as PostAssistantReplyContext, V as PostToolCallContext, W as PreToolCallContext, X as PreUserSendContext, Y as PreUserSendResult, Z as ProviderTransform, _ as ProviderTransformContext, $ as RecordSessionSummaryArgs, a0 as SessionLifecycleContext, a1 as SessionRecord, a2 as SessionStore, a3 as SettingSource, a4 as Skill, a5 as SkillsResolver, a6 as SkillsResolverContext, a7 as SystemPromptContext, a8 as SystemPromptMemoryFact, a9 as TelemetrySettings, aa as ToolCallSummary, ab as ToolContext, ac as ToolResultTransformContext, ad as TransformContext } from './agent-lS68mYIL.js';
5
+ import { A as AgentOptions, L as LocalOptions, S as SystemPromptResolver, C as CloudOptions, M as MemorySettings, a as AgentDefinition, b as SkillsSettings, c as ListAgentsOptions, d as ListResult, e as SDKAgentInfo, G as GetAgentOptions, f as ListRunsOptions, g as GetRunOptions, h as AgentOperationOptions, i as AgentDescription, P as Plugin$1, j as ProviderProfile, I as InlineSkill, k as Skill, B as BudgetTracker, l as MemoryProvider, m as PreToolCallDecision } from './agent-enXXu447.js';
6
+ export { n as ActiveMemoryPassArgs, o as ActiveMemoryPassResult, p as AgentSubagentDescription, q as AgentToolDescription, r as BudgetCheck, s as BudgetTotal, t as BudgetUsageEvent, u as BuiltinToolName, v as CloudEnv, w as CloudRepo, x as CompatSource, y as CompatSourceAdapter, z as CompatSurface, D as CreateSkillSpec, H as HookApprovalGate, E as HookApprovalRequest, F as HookName, J as LlmCallContext, K as MemoryProviderAgentRef, N as MemoryProviderFactory, O as MemoryProviderHandle, Q as MemoryProviderInitOptions, R as PluginContext, T as PluginHookDisposer, U as PostAssistantReplyContext, V as PostToolCallContext, W as PreToolCallContext, X as PreUserSendContext, Y as PreUserSendResult, Z as ProviderTransform, _ as ProviderTransformContext, $ as RecordSessionSummaryArgs, a0 as SessionLifecycleContext, a1 as SessionRecord, a2 as SessionStore, a3 as SettingSource, a4 as Skill, a5 as SkillsResolver, a6 as SkillsResolverContext, a7 as SystemPromptContext, a8 as SystemPromptMemoryFact, a9 as TelemetrySettings, aa as ToolCallSummary, ab as ToolContext, ac as ToolResultTransformContext, ad as TransformContext } from './agent-enXXu447.js';
7
7
  import * as zod from 'zod';
8
8
  import { ZodType, z } from 'zod';
9
9
  import { S as StructuredOutputError, B as BudgetOptions, a as BudgetHandle, b as BudgetSnapshot } from './errors-DDvG18IB.js';
10
10
  export { A as AgentDisposedError, c as AgentRunError, d as AgentRunErrorCode, e as AuthenticationError, f as BudgetExceedEvent, g as BudgetExceededError, h as BudgetLimit, i as BudgetMode, j as BudgetScope, k as BudgetThresholdEvent, l as BudgetWindow, C as ConfigurationError, I as IntegrationNotConnectedError, m as InvalidTaskIdError, M as MemoryAdapterError, n as MemoryAdapterErrorCode, N as NetworkError, R as RateLimitError, T as TaskNotFoundError, U as UnknownAgentError, o as UnsupportedBudgetOperationError, p as UnsupportedRunOperationError, q as UnsupportedTaskOperationError, r as isTransientError } from './errors-DDvG18IB.js';
11
11
  import { P as ProviderRoutingSettings, S as SDKAgent, C as ContextSettings, a as PluginsSettings, J as JudgeResult, G as GoalOptions, b as GoalEvent, c as GoalResult, M as MemoryId, d as SDKProvider } from './sdk-agent-wEOLXD3F.js';
12
12
  export { A as AgentMemory, e as AgentOperation, f as ContextBudget, g as ContextManagerKind, h as ContextSnapshot, i as ContextSource, j as ContextSourceStatus, F as ForkOptions, k as ForkResult, I as InvalidateCacheOptions, l as MemoryAdapter, m as MemoryAdapterCapabilities, n as MemoryContext, o as MemoryFact, p as MemoryRevision, q as MemoryToolSchema, r as MemoryTurnMessage, s as PersonalityPreset, t as ProviderCapability, u as ProviderRoute, R as ResolvedProviderRoute, v as RunUntilIterator, w as SDKAgentPlugins, x as SDKAgentSkillDetail, y as SDKAgentSkills, z as SDKArtifact, B as SDKContextManager, D as SDKPluginMetadata, E as SDKProvidersManager, H as SystemPromptSkillRef, V as Verdict } from './sdk-agent-wEOLXD3F.js';
13
- export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-DJv8zMa3.js';
13
+ export { C as Cron, a as CronCreateOptions, b as CronGetOptions, c as CronJob, d as CronJobStatus, e as CronListOptions, f as CronOperationOptions, g as CronRunOptions, h as CronRuntime, i as CronSchedulerStatus, j as CronStartOptions } from './cron-DTuaPMVI.js';
14
14
  import { StepResult } from './workflow.js';
15
15
  export { Workflow, agentStep, fn } from './workflow.js';
16
16
 
package/dist/index.js CHANGED
@@ -8,9 +8,9 @@ import { Workflow, agentStep } from './chunk-MU7IAA7G.js';
8
8
  export { Workflow, agentStep, fn } from './chunk-MU7IAA7G.js';
9
9
  import './chunk-HV4V63CO.js';
10
10
  import './chunk-HY66GLM6.js';
11
- export { Cron } from './chunk-FRL35MFN.js';
12
- import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-3CU5J7V3.js';
13
- export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry, managedSettingsPathFor, readManagedSettings } from './chunk-3CU5J7V3.js';
11
+ export { Cron } from './chunk-UKBBYVNS.js';
12
+ import { MEMORY_EMBEDDING_ADAPTERS, resolveSessionDir, DEFAULT_AGENTIC_MODEL_ID, Agent } from './chunk-PYFBS6OQ.js';
13
+ export { Agent, AgentBuilder, Tool, ToolError, UsageAccumulator, computeCost, getPricingEntry, managedSettingsPathFor, readManagedSettings } from './chunk-PYFBS6OQ.js';
14
14
  import { configure, submit, list, get, cancel, subscribe } from './chunk-XKMVJ443.js';
15
15
  export { emitRunEvent } from './chunk-XKMVJ443.js';
16
16
  import './chunk-5522X223.js';
@@ -56,7 +56,7 @@ import { withCwdMutex } from './chunk-Q5EWJPRY.js';
56
56
  export { withCwdMutex } from './chunk-Q5EWJPRY.js';
57
57
  export { TASK_RESERVED_PREFIXES, isValidTaskId } from './chunk-GGRPAQ3B.js';
58
58
  import { replaceFileAtomic } from './chunk-3JHIFQ4I.js';
59
- import './chunk-W4VQMXBZ.js';
59
+ import './chunk-ZDYDBXSD.js';
60
60
  import { CLAUDE_DIR_NAME, THEOKIT_DIR_LITERAL } from './chunk-X7EUUHXU.js';
61
61
  import './chunk-MQGSOKR3.js';
62
62
  import { estimateTokens, CHARS_PER_TOKEN } from './chunk-GMRFAX4I.js';
@@ -2016,7 +2016,7 @@ function isBuiltAgent(m) {
2016
2016
  return typeof m.send === "function";
2017
2017
  }
2018
2018
  async function materialize(def, index) {
2019
- const { Agent: Agent2 } = await import('./agent-7ERQNV66.js');
2019
+ const { Agent: Agent2 } = await import('./agent-6STOEBGQ.js');
2020
2020
  return Agent2.create({
2021
2021
  // `AgentDefinition.model` admits the sentinel `'inherit'`, which is not a model id. Inheriting
2022
2022
  // here means "declare nothing and let the default apply" — forwarding the literal would create
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var chunkC7GKRGKN_cjs = require('./chunk-C7GKRGKN.cjs');
4
+ require('./chunk-TY56BKSK.cjs');
5
+ require('./chunk-MPR2ISL2.cjs');
6
+ require('./chunk-UNFBHV46.cjs');
7
+ require('./chunk-6LHQPOMI.cjs');
8
+
9
+
10
+
11
+ Object.defineProperty(exports, "loadSubagents", {
12
+ enumerable: true,
13
+ get: function () { return chunkC7GKRGKN_cjs.loadSubagents; }
14
+ });
15
+ //# sourceMappingURL=subagents-loader-5TZCAIYQ.cjs.map
16
+ //# sourceMappingURL=subagents-loader-5TZCAIYQ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-7GE7YUDI.cjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-5TZCAIYQ.cjs"}
@@ -0,0 +1,7 @@
1
+ export { loadSubagents } from './chunk-ZDYDBXSD.js';
2
+ import './chunk-X7EUUHXU.js';
3
+ import './chunk-MQGSOKR3.js';
4
+ import './chunk-B5MHRQJZ.js';
5
+ import './chunk-CZJ6Q7CW.js';
6
+ //# sourceMappingURL=subagents-loader-PEV3PD4Q.js.map
7
+ //# sourceMappingURL=subagents-loader-PEV3PD4Q.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-S2PMZY7J.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"subagents-loader-PEV3PD4Q.js"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkXW4POZ6V_cjs = require('./chunk-XW4POZ6V.cjs');
3
+ var chunkC7GKRGKN_cjs = require('./chunk-C7GKRGKN.cjs');
4
4
  require('./chunk-TY56BKSK.cjs');
5
5
  require('./chunk-MPR2ISL2.cjs');
6
6
  var chunkUNFBHV46_cjs = require('./chunk-UNFBHV46.cjs');
@@ -23,7 +23,7 @@ function resolveSources(options) {
23
23
  }
24
24
  async function discoverSubagents(cwd, options) {
25
25
  const sources = resolveSources(options);
26
- return chunkXW4POZ6V_cjs.loadSubagents(cwd, sources.includes("project"), void 0, options?.compatSources ?? []);
26
+ return chunkC7GKRGKN_cjs.loadSubagents(cwd, sources.includes("project"), void 0, options?.compatSources ?? []);
27
27
  }
28
28
  async function loadSubagentDefinition(name, cwd, options) {
29
29
  return (await discoverSubagents(cwd, options))[name];
@@ -1,4 +1,4 @@
1
- import { a as AgentDefinition } from './agent-3RcPVGMo.cjs';
1
+ import { a as AgentDefinition } from './agent-Dh2YHSLj.cjs';
2
2
  import './sdk-agent-dNwjwCt5.cjs';
3
3
  import './run-DsA5Ip2i.cjs';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- import { a as AgentDefinition } from './agent-lS68mYIL.js';
1
+ import { a as AgentDefinition } from './agent-enXXu447.js';
2
2
  import './sdk-agent-wEOLXD3F.js';
3
3
  import './run-DsA5Ip2i.js';
4
4
  import 'zod';
@@ -1,4 +1,4 @@
1
- import { loadSubagents } from './chunk-W4VQMXBZ.js';
1
+ import { loadSubagents } from './chunk-ZDYDBXSD.js';
2
2
  import './chunk-X7EUUHXU.js';
3
3
  import './chunk-MQGSOKR3.js';
4
4
  import { ConfigurationError } from './chunk-B5MHRQJZ.js';
@@ -250,6 +250,18 @@ export interface AgentDefinition {
250
250
  * answered it for the other two surfaces.
251
251
  */
252
252
  source?: string;
253
+ /**
254
+ * The memory root this subagent declared, from `memory:` in its frontmatter.
255
+ *
256
+ * CARRIED, never acted on here. Resolving it means deciding which of three roots a note lives
257
+ * under, and those roots differ in who can see it — `@theokit/agents` owns that decision, with
258
+ * `resolveAgentMemory` and a refusal for any scope it does not recognise. A second copy of that
259
+ * rule in this package is how the two drift into disagreeing about privacy.
260
+ *
261
+ * The value is passed through unjudged for the same reason: a scope a newer `@theokit/agents`
262
+ * has learned would otherwise be rejected here, by a list nobody remembered to update.
263
+ */
264
+ memory?: string;
253
265
  model?: ModelSelection | "inherit";
254
266
  mcpServers?: Array<string | Record<string, McpServerConfig>>;
255
267
  /**
@@ -6,7 +6,7 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
6
6
 
7
7
  **Transport codes vs the rest.** `ErrorCode` in `errors.ts` is the small canonical union a provider failure maps onto — the codes marked *transport* below. Everything else is raised by a specific subsystem at a specific place, and a `catch` that only handles the union will meet them anyway.
8
8
 
9
- 243 distinct code(s).
9
+ 244 distinct code(s).
10
10
 
11
11
  | Code | Kind | Raised by | Sites |
12
12
  |---|---|---|---|
@@ -198,13 +198,14 @@ Branch on `code`, never on the message: messages carry context (an id, a path, a
198
198
  | `ssrf_blocked` | domain | — | `packages/sdk-tools/src/internal/network-guard.ts:23` |
199
199
  | `stream_idle_timeout` | domain | NetworkError | `packages/sdk/src/internal/llm/sse.ts:95` |
200
200
  | `stream_truncated` | domain | NetworkError | `packages/sdk/src/internal/llm/anthropic.ts:184` +1 |
201
- | `subagent_mcp_unsupported_local` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:207` |
201
+ | `subagent_foreign_runtime_field` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:245` |
202
+ | `subagent_mcp_unsupported_local` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:272` |
202
203
  | `subagent_missing_description` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/validation/validate-agent-options.ts:142` |
203
- | `subagent_missing_frontmatter` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:284` |
204
+ | `subagent_missing_frontmatter` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:349` |
204
205
  | `subagent_missing_prompt` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/validation/validate-agent-options.ts:147` |
205
- | `subagent_reasoning_effort_without_model` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:227` |
206
- | `subagent_sandbox_not_boolean` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:247` |
207
- | `subagent_unknown_field` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:192` |
206
+ | `subagent_reasoning_effort_without_model` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:292` |
207
+ | `subagent_sandbox_not_boolean` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:312` |
208
+ | `subagent_unknown_field` | domain | ConfigurationError | `packages/sdk/src/internal/runtime/skills/subagents-loader.ts:249` |
208
209
  | `subagent_unknown_setting_source` | domain | ConfigurationError | `packages/sdk/src/subagents-loader.ts:96` |
209
210
  | `subscribe_baseUrl_missing` | domain | SubscriptionError | `packages/sdk/src/subscription/theokit-subscribe.ts:77` |
210
211
  | `subscribe_name_invalid` | domain | SubscriptionError | `packages/sdk/src/subscription/theokit-subscribe.ts:72` |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theokit/sdk",
3
- "version": "5.8.0",
3
+ "version": "5.9.0",
4
4
  "description": "TypeScript SDK for the Theo agent harness — same surface, local or cloud.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/usetheokit/theokit-sdk#readme",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/internal/runtime/plugin-loader/plugin-bundles.ts","../src/internal/runtime/skills/subagents-loader.ts"],"names":["join"],"mappings":";;;;;;;AAyBA,eAAsB,gBAAA,CACpB,GAAA,EAEA,aAAA,GAAoD,EAAC,EAClC;AACnB,EAAA,MAAM,OAAiB,EAAC;AACxB,EAAA,KAAA,MAAW,IAAA,IAAQ,iBAAA,CAAkB,GAAA,EAAK,aAAa,CAAA,EAAG;AACxD,IAAA,IAAI,OAAA;AACJ,IAAA,IAAI;AACF,MAAA,OAAA,GAAU,MAAM,OAAA,CAAQ,IAAA,EAAM,EAAE,aAAA,EAAe,MAAM,CAAA;AAAA,IACvD,CAAA,CAAA,MAAQ;AACN,MAAA;AAAA,IACF;AACA,IAAA,KAAA,MAAW,SAAS,OAAA,E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E,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,CAAC,CAAA;AAC9E,EAAA,IAAI,OAAO,MAAM,QAAA,EAAU;AACzB,IAAA,OAAO,EACJ,KAAA,CAAM,QAAQ,CAAA,CACd,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,EAAM,EACnB,MAAA,CAAO,CAAC,CAAA,KAAM,CAAA,CAAE,SAAS,CAAC,CAAA;AAAA,EAC/B;AACA,EAAA,OAAO,EAAC;AACV;AAGA,SAAS,eAAe,GAAA,EAAsB;AAC5C,EAAA,OAAO,WAAA,CAAY,KAAK,GAAG,CAAA;AAC7B;AAEA,SAAS,gBAAA,CAAiB,KAAa,QAAA,EAAyD;AAC9F,EAAA,MAAM,KAAA,GAAQ,yCAAA,CAA0C,IAAA,CAAK,GAAG,CAAA;AAChE,EAAA,IAAI,UAAU,IAAA,EAAM;AAClB,IAAA,MAAM,IAAI,kBAAA,CAAmB,CAAA,SAAA,EAAY,QAAQ,CAAA,uBAAA,CAAA,EAA2B;AAAA,MAC1E,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AACA,EAAA,OAAO,EAAE,WAAA,EAAa,KAAA,CAAM,CAAC,CAAA,IAAK,EAAA,EAAI,IAAA,EAAA,CAAO,KAAA,CAAM,CAAC,CAAA,IAAK,EAAA,EAAI,IAAA,EAAK,EAAE;AACtE;AAEA,SAAS,uBAAuB,WAAA,EAAmE;AAIjG,EAAA,OAAO,gBAAgB,WAAW,CAAA;AACpC","file":"chunk-W4VQMXBZ.js","sourcesContent":["/**\n * Locating the plugin bundles a project carries.\n *\n * Shared by the skills and subagents loaders, which both need the same answer to \"which folders in\n * this project are plugins\" and would otherwise each grow their own copy of the directory walk.\n *\n * @internal\n */\n\nimport type { Dirent } from \"node:fs\";\nimport { readdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { pluginBundleRoots } from \"../../persistence/paths.js\";\nimport type { CompatSourceDeclaration } from \"../compat/foreign-config-sources.js\";\n\n/**\n * Every plugin folder under the project's plugin roots.\n *\n * Returns the FOLDERS, not their contents — what a bundle contributes (`skills/`, `agents/`) is the\n * caller's business, and a loader that also knew the layout would have to change whenever the other\n * one did.\n *\n * A missing root is not an error: most projects carry no plugins, and treating their absence as a\n * failure would make \"none installed\" indistinguishable from \"the directory could not be read\".\n */\nexport async function pluginBundleDirs(\n cwd: string,\n /** Declared foreign dialects (#524). Empty reads `.theokit/plugins` only. */\n compatSources: readonly CompatSourceDeclaration[] = [],\n): Promise<string[]> {\n const dirs: string[] = [];\n for (const root of pluginBundleRoots(cwd, compatSources)) {\n let entries: Dirent[];\n try {\n entries = await readdir(root, { withFileTypes: true });\n } catch {\n continue;\n }\n for (const entry of entries) {\n if (entry.isDirectory()) dirs.push(join(root, entry.name));\n }\n }\n return dirs;\n}\n","import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { ConfigurationError } from \"../../../errors.js\";\nimport type { AgentDefinition } from \"../../../types/agent.js\";\nimport type { ModelSelection } from \"../../../types/agent-prims.js\";\nimport { diag } from \"../../diagnostics.js\";\nimport { projectConfigRoots } from \"../../persistence/paths.js\";\nimport type { CompatSourceDeclaration } from \"../compat/foreign-config-sources.js\";\nimport { readWorkspaceDir } from \"../config/workspace-dir.js\";\nimport { type FrontmatterValue, parseSimpleYaml } from \"../context/yaml-frontmatter.js\";\nimport { pluginBundleDirs } from \"../plugin-loader/plugin-bundles.js\";\n\n/**\n * Load file-based subagents from `.theokit/agents/*.md` and merge with\n * inline definitions. Inline overrides file-based on name conflict.\n *\n * Each markdown file has YAML frontmatter (description + optional model)\n * and a body that becomes the subagent prompt.\n *\n * @internal\n */\nexport async function loadSubagents(\n cwd: string,\n settingSourcesIncludeProject: boolean,\n inline: Record<string, AgentDefinition> | undefined,\n /** Declared foreign dialects (#524). Empty reads `.theokit/` only. */\n compatSources: readonly CompatSourceDeclaration[] = [],\n): Promise<Record<string, AgentDefinition>> {\n const result: Record<string, AgentDefinition> = {};\n if (settingSourcesIncludeProject) {\n const projectAgents = await readProjectSubagents(cwd, compatSources);\n for (const [name, definition] of Object.entries(projectAgents)) {\n result[name] = definition;\n }\n }\n if (inline !== undefined) {\n for (const [name, definition] of Object.entries(inline)) {\n result[name] = definition;\n }\n }\n return result;\n}\n\n/**\n * Read agent declarations from every project config root (`.theokit`, then `.claude`).\n *\n * FIRST occurrence of a name wins, which is what makes `projectConfigRoots`' order a contract rather\n * than a detail: a project declaring the same agent in both means the explicit namespace.\n */\nasync function readProjectSubagents(\n cwd: string,\n compatSources: readonly CompatSourceDeclaration[],\n): Promise<Record<string, AgentDefinition>> {\n const subagents: Record<string, AgentDefinition> = {};\n for (const configRoot of projectConfigRoots(cwd, compatSources, \"subagents\")) {\n await readSubagentsFrom(join(configRoot, \"agents\"), subagents);\n }\n // A Claude Code plugin is a BUNDLE, and its `agents/` is what it exists to contribute. Read after\n // the project's own, so a project can shadow an agent a plugin ships without editing the plugin.\n for (const bundle of await pluginBundleDirs(cwd, compatSources)) {\n await readSubagentsFrom(join(bundle, \"agents\"), subagents);\n }\n return subagents;\n}\n\nasync function readSubagentsFrom(\n root: string,\n subagents: Record<string, AgentDefinition>,\n): Promise<void> {\n const entries = await readWorkspaceDir(root, \"subagents_read_error\", \"subagents directory\");\n for (const entry of entries) {\n if (!entry.isFile() || !entry.name.endsWith(\".md\")) continue;\n const path = join(root, entry.name);\n const raw = await readFile(path, \"utf8\");\n // A markdown file with NO frontmatter is not an agent declaration — a directory of agents\n // written for the Claude Code CLI conventionally carries documentation beside them, and\n // `.claude/agents/README.md` exists in this repository. Throwing on it made ONE such file stop\n // every agent in the directory from loading.\n //\n // Skipped with a warn rather than in silence, and ONLY for the no-frontmatter case: a file that\n // HAS frontmatter and gets it wrong is a broken agent and still fails loudly, which is what\n // keeps a typo'd `sandbox` from returning as a silent gate through this door.\n if (!hasFrontmatter(raw)) {\n diag(`[theokit-sdk] ${entry.name} has no frontmatter — not an agent declaration, skipping`);\n continue;\n }\n const definition = parseSubagentMarkdown(raw, entry.name);\n if (subagents[definition.name] === undefined) {\n // `path` is computed above to read the file and was then dropped. Keeping it is the whole\n // visibility fix (#524): without it a listing cannot say which root an agent came from.\n subagents[definition.name] = { ...definition.definition, source: path };\n }\n }\n}\n\n// The frontmatter keys a disk subagent may declare. Any other key is a typed load\n// error rather than a silent drop — a dropped `sandbox` an operator wrote believing\n// it confines the child is exactly the silent-gate failure class this guards against.\nconst ACCEPTED_FIELDS = new Set([\n \"name\",\n \"description\",\n \"model\",\n \"tools\",\n \"reasoning_effort\",\n \"mcp\",\n \"sandbox\",\n]);\n\n// Fields the Claude Code CLI writes that carry NO behaviour for this runtime. Accepted and ignored,\n// so an agent authored for the CLI loads here unchanged — measured 2026-08-26 across the 59 agent\n// files on one machine, where `color` appeared in 38 of them and made every one of those a\n// `subagent_unknown_field` load error.\n//\n// Named explicitly instead of loosening the check above, because that check's reason is sound: a\n// dropped `sandbox` an operator wrote believing it confines the child is a silent gate. A field that\n// COULD change behaviour must still fail loudly. This set is the difference between \"we know this\n// one and it does nothing\" and \"we have never heard of this\" — two facts a bare allow-everything\n// would collapse into one.\n//\n// Anything added here needs the same justification: inert for THIS runtime, not merely unfamiliar.\nconst INERT_CLAUDE_CODE_FIELDS = new Set([\n /** The CLI's label colour for the agent. Presentation only. */\n \"color\",\n]);\n\nfunction parseSubagentMarkdown(\n raw: string,\n filename: string,\n): { name: string; definition: AgentDefinition } {\n const { frontmatter, body } = splitFrontmatter(raw, filename);\n const fields = parseFrontmatterFields(frontmatter);\n rejectUnknownFields(fields, filename);\n rejectMcp(fields, filename);\n\n const definition: AgentDefinition = {\n description: asString(fields.description) ?? \"\",\n prompt: body,\n };\n const model = resolveModel(fields, filename);\n if (model !== undefined) definition.model = model;\n const tools = toStringList(fields.tools);\n if (tools.length > 0) definition.tools = tools;\n const sandbox = resolveSandbox(fields, filename);\n if (sandbox !== undefined) definition.sandbox = sandbox;\n\n const name = asString(fields.name) ?? filename.replace(/\\.md$/, \"\");\n return { name, definition };\n}\n\n/**\n * Frontmatter keys that Claude Code documents for a subagent and this runtime does not accept.\n *\n * Not an allow-list — every one of these still fails the load. It exists so the FAILURE can say\n * which kind of unknown it met. A user migrating a `.claude/agents/` tree used to learn one key per\n * round trip: fix `memory`, meet `permissionMode`, fix that, meet `maxTurns` — with nothing saying\n * the set was finite or that the tree was simply written for another runtime.\n *\n * The distinction this file already draws for `INERT_CLAUDE_CODE_FIELDS` is the same one: \"the\n * difference between 'we know this one and it does nothing' and 'we have never heard of this' — two\n * facts a bare allow-everything would collapse into one.\" This is the third fact beside them —\n * \"another runtime's field\" — and it changes only the message, never the verdict.\n */\nconst KNOWN_CLAUDE_CODE_FIELDS = new Set([\n \"disallowedTools\",\n \"permissionMode\",\n \"maxTurns\",\n \"skills\",\n \"memory\",\n \"background\",\n \"effort\",\n \"isolation\",\n \"initialPrompt\",\n \"hooks\",\n \"experimental\",\n \"mcpServers\",\n]);\n\nfunction rejectUnknownFields(\n fields: Record<string, FrontmatterValue | undefined>,\n filename: string,\n): void {\n for (const key of Object.keys(fields)) {\n if (INERT_CLAUDE_CODE_FIELDS.has(key)) continue;\n if (!ACCEPTED_FIELDS.has(key)) {\n const siblings = [...KNOWN_CLAUDE_CODE_FIELDS].filter((f) => f !== key);\n const origin = KNOWN_CLAUDE_CODE_FIELDS.has(key)\n ? ` — \"${key}\" is a Claude Code subagent field that this runtime does not support. ` +\n `The same applies to: ${siblings.join(\", \")}. Removing them one at a time will meet each ` +\n `in turn; the tree is written for another runtime`\n : \"\";\n throw new ConfigurationError(\n `Subagent ${filename}: unknown frontmatter field \"${key}\" (accepted: ${[...ACCEPTED_FIELDS].join(\", \")})${origin}`,\n { code: \"subagent_unknown_field\" },\n );\n }\n }\n}\n\n// mcp: a known field, but not yet honored on the LOCAL delegation path. The frontmatter YAML can only\n// express server NAMES (parseSimpleYaml has no nested-object support), while a child's `Agent.create`\n// needs `mcpServers` as a Record<name, config>; resolving names→config per-subagent in local delegation\n// is its own follow-up. Rather than silently drop it (the M26/M32 silent-gate class), it is a typed load\n// error that names the field and points at the alternative.\nfunction rejectMcp(fields: Record<string, FrontmatterValue | undefined>, filename: string): void {\n if (fields.mcp !== undefined) {\n throw new ConfigurationError(\n `Subagent ${filename}: per-subagent \"mcp\" is not yet supported on the local delegation path; declare MCP servers in .theokit/mcp.json (or the parent) instead`,\n { code: \"subagent_mcp_unsupported_local\" },\n );\n }\n}\n\n// model + reasoning_effort — effort rides inside `model.params[thinking]`, so it requires a concrete\n// model id to attach to (a child inheriting the parent's model cannot carry the parent's provider-\n// specific effort param safely).\nfunction resolveModel(\n fields: Record<string, FrontmatterValue | undefined>,\n filename: string,\n): ModelSelection | \"inherit\" | undefined {\n const modelId = asString(fields.model);\n const effort = asString(fields.reasoning_effort);\n // reasoning_effort rides in model.params[thinking], so it needs a CONCRETE model id to attach to.\n // Neither an absent model NOR `model: inherit` can carry it (the inherited id is unknown at load), so\n // both are typed errors rather than a silently-dropped effort — the silent-gate class this guards.\n if (effort !== undefined && (modelId === undefined || modelId === \"inherit\")) {\n throw new ConfigurationError(\n `Subagent ${filename}: reasoning_effort requires a concrete model (effort is a model parameter; an absent model or \"inherit\" cannot carry it)`,\n { code: \"subagent_reasoning_effort_without_model\" },\n );\n }\n if (modelId === undefined) return undefined;\n if (modelId === \"inherit\") return \"inherit\";\n return effort !== undefined\n ? { id: modelId, params: [{ id: \"thinking\", value: effort }] }\n : { id: modelId };\n}\n\n// sandbox: boolean only. A granular mode string (read-only/…) is unsupported by the SDK runtime and is\n// a typed error rather than a silent coercion to a boolean.\nfunction resolveSandbox(\n fields: Record<string, FrontmatterValue | undefined>,\n filename: string,\n): boolean | undefined {\n if (fields.sandbox === undefined) return undefined;\n if (typeof fields.sandbox !== \"boolean\") {\n throw new ConfigurationError(\n `Subagent ${filename}: sandbox must be a boolean (got \"${String(fields.sandbox)}\"); granular sandbox modes are not supported by the runtime`,\n { code: \"subagent_sandbox_not_boolean\" },\n );\n }\n return fields.sandbox;\n}\n\nfunction asString(v: FrontmatterValue | undefined): string | undefined {\n if (typeof v !== \"string\") return undefined;\n // parseSimpleYaml does not strip quotes (documented), and `model`/`reasoning_effort` are fields users\n // habitually quote (`model: \"openai/gpt-4o\"`). Strip a single matching surrounding quote pair so a\n // quoted id/effort does not slip past validation and fail only at the provider.\n const m = /^([\"'])(.*)\\1$/.exec(v);\n return m ? m[2] : v;\n}\n\n/** Accept a YAML list (`string[]`) or a comma/space-separated scalar; trim + drop empties. */\nfunction toStringList(v: FrontmatterValue | undefined): string[] {\n if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);\n if (typeof v === \"string\") {\n return v\n .split(/[\\s,]+/)\n .map((t) => t.trim())\n .filter((t) => t.length > 0);\n }\n return [];\n}\n\n/** Does this file open with a frontmatter block at all? Its ABSENCE means \"not an agent\". */\nfunction hasFrontmatter(raw: string): boolean {\n return /^---\\s*\\n/.test(raw);\n}\n\nfunction splitFrontmatter(raw: string, filename: string): { frontmatter: string; body: string } {\n const match = /^---\\s*\\n([\\s\\S]*?)\\n---\\s*\\n([\\s\\S]*)$/.exec(raw);\n if (match === null) {\n throw new ConfigurationError(`Subagent ${filename} is missing frontmatter`, {\n code: \"subagent_missing_frontmatter\",\n });\n }\n return { frontmatter: match[1] ?? \"\", body: (match[2] ?? \"\").trim() };\n}\n\nfunction parseFrontmatterFields(frontmatter: string): Record<string, FrontmatterValue | undefined> {\n // Preserve the rich YAML value types (boolean/number/string[]): `sandbox: true` and\n // `mcp: [a, b]` are meaningful here, so narrowing everything to string (as the\n // pre-M33 loader did) would drop them. Per-field validation happens in parseSubagentMarkdown.\n return parseSimpleYaml(frontmatter);\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/internal/runtime/plugin-loader/plugin-bundles.ts","../src/internal/runtime/skills/subagents-loader.ts"],"names":["pluginBundleRoots","readdir","join","projectConfigRoots","readWorkspaceDir","path","readFile","diag","ConfigurationError","parseSimpleYa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AAA,CAAM,CAAC,CAAA,IAAK,EAAA,EAAI,IAAA,EAAK,EAAE;AACtE;AAEA,SAAS,uBAAuB,WAAA,EAAmE;AAIjG,EAAA,OAAOC,kCAAgB,WAAW,CAAA;AACpC","file":"chunk-XW4POZ6V.cjs","sourcesContent":["/**\n * Locating the plugin bundles a project carries.\n *\n * Shared by the skills and subagents loaders, which both need the same answer to \"which folders in\n * this project are plugins\" and would otherwise each grow their own copy of the directory walk.\n *\n * @internal\n */\n\nimport type { Dirent } from \"node:fs\";\nimport { readdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { pluginBundleRoots } from \"../../persistence/paths.js\";\nimport type { CompatSourceDeclaration } from \"../compat/foreign-config-sources.js\";\n\n/**\n * Every plugin folder under the project's plugin roots.\n *\n * Returns the FOLDERS, not their contents — what a bundle contributes (`skills/`, `agents/`) is the\n * caller's business, and a loader that also knew the layout would have to change whenever the other\n * one did.\n *\n * A missing root is not an error: most projects carry no plugins, and treating their absence as a\n * failure would make \"none installed\" indistinguishable from \"the directory could not be read\".\n */\nexport async function pluginBundleDirs(\n cwd: string,\n /** Declared foreign dialects (#524). Empty reads `.theokit/plugins` only. */\n compatSources: readonly CompatSourceDeclaration[] = [],\n): Promise<string[]> {\n const dirs: string[] = [];\n for (const root of pluginBundleRoots(cwd, compatSources)) {\n let entries: Dirent[];\n try {\n entries = await readdir(root, { withFileTypes: true });\n } catch {\n continue;\n }\n for (const entry of entries) {\n if (entry.isDirectory()) dirs.push(join(root, entry.name));\n }\n }\n return dirs;\n}\n","import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nimport { ConfigurationError } from \"../../../errors.js\";\nimport type { AgentDefinition } from \"../../../types/agent.js\";\nimport type { ModelSelection } from \"../../../types/agent-prims.js\";\nimport { diag } from \"../../diagnostics.js\";\nimport { projectConfigRoots } from \"../../persistence/paths.js\";\nimport type { CompatSourceDeclaration } from \"../compat/foreign-config-sources.js\";\nimport { readWorkspaceDir } from \"../config/workspace-dir.js\";\nimport { type FrontmatterValue, parseSimpleYaml } from \"../context/yaml-frontmatter.js\";\nimport { pluginBundleDirs } from \"../plugin-loader/plugin-bundles.js\";\n\n/**\n * Load file-based subagents from `.theokit/agents/*.md` and merge with\n * inline definitions. Inline overrides file-based on name conflict.\n *\n * Each markdown file has YAML frontmatter (description + optional model)\n * and a body that becomes the subagent prompt.\n *\n * @internal\n */\nexport async function loadSubagents(\n cwd: string,\n settingSourcesIncludeProject: boolean,\n inline: Record<string, AgentDefinition> | undefined,\n /** Declared foreign dialects (#524). Empty reads `.theokit/` only. */\n compatSources: readonly CompatSourceDeclaration[] = [],\n): Promise<Record<string, AgentDefinition>> {\n const result: Record<string, AgentDefinition> = {};\n if (settingSourcesIncludeProject) {\n const projectAgents = await readProjectSubagents(cwd, compatSources);\n for (const [name, definition] of Object.entries(projectAgents)) {\n result[name] = definition;\n }\n }\n if (inline !== undefined) {\n for (const [name, definition] of Object.entries(inline)) {\n result[name] = definition;\n }\n }\n return result;\n}\n\n/**\n * Read agent declarations from every project config root (`.theokit`, then `.claude`).\n *\n * FIRST occurrence of a name wins, which is what makes `projectConfigRoots`' order a contract rather\n * than a detail: a project declaring the same agent in both means the explicit namespace.\n */\nasync function readProjectSubagents(\n cwd: string,\n compatSources: readonly CompatSourceDeclaration[],\n): Promise<Record<string, AgentDefinition>> {\n const subagents: Record<string, AgentDefinition> = {};\n for (const configRoot of projectConfigRoots(cwd, compatSources, \"subagents\")) {\n await readSubagentsFrom(join(configRoot, \"agents\"), subagents);\n }\n // A Claude Code plugin is a BUNDLE, and its `agents/` is what it exists to contribute. Read after\n // the project's own, so a project can shadow an agent a plugin ships without editing the plugin.\n for (const bundle of await pluginBundleDirs(cwd, compatSources)) {\n await readSubagentsFrom(join(bundle, \"agents\"), subagents);\n }\n return subagents;\n}\n\nasync function readSubagentsFrom(\n root: string,\n subagents: Record<string, AgentDefinition>,\n): Promise<void> {\n const entries = await readWorkspaceDir(root, \"subagents_read_error\", \"subagents directory\");\n for (const entry of entries) {\n if (!entry.isFile() || !entry.name.endsWith(\".md\")) continue;\n const path = join(root, entry.name);\n const raw = await readFile(path, \"utf8\");\n // A markdown file with NO frontmatter is not an agent declaration — a directory of agents\n // written for the Claude Code CLI conventionally carries documentation beside them, and\n // `.claude/agents/README.md` exists in this repository. Throwing on it made ONE such file stop\n // every agent in the directory from loading.\n //\n // Skipped with a warn rather than in silence, and ONLY for the no-frontmatter case: a file that\n // HAS frontmatter and gets it wrong is a broken agent and still fails loudly, which is what\n // keeps a typo'd `sandbox` from returning as a silent gate through this door.\n if (!hasFrontmatter(raw)) {\n diag(`[theokit-sdk] ${entry.name} has no frontmatter — not an agent declaration, skipping`);\n continue;\n }\n const definition = parseSubagentMarkdown(raw, entry.name);\n if (subagents[definition.name] === undefined) {\n // `path` is computed above to read the file and was then dropped. Keeping it is the whole\n // visibility fix (#524): without it a listing cannot say which root an agent came from.\n subagents[definition.name] = { ...definition.definition, source: path };\n }\n }\n}\n\n// The frontmatter keys a disk subagent may declare. Any other key is a typed load\n// error rather than a silent drop — a dropped `sandbox` an operator wrote believing\n// it confines the child is exactly the silent-gate failure class this guards against.\nconst ACCEPTED_FIELDS = new Set([\n \"name\",\n \"description\",\n \"model\",\n \"tools\",\n \"reasoning_effort\",\n \"mcp\",\n \"sandbox\",\n]);\n\n// Fields the Claude Code CLI writes that carry NO behaviour for this runtime. Accepted and ignored,\n// so an agent authored for the CLI loads here unchanged — measured 2026-08-26 across the 59 agent\n// files on one machine, where `color` appeared in 38 of them and made every one of those a\n// `subagent_unknown_field` load error.\n//\n// Named explicitly instead of loosening the check above, because that check's reason is sound: a\n// dropped `sandbox` an operator wrote believing it confines the child is a silent gate. A field that\n// COULD change behaviour must still fail loudly. This set is the difference between \"we know this\n// one and it does nothing\" and \"we have never heard of this\" — two facts a bare allow-everything\n// would collapse into one.\n//\n// Anything added here needs the same justification: inert for THIS runtime, not merely unfamiliar.\nconst INERT_CLAUDE_CODE_FIELDS = new Set([\n /** The CLI's label colour for the agent. Presentation only. */\n \"color\",\n]);\n\nfunction parseSubagentMarkdown(\n raw: string,\n filename: string,\n): { name: string; definition: AgentDefinition } {\n const { frontmatter, body } = splitFrontmatter(raw, filename);\n const fields = parseFrontmatterFields(frontmatter);\n rejectUnknownFields(fields, filename);\n rejectMcp(fields, filename);\n\n const definition: AgentDefinition = {\n description: asString(fields.description) ?? \"\",\n prompt: body,\n };\n const model = resolveModel(fields, filename);\n if (model !== undefined) definition.model = model;\n const tools = toStringList(fields.tools);\n if (tools.length > 0) definition.tools = tools;\n const sandbox = resolveSandbox(fields, filename);\n if (sandbox !== undefined) definition.sandbox = sandbox;\n\n const name = asString(fields.name) ?? filename.replace(/\\.md$/, \"\");\n return { name, definition };\n}\n\n/**\n * Frontmatter keys that Claude Code documents for a subagent and this runtime does not accept.\n *\n * Not an allow-list — every one of these still fails the load. It exists so the FAILURE can say\n * which kind of unknown it met. A user migrating a `.claude/agents/` tree used to learn one key per\n * round trip: fix `memory`, meet `permissionMode`, fix that, meet `maxTurns` — with nothing saying\n * the set was finite or that the tree was simply written for another runtime.\n *\n * The distinction this file already draws for `INERT_CLAUDE_CODE_FIELDS` is the same one: \"the\n * difference between 'we know this one and it does nothing' and 'we have never heard of this' — two\n * facts a bare allow-everything would collapse into one.\" This is the third fact beside them —\n * \"another runtime's field\" — and it changes only the message, never the verdict.\n */\nconst KNOWN_CLAUDE_CODE_FIELDS = new Set([\n \"disallowedTools\",\n \"permissionMode\",\n \"maxTurns\",\n \"skills\",\n \"memory\",\n \"background\",\n \"effort\",\n \"isolation\",\n \"initialPrompt\",\n \"hooks\",\n \"experimental\",\n \"mcpServers\",\n]);\n\nfunction rejectUnknownFields(\n fields: Record<string, FrontmatterValue | undefined>,\n filename: string,\n): void {\n for (const key of Object.keys(fields)) {\n if (INERT_CLAUDE_CODE_FIELDS.has(key)) continue;\n if (!ACCEPTED_FIELDS.has(key)) {\n const siblings = [...KNOWN_CLAUDE_CODE_FIELDS].filter((f) => f !== key);\n const origin = KNOWN_CLAUDE_CODE_FIELDS.has(key)\n ? ` — \"${key}\" is a Claude Code subagent field that this runtime does not support. ` +\n `The same applies to: ${siblings.join(\", \")}. Removing them one at a time will meet each ` +\n `in turn; the tree is written for another runtime`\n : \"\";\n throw new ConfigurationError(\n `Subagent ${filename}: unknown frontmatter field \"${key}\" (accepted: ${[...ACCEPTED_FIELDS].join(\", \")})${origin}`,\n { code: \"subagent_unknown_field\" },\n );\n }\n }\n}\n\n// mcp: a known field, but not yet honored on the LOCAL delegation path. The frontmatter YAML can only\n// express server NAMES (parseSimpleYaml has no nested-object support), while a child's `Agent.create`\n// needs `mcpServers` as a Record<name, config>; resolving names→config per-subagent in local delegation\n// is its own follow-up. Rather than silently drop it (the M26/M32 silent-gate class), it is a typed load\n// error that names the field and points at the alternative.\nfunction rejectMcp(fields: Record<string, FrontmatterValue | undefined>, filename: string): void {\n if (fields.mcp !== undefined) {\n throw new ConfigurationError(\n `Subagent ${filename}: per-subagent \"mcp\" is not yet supported on the local delegation path; declare MCP servers in .theokit/mcp.json (or the parent) instead`,\n { code: \"subagent_mcp_unsupported_local\" },\n );\n }\n}\n\n// model + reasoning_effort — effort rides inside `model.params[thinking]`, so it requires a concrete\n// model id to attach to (a child inheriting the parent's model cannot carry the parent's provider-\n// specific effort param safely).\nfunction resolveModel(\n fields: Record<string, FrontmatterValue | undefined>,\n filename: string,\n): ModelSelection | \"inherit\" | undefined {\n const modelId = asString(fields.model);\n const effort = asString(fields.reasoning_effort);\n // reasoning_effort rides in model.params[thinking], so it needs a CONCRETE model id to attach to.\n // Neither an absent model NOR `model: inherit` can carry it (the inherited id is unknown at load), so\n // both are typed errors rather than a silently-dropped effort — the silent-gate class this guards.\n if (effort !== undefined && (modelId === undefined || modelId === \"inherit\")) {\n throw new ConfigurationError(\n `Subagent ${filename}: reasoning_effort requires a concrete model (effort is a model parameter; an absent model or \"inherit\" cannot carry it)`,\n { code: \"subagent_reasoning_effort_without_model\" },\n );\n }\n if (modelId === undefined) return undefined;\n if (modelId === \"inherit\") return \"inherit\";\n return effort !== undefined\n ? { id: modelId, params: [{ id: \"thinking\", value: effort }] }\n : { id: modelId };\n}\n\n// sandbox: boolean only. A granular mode string (read-only/…) is unsupported by the SDK runtime and is\n// a typed error rather than a silent coercion to a boolean.\nfunction resolveSandbox(\n fields: Record<string, FrontmatterValue | undefined>,\n filename: string,\n): boolean | undefined {\n if (fields.sandbox === undefined) return undefined;\n if (typeof fields.sandbox !== \"boolean\") {\n throw new ConfigurationError(\n `Subagent ${filename}: sandbox must be a boolean (got \"${String(fields.sandbox)}\"); granular sandbox modes are not supported by the runtime`,\n { code: \"subagent_sandbox_not_boolean\" },\n );\n }\n return fields.sandbox;\n}\n\nfunction asString(v: FrontmatterValue | undefined): string | undefined {\n if (typeof v !== \"string\") return undefined;\n // parseSimpleYaml does not strip quotes (documented), and `model`/`reasoning_effort` are fields users\n // habitually quote (`model: \"openai/gpt-4o\"`). Strip a single matching surrounding quote pair so a\n // quoted id/effort does not slip past validation and fail only at the provider.\n const m = /^([\"'])(.*)\\1$/.exec(v);\n return m ? m[2] : v;\n}\n\n/** Accept a YAML list (`string[]`) or a comma/space-separated scalar; trim + drop empties. */\nfunction toStringList(v: FrontmatterValue | undefined): string[] {\n if (Array.isArray(v)) return v.map((t) => t.trim()).filter((t) => t.length > 0);\n if (typeof v === \"string\") {\n return v\n .split(/[\\s,]+/)\n .map((t) => t.trim())\n .filter((t) => t.length > 0);\n }\n return [];\n}\n\n/** Does this file open with a frontmatter block at all? Its ABSENCE means \"not an agent\". */\nfunction hasFrontmatter(raw: string): boolean {\n return /^---\\s*\\n/.test(raw);\n}\n\nfunction splitFrontmatter(raw: string, filename: string): { frontmatter: string; body: string } {\n const match = /^---\\s*\\n([\\s\\S]*?)\\n---\\s*\\n([\\s\\S]*)$/.exec(raw);\n if (match === null) {\n throw new ConfigurationError(`Subagent ${filename} is missing frontmatter`, {\n code: \"subagent_missing_frontmatter\",\n });\n }\n return { frontmatter: match[1] ?? \"\", body: (match[2] ?? \"\").trim() };\n}\n\nfunction parseFrontmatterFields(frontmatter: string): Record<string, FrontmatterValue | undefined> {\n // Preserve the rich YAML value types (boolean/number/string[]): `sandbox: true` and\n // `mcp: [a, b]` are meaningful here, so narrowing everything to string (as the\n // pre-M33 loader did) would drop them. Per-field validation happens in parseSubagentMarkdown.\n return parseSimpleYaml(frontmatter);\n}\n"]}
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkXW4POZ6V_cjs = require('./chunk-XW4POZ6V.cjs');
4
- require('./chunk-TY56BKSK.cjs');
5
- require('./chunk-MPR2ISL2.cjs');
6
- require('./chunk-UNFBHV46.cjs');
7
- require('./chunk-6LHQPOMI.cjs');
8
-
9
-
10
-
11
- Object.defineProperty(exports, "loadSubagents", {
12
- enumerable: true,
13
- get: function () { return chunkXW4POZ6V_cjs.loadSubagents; }
14
- });
15
- //# sourceMappingURL=subagents-loader-7GE7YUDI.cjs.map
16
- //# sourceMappingURL=subagents-loader-7GE7YUDI.cjs.map
@@ -1,7 +0,0 @@
1
- export { loadSubagents } from './chunk-W4VQMXBZ.js';
2
- import './chunk-X7EUUHXU.js';
3
- import './chunk-MQGSOKR3.js';
4
- import './chunk-B5MHRQJZ.js';
5
- import './chunk-CZJ6Q7CW.js';
6
- //# sourceMappingURL=subagents-loader-S2PMZY7J.js.map
7
- //# sourceMappingURL=subagents-loader-S2PMZY7J.js.map