@theokit/agents 7.4.2 → 7.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.
@@ -0,0 +1,7 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ export {
5
+ __name
6
+ };
7
+ //# sourceMappingURL=chunk-Z4QWC7IK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"mappings":"","names":[]}
@@ -2,7 +2,10 @@ import {
2
2
  AgentClient,
3
3
  HttpTransport,
4
4
  isAgentHandle
5
- } from "./chunk-FJA4QQLZ.js";
5
+ } from "./chunk-2BAFKRXT.js";
6
+ import {
7
+ __name
8
+ } from "./chunk-Z4QWC7IK.js";
6
9
 
7
10
  // src/client/use-agent.ts
8
11
  import { useMemo, useRef, useSyncExternalStore } from "react";
@@ -17,7 +20,7 @@ function useAgent(binding, options = {}) {
17
20
  () => new AgentClient(
18
21
  api !== void 0 ? new HttpTransport({
19
22
  api,
20
- headers: () => optionsRef.current.headers,
23
+ headers: /* @__PURE__ */ __name(() => optionsRef.current.headers, "headers"),
21
24
  fetch: optionsRef.current.fetch
22
25
  }) : binding,
23
26
  // M43 — resolve context live from the ref each send/reconnect (never stale). A value or a resolver.
@@ -28,7 +31,9 @@ function useAgent(binding, options = {}) {
28
31
  ),
29
32
  // bindingIdentity captures api/binding; options resolve live via optionsRef (rebuild would drop messages).
30
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
31
- [bindingIdentity]
34
+ [
35
+ bindingIdentity
36
+ ]
32
37
  );
33
38
  const state = useSyncExternalStore(client.subscribe, client.getSnapshot, client.getSnapshot);
34
39
  return {
@@ -43,6 +48,7 @@ function useAgent(binding, options = {}) {
43
48
  reconnect: client.reconnect
44
49
  };
45
50
  }
51
+ __name(useAgent, "useAgent");
46
52
  export {
47
53
  useAgent
48
54
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/client/use-agent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kBAAkBH,OAAOL;AAE/B,QAAMS,SAASC;IACb,MACE,IAAIC;MACFN,QAAQO,SACJ,IAAIC,cAAc;QAChBR;QACAS,SAAS,6BAAMZ,WAAWE,QAAQU,SAAzB;QACTC,OAAOb,WAAWE,QAAQW;MAC5B,CAAA,IACCf;;MAEL,MAAA;AACE,cAAMgB,MAAMd,WAAWE,QAAQa;AAC/B,eAAO,OAAOD,QAAQ,aAAaA,IAAAA,IAAQA;MAC7C;IAAA;;;IAIJ;MAACR;;EAAgB;AAGnB,QAAMU,QAAQC,qBAAqBV,OAAOW,WAAWX,OAAOY,aAAaZ,OAAOY,WAAW;AAE3F,SAAO;IACLC,UAAUJ,MAAMI;IAChBC,QAAQL,MAAMK;IACdC,QAAQN,MAAMM;IACdC,OAAOP,MAAMO;IACbC,MAAMjB,OAAOiB;IACbC,OAAOlB,OAAOkB;IACdC,OAAOnB,OAAOmB;IACdC,SAASpB,OAAOoB;IAChBC,WAAWrB,OAAOqB;EACpB;AACF;AAnDgB/B;","names":["useMemo","useRef","useSyncExternalStore","useAgent","binding","options","optionsRef","useRef","current","api","isAgentHandle","path","bindingIdentity","client","useMemo","AgentClient","undefined","HttpTransport","headers","fetch","ctx","context","state","useSyncExternalStore","subscribe","getSnapshot","messages","thread","status","error","send","abort","reset","approve","reconnect"]}
package/dist/client.js CHANGED
@@ -10,7 +10,8 @@ import {
10
10
  extractLastUserText,
11
11
  isAgentHandle,
12
12
  responseToChunkStream
13
- } from "./chunk-FJA4QQLZ.js";
13
+ } from "./chunk-2BAFKRXT.js";
14
+ import "./chunk-Z4QWC7IK.js";
14
15
  export {
15
16
  AgentClient,
16
17
  ApprovalAbortedError,
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition, BudgetTracker, CustomTool, GoalLoopAgent, GoalOptions, runGoalLoop, GoalEvent, GoalResult, InlineSkill, Agent as Agent$1, ListAgentsOptions, ListResult, SDKAgentInfo } from '@theokit/sdk';
2
- export { CustomTool, DiagnosticsSink, GoalEvent, GoalLoopAgent, GoalOptions, GoalResult, JudgeCredentialError, JudgeResult, McpAuthConfig, McpHttpServerConfig, McpOAuthConfig, McpServerConfig, McpStdioServerConfig, Provider, SDKAgent, SessionRecord, Squad, Tool, Verdict, setDiagnosticsSink } from '@theokit/sdk';
3
- import { G as Guardrail, L as LoopStrategy, R as ReflectionStrategy, C as CompiledAgentOptions, M as MainLoopMeta, a as CompiledTool, b as ReasoningEffort, c as RoundStreamFactory, S as StreamEvent, D as DelegationResult, d as ContextWindowOptions, e as SkillsOptions, T as ToolOptions, A as ApprovalOptions, H as HumanInTheLoopOptions, f as AgentManifestEntry, g as HitlDecision, s as streamAgentUIMessages, h as ApprovalPosture } from './bridge-entry-Z8GjrwH4.js';
4
- export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, p as AgentManifestSource, q as AgentManifestTool, r as AgentOptions, 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, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, P as BudgetOptions, Q as CheckpointSavedEvent, U as CompiledContextWindow, V as ContextualTool, W as CostBudgetExceededError, X as DEFAULT_MAX_ITERATIONS, Y as DefineAgentConfig, Z as DefinitionOrThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, a5 as GuardrailAction, a6 as GuardrailPhase, a7 as GuardrailResult, a8 as GuardrailViolationError, a9 as HookHandlers, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ae as LoopFinishReason, af as LoopOutcome, ag as LoopStrategyConfig, ah as MainLoopOptions, ai as McpApprovalSpec, aj as McpFileError, ak as McpRegistryConfig, al as McpRequestContext, am as McpSelection, an as McpServersMap, ao as PartialToolCallEvent, ap as PolicyHandler, aq as ProcessInputContext, ar as ReflectionContext, as as ReflectionResult, at as ReflectionStrategyConfig, 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, aD as SkillsRequestContext, aE as SkillsSelection, aF as StateUpdateEvent, aG as TextDeltaEvent, aH as ThinkingEvent, aI as TimeoutAction, aJ as ToolCallEvent, aK as ToolCallVeto, aL as ToolHooks, aM as ToolHooksPlugin, aN as ToolResultEvent, aO as ToolWalkResult, aP as ToolboxOptions, 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, bh as ladderReflectionStrategy, bi as loadMcpJson, bj as loopStrategyConfigSchema, bk as mcpRegistry, bl as mcpToolApprovals, bm as noopReflectionStrategy, bn as presentUIMessageStream, bo as projectContextMetadataOnlyKnobs, bp as reasoningEffortOf, bq as reflectionStrategyConfigSchema, br as resolveEnabledSkills, bs as resolveLoopStrategy, bt as resolveMcpServers, bu as runWithApiErrorHandling, bv as streamAgentResponse, bw as toAgentFactory, bx as translateSdkEvent } from './bridge-entry-Z8GjrwH4.js';
2
+ export { CustomTool, DiagnosticsSink, GenerateObjectError, GoalEvent, GoalLoopAgent, GoalOptions, GoalResult, JudgeCredentialError, JudgeResult, LayerOrderError, McpAuthConfig, McpHttpServerConfig, McpOAuthConfig, McpServerConfig, McpStdioServerConfig, Provider, SDKAgent, SessionRecord, Squad, StreamObjectError, Tool, ToolError, ToolResultContentBlock, TrustLevel, TrustPosture, TrustPostureInput, TrustSource, UngatedCapabilityError, Verdict, WiredEntity, applySecurityFloor, auditEnvReachability, foldLayers, recordWiring, resolveTrustPosture, setDiagnosticsSink, verifyLayerOrdering } from '@theokit/sdk';
3
+ import { G as Guardrail, L as LoopStrategy, R as ReflectionStrategy, C as CompiledAgentOptions, M as MainLoopMeta, a as CompiledTool, b as ReasoningEffort, c as RoundStreamFactory, S as StreamEvent, D as DelegationResult, d as ContextWindowOptions, e as SkillsOptions, T as ToolOptions, A as ApprovalOptions, H as HumanInTheLoopOptions, f as AgentManifestEntry, g as HitlDecision, s as streamAgentUIMessages, h as ApprovalPosture } from './bridge-entry-CvmBrmc9.js';
4
+ export { i as AGENT_BRAND, j as AfterToolCallContext, k as AgentBuilder, l as AgentDefinition, m as AgentDefinitionError, n as AgentExecutionContext, o as AgentManifest, p as AgentManifestSource, q as AgentManifestTool, r as AgentOptions, 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, F as ApprovalRequiredEvent, I as ArtifactChunkEvent, J as ArtifactStartEvent, K as BackgroundDelegation, N as BeforeToolCallContext, O as BudgetExceededError, P as BudgetOptions, Q as CheckpointSavedEvent, U as CompiledContextWindow, V as ContextualTool, W as CostBudgetExceededError, X as DEFAULT_MAX_ITERATIONS, Y as DefineAgentConfig, Z as DefinitionOrThunk, _ as DelegateFn, $ as DelegateOptions, a0 as DelegationBudgetExceededError, a1 as DelegationError, a2 as DoneEvent, a3 as ErrorEvent, a4 as FileEditEvent, a5 as GuardrailAction, a6 as GuardrailPhase, a7 as GuardrailResult, a8 as GuardrailViolationError, a9 as HookHandlers, aa as InferAgentInput, ab as InferAgentToolNames, ac as IterationEvent, ad as LLMCallContext, ae as LoopFinishReason, af as LoopOutcome, ag as LoopStrategyConfig, ah as MainLoopOptions, ai as McpApprovalSpec, aj as McpFileError, ak as McpRegistryConfig, al as McpRequestContext, am as McpSelection, an as McpServersMap, ao as PartialToolCallEvent, ap as PolicyHandler, aq as ProcessInputContext, ar as ProjectSettingsGrant, as as ReflectionContext, at as ReflectionResult, au as ReflectionStrategyConfig, av as RunStartedEvent, aw as ScoreVerdict, ax as ScoredDelegation, ay as Scorer, az as SdkAgentHandle, aA as SdkMessage, aB as SdkSendOptions, aC as SdkTurnHandle, aD as Segment, aE as SettingSourceCapability, aF as SettingSourcesSelection, aG as SkillsRequestContext, aH as SkillsSelection, aI as StateUpdateEvent, aJ as TextDeltaEvent, aK as ThinkingEvent, aL as TimeoutAction, aM as ToolCallEvent, aN as ToolCallVeto, aO as ToolHooks, aP as ToolHooksPlugin, aQ as ToolResultEvent, aR as ToolWalkResult, aS as ToolboxOptions, aT as ToolboxWalkResult, aU as UntrustedSettingSourceError, aV as agentsPlugin, aW as buildModelSelection, aX as compileAgentDefinition, aY as compileAgentModule, aZ as compileContextWindow, a_ as compileProjectContext, a$ as compileSkills, b0 as compileTools, b1 as createAgentExecutionContext, b2 as createApiErrorHandler, b3 as createSdkAgentStream, b4 as createThinkTagExtractor, b5 as createToolHooksPlugin, b6 as delegate, b7 as delegateBackground, b8 as delegateWithScoring, b9 as extractThinkTagStream, ba as generateAgentManifest, bb as generateAgentRoutes, bc as isAgentContext, bd as isAgentDefinition, be as isApprovalRequired, bf as isDone, bg as isError, bh as isPartialToolCall, bi as isTextDelta, bj as isToolCall, bk as isToolResult, bl as ladderReflectionStrategy, bm as loadMcpJson, bn as loopStrategyConfigSchema, bo as mcpRegistry, bp as mcpToolApprovals, bq as noopReflectionStrategy, br as presentUIMessageStream, bs as projectContextMetadataOnlyKnobs, bt as reasoningEffortOf, bu as reflectionStrategyConfigSchema, bv as resolveEnabledSkills, bw as resolveLoopStrategy, bx as resolveMcpServers, by as resolveSettingSources, bz as runWithApiErrorHandling, bA as streamAgentResponse, bB as toAgentFactory, bC as translateSdkEvent } from './bridge-entry-CvmBrmc9.js';
5
5
  import { TheokitAgentError } from '@theokit/sdk/errors';
