@orkestrel/agent 0.0.2 → 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 -315
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +36 -319
- package/dist/src/core/index.d.ts +36 -319
- package/dist/src/core/index.js +16 -312
- package/dist/src/core/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -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,66 +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
|
-
* exactly like the analogous `createWorkflowTool` in `@orkestrel/workflow` (NOT a class). The
|
|
2558
|
-
* contract is compiled ONCE and its JSON Schema is narrowed to the open
|
|
2559
|
-
* `Readonly<Record<string, unknown>>` a tool advertises via the shared
|
|
2560
|
-
* {@link schemaToParameters} contracts helper, never an assertion
|
|
2561
|
-
* (§14) — a compiled contract schema is always a record, so it passes; the `undefined` fallback only
|
|
2562
|
-
* satisfies the type's optionality.
|
|
2563
|
-
*
|
|
2564
|
-
* The handler conforms to the universal tool-handler contract (AGENTS §14): it `contract.parse`s the
|
|
2565
|
-
* args, THROWS a `TOOL` {@link WorkspaceError} when no operation arm matched (a malformed / unknown
|
|
2566
|
-
* operation), else `switch`es on `op.operation` and RETURNS the plain result — letting a
|
|
2567
|
-
* `WorkspaceError` raised by the live workspace (`MODALITY` / `PATTERN` / `RANGE`) PROPAGATE
|
|
2568
|
-
* unCAUGHT. The {@link import('./tools/ToolManager.js').ToolManager} performs the ONE
|
|
2569
|
-
* canonical wrap (`{ id, name, value }` on a return; `{ id, name, error }` on a throw, ISOLATED so
|
|
2570
|
-
* nothing escapes the run), so the outcome appears EXACTLY ONCE over BOTH the agent loop and MCP (a
|
|
2571
|
-
* throw → MCP `isError: true`). There is no `{ ok, output, duration }` envelope. The range edit is
|
|
2572
|
-
* the FLAT `'splice'` op: its four flat caret integers are reassembled into a {@link import('./types.js').Range}
|
|
2573
|
-
* by {@link rangeOf} and fed to the workspace's ranged `write`.
|
|
2574
|
-
*
|
|
2575
|
-
* @param manager - The workspace registry the tool reads + edits (its ACTIVE workspace; closed over by the handler)
|
|
2576
|
-
* @param options - Optional advertised `name` / `description` overrides (see {@link WorkspaceToolOptions})
|
|
2577
|
-
* @returns A {@link ToolInterface} (named {@link import('./constants.js').WORKSPACE_TOOL_NAME} by
|
|
2578
|
-
* default) whose `parameters` advertise the `operation`-discriminated union schema
|
|
2579
|
-
*
|
|
2580
|
-
* @example
|
|
2581
|
-
* ```ts
|
|
2582
|
-
* import { createWorkspaceManager, createWorkspaceTool, createToolManager } from '@src/core'
|
|
2583
|
-
*
|
|
2584
|
-
* const manager = createWorkspaceManager()
|
|
2585
|
-
* const tool = createWorkspaceTool(manager) // edits the manager's ACTIVE workspace
|
|
2586
|
-
* const tools = createToolManager()
|
|
2587
|
-
* tools.add(tool) // a model can now read + edit the active workspace by calling `workspace`
|
|
2588
|
-
* ```
|
|
2589
|
-
*/
|
|
2590
|
-
export declare function createWorkspaceTool(manager: WorkspaceManagerInterface, options?: WorkspaceToolOptions): ToolInterface;
|
|
2591
|
-
|
|
2592
2533
|
/**
|
|
2593
2534
|
* A {@link ConversationStoreInterface} backed by one table of the `databases` layer — a
|
|
2594
2535
|
* conversation's durable state IS a row, so persistence reduces to keyed point-access (`get` / `set`
|
|
@@ -3875,10 +3816,10 @@ export declare interface Range {
|
|
|
3875
3816
|
}
|
|
3876
3817
|
|
|
3877
3818
|
/**
|
|
3878
|
-
* Assemble a 1-based nested {@link Range} from
|
|
3879
|
-
*
|
|
3880
|
-
*
|
|
3881
|
-
*
|
|
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.
|
|
3882
3823
|
*
|
|
3883
3824
|
* @remarks
|
|
3884
3825
|
* Pairs `(fromLine, fromColumn)` into `start` and `(toLine, toColumn)` into `end` verbatim — a pure
|
|
@@ -4432,6 +4373,7 @@ export declare class Tool implements ToolInterface {
|
|
|
4432
4373
|
#private;
|
|
4433
4374
|
readonly name: string;
|
|
4434
4375
|
readonly description?: string;
|
|
4376
|
+
readonly summary?: string;
|
|
4435
4377
|
readonly parameters?: Readonly<Record<string, unknown>>;
|
|
4436
4378
|
constructor(options: ToolOptions);
|
|
4437
4379
|
execute(args: Readonly<Record<string, unknown>>): Promise<unknown> | unknown;
|
|
@@ -4488,6 +4430,12 @@ export declare interface ToolDefinition {
|
|
|
4488
4430
|
* (§14), never assert; the manager isolates a throw into a {@link ToolResult} `error`.
|
|
4489
4431
|
*/
|
|
4490
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;
|
|
4491
4439
|
/**
|
|
4492
4440
|
* Run the tool. `args` is the model-supplied `unknown` JSON object — narrow it
|
|
4493
4441
|
* inside (§14); the manager isolates a throw into a {@link ToolResult} `error`.
|
|
@@ -4509,7 +4457,9 @@ export declare interface ToolInterface extends ToolDefinition {
|
|
|
4509
4457
|
* (last write wins). `count` is the map size, `tool(name)` looks one up, `tools()`
|
|
4510
4458
|
* lists them in insertion order, and `definitions()` maps each to a plain
|
|
4511
4459
|
* {@link ToolDefinition} (`name` / `description?` / `parameters?`, the `execute`
|
|
4512
|
-
* 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).
|
|
4513
4463
|
* - **Per-call error isolation (the load-bearing part).** `execute` resolves a
|
|
4514
4464
|
* {@link ToolCall}'s tool by name and ALWAYS resolves a {@link ToolResult}: an
|
|
4515
4465
|
* unknown name → `{ id, name, error: 'tool not found: <name>' }`; a successful run →
|
|
@@ -4553,7 +4503,9 @@ export declare class ToolManager implements ToolManagerInterface {
|
|
|
4553
4503
|
* - **Registry.** `add` registers one tool or a batch (§9.2), keyed by `tool.name`
|
|
4554
4504
|
* (a re-`add` of the same name overwrites — last write wins); `count` is the number
|
|
4555
4505
|
* registered. `tool(name)` looks one up; `tools()` lists them in insertion order;
|
|
4556
|
-
* `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.
|
|
4557
4509
|
* - **Per-call error isolation.** `execute` resolves a {@link ToolCall}'s tool by name
|
|
4558
4510
|
* and runs it, ALWAYS resolving a {@link ToolResult}: a success carries `value`, a
|
|
4559
4511
|
* handler throw is caught into `error`, and an unknown name becomes a not-found
|
|
@@ -4584,12 +4536,16 @@ export declare interface ToolManagerInterface {
|
|
|
4584
4536
|
* @remarks
|
|
4585
4537
|
* `name` is required (it keys the tool in a {@link ToolManagerInterface} and is what
|
|
4586
4538
|
* the model calls); `description` and `parameters` are the optional JSON-Schema the
|
|
4587
|
-
* provider advertises (forwarded verbatim). `
|
|
4588
|
-
*
|
|
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).
|
|
4589
4544
|
*/
|
|
4590
4545
|
export declare interface ToolOptions {
|
|
4591
4546
|
readonly name: string;
|
|
4592
4547
|
readonly description?: string;
|
|
4548
|
+
readonly summary?: string;
|
|
4593
4549
|
readonly parameters?: Readonly<Record<string, unknown>>;
|
|
4594
4550
|
readonly execute: (args: Readonly<Record<string, unknown>>) => Promise<unknown> | unknown;
|
|
4595
4551
|
}
|
|
@@ -4697,40 +4653,6 @@ export declare class Workspace implements WorkspaceInterface {
|
|
|
4697
4653
|
*/
|
|
4698
4654
|
export declare const WORKSPACE_SECTION_HEADER = "## Workspace";
|
|
4699
4655
|
|
|
4700
|
-
/**
|
|
4701
|
-
* The DESCRIPTION {@link import('./factories.js').createWorkspaceTool} advertises — a multi-line
|
|
4702
|
-
* guide that teaches a small model how to drive a workspace through the single `operation`-keyed
|
|
4703
|
-
* tool.
|
|
4704
|
-
*
|
|
4705
|
-
* @remarks
|
|
4706
|
-
* Mirrors the analogous `WORKFLOW_TOOL_DESCRIPTION` in `@orkestrel/workflow`'s teaching style:
|
|
4707
|
-
* names the `operation` discriminant field, enumerates all 13 operations with their FLAT fields,
|
|
4708
|
-
* gives a worked example for the common ones (read / write / search / replace / splice), and embeds
|
|
4709
|
-
* {@link WORKSPACE_TOOL_EXAMPLE} verbatim (pinned by a parity test). The range edit is the FLAT
|
|
4710
|
-
* `'splice'` op — four positive-integer caret components, NOT a nested range — the ergonomic lever
|
|
4711
|
-
* a 2B model can fill. The edit / read ops target the ACTIVE workspace (one is auto-created on the
|
|
4712
|
-
* first edit when none is active); the `workspaces` / `switch` ops let the model move between
|
|
4713
|
-
* workspaces.
|
|
4714
|
-
*/
|
|
4715
|
-
export declare const WORKSPACE_TOOL_DESCRIPTION: string;
|
|
4716
|
-
|
|
4717
|
-
/**
|
|
4718
|
-
* A valid {@link WorkspaceOperation} object — the canonical example embedded VERBATIM in
|
|
4719
|
-
* {@link WORKSPACE_TOOL_DESCRIPTION} and pinned by a parity test (it must satisfy the compiled
|
|
4720
|
-
* contract's `is`), so the doc example can never drift from a real, contract-valid operation.
|
|
4721
|
-
*
|
|
4722
|
-
* @remarks
|
|
4723
|
-
* A `'write'` op (the most common authoring action): create or overwrite `notes.txt` with
|
|
4724
|
-
* `hello`. Frozen so it cannot be mutated in place.
|
|
4725
|
-
*/
|
|
4726
|
-
export declare const WORKSPACE_TOOL_EXAMPLE: WorkspaceOperation;
|
|
4727
|
-
|
|
4728
|
-
/**
|
|
4729
|
-
* The name {@link import('./factories.js').createWorkspaceTool} advertises by default — the key a
|
|
4730
|
-
* model calls and the {@link import('./types.js').ToolManagerInterface} registers under.
|
|
4731
|
-
*/
|
|
4732
|
-
export declare const WORKSPACE_TOOL_NAME = "workspace";
|
|
4733
|
-
|
|
4734
4656
|
/**
|
|
4735
4657
|
* An error thrown by the in-memory {@link import('./workspaces/Workspace.js').Workspace} edit
|
|
4736
4658
|
* surface.
|
|
@@ -4756,10 +4678,10 @@ export declare class WorkspaceError extends Error {
|
|
|
4756
4678
|
* - `MODALITY` — a text-only op (ranged read/write, `prepend`, `append`) was aimed at a binary file.
|
|
4757
4679
|
* - `PATTERN` — a `search` / `replace` `query` was an invalid regular expression (with `regex: true`).
|
|
4758
4680
|
* - `RANGE` — a ranged `write` got a structurally invalid {@link Range} (inverted, or a sub-1 line/column).
|
|
4759
|
-
* - `TOOL` — a handler-level validation fault
|
|
4760
|
-
* the agent-supplied args were
|
|
4761
|
-
*
|
|
4762
|
-
*
|
|
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.
|
|
4763
4685
|
*/
|
|
4764
4686
|
export declare type WorkspaceErrorCode = 'MODALITY' | 'PATTERN' | 'RANGE' | 'TOOL';
|
|
4765
4687
|
|
|
@@ -5015,124 +4937,6 @@ export declare interface WorkspaceManagerOptions {
|
|
|
5015
4937
|
readonly store?: WorkspaceStoreInterface;
|
|
5016
4938
|
}
|
|
5017
4939
|
|
|
5018
|
-
/**
|
|
5019
|
-
* One operation an agent invokes through {@link import('./factories.js').createWorkspaceTool} — a
|
|
5020
|
-
* FLAT, descriptive tagged union over the 13 workspace edit / read / navigation actions,
|
|
5021
|
-
* discriminated by the `operation` literal (AGENTS §4.8: a discriminant is named for its axis — the
|
|
5022
|
-
* action being performed — NEVER `kind`).
|
|
5023
|
-
*
|
|
5024
|
-
* @remarks
|
|
5025
|
-
* This is the SOURCE OF TRUTH the tool contract is typed to ({@link import('./shapers.js').workspaceToolShape}
|
|
5026
|
-
* compiles to a structurally-identical guard / parser / JSON Schema). Every field is FLAT (no nested
|
|
5027
|
-
* objects) — the small-model ergonomic lever: a range edit is the four flat integers of the
|
|
5028
|
-
* `'splice'` arm (`fromLine` / `fromColumn` / `toLine` / `toColumn`), reassembled into a 1-based
|
|
5029
|
-
* {@link Range} by {@link import('./helpers.js').rangeOf}, never a nested `{ start, end }`. Each EDIT
|
|
5030
|
-
* / READ arm maps onto exactly one {@link WorkspaceInterface} call against the manager's ACTIVE
|
|
5031
|
-
* workspace; the two REGISTRY arms (`switch` / `workspaces`) drive the
|
|
5032
|
-
* {@link WorkspaceManagerInterface} pointer instead — `workspaces` LISTS the workspaces the model
|
|
5033
|
-
* can move between, and `switch` re-points which one the edit / read arms target.
|
|
5034
|
-
*/
|
|
5035
|
-
export declare type WorkspaceOperation =
|
|
5036
|
-
/** Read a whole text file's text by `path` from the ACTIVE workspace (a binary / absent path — or no active workspace — yields no content). */
|
|
5037
|
-
{
|
|
5038
|
-
readonly operation: 'read';
|
|
5039
|
-
readonly path: string;
|
|
5040
|
-
}
|
|
5041
|
-
/** List every file in the ACTIVE workspace (path / state / size / lines / kind summaries); `[]` when no workspace is active. */
|
|
5042
|
-
| {
|
|
5043
|
-
readonly operation: 'list';
|
|
5044
|
-
}
|
|
5045
|
-
/** Whether a file exists at `path` in the ACTIVE workspace (`false` when no workspace is active). */
|
|
5046
|
-
| {
|
|
5047
|
-
readonly operation: 'has';
|
|
5048
|
-
readonly path: string;
|
|
5049
|
-
}
|
|
5050
|
-
/**
|
|
5051
|
-
* Scan every text file for `query`, returning each hit (path + 1-based line / column + the line).
|
|
5052
|
-
*
|
|
5053
|
-
* @remarks
|
|
5054
|
-
* `regex` treats `query` as a regular-expression source (default `false` — a literal substring);
|
|
5055
|
-
* `exact` matches case-sensitively (default `true`); `limit` caps the total hits returned.
|
|
5056
|
-
*/
|
|
5057
|
-
| {
|
|
5058
|
-
readonly operation: 'search';
|
|
5059
|
-
readonly query: string;
|
|
5060
|
-
readonly regex?: boolean;
|
|
5061
|
-
readonly exact?: boolean;
|
|
5062
|
-
readonly limit?: number;
|
|
5063
|
-
}
|
|
5064
|
-
/**
|
|
5065
|
-
* Replace `query` with `replacement` across every text file, returning the tally.
|
|
5066
|
-
*
|
|
5067
|
-
* @remarks
|
|
5068
|
-
* Same matching axes as `search`: `regex` (default `false`), `exact` (default `true`), `limit`
|
|
5069
|
-
* (cap the total replacements).
|
|
5070
|
-
*/
|
|
5071
|
-
| {
|
|
5072
|
-
readonly operation: 'replace';
|
|
5073
|
-
readonly query: string;
|
|
5074
|
-
readonly replacement: string;
|
|
5075
|
-
readonly regex?: boolean;
|
|
5076
|
-
readonly exact?: boolean;
|
|
5077
|
-
readonly limit?: number;
|
|
5078
|
-
}
|
|
5079
|
-
/** Write (create or overwrite) the whole file at `path` with `content`. */
|
|
5080
|
-
| {
|
|
5081
|
-
readonly operation: 'write';
|
|
5082
|
-
readonly path: string;
|
|
5083
|
-
readonly content: string;
|
|
5084
|
-
}
|
|
5085
|
-
/**
|
|
5086
|
-
* Splice `content` into an existing text file, replacing the 1-based range
|
|
5087
|
-
* `(fromLine, fromColumn)` (INCLUSIVE) → `(toLine, toColumn)` (EXCLUSIVE).
|
|
5088
|
-
*
|
|
5089
|
-
* @remarks
|
|
5090
|
-
* The FLAT range edit — the four positive-integer caret components reassemble into a {@link Range}
|
|
5091
|
-
* ({@link import('./helpers.js').rangeOf}). An empty span (`from === to`) inserts; a span past the
|
|
5092
|
-
* end is clamped. An inverted / sub-1 range throws `RANGE`; a binary target throws `MODALITY`.
|
|
5093
|
-
*/
|
|
5094
|
-
| {
|
|
5095
|
-
readonly operation: 'splice';
|
|
5096
|
-
readonly path: string;
|
|
5097
|
-
readonly content: string;
|
|
5098
|
-
readonly fromLine: number;
|
|
5099
|
-
readonly fromColumn: number;
|
|
5100
|
-
readonly toLine: number;
|
|
5101
|
-
readonly toColumn: number;
|
|
5102
|
-
}
|
|
5103
|
-
/** Prepend `content` to the start of the file at `path` (creating it when absent). */
|
|
5104
|
-
| {
|
|
5105
|
-
readonly operation: 'prepend';
|
|
5106
|
-
readonly path: string;
|
|
5107
|
-
readonly content: string;
|
|
5108
|
-
}
|
|
5109
|
-
/** Append `content` to the end of the file at `path` (creating it when absent). */
|
|
5110
|
-
| {
|
|
5111
|
-
readonly operation: 'append';
|
|
5112
|
-
readonly path: string;
|
|
5113
|
-
readonly content: string;
|
|
5114
|
-
}
|
|
5115
|
-
/** Re-key the file `from` → `to` (overwriting an occupied target). */
|
|
5116
|
-
| {
|
|
5117
|
-
readonly operation: 'move';
|
|
5118
|
-
readonly from: string;
|
|
5119
|
-
readonly to: string;
|
|
5120
|
-
}
|
|
5121
|
-
/** Remove the file at `path` from the workspace. */
|
|
5122
|
-
| {
|
|
5123
|
-
readonly operation: 'remove';
|
|
5124
|
-
readonly path: string;
|
|
5125
|
-
}
|
|
5126
|
-
/** List the workspaces the model can move between — each `{ id, files, active }` — so it can choose an `id` to `switch` to. */
|
|
5127
|
-
| {
|
|
5128
|
-
readonly operation: 'workspaces';
|
|
5129
|
-
}
|
|
5130
|
-
/** 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. */
|
|
5131
|
-
| {
|
|
5132
|
-
readonly operation: 'switch';
|
|
5133
|
-
readonly id: string;
|
|
5134
|
-
};
|
|
5135
|
-
|
|
5136
4940
|
/**
|
|
5137
4941
|
* Options for {@link import('./factories.js').createWorkspace} / the
|
|
5138
4942
|
* {@link import('./workspaces/Workspace.js').Workspace} constructor.
|
|
@@ -5238,91 +5042,4 @@ export declare interface WorkspaceStoreInterface {
|
|
|
5238
5042
|
delete(id: string): Promise<void>;
|
|
5239
5043
|
}
|
|
5240
5044
|
|
|
5241
|
-
/**
|
|
5242
|
-
* Options for {@link import('./factories.js').createWorkspaceTool} — optional overrides of the
|
|
5243
|
-
* advertised tool `name` / `description`.
|
|
5244
|
-
*
|
|
5245
|
-
* @param options - The workspace-tool options
|
|
5246
|
-
*
|
|
5247
|
-
* @remarks
|
|
5248
|
-
* - `name` — the advertised tool name a model calls; defaults to {@link import('./constants.js').WORKSPACE_TOOL_NAME} (`'workspace'`).
|
|
5249
|
-
* - `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).
|
|
5250
|
-
*/
|
|
5251
|
-
export declare interface WorkspaceToolOptions {
|
|
5252
|
-
readonly name?: string;
|
|
5253
|
-
readonly description?: string;
|
|
5254
|
-
}
|
|
5255
|
-
|
|
5256
|
-
/**
|
|
5257
|
-
* The shape of a {@link import('./types.js').WorkspaceOperation} — a descriptive tagged union over
|
|
5258
|
-
* the 13 workspace edit / read / navigation operations, discriminated by the `operation` literal
|
|
5259
|
-
* (never a bare `kind`; AGENTS §4.8). Each variant leads with its `operation` discriminant then its
|
|
5260
|
-
* FLAT fields, every field via `stringShape` / `optionalShape` / `integerShape({ min: 1 })` /
|
|
5261
|
-
* `booleanShape`, each carrying a strong field-level `description`.
|
|
5262
|
-
*
|
|
5263
|
-
* @remarks
|
|
5264
|
-
* The union compiles to an `anyOf` JSON Schema + a `unionOf` guard + a first-match parser
|
|
5265
|
-
* automatically ({@link import('./factories.js').createWorkspaceTool} types the result to the
|
|
5266
|
-
* hand-written `WorkspaceOperation`). `limit` and the four `'splice'` caret components are POSITIVE
|
|
5267
|
-
* integers (`integerShape({ min: 1 })`); `regex` / `exact` are `optionalShape(booleanShape(...))`.
|
|
5268
|
-
* The two REGISTRY arms — `workspaces` (list the workspaces the model can move between) and `switch`
|
|
5269
|
-
* (re-point the active one by `id`) — let a model DISCOVER then CHOOSE which workspace the edit /
|
|
5270
|
-
* read arms target. The descriptions are the small-model ergonomic lever — they ride into the
|
|
5271
|
-
* advertised schema so a model authoring an operation gets per-field guidance.
|
|
5272
|
-
*/
|
|
5273
|
-
export declare const workspaceToolShape: UnionShape<[ ObjectShape<{
|
|
5274
|
-
operation: LiteralShape<readonly ["read"]>;
|
|
5275
|
-
path: StringShape;
|
|
5276
|
-
}>, ObjectShape<{
|
|
5277
|
-
operation: LiteralShape<readonly ["list"]>;
|
|
5278
|
-
}>, ObjectShape<{
|
|
5279
|
-
operation: LiteralShape<readonly ["has"]>;
|
|
5280
|
-
path: StringShape;
|
|
5281
|
-
}>, ObjectShape<{
|
|
5282
|
-
operation: LiteralShape<readonly ["search"]>;
|
|
5283
|
-
query: StringShape;
|
|
5284
|
-
regex: OptionalShape<BooleanShape>;
|
|
5285
|
-
exact: OptionalShape<BooleanShape>;
|
|
5286
|
-
limit: OptionalShape<NumberShape>;
|
|
5287
|
-
}>, ObjectShape<{
|
|
5288
|
-
operation: LiteralShape<readonly ["replace"]>;
|
|
5289
|
-
query: StringShape;
|
|
5290
|
-
replacement: StringShape;
|
|
5291
|
-
regex: OptionalShape<BooleanShape>;
|
|
5292
|
-
exact: OptionalShape<BooleanShape>;
|
|
5293
|
-
limit: OptionalShape<NumberShape>;
|
|
5294
|
-
}>, ObjectShape<{
|
|
5295
|
-
operation: LiteralShape<readonly ["write"]>;
|
|
5296
|
-
path: StringShape;
|
|
5297
|
-
content: StringShape;
|
|
5298
|
-
}>, ObjectShape<{
|
|
5299
|
-
operation: LiteralShape<readonly ["splice"]>;
|
|
5300
|
-
path: StringShape;
|
|
5301
|
-
content: StringShape;
|
|
5302
|
-
fromLine: NumberShape;
|
|
5303
|
-
fromColumn: NumberShape;
|
|
5304
|
-
toLine: NumberShape;
|
|
5305
|
-
toColumn: NumberShape;
|
|
5306
|
-
}>, ObjectShape<{
|
|
5307
|
-
operation: LiteralShape<readonly ["prepend"]>;
|
|
5308
|
-
path: StringShape;
|
|
5309
|
-
content: StringShape;
|
|
5310
|
-
}>, ObjectShape<{
|
|
5311
|
-
operation: LiteralShape<readonly ["append"]>;
|
|
5312
|
-
path: StringShape;
|
|
5313
|
-
content: StringShape;
|
|
5314
|
-
}>, ObjectShape<{
|
|
5315
|
-
operation: LiteralShape<readonly ["move"]>;
|
|
5316
|
-
from: StringShape;
|
|
5317
|
-
to: StringShape;
|
|
5318
|
-
}>, ObjectShape<{
|
|
5319
|
-
operation: LiteralShape<readonly ["remove"]>;
|
|
5320
|
-
path: StringShape;
|
|
5321
|
-
}>, ObjectShape<{
|
|
5322
|
-
operation: LiteralShape<readonly ["workspaces"]>;
|
|
5323
|
-
}>, ObjectShape<{
|
|
5324
|
-
operation: LiteralShape<readonly ["switch"]>;
|
|
5325
|
-
id: StringShape;
|
|
5326
|
-
}>]>;
|
|
5327
|
-
|
|
5328
5045
|
export { }
|