@theokit/agents 13.4.0 → 14.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 (37) hide show
  1. package/CHANGELOG.md +203 -0
  2. package/README.md +28 -0
  3. package/dist/{agent-compiler-BaOZzU7Q.d.ts → agent-compiler-B1F9iumK.d.ts} +1 -1
  4. package/dist/auth.js +0 -2
  5. package/dist/auth.js.map +1 -1
  6. package/dist/{bridge-entry-BgWauyLQ.d.ts → bridge-entry-C0MwIOpc.d.ts} +4 -4
  7. package/dist/bridge.d.ts +5 -5
  8. package/dist/bridge.js +3 -3
  9. package/dist/{chunk-CBP72LFM.js → chunk-BHX2BMKG.js} +7 -7
  10. package/dist/chunk-BHX2BMKG.js.map +1 -0
  11. package/dist/{chunk-PYVLRSXZ.js → chunk-NKPNVQBF.js} +2 -1
  12. package/dist/chunk-NKPNVQBF.js.map +1 -0
  13. package/dist/{chunk-SL3QW5WZ.js → chunk-ZDYCYSPL.js} +3 -3
  14. package/dist/config.d.ts +1 -1
  15. package/dist/config.js +7 -3
  16. package/dist/config.js.map +1 -1
  17. package/dist/{define-agent-DOZL_0uP.d.ts → define-agent-D1zBG-Ys.d.ts} +2 -2
  18. package/dist/{delegation-scoring-DLsMQ4BJ.d.ts → delegation-scoring-BTuTKWkZ.d.ts} +1 -1
  19. package/dist/hooks.d.ts +85 -48
  20. package/dist/hooks.js +44 -42
  21. package/dist/hooks.js.map +1 -1
  22. package/dist/index.d.ts +9 -9
  23. package/dist/index.js +3 -3
  24. package/dist/persistence.d.ts +1 -1
  25. package/dist/persistence.js +5 -27
  26. package/dist/persistence.js.map +1 -1
  27. package/dist/sandbox.js.map +1 -1
  28. package/dist/session.js.map +1 -1
  29. package/dist/{setting-sources-gate-BXdZmY78.d.ts → setting-sources-gate-BoTngPIn.d.ts} +50 -8
  30. package/dist/testing.d.ts +3 -3
  31. package/dist/testing.js +1 -1
  32. package/dist/tools.d.ts +3 -3
  33. package/dist/tools.js +2 -2
  34. package/package.json +2 -2
  35. package/dist/chunk-CBP72LFM.js.map +0 -1
  36. package/dist/chunk-PYVLRSXZ.js.map +0 -1
  37. /package/dist/{chunk-SL3QW5WZ.js.map → chunk-ZDYCYSPL.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,208 @@
1
1
  # @theokit/agents
2
2
 
3
+ ## 14.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - ef049e1: The declared `@theokit/sdk` range no longer admits a floor that delivers zero parity.
8
+
9
+ `packages/agents` declared `^4.52.1 || ^5.0.0` and `packages/theo` peer-declared the same. Measured
10
+ by unpacking the published tarballs, against a control of `AgentOptions` (83-86 files in every one):
11
+
12
+ | surface | 4.52.1 | 5.0.0 | 5.3.0 | 5.4.0 |
13
+ | -------------------------------- | ------ | ----- | ----- | ----- |
14
+ | `CompatSurface` | 0 | 10 | 10 | 10 |
15
+ | `.claude/rules/*` discovery spec | 0 | 4 | 4 | 4 |
16
+ | `settings.local.json` | 0 | 4 | 4 | 4 |
17
+ | `CLAUDE_PROJECT_DIR` | 0 | 14 | 14 | 14 |
18
+
19
+ The boundary is the 4→5 major exactly, and the lower half of the declared range delivered **zero**
20
+ parity. Not one missing surface — every surface at once, invisibly, because the package resolves,
21
+ compiles and runs. This repository's own lockfile resolved 4.52.1, so its green suite was green
22
+ against an SDK where `compatSources` does not exist as an option.
23
+
24
+ **Why the range rather than a fourth runtime guard.** Three version guards already exist
25
+ (`HOOK_GATE_SINCE`, `COMPAT_IMPORT_SINCE`, and the `compatSources` warning), and every one is on a
26
+ path where this layer PASSES AN OPTION to the SDK. The surfaces above are not like that: nothing is
27
+ passed, the SDK reads a file or it does not, so there is no call site to guard. A fourth check could
28
+ not have been written. The reason the floor stayed low is recorded in the code and has expired —
29
+ _"Until this package's floor can name a stable 5.x"_; `@theokit/sdk@5.5.0` is `latest`, and stable
30
+ 5.x has existed since 5.3.0.
31
+
32
+ **The floor is `^5.3.0`, and the first attempt at `^5.0.0` was wrong for an instructive reason.**
33
+ Verifying that the four parity surfaces exist at 5.0.0 — they do — was necessary and not sufficient.
34
+ The persistence barrel is GENERATED from the resolved copy, so it also ships whatever that copy
35
+ exports, and six of those names do not exist at 5.0.0. The DTS build fails against the bottom of the
36
+ range, which a consumer meets as a build error rather than as a typed refusal.
37
+
38
+ Caught by `dep-check / suite at the bottom of every declared range`, the job that skips on a pull
39
+ request into `develop` and runs on one into `main` — it fired exactly where it was designed to.
40
+
41
+ Measured with controls at each version (positive `transcriptPath` = 1, invented name = 0): 5.0.0
42
+ carries **1 of the 7**; 5.3.0, 5.4.0 and 5.5.0 carry **7 of 7**. So 5.3.0 is the lowest version
43
+ _proven_ to work, not necessarily the first — the two releases between them are not in the measured
44
+ set, and a declared floor that was proven beats one that was inferred.
45
+
46
+ **Why not 5.4.0.** `local.hooks` and the narrowed `compatSources[].import` landed in
47
+ 5.4.0, which is inside the new range — and that is deliberate. Both already throw a typed error
48
+ naming the version they need. Raising the floor to 5.4.0 would strand every 5.0-5.3 consumer who
49
+ uses neither, in order to duplicate a refusal that already announces itself. The invariant is that
50
+ every version the range admits either works or fails with a typed error naming what it needs; none
51
+ fails in silence. A silent gap is closed by the range, a named one is not.
52
+
53
+ **What the narrowing exposed, which is the item's real value.** The workspace itself resolved
54
+ 4.52.1, so raising the floor moved it to 5.5.0 and five test files went red with no production line
55
+ changed. Each was something never verified:
56
+
57
+ - `packages/agents/persistence` gained **7 exports** it had never been able to carry —
58
+ `LiveTranscriptError`, `legacyTranscriptPath`, `listSessions`, `sessionUuidFor`,
59
+ `ListSessionsOptions`, `SessionIdSource`, `SessionListing`. None were withheld; they were
60
+ unreachable. The barrel is generated from the resolved copy, and a barrel generated against the
61
+ bottom of a range ships the bottom of the range. `LiveTranscriptError` carried a note ending
62
+ _"revisit when the floor moves past 4.x"_ — this is that revisit.
63
+ - `assembleM8CreateOptions`'s `deps.sdkVersion`, documented "Injectable for tests", reached the hook
64
+ gate and **not** the narrowed-import gate. So that gate could only ever read the ambient
65
+ installation, and its test passed because the machine happened to resolve 4.52.1. The seam now
66
+ reaches both, and the refusal is pinned with a version on each side rather than one.
67
+ - `effectiveToolNames` entered the root bar in 5.x and was invisible here. Recorded `out` with
68
+ measured evidence (0 callers in this repo, 0 in the downstream product, against probe controls of
69
+ 3 and 90) rather than by taste.
70
+
71
+ **Why `theokit` takes a minor and not a major.** Narrowing a dependency range IS breaking, and under
72
+ semver 0.x the breaking slot is the MINOR — `major` on a 0.x package means declaring 1.0.0, which is a
73
+ statement about stability, not about this change. `theokit` is at 0.65.0 and has never taken a major:
74
+ its own CHANGELOG carries entries labelled "BREAKING for hand-built compiled options" that shipped as
75
+ minors. `public-copy.md § 3` refuses the production-ready claim until there is sustained measured
76
+ evidence, and a 1.0.0 cut is that claim in the one place every consumer reads it. `@theokit/agents`
77
+ (13.4.0) and `create-theokit` (2.0.0) are past 1.0, so their majors are the ordinary encoding.
78
+
79
+ **Breaking:** a consumer pinned to `@theokit/sdk@4.x` can no longer install these packages. That
80
+ consumer was already receiving none of the `.claude` compatibility the packages advertise, and
81
+ `HookGateUnsupportedError` was already refusing them outright if they declared a hook gate. `theo`
82
+ moves with `agents` because it depends on it: a peer range advertising a major its own dependency
83
+ rejects is unsatisfiable at install time and says nothing until then.
84
+
85
+ ### Minor Changes
86
+
87
+ - f28ebd5: `THEO.local.md` and `AGENTS.local.md` are read, and composed after the files they refine.
88
+
89
+ The gitignored companion is where an operator keeps the standing corrections that matter most to
90
+ them — the ones too personal or too situational to commit. Nothing read it. Measured 2026-09-12: a
91
+ grep for the four `.local` spellings returned **0 files** across every package source tree, against
92
+ a control of 4 for `AGENTS.md`; the same query over the newly-resolved `@theokit/sdk@5.5.0`
93
+ returned **0** against a control of 23 for `CLAUDE.md`. The gap is in both layers, and raising the
94
+ SDK floor did not close it.
95
+
96
+ The failure is the silent kind: the file exists, it is named the documented way, nothing loads it,
97
+ and nothing complains. The agent behaves exactly as it would if the operator had written nothing,
98
+ which from the outside is indistinguishable from the instructions being wrong.
99
+
100
+ **Order shipped with membership, because membership alone would have shipped broken.**
101
+ `localeCompare` sorts `AGENTS.local.md` BEFORE `AGENTS.md` — `'l' < 'm'` — so adding the names to
102
+ `DEFAULT_FILE_NAMES` and nothing else would compose the operator's correction _before_ the rule it
103
+ was written to correct. The file would load and lose: a subtler version of the original defect, and
104
+ just as quiet. `walkOrder` now emits three bands within a directory — public files, private files,
105
+ then subdirectories — each boundary carrying its reason. The `lexicographic` mode stays literally
106
+ alphabetical; it is the documented escape for a caller who wants the raw order.
107
+
108
+ **The two chains are independent.** A local file never replaces its public sibling; both load. The
109
+ trap avoided is one chain falling back to the other, where adding a `THEO.md` would silently orphan
110
+ an existing `AGENTS.local.md` — a file the operator wrote, disabled by a file they added for an
111
+ unrelated reason.
112
+
113
+ **`CLAUDE.local.md` is deliberately not included.** `CLAUDE.md` is not in the public half of this
114
+ list either, so a private companion to a file this seam does not read would pair with nothing. If
115
+ `CLAUDE.md` is ever added, its companion comes with it.
116
+
117
+ Also corrects two comments in the same file that `@theokit/sdk@^5.0.0` made false: one described a
118
+ cast removed when the type began resolving — the symlink-escape **control it guards is untouched**,
119
+ and the note stays so its removal does not read as the control being relaxed — and one duplicated an
120
+ ordering rationale that now lives with the ordering.
121
+
122
+ - 914e177: A caller can now name the foreign root's instructions — `context` is a `CompatSurface`.
123
+
124
+ `.claude/rules/*.md` had no name a consumer could write. The union was `'commands' | 'hooks' |
125
+ 'plugins' | 'skills' | 'subagents'` — five names for a root that feeds six things — and the gate's
126
+ own docblock had already written the rule that violated: "An enumeration used to NARROW a root must
127
+ cover every surface that root feeds: a name absent from the vocabulary is a surface the caller
128
+ cannot ask for and cannot be told it lost."
129
+
130
+ It was measured from the other end. `theokit-sdk` #652: `FileContextManager` consulted no
131
+ foreign-dialect grant at all, so a cloned repository's `.claude/rules/*.md` reached the system
132
+ prompt of a consumer who had declared only its own `.theokit/` — while that same directory's hooks,
133
+ skills, subagents and plugins were correctly withheld. Closing that gate is what makes the missing
134
+ name here load-bearing: once the SDK honours a `context` grant, a caller with no word for it loses
135
+ the rules silently.
136
+
137
+ **This ships BEFORE the SDK release that honours it, and the ordering is safe in exactly one
138
+ direction.** The SDK matches a narrowed `import` list per surface, so a name it does not recognise
139
+ is never matched and changes nothing: on today's SDK the rules load as they always did, and on the
140
+ next one the grant is what keeps them loading. The reverse order would take `.claude/rules` from
141
+ every caller here with no name they could write to ask for it back.
142
+
143
+ A consumer passing the bare `'claude-code'` literal is unaffected — it still means the whole root.
144
+ What changes is that `import: ['context']` is now expressible, so taking a foreign repository's
145
+ house rules no longer requires also granting it command execution.
146
+
147
+ ### Patch Changes
148
+
149
+ - 6c1a602: Four `.claude` mechanisms are now declared out of scope, with the reason and the owner.
150
+
151
+ An absence that reads as an oversight gets re-investigated at full cost by the next person. The
152
+ `.claude` sweep produced a table with absences in it, and shipping that without separating "we
153
+ decided not to" from "we have not got to it" reproduces the defect the table exists to prevent.
154
+
155
+ Measured 2026-09-12: `keybindings`, `themes/` and `.claude.json` each return **0 files** across every
156
+ package source tree, against a control of 31 for `skills`.
157
+
158
+ | Surface | Verdict |
159
+ | --------------------------------------------- | -------------------------------- |
160
+ | `keybindings.json` | out of scope — `@theokit/tui` |
161
+ | `themes/*.json` | out of scope — `@theokit/tui` |
162
+ | `~/.claude.json` — OAuth state, UI toggles | out of scope — a CLI's own state |
163
+ | `~/.claude.json` — personal-scope MCP servers | **not read yet**, and in scope |
164
+
165
+ **A framework has no keyboard and no colour.** It produces text and tool calls; the process that
166
+ renders them owns which key does what and which escape codes it emits. Reading those here would let
167
+ this package hold configuration it cannot act on, which is the accepted-and-ignored failure the whole
168
+ table exists to prevent.
169
+
170
+ **`~/.claude.json` is two things under one name, and the split is the point.** One verdict over the
171
+ whole file would be wrong about one half whichever way it went: the OAuth state is a specific
172
+ program's own session, and a library reading another program's login state reaches into something it
173
+ neither owns nor can refresh — while an MCP server the operator registered for themselves is a
174
+ framework concern, and this package already reads project-scope servers from `.mcp.json`. That half
175
+ is **not refused; it is not done**, and the two stay distinguishable because the reader deciding
176
+ whether to file a bug needs to know which one they are looking at.
177
+
178
+ Declared in `README.md` and not only in the project's rules directory, because that directory is
179
+ gitignored — a decision recorded only there is a decision made for one checkout.
180
+
181
+ Separately, `SettingSourcesSelection.user`'s docblock stops describing a capability the runtime does
182
+ not have: nothing reads the operator's root because of that flag (`includesSetting` is called with
183
+ exactly `"project"` and `"plugins"` at `@theokit/sdk@5.5.0`). What the SDK _does_ read from
184
+ `~/.theokit/` — model-provider plugins, the provider trust file, transcripts, the HTTP cache — it
185
+ reads unconditionally, governed by nothing. The flag is still accepted rather than refused: the
186
+ measured consumer passes it on every run, including the untrusted-directory path where it is the only
187
+ grant, so refusing would turn a graceful degradation into a throw for the case it exists to survive.
188
+
189
+ - 24e1fab: State, where hook events are declared, that no seam can run before compaction
190
+
191
+ B-002 FR-004. A consumer needing to persist state before the transcript is compacted has no event to
192
+ bind to, and could only learn that by writing a handler and watching it never fire.
193
+
194
+ Measured against `@theokit/sdk@5.5.0`: `HookName` is a closed union of ten names with no compaction
195
+ member, and `PluginContext.on` keys its callback by that union — so no event name can be added from
196
+ this package. The SDK's own auto-compaction path is further out of reach: bundle-internal, absent
197
+ from every emitted `.d.ts` and all 33 export subpaths, and it builds its own summarizer at the call
198
+ site.
199
+
200
+ The docblock now says so and names `usetheokit/theokit-sdk#653`, the issue that unblocks it, so a
201
+ reader arrives at the nine candidate seams already ruled out rather than repeating the enumeration.
202
+
203
+ `hook-events.ts` is split out of `hook-spec.ts`, which had drifted to 616 lines against the 600 its
204
+ brief caps it at. Every symbol callers import stays importable from `hook-spec.js`.
205
+
3
206
  ## 13.4.0
