@asterism-app/builtin-api 1.1.5 → 1.2.1

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,27 +1,5 @@
1
1
  # Built-in public API
2
2
 
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.
3
+ This package lets plugins participate in the bundled Agent domain without importing its private implementation. The enabled provider supplies the original contracts and behavior at runtime; this package is not a second plugin.
4
4
 
5
- ## Extend without taking ownership
6
-
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
-
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
-
11
- ## Depend on the implementation provider
12
-
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
-
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
-
17
- ## Build an extension artifact
18
-
19
- Declare `@asterism-app/builtin-api` as a peer dependency so the standalone builder keeps builtin public imports external throughout the graph. The enabled builtin provider supplies their native ESM modules; a private copy cannot replace its runtime identity.
20
-
21
- Use `@asterism-app/plugin-build` and an explicit `asterism-plugin-build` build script. Build before adding the package directory to Asterism, then restart. The build writes loaded output into `dist`; source entries remain authoring inputs under `asterism.build`. Rebuild and restart after changes, and validate the delivered package against the intended application and provider rather than treating a successful build as integration acceptance.
22
-
23
- ## Explain integration choices
24
-
25
- 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.
26
-
27
- The manual supports users and plugin authors on demand. Tools remain understandable from their own descriptions, guidelines, and schemas without a separate documentation prerequisite.
5
+ Use the [Agent integration guide](docs/agents.md) to decide what belongs in an existing Agent. Read the bundled examples to see how an integration is assembled; use the target release's public source and types for the interface. Generic hosting capabilities live in the SDK.
package/docs/agents.md CHANGED
@@ -6,15 +6,7 @@ The built-in public API lets plugins integrate with existing Agents without impo
6
6
 
7
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
- 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
-
11
- ## Build against the enabled provider
12
-
13
- Declare `@asterism-app/builtin-api` as a peer dependency. The builder then keeps builtin API imports external in the completed artifact, including contracts, runtime helpers, and renderer exports reached through other modules of the plugin. A development dependency supplies the authoring declarations; neither declaration activates builtin.
14
-
15
- Build explicitly with `asterism-plugin-build` before adding the package directory to Asterism, then restart. The build writes loaded output into `dist`; source entries belong in `asterism.build`. A source checkout and a distributed package use the same loading contract. Rebuilding does not replace a graph already running in the application.
16
-
17
- Binding to the provider's native ESM exports preserves the original operation declarations and renderer services. A consumer-local copy is not a fallback when builtin is disabled or unavailable. Validate with the intended provider enabled; successful typechecking or artifact generation alone does not establish that integration.
9
+ Follow the target release's public domain exports into its declarations and the shipped integrations. Import those same contracts and verify with the provider enabled; a copied declaration is not a fallback for a missing provider.
18
10
 
19
11
  ## Make messages readable and attributable
20
12
 
@@ -22,7 +14,7 @@ Sender attribution explains where input came from independently of the Agent tha
22
14
 
23
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.
24
16
 
25
- A resource event can separate the two audiences. Leading YAML frontmatter carries metadata of any shape for the receiving Agent, such as the event kind and the identifiers its tools accept; the Markdown after it is the message people read in the conversation, which hides the frontmatter. Put each fact where its reader needs it rather than repeating identifiers in prose or squeezing the readable summary into metadata. A body may be empty when the following parts already form the message, as when a chat event is followed by the received messages themselves.
17
+ Separate machine-useful event metadata from the explanation shown to people. Put useful tool identifiers where the receiving Agent can use them; keep the visible message readable without them. If the received content already explains the event, avoid repeating it.
26
18
 
27
19
  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.
28
20
 
@@ -80,7 +72,7 @@ Keep preparation deterministic within the captured request environment. Changes
80
72
 
81
73
  ## Transform model context without rewriting history
82
74
 
83
- Agent context transforms compose in registration order after the built-in timeline projection. Each synchronous transform gets the preceding transform's standard context units. It can preserve, replace, add, or remove units; tool calls and results must stay paired within a unit. An invalid transform fails the request instead of silently restoring another projection. Keep transforms deterministic for a captured request, especially when reusing a provider's cached prefix.
75
+ Use context transforms to shape what a particular request needs, not to change the recorded facts. Keep tool calls and results paired. Treat earlier transforms as part of the input, and make the result deterministic within the captured request so unchanged context can stay reusable.
84
76
 
85
77
  Provenance accompanies the model items but is not sent to the model. Preserve a part's original identity only when forwarding that part. Synthetic or replaced parts do not claim its provenance. Treat a recall ticket as an address, not authority: resolve it on the calling Agent's request path and return the original content as a new tool result. Projection changes neither the saved timeline nor user-facing history.
