@theokit/agents 14.3.0 → 14.5.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,88 @@
1
1
  # @theokit/agents
2
2
 
3
+ ## 14.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 604ecab: `loadPersonalMcpServers` — MCP servers an operator registered for themselves, in `~/.claude.json`,
8
+ are now read alongside the project-scope servers from `.mcp.json`.
9
+
10
+ The surface table recorded this as measuring zero and therefore not worth closing. Re-measured
11
+ 2026-09-15 on the machine the original number came from: the file carried 2 personal-scope servers.
12
+ A measurement that justifies inaction has to stay current, and that one had expired — the gap costs
13
+ an operator the servers they registered for themselves.
14
+
15
+ Never throws: `~/.claude.json` is shared with another tool that writes it, so an unreadable or
16
+ surprising file yields no servers rather than failing the run that merely wanted to read them.
17
+
18
+ - 604ecab: `applySubagentMemory` — a subagent's `memory:` declaration now reaches the prompt it governs.
19
+
20
+ `@theokit/sdk` carries the declaration and deliberately stops there: which of three roots a note
21
+ lives under is a decision about who can see it, and a second copy of that rule in that package is
22
+ how two packages drift into disagreeing about privacy. `resolveAgentMemory` owned that decision
23
+ here — and owned it with no caller. The reader and the declaration were one call apart for as long
24
+ as both existed.
25
+
26
+ The three roots are decided together, because they differ in exactly one way — who can see the
27
+ notes — so defaulting an unrecognised scope would publish, on the next commit, something somebody
28
+ wrote expecting privacy. An unrecognised scope therefore throws rather than guessing.
29
+
30
+ ## 14.4.0
31
+
32
+ ### Minor Changes
33
+
34
+ - 309c717: The agent can declare the work it is judged on.
35
+
36
+ The runtime already modelled tasks and already emitted their lifecycle — `Task.submit` is published,
37
+ `task_started` / `task_updated` / `task_completed` reach a consumer, and B-018 shipped moderation for
38
+ `task_progress.text`. What was missing was the way in: measured, `packages/agents/src` emitted
39
+ `task_started` in **0** files, so the channel was reachable by the embedder and by nothing the model
40
+ could call. A UI could draw a task list the agent had no way to populate.
41
+
42
+ ```ts
43
+ import { createTaskDeclareTool, createTaskCompleteTool } from '@theokit/agents/tools'
44
+ import { createPlanOnlyGate, PlanOnlyRefusalError } from '@theokit/agents/auth'
45
+ import { resolveDecomposition } from '@theokit/agents'
46
+ ```
47
+
48
+ **A plan-only run may decompose and may not act.** The SDK already declared
49
+ `PermissionMode = "default" | "plan" | ...`, and measured across this package: `default` appeared 4
50
+ times, `acceptEdits` once, `bypass` once, and **`plan` zero** — of five modes the type carries, the
51
+ one meaning "do not act" was the only one nothing here mentioned. So this does not invent a mode; it
52
+ makes the declared one refuse.
53
+
54
+ ```ts
55
+ pre_tool_call: async (ctx) => (await planOnly(ctx)) ?? (await mine(ctx))
56
+ ```
57
+
58
+ The gate returns `undefined` outside plan mode, so it COMPOSES rather than replacing a handler you
59
+ already have — `pre_tool_call` is a single field, and assigning over it loses one silently.
60
+
61
+ **Refusing is not skipping.** A skipped call leaves the agent believing it succeeded and the plan
62
+ reading as executed, which is the one outcome nobody can detect afterwards. `PlanOnlyRefusalError`
63
+ names both the mode and the tool. Declaring stays allowed: a gate that refused everything would
64
+ produce a mode that yields no plan.
65
+
66
+ **The agent's decomposition is what the judge reads.** A caller-supplied `GoalOptions.subgoals` is a
67
+ starting value, never a verdict — which is what stops a breakdown somebody else wrote from being
68
+ charged to the agent as failure.
69
+
70
+ **A declaration is a DEFERRED task, and that is the design rather than an accident.** `Task.submit`
71
+ takes a work FUNCTION — it was built to run work, and a declaration has none: the work is the agent,
72
+ across turns. So the submitted work returns a promise that stays pending until `task_complete`
73
+ resolves it.
74
+
75
+ The naive alternative is worth naming because it looks correct: work that returns immediately emits
76
+ `task_started` and `task_completed` in the same tick, so every declaration is born finished and
77
+ "declared and still open" can never be told from "never declared".
78
+
79
+ **Completing an id that was never declared RAISES**, naming the id. A silent no-op would leave the
80
+ agent believing the unit closed while the list still shows it open — the one outcome nobody can
81
+ detect afterwards.
82
+
83
+ **A registry that refuses is reported to the model**, not thrown: a registry being down is not a
84
+ reason for the run to end.
85
+
3
86
  ## 14.3.0
4
87
 
5
88
  ### Minor Changes
package/README.md CHANGED
@@ -90,19 +90,20 @@ configuration that had no effect.
90
90
 
91
91
  | Surface | State |
92
92
  |---|---|
93
- | `CLAUDE.md` | read |
93
+ | `CLAUDE.md` | **read when the host names it** — see below |
94
94
  | `settings.json` — `permissions` | translated into the SDK's `PermissionRule[]`; an entry that cannot be rendered faithfully is reported and excluded |
95
- | `settings.json` — `env`, `outputStyle` | read |
95
+ | `settings.json` — `outputStyle` | read |
96
+ | `settings.json` — `env` | **parsed, not applied** — see below |
96
97
  | `settings.local.json` | read, layered above `settings.json` |
97
98
  | `skills/`, `agents/`, `commands/`, `plugins/` | read when the dialect is declared |
98
99
  | `.mcp.json` | read; a field this runtime does not carry is reported |
99
100
  | `output-styles/*.md` | read, selected by `settings.json` |
100
- | `agent-memory/` | read — see below |
101
+ | `agent-memory/` | **resolvable** — the SDK carries the declaration, `applySubagentMemory` applies it, and the host decides whether to call it. Measured 2026-09-15: no consumer does yet |
101
102
  | `workflows/*.js` | **refused**, and reported. Every other surface is data; a workflow is code, and executing JavaScript found under a caller-supplied directory is a decision that belongs to you |
102
- | `keybindings.json` | **out of scope** — `@theokit/tui` |
103
- | `themes/*.json` | **out of scope** — `@theokit/tui` |
103
+ | `keybindings.json` | **out of scope HERE** — read by the consumer, see below |
104
+ | `themes/*.json` | **out of scope** — nobody reads it, in any of the three packages |
104
105
  | `~/.claude.json` — OAuth state, UI toggles | **out of scope** — a CLI's own state |
