@orkestrel/agent 0.0.10 → 0.0.11

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.
@@ -100,15 +100,17 @@ export declare type AgentChunk = {
100
100
  * The richer turn context the agent loop assembles a provider request from — the optional
101
101
  * system prompt, the observable context managers (instructions / workspaces), the
102
102
  * {@link ConversationManagerInterface} message source (whose active conversation IS `messages`),
103
- * the {@link ToolManagerInterface} registry, and a mutable active {@link ScopeInterface}.
103
+ * the {@link ToolManagerInterface} registry, and an active {@link ScopeInterface} changed through
104
+ * {@link AgentContextInterface.apply}.
104
105
  *
105
106
  * @remarks
106
107
  * - **Composition.** `system` is the optional system prompt; `instructions` / `tools` /
107
108
  * `workspaces` / `conversations` are the registries passed in `options` (bring your own), or
108
109
  * fresh empty ones when omitted (so `workspaces` is ALWAYS present); `messages` is the ACTIVE
109
110
  * conversation's live tail (ALWAYS defined — see below). `scope` is the active filter —
110
- * `undefined` (the default) ⇒ no filtering; settable afterwards. `workspaces` / `conversations`
111
- * are likewise SETTABLE (swap the whole registry between runs).
111
+ * `undefined` (the default) ⇒ no filtering; change it through `apply(scope)`. The structural
112
+ * `workspaces` / `conversations` registries are fixed at construction; switch their active
113
+ * members through their own `switch(id)` methods.
112
114
  * - **The message source — the conversation registry's ACTIVE conversation.** `conversations` is a
113
115
  * {@link ConversationManagerInterface}; the context ENSURES it always has an active conversation
114
116
  * (at construction it `add`s a default when the manager has none), so the DYNAMIC `messages`
@@ -167,13 +169,11 @@ export declare class AgentContext implements AgentContextInterface {
167
169
  get system(): string | undefined;
168
170
  get instructions(): InstructionManagerInterface;
169
171
  get workspaces(): WorkspaceManagerInterface;
170
- set workspaces(value: WorkspaceManagerInterface);
171
172
  get messages(): MessageManagerInterface;
172
173
  get conversations(): ConversationManagerInterface;
173
- set conversations(value: ConversationManagerInterface);
174
174
  get tools(): ToolManagerInterface;
175
175
  get scope(): ScopeInterface | undefined;
176
- set scope(value: ScopeInterface | undefined);
176
+ apply(scope: ScopeInterface | undefined): void;
177
177
  build(format?: ContextFormatInterface): readonly MessageInterface[];
178
178
  }
179
179
 
@@ -214,8 +214,8 @@ export declare interface AgentContextInterface {
214
214
  * construction). It IS the active {@link ConversationInterface} itself (which satisfies
215
215
  * {@link MessageManagerInterface} structurally), so appends through `messages` route to the
216
216
  * active conversation's tail and `build()` folds its `view()`. Computed dynamically (it follows
217
- * a `conversations.switch(id)` or a `conversations` swap), the SAME reference the active
218
- * conversation exposes — no duplication.
217
+ * `conversations.switch(id)`), the SAME reference the active conversation exposes — no
218
+ * duplication.
219
219
  */
220
220
  readonly messages: MessageManagerInterface;
221
221
  /**
@@ -231,6 +231,18 @@ export declare interface AgentContextInterface {
231
231
  readonly tools: ToolManagerInterface;
232
232
  /** The active scope applied at `build()` time + the loop's tool-advertise step (`undefined` ⇒ no filtering). */
233
233
  readonly scope: ScopeInterface | undefined;
