@theokit/sdk 3.2.3 → 3.3.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.
@@ -1,6 +1,6 @@
1
1
  import * as zod from 'zod';
2
2
  import { ZodType } from 'zod';
3
- import { C as CustomTool, M as ModelSelection, a7 as SDKUserMessage, a9 as SendOptions, b as Run, G as GenerateOptions, k as GenerateRunResult, V as RunToCompletionOptions, W as RunToCompletionResult, S as SDKMessage, ag as StreamToCompletionResult, a as McpServerConfig, P as Processor, r as MessageOrigin } from './run-CrHz9BAP.js';
3
+ import { C as CustomTool, c as PermissionMode, M as ModelSelection, ac as SDKUserMessage, ae as SendOptions, b as Run, G as GenerateOptions, m as GenerateRunResult, _ as RunToCompletionOptions, $ as RunToCompletionResult, S as SDKMessage, al as StreamToCompletionResult, a as McpServerConfig, P as Processor, t as MessageOrigin } from './run-CL5Rw6a5.cjs';
4
4
 
5
5
  /**
6
6
  * Fork primitive public type contracts (T1.2, ADRs D110-D114).
@@ -1100,6 +1100,13 @@ interface PreToolCallContext {
1100
1100
  args: Record<string, unknown>;
1101
1101
  agentId: string;
1102
1102
  runId: string;
1103
+ /**
1104
+ * SE1 — the run's resolved `PermissionMode` (from `SendOptions.permissionMode`
1105
+ * ?? `AgentOptions.permissionMode`), threaded so a permission-style plugin can
1106
+ * gate per-run rather than at construction time. Absent ⇒ the plugin's own
1107
+ * default applies. Ignored by non-permission plugins.
1108
+ */
1109
+ permissionMode?: PermissionMode;
1103
1110
  }
1104
1111
  interface PreToolCallDecision {
1105
1112
  block: true;
@@ -1563,6 +1570,13 @@ interface AgentOptions {
1563
1570
  * The two forms are mutually exclusive — pass one or the other.
1564
1571
  */
1565
1572
  plugins?: PluginsSettings | readonly Plugin[];
1573
+ /**
1574
+ * SE1 — the default permission mode for this agent's runs, threaded to a
1575
+ * registered `PermissionPlugin`'s pre-tool gate. A per-send
1576
+ * `SendOptions.permissionMode` overrides it. Absent ⇒ the plugin's own
1577
+ * construction-time mode applies. Local runtime.
1578
+ */
1579
+ permissionMode?: PermissionMode;
1566
1580
  /**
1567
1581
  * Skills configuration. Either a static {@link SkillsSettings} object or —
1568
1582
  * SE22 — a {@link SkillsResolver} evaluated per `send()` to pick skills from
@@ -1,6 +1,6 @@
1
1
  import * as zod from 'zod';
2
2
  import { ZodType } from 'zod';
3
- import { C as CustomTool, M as ModelSelection, a7 as SDKUserMessage, a9 as SendOptions, b as Run, G as GenerateOptions, k as GenerateRunResult, V as RunToCompletionOptions, W as RunToCompletionResult, S as SDKMessage, ag as StreamToCompletionResult, a as McpServerConfig, P as Processor, r as MessageOrigin } from './run-CrHz9BAP.cjs';
3
+ import { C as CustomTool, c as PermissionMode, M as ModelSelection, ac as SDKUserMessage, ae as SendOptions, b as Run, G as GenerateOptions, m as GenerateRunResult, _ as RunToCompletionOptions, $ as RunToCompletionResult, S as SDKMessage, al as StreamToCompletionResult, a as McpServerConfig, P as Processor, t as MessageOrigin } from './run-CL5Rw6a5.js';
4
4
 
5
5
  /**
6
6
  * Fork primitive public type contracts (T1.2, ADRs D110-D114).
@@ -1100,6 +1100,13 @@ interface PreToolCallContext {
1100
1100
  args: Record<string, unknown>;
1101
1101
  agentId: string;
1102
1102
  runId: string;
1103
+ /**
1104
+ * SE1 — the run's resolved `PermissionMode` (from `SendOptions.permissionMode`
1105
+ * ?? `AgentOptions.permissionMode`), threaded so a permission-style plugin can
1106
+ * gate per-run rather than at construction time. Absent ⇒ the plugin's own
1107
+ * default applies. Ignored by non-permission plugins.
1108
+ */
1109
+ permissionMode?: PermissionMode;
1103
1110
  }
1104
1111
  interface PreToolCallDecision {
1105
1112
  block: true;
@@ -1563,6 +1570,13 @@ interface AgentOptions {
1563
1570
  * The two forms are mutually exclusive — pass one or the other.
1564
1571
  */
1565
1572
  plugins?: PluginsSettings | readonly Plugin[];
1573
+ /**
1574
+ * SE1 — the default permission mode for this agent's runs, threaded to a
1575
+ * registered `PermissionPlugin`'s pre-tool gate. A per-send
1576
+ * `SendOptions.permissionMode` overrides it. Absent ⇒ the plugin's own
1577
+ * construction-time mode applies. Local runtime.
1578
+ */
1579
+ permissionMode?: PermissionMode;
1566
1580
  /**
1567
1581
  * Skills configuration. Either a static {@link SkillsSettings} object or —
1568
1582
  * SE22 — a {@link SkillsResolver} evaluated per `send()` to pick skills from
package/dist/cron.cjs CHANGED
@@ -9006,7 +9006,9 @@ async function vetoFromPluginPreHook(inputs, call, callId, events) {
9006
9006
  name: call.name,
9007
9007
  args: call.input,
9008
9008
  agentId: inputs.agentId,
9009
- runId: inputs.runId
9009
+ runId: inputs.runId,
9010
+ // SE1 — thread the run's permission mode so a PermissionPlugin gates per-run.
9011
+ ...inputs.permissionMode !== void 0 ? { permissionMode: inputs.permissionMode } : {}
9010
9012
  });
9011
9013
  if (pluginVeto === void 0) return void 0;
9012
9014
  emitRunEvent(inputs.runEventSink, {
@@ -13417,6 +13419,10 @@ function buildLoopInputs(options, runId, userText) {
13417
13419
  ...options.onDelta !== void 0 ? { onDelta: options.onDelta } : {},
13418
13420
  ...options.sendOptions.toolChoice !== void 0 ? { toolChoice: options.sendOptions.toolChoice } : {},
13419
13421
  ...options.sendOptions.activeTools !== void 0 ? { activeTools: options.sendOptions.activeTools } : {},
13422
+ // SE1 — resolve the run's permission mode: per-send wins over creation-time.
13423
+ ...(options.sendOptions.permissionMode ?? options.agentOptions.permissionMode) !== void 0 ? {
13424
+ permissionMode: options.sendOptions.permissionMode ?? options.agentOptions.permissionMode
13425
+ } : {},
13420
13426
  ...options.priorMessages !== void 0 ? { priorMessages: options.priorMessages } : {},
13421
13427
  ...options.memoryTools !== void 0 && options.memoryTools.length > 0 ? { memoryTools: options.memoryTools } : {},
13422
13428
  ...buildCustomToolsInput(