@theokit/sdk 5.4.0 → 5.6.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 (132) hide show
  1. package/CHANGELOG.md +642 -0
  2. package/dist/{agent-AUVD4TI4.cjs → agent-47NS6ZVL.cjs} +13 -13
  3. package/dist/{agent-AUVD4TI4.cjs.map → agent-47NS6ZVL.cjs.map} +1 -1
  4. package/dist/{agent-C1Efo7PI.d.cts → agent-82d_DrCL.d.cts} +33 -2
  5. package/dist/{agent-Bmy2G_ml.d.ts → agent-G6g-uwcB.d.ts} +33 -2
  6. package/dist/{agent-MNINE73R.js → agent-JJZM2VIK.js} +12 -12
  7. package/dist/{agent-MNINE73R.js.map → agent-JJZM2VIK.js.map} +1 -1
  8. package/dist/{chunk-IKBLU7ZS.js → chunk-2UXQASTX.js} +232 -32
  9. package/dist/chunk-2UXQASTX.js.map +1 -0
  10. package/dist/{chunk-VPK6PHIE.cjs → chunk-52FDUJSV.cjs} +8 -8
  11. package/dist/{chunk-VPK6PHIE.cjs.map → chunk-52FDUJSV.cjs.map} +1 -1
  12. package/dist/{chunk-2XRAWOZZ.js → chunk-5NELQ6LB.js} +65 -3
  13. package/dist/chunk-5NELQ6LB.js.map +1 -0
  14. package/dist/{chunk-3FDU5JFE.cjs → chunk-7IZKTQ5G.cjs} +35 -7
  15. package/dist/chunk-7IZKTQ5G.cjs.map +1 -0
  16. package/dist/{chunk-7SZAV6QG.js → chunk-7MMTZBTT.js} +3 -3
  17. package/dist/{chunk-7SZAV6QG.js.map → chunk-7MMTZBTT.js.map} +1 -1
  18. package/dist/{chunk-SADXXGWU.js → chunk-BZ3YMAMP.js} +3 -3
  19. package/dist/{chunk-NQTNSHSB.cjs.map → chunk-BZ3YMAMP.js.map} +1 -1
  20. package/dist/{chunk-LX7SEXOQ.js → chunk-CA5VUAP3.js} +25 -7
  21. package/dist/chunk-CA5VUAP3.js.map +1 -0
  22. package/dist/{chunk-IU5N5224.cjs → chunk-EIOMN5VA.cjs} +8 -8
  23. package/dist/chunk-EIOMN5VA.cjs.map +1 -0
  24. package/dist/{chunk-KWGSBZ2Q.js → chunk-FPIY5CLV.js} +3 -3
  25. package/dist/{chunk-KWGSBZ2Q.js.map → chunk-FPIY5CLV.js.map} +1 -1
  26. package/dist/{chunk-UALC6Q3J.cjs → chunk-GCHZMH42.cjs} +290 -88
  27. package/dist/chunk-GCHZMH42.cjs.map +1 -0
  28. package/dist/{chunk-NQTNSHSB.cjs → chunk-GFFBXSQT.cjs} +5 -5
  29. package/dist/chunk-GFFBXSQT.cjs.map +1 -0
  30. package/dist/{chunk-J6KZE2ZQ.cjs → chunk-HG4UN4MN.cjs} +4 -4
  31. package/dist/{chunk-J6KZE2ZQ.cjs.map → chunk-HG4UN4MN.cjs.map} +1 -1
  32. package/dist/{chunk-N6OOOYFZ.js → chunk-HUDNLFY4.js} +4 -4
  33. package/dist/chunk-HUDNLFY4.js.map +1 -0
  34. package/dist/{chunk-LOHMT36V.cjs → chunk-LD6HASA5.cjs} +65 -2
  35. package/dist/chunk-LD6HASA5.cjs.map +1 -0
  36. package/dist/{chunk-QATRS7JD.cjs → chunk-MYJGWS2J.cjs} +26 -8
  37. package/dist/chunk-MYJGWS2J.cjs.map +1 -0
  38. package/dist/{chunk-XD3FS5OI.js → chunk-N2KAIZ5D.js} +34 -7
  39. package/dist/chunk-N2KAIZ5D.js.map +1 -0
  40. package/dist/{chunk-HW7SEELD.cjs → chunk-QRVS2PRE.cjs} +31 -8
  41. package/dist/chunk-QRVS2PRE.cjs.map +1 -0
  42. package/dist/{chunk-AYA65JA5.cjs → chunk-RWPLWMCZ.cjs} +25 -9
  43. package/dist/chunk-RWPLWMCZ.cjs.map +1 -0
  44. package/dist/{chunk-WS5ULCL4.js → chunk-STGSMJMJ.js} +3 -3
  45. package/dist/{chunk-WS5ULCL4.js.map → chunk-STGSMJMJ.js.map} +1 -1
  46. package/dist/{chunk-O7L7M42F.js → chunk-T3ZDEYTJ.js} +21 -5
  47. package/dist/chunk-T3ZDEYTJ.js.map +1 -0
  48. package/dist/{chunk-43YXGD3P.cjs → chunk-TY56BKSK.cjs} +8 -4
  49. package/dist/chunk-TY56BKSK.cjs.map +1 -0
  50. package/dist/chunk-UOLBAPDM.js +66 -0
  51. package/dist/chunk-UOLBAPDM.js.map +1 -0
  52. package/dist/{chunk-Z2JFX372.cjs → chunk-VUHXC74Q.cjs} +15 -15
  53. package/dist/{chunk-Z2JFX372.cjs.map → chunk-VUHXC74Q.cjs.map} +1 -1
  54. package/dist/{chunk-NSLHPAC7.js → chunk-X7EUUHXU.js} +6 -5
  55. package/dist/chunk-X7EUUHXU.js.map +1 -0
  56. package/dist/context/index.cjs +7 -7
  57. package/dist/context/index.js +3 -3
  58. package/dist/{context-4AIK26QB.cjs → context-HR4KMXMA.cjs} +7 -7
  59. package/dist/{context-4AIK26QB.cjs.map → context-HR4KMXMA.cjs.map} +1 -1
  60. package/dist/context-J5BJ3LBS.js +6 -0
  61. package/dist/{context-EGM6CHXD.js.map → context-J5BJ3LBS.js.map} +1 -1
  62. package/dist/{cron-DSMdlhyF.d.cts → cron-DWv69ZSD.d.cts} +1 -1
  63. package/dist/{cron-Dcdrdv_T.d.ts → cron-GynWtAax.d.ts} +1 -1
  64. package/dist/cron.cjs +12 -12
  65. package/dist/cron.d.cts +2 -2
  66. package/dist/cron.d.ts +2 -2
  67. package/dist/cron.js +11 -11
  68. package/dist/eval.cjs +11 -11
  69. package/dist/eval.js +10 -10
  70. package/dist/{index-manager-W7FDMGEG.js → index-manager-27WLNQEE.js} +5 -5
  71. package/dist/{index-manager-W7FDMGEG.js.map → index-manager-27WLNQEE.js.map} +1 -1
  72. package/dist/{index-manager-3UNPYH34.cjs → index-manager-BBHDKMQS.cjs} +6 -6
  73. package/dist/{index-manager-3UNPYH34.cjs.map → index-manager-BBHDKMQS.cjs.map} +1 -1
  74. package/dist/index.cjs +274 -40
  75. package/dist/index.cjs.map +1 -1
  76. package/dist/index.d.cts +168 -5
  77. package/dist/index.d.ts +168 -5
  78. package/dist/index.js +246 -23
  79. package/dist/index.js.map +1 -1
  80. package/dist/internal/memory/storage/index.cjs +32 -32
  81. package/dist/internal/memory/storage/index.js +3 -3
  82. package/dist/internal/memory/storage/memory-root.d.cts +27 -0
  83. package/dist/internal/memory/storage/memory-root.d.ts +27 -0
  84. package/dist/internal/persistence/index.cjs +4 -4
  85. package/dist/internal/persistence/index.js +1 -1
  86. package/dist/internal/runtime/compat/foreign-config-sources.d.ts +17 -4
  87. package/dist/internal/runtime/compat/managed-settings.d.ts +80 -0
  88. package/dist/internal/runtime/context/context-discovery-runner.d.ts +14 -0
  89. package/dist/internal/runtime/context/context-discovery.d.ts +37 -0
  90. package/dist/internal/runtime/context/context-manager.d.ts +21 -1
  91. package/dist/internal/runtime/context/yaml-frontmatter.d.ts +6 -3
  92. package/dist/internal/runtime/hooks/hooks-executor.d.ts +23 -1
  93. package/dist/internal/runtime/hooks/hooks-source.d.ts +46 -1
  94. package/dist/internal/runtime/skills/discover-skills.d.ts +4 -0
  95. package/dist/project.cjs +3 -3
  96. package/dist/project.js +1 -1
  97. package/dist/skills.cjs +5 -5
  98. package/dist/skills.js +2 -2
  99. package/dist/subagents-loader-CJFYQQU2.js +7 -0
  100. package/dist/{subagents-loader-AIVDQ2D5.js.map → subagents-loader-CJFYQQU2.js.map} +1 -1
  101. package/dist/subagents-loader-MOO7DC4E.cjs +16 -0
  102. package/dist/{subagents-loader-DN4LETGL.cjs.map → subagents-loader-MOO7DC4E.cjs.map} +1 -1
  103. package/dist/subagents-loader.cjs +4 -4
  104. package/dist/subagents-loader.d.cts +1 -1
  105. package/dist/subagents-loader.d.ts +1 -1
  106. package/dist/subagents-loader.js +3 -3
  107. package/dist/types/agent.d.ts +6 -1
  108. package/dist/types/hooks.d.ts +22 -0
  109. package/docs/error-codes.md +20 -18
  110. package/docs/harness-capability-map.md +9 -1
  111. package/package.json +1 -1
  112. package/dist/chunk-2XRAWOZZ.js.map +0 -1
  113. package/dist/chunk-3FDU5JFE.cjs.map +0 -1
  114. package/dist/chunk-43YXGD3P.cjs.map +0 -1
  115. package/dist/chunk-AYA65JA5.cjs.map +0 -1
  116. package/dist/chunk-HW7SEELD.cjs.map +0 -1
  117. package/dist/chunk-IKBLU7ZS.js.map +0 -1
  118. package/dist/chunk-IU5N5224.cjs.map +0 -1
  119. package/dist/chunk-JNAA4G4H.js +0 -43
  120. package/dist/chunk-JNAA4G4H.js.map +0 -1
  121. package/dist/chunk-LOHMT36V.cjs.map +0 -1
  122. package/dist/chunk-LX7SEXOQ.js.map +0 -1
  123. package/dist/chunk-N6OOOYFZ.js.map +0 -1
  124. package/dist/chunk-NSLHPAC7.js.map +0 -1
  125. package/dist/chunk-O7L7M42F.js.map +0 -1
  126. package/dist/chunk-QATRS7JD.cjs.map +0 -1
  127. package/dist/chunk-SADXXGWU.js.map +0 -1
  128. package/dist/chunk-UALC6Q3J.cjs.map +0 -1
  129. package/dist/chunk-XD3FS5OI.js.map +0 -1
  130. package/dist/context-EGM6CHXD.js +0 -6
  131. package/dist/subagents-loader-AIVDQ2D5.js +0 -7
  132. package/dist/subagents-loader-DN4LETGL.cjs +0 -16
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 { F as RunEvent, j as CostBreakdown, at 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-CTAdRU3U.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, 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, E as RunErrorDetail, F as RunEvent, H as RunGitInfo, J as RunMemoryDegradedEvent, K as RunOperation, L as RunPermissionDeniedEvent, N as RunRateLimitEvent, Q as RunStatus, U as RunTaskCompletedEvent, V as RunTaskStartedEvent, W as RunTaskUpdatedEvent, X as RunTimelineEvent, Y as RunToCompletionOptions, Z as RunToCompletionResult, _ as RunToolProgressEvent, $ as RunTripwireEvent, a0 as SDKAssistantMessage, a1 as SDKImage, a2 as SDKImageDimension, a3 as SDKObjectDelta, a4 as SDKRequestMessage, a5 as SDKStatusMessage, a6 as SDKSystemMessage, a7 as SDKTaskMessage, a8 as SDKThinkingMessage, a9 as SDKToolUseMessage, aa as SDKUserMessage, ab as SDKUserMessageEvent, ac as SendOptions, ad as ShellCommand, ae as ShellConversationTurn, af as ShellOutput, ag as ShellOutputDeltaUpdate, ah as StepCompletedUpdate, ai as StepStartedUpdate, aj as StreamToCompletionResult, ak as SummaryCompletedUpdate, al as SummaryStartedUpdate, am as SummaryUpdate, an as TextBlock, ao as TextDeltaUpdate, ap as ThinkingCompletedUpdate, aq as ThinkingDeltaUpdate, ar as ThinkingMessage, as as TokenDeltaUpdate, at as TokenUsage, au as ToolCall, av as ToolCallCompletedUpdate, aw as ToolCallStartedUpdate, ax as ToolContextMessage, ay as ToolResult, az as ToolResultGuardOptions, aA as ToolUseBlock, aB as TurnEndedUpdate, aC as UserMessage, aD as UserMessageAppendedUpdate } from './run-CTAdRU3U.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, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-C1Efo7PI.cjs';
6
- export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-C1Efo7PI.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-82d_DrCL.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 HookName, E as MemoryProviderAgentRef, F as MemoryProviderFactory, J as MemoryProviderHandle, K as MemoryProviderInitOptions, N as PluginContext, O as PluginHookDisposer, Q as PostAssistantReplyContext, R as PostToolCallContext, T as PreToolCallContext, U as PreUserSendContext, V as PreUserSendResult, W as ProviderTransform, X as ProviderTransformContext, Y as RecordSessionSummaryArgs, Z as SessionLifecycleContext, _ as SessionRecord, $ as SessionStore, a0 as SettingSource, a1 as Skill, a2 as SkillsResolver, a3 as SkillsResolverContext, a4 as SystemPromptContext, a5 as SystemPromptMemoryFact, a6 as TelemetrySettings, a7 as ToolCallSummary, a8 as ToolResultTransformContext, a9 as TransformContext } from './agent-82d_DrCL.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-DrDEgyz1.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-DrDEgyz1.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-BOiKqOgL.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, I as InvalidateCacheOptions, k as MemoryAdapter, l as MemoryAdapterCapabilities, m as MemoryContext, n as MemoryFact, o as MemoryRevision, p as MemoryToolSchema, q as MemoryTurnMessage, r as PersonalityPreset, s as ProviderCapability, t as ProviderRoute, R as ResolvedProviderRoute, u as RunUntilIterator, v as SDKAgentPlugins, w as SDKAgentSkillDetail, x as SDKAgentSkills, y as SDKArtifact, z as SDKContextManager, B as SDKPluginMetadata, D as SDKProvidersManager, E as SystemPromptSkillRef, V as Verdict } from './sdk-agent-BOiKqOgL.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-DSMdlhyF.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-DWv69ZSD.cjs';
14
14
  import { StepResult } from './workflow.cjs';
