@asterism-app/builtin-api 0.26.0 → 0.26.2

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/README.md CHANGED
@@ -1,21 +1,21 @@
1
1
  # Built-in public API
2
2
 
3
- This package exposes domain contracts and extension capabilities shared by Asterism's built-in implementation and external plugins.
3
+ This package is the public domain boundary shared by Asterism's builtin implementation and external plugins. It lets an integration participate in existing Agent behavior without importing private implementation code.
4
4
 
5
- It lets a plugin interact with existing Agent behavior, offer creation capabilities, or contribute Agent presentation without importing the implementation.
5
+ ## Extend without taking ownership
6
6
 
7
- Public declarations retain their identity across consumers. The package is a shared domain boundary, not a second installed plugin and not a grant of private object access.
7
+ Builtin owns its input admission, conversation history, and Agent execution. An extension owns its business state, external relationships, and presentation contributions. Use this boundary when extending that domain rather than treating the bundled paradigm as a mandatory model for all plugins.
8
8
 
9
- General hosting facilities belong to the SDK. Built-in-specific behavior belongs here only when it is intentionally public.
9
+ Public declarations retain shared runtime identity across consumers. The package is not a second installed plugin and does not grant access to private objects. Generic hosting capabilities belong to the SDK; builtin-specific capabilities belong here when they are intentionally public.
10
10
 
11
- ## Installation
11
+ ## Depend on the implementation provider
12
12
 
13
- Install with `npm install --save-dev --save-exact @asterism-app/sdk@latest @asterism-app/builtin-api@latest` to target the stable application, or use `@next` for both to target the preview application. Declare both packages as peer dependencies with `"*"` in the plugin package.
13
+ Develop against compatible SDK and builtin API packages. Development dependencies supply declarations; peer dependencies express the shared provider relationship. Installing the API package does not install or update the builtin implementation that supplies behavior at runtime.
14
14
 
15
- The package ships TypeScript source. Asterism supplies the built-in public API at runtime, preserving shared declaration identity. Use development versions compatible with the target application; installing these packages does not install or update the built-in implementation.
15
+ Import original contracts so extensions compose with the provider's operations rather than recreate them by convention. Validate the integration in an application with the intended provider enabled.
16
16
 
17
- ## Authoring material
17
+ ## Explain integration choices
18
18
 
19
- The source package includes `docs/` for built-in domain development guides and `examples/` for agent input, input preparation, resource creation, and agent UI extensions. These examples are fragments to compose into a plugin with compatible SDK and built-in API dependencies. They participate in repository type checking.
19
+ The package includes domain guides and source examples. Prose explains when to submit, prepare, observe, or present work and which participant owns each decision. Types and maintained examples express the concrete contracts and composition.
20
20
 
21
- The application's manual exposes these directories directly. Generic plugin development material and the complete starter package belong to `@asterism-app/sdk`.
21
+ The manual supports users and plugin authors on demand. Tools remain understandable from their own descriptions, guidelines, and schemas without a separate documentation prerequisite.
package/docs/agents.md CHANGED
@@ -1,114 +1,69 @@
1
- # Extend built-in agents
1
+ # Extend built-in Agents
2
2
 
3
- The built-in public API lets plugins submit messages to existing Agents and extend their preparation and presentation. The contributing plugin owns its integration and business state. Builtin owns input admission, conversation history, and Agent execution.
3
+ The built-in public API lets plugins integrate with existing Agents without importing their implementation. The integration owns its business state and external relationships; builtin owns input admission, conversation history, and Agent execution.
4
4
 
5
- ## Declare the dependency
5
+ ## Extend the domain you need
6
6
 
7
- Declare `@asterism-app/builtin-api` and `@asterism-app/sdk` in `peerDependencies` with `"*"`. The SDK is supplied by the host; the enabled builtin plugin provides its public API package. The host does not gate loading on dependency ranges. For local development, source-package dependencies supply editor types. Import public contracts from the domain package so every participant uses the same declarations. Disabling builtin also makes its dependent plugins unavailable.
7
+ Use the public Agent boundary when the work belongs in an existing Agent conversation. A plugin that needs its own execution model can instead compose host capabilities without adopting that conversation model.
8
8
 