6
6
  export * from '@theokit/sdk/errors';
7
7
  export { ConfigurationError, BudgetExceededError as WindowBudgetExceededError } from '@theokit/sdk/errors';
@@ -1119,6 +1119,21 @@ interface StreamAgentTurnInProcessInput {
1119
1119
  source?: string;
1120
1120
  /** Abort signal forwarded to the SDK stream (client disconnect / window close). */
1121
1121
  signal?: AbortSignal;
1122
+ /**
1123
+ * theokit#189 — observe the SDK's typed `RunEvent`s for this turn.
1124
+ *
1125
+ * `agent-endpoint.ts` already threaded this sink on the HTTP path (theokit#132); this entry point
1126
+ * — the one an EMBEDDED surface uses — declared no field for it, so the sink had no way in and
1127
+ * every `RunEvent` was unobservable in-process. `streamAgentUIMessages` accepted it at the far end
1128
+ * the whole time; the hop in between simply did not pass it.
1129
+ *
1130
+ * Nothing failed while it was missing, because a sink nobody can install emits nothing to compare
1131
+ * against. That is what made it survive: the absence had no observable consequence to test.
1132
+ *
1133
+ * Absent ⇒ the key is omitted from the SDK call entirely, so the stream is byte-identical to
1134
+ * before.
1135
+ */
1136
+ onRunEvent?: Parameters<typeof streamAgentUIMessages>[2]['onRunEvent'];
1122
1137
  }
1123
1138
  /** Injectable stream fn (defaults to the real SDK bridge) — lets tests drive a deterministic stream. */
1124
1139
  interface StreamAgentTurnDeps {