@asterism-app/builtin-api 0.20.0 → 0.21.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/docs/agents.md CHANGED
@@ -38,7 +38,7 @@ Keep a preparer's scope tied to its business purpose. It does not replace the ag
38
38
 
39
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
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.
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. `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.
42
42
 
43
43
  ## Extend presentation
44
44
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asterism-app/builtin-api",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Public domain contracts and extensions for Asterism built-in features",
5
5
  "license": "MIT",
6
6
  "author": "Chien Zhang",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "files": [
40
40
  "src",
41
- "!src/**/*.test.ts",
41
+ "!**/*.test.*",
42
42
  "docs",
43
43
  "examples",
44
44
  "README.md"
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { modelExpressionSchema, thinkingSchema } from "@asterism-app/sdk/contracts";
3
- const id = z.string().min(1).max(160);
4
3
  /** Configurations use readable slugs for identification by both users and models. */
5
4
  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
5
  export const modelRoleInputSchema = z.strictObject({
@@ -10,23 +9,26 @@ export const modelRoleSchema = modelRoleInputSchema.extend({ id: configurationId
10
9
  export const modelRoleOverridesSchema = modelRoleInputSchema.partial();
11
10
  export type ModelRole = z.infer<typeof modelRoleSchema>;
12
11
  export type ModelRoleOverrides = z.infer<typeof modelRoleOverridesSchema>;
13
- const names = z.array(id).max(200);
12
+ /** Execution limits applied to subagent runs; workbench Agents have no budget. */
13
+ export const agentBudgetSchema = z.strictObject({
14
+ maxRequests: z.number().int().positive(),
15
+ maxDurationSeconds: z.number().int().positive().max(2147483),
16
+ });
17
+ export type AgentBudget = z.infer<typeof agentBudgetSchema>;
14
18
  const agentFieldsSchema = z.strictObject({
15
19
  enabled: z.boolean(), description: z.string().max(20_000), systemPrompt: z.string().max(100_000),
16
- modelRole: configurationIdSchema.nullable(), fallbackRole: configurationIdSchema.nullable(), examples: z.array(z.string().max(4_000)).max(50),
17
- tools: names.nullable(), excludeTools: names.nullable(), subagentRoles: z.array(configurationIdSchema).max(200).nullable(),
18
- maxTurns: z.number().int().positive().nullable(),
20
+ modelRole: configurationIdSchema.nullable(), examples: z.array(z.string().max(4_000)).max(50),
21
+ budget: agentBudgetSchema,
19
22
  });
20
- export const agentInputSchema = agentFieldsSchema.refine(value => value.tools === null || value.excludeTools === null, "Tool allowlist and denylist are mutually exclusive.");
21
- export const agentSchema = agentInputSchema.safeExtend({ id: configurationIdSchema, builtin: z.boolean() });
22
- // Blank text removes the override on save; false, null, and empty lists retain their respective business meanings.
23
- export const agentOverridesSchema = agentFieldsSchema.partial()
24
- .refine(value => value.tools == null || value.excludeTools == null, "Tool allowlist and denylist are mutually exclusive.");
23
+ export const agentInputSchema = agentFieldsSchema;
24
+ export const agentSchema = agentInputSchema.extend({ id: configurationIdSchema, builtin: z.boolean() });
25
+ // Blank text removes the override on save; false, null, and empty lists retain their respective business meanings. Budget fields override individually.
26
+ export const agentOverridesSchema = agentFieldsSchema.extend({ budget: agentBudgetSchema.partial() }).partial();
25
27
 
26
28
  export type AgentConfiguration = z.infer<typeof agentSchema>;
27
29
  export type AgentOverrides = z.infer<typeof agentOverridesSchema>;
28
30
  export const agentSelectionSchema = z.strictObject({
29
- agent: configurationIdSchema.describe("ID of the configuration supplying this Agent's instructions and tool policy."),
31
+ agent: configurationIdSchema.describe("ID of the configuration supplying this Agent's instructions and model role."),
30
32
  model: modelExpressionSchema.nullable().describe("Model for this Agent as provider/model. Null uses the model resolved from its configuration."),
31
33
  thinking: thinkingSchema.nullable().describe("Thinking level for this Agent. Null uses the default resolved from its configuration."),
32
34
  }).describe("The Agent's base configuration and per-instance model settings.");