234
+ /**
235
+ * Apply the active per-turn scope filter. Passing `undefined` removes filtering.
236
+ *
237
+ * @param scope - The scope to apply, or `undefined` to remove the active filter
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * context.apply(scope)
242
+ * context.apply(undefined)
243
+ * ```
244
+ */
245
+ apply(scope: ScopeInterface | undefined): void;
234
246
  /**
235
247
  * The provider input for the next turn: a leading `system` message folding the prompt
236
248
  * + the scoped instructions + the ACTIVE workspace's scoped-in TEXT files (rendered as
@@ -295,10 +307,10 @@ export declare interface AgentContextInterface {
295
307
  * `instructions` / `workspaces` are optional pre-built managers to reuse (bring your own
296
308
  * registry); when one is omitted, the context creates a fresh empty one. `scope` is the
297
309
  * initial active filter applied at `build()` time (and at the loop's tool-advertise step); it
298
- * defaults to `undefined` — no filtering — and is mutable through the context's `scope` setter
299
- * afterwards. `conversations` is the {@link ConversationManagerInterface} the context's message
300
- * source flows from: `messages` IS the manager's ACTIVE conversation's live tail and `build()`
301
- * folds that conversation's `view()` (section summaries + live). When omitted, a fresh
310
+ * defaults to `undefined` — no filtering — and can be changed through the context's `apply`
311
+ * method afterwards. `conversations` is the structural {@link ConversationManagerInterface} the
312
+ * context's message source flows from: `messages` IS the manager's ACTIVE conversation's live tail
313
+ * and `build()` folds that conversation's `view()` (section summaries + live). When omitted, a fresh
302
314
  * {@link ConversationManagerInterface} is created and a default conversation is added (so
303
315
  * `messages` is ALWAYS defined). All default to a context with no system prompt, empty registries,
304
316
  * no scope, and a fresh conversation registry holding one default conversation.
@@ -313,8 +325,8 @@ export declare interface AgentContextOptions {
313
325
  * A pre-built {@link WorkspaceManagerInterface} to reuse; a fresh empty one is created when
314
326
  * omitted (so `context.workspaces` is ALWAYS present). `build()` renders the ACTIVE workspace's
315
327
  * files by carrier — text files into the system block (fenced), image files attached to the last
316
- * user message — and is mutable through the context's `workspaces` setter afterwards. The active
317
- * workspace is the SOLE document/image context.
328
+ * user message. The registry is structural; change its active workspace through
329
+ * `workspaces.switch(id)`. The active workspace is the SOLE document/image context.
318
330
  */
319
331
  readonly workspaces?: WorkspaceManagerInterface;
320
332
  /** The initial active scope (the build-time filter); `undefined` ⇒ no filtering. */
@@ -326,9 +338,8 @@ export declare interface AgentContextOptions {
326
338
  * conversation's LIVE tail — is ALWAYS defined. `build()` folds the active conversation's
327
339
  * `view()` (the per-section summaries + the live tail) as its AUTHORITATIVE message inclusion —
328
340
  * the scope does NOT filter the conversation (it owns inclusion via compaction; scope filters
329
- * only instructions / tools / workspace files). A SETTABLE mutable
330
- * property afterwards (the context's `conversations` setter — swap the whole registry between
331
- * runs), and the active conversation is switchable through the manager's `switch(id)`.
341
+ * only instructions / tools / workspace files). The registry is structural; change its active
342
+ * conversation through the manager's `switch(id)`.
332
343
  */
333
344
  readonly conversations?: ConversationManagerInterface;
334
345
  }
@@ -2001,8 +2012,8 @@ export declare function createAgent(provider: ProviderInterface, options?: Agent
2001
2012
  * @remarks
2002
2013
  * `system` is the optional system prompt; `tools` / `instructions` / `workspaces` are pre-built
2003
2014
  * managers to reuse (empty ones are created when omitted, so `context.workspaces` is ALWAYS
2004
- * present); `scope` is the initial active filter (`undefined` ⇒ no filtering, mutable afterwards
2005
- * via `context.scope`). The `messages` store is always fresh. `build()` folds the scoped
2015
+ * present); `scope` is the initial active filter (`undefined` ⇒ no filtering, changeable afterwards
2016
+ * via `context.apply(...)`). The `messages` store is always fresh. `build()` folds the scoped
2006
2017
  * instructions — PLUS the ACTIVE workspace's scope-filtered text files (fenced) — into ONE leading