86
78
 
@@ -4,7 +4,7 @@ A plugin can make its resource available through builtin's model-facing creation
4
4
 
5
5
  ## Reuse creation meaning
6
6
 
7
- Build on the original public creation contract rather than creating a parallel initialization path. Agent entries receive a parameter object even when there are no fields to supply. Reuse the creation schema directly when it describes an object, or use `inputSchema` and `toInput` to adapt that object to the underlying contract. This lets the domain contract keep inputs like `null` or a number without exposing them as the entire Agent input. An adapter can also expose a smaller meaningful input, such as a short note from which the plugin derives a titled document.
7
+ Build on the original public creation contract rather than creating a parallel initialization path. Give the Agent the choices that express the user's intent; adapt them when the domain needs a different representation or can derive remaining values. For example, a short note can be enough input to create a titled document.
8
8
 
9
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
 
@@ -15,8 +15,8 @@
15
15
  "react-intl": "^12.1.4"
16
16
  },
17
17
  "devDependencies": {
18
- "@asterism-app/sdk": "2.3.0",
19
- "@asterism-app/builtin-api": "1.1.5",
18
+ "@asterism-app/sdk": "2.5.0",
19
+ "@asterism-app/builtin-api": "1.2.1",
20
20
  "@asterism-app/plugin-build": "1.0.1",
21
21
  "typescript": "^7.0.2",
22
22
  "@types/node": "^26.6.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asterism-app/builtin-api",
3
- "version": "1.1.5",
3
+ "version": "1.2.1",
4
4
  "description": "Public domain contracts and extensions for Asterism built-in features",
5
5
  "license": "MIT",
6
6
  "author": "Chien Zhang",
package/src/records.ts CHANGED
@@ -14,8 +14,8 @@ export const Execution = defineRecord(builtin.name("agent.execution"), {
14
14
  });
15
15
  /** Tool inputs keep their model-order position; execution fills the outcome once. */
16
16
  export const ToolExecution = defineOperationRecord(builtin.name("agent.tool-execution"), {
17
- input: modelToolCallBlockSchema.refine(block => !block.complete && block.outcome === null && block.argumentsText === null,
18
- "Tool operation input must have complete arguments and a pending outcome."),
17
+ input: modelToolCallBlockSchema.refine(block => !block.complete && block.outcome === null && block.input !== null && block.draft === null,
18
+ "Tool operation input must have complete input and a pending outcome."),
19
19
  output: toolOutcomeSchema,
20
20
  });
21
21
  export const executionRecordIds = [Execution.id, ToolExecution.id];
package/src/search.ts CHANGED
@@ -7,7 +7,7 @@ const selection = {
7
7
  limit: z.number().int().positive().max(2000).optional().describe("Maximum returned matching lines, or entries in another resource-specific view; defaults to 500, maximum 2000. Context lines are bounded only by the output-byte budget."),
8
8
  };
9
9
  const globGuidelines = [
10
- "Globs use ripgrep semantics. A pattern without '/' such as '*.md' matches filenames at any depth.",
10
+ "Globs use ripgrep semantics. A pattern without '/' matches filenames at any depth.",
11
11
  "Positive globs override hidden and ignore rules for entries they match. A directory that remains excluded is skipped with its descendants.",
12
12
  ];
13
13
 
@@ -19,7 +19,7 @@ export const Find = defineTool({
19
19
  "target selects the search scope and resource-specific file filtering according to the resource implementation's schema.",
20
20
  ],
21
21
  argsSchema: z.strictObject({
22
- pattern: pattern.describe("File glob relative to the selected search directory, using '/' separators; for example '**/*.ts' or '**/package.json'."),
22
+ pattern: pattern.describe("File glob relative to the selected search directory, using '/' separators."),
23
23
  ...selection,
24
24
  }).describe("A file glob and search selection options."),
25
25
  });
package/src/text.ts CHANGED
@@ -4,15 +4,15 @@ export const lineAnchorSchema = z.strictObject({
4
4
  line: z.number().int().positive().describe("1-based line number copied from an anchored read, grep, edit, or replace result."),
5
5
  hash: z.string().regex(/^[0-9A-HJKMNP-TV-Z]{4}$/).describe("The exact four-character content hash after # in an anchored read, grep, edit, or replace result."),
6
6
  }).describe("A LINE#HASH reference to the current content at one line.");
7
- const body = z.array(z.string().regex(/^[^\r\n]*$/).describe("One content line without a line terminator; an empty string represents a blank line."))
7
+ const body = z.array(z.string().regex(/^[^\r\n]*$/).describe("One line of new content without the LINE#HASH prefix or a line terminator. An empty string represents a blank line."))
8
8
  .min(1).describe("New text lines to insert or use as replacement content.");
