@theokit/agents 7.5.0 → 8.0.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 (59) hide show
  1. package/dist/{agent-handle-BX4oFqfb.d.ts → agent-handle-Dgi4ZGbg.d.ts} +11 -1
  2. package/dist/ask.d.ts +190 -0
  3. package/dist/ask.js +167 -0
  4. package/dist/ask.js.map +1 -0
  5. package/dist/auth.d.ts +96 -2
  6. package/dist/auth.js +85 -1
  7. package/dist/auth.js.map +1 -1
  8. package/dist/{bridge-entry-Z8GjrwH4.d.ts → bridge-entry-BEniSXWE.d.ts} +228 -609
  9. package/dist/bridge.d.ts +6 -3
  10. package/dist/bridge.js +18 -6
  11. package/dist/chunk-4VHCH6IZ.js +181 -0
  12. package/dist/chunk-4VHCH6IZ.js.map +1 -0
  13. package/dist/{chunk-WKBZZQBO.js → chunk-C7UXZWVY.js} +168 -177
  14. package/dist/chunk-C7UXZWVY.js.map +1 -0
  15. package/dist/{chunk-2BAFKRXT.js → chunk-M6HMASZC.js} +9 -4
  16. package/dist/chunk-M6HMASZC.js.map +1 -0
  17. package/dist/client-react.d.ts +2 -1
  18. package/dist/client-react.js +1 -1
  19. package/dist/client.d.ts +3 -2
  20. package/dist/client.js +1 -1
  21. package/dist/commands.d.ts +120 -0
  22. package/dist/commands.js +145 -0
  23. package/dist/commands.js.map +1 -0
  24. package/dist/define-agent-3Kuf6iKM.d.ts +633 -0
  25. package/dist/doctor.d.ts +119 -0
  26. package/dist/doctor.js +84 -0
  27. package/dist/doctor.js.map +1 -0
  28. package/dist/hook-handlers-Cw2FsnE5.d.ts +56 -0
  29. package/dist/hooks.d.ts +225 -0
  30. package/dist/hooks.js +286 -0
  31. package/dist/hooks.js.map +1 -0
  32. package/dist/index.d.ts +170 -26
  33. package/dist/index.js +105 -20
  34. package/dist/index.js.map +1 -1
  35. package/dist/mcp-health.d.ts +69 -0
  36. package/dist/mcp-health.js +42 -0
  37. package/dist/mcp-health.js.map +1 -0
  38. package/dist/persistence.d.ts +1 -1
  39. package/dist/persistence.js +4 -0
  40. package/dist/persistence.js.map +1 -1
  41. package/dist/sandbox.d.ts +1 -1
  42. package/dist/sandbox.js +29 -2
  43. package/dist/sandbox.js.map +1 -1
  44. package/dist/session.d.ts +238 -0
  45. package/dist/session.js +338 -0
  46. package/dist/session.js.map +1 -0
  47. package/dist/testing.d.ts +90 -1
  48. package/dist/testing.js +76 -1
  49. package/dist/testing.js.map +1 -1
  50. package/dist/tool-scope.d.ts +133 -0
  51. package/dist/tool-scope.js +61 -0
  52. package/dist/tool-scope.js.map +1 -0
  53. package/dist/tools.js.map +1 -1
  54. package/dist/usage.d.ts +98 -0
  55. package/dist/usage.js +55 -0
  56. package/dist/usage.js.map +1 -0
  57. package/package.json +37 -12
  58. package/dist/chunk-2BAFKRXT.js.map +0 -1
  59. package/dist/chunk-WKBZZQBO.js.map +0 -1
