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.
- package/README.md +3 -4
- package/dist/docs/internals/discovery.md +2 -2
- package/dist/docs/internals/mechanical-invariants.md +1 -1
- package/dist/docs/internals/testing.md +1 -1
- package/dist/docs/public/README.md +1 -1
- package/dist/docs/public/agent-ts.md +2 -2
- package/dist/docs/public/channels/README.md +1 -1
- package/dist/docs/public/context-control.md +20 -20
- package/dist/docs/public/getting-started.md +1 -1
- package/dist/docs/public/project-layout.md +21 -21
- package/dist/docs/public/schedules.md +1 -1
- package/dist/docs/public/skills.md +3 -3
- package/dist/docs/public/subagents.md +3 -3
- package/dist/docs/public/typescript-api.md +2 -2
- package/dist/src/chunks/{dev-authored-source-watcher-MDHwWfTE.js → dev-authored-source-watcher-HzOplr1S.js} +1 -1
- package/dist/src/chunks/{host-CDvE1sV_.js → host-Ca8xvEQ1.js} +2 -2
- package/dist/src/chunks/paths-BiY7uVwD.js +88 -0
- package/dist/src/chunks/{prewarm-CCU5VjXa.js → prewarm-DiZ_sYLy.js} +1 -1
- package/dist/src/cli/commands/info.js +1 -1
- package/dist/src/cli/run.js +1 -1
- package/dist/src/compiler/compile-agent.js +10 -0
- package/dist/src/compiler/manifest.d.ts +8 -7
- package/dist/src/compiler/manifest.js +5 -5
- package/dist/src/compiler/normalize-instructions.d.ts +12 -0
- package/dist/src/compiler/normalize-instructions.js +28 -0
- package/dist/src/compiler/normalize-manifest.js +3 -3
- package/dist/src/discover/discover-agent.d.ts +2 -2
- package/dist/src/discover/discover-agent.js +5 -5
- package/dist/src/discover/discover-subagent.js +4 -4
- package/dist/src/discover/filesystem.d.ts +4 -4
- package/dist/src/discover/filesystem.js +30 -0
- package/dist/src/discover/grammar.d.ts +21 -7
- package/dist/src/discover/grammar.js +79 -21
- package/dist/src/discover/manifest.d.ts +11 -8
- package/dist/src/discover/manifest.js +2 -2
- package/dist/src/evals/cli/eval.js +1 -1
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.d.ts +7 -6
- package/dist/src/internal/authored-definition/core.js +6 -5
- package/dist/src/internal/nitro/routes/home-page/build-home-page-response.d.ts +5 -5
- package/dist/src/internal/nitro/routes/home-page/build-home-page-response.js +16 -15
- package/dist/src/internal/nitro/routes/home-page/load-home-page-data.d.ts +2 -2
- package/dist/src/internal/nitro/routes/web-ui/assets/{index-z8flAc4k.js → index-BQa8fbHJ.js} +1 -1
- package/dist/src/internal/nitro/routes/web-ui/index.html +1 -1
- package/dist/src/public/definitions/instructions.d.ts +29 -0
- package/dist/src/public/definitions/instructions.js +12 -0
- package/dist/src/public/helpers/markdown.d.ts +5 -5
- package/dist/src/public/helpers/markdown.js +7 -7
- package/dist/src/public/instructions/index.d.ts +8 -0
- package/dist/src/public/instructions/index.js +6 -0
- package/dist/src/runtime/agent/bootstrap.js +3 -3
- package/dist/src/runtime/prompt/compose.d.ts +5 -4
- package/dist/src/runtime/prompt/compose.js +6 -6
- package/dist/src/runtime/resolve-agent.js +10 -10
- package/dist/src/runtime/types.d.ts +10 -7
- package/package.json +9 -4
- package/dist/src/chunks/paths-D1gMcyWw.js +0 -88
- package/dist/src/compiler/normalize-system.d.ts +0 -11
- package/dist/src/compiler/normalize-system.js +0 -27
- package/dist/src/public/definitions/system.d.ts +0 -16
- package/dist/src/public/definitions/system.js +0 -7
- package/dist/src/public/system/index.d.ts +0 -4
- package/dist/src/public/system/index.js +0 -4
- /package/dist/src/cli/templates/init-app/agent/{system.md → instructions.md} +0 -0
|
@@ -2,7 +2,7 @@ import type { MarkdownSourceRef, ModuleSourceRef, SkillPackageSourceRef } from "
|
|
|
2
2
|
import type { InternalSkillDefinition } from "#shared/skill-definition.js";
|
|
3
3
|
import type { ScheduleDefinition } from "#public/definitions/schedule.js";
|
|
4
4
|
import type { SkillDefinition } from "#public/definitions/skill.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { InstructionsDefinition } from "#public/definitions/instructions.js";
|
|
6
6
|
import type { DiscoverDiagnostic, DiscoverDiagnosticsSummary } from "#discover/diagnostics.js";
|
|
7
7
|
/**
|
|
8
8
|
* Stable manifest kind emitted by discovery.
|
|
@@ -31,9 +31,10 @@ export interface ConnectionSourceRef extends ModuleSourceRef {
|
|
|
31
31
|
readonly connectionName: string;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* Instructions source reference preserved by discovery for compiler
|
|
35
|
+
* normalization.
|
|
35
36
|
*/
|
|
36
|
-
export type
|
|
37
|
+
export type InstructionsSourceRef = MarkdownSourceRef<InstructionsDefinition> | ModuleSourceRef;
|
|
37
38
|
/**
|
|
38
39
|
* Skill source reference preserved by the discovery manifest.
|
|
39
40
|
*/
|
|
@@ -122,11 +123,13 @@ export interface AgentSourceManifest {
|
|
|
122
123
|
lib: LibSourceRef[];
|
|
123
124
|
kind: typeof AGENT_SOURCE_MANIFEST_KIND;
|
|
124
125
|
/**
|
|
125
|
-
* Authored
|
|
126
|
-
* (`
|
|
127
|
-
* without an authored
|
|
126
|
+
* Authored instructions prompt source discovered at the agent root
|
|
127
|
+
* (`instructions.md` or `instructions.{ts,cts,mts,js,cjs,mjs}`).
|
|
128
|
+
* Optional — agents without an authored instructions prompt fall back
|
|
129
|
+
* to the framework default. The deprecated `system.{md,ts,...}` slot is
|
|
130
|
+
* still discovered as a fallback (with a deprecation warning).
|
|
128
131
|
*/
|
|
129
|
-
|
|
132
|
+
instructions?: InstructionsSourceRef;
|
|
130
133
|
/**
|
|
131
134
|
* Authored sandbox module discovered for this agent, or `null` when
|
|
132
135
|
* the agent does not declare one. Every agent owns at most one
|
|
@@ -165,7 +168,7 @@ export interface CreateAgentSourceManifestInput {
|
|
|
165
168
|
* `/vercel/path0`) produce a meaningful agent id.
|
|
166
169
|
*/
|
|
167
170
|
packageName?: string;
|
|
168
|
-
|
|
171
|
+
instructions?: InstructionsSourceRef;
|
|
169
172
|
sandbox?: SandboxSourceRef | null;
|
|
170
173
|
sandboxWorkspaces?: readonly SandboxWorkspaceFolderSourceRef[];
|
|
171
174
|
schedules?: readonly ScheduleSourceRef[];
|
|
@@ -36,8 +36,8 @@ export function createAgentSourceManifest(input) {
|
|
|
36
36
|
if (input.configModule !== undefined) {
|
|
37
37
|
manifest.configModule = input.configModule;
|
|
38
38
|
}
|
|
39
|
-
if (input.
|
|
40
|
-
manifest.
|
|
39
|
+
if (input.instructions !== undefined) {
|
|
40
|
+
manifest.instructions = input.instructions;
|
|
41
41
|
}
|
|
42
42
|
return manifest;
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"../../chunks/paths-
|
|
1
|
+
import{n as e}from"../../chunks/paths-BiY7uVwD.js";import{loadDevelopmentEnvironmentFiles as t}from"../../cli/dev/environment.js";import{a as n,n as r,t as i}from"../../chunks/client-DBMG7iuf.js";import{n as a}from"../../chunks/host-Ca8xvEQ1.js";import{discoverAndImportSuites as o,discoverSuiteFiles as s,importSuiteFile as c}from"../runner/discover.js";import{executeSuite as l}from"../runner/execute-suite.js";import{ConsoleReporter as u}from"../runner/reporters/console.js";var d=n();function f(e,t){e.command(`eval`).description(`Run eval suites against an Ash agent.`).option(`--suite <id...>`,`Suite IDs to run (repeatable)`).option(`--all`,`Run all discovered suites`).option(`--url <url>`,`Remote agent URL (skip local host startup)`).option(`--timeout <ms>`,`Per-case timeout in milliseconds`).option(`--max-concurrency <n>`,`Max concurrent case executions per suite`).option(`--json`,`Output results as JSON`).option(`--list-suites`,`List discovered suites and exit`).option(`--skip-report`,`Skip suite-defined reporters (e.g. Braintrust)`).action(async e=>{await p(e,t)})}async function p(n,r){let i=e();if(t(i),n.listSuites){await y(i,r);return}let s=n.suite,c=await o(i,s);if(c.length===0){s&&s.length>0?r.error(`No suites found matching: ${s.join(`, `)}`):r.error(`No eval suites found. Create suite files under evals/ with the *.eval.ts extension.`),process.exitCode=1;return}let u,d;n.url?d={kind:`remote`,url:n.url}:(u=await a(i,{host:`127.0.0.1`,port:0}),d={kind:`local`,url:u.url});let f=m(d);try{let e=[];for(let t of c){let r=_(t,n),a=v(r,{json:n.json===!0,skipReport:n.skipReport===!0}),o=await l({suite:r,target:d,reporters:a,appRoot:i,client:f});e.push(o)}n.json&&r.log(JSON.stringify(e,null,2)),e.some(e=>e.errored>0)&&(process.exitCode=1)}finally{u&&await u.close()}process.exit(process.exitCode??0)}function m(e){if(e.kind===`local`)return new i({host:e.url});let t={},n=process.env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();return n&&(t[r]=n),new i({auth:h(),headers:Object.keys(t).length>0?t:void 0,host:e.url})}function h(){let e=process.env.ASH_EVAL_AUTH_TOKEN?.trim();return e?{bearer:e}:{bearer:g}}async function g(){try{let e=(await(0,d.getVercelOidcToken)()).trim();if(e.length>0)return e}catch{}return process.env.VERCEL_OIDC_TOKEN?.trim()??``}function _(e,t){let n=t.maxConcurrency?Number.parseInt(t.maxConcurrency,10):void 0,r=t.timeout?Number.parseInt(t.timeout,10):void 0;if(n===void 0&&r===void 0)return e;let i={...e};return n!==void 0&&(i.maxConcurrency=n),r!==void 0&&(i.timeoutMs=r),i}function v(e,t){let n=t.json?[]:[new u];return!t.skipReport&&e.reporters&&n.push(...e.reporters),n}async function y(e,t){let n=await s(e);if(n.length===0){t.log(`No eval suites found.`);return}t.log(`Found ${n.length} eval suite file(s):\n`);for(let r of n){let n=await c(e,r);t.log(` ${n.id}${n.description?` - ${n.description}`:``}`)}}export{f as registerEvalCommand,p as runEvalCommand};
|
|
@@ -6,7 +6,7 @@ import { ASH_PACKAGE_NAME } from "#package-name.js";
|
|
|
6
6
|
let cachedPackageInfo;
|
|
7
7
|
// The package build stamps the published version into `dist` so bundled
|
|
8
8
|
// deployments can still report package metadata without resolving package.json.
|
|
9
|
-
const BUNDLED_FALLBACK_PACKAGE_VERSION = "0.
|
|
9
|
+
const BUNDLED_FALLBACK_PACKAGE_VERSION = "0.7.0";
|
|
10
10
|
const BUNDLED_FALLBACK_PACKAGE_VERSION_PLACEHOLDER = "__ASH_PACKAGE_VERSION_PLACEHOLDER__";
|
|
11
11
|
const WORKFLOW_MODULE_ALIASES = {
|
|
12
12
|
"workflow/api": "src/compiled/@workflow/core/runtime.js",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentDefinition, AgentBuildDefinition } from "#public/definitions/agent.js";
|
|
2
2
|
import type { ScheduleDefinition } from "#public/definitions/schedule.js";
|
|
3
3
|
import type { SkillDefinition } from "#public/definitions/skill.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { InstructionsDefinition } from "#public/definitions/instructions.js";
|
|
5
5
|
type NormalizedAgentDefinition = Omit<AgentDefinition, "build"> & {
|
|
6
6
|
build?: {
|
|
7
7
|
externalDependencies?: Readonly<AgentBuildDefinition["externalDependencies"]>;
|
|
@@ -15,13 +15,14 @@ type NormalizedAgentDefinition = Omit<AgentDefinition, "build"> & {
|
|
|
15
15
|
*/
|
|
16
16
|
export declare function normalizeAgentDefinition(value: unknown, message: string): Readonly<NormalizedAgentDefinition>;
|
|
17
17
|
/**
|
|
18
|
-
* Normalizes one authored
|
|
19
|
-
* shape.
|
|
18
|
+
* Normalizes one authored instructions definition into the canonical
|
|
19
|
+
* internal shape.
|
|
20
20
|
*
|
|
21
|
-
* Authored `name` fields are rejected —
|
|
22
|
-
* from the file path (`
|
|
21
|
+
* Authored `name` fields are rejected — instructions prompt identity is
|
|
22
|
+
* derived from the file path (`instructions.md` or
|
|
23
|
+
* `instructions.{ts,...}`).
|
|
23
24
|
*/
|
|
24
|
-
export declare function
|
|
25
|
+
export declare function normalizeInstructionsDefinition(value: unknown, message: string): InstructionsDefinition;
|
|
25
26
|
/**
|
|
26
27
|
* Normalizes one authored skill definition into the canonical internal
|
|
27
28
|
* shape.
|
|
@@ -95,13 +95,14 @@ function normalizeAgentCompactionDefinition(value, message) {
|
|
|
95
95
|
return normalizedDefinition;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
|
-
* Normalizes one authored
|
|
99
|
-
* shape.
|
|
98
|
+
* Normalizes one authored instructions definition into the canonical
|
|
99
|
+
* internal shape.
|
|
100
100
|
*
|
|
101
|
-
* Authored `name` fields are rejected —
|
|
102
|
-
* from the file path (`
|
|
101
|
+
* Authored `name` fields are rejected — instructions prompt identity is
|
|
102
|
+
* derived from the file path (`instructions.md` or
|
|
103
|
+
* `instructions.{ts,...}`).
|
|
103
104
|
*/
|
|
104
|
-
export function
|
|
105
|
+
export function normalizeInstructionsDefinition(value, message) {
|
|
105
106
|
const record = expectObjectRecord(value, message);
|
|
106
107
|
expectOnlyKnownKeys(record, ["markdown"], message);
|
|
107
108
|
return {
|
|
@@ -52,12 +52,12 @@ export interface HomePageOverview {
|
|
|
52
52
|
readonly discoveryWarnings: number;
|
|
53
53
|
readonly modelId: string;
|
|
54
54
|
readonly subagentCount: number;
|
|
55
|
-
readonly
|
|
55
|
+
readonly instructionsPromptSource: string;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* Instructions prompt section returned by the home-page JSON route.
|
|
59
59
|
*/
|
|
60
|
-
export interface
|
|
60
|
+
export interface HomePageInstructionsPrompt {
|
|
61
61
|
readonly logicalPath: string;
|
|
62
62
|
readonly markdownPreview: string;
|
|
63
63
|
}
|
|
@@ -77,8 +77,8 @@ export interface HomePageResponse {
|
|
|
77
77
|
readonly skills: readonly HomePageSourceRow[];
|
|
78
78
|
readonly subagents: readonly HomePageSubagentRow[];
|
|
79
79
|
readonly summaryCounts: readonly HomePageSummaryCount[];
|
|
80
|
-
readonly
|
|
81
|
-
readonly
|
|
80
|
+
readonly instructions: HomePageSourceRow | null;
|
|
81
|
+
readonly instructionsPrompt: HomePageInstructionsPrompt;
|
|
82
82
|
readonly tools: readonly HomePageSourceRow[];
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
@@ -10,20 +10,20 @@ function truncateCopy(value, maxLength) {
|
|
|
10
10
|
}
|
|
11
11
|
function createHeroSummary(data) {
|
|
12
12
|
const { agent, manifest, schedules } = data;
|
|
13
|
-
return `Compiled inspection surface for the current runtime. Runs on ${agent.config.model.id} with ${agent.
|
|
13
|
+
return `Compiled inspection surface for the current runtime. Runs on ${agent.config.model.id} with ${agent.instructions === undefined ? "no instructions prompt" : "an instructions prompt"}, ${pluralize(agent.skills.length, "skill")}, ${pluralize(agent.tools.length, "tool")}, ${pluralize(agent.sandbox === null ? 0 : 1, "sandbox")}, ${pluralize(schedules.length, "schedule")}, and ${pluralize(manifest.subagents.length, "subagent")}.`;
|
|
14
14
|
}
|
|
15
15
|
function createPageDescription(data) {
|
|
16
16
|
return truncateCopy(createHeroSummary(data), 155);
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
if (agent.
|
|
18
|
+
function renderInstructionsRow(agent) {
|
|
19
|
+
if (agent.instructions === undefined) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
return {
|
|
23
|
-
details: truncateCopy(agent.
|
|
24
|
-
logicalPath: agent.
|
|
25
|
-
name: agent.
|
|
26
|
-
sourceKind: agent.
|
|
23
|
+
details: truncateCopy(agent.instructions.markdown.trim(), 420),
|
|
24
|
+
logicalPath: agent.instructions.logicalPath,
|
|
25
|
+
name: agent.instructions.name,
|
|
26
|
+
sourceKind: agent.instructions.sourceKind === "module" ? "Module" : agent.instructions.sourceKind,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
function renderSkillRows(skills) {
|
|
@@ -118,7 +118,7 @@ function renderEndpointRows() {
|
|
|
118
118
|
* Builds the JSON payload served to Ash's static Nitro home page.
|
|
119
119
|
*/
|
|
120
120
|
export function buildHomePageResponse(data) {
|
|
121
|
-
const
|
|
121
|
+
const instructions = data.agent.instructions;
|
|
122
122
|
const requestExample = `POST ${ASH_CREATE_SESSION_ROUTE_PATH}
|
|
123
123
|
content-type: application/json
|
|
124
124
|
|
|
@@ -137,7 +137,7 @@ content-type: application/json
|
|
|
137
137
|
discoveryWarnings: data.agent.metadata.diagnosticsSummary.warnings,
|
|
138
138
|
modelId: data.agent.config.model.id,
|
|
139
139
|
subagentCount: data.manifest.subagents.length,
|
|
140
|
-
|
|
140
|
+
instructionsPromptSource: instructions?.logicalPath ?? "No instructions prompt discovered",
|
|
141
141
|
},
|
|
142
142
|
pageDescription: createPageDescription(data),
|
|
143
143
|
pageTitle: `${data.agent.config.name} | Ash`,
|
|
@@ -147,8 +147,8 @@ content-type: application/json
|
|
|
147
147
|
subagents: renderSubagentRows(data.manifest),
|
|
148
148
|
summaryCounts: [
|
|
149
149
|
{
|
|
150
|
-
label: "
|
|
151
|
-
value:
|
|
150
|
+
label: "instructions prompt",
|
|
151
|
+
value: instructions === undefined ? 0 : 1,
|
|
152
152
|
},
|
|
153
153
|
{
|
|
154
154
|
label: "skill",
|
|
@@ -171,10 +171,11 @@ content-type: application/json
|
|
|
171
171
|
value: data.manifest.subagents.length,
|
|
172
172
|
},
|
|
173
173
|
],
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
logicalPath:
|
|
177
|
-
markdownPreview: truncateCopy(
|
|
174
|
+
instructions: renderInstructionsRow(data.agent),
|
|
175
|
+
instructionsPrompt: {
|
|
176
|
+
logicalPath: instructions?.logicalPath ?? "No instructions prompt discovered",
|
|
177
|
+
markdownPreview: truncateCopy(instructions?.markdown.trim() ??
|
|
178
|
+
"This agent does not currently define an instructions prompt.", 420),
|
|
178
179
|
},
|
|
179
180
|
tools: renderToolRows(data.agent),
|
|
180
181
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CompiledAgentManifest, CompiledSubagentNode } from "#compiler/manifest.js";
|
|
2
2
|
import { type RuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js";
|
|
3
|
-
import type { ResolvedAgent, ResolvedSandboxDefinition, ResolvedSchedule, ResolvedSkillDefinition,
|
|
3
|
+
import type { ResolvedAgent, ResolvedSandboxDefinition, ResolvedSchedule, ResolvedSkillDefinition, ResolvedInstructions } from "#runtime/types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Runtime data needed to build the package-owned Nitro homepage.
|
|
6
6
|
*/
|
|
@@ -23,4 +23,4 @@ export declare function loadHomePageData(input: {
|
|
|
23
23
|
export declare function resolveHomePageCompiledArtifactsSource(input?: {
|
|
24
24
|
readonly appRoot?: string;
|
|
25
25
|
}): RuntimeCompiledArtifactsSource;
|
|
26
|
-
export type { CompiledAgentManifest, CompiledSubagentNode, ResolvedSandboxDefinition, ResolvedSchedule, ResolvedSkillDefinition,
|
|
26
|
+
export type { CompiledAgentManifest, CompiledSubagentNode, ResolvedSandboxDefinition, ResolvedSchedule, ResolvedSkillDefinition, ResolvedInstructions, };
|