2007
2018
  * `system` message and appends the scoped conversation (attaching the active workspace's
2008
2019
  * scope-filtered image files' `data` to the last user message), built fresh each call; the active
@@ -3933,7 +3944,7 @@ export declare interface ProviderInterface {
3933
3944
  * built-in framing, beaten by a manager-options or per-item override). Omitted ⇒ the
3934
3945
  * provider is framing-agnostic and the managers' built-in defaults apply unchanged.
3935
3946
  */
3936
- readonly format?: ContextFormatInterface;
3947
+ readonly format?: ContextFormatInterface | undefined;
3937
3948
  /**
3938
3949
  * Generate one complete turn — resolves the assembled {@link ProviderResult}.
3939
3950
  *
@@ -100,15 +100,17 @@ export declare type AgentChunk = {
100
100
  * The richer turn context the agent loop assembles a provider request from — the optional
101
101
  * system prompt, the observable context managers (instructions / workspaces), the
102
102
  * {@link ConversationManagerInterface} message source (whose active conversation IS `messages`),
103
- * the {@link ToolManagerInterface} registry, and a mutable active {@link ScopeInterface}.
103
+ * the {@link ToolManagerInterface} registry, and an active {@link ScopeInterface} changed through
104
+ * {@link AgentContextInterface.apply}.
104
105
  *
105
106
  * @remarks
106
107
  * - **Composition.** `system` is the optional system prompt; `instructions` / `tools` /
107
108
  * `workspaces` / `conversations` are the registries passed in `options` (bring your own), or
108
109
  * fresh empty ones when omitted (so `workspaces` is ALWAYS present); `messages` is the ACTIVE
109
110
  * conversation's live tail (ALWAYS defined — see below). `scope` is the active filter —
110
- * `undefined` (the default) ⇒ no filtering; settable afterwards. `workspaces` / `conversations`
111
- * are likewise SETTABLE (swap the whole registry between runs).
111
+ * `undefined` (the default) ⇒ no filtering; change it through `apply(scope)`. The structural
112
+ * `workspaces` / `conversations` registries are fixed at construction; switch their active
113
+ * members through their own `switch(id)` methods.
112
114
  * - **The message source — the conversation registry's ACTIVE conversation.** `conversations` is a
113
115
  * {@link ConversationManagerInterface}; the context ENSURES it always has an active conversation
114
116
  * (at construction it `add`s a default when the manager has none), so the DYNAMIC `messages`
@@ -167,13 +169,11 @@ export declare class AgentContext implements AgentContextInterface {
167
169
  get system(): string | undefined;
168
170
  get instructions(): InstructionManagerInterface;
169
171
  get workspaces(): WorkspaceManagerInterface;
170
- set workspaces(value: WorkspaceManagerInterface);
171
172
  get messages(): MessageManagerInterface;
172
173
  get conversations(): ConversationManagerInterface;
173
- set conversations(value: ConversationManagerInterface);
174
174
  get tools(): ToolManagerInterface;
175
175
  get scope(): ScopeInterface | undefined;
176
- set scope(value: ScopeInterface | undefined);
176
+ apply(scope: ScopeInterface | undefined): void;
177
177
  build(format?: ContextFormatInterface): readonly MessageInterface[];
178
178
  }
179
179
 
@@ -214,8 +214,8 @@ export declare interface AgentContextInterface {
214
214
  * construction). It IS the active {@link ConversationInterface} itself (which satisfies
215
215
  * {@link MessageManagerInterface} structurally), so appends through `messages` route to the
216
216
  * active conversation's tail and `build()` folds its `view()`. Computed dynamically (it follows
217
- * a `conversations.switch(id)` or a `conversations` swap), the SAME reference the active
218
- * conversation exposes — no duplication.
217
+ * `conversations.switch(id)`), the SAME reference the active conversation exposes — no
218
+ * duplication.
219
219
  */
220
220
  readonly messages: MessageManagerInterface;
221
221
  /**
@@ -231,6 +231,18 @@ export declare interface AgentContextInterface {
231
231
  readonly tools: ToolManagerInterface;
232
232
  /** The active scope applied at `build()` time + the loop's tool-advertise step (`undefined` ⇒ no filtering). */
233
233
  readonly scope: ScopeInterface | undefined;
234
+ /**
235
+ * Apply the active per-turn scope filter. Passing `undefined` removes filtering.
236
+ *
237
+ * @param scope - The scope to apply, or `undefined` to remove the active filter
238
+ *
239
+ * @example
240
+ * ```ts
241
+ * context.apply(scope)
242
+ * context.apply(undefined)
243
+ * ```
244
+ */
245
+ apply(scope: ScopeInterface | undefined): void;
234
246
  /**
235
247
  * The provider input for the next turn: a leading `system` message folding the prompt
236
248
  * + the scoped instructions + the ACTIVE workspace's scoped-in TEXT files (rendered as
@@ -295,10 +307,10 @@ export declare interface AgentContextInterface {
295
307
  * `instructions` / `workspaces` are optional pre-built managers to reuse (bring your own
296
308
  * registry); when one is omitted, the context creates a fresh empty one. `scope` is the
297
309
  * initial active filter applied at `build()` time (and at the loop's tool-advertise step); it
298
- * defaults to `undefined` — no filtering — and is mutable through the context's `scope` setter
299
- * afterwards. `conversations` is the {@link ConversationManagerInterface} the context's message
300
- * source flows from: `messages` IS the manager's ACTIVE conversation's live tail and `build()`
301
- * folds that conversation's `view()` (section summaries + live). When omitted, a fresh
310
+ * defaults to `undefined` — no filtering — and can be changed through the context's `apply`
311
+ * method afterwards. `conversations` is the structural {@link ConversationManagerInterface} the
312
+ * context's message source flows from: `messages` IS the manager's ACTIVE conversation's live tail
313
+ * and `build()` folds that conversation's `view()` (section summaries + live). When omitted, a fresh
302
314
  * {@link ConversationManagerInterface} is created and a default conversation is added (so
303
315
  * `messages` is ALWAYS defined). All default to a context with no system prompt, empty registries,
304
316
  * no scope, and a fresh conversation registry holding one default conversation.
@@ -313,8 +325,8 @@ export declare interface AgentContextOptions {
313
325
  * A pre-built {@link WorkspaceManagerInterface} to reuse; a fresh empty one is created when
314
326
  * omitted (so `context.workspaces` is ALWAYS present). `build()` renders the ACTIVE workspace's
315
327
  * files by carrier — text files into the system block (fenced), image files attached to the last
316
- * user message — and is mutable through the context's `workspaces` setter afterwards. The active
317
- * workspace is the SOLE document/image context.
328
+ * user message. The registry is structural; change its active workspace through
329
+ * `workspaces.switch(id)`. The active workspace is the SOLE document/image context.
318
330
  */
319
331
  readonly workspaces?: WorkspaceManagerInterface;
320
332
  /** The initial active scope (the build-time filter); `undefined` ⇒ no filtering. */
@@ -326,9 +338,8 @@ export declare interface AgentContextOptions {
326
338
  * conversation's LIVE tail — is ALWAYS defined. `build()` folds the active conversation's
327
339
  * `view()` (the per-section summaries + the live tail) as its AUTHORITATIVE message inclusion —
328
340
  * the scope does NOT filter the conversation (it owns inclusion via compaction; scope filters
329
- * only instructions / tools / workspace files). A SETTABLE mutable
330
- * property afterwards (the context's `conversations` setter — swap the whole registry between
331
- * runs), and the active conversation is switchable through the manager's `switch(id)`.
341
+ * only instructions / tools / workspace files). The registry is structural; change its active
342
+ * conversation through the manager's `switch(id)`.
332
343
  */
333
344
  readonly conversations?: ConversationManagerInterface;
334
345
  }
