@orkestrel/agent 0.0.3 → 0.0.4
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/dist/src/core/index.cjs +14 -317
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +36 -321
- package/dist/src/core/index.d.ts +36 -321
- package/dist/src/core/index.js +16 -314
- package/dist/src/core/index.js.map +1 -1
- package/package.json +2 -2
package/dist/src/core/index.d.ts
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
import { BooleanShape } from '@orkestrel/contract';
|
|
2
1
|
import { BudgetInterface } from '@orkestrel/budget';
|
|
3
2
|
import { DriverInterface } from '@orkestrel/database';
|
|
4
3
|
import { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
5
4
|
import { EmitterHooks } from '@orkestrel/emitter';
|
|
6
5
|
import { EmitterInterface } from '@orkestrel/emitter';
|
|
7
|
-
import { LiteralShape } from '@orkestrel/contract';
|
|
8
|
-
import { NumberShape } from '@orkestrel/contract';
|
|
9
|
-
import { ObjectShape } from '@orkestrel/contract';
|
|
10
|
-
import { OptionalShape } from '@orkestrel/contract';
|
|
11
6
|
import { QueueInterface } from '@orkestrel/queue';
|
|
12
7
|
import { QueueStoreInterface } from '@orkestrel/queue';
|
|
13
8
|
import { RunnerInterface } from '@orkestrel/workflow';
|
|
14
9
|
import { SchedulerInterface } from '@orkestrel/workflow';
|
|
15
|
-
import { StringShape } from '@orkestrel/contract';
|
|
16
10
|
import { TableInterface } from '@orkestrel/database';
|
|
17
11
|
import { TokenUsage } from '@orkestrel/budget';
|
|
18
|
-
import { UnionShape } from '@orkestrel/contract';
|
|
19
12
|
|
|
20
13
|
/**
|
|
21
14
|
* The agent loop — composes a {@link ProviderInterface}, an {@link AgentContext}, and
|
|
@@ -716,13 +709,21 @@ export declare interface AgentRegistryInterface {
|
|
|
716
709
|
* `providers` is required (a job always names a provider); `tools` / `authorities` /
|
|
717
710
|
* `schedulers` are optional pools, each an entity-keyed record (§8) mapping a registry
|
|
718
711
|
* name to its live object. A name absent from its pool throws when resolved (see
|
|
719
|
-
* {@link AgentRegistryInterface}).
|
|
712
|
+
* {@link AgentRegistryInterface}). `store` is the durable {@link ConversationStoreInterface}
|
|
713
|
+
* every agent this registry builds carries: each built agent gets its OWN store-backed
|
|
714
|
+
* {@link ConversationManagerInterface} over THIS shared store — a fresh conversation id per
|
|
715
|
+
* build (minted by the seeded `add`), so concurrent builds never collide, and the store
|
|
716
|
+
* simply accumulates one snapshot per built agent that later calls `save`. Persistence
|
|
717
|
+
* stays caller-triggered (`open` / `save`) — `build` never hydrates, so `build` stays
|
|
718
|
+
* SYNCHRONOUS. Omitted ⇒ every built agent gets a registry-only manager, byte-identical
|
|
719
|
+
* to today.
|
|
720
720
|
*/
|
|
721
721
|
export declare interface AgentRegistryOptions {
|
|
722
722
|
readonly providers: Readonly<Record<string, ProviderInterface>>;
|
|
723
723
|
readonly tools?: Readonly<Record<string, ToolInterface>>;
|
|
724
724
|
readonly authorities?: Readonly<Record<string, AuthorityInterface>>;
|
|
725
725
|
readonly schedulers?: Readonly<Record<string, SchedulerInterface>>;
|
|
726
|
+
readonly store?: ConversationStoreInterface;
|
|
726
727
|
}
|
|
727
728
|
|
|
728
729
|
/**
|
|
@@ -2529,68 +2530,6 @@ export declare function createWorkspace(options?: WorkspaceOptions): WorkspaceIn
|
|
|
2529
2530
|
*/
|
|
2530
2531
|
export declare function createWorkspaceManager(options?: WorkspaceManagerOptions): WorkspaceManagerInterface;
|
|
2531
2532
|
|
|
2532
|
-
/**
|
|
2533
|
-
* Wrap a {@link WorkspaceManagerInterface} as an LLM-callable {@link ToolInterface} — it ADVERTISES
|
|
2534
|
-
* the `operation`-discriminated 13-op union ({@link import('./shapers.js').workspaceToolShape}) as
|
|
2535
|
-
* its `parameters`, and its handler PARSES the model-supplied args against that contract and
|
|
2536
|
-
* DISPATCHES the matched operation against the manager's ACTIVE workspace (the registry ops drive
|
|
2537
|
-
* the manager itself), returning the plain result (throwing a typed {@link WorkspaceError} on
|
|
2538
|
-
* failure).
|
|
2539
|
-
*
|
|
2540
|
-
* @remarks
|
|
2541
|
-
* MANAGER-DRIVEN: every edit / read op (read / list / has / search / replace / write / splice /
|
|
2542
|
-
* prepend / append / move / remove) targets `manager.active`, so the model edits whichever workspace
|
|
2543
|
-
* is active and a host can re-point it ({@link WorkspaceManagerInterface.switch}) between turns —
|
|
2544
|
-
* wire the agent's registry in via `createWorkspaceTool(agent.context.workspaces)`. Two REGISTRY ops
|
|
2545
|
-
* make the model self-sufficient: `workspaces` LISTS the registered workspaces (each
|
|
2546
|
-
* `{ id, files, active }`) so it can discover an id, and `switch` re-points the active workspace by
|
|
2547
|
-
* id (lenient — an unknown id is a no-op reporting `switched: false`, never a throw).
|
|
2548
|
-
*
|
|
2549
|
-
* NO-ACTIVE RULE (the ergonomic seam): a WRITING op (write / splice / prepend / append / move /
|
|
2550
|
-
* remove / replace) run when `manager.active` is `undefined` AUTO-CREATES + activates a default
|
|
2551
|
-
* workspace (`manager.add()`) so the model can just start writing; a pure-READ op (read / list / has
|
|
2552
|
-
* / search) against no active workspace returns the EMPTY result (`undefined` / `[]` / `false`),
|
|
2553
|
-
* never creating one and never throwing.
|
|
2554
|
-
*
|
|
2555
|
-
* A plain {@link ToolManagerInterface}-compatible tool (so `createMCPServer` / `createMCPRoutes`
|
|
2556
|
-
* expose it over MCP for free — nothing MCP is wired here), built as a factory + dispatch closure
|
|
2557
|
-
* in the same consumer-edge style as `createWorkflowTool` in `@orkestrel/workflow` (NOT a class —
|
|
2558
|
-
* their signatures differ; the shared idea is that concrete tools live at the factories edge over
|
|
2559
|
-
* a pure tool runtime). The
|
|
2560
|
-
* contract is compiled ONCE and its JSON Schema is narrowed to the open
|
|
2561
|
-
* `Readonly<Record<string, unknown>>` a tool advertises via the shared
|
|
2562
|
-
* {@link schemaToParameters} contracts helper, never an assertion
|
|
2563
|
-
* (§14) — a compiled contract schema is always a record, so it passes; the `undefined` fallback only
|
|
2564
|
-
* satisfies the type's optionality.
|
|
2565
|
-
*
|
|
2566
|
-
* The handler conforms to the universal tool-handler contract (AGENTS §14): it `contract.parse`s the
|
|
2567
|
-
* args, THROWS a `TOOL` {@link WorkspaceError} when no operation arm matched (a malformed / unknown
|
|
2568
|
-
* operation), else `switch`es on `op.operation` and RETURNS the plain result — letting a
|
|
2569
|
-
* `WorkspaceError` raised by the live workspace (`MODALITY` / `PATTERN` / `RANGE`) PROPAGATE
|
|
2570
|
-
* unCAUGHT. The {@link import('./tools/ToolManager.js').ToolManager} performs the ONE
|
|
2571
|
-
* canonical wrap (`{ id, name, value }` on a return; `{ id, name, error }` on a throw, ISOLATED so
|
|
2572
|
-
* nothing escapes the run), so the outcome appears EXACTLY ONCE over BOTH the agent loop and MCP (a
|
|
2573
|
-
* throw → MCP `isError: true`). There is no `{ ok, output, duration }` envelope. The range edit is
|
|
2574
|
-
* the FLAT `'splice'` op: its four flat caret integers are reassembled into a {@link import('./types.js').Range}
|
|
2575
|
-
* by {@link rangeOf} and fed to the workspace's ranged `write`.
|
|
2576
|
-
*
|
|
2577
|
-
* @param manager - The workspace registry the tool reads + edits (its ACTIVE workspace; closed over by the handler)
|
|
2578
|
-
* @param options - Optional advertised `name` / `description` overrides (see {@link WorkspaceToolOptions})
|
|
2579
|
-
* @returns A {@link ToolInterface} (named {@link import('./constants.js').WORKSPACE_TOOL_NAME} by
|
|
2580
|
-
* default) whose `parameters` advertise the `operation`-discriminated union schema
|
|
2581
|
-
*
|
|
2582
|
-
* @example
|
|
2583
|
-
* ```ts
|
|
2584
|
-
* import { createWorkspaceManager, createWorkspaceTool, createToolManager } from '@src/core'
|
|
2585
|
-
*
|
|
2586
|
-
* const manager = createWorkspaceManager()
|
|
2587
|
-
* const tool = createWorkspaceTool(manager) // edits the manager's ACTIVE workspace
|
|
2588
|
-
* const tools = createToolManager()
|
|
2589
|
-
* tools.add(tool) // a model can now read + edit the active workspace by calling `workspace`
|
|
2590
|
-
* ```
|
|
2591
|
-
*/
|
|
2592
|
-
export declare function createWorkspaceTool(manager: WorkspaceManagerInterface, options?: WorkspaceToolOptions): ToolInterface;
|
|
2593
|
-
|
|
2594
2533
|
/**
|
|
2595
2534
|
* A {@link ConversationStoreInterface} backed by one table of the `databases` layer — a
|
|
2596
2535
|
* conversation's durable state IS a row, so persistence reduces to keyed point-access (`get` / `set`
|
|
@@ -3877,10 +3816,10 @@ export declare interface Range {
|
|
|
3877
3816
|
}
|
|
3878
3817
|
|
|
3879
3818
|
/**
|
|
3880
|
-
* Assemble a 1-based nested {@link Range} from
|
|
3881
|
-
*
|
|
3882
|
-
*
|
|
3883
|
-
*
|
|
3819
|
+
* Assemble a 1-based nested {@link Range} from four FLAT caret integers — the bridge a
|
|
3820
|
+
* workspace-editing tool (see `@orkestrel/tool`) uses from its small-model FLAT surface back to the
|
|
3821
|
+
* nested {@link Range} the {@link import('./workspaces/Workspace.js').Workspace} edit surface
|
|
3822
|
+
* speaks. Published as a public helper for that consumer.
|
|
3884
3823
|
*
|
|
3885
3824
|
* @remarks
|
|
3886
3825
|
* Pairs `(fromLine, fromColumn)` into `start` and `(toLine, toColumn)` into `end` verbatim — a pure
|
|
@@ -4434,6 +4373,7 @@ export declare class Tool implements ToolInterface {
|
|
|
4434
4373
|
#private;
|
|
4435
4374
|
readonly name: string;
|
|
4436
4375
|
readonly description?: string;
|
|
4376
|
+
readonly summary?: string;
|
|
4437
4377
|
readonly parameters?: Readonly<Record<string, unknown>>;
|
|
4438
4378
|
constructor(options: ToolOptions);
|
|
4439
4379
|
execute(args: Readonly<Record<string, unknown>>): Promise<unknown> | unknown;
|
|
@@ -4490,6 +4430,12 @@ export declare interface ToolDefinition {
|
|
|
4490
4430
|
* (§14), never assert; the manager isolates a throw into a {@link ToolResult} `error`.
|
|
4491
4431
|
*/
|
|
4492
4432
|
export declare interface ToolInterface extends ToolDefinition {
|
|
4433
|
+
/**
|
|
4434
|
+
* A one-or-two-sentence concise description advertised to the model IN PLACE of the
|
|
4435
|
+
* full `description` (which stays on the tool for on-demand retrieval, e.g. a
|
|
4436
|
+
* describe tool); absent ⇒ the full `description` is advertised exactly as today.
|
|
4437
|
+
*/
|
|
4438
|
+
readonly summary?: string;
|
|
4493
4439
|
/**
|
|
4494
4440
|
* Run the tool. `args` is the model-supplied `unknown` JSON object — narrow it
|
|
4495
4441
|
* inside (§14); the manager isolates a throw into a {@link ToolResult} `error`.
|
|
@@ -4511,7 +4457,9 @@ export declare interface ToolInterface extends ToolDefinition {
|
|
|
4511
4457
|
* (last write wins). `count` is the map size, `tool(name)` looks one up, `tools()`
|
|
4512
4458
|
* lists them in insertion order, and `definitions()` maps each to a plain
|
|
4513
4459
|
* {@link ToolDefinition} (`name` / `description?` / `parameters?`, the `execute`
|
|
4514
|
-
* handler stripped) — exactly what a provider advertises to the model
|
|
4460
|
+
* handler stripped) — exactly what a provider advertises to the model, with
|
|
4461
|
+
* `tool.summary ?? tool.description` advertised as `description` (a lean `summary`
|
|
4462
|
+
* stands in for the full text when set).
|
|
4515
4463
|
* - **Per-call error isolation (the load-bearing part).** `execute` resolves a
|
|
4516
4464
|
* {@link ToolCall}'s tool by name and ALWAYS resolves a {@link ToolResult}: an
|
|
4517
4465
|
* unknown name → `{ id, name, error: 'tool not found: <name>' }`; a successful run →
|
|
@@ -4555,7 +4503,9 @@ export declare class ToolManager implements ToolManagerInterface {
|
|
|
4555
4503
|
* - **Registry.** `add` registers one tool or a batch (§9.2), keyed by `tool.name`
|
|
4556
4504
|
* (a re-`add` of the same name overwrites — last write wins); `count` is the number
|
|
4557
4505
|
* registered. `tool(name)` looks one up; `tools()` lists them in insertion order;
|
|
4558
|
-
* `definitions()` strips each to a plain {@link ToolDefinition} for the provider
|
|
4506
|
+
* `definitions()` strips each to a plain {@link ToolDefinition} for the provider,
|
|
4507
|
+
* advertising `tool.summary ?? tool.description` in the definition's `description`
|
|
4508
|
+
* field — a lean `summary` stands in for the full `description` when set.
|
|
4559
4509
|
* - **Per-call error isolation.** `execute` resolves a {@link ToolCall}'s tool by name
|
|
4560
4510
|
* and runs it, ALWAYS resolving a {@link ToolResult}: a success carries `value`, a
|
|
4561
4511
|
* handler throw is caught into `error`, and an unknown name becomes a not-found
|
|
@@ -4586,12 +4536,16 @@ export declare interface ToolManagerInterface {
|
|
|
4586
4536
|
* @remarks
|
|
4587
4537
|
* `name` is required (it keys the tool in a {@link ToolManagerInterface} and is what
|
|
4588
4538
|
* the model calls); `description` and `parameters` are the optional JSON-Schema the
|
|
4589
|
-
* provider advertises (forwarded verbatim). `
|
|
4590
|
-
*
|
|
4539
|
+
* provider advertises (forwarded verbatim). `summary`, when set, is a lean
|
|
4540
|
+
* one-or-two-sentence advertisement used IN PLACE of `description` in a
|
|
4541
|
+
* {@link ToolManagerInterface.definitions} listing — `description` stays available on
|
|
4542
|
+
* the tool for on-demand retrieval. `execute` receives the model-supplied arguments
|
|
4543
|
+
* record and returns the tool's result (sync or async).
|
|
4591
4544
|
*/
|
|
4592
4545
|
export declare interface ToolOptions {
|
|
4593
4546
|
readonly name: string;
|
|
4594
4547
|
readonly description?: string;
|
|
4548
|
+
readonly summary?: string;
|
|
4595
4549
|
readonly parameters?: Readonly<Record<string, unknown>>;
|
|
4596
4550
|
readonly execute: (args: Readonly<Record<string, unknown>>) => Promise<unknown> | unknown;
|
|
4597
4551
|
}
|
|
@@ -4699,40 +4653,6 @@ export declare class Workspace implements WorkspaceInterface {
|
|
|
4699
4653
|
*/
|
|
4700
4654
|
export declare const WORKSPACE_SECTION_HEADER = "## Workspace";
|
|
4701
4655
|
|
|
4702
|
-
/**
|
|
4703
|
-
* The DESCRIPTION {@link import('./factories.js').createWorkspaceTool} advertises — a multi-line
|
|
4704
|
-
* guide that teaches a small model how to drive a workspace through the single `operation`-keyed
|
|
4705
|
-
* tool.
|
|
4706
|
-
*
|
|
4707
|
-
* @remarks
|
|
4708
|
-
* Mirrors the analogous `WORKFLOW_TOOL_DESCRIPTION` in `@orkestrel/workflow`'s teaching style:
|
|
4709
|
-
* names the `operation` discriminant field, enumerates all 13 operations with their FLAT fields,
|
|
4710
|
-
* gives a worked example for the common ones (read / write / search / replace / splice), and embeds
|
|
4711
|
-
* {@link WORKSPACE_TOOL_EXAMPLE} verbatim (pinned by a parity test). The range edit is the FLAT
|
|
4712
|
-
* `'splice'` op — four positive-integer caret components, NOT a nested range — the ergonomic lever
|
|
4713
|
-
* a 2B model can fill. The edit / read ops target the ACTIVE workspace (one is auto-created on the
|
|
4714
|
-
* first edit when none is active); the `workspaces` / `switch` ops let the model move between
|
|
4715
|
-
* workspaces.
|
|
4716
|
-
*/
|
|
4717
|
-
export declare const WORKSPACE_TOOL_DESCRIPTION: string;
|
|
4718
|
-
|
|
4719
|
-
/**
|
|
4720
|
-
* A valid {@link WorkspaceOperation} object — the canonical example embedded VERBATIM in
|
|
4721
|
-
* {@link WORKSPACE_TOOL_DESCRIPTION} and pinned by a parity test (it must satisfy the compiled
|
|
4722
|
-
* contract's `is`), so the doc example can never drift from a real, contract-valid operation.
|
|
4723
|
-
*
|
|
4724
|
-
* @remarks
|
|
4725
|
-
* A `'write'` op (the most common authoring action): create or overwrite `notes.txt` with
|
|
4726
|
-
* `hello`. Frozen so it cannot be mutated in place.
|
|
4727
|
-
*/
|
|
4728
|
-
export declare const WORKSPACE_TOOL_EXAMPLE: WorkspaceOperation;
|
|
4729
|
-
|
|
4730
|
-
/**
|
|
4731
|
-
* The name {@link import('./factories.js').createWorkspaceTool} advertises by default — the key a
|
|
4732
|
-
* model calls and the {@link import('./types.js').ToolManagerInterface} registers under.
|
|
4733
|
-
*/
|
|
4734
|
-
export declare const WORKSPACE_TOOL_NAME = "workspace";
|
|
4735
|
-
|
|
4736
4656
|
/**
|
|
4737
4657
|
* An error thrown by the in-memory {@link import('./workspaces/Workspace.js').Workspace} edit
|
|
4738
4658
|
* surface.
|
|
@@ -4758,10 +4678,10 @@ export declare class WorkspaceError extends Error {
|
|
|
4758
4678
|
* - `MODALITY` — a text-only op (ranged read/write, `prepend`, `append`) was aimed at a binary file.
|
|
4759
4679
|
* - `PATTERN` — a `search` / `replace` `query` was an invalid regular expression (with `regex: true`).
|
|
4760
4680
|
* - `RANGE` — a ranged `write` got a structurally invalid {@link Range} (inverted, or a sub-1 line/column).
|
|
4761
|
-
* - `TOOL` — a handler-level validation fault
|
|
4762
|
-
* the agent-supplied args were
|
|
4763
|
-
*
|
|
4764
|
-
*
|
|
4681
|
+
* - `TOOL` — a handler-level validation fault raised by a workspace-editing tool boundary (see
|
|
4682
|
+
* `@orkestrel/tool`) when the agent-supplied args were malformed / unknown. Distinct from the
|
|
4683
|
+
* surface faults above (which the live workspace raises) — this is the tool boundary rejecting an
|
|
4684
|
+
* un-parseable operation before any workspace call.
|
|
4765
4685
|
*/
|
|
4766
4686
|
export declare type WorkspaceErrorCode = 'MODALITY' | 'PATTERN' | 'RANGE' | 'TOOL';
|
|
4767
4687
|
|
|
@@ -5017,124 +4937,6 @@ export declare interface WorkspaceManagerOptions {
|
|
|
5017
4937
|
readonly store?: WorkspaceStoreInterface;
|
|
5018
4938
|
}
|
|
5019
4939
|
|
|
5020
|
-
/**
|
|
5021
|
-
* One operation an agent invokes through {@link import('./factories.js').createWorkspaceTool} — a
|
|
5022
|
-
* FLAT, descriptive tagged union over the 13 workspace edit / read / navigation actions,
|
|
5023
|
-
* discriminated by the `operation` literal (AGENTS §4.8: a discriminant is named for its axis — the
|
|
5024
|
-
* action being performed — NEVER `kind`).
|
|
5025
|
-
*
|
|
5026
|
-
* @remarks
|
|
5027
|
-
* This is the SOURCE OF TRUTH the tool contract is typed to ({@link import('./shapers.js').workspaceToolShape}
|
|
5028
|
-
* compiles to a structurally-identical guard / parser / JSON Schema). Every field is FLAT (no nested
|
|
5029
|
-
* objects) — the small-model ergonomic lever: a range edit is the four flat integers of the
|
|
5030
|
-
* `'splice'` arm (`fromLine` / `fromColumn` / `toLine` / `toColumn`), reassembled into a 1-based
|
|
5031
|
-
* {@link Range} by {@link import('./helpers.js').rangeOf}, never a nested `{ start, end }`. Each EDIT
|
|
5032
|
-
* / READ arm maps onto exactly one {@link WorkspaceInterface} call against the manager's ACTIVE
|
|
5033
|
-
* workspace; the two REGISTRY arms (`switch` / `workspaces`) drive the
|
|
5034
|
-
* {@link WorkspaceManagerInterface} pointer instead — `workspaces` LISTS the workspaces the model
|
|
5035
|
-
* can move between, and `switch` re-points which one the edit / read arms target.
|
|
5036
|
-
*/
|
|
5037
|
-
export declare type WorkspaceOperation =
|
|
5038
|
-
/** Read a whole text file's text by `path` from the ACTIVE workspace (a binary / absent path — or no active workspace — yields no content). */
|
|
5039
|
-
{
|
|
5040
|
-
readonly operation: 'read';
|
|
5041
|
-
readonly path: string;
|
|
5042
|
-
}
|
|
5043
|
-
/** List every file in the ACTIVE workspace (path / state / size / lines / kind summaries); `[]` when no workspace is active. */
|
|
5044
|
-
| {
|
|
5045
|
-
readonly operation: 'list';
|
|
5046
|
-
}
|
|
5047
|
-
/** Whether a file exists at `path` in the ACTIVE workspace (`false` when no workspace is active). */
|
|
5048
|
-
| {
|
|
5049
|
-
readonly operation: 'has';
|
|
5050
|
-
readonly path: string;
|
|
5051
|
-
}
|
|
5052
|
-
/**
|
|
5053
|
-
* Scan every text file for `query`, returning each hit (path + 1-based line / column + the line).
|
|
5054
|
-
*
|
|
5055
|
-
* @remarks
|
|
5056
|
-
* `regex` treats `query` as a regular-expression source (default `false` — a literal substring);
|
|
5057
|
-
* `exact` matches case-sensitively (default `true`); `limit` caps the total hits returned.
|
|
5058
|
-
*/
|
|
5059
|
-
| {
|
|
5060
|
-
readonly operation: 'search';
|
|
5061
|
-
readonly query: string;
|
|
5062
|
-
readonly regex?: boolean;
|
|
5063
|
-
readonly exact?: boolean;
|
|
5064
|
-
readonly limit?: number;
|
|
5065
|
-
}
|
|
5066
|
-
/**
|
|
5067
|
-
* Replace `query` with `replacement` across every text file, returning the tally.
|
|
5068
|
-
*
|
|
5069
|
-
* @remarks
|
|
5070
|
-
* Same matching axes as `search`: `regex` (default `false`), `exact` (default `true`), `limit`
|
|
5071
|
-
* (cap the total replacements).
|
|
5072
|
-
*/
|
|
5073
|
-
| {
|
|
5074
|
-
readonly operation: 'replace';
|
|
5075
|
-
readonly query: string;
|
|
5076
|
-
readonly replacement: string;
|
|
5077
|
-
readonly regex?: boolean;
|
|
5078
|
-
readonly exact?: boolean;
|
|
5079
|
-
readonly limit?: number;
|
|
5080
|
-
}
|
|
5081
|
-
/** Write (create or overwrite) the whole file at `path` with `content`. */
|
|
5082
|
-
| {
|
|
5083
|
-
readonly operation: 'write';
|
|
5084
|
-
readonly path: string;
|
|
5085
|
-
readonly content: string;
|
|
5086
|
-
}
|
|
5087
|
-
/**
|
|
5088
|
-
* Splice `content` into an existing text file, replacing the 1-based range
|
|
5089
|
-
* `(fromLine, fromColumn)` (INCLUSIVE) → `(toLine, toColumn)` (EXCLUSIVE).
|
|
5090
|
-
*
|
|
5091
|
-
* @remarks
|
|
5092
|
-
* The FLAT range edit — the four positive-integer caret components reassemble into a {@link Range}
|
|
5093
|
-
* ({@link import('./helpers.js').rangeOf}). An empty span (`from === to`) inserts; a span past the
|
|
5094
|
-
* end is clamped. An inverted / sub-1 range throws `RANGE`; a binary target throws `MODALITY`.
|
|
5095
|
-
*/
|
|
5096
|
-
| {
|
|
5097
|
-
readonly operation: 'splice';
|
|
5098
|
-
readonly path: string;
|
|
5099
|
-
readonly content: string;
|
|
5100
|
-
readonly fromLine: number;
|
|
5101
|
-
readonly fromColumn: number;
|
|
5102
|
-
readonly toLine: number;
|
|
5103
|
-
readonly toColumn: number;
|
|
5104
|
-
}
|
|
5105
|
-
/** Prepend `content` to the start of the file at `path` (creating it when absent). */
|
|
5106
|
-
| {
|
|
5107
|
-
readonly operation: 'prepend';
|
|
5108
|
-
readonly path: string;
|
|
5109
|
-
readonly content: string;
|
|
5110
|
-
}
|
|
5111
|
-
/** Append `content` to the end of the file at `path` (creating it when absent). */
|
|
5112
|
-
| {
|
|
5113
|
-
readonly operation: 'append';
|
|
5114
|
-
readonly path: string;
|
|
5115
|
-
readonly content: string;
|
|
5116
|
-
}
|
|
5117
|
-
/** Re-key the file `from` → `to` (overwriting an occupied target). */
|
|
5118
|
-
| {
|
|
5119
|
-
readonly operation: 'move';
|
|
5120
|
-
readonly from: string;
|
|
5121
|
-
readonly to: string;
|
|
5122
|
-
}
|
|
5123
|
-
/** Remove the file at `path` from the workspace. */
|
|
5124
|
-
| {
|
|
5125
|
-
readonly operation: 'remove';
|
|
5126
|
-
readonly path: string;
|
|
5127
|
-
}
|
|
5128
|
-
/** List the workspaces the model can move between — each `{ id, files, active }` — so it can choose an `id` to `switch` to. */
|
|
5129
|
-
| {
|
|
5130
|
-
readonly operation: 'workspaces';
|
|
5131
|
-
}
|
|
5132
|
-
/** Re-point the manager's ACTIVE workspace to the one with `id` (an unknown `id` is a lenient no-op). The edit / read arms target the active workspace from then on. */
|
|
5133
|
-
| {
|
|
5134
|
-
readonly operation: 'switch';
|
|
5135
|
-
readonly id: string;
|
|
5136
|
-
};
|
|
5137
|
-
|
|
5138
4940
|
/**
|
|
5139
4941
|
* Options for {@link import('./factories.js').createWorkspace} / the
|
|
5140
4942
|
* {@link import('./workspaces/Workspace.js').Workspace} constructor.
|
|
@@ -5240,91 +5042,4 @@ export declare interface WorkspaceStoreInterface {
|
|
|
5240
5042
|
delete(id: string): Promise<void>;
|
|
5241
5043
|
}
|
|
5242
5044
|
|
|
5243
|
-
/**
|
|
5244
|
-
* Options for {@link import('./factories.js').createWorkspaceTool} — optional overrides of the
|
|
5245
|
-
* advertised tool `name` / `description`.
|
|
5246
|
-
*
|
|
5247
|
-
* @param options - The workspace-tool options
|
|
5248
|
-
*
|
|
5249
|
-
* @remarks
|
|
5250
|
-
* - `name` — the advertised tool name a model calls; defaults to {@link import('./constants.js').WORKSPACE_TOOL_NAME} (`'workspace'`).
|
|
5251
|
-
* - `description` — the model-facing description; defaults to {@link import('./constants.js').WORKSPACE_TOOL_DESCRIPTION} (the operation guide). Deliberately minimal (AGENTS §21) — the tool needs no depth / ancestry (it has no recursion).
|
|
5252
|
-
*/
|
|
5253
|
-
export declare interface WorkspaceToolOptions {
|
|
5254
|
-
readonly name?: string;
|
|
5255
|
-
readonly description?: string;
|
|
5256
|
-
}
|
|
5257
|
-
|
|
5258
|
-
/**
|
|
5259
|
-
* The shape of a {@link import('./types.js').WorkspaceOperation} — a descriptive tagged union over
|
|
5260
|
-
* the 13 workspace edit / read / navigation operations, discriminated by the `operation` literal
|
|
5261
|
-
* (never a bare `kind`; AGENTS §4.8). Each variant leads with its `operation` discriminant then its
|
|
5262
|
-
* FLAT fields, every field via `stringShape` / `optionalShape` / `integerShape({ min: 1 })` /
|
|
5263
|
-
* `booleanShape`, each carrying a strong field-level `description`.
|
|
5264
|
-
*
|
|
5265
|
-
* @remarks
|
|
5266
|
-
* The union compiles to an `anyOf` JSON Schema + a `unionOf` guard + a first-match parser
|
|
5267
|
-
* automatically ({@link import('./factories.js').createWorkspaceTool} types the result to the
|
|
5268
|
-
* hand-written `WorkspaceOperation`). `limit` and the four `'splice'` caret components are POSITIVE
|
|
5269
|
-
* integers (`integerShape({ min: 1 })`); `regex` / `exact` are `optionalShape(booleanShape(...))`.
|
|
5270
|
-
* The two REGISTRY arms — `workspaces` (list the workspaces the model can move between) and `switch`
|
|
5271
|
-
* (re-point the active one by `id`) — let a model DISCOVER then CHOOSE which workspace the edit /
|
|
5272
|
-
* read arms target. The descriptions are the small-model ergonomic lever — they ride into the
|
|
5273
|
-
* advertised schema so a model authoring an operation gets per-field guidance.
|
|
5274
|
-
*/
|
|
5275
|
-
export declare const workspaceToolShape: UnionShape<[ ObjectShape<{
|
|
5276
|
-
operation: LiteralShape<readonly ["read"]>;
|
|
5277
|
-
path: StringShape;
|
|
5278
|
-
}>, ObjectShape<{
|
|
5279
|
-
operation: LiteralShape<readonly ["list"]>;
|
|
5280
|
-
}>, ObjectShape<{
|
|
5281
|
-
operation: LiteralShape<readonly ["has"]>;
|
|
5282
|
-
path: StringShape;
|
|
5283
|
-
}>, ObjectShape<{
|
|
5284
|
-
operation: LiteralShape<readonly ["search"]>;
|
|
5285
|
-
query: StringShape;
|
|
5286
|
-
regex: OptionalShape<BooleanShape>;
|
|
5287
|
-
exact: OptionalShape<BooleanShape>;
|
|
5288
|
-
limit: OptionalShape<NumberShape>;
|
|
5289
|
-
}>, ObjectShape<{
|
|
5290
|
-
operation: LiteralShape<readonly ["replace"]>;
|
|
5291
|
-
query: StringShape;
|
|
5292
|
-
replacement: StringShape;
|
|
5293
|
-
regex: OptionalShape<BooleanShape>;
|
|
5294
|
-
exact: OptionalShape<BooleanShape>;
|
|
5295
|
-
limit: OptionalShape<NumberShape>;
|
|
5296
|
-
}>, ObjectShape<{
|
|
5297
|
-
operation: LiteralShape<readonly ["write"]>;
|
|
5298
|
-
path: StringShape;
|
|
5299
|
-
content: StringShape;
|
|
5300
|
-
}>, ObjectShape<{
|
|
5301
|
-
operation: LiteralShape<readonly ["splice"]>;
|
|
5302
|
-
path: StringShape;
|
|
5303
|
-
content: StringShape;
|
|
5304
|
-
fromLine: NumberShape;
|
|
5305
|
-
fromColumn: NumberShape;
|
|
5306
|
-
toLine: NumberShape;
|
|
5307
|
-
toColumn: NumberShape;
|
|
5308
|
-
}>, ObjectShape<{
|
|
5309
|
-
operation: LiteralShape<readonly ["prepend"]>;
|
|
5310
|
-
path: StringShape;
|
|
5311
|
-
content: StringShape;
|
|
5312
|
-
}>, ObjectShape<{
|
|
5313
|
-
operation: LiteralShape<readonly ["append"]>;
|
|
5314
|
-
path: StringShape;
|
|
5315
|
-
content: StringShape;
|
|
5316
|
-
}>, ObjectShape<{
|
|
5317
|
-
operation: LiteralShape<readonly ["move"]>;
|
|
5318
|
-
from: StringShape;
|
|
5319
|
-
to: StringShape;
|
|
5320
|
-
}>, ObjectShape<{
|
|
5321
|
-
operation: LiteralShape<readonly ["remove"]>;
|
|
5322
|
-
path: StringShape;
|
|
5323
|
-
}>, ObjectShape<{
|
|
5324
|
-
operation: LiteralShape<readonly ["workspaces"]>;
|
|
5325
|
-
}>, ObjectShape<{
|
|
5326
|
-
operation: LiteralShape<readonly ["switch"]>;
|
|
5327
|
-
id: StringShape;
|
|
5328
|
-
}>]>;
|
|
5329
|
-
|
|
5330
5045
|
export { }
|