105
- | `~/.claude.json` — personal-scope MCP servers | **not read yet**, and in scope |
106
+ | `~/.claude.json` — personal-scope MCP servers | **read** — `loadPersonalMcpServers` |
106
107
 
107
108
 
108
109
  ### Out of scope, and who owns it instead
@@ -112,27 +113,109 @@ were measured on 2026-09-12 — `keybindings`, `themes/` and `.claude.json` each
112
113
  across every package source tree, against a control of 31 for `skills` — and each one is a decision
113
114
  rather than a gap.
114
115
 
115
- **`keybindings.json` and `themes/*.json` belong to `@theokit/tui`.** A framework has no keyboard and
116
+ **`keybindings.json` and `themes/*.json` are not this package's.** A framework has no keyboard and
116
117
  no colour: it produces text and tool calls, and the process that renders them owns which key does
117
118
  what and which escape codes it emits. Reading them here would let this package hold configuration it
118
119
  cannot act on, which is the accepted-and-ignored failure the table above exists to prevent.
119
120
 
121
+ **Where they actually go is the consumer, not `@theokit/tui`.** Re-measured 2026-09-15: the toolkit
122
+ carries internal keybindings and reads no file; `theocode` reads `~/.claude/keybindings.json` itself,
123
+ in `terminal-io/keybindings.ts`, against a format it measured against the published documentation.
124
+ Naming the toolkit as the owner sent a reader to the package that does the least with it — and the
125
+ row said `out of scope` without saying out of scope FOR WHOM, which is the half that misleads.
126
+
127
+ `themes/*.json` is read by nobody, in any of the three packages. That is a genuine gap rather than a
128
+ delegation, and it is stated here rather than implied by an ownership that does not exist.
129
+
120
130
  **`~/.claude.json` is two things under one name, and the split is the point.** Its OAuth state and UI
121
131
  toggles are a CLI's own state — that file is written by a specific program about its own session, and
122
132
  a library reading another program's login state would be reaching into something it neither owns nor
123
133
  can refresh. Its **personal-scope MCP servers** are a different matter: an MCP server the operator
124
134
  registered for themselves is a framework concern, this package already reads project-scope servers
125
- from `.mcp.json`, and the personal scope measures 0. That half is **not refused — it is not done**,
126
- and saying so is the distinction this section exists to make.
135
+ from `.mcp.json`, and the personal scope measured 0 when this was written. **It does not any more:** on the machine this was re-measured on, 2026-09-15, `~/.claude.json` carried 2 personal-scope servers. The gap cost an operator the servers they registered for themselves, which is the difference between a
136
+ gap worth declaring and one worth closing — so it was closed. `loadPersonalMcpServers` reads that key
137
+ and only that key, and returns empty on a malformed file rather than throwing, because one stray comma
138
+ in a shared home file must not break every project on the machine.
139
+
140
+ Both MCP readers are called by the host, not from inside this package — `loadMcpJson` has no internal
141
+ caller either, and a library with no `main()` cannot have one. That is why both rows say **read** while
142
+ `agent-memory/` says **resolvable**: the difference is not who calls, it is whether the chain is intact.
143
+ A `memory:` declaration was DROPPED by `@theokit/sdk` before any reader could see it; nothing drops an
144
+ MCP server.
127
145
 
128
146
  The registry entry that prompted this counts four decisions across three files, because
129
147
  `~/.claude.json` is split. That is the count, stated so nobody goes looking for a fourth file.
130
148
 
149
+ ### `themes/*.json`
150
+
151
+ Read by none of the three packages, measured 2026-09-15. After `keybindings.json` turned out to be
152
+ read by the consumer rather than by the package it was attributed to, the obvious next move was to
153
+ treat this as the same finding. It is not.
154
+
155
+ This package has no colour at all — a grep for `color`, `chalk` or `theme` across its source returns
156
+ nothing, the one apparent hit being `ansi` inside `stateTransitionHistory`. It produces text and tool
157
+ calls; a palette here would be configuration nothing could act on. The toolkit reads no theme file
158
+ either, so naming an owner would repeat the mistake the `keybindings.json` row already made.
159
+
160
+ ### `CLAUDE.md`
161
+
162
+ The instruction tree accepts any file list: `input.fileNames`, falling back to a default of
163
+ `['THEO.md', 'AGENTS.md', 'THEO.local.md', 'AGENTS.local.md']`. `CLAUDE.md` is not in it, and
164
+ `instruction-tree.ts` says so while explaining why `CLAUDE.local.md` is absent too: "a private
165
+ companion to a file this does not read would pair with nothing".
166
+
167
+ A consumer that wants it passes it. Measured 2026-09-15 while auditing this table row by row:
168
+ `CLAUDE.md`, `settings.json` → `env` and `agent-memory/` are each resolvable by the host, and each
169
+ was listed as `read`. The word describes the mechanism existing; a reader takes it as the behaviour
170
+ happening.
171
+
172
+ ### `settings.json` — `env`
173
+
174
+ `outputStyle` is read AND applied: `loadSettings` returns it and `resolveOutputStyle` hands it to
175
+ `loadOutputStyle`, which is the mechanism this package documents.
176
+
177
+ `env` is parsed and goes no further here. Measured 2026-09-15: the schema accepts it, the only
178
+ consumer of a `loadSettings` result in this package reads `outputStyle`, and nothing applies the
179
+ parsed values to `process.env`. A host that wants them can read `settings.values.env` and apply
180
+ them itself — the same shape as `agent-memory/` above, and stated for the same reason.
181
+
182
+ Grouping it with `outputStyle` under one `read` claimed for both what is true of one. The rule this
183
+ table serves is that a surface is read, or refused with a reason, and never accepted and ignored;
184
+ a key that is parsed and dropped is the third state, and it was in this file's own table.
185
+
186
+ ## Why `env` is not applied, rather than not yet applied
187
+
188
+ This is a refusal with a reason, not a gap waiting for someone.
189
+
190
+ `env` under `.claude/` sets environment variables, and a variable is not inert. `NODE_OPTIONS`
191
+ alone is code execution — `--require ./anything.js` runs a file before the program does — and
192
+ `LD_PRELOAD`, `PATH` and `NODE_PATH` each reach the same place by another route. Anything this
193
+ package spawns inherits the process environment: hook commands, and the stdio MCP servers whose
194
+ `${VAR}` references `expandEnvReferences` already resolves against `process.env`.
195
+
196
+ `.claude/settings.json` usually arrives with the clone. Applying its `env` would let a repository
197
+ choose what runs inside every subprocess of anyone who opens it — the same threat the `hooks` row
198
+ above is gated for, arriving by a quieter door. A consumer that wants those values can read
199
+ `settings.values.env` and decide for itself, which is where a trust decision of that size belongs.
200
+
201
+ The honest form of this is what the table now says: parsed, so an author is told the key was seen,
202
+ and not applied, so nobody believes it took effect.
203
+
131
204
  ### `agent-memory/`