9
9
  const anchor = lineAnchorSchema.describe("The first affected line, or the preserved line next to an insertion.");
10
- const end = lineAnchorSchema.optional().describe("Inclusive last line for replace/delete. Required for a multi-line range; omission selects only the anchor line. Validation checks the cited endpoints.");
10
+ const end = lineAnchorSchema.optional().describe("Inclusive last line for replace/delete. Omit only for a single-line edit: without end, even a multi-line body replaces only the anchor line and leaves following lines in place.");
11
11
  export const editOperationSchema = z.discriminatedUnion("op", [
12
12
  z.strictObject({ op: z.literal("replace").describe("Replace the selected lines with body."), anchor, end, body }),
13
13
  z.strictObject({ op: z.literal("delete").describe("Delete the selected lines."), anchor, end }),
14
- z.strictObject({ op: z.literal("insert_after").describe("Insert body after the preserved anchor line. body contains only new lines."), anchor, body }),
15
- z.strictObject({ op: z.literal("insert_before").describe("Insert body before the preserved anchor line. body contains only new lines."), anchor, body }),
14
+ z.strictObject({ op: z.literal("insert_after").describe("Insert only new lines after the anchor line. The existing anchor line stays in place."), anchor, body }),
15
+ z.strictObject({ op: z.literal("insert_before").describe("Insert only new lines before the anchor line. The existing anchor line stays in place."), anchor, body }),
16
16
  z.strictObject({ op: z.literal("append").describe("Append body to the target's text."), body }),
17
17
  z.strictObject({ op: z.literal("prepend").describe("Prepend body to the target's text."), body }),
18
18
  ]).describe("Replace/delete an inclusive anchored range, insert beside a preserved anchor, or append/prepend without anchors.");
package/src/tools.ts CHANGED
@@ -45,18 +45,12 @@ export const Edit = defineTool({
45
45
  name: "edit",
46
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
- "target selects existing editable text according to the resource implementation's schema. args.edits contains the operations.",
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
- "replace/delete affect the inclusive anchor..end range. An omitted end selects one line. Validation checks the cited endpoints.",
51
- "insert_before/insert_after preserve the anchor line. body contains the new lines.",
52
- "append/prepend take body. Each body item is one text line; an empty string represents a blank line.",
53
- "All operations refer to the same pre-edit content and commit as one batch. Anchor or overlap failures preserve the original text.",
54
- "Replace/delete ranges conflict when they share original lines. Insertions can share range boundaries; an insertion strictly inside a replaced or deleted range conflicts. Insertions at the same original gap appear in edits array order.",
55
- "A successful edit reports the line counts and fresh LINE#HASH anchors for subsequent edits. The user-facing result contains the diff.",
56
- "Anchor mismatch results include current-line or shifted candidates.",
48
+ "args.edits can group several changes to the same target in one call. Every operation uses coordinates from the same pre-edit text. Copy anchor and end line numbers and hashes from the latest anchored tool output.",
49
+ "A successful edit returns updated anchors for subsequent edits. Pre-edit anchors below an insertion or deletion may be stale even if the line content did not change.",
50
+ "The batch commits only if all anchors and ranges validate. Replace/delete ranges cannot share original lines. Insertions can share range boundaries but cannot fall inside a replaced or deleted range. Insertions at the same gap follow array order.",
57
51
  ],
58
52
  argsSchema: z.strictObject({
59
- edits: z.array(editOperationSchema).min(1).max(500).describe("One to 500 hashline operations referring to the same current text. Replace/delete ranges have no shared lines; insertions may share boundaries and use array order at the same gap."),
53
+ edits: z.array(editOperationSchema).min(1).max(500).describe("One to 500 operations on the same pre-edit text."),
60
54
  }).describe("A complete batch of line-based edit operations. The target is selected separately."),
61
55
  });
62
56
 
@@ -90,7 +84,7 @@ export const Replace = defineTool({
90
84
  "Literal mode matches find as text and inserts replace verbatim. Regex mode uses JavaScript regular expressions and replacement syntax.",
91
85
  "All non-overlapping matches are replaced. flags applies in both modes; global matching is always enabled.",
92
86
  "No matches returns an error without changing the target. Matches that produce identical content succeed without writing.",
93
- "The receipt reports the match count and fresh anchors for edit. The user-facing result contains the diff.",
87
+ "The receipt reports the match count and updated anchors for subsequent edits.",
94
88
  ],
95
89
  argsSchema: z.strictObject({
96
90
  find: z.string().min(1).describe("Non-empty text to find, or a JavaScript regular expression source when regex is true."),