experimental-ash 0.6.2 → 0.7.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.
Files changed (64) hide show
  1. package/README.md +3 -4
  2. package/dist/docs/internals/discovery.md +2 -2
  3. package/dist/docs/internals/mechanical-invariants.md +1 -1
  4. package/dist/docs/internals/testing.md +1 -1
  5. package/dist/docs/public/README.md +1 -1
  6. package/dist/docs/public/agent-ts.md +2 -2
  7. package/dist/docs/public/channels/README.md +1 -1
  8. package/dist/docs/public/context-control.md +20 -20
  9. package/dist/docs/public/getting-started.md +1 -1
  10. package/dist/docs/public/project-layout.md +21 -21
  11. package/dist/docs/public/schedules.md +1 -1
  12. package/dist/docs/public/skills.md +3 -3
  13. package/dist/docs/public/subagents.md +3 -3
  14. package/dist/docs/public/typescript-api.md +2 -2
  15. package/dist/src/chunks/{dev-authored-source-watcher-MDHwWfTE.js → dev-authored-source-watcher-HzOplr1S.js} +1 -1
  16. package/dist/src/chunks/{host-CDvE1sV_.js → host-Ca8xvEQ1.js} +2 -2
  17. package/dist/src/chunks/paths-BiY7uVwD.js +88 -0
  18. package/dist/src/chunks/{prewarm-CCU5VjXa.js → prewarm-DiZ_sYLy.js} +1 -1
  19. package/dist/src/cli/commands/info.js +1 -1
  20. package/dist/src/cli/run.js +1 -1
  21. package/dist/src/compiler/compile-agent.js +10 -0
  22. package/dist/src/compiler/manifest.d.ts +8 -7
  23. package/dist/src/compiler/manifest.js +5 -5
  24. package/dist/src/compiler/normalize-instructions.d.ts +12 -0
  25. package/dist/src/compiler/normalize-instructions.js +28 -0
  26. package/dist/src/compiler/normalize-manifest.js +3 -3
  27. package/dist/src/discover/discover-agent.d.ts +2 -2
  28. package/dist/src/discover/discover-agent.js +5 -5
  29. package/dist/src/discover/discover-subagent.js +4 -4
  30. package/dist/src/discover/filesystem.d.ts +4 -4
  31. package/dist/src/discover/filesystem.js +30 -0
  32. package/dist/src/discover/grammar.d.ts +21 -7
  33. package/dist/src/discover/grammar.js +79 -21
  34. package/dist/src/discover/manifest.d.ts +11 -8
  35. package/dist/src/discover/manifest.js +2 -2
  36. package/dist/src/evals/cli/eval.js +1 -1
  37. package/dist/src/internal/application/package.js +1 -1
  38. package/dist/src/internal/authored-definition/core.d.ts +7 -6
  39. package/dist/src/internal/authored-definition/core.js +6 -5
  40. package/dist/src/internal/nitro/routes/home-page/build-home-page-response.d.ts +5 -5
  41. package/dist/src/internal/nitro/routes/home-page/build-home-page-response.js +16 -15
  42. package/dist/src/internal/nitro/routes/home-page/load-home-page-data.d.ts +2 -2
  43. package/dist/src/internal/nitro/routes/web-ui/assets/{index-z8flAc4k.js → index-BQa8fbHJ.js} +1 -1
  44. package/dist/src/internal/nitro/routes/web-ui/index.html +1 -1
  45. package/dist/src/public/definitions/instructions.d.ts +29 -0
  46. package/dist/src/public/definitions/instructions.js +12 -0
  47. package/dist/src/public/helpers/markdown.d.ts +5 -5
  48. package/dist/src/public/helpers/markdown.js +7 -7
  49. package/dist/src/public/instructions/index.d.ts +8 -0
  50. package/dist/src/public/instructions/index.js +6 -0
  51. package/dist/src/runtime/agent/bootstrap.js +3 -3
  52. package/dist/src/runtime/prompt/compose.d.ts +5 -4
  53. package/dist/src/runtime/prompt/compose.js +6 -6
  54. package/dist/src/runtime/resolve-agent.js +10 -10
  55. package/dist/src/runtime/types.d.ts +10 -7
  56. package/package.json +9 -4
  57. package/dist/src/chunks/paths-D1gMcyWw.js +0 -88
  58. package/dist/src/compiler/normalize-system.d.ts +0 -11
  59. package/dist/src/compiler/normalize-system.js +0 -27
  60. package/dist/src/public/definitions/system.d.ts +0 -16
  61. package/dist/src/public/definitions/system.js +0 -7
  62. package/dist/src/public/system/index.d.ts +0 -4
  63. package/dist/src/public/system/index.js +0 -4
  64. /package/dist/src/cli/templates/init-app/agent/{system.md → instructions.md} +0 -0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Public definition for an instructions prompt authored in markdown or
