@lloyal-labs/lloyal-agents 2.1.0 → 3.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 (70) hide show
  1. package/LICENSE +107 -0
  2. package/LICENSE-FAQ.md +256 -0
  3. package/README.md +17 -1
  4. package/dist/Agent.d.ts +13 -2
  5. package/dist/Agent.d.ts.map +1 -1
  6. package/dist/Agent.js +10 -0
  7. package/dist/Agent.js.map +1 -1
  8. package/dist/AgentPolicy.d.ts +84 -7
  9. package/dist/AgentPolicy.d.ts.map +1 -1
  10. package/dist/AgentPolicy.js +32 -4
  11. package/dist/AgentPolicy.js.map +1 -1
  12. package/dist/Tool.d.ts +44 -0
  13. package/dist/Tool.d.ts.map +1 -1
  14. package/dist/Tool.js +49 -1
  15. package/dist/Tool.js.map +1 -1
  16. package/dist/agent-pool.d.ts.map +1 -1
  17. package/dist/agent-pool.js +187 -16
  18. package/dist/agent-pool.js.map +1 -1
  19. package/dist/app-config.d.ts +50 -0
  20. package/dist/app-config.d.ts.map +1 -0
  21. package/dist/app-config.js +27 -0
  22. package/dist/app-config.js.map +1 -0
  23. package/dist/app-types.d.ts +309 -0
  24. package/dist/app-types.d.ts.map +1 -0
  25. package/dist/app-types.js +28 -0
  26. package/dist/app-types.js.map +1 -0
  27. package/dist/chunk.d.ts +118 -0
  28. package/dist/chunk.d.ts.map +1 -0
  29. package/dist/chunk.js +19 -0
  30. package/dist/chunk.js.map +1 -0
  31. package/dist/context.d.ts +68 -12
  32. package/dist/context.d.ts.map +1 -1
  33. package/dist/context.js +64 -12
  34. package/dist/context.js.map +1 -1
  35. package/dist/create-agent-pool.d.ts +10 -4
  36. package/dist/create-agent-pool.d.ts.map +1 -1
  37. package/dist/create-agent-pool.js +7 -6
  38. package/dist/create-agent-pool.js.map +1 -1
  39. package/dist/grant-store.d.ts +49 -0
  40. package/dist/grant-store.d.ts.map +1 -0
  41. package/dist/grant-store.js +33 -0
  42. package/dist/grant-store.js.map +1 -0
  43. package/dist/index.d.ts +7 -3
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +6 -2
  46. package/dist/index.js.map +1 -1
  47. package/dist/orchestrators.d.ts +7 -0
  48. package/dist/orchestrators.d.ts.map +1 -1
  49. package/dist/orchestrators.js.map +1 -1
  50. package/dist/source.d.ts +31 -1
  51. package/dist/source.d.ts.map +1 -1
  52. package/dist/source.js +32 -2
  53. package/dist/source.js.map +1 -1
  54. package/dist/spine.d.ts +0 -6
  55. package/dist/spine.d.ts.map +1 -1
  56. package/dist/spine.js +18 -2
  57. package/dist/spine.js.map +1 -1
  58. package/dist/toolkit.d.ts +44 -17
  59. package/dist/toolkit.d.ts.map +1 -1
  60. package/dist/toolkit.js +24 -14
  61. package/dist/toolkit.js.map +1 -1
  62. package/dist/trace-types.d.ts +34 -2
  63. package/dist/trace-types.d.ts.map +1 -1
  64. package/dist/types.d.ts +27 -2
  65. package/dist/types.d.ts.map +1 -1
  66. package/dist/use-agent.d.ts +9 -4
  67. package/dist/use-agent.d.ts.map +1 -1
  68. package/dist/use-agent.js +15 -12
  69. package/dist/use-agent.js.map +1 -1
  70. package/package.json +7 -5