9
- Examples are TypeScript and TSX fragments for a plugin's backend or renderer. They use public packages; install additional libraries imported by the chosen example, such as Nano ID for submission identities, in the plugin project. A plugin still supplies its manifest and composition entry points.
9
+ Import original contracts from the domain package. Shared declaration identity lets an extension participate in existing behavior; a copied schema or an implementation import is not an equivalent integration. Depending on the public API also means depending on its enabled implementation provider.
10
10
 
11
- ## Messages and their sources
11
+ ## Make messages readable and attributable
12
12
 
13
- An Agent input is a message with ordered text, stored-file, or file-reference parts and a structured sender. All messages use the same submission action, history record, queue, and body renderer. The sender has three variants:
13
+ Sender attribution explains where input came from independently of the Agent that receives it. It is not authority to access the source or a guarantee of a reply route. Preserve that distinction when bridging external systems or forwarding another Agent's message.
14
14
 
15
- | Source | Meaning | Attribution |
16
- | --- | --- | --- |
17
- | `user` | Input from the user | No additional sender fields; this is the default when sender is omitted |
18
- | `agent` | Communication from another Agent | Communication resource reference and Agent name, with optional Mesh channel addressing |
19
- | `event` | Facts reported by a resource | Emitting resource reference and its name when the message is constructed |
15
+ Keep the body useful as ordinary readable text. For example, a pull-request notification can state the repository, change, author, and URL. The integration understands those facts and should explain them; the receiving Agent's instructions supply its responsibilities. A domain event does not need a private machine payload disguised as a message.
20
16
 
21
- Plugins supply sender attribution from their integration context. An Agent's Send tool obtains it from the bound caller. The saved input record belongs to the receiving Agent; its sender identifies the origin independently. Attribution itself grants no access to the source resource or reply route.
17
+ Use retained attachments when the message must preserve submitted bytes. Use file references when the message should carry an address for later consumption. Forwarding an address does not mean its content has been read or captured.
22
18
 
23
- Keep the body useful as ordinary readable text. A resource reporting a pull request can include its repository, number, title, author, commit, and URL. The Agent's configured instructions supply its responsibilities. Event type names and domain facts belong in the body; no separate event payload schema or renderer is required.
19
+ ## Choose admission and scheduling intentionally
24
20
 
25
- Builtin preserves the submitted body and sender in history. Model projection wraps Agent and event messages in escaped source envelopes. The UI renders the original body with source identification: Agent messages use the Agent name, while event messages use the resource name, event icon, and blue surface. Names remain those recorded with the message even if the source is later renamed or removed.
21
+ Successful submission means that input was accepted, not that the Agent completed the requested work. Design acknowledgements and external status updates around that distinction.
26
22
 
27
- ## Submit and schedule messages
23
+ Choose steering for information intended to affect current work and follow-up delivery for a subsequent task. An updated fact and a new independent review may deserve different scheduling even when they came from the same sender. Do not assume one submitted message corresponds to one model request or one turn.
28
24
 
29
- Obtain the target session executor from the plugin context and invoke `SubmitAgentInput` with the Agent resource reference. Each submission includes a 16-character Nano ID, parts, a delivery mode, and its sender. External callbacks can invoke the same action without a model tool call. Use a resource's attachment lifetime for an object-owned connection and pass its signal into ongoing submissions.
25
+ Retain the complete submission for a retry, including its identity and attribution. A retry asks about the same work; changing the body or sender while keeping its identity obscures that meaning. New work needs a new submission identity.
30
26
 
31
- An idle Agent records accepted input and starts execution. When the Agent is running, accepted input enters its persistent drafts collection. Delivery mode is independent of sender:
27
+ Cancellation of the submission and cancellation of the Agent's independent execution are different decisions. Bind an object-owned bridge to its resource lifetime, but do not treat the disappearance of a sending interface as an implicit request to stop the recipient.
32
28
 