132
205
 
133
- A subagent whose frontmatter declares `memory:` gets a directory it reads and writes. The first
134
- **200 lines, capped at 25KB**, of its `MEMORY.md` are loaded when it runs — both caps apply, and
135
- truncation is reported rather than silent.
206
+ `resolveAgentMemory()` resolves the directory a subagent reads and writes, and returns the first
207
+ **200 lines, capped at 25KB**, of its `MEMORY.md` — both caps apply, and truncation is reported
208
+ rather than silent.
209
+
210
+ **The host calls it. Nothing here calls it for you, and `memory:` in subagent frontmatter does not
211
+ reach it.** Measured 2026-09-15: `resolveAgentMemory` has no caller in this repository outside its
212
+ own tests, and `@theokit/sdk` — which is the package that loads `.claude/agents/*.md`, and does not
213
+ depend on this one — lists `memory` among the fields it refuses, so a file declaring it is skipped
214
+ with a diagnostic rather than granted a directory.
215
+
216
+ Saying "read" in the table above, as this document did until that measurement, put this surface in
217
+ the same column as `CLAUDE.md` and implied a wiring that does not exist. The reader is real and the
218
+ three roots below are real; what an author supplies is the call.
136
219
 
137
220
  | `memory:` | Root | Who can see it |
138
221
  |---|---|---|
package/dist/auth.d.ts CHANGED
@@ -617,4 +617,72 @@ interface Veto {
617
617
  */
618
618
  declare function grantGate(store: PermissionStore, classify: (ctx: GrantGateContext) => Classification): (ctx: GrantGateContext) => Promise<Veto | undefined>;
619
619
 
620
- export { type AgentCredentialInput, type AuthMethod, AuthProvider, CODEX_CLIENT_ID_ENV_VAR, CODEX_PROVIDER, type Classification, CredentialNotFoundError, type ProviderDescriptor as CredentialProviderDescriptor, type CredentialResolution, type CredentialSourcesInput, DEFAULT_PROVIDERS, DeclaredProviderError, type DeviceAuthProvider, type Governed, type Grant, type GrantGateContext, type GrantOptions, type NotGoverned, type PermissionQuery, PermissionStore, type PermissionStoreOptions, type PromptHooks, ProviderKeyMismatchError, ProviderPrefixMismatchError, type ResolveCredentialInput, type RunCredentialHelperOptions, type SourceOrigin, type Veto, credentialSources, grantGate, loginWithDevice, requireCredential, resolveAgentCredential, resolveCredential, resolveOperatorApiKey };
620
+ /**
621
+ * B-080 — a run in which the agent may plan and may not act.
622
+ *
623
+ * ## The mode already had a name, and nothing honoured it
624
+ *
625
+ * The SDK declares `PermissionMode = "default" | "plan" | "acceptEdits" | "bypass" |
626
+ * "bypassPermissions"`. Measured 2026-09-14 across `packages/agents/src`: `default` 4 times,
627
+ * `acceptEdits` once, `bypass` once, and **`plan` zero times** — of the five modes the type carries,
628
+ * the one meaning "do not act" is the single one this layer never mentioned. Accepted by the type
629
+ * and consulted by nobody, which is the shape this backlog keeps closing.
630
+ *
631
+ * So nothing here invents a mode. It makes the declared one refuse.
632
+ *
633
+ * ## Refusing, never skipping
634
+ *
635
+ * A silently skipped call leaves the agent believing it succeeded, so the plan reads as executed.
636
+ * That is the one outcome nobody can detect afterwards — worse than an error, which is why this
637
+ * throws a typed error naming both the mode and the tool (`rules/error-handling.md` § 2).
638
+ *
639
+ * ## Compose, never assign
640
+ *
641
+ * `auth/permission-gate.ts` states the hazard in its own docblock: `HookHandlers.pre_tool_call` is a
642
+ * SINGLE field, so assigning this over an existing handler loses one of the two silently — *"and
643
+ * worse here because the handler that loses may be the one that refuses."* The documented shape is:
644
+ *
645
+ * ```ts
646
+ * pre_tool_call: async (ctx) => (await planOnly(ctx)) ?? (await mine(ctx))
647
+ * ```
648
+ *
649
+ * First veto wins; `undefined` falls through. No helper ships for that: it is one line, and a
650
+ * `composePreToolCall` would be a second way to do what `??` already does.
651
+ *
652
+ * ## What counts as state-changing is the CONSUMER's decision
653
+ *
654
+ * `permission-gate.ts` already established why: a context carries `{ name, args }` with no notion of
655
+ * which argument is the command, and that differs per tool. The classifier is passed in rather than
656
+ * guessed, and this module does not invent a second taxonomy of dangerous tools.
657
+ */
658
+
659
+ /** Refused because the run is in `plan` mode. Typed so a consumer can catch this and only this. */
660
+ declare class PlanOnlyRefusalError extends TheokitAgentError {
661
+ readonly name = "PlanOnlyRefusalError";
662
+ /** The tool whose call was refused, so a handler can report it without parsing the message. */
663
+ readonly tool: string;
664
+ constructor(tool: string);
665
+ }
666
+ /** The slice of a pre-tool-call context this gate reads. Structural, so it fits the SDK's shape. */
667
+ interface PlanOnlyContext {
668
+ readonly name: string;
669
+ readonly permissionMode?: string;
670
+ }
671
+ interface PlanOnlyGateOptions {
672
+ /**
673
+ * Does calling this tool change state that outlives the turn?
674
+ *
675
+ * The consumer's decision, for the reason `permission-gate.ts` records: the package cannot know
676
+ * which argument is the command, and a guessed taxonomy would be wrong per tool.
677
+ */
678
+ readonly isStateChanging: (toolName: string) => boolean;
679
+ }
680
+ /**
681
+ * A `pre_tool_call` handler that refuses state-changing calls while the run is in `plan` mode.
682
+ *
683
+ * Returns `undefined` in every other case, so it composes with `??` rather than replacing whatever
684
+ * handler a consumer already has.
685
+ */
686
+ declare function createPlanOnlyGate(options: PlanOnlyGateOptions): (ctx: PlanOnlyContext) => Promise<undefined>;
687
+
688
+ export { type AgentCredentialInput, type AuthMethod, AuthProvider, CODEX_CLIENT_ID_ENV_VAR, CODEX_PROVIDER, type Classification, CredentialNotFoundError, type ProviderDescriptor as CredentialProviderDescriptor, type CredentialResolution, type CredentialSourcesInput, DEFAULT_PROVIDERS, DeclaredProviderError, type DeviceAuthProvider, type Governed, type Grant, type GrantGateContext, type GrantOptions, type NotGoverned, type PermissionQuery, PermissionStore, type PermissionStoreOptions, type PlanOnlyContext, type PlanOnlyGateOptions, PlanOnlyRefusalError, type PromptHooks, ProviderKeyMismatchError, ProviderPrefixMismatchError, type ResolveCredentialInput, type RunCredentialHelperOptions, type SourceOrigin, type Veto, createPlanOnlyGate, credentialSources, grantGate, loginWithDevice, requireCredential, resolveAgentCredential, resolveCredential, resolveOperatorApiKey };
package/dist/auth.js CHANGED
@@ -662,6 +662,31 @@ function grantGate(store, classify) {
662
662
  };
663
663
  }