@@ -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;IAC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DAAwD;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, Branch } from '@lloyal-labs/sdk';
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
@@ -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,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EA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KAAK,0CAA6C,CAAC;AAEhE;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,wDAA4D,CAAC;AAEhF;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,0CAA6C,CAAC;AAEhE;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,qCAA+C,CAAC;AAExE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,oCAA8C,CAAC;AAExE;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,QAAQ,kDAA8D,CAAC;AAEpF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,uCAA6C,CAAC;AAEtE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,0CAAmD,CAAC;AAE/E;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,6CAAyD,CAAC;AAExF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,aAAa,yCAAiD,CAAC"}
package/dist/context.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SpineFmt = exports.CallingAgent = exports.ScratchpadParent = exports.TraceParent = exports.Trace = exports.Events = exports.Store = exports.Ctx = void 0;
3
+ exports.GrantStoreCtx = exports.AppConfigStoreCtx = exports.AppRegistryCtx = exports.RerankerCtx = exports.SpineFmt = exports.CallingAgent = exports.TraceParent = exports.Trace = exports.Events = exports.Store = exports.Ctx = void 0;
4
4
  const effection_1 = require("effection");
5
5
  /**
6
6
  * Effection context holding the active {@link SessionContext}
@@ -49,17 +49,6 @@ exports.Trace = (0, effection_1.createContext)('lloyal.trace');
49
49
  * @category Agents
50
50
  */
51
51
  exports.TraceParent = (0, effection_1.createContext)('lloyal.traceParent');
52
- /**
53
- * Effection context holding the scratchpad fork parent branch
54
- *
55
- * Set by {@link withSpine} to the current spine branch. Tools that
56
- * need scratchpad extraction (e.g. BufferingFetchPage, BufferingWebSearch)
57
- * read this via `yield* ScratchpadParent.expect()` to fork from the
58
- * innermost active spine — never a stale reference from a prior scope.
59
- *
60
- * @category Agents
61
- */
62
- exports.ScratchpadParent = (0, effection_1.createContext)('lloyal.scratchpadParent');
63
52
  /**
64
53
  * Effection context holding the calling agent during DISPATCH
65
54
  *
@@ -91,4 +80,67 @@ exports.CallingAgent = (0, effection_1.createContext)('lloyal.callingAgent');
91
80
  * @category Agents
92
81
  */
93
82
  exports.SpineFmt = (0, effection_1.createContext)('lloyal.spineFmt', null);