33
- | Mode | Delivery while running |
34
- | --- | --- |
35
- | `steer` | At the next request boundary, after the current response and tool batch |
36
- | `follow` | At a turn boundary, together with other pending inputs eligible for the next turn |
29
+ ## Keep creation independent of input
37
30
 
38
- For example, a new independent review can use `follow`, while updated facts for the current task can use `steer`. A turn may consume a batch of messages; submission does not promise a separate turn for each message. Successful submission means acceptance, not completion of the Agent's response.
31
+ Creating an Agent establishes an object; submitting input asks it to work. An integration can create an Agent now and submit ordinary input later. A starting interface may combine both in one transaction without inventing a separate first-message protocol.
39
32
 
40
- Construct the complete input once and retain it for retries, including the submission ID, sender name, mode, and body. An already accepted submission ID is ignored rather than accepted again. A new message needs a new ID.
33
+ Put required initialization in creation or prepared initial work. Observe creation facts for reactions after commitment, not as a blocking initialization hook. Resource presence is a lifetime concern: reconstruction can make an existing Agent present again without creating a new Agent.
41
34
 
42
- Stored-file parts (`kind: "file"`) supply immutable content to the model and require the appropriate content reader when forwarded through an action. File-reference parts (`kind: "file-reference"`) carry a `FileRef` in `ref`, with optional `filename` and `mediaType`. They pass through actions, events, drafts, and history as ordinary JSON. Model projection presents their addresses as text; receiving or resending one does not read its bytes or require a content reader.
35
+ ## Route through explicit relationships
43
36
 
44
- Cancellation of a submission is separate from cancellation of the Agent's independent execution, which has its own public action. Stopping an Agent preserves pending drafts. Restoring drafts on application startup does not automatically send them.
37
+ The publishing integration chooses recipients. A bridge can use its direct links to find Agents without obtaining their private state or inheriting their access to other resources. The reverse link is a separate relationship.
45
38
 
46
- ## Creation and input
39
+ An SDK event is a transient notification, not an Agent message. Translate it into readable input only when the integration's purpose calls for that. This keeps transport, recipient policy, and conversation meaning with the layer that understands each one.
47
40
 
48
- Agent creation and message submission are independent operations. Creating an Agent establishes an empty resource with its configuration; it does not require a message or start execution. Plugins can create the resource and submit ordinary input later.
41
+ Communication resources should reuse public operation contracts when the semantics match while owning their own addressing and membership. Capture recipient authority at the request boundary; read mutable descriptions when handling the operation. A member directory informs routing without granting access beyond that scope.
49
42
 
50
- The builtin Home entry combines session creation, Agent creation, and acceptance of a user message in one transaction. It prepares the input before committing the new session, so rejected input leaves no empty session behind. The message uses the ordinary input contract, preparers, and acceptance notification. There is no separate first-message event or plugin lifecycle stage.
43
+ ## Distinguish admission, evidence, and execution
51
44
 
52
- Creation-related work belongs to resource creation or observation of the resulting creation fact, independently of incoming messages. In a session observer's `committed` callback, use the SDK's `ResourceCreated.decodeAll(records)` and select known entries whose `data.type` equals `Agent.kind`. The associated Agent ID is `data.id`; the host-created record's source is null. A creation observer sees the committed state; Home's creation and input may already be present together. Observation is not a blocking initialization hook. Resource-presence notifications and attachment lifetimes describe entry into the current resource set, including reconstruction, rather than only new creation.
45
+ Use input preparation to inspect, replace, or reject a proposed submission. Keep it tied to a business rule and free of mutations that assume acceptance: preparation is not proof that the submission committed.
53
46
 
54
- ## Resolve recipients
47
+ Acceptance is useful for integrations that acknowledge received work. Conversation records are evidence of input actually delivered to history. Queued input can remain editable or be discarded, so those observation points answer different questions.
55
48
 