15
15
  export { Workflow, agentStep, fn } from './workflow.cjs';
16
16
 
@@ -1596,13 +1596,22 @@ declare class Provider {
1596
1596
  * @public
1597
1597
  */
1598
1598
 
1599
+ /**
1600
+ * What `skill_read` can read: a skill that carries its body, or one that knows where its body is.
1601
+ *
1602
+ * The tool used to take `InlineSkill` alone. A skill discovered on disk is a `Skill`, whose own
1603
+ * declaration says "the skill BODY is never included" — so it did not fit through the door at all,
1604
+ * and the entire on-disk surface was advertised to the model and unreadable by it: a `SKILL.md`
1605
+ * listed by name and description, with the instructions under the frontmatter unable to arrive.
1606
+ */
1607
+ type ReadableSkill = InlineSkill | Skill;
1599
1608
  /** SE36 — `SkillReadTool.create` replaces `defineSkillReadTool` (ADR 0015). @public *
1600
1609
  * `SkillReadTool.create` returns a **`CustomTool`** — a skill-reading tool, not a
1601
1610
  * `SkillReadTool` instance.
1602
1611
  */
1603
1612
  declare class SkillReadTool {
1604
1613
  private constructor();
1605
- static create(skills: ReadonlyArray<InlineSkill>): CustomTool;
1614
+ static create(skills: ReadonlyArray<ReadableSkill>): CustomTool;
1606
1615
  }
1607
1616
 
1608
1617
  /**
@@ -2114,6 +2123,87 @@ declare function emitRunEvent(sink: RunEventSink$1 | undefined, event: RunEvent)
2114
2123
  */
2115
2124
  declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
2116
2125
 
2126
+ /**
2127
+ * What an operator may impose. One key today, and the shape is the point: each addition is a control
2128
+ * that already exists somewhere below and is being lifted into a tier the project cannot reach.
2129
+ *
2130
+ * Deliberately NOT a passthrough of arbitrary keys. A policy file whose unknown keys were carried
2131
+ * along would let an organisation believe it had imposed something this runtime never reads — the
2132
+ * exact belief-in-an-absent-protection this tier exists to remove.
2133
+ */
2134
+ interface ManagedSettings {
2135
+ /**
2136
+ * Refuse to execute the `` !`command` `` form in a skill or command body.
2137
+ *
2138
+ * A skill is a markdown file a repository can carry, and its body can run shell at expansion time.
2139
+ * Without this the only way to decline was to stop reading skills entirely.
2140
+ */
2141
+ disableSkillShellExecution?: boolean;
2142
+ /**
2143
+ * The permission posture the operator imposes on every run.
2144
+ *
2145
+ * `plan` is the one this exists for: an explore-only posture where edits are structurally refused.
2146
+ * A `createPlanModeTool` already existed and it is a tool the MODEL may call — the difference is
2147
+ * who decides. A never-prompt posture (`bypass`) is the other end, for a locked-down CI run where
2148
+ * there is nobody to ask.
2149
+ *
2150
+ * It does NOT reach the standing-grant gate. `bypass` allows what the RULES would have asked
2151
+ * about; a grant an operator recorded is not the run's to clear.
2152
+ */
2153
+ permissionMode?: "default" | "plan" | "acceptEdits" | "bypass";
2154
+ /**
2155
+ * The permission policy, as rule strings an operator writes and reviews.
2156
+ *
2157
+ * `{ "permissions": { "deny": ["Read(path:./.env)"] } }` — the spec's own paste-ready
2158
+ * secret-exclusion example, which could not be expressed at all while every policy was a compiled
2159
+ * predicate. Parsed by `parsePermissionRules` into the rules `PermissionEngine` already evaluates;
2160
+ * the engine is unchanged and keeps its fail-closed default and its immune-to-un-deny explicit
2161
+ * deny.
2162
+ */
2163
+ permissions?: {
2164
+ readonly deny?: readonly string[];
2165
+ readonly ask?: readonly string[];
2166
+ readonly allow?: readonly string[];
2167
+ };
2168
+ /**
2169
+ * Refuse to run ANY hook, whatever the project declared.
2170
+ *
2171
+ * The first control lifted, because it is the one whose absence is hardest to notice: a hook that
2172
+ * does not run looks identical to a hook that ran and approved.
2173
+ */
2174
+ disableAllHooks?: boolean;
2175
+ }
2176
+ /**
2177
+ * Where the platform keeps its managed settings.
2178
+ *
2179
+ * `root` exists so the precedence rule is testable: the real directories are platform-owned and a
2180
+ * test must not write to `/etc`. Hard-coding the path inside the reader would make the thing that
2181
+ * actually matters — that a project cannot override this file — unreachable by any test not running
2182
+ * as root.
2183
+ *
2184
+ * The paths are Claude Code's own, because the file is Claude Code's format: an organisation that
2185
+ * already deployed one should not have to deploy a second copy under a different name to get the
2186
+ * same policy honoured here.
2187
+ */
2188
+ declare function managedSettingsPathFor(root?: string): string;
2189
+ /**
2190
+ * Read the deployed policy, or `{}` when none is.
2191
+ *
2192
+ * Absent is the ordinary case and not an error — most machines have no operator tier, and a reader
2193
+ * that failed without one would make the feature a prerequisite for running at all.
2194
+ *
2195
+ * A file that EXISTS and cannot be read is different, and says so — through `diagFailure`, not
2196
+ * `diag`. `diag` returns immediately when no sink is installed, and most consumers never install
2197
+ * one: an organisation that deployed a policy with a typo in it would get complete silence, which is
2198
+ * the same defect this repository just fixed for dropped hook events. A policy channel that is
2199
+ * silent by default reports nothing about the one thing the tier exists to make certain. An organisation that deployed a
2200
+ * policy and got silence would believe it applied; that belief is what this tier removes.
2201
+ *
2202
+ * SYNC for the same reason `readCompatConfigFile` is: the caller resolves this before any submanager
2203
+ * exists to await a promise, and a once-per-agent read of one small file is the same class of work.
2204
+ */
2205
+ declare function readManagedSettings(root?: string): ManagedSettings;
2206
+
2117
2207
  /**
2118
2208
  * Reference `MemoryProvider` impl — no-op fallback (SDK 2.0 Phase 1 /
2119
2209
  * T1.2 reference implementation, mirrors `createCounterBudgetTracker`).
@@ -2780,6 +2870,22 @@ declare class PermissionEngine {
2780
2870
  evaluate(toolName: string, args?: Record<string, unknown>, mode?: PermissionMode): PermissionAction;
2781
2871
  }
2782
2872
 
2873
+ /** Where the floor is anchored. Defaults to the real environment; overridable so it is testable. */
2874
+ interface PermissionFloorContext {
2875
+ readonly cwd?: string;
2876
+ readonly home?: string;
2877
+ }
2878
+ /**
2879
+ * Why this call may not be approved, or `undefined` when the floor has no objection.
2880
+ *
2881
+ * The reason NAMES the path or the target and says which tier refused, so it is not mistaken for a
2882
+ * permissions misconfiguration — an operator who reads "denied" goes looking at their rules, and
2883
+ * would not find anything wrong with them.
2884
+ */
2885
+ declare function permissionFloorReason(toolName: string, args: Record<string, unknown> | undefined, context?: PermissionFloorContext): string | undefined;
2886
+ /** Whether `child` is inside `parent`. Kept for callers that need the containment question. */
2887
+ declare function isInside(parent: string, child: string): boolean;
2888
+
2783
2889
  /**
2784
2890
  * M7-5 — `createPermissionPlugin`: wire a {@link PermissionEngine} into the
2785
2891
  * `definePlugin` `pre_tool_call` veto seam. This is the canonical exemplar that
@@ -2850,6 +2956,63 @@ declare class PermissionPlugin {
2850
2956
  static create(engine: PermissionEngine, opts?: PermissionPluginOptions): Plugin;
2851
2957
  }
2852
2958
 
2959
+ /**
2960
+ * The permission rule LANGUAGE — a policy an operator can ship, review and diff.
2961
+ *
2962
+ * A policy could previously only be a compiled-in function. Measured: `allowedTools` and
2963
+ * `disallowedTools` returned 0 files in the agents layer, and the closest facility was
2964
+ * `CommandPolicy = (command: string) => string | null` — a code predicate. So no policy could be
2965
+ * audited, diffed, reviewed in a pull request, or varied per environment, and `Read(./.env)` — the
2966
+ * spec's own paste-ready secret-exclusion example — could not be expressed at all.
2967
+ *
2968
+ * This turns the spec's rule strings into {@link PermissionRule}s the existing engine already
2969
+ * evaluates. The engine is unchanged: first-match, fail-closed by default, explicit deny immune to
2970
+ * every auto-approve mode.
2971
+ *
2972
+ * ## The grammar, decided as a whole rather than one specifier at a time
2973
+ *
2974
+ * | Written | Matches |
2975
+ * |---|---|
2976
+ * | `Bash` | every call to `Bash` |
2977
+ * | `Bash(npm run test:*)` | the primary argument STARTS WITH `npm run test:` |
2978
+ * | `Read(path:./.env)` | the primary argument, read as a path, matches the glob |
2979
+ * | `WebFetch(domain:example.com)` | the primary argument's HOST equals `example.com` |
2980
+ * | `Bash(npm audit)` | the primary argument EQUALS `npm audit` |
2981
+ *
2982
+ * The specifier says how to read ITSELF. The alternative — knowing that `Read` means a path and
2983
+ * `WebFetch` means a URL — cannot work in a runtime where the consumer brings their own tools: a
2984
+ * rule naming a tool this SDK has never heard of must still be readable, and under a prefixed
2985
+ * grammar it is.
2986
+ *
2987
+ * WHICH argument a specifier reads is the one part that cannot be derived, so the set is DECLARED:
2988
+ * `command`, `file_path`, `path`, `url`, `query`. A tool whose argument is named something else
2989
+ * cannot be narrowed by specifier, and that limit is stated rather than guessed around. "Read
2990
+ * whichever argument is the only string" was the alternative, and it is worse: a rule would match an
2991
+ * argument the operator never named, widening an allow rule exactly as often as it narrows a deny
2992
+ * one. The escape that always works is a BARE tool name, which matches every call whatever its
2993
+ * shape.
2994
+ *
2995
+ * @public
2996
+ */
2997
+
2998
+ /** A policy as an operator writes it: three lists of rule strings. */
2999
+ interface PermissionRuleSet {
3000
+ readonly deny?: readonly string[];
3001
+ readonly ask?: readonly string[];
3002
+ readonly allow?: readonly string[];
3003
+ }
3004
+ /**
3005
+ * Parse a rule set into engine rules, DENY first.
3006
+ *
3007
+ * The engine is first-match, so the order emitted here IS the precedence — and a narrow deny must
3008
+ * survive a broad allow, or `Read` + `Read(path:./.env)` would read the secret the second line
3009
+ * exists to protect. `ask` sits between them: it is a restriction on something otherwise allowed.
3010
+ *
3011
+ * @throws ConfigurationError on a rule this grammar cannot read. A policy line an operator wrote and
3012
+ * this runtime silently ignored is the belief-in-an-absent-protection the whole tier removes.
3013
+ */
3014
+ declare function parsePermissionRules(set: PermissionRuleSet): PermissionRule[];
3015
+
2853
3016
  /**
2854
3017
  * Load a project's `.env` without letting it move the credential store or switch off a trust
2855
3018
  * decision.
@@ -4246,4 +4409,4 @@ interface WiringRecordInput<K extends string> {
4246
4409
  */
4247
4410
  declare function recordWiring<K extends string>(input: WiringRecordInput<K>): Readonly<Record<K, WiredEntity>>;
4248
4411
 
4249
- export { Agent, AgentBuilder, AgentDefinition, type AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, type BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, type CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EffectiveToolCatalog, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, type JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, type LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, McpServerConfig, Memory, MemoryId, type MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, type OTelSpan, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, type PermissionRule, Plugin, PluginsSettings, PreToolCallDecision, type Processor, Provider, type ProviderProfile, ProviderRoutingSettings, type ReadSessionMessagesOptions, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink$1 as RunEventSink, RunResult, type SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, type TelemetryHandle, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, type ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, type UnresolvedToolSource, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, decideApproval, describeAction, describeCredential, effectiveToolNames, emitRunEvent, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, planReaping, preflightCheck, readSessionMessages, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius, withCwdMutex };
4412
+ export { Agent, AgentBuilder, AgentDefinition, type AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, type BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, type CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EffectiveToolCatalog, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, type JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, type LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, type ManagedSettings, McpServerConfig, Memory, MemoryId, type MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, type OTelSpan, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionFloorContext, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, type PermissionRule, type PermissionRuleSet, Plugin, PluginsSettings, PreToolCallDecision, type Processor, Provider, type ProviderProfile, ProviderRoutingSettings, type ReadSessionMessagesOptions, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink$1 as RunEventSink, RunResult, type SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, type TelemetryHandle, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, type ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, type UnresolvedToolSource, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, decideApproval, describeAction, describeCredential, effectiveToolNames, emitRunEvent, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isInside, isValidTaskId, loadProjectEnv, managedSettingsPathFor, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, parsePermissionRules, permissionFloorReason, planReaping, preflightCheck, readManagedSettings, readSessionMessages, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius, withCwdMutex };
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 { F as RunEvent, j as CostBreakdown, at 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-CTAdRU3U.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, 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, E as RunErrorDetail, F as RunEvent, H as RunGitInfo, J as RunMemoryDegradedEvent, K as RunOperation, L as RunPermissionDeniedEvent, N as RunRateLimitEvent, Q as RunStatus, U as RunTaskCompletedEvent, V as RunTaskStartedEvent, W as RunTaskUpdatedEvent, X as RunTimelineEvent, Y as RunToCompletionOptions, Z as RunToCompletionResult, _ as RunToolProgressEvent, $ as RunTripwireEvent, a0 as SDKAssistantMessage, a1 as SDKImage, a2 as SDKImageDimension, a3 as SDKObjectDelta, a4 as SDKRequestMessage, a5 as SDKStatusMessage, a6 as SDKSystemMessage, a7 as SDKTaskMessage, a8 as SDKThinkingMessage, a9 as SDKToolUseMessage, aa as SDKUserMessage, ab as SDKUserMessageEvent, ac as SendOptions, ad as ShellCommand, ae as ShellConversationTurn, af as ShellOutput, ag as ShellOutputDeltaUpdate, ah as StepCompletedUpdate, ai as StepStartedUpdate, aj as StreamToCompletionResult, ak as SummaryCompletedUpdate, al as SummaryStartedUpdate, am as SummaryUpdate, an as TextBlock, ao as TextDeltaUpdate, ap as ThinkingCompletedUpdate, aq as ThinkingDeltaUpdate, ar as ThinkingMessage, as as TokenDeltaUpdate, at as TokenUsage, au as ToolCall, av as ToolCallCompletedUpdate, aw as ToolCallStartedUpdate, ax as ToolContextMessage, ay as ToolResult, az as ToolResultGuardOptions, aA as ToolUseBlock, aB as TurnEndedUpdate, aC as UserMessage, aD as UserMessageAppendedUpdate } from './run-CTAdRU3U.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, B as BudgetTracker, k as MemoryProvider, l as PreToolCallDecision } from './agent-Bmy2G_ml.js';
6
- export { m as ActiveMemoryPassArgs, n as ActiveMemoryPassResult, o as AgentSubagentDescription, p as AgentToolDescription, q as BudgetCheck, r as BudgetTotal, s as BudgetUsageEvent, t as BuiltinToolName, u as CloudEnv, v as CloudRepo, w as CompatSource, x as CompatSourceAdapter, y as CompatSurface, z as CreateSkillSpec, H as HookName, D as MemoryProviderAgentRef, E as MemoryProviderFactory, F as MemoryProviderHandle, J as MemoryProviderInitOptions, K as PluginContext, N as PluginHookDisposer, O as PostAssistantReplyContext, Q as PostToolCallContext, R as PreToolCallContext, T as PreUserSendContext, U as PreUserSendResult, V as ProviderTransform, W as ProviderTransformContext, X as RecordSessionSummaryArgs, Y as SessionLifecycleContext, Z as SessionRecord, _ as SessionStore, $ as SettingSource, a0 as Skill, a1 as SkillsResolver, a2 as SkillsResolverContext, a3 as SystemPromptContext, a4 as SystemPromptMemoryFact, a5 as TelemetrySettings, a6 as ToolCallSummary, a7 as ToolResultTransformContext, a8 as TransformContext } from './agent-Bmy2G_ml.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-G6g-uwcB.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 HookName, E as MemoryProviderAgentRef, F as MemoryProviderFactory, J as MemoryProviderHandle, K as MemoryProviderInitOptions, N as PluginContext, O as PluginHookDisposer, Q as PostAssistantReplyContext, R as PostToolCallContext, T as PreToolCallContext, U as PreUserSendContext, V as PreUserSendResult, W as ProviderTransform, X as ProviderTransformContext, Y as RecordSessionSummaryArgs, Z as SessionLifecycleContext, _ as SessionRecord, $ as SessionStore, a0 as SettingSource, a1 as Skill, a2 as SkillsResolver, a3 as SkillsResolverContext, a4 as SystemPromptContext, a5 as SystemPromptMemoryFact, a6 as TelemetrySettings, a7 as ToolCallSummary, a8 as ToolResultTransformContext, a9 as TransformContext } from './agent-G6g-uwcB.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-CLOAyuiv.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-CLOAyuiv.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-D4a_BR_6.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, I as InvalidateCacheOptions, k as MemoryAdapter, l as MemoryAdapterCapabilities, m as MemoryContext, n as MemoryFact, o as MemoryRevision, p as MemoryToolSchema, q as MemoryTurnMessage, r as PersonalityPreset, s as ProviderCapability, t as ProviderRoute, R as ResolvedProviderRoute, u as RunUntilIterator, v as SDKAgentPlugins, w as SDKAgentSkillDetail, x as SDKAgentSkills, y as SDKArtifact, z as SDKContextManager, B as SDKPluginMetadata, D as SDKProvidersManager, E as SystemPromptSkillRef, V as Verdict } from './sdk-agent-D4a_BR_6.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-Dcdrdv_T.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-GynWtAax.js';
14
14
  import { StepResult } from './workflow.js';