83
+ /**
84
+ * Effection context holding the harness-wide {@link Reranker}.
85
+ *
86
+ * Set by the harness once via `RerankerCtx.set(reranker)` after
87
+ * `createReranker(...)`. App factories (`createWebApp`, `createCorpusApp`,
88
+ * third-party apps) read this via `yield* RerankerCtx.expect()` at
89
+ * construction time and pass it to their `Source` / search tools.
90
+ *
91
+ * Replaces the per-source `source.bind({reranker})` pattern — chunks
92
+ * tokenized by one reranker can't be re-bound to another without
93
+ * re-tokenization, so one cross-encoder per harness
94
+ * is the invariant.
95
+ *
96
+ * @category Contract
97
+ */
98
+ exports.RerankerCtx = (0, effection_1.createContext)('lloyal.reranker');
99
+ /**
100
+ * Effection context holding the {@link AppRegistry}.
101
+ *
102
+ * Set by `createAppRegistry(...)` (lives in `@lloyal-labs/rig`). The
103
+ * scope-guard reads this at tool-dispatch time to resolve
104
+ * the allowed-tools set for an App-assigned spawn — looking up
105
+ * `registry.byName(spawn.assignedApp)` and matching the dispatched
106
+ * `toolName` against `manifest.protocol.tools`.
107
+ *
108
+ * The spine renderer also reads this to compose the catalog in
109
+ * registration order.
110
+ *
111
+ * @category Contract
112
+ */
113
+ exports.AppRegistryCtx = (0, effection_1.createContext)('lloyal.appRegistry');
114
+ /**
115
+ * Effection context holding the harness's {@link AppConfigStore}.
116
+ *
117
+ * Set by `createAppRegistry({ configStore })` from its `configStore`
118
+ * option, and seeded into each app's detached scope so factories can
119
+ * read it. App factories read their own config via
120
+ * `(yield* AppConfigStoreCtx.expect()).get(manifest.name)` at
121
+ * construction time. The framework validates the stored config against
122
+ * `app.manifest.configSchema` when the app is enabled.
123
+ *
124
+ * Whole-replace semantics on `set`; last-write-wins on concurrent
125
+ * writes.
126
+ *
127
+ * @category Contract
128
+ */
129
+ exports.AppConfigStoreCtx = (0, effection_1.createContext)('lloyal.appConfigStore');
130
+ /**
131
+ * Effection context holding the session's {@link GrantStore}.
132
+ *
133
+ * Seeded by `createAppRegistry({ grantStore })` (lives in `@lloyal-labs/rig`)
134
+ * alongside {@link AppConfigStoreCtx}. The authGuard
135
+ * reads it once per pool to resolve which `protected` tools the session is
136
+ * authorized to call — `protected` tools without a grant reject at dispatch
137
+ * time (`tool:authReject`). The store holds the consent decision; the
138
+ * **credential never enters the model's context**.
139
+ *
140
+ * Absent context = fail-closed: no grants, every protected tool denied.
141
+ * Open (non-protected) tools never consult it.
142
+ *
143
+ * @category Contract
144
+ */
145
+ exports.GrantStoreCtx = (0, effection_1.createContext)('lloyal.grantStore');
94
146
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;AAAA,yCAA0C;AAS1C;;;;;;;;GAQG;AACU,QAAA,GAAG,GAAG,IAAA,yBAAa,EAAiB,YAAY,CAAC,CAAC;AAE/D;;;;;;;GAOG;AACU,QAAA,KAAK,GAAG,IAAA,yBAAa,EAAc,cAAc,CAAC,CAAC;AAEhE;;;;;;;GAOG;AACU,QAAA,MAAM,GAAG,IAAA,yBAAa,EAA4B,eAAe,CAAC,CAAC;AAEhF;;;;;;;GAOG;AACU,QAAA,KAAK,GAAG,IAAA,yBAAa,EAAc,cAAc,CAAC,CAAC;AAEhE;;;;;;;;GAQG;AACU,QAAA,WAAW,GAAG,IAAA,yBAAa,EAAU,oBAAoB,CAAC,CAAC;AAExE;;;;;;;;;GASG;AACU,QAAA,gBAAgB,GAAG,IAAA,yBAAa,EAAS,yBAAyB,CAAC,CAAC;AAEjF;;;;;;;;;;;;GAYG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,8 +20,14 @@ export interface CreateAgentPoolOpts {
20
20
  orchestrate: Orchestrator;
21
21
  /** Data access tools (array, createToolkit called internally). Optional — pool degenerates cleanly without tools. */
22
22
  tools?: Tool[];
23
- /** Terminal tool name — tool must be in the tools array. Pool intercepts and extracts result. */
24
- terminalToolName?: string;
23
+ /**
24
+ * The tool that ends an agent's turn — `report`, `email`, whatever the
25
+ * harness designates. Passed by reference; the framework merges it into
26
+ * the tool set (so its schema reaches the model) and intercepts its
27
+ * call at the policy layer to extract the `result` arg as the agent's
28
+ * return value. Omit for pools that end on free-text/stop.
29
+ */
30
+ terminal?: Tool;
25
31
  /** Max tool-use turns per agent before hard cut. @default 100 */
26
32
  maxTurns?: number;
27
33
  /** Prune agent branches immediately when they voluntarily return, freeing KV mid-pool. */
@@ -84,9 +90,9 @@ export interface CreateAgentPoolOpts {
84
90
  * @example Research harness
85
91
  * ```typescript
86
92
  * const pool = yield* agentPool({
87
- * tools: [delegateTool, ...source.tools, reportTool],
93
+ * tools: [delegateTool, ...source.tools],
88
94
  * orchestrate: parallel(questions.map(q => ({ content: q, systemPrompt: RESEARCH_PROMPT }))),
89
- * terminalToolName: 'report',
95
+ * terminal: reportTool,
90
96
  * });
91
97
  * ```
92
98
  *
@@ -1 +1 @@
1
- {"version":3,"file":"create-agent-pool.d.ts","sourceRoot":"","sources":["../src/create-agent-pool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,M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18
18
  * ```typescript
19
19
  * const pool = yield* agentPool({
20
- * tools: [delegateTool, ...source.tools, reportTool],
20
+ * tools: [delegateTool, ...source.tools],
21
21
  * orchestrate: parallel(questions.map(q => ({ content: q, systemPrompt: RESEARCH_PROMPT }))),
22
- * terminalToolName: 'report',
22
+ * terminal: reportTool,
23
23
  * });
24
24
  * ```
25
25
  *
@@ -27,7 +27,7 @@ const agent_pool_1 = require("./agent-pool");
27
27
  */
28
28
  function* agentPool(opts) {
29
29
  const broadcast = yield* context_1.Events.expect();
30
- const toolkit = (0, toolkit_1.createToolkit)(opts.tools ?? []);
30
+ const toolkit = (0, toolkit_1.createToolkit)(opts.tools ?? [], opts.terminal);
31
31
  // Warm path priority: explicit parent > session trunk > cold
32
32
  const warmParent = opts.parent ?? opts.session?.trunk ?? undefined;
33
33
  const sharedMode = opts.systemPrompt !== undefined;
@@ -36,8 +36,9 @@ function* agentPool(opts) {
36
36
  systemPrompt: opts.systemPrompt,
37
37
  // Only emit tool schemas into the spine header in shared mode; the
38
38
  // dispatcher (toolkit.toolMap) is registered on the useAgentPool
39
- // below regardless.
40
- tools: sharedMode ? opts.tools : undefined,
39
+ // below regardless. Use the toolkit's merged set so the terminal's
40
+ // schema rides the spine prefill alongside the capability tools.
41
+ tools: sharedMode ? toolkit.tools : undefined,
41
42
  // Thread enableThinking so the spine header chat-format and the
42
43
  // SpineFmt FormatConfig (parser/grammar/triggers) match what the
43
44
  // per-agent suffixes get further down. Otherwise a caller passing
@@ -64,7 +65,7 @@ function* agentPool(opts) {
64
65
  orchestrate: opts.orchestrate,
65
66
  toolsJson: toolkit.toolsJson,
66
67
  tools: toolkit.toolMap,
67
- terminalToolName: opts.terminalToolName,
68
+ terminalToolName: toolkit.terminalName,
68
69
  pruneOnReturn: opts.pruneOnReturn,
69
70
  maxTurns: opts.maxTurns,
70
71
  trace: opts.trace,
@@ -1 +1 @@
1
- {"version":3,"file":"create-agent-pool.js","sourceRoot":"","sources":["../src/create-agent-pool.ts"],"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ACnB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,cAAc,EAAE,IAAI,CAAC,cAAc;SACpC,CAAC,CAAC;QAEH,oEAAoE;QACpE,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAClB,KAAK,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClC,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * `GrantStore` — pluggable runtime store for protected-tool grants.
3
+ *
4
+ * A **grant** authorizes the current session to invoke a `protected` tool
5
+ * (see {@link Tool.protected}). The framework's authGuard denies any
6
+ * protected tool call whose name is not granted. Grants are obtained via
7
+ * consent — a harness consent prompt, or an app's {@link ConfigFlow}
8
+ * OAuth-style handoff — and the **credential itself never enters the
9
+ * model's context**: the model only triggers the call; the runtime holds
10
+ * the grant and the tool's `execute` uses the underlying secret.
11
+ *
12
+ * The interface lives in `@lloyal-labs/lloyal-agents` so the framework
13
+ * context ({@link GrantStoreCtx}) and app/harness code share one type
14
+ * without a dependency cycle. The concrete in-memory implementation
15
+ * (`createGrantStore`) and harness-supplied backends live in rig and
16
+ * harness packages — mirroring {@link AppConfigStore} /
17
+ * `createInMemoryConfigStore`.
18
+ *
19
+ * **Semantics:**
20
+ *
21
+ * - **Binary per tool.** A grant is keyed by tool name; either the session
22
+ * holds it or it doesn't. No scopes, no expiry in the base contract —
23
+ * richer policies are a harness concern.
24
+ * - **Fail-closed.** With no grant store on {@link GrantStoreCtx}, no grants
25
+ * exist: every protected tool is denied. Open (non-protected) tools are
26
+ * unaffected.
27
+ *
28
+ * @packageDocumentation
29
+ * @category Contract
30
+ */
31
+ import type { Operation } from 'effection';
32
+ /**
33
+ * Pluggable runtime store of protected-tool grants for a session.
34
+ *
35
+ * All methods return `Operation<...>` (Effection generators) so concrete
36
+ * implementations can perform async IO (reading a secrets backend,
37
+ * checking a remote authorization service) inside the framework's scope.
38
+ */
39
+ export interface GrantStore {
40
+ /** Whether the session currently holds a grant for `toolName`. */
41
+ has(toolName: string): Operation<boolean>;
42
+ /** Record consent for `toolName` (the session may now call it). Idempotent. */
43
+ grant(toolName: string): Operation<void>;
44
+ /** Revoke a previously-granted tool. Idempotent. */
45
+ revoke(toolName: string): Operation<void>;
46
+ /** Snapshot of all granted tool names — the synchronous gate the pool reads. */
47
+ granted(): Operation<readonly string[]>;
48
+ }
49
+ //# sourceMappingURL=grant-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grant-store.d.ts","sourceRoot":"","sources":["../src/grant-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,kEAAkE;IAClE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1C,+EAA+E;IAC/E,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACzC,oDAAoD;IACpD,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC1C,gFAAgF;IAChF,OAAO,IAAI,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACzC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * `GrantStore` — pluggable runtime store for protected-tool grants.
4
+ *
5
+ * A **grant** authorizes the current session to invoke a `protected` tool
6
+ * (see {@link Tool.protected}). The framework's authGuard denies any
7
+ * protected tool call whose name is not granted. Grants are obtained via
8
+ * consent — a harness consent prompt, or an app's {@link ConfigFlow}
9
+ * OAuth-style handoff — and the **credential itself never enters the
10
+ * model's context**: the model only triggers the call; the runtime holds
11
+ * the grant and the tool's `execute` uses the underlying secret.
12
+ *
13
+ * The interface lives in `@lloyal-labs/lloyal-agents` so the framework
14
+ * context ({@link GrantStoreCtx}) and app/harness code share one type
15
+ * without a dependency cycle. The concrete in-memory implementation
16
+ * (`createGrantStore`) and harness-supplied backends live in rig and
17
+ * harness packages — mirroring {@link AppConfigStore} /
18
+ * `createInMemoryConfigStore`.
19
+ *
20
+ * **Semantics:**
21
+ *
22
+ * - **Binary per tool.** A grant is keyed by tool name; either the session
23
+ * holds it or it doesn't. No scopes, no expiry in the base contract —
24
+ * richer policies are a harness concern.
25
+ * - **Fail-closed.** With no grant store on {@link GrantStoreCtx}, no grants
26
+ * exist: every protected tool is denied. Open (non-protected) tools are
27
+ * unaffected.
28
+ *
29
+ * @packageDocumentation
30
+ * @category Contract
31
+ */
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ //# sourceMappingURL=grant-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grant-store.js","sourceRoot":"","sources":["../src/grant-store.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { Ctx, Store, Events, Trace, TraceParent, ScratchpadParent } from './context';
2
- export { Tool } from './Tool';
1
+ export { Ctx, Store, Events, Trace, TraceParent, RerankerCtx, AppRegistryCtx, AppConfigStoreCtx, GrantStoreCtx, } from './context';
2
+ export { Tool, ToolRetryError } from './Tool';
3
3
  export { Agent } from './Agent';
4
4
  export type { AgentStatus, ResultSource, FormatConfig, ToolHistoryEntry } from './Agent';
5
5
  export { DefaultAgentPolicy } from './AgentPolicy';
6
- export type { AgentPolicy, ProduceAction, SettleAction, RecoveryAction, IdleReason, PolicyConfig, ToolGuard, DefaultAgentPolicyOpts } from './AgentPolicy';
6
+ export type { AgentPolicy, ProduceAction, SettleAction, RecoveryAction, ToolRetryAction, IdleReason, PolicyConfig, ToolGuard, DefaultAgentPolicyOpts } from './AgentPolicy';
7
7
  export { defaultToolGuards } from './AgentPolicy';
8
8
  export { CallingAgent } from './context';
9
9
  export { Source, NULL_SCORER } from './source';
@@ -33,4 +33,8 @@ export type { TraceEvent, TraceId } from './trace-types';
33
33
  export type { AgentHandle } from './init';
34
34
  export type { SpineOptions } from './spine';
35
35
  export type { TraceToken, JsonSchema, ToolSchema, ToolContext, PressureThresholds, AgentTaskSpec, AgentPoolOptions, AgentResult, AgentPoolResult, DivergeOptions, DivergeAttempt, DivergeResult, AgentEvent, } from './types';
36
+ export type { App, AppManifest, AppProtocol, AppHints, AppRegistry, AppFactory, AppState, AgentRenderCtx, ExamplesRenderCtx, SkillTemplateFn, ExamplesTemplateFn, ConfigFlow, } from './app-types';
37
+ export type { AppConfigStore } from './app-config';
38
+ export type { GrantStore } from './grant-store';
39
+ export type { Resource, Chunk, ScoredChunk, ScoredResult, Reranker } from './chunk';
36
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,E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,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AACvF,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAC1C,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,YAAY,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,UAAU,GACX,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,GAAG,EACH,WAAW,EACX,WAAW,EACX,QAAQ,EACR,WAAW,EACX,UAAU,EACV,QAAQ,EACR,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1,15 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reconstructBranch = exports.extractSpineCheckpoint = exports.extractSpineSeed = exports.dag = exports.fanout = exports.chain = exports.parallel = exports.reduce = exports.renderTemplate = exports.renderPrompt = exports.composePrompt = exports.traceScope = exports.JsonlTraceWriter = exports.NullTraceWriter = exports.withSpine = exports.initAgents = exports.createToolkit = exports.ContextPressure = exports.useAgentPool = exports.diverge = exports.agentPool = exports.agent = exports.useAgent = exports.buildToolResultDelta = exports.buildUserDelta = exports.NULL_SCORER = exports.Source = exports.CallingAgent = exports.defaultToolGuards = exports.DefaultAgentPolicy = exports.Agent = exports.Tool = exports.ScratchpadParent = exports.TraceParent = exports.Trace = exports.Events = exports.Store = exports.Ctx = void 0;
3
+ exports.reconstructBranch = exports.extractSpineCheckpoint = exports.extractSpineSeed = exports.dag = exports.fanout = exports.chain = exports.parallel = exports.reduce = exports.renderTemplate = exports.renderPrompt = exports.composePrompt = exports.traceScope = exports.JsonlTraceWriter = exports.NullTraceWriter = exports.withSpine = exports.initAgents = exports.createToolkit = exports.ContextPressure = exports.useAgentPool = exports.diverge = exports.agentPool = exports.agent = exports.useAgent = exports.buildToolResultDelta = exports.buildUserDelta = exports.NULL_SCORER = exports.Source = exports.CallingAgent = exports.defaultToolGuards = exports.DefaultAgentPolicy = exports.Agent = exports.ToolRetryError = exports.Tool = exports.GrantStoreCtx = exports.AppConfigStoreCtx = exports.AppRegistryCtx = exports.RerankerCtx = exports.TraceParent = exports.Trace = exports.Events = exports.Store = exports.Ctx = void 0;
4
4
  var context_1 = require("./context");
5
5
  Object.defineProperty(exports, "Ctx", { enumerable: true, get: function () { return context_1.Ctx; } });
6
6
  Object.defineProperty(exports, "Store", { enumerable: true, get: function () { return context_1.Store; } });
7
7
  Object.defineProperty(exports, "Events", { enumerable: true, get: function () { return context_1.Events; } });
8
8
  Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return context_1.Trace; } });
9
9
  Object.defineProperty(exports, "TraceParent", { enumerable: true, get: function () { return context_1.TraceParent; } });
10
- Object.defineProperty(exports, "ScratchpadParent", { enumerable: true, get: function () { return context_1.ScratchpadParent; } });
10
+ Object.defineProperty(exports, "RerankerCtx", { enumerable: true, get: function () { return context_1.RerankerCtx; } });
11
+ Object.defineProperty(exports, "AppRegistryCtx", { enumerable: true, get: function () { return context_1.AppRegistryCtx; } });
12
+ Object.defineProperty(exports, "AppConfigStoreCtx", { enumerable: true, get: function () { return context_1.AppConfigStoreCtx; } });
13
+ Object.defineProperty(exports, "GrantStoreCtx", { enumerable: true, get: function () { return context_1.GrantStoreCtx; } });
11
14
  var Tool_1 = require("./Tool");
12
15
  Object.defineProperty(exports, "Tool", { enumerable: true, get: function () { return Tool_1.Tool; } });
16
+ Object.defineProperty(exports, "ToolRetryError", { enumerable: true, get: function () { return Tool_1.ToolRetryError; } });
13
17
  var Agent_1 = require("./Agent");
14
18
  Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return Agent_1.Agent; } });
15
19
  var AgentPolicy_1 = require("./AgentPolicy");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAqF;AAA5E,8FAAA,GAAG,OAAA;AAAE,gGAAA,KAAK,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,gGAAA,KAAK,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AACjE,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AAEd,6CAAmD;AAA1C,iHAAA,kBAAkB,OAAA;AAE3B,6CAAkD;AAAzC,gHAAA,iBAAiB,OAAA;AAC1B,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AACrB,mCAA+C;AAAtC,gGAAA,MAAM,OAAA;AAAE,qGAAA,WAAW,OAAA;AAE5B,wCAAwE;AAA/D,qGAAA,cAAc,OAAA;AAAE,2GAAA,oBAAoB,OAAA;AAC7C,yCAA8C;AAArC,qGAAA,QAAQ,OAAA;AAAE,kGAAA,KAAK,OAAA;AAExB,yDAAgD;AAAvC,8GAAA,SAAS,OAAA;AAElB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,2CAA6D;AAApD,0GAAA,Y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CAAwE;AAA/D,qGAAA,cAAc,OAAA;AAAE,2GAAA,oBAAoB,OAAA;AAC7C,yCAA8C;AAArC,qGAAA,QAAQ,OAAA;AAAE,kGAAA,KAAK,OAAA;AAExB,yDAAgD;AAAvC,8GAAA,SAAS,OAAA;AAElB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,2CAA6D;AAApD,0GAAA,YAAY,OAAA;AAAE,6GAAA,eAAe,OAAA;AACtC,qCAA0C;AAAjC,wGAAA,aAAa,OAAA;AACtB,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,iCAAoC;AAA3B,kGAAA,SAAS,OAAA;AAClB,+CAAmE;AAA1D,+GAAA,eAAe,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAC1C,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,mCAAuE;AAA9D,uGAAA,aAAa,OAAA;AAAE,sGAAA,YAAY,OAAA;AAAE,wGAAA,cAAc,OAAA;AAEpD,6CAAuC;AAA9B,qGAAA,MAAM,OAAA;AACf,iDAA+D;AAAtD,yGAAA,QAAQ,OAAA;AAAE,sGAAA,KAAK,OAAA;AAAE,uGAAA,MAAM,OAAA;AAAE,oGAAA,GAAG,OAAA;AAErC,mCAAuF;AAA9E,0GAAA,gBAAgB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAAE,2GAAA,iBAAiB,OAAA"}
@@ -16,6 +16,13 @@ export interface SpawnSpec {
16
16
  seed?: number;
17
17
  /** Parent branch to fork from. Falls back to ctx.spine. */
18
18
  parent?: Branch;
19
+ /**
20
+ * Non-enforcing label naming the App this spawn nominally belongs to
21
+ * Carried for trace attribution (`tool:authReject`) and
22
+ * harness UI only — tool access is gated by {@link Tool.protected} +
23
+ * session grants (the authGuard), not by app membership.
24
+ */
25
+ assignedApp?: string;
19
26
  }
20
27
  /**
21
28
  * Orchestrator-facing API surface exposed by {@link useAgentPool}.