56
- The publishing plugin selects recipients and submits messages explicitly. A bridge resource can read a fresh session snapshot for resources directly linked to itself, select Agent references, and invoke their input action. Each link makes a resource available to its receiver; the reverse relationship is independent. Reading a link does not expose another plugin's private state.
49
+ Turn-end notifications describe execution boundaries, not an immutable seal on the conversation or a promise of future idleness. Use the reported input and history position to identify the work rather than assuming the live session tip still represents that ending. Failure, cancellation, and normal completion should remain distinct in downstream status.
57
50
 
58
- The SDK event bus delivers typed transient notifications to subscribers. Publishing there does not submit an Agent message. A callback can translate a notification into a readable event message and submit it to selected Agents. This translation belongs to the integration that understands the notification.
51
+ Transient notifications suit live reactions. Durable reconciliation needs saved evidence. An observer runs after facts have committed and cannot replace admission or take control of turn scheduling.
59
52
 
60
- ## Implement communication resources
53
+ ## Investigate without continuing the target
61
54
 
62
- Use the public Send, Peek, GetProfile, and SetProfile tool declarations when a resource provides those operations. Each resource implementation owns its addressing schema and resolves targets within its authorized scope. A shared tool name does not grant direct access to the addressed Agent or its linked resources.
55
+ A saved-conversation investigation explains evidence without starting a turn on the target Agent. It is useful for status or review questions that should not become new instructions to that Agent.
63
56
 
64
- Send accepts ordered `parts` containing text and file references. Each file-reference part carries a `FileRef` in `ref`; its optional `filename` specifies the name used for delivery. Agent and Mesh implementations forward these parts into Agent input without resolving the references. A consuming implementation can stream a referenced file through `plugin.files.open(ref, { signal })`. The original source resource remains in the reference across sessions and intermediate senders. The consuming operation determines how to use the bytes; support for references is explicit in each operation's contract.
57
+ Keep the evidence snapshot separate from the caller's follow-up conversation. Each investigation can read fresh evidence while the caller retains earlier questions and reports as context. Preserve incomplete outcomes so a follow-up does not mistake a cancelled report for a complete account.
65
58
 
66
- For cross-session messaging, obtain the target session executor and submit through the same Agent input action. The public Agent service supplies an Agent's configured type and investigates its saved records without exposing private Agent state. Investigation captures a fixed record snapshot and does not start a turn on the target. Forward cancellation and investigation progress to the caller.
59
+ ## Prepare context without claiming authority
67
60
 
68
- Mesh messages retain their internal sender attribution in history. Model projection uses the channel name, Agent name, and numeric disambiguator; a sender not exposed to the channel is marked as not visible. Communication resources own their member directory and task descriptions. Resolve targets against the request's captured access scope. Read current task descriptions when handling an operation; identity resolution and mutable profile text have separate lifetimes.
61
+ Request preparation changes the skills and instruction blocks presented to an Agent. Use it for integration-specific context, not as a replacement for authorization. Omitting information from a prompt is not an access restriction.
69
62
 
70
- ## Investigate a conversation
63
+ Keep preparation deterministic within the captured request environment. Changes to configuration or catalogs belong to later requests rather than altering the meaning of a request already being assembled.
71
64
 
72
- Peek uses the configured utility model to explain an Agent's saved records. Backend plugins obtain a client with `agentServices(plugin).peek(target)` after resolving an authorized Agent reference. Renderer contributions bind `createPeekClient(object)` to their displayed Agent. Both clients offer `run(input, { signal, onProgress })` for a final outcome and `stream(input, { signal })` for progress followed by a terminal result.
65
+ ## Extend presentation without owning execution
73
66
 