15
15
  export { Workflow, agentStep, fn } from './workflow.js';
16
16
 
@@ -1596,13 +1596,22 @@ declare class Provider {
1596
1596
  * @public
1597
1597
  */
1598
1598
 
1599
+ /**
1600
+ * What `skill_read` can read: a skill that carries its body, or one that knows where its body is.
1601
+ *
1602
+ * The tool used to take `InlineSkill` alone. A skill discovered on disk is a `Skill`, whose own
1603
+ * declaration says "the skill BODY is never included" — so it did not fit through the door at all,
1604
+ * and the entire on-disk surface was advertised to the model and unreadable by it: a `SKILL.md`
1605
+ * listed by name and description, with the instructions under the frontmatter unable to arrive.
1606
+ */
1607
+ type ReadableSkill = InlineSkill | Skill;
1599
1608
  /** SE36 — `SkillReadTool.create` replaces `defineSkillReadTool` (ADR 0015). @public *
1600
1609
  * `SkillReadTool.create` returns a **`CustomTool`** — a skill-reading tool, not a
1601
1610
  * `SkillReadTool` instance.
1602
1611
  */
1603
1612
  declare class SkillReadTool {
1604
1613
  private constructor();
1605
- static create(skills: ReadonlyArray<InlineSkill>): CustomTool;
1614
+ static create(skills: ReadonlyArray<ReadableSkill>): CustomTool;
1606
1615
  }
1607
1616
 
1608
1617
  /**
@@ -2114,6 +2123,87 @@ declare function emitRunEvent(sink: RunEventSink$1 | undefined, event: RunEvent)
2114
2123
  */
2115
2124
  declare function withCwdMutex<T>(key: string, fn: () => Promise<T>): Promise<T>;
2116
2125
 
2126
+ /**
2127
+ * What an operator may impose. One key today, and the shape is the point: each addition is a control
2128
+ * that already exists somewhere below and is being lifted into a tier the project cannot reach.
2129
+ *
2130
+ * Deliberately NOT a passthrough of arbitrary keys. A policy file whose unknown keys were carried
2131
+ * along would let an organisation believe it had imposed something this runtime never reads — the
2132
+ * exact belief-in-an-absent-protection this tier exists to remove.
2133
+ */
2134
+ interface ManagedSettings {
2135
+ /**
2136
+ * Refuse to execute the `` !`command` `` form in a skill or command body.
2137
+ *
2138
+ * A skill is a markdown file a repository can carry, and its body can run shell at expansion time.
2139
+ * Without this the only way to decline was to stop reading skills entirely.
2140
+ */
2141
+ disableSkillShellExecution?: boolean;
2142
+ /**
2143
+ * The permission posture the operator imposes on every run.
2144
+ *
2145
+ * `plan` is the one this exists for: an explore-only posture where edits are structurally refused.
2146
+ * A `createPlanModeTool` already existed and it is a tool the MODEL may call — the difference is
2147
+ * who decides. A never-prompt posture (`bypass`) is the other end, for a locked-down CI run where
2148
+ * there is nobody to ask.
2149
+ *
2150
+ * It does NOT reach the standing-grant gate. `bypass` allows what the RULES would have asked
2151
+ * about; a grant an operator recorded is not the run's to clear.
2152
+ */
2153
+ permissionMode?: "default" | "plan" | "acceptEdits" | "bypass";
2154
+ /**
2155
+ * The permission policy, as rule strings an operator writes and reviews.
2156
+ *
2157
+ * `{ "permissions": { "deny": ["Read(path:./.env)"] } }` — the spec's own paste-ready
2158
+ * secret-exclusion example, which could not be expressed at all while every policy was a compiled
2159
+ * predicate. Parsed by `parsePermissionRules` into the rules `PermissionEngine` already evaluates;
2160
+ * the engine is unchanged and keeps its fail-closed default and its immune-to-un-deny explicit
2161
+ * deny.
2162
+ */
2163
+ permissions?: {
2164
+ readonly deny?: readonly string[];
2165
+ readonly ask?: readonly string[];
2166
+ readonly allow?: readonly string[];
2167
+ };
2168
+ /**
2169
+ * Refuse to run ANY hook, whatever the project declared.
2170
+ *
2171
+ * The first control lifted, because it is the one whose absence is hardest to notice: a hook that
2172
+ * does not run looks identical to a hook that ran and approved.
2173
+ */
2174
+ disableAllHooks?: boolean;
2175
+ }
2176
+ /**
2177
+ * Where the platform keeps its managed settings.
2178
+ *
2179
+ * `root` exists so the precedence rule is testable: the real directories are platform-owned and a
2180
+ * test must not write to `/etc`. Hard-coding the path inside the reader would make the thing that
2181
+ * actually matters — that a project cannot override this file — unreachable by any test not running
2182
+ * as root.
2183
+ *
2184
+ * The paths are Claude Code's own, because the file is Claude Code's format: an organisation that
2185
+ * already deployed one should not have to deploy a second copy under a different name to get the
2186
+ * same policy honoured here.
2187
+ */
2188
+ declare function managedSettingsPathFor(root?: string): string;
2189
+ /**
2190
+ * Read the deployed policy, or `{}` when none is.
2191
+ *
2192
+ * Absent is the ordinary case and not an error — most machines have no operator tier, and a reader
2193
+ * that failed without one would make the feature a prerequisite for running at all.
2194
+ *
2195
+ * A file that EXISTS and cannot be read is different, and says so — through `diagFailure`, not
2196
+ * `diag`. `diag` returns immediately when no sink is installed, and most consumers never install
2197
+ * one: an organisation that deployed a policy with a typo in it would get complete silence, which is
2198
+ * the same defect this repository just fixed for dropped hook events. A policy channel that is
2199
+ * silent by default reports nothing about the one thing the tier exists to make certain. An organisation that deployed a
2200
+ * policy and got silence would believe it applied; that belief is what this tier removes.
2201
+ *
2202
+ * SYNC for the same reason `readCompatConfigFile` is: the caller resolves this before any submanager
2203
+ * exists to await a promise, and a once-per-agent read of one small file is the same class of work.
2204
+ */
2205
+ declare function readManagedSettings(root?: string): ManagedSettings;
2206
+
2117
2207
  /**
2118
2208
  * Reference `MemoryProvider` impl — no-op fallback (SDK 2.0 Phase 1 /
2119
2209
  * T1.2 reference implementation, mirrors `createCounterBudgetTracker`).
@@ -2780,6 +2870,22 @@ declare class PermissionEngine {
2780
2870
  evaluate(toolName: string, args?: Record<string, unknown>, mode?: PermissionMode): PermissionAction;
2781
2871
  }
2782
2872
 
2873
+ /** Where the floor is anchored. Defaults to the real environment; overridable so it is testable. */
2874
+ interface PermissionFloorContext {
2875
+ readonly cwd?: string;
2876
+ readonly home?: string;
2877
+ }
2878
+ /**
2879
+ * Why this call may not be approved, or `undefined` when the floor has no objection.
2880
+ *
2881
+ * The reason NAMES the path or the target and says which tier refused, so it is not mistaken for a
2882
+ * permissions misconfiguration — an operator who reads "denied" goes looking at their rules, and
2883
+ * would not find anything wrong with them.
2884
+ */
2885
+ declare function permissionFloorReason(toolName: string, args: Record<string, unknown> | undefined, context?: PermissionFloorContext): string | undefined;
2886
+ /** Whether `child` is inside `parent`. Kept for callers that need the containment question. */
2887
+ declare function isInside(parent: string, child: string): boolean;
2888
+
2783
2889
  /**
2784
2890
  * M7-5 — `createPermissionPlugin`: wire a {@link PermissionEngine} into the
2785
2891
  * `definePlugin` `pre_tool_call` veto seam. This is the canonical exemplar that
@@ -2850,6 +2956,63 @@ declare class PermissionPlugin {
2850
2956
  static create(engine: PermissionEngine, opts?: PermissionPluginOptions): Plugin;
2851
2957
  }
2852
2958
 
2959
+ /**
2960
+ * The permission rule LANGUAGE — a policy an operator can ship, review and diff.
2961
+ *
2962
+ * A policy could previously only be a compiled-in function. Measured: `allowedTools` and
2963
+ * `disallowedTools` returned 0 files in the agents layer, and the closest facility was
2964
+ * `CommandPolicy = (command: string) => string | null` — a code predicate. So no policy could be
2965
+ * audited, diffed, reviewed in a pull request, or varied per environment, and `Read(./.env)` — the
2966
+ * spec's own paste-ready secret-exclusion example — could not be expressed at all.
2967
+ *
2968
+ * This turns the spec's rule strings into {@link PermissionRule}s the existing engine already
2969
+ * evaluates. The engine is unchanged: first-match, fail-closed by default, explicit deny immune to
2970
+ * every auto-approve mode.
2971
+ *
2972
+ * ## The grammar, decided as a whole rather than one specifier at a time
2973
+ *
2974
+ * | Written | Matches |
2975
+ * |---|---|
2976
+ * | `Bash` | every call to `Bash` |
2977
+ * | `Bash(npm run test:*)` | the primary argument STARTS WITH `npm run test:` |
2978
+ * | `Read(path:./.env)` | the primary argument, read as a path, matches the glob |
2979
+ * | `WebFetch(domain:example.com)` | the primary argument's HOST equals `example.com` |
2980
+ * | `Bash(npm audit)` | the primary argument EQUALS `npm audit` |
2981
+ *
2982
+ * The specifier says how to read ITSELF. The alternative — knowing that `Read` means a path and
2983
+ * `WebFetch` means a URL — cannot work in a runtime where the consumer brings their own tools: a
2984
+ * rule naming a tool this SDK has never heard of must still be readable, and under a prefixed
2985
+ * grammar it is.
2986
+ *
2987
+ * WHICH argument a specifier reads is the one part that cannot be derived, so the set is DECLARED:
2988
+ * `command`, `file_path`, `path`, `url`, `query`. A tool whose argument is named something else
2989
+ * cannot be narrowed by specifier, and that limit is stated rather than guessed around. "Read
2990
+ * whichever argument is the only string" was the alternative, and it is worse: a rule would match an
2991
+ * argument the operator never named, widening an allow rule exactly as often as it narrows a deny
2992
+ * one. The escape that always works is a BARE tool name, which matches every call whatever its
2993
+ * shape.
2994
+ *
2995
+ * @public
2996
+ */
2997
+
2998
+ /** A policy as an operator writes it: three lists of rule strings. */
2999
+ interface PermissionRuleSet {
3000
+ readonly deny?: readonly string[];
3001
+ readonly ask?: readonly string[];
3002
+ readonly allow?: readonly string[];
3003
+ }
3004
+ /**
3005
+ * Parse a rule set into engine rules, DENY first.
3006
+ *
3007
+ * The engine is first-match, so the order emitted here IS the precedence — and a narrow deny must
3008
+ * survive a broad allow, or `Read` + `Read(path:./.env)` would read the secret the second line
3009
+ * exists to protect. `ask` sits between them: it is a restriction on something otherwise allowed.
3010
+ *
3011
+ * @throws ConfigurationError on a rule this grammar cannot read. A policy line an operator wrote and
3012
+ * this runtime silently ignored is the belief-in-an-absent-protection the whole tier removes.
3013
+ */
3014
+ declare function parsePermissionRules(set: PermissionRuleSet): PermissionRule[];
3015
+
2853
3016
  /**
2854
3017
  * Load a project's `.env` without letting it move the credential store or switch off a trust
2855
3018
  * decision.
@@ -4246,4 +4409,4 @@ interface WiringRecordInput<K extends string> {
4246
4409
  */
4247
4410
  declare function recordWiring<K extends string>(input: WiringRecordInput<K>): Readonly<Record<K, WiredEntity>>;
4248
4411
 
4249
- export { Agent, AgentBuilder, AgentDefinition, type AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, type BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, type CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EffectiveToolCatalog, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, type JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, type LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, McpServerConfig, Memory, MemoryId, type MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, type OTelSpan, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, type PermissionRule, Plugin, PluginsSettings, PreToolCallDecision, type Processor, Provider, type ProviderProfile, ProviderRoutingSettings, type ReadSessionMessagesOptions, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink$1 as RunEventSink, RunResult, type SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, type TelemetryHandle, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, type ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, type UnresolvedToolSource, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, decideApproval, describeAction, describeCredential, effectiveToolNames, emitRunEvent, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isValidTaskId, loadProjectEnv, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, planReaping, preflightCheck, readSessionMessages, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius, withCwdMutex };
4412
+ export { Agent, AgentBuilder, AgentDefinition, type AgentDescription, AgentFactory, AgentOperationOptions, AgentOptions, type AgentPromptResult, type AgentRegistryOptions, type ApprovalDecision, type ApprovalInput, type ApprovalMode, type ApprovalOutcome, type ApprovalReason, type BatchItem, type BatchOptions, type BatchProgress, type BatchResult, type BlastRadiusDecision, type BlastRadiusInput, type BlastRadiusOutcome, type BlastRadiusReason, Budget, BudgetHandle, BudgetOptions, BudgetSnapshot, type BudgetTracker, CloudOptions, ContextSettings, type CounterBudgetTrackerOptions, type CredentialInput, type CredentialReport, type CustomTool, type DeclaredAction, type DeclaredLayer, type DeepPartial, type DefineProviderOptions, type DefineToolSpec, type DiagnosticsSink, type DreamingSweepOptions, type DreamingSweepResult, type EffectiveToolCatalog, type EnvOptOut, type EnvReachabilityAudit, type EnvReachabilityInput, ErrorMetadata, EventBus, type EvictReason, GOAL_CONTINUATION_MARKER, GenerateObjectError, type GenerateObjectOptions, type GenerateObjectResult, GetAgentOptions, GetRunOptions, GoalEvent, type GoalLoopAgent, GoalOptions, GoalResult, InlineSkill, JobQueue, type JobQueueOptions, JudgeCredentialError, type JudgeResult, type KeepReason, type KeptArtifact, LayerOrderError, type LayerValues, ListAgentsOptions, ListResult, ListRunsOptions, type LiveAgentRegistry, LiveSessionError, type LiveSessionReason, LocalOptions, type ManagedSettings, McpServerConfig, Memory, MemoryId, type MemoryProvider, MemorySettings, type MigrateOptions, type MigrateResult, type ModelListItem, type ModelParameterDefinition, ModelSelection, type ModelVariant, NoopMemoryProvider, type NormalizedJsonSchema, type OTelSpan, type PermissionAction, PermissionEngine, type PermissionEngineOptions, type PermissionFloorContext, type PermissionGate, type PermissionGateContext, type PermissionGateDecision, PermissionMode, PermissionPlugin, type PermissionPluginOptions, type PermissionRule, type PermissionRuleSet, Plugin, PluginsSettings, PreToolCallDecision, type Processor, Provider, type ProviderProfile, ProviderRoutingSettings, type ReadSessionMessagesOptions, type ReapPlan, type ReapPlanInput, type ReapableArtifact, type RetentionPolicy, RetentionPolicyError, Run, RunEventSink$1 as RunEventSink, RunResult, type SDKAgent, SDKAgentInfo, SDKMessage, type SDKModel, SDKProvider, type SDKRepository, type SDKUser, SOVEREIGN_ENV_KEYS, Security, type SecurityFloorInput, type SessionMessage, type SessionMessagePart, type SessionScope, type ShareGptMessage, type ShareGptTrajectory, SkillReadTool, SkillsSettings, type SovereignEnvKey, Squad, type SquadOptions, type SquadRun, StreamObjectError, type StreamObjectEvent, type StreamObjectOptions, SystemPromptResolver, TASK_RESERVED_PREFIXES, Task, type TaskCancelResult, type TaskConfigureOptions, type TaskEvent, type TaskFilter, type TaskHandle, type TaskKind, type TaskState, type TaskStoreOptions, type TaskSubmitOptions, type TaskWorkContext, type TaskWorkFn, type TelemetryHandle, Theokit, TheokitAgentError, type TheokitRequestOptions, TokenLimiter, type TokenLimiterOptions, Tool, ToolError, type ToolResultContentBlock, type TrustLevel, type TrustPosture, type TrustPostureInput, type TrustSource, UngatedCapabilityError, UnicodeNormalizer, type UnicodeNormalizerOptions, type UnresolvedToolSource, UsageAccumulator, type WiredEntity, type WiringRecordInput, type WithBlastRadius, applyMode, applySecurityFloor, auditEnvReachability, chargeAndCheckThresholds, computeCost, createCounterBudgetTracker, decideApproval, describeAction, describeCredential, effectiveToolNames, emitRunEvent, estimateTokens, evaluateBlastRadius, extractRawId, foldLayers, getPricingEntry, guardSessionDestruction, inferApiMode, isInside, isValidTaskId, loadProjectEnv, managedSettingsPathFor, migrateSqliteToLance, mkMemoryId, normalizeSchema, normalizeUsage, parsePermissionRules, permissionFloorReason, planReaping, preflightCheck, readManagedSettings, readSessionMessages, recordWiring, resolveTrustPosture, runGoalLoop, scopedConversationId, sessionScopePrefix, setDiagnosticsSink, toShareGptTrajectory, verifyLayerOrdering, withBlastRadius, withCwdMutex };