




















@@ -1,3 +1,4 @@
1+/** Tests agent bootstrap file discovery, filtering, and injected context modes. */
12import fs from "node:fs/promises";
23import path from "node:path";
34import { afterEach, beforeEach, describe, expect, it } from "vitest";
@@ -36,6 +37,8 @@ function registerExtraBootstrapFileHook() {
3637function registerMalformedBootstrapFileHook() {
3738registerInternalHook("agent:bootstrap", (event) => {
3839const context = event.context as AgentBootstrapHookContext;
40+// Hook contracts are extension-facing; malformed entries must warn and drop
41+// without breaking normal project bootstrap files.
3942context.bootstrapFiles = [
4043 ...context.bootstrapFiles,
4144{
@@ -63,6 +66,8 @@ function registerMalformedBootstrapFileHook() {
6366function registerDuplicateBootstrapFileHook() {
6467registerInternalHook("agent:bootstrap", (event) => {
6568const context = event.context as AgentBootstrapHookContext;
69+// Duplicates exercise canonical path dedupe between relative hook entries
70+// and resolved workspace files.
6671context.bootstrapFiles = [
6772 ...context.bootstrapFiles,
6873{
@@ -104,6 +109,8 @@ async function createHeartbeatAgentsWorkspace() {
104109}
105110106111function expectHeartbeatExcludedAndAgentsKept(files: WorkspaceBootstrapFile[]) {
112+// Heartbeat policy can remove HEARTBEAT.md for normal turns, but project rules
113+// must remain in the bootstrap set.
107114const fileNames = files.map((file) => file.name);
108115expect(fileNames).not.toContain("HEARTBEAT.md");
109116expect(fileNames).toContain("AGENTS.md");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。