74
- Supply a `question` and optionally `includeThinking` to admit saved readable thinking. Each call captures fresh evidence from the target's current timeline and keeps that snapshot fixed throughout its retrieval rounds. Progress contains a complete report snapshot, which replaces the previous report rather than appending to it. The final outcome distinguishes success, partial output, cancellation, and failure. Breaking out of a stream cancels its investigation.
67
+ Use presentation extensions for the integration's controls and business state while preserving builtin's conversation and execution ownership. A view closing does not complete or cancel waiting backend work. Reopening should read the current state rather than depend on an earlier component instance.
75
68
 
76
- For follow-ups, pass `history` containing earlier questions, reports, and their outcomes. This context belongs to the caller and is separate from the target's saved records. Keep incomplete reports marked with their actual outcome. The service does not retain conversations or write investigation exchanges to the target. Single-call tools, including Mesh Peek, supply no history; a conversational interface owns its temporary history and passes it explicitly on each call.
77
-
78
- ## Prepare incoming input
79
-
80
- An external preparer can inspect, replace, or reject any of the three message sources using the original built-in action contract. Its replacement supplies raw action input that will be parsed again. Preparation applies to idle input, queued steering and follow-ups, and Home's initial input. It runs before acceptance, including on retries, so it is not an acceptance notification. Preparation has read capabilities and does not commit session mutations.
81
-
82
- Keep a preparer's scope tied to its business purpose. It does not replace the Agent implementation or acquire a private Agent executor.
83
-
84
- ## Observe input and turn boundaries
85
-
86
- Input preparation, acceptance, and delivery are separate observation points. Use a preparer to modify or reject a submission. Subscribe to `AgentInputAccepted` to react after a new input commits. Its payload contains the final prepared `input`, including `submissionId`, and `queued`, which reports whether it entered drafts instead of being delivered immediately. Rejected inputs and retries of accepted submissions produce no new acceptance event. Home publishes acceptance after its complete session-creation transaction succeeds.
87
-
88
- Saving a held draft or changing an existing draft's mode is a draft-state operation, not a new input submission. These operations do not emit acceptance events; record observers still see the draft if it is delivered.
89
-
90
- Observe `AgentInputMessage` through `SessionObserver.committed` to see actual delivery to conversation history. Queued messages produce this record when consumed; idle inputs produce it during acceptance. Steering records do not start a new turn. These records and acceptance events use separate delivery mechanisms; an idle input's record is committed before its acceptance event is published. Acceptance does not guarantee that a queued message will reach a model request: pending drafts remain editable and can be discarded.
91
-
92
- Subscribe to `AgentTurnEnded` for execution boundaries. Every ending carries `reason` and `settled`. A normal turn followed by another queued batch reports `settled: false`; the last turn reports `settled: true` after the loop stops consuming. Failure and cancellation are reported with their own reasons rather than as successful completion. Steering joins the current turn and does not produce an ending by itself.
93
-
94
- The event's `inputId` identifies the turn-opening input record, and `position.nodeId` identifies its ending history position before any next-turn inputs. `inputId` can be null when execution has no recorded turn input. By the time a handler runs, the live session may contain later records; use these identities to locate the reported work instead of assuming the current tip is that ending. A stopped turn can be resumed explicitly and emit another ending for the same input. The event does not seal history or promise that the Agent will remain idle.
95
-
96
- Both events are transient occurrence notifications on `plugin.ipc.events`, with the receiving Agent as their resource source. Subscribe for all Agents or filter by session and resource identity, and bind subscriptions to the plugin lifetime. A plugin does not need its own resource to subscribe. Handlers run asynchronously and do not participate in input admission or turn scheduling. `settled` describes the consuming loop, while host task cleanup may still be tracked independently. Events are not replayed after restart.
97
-
98
- `SessionObserver.completed` concerns finalized operation records; it is not a turn-end callback. Resource status events describe coarse workbench status. Use the Agent's domain notifications when input identity, turn position, or the distinction between turn end and loop end matters.
99
-
100
- ## Prepare model requests
101
-
102
- The host collects skill packages and instruction blocks with their registering plugin's provenance. Builtin selects its effective skills and builds structured instruction blocks for each request. User skills override plugin skills, which override builtin skills.
103
-
104
- Declare an Agent preparer to filter skills or remove, change, and append instruction blocks. Preparers run synchronously in plugin initialization order. Each request captures the catalog and preparer set before awaiting linked context, then uses the prepared result for its prompt. `skill_read` resolves names independently through the current flattened catalog. Removing a skill from the prompt does not restrict reading it; a catalog refresh affects later reads and model requests.
105
-
106
- ## Extend presentation
107
-
108
- Agent history includes immutable model blocks and tool operations. Complete tool inputs are published before execution and their results fill the same record once. Read both through the public execution decoder when building a history projection; operation completion updates the existing record rather than appending a new tool position.
109
-
110
- Response termination metadata may describe generation failure or cancellation as well as success. It belongs to the response's last model-ordinal block and does not invalidate all earlier content. Errors before any output remain transient. Retry activity belongs to current execution state, not historical notices.
111
-
112
- Register Agent UI extensions during frontend preparation and bind registration to its cancellation signal. Extensions can present controls, supplemental content, overlays, or modal interaction using the built-in presentation components. Message sources already share the built-in body renderer and source presentation.
113
-
114
- The plugin supplies business state for the associated Agent and callbacks for user actions. A component becoming invisible does not complete or cancel waiting backend work. Remounting should reread current state, and each submission entry owns its pending and error state.
69
+ When presenting history, distinguish immutable evidence from live progress and retry activity. A generation failure can coexist with useful earlier output or completed tool effects. Show what the evidence supports instead of assigning one blanket status to all preceding work.
@@ -1,11 +1,15 @@
1
- # Offer resource creation to agents
1
+ # Offer resource creation to Agents
2
2
 
