@theokit/agents 13.4.0 → 14.1.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 +246 -0
- package/README.md +28 -0
- package/dist/{agent-compiler-BaOZzU7Q.d.ts → agent-compiler-B1F9iumK.d.ts} +1 -1
- package/dist/auth.js +0 -2
- package/dist/auth.js.map +1 -1
- package/dist/{bridge-entry-BgWauyLQ.d.ts → bridge-entry-C0MwIOpc.d.ts} +4 -4
- package/dist/bridge.d.ts +5 -5
- package/dist/bridge.js +3 -3
- package/dist/{chunk-CBP72LFM.js → chunk-72QVLTDI.js} +77 -9
- package/dist/chunk-72QVLTDI.js.map +1 -0
- package/dist/{chunk-SL3QW5WZ.js → chunk-DFGIED4E.js} +3 -3
- package/dist/{chunk-PYVLRSXZ.js → chunk-NKPNVQBF.js} +2 -1
- package/dist/chunk-NKPNVQBF.js.map +1 -0
- package/dist/config.d.ts +1 -1
- package/dist/config.js +7 -3
- package/dist/config.js.map +1 -1
- package/dist/{define-agent-DOZL_0uP.d.ts → define-agent-D1zBG-Ys.d.ts} +2 -2
- package/dist/{delegation-scoring-DLsMQ4BJ.d.ts → delegation-scoring-BTuTKWkZ.d.ts} +1 -1
- package/dist/hooks.d.ts +85 -48
- package/dist/hooks.js +44 -42
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +89 -10
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/dist/persistence.d.ts +1 -1
- package/dist/persistence.js +5 -27
- package/dist/persistence.js.map +1 -1
- package/dist/sandbox.js.map +1 -1
- package/dist/session.js.map +1 -1
- package/dist/{setting-sources-gate-BXdZmY78.d.ts → setting-sources-gate-BoTngPIn.d.ts} +50 -8
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +1 -1
- package/dist/tools.d.ts +3 -3
- package/dist/tools.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-CBP72LFM.js.map +0 -1
- package/dist/chunk-PYVLRSXZ.js.map +0 -1
- /package/dist/{chunk-SL3QW5WZ.js.map → chunk-DFGIED4E.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,251 @@
|
|
|
1
1
|
# @theokit/agents
|
|
2
2
|
|
|
3
|
+
## 14.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 22a36da: `withPreCompaction` runs your work — and awaits it — before a transcript is rewritten.
|
|
8
|
+
|
|
9
|
+
Until now the only signal near compaction was `compact_boundary`, which fires **after** the rewrite
|
|
10
|
+
and returns `void`. A consumer wanting to persist state that compaction destroys had nowhere to put
|
|
11
|
+
it, and the workaround was to build a policy on a turn hook and hope the ordering held.
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { withPreCompaction } from '@theokit/agents'
|
|
15
|
+
|
|
16
|
+
const guarded = withPreCompaction(runner.compaction!, async (messages) => {
|
|
17
|
+
await archive(messages) // the PRE-compaction transcript, still whole
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
await guarded.compact(transcript, { summarize })
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
It is a decorator over `TranscriptCompactionStrategy`, so the result satisfies the same interface
|
|
24
|
+
and every existing consumer accepts it unchanged. Registration is once per strategy rather than per
|
|
25
|
+
call — a handler you have to remember to pass is a handler that is absent from the call site you
|
|
26
|
+
forgot.
|
|
27
|
+
|
|
28
|
+
**What it does not cover, stated here rather than discovered later.** The SDK's auto-compaction path
|
|
29
|
+
— the one that fires on its own when usage crosses a threshold — has no consumer callback and none
|
|
30
|
+
can be added from this layer. A handler registered here never runs on that path. Tracked upstream as
|
|
31
|
+
`usetheokit/theokit-sdk#653`; the limit is also stated in the docblock where hook events are
|
|
32
|
+
declared, so it is visible from the file you would be reading when the question occurs to you.
|
|
33
|
+
|
|
34
|
+
**Failure is reported, never fatal.** A handler that rejects, throws synchronously, or exceeds its
|
|
35
|
+
bound (30s by default, configurable) is passed to your `onError` as a typed
|
|
36
|
+
`PreCompactionHandlerError` carrying `reason: 'timeout' | 'threw'` — and compaction proceeds anyway.
|
|
37
|
+
A run that cannot compact meets the context wall, which is worse than a run whose handler failed.
|
|
38
|
+
|
|
39
|
+
The handler also receives an `AbortSignal` that fires when the bound is reached, so a cooperative
|
|
40
|
+
handler can drop work that is now pointless instead of running on, detached, after compaction stopped
|
|
41
|
+
waiting for it. Signalling is not stopping — the timeout is what releases compaction either way.
|
|
42
|
+
|
|
43
|
+
The handler receives a readonly copy: `compact` documents that it never mutates its input, and a
|
|
44
|
+
seam that handed out the live array would open a mutation path through that guarantee.
|
|
45
|
+
|
|
46
|
+
## 14.0.0
|
|
47
|
+
|
|
48
|
+
### Major Changes
|
|
49
|
+
|
|
50
|
+
- ef049e1: The declared `@theokit/sdk` range no longer admits a floor that delivers zero parity.
|
|
51
|
+
|
|
52
|
+
`packages/agents` declared `^4.52.1 || ^5.0.0` and `packages/theo` peer-declared the same. Measured
|
|
53
|
+
by unpacking the published tarballs, against a control of `AgentOptions` (83-86 files in every one):
|
|
54
|
+
|
|
55
|
+
| surface | 4.52.1 | 5.0.0 | 5.3.0 | 5.4.0 |
|
|
56
|
+
| -------------------------------- | ------ | ----- | ----- | ----- |
|
|
57
|
+
| `CompatSurface` | 0 | 10 | 10 | 10 |
|
|
58
|
+
| `.claude/rules/*` discovery spec | 0 | 4 | 4 | 4 |
|
|
59
|
+
| `settings.local.json` | 0 | 4 | 4 | 4 |
|
|
60
|
+
| `CLAUDE_PROJECT_DIR` | 0 | 14 | 14 | 14 |
|
|
61
|
+
|
|
62
|
+
The boundary is the 4→5 major exactly, and the lower half of the declared range delivered **zero**
|
|
63
|
+
parity. Not one missing surface — every surface at once, invisibly, because the package resolves,
|
|
64
|
+
compiles and runs. This repository's own lockfile resolved 4.52.1, so its green suite was green
|
|
65
|
+
against an SDK where `compatSources` does not exist as an option.
|
|
66
|
+
|
|
67
|
+
**Why the range rather than a fourth runtime guard.** Three version guards already exist
|
|
68
|
+
(`HOOK_GATE_SINCE`, `COMPAT_IMPORT_SINCE`, and the `compatSources` warning), and every one is on a
|
|
69
|
+
path where this layer PASSES AN OPTION to the SDK. The surfaces above are not like that: nothing is
|
|
70
|
+
passed, the SDK reads a file or it does not, so there is no call site to guard. A fourth check could
|
|
71
|
+
not have been written. The reason the floor stayed low is recorded in the code and has expired —
|
|
72
|
+
_"Until this package's floor can name a stable 5.x"_; `@theokit/sdk@5.5.0` is `latest`, and stable
|
|
73
|
+
5.x has existed since 5.3.0.
|
|
74
|
+
|
|
75
|
+
**The floor is `^5.3.0`, and the first attempt at `^5.0.0` was wrong for an instructive reason.**
|
|
76
|
+
Verifying that the four parity surfaces exist at 5.0.0 — they do — was necessary and not sufficient.
|
|
77
|
+
The persistence barrel is GENERATED from the resolved copy, so it also ships whatever that copy
|
|
78
|
+
exports, and six of those names do not exist at 5.0.0. The DTS build fails against the bottom of the
|
|
79
|
+
range, which a consumer meets as a build error rather than as a typed refusal.
|
|
80
|
+
|
|
81
|
+
Caught by `dep-check / suite at the bottom of every declared range`, the job that skips on a pull
|
|
82
|
+
request into `develop` and runs on one into `main` — it fired exactly where it was designed to.
|
|
83
|
+
|
|
84
|
+
Measured with controls at each version (positive `transcriptPath` = 1, invented name = 0): 5.0.0
|
|
85
|
+
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
|
|
86
|
+
_proven_ to work, not necessarily the first — the two releases between them are not in the measured
|
|
87
|
+
set, and a declared floor that was proven beats one that was inferred.
|
|
88
|
+
|
|
89
|
+
**Why not 5.4.0.** `local.hooks` and the narrowed `compatSources[].import` landed in
|
|
90
|
+
5.4.0, which is inside the new range — and that is deliberate. Both already throw a typed error
|
|
91
|
+
naming the version they need. Raising the floor to 5.4.0 would strand every 5.0-5.3 consumer who
|
|
92
|
+
uses neither, in order to duplicate a refusal that already announces itself. The invariant is that
|
|
93
|
+
every version the range admits either works or fails with a typed error naming what it needs; none
|
|
94
|
+
fails in silence. A silent gap is closed by the range, a named one is not.
|
|
95
|
+
|
|
96
|
+
**What the narrowing exposed, which is the item's real value.** The workspace itself resolved
|
|
97
|
+
4.52.1, so raising the floor moved it to 5.5.0 and five test files went red with no production line
|
|
98
|
+
changed. Each was something never verified:
|
|
99
|
+
|
|
100
|
+
- `packages/agents/persistence` gained **7 exports** it had never been able to carry —
|
|
101
|
+
`LiveTranscriptError`, `legacyTranscriptPath`, `listSessions`, `sessionUuidFor`,
|
|
102
|
+
`ListSessionsOptions`, `SessionIdSource`, `SessionListing`. None were withheld; they were
|
|
103
|
+
unreachable. The barrel is generated from the resolved copy, and a barrel generated against the
|
|
104
|
+
bottom of a range ships the bottom of the range. `LiveTranscriptError` carried a note ending
|
|
105
|
+
_"revisit when the floor moves past 4.x"_ — this is that revisit.
|
|
106
|
+
- `assembleM8CreateOptions`'s `deps.sdkVersion`, documented "Injectable for tests", reached the hook
|
|
107
|
+
gate and **not** the narrowed-import gate. So that gate could only ever read the ambient
|
|
108
|
+
installation, and its test passed because the machine happened to resolve 4.52.1. The seam now
|
|
109
|
+
reaches both, and the refusal is pinned with a version on each side rather than one.
|
|
110
|
+
- `effectiveToolNames` entered the root bar in 5.x and was invisible here. Recorded `out` with
|
|
111
|
+
measured evidence (0 callers in this repo, 0 in the downstream product, against probe controls of
|
|
112
|
+
3 and 90) rather than by taste.
|
|
113
|
+
|
|
114
|
+
**Why `theokit` takes a minor and not a major.** Narrowing a dependency range IS breaking, and under
|
|
115
|
+
semver 0.x the breaking slot is the MINOR — `major` on a 0.x package means declaring 1.0.0, which is a
|
|
116
|
+
statement about stability, not about this change. `theokit` is at 0.65.0 and has never taken a major:
|
|
117
|
+
its own CHANGELOG carries entries labelled "BREAKING for hand-built compiled options" that shipped as
|
|
118
|
+
minors. `public-copy.md § 3` refuses the production-ready claim until there is sustained measured
|
|
119
|
+
evidence, and a 1.0.0 cut is that claim in the one place every consumer reads it. `@theokit/agents`
|
|
120
|
+
(13.4.0) and `create-theokit` (2.0.0) are past 1.0, so their majors are the ordinary encoding.
|
|
121
|
+
|
|
122
|
+
**Breaking:** a consumer pinned to `@theokit/sdk@4.x` can no longer install these packages. That
|
|
123
|
+
consumer was already receiving none of the `.claude` compatibility the packages advertise, and
|
|
124
|
+
`HookGateUnsupportedError` was already refusing them outright if they declared a hook gate. `theo`
|
|
125
|
+
moves with `agents` because it depends on it: a peer range advertising a major its own dependency
|
|
126
|
+
rejects is unsatisfiable at install time and says nothing until then.
|
|
127
|
+
|
|
128
|
+
### Minor Changes
|
|
129
|
+
|
|
130
|
+
- f28ebd5: `THEO.local.md` and `AGENTS.local.md` are read, and composed after the files they refine.
|
|
131
|
+
|
|
132
|
+
The gitignored companion is where an operator keeps the standing corrections that matter most to
|
|
133
|
+
them — the ones too personal or too situational to commit. Nothing read it. Measured 2026-09-12: a
|
|
134
|
+
grep for the four `.local` spellings returned **0 files** across every package source tree, against
|
|
135
|
+
a control of 4 for `AGENTS.md`; the same query over the newly-resolved `@theokit/sdk@5.5.0`
|
|
136
|
+
returned **0** against a control of 23 for `CLAUDE.md`. The gap is in both layers, and raising the
|
|
137
|
+
SDK floor did not close it.
|
|
138
|
+
|
|
139
|
+
The failure is the silent kind: the file exists, it is named the documented way, nothing loads it,
|
|
140
|
+
and nothing complains. The agent behaves exactly as it would if the operator had written nothing,
|
|
141
|
+
which from the outside is indistinguishable from the instructions being wrong.
|
|
142
|
+
|
|
143
|
+
**Order shipped with membership, because membership alone would have shipped broken.**
|
|
144
|
+
`localeCompare` sorts `AGENTS.local.md` BEFORE `AGENTS.md` — `'l' < 'm'` — so adding the names to
|
|
145
|
+
`DEFAULT_FILE_NAMES` and nothing else would compose the operator's correction _before_ the rule it
|
|
146
|
+
was written to correct. The file would load and lose: a subtler version of the original defect, and
|
|
147
|
+
just as quiet. `walkOrder` now emits three bands within a directory — public files, private files,
|
|
148
|
+
then subdirectories — each boundary carrying its reason. The `lexicographic` mode stays literally
|
|
149
|
+
alphabetical; it is the documented escape for a caller who wants the raw order.
|
|
150
|
+
|
|
151
|
+
**The two chains are independent.** A local file never replaces its public sibling; both load. The
|
|
152
|
+
trap avoided is one chain falling back to the other, where adding a `THEO.md` would silently orphan
|
|
153
|
+
an existing `AGENTS.local.md` — a file the operator wrote, disabled by a file they added for an
|
|
154
|
+
unrelated reason.
|
|
155
|
+
|
|
156
|
+
**`CLAUDE.local.md` is deliberately not included.** `CLAUDE.md` is not in the public half of this
|
|
157
|
+
list either, so a private companion to a file this seam does not read would pair with nothing. If
|
|
158
|
+
`CLAUDE.md` is ever added, its companion comes with it.
|
|
159
|
+
|
|
160
|
+
Also corrects two comments in the same file that `@theokit/sdk@^5.0.0` made false: one described a
|
|
161
|
+
cast removed when the type began resolving — the symlink-escape **control it guards is untouched**,
|
|
162
|
+
and the note stays so its removal does not read as the control being relaxed — and one duplicated an
|
|
163
|
+
ordering rationale that now lives with the ordering.
|
|
164
|
+
|
|
165
|
+
- 914e177: A caller can now name the foreign root's instructions — `context` is a `CompatSurface`.
|
|
166
|
+
|
|
167
|
+
`.claude/rules/*.md` had no name a consumer could write. The union was `'commands' | 'hooks' |
|
|
168
|
+
'plugins' | 'skills' | 'subagents'` — five names for a root that feeds six things — and the gate's
|
|
169
|
+
own docblock had already written the rule that violated: "An enumeration used to NARROW a root must
|
|
170
|
+
cover every surface that root feeds: a name absent from the vocabulary is a surface the caller
|
|
171
|
+
cannot ask for and cannot be told it lost."
|
|
172
|
+
|
|
173
|
+
It was measured from the other end. `theokit-sdk` #652: `FileContextManager` consulted no
|
|
174
|
+
foreign-dialect grant at all, so a cloned repository's `.claude/rules/*.md` reached the system
|
|
175
|
+
prompt of a consumer who had declared only its own `.theokit/` — while that same directory's hooks,
|
|
176
|
+
skills, subagents and plugins were correctly withheld. Closing that gate is what makes the missing
|
|
177
|
+
name here load-bearing: once the SDK honours a `context` grant, a caller with no word for it loses
|
|
178
|
+
the rules silently.
|
|
179
|
+
|
|
180
|
+
**This ships BEFORE the SDK release that honours it, and the ordering is safe in exactly one
|
|
181
|
+
direction.** The SDK matches a narrowed `import` list per surface, so a name it does not recognise
|
|
182
|
+
is never matched and changes nothing: on today's SDK the rules load as they always did, and on the
|
|
183
|
+
next one the grant is what keeps them loading. The reverse order would take `.claude/rules` from
|
|
184
|
+
every caller here with no name they could write to ask for it back.
|
|
185
|
+
|
|
186
|
+
A consumer passing the bare `'claude-code'` literal is unaffected — it still means the whole root.
|
|
187
|
+
What changes is that `import: ['context']` is now expressible, so taking a foreign repository's
|
|
188
|
+
house rules no longer requires also granting it command execution.
|
|
189
|
+
|
|
190
|
+
### Patch Changes
|
|
191
|
+
|
|
192
|
+
- 6c1a602: Four `.claude` mechanisms are now declared out of scope, with the reason and the owner.
|
|
193
|
+
|
|
194
|
+
An absence that reads as an oversight gets re-investigated at full cost by the next person. The
|
|
195
|
+
`.claude` sweep produced a table with absences in it, and shipping that without separating "we
|
|
196
|
+
decided not to" from "we have not got to it" reproduces the defect the table exists to prevent.
|
|
197
|
+
|
|
198
|
+
Measured 2026-09-12: `keybindings`, `themes/` and `.claude.json` each return **0 files** across every
|
|
199
|
+
package source tree, against a control of 31 for `skills`.
|
|
200
|
+
|
|
201
|
+
| Surface | Verdict |
|
|
202
|
+
| --------------------------------------------- | -------------------------------- |
|
|
203
|
+
| `keybindings.json` | out of scope — `@theokit/tui` |
|
|
204
|
+
| `themes/*.json` | out of scope — `@theokit/tui` |
|
|
205
|
+
| `~/.claude.json` — OAuth state, UI toggles | out of scope — a CLI's own state |
|
|
206
|
+
| `~/.claude.json` — personal-scope MCP servers | **not read yet**, and in scope |
|
|
207
|
+
|
|
208
|
+
**A framework has no keyboard and no colour.** It produces text and tool calls; the process that
|
|
209
|
+
renders them owns which key does what and which escape codes it emits. Reading those here would let
|
|
210
|
+
this package hold configuration it cannot act on, which is the accepted-and-ignored failure the whole
|
|
211
|
+
table exists to prevent.
|
|
212
|
+
|
|
213
|
+
**`~/.claude.json` is two things under one name, and the split is the point.** One verdict over the
|
|
214
|
+
whole file would be wrong about one half whichever way it went: the OAuth state is a specific
|
|
215
|
+
program's own session, and a library reading another program's login state reaches into something it
|
|
216
|
+
neither owns nor can refresh — while an MCP server the operator registered for themselves is a
|
|
217
|
+
framework concern, and this package already reads project-scope servers from `.mcp.json`. That half
|
|
218
|
+
is **not refused; it is not done**, and the two stay distinguishable because the reader deciding
|
|
219
|
+
whether to file a bug needs to know which one they are looking at.
|
|
220
|
+
|
|
221
|
+
Declared in `README.md` and not only in the project's rules directory, because that directory is
|
|
222
|
+
gitignored — a decision recorded only there is a decision made for one checkout.
|
|
223
|
+
|
|
224
|
+
Separately, `SettingSourcesSelection.user`'s docblock stops describing a capability the runtime does
|
|
225
|
+
not have: nothing reads the operator's root because of that flag (`includesSetting` is called with
|
|
226
|
+
exactly `"project"` and `"plugins"` at `@theokit/sdk@5.5.0`). What the SDK _does_ read from
|
|
227
|
+
`~/.theokit/` — model-provider plugins, the provider trust file, transcripts, the HTTP cache — it
|
|
228
|
+
reads unconditionally, governed by nothing. The flag is still accepted rather than refused: the
|
|
229
|
+
measured consumer passes it on every run, including the untrusted-directory path where it is the only
|
|
230
|
+
grant, so refusing would turn a graceful degradation into a throw for the case it exists to survive.
|
|
231
|
+
|
|
232
|
+
- 24e1fab: State, where hook events are declared, that no seam can run before compaction
|
|
233
|
+
|
|
234
|
+
B-002 FR-004. A consumer needing to persist state before the transcript is compacted has no event to
|
|
235
|
+
bind to, and could only learn that by writing a handler and watching it never fire.
|
|
236
|
+
|
|
237
|
+
Measured against `@theokit/sdk@5.5.0`: `HookName` is a closed union of ten names with no compaction
|
|
238
|
+
member, and `PluginContext.on` keys its callback by that union — so no event name can be added from
|
|
239
|
+
this package. The SDK's own auto-compaction path is further out of reach: bundle-internal, absent
|
|
240
|
+
from every emitted `.d.ts` and all 33 export subpaths, and it builds its own summarizer at the call
|
|
241
|
+
site.
|
|
242
|
+
|
|
243
|
+
The docblock now says so and names `usetheokit/theokit-sdk#653`, the issue that unblocks it, so a
|
|
244
|
+
reader arrives at the nine candidate seams already ruled out rather than repeating the enumeration.
|
|
245
|
+
|
|
246
|
+
`hook-events.ts` is split out of `hook-spec.ts`, which had drifted to 616 lines against the 600 its
|
|
247
|
+
brief caps it at. Every symbol callers import stays importable from `hook-spec.js`.
|
|
248
|
+
|
|
3
249
|
## 13.4.0
|
|
4
250
|
|
|
5
251
|
### 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-
|
|
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,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,QA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AKlC,MACL,CAACmC,QAAAA;AACC,YAAMC,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"],"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;AAC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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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
32
|
+
} from "./chunk-DFGIED4E.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-
|
|
59
|
+
} from "./chunk-72QVLTDI.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-
|
|
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-
|
|
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.
|
|
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.
|
|
2142
|
+
return Retry.run(open, {
|
|
2143
2143
|
...retry,
|
|
2144
2144
|
signal: retry.signal ?? signal
|
|
2145
2145
|
});
|
|
@@ -2526,6 +2526,71 @@ function formatUnrecognised(event) {
|
|
|
2526
2526
|
}
|
|
2527
2527
|
__name(formatUnrecognised, "formatUnrecognised");
|
|
2528
2528
|
|
|
2529
|
+
// src/loop/pre-compaction.ts
|
|
2530
|
+
import { TheokitAgentError as TheokitAgentError5 } from "@theokit/sdk/errors";
|
|
2531
|
+
var DEFAULT_HANDLER_TIMEOUT_MS = 3e4;
|
|
2532
|
+
var PreCompactionHandlerError = class extends TheokitAgentError5 {
|
|
2533
|
+
static {
|
|
2534
|
+
__name(this, "PreCompactionHandlerError");
|
|
2535
|
+
}
|
|
2536
|
+
name = "PreCompactionHandlerError";
|
|
2537
|
+
/** `'timeout'` when the bound was exceeded, `'threw'` when the handler failed on its own. */
|
|
2538
|
+
reason;
|
|
2539
|
+
constructor(message, reason, options) {
|
|
2540
|
+
super(message, {
|
|
2541
|
+
code: "PRE_COMPACTION_HANDLER_FAILED",
|
|
2542
|
+
...options ?? {}
|
|
2543
|
+
});
|
|
2544
|
+
this.reason = reason;
|
|
2545
|
+
}
|
|
2546
|
+
};
|
|
2547
|
+
function assertUsableTimeout(timeoutMs) {
|
|
2548
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
2549
|
+
throw new TypeError(`withPreCompaction: timeoutMs must be a finite number greater than 0, received ${String(timeoutMs)}`);
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
__name(assertUsableTimeout, "assertUsableTimeout");
|
|
2553
|
+
async function runHandlerBounded(handler, messages, timeoutMs, onError) {
|
|
2554
|
+
let timer;
|
|
2555
|
+
const controller = new AbortController();
|
|
2556
|
+
try {
|
|
2557
|
+
await Promise.race([
|
|
2558
|
+
Promise.resolve(handler(messages, controller.signal)),
|
|
2559
|
+
new Promise((_resolve, reject) => {
|
|
2560
|
+
timer = setTimeout(() => {
|
|
2561
|
+
controller.abort();
|
|
2562
|
+
reject(new PreCompactionHandlerError(`pre-compaction handler exceeded its ${String(timeoutMs)}ms bound; compaction proceeded without it`, "timeout"));
|
|
2563
|
+
}, timeoutMs);
|
|
2564
|
+
})
|
|
2565
|
+
]);
|
|
2566
|
+
} catch (cause) {
|
|
2567
|
+
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
2568
|
+
const reported = cause instanceof PreCompactionHandlerError ? cause : new PreCompactionHandlerError(`pre-compaction handler failed: ${detail}`, "threw", {
|
|
2569
|
+
cause
|
|
2570
|
+
});
|
|
2571
|
+
onError?.(reported);
|
|
2572
|
+
} finally {
|
|
2573
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
2576
|
+
__name(runHandlerBounded, "runHandlerBounded");
|
|
2577
|
+
function withPreCompaction(strategy, handler, options) {
|
|
2578
|
+
const timeoutMs = options?.timeoutMs ?? DEFAULT_HANDLER_TIMEOUT_MS;
|
|
2579
|
+
assertUsableTimeout(timeoutMs);
|
|
2580
|
+
const onError = options?.onError;
|
|
2581
|
+
return {
|
|
2582
|
+
name: strategy.name,
|
|
2583
|
+
keepTokens: strategy.keepTokens,
|
|
2584
|
+
compact: /* @__PURE__ */ __name(async (messages, callOptions) => {
|
|
2585
|
+
await runHandlerBounded(handler, [
|
|
2586
|
+
...messages
|
|
2587
|
+
], timeoutMs, onError);
|
|
2588
|
+
return strategy.compact(messages, callOptions);
|
|
2589
|
+
}, "compact")
|
|
2590
|
+
};
|
|
2591
|
+
}
|
|
2592
|
+
__name(withPreCompaction, "withPreCompaction");
|
|
2593
|
+
|
|
2529
2594
|
// src/bridge/agent-orchestrator.ts
|
|
2530
2595
|
function requireApiKey(opts, agentName) {
|
|
2531
2596
|
if (opts.apiKey === null) return "";
|
|
@@ -2606,8 +2671,8 @@ async function moderateDelegationResult(result, guardrails) {
|
|
|
2606
2671
|
__name(moderateDelegationResult, "moderateDelegationResult");
|
|
2607
2672
|
|
|
2608
2673
|
// src/bridge/delegation-lifecycle.ts
|
|
2609
|
-
import { TheokitAgentError as
|
|
2610
|
-
var DelegationTimeoutError = class extends
|
|
2674
|
+
import { TheokitAgentError as TheokitAgentError6 } from "@theokit/sdk/errors";
|
|
2675
|
+
var DelegationTimeoutError = class extends TheokitAgentError6 {
|
|
2611
2676
|
static {
|
|
2612
2677
|
__name(this, "DelegationTimeoutError");
|
|
2613
2678
|
}
|
|
@@ -2769,6 +2834,9 @@ export {
|
|
|
2769
2834
|
GoalRunner,
|
|
2770
2835
|
JudgeCredentialError,
|
|
2771
2836
|
formatGoalEvent,
|
|
2837
|
+
DEFAULT_HANDLER_TIMEOUT_MS,
|
|
2838
|
+
PreCompactionHandlerError,
|
|
2839
|
+
withPreCompaction,
|
|
2772
2840
|
delegate,
|
|
2773
2841
|
DelegationTimeoutError,
|
|
2774
2842
|
withClockCap,
|
|
@@ -2777,4 +2845,4 @@ export {
|
|
|
2777
2845
|
delegateBackground,
|
|
2778
2846
|
delegateWithScoring
|
|
2779
2847
|
};
|
|
2780
|
-
//# sourceMappingURL=chunk-
|
|
2848
|
+
//# sourceMappingURL=chunk-72QVLTDI.js.map
|