@asterism-app/builtin-api 0.19.1 → 0.20.0
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 +1 -1
- package/docs/agents.md +17 -1
- package/package.json +10 -2
- package/src/agent-services.ts +25 -0
- package/src/agent.ts +5 -3
- package/src/catalogs.ts +8 -19
- package/src/configuration.ts +7 -0
- package/src/contracts.ts +3 -0
- package/src/messaging.ts +24 -0
- package/src/naming.ts +6 -20
- package/src/peek.ts +31 -0
- package/src/preparation.ts +33 -0
- package/src/prompt.ts +5 -0
- package/src/runtime.ts +2 -1
- package/src/manual.ts +0 -5
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ General hosting facilities belong to the SDK. Built-in-specific behavior belongs
|
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
|
-
Install
|
|
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.
|
|
14
14
|
|
|
15
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.
|
|
16
16
|
|
package/docs/agents.md
CHANGED
|
@@ -4,7 +4,7 @@ The built-in public API lets plugins interact with Asterism's existing agents th
|
|
|
4
4
|
|
|
5
5
|
## Declare the dependency
|
|
6
6
|
|
|
7
|
-
Declare `@asterism-app/builtin-api` and `@asterism-app/sdk` in `peerDependencies` with `"*"
|
|
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.
|
|
8
8
|
|
|
9
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.
|
|
10
10
|
|
|
@@ -18,12 +18,28 @@ Each input submission has a submission identity, parts, a delivery mode, and a s
|
|
|
18
18
|
|
|
19
19
|
File parts use content references with explicit read eligibility. Pass the appropriate content source with the action when forwarding files. Cancellation of the submission is separate from cancellation of the agent's independent execution, which has its own public action.
|
|
20
20
|
|
|
21
|
+
## Implement communication resources
|
|
22
|
+
|
|
23
|
+
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.
|
|
24
|
+
|
|
25
|
+
For cross-session messaging, obtain the target session executor and submit input through the agent's public action. The public agent service supplies an agent's configured type and investigates its saved records without exposing private agent state. Obtain it from the plugin context, pass a resolved agent reference, and forward cancellation and investigation progress. Investigation captures a fresh record snapshot and does not start a turn on the target.
|
|
26
|
+
|
|
27
|
+
Mesh messages retain internal sender attribution in history and project the channel name, sender name, and numeric disambiguator to the receiving model. A sender not exposed to the channel is marked as not visible. The message itself does not grant a reply route.
|
|
28
|
+
|
|
29
|
+
Communication resources own their member directory and task descriptions. Resolve member names and any disambiguators against the request's captured access scope before calling agent services. Read current task descriptions when handling an operation; identity resolution and mutable profile text have separate lifetimes.
|
|
30
|
+
|
|
21
31
|
## Prepare incoming input
|
|
22
32
|
|
|
23
33
|
An external preparer can inspect, replace, or reject input using the original built-in action contract. Its replacement supplies raw action input that will be parsed again. Preparation has read capabilities and does not commit session mutations.
|
|
24
34
|
|
|
25
35
|
Keep a preparer's scope tied to its business purpose. It does not replace the agent implementation or acquire a private agent executor.
|
|
26
36
|
|
|
37
|
+
## Prepare model requests
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
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 and tool batch. Removing a skill from that result also makes it unavailable to `skill_read` for that request. A catalog refresh affects later requests.
|
|
42
|
+
|
|
27
43
|
## Extend presentation
|
|
28
44
|
|
|
29
45
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asterism-app/builtin-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Public domain contracts and extensions for Asterism built-in features",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Chien Zhang",
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
"registry": "https://registry.npmjs.org/"
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
|
+
"asterism": {
|
|
19
|
+
"manual": [
|
|
20
|
+
"docs",
|
|
21
|
+
"examples"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
18
24
|
"exports": {
|
|
19
25
|
"./contracts": "./src/contracts.ts",
|
|
20
26
|
"./renderer": "./src/renderer.ts",
|
|
@@ -26,7 +32,9 @@
|
|
|
26
32
|
"zod": "^4.6.5"
|
|
27
33
|
},
|
|
28
34
|
"peerDependenciesMeta": {
|
|
29
|
-
"react": {
|
|
35
|
+
"react": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
30
38
|
},
|
|
31
39
|
"files": [
|
|
32
40
|
"src",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { ResourceRef, SessionDirectory } from "@asterism-app/sdk/contracts";
|
|
3
|
+
import { PluginApiError, type CallResult, type PluginContext } from "@asterism-app/sdk/runtime";
|
|
4
|
+
import type { Peek, PeekResult } from "./peek.ts";
|
|
5
|
+
|
|
6
|
+
/** Agent-owned operations for trusted plugins that have resolved an authorized resource reference. */
|
|
7
|
+
export interface AgentServices {
|
|
8
|
+
describe(target: ResourceRef): { type: string };
|
|
9
|
+
peek(target: ResourceRef, args: z.infer<typeof Peek.argsSchema>, signal: AbortSignal,
|
|
10
|
+
publish: (data: PeekResult) => void): Promise<CallResult<PeekResult>>;
|
|
11
|
+
}
|
|
12
|
+
const services = new WeakMap<SessionDirectory, AgentServices>();
|
|
13
|
+
|
|
14
|
+
export function registerAgentServices(plugin: PluginContext, value: AgentServices): void {
|
|
15
|
+
if (services.has(plugin.sessions)) throw new PluginApiError("conflict", "Agent services are already registered.");
|
|
16
|
+
services.set(plugin.sessions, value);
|
|
17
|
+
plugin.lifetime.signal.addEventListener("abort", () => services.delete(plugin.sessions), { once: true });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function agentServices(plugin: PluginContext): AgentServices {
|
|
21
|
+
plugin.lifetime.signal.throwIfAborted();
|
|
22
|
+
const value = services.get(plugin.sessions);
|
|
23
|
+
if (!value) throw new PluginApiError("unavailable", "Agent services are unavailable.");
|
|
24
|
+
return value;
|
|
25
|
+
}
|
package/src/agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineCreation, defineAction } from "@asterism-app/sdk/contracts";
|
|
1
|
+
import { defineCreation, defineAction, defineCall } from "@asterism-app/sdk/contracts";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { builtin } from "./identity.ts";
|
|
4
4
|
import { userInputPartsSchema } from "./input.ts";
|
|
@@ -9,12 +9,14 @@ import { agentMessageSenderSchema } from "./messaging.ts";
|
|
|
9
9
|
export const Agent = builtin.resource("agent", z.object({}));
|
|
10
10
|
/** The built-in agent preset selected by default when starting from the home page. */
|
|
11
11
|
export const defaultAgentPreset = "worker";
|
|
12
|
-
/** The host draft target for the first submission from the home page; this is not an action routable to an existing object. */
|
|
13
|
-
export const startAgentContentTarget = { contractId: builtin.name("session.start"), resourceKind: Agent.kind } as const;
|
|
14
12
|
/** Pending input is delivered at request or turn boundaries; execution starts immediately when idle. */
|
|
15
13
|
export const agentInputModeSchema = z.enum(["steer", "follow"]);
|
|
16
14
|
/** Submissions and drafts share a 16-character Nano ID identity. */
|
|
17
15
|
export const submissionIdSchema = z.string().regex(/^[A-Za-z0-9_-]{16}$/u);
|
|
16
|
+
export const StartAgentSession = defineCall(builtin.name("session.start"), {
|
|
17
|
+
scope: "plugin", input: z.strictObject({ submissionId: submissionIdSchema, selection: agentSelectionSchema, parts: userInputPartsSchema }),
|
|
18
|
+
output: z.strictObject({ sessionId: z.string().min(1) }),
|
|
19
|
+
});
|
|
18
20
|
/** title is optional; when omitted, the creation entry point generates a random display name. */
|
|
19
21
|
export const agentCreateSchema = z.strictObject({
|
|
20
22
|
selection: agentSelectionSchema,
|
package/src/catalogs.ts
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { agentSchema, type AgentSelection } from "./configuration.ts";
|
|
4
|
-
import { builtin } from "./identity.ts";
|
|
1
|
+
import { modelReference, resolveModelSelection, type CatalogModel, type ModelCatalogSnapshot } from "@asterism-app/sdk/contracts";
|
|
2
|
+
import type { AgentConfiguration, AgentSelection, ModelRole } from "./configuration.ts";
|
|
5
3
|
|
|
6
|
-
/**
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
generation: z.object({ maxOutputTokens: z.number().nullable() }),
|
|
13
|
-
capabilities: z.object({ reasoning: z.boolean(), tools: z.boolean(), thinkingLevels: z.array(thinkingSchema) }),
|
|
14
|
-
});
|
|
15
|
-
const roleSchema = z.object({ id: z.string(), enabled: z.boolean(), model: z.string().nullable(), thinking: thinkingSchema.nullable() });
|
|
16
|
-
export const ModelConfiguration = builtin.data("model.configuration", z.object({
|
|
17
|
-
modelProviders: z.array(modelProviderSchema), models: z.array(modelSchema), roles: z.array(roleSchema), agents: z.array(agentSchema),
|
|
18
|
-
}));
|
|
19
|
-
export type ModelConfigurationSnapshot = z.infer<typeof ModelConfiguration.schema>;
|
|
20
|
-
export type CatalogModel = z.infer<typeof modelSchema>;
|
|
4
|
+
/** Builtin combines host model metadata with its own effective configuration. */
|
|
5
|
+
export interface ModelConfigurationSnapshot extends ModelCatalogSnapshot {
|
|
6
|
+
roles: Pick<ModelRole, "id" | "enabled" | "model" | "thinking">[];
|
|
7
|
+
agents: AgentConfiguration[];
|
|
8
|
+
}
|
|
9
|
+
export type { CatalogModel } from "@asterism-app/sdk/contracts";
|
|
21
10
|
|
|
22
11
|
export function resolveCatalogModel<M extends CatalogModel>(snapshot: Omit<ModelConfigurationSnapshot, "models"> & { models: M[] }, reference: string | null): M | null {
|
|
23
12
|
return snapshot.models.find(model => model.enabled && modelReference(model) === reference
|
package/src/configuration.ts
CHANGED
|
@@ -3,6 +3,13 @@ import { modelExpressionSchema, thinkingSchema } from "@asterism-app/sdk/contrac
|
|
|
3
3
|
const id = z.string().min(1).max(160);
|
|
4
4
|
/** Configurations use readable slugs for identification by both users and models. */
|
|
5
5
|
export const configurationIdSchema = z.string().trim().min(1).max(160).regex(/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/u, "Use lowercase letters, digits, hyphens or underscores.");
|
|
6
|
+
export const modelRoleInputSchema = z.strictObject({
|
|
7
|
+
model: modelExpressionSchema.nullable(), thinking: thinkingSchema.nullable(), enabled: z.boolean(), description: z.string().max(20_000), hidden: z.boolean(),
|
|
8
|
+
});
|
|
9
|
+
export const modelRoleSchema = modelRoleInputSchema.extend({ id: configurationIdSchema, builtin: z.boolean() });
|
|
10
|
+
export const modelRoleOverridesSchema = modelRoleInputSchema.partial();
|
|
11
|
+
export type ModelRole = z.infer<typeof modelRoleSchema>;
|
|
12
|
+
export type ModelRoleOverrides = z.infer<typeof modelRoleOverridesSchema>;
|
|
6
13
|
const names = z.array(id).max(200);
|
|
7
14
|
const agentFieldsSchema = z.strictObject({
|
|
8
15
|
enabled: z.boolean(), description: z.string().max(20_000), systemPrompt: z.string().max(100_000),
|
package/src/contracts.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./identity.ts";
|
|
2
2
|
export * from "./agent.ts";
|
|
3
3
|
export * from "./messaging.ts";
|
|
4
|
+
export * from "./peek.ts";
|
|
4
5
|
export * from "./text.ts";
|
|
5
6
|
export * from "./tools.ts";
|
|
6
7
|
export * from "./search.ts";
|
|
@@ -11,3 +12,5 @@ export * from "./request-context.ts";
|
|
|
11
12
|
export * from "./naming.ts";
|
|
12
13
|
export * from "./catalogs.ts";
|
|
13
14
|
export * from "./creations.ts";
|
|
15
|
+
|
|
16
|
+
export type * from "./prompt.ts";
|
package/src/messaging.ts
CHANGED
|
@@ -9,6 +9,10 @@ export const agentMessageSenderSchema = z.discriminatedUnion("kind", [
|
|
|
9
9
|
kind: z.literal("agent"),
|
|
10
10
|
resource: z.strictObject({ sessionId: z.string().min(1), id: z.string().min(1), kind: z.string().min(1) }),
|
|
11
11
|
name: z.string().min(1),
|
|
12
|
+
mesh: z.strictObject({
|
|
13
|
+
channel: z.string().min(1),
|
|
14
|
+
id: z.number().int().nonnegative().nullable(),
|
|
15
|
+
}).optional().describe("Mesh channel name and sender's numeric name disambiguator. Null means the sender is not exposed to the channel."),
|
|
12
16
|
}),
|
|
13
17
|
]);
|
|
14
18
|
export type AgentMessageSender = z.infer<typeof agentMessageSenderSchema>;
|
|
@@ -28,3 +32,23 @@ export const Send = defineTool({
|
|
|
28
32
|
.describe("Message text for the recipient Agent."),
|
|
29
33
|
}).describe("The message to send."),
|
|
30
34
|
});
|
|
35
|
+
|
|
36
|
+
export const sendResultSchema = z.strictObject({ name: z.string() })
|
|
37
|
+
.describe("Recipient Agent name for the accepted message. Processing proceeds independently.");
|
|
38
|
+
export type SendResult = z.infer<typeof sendResultSchema>;
|
|
39
|
+
|
|
40
|
+
export const GetProfile = defineTool({
|
|
41
|
+
id: builtin.name("tool.get_profile"), name: "get_profile",
|
|
42
|
+
description: "Read an Agent's name, configured type, and task description through a resource.",
|
|
43
|
+
guidelines: ["Null target selects your own profile on this resource. Other targets follow the resource's addressing schema."],
|
|
44
|
+
argsSchema: z.strictObject({}).describe("Empty parameter object."),
|
|
45
|
+
});
|
|
46
|
+
export const SetProfile = defineTool({
|
|
47
|
+
id: builtin.name("tool.set_profile"), name: "set_profile",
|
|
48
|
+
description: "Set your own task description on this resource.",
|
|
49
|
+
guidelines: ["The runtime identifies the caller. Name and configured Agent type come from the Agent.",
|
|
50
|
+
"Descriptions belong to this resource. An empty description clears your description."],
|
|
51
|
+
argsSchema: z.strictObject({
|
|
52
|
+
description: z.string().trim().max(1000).describe("A brief description of your current task. Empty text clears it."),
|
|
53
|
+
}).describe("Your task description on this resource."),
|
|
54
|
+
});
|
package/src/naming.ts
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { defineRecord } from "@asterism-app/sdk/contracts";
|
|
3
2
|
import { builtin } from "./identity.ts";
|
|
4
3
|
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
title: z.string().min(1).max(160),
|
|
12
|
-
source: z.enum(["user", "agent", "auto"]),
|
|
13
|
-
auto: z.strictObject({
|
|
14
|
-
level: z.enum(["initial", "refined"]),
|
|
15
|
-
messageId: z.string(),
|
|
16
|
-
model: z.string(),
|
|
17
|
-
}).optional(),
|
|
18
|
-
}).refine(data => (data.source === "auto") === (data.auto !== undefined), "Only automatic names carry naming metadata."),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export interface NamingApi {
|
|
22
|
-
nameByUser(sessionId: string, title: string): void;
|
|
23
|
-
}
|
|
4
|
+
/** Provenance attached to a host title assignment generated by the builtin paradigm. */
|
|
5
|
+
export const AutomaticSessionName = builtin.data("session.automatic-name", z.strictObject({
|
|
6
|
+
level: z.enum(["initial", "refined"]),
|
|
7
|
+
messageId: z.string(),
|
|
8
|
+
model: z.string(),
|
|
9
|
+
}));
|
package/src/peek.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineTool, jsonSchema, modelCompletionSchema, modelSourceSchema } from "@asterism-app/sdk/contracts";
|
|
3
|
+
import { builtin } from "./identity.ts";
|
|
4
|
+
|
|
5
|
+
export const Peek = defineTool({
|
|
6
|
+
id: builtin.name("tool.peek"), name: "peek",
|
|
7
|
+
description: "Investigate an Agent's saved timeline records and return a focused report using the utility model.",
|
|
8
|
+
guidelines: [
|
|
9
|
+
"target selects an Agent according to the resource implementation's schema.",
|
|
10
|
+
"question describes the information to locate and includes context for follow-up questions.",
|
|
11
|
+
"Each call reads a fresh, fixed snapshot of the selected Agent's current timeline, including records preceding context compression.",
|
|
12
|
+
"includeThinking admits saved readable thinking into the investigation; its default is false.",
|
|
13
|
+
],
|
|
14
|
+
argsSchema: z.strictObject({
|
|
15
|
+
question: z.string().trim().min(1).describe("The question to investigate in this Agent's saved records."),
|
|
16
|
+
includeThinking: z.boolean().optional().describe("Include saved readable thinking. Defaults to false."),
|
|
17
|
+
}).describe("Question and optional access to saved readable thinking."),
|
|
18
|
+
});
|
|
19
|
+
export const peekResultSchema = z.strictObject({
|
|
20
|
+
snapshot: z.strictObject({ nodeId: z.string().nullable(), capturedAt: z.string(), records: z.number().int().nonnegative() }),
|
|
21
|
+
phase: z.enum(["investigating", "thinking", "searching", "reading", "writing", "done"]),
|
|
22
|
+
report: z.string(),
|
|
23
|
+
round: z.number().int().nonnegative(),
|
|
24
|
+
requests: z.array(z.strictObject({ source: modelSourceSchema.nullable(), completion: modelCompletionSchema })),
|
|
25
|
+
queries: z.array(z.strictObject({ tool: z.string(), arguments: jsonSchema, records: z.array(z.string()) })),
|
|
26
|
+
}).describe("Investigation progress or report, fixed snapshot position, request measurements and retrieved record references.");
|
|
27
|
+
export type PeekResult = z.infer<typeof peekResultSchema>;
|
|
28
|
+
|
|
29
|
+
export function peekToModel(data: PeekResult): string {
|
|
30
|
+
return `Snapshot: ${data.snapshot.capturedAt}; timeline position: ${data.snapshot.nodeId ?? "origin"}.\n${data.report}`;
|
|
31
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { SessionDirectory } from "@asterism-app/sdk/contracts";
|
|
2
|
+
import { defineModule, PluginApiError, type AgentSkill, type PluginContext } from "@asterism-app/sdk/runtime";
|
|
3
|
+
|
|
4
|
+
import type { AgentPromptBlock } from "./prompt.ts";
|
|
5
|
+
export type { AgentPromptBlock } from "./prompt.ts";
|
|
6
|
+
export interface AgentPreparation {
|
|
7
|
+
skills: readonly AgentSkill[];
|
|
8
|
+
blocks: AgentPromptBlock[];
|
|
9
|
+
}
|
|
10
|
+
interface Preparer { id: string; prepare(value: AgentPreparation): void }
|
|
11
|
+
const directories = new WeakMap<SessionDirectory, Map<string, Preparer>>();
|
|
12
|
+
function entries(plugin: PluginContext) {
|
|
13
|
+
let value = directories.get(plugin.sessions);
|
|
14
|
+
if (!value) { value = new Map(); directories.set(plugin.sessions, value); }
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
/** Synchronous pure transformations run in plugin initialization order and retain entry provenance. */
|
|
18
|
+
export function defineAgentPreparer(definition: Preparer) {
|
|
19
|
+
return defineModule(plugin => {
|
|
20
|
+
const registry = entries(plugin), id = `${plugin.id}:${definition.id}`;
|
|
21
|
+
if (!definition.id.trim() || registry.has(id)) throw new PluginApiError("conflict", `Duplicate or empty Agent preparer: ${id}`);
|
|
22
|
+
registry.set(id, definition);
|
|
23
|
+
plugin.lifetime.signal.addEventListener("abort", () => registry.delete(id), { once: true });
|
|
24
|
+
return {};
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export function captureAgentPreparers(plugin: PluginContext) {
|
|
28
|
+
const preparers = [...entries(plugin).values()];
|
|
29
|
+
return (value: AgentPreparation): AgentPreparation => {
|
|
30
|
+
for (const preparer of preparers) preparer.prepare(value);
|
|
31
|
+
return value;
|
|
32
|
+
};
|
|
33
|
+
}
|
package/src/prompt.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type AgentPromptBlock = (
|
|
2
|
+
| { id: string; kind: "system"; from: string; text: string }
|
|
3
|
+
| { id: string; kind: "agent"; role: string; text: string }
|
|
4
|
+
| { id: string; kind: "context"; file: string; text: string }
|
|
5
|
+
) & { source: { id: string; plugin: string | null } };
|
package/src/runtime.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { z } from "zod";
|
|
|
2
2
|
import { belongsTo, jsonSchema, type CreationContract, type Json, type SessionDirectory } from "@asterism-app/sdk/contracts";
|
|
3
3
|
import { defineModule, PluginApiError, type PluginContext, type PluginModule, type ObjectReader, type TopLevelToolContext } from "@asterism-app/sdk/runtime";
|
|
4
4
|
|
|
5
|
-
export type
|
|
5
|
+
export { agentServices, registerAgentServices, type AgentServices } from "./agent-services.ts";
|
|
6
|
+
export { defineAgentPreparer, captureAgentPreparers, type AgentPreparation, type AgentPromptBlock } from "./preparation.ts";
|
|
6
7
|
|
|
7
8
|
export interface AgentCreationDescription {
|
|
8
9
|
readonly id: string;
|