664
664
  __name(grantGate, "grantGate");
665
+
666
+ // src/loop/plan-only.ts
667
+ import { TheokitAgentError as TheokitAgentError2 } from "@theokit/sdk/errors";
668
+ var PlanOnlyRefusalError = class extends TheokitAgentError2 {
669
+ static {
670
+ __name(this, "PlanOnlyRefusalError");
671
+ }
672
+ name = "PlanOnlyRefusalError";
673
+ /** The tool whose call was refused, so a handler can report it without parsing the message. */
674
+ tool;
675
+ constructor(tool) {
676
+ super(`refusing to run '${tool}': this run is in 'plan' permission mode, where the agent may decompose the work and may not change state. This is a REFUSAL, not a skip \u2014 a skipped call would leave the agent believing it succeeded and the plan reading as executed, which is the one outcome nobody can detect afterwards. Declare the work instead, and let the caller decide whether to leave plan mode.`, {
677
+ code: "PLAN_ONLY_REFUSAL"
678
+ });
679
+ this.tool = tool;
680
+ }
681
+ };
682
+ function createPlanOnlyGate(options) {
683
+ return async (ctx) => {
684
+ if (ctx.permissionMode !== "plan") return void 0;
685
+ if (!options.isStateChanging(ctx.name)) return void 0;
686
+ throw new PlanOnlyRefusalError(ctx.name);
687
+ };
688
+ }
689
+ __name(createPlanOnlyGate, "createPlanOnlyGate");
665
690
  export {
666
691
  AuthProvider,
667
692
  CODEX_CLIENT_ID_ENV_VAR,
@@ -671,10 +696,12 @@ export {
671
696
  DEFAULT_PROVIDERS,
672
697
  DeclaredProviderError,
673
698
  PermissionStore,
699
+ PlanOnlyRefusalError,
674
700
  ProviderKeyMismatchError,
675
701
  ProviderPrefixMismatchError,
676
702
  assertSecureModes,
677
703
  authFilePath2 as authFilePath,
704
+ createPlanOnlyGate,
678
705
  credentialHome,
679
706
  credentialSources,
680
707
  deviceLogin,
package/dist/auth.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/auth/auth-provider.ts","../src/auth-entry.ts","../src/auth/device-provider.ts","../src/auth/resolve-credential.ts","../src/auth/credential-helper.ts","../src/auth/permission-store.ts","../src/auth/permission-gate.ts"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SACEA,cACAC,uBACAC,mBACAC,oBACAC,uBACK;AAQP,SAASC,oBAAoB;AAkCtB,IAAMC,iBAAN,cAA6BC,MAAAA;EAhDpC,OAgDoCA;;;;EAClC,YACEC,SAESC,WACT;AACA,UAAMD,OAAAA,GAAAA,KAFGC,YAAAA;AAGT,SAAKC,OAAO;EACd;AACF;AAMA,IAAMC,oBAAoB;EACxB;EACA;EACA;EACA;EACA;EACA;;AAIK,SAASC,uBAAuBC,KAAY;AACjD,QAAMC,OAAOD,eAAeN,QAAQ,GAAGM,IAAIH,IAAI,KAAKG,IAAIL,OAAO,KAAKO,OAAOF,GAAAA;AAC3E,MAAI,qDAAqDG,KAAKF,IAAAA,GAAO;AACnE,WAAO,IAAIR,eACT,mGACA,KAAA;EAEJ;AACA,QAAMG,YACJE,kBAAkBM,KAAK,CAACC,MAAMJ,KAAKK,SAASD,CAAAA,CAAAA,KAAO,gCAAgCF,KAAKF,IAAAA;AAC1F,SAAO,IAAIR,eACTG,YAAY,gDAAgD,qCAC5DA,SAAAA;AAEJ;AAdgBG;AAiBT,SAASQ,eAAeC,SAAiBC,SAAS,KAAKC,SAASC,KAAKD,QAAM;AAChF,QAAME,OAAOH,SAAS,KAAKD;AAC3B,SAAOG,KAAKE,MAAMD,QAAQ,OAAOF,OAAAA,IAAW,IAAE;AACh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,SAAkBC,KAAKC,MAAMH,GAAAA;AACnC,UAAI,CAACI,MAAMC,QAAQJ,MAAAA,EAAS,OAAM,IAAI1B,MAAM,6BAAA;AAC5C,aAAO0B;IACT,GACA,CAAA,CAAE;AAEJ,SAAKnC,gBAAgBgC;AACrB,WAAOD;EACT;EAEA,SAASb,QAAwB;AAC/BsB,oBAAgB,KAAKzC,MAAM,MAAM,GAAGqC,KAAKK,UAAUvB,QAAQ,MAAM,CAAA,CAAA;CAAM;EACzE;AACF;;;ACtFO,SAASwB,UACdC,OACAC,UAAmD;AAEnD,SAAO,CAACC,QAAAA;AACN,QAAI;AACF,YAAMC,iBAAiCF,SAASC,GAAAA;AAkBhD,UAAIC,eAAeC,aAAa,MAAO,QAAOC,QAAQC,QAAQC,MAAAA;AAC9D,UAAIP,MAAMQ,UAAUL,eAAeM,KAAK,EAAG,QAAOJ,QAAQC,QAAQC,MAAAA;AAIlE,YAAMG,UACJV,MAAMW,kBAAkBJ,SACpB,8BACA;AAQNK,eAAS,oCAAoC;QAC3CC,MAAMX,IAAIY;QACVC,OAAOZ,eAAeM,MAAMM;QAC5BL;MACF,CAAA;AACA,aAAOL,QAAQC,QAAQ;QACrBU,OAAO;QACPC,SAAS,IAAIf,IAAIY,IAAI,yBAAyBX,eAAeM,MAAMM,KAAK,KAAKL,OAAAA;MAC/E,CAAA;IACF,SAASQ,OAAO;AAGd,YAAMC,MAAMD,iBAAiBE,QAAQF,MAAMD,UAAUI,OAAOH,KAAAA;AAI5DN,eAAS,gDAAgD;QAAEC,MAAMX,IAAIY;QAAMK;MAAI,CAAA;AAC/E,aAAOd,QAAQC,QAAQ;QACrBU,OAAO;QACPC,SAAS,uCAAuCf,IAAIY,IAAI,MAAMK,GAAAA;MAChE,CAAA;IACF;EACF;AACF;AA/DgBpB;","names":["authFilePath","ensureFreshCredential","openaiDeviceLogin","persistOAuthTokens","readStoredOAuth","withFileLock","RefreshFailure","Error","message","transient","name","TRANSIENT_REASONS","classifyRefreshFailure","err","text","String","test","some","m","includes","waitWithJitter","attempt","baseMs","random","Math","base","round","AuthProvider","config","store","ensureFresh","resolved","deps","env","kind","ensureFreshCredential","filePath","authFilePath","inFlight","refreshInFlight","get","undefined","promise","refreshUnderLock","set","delete","Map","withFileLock","doDisco","readStoredOAuth","current","apiKey","access","expiresAt","expires","MAX_ATTEMPTS","failure","Promise","resolve","setTimeout","deviceLogin","deviceConfig","hooks","openaiDeviceLogin","persist","provider","tokens","persistOAuthTokens","assertSecureModes","authFilePath","CredentialError","credentialHome","readAuthFile","readStoredOAuth","writeCredential","deviceLogin","openaiDeviceLogin","pollDeviceToken","requestDeviceCode","ensureFreshCredential","extractAccountId","persistOAuthTokens","refreshOAuthTokens","providerFromApiKeyPrefix","openaiDeviceLogin","CODEX_CLIENT_ID","CODEX_ISSUER","CODEX_CLIENT_ID_ENV_VAR","CODEX_OAUTH","provider","clientId","process","env","authorizeEndpoint","tokenEndpoint","scopes","redirectUri","CODEX_DEVICE","deviceUsercodeEndpoint","devicePollEndpoint","verificationUri","CODEX_PROVIDER","Object","freeze","name","oauth","methods","label","type","authorize","deps","hooks","openaiDeviceLogin","comDefaults","fetch","sleep","ms","Promise","resolve","setTimeout","now","Date","loginWithDevice","method","store","opts","length","TypeError","includes","tokens","path","AuthProvider","persist","accountId","undefined","readFileSync","join","providerFromApiKeyPrefix","readAuthFile","TheokitAgentError","ProviderPrefixMismatchError","TheokitAgentError","name","provider","envKey","model","ProviderKeyMismatchError","where","expectedPrefix","code","isRetryable","DeclaredProviderError","message","CredentialNotFoundError","attempts","map","a","i","String","join","declaredNames","path","raw","readFileSync","Set","names","line","split","trimmed","trim","startsWith","withoutExport","slice","length","eq","indexOf","add","credentialSources","input","sources","providers","sort","b","priority","descriptor","store","undefined","config","push","dirName","fileName","assertKeyMatchesProvider","apiKey","inferred","providerFromApiKeyPrefix","keyPrefix","pinnedProvider","byPriority","declaredProviderEnvVar","declared","env","find","d","resolveCredential","pinned","kind","source","originOf","home","available","flatMap","claimed","claimedProvider","found","candidate","storedOAuthResolution","diagnose","console","warn","filePathOf","stored","readAuthFile","cause","Error","p","type","api_key","access","modelPrefix","varName","dotenv","has","requireCredential","resolved","DEFAULT_PROVIDERS","resolveAgentCredential","execFile","DEFAULT_TIMEOUT_MS","runCredentialHelper","command","options","timeoutMs","printed","Promise","resolve","reject","execFile","shell","timeout","cwd","encoding","error","stdout","killed","ConfigurationError","code","credential","trim","length","resolveOperatorApiKey","warn","apiKeyHelper","currentOperatorPolicy","undefined","realpathSync","join","signatureOf","command","trim","replace","PermissionStore","path","lastReadError","options","join","home","now","Date","scope","realpathSync","cause","Error","message","String","isGranted","query","grant","tool","undefined","expiresAt","grants","filter","g","push","grantedAt","toISOString","ttlMs","revoke","signature","kept","list","expired","find","value","error","readSecureJson","raw","parsed","JSON","parse","Array","isArray","writeSecureJson","stringify","grantGate","store","classify","ctx","classification","governed","Promise","resolve","undefined","isGranted","query","because","lastReadError","debugLog","tool","name","scope","block","message","cause","why","Error","String"]}
1
+ {"version":3,"sources":["../src/auth/auth-provider.ts","../src/auth-entry.ts","../src/auth/device-provider.ts","../src/auth/resolve-credential.ts","../src/auth/credential-helper.ts","../src/auth/permission-store.ts","../src/auth/permission-gate.ts","../src/loop/plan-only.ts"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SACEA,cACAC,uBACAC,mBACAC,oBACAC,uBACK;AAQP,SAASC,oBAAoB;AAkCtB,IAAMC,iBAAN,cAA6BC,MAAAA;EAhDpC,OAgDoCA;;;;EAClC,YACEC,SAESC,WACT;AACA,UAAMD,OAAAA,GAAAA,KAFGC,YAAAA;AAGT,SAAKC,OAAO;EACd;AACF;AAMA,IAAMC,oBAAoB;EACxB;EACA;EACA;EACA;EACA;EACA;;AAIK,SAASC,uBAAuBC,KAAY;AACjD,QAAMC,OAAOD,eAAeN,QAAQ,GAAGM,IAAIH,IAAI,KAAKG,IAAIL,OAAO,KAAKO,OAAOF,GAAAA;AAC3E,MAAI,qDAAqDG,KAAKF,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;IACF,SAASQ,OAAO;AAGd,YAAMC,MAAMD,iBAAiBE,QAAQF,MAAMD,UAAUI,OAAOH,KAAAA;AAI5DN,eAAS,gDAAgD;QAAEC,MAAMX,IAAIY;QAAMK;MAAI,CAAA;AAC/E,aAAOd,QAAQC,QAAQ;QACrBU,OAAO;QACPC,SAAS,uCAAuCf,IAAIY,IAAI,MAAMK,GAAAA;MAChE,CAAA;IACF;EACF;AACF;AA/DgBpB;;;ACnHhB,SAASuB,qBAAAA,0BAAyB;AAG3B,IAAMC,uBAAN,cAAmCC,mBAAAA;EAzC1C,OAyC0CA;;;EACtBC,OAAO;;EAEhBC;EAET,YAAYA,MAAc;AACxB,UACE,oBAAoBA,IAAAA,wXAKpB;MAAEC,MAAM;IAAoB,CAAA;AAE9B,SAAKD,OAAOA;EACd;AACF;AAwBO,SAASE,mBAAmBC,SAA4B;AAO7D,SAAO,OAAOC,QAAAA;AAGZ,QAAIA,IAAIC,mBAAmB,OAAQ,QAAOC;AAI1C,QAAI,CAACH,QAAQI,gBAAgBH,IAAIL,IAAI,EAAG,QAAOO;AAE/C,UAAM,IAAIT,qBAAqBO,IAAIL,IAAI;EACzC;AACF;AAlBgBG;","names":["authFilePath","ensureFreshCredential","openaiDeviceLogin","persistOAuthTokens","readStoredOAuth","withFileLock","RefreshFailure","Error","message","transient","name","TRANSIENT_REASONS","classifyRefreshFailure","err","text","String","test","some","m","includes","waitWithJitter","attempt","baseMs","random","Math","base","round","AuthProvider","config","store","ensureFresh","resolved","deps","env","kind","ensureFreshCredential","filePath","authFilePath","inFlight","refreshInFlight","get","undefined","promise","refreshUnderLock","set","delete","Map","withFileLock","doDisco","readStoredOAuth","current","apiKey","access","expiresAt","expires","MAX_ATTEMPTS","failure","Promise","resolve","setTimeout","deviceLogin","deviceConfig","hooks","openaiDeviceLogin","persist","provider","tokens","persistOAuthTokens","assertSecureModes","authFilePath","CredentialError","credentialHome","readAuthFile","readStoredOAuth","writeCredential","deviceLogin","openaiDeviceLogin","pollDeviceToken","requestDeviceCode","ensureFreshCredential","extractAccountId","persistOAuthTokens","refreshOAuthTokens","providerFromApiKeyPrefix","openaiDeviceLogin","CODEX_CLIENT_ID","CODEX_ISSUER","CODEX_CLIENT_ID_ENV_VAR","CODEX_OAUTH","provider","clientId","process","env","authorizeEndpoint","tokenEndpoint","scopes","redirectUri","CODEX_DEVICE","deviceUsercodeEndpoint","devicePollEndpoint","verificationUri","CODEX_PROVIDER","Object","freeze","name","oauth","methods","label","type","authorize","deps","hooks","openaiDeviceLogin","comDefaults","fetch","sleep","ms","Promise","resolve","setTimeout","now","Date","loginWithDevice","method","store","opts","length","TypeError","includes","tokens","path","AuthProvider","persist","accountId","undefined","readFileSync","join","providerFromApiKeyPrefix","readAuthFile","TheokitAgentError","ProviderPrefixMismatchError","TheokitAgentError","name","provider","envKey","model","ProviderKeyMismatchError","where","expectedPrefix","code","isRetryable","DeclaredProviderError","message","CredentialNotFoundError","attempts","map","a","i","String","join","declaredNames","path","raw","readFileSync","Set","names","line","split","trimmed","trim","startsWith","withoutExport","slice","length","eq","indexOf","add","credentialSources","input","sources","providers","sort","b","priority","descriptor","store","undefined","config","push","dirName","fileName","assertKeyMatchesProvider","apiKey","inferred","providerFromApiKeyPrefix","keyPrefix","pinnedProvider","byPriority","declaredProviderEnvVar","declared","env","find","d","resolveCredential","pinned","kind","source","originOf","home","available","flatMap","claimed","claimedProvider","found","candidate","storedOAuthResolution","diagnose","console","warn","filePathOf","stored","readAuthFile","cause","Error","p","type","api_key","access","modelPrefix","varName","dotenv","has","requireCredential","resolved","DEFAULT_PROVIDERS","resolveAgentCredential","execFile","DEFAULT_TIMEOUT_MS","runCredentialHelper","command","options","timeoutMs","printed","Promise","resolve","reject","execFile","shell","timeout","cwd","encoding","error","stdout","killed","ConfigurationError","code","credential","trim","length","resolveOperatorApiKey","warn","apiKeyHelper","currentOperatorPolicy","undefined","realpathSync","join","signatureOf","command","trim","replace","PermissionStore","path","lastReadError","options","join","home","now","Date","scope","realpathSync","cause","Error","message","String","isGranted","query","grant","tool","undefined","expiresAt","grants","filter","g","push","grantedAt","toISOString","ttlMs","revoke","signature","kept","list","expired","find","value","error","readSecureJson","raw","parsed","JSON","parse","Array","isArray","writeSecureJson","stringify","grantGate","store","classify","ctx","classification","governed","Promise","resolve","undefined","isGranted","query","because","lastReadError","debugLog","tool","name","scope","block","message","cause","why","Error","String","TheokitAgentError","PlanOnlyRefusalError","TheokitAgentError","name","tool","code","createPlanOnlyGate","options","ctx","permissionMode","undefined","isStateChanging"]}
@@ -1493,6 +1493,31 @@ declare class McpFileError extends TheokitAgentError {
1493
1493
  * Reading is explicit — this module has no import-time side effect.
1494
1494
  */
1495
1495
  declare function loadMcpJson(cwd: string, opts?: LoadMcpJsonOptions): McpServersMap;
1496
+ /**
1497
+ * The MCP servers an operator registered for themselves, from `~/.claude.json`.
1498
+ *
1499
+ * `.mcp.json` is a PROJECT's declaration and {@link loadMcpJson} has read it since B-043. This is
1500
+ * the other half: the servers someone registered for their own account, under the same
1501
+ * `mcpServers` key, which nothing here was reading. The surfaces table listed them "not read yet,
1502
+ * and in scope", justified with "the personal scope measures 0" — re-measured 2026-09-15 on the
1503
+ * machine that wrote that note: 2 servers, neither reaching an agent.
1504
+ *
1505
+ * ## Only `mcpServers`, and the rest is deliberately left alone
1506
+ *
1507
+ * That file is two things under one name. Its OAuth state and UI toggles are a specific CLI writing
1508
+ * about its own session; a library reaching into another program's login state would be taking
1509
+ * something it neither owns nor can refresh. The parser already ignores every other key, and a test
1510
+ * pins it by putting a token beside the servers and asserting the result carries nothing but them.
1511
+ *
1512
+ * ## Why this never throws
1513
+ *
1514
+ * {@link loadMcpJson} throws on a malformed project file, because that file is the project's own
1515
+ * declaration and an author who wrote it wants to know. This one is in the operator's home and is
1516
+ * shared with another product: one stray comma there would otherwise break every project on the
1517
+ * machine, for a file this project did not write. It reports and returns nothing instead — the same
1518
+ * trade `readLayer` makes in `config/settings-file.ts`, for the same reason.
1519
+ */
1520
+ declare function loadPersonalMcpServers(home: string, opts?: LoadMcpJsonOptions): McpServersMap;
1496
1521
 
1497
1522
  /**
1498
1523
  * Agent manifest generator — build-time JSON describing all agents, tools, guards, policies.
@@ -1639,4 +1664,4 @@ declare function agentsPlugin(opts: AgentsPluginOptions): {
1639
1664
  register(app: PluginApp): void;
1640
1665
  };
1641
1666
 
1642
- export { compileLoadedAgentModule as $, type AgentManifestEntry as A, type BeforeToolCallContext as B, type ContextWindowOptions as C, type DefinitionOrThunk as D, type EphemeralAgent as E, type McpSelection as F, type SdkAgentHandle as G, type HitlDecision as H, type SdkMessage as I, type SdkSendOptions as J, type SdkTurnHandle as K, type LLMCallContext as L, type McpApprovalSpec as M, type Segment as N, type ShouldAutoApproveOptions as O, type ProcessInputContext as P, type ToolHooks as Q, type RuntimeOverrides as R, type SkillsOptions as S, type ToolCallVeto as T, type ToolHooksPlugin as U, agentsPlugin as V, WRITE_SCOPED_TOOLS as W, applyPosture as X, buildModelSelection as Y, compileAgentModule as Z, compileContextWindow as _, type ApprovalPosture as a, compileProjectContext as a0, compileSkills as a1, createAgentExecutionContext as a2, createApiErrorHandler as a3, createSdkAgentStream as a4, createThinkTagExtractor as a5, createToolHooksPlugin as a6, extractThinkTagStream as a7, generateAgentManifest as a8, generateAgentRoutes as a9, isAgentContext as aa, loadMcpJson as ab, mcpRegistry as ac, mcpToolApprovals as ad, projectContextMetadataOnlyKnobs as ae, reasoningEffortOf as af, resolveMcpServers as ag, runWithApiErrorHandling as ah, shouldAutoApprove as ai, toAgentFactory as aj, translateSdkEvent as ak, withClockCap as al, withEphemeralAgent as am, type AgentModule as b, APPROVAL_MODES as c, type AfterToolCallContext as d, AgentBuilder as e, AgentDefinitionError as f, type AgentExecutionContext as g, type AgentManifest as h, type AgentManifestSource as i, type AgentManifestTool as j, type AgentRoute as k, type AgentRouteContext as l, type AgentRunInfo as m, type AgentsPluginOptions as n, type ApiErrorContext as o, type ApiErrorDecision as p, type ApiErrorPolicy as q, type ApprovalMode as r, streamAgentUIMessages as s, type ApprovalRequest as t, type CompiledContextWindow as u, ContextualTool as v, DelegationTimeoutError as w, McpFileError as x, type McpRegistryConfig as y, type McpRequestContext as z };
1667
+ export { compileLoadedAgentModule as $, type AgentManifestEntry as A, type BeforeToolCallContext as B, type ContextWindowOptions as C, type DefinitionOrThunk as D, type EphemeralAgent as E, type McpSelection as F, type SdkAgentHandle as G, type HitlDecision as H, type SdkMessage as I, type SdkSendOptions as J, type SdkTurnHandle as K, type LLMCallContext as L, type McpApprovalSpec as M, type Segment as N, type ShouldAutoApproveOptions as O, type ProcessInputContext as P, type ToolHooks as Q, type RuntimeOverrides as R, type SkillsOptions as S, type ToolCallVeto as T, type ToolHooksPlugin as U, agentsPlugin as V, WRITE_SCOPED_TOOLS as W, applyPosture as X, buildModelSelection as Y, compileAgentModule as Z, compileContextWindow as _, type ApprovalPosture as a, compileProjectContext as a0, compileSkills as a1, createAgentExecutionContext as a2, createApiErrorHandler as a3, createSdkAgentStream as a4, createThinkTagExtractor as a5, createToolHooksPlugin as a6, extractThinkTagStream as a7, generateAgentManifest as a8, generateAgentRoutes as a9, isAgentContext as aa, loadMcpJson as ab, loadPersonalMcpServers as ac, mcpRegistry as ad, mcpToolApprovals as ae, projectContextMetadataOnlyKnobs as af, reasoningEffortOf as ag, resolveMcpServers as ah, runWithApiErrorHandling as ai, shouldAutoApprove as aj, toAgentFactory as ak, translateSdkEvent as al, withClockCap as am, withEphemeralAgent as an, type AgentModule as b, APPROVAL_MODES as c, type AfterToolCallContext as d, AgentBuilder as e, AgentDefinitionError as f, type AgentExecutionContext as g, type AgentManifest as h, type AgentManifestSource as i, type AgentManifestTool as j, type AgentRoute as k, type AgentRouteContext as l, type AgentRunInfo as m, type AgentsPluginOptions as n, type ApiErrorContext as o, type ApiErrorDecision as p, type ApiErrorPolicy as q, type ApprovalMode as r, streamAgentUIMessages as s, type ApprovalRequest as t, type CompiledContextWindow as u, ContextualTool as v, DelegationTimeoutError as w, McpFileError as x, type McpRegistryConfig as y, type McpRequestContext as z };
package/dist/bridge.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { c as APPROVAL_MODES, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, A as AgentManifestEntry, i as AgentManifestSource, j as AgentManifestTool, b as AgentModule, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentsPluginOptions, o as ApiErrorContext, p as ApiErrorDecision, q as ApiErrorPolicy, r as ApprovalMode, a as ApprovalPosture, B as BeforeToolCallContext, u as CompiledContextWindow, v as ContextualTool, D as DefinitionOrThunk, w as DelegationTimeoutError, E as EphemeralAgent, L as LLMCallContext, M as McpApprovalSpec, x as McpFileError, y as McpRegistryConfig, z as McpRequestContext, F as McpSelection, P as ProcessInputContext, G as SdkAgentHandle, I as SdkMessage, J as SdkSendOptions, K as SdkTurnHandle, N as Segment, O as ShouldAutoApproveOptions, T as ToolCallVeto, Q as ToolHooks, U as ToolHooksPlugin, W as WRITE_SCOPED_TOOLS, V as agentsPlugin, X as applyPosture, Y as buildModelSelection, Z as compileAgentModule, _ as compileContextWindow, $ as compileLoadedAgentModule, a0 as compileProjectContext, a1 as compileSkills, a2 as createAgentExecutionContext, a3 as createApiErrorHandler, a4 as createSdkAgentStream, a5 as createThinkTagExtractor, a6 as createToolHooksPlugin, a7 as extractThinkTagStream, a8 as generateAgentManifest, a9 as generateAgentRoutes, aa as isAgentContext, ab as loadMcpJson, ac as mcpRegistry, ad as mcpToolApprovals, ae as projectContextMetadataOnlyKnobs, af as reasoningEffortOf, ag as resolveMcpServers, ah as runWithApiErrorHandling, ai as shouldAutoApprove, s as streamAgentUIMessages, aj as toAgentFactory, ak as translateSdkEvent, al as withClockCap, am as withEphemeralAgent } from './bridge-entry-CuiHdpee.js';
1
+ export { c as APPROVAL_MODES, d as AfterToolCallContext, e as AgentBuilder, f as AgentDefinitionError, g as AgentExecutionContext, h as AgentManifest, A as AgentManifestEntry, i as AgentManifestSource, j as AgentManifestTool, b as AgentModule, k as AgentRoute, l as AgentRouteContext, m as AgentRunInfo, n as AgentsPluginOptions, o as ApiErrorContext, p as ApiErrorDecision, q as ApiErrorPolicy, r as ApprovalMode, a as ApprovalPosture, B as BeforeToolCallContext, u as CompiledContextWindow, v as ContextualTool, D as DefinitionOrThunk, w as DelegationTimeoutError, E as EphemeralAgent, L as LLMCallContext, M as McpApprovalSpec, x as McpFileError, y as McpRegistryConfig, z as McpRequestContext, F as McpSelection, P as ProcessInputContext, G as SdkAgentHandle, I as SdkMessage, J as SdkSendOptions, K as SdkTurnHandle, N as Segment, O as ShouldAutoApproveOptions, T as ToolCallVeto, Q as ToolHooks, U as ToolHooksPlugin, W as WRITE_SCOPED_TOOLS, V as agentsPlugin, X as applyPosture, Y as buildModelSelection, Z as compileAgentModule, _ as compileContextWindow, $ as compileLoadedAgentModule, a0 as compileProjectContext, a1 as compileSkills, a2 as createAgentExecutionContext, a3 as createApiErrorHandler, a4 as createSdkAgentStream, a5 as createThinkTagExtractor, a6 as createToolHooksPlugin, a7 as extractThinkTagStream, a8 as generateAgentManifest, a9 as generateAgentRoutes, aa as isAgentContext, ab as loadMcpJson, ac as loadPersonalMcpServers, ad as mcpRegistry, ae as mcpToolApprovals, af as projectContextMetadataOnlyKnobs, ag as reasoningEffortOf, ah as resolveMcpServers, ai as runWithApiErrorHandling, aj as shouldAutoApprove, s as streamAgentUIMessages, ak as toAgentFactory, al as translateSdkEvent, am as withClockCap, an as withEphemeralAgent } from './bridge-entry-kh9JllQT.js';
2
2
  export { c as CompatImportUnsupportedError, a as CompiledAgentOptions, b as CompiledTool, H as HookApprovalGate, j as HookApprovalRequest, k as HookGateUnsupportedError, T as ToolWalkResult, m as ToolboxWalkResult, n as compileTools } from './agent-compiler-D7-Xd6Zh.js';
3
3
  export { A as AgentStopReason, d as AgentStreamEvent, e as AgentTurnMetadata, f as ApprovalRequiredEvent, g as ArtifactChunkEvent, h as ArtifactStartEvent, B as BackgroundDelegation, i as BudgetExceededError, C as CheckpointSavedEvent, k as DelegateFn, a as DelegateOptions, l as DelegationBudgetExceededError, m as DelegationError, n as DelegationPort, c as DelegationResult, D as DelegationTarget, o as DoneEvent, E as ErrorEvent, F as FileEditEvent, I as IterationEvent, P as PartialToolCallEvent, v as RunStartedEvent, w as ScoreVerdict, x as ScoredDelegation, y as Scorer, z as StateUpdateEvent, S as StreamEvent, T as TextDeltaEvent, G as ThinkingEvent, H as ToolCallEvent, J as ToolResultEvent, K as delegate, M as delegateBackground, N as delegateWithScoring, O as isApprovalRequired, Q as isDone, U as isError, V as isPartialToolCall, W as isTextDelta, X as isToolCall, Y as isToolResult, a0 as presentUIMessageStream, a3 as streamAgentResponse } from './delegation-scoring-CH9Mr9NF.js';
4
4
  export { a as AGENT_BRAND, A as AgentDefinition, D as DefineAgentConfig, I as InferAgentInput, b as InferAgentToolNames, c as compileAgentDefinition, i as isAgentDefinition } from './define-agent-y3fsG91f.js';
package/dist/bridge.js CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  isToolCall,
23
23
  isToolResult,
24
24
  loadMcpJson,
25
+ loadPersonalMcpServers,
25
26
  mcpRegistry,
26
27
  mcpToolApprovals,
27
28
  presentUIMessageStream,
@@ -29,7 +30,7 @@ import {
29
30
  runWithApiErrorHandling,
30
31
  streamAgentResponse,
31
32
  streamAgentUIMessages
32
- } from "./chunk-G6GCS5XI.js";
33
+ } from "./chunk-DLBGAMHP.js";
33
34
  import {
34
35
  APPROVAL_MODES,
35
36
  BudgetExceededError,
@@ -56,7 +57,7 @@ import {
56
57
  translateSdkEvent,
57
58
  withClockCap,
58
59
  withEphemeralAgent
59
- } from "./chunk-KZPPH6LC.js";
60
+ } from "./chunk-44IHBFL6.js";
60
61
  import "./chunk-MJ6FRILJ.js";
61
62
  import {
62
63
  AGENT_BRAND,
@@ -117,6 +118,7 @@ export {
117
118
  isToolCall,
118
119
  isToolResult,
119
120
  loadMcpJson,
121
+ loadPersonalMcpServers,
120
122
  mcpRegistry,
121
123
  mcpToolApprovals,
122
124
  presentUIMessageStream,
@@ -2591,6 +2591,13 @@ function withPreCompaction(strategy, handler, options) {
2591
2591
  }
2592
2592
  __name(withPreCompaction, "withPreCompaction");
2593
2593
 
2594
+ // src/loop/decomposition.ts
2595
+ function resolveDecomposition(callerSubgoals, declared) {
2596
+ if (declared.length > 0) return declared;
2597
+ return callerSubgoals;
2598
+ }
2599
+ __name(resolveDecomposition, "resolveDecomposition");
2600
+
2594
2601
  // src/bridge/agent-orchestrator.ts
2595
2602
  function requireApiKey(opts, agentName) {
2596
2603
  if (opts.apiKey === null) return "";
@@ -2837,6 +2844,7 @@ export {
2837
2844
  DEFAULT_HANDLER_TIMEOUT_MS,
2838
2845
  PreCompactionHandlerError,
2839
2846
  withPreCompaction,
2847
+ resolveDecomposition,
2840
2848
  delegate,
2841
2849
  DelegationTimeoutError,
2842
2850
  withClockCap,
@@ -2845,4 +2853,4 @@ export {
2845
2853
  delegateBackground,
2846
2854
  delegateWithScoring
2847
2855
  };
2848
- //# sourceMappingURL=chunk-KZPPH6LC.js.map
2856
+ //# sourceMappingURL=chunk-44IHBFL6.js.map