@lloyal-labs/lloyal-agents 2.1.0 → 3.0.1
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/LICENSE +107 -0
- package/LICENSE-FAQ.md +256 -0
- package/README.md +64 -26
- package/dist/Agent.d.ts +13 -2
- package/dist/Agent.d.ts.map +1 -1
- package/dist/Agent.js +10 -0
- package/dist/Agent.js.map +1 -1
- package/dist/AgentPolicy.d.ts +84 -7
- package/dist/AgentPolicy.d.ts.map +1 -1
- package/dist/AgentPolicy.js +32 -4
- package/dist/AgentPolicy.js.map +1 -1
- package/dist/Tool.d.ts +44 -0
- package/dist/Tool.d.ts.map +1 -1
- package/dist/Tool.js +49 -1
- package/dist/Tool.js.map +1 -1
- package/dist/agent-pool.d.ts.map +1 -1
- package/dist/agent-pool.js +187 -16
- package/dist/agent-pool.js.map +1 -1
- package/dist/app-config.d.ts +50 -0
- package/dist/app-config.d.ts.map +1 -0
- package/dist/app-config.js +27 -0
- package/dist/app-config.js.map +1 -0
- package/dist/app-types.d.ts +309 -0
- package/dist/app-types.d.ts.map +1 -0
- package/dist/app-types.js +28 -0
- package/dist/app-types.js.map +1 -0
- package/dist/chunk.d.ts +118 -0
- package/dist/chunk.d.ts.map +1 -0
- package/dist/chunk.js +19 -0
- package/dist/chunk.js.map +1 -0
- package/dist/context.d.ts +68 -12
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +64 -12
- package/dist/context.js.map +1 -1
- package/dist/create-agent-pool.d.ts +10 -4
- package/dist/create-agent-pool.d.ts.map +1 -1
- package/dist/create-agent-pool.js +7 -6
- package/dist/create-agent-pool.js.map +1 -1
- package/dist/grant-store.d.ts +49 -0
- package/dist/grant-store.d.ts.map +1 -0
- package/dist/grant-store.js +33 -0
- package/dist/grant-store.js.map +1 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/orchestrators.d.ts +7 -0
- package/dist/orchestrators.d.ts.map +1 -1
- package/dist/orchestrators.js.map +1 -1
- package/dist/source.d.ts +31 -1
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +32 -2
- package/dist/source.js.map +1 -1
- package/dist/spine.d.ts +0 -6
- package/dist/spine.d.ts.map +1 -1
- package/dist/spine.js +18 -2
- package/dist/spine.js.map +1 -1
- package/dist/toolkit.d.ts +44 -17
- package/dist/toolkit.d.ts.map +1 -1
- package/dist/toolkit.js +24 -14
- package/dist/toolkit.js.map +1 -1
- package/dist/trace-types.d.ts +34 -2
- package/dist/trace-types.d.ts.map +1 -1
- package/dist/types.d.ts +27 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/use-agent.d.ts +9 -4
- package/dist/use-agent.d.ts.map +1 -1
- package/dist/use-agent.js +15 -12
- package/dist/use-agent.js.map +1 -1
- package/package.json +7 -5
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App protocol types — what a third-party app developer declares + what
|
|
3
|
+
* the framework consumes when registering and rendering apps.
|
|
4
|
+
*
|
|
5
|
+
* Three groups of types live here:
|
|
6
|
+
*
|
|
7
|
+
* 1. **Declarative manifest** ({@link AppManifest}, {@link AppProtocol},
|
|
8
|
+
* {@link AppHints}). Authored in `app.json` and imported into the
|
|
9
|
+
* factory; describes what the app *is* without any runtime values.
|
|
10
|
+
*
|
|
11
|
+
* 2. **Runtime App object** ({@link App}, {@link SkillTemplateFn},
|
|
12
|
+
* {@link ExamplesTemplateFn}). Constructed by `defineApp(...)` inside
|
|
13
|
+
* the app's factory; bundles the manifest with the live `Source`,
|
|
14
|
+
* `Tool[]`, and template renderers.
|
|
15
|
+
*
|
|
16
|
+
* 3. **Per-spawn render context** ({@link AgentRenderCtx},
|
|
17
|
+
* {@link ExamplesRenderCtx}). Passed by the framework to template
|
|
18
|
+
* renderers when constructing a per-spawn preamble.
|
|
19
|
+
*
|
|
20
|
+
* Plus {@link AppFactory} (what the registry runs to construct an App)
|
|
21
|
+
* and {@link ConfigFlow} for the optional credential handoff.
|
|
22
|
+
*
|
|
23
|
+
* @packageDocumentation
|
|
24
|
+
* @category Protocol
|
|
25
|
+
*/
|
|
26
|
+
import type { Operation } from 'effection';
|
|
27
|
+
import type { Source } from './source';
|
|
28
|
+
import type { Tool } from './Tool';
|
|
29
|
+
import type { JsonSchema } from './types';
|
|
30
|
+
/**
|
|
31
|
+
* The model-facing identity of an app — three fields under
|
|
32
|
+
* `manifest.protocol` in `app.json`. The framework renders these into
|
|
33
|
+
* the boundary marker, the spine catalog entry,
|
|
34
|
+
* and the auth-guard allowed-tools set.
|
|
35
|
+
*
|
|
36
|
+
* Constraints (enforced synchronously by `defineApp`):
|
|
37
|
+
* - `name` matches `[a-z][a-z0-9_-]{1,63}`.
|
|
38
|
+
* - `tools` is a non-empty array of tool-name strings, each matching the
|
|
39
|
+
* same regex as `name`. Must cover exactly the keys of the app's
|
|
40
|
+
* `tools` map supplied to `defineApp`.
|
|
41
|
+
* - `useWhen` is a single sentence of printable characters, bounded in
|
|
42
|
+
* length, with no chat-role markers (`SYSTEM:`/`USER:`/etc.), no
|
|
43
|
+
* markdown code fences, and no newlines.
|
|
44
|
+
*/
|
|
45
|
+
export interface AppProtocol {
|
|
46
|
+
/** Model-facing protocol identifier (e.g., `"web_research"`). */
|
|
47
|
+
readonly name: string;
|
|
48
|
+
/** Single-sentence routing hint rendered into the catalog `Use when:` line. */
|
|
49
|
+
readonly useWhen: string;
|
|
50
|
+
/** Tool names exposed by this protocol; must match the app's `tools` map keys. */
|
|
51
|
+
readonly tools: readonly string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Optional UX/marketplace metadata. Not part of the model-facing surface;
|
|
55
|
+
* surfaced to harness UI, marketplace listings, and capability disclosure
|
|
56
|
+
* at install time.
|
|
57
|
+
*/
|
|
58
|
+
export interface AppHints {
|
|
59
|
+
/** Short display name for chips/tabs (e.g., `"web"`, `"jira"`). */
|
|
60
|
+
readonly shortName?: string;
|
|
61
|
+
/** Long-form description for marketplace listings. */
|
|
62
|
+
readonly description?: string;
|
|
63
|
+
/** URL to an icon (svg/png) the harness may display. */
|
|
64
|
+
readonly iconUrl?: string;
|
|
65
|
+
/** Coarse capability disclosure for install-time review. */
|
|
66
|
+
readonly authKind?: 'oauth' | 'apikey' | 'path' | 'token' | 'none';
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The declarative app manifest — content of `app.json` plus the
|
|
70
|
+
* `appProtocolVersion` declaration. Imported into the app's factory
|
|
71
|
+
* and passed to `defineApp(...)`.
|
|
72
|
+
*
|
|
73
|
+
* `manifest.name` is the **app identifier** used in code paths
|
|
74
|
+
* (`SpawnSpec.assignedApp`, `registry.byName(...)`, the AppConfigStore
|
|
75
|
+
* key, filesystem paths). The model never sees this — it only sees
|
|
76
|
+
* `manifest.protocol.name`. One app, one protocol.
|
|
77
|
+
*/
|
|
78
|
+
export interface AppManifest {
|
|
79
|
+
/** App identifier used for routing, config storage, and registry lookup. */
|
|
80
|
+
readonly name: string;
|
|
81
|
+
/**
|
|
82
|
+
* Which codified App protocol version this app targets. The framework
|
|
83
|
+
* refuses to register apps whose declared version is not in
|
|
84
|
+
* `SUPPORTED_APP_PROTOCOL_VERSIONS` (currently `['3.0']`).
|
|
85
|
+
*/
|
|
86
|
+
readonly appProtocolVersion?: string;
|
|
87
|
+
/** The model-facing identity. */
|
|
88
|
+
readonly protocol: AppProtocol;
|
|
89
|
+
/** Optional UX/marketplace metadata. */
|
|
90
|
+
readonly hints?: AppHints;
|
|
91
|
+
/**
|
|
92
|
+
* JSON Schema declaring what config the app needs. The framework
|
|
93
|
+
* validates the app's stored config against it at enable time (when the
|
|
94
|
+
* factory's constructed manifest is available). The `x-secret: true`
|
|
95
|
+
* field annotation signals sensitive values (harness UX masks them, may
|
|
96
|
+
* prefer secure storage backend).
|
|
97
|
+
*/
|
|
98
|
+
readonly configSchema?: JsonSchema;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Variables the framework provides to `skill.eta` template renderers
|
|
102
|
+
* at per-spawn render time. Apps reference these as `it.agentCount`,
|
|
103
|
+
* `it.maxTurns`, etc. inside their Eta templates.
|
|
104
|
+
*
|
|
105
|
+
* App-specific additional variables (e.g., corpus apps' TOC) can be
|
|
106
|
+
* supplied by extending the render context inside the App's factory —
|
|
107
|
+
* the framework spreads `params` into the Eta template's render data.
|
|
108
|
+
*/
|
|
109
|
+
export interface AgentRenderCtx {
|
|
110
|
+
/** Total number of agents spawned in the current fan-out. */
|
|
111
|
+
readonly agentCount: number;
|
|
112
|
+
/** Task descriptions of the *other* agents in this fan-out. */
|
|
113
|
+
readonly siblingTasks: readonly string[];
|
|
114
|
+
/** Tool-call budget for this spawn. */
|
|
115
|
+
readonly maxTurns: number;
|
|
116
|
+
/** Today's date in ISO format. */
|
|
117
|
+
readonly date: string;
|
|
118
|
+
/** Position in a chain orchestrator (0-indexed); 0 for parallel fan-outs. */
|
|
119
|
+
readonly taskIndex: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Variables provided to `examples.eta` renderers in addition to all
|
|
123
|
+
* fields of {@link AgentRenderCtx}. Apps can reference `it.name`
|
|
124
|
+
* (protocol name) and `it.tools` (the protocol's tool-name list) when
|
|
125
|
+
* authoring discipline content.
|
|
126
|
+
*/
|
|
127
|
+
export interface ExamplesRenderCtx extends AgentRenderCtx {
|
|
128
|
+
/** The protocol's name (same as `app.manifest.protocol.name`). */
|
|
129
|
+
readonly name: string;
|
|
130
|
+
/** The protocol's tool-name list (same as `app.manifest.protocol.tools`). */
|
|
131
|
+
readonly tools: readonly string[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Function alternative to a string `skill.eta` template — for apps whose
|
|
135
|
+
* per-spawn prompt needs runtime parameterization beyond what Eta covers.
|
|
136
|
+
*
|
|
137
|
+
* The returned string is the per-spawn body; the framework prepends
|
|
138
|
+
* `BOUNDARY_MARKER(protocol.name)` and (optionally) appends the rendered
|
|
139
|
+
* `examples.eta`. The function MUST NOT return content containing the
|
|
140
|
+
* literal `Apply the **` substring (the framework prepends it and
|
|
141
|
+
* `defineApp` cannot statically validate function outputs — the first-render
|
|
142
|
+
* check on canonical apps catches it).
|
|
143
|
+
*/
|
|
144
|
+
export type SkillTemplateFn = (params: AgentRenderCtx) => string;
|
|
145
|
+
/**
|
|
146
|
+
* Function alternative to a string `examples.eta` template.
|
|
147
|
+
*
|
|
148
|
+
* Per-spawn only — examples are rendered into the
|
|
149
|
+
* preamble of agents assigned to *this* app, never into the shared spine.
|
|
150
|
+
*/
|
|
151
|
+
export type ExamplesTemplateFn = (params: ExamplesRenderCtx) => string;
|
|
152
|
+
/**
|
|
153
|
+
* Interactive config-acquisition flow for OAuth-like protocols the app
|
|
154
|
+
* drives. This is credential **acquisition**, not lifecycle: it obtains
|
|
155
|
+
* config (tokens) and the harness writes the result to `AppConfigStore`.
|
|
156
|
+
* It is unrelated to enable/disable — the actual authentication happens
|
|
157
|
+
* at the provider, not in the framework.
|
|
158
|
+
*
|
|
159
|
+
* Harness calls `initiate` → app returns a handoff URL + optional
|
|
160
|
+
* callback param validator → harness opens the URL → user completes auth
|
|
161
|
+
* → harness captures callback params → harness validates via
|
|
162
|
+
* `callbackValidator` (if provided) → harness calls `complete` → app
|
|
163
|
+
* returns the full config object → framework validates against
|
|
164
|
+
* `manifest.configSchema` → harness writes the whole-replace config to
|
|
165
|
+
* `AppConfigStore`.
|
|
166
|
+
*
|
|
167
|
+
* Both steps run inside the harness's Effection scope; if a flow needs
|
|
168
|
+
* to read existing config it does `yield* AppConfigStoreCtx.expect()`
|
|
169
|
+
* directly — there is no separate context parameter.
|
|
170
|
+
*/
|
|
171
|
+
export interface ConfigFlow {
|
|
172
|
+
/** Initiates the auth flow; returns a handoff URL the harness opens. */
|
|
173
|
+
initiate(): Operation<{
|
|
174
|
+
handoffUrl?: string;
|
|
175
|
+
callbackValidator?: (params: unknown) => boolean;
|
|
176
|
+
}>;
|
|
177
|
+
/** Receives callback params from the harness; returns the full config. */
|
|
178
|
+
complete(callbackParams: unknown): Operation<Record<string, unknown>>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The runtime artifact returned by `defineApp(...)` inside an app's
|
|
182
|
+
* factory. Combines the declarative {@link AppManifest} with the live
|
|
183
|
+
* `Source`, `Tool[]`, and prompt templates the framework needs at
|
|
184
|
+
* spawn time.
|
|
185
|
+
*
|
|
186
|
+
* Apps are constructed inside zero-arg `Operation<App>` factories
|
|
187
|
+
* (typically `createWebApp`, `createJiraApp`, etc.) that read config
|
|
188
|
+
* from `AppConfigStoreCtx` and the shared reranker from `RerankerCtx`.
|
|
189
|
+
* Both npm-distributed apps and signed-bundle apps use the identical
|
|
190
|
+
* factory signature.
|
|
191
|
+
*/
|
|
192
|
+
export interface App {
|
|
193
|
+
/** Same as `manifest.name` — routing key. */
|
|
194
|
+
readonly name: string;
|
|
195
|
+
/** The declarative manifest. */
|
|
196
|
+
readonly manifest: AppManifest;
|
|
197
|
+
/** The app's Source (provides per-domain chunking + tools). */
|
|
198
|
+
readonly source: Source;
|
|
199
|
+
/**
|
|
200
|
+
* The tool instances exposed by this app. Their names must match
|
|
201
|
+
* `manifest.protocol.tools` exactly. The framework concatenates all
|
|
202
|
+
* registered apps' `tools` into the spine prefill (one shared decode
|
|
203
|
+
* of all schemas, amortized across every spawn in the pool).
|
|
204
|
+
*/
|
|
205
|
+
readonly tools: readonly Tool[];
|
|
206
|
+
/**
|
|
207
|
+
* The per-spawn `skill.eta` template (string) or function. The
|
|
208
|
+
* framework prepends the boundary marker; `skill.eta` MUST NOT
|
|
209
|
+
* contain the literal `Apply the **` substring.
|
|
210
|
+
*/
|
|
211
|
+
readonly skill: string | SkillTemplateFn;
|
|
212
|
+
/**
|
|
213
|
+
* Optional discipline content (GOOD/BAD examples, anti-patterns)
|
|
214
|
+
* rendered into the per-spawn preamble of agents assigned to this
|
|
215
|
+
* app. Not surfaced in the shared spine.
|
|
216
|
+
*/
|
|
217
|
+
readonly examples?: string | ExamplesTemplateFn;
|
|
218
|
+
/** Optional config schema (same as `manifest.configSchema`). */
|
|
219
|
+
readonly configSchema?: JsonSchema;
|
|
220
|
+
/** Optional UX hints (same as `manifest.hints`). */
|
|
221
|
+
readonly hints?: AppHints;
|
|
222
|
+
/** Optional interactive config flow. */
|
|
223
|
+
readonly configFlow?: ConfigFlow;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* A zero-arg Operation that constructs an {@link App}. This — not a
|
|
227
|
+
* constructed `App` — is what the registry consumes (`createAppRegistry({
|
|
228
|
+
* apps })` at boot, or `registry.enable(factory)` dynamically): the
|
|
229
|
+
* registry runs the factory inside a per-app **detached** Effection scope
|
|
230
|
+
* that it seeds with `AppConfigStoreCtx` / `AppRegistryCtx` / `RerankerCtx`,
|
|
231
|
+
* so the factory reads its config and reranker, does any setup, and returns
|
|
232
|
+
* the App.
|
|
233
|
+
*
|
|
234
|
+
* **Setup and teardown are structured, not hooks.** The factory body *is*
|
|
235
|
+
* the setup. For resources that need teardown (a connection, a watcher),
|
|
236
|
+
* the factory is a `resource()` that allocates, registers cleanup with
|
|
237
|
+
* `ensure(...)`, and `provide(...)`s the App — the cleanup fires when the
|
|
238
|
+
* app's detached scope is torn down (`registry.disable(name)`, or registry
|
|
239
|
+
* scope exit). Apps with no external resources are a plain
|
|
240
|
+
* `function* () { return defineApp(...) }`. There are no
|
|
241
|
+
* `install`/`uninstall`/`enable`/`disable` hooks.
|
|
242
|
+
*
|
|
243
|
+
* Apps installed via `harness.dev install` (signed npm tarballs from
|
|
244
|
+
* the canonical channel) export a factory of this exact shape from
|
|
245
|
+
* their package entry point — the harness imports it with a plain
|
|
246
|
+
* `import { createXxxApp } from '@lloyal-labs/<name>-app'` and passes
|
|
247
|
+
* it to `createAppRegistry({ apps: [...] })`.
|
|
248
|
+
*/
|
|
249
|
+
export type AppFactory = () => Operation<App>;
|
|
250
|
+
/**
|
|
251
|
+
* The framework-tracked runtime state of an app: `'enabled'` once its
|
|
252
|
+
* factory has run and it sits in the registry, `'disabled'` otherwise.
|
|
253
|
+
* Binary by design — richer states (configured, authenticated, ready) are
|
|
254
|
+
* harness UX rollups or app-internal runtime concerns, not framework
|
|
255
|
+
* state.
|
|
256
|
+
*/
|
|
257
|
+
export type AppState = 'enabled' | 'disabled';
|
|
258
|
+
/**
|
|
259
|
+
* The harness-owned registry of enabled apps. Lives behind
|
|
260
|
+
* `AppRegistryCtx`; the auth-guard consults it at
|
|
261
|
+
* tool-dispatch time to resolve the allowed-tools set for an
|
|
262
|
+
* App-assigned spawn (`SpawnSpec.assignedApp`). The concrete factory
|
|
263
|
+
* `createAppRegistry(...)` lives in `@lloyal-labs/rig`; dynamic
|
|
264
|
+
* enable/disable are methods on this interface.
|
|
265
|
+
*
|
|
266
|
+
* Registry state is the single source of truth for which apps are
|
|
267
|
+
* enabled within a harness scope. The harness declares its boot set
|
|
268
|
+
* via `createAppRegistry({ apps })`; each app runs in its own detached
|
|
269
|
+
* Effection scope. `disable` (or registry scope-exit) tears that scope
|
|
270
|
+
* down, firing the app factory's `ensure(...)` teardown. There are no
|
|
271
|
+
* install/uninstall hooks.
|
|
272
|
+
*/
|
|
273
|
+
export interface AppRegistry {
|
|
274
|
+
/**
|
|
275
|
+
* Look up an enabled app by `manifest.name` (the routing key —
|
|
276
|
+
* **not** `manifest.protocol.name`). Returns `undefined` if no app
|
|
277
|
+
* with that name is enabled.
|
|
278
|
+
*/
|
|
279
|
+
byName(name: string): App | undefined;
|
|
280
|
+
/**
|
|
281
|
+
* Snapshot of currently-enabled apps in registration order. The
|
|
282
|
+
* spine renderer walks this list to compose the catalog;
|
|
283
|
+
* order is observable to the model.
|
|
284
|
+
*/
|
|
285
|
+
enabled(): readonly App[];
|
|
286
|
+
/**
|
|
287
|
+
* Binary state of an app: `'enabled'` if it's in the registry,
|
|
288
|
+
* `'disabled'` otherwise. Convenience over `byName(name) !==
|
|
289
|
+
* undefined` for harness UX.
|
|
290
|
+
*/
|
|
291
|
+
stateOf(name: string): AppState;
|
|
292
|
+
/**
|
|
293
|
+
* Enable an app dynamically (the mid-session enable path). Runs
|
|
294
|
+
* the factory in a fresh per-app detached scope (seeded with `App*Ctx`),
|
|
295
|
+
* validates the manifest, and adds it. Returns the constructed App.
|
|
296
|
+
* Throws — and tears down the partial scope — if the factory
|
|
297
|
+
* throws, validation fails, or the name is already enabled. The boot
|
|
298
|
+
* set is enabled the same way via `createAppRegistry({ apps })`.
|
|
299
|
+
*/
|
|
300
|
+
enable(factory: AppFactory): Operation<App>;
|
|
301
|
+
/**
|
|
302
|
+
* Disable an app dynamically: remove it and tear down its detached
|
|
303
|
+
* scope, firing the factory's `ensure(...)` teardown. A throwing
|
|
304
|
+
* teardown is logged but the app is removed regardless. No-op for an
|
|
305
|
+
* unknown name.
|
|
306
|
+
*/
|
|
307
|
+
disable(name: string): Operation<void>;
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=app-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-types.d.ts","sourceRoot":"","sources":["../src/app-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,WAAW;IAC1B,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;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;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,GAAG,CAAC,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAI9C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC;IACtC;;;;OAIG;IACH,OAAO,IAAI,SAAS,GAAG,EAAE,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IAChC;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5C;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;CACxC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* App protocol types — what a third-party app developer declares + what
|
|
4
|
+
* the framework consumes when registering and rendering apps.
|
|
5
|
+
*
|
|
6
|
+
* Three groups of types live here:
|
|
7
|
+
*
|
|
8
|
+
* 1. **Declarative manifest** ({@link AppManifest}, {@link AppProtocol},
|
|
9
|
+
* {@link AppHints}). Authored in `app.json` and imported into the
|
|
10
|
+
* factory; describes what the app *is* without any runtime values.
|
|
11
|
+
*
|
|
12
|
+
* 2. **Runtime App object** ({@link App}, {@link SkillTemplateFn},
|
|
13
|
+
* {@link ExamplesTemplateFn}). Constructed by `defineApp(...)` inside
|
|
14
|
+
* the app's factory; bundles the manifest with the live `Source`,
|
|
15
|
+
* `Tool[]`, and template renderers.
|
|
16
|
+
*
|
|
17
|
+
* 3. **Per-spawn render context** ({@link AgentRenderCtx},
|
|
18
|
+
* {@link ExamplesRenderCtx}). Passed by the framework to template
|
|
19
|
+
* renderers when constructing a per-spawn preamble.
|
|
20
|
+
*
|
|
21
|
+
* Plus {@link AppFactory} (what the registry runs to construct an App)
|
|
22
|
+
* and {@link ConfigFlow} for the optional credential handoff.
|
|
23
|
+
*
|
|
24
|
+
* @packageDocumentation
|
|
25
|
+
* @category Protocol
|
|
26
|
+
*/
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
//# sourceMappingURL=app-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-types.js","sourceRoot":"","sources":["../src/app-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG"}
|
package/dist/chunk.d.ts
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chunk / Reranker abstraction types.
|
|
3
|
+
*
|
|
4
|
+
* These interfaces live in `@lloyal-labs/lloyal-agents` (not rig) so that
|
|
5
|
+
* agent-pool code, app factories, and harness contexts can refer to a
|
|
6
|
+
* common Reranker shape without depending on rig's concrete chunking
|
|
7
|
+
* implementation. Concrete chunking utilities (`chunkResources`,
|
|
8
|
+
* `chunkHtml`, `chunkFetchedPages`) and the cross-encoder-backed
|
|
9
|
+
* `createReranker(...)` factory live in `@lloyal-labs/rig`.
|
|
10
|
+
*
|
|
11
|
+
* The pattern mirrors `Source` and `Tool`: abstract type in agents,
|
|
12
|
+
* concrete subclasses/factories in rig.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
* @category Contract
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* A loaded document available for search, read, and grep operations.
|
|
19
|
+
*
|
|
20
|
+
* Represents a single file (typically Markdown) loaded into memory.
|
|
21
|
+
* Resources are chunked into {@link Chunk} instances for reranking.
|
|
22
|
+
*/
|
|
23
|
+
export interface Resource {
|
|
24
|
+
/** File name (basename, not full path) used as the resource identifier. */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Full text content of the file. */
|
|
27
|
+
content: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A scored passage within a {@link Resource}, used for reranking and retrieval.
|
|
31
|
+
*
|
|
32
|
+
* The `tokens` array is populated lazily by {@link Reranker.tokenizeChunks}
|
|
33
|
+
* before scoring. Once tokenized, a chunk is bound to that reranker's
|
|
34
|
+
* cross-encoder vocabulary — re-binding requires re-tokenization.
|
|
35
|
+
*/
|
|
36
|
+
export interface Chunk {
|
|
37
|
+
/** Resource identifier (file name or URL) this chunk belongs to. */
|
|
38
|
+
resource: string;
|
|
39
|
+
/** Leaf section heading (e.g. "Recovery loop"). */
|
|
40
|
+
heading: string;
|
|
41
|
+
/** Hierarchical section path (e.g. "Agents > Lifecycle > Recovery loop"). Empty for web chunks. */
|
|
42
|
+
section: string;
|
|
43
|
+
/** Raw text content of the chunk. */
|
|
44
|
+
text: string;
|
|
45
|
+
/** Pre-tokenized representation for the reranker — empty until {@link Reranker.tokenizeChunks} runs. */
|
|
46
|
+
tokens: number[];
|
|
47
|
+
/** First line number (1-based) in the source resource. */
|
|
48
|
+
startLine: number;
|
|
49
|
+
/** Last line number (1-based) in the source resource. */
|
|
50
|
+
endLine: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* A single chunk scored by the {@link Reranker} against a query.
|
|
54
|
+
*/
|
|
55
|
+
export interface ScoredChunk {
|
|
56
|
+
/** Source filename containing the chunk. */
|
|
57
|
+
file: string;
|
|
58
|
+
/** Leaf section heading (e.g. "Recovery loop"). */
|
|
59
|
+
heading: string;
|
|
60
|
+
/** Hierarchical section path (e.g. "Agents > Lifecycle > Recovery loop"). Empty for web chunks. */
|
|
61
|
+
section: string;
|
|
62
|
+
/** First ~200 chars of chunk text — gives agents content at search time. */
|
|
63
|
+
snippet: string;
|
|
64
|
+
/** Relevance score (higher = more relevant). */
|
|
65
|
+
score: number;
|
|
66
|
+
/** Start line in the source file (1-indexed). */
|
|
67
|
+
startLine: number;
|
|
68
|
+
/** End line in the source file (1-indexed). */
|
|
69
|
+
endLine: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Progressive reranker output emitted during scoring.
|
|
73
|
+
*
|
|
74
|
+
* Streamed from {@link Reranker.score} as an async iterable, allowing
|
|
75
|
+
* callers to report progress while scoring is in flight.
|
|
76
|
+
*/
|
|
77
|
+
export interface ScoredResult {
|
|
78
|
+
/** Scored chunks accumulated so far, ordered by relevance. */
|
|
79
|
+
results: ScoredChunk[];
|
|
80
|
+
/** Number of chunks scored so far. */
|
|
81
|
+
filled: number;
|
|
82
|
+
/** Total number of chunks to score. */
|
|
83
|
+
total: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Cross-encoder reranker for scoring corpus chunks against a query.
|
|
87
|
+
*
|
|
88
|
+
* Apps obtain the harness-wide reranker via `RerankerCtx.expect()` at
|
|
89
|
+
* factory time — `source.bind({reranker})` is no longer the mechanism.
|
|
90
|
+
* Implementations tokenize chunks up front via {@link tokenizeChunks},
|
|
91
|
+
* then stream progressive results from {@link score}.
|
|
92
|
+
*/
|
|
93
|
+
export interface Reranker {
|
|
94
|
+
/** Score chunks against a query, streaming progressive results. */
|
|
95
|
+
score(query: string, chunks: Chunk[]): AsyncIterable<ScoredResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Score raw text strings against a query in one batch.
|
|
98
|
+
*
|
|
99
|
+
* Returns logit-diff scores (`logit("yes") - logit("no")`, unbounded) in
|
|
100
|
+
* input order. This is the log-odds of the reranker's ABSOLUTE yes/no
|
|
101
|
+
* relevance judgment — `P(yes) = sigmoid(score)`, so 0 ≡ P 0.5 — the
|
|
102
|
+
* monotone equivalent of the official Qwen3-Reranker two-token softmax.
|
|
103
|
+
* Scores are thresholdable and comparable across queries to the extent of
|
|
104
|
+
* the model's calibration (quantization adds noise at the extremes).
|
|
105
|
+
*/
|
|
106
|
+
scoreBatch(query: string, texts: string[]): Promise<number[]>;
|
|
107
|
+
/** Pre-tokenize chunks for subsequent scoring calls. */
|
|
108
|
+
tokenizeChunks(chunks: Chunk[]): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Tokenize an arbitrary text string through the reranker's tokenizer.
|
|
111
|
+
* Use when consumers need to operate on tokens from the same vocabulary
|
|
112
|
+
* as the chunks (e.g. BM25 first-stage scoring at query time).
|
|
113
|
+
*/
|
|
114
|
+
tokenize(text: string): Promise<number[]>;
|
|
115
|
+
/** Release reranker resources. */
|
|
116
|
+
dispose(): void;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=chunk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../src/chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,KAAK;IACpB,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,mGAAmG;IACnG,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,wGAAwG;IACxG,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,mGAAmG;IACnG,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,8DAA8D;IAC9D,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,mEAAmE;IACnE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC,YAAY,CAAC,CAAC;IACnE;;;;;;;;;OASG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D,wDAAwD;IACxD,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1C,kCAAkC;IAClC,OAAO,IAAI,IAAI,CAAC;CACjB"}
|
package/dist/chunk.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Chunk / Reranker abstraction types.
|
|
4
|
+
*
|
|
5
|
+
* These interfaces live in `@lloyal-labs/lloyal-agents` (not rig) so that
|
|
6
|
+
* agent-pool code, app factories, and harness contexts can refer to a
|
|
7
|
+
* common Reranker shape without depending on rig's concrete chunking
|
|
8
|
+
* implementation. Concrete chunking utilities (`chunkResources`,
|
|
9
|
+
* `chunkHtml`, `chunkFetchedPages`) and the cross-encoder-backed
|
|
10
|
+
* `createReranker(...)` factory live in `@lloyal-labs/rig`.
|
|
11
|
+
*
|
|
12
|
+
* The pattern mirrors `Source` and `Tool`: abstract type in agents,
|
|
13
|
+
* concrete subclasses/factories in rig.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
* @category Contract
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
//# sourceMappingURL=chunk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk.js","sourceRoot":"","sources":["../src/chunk.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { SessionContext } from '@lloyal-labs/sdk';
|
|
2
|
-
import type { BranchStore
|
|
2
|
+
import type { BranchStore } from '@lloyal-labs/sdk';
|
|
3
3
|
import type { Channel } from 'effection';
|
|
4
4
|
import type { AgentEvent } from './types';
|
|
5
5
|
import type { TraceWriter } from './trace-writer';
|
|
6
6
|
import type { Agent, FormatConfig } from './Agent';
|
|
7
|
+
import type { Reranker } from './chunk';
|
|
8
|
+
import type { AppRegistry } from './app-types';
|
|
9
|
+
import type { AppConfigStore } from './app-config';
|
|
10
|
+
import type { GrantStore } from './grant-store';
|
|
7
11
|
/**
|
|
8
12
|
* Effection context holding the active {@link SessionContext}
|
|
9
13
|
*
|
|
@@ -51,17 +55,6 @@ export declare const Trace: import("effection").Context<TraceWriter>;
|
|
|
51
55
|
* @category Agents
|
|
52
56
|
*/
|
|
53
57
|
export declare const TraceParent: import("effection").Context<number>;
|
|
54
|
-
/**
|
|
55
|
-
* Effection context holding the scratchpad fork parent branch
|
|
56
|
-
*
|
|
57
|
-
* Set by {@link withSpine} to the current spine branch. Tools that
|
|
58
|
-
* need scratchpad extraction (e.g. BufferingFetchPage, BufferingWebSearch)
|
|
59
|
-
* read this via `yield* ScratchpadParent.expect()` to fork from the
|
|
60
|
-
* innermost active spine — never a stale reference from a prior scope.
|
|
61
|
-
*
|
|
62
|
-
* @category Agents
|
|
63
|
-
*/
|
|
64
|
-
export declare const ScratchpadParent: import("effection").Context<Branch>;
|
|
65
58
|
/**
|
|
66
59
|
* Effection context holding the calling agent during DISPATCH
|
|
67
60
|
*
|
|
@@ -93,4 +86,67 @@ export declare const CallingAgent: import("effection").Context<Agent>;
|
|
|
93
86
|
* @category Agents
|
|
94
87
|
*/
|
|
95
88
|
export declare const SpineFmt: import("effection").Context<FormatConfig | null>;
|
|
89
|
+
/**
|
|
90
|
+
* Effection context holding the harness-wide {@link Reranker}.
|
|
91
|
+
*
|
|
92
|
+
* Set by the harness once via `RerankerCtx.set(reranker)` after
|
|
93
|
+
* `createReranker(...)`. App factories (`createWebApp`, `createCorpusApp`,
|
|
94
|
+
* third-party apps) read this via `yield* RerankerCtx.expect()` at
|
|
95
|
+
* construction time and pass it to their `Source` / search tools.
|
|
96
|
+
*
|
|
97
|
+
* Replaces the per-source `source.bind({reranker})` pattern — chunks
|
|
98
|
+
* tokenized by one reranker can't be re-bound to another without
|
|
99
|
+
* re-tokenization, so one cross-encoder per harness
|
|
100
|
+
* is the invariant.
|
|
101
|
+
*
|
|
102
|
+
* @category Contract
|
|
103
|
+
*/
|
|
104
|
+
export declare const RerankerCtx: import("effection").Context<Reranker>;
|
|
105
|
+
/**
|
|
106
|
+
* Effection context holding the {@link AppRegistry}.
|
|
107
|
+
*
|
|
108
|
+
* Set by `createAppRegistry(...)` (lives in `@lloyal-labs/rig`). The
|
|
109
|
+
* scope-guard reads this at tool-dispatch time to resolve
|
|
110
|
+
* the allowed-tools set for an App-assigned spawn — looking up
|
|
111
|
+
* `registry.byName(spawn.assignedApp)` and matching the dispatched
|
|
112
|
+
* `toolName` against `manifest.protocol.tools`.
|
|
113
|
+
*
|
|
114
|
+
* The spine renderer also reads this to compose the catalog in
|
|
115
|
+
* registration order.
|
|
116
|
+
*
|
|
117
|
+
* @category Contract
|
|
118
|
+
*/
|
|
119
|
+
export declare const AppRegistryCtx: import("effection").Context<AppRegistry>;
|
|
120
|
+
/**
|
|
121
|
+
* Effection context holding the harness's {@link AppConfigStore}.
|
|
122
|
+
*
|
|
123
|
+
* Set by `createAppRegistry({ configStore })` from its `configStore`
|
|
124
|
+
* option, and seeded into each app's detached scope so factories can
|
|
125
|
+
* read it. App factories read their own config via
|
|
126
|
+
* `(yield* AppConfigStoreCtx.expect()).get(manifest.name)` at
|
|
127
|
+
* construction time. The framework validates the stored config against
|
|
128
|
+
* `app.manifest.configSchema` when the app is enabled.
|
|
129
|
+
*
|
|
130
|
+
* Whole-replace semantics on `set`; last-write-wins on concurrent
|
|
131
|
+
* writes.
|
|
132
|
+
*
|
|
133
|
+
* @category Contract
|
|
134
|
+
*/
|
|
135
|
+
export declare const AppConfigStoreCtx: import("effection").Context<AppConfigStore>;
|
|
136
|
+
/**
|
|
137
|
+
* Effection context holding the session's {@link GrantStore}.
|
|
138
|
+
*
|
|
139
|
+
* Seeded by `createAppRegistry({ grantStore })` (lives in `@lloyal-labs/rig`)
|
|
140
|
+
* alongside {@link AppConfigStoreCtx}. The authGuard
|
|
141
|
+
* reads it once per pool to resolve which `protected` tools the session is
|
|
142
|
+
* authorized to call — `protected` tools without a grant reject at dispatch
|
|
143
|
+
* time (`tool:authReject`). The store holds the consent decision; the
|
|
144
|
+
* **credential never enters the model's context**.
|
|
145
|
+
*
|
|
146
|
+
* Absent context = fail-closed: no grants, every protected tool denied.
|
|
147
|
+
* Open (non-protected) tools never consult it.
|
|
148
|
+
*
|
|
149
|
+
* @category Contract
|
|
150
|
+
*/
|
|
151
|
+
export declare const GrantStoreCtx: import("effection").Context<GrantStore>;
|
|
96
152
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OA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