package/dist/bridge.d.ts CHANGED
@@ -1,7 +1,10 @@
1
- export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, f as AgentManifestEntry, p as AgentManifestSource, q as AgentManifestTool, t as AgentRoute, u as AgentRouteContext, v as AgentRunInfo, w as AgentStreamEvent, x as AgentTurnMetadata, y as AgentsPluginOptions, z as ApiErrorContext, B as ApiErrorDecision, E as ApiErrorPolicy, h as ApprovalPosture, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, Q as CheckpointSavedEvent, C as CompiledAgentOptions, U as CompiledContextWindow, a as CompiledTool, V as ContextualTool, Y as DefineAgentConfig, Z as DefinitionOrThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, D as DelegationResult, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ai as McpApprovalSpec, aj as McpFileError, ak as McpRegistryConfig, al as McpRequestContext, am as McpSelection, ao as PartialToolCallEvent, aq as ProcessInputContext, au as RunStartedEvent, av as ScoreVerdict, aw as ScoredDelegation, ax as Scorer, ay as SdkAgentHandle, az as SdkMessage, aA as SdkSendOptions, aB as SdkTurnHandle, aC as Segment, aF as StateUpdateEvent, S as StreamEvent, aG as TextDeltaEvent, aH as ThinkingEvent, aJ as ToolCallEvent, aK as ToolCallVeto, aL as ToolHooks, aM as ToolHooksPlugin, aN as ToolResultEvent, aO as ToolWalkResult, aQ as ToolboxWalkResult, aR as agentsPlugin, aS as buildModelSelection, aT as compileAgentDefinition, aU as compileAgentModule, aV as compileContextWindow, aW as compileProjectContext, aX as compileSkills, aY as compileTools, aZ as createAgentExecutionContext, a_ as createApiErrorHandler, a$ as createSdkAgentStream, b0 as createThinkTagExtractor, b1 as createToolHooksPlugin, b2 as delegate, b3 as delegateBackground, b4 as delegateWithScoring, b5 as extractThinkTagStream, b6 as generateAgentManifest, b7 as generateAgentRoutes, b8 as isAgentContext, b9 as isAgentDefinition, ba as isApprovalRequired, bb as isDone, bc as isError, bd as isPartialToolCall, be as isTextDelta, bf as isToolCall, bg as isToolResult, bi as loadMcpJson, bk as mcpRegistry, bl as mcpToolApprovals, bn as presentUIMessageStream, bo as projectContextMetadataOnlyKnobs, bp as reasoningEffortOf, bt as resolveMcpServers, bu as runWithApiErrorHandling, bv as streamAgentResponse, s as streamAgentUIMessages, bw as toAgentFactory, bx as translateSdkEvent } from './bridge-entry-Z8GjrwH4.js';
1
+ export { d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, A as AgentManifestEntry, i as AgentManifestSource, j as AgentManifestTool, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentStreamEvent, o as AgentTurnMetadata, p as AgentsPluginOptions, q as ApiErrorContext, r as ApiErrorDecision, t as ApiErrorPolicy, c as ApprovalPosture, u as ApprovalRequiredEvent, v as ArtifactChunkEvent, w as ArtifactStartEvent, B as BackgroundDelegation, x as BeforeToolCallContext, y as BudgetExceededError, z as CheckpointSavedEvent, E as CompiledContextWindow, F as ContextualTool, I as DefinitionOrThunk, J as DelegateFn, K as DelegateOptions, M as DelegationBudgetExceededError, N as DelegationError, O as DelegationPort, D as DelegationResult, P as DelegationTarget, Q as DelegationTimeoutError, T as DoneEvent, U as EphemeralAgent, V as ErrorEvent, W as FileEditEvent, X as IterationEvent, Y as LLMCallContext, a0 as McpApprovalSpec, a1 as McpFileError, a2 as McpRegistryConfig, a3 as McpRequestContext, a4 as McpSelection, a5 as PartialToolCallEvent, a6 as ProcessInputContext, aa as RunStartedEvent, ab as ScoreVerdict, ac as ScoredDelegation, ad as Scorer, ae as SdkAgentHandle, af as SdkMessage, ag as SdkSendOptions, ah as SdkTurnHandle, ai as Segment, aj as StateUpdateEvent, S as StreamEvent, ak as TextDeltaEvent, al as ThinkingEvent, am as ToolCallEvent, an as ToolCallVeto, ao as ToolHooks, ap as ToolHooksPlugin, aq as ToolResultEvent, ar as agentsPlugin, as as buildModelSelection, at as compileAgentModule, au as compileContextWindow, av as compileProjectContext, aw as compileSkills, ax as createAgentExecutionContext, ay as createApiErrorHandler, az as createSdkAgentStream, aA as createThinkTagExtractor, aB as createToolHooksPlugin, aC as delegate, aD as delegateBackground, aE as delegateWithScoring, aF as extractThinkTagStream, aG as generateAgentManifest, aH as generateAgentRoutes, aI as isAgentContext, aJ as isApprovalRequired, aK as isDone, aL as isError, aM as isPartialToolCall, aN as isTextDelta, aO as isToolCall, aP as isToolResult, aR as loadMcpJson, aT as mcpRegistry, aU as mcpToolApprovals, aW as presentUIMessageStream, aX as projectContextMetadataOnlyKnobs, aY as reasoningEffortOf, a$ as resolveMcpServers, b0 as runWithApiErrorHandling, b1 as streamAgentResponse, s as streamAgentUIMessages, b2 as toAgentFactory, b3 as translateSdkEvent, b4 as withClockCap, b5 as withEphemeralAgent } from './bridge-entry-BEniSXWE.js';
2
+ export { c as AGENT_BRAND, A as AgentDefinition, C as CompiledAgentOptions, a as CompiledTool, D as DefineAgentConfig, I as InferAgentInput, j as InferAgentToolNames, m as ProjectSettingsGrant, n as SettingSourceCapability, S as SettingSourcesSelection, r as ToolWalkResult, t as ToolboxWalkResult, U as UntrustedSettingSourceError, u as compileAgentDefinition, v as compileTools, w as isAgentDefinition, y as resolveSettingSources } from './define-agent-3Kuf6iKM.js';
2
3
  import '@theokit/http';