@@ -2001,8 +2012,8 @@ export declare function createAgent(provider: ProviderInterface, options?: Agent
2001
2012
  * @remarks
2002
2013
  * `system` is the optional system prompt; `tools` / `instructions` / `workspaces` are pre-built
2003
2014
  * managers to reuse (empty ones are created when omitted, so `context.workspaces` is ALWAYS
2004
- * present); `scope` is the initial active filter (`undefined` ⇒ no filtering, mutable afterwards
2005
- * via `context.scope`). The `messages` store is always fresh. `build()` folds the scoped
2015
+ * present); `scope` is the initial active filter (`undefined` ⇒ no filtering, changeable afterwards
2016
+ * via `context.apply(...)`). The `messages` store is always fresh. `build()` folds the scoped
2006
2017
  * instructions — PLUS the ACTIVE workspace's scope-filtered text files (fenced) — into ONE leading
2007
2018
  * `system` message and appends the scoped conversation (attaching the active workspace's
2008
2019
  * scope-filtered image files' `data` to the last user message), built fresh each call; the active
@@ -3933,7 +3944,7 @@ export declare interface ProviderInterface {
3933
3944
  * built-in framing, beaten by a manager-options or per-item override). Omitted ⇒ the
3934
3945
  * provider is framing-agnostic and the managers' built-in defaults apply unchanged.
3935
3946
  */
3936
- readonly format?: ContextFormatInterface;
3947
+ readonly format?: ContextFormatInterface | undefined;
3937
3948
  /**
3938
3949
  * Generate one complete turn — resolves the assembled {@link ProviderResult}.
3939
3950
  *
@@ -2121,15 +2121,17 @@ var WorkspaceManager = class {
2121
2121
  * The richer turn context the agent loop assembles a provider request from — the optional
2122
2122
  * system prompt, the observable context managers (instructions / workspaces), the
2123
2123
  * {@link ConversationManagerInterface} message source (whose active conversation IS `messages`),
2124
- * the {@link ToolManagerInterface} registry, and a mutable active {@link ScopeInterface}.
2124
+ * the {@link ToolManagerInterface} registry, and an active {@link ScopeInterface} changed through
2125
+ * {@link AgentContextInterface.apply}.
2125
2126
  *
2126
2127
  * @remarks
2127
2128
  * - **Composition.** `system` is the optional system prompt; `instructions` / `tools` /
2128
2129
  * `workspaces` / `conversations` are the registries passed in `options` (bring your own), or
2129
2130
  * fresh empty ones when omitted (so `workspaces` is ALWAYS present); `messages` is the ACTIVE
2130
2131
  * conversation's live tail (ALWAYS defined — see below). `scope` is the active filter —
2131
- * `undefined` (the default) ⇒ no filtering; settable afterwards. `workspaces` / `conversations`
2132
- * are likewise SETTABLE (swap the whole registry between runs).
2132
+ * `undefined` (the default) ⇒ no filtering; change it through `apply(scope)`. The structural
2133
+ * `workspaces` / `conversations` registries are fixed at construction; switch their active
2134
+ * members through their own `switch(id)` methods.
2133
2135
  * - **The message source — the conversation registry's ACTIVE conversation.** `conversations` is a
2134
2136
  * {@link ConversationManagerInterface}; the context ENSURES it always has an active conversation
2135
2137
  * (at construction it `add`s a default when the manager has none), so the DYNAMIC `messages`
@@ -2207,27 +2209,20 @@ var AgentContext = class {
2207
2209
  get workspaces() {
2208
2210
  return this.#workspaces;
2209
2211
  }
2210
- set workspaces(value) {
2211
- this.#workspaces = value;
2212
- }
2213
2212
  get messages() {
2214
2213
  return this.#conversations.active ?? this.#ensure();
2215
2214
  }
2216
2215
  get conversations() {
2217
2216
  return this.#conversations;
2218
2217
  }
2219
- set conversations(value) {
2220
- this.#conversations = value;
2221
- if (this.#conversations.active === void 0) this.#conversations.add();
2222
- }
2223
2218
  get tools() {
2224
2219
  return this.#tools;
2225
2220
  }
2226
2221
  get scope() {
2227
2222
  return this.#scope;
2228
2223
  }
2229
- set scope(value) {
2230
- this.#scope = value;
2224
+ apply(scope) {
2225
+ this.#scope = scope;
2231
2226
  }
2232
2227
  build(format) {
2233
2228
  const scope = this.#scope;
@@ -3790,8 +3785,8 @@ function createScopeManager(options) {
3790
3785
  * @remarks
3791
3786
  * `system` is the optional system prompt; `tools` / `instructions` / `workspaces` are pre-built
3792
3787
  * managers to reuse (empty ones are created when omitted, so `context.workspaces` is ALWAYS
3793
- * present); `scope` is the initial active filter (`undefined` ⇒ no filtering, mutable afterwards
3794
- * via `context.scope`). The `messages` store is always fresh. `build()` folds the scoped
3788
+ * present); `scope` is the initial active filter (`undefined` ⇒ no filtering, changeable afterwards
3789
+ * via `context.apply(...)`). The `messages` store is always fresh. `build()` folds the scoped
3795
3790
  * instructions — PLUS the ACTIVE workspace's scope-filtered text files (fenced) — into ONE leading
3796
3791
  * `system` message and appends the scoped conversation (attaching the active workspace's
3797
3792
  * scope-filtered image files' `data` to the last user message), built fresh each call; the active