@luminascale/shepherd 0.0.0-stage → 0.6.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/.agents/agents/README.md +12 -0
- package/.agents/agents/planner.md +38 -0
- package/.agents/agents/reviewer.md +38 -0
- package/.agents/agents/scout.md +43 -0
- package/.agents/agents/worker.md +33 -0
- package/.agents/skills/smoke-test/SKILL.md +155 -0
- package/.agents/skills/smoke-test/references/forensics.md +46 -0
- package/.agents/skills/smoke-test/scripts/live-smoke-poll.mjs +130 -0
- package/.github/workflows/publish.yml +77 -0
- package/.pi/prompts/release.md +21 -0
- package/.prettierrc +10 -0
- package/AGENTS.md +88 -0
- package/CONTRIBUTING.md +177 -0
- package/LICENSE +201 -0
- package/README.md +424 -2
- package/docs/README.md +25 -0
- package/docs/guides/agent-definitions.md +42 -0
- package/docs/guides/diagnostics.md +199 -0
- package/docs/guides/tool-reference.md +55 -0
- package/docs/manual-tests/ping-pong-peer-messaging.md +147 -0
- package/docs/plans/agent-labels.md +257 -0
- package/docs/plans/architecture.md +110 -0
- package/docs/plans/settings-scope.md +163 -0
- package/docs/plans/tool-surface-split.md +278 -0
- package/docs/reference/dictionary +26 -0
- package/docs/releasing.md +47 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/baseline.md +115 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/handoff.md +564 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/phase10-notes.md +109 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/phase6-notes.md +69 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/phase7-notes.md +100 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/phase8-notes.md +127 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/phase9-notes.md +104 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/plan.md +1093 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/spec.md +583 -0
- package/docs/specs/005-agent-messaging-and-task-lifecycle/tasks.md +838 -0
- package/docs/specs/006-shepherd-tool-rendering/plan.md +175 -0
- package/docs/specs/006-shepherd-tool-rendering/spec.md +469 -0
- package/index.ts +599 -0
- package/package.json +112 -4
- package/scripts/capture-system-prompt.mjs +45 -0
- package/scripts/extract-pi-system-prompt.mjs +277 -0
- package/scripts/host-impact.mjs +74 -0
- package/scripts/resolve-agent.mjs +43 -0
- package/scripts/show-shepherd-orchestrator.mjs +58 -0
- package/scripts/show-shepherd-prompt.mjs +96 -0
- package/scripts/verify-suites.mjs +67 -0
- package/specs/001-artifacts/spec.md +436 -0
- package/specs/002-simplify-agent-orchestration/plan.md +287 -0
- package/specs/002-simplify-agent-orchestration/spec.md +323 -0
- package/specs/002-simplify-agent-orchestration/tasks.md +212 -0
- package/specs/003-orchestrator-session-artifacts/plan.md +396 -0
- package/specs/003-orchestrator-session-artifacts/spec.md +453 -0
- package/specs/003-orchestrator-session-artifacts/tasks.md +141 -0
- package/specs/004-asynchronous-prompt-watchers/plan.md +139 -0
- package/specs/004-asynchronous-prompt-watchers/spec.md +202 -0
- package/specs/004-asynchronous-prompt-watchers/tasks.md +126 -0
- package/specs/005-per-workspace-settings/plan.md +230 -0
- package/specs/005-per-workspace-settings/spec.md +368 -0
- package/specs/005-per-workspace-settings/tasks.md +178 -0
- package/specs/006-dual-runtime-herdr-durable/intent.md +86 -0
- package/specs/006-dual-runtime-herdr-durable/journal.md +80 -0
- package/specs/006-dual-runtime-herdr-durable/plan.md +242 -0
- package/specs/006-dual-runtime-herdr-durable/spec.md +389 -0
- package/specs/006-dual-runtime-herdr-durable/tasks.md +199 -0
- package/specs/007-unwatched-completion-notice/journal.md +145 -0
- package/specs/007-unwatched-completion-notice/plan.md +186 -0
- package/specs/007-unwatched-completion-notice/spec.md +284 -0
- package/specs/007-unwatched-completion-notice/tasks.md +147 -0
- package/specs/008-remote-machine-sheep/intent.md +174 -0
- package/specs/008-remote-machine-sheep/journal.md +57 -0
- package/specs/008-remote-machine-sheep/prerequisites.md +219 -0
- package/specs/009-hc-runtime/intent.md +44 -0
- package/specs/009-hc-runtime/plan.md +49 -0
- package/specs/009-hc-runtime/spec.md +118 -0
- package/specs/009-hc-runtime/tasks.md +62 -0
- package/specs/010-unseen-watch-parity/intent.md +57 -0
- package/specs/010-unseen-watch-parity/journal.md +172 -0
- package/specs/010-unseen-watch-parity/plan.md +74 -0
- package/specs/010-unseen-watch-parity/spec.md +191 -0
- package/specs/010-unseen-watch-parity/tasks.md +119 -0
- package/specs/011-hc-background-poll/intent.md +57 -0
- package/specs/011-hc-background-poll/journal.md +95 -0
- package/specs/011-hc-background-poll/plan.md +87 -0
- package/specs/011-hc-background-poll/spec.md +141 -0
- package/specs/011-hc-background-poll/tasks.md +83 -0
- package/specs/012-steer-default/intent.md +12 -0
- package/specs/012-steer-default/journal.md +40 -0
- package/specs/012-steer-default/plan.md +7 -0
- package/specs/012-steer-default/spec.md +42 -0
- package/specs/012-steer-default/tasks.md +6 -0
- package/specs/013-opencode-shepherd/handoff-t011.md +94 -0
- package/specs/013-opencode-shepherd/intent.md +59 -0
- package/specs/013-opencode-shepherd/plan.md +204 -0
- package/specs/013-opencode-shepherd/spec.md +258 -0
- package/specs/013-opencode-shepherd/tasks.md +259 -0
- package/src/core/artifact-sessions.ts +835 -0
- package/src/core/config.ts +329 -0
- package/src/core/discovery.ts +342 -0
- package/src/core/herdr.ts +1 -0
- package/src/core/host.ts +77 -0
- package/src/core/ids.ts +78 -0
- package/src/core/lifecycle.ts +1 -0
- package/src/core/messaging.ts +1 -0
- package/src/core/migration.ts +55 -0
- package/src/core/orchestration.ts +1 -0
- package/src/core/types.ts +143 -0
- package/src/core/unseen-completions.ts +114 -0
- package/src/extension/cli.ts +417 -0
- package/src/extension/config.ts +1 -0
- package/src/extension/settings-ui.ts +296 -0
- package/src/extension/shepherd-done.ts +768 -0
- package/src/extension/shepherd.ts +2548 -0
- package/src/extension/system-prompt.ts +38 -0
- package/src/extension/unseen-completions.ts +237 -0
- package/src/opencode/actions.ts +794 -0
- package/src/opencode/bridge.ts +777 -0
- package/src/opencode/display.ts +36 -0
- package/src/opencode/fieldnotes.ts +60 -0
- package/src/opencode/host.ts +62 -0
- package/src/opencode/orphans.ts +162 -0
- package/src/opencode/server.ts +458 -0
- package/src/runtimes/backend.ts +119 -0
- package/src/runtimes/detect.ts +102 -0
- package/src/runtimes/hc/hc.ts +527 -0
- package/src/runtimes/hc/runtime.ts +1898 -0
- package/src/runtimes/herdr/herdr.ts +912 -0
- package/src/runtimes/herdr/lifecycle.ts +1712 -0
- package/src/runtimes/herdr/messaging.ts +703 -0
- package/src/runtimes/herdr/orchestration.ts +1583 -0
- package/src/runtimes/herdr/runtime.ts +224 -0
- package/src/runtimes/runtime.ts +133 -0
- package/src/runtimes/settle-observations.ts +114 -0
- package/test/fixtures/context-project/AGENTS.md +2 -0
- package/test/fixtures/home/.agents/agents/same.md +6 -0
- package/test/fixtures/home/.agents/agents/shared-only.md +6 -0
- package/test/fixtures/home/.pi/agent/agents/invalid-thinking.md +6 -0
- package/test/fixtures/home/.pi/agent/agents/model-empty.md +7 -0
- package/test/fixtures/home/.pi/agent/agents/model-explicit.md +7 -0
- package/test/fixtures/home/.pi/agent/agents/omit-context-absent.md +5 -0
- package/test/fixtures/home/.pi/agent/agents/omit-context-false.md +6 -0
- package/test/fixtures/home/.pi/agent/agents/omit-context-invalid.md +6 -0
- package/test/fixtures/home/.pi/agent/agents/omit-context-true.md +6 -0
- package/test/fixtures/home/.pi/agent/agents/omit-false.md +6 -0
- package/test/fixtures/home/.pi/agent/agents/omit-invalid.md +6 -0
- package/test/fixtures/home/.pi/agent/agents/omit-pi-docs.md +7 -0
- package/test/fixtures/home/.pi/agent/agents/omit-true.md +6 -0
- package/test/fixtures/home/.pi/agent/agents/only-user.md +9 -0
- package/test/fixtures/home/.pi/agent/agents/same.md +6 -0
- package/test/fixtures/proj/.agents/agents/proj-shared.md +6 -0
- package/test/fixtures/proj/.pi/agents/project-pi.md +6 -0
- package/test/fixtures/proj/.pi/agents/same.md +6 -0
- package/test/helpers/fake-clock.mjs +39 -0
- package/test/helpers/feature-contracts.mjs +44 -0
- package/test/helpers/test-utils.mjs +44 -0
- package/test/verify-artifact-sessions.mjs +258 -0
- package/test/verify-backend.mjs +297 -0
- package/test/verify-child-mislabel.mjs +135 -0
- package/test/verify-child-surface.mjs +321 -0
- package/test/verify-cli.mjs +197 -0
- package/test/verify-command-ux.mjs +100 -0
- package/test/verify-compat.mjs +32 -0
- package/test/verify-cross-host-notes.mjs +128 -0
- package/test/verify-delegate.mjs +161 -0
- package/test/verify-detect.mjs +151 -0
- package/test/verify-discovery.mjs +239 -0
- package/test/verify-done-nudge.mjs +238 -0
- package/test/verify-effective-prompt.mjs +98 -0
- package/test/verify-hc-matrix.mjs +246 -0
- package/test/verify-hc-poll.mjs +260 -0
- package/test/verify-host-docs.mjs +35 -0
- package/test/verify-host-impact.mjs +49 -0
- package/test/verify-ids.mjs +141 -0
- package/test/verify-launch.mjs +183 -0
- package/test/verify-message-routing.mjs +560 -0
- package/test/verify-messaging.mjs +303 -0
- package/test/verify-migration-notice.mjs +69 -0
- package/test/verify-multi-wait.mjs +42 -0
- package/test/verify-opencode-display.mjs +47 -0
- package/test/verify-opencode-fieldnotes.mjs +121 -0
- package/test/verify-opencode-notice.mjs +77 -0
- package/test/verify-opencode-nudge.mjs +116 -0
- package/test/verify-opencode-orphans.mjs +160 -0
- package/test/verify-opencode-surface.mjs +107 -0
- package/test/verify-packaging.mjs +82 -0
- package/test/verify-parent-surface.mjs +118 -0
- package/test/verify-phase0.mjs +95 -0
- package/test/verify-registry.mjs +124 -0
- package/test/verify-rename-migration.mjs +111 -0
- package/test/verify-rendering.mjs +379 -0
- package/test/verify-session-boundary.mjs +146 -0
- package/test/verify-settings.mjs +260 -0
- package/test/verify-stale-wait.mjs +339 -0
- package/test/verify-status-widget.mjs +377 -0
- package/test/verify-status.mjs +172 -0
- package/test/verify-task-completion.mjs +156 -0
- package/test/verify-task-failures.mjs +201 -0
- package/test/verify-task-mislabel.mjs +143 -0
- package/test/verify-task-registry.mjs +194 -0
- package/test/verify-task-watchers.mjs +217 -0
- package/test/verify-tool-schemas.mjs +120 -0
- package/test/verify-unseen-completions.mjs +1211 -0
- package/test/verify-watchers.mjs +181 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Phase 1 — discovery verification harness.
|
|
4
|
+
*
|
|
5
|
+
* Exercises discoverAgents() across the fixture tree in test/fixtures and
|
|
6
|
+
* asserts precedence + scope filtering across the user/project locations.
|
|
7
|
+
*
|
|
8
|
+
* How user dirs are controlled: discovery.ts resolves user dirs via
|
|
9
|
+
* getAgentDir() (= $HOME/.pi/agent) and os.homedir() (= $HOME/.agents). Both
|
|
10
|
+
* read $HOME at call time, so we set process.env.HOME to the fixture "home"
|
|
11
|
+
* BEFORE the dynamic import, then call discoverAgents().
|
|
12
|
+
*
|
|
13
|
+
* The bundled base dirs (pi-shepherd's own .pi/agents and .agents/agents) are
|
|
14
|
+
* package-fixed and cannot be injected; they contain no named agents yet, so
|
|
15
|
+
* we only assert they are reported in projectDirs.
|
|
16
|
+
*
|
|
17
|
+
* Run: node --experimental-strip-types test/verify-discovery.mjs
|
|
18
|
+
* (node >= 22.6 with type stripping; a `test` script is also wired in package.json)
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import * as path from 'node:path';
|
|
22
|
+
import { fileURLToPath } from 'node:url';
|
|
23
|
+
|
|
24
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
const fixtures = path.join(__dirname, 'fixtures');
|
|
26
|
+
|
|
27
|
+
// Point user dirs at the fixture "home" BEFORE importing discovery.
|
|
28
|
+
process.env.HOME = path.join(fixtures, 'home');
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
discoverAgents,
|
|
32
|
+
formatAgentList,
|
|
33
|
+
normalizeModel,
|
|
34
|
+
normalizeThinking,
|
|
35
|
+
resolveDelegatedModel,
|
|
36
|
+
resolveDelegatedThinking,
|
|
37
|
+
} = await import('../src/core/discovery.ts');
|
|
38
|
+
|
|
39
|
+
let failures = 0;
|
|
40
|
+
function assert(cond, label, extra = '') {
|
|
41
|
+
if (cond) {
|
|
42
|
+
console.log(`PASS ${label}${extra ? ` — ${extra}` : ''}`);
|
|
43
|
+
} else {
|
|
44
|
+
failures++;
|
|
45
|
+
console.log(`FAIL ${label}${extra ? ` — ${extra}` : ''}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const proj = path.join(fixtures, 'proj');
|
|
50
|
+
|
|
51
|
+
function namesOf(r) {
|
|
52
|
+
return r.agents.map(a => a.name).sort();
|
|
53
|
+
}
|
|
54
|
+
function descOf(r, name) {
|
|
55
|
+
const a = r.agents.find(x => x.name === name);
|
|
56
|
+
return a ? a.description : undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// --- user scope: only user-level agents, no project agents -----------------
|
|
60
|
+
const user = discoverAgents(proj, 'user');
|
|
61
|
+
assert(!!descOf(user, 'same')?.includes('user1-same'), "user scope: 'same' -> user1 version");
|
|
62
|
+
assert(!!descOf(user, 'only-user'), 'user scope: includes only-user');
|
|
63
|
+
assert(!!descOf(user, 'shared-only'), 'user scope: includes shared-only (user2)');
|
|
64
|
+
assert(!descOf(user, 'project-pi'), 'user scope: excludes project-pi');
|
|
65
|
+
assert(!descOf(user, 'proj-shared'), 'user scope: excludes proj-shared');
|
|
66
|
+
assert(!descOf(user, 'invalid-thinking'), 'user scope: invalid thinking definition is skipped');
|
|
67
|
+
assert(
|
|
68
|
+
resolveDelegatedModel('default', { provider: 'test-provider', id: 'test-model' }) ===
|
|
69
|
+
'test-provider/test-model',
|
|
70
|
+
'model: default sentinel inherits parent'
|
|
71
|
+
);
|
|
72
|
+
assert(
|
|
73
|
+
resolveDelegatedModel('explicit/model', { provider: 'test-provider', id: 'test-model' }) ===
|
|
74
|
+
'explicit/model',
|
|
75
|
+
'model: explicit model still wins'
|
|
76
|
+
);
|
|
77
|
+
assert(
|
|
78
|
+
resolveDelegatedThinking(undefined, 'high') === 'high',
|
|
79
|
+
'thinking: absent value inherits parent level'
|
|
80
|
+
);
|
|
81
|
+
assert(
|
|
82
|
+
resolveDelegatedThinking('default', 'xhigh') === 'xhigh',
|
|
83
|
+
'thinking: default sentinel inherits parent level'
|
|
84
|
+
);
|
|
85
|
+
assert(
|
|
86
|
+
resolveDelegatedThinking('off', 'high') === 'off',
|
|
87
|
+
'thinking: explicit off wins over parent level'
|
|
88
|
+
);
|
|
89
|
+
const omitTrue = user.agents.find(a => a.name === 'omit-true');
|
|
90
|
+
const omitFalse = user.agents.find(a => a.name === 'omit-false');
|
|
91
|
+
const omitInvalid = user.agents.find(a => a.name === 'omit-invalid');
|
|
92
|
+
const omitPiDocs = user.agents.find(a => a.name === 'omit-pi-docs');
|
|
93
|
+
const omitContextTrue = user.agents.find(a => a.name === 'omit-context-true');
|
|
94
|
+
const omitContextFalse = user.agents.find(a => a.name === 'omit-context-false');
|
|
95
|
+
const omitContextInvalid = user.agents.find(a => a.name === 'omit-context-invalid');
|
|
96
|
+
const omitContextAbsent = user.agents.find(a => a.name === 'omit-context-absent');
|
|
97
|
+
assert(omitTrue?.omitSystemPrompt === true, 'frontmatter: strict true is retained');
|
|
98
|
+
assert(omitFalse?.omitSystemPrompt === false, 'frontmatter: strict false is retained');
|
|
99
|
+
assert(omitInvalid?.omitSystemPrompt === undefined, 'frontmatter: quoted true is ignored');
|
|
100
|
+
assert(
|
|
101
|
+
omitPiDocs?.omitPiDocumentation === true,
|
|
102
|
+
'frontmatter: omit-pi-documentation true is retained'
|
|
103
|
+
);
|
|
104
|
+
assert(
|
|
105
|
+
user.agents.find(a => a.name === 'only-user')?.omitPiDocumentation === false,
|
|
106
|
+
'frontmatter: omit-pi-documentation defaults false'
|
|
107
|
+
);
|
|
108
|
+
assert(
|
|
109
|
+
user.agents.find(a => a.name === 'only-user')?.userInvocable === true,
|
|
110
|
+
'frontmatter: user-invocable is retained'
|
|
111
|
+
);
|
|
112
|
+
assert(
|
|
113
|
+
user.agents.find(a => a.name === 'omit-context-absent')?.userInvocable === true,
|
|
114
|
+
'frontmatter: user-invocable defaults true'
|
|
115
|
+
);
|
|
116
|
+
assert(
|
|
117
|
+
omitContextTrue?.omitContextFiles === true,
|
|
118
|
+
'frontmatter: omit-context-files strict true is retained'
|
|
119
|
+
);
|
|
120
|
+
assert(
|
|
121
|
+
omitContextFalse?.omitContextFiles === false,
|
|
122
|
+
'frontmatter: omit-context-files strict false is retained'
|
|
123
|
+
);
|
|
124
|
+
assert(
|
|
125
|
+
omitContextInvalid?.omitContextFiles === false,
|
|
126
|
+
'frontmatter: omit-context-files quoted true is ignored'
|
|
127
|
+
);
|
|
128
|
+
assert(
|
|
129
|
+
omitContextAbsent?.omitContextFiles === false,
|
|
130
|
+
'frontmatter: omit-context-files defaults false'
|
|
131
|
+
);
|
|
132
|
+
assert(
|
|
133
|
+
normalizeModel(' anthropic/claude ') === 'anthropic/claude',
|
|
134
|
+
'frontmatter: model is trimmed'
|
|
135
|
+
);
|
|
136
|
+
assert(
|
|
137
|
+
normalizeModel(' ') === undefined && normalizeModel(null) === undefined,
|
|
138
|
+
'frontmatter: empty/null model inherits'
|
|
139
|
+
);
|
|
140
|
+
assert(
|
|
141
|
+
normalizeThinking(' HIGH ') === 'high',
|
|
142
|
+
'frontmatter: thinking level is trimmed and normalized'
|
|
143
|
+
);
|
|
144
|
+
assert(
|
|
145
|
+
normalizeThinking('') === undefined &&
|
|
146
|
+
normalizeThinking(null) === undefined &&
|
|
147
|
+
normalizeThinking('default') === undefined,
|
|
148
|
+
'frontmatter: empty/null/default thinking inherits'
|
|
149
|
+
);
|
|
150
|
+
let invalidModelRejected = false;
|
|
151
|
+
try {
|
|
152
|
+
normalizeModel('none');
|
|
153
|
+
} catch {
|
|
154
|
+
invalidModelRejected = true;
|
|
155
|
+
}
|
|
156
|
+
assert(invalidModelRejected, 'frontmatter: none model value is rejected');
|
|
157
|
+
let invalidThinkingRejected = false;
|
|
158
|
+
try {
|
|
159
|
+
normalizeThinking('none');
|
|
160
|
+
} catch {
|
|
161
|
+
invalidThinkingRejected = true;
|
|
162
|
+
}
|
|
163
|
+
assert(invalidThinkingRejected, 'frontmatter: none thinking value is rejected');
|
|
164
|
+
assert(
|
|
165
|
+
user.agents.find(a => a.name === 'model-explicit')?.model === 'anthropic/claude-sonnet-4-5',
|
|
166
|
+
'frontmatter: explicit model is retained'
|
|
167
|
+
);
|
|
168
|
+
assert(
|
|
169
|
+
user.agents.find(a => a.name === 'model-explicit')?.thinking === 'high',
|
|
170
|
+
'frontmatter: explicit thinking level is retained'
|
|
171
|
+
);
|
|
172
|
+
assert(
|
|
173
|
+
user.agents.find(a => a.name === 'model-empty')?.thinking === undefined,
|
|
174
|
+
'frontmatter: empty thinking is normalized for inheritance'
|
|
175
|
+
);
|
|
176
|
+
assert(
|
|
177
|
+
user.agents.find(a => a.name === 'model-empty')?.model === undefined,
|
|
178
|
+
'frontmatter: empty model is normalized for inheritance'
|
|
179
|
+
);
|
|
180
|
+
assert(
|
|
181
|
+
resolveDelegatedModel(undefined, { provider: 'openai', id: 'gpt-4o' }) === 'openai/gpt-4o',
|
|
182
|
+
'model: parent provider/id inherited'
|
|
183
|
+
);
|
|
184
|
+
assert(
|
|
185
|
+
resolveDelegatedModel(' custom/model ', { provider: 'openai', id: 'gpt-4o' }) === 'custom/model',
|
|
186
|
+
'model: explicit agent wins'
|
|
187
|
+
);
|
|
188
|
+
assert(resolveDelegatedModel(undefined, undefined) === undefined, 'model: absent parent omitted');
|
|
189
|
+
|
|
190
|
+
// --- project scope: only project agents ------------------------------------
|
|
191
|
+
const project = discoverAgents(proj, 'project');
|
|
192
|
+
assert(!!descOf(project, 'project-pi'), 'project scope: includes project-pi');
|
|
193
|
+
assert(!!descOf(project, 'proj-shared'), 'project scope: includes proj-shared');
|
|
194
|
+
assert(!descOf(project, 'only-user'), 'project scope: excludes only-user (user)');
|
|
195
|
+
assert(!descOf(project, 'shared-only'), 'project scope: excludes shared-only (user)');
|
|
196
|
+
assert(
|
|
197
|
+
!!descOf(project, 'same')?.includes('proj-pi-same'),
|
|
198
|
+
"project scope: 'same' -> proj-pi version"
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
// --- both scope: precedence user1 > user2 > project ------------------------
|
|
202
|
+
const both = discoverAgents(proj, 'both');
|
|
203
|
+
assert(!!descOf(both, 'only-user'), 'both scope: includes only-user');
|
|
204
|
+
assert(!!descOf(both, 'proj-shared'), 'both scope: includes proj-shared');
|
|
205
|
+
assert(!!descOf(both, 'project-pi'), 'both scope: includes project-pi');
|
|
206
|
+
assert(
|
|
207
|
+
!!descOf(both, 'same')?.includes('user1-same'),
|
|
208
|
+
"both scope: 'same' -> user1 wins over user2+project"
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
// bundled base dirs are resolved and reported (package-fixed, no named agents yet)
|
|
212
|
+
const bundledInDirs = both.projectDirs.some(d => d.includes('.pi') || d.includes('.agents'));
|
|
213
|
+
assert(
|
|
214
|
+
bundledInDirs,
|
|
215
|
+
'both scope: bundled base dirs reported in projectDirs',
|
|
216
|
+
JSON.stringify(both.projectDirs)
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
// formatAgentList sanity
|
|
220
|
+
const fmt = formatAgentList(both.agents, 2);
|
|
221
|
+
assert(
|
|
222
|
+
typeof fmt.text === 'string' && fmt.remaining >= 0,
|
|
223
|
+
'formatAgentList returns text+remaining'
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
console.log(
|
|
227
|
+
'\nSummary: user=',
|
|
228
|
+
namesOf(user).join(','),
|
|
229
|
+
'| project=',
|
|
230
|
+
namesOf(project).join(','),
|
|
231
|
+
'| both=',
|
|
232
|
+
namesOf(both).join(',')
|
|
233
|
+
);
|
|
234
|
+
if (failures > 0) {
|
|
235
|
+
console.error(`\n${failures} assertion(s) FAILED`);
|
|
236
|
+
process.exit(1);
|
|
237
|
+
}
|
|
238
|
+
console.log('\nAll assertions passed.');
|
|
239
|
+
process.exit(0);
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Verification for the forgotten-shepherd_done recovery: a tracked task that a
|
|
4
|
+
* child leaves open at turn end gets one reminder turn, and a task that stays
|
|
5
|
+
* open past the budget is escalated to the parent instead of looping.
|
|
6
|
+
*/
|
|
7
|
+
import assert from 'node:assert/strict';
|
|
8
|
+
import {
|
|
9
|
+
createChildBroker,
|
|
10
|
+
createEnvelope,
|
|
11
|
+
createParentBroker,
|
|
12
|
+
pollParentInbox,
|
|
13
|
+
publishFromParent,
|
|
14
|
+
registerChild,
|
|
15
|
+
} from '../src/core/messaging.ts';
|
|
16
|
+
import { withTempDirectory } from './helpers/test-utils.mjs';
|
|
17
|
+
|
|
18
|
+
const envNames = [
|
|
19
|
+
'PI_SHEPHERD_BROKER_DIR',
|
|
20
|
+
'PI_SHEPHERD_BROKER_SESSION_ID',
|
|
21
|
+
'PI_SHEPHERD_BROKER_ID',
|
|
22
|
+
'PI_SHEPHERD_AGENT_ID',
|
|
23
|
+
'PI_SHEPHERD_BROKER_TOKEN',
|
|
24
|
+
'PI_SHEPHERD_AGENT_INBOX',
|
|
25
|
+
'PI_SHEPHERD_TASK_ID',
|
|
26
|
+
'PI_SHEPHERD_SESSION',
|
|
27
|
+
'PI_SHEPHERD_AUTO_EXIT',
|
|
28
|
+
'PI_SHEPHERD_STAY_OPEN',
|
|
29
|
+
'PI_SHEPHERD_DONE_NUDGES',
|
|
30
|
+
];
|
|
31
|
+
const savedEnv = Object.fromEntries(envNames.map(name => [name, process.env[name]]));
|
|
32
|
+
const { default: registerChildExtension } = await import('../src/extension/shepherd-done.ts');
|
|
33
|
+
|
|
34
|
+
/** Load the child extension with a fresh fake pi harness. */
|
|
35
|
+
function loadChild({ taskId, nudges, autoExit = '0', stayOpen = '1' } = {}) {
|
|
36
|
+
if (taskId === undefined) delete process.env.PI_SHEPHERD_TASK_ID;
|
|
37
|
+
else process.env.PI_SHEPHERD_TASK_ID = taskId;
|
|
38
|
+
if (nudges === undefined) delete process.env.PI_SHEPHERD_DONE_NUDGES;
|
|
39
|
+
else process.env.PI_SHEPHERD_DONE_NUDGES = String(nudges);
|
|
40
|
+
process.env.PI_SHEPHERD_AUTO_EXIT = autoExit;
|
|
41
|
+
process.env.PI_SHEPHERD_STAY_OPEN = stayOpen;
|
|
42
|
+
delete process.env.PI_SHEPHERD_SESSION;
|
|
43
|
+
const registered = [];
|
|
44
|
+
const handlers = new Map();
|
|
45
|
+
const sentUserMessages = [];
|
|
46
|
+
const pi = {
|
|
47
|
+
registerTool(tool) {
|
|
48
|
+
registered.push(tool);
|
|
49
|
+
},
|
|
50
|
+
on(event, handler) {
|
|
51
|
+
handlers.set(event, handler);
|
|
52
|
+
},
|
|
53
|
+
sendUserMessage(content, options) {
|
|
54
|
+
sentUserMessages.push({ content, options });
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
registerChildExtension(pi);
|
|
58
|
+
return {
|
|
59
|
+
pi,
|
|
60
|
+
handlers,
|
|
61
|
+
sentUserMessages,
|
|
62
|
+
tools: Object.fromEntries(registered.map(tool => [tool.name, tool])),
|
|
63
|
+
async endTurn(messages = [{ role: 'assistant', stopReason: 'stop' }]) {
|
|
64
|
+
let shutdowns = 0;
|
|
65
|
+
await handlers.get('agent_end')({ messages }, {
|
|
66
|
+
shutdown() {
|
|
67
|
+
shutdowns += 1;
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return shutdowns;
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const normalEnd = [{ role: 'assistant', stopReason: 'stop' }];
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
await withTempDirectory('pi-shepherd-done-nudge-', async root => {
|
|
79
|
+
const broker = createParentBroker('done-nudge-session', { rootDir: `${root}/broker` });
|
|
80
|
+
|
|
81
|
+
// --- 1. A tracked task left open at turn end gets exactly one reminder.
|
|
82
|
+
let capability = registerChild(broker, 'shepherd-agent-nudge');
|
|
83
|
+
Object.assign(process.env, {
|
|
84
|
+
PI_SHEPHERD_BROKER_DIR: broker.rootDir,
|
|
85
|
+
PI_SHEPHERD_BROKER_SESSION_ID: capability.sessionId,
|
|
86
|
+
PI_SHEPHERD_BROKER_ID: capability.brokerId,
|
|
87
|
+
PI_SHEPHERD_AGENT_ID: capability.agentId,
|
|
88
|
+
PI_SHEPHERD_BROKER_TOKEN: capability.token,
|
|
89
|
+
PI_SHEPHERD_AGENT_INBOX: capability.inboxPath,
|
|
90
|
+
});
|
|
91
|
+
let child = loadChild({ taskId: 'shepherd-task-nudge' });
|
|
92
|
+
let shutdowns = await child.endTurn(normalEnd);
|
|
93
|
+
assert.equal(shutdowns, 0);
|
|
94
|
+
assert.equal(child.sentUserMessages.length, 1, 'a forgotten done produces one reminder turn');
|
|
95
|
+
const nudge = child.sentUserMessages[0];
|
|
96
|
+
assert.match(nudge.content, /shepherd_done/);
|
|
97
|
+
assert.match(nudge.content, /shepherd-task-nudge/);
|
|
98
|
+
assert.equal(nudge.options.deliverAs, 'followUp');
|
|
99
|
+
assert.equal(nudge.options.triggerTurn, true);
|
|
100
|
+
console.log('PASS a tracked task left open at turn end is nudged with shepherd_done');
|
|
101
|
+
|
|
102
|
+
// The reminder is a queued follow-up, not a fabricated completion.
|
|
103
|
+
assert.deepEqual(pollParentInbox(broker), [], 'nudging alone publishes no task completion');
|
|
104
|
+
|
|
105
|
+
// --- 2. The nudge is not repeated once the child complies.
|
|
106
|
+
const done = await child.tools.shepherd_done.execute('done-1', {
|
|
107
|
+
status: 'completed',
|
|
108
|
+
summary: 'Wrote the migration.',
|
|
109
|
+
});
|
|
110
|
+
assert.equal(done.details.returnCode, 0);
|
|
111
|
+
assert.equal(pollParentInbox(broker).filter(e => e.kind === 'task_done').length, 1);
|
|
112
|
+
await child.endTurn(normalEnd);
|
|
113
|
+
assert.equal(child.sentUserMessages.length, 1, 'a completed task is never nudged again');
|
|
114
|
+
console.log('PASS calling shepherd_done clears the open task and stops further nudges');
|
|
115
|
+
|
|
116
|
+
// --- 3. A forgotten done escalates to the parent once the budget is spent.
|
|
117
|
+
capability = registerChild(broker, 'shepherd-agent-nudge-escalate');
|
|
118
|
+
Object.assign(process.env, {
|
|
119
|
+
PI_SHEPHERD_BROKER_SESSION_ID: capability.sessionId,
|
|
120
|
+
PI_SHEPHERD_BROKER_ID: capability.brokerId,
|
|
121
|
+
PI_SHEPHERD_AGENT_ID: capability.agentId,
|
|
122
|
+
PI_SHEPHERD_BROKER_TOKEN: capability.token,
|
|
123
|
+
PI_SHEPHERD_AGENT_INBOX: capability.inboxPath,
|
|
124
|
+
});
|
|
125
|
+
child = loadChild({ taskId: 'shepherd-task-escalate', nudges: 1 });
|
|
126
|
+
await child.endTurn(normalEnd);
|
|
127
|
+
assert.equal(child.sentUserMessages.length, 1, 'first forgotten done nudges');
|
|
128
|
+
await child.endTurn(normalEnd); // the reminder turn also forgets shepherd_done
|
|
129
|
+
assert.equal(child.sentUserMessages.length, 1, 'the reminder budget is bounded');
|
|
130
|
+
const escalation = pollParentInbox(broker).find(
|
|
131
|
+
e => e.kind === 'message' && String(e.content).includes('completion stalled')
|
|
132
|
+
);
|
|
133
|
+
assert.ok(escalation, 'an exhausted reminder budget is reported to the parent');
|
|
134
|
+
assert.equal(escalation.taskId, 'shepherd-task-escalate');
|
|
135
|
+
assert.equal(escalation.targetId, broker.parentId);
|
|
136
|
+
assert.equal(escalation.expectsReply, undefined, 'the escalation is passive, not a question');
|
|
137
|
+
await child.endTurn(normalEnd);
|
|
138
|
+
assert.equal(
|
|
139
|
+
pollParentInbox(broker).filter(e => String(e.content).includes('completion stalled')).length,
|
|
140
|
+
0,
|
|
141
|
+
'the stall is not re-reported on every later turn'
|
|
142
|
+
);
|
|
143
|
+
console.log('PASS an exhausted reminder budget escalates to the parent exactly once');
|
|
144
|
+
|
|
145
|
+
// --- 4. Legitimate turn ends are never nudged.
|
|
146
|
+
capability = registerChild(broker, 'shepherd-agent-nudge-guard');
|
|
147
|
+
Object.assign(process.env, {
|
|
148
|
+
PI_SHEPHERD_BROKER_SESSION_ID: capability.sessionId,
|
|
149
|
+
PI_SHEPHERD_BROKER_ID: capability.brokerId,
|
|
150
|
+
PI_SHEPHERD_AGENT_ID: capability.agentId,
|
|
151
|
+
PI_SHEPHERD_BROKER_TOKEN: capability.token,
|
|
152
|
+
PI_SHEPHERD_AGENT_INBOX: capability.inboxPath,
|
|
153
|
+
});
|
|
154
|
+
// (a) aborted turn — the user took over in the tab.
|
|
155
|
+
child = loadChild({ taskId: 'shepherd-task-aborted' });
|
|
156
|
+
await child.endTurn([{ role: 'assistant', stopReason: 'aborted' }]);
|
|
157
|
+
// (b) provider error — another path reports the failure.
|
|
158
|
+
await child.endTurn([{ role: 'assistant', stopReason: 'error', errorMessage: 'rate limited' }]);
|
|
159
|
+
assert.equal(child.sentUserMessages.length, 0, 'aborted and errored turns are left alone');
|
|
160
|
+
// (c) no tracked task — plain prompts settle through the sidecar.
|
|
161
|
+
child = loadChild({ taskId: undefined });
|
|
162
|
+
await child.endTurn(normalEnd);
|
|
163
|
+
assert.equal(child.sentUserMessages.length, 0, 'an agent without a tracked task is not nudged');
|
|
164
|
+
console.log('PASS aborted, errored, and untracked turn ends are never nudged');
|
|
165
|
+
|
|
166
|
+
// --- 5. A child waiting for a tracked reply may end its turn in peace.
|
|
167
|
+
capability = registerChild(broker, 'shepherd-agent-nudge-waiting');
|
|
168
|
+
Object.assign(process.env, {
|
|
169
|
+
PI_SHEPHERD_BROKER_SESSION_ID: capability.sessionId,
|
|
170
|
+
PI_SHEPHERD_BROKER_ID: capability.brokerId,
|
|
171
|
+
PI_SHEPHERD_AGENT_ID: capability.agentId,
|
|
172
|
+
PI_SHEPHERD_BROKER_TOKEN: capability.token,
|
|
173
|
+
PI_SHEPHERD_AGENT_INBOX: capability.inboxPath,
|
|
174
|
+
});
|
|
175
|
+
child = loadChild({ taskId: 'shepherd-task-waiting' });
|
|
176
|
+
const request = await child.tools.shepherd_message.execute('ask-parent', {
|
|
177
|
+
target: 'shepherd',
|
|
178
|
+
message: 'Which migration do you want applied?',
|
|
179
|
+
expectsReply: true,
|
|
180
|
+
});
|
|
181
|
+
assert.equal(request.details.returnCode, 0);
|
|
182
|
+
pollParentInbox(broker);
|
|
183
|
+
await child.endTurn(normalEnd);
|
|
184
|
+
assert.equal(
|
|
185
|
+
child.sentUserMessages.length,
|
|
186
|
+
0,
|
|
187
|
+
'ending the turn while a tracked request is outstanding is not a forgotten done'
|
|
188
|
+
);
|
|
189
|
+
// The reply arrives and closes the request; the next forgotten done nudges.
|
|
190
|
+
publishFromParent(
|
|
191
|
+
broker,
|
|
192
|
+
createEnvelope(
|
|
193
|
+
{ sessionId: broker.sessionId, brokerId: broker.brokerId, senderId: broker.parentId },
|
|
194
|
+
{
|
|
195
|
+
kind: 'reply',
|
|
196
|
+
targetId: capability.agentId,
|
|
197
|
+
taskId: 'shepherd-task-waiting',
|
|
198
|
+
replyTo: request.details.messageId,
|
|
199
|
+
delivery: 'followUp',
|
|
200
|
+
content: 'Apply migration 0042.',
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
);
|
|
204
|
+
const delivered = child.sentUserMessages.length;
|
|
205
|
+
await child.handlers.get('session_start')({}, {});
|
|
206
|
+
await new Promise(resolve => setTimeout(resolve, 300));
|
|
207
|
+
await child.handlers.get('session_shutdown')({}, {});
|
|
208
|
+
assert.equal(child.sentUserMessages.length - delivered, 1, 'the reply is delivered as its own turn');
|
|
209
|
+
assert.match(child.sentUserMessages.at(-1).content, /Apply migration 0042/);
|
|
210
|
+
await child.endTurn(normalEnd);
|
|
211
|
+
assert.equal(child.sentUserMessages.length, 2, 'after the reply, a forgotten done is nudged');
|
|
212
|
+
assert.match(child.sentUserMessages[1].content, /\[Shepherd completion check\]/);
|
|
213
|
+
console.log('PASS waiting for a tracked reply suppresses the nudge until the answer lands');
|
|
214
|
+
|
|
215
|
+
// --- 6. Nudging can be disabled without changing any other behavior.
|
|
216
|
+
capability = registerChild(broker, 'shepherd-agent-nudge-disabled');
|
|
217
|
+
Object.assign(process.env, {
|
|
218
|
+
PI_SHEPHERD_BROKER_SESSION_ID: capability.sessionId,
|
|
219
|
+
PI_SHEPHERD_BROKER_ID: capability.brokerId,
|
|
220
|
+
PI_SHEPHERD_AGENT_ID: capability.agentId,
|
|
221
|
+
PI_SHEPHERD_BROKER_TOKEN: capability.token,
|
|
222
|
+
PI_SHEPHERD_AGENT_INBOX: capability.inboxPath,
|
|
223
|
+
});
|
|
224
|
+
child = loadChild({ taskId: 'shepherd-task-disabled', nudges: 0 });
|
|
225
|
+
await child.endTurn(normalEnd);
|
|
226
|
+
await child.endTurn(normalEnd);
|
|
227
|
+
assert.equal(child.sentUserMessages.length, 0, 'PI_SHEPHERD_DONE_NUDGES=0 disables nudging');
|
|
228
|
+
assert.equal(pollParentInbox(broker).length, 0, 'a disabled nudge reports nothing');
|
|
229
|
+
console.log('PASS nudging is opt-out via PI_SHEPHERD_DONE_NUDGES=0');
|
|
230
|
+
});
|
|
231
|
+
} finally {
|
|
232
|
+
for (const name of envNames) {
|
|
233
|
+
if (savedEnv[name] === undefined) delete process.env[name];
|
|
234
|
+
else process.env[name] = savedEnv[name];
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
console.log('All completion-nudge assertions passed.');
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* End-to-end verification of Pi context-file loading for discovered agents.
|
|
4
|
+
*
|
|
5
|
+
* The extractor aborts from before_agent_start, before making a provider
|
|
6
|
+
* request. A dummy Anthropic key is enough to let Pi initialize while keeping
|
|
7
|
+
* this test network-free.
|
|
8
|
+
*/
|
|
9
|
+
import * as fs from 'node:fs';
|
|
10
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
11
|
+
import * as os from 'node:os';
|
|
12
|
+
import * as path from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
|
|
15
|
+
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
16
|
+
const project = path.join(root, 'test', 'fixtures', 'context-project');
|
|
17
|
+
const script = path.join(root, 'scripts', 'extract-pi-system-prompt.mjs');
|
|
18
|
+
const marker = 'UNIQUE_CONTEXT_FIXTURE_MARKER_7f3d2c9a';
|
|
19
|
+
const failures = [];
|
|
20
|
+
|
|
21
|
+
if (spawnSync('pi', ['--version'], { stdio: 'ignore' }).status === null) {
|
|
22
|
+
console.log('SKIP effective prompt integration: pi is not available');
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const agentDir = fs.mkdtempSync(path.join(os.tmpdir(), 'pi-shepherd-effective-prompt-'));
|
|
27
|
+
try {
|
|
28
|
+
const agentsDir = path.join(agentDir, 'agents');
|
|
29
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
30
|
+
fs.writeFileSync(
|
|
31
|
+
path.join(agentsDir, 'context-enabled.md'),
|
|
32
|
+
'---\nname: context-enabled\ndescription: Receives project context\n---\nUNIQUE_AGENT_BODY_ENABLED_1a2b3c4d\n'
|
|
33
|
+
);
|
|
34
|
+
fs.writeFileSync(
|
|
35
|
+
path.join(agentsDir, 'context-disabled.md'),
|
|
36
|
+
'---\nname: context-disabled\ndescription: Omits project context\nomit-context-files: true\n---\nUNIQUE_AGENT_BODY_DISABLED_5e6f7a8b\n'
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
function extract(agent) {
|
|
40
|
+
const output = execFileSync(
|
|
41
|
+
process.execPath,
|
|
42
|
+
[
|
|
43
|
+
'--experimental-strip-types',
|
|
44
|
+
'--disable-warning=ExperimentalWarning',
|
|
45
|
+
script,
|
|
46
|
+
'agent',
|
|
47
|
+
agent,
|
|
48
|
+
'--scope',
|
|
49
|
+
'user',
|
|
50
|
+
'--cwd',
|
|
51
|
+
project,
|
|
52
|
+
'--model',
|
|
53
|
+
'anthropic/claude-sonnet-4-5',
|
|
54
|
+
'--json',
|
|
55
|
+
],
|
|
56
|
+
{
|
|
57
|
+
cwd: root,
|
|
58
|
+
encoding: 'utf8',
|
|
59
|
+
env: {
|
|
60
|
+
...process.env,
|
|
61
|
+
HOME: agentDir,
|
|
62
|
+
PI_CODING_AGENT_DIR: agentDir,
|
|
63
|
+
ANTHROPIC_API_KEY: 'dummy',
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
return JSON.parse(output);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const enabled = extract('context-enabled');
|
|
71
|
+
const disabled = extract('context-disabled');
|
|
72
|
+
const enabledPrompt = enabled.systemPrompt ?? '';
|
|
73
|
+
const disabledPrompt = disabled.systemPrompt ?? '';
|
|
74
|
+
|
|
75
|
+
if (!enabledPrompt.includes(marker)) failures.push('enabled agent receives AGENTS.md context');
|
|
76
|
+
if (disabledPrompt.includes(marker)) failures.push('disabled agent omits AGENTS.md context');
|
|
77
|
+
if (!enabledPrompt.includes('UNIQUE_AGENT_BODY_ENABLED_1a2b3c4d'))
|
|
78
|
+
failures.push('enabled agent body remains present');
|
|
79
|
+
if (!disabledPrompt.includes('UNIQUE_AGENT_BODY_DISABLED_5e6f7a8b'))
|
|
80
|
+
failures.push('disabled agent body remains present');
|
|
81
|
+
if (enabled.cwd !== project || disabled.cwd !== project)
|
|
82
|
+
failures.push('child cwd remains the requested project');
|
|
83
|
+
|
|
84
|
+
for (const label of [
|
|
85
|
+
'enabled agent receives AGENTS.md context',
|
|
86
|
+
'disabled agent omits AGENTS.md context',
|
|
87
|
+
'enabled agent body remains present',
|
|
88
|
+
'disabled agent body remains present',
|
|
89
|
+
'child cwd remains the requested project',
|
|
90
|
+
]) {
|
|
91
|
+
console.log(`${failures.includes(label) ? 'FAIL' : 'PASS'} ${label}`);
|
|
92
|
+
}
|
|
93
|
+
} finally {
|
|
94
|
+
fs.rmSync(agentDir, { recursive: true, force: true });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (failures.length > 0) process.exit(1);
|
|
98
|
+
console.log('All effective prompt assertions passed.');
|