@rudderhq/agent-runtime-utils 0.3.4-canary.9 → 0.3.5-canary.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/dist/git-identity.test.js +1 -9
- package/dist/git-identity.test.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/server-utils.cli.d.ts +1 -1
- package/dist/server-utils.cli.d.ts.map +1 -1
- package/dist/server-utils.cli.js +3 -3
- package/dist/server-utils.cli.js.map +1 -1
- package/dist/server-utils.d.ts +2 -2
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.instructions.d.ts +2 -0
- package/dist/server-utils.instructions.d.ts.map +1 -1
- package/dist/server-utils.instructions.js +25 -27
- package/dist/server-utils.instructions.js.map +1 -1
- package/dist/server-utils.js +2 -2
- package/dist/server-utils.js.map +1 -1
- package/dist/server-utils.process.d.ts +0 -32
- package/dist/server-utils.process.d.ts.map +1 -1
- package/dist/server-utils.process.js +0 -65
- package/dist/server-utils.process.js.map +1 -1
- package/dist/server-utils.prompts.d.ts +8 -7
- package/dist/server-utils.prompts.d.ts.map +1 -1
- package/dist/server-utils.prompts.js +38 -9
- package/dist/server-utils.prompts.js.map +1 -1
- package/dist/server-utils.test.js +64 -45
- package/dist/server-utils.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.process.d.ts","sourceRoot":"","sources":["../src/server-utils.process.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-utils.process.d.ts","sourceRoot":"","sources":["../src/server-utils.process.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtD,OAAO,KAAK,EACV,sBAAsB,EACvB,MAAM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gB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAMvE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SAAoB,UAGjF;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,MAAM,UAoBhF;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,UAE7E"}
|
|
@@ -190,69 +190,4 @@ export function resolvePathValue(obj, dottedPath) {
|
|
|
190
190
|
export function renderTemplate(template, data) {
|
|
191
191
|
return template.replace(/{{\s*([a-zA-Z0-9_.-]+)\s*}}/g, (_, path) => resolvePathValue(data, path));
|
|
192
192
|
}
|
|
193
|
-
export const ISSUE_DOCUMENT_PROMPT_BODY_CHAR_LIMIT = 16_000;
|
|
194
|
-
export function truncateIssueDocumentBody(body) {
|
|
195
|
-
if (body.length <= ISSUE_DOCUMENT_PROMPT_BODY_CHAR_LIMIT)
|
|
196
|
-
return body;
|
|
197
|
-
return `${body.slice(0, ISSUE_DOCUMENT_PROMPT_BODY_CHAR_LIMIT).trimEnd()}\n\n[Document truncated in prompt. Fetch the full document with the Rudder CLI.]`;
|
|
198
|
-
}
|
|
199
|
-
export function formatDocumentHeading(key, title) {
|
|
200
|
-
const cleanTitle = typeof title === "string" ? title.trim() : "";
|
|
201
|
-
return cleanTitle ? `### ${key} — ${cleanTitle}` : `### ${key}`;
|
|
202
|
-
}
|
|
203
|
-
export function readIssueDocumentPromptIssueId(input) {
|
|
204
|
-
const planIssueId = typeof input.planDocument?.issueId === "string" ? input.planDocument.issueId.trim() : "";
|
|
205
|
-
if (planIssueId)
|
|
206
|
-
return planIssueId;
|
|
207
|
-
for (const summary of input.documentSummaries ?? []) {
|
|
208
|
-
const issueId = typeof summary.issueId === "string" ? summary.issueId.trim() : "";
|
|
209
|
-
if (issueId)
|
|
210
|
-
return issueId;
|
|
211
|
-
}
|
|
212
|
-
return "<issue-id>";
|
|
213
|
-
}
|
|
214
|
-
export function formatIssueDocumentReference(input) {
|
|
215
|
-
const key = input.key?.trim() || "document";
|
|
216
|
-
const title = input.title?.trim();
|
|
217
|
-
const titlePart = title ? ` — ${title}` : "";
|
|
218
|
-
const revision = typeof input.latestRevisionNumber === "number" ? `, revision ${input.latestRevisionNumber}` : "";
|
|
219
|
-
return `- \`${key}\`${titlePart}${revision}. Legacy issue document; fetch with \`rudder issue documents get ${input.issueId} ${key} --json\`.`;
|
|
220
|
-
}
|
|
221
|
-
export function buildIssueDocumentsPrompt(input) {
|
|
222
|
-
if (!input)
|
|
223
|
-
return "";
|
|
224
|
-
const issueId = readIssueDocumentPromptIssueId(input);
|
|
225
|
-
const references = [];
|
|
226
|
-
const planKey = input.planDocument?.key?.trim() || "plan";
|
|
227
|
-
if (input.planDocument) {
|
|
228
|
-
references.push(formatIssueDocumentReference({
|
|
229
|
-
issueId,
|
|
230
|
-
key: planKey,
|
|
231
|
-
title: input.planDocument.title,
|
|
232
|
-
latestRevisionNumber: input.planDocument.latestRevisionNumber,
|
|
233
|
-
}));
|
|
234
|
-
}
|
|
235
|
-
const otherDocuments = (input.documentSummaries ?? []).filter((doc) => {
|
|
236
|
-
const key = typeof doc.key === "string" ? doc.key.trim() : "";
|
|
237
|
-
return key && key !== planKey;
|
|
238
|
-
});
|
|
239
|
-
references.push(...otherDocuments.map((doc) => formatIssueDocumentReference({
|
|
240
|
-
issueId,
|
|
241
|
-
key: doc.key,
|
|
242
|
-
title: doc.title,
|
|
243
|
-
latestRevisionNumber: doc.latestRevisionNumber,
|
|
244
|
-
})));
|
|
245
|
-
if (input.legacyPlanDocument && references.length === 0) {
|
|
246
|
-
references.push("- `plan` — legacy `<plan>` block in the issue description. Treat it as issue text, not an attached document body.");
|
|
247
|
-
}
|
|
248
|
-
if (references.length === 0)
|
|
249
|
-
return "";
|
|
250
|
-
return [
|
|
251
|
-
"## Legacy Issue Documents",
|
|
252
|
-
"These legacy issue documents are not inlined automatically. Fetch one only when you need its contents.",
|
|
253
|
-
"For new or revised durable work files in local trusted runs, write them under `$RUDDER_PROJECT_LIBRARY_ROOT`, then cite them in issue text or comments with `rudder library file ref \"$RUDDER_PROJECT_LIBRARY_PATH/<relative-file>\" --json`.",
|
|
254
|
-
"",
|
|
255
|
-
...references,
|
|
256
|
-
].join("\n");
|
|
257
|
-
}
|
|
258
193
|
//# sourceMappingURL=server-utils.process.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.process.js","sourceRoot":"","sources":["../src/server-utils.process.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-utils.process.js","sourceRoot":"","sources":["../src/server-utils.process.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAe,MAAM,SAAS,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAiC7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAA0B,CAAC;AAElE,MAAM,UAAU,mBAAmB,CAAC,KAA6B;IAC/D,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;IACtB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACvE,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,GAAG,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,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AAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3E,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,MAAM,GAAI,MAAkC,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACvD,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC9C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC;IAErF,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAgB,EAAE,IAA6B;IAC5E,OAAO,QAAQ,CAAC,OAAO,CAAC,8BAA8B,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare const DEFAULT_AGENT_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). Continue your Rudder work.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n
|
|
2
|
-
export declare const ISSUE_ASSIGN_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). You have been assigned to work on an issue.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Task Context\n\n**Issue:** {{issue.title}}\n**ID:** {{issue.id}}\n**Status:** {{issue.status}}\n**Priority:** {{issue.priority}}\n\n**Description:**\n{{issue.description}}\n\n
|
|
3
|
-
export declare const COMMENT_MENTION_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). You were mentioned in a comment and your attention is needed.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Context\n\n**Issue:** {{issue.title}}\n**ID:** {{issue.id}}\n\n**Issue Description:**\n{{issue.description}}\n\n
|
|
4
|
-
export declare const ISSUE_COMMENTED_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). There is a new comment on an issue you own.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Context\n\n**Issue:** {{issue.title}}\n**ID:** {{issue.id}}\n**Status:** {{issue.status}}\n\n**Issue Description:**\n{{issue.description}}\n\n
|
|
5
|
-
export declare const ISSUE_CHANGES_REQUESTED_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). A reviewer requested changes on an issue you own.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Context\n\n**Issue:** {{issue.title}}\n**ID:** {{issue.id}}\n**Status:** {{issue.status}}\n\n**Issue Description:**\n{{issue.description}}\n\n
|
|
6
|
-
export declare const ISSUE_RECOVERY_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). This is a recovery run, not a fresh task.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Recovery Context\n\n- Original Run ID: {{context.recovery.originalRunId}}\n- Failure Kind: {{context.recovery.failureKind}}\n- Failure Summary: {{context.recovery.failureSummary}}\n- Recovery Trigger: {{context.recovery.recoveryTrigger}}\n- Recovery Mode: {{context.recovery.recoveryMode}}\n\n## Current Issue Context\n\n- Issue: {{issue.title}}\n- ID: {{issue.id}}\n- Status: {{issue.status}}\n- Priority: {{issue.priority}}\n\n- Description:\n{{issue.description}}\n\n
|
|
1
|
+
export declare const DEFAULT_AGENT_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). Continue your Rudder work.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n";
|
|
2
|
+
export declare const ISSUE_ASSIGN_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). You have been assigned to work on an issue.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Task Context\n\n**Issue:** {{issue.title}}\n**ID:** {{issue.id}}\n**Status:** {{issue.status}}\n**Priority:** {{issue.priority}}\n\n**Description:**\n{{issue.description}}\n\n\nYour task is to review this issue, understand what kind of work it asks for, and take the appropriate next action.\n\nDo not assume every issue is a codebase task. If the issue is a question, screenshot check, review, planning request, coordination task, or another non-code request, answer or handle that request directly. Inspect the codebase and implement a change only when the issue actually asks for engineering work or when the relevant project resources make code changes necessary.";
|
|
3
|
+
export declare const COMMENT_MENTION_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). You were mentioned in a comment and your attention is needed.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Context\n\n**Issue:** {{issue.title}}\n**ID:** {{issue.id}}\n\n**Issue Description:**\n{{issue.description}}\n\n\n**Comment:**\nFrom: {{comment.authorLabel}} ({{comment.authorKind}})\n\n{{comment.body}}\n\nPlease review the comment above and respond or take action as appropriate.\nA mention-triggered comment wake is a request for attention or collaboration, not an automatic transfer of issue ownership. Plain structured agent links such as `agent://agent-id` are reference-only. Only checkout or self-assign when the comment explicitly asks you to take ownership and the normal issue workflow allows it.";
|
|
4
|
+
export declare const ISSUE_COMMENTED_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). There is a new comment on an issue you own.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Context\n\n**Issue:** {{issue.title}}\n**ID:** {{issue.id}}\n**Status:** {{issue.status}}\n\n**Issue Description:**\n{{issue.description}}\n\n\n**Latest Comment:**\nFrom: {{comment.authorLabel}} ({{comment.authorKind}})\n\n{{comment.body}}\n\nReview the new comment and continue the issue from the current state. Respond or take action as needed.";
|
|
5
|
+
export declare const ISSUE_CHANGES_REQUESTED_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). A reviewer requested changes on an issue you own.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Context\n\n**Issue:** {{issue.title}}\n**ID:** {{issue.id}}\n**Status:** {{issue.status}}\n\n**Issue Description:**\n{{issue.description}}\n\n\n**Reviewer Comment:**\nFrom: {{comment.authorLabel}} ({{comment.authorKind}})\n\n{{comment.body}}\n\nReview the requested changes and continue the issue from the current state. Address the reviewer feedback before handing it back for review.";
|
|
6
|
+
export declare const ISSUE_RECOVERY_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). This is a recovery run, not a fresh task.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Recovery Context\n\n- Original Run ID: {{context.recovery.originalRunId}}\n- Failure Kind: {{context.recovery.failureKind}}\n- Failure Summary: {{context.recovery.failureSummary}}\n- Recovery Trigger: {{context.recovery.recoveryTrigger}}\n- Recovery Mode: {{context.recovery.recoveryMode}}\n\n## Current Issue Context\n\n- Issue: {{issue.title}}\n- ID: {{issue.id}}\n- Status: {{issue.status}}\n- Priority: {{issue.priority}}\n\n- Description:\n{{issue.description}}\n\n\nBefore doing anything else, inspect what the previous run already completed and any side effects it may have caused. Continue the remaining work from the current state. Avoid blindly re-running the whole task.";
|
|
7
7
|
export declare const RECOVERY_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). This is a recovery run, not a fresh task.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Recovery Context\n\n- Original Run ID: {{context.recovery.originalRunId}}\n- Failure Kind: {{context.recovery.failureKind}}\n- Failure Summary: {{context.recovery.failureSummary}}\n- Recovery Trigger: {{context.recovery.recoveryTrigger}}\n- Recovery Mode: {{context.recovery.recoveryMode}}\n\nBefore doing anything else, inspect what the previous run already completed and any side effects it may have caused. Continue the remaining work from the current state. Avoid blindly re-running the whole task.";
|
|
8
|
-
export declare const ISSUE_PASSIVE_FOLLOWUP_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). This is a passive issue follow-up, not a fresh assignment and not a failure recovery.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Why You Were Woken\n\nThe previous run ended without sufficient issue close-out.\n\n- Origin Run ID: {{context.passiveFollowup.originRunId}}\n- Previous Run ID: {{context.passiveFollowup.previousRunId}}\n- Attempt: {{context.passiveFollowup.attempt}} / {{context.passiveFollowup.maxAttempts}}\nReason: {{context.passiveFollowup.reason}}\n\n## Current Issue Context\n\n- Issue: {{issue.title}}\n- ID: {{issue.id}}\n- Status: {{issue.status}}\n- Priority: {{issue.priority}}\n\n- Description:\n{{issue.description}}\n\n
|
|
8
|
+
export declare const ISSUE_PASSIVE_FOLLOWUP_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). This is a passive issue follow-up, not a fresh assignment and not a failure recovery.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n## Why You Were Woken\n\nThe previous run ended without sufficient issue close-out.\n\n- Origin Run ID: {{context.passiveFollowup.originRunId}}\n- Previous Run ID: {{context.passiveFollowup.previousRunId}}\n- Attempt: {{context.passiveFollowup.attempt}} / {{context.passiveFollowup.maxAttempts}}\nReason: {{context.passiveFollowup.reason}}\n\n## Current Issue Context\n\n- Issue: {{issue.title}}\n- ID: {{issue.id}}\n- Status: {{issue.status}}\n- Priority: {{issue.priority}}\n\n- Description:\n{{issue.description}}\n\n\nBefore changing the issue, inspect the current issue state and any side effects from the previous run. Then do exactly one close-out action: add a progress comment, mark the issue done, block it with a reason, or hand it off explicitly with explanation.";
|
|
9
9
|
/**
|
|
10
10
|
* Selects the base heartbeat prompt template used by runtimes before final prompt assembly.
|
|
11
11
|
*
|
|
@@ -49,4 +49,5 @@ export declare const ISSUE_PASSIVE_FOLLOWUP_PROMPT_TEMPLATE = "You are agent {{a
|
|
|
49
49
|
export declare function selectPromptTemplate(configuredTemplate: string | undefined, context: Record<string, unknown>): string;
|
|
50
50
|
export declare function joinPromptSections(sections: Array<string | null | undefined>, separator?: string): string;
|
|
51
51
|
export declare const RUDDER_AGENT_OPERATING_CONTRACT: string;
|
|
52
|
+
export declare const RUDDER_AGENT_HEARTBEAT_INSTRUCTION: string;
|
|
52
53
|
//# sourceMappingURL=server-utils.prompts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.prompts.d.ts","sourceRoot":"","sources":["../src/server-utils.prompts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-utils.prompts.d.ts","sourceRoot":"","sources":["../src/server-utils.prompts.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,6BAA6B,gIAIzC,CAAC;AAEF,eAAO,MAAM,4BAA4B,izBAiB4U,CAAC;AAEtX,eAAO,MAAM,+BAA+B,swBAmB2R,CAAC;AAExU,eAAO,MAAM,+BAA+B,gfAmB4D,CAAC;AAEzG,eAAO,MAAM,uCAAuC,6hBAmByF,CAAC;AAE9I,eAAO,MAAM,8BAA8B,6zBAuBuK,CAAC;AAEnN,eAAO,MAAM,wBAAwB,0oBAY6K,CAAC;AAEnN,eAAO,MAAM,sCAAsC,o8BAwB2M,CAAC;AAE/P;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,oBAAoB,CAClC,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,MAAM,CAsCR;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,EAC1C,SAAS,SAAS,UAMnB;AAED,eAAO,MAAM,+BAA+B,QA8DhC,CAAC;AAEb,eAAO,MAAM,kCAAkC,QAkBnC,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export const DEFAULT_AGENT_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). Continue your Rudder work.
|
|
2
2
|
|
|
3
3
|
{{context.rudderWorkspace.orgResourcesPrompt}}
|
|
4
|
-
|
|
5
|
-
{{context.issueDocumentsPrompt}}`;
|
|
4
|
+
`;
|
|
6
5
|
export const ISSUE_ASSIGN_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). You have been assigned to work on an issue.
|
|
7
6
|
|
|
8
7
|
{{context.rudderWorkspace.orgResourcesPrompt}}
|
|
@@ -17,7 +16,6 @@ export const ISSUE_ASSIGN_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent
|
|
|
17
16
|
**Description:**
|
|
18
17
|
{{issue.description}}
|
|
19
18
|
|
|
20
|
-
{{context.issueDocumentsPrompt}}
|
|
21
19
|
|
|
22
20
|
Your task is to review this issue, understand what kind of work it asks for, and take the appropriate next action.
|
|
23
21
|
|
|
@@ -34,7 +32,6 @@ export const COMMENT_MENTION_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{ag
|
|
|
34
32
|
**Issue Description:**
|
|
35
33
|
{{issue.description}}
|
|
36
34
|
|
|
37
|
-
{{context.issueDocumentsPrompt}}
|
|
38
35
|
|
|
39
36
|
**Comment:**
|
|
40
37
|
From: {{comment.authorLabel}} ({{comment.authorKind}})
|
|
@@ -56,7 +53,6 @@ export const ISSUE_COMMENTED_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{ag
|
|
|
56
53
|
**Issue Description:**
|
|
57
54
|
{{issue.description}}
|
|
58
55
|
|
|
59
|
-
{{context.issueDocumentsPrompt}}
|
|
60
56
|
|
|
61
57
|
**Latest Comment:**
|
|
62
58
|
From: {{comment.authorLabel}} ({{comment.authorKind}})
|
|
@@ -77,7 +73,6 @@ export const ISSUE_CHANGES_REQUESTED_PROMPT_TEMPLATE = `You are agent {{agent.id
|
|
|
77
73
|
**Issue Description:**
|
|
78
74
|
{{issue.description}}
|
|
79
75
|
|
|
80
|
-
{{context.issueDocumentsPrompt}}
|
|
81
76
|
|
|
82
77
|
**Reviewer Comment:**
|
|
83
78
|
From: {{comment.authorLabel}} ({{comment.authorKind}})
|
|
@@ -107,7 +102,6 @@ export const ISSUE_RECOVERY_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{age
|
|
|
107
102
|
- Description:
|
|
108
103
|
{{issue.description}}
|
|
109
104
|
|
|
110
|
-
{{context.issueDocumentsPrompt}}
|
|
111
105
|
|
|
112
106
|
Before doing anything else, inspect what the previous run already completed and any side effects it may have caused. Continue the remaining work from the current state. Avoid blindly re-running the whole task.`;
|
|
113
107
|
export const RECOVERY_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). This is a recovery run, not a fresh task.
|
|
@@ -146,7 +140,6 @@ Reason: {{context.passiveFollowup.reason}}
|
|
|
146
140
|
- Description:
|
|
147
141
|
{{issue.description}}
|
|
148
142
|
|
|
149
|
-
{{context.issueDocumentsPrompt}}
|
|
150
143
|
|
|
151
144
|
Before changing the issue, inspect the current issue state and any side effects from the previous run. Then do exactly one close-out action: add a progress comment, mark the issue done, block it with a reason, or hand it off explicitly with explanation.`;
|
|
152
145
|
/**
|
|
@@ -259,7 +252,19 @@ export const RUDDER_AGENT_OPERATING_CONTRACT = [
|
|
|
259
252
|
"When you write issue comments or chat replies, match the language of the user's or board's most recent substantive message unless they explicitly ask for a different language.",
|
|
260
253
|
"When you mention a web page, issue URL, external dashboard, or other user-openable target in an issue comment or chat reply, write it as a clickable Markdown link with a descriptive label, for example `[NameSilo transfer page](https://www.namesilo.com/account_domain_manage_transfer.php)`. Do not put action URLs in backticks or code blocks unless you are showing literal code or a command.",
|
|
261
254
|
"",
|
|
262
|
-
"
|
|
255
|
+
"## Rudder Renderable Links",
|
|
256
|
+
"",
|
|
257
|
+
"When you mention Rudder entities in any user-visible Markdown output, prefer Rudder's renderable Markdown link syntax over plain IDs, bare URLs, or backticked references so the UI can render chips and navigate correctly.",
|
|
258
|
+
"",
|
|
259
|
+
"- Issues: use `[<identifier-or-title>](issue://<issue-id>)`; include `?c=<comment-id>` when linking to a specific comment.",
|
|
260
|
+
"- Agents: use `[<agent-name>](agent://<agent-id>)` for reference-only links. In issue comments, use `[<agent-name>](agent://<agent-id>?intent=wake)` only when you intentionally want to wake that agent for attention or collaboration.",
|
|
261
|
+
"- Projects: use `[<project-name>](project://<project-id>)` when citing a Rudder project.",
|
|
262
|
+
"- Chat threads: use `[<chat-title>](chat://<conversation-id>)` when citing a Rudder chat conversation.",
|
|
263
|
+
"- Library files: use the `markdownLink` returned by `rudder library file ref \"$RUDDER_PROJECT_LIBRARY_PATH/<relative-file>\" --json`; do not hand-write `library-entry://...` links, and treat `library-file://...` as legacy path syntax only.",
|
|
264
|
+
"",
|
|
265
|
+
"Write these as normal Markdown links, not inside code spans or code blocks, unless you are literally documenting the syntax.",
|
|
266
|
+
"",
|
|
267
|
+
"Mention-triggered comment wakes arrive with `RUDDER_WAKE_COMMENT_ID`; read that wake comment before acting. Issue comments can wake an agent only with an explicit wake-intent agent link serialized as `agent://agent-id?intent=wake`. Plain structured links such as `agent://agent-id` are reference-only links for rendering and navigation, and plain text agent names are not wake requests. Use wake-intent links only when you intentionally want to wake another agent for attention or collaboration; omit the wake intent for ordinary references. Mentioning an agent requests attention or collaboration; it does not transfer issue ownership unless the comment also makes an explicit handoff and normal checkout rules allow it.",
|
|
263
268
|
"",
|
|
264
269
|
"When an issue comment, done comment, or blocker comment cites visual evidence from a local screenshot/image path, attach the image with the Rudder CLI `--image <path>` option instead of leaving only the filesystem path in the text.",
|
|
265
270
|
"",
|
|
@@ -275,5 +280,29 @@ export const RUDDER_AGENT_OPERATING_CONTRACT = [
|
|
|
275
280
|
"",
|
|
276
281
|
"- Never exfiltrate secrets or private data.",
|
|
277
282
|
"- Do not perform any destructive commands unless explicitly requested by the board.",
|
|
283
|
+
"",
|
|
284
|
+
"## Other",
|
|
285
|
+
"- You can use `rudder` skill to see Agent best practise in Rudder. eg: update Agent profile, crud automation, manage library, project, org, curd agent run, chat, issue.",
|
|
286
|
+
"- Before taking action, deeply analyze and research the existing information to ensure you have comprehensive context information before proceeding with the next action. You have your own goal, memory, skills, automation, library, project, org, use these resources to make better decisions.",
|
|
287
|
+
"- When the user explicitly mentions previously handled issue, tasks or conversations, you need to retrieve the relevant tasks first before proceeding with the next action."
|
|
288
|
+
].join("\n");
|
|
289
|
+
export const RUDDER_AGENT_HEARTBEAT_INSTRUCTION = [
|
|
290
|
+
"# Rudder Heartbeat Instruction",
|
|
291
|
+
"",
|
|
292
|
+
"This section is injected by Rudder for heartbeat scene runs. It is the platform-owned timed-wakeup pipeline, not an agent-local `HEARTBEAT.md` file.",
|
|
293
|
+
"",
|
|
294
|
+
"## Heartbeat Pipeline",
|
|
295
|
+
"",
|
|
296
|
+
"1. Identify yourself and inspect wake context, including `RUDDER_TASK_ID`, `RUDDER_WAKE_REASON`, `RUDDER_WAKE_COMMENT_ID`, and `RUDDER_APPROVAL_ID` when present.",
|
|
297
|
+
"2. Handle approval follow-up first: read the approval and linked issues, then close resolved work or comment on what remains.",
|
|
298
|
+
"3. Inspect your Rudder inbox. Prioritize reviewer rows in `in_review` or `blocked`, then assignee `in_progress`, then assignee `todo`. Do not look for unassigned work.",
|
|
299
|
+
"4. For mention wakes, read the wake comment before acting. Mentions request attention; they do not transfer ownership unless the comment explicitly says so.",
|
|
300
|
+
"5. Checkout before doing assignee task work. A `409` means another agent owns the task; do not retry it.",
|
|
301
|
+
"6. Load compact issue context, do one bounded useful chunk, and preserve evidence.",
|
|
302
|
+
"7. Before exiting active work, leave exactly one durable signal: progress, done, blocked, explicit handoff, or structured review decision.",
|
|
303
|
+
"8. Treat passive follow-up as close-out governance, not a fresh assignment.",
|
|
304
|
+
"9. Treat review close-out follow-up as review governance; free-form accept/reject text is not a durable decision.",
|
|
305
|
+
"",
|
|
306
|
+
"Use the Rudder control-plane interface available in this runtime. CLI-capable runtimes should use the bundled `rudder` skill for command details, Library handoff rules, organization-skill workflow, and control-plane best practices. HTTP compatibility runtimes should follow the explicit HTTP workflow in their wake text; that workflow overrides CLI command guidance.",
|
|
278
307
|
].join("\n");
|
|
279
308
|
//# sourceMappingURL=server-utils.prompts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.prompts.js","sourceRoot":"","sources":["../src/server-utils.prompts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-utils.prompts.js","sourceRoot":"","sources":["../src/server-utils.prompts.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,6BAA6B,GACxC;;;CAGD,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;;qXAiByU,CAAC;AAEtX,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;uUAmBwR,CAAC;AAExU,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;;;;;;;;;;;;wGAmByD,CAAC;AAEzG,MAAM,CAAC,MAAM,uCAAuC,GAAG;;;;;;;;;;;;;;;;;;;6IAmBsF,CAAC;AAE9I,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;;kNAuBoK,CAAC;AAEnN,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;kNAY0K,CAAC;AAEnN,MAAM,CAAC,MAAM,sCAAsC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;8PAwBwM,CAAC;AAE/P;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,oBAAoB,CAClC,kBAAsC,EACtC,OAAgC;IAEhC,+CAA+C;IAC/C,IAAI,kBAAkB,EAAE,IAAI,EAAE,EAAE,CAAC;QAC/B,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED,qCAAqC;IACrC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,QAAQ,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pF,4IAA4I;IAC5I,6EAA6E;IAC7E,mHAAmH;IACnH,EAAE;IACF,gXAAgX;CACjX,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { spawn } from "node:child_process";
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { afterEach, describe, expect, it } from "vitest";
|
|
6
|
-
import {
|
|
6
|
+
import { ensureLocalCliCredentialShimsInPath, ensureRudderCliInPath, resolveLocalOperatorHome, syncLocalCliCredentialHomeEntries, loadAgentInstructionsPrefix, renderTemplate, RUDDER_AGENT_HEARTBEAT_INSTRUCTION, RUDDER_AGENT_OPERATING_CONTRACT, runChildProcess, selectPromptTemplate, } from "./server-utils.js";
|
|
7
7
|
const ORIGINAL_HOME = process.env.HOME;
|
|
8
8
|
const ORIGINAL_RUDDER_OPERATOR_HOME = process.env.RUDDER_OPERATOR_HOME;
|
|
9
9
|
const ORIGINAL_ZDOTDIR = process.env.ZDOTDIR;
|
|
@@ -211,26 +211,9 @@ describe("selectPromptTemplate", () => {
|
|
|
211
211
|
expect(rendered).toContain("## Organization Resources");
|
|
212
212
|
expect(rendered).toContain("Locator: `~/projects/rudder`");
|
|
213
213
|
});
|
|
214
|
-
it("renders issue
|
|
215
|
-
const issueDocumentsPrompt = buildIssueDocumentsPrompt({
|
|
216
|
-
planDocument: {
|
|
217
|
-
issueId: "issue-3",
|
|
218
|
-
key: "plan",
|
|
219
|
-
title: "Execution Plan",
|
|
220
|
-
body: "# Plan\n\nCheck the document-backed requirements.",
|
|
221
|
-
},
|
|
222
|
-
documentSummaries: [
|
|
223
|
-
{
|
|
224
|
-
issueId: "issue-3",
|
|
225
|
-
key: "design",
|
|
226
|
-
title: "Design Notes",
|
|
227
|
-
latestRevisionNumber: 2,
|
|
228
|
-
},
|
|
229
|
-
],
|
|
230
|
-
});
|
|
214
|
+
it("renders issue-aware prompts without legacy issue document injection", () => {
|
|
231
215
|
const context = {
|
|
232
216
|
wakeReason: "issue_assigned",
|
|
233
|
-
issueDocumentsPrompt,
|
|
234
217
|
issue: {
|
|
235
218
|
id: "issue-3",
|
|
236
219
|
title: "Use issue docs",
|
|
@@ -245,16 +228,9 @@ describe("selectPromptTemplate", () => {
|
|
|
245
228
|
context,
|
|
246
229
|
issue: context.issue,
|
|
247
230
|
});
|
|
248
|
-
expect(issueDocumentsPrompt).toContain("## Legacy Issue Documents");
|
|
249
|
-
expect(issueDocumentsPrompt).toContain("These legacy issue documents are not inlined automatically.");
|
|
250
|
-
expect(issueDocumentsPrompt).toContain("$RUDDER_PROJECT_LIBRARY_ROOT");
|
|
251
|
-
expect(issueDocumentsPrompt).toContain('rudder library file ref "$RUDDER_PROJECT_LIBRARY_PATH/<relative-file>" --json');
|
|
252
|
-
expect(issueDocumentsPrompt).toContain("rudder issue documents get issue-3 plan --json");
|
|
253
|
-
expect(issueDocumentsPrompt).toContain("rudder issue documents get issue-3 design --json");
|
|
254
|
-
expect(issueDocumentsPrompt).not.toContain("Check the document-backed requirements.");
|
|
255
231
|
expect(rendered).toContain("Use issue docs");
|
|
256
|
-
expect(rendered).toContain("
|
|
257
|
-
expect(rendered).not.toContain("
|
|
232
|
+
expect(rendered).not.toContain("Legacy Issue Documents");
|
|
233
|
+
expect(rendered).not.toContain("rudder issue documents");
|
|
258
234
|
});
|
|
259
235
|
it("renders reviewer changes-requested comment context before generic assignment prompts", () => {
|
|
260
236
|
const context = {
|
|
@@ -338,21 +314,52 @@ describe("loadAgentInstructionsPrefix", () => {
|
|
|
338
314
|
expect(loaded.prefix).toContain("always include a user-visible Markdown link");
|
|
339
315
|
expect(loaded.prefix).toContain('rudder library file ref "$RUDDER_PROJECT_LIBRARY_PATH/<relative-file>" --json');
|
|
340
316
|
expect(loaded.prefix).not.toContain("library-file://file?p=<url-encoded-relative-path>&t=<url-encoded-title>");
|
|
317
|
+
expect(loaded.prefix).toContain("## Rudder Renderable Links");
|
|
318
|
+
expect(loaded.prefix).toContain("prefer Rudder's renderable Markdown link syntax over plain IDs");
|
|
319
|
+
expect(loaded.prefix).toContain("[<identifier-or-title>](issue://<issue-id>)");
|
|
320
|
+
expect(loaded.prefix).toContain("[<agent-name>](agent://<agent-id>)");
|
|
321
|
+
expect(loaded.prefix).toContain("[<agent-name>](agent://<agent-id>?intent=wake)");
|
|
322
|
+
expect(loaded.prefix).toContain("[<project-name>](project://<project-id>)");
|
|
323
|
+
expect(loaded.prefix).toContain("[<chat-title>](chat://<conversation-id>)");
|
|
324
|
+
expect(loaded.prefix).toContain("Library files: use the `markdownLink` returned by");
|
|
325
|
+
expect(loaded.prefix).toContain("not inside code spans or code blocks");
|
|
341
326
|
expect(loaded.prefix).toContain("Use `/tmp` only for transient scratch files");
|
|
342
327
|
expect(loaded.prefix).toContain("Local trusted runtimes may expose the host operator home as `$RUDDER_OPERATOR_HOME`");
|
|
343
328
|
expect(loaded.prefix).toContain("[NameSilo transfer page](https://www.namesilo.com/account_domain_manage_transfer.php)");
|
|
344
329
|
expect(loaded.prefix).toContain("Do not put action URLs in backticks or code blocks");
|
|
345
330
|
expect(loaded.prefix).toContain("agent://agent-id?intent=wake");
|
|
346
331
|
expect(loaded.prefix).toContain("Plain structured links such as `agent://agent-id` are reference-only links");
|
|
347
|
-
expect(loaded.prefix).toContain("
|
|
332
|
+
expect(loaded.prefix).toContain("plain text agent names are not wake requests");
|
|
333
|
+
expect(loaded.prefix).toContain("Use wake-intent links only when you intentionally want to wake another agent");
|
|
348
334
|
expect(loaded.prefix).toContain("attach the image with the Rudder CLI `--image <path>` option");
|
|
349
335
|
expect(loaded.commandNotes).toEqual(["Loaded Rudder agent operating contract from runtime code"]);
|
|
350
336
|
expect(loaded.readFailed).toBe(false);
|
|
351
337
|
expect(loaded.memoryFilePath).toBeNull();
|
|
352
338
|
expect(loaded.metrics.instructionsChars).toBe(loaded.prefix.length);
|
|
353
339
|
expect(loaded.metrics.operatingContractChars).toBeGreaterThan(0);
|
|
340
|
+
expect(loaded.metrics.runtimeHeartbeatChars).toBe(0);
|
|
354
341
|
expect(loaded.metrics.instructionEntryChars).toBe(0);
|
|
355
342
|
expect(loaded.metrics.memoryChars).toBe(0);
|
|
343
|
+
expect(loaded.metrics.heartbeatFileChars).toBe(0);
|
|
344
|
+
expect(loaded.metrics.heartbeatChars).toBe(0);
|
|
345
|
+
});
|
|
346
|
+
it("loads the runtime heartbeat instruction for heartbeat scenes without requiring a HEARTBEAT.md file", async () => {
|
|
347
|
+
const loaded = await loadAgentInstructionsPrefix({
|
|
348
|
+
instructionsFilePath: "",
|
|
349
|
+
includeHeartbeatInstructions: true,
|
|
350
|
+
onLog: async () => { },
|
|
351
|
+
});
|
|
352
|
+
expect(loaded.prefix).toContain("# Rudder Agent Operating Contract");
|
|
353
|
+
expect(loaded.prefix).toContain(RUDDER_AGENT_HEARTBEAT_INSTRUCTION);
|
|
354
|
+
expect(loaded.prefix).toContain("platform-owned timed-wakeup pipeline");
|
|
355
|
+
expect(loaded.commandNotes).toEqual([
|
|
356
|
+
"Loaded Rudder agent operating contract from runtime code",
|
|
357
|
+
"Loaded Rudder heartbeat instructions from runtime code",
|
|
358
|
+
]);
|
|
359
|
+
expect(loaded.heartbeatFilePath).toBeNull();
|
|
360
|
+
expect(loaded.metrics.runtimeHeartbeatChars).toBeGreaterThan(0);
|
|
361
|
+
expect(loaded.metrics.heartbeatFileChars).toBe(0);
|
|
362
|
+
expect(loaded.metrics.heartbeatChars).toBe(loaded.metrics.runtimeHeartbeatChars);
|
|
356
363
|
});
|
|
357
364
|
it("loads the operating contract and entry instructions when no sibling memory file exists", async () => {
|
|
358
365
|
const root = await fs.mkdtemp(path.join(os.tmpdir(), "rudder-load-agent-instructions-entry-"));
|
|
@@ -379,6 +386,7 @@ describe("loadAgentInstructionsPrefix", () => {
|
|
|
379
386
|
expect(loaded.memoryFilePath).toBeNull();
|
|
380
387
|
expect(loaded.metrics.instructionsChars).toBe(loaded.prefix.length);
|
|
381
388
|
expect(loaded.metrics.operatingContractChars).toBeGreaterThan(0);
|
|
389
|
+
expect(loaded.metrics.runtimeHeartbeatChars).toBe(0);
|
|
382
390
|
expect(loaded.metrics.instructionEntryChars).toBeGreaterThan(0);
|
|
383
391
|
expect(loaded.metrics.memoryChars).toBe(0);
|
|
384
392
|
expect(logs).toContainEqual(expect.objectContaining({
|
|
@@ -424,23 +432,24 @@ describe("loadAgentInstructionsPrefix", () => {
|
|
|
424
432
|
expect(loaded.heartbeatFilePath).toBeNull();
|
|
425
433
|
expect(loaded.metrics.instructionsChars).toBe(loaded.prefix.length);
|
|
426
434
|
expect(loaded.metrics.operatingContractChars).toBeGreaterThan(0);
|
|
435
|
+
expect(loaded.metrics.runtimeHeartbeatChars).toBe(0);
|
|
427
436
|
expect(loaded.metrics.instructionEntryChars).toBeGreaterThan(0);
|
|
428
437
|
expect(loaded.metrics.soulChars).toBeGreaterThan(0);
|
|
429
438
|
expect(loaded.metrics.toolsChars).toBeGreaterThan(0);
|
|
430
439
|
expect(loaded.metrics.memoryChars).toBeGreaterThan(0);
|
|
440
|
+
expect(loaded.metrics.heartbeatFileChars).toBe(0);
|
|
431
441
|
expect(loaded.metrics.heartbeatChars).toBe(0);
|
|
432
442
|
}
|
|
433
443
|
finally {
|
|
434
444
|
await fs.rm(root, { recursive: true, force: true });
|
|
435
445
|
}
|
|
436
446
|
});
|
|
437
|
-
it("
|
|
447
|
+
it("ignores sibling HEARTBEAT.md even when heartbeat instructions are requested", async () => {
|
|
438
448
|
const root = await fs.mkdtemp(path.join(os.tmpdir(), "rudder-load-agent-instructions-heartbeat-"));
|
|
439
449
|
const instructionsPath = path.join(root, "instructions", "SOUL.md");
|
|
440
|
-
const heartbeatPath = path.join(root, "instructions", "HEARTBEAT.md");
|
|
441
450
|
await fs.mkdir(path.dirname(instructionsPath), { recursive: true });
|
|
442
451
|
await fs.writeFile(instructionsPath, "# Persona\n\nYou are QA.\n", "utf8");
|
|
443
|
-
await fs.writeFile(
|
|
452
|
+
await fs.writeFile(path.join(root, "instructions", "HEARTBEAT.md"), "# Heartbeat\n\n- Check assignments.\n", "utf8");
|
|
444
453
|
try {
|
|
445
454
|
const loaded = await loadAgentInstructionsPrefix({
|
|
446
455
|
instructionsFilePath: instructionsPath,
|
|
@@ -448,16 +457,20 @@ describe("loadAgentInstructionsPrefix", () => {
|
|
|
448
457
|
onLog: async () => { },
|
|
449
458
|
});
|
|
450
459
|
expect(loaded.prefix).toContain("# Persona");
|
|
451
|
-
expect(loaded.prefix).toContain("# Heartbeat");
|
|
452
|
-
expect(loaded.
|
|
453
|
-
expect(loaded.
|
|
454
|
-
expect(loaded.
|
|
460
|
+
expect(loaded.prefix).toContain("# Rudder Heartbeat Instruction");
|
|
461
|
+
expect(loaded.prefix).not.toContain("# Heartbeat\n\n- Check assignments.");
|
|
462
|
+
expect(loaded.commandNotes).toContain("Loaded Rudder heartbeat instructions from runtime code");
|
|
463
|
+
expect(loaded.commandNotes).not.toContain("Loaded supplemental agent heartbeat notes from $AGENT_HOME/instructions/HEARTBEAT.md");
|
|
464
|
+
expect(loaded.heartbeatFilePath).toBeNull();
|
|
465
|
+
expect(loaded.metrics.runtimeHeartbeatChars).toBeGreaterThan(0);
|
|
466
|
+
expect(loaded.metrics.heartbeatFileChars).toBe(0);
|
|
467
|
+
expect(loaded.metrics.heartbeatChars).toBe(loaded.metrics.runtimeHeartbeatChars);
|
|
455
468
|
}
|
|
456
469
|
finally {
|
|
457
470
|
await fs.rm(root, { recursive: true, force: true });
|
|
458
471
|
}
|
|
459
472
|
});
|
|
460
|
-
it("
|
|
473
|
+
it("ignores HEARTBEAT.md when it is the entry file outside heartbeat runs", async () => {
|
|
461
474
|
const root = await fs.mkdtemp(path.join(os.tmpdir(), "rudder-load-agent-instructions-heartbeat-entry-skip-"));
|
|
462
475
|
const instructionsPath = path.join(root, "instructions", "HEARTBEAT.md");
|
|
463
476
|
const logs = [];
|
|
@@ -472,21 +485,23 @@ describe("loadAgentInstructionsPrefix", () => {
|
|
|
472
485
|
});
|
|
473
486
|
expect(loaded.prefix).toContain("# Rudder Agent Operating Contract");
|
|
474
487
|
expect(loaded.prefix).not.toContain("# Heartbeat");
|
|
475
|
-
expect(loaded.commandNotes).toContain("
|
|
488
|
+
expect(loaded.commandNotes).toContain("Ignored legacy HEARTBEAT.md instructions file: $AGENT_HOME/instructions/HEARTBEAT.md");
|
|
476
489
|
expect(loaded.heartbeatFilePath).toBeNull();
|
|
477
490
|
expect(loaded.readFailed).toBe(false);
|
|
478
491
|
expect(loaded.metrics.instructionEntryChars).toBe(0);
|
|
492
|
+
expect(loaded.metrics.runtimeHeartbeatChars).toBe(0);
|
|
493
|
+
expect(loaded.metrics.heartbeatFileChars).toBe(0);
|
|
479
494
|
expect(loaded.metrics.heartbeatChars).toBe(0);
|
|
480
495
|
expect(logs).toContainEqual(expect.objectContaining({
|
|
481
496
|
stream: "stdout",
|
|
482
|
-
chunk: expect.stringContaining("[rudder]
|
|
497
|
+
chunk: expect.stringContaining("[rudder] Ignored legacy agent heartbeat instructions file: $AGENT_HOME/instructions/HEARTBEAT.md"),
|
|
483
498
|
}));
|
|
484
499
|
}
|
|
485
500
|
finally {
|
|
486
501
|
await fs.rm(root, { recursive: true, force: true });
|
|
487
502
|
}
|
|
488
503
|
});
|
|
489
|
-
it("
|
|
504
|
+
it("ignores HEARTBEAT.md entry files for heartbeat runs", async () => {
|
|
490
505
|
const root = await fs.mkdtemp(path.join(os.tmpdir(), "rudder-load-agent-instructions-heartbeat-entry-load-"));
|
|
491
506
|
const instructionsPath = path.join(root, "instructions", "HEARTBEAT.md");
|
|
492
507
|
await fs.mkdir(path.dirname(instructionsPath), { recursive: true });
|
|
@@ -497,11 +512,15 @@ describe("loadAgentInstructionsPrefix", () => {
|
|
|
497
512
|
includeHeartbeatInstructions: true,
|
|
498
513
|
onLog: async () => { },
|
|
499
514
|
});
|
|
500
|
-
expect(loaded.prefix).toContain("# Heartbeat");
|
|
501
|
-
expect(loaded.
|
|
502
|
-
expect(loaded.
|
|
503
|
-
expect(loaded.
|
|
504
|
-
expect(loaded.
|
|
515
|
+
expect(loaded.prefix).toContain("# Rudder Heartbeat Instruction");
|
|
516
|
+
expect(loaded.prefix).not.toContain("# Heartbeat\n\n- Check assignments.");
|
|
517
|
+
expect(loaded.commandNotes).toContain("Loaded Rudder heartbeat instructions from runtime code");
|
|
518
|
+
expect(loaded.commandNotes).toContain("Ignored legacy HEARTBEAT.md instructions file: $AGENT_HOME/instructions/HEARTBEAT.md");
|
|
519
|
+
expect(loaded.heartbeatFilePath).toBeNull();
|
|
520
|
+
expect(loaded.metrics.instructionEntryChars).toBe(0);
|
|
521
|
+
expect(loaded.metrics.runtimeHeartbeatChars).toBeGreaterThan(0);
|
|
522
|
+
expect(loaded.metrics.heartbeatFileChars).toBe(0);
|
|
523
|
+
expect(loaded.metrics.heartbeatChars).toBe(loaded.metrics.runtimeHeartbeatChars);
|
|
505
524
|
}
|
|
506
525
|
finally {
|
|
507
526
|
await fs.rm(root, { recursive: true, force: true });
|