3
- A plugin can expose its resource's public creation contract through the built-in agent creation mechanism. The plugin still owns the resource type, initial data, projection, and lifetime. The built-in domain integration supplies the model-facing creation entry.
3
+ A plugin can make its resource available through builtin's model-facing creation mechanism without adopting the Agent's lifecycle or giving up ownership of the resource. The resource plugin still defines what the object means, what state it owns, and how it behaves.
4
4
 
5
- Declare creation once and pass that original contract to the integration. A straightforward entry accepts the creation contract's input directly. A specialized entry can define a smaller model-facing input and transform it into the same creation input, such as turning a short note into a titled document.
5
+ ## Reuse creation meaning
6
6
 
7
- Creation participates in the host's resource and history operations. The created object links to the invoking agent. Optional initial resources remain within the request's captured resource scope. Explicit self-exposure supplies the reverse relationship; a new resource does not inherit every link or capability of its creator.
7
+ Build on the original public creation contract rather than creating a parallel initialization path. A straightforward entry can expose that contract directly. A specialized entry is useful when a model can supply a smaller meaningful input, such as a short note from which the plugin derives a titled document.
8
8
 
9
- Initial self-exposure is optional. After creation, the agent can use `resource_expose` to enable or withdraw its exposure to a resource in its captured request scope. The recipient must support receiving links; the agent's access to that recipient remains independent.
9
+ Keep that adaptation explainable. It should translate intent into the same domain creation operation, not bypass validation or hide unrelated effects. Descriptions and schemas should make the resulting object's purpose understandable without a manual recipe.
10
10
 
11
- Use descriptions and schemas that explain what the resulting resource means and what inputs the model should supply. Creating another agent is also an explicit domain operation with its own configuration and initial links.
11
+ ## Choose relationships explicitly
12
+
13
+ Creation and access are separate responsibilities. A new resource does not inherit every link or capability of its creator. Decide which initial relationships make it useful within the invoking request's authorized scope.
14
+
15
+ The Agent's access to the new object and the object's access to the Agent are independent. A document may need only to be readable; a communication resource may also need a route back to its creator. Choose the reverse relationship for that purpose rather than treating mutual visibility as an automatic consequence of creation.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asterism-app/builtin-api",
3
- "version": "0.26.0",
3
+ "version": "0.26.2",
4
4
  "description": "Public domain contracts and extensions for Asterism built-in features",