4
207
 
5
208
  ### Minor Changes
package/README.md CHANGED
@@ -99,6 +99,34 @@ configuration that had no effect.
99
99
  | `output-styles/*.md` | read, selected by `settings.json` |
100
100
  | `agent-memory/` | read — see below |
101
101
  | `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` |
104
+ | `~/.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
+
107
+
108
+ ### Out of scope, and who owns it instead
109
+
110
+ An absence that reads as an oversight gets re-investigated at full cost by the next person. These
111
+ were measured on 2026-09-12 — `keybindings`, `themes/` and `.claude.json` each return **0 files**
112
+ across every package source tree, against a control of 31 for `skills` — and each one is a decision
113
+ rather than a gap.
114
+
115
+ **`keybindings.json` and `themes/*.json` belong to `@theokit/tui`.** A framework has no keyboard and
116
+ no colour: it produces text and tool calls, and the process that renders them owns which key does
117
+ what and which escape codes it emits. Reading them here would let this package hold configuration it
118
+ cannot act on, which is the accepted-and-ignored failure the table above exists to prevent.
119
+
120
+ **`~/.claude.json` is two things under one name, and the split is the point.** Its OAuth state and UI
121
+ toggles are a CLI's own state — that file is written by a specific program about its own session, and
122
+ a library reading another program's login state would be reaching into something it neither owns nor
123
+ can refresh. Its **personal-scope MCP servers** are a different matter: an MCP server the operator
124
+ 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.
127
+
128
+ The registry entry that prompted this counts four decisions across three files, because
129
+ `~/.claude.json` is split. That is the count, stated so nobody goes looking for a fourth file.
102
130
 
103
131
  ### `agent-memory/`
104
132
 
@@ -2,7 +2,7 @@ import { InlineSkill, SystemPromptResolver, SessionStore, PermissionGate, Memory
2
2
  import { AgentDefinition } from '@theokit/sdk/subagents-loader';
3
3
  import { TheokitAgentError } from '@theokit/sdk/errors';
4
4
  import { R as ReasoningEffort, a as MemoryOptions, P as ProjectContextOptions, M as McpServersMap, H as HumanInTheLoopOptions, C as CheckpointOptions, T as ToolOptions, A as ApprovalOptions, B as BudgetOptions } from './types-C16Wuh9E.js';
5
- import { G as GatedSettingSource, a as GatedCompatSource } from './setting-sources-gate-BXdZmY78.js';
5
+ import { G as GatedSettingSource, a as GatedCompatSource } from './setting-sources-gate-BoTngPIn.js';
6
6
 
7
7
  /**
8
8
  * M9 (theokit-ai-first) — guardrail contract + typed errors.
package/dist/auth.js CHANGED
@@ -438,7 +438,6 @@ function requireCredential(input) {
438
438
  if (resolved !== void 0) return resolved;
439
439
  throw new CredentialNotFoundError(credentialSources({
440
440
  providers: input.providers,
441
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- `CredentialStoreConfig` does not resolve (see the import note at the top of this file); the value is only forwarded, never inspected
442
441
  ...input.store === void 0 ? {} : {
443
442
  store: input.store
444
443
  }
@@ -476,7 +475,6 @@ function resolveAgentCredential(input) {
476
475
  ...input.model === void 0 ? {} : {
477
476
  model: input.model
478
477
  },
479
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- same unresolved `CredentialStoreConfig`; forwarded verbatim to the resolver
480
478
  ...input.store === void 0 ? {} : {
481
479
  store: input.store
482
480
  }
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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AIY,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"],"mappings":";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F,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,14 +1,14 @@
1
1
  import { ExecutionContext } from '@theokit/http';
2
2
  import { c as AgentOptions, T as ToolOptions, P as ProjectContextOptions, H as HumanInTheLoopOptions, R as ReasoningEffort, M as McpServersMap } from './types-C16Wuh9E.js';
3
- import { a as CompiledAgentOptions, b as CompiledTool, G as Guardrail, S as SkillsSelection, H as HookApprovalGate, C as CodePlugin } from './agent-compiler-BaOZzU7Q.js';
3
+ import { a as CompiledAgentOptions, b as CompiledTool, G as Guardrail, S as SkillsSelection, H as HookApprovalGate, C as CodePlugin } from './agent-compiler-B1F9iumK.js';
4
4
  import { SkillsSettings, ContextSettings, SystemPromptResolver, ModelSelection, PluginsSettings, Plugin, ProviderRoutingSettings, AgentDefinition as AgentDefinition$1, BudgetTracker, CustomTool, RunEventSink, MemorySettings, TelemetrySettings } from '@theokit/sdk';
5
- import { S as StreamEvent, f as ApprovalRequiredEvent, a4 as MaskError } from './delegation-scoring-DLsMQ4BJ.js';
5
+ import { S as StreamEvent, f as ApprovalRequiredEvent, a4 as MaskError } from './delegation-scoring-BTuTKWkZ.js';
6
6
  import { RetryOptions } from '@theokit/sdk/retry';
7
7
  import { SandboxPosture } from '@theokit/sdk/sandbox';
8
- import { A as AgentDefinition } from './define-agent-DOZL_0uP.js';
8
+ import { A as AgentDefinition } from './define-agent-D1zBG-Ys.js';
9
9
  import { z } from 'zod';
10
10
  import { H as HookHandlers } from './hook-handlers-Cw2FsnE5.js';
11
- import { S as SettingSourcesSelection } from './setting-sources-gate-BXdZmY78.js';
11
+ import { S as SettingSourcesSelection } from './setting-sources-gate-BoTngPIn.js';
12
12
  import { WireChunk } from '@theokit/presenter/wire';
13
13
  import { TheokitAgentError } from '@theokit/sdk/errors';
14
14
 
package/dist/bridge.d.ts CHANGED
@@ -1,8 +1,8 @@
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-BgWauyLQ.js';
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-BaOZzU7Q.js';
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-DLsMQ4BJ.js';
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-DOZL_0uP.js';
5
- export { C as CompatSurface, a as GatedCompatSource, G as GatedSettingSource, P as ProjectSettingsGrant, R as ResolvedCompatSource, b as SettingSourceCapability, S as SettingSourcesSelection, U as UntrustedSettingSourceError, r as resolveCompatSources, c as resolveSettingSources } from './setting-sources-gate-BXdZmY78.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 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-C0MwIOpc.js';
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-B1F9iumK.js';
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-BTuTKWkZ.js';
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-D1zBG-Ys.js';
5
+ export { C as CompatSurface, a as GatedCompatSource, G as GatedSettingSource, P as ProjectSettingsGrant, R as ResolvedCompatSource, b as SettingSourceCapability, S as SettingSourcesSelection, U as UntrustedSettingSourceError, r as resolveCompatSources, c as resolveSettingSources } from './setting-sources-gate-BoTngPIn.js';
6
6
  import '@theokit/http';
7
7
  import './types-C16Wuh9E.js';
8
8
  import '@theokit/sdk';
package/dist/bridge.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  runWithApiErrorHandling,
30
30
  streamAgentResponse,
31
31
  streamAgentUIMessages
32
- } from "./chunk-SL3QW5WZ.js";
32
+ } from "./chunk-ZDYCYSPL.js";
33
33
  import {
34
34
  APPROVAL_MODES,
35
35
  BudgetExceededError,
@@ -56,7 +56,7 @@ import {
56
56
  translateSdkEvent,
57
57
  withClockCap,
58
58
  withEphemeralAgent
59
- } from "./chunk-CBP72LFM.js";
59
+ } from "./chunk-BHX2BMKG.js";
60
60
  import "./chunk-MJ6FRILJ.js";
61
61
  import {
62
62
  AGENT_BRAND,
@@ -65,7 +65,7 @@ import {
65
65
  isAgentDefinition,
66
66
  resolveCompatSources,
67
67
  resolveSettingSources
68
- } from "./chunk-PYVLRSXZ.js";
68
+ } from "./chunk-NKPNVQBF.js";
69
69
  import "./chunk-M5J3Q6YC.js";
70
70
  import "./chunk-U72XTMYB.js";
71
71
  import "./chunk-2SP5BB6U.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-MJ6FRILJ.js";
5
5
  import {
6
6
  compileAgentDefinition
7
- } from "./chunk-PYVLRSXZ.js";
7
+ } from "./chunk-NKPNVQBF.js";
8
8
  import {
9
9
  debugLog
10
10
  } from "./chunk-M5J3Q6YC.js";
@@ -722,7 +722,7 @@ function applyPlugins(compiled, options, applied) {
722
722
  }
723
723
  }
724
724
  __name(applyPlugins, "applyPlugins");
725
- function applyLocalSources(compiled, options, applied) {
725
+ function applyLocalSources(compiled, options, applied, sdkVersion) {
726
726
  if (compiled.settingSources !== void 0 && compiled.settingSources.length > 0) {
727
727
  options.local = {
728
728
  ...options.local,
@@ -742,7 +742,7 @@ function applyLocalSources(compiled, options, applied) {
742
742
  if (compiled.compatSources !== void 0 && compiled.compatSources.length > 0) {
743
743
  const forSdk = compatSourcesForSdk(compiled.compatSources);
744
744
  if (forSdk.some((c) => typeof c === "object" && "import" in c)) {
745
- assertSdkCanReadNarrowedImport(installedSdkVersion());
745
+ assertSdkCanReadNarrowedImport(sdkVersion ?? installedSdkVersion());
746
746
  }
747
747
  if (forSdk.length > 0) {
748
748
  options.local = {
@@ -778,7 +778,7 @@ function assembleM8CreateOptions(compiled, deps = {}) {
778
778
  options.agents = compiled.agents;
779
779
  applied.push("agents");
780
780
  }
781
- applyLocalSources(compiled, options, applied);
781
+ applyLocalSources(compiled, options, applied, deps.sdkVersion);
782
782
  applyHookApproval(compiled, options, applied, deps.sdkVersion);
783
783
  if (compiled.context) {
784
784
  options.context = compiled.context;
@@ -1532,7 +1532,7 @@ async function startTurn(open, retry) {
1532
1532
  }
1533
1533
  }, "attempt");
1534
1534
  const { Retry } = await import("@theokit/sdk/retry");
1535
- return Retry.create(attempt, retry);
1535
+ return Retry.run(attempt, retry);
1536
1536
  }
1537
1537
  __name(startTurn, "startTurn");
1538
1538
  async function* withTurnStartRetry(open, retry) {
@@ -2139,7 +2139,7 @@ async function startRound(factory, prompt, sessionId, signal, retry) {
2139
2139
  }, "open");
2140
2140
  if (!retry) return open();
2141
2141
  const { Retry } = await import("@theokit/sdk/retry");
2142
- return Retry.create(open, {
2142
+ return Retry.run(open, {
2143
2143
  ...retry,
2144
2144
  signal: retry.signal ?? signal
2145
2145
  });
@@ -2777,4 +2777,4 @@ export {
2777
2777
  delegateBackground,
2778
2778
  delegateWithScoring
2779
2779
  };
2780
- //# sourceMappingURL=chunk-CBP72LFM.js.map
2780
+ //# sourceMappingURL=chunk-BHX2BMKG.js.map