3
+ * TypeScript.
4
+ *
5
+ * Authored at the agent root as either `instructions.md` or
6
+ * `instructions.{ts,cts,mts,js,cjs,mjs}`. Module-backed instructions
7
+ * sources execute once at build time — the resulting markdown is captured
8
+ * into the compiled manifest. Authored definitions do not carry a `name`
9
+ * field.
10
+ */
11
+ export interface InstructionsDefinition {
12
+ markdown: string;
13
+ }
14
+ /**
15
+ * Defines an instructions prompt in TypeScript using the same shape
16
+ * discovery produces from markdown.
17
+ */
18
+ export declare function defineInstructions<TInstructions extends InstructionsDefinition>(definition: TInstructions): TInstructions;
19
+ /**
20
+ * @deprecated Use {@link InstructionsDefinition} instead. The authored
21
+ * file slot was renamed from `system.{md,ts,...}` to
22
+ * `instructions.{md,ts,...}`.
23
+ */
24
+ export type SystemDefinition = InstructionsDefinition;
25
+ /**
26
+ * @deprecated Use {@link defineInstructions} instead. The authored file
27
+ * slot was renamed from `system.{md,ts,...}` to `instructions.{md,ts,...}`.
28
+ */
29
+ export declare const defineSystem: typeof defineInstructions;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Defines an instructions prompt in TypeScript using the same shape
3
+ * discovery produces from markdown.
4
+ */
5
+ export function defineInstructions(definition) {
6
+ return definition;
7
+ }
8
+ /**
9
+ * @deprecated Use {@link defineInstructions} instead. The authored file
10
+ * slot was renamed from `system.{md,ts,...}` to `instructions.{md,ts,...}`.
11
+ */
12
+ export const defineSystem = defineInstructions;
@@ -1,6 +1,6 @@
1
1
  import { type ScheduleDefinition } from "#public/definitions/schedule.js";
2
2
  import { type SkillDefinition } from "#public/definitions/skill.js";
3
- import { type SystemDefinition } from "#public/definitions/system.js";
3
+ import { type InstructionsDefinition } from "#public/definitions/instructions.js";
4
4
  /**
5
5
  * Parsed markdown document with optional YAML frontmatter.
6
6
  */
