experimental-ash 0.6.1 → 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-Bk-ZWzF_.js → dev-authored-source-watcher-HzOplr1S.js} +1 -1
- package/dist/src/chunks/{host-CEiB9Ps8.js → host-Ca8xvEQ1.js} +2 -2
- package/dist/src/chunks/paths-BiY7uVwD.js +88 -0
- package/dist/src/chunks/{prewarm-BK_ZT4-w.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/cli/templates/init-app/package.json +1 -1
- package/dist/src/compiled/.vendor-stamp.json +2 -2
- package/dist/src/compiled/@ai-sdk/otel/index.js +3 -3
- package/dist/src/compiled/@ai-sdk/otel/package.json +1 -1
- package/dist/src/compiled/@vercel/sandbox/index.d.ts +1 -0
- 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/execution/sandbox/bindings/local.js +32 -3
- package/dist/src/execution/sandbox/bindings/vercel.js +3 -2
- package/dist/src/execution/sandbox/session.d.ts +2 -2
- package/dist/src/execution/sandbox/session.js +2 -2
- 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/authored-definition/sandbox.d.ts +3 -10
- 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/channels/slack/slackChannel.d.ts +7 -0
- package/dist/src/public/channels/slack/slackChannel.js +5 -0
- package/dist/src/public/definitions/instructions.d.ts +29 -0
- package/dist/src/public/definitions/instructions.js +12 -0
- package/dist/src/public/definitions/sandbox-backend.d.ts +1 -123
- package/dist/src/public/definitions/sandbox.d.ts +6 -165
- 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/public/sandbox/index.d.ts +1 -1
- 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 +15 -15
- package/dist/src/shared/sandbox-backend.d.ts +124 -0
- package/dist/src/shared/sandbox-backend.js +1 -0
- package/dist/src/shared/sandbox-definition.d.ts +72 -0
- package/dist/src/shared/sandbox-definition.js +1 -0
- package/dist/src/shared/sandbox-session.d.ts +95 -0
- package/dist/src/shared/sandbox-session.js +1 -0
- package/package.json +12 -7
- package/dist/src/chunks/paths-Dxh19LKr.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
|
@@ -25,6 +25,15 @@ export const AGENT_ROOT_FILE_NAMES = [
|
|
|
25
25
|
"agent.js",
|
|
26
26
|
"agent.cjs",
|
|
27
27
|
"agent.mjs",
|
|
28
|
+
"instructions.md",
|
|
29
|
+
"instructions.ts",
|
|
30
|
+
"instructions.cts",
|
|
31
|
+
"instructions.mts",
|
|
32
|
+
"instructions.js",
|
|
33
|
+
"instructions.cjs",
|
|
34
|
+
"instructions.mjs",
|
|
35
|
+
// The `system` files are deprecated and will be removed soon.
|
|
36
|
+
// TODO: Clean up in the near future.
|
|
28
37
|
"system.md",
|
|
29
38
|
"system.ts",
|
|
30
39
|
"system.cts",
|
|
@@ -58,6 +67,15 @@ export const LOCAL_SUBAGENT_FILE_NAMES = [
|
|
|
58
67
|
"agent.js",
|
|
59
68
|
"agent.cjs",
|
|
60
69
|
"agent.mjs",
|
|
70
|
+
"instructions.md",
|
|
71
|
+
"instructions.ts",
|
|
72
|
+
"instructions.cts",
|
|
73
|
+
"instructions.mts",
|
|
74
|
+
"instructions.js",
|
|
75
|
+
"instructions.cjs",
|
|
76
|
+
"instructions.mjs",
|
|
77
|
+
// The `system` files are deprecated and will be removed soon.
|
|
78
|
+
// TODO: Clean up in the near future.
|
|
61
79
|
"system.md",
|
|
62
80
|
"system.ts",
|
|
63
81
|
"system.cts",
|
|
@@ -118,6 +136,12 @@ export function classifyAgentRootEntry(name, entryType) {
|
|
|
118
136
|
if (matchesSupportedModuleBaseName(name, "agent")) {
|
|
119
137
|
return "agent-config-module";
|
|
120
138
|
}
|
|
139
|
+
if (name === "instructions.md") {
|
|
140
|
+
return "instructions-markdown";
|
|
141
|
+
}
|
|
142
|
+
if (matchesSupportedModuleBaseName(name, "instructions")) {
|
|
143
|
+
return "instructions-module";
|
|
144
|
+
}
|
|
121
145
|
if (name === "system.md") {
|
|
122
146
|
return "system-markdown";
|
|
123
147
|
}
|
|
@@ -165,6 +189,12 @@ export function classifyLocalSubagentEntry(name, entryType) {
|
|
|
165
189
|
if (matchesSupportedModuleBaseName(name, "agent")) {
|
|
166
190
|
return "agent-config-module";
|
|
167
191
|
}
|
|
192
|
+
if (name === "instructions.md") {
|
|
193
|
+
return "instructions-markdown";
|
|
194
|
+
}
|
|
195
|
+
if (matchesSupportedModuleBaseName(name, "instructions")) {
|
|
196
|
+
return "instructions-module";
|
|
197
|
+
}
|
|
168
198
|
if (name === "system.md") {
|
|
169
199
|
return "system-markdown";
|
|
170
200
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Dirent } from "node:fs";
|
|
2
2
|
import type { MarkdownSourceRef, ModuleSourceRef } from "#shared/source-ref.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { InstructionsDefinition } from "#public/definitions/instructions.js";
|
|
4
4
|
import { type DiscoverDiagnostic } from "#discover/diagnostics.js";
|
|
5
5
|
import { type DirectoryEntryType } from "#discover/filesystem.js";
|
|
6
6
|
import type { ProjectSource, ProjectSourceEntry } from "#discover/project-source.js";
|
|
@@ -9,9 +9,17 @@ import type { ProjectSource, ProjectSourceEntry } from "#discover/project-source
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const DISCOVER_MODULE_SLOT_COLLISION = "discover/module-slot-collision";
|
|
11
11
|
/**
|
|
12
|
-
* Shared diagnostic emitted when the required
|
|
12
|
+
* Shared diagnostic emitted when the required instructions prompt source
|
|
13
|
+
* is missing.
|
|
13
14
|
*/
|
|
14
|
-
export declare const
|
|
15
|
+
export declare const DISCOVER_REQUIRED_INSTRUCTIONS_MISSING = "discover/required-instructions-missing";
|
|
16
|
+
/**
|
|
17
|
+
* Shared diagnostic emitted when discovery falls back to the deprecated
|
|
18
|
+
* `system.{md,ts,...}` slot because no `instructions.{md,ts,...}` source
|
|
19
|
+
* was found. The fallback resolves successfully; the warning prompts the
|
|
20
|
+
* author to rename the file.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DISCOVER_DEPRECATED_SYSTEM_SLOT = "discover/deprecated-system-slot";
|
|
15
23
|
/**
|
|
16
24
|
* Shared diagnostic emitted when a slot has both markdown and module sources.
|
|
17
25
|
*/
|
|
@@ -100,7 +108,7 @@ export declare const DISCOVER_UNSUPPORTED_DIRECTORY = "discover/unsupported-dire
|
|
|
100
108
|
* {@link createDiskProjectSource} returns them directly.
|
|
101
109
|
*/
|
|
102
110
|
export type StringDirent = Dirent<string>;
|
|
103
|
-
type
|
|
111
|
+
type InstructionsSourceRef = MarkdownSourceRef<InstructionsDefinition> | ModuleSourceRef;
|
|
104
112
|
/**
|
|
105
113
|
* Reads one directory through `source` and returns its entries sorted by name.
|
|
106
114
|
*/
|
|
@@ -110,15 +118,21 @@ export declare function readSortedDirectoryEntries(source: ProjectSource, direct
|
|
|
110
118
|
*/
|
|
111
119
|
export declare function getPathType(source: ProjectSource, targetPath: string): Promise<"directory" | "file" | "missing" | "other">;
|
|
112
120
|
/**
|
|
113
|
-
* Discovers one required `
|
|
121
|
+
* Discovers one required `instructions.md|ts|cts|mts|js|cjs|mjs` source
|
|
122
|
+
* from a root directory.
|
|
123
|
+
*
|
|
124
|
+
* For backwards compatibility, falls back to the deprecated
|
|
125
|
+
* `system.{md,ts,...}` slot when no `instructions.*` source is present —
|
|
126
|
+
* with a {@link DISCOVER_DEPRECATED_SYSTEM_SLOT} warning prompting the
|
|
127
|
+
* author to rename the file.
|
|
114
128
|
*/
|
|
115
|
-
export declare function
|
|
129
|
+
export declare function discoverInstructionsSource(input: {
|
|
116
130
|
rootEntries: readonly ProjectSourceEntry[];
|
|
117
131
|
rootPath: string;
|
|
118
132
|
source: ProjectSource;
|
|
119
133
|
}): Promise<{
|
|
120
134
|
diagnostics: DiscoverDiagnostic[];
|
|
121
|
-
|
|
135
|
+
instructions?: InstructionsSourceRef;
|
|
122
136
|
}>;
|
|
123
137
|
/**
|
|
124
138
|
* Discovers one flat module slot such as `agent.ts` or `subagent.cjs`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import {
|
|
2
|
+
import { lowerInstructionsMarkdown } from "#public/helpers/markdown.js";
|
|
3
3
|
import { createDiscoverErrorDiagnostic, createDiscoverWarningDiagnostic, } from "#discover/diagnostics.js";
|
|
4
4
|
import { getDirectoryEntryType } from "#discover/filesystem.js";
|
|
5
5
|
import { createModuleSourceRef } from "#discover/manifest.js";
|
|
@@ -10,9 +10,17 @@ import { collectFlatSlotCandidates } from "#discover/slots.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export const DISCOVER_MODULE_SLOT_COLLISION = "discover/module-slot-collision";
|
|
12
12
|
/**
|
|
13
|
-
* Shared diagnostic emitted when the required
|
|
13
|
+
* Shared diagnostic emitted when the required instructions prompt source
|
|
14
|
+
* is missing.
|
|
14
15
|
*/
|
|
15
|
-
export const
|
|
16
|
+
export const DISCOVER_REQUIRED_INSTRUCTIONS_MISSING = "discover/required-instructions-missing";
|
|
17
|
+
/**
|
|
18
|
+
* Shared diagnostic emitted when discovery falls back to the deprecated
|
|
19
|
+
* `system.{md,ts,...}` slot because no `instructions.{md,ts,...}` source
|
|
20
|
+
* was found. The fallback resolves successfully; the warning prompts the
|
|
21
|
+
* author to rename the file.
|
|
22
|
+
*/
|
|
23
|
+
export const DISCOVER_DEPRECATED_SYSTEM_SLOT = "discover/deprecated-system-slot";
|
|
16
24
|
/**
|
|
17
25
|
* Shared diagnostic emitted when a slot has both markdown and module sources.
|
|
18
26
|
*/
|
|
@@ -106,17 +114,75 @@ export async function getPathType(source, targetPath) {
|
|
|
106
114
|
return await source.stat(targetPath);
|
|
107
115
|
}
|
|
108
116
|
/**
|
|
109
|
-
* Discovers one required `
|
|
117
|
+
* Discovers one required `instructions.md|ts|cts|mts|js|cjs|mjs` source
|
|
118
|
+
* from a root directory.
|
|
119
|
+
*
|
|
120
|
+
* For backwards compatibility, falls back to the deprecated
|
|
121
|
+
* `system.{md,ts,...}` slot when no `instructions.*` source is present —
|
|
122
|
+
* with a {@link DISCOVER_DEPRECATED_SYSTEM_SLOT} warning prompting the
|
|
123
|
+
* author to rename the file.
|
|
110
124
|
*/
|
|
111
|
-
export async function
|
|
112
|
-
const
|
|
125
|
+
export async function discoverInstructionsSource(input) {
|
|
126
|
+
const result = await discoverSlotSource({
|
|
127
|
+
markdownFileName: "instructions.md",
|
|
128
|
+
moduleBaseName: "instructions",
|
|
129
|
+
rootEntries: input.rootEntries,
|
|
130
|
+
rootPath: input.rootPath,
|
|
131
|
+
slotLabel: "instructions",
|
|
132
|
+
source: input.source,
|
|
133
|
+
});
|
|
134
|
+
if (result.diagnostics.length > 0 || result.source !== undefined) {
|
|
135
|
+
return {
|
|
136
|
+
diagnostics: result.diagnostics,
|
|
137
|
+
instructions: result.source,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const legacyResult = await discoverSlotSource({
|
|
113
141
|
markdownFileName: "system.md",
|
|
114
142
|
moduleBaseName: "system",
|
|
143
|
+
rootEntries: input.rootEntries,
|
|
144
|
+
rootPath: input.rootPath,
|
|
145
|
+
slotLabel: "system",
|
|
146
|
+
source: input.source,
|
|
147
|
+
});
|
|
148
|
+
if (legacyResult.source !== undefined) {
|
|
149
|
+
const fileName = legacyResult.source.sourceKind === "markdown" ? "system.md" : legacyResult.source.logicalPath;
|
|
150
|
+
return {
|
|
151
|
+
diagnostics: [
|
|
152
|
+
createDiscoverWarningDiagnostic({
|
|
153
|
+
code: DISCOVER_DEPRECATED_SYSTEM_SLOT,
|
|
154
|
+
message: `The "${fileName}" slot is deprecated. Rename it to "${fileName.replace(/^system/, "instructions")}" — the runtime still loads the legacy slot for now, but support will be removed in a future release.`,
|
|
155
|
+
sourcePath: join(input.rootPath, fileName),
|
|
156
|
+
}),
|
|
157
|
+
...legacyResult.diagnostics,
|
|
158
|
+
],
|
|
159
|
+
instructions: legacyResult.source,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (legacyResult.diagnostics.length > 0) {
|
|
163
|
+
return {
|
|
164
|
+
diagnostics: legacyResult.diagnostics,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
diagnostics: [
|
|
169
|
+
createDiscoverErrorDiagnostic({
|
|
170
|
+
code: DISCOVER_REQUIRED_INSTRUCTIONS_MISSING,
|
|
171
|
+
message: 'Expected one authored instructions prompt source at "instructions.md", "instructions.ts", "instructions.cts", "instructions.mts", "instructions.js", "instructions.cjs", or "instructions.mjs".',
|
|
172
|
+
sourcePath: input.rootPath,
|
|
173
|
+
}),
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
async function discoverSlotSource(input) {
|
|
178
|
+
const candidates = collectFlatSlotCandidates(input.rootEntries, {
|
|
179
|
+
markdownFileName: input.markdownFileName,
|
|
180
|
+
moduleBaseName: input.moduleBaseName,
|
|
115
181
|
});
|
|
116
182
|
if (candidates.markdownFileName !== undefined && candidates.moduleFileNames.length > 0) {
|
|
117
183
|
return {
|
|
118
184
|
diagnostics: [
|
|
119
|
-
createSlotCollisionDiagnostic(input.rootPath,
|
|
185
|
+
createSlotCollisionDiagnostic(input.rootPath, input.slotLabel, [
|
|
120
186
|
candidates.markdownFileName,
|
|
121
187
|
...candidates.moduleFileNames,
|
|
122
188
|
]),
|
|
@@ -126,16 +192,16 @@ export async function discoverSystemSource(input) {
|
|
|
126
192
|
if (candidates.moduleFileNames.length > 1) {
|
|
127
193
|
return {
|
|
128
194
|
diagnostics: [
|
|
129
|
-
createModuleSlotCollisionDiagnostic(input.rootPath,
|
|
195
|
+
createModuleSlotCollisionDiagnostic(input.rootPath, input.slotLabel, candidates.moduleFileNames),
|
|
130
196
|
],
|
|
131
197
|
};
|
|
132
198
|
}
|
|
133
199
|
if (candidates.markdownFileName !== undefined) {
|
|
134
200
|
return {
|
|
135
201
|
diagnostics: [],
|
|
136
|
-
|
|
137
|
-
logicalPath:
|
|
138
|
-
lower:
|
|
202
|
+
source: await discoverMarkdownSource({
|
|
203
|
+
logicalPath: input.markdownFileName,
|
|
204
|
+
lower: lowerInstructionsMarkdown,
|
|
139
205
|
source: input.source,
|
|
140
206
|
sourcePath: join(input.rootPath, candidates.markdownFileName),
|
|
141
207
|
}),
|
|
@@ -145,20 +211,12 @@ export async function discoverSystemSource(input) {
|
|
|
145
211
|
if (logicalPath !== undefined) {
|
|
146
212
|
return {
|
|
147
213
|
diagnostics: [],
|
|
148
|
-
|
|
214
|
+
source: createModuleSourceRef({
|
|
149
215
|
logicalPath,
|
|
150
216
|
}),
|
|
151
217
|
};
|
|
152
218
|
}
|
|
153
|
-
return {
|
|
154
|
-
diagnostics: [
|
|
155
|
-
createDiscoverErrorDiagnostic({
|
|
156
|
-
code: DISCOVER_REQUIRED_SYSTEM_MISSING,
|
|
157
|
-
message: 'Expected one authored system prompt source at "system.md", "system.ts", "system.cts", "system.mts", "system.js", "system.cjs", or "system.mjs".',
|
|
158
|
-
sourcePath: input.rootPath,
|
|
159
|
-
}),
|
|
160
|
-
],
|
|
161
|
-
};
|
|
219
|
+
return { diagnostics: [] };
|
|
162
220
|
}
|
|
163
221
|
/**
|
|
164
222
|
* Discovers one flat module slot such as `agent.ts` or `subagent.cjs`.
|
|
@@ -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};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { resolveSandboxCacheDirectory } from "#internal/application/paths.js";
|
|
4
|
+
import { shellQuote } from "#execution/sandbox/shell-quote.js";
|
|
4
5
|
import { SandboxTemplateNotProvisionedError } from "#public/definitions/sandbox-backend.js";
|
|
5
6
|
import { WORKSPACE_ROOT } from "#runtime/workspace/types.js";
|
|
6
7
|
import { buildSandboxSession } from "#execution/sandbox/session.js";
|
|
@@ -89,8 +90,17 @@ async function createBashSandbox(input) {
|
|
|
89
90
|
const disposableBash = bash;
|
|
90
91
|
await disposableBash.dispose?.();
|
|
91
92
|
},
|
|
92
|
-
async executeCommand(command) {
|
|
93
|
-
|
|
93
|
+
async executeCommand(command, options) {
|
|
94
|
+
if (options?.abortSignal?.aborted) {
|
|
95
|
+
throw new DOMException("The operation was aborted.", "AbortError");
|
|
96
|
+
}
|
|
97
|
+
const wrapped = options?.workingDirectory !== undefined
|
|
98
|
+
? `( cd ${shellQuote(options.workingDirectory)} && ${command} )`
|
|
99
|
+
: command;
|
|
100
|
+
const execPromise = bash.exec(wrapped);
|
|
101
|
+
const result = options?.abortSignal
|
|
102
|
+
? await raceAbort(execPromise, options.abortSignal)
|
|
103
|
+
: await execPromise;
|
|
94
104
|
return { exitCode: result.exitCode, stderr: result.stderr, stdout: result.stdout };
|
|
95
105
|
},
|
|
96
106
|
async readFileBytes(path) {
|
|
@@ -171,10 +181,29 @@ function createLocalSessionPrimitives(sandbox) {
|
|
|
171
181
|
readFileBytes: (path) => sandbox.readFileBytes(path),
|
|
172
182
|
readFileRaw: (path) => sandbox.readFileText(path),
|
|
173
183
|
resolvePath: resolveLocalPath,
|
|
174
|
-
runCommand: (command) => sandbox.executeCommand(command),
|
|
184
|
+
runCommand: (command, options) => sandbox.executeCommand(command, options),
|
|
175
185
|
writeFileRaw: (path, content) => sandbox.writeFiles([{ path, content }]),
|
|
176
186
|
};
|
|
177
187
|
}
|
|
188
|
+
async function raceAbort(promise, signal) {
|
|
189
|
+
return await new Promise((resolve, reject) => {
|
|
190
|
+
const onAbort = () => {
|
|
191
|
+
reject(new DOMException("The operation was aborted.", "AbortError"));
|
|
192
|
+
};
|
|
193
|
+
if (signal.aborted) {
|
|
194
|
+
onAbort();
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
198
|
+
promise.then((value) => {
|
|
199
|
+
signal.removeEventListener("abort", onAbort);
|
|
200
|
+
resolve(value);
|
|
201
|
+
}, (error) => {
|
|
202
|
+
signal.removeEventListener("abort", onAbort);
|
|
203
|
+
reject(error);
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
178
207
|
function resolveLocalPath(path) {
|
|
179
208
|
if (path.startsWith("/")) {
|
|
180
209
|
return path;
|
|
@@ -229,11 +229,12 @@ function createVercelSessionPrimitives(sandbox, id) {
|
|
|
229
229
|
return new TextDecoder("utf-8", { fatal: true }).decode(buffer);
|
|
230
230
|
},
|
|
231
231
|
resolvePath: resolveVercelSandboxPath,
|
|
232
|
-
async runCommand(command) {
|
|
232
|
+
async runCommand(command, options) {
|
|
233
233
|
const result = await sandbox.runCommand({
|
|
234
234
|
args: ["-lc", command],
|
|
235
235
|
cmd: "bash",
|
|
236
|
-
cwd: WORKSPACE_ROOT,
|
|
236
|
+
cwd: options?.workingDirectory ?? WORKSPACE_ROOT,
|
|
237
|
+
signal: options?.abortSignal,
|
|
237
238
|
});
|
|
238
239
|
const [stdout, stderr] = await Promise.all([result.stdout(), result.stderr()]);
|
|
239
240
|
return { exitCode: result.exitCode, stderr, stdout };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SandboxCommandResult, SandboxSession } from "#public/definitions/sandbox.js";
|
|
1
|
+
import type { SandboxCommandOptions, SandboxCommandResult, SandboxSession } from "#public/definitions/sandbox.js";
|
|
2
2
|
/**
|
|
3
3
|
* Raw backend primitives consumed by {@link buildSandboxSession} to
|
|
4
4
|
* construct the public {@link SandboxSession}.
|
|
@@ -18,7 +18,7 @@ export interface SandboxSessionPrimitives {
|
|
|
18
18
|
/** Translates a user-facing path to the backend's native path. */
|
|
19
19
|
resolvePath(path: string): string;
|
|
20
20
|
/** Runs one shell command inside the sandbox. */
|
|
21
|
-
runCommand(command: string): Promise<SandboxCommandResult>;
|
|
21
|
+
runCommand(command: string, options?: SandboxCommandOptions): Promise<SandboxCommandResult>;
|
|
22
22
|
/**
|
|
23
23
|
* Writes `content` to `resolvedPath`, creating parent dirs recursively.
|
|
24
24
|
*/
|
|
@@ -23,8 +23,8 @@ export function buildSandboxSession(primitives) {
|
|
|
23
23
|
resolvePath(path) {
|
|
24
24
|
return primitives.resolvePath(path);
|
|
25
25
|
},
|
|
26
|
-
async runCommand(command) {
|
|
27
|
-
return await primitives.runCommand(command);
|
|
26
|
+
async runCommand(command, options) {
|
|
27
|
+
return await primitives.runCommand(command, options);
|
|
28
28
|
},
|
|
29
29
|
async writeFile(path, content) {
|
|
30
30
|
const resolvedPath = primitives.resolvePath(path);
|
|
@@ -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 {
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
* Canonical internal shape for an authored sandbox definition after
|
|
4
|
-
* normalization.
|
|
5
|
-
*/
|
|
6
|
-
export interface NormalizedSandboxDefinition {
|
|
7
|
-
readonly backend?: SandboxBackend;
|
|
1
|
+
import type { SandboxDefinition } from "#public/definitions/sandbox.js";
|
|
2
|
+
export type NormalizedSandboxDefinition = Readonly<SandboxDefinition> & {
|
|
8
3
|
readonly description?: string;
|
|
9
|
-
|
|
10
|
-
readonly onSession?: (input: unknown) => Promise<void> | void;
|
|
11
|
-
}
|
|
4
|
+
};
|
|
12
5
|
/**
|
|
13
6
|
* Normalizes one authored sandbox definition into the canonical internal
|
|
14
7
|
* shape.
|
|
@@ -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, };
|