5
5
  "license": "MIT",
6
6
  "author": "Chien Zhang",
package/src/messaging.ts CHANGED
@@ -49,17 +49,17 @@ export const sendResultSchema = z.strictObject({ name: z.string() })
49
49
  export type SendResult = z.infer<typeof sendResultSchema>;
50
50
 
51
51
  export const GetProfile = defineTool({
52
- id: builtin.name("tool.get_profile"), name: "get_profile",
53
- description: "Read an Agent's name, configured type, and task description through a resource.",
54
- guidelines: ["Null target selects your own profile on this resource. Other targets follow the resource's addressing schema."],
52
+ id: builtin.name("tool.get_profile"), name: "mesh_get_profile",
53
+ description: "Read an Agent's name, configured type, and task descriptions through a Mesh resource.",
54
+ guidelines: ["Null target selects your own profile on this Mesh. Other targets follow the Mesh's channel-local addressing schema."],
55
55
  argsSchema: z.strictObject({}).describe("Empty parameter object."),
56
56
  });
57
57
  export const SetProfile = defineTool({
58
- id: builtin.name("tool.set_profile"), name: "set_profile",
59
- description: "Set your own task description on this resource.",
58
+ id: builtin.name("tool.set_profile"), name: "mesh_set_profile",
59
+ description: "Set your own task description on a Mesh resource.",
60
60
  guidelines: ["The runtime identifies the caller. Name and configured Agent type come from the Agent.",
61
- "Descriptions belong to this resource. An empty description clears your description."],
61
+ "Descriptions belong to this Mesh resource. An empty description clears your description."],
62
62
  argsSchema: z.strictObject({
63
63
  description: z.string().trim().max(1000).describe("A brief description of your current task. Empty text clears it."),
64
- }).describe("Your task description on this resource."),
64
+ }).describe("Your task description on this Mesh resource."),
65
65
  });
@@ -2,10 +2,10 @@ import type { RendererObjectContext } from "@asterism-app/sdk/renderer";
2
2
  import { PeekChannel, type PeekClient, type PeekEvent, type PeekResult } from "./peek.ts";
3
3
 
4
4
  /** Binds Peek to the displayed Agent. Stream completion carries the outcome; early iterator exit closes the channel. */