@@ -24,11 +24,11 @@ export interface ParsedMarkdownDocument {
24
24
  */
25
25
  export declare function parseMarkdownDocument(source: string): ParsedMarkdownDocument;
26
26
  /**
27
- * Lowers authored system prompt markdown into the shared public definition
28
- * shape. System identity is path-derived, so the lowered definition never
29
- * carries a `name`.
27
+ * Lowers authored instructions prompt markdown into the shared public
28
+ * definition shape. Instructions identity is path-derived, so the lowered
29
+ * definition never carries a `name`.
30
30
  */
31
- export declare function lowerSystemMarkdown(markdown: string): SystemDefinition;
31
+ export declare function lowerInstructionsMarkdown(markdown: string): InstructionsDefinition;
32
32
  /**
33
33
  * Optional input for {@link lowerSkillMarkdown}.
34
34
  *
@@ -1,9 +1,9 @@
1
1
  import grayMatter from "gray-matter";
2
- import { normalizeScheduleDefinition, normalizeSkillDefinition, normalizeSystemDefinition, } from "#internal/authored-definition/core.js";
2
+ import { normalizeScheduleDefinition, normalizeSkillDefinition, normalizeInstructionsDefinition, } from "#internal/authored-definition/core.js";
3
3
  import { isObject } from "#shared/guards.js";
4
4
  import { defineSchedule } from "#public/definitions/schedule.js";
5
5
  import { defineSkill } from "#public/definitions/skill.js";
6
- import { defineSystem } from "#public/definitions/system.js";
6
+ import { defineInstructions, } from "#public/definitions/instructions.js";
7
7
  const CLOSED_FRONTMATTER_PATTERN = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/;
8
8
  /**
9
9
  * Parses markdown with optional YAML frontmatter.
@@ -36,12 +36,12 @@ export function parseMarkdownDocument(source) {
36
36
  };
37
37
  }
38
38
  /**
39
- * Lowers authored system prompt markdown into the shared public definition
40
- * shape. System identity is path-derived, so the lowered definition never
41
- * carries a `name`.
39
+ * Lowers authored instructions prompt markdown into the shared public
40
+ * definition shape. Instructions identity is path-derived, so the lowered
41
+ * definition never carries a `name`.
42
42
  */
43
- export function lowerSystemMarkdown(markdown) {
44
- return defineSystem(normalizeSystemDefinition({ markdown }, "Expected authored system markdown to match the public Ash shape."));
43
+ export function lowerInstructionsMarkdown(markdown) {
44
+ return defineInstructions(normalizeInstructionsDefinition({ markdown }, "Expected authored instructions markdown to match the public Ash shape."));
45
45
  }
46
46
  /**
47
47
  * Lowers authored skill markdown into the shared public definition shape.
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Instructions prompt authoring helpers for `agent/instructions.ts` files.
3
+ */
4
+ export { defineInstructions, type InstructionsDefinition,
5
+ /** @deprecated Use {@link defineInstructions} instead. */
6
+ defineSystem,
7
+ /** @deprecated Use {@link InstructionsDefinition} instead. */
8
+ type SystemDefinition, } from "#public/definitions/instructions.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Instructions prompt authoring helpers for `agent/instructions.ts` files.
3
+ */
4
+ export { defineInstructions,
5
+ /** @deprecated Use {@link defineInstructions} instead. */
6
+ defineSystem, } from "#public/definitions/instructions.js";
@@ -19,7 +19,7 @@ export function createResolvedRuntimeTurnAgent(input) {
19
19
  id: agent.config.name,
20
20
  instructions: composeRuntimeBasePrompt({
21
21
  connections: agent.connections,
22
- system: agent.system,
22
+ instructions: agent.instructions,
23
23
  skills: agent.skills,
24
24
  toolsAvailable: input.tools.length > 0,
25
25
  workspaceSpec: agent.workspaceSpec,
@@ -39,8 +39,8 @@ function createResolvedTurnMetadata(agent) {
39
39
  ...agent.config.metadata,
40
40
  };
41
41
  }
42
- if (agent.system !== undefined) {
43
- metadata.systemName = agent.system.name;
42
+ if (agent.instructions !== undefined) {
43
+ metadata.instructionsName = agent.instructions.name;
44
44
  }
45
45
  if (agent.skills.length > 0) {
46
46
  metadata.skillNames = agent.skills.map((skill) => skill.name);
@@ -1,17 +1,18 @@
1
- import type { ResolvedConnectionDefinition, ResolvedSkillDefinition, ResolvedSystem } from "#runtime/types.js";
1
+ import type { ResolvedConnectionDefinition, ResolvedInstructions, ResolvedSkillDefinition } from "#runtime/types.js";
2
2
  import type { WorkspaceRuntimeSpec } from "#runtime/workspace/types.js";
3
3
  /**
4
- * Input for composing the base authored system prompt for one resolved agent.
4
+ * Input for composing the base authored instructions prompt for one
5
+ * resolved agent.
5
6
  */
6
7
  export interface ComposeRuntimeBasePromptInput {
7
8
  connections?: readonly ResolvedConnectionDefinition[];
8
- system?: ResolvedSystem;
9
+ instructions?: ResolvedInstructions;
9
10
  skills?: readonly ResolvedSkillDefinition[];
10
11
  toolsAvailable?: boolean;
11
12
  workspaceSpec?: WorkspaceRuntimeSpec;
12
13
  }
13
14
  /**
14
- * Composes the authored base prompt from the resolved system source
15
+ * Composes the authored base prompt from the resolved instructions source
15
16
  * without flattening skills into always-on instructions.
16
17
  */
17
18
  export declare function composeRuntimeBasePrompt(input: ComposeRuntimeBasePromptInput): readonly string[];
@@ -3,27 +3,27 @@ import { createWorkspacePromptSection } from "#runtime/workspace/spec.js";
3
3
  import { formatConnectionsSection } from "#runtime/prompt/connections.js";
4
4
  const PARALLEL_ACTION_INSTRUCTION = "Tool execution\nA single tool or subagent call runs as one serial action. If you call multiple independent tools or subagents in one response, Ash treats that batch as parallel work. Only batch work that is independent and does not rely on another call in the same response.";
5
5
  /**
6
- * Composes the authored base prompt from the resolved system source
6
+ * Composes the authored base prompt from the resolved instructions source
7
7
  * without flattening skills into always-on instructions.
8
8
  */
9
9
  export function composeRuntimeBasePrompt(input) {
10
10
  return [
11
- ...createSystemPromptBlocks(input.system),
11
+ ...createInstructionsPromptBlocks(input.instructions),
12
12
  ...createWorkspacePromptBlocks(input.workspaceSpec),
13
13
  ...(input.toolsAvailable ? [PARALLEL_ACTION_INSTRUCTION] : []),
14
14
  ...createConnectionsPromptBlocks(input.connections),
15
15
  ...createSkillsPromptBlocks(input.skills),
16
16
  ];
17
17
  }
18
- function createSystemPromptBlocks(system) {
19
- if (system === undefined) {
18
+ function createInstructionsPromptBlocks(instructions) {
19
+ if (instructions === undefined) {
20
20
  return [];
21
21
  }
22
- const markdown = system.markdown.trim();
22
+ const markdown = instructions.markdown.trim();
23
23
  if (markdown.length === 0) {
24
24
  return [];
25
25
  }
26
- return [`System (${system.name})\n${markdown}`];
26
+ return [`Instructions (${instructions.name})\n${markdown}`];
27
27
  }
28
28
  function createWorkspacePromptBlocks(workspaceSpec) {
29
29
  if (workspaceSpec === undefined) {
@@ -41,7 +41,7 @@ export async function resolveAgent(input) {
41
41
  const authoredSandbox = input.manifest.sandbox === null
42
42
  ? null
43
43
  : await resolveSandboxDefinition(input.manifest.sandbox, input.moduleMap, input.nodeId);
44
- const system = createResolvedSystem(input.manifest.system);
44
+ const instructions = createResolvedInstructions(input.manifest.instructions);
45
45
  const workspaceResourceRoot = input.manifest.workspaceResourceRoot;
46
46
  const resolvedAgent = {
47
47
  channels: resolvedChannels,
@@ -61,21 +61,21 @@ export async function resolveAgent(input) {
61
61
  tools: resolvedTools,
62
62
  workspaceSpec: { rootEntries: [...workspaceResourceRoot.rootEntries] },
63
63
  };
64
- if (system !== undefined) {
65
- return { ...resolvedAgent, system };
64
+ if (instructions !== undefined) {
65
+ return { ...resolvedAgent, instructions };
66
66
  }
67
67
  return resolvedAgent;
68
68
  }
69
- function createResolvedSystem(system) {
70
- if (system === undefined) {
69
+ function createResolvedInstructions(instructions) {
70
+ if (instructions === undefined) {
71
71
  return undefined;
72
72
  }
73
73
  return {
74
- name: system.name,
75
- logicalPath: system.logicalPath,
76
- markdown: system.markdown,
77
- sourceId: system.sourceId,
78
- sourceKind: system.sourceKind,
74
+ name: instructions.name,
75
+ logicalPath: instructions.logicalPath,
76
+ markdown: instructions.markdown,
77
+ sourceId: instructions.sourceId,
78
+ sourceKind: instructions.sourceKind,
79
79
  };
80
80
  }
81
81
  function createResolvedAgentConfig(manifest) {
@@ -21,12 +21,14 @@ import type { SandboxSession } from "#shared/sandbox-session.js";
21
21
  */
22
22
  export type ResolvedModuleSourceRef = Readonly<ModuleSourceRef>;
23
23
  /**
24
- * Authored system prompt resolved from `system.md` or `system.{ts,...}`.
24
+ * Authored instructions prompt resolved from `instructions.md` or
25
+ * `instructions.{ts,...}`.
25
26
  *
26
- * Module-backed system sources are executed once at build time — the resulting
27
- * markdown is captured here. Runtime never re-evaluates the module.
27
+ * Module-backed instructions sources are executed once at build time —
28
+ * the resulting markdown is captured here. Runtime never re-evaluates
29
+ * the module.
28
30
  */
29
- export type ResolvedSystem = Readonly<SourceRef & {
31
+ export type ResolvedInstructions = Readonly<SourceRef & {
30
32
  name: string;
31
33
  markdown: string;
32
34
  } & (Omit<MarkdownSourceRef<undefined>, "definition"> | ModuleSourceRef)>;
@@ -232,10 +234,11 @@ export interface ResolvedAgent {
232
234
  readonly disabledFrameworkTools: readonly string[];
233
235
  readonly metadata: ResolvedAgentMetadata;
234
236
  /**
235
- * Authored system prompt resolved from `system.md` or `system.{ts,...}`,
236
- * or `undefined` when the agent does not declare one.
237
+ * Authored instructions prompt resolved from `instructions.md` or
238
+ * `instructions.{ts,...}`, or `undefined` when the agent does not
239
+ * declare one.
237
240
  */
238
- readonly system?: ResolvedSystem;
241
+ readonly instructions?: ResolvedInstructions;
239
242
  /**
240
243
  * Authored sandbox override for this agent, when one exists. `null`
241
244
  * means the agent uses the framework default sandbox unchanged.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "experimental-ash",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "bin": {
5
5
  "ash": "./bin/ash.js",
6
6
  "experimental-ash": "./bin/ash.js"
@@ -90,10 +90,15 @@
90
90
  "import": "./dist/src/public/skills/index.js",
91
91
  "default": "./dist/src/public/skills/index.js"
92
92
  },
93
+ "./instructions": {
94
+ "types": "./dist/src/public/instructions/index.d.ts",
95
+ "import": "./dist/src/public/instructions/index.js",
96
+ "default": "./dist/src/public/instructions/index.js"
97
+ },
93
98
  "./system": {
94
- "types": "./dist/src/public/system/index.d.ts",
95
- "import": "./dist/src/public/system/index.js",
96
- "default": "./dist/src/public/system/index.js"
99
+ "types": "./dist/src/public/instructions/index.d.ts",
100
+ "import": "./dist/src/public/instructions/index.js",
101
+ "default": "./dist/src/public/instructions/index.js"
97
102
  },
98
103
  "./context": {
99
104
  "types": "./dist/src/public/context/index.d.ts",