3
4
  import '@theokit/sdk';
4
- import 'zod';
5
+ import '@theokit/sdk/sandbox';
5
6
  import '@theokit/presenter/wire';
6
- import '@theokit/sdk/retry';
7
+ import 'zod';
8
+ import './hook-handlers-Cw2FsnE5.js';
7
9
  import '@theokit/sdk/errors';
10
+ import '@theokit/sdk/retry';
package/dist/bridge.js CHANGED
@@ -1,15 +1,14 @@
1
1
  import {
2
- AGENT_BRAND,
3
2
  AgentBuilder,
4
3
  AgentDefinitionError,
5
4
  BudgetExceededError,
6
5
  ContextualTool,
7
6
  DelegationBudgetExceededError,
8
7
  DelegationError,
8
+ DelegationTimeoutError,
9
9
  McpFileError,
10
10
  agentsPlugin,
11
11
  buildModelSelection,
12
- compileAgentDefinition,
13
12
  compileAgentModule,
14
13
  compileContextWindow,
15
14
  compileProjectContext,
@@ -27,7 +26,6 @@ import {
27
26
  generateAgentManifest,
28
27
  generateAgentRoutes,
29
28
  isAgentContext,
30
- isAgentDefinition,
31
29
  isApprovalRequired,
32
30
  isDone,
33
31
  isError,
@@ -46,8 +44,17 @@ import {
46
44
  streamAgentResponse,
47
45
  streamAgentUIMessages,
48
46
  toAgentFactory,
49
- translateSdkEvent
50
- } from "./chunk-WKBZZQBO.js";
47
+ translateSdkEvent,
48
+ withClockCap,
49
+ withEphemeralAgent
50
+ } from "./chunk-C7UXZWVY.js";
51
+ import {
52
+ AGENT_BRAND,
53
+ UntrustedSettingSourceError,
54
+ compileAgentDefinition,
55
+ isAgentDefinition,
56
+ resolveSettingSources
57
+ } from "./chunk-4VHCH6IZ.js";
51
58
  import "./chunk-Z4QWC7IK.js";
52
59
  export {
53
60
  AGENT_BRAND,
@@ -57,7 +64,9 @@ export {
57
64
  ContextualTool,
58
65
  DelegationBudgetExceededError,
59
66
  DelegationError,
67
+ DelegationTimeoutError,
60
68
  McpFileError,
69
+ UntrustedSettingSourceError,
61
70
  agentsPlugin,
62
71
  buildModelSelection,
63
72
  compileAgentDefinition,
@@ -93,10 +102,13 @@ export {
93
102
  projectContextMetadataOnlyKnobs,
94
103
  reasoningEffortOf,
95
104
  resolveMcpServers,
105
+ resolveSettingSources,
96
106
  runWithApiErrorHandling,
97
107
  streamAgentResponse,
98
108
  streamAgentUIMessages,
99
109
  toAgentFactory,
100
- translateSdkEvent
110
+ translateSdkEvent,
111
+ withClockCap,
112
+ withEphemeralAgent
101
113
  };
102
114
  //# sourceMappingURL=bridge.js.map
@@ -0,0 +1,181 @@
1
+ import {
2
+ __name
3
+ } from "./chunk-Z4QWC7IK.js";
4
+
5
+ // src/bridge/setting-sources-gate.ts
6
+ import { TheokitAgentError } from "@theokit/sdk/errors";
7
+ var UntrustedSettingSourceError = class extends TheokitAgentError {
8
+ static {
9
+ __name(this, "UntrustedSettingSourceError");
10
+ }
11
+ trustSource;
12
+ capability;
13
+ name = "UntrustedSettingSourceError";
14
+ constructor(message, trustSource, capability) {
15
+ super(message), this.trustSource = trustSource, this.capability = capability;
16
+ }
17
+ };
18
+ function resolveSettingSources(selection) {
19
+ if (selection === void 0) return [];
20
+ const sources = [];
21
+ if (selection.user === true) sources.push("user");
22
+ const grant = selection.project;
23
+ if (grant !== void 0) {
24
+ const posture = grant.trustedBy;
25
+ if (!posture.allows.projectSettings) {
26
+ throw new UntrustedSettingSourceError(`the \`project\` setting source reads <cwd>/.theokit/ \u2014 including shell-executing hooks \u2014 and the posture does not grant \`projectSettings\` (level: ${posture.level}, decided by: ${posture.source}). Grant it with a trusted posture, or omit \`project\` to read only the operator's own ~/.theokit/.`, posture.source, "projectSettings");
27
+ }
28
+ sources.push("project");
29
+ }
30
+ return sources;
31
+ }
32
+ __name(resolveSettingSources, "resolveSettingSources");
33
+
34
+ // src/bridge/define-agent.ts
35
+ var AGENT_BRAND = /* @__PURE__ */ Symbol.for("theokit.agent.definition");
36
+ function defineAgent(config) {
37
+ return {
38
+ ...config,
39
+ [AGENT_BRAND]: true
40
+ };
41
+ }
42
+ __name(defineAgent, "defineAgent");
43
+ function isAgentDefinition(value) {
44
+ return typeof value === "object" && value !== null && value[AGENT_BRAND] === true;
45
+ }
46
+ __name(isAgentDefinition, "isAgentDefinition");
47
+ function toCompiledTool(tool) {
48
+ const handler = tool.handler;
49
+ const compiled = {
50
+ name: tool.name,
51
+ description: tool.description,
52
+ inputSchema: tool.inputSchema,
53
+ handler: /* @__PURE__ */ __name((input, ctx) => handler(input, ctx), "handler")
54
+ };
55
+ for (const sym of Object.getOwnPropertySymbols(tool)) {
56
+ ;
57
+ compiled[sym] = tool[sym];
58
+ }
59
+ return compiled;
60
+ }
61
+ __name(toCompiledTool, "toCompiledTool");
62
+ function compileAgentDefinition(def) {
63
+ return {
64
+ model: def.model,
65
+ reasoningEffort: def.reasoningEffort,
66
+ systemPrompt: def.system,
67
+ tools: (def.tools ?? []).map(toCompiledTool),
68
+ agents: {},
69
+ stream: true,
70
+ // M7 — run-context flows to CompiledAgentOptions.runContext (distinct from the
71
+ // context-window `context` field the decorator path uses); absent ⇒ no key.
72
+ ...def.context !== void 0 ? {
73
+ runContext: def.context
74
+ } : {},
75
+ // M9 — guardrails flow through unchanged; the runner applies them at the input boundary.
76
+ ...def.guardrails !== void 0 ? {
77
+ guardrails: def.guardrails
78
+ } : {},
79
+ // M14 — HITL approvals compile into the same `hitl` map the decorator path produces.
80
+ ...def.approvals !== void 0 ? {
81
+ hitl: compileApprovals(def)
82
+ } : {},
83
+ // M13 — skills: a static list → SDK skills.enabled; a resolver → carried for the request path.
84
+ ...compileSkillsSelection(def.skills),
85
+ // theokit-file-based-config + M68 — the selection is resolved HERE, at the earliest point every
86
+ // authoring path converges on, so `CompiledAgentOptions.settingSources` can only ever hold
87
+ // roots that some posture authorized. Refusing at compile time rather than at run assembly is
88
+ // `error-handling.md` § 3: validate at the entry, fail before the value travels.
89
+ ...def.settingSources !== void 0 ? {
90
+ settingSources: resolveSettingSources(def.settingSources)
91
+ } : {},
92
+ // M49 — memory flows to the projection layer; `assembleM8CreateOptions` forwards it to Agent.create.
93
+ ...def.memory !== void 0 ? {
94
+ memory: def.memory
95
+ } : {},
96
+ // Hooks are converted here — the layer EVERY path converges on — rather than on the builder, so
97
+ // `defineAgent({ hooks })` cannot type-check and silently no-op. A lifecycle hook that is
98
+ // declared but never registered is a security gate that does not gate.
99
+ ...compileHooksAndPlugins(def),
100
+ // MCP — builder/`defineAgent` servers converge on the same `mcpServers` field the `@MCP`
101
+ // decorator path populates; the SDK adapter forwards it to `Agent.create({ mcpServers })`.
102
+ ...def.mcpServers !== void 0 ? {
103
+ mcpServers: def.mcpServers
104
+ } : {}
105
+ };
106
+ }
107
+ __name(compileAgentDefinition, "compileAgentDefinition");
108
+ function compileHooksAndPlugins(def) {
109
+ const map = def.hooks;
110
+ const entries = Object.entries(map ?? {}).filter(([, h]) => typeof h === "function");
111
+ const explicit = def.plugins ?? [];
112
+ if (entries.length === 0) {
113
+ return def.plugins !== void 0 ? {
114
+ plugins: def.plugins
115
+ } : {};
116
+ }
117
+ const plugin = {
118
+ name: "theokit-builder-hooks",
119
+ version: "1.0.0",
120
+ kind: "general",
121
+ register(ctx) {
122
+ for (const [hookName, handler] of entries) {
123
+ ctx.on(hookName, handler);
124
+ }
125
+ }
126
+ };
127
+ return {
128
+ plugins: [
129
+ ...explicit,
130
+ plugin
131
+ ]
132
+ };
133
+ }
134
+ __name(compileHooksAndPlugins, "compileHooksAndPlugins");
135
+ function compileSkillsSelection(skills) {
136
+ if (skills === void 0) return {};
137
+ if (typeof skills === "function") return {
138
+ skillsResolver: skills
139
+ };
140
+ const enabled = [];
141
+ const inline = [];
142
+ for (const entry of skills) {
143
+ if (typeof entry === "string") enabled.push(entry);
144
+ else inline.push(entry);
145
+ }
146
+ return {
147
+ skills: {
148
+ enabled,
149
+ autoInject: true,
150
+ ...inline.length > 0 ? {
151
+ inline
152
+ } : {}
153
+ }
154
+ };
155
+ }
156
+ __name(compileSkillsSelection, "compileSkillsSelection");
157
+ function compileApprovals(def) {
158
+ const toolNames = new Set((def.tools ?? []).map((t) => t.name));
159
+ const gates = /* @__PURE__ */ new Map();
160
+ for (const [toolName, options] of Object.entries(def.approvals ?? {})) {
161
+ if (!toolNames.has(toolName)) {
162
+ throw new Error(`[@theokit/agents] defineAgent approval references unknown tool "${toolName}". Declared tools: ${[
163
+ ...toolNames
164
+ ].join(", ") || "(none)"}.`);
165
+ }
166
+ gates.set(toolName, options);
167
+ }
168
+ return gates;
169
+ }
170
+ __name(compileApprovals, "compileApprovals");
171
+
172
+ export {
173
+ UntrustedSettingSourceError,
174
+ resolveSettingSources,
175
+ AGENT_BRAND,
176
+ defineAgent,
177
+ isAgentDefinition,
178
+ compileAgentDefinition,
179
+ compileSkillsSelection
180
+ };
181
+ //# sourceMappingURL=chunk-4VHCH6IZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/bridge/setting-sources-gate.ts","../src/bridge/define-agent.ts"],"mappings":";;;;;AACA,SAASA,yBAAyB;AA2E3B,IAAMC,8BAAN,cAA0CC,kBAAAA;EA3EjD,OA2EiDA;;;;;EAC7BC,OAAO;EAEzB,YACEC,SAESC,aAEAC,YACT;AACA,UAAMF,OAAAA,GAAAA,KAJGC,cAAAA,aAAAA,KAEAC,aAAAA;EAGX;AACF;AAaO,SAASC,sBACdC,WAA8C;AAE9C,MAAIA,cAAcC,OAAW,QAAO,CAAA;AAEpC,QAAMC,UAA2B,CAAA;AACjC,MAAIF,UAAUG,SAAS,KAAMD,SAAQE,KAAK,MAAA;AAE1C,QAAMC,QAAQL,UAAUM;AACxB,MAAID,UAAU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I,OAAOsB,UAAU,SAAUF,SAAQG,KAAKD,KAAAA;QACvCD,QAAOE,KAAKD,KAAAA;EACnB;AACA,SAAO;IACLtB,QAAQ;MAAEoB;MAASI,YAAY;MAAM,GAAIH,OAAOT,SAAS,IAAI;QAAES;MAAO,IAAI,CAAC;IAAG;EAChF;AACF;AAdgBtB;AAqBhB,SAASD,iBAAiBf,KAAoB;AAC5C,QAAM0C,YAAY,IAAIC,KAAK3C,IAAIK,SAAS,CAAA,GAAIC,IAAI,CAACsC,MAAMA,EAAErD,IAAI,CAAA;AAC7D,QAAMsD,QAAQ,oBAAIC,IAAAA;AAClB,aAAW,CAACC,UAAUC,OAAAA,KAAYnD,OAAO2B,QAAQxB,IAAIa,aAAa,CAAC,CAAA,GAAI;AACrE,QAAI,CAAC6B,UAAUO,IAAIF,QAAAA,GAAW;AAC5B,YAAM,IAAIG,MACR,mEAAmEH,QAAAA,sBAC9C;WAAIL;QAAWS,KAAK,IAAA,KAAS,QAAA,GAAW;IAEjE;AACAN,UAAMO,IAAIL,UAAUC,OAAAA;EACtB;AACA,SAAOH;AACT;AAbS9B;","names":["TheokitAgentError","UntrustedSettingSourceError","TheokitAgentError","name","message","trustSource","capability","resolveSettingSources","selection","undefined","sources","user","push","grant","project","posture","trustedBy","allows","projectSettings","level","source","AGENT_BRAND","Symbol","for","defineAgent","config","isAgentDefinition","value","toCompiledTool","tool","handler","compiled","name","description","inputSchema","input","ctx","sym","Object","getOwnPropertySymbols","compileAgentDefinition","def","model","reasoningEffort","systemPrompt","system","tools","map","agents","stream","context","undefined","runContext","guardrails","approvals","hitl","compileApprovals","compileSkillsSelection","skills","settingSources","resolveSettingSources","memory","compileHooksAndPlugins","mcpServers","hooks","entries","filter","h","explicit","plugins","length","plugin","version","kind","register","hookName","on","skillsResolver","enabled","inline","entry","push","autoInject","toolNames","Set","t","gates","Map","toolName","options","has","Error","join","set"]}