5
- export function createPeekClient(object: Pick<RendererObjectContext, "openChannel">): PeekClient {
5
+ export function createPeekClient({ openChannel }: Pick<RendererObjectContext, "openChannel">): PeekClient {
6
6
  const stream: PeekClient["stream"] = async function* (input, { signal }) {
7
7
  signal.throwIfAborted();
8
- const channel = object.openChannel(PeekChannel);
8
+ const channel = openChannel(PeekChannel);
9
9
  const abort = () => channel.close();
10
10
  signal.addEventListener("abort", abort, { once: true });
11
11
  let completed = false;
package/src/search.ts CHANGED
@@ -12,7 +12,7 @@ const globGuidelines = [
12
12
  ];
13
13
 
14
14
  export const Find = defineTool({
15
- id: builtin.name("tool.find"), name: "find",
15
+ id: builtin.name("tool.find"), name: "glob",
16
16
  description: "Find files by glob pattern within a resource.",
17
17
  guidelines: [
18
18
  ...globGuidelines,
@@ -28,7 +28,7 @@ export const Grep = defineTool({
28
28
  id: builtin.name("tool.grep"), name: "grep",
29
29
  description: "Search text for a regular expression or literal pattern within a resource.",
30
30
  guidelines: [
31
- "Results identify matching lines and surrounding context. Resource implementations define additional output views.",
31
+ "Matching and context lines carry LINE#HASH anchors usable directly in edit where supported. Resource implementations define additional output views.",
32
32
  "Regular expressions use ripgrep's default Rust regex syntax. Matching is line-oriented.",
33
33
  "target selects the search scope and resource-specific content view according to the resource implementation's schema.",
34
34
  ],
package/src/text.ts CHANGED
@@ -30,7 +30,7 @@ export type TextRow = z.infer<typeof textRowSchema>;
30
30
  export const textReadTargetSchema = z.strictObject({
31
31
  offset: z.number().int().positive().optional().describe("First line to read, 1-based in the complete text; defaults to 1."),
32
32
  limit: z.number().int().positive().max(2000).optional().describe("Maximum lines to read; defaults to 1000, maximum 2000. Output is also limited to 64 KiB of line text; lines longer than 16000 characters are returned as excerpts."),
33
- anchored: z.boolean().optional().describe("Include LINE#HASH edit anchors; defaults to true. Anchors identify complete lines, including those displayed as excerpts. False returns text with line numbers only."),
33
+ anchored: z.boolean().optional().describe("Include per-line content hashes for edit (LINE#HASH│content); defaults to true. Hashes identify complete lines, including excerpts. False returns line-numbered text without edit anchors."),
34
34
  });
35
35
  export const textReadSchema = z.strictObject({
36
36
  totalLines: z.number().int().nonnegative().describe("Number of logical lines in the complete text; empty text has zero lines."),
package/src/tools.ts CHANGED
@@ -32,7 +32,7 @@ export const Metadata = defineTool({
32
32
  export const Read = defineTool({
33
33
  id: builtin.name("tool.read"),
34
34
  name: "read",
35
- description: "Read the selected content as text.",
35
+ description: "Read the selected content as text. Where supported, text lines display per-line content hashes by default (LINE#HASH│content) for hashline-verified editing.",
36
36
  guidelines: [
37
37
  "target selects the content, range, and reading view according to the resource implementation's schema.",
38
38
  "The result reports positions and a continuation point where the implementation supports ranges.",
@@ -43,10 +43,10 @@ export const Read = defineTool({
43
43
  export const Edit = defineTool({
44
44
  id: builtin.name("tool.edit"),
45
45
  name: "edit",
46
- description: "Apply a batch of line-anchored text edits to an existing target, and return the actual diff and fresh anchors.",
46
+ description: "Edit selected lines in existing text using hashline operations. LINE#HASH anchors come from the latest read, grep, edit, or replace result.",
47
47
  guidelines: [
48
48
  "target selects existing editable text according to the resource implementation's schema. args.edits contains the operations.",
49
- "Anchors contain a line number and its content hash, as returned by read, grep, edit, or replace.",
49
+ 'For a line shown as 12#ABCD│old, a single-line replacement is args.edits=[{"op":"replace","anchor":{"line":12,"hash":"ABCD"},"body":["new"]}].',
50
50
  "replace/delete affect the inclusive anchor..end range. An omitted end selects one line. Validation checks the cited endpoints.",
51
51
  "insert_before/insert_after preserve the anchor line. body contains the new lines.",
52
52
  "append/prepend take body. Each body item is one text line; an empty string represents a blank line.",
@@ -113,12 +113,13 @@ export const See = defineTool({
113
113
  export const Wait = defineTool({
114
114
  id: builtin.name("tool.wait"),
115
115
  name: "wait",
116
- description: "Wait until a resource reaches its resting state, up to a timeout.",
116
+ description: "Wait until a resource reaches its resting state, with an optional timeout.",
117
117
  guidelines: [
118
118
  "The resource implementation defines its resting state. A resource already at rest returns immediately.",
119
+ "Normally omit timeout and wait for completion or cancellation. Specify it only when the task has an explicit time limit.",
119
120
  "Timeout or cancellation ends only the wait; the resource continues its own work. The result reports the observed state.",
120
121
  ],
121
122
  argsSchema: z.strictObject({
122
- timeout: z.number().positive().max(2147483).describe("Maximum wait in seconds."),
123
- }).describe("A bounded wait."),
123
+ timeout: z.number().positive().max(2147483).optional().describe("Optional maximum wait in seconds; omitted means no timeout."),
124
+ }).describe("Wait with an optional time limit."),
124
125
  });