@rudderhq/agent-runtime-utils 0.2.0-canary.3 → 0.2.0-canary.31
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.d.ts +28 -0
- package/dist/git-identity.d.ts.map +1 -0
- package/dist/git-identity.js +220 -0
- package/dist/git-identity.js.map +1 -0
- package/dist/git-identity.test.d.ts +2 -0
- package/dist/git-identity.test.d.ts.map +1 -0
- package/dist/git-identity.test.js +307 -0
- package/dist/git-identity.test.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/log-redaction.d.ts.map +1 -1
- package/dist/log-redaction.js +9 -0
- package/dist/log-redaction.js.map +1 -1
- package/dist/server-utils.d.ts +42 -6
- package/dist/server-utils.d.ts.map +1 -1
- package/dist/server-utils.js +267 -15
- package/dist/server-utils.js.map +1 -1
- package/dist/server-utils.test.js +232 -9
- package/dist/server-utils.test.js.map +1 -1
- package/dist/types.d.ts +18 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-redaction.js","sourceRoot":"","sources":["../src/log-redaction.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAM3C,SAAS,uBAAuB,CAAC,KAAa;IAC5C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO;QAAE,OAAO,uBAAuB,CAAC;IAC7C,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,CAAC;AAED,MAAM,kBAAkB,GAAG;IACzB;QACE,KAAK,EAA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AAK,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC7F,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBAChC,GAAG,IAAI;oBACP,IAAI,EAAE,0BAA0B,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;iBAClD,CAAC,CAAC;aACJ,CAAC;QACJ,KAAK,MAAM;YACT,OAAO;gBACL,GAAG,KAAK;gBACR,KAAK,EAAE,0BAA0B,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC;gBACpD,SAAS,EAAE,0BAA0B,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC;aAC7D,CAAC;QACJ,KAAK,QAAQ;YACX,OAAO;gBACL,GAAG,KAAK;gBACR,IAAI,EAAE,0BAA0B,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;gBAClD,OAAO,EAAE,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;gBACxD,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,0BAA0B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;aAC7E,CAAC;QACJ;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/dist/server-utils.d.ts
CHANGED
|
@@ -53,13 +53,35 @@ export declare function parseJson(value: string): Record<string, unknown> | null
|
|
|
53
53
|
export declare function appendWithCap(prev: string, chunk: string, cap?: number): string;
|
|
54
54
|
export declare function resolvePathValue(obj: Record<string, unknown>, dottedPath: string): string;
|
|
55
55
|
export declare function renderTemplate(template: string, data: Record<string, unknown>): string;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
type IssueDocumentPromptInput = {
|
|
57
|
+
planDocument?: {
|
|
58
|
+
key?: string | null;
|
|
59
|
+
title?: string | null;
|
|
60
|
+
body?: string | null;
|
|
61
|
+
issueId?: string | null;
|
|
62
|
+
} | null;
|
|
63
|
+
documentSummaries?: Array<{
|
|
64
|
+
key?: string | null;
|
|
65
|
+
title?: string | null;
|
|
66
|
+
latestRevisionNumber?: number | null;
|
|
67
|
+
updatedAt?: string | Date | null;
|
|
68
|
+
issueId?: string | null;
|
|
69
|
+
}> | null;
|
|
70
|
+
legacyPlanDocument?: {
|
|
71
|
+
key?: string | null;
|
|
72
|
+
body?: string | null;
|
|
73
|
+
source?: string | null;
|
|
74
|
+
} | null;
|
|
75
|
+
};
|
|
76
|
+
export declare function buildIssueDocumentsPrompt(input: IssueDocumentPromptInput | null | undefined): string;
|
|
77
|
+
export declare const DEFAULT_AGENT_PROMPT_TEMPLATE = "You are agent {{agent.id}} ({{agent.name}}). Continue your Rudder work.\n\n{{context.rudderWorkspace.orgResourcesPrompt}}\n\n{{context.issueDocumentsPrompt}}";
|
|
78
|
+
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{{context.issueDocumentsPrompt}}\n\nYour task is to review this issue and begin working on it. Use the available tools to explore the codebase, understand the requirements, and implement a solution.";
|
|
79
|
+
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{{context.issueDocumentsPrompt}}\n\n**Comment:**\n{{comment.body}}\n\nPlease review the comment above and respond or take action as appropriate.";
|
|
80
|
+
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{{context.issueDocumentsPrompt}}\n\n**Latest Comment:**\n{{comment.body}}\n\nReview the new comment and continue the issue from the current state. Respond or take action as needed.";
|
|
81
|
+
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{{context.issueDocumentsPrompt}}\n\n**Reviewer Comment:**\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.";
|
|
82
|
+
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{{context.issueDocumentsPrompt}}\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.";
|
|
61
83
|
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.";
|
|
62
|
-
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\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.";
|
|
84
|
+
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{{context.issueDocumentsPrompt}}\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.";
|
|
63
85
|
/**
|
|
64
86
|
* Selects the base heartbeat prompt template used by runtimes before final prompt assembly.
|
|
65
87
|
*
|
|
@@ -70,6 +92,9 @@ export declare const ISSUE_PASSIVE_FOLLOWUP_PROMPT_TEMPLATE = "You are agent {{a
|
|
|
70
92
|
* - comment.mention:
|
|
71
93
|
* "You were mentioned in a comment ..."
|
|
72
94
|
* Includes issue summary plus mention comment body so the agent can respond without extra fetches.
|
|
95
|
+
* - issue_changes_requested:
|
|
96
|
+
* "A reviewer requested changes on an issue you own ..."
|
|
97
|
+
* Includes issue summary plus reviewer comment body so the assignee can act on feedback immediately.
|
|
73
98
|
* - issue_commented:
|
|
74
99
|
* "There is a new comment on an issue you own ..."
|
|
75
100
|
* Includes issue summary plus the newest comment body so the assignee can continue immediately.
|
|
@@ -149,6 +174,17 @@ export declare function resolveRudderDesiredSkillNames(config: Record<string, un
|
|
|
149
174
|
runtimeName?: string | null;
|
|
150
175
|
}>): string[];
|
|
151
176
|
export declare function writeRudderSkillSyncPreference(config: Record<string, unknown>, desiredSkills: string[]): Record<string, unknown>;
|
|
177
|
+
export declare function resolveLocalOperatorHome(sourceEnv?: NodeJS.ProcessEnv): string;
|
|
178
|
+
export declare function applyLocalCliHomeEnv(targetEnv: Record<string, string>, sourceEnv?: NodeJS.ProcessEnv): void;
|
|
179
|
+
export declare function syncLocalCliCredentialHomeEntries(input: {
|
|
180
|
+
sourceHome?: string | null;
|
|
181
|
+
targetHome: string;
|
|
182
|
+
entries?: readonly string[];
|
|
183
|
+
onLog?: ((stream: "stdout" | "stderr", chunk: string) => Promise<void>) | null;
|
|
184
|
+
}): Promise<{
|
|
185
|
+
linked: string[];
|
|
186
|
+
skipped: string[];
|
|
187
|
+
}>;
|
|
152
188
|
export declare function ensureRudderSkillSymlink(source: string, target: string, linkSkill?: (source: string, target: string) => Promise<void>): Promise<"created" | "repaired" | "skipped">;
|
|
153
189
|
export declare function removeMaintainerOnlySkillSymlinks(skillsHome: string, allowedSkillNames: Iterable<string>): Promise<string[]>;
|
|
154
190
|
export declare function ensureCommandResolvable(command: string, cwd: string, env: NodeJS.ProcessEnv): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.d.ts","sourceRoot":"","sources":["../src/server-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI9D,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,UAAU,cAAc;IACtB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAeD,eAAO,MAAM,gBAAgB,6BAAoC,CAAC;AAclE,eAAO,MAAM,iBAAiB,QAAkB,CAAC;AACjD,eAAO,MAAM,iBAAiB,QAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"server-utils.d.ts","sourceRoot":"","sources":["../src/server-utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI9D,OAAO,KAAK,EAEV,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,E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ills",
|
|
28
28
|
"../../../../../server/resources/bundled-skills",
|
|
29
29
|
];
|
|
30
|
+
const DEFAULT_LOCAL_CLI_CREDENTIAL_HOME_ENTRIES = [
|
|
31
|
+
".aws",
|
|
32
|
+
".azure",
|
|
33
|
+
".config/gh",
|
|
34
|
+
".config/gcloud",
|
|
35
|
+
".config/op",
|
|
36
|
+
".config/vercel",
|
|
37
|
+
".config/configstore",
|
|
38
|
+
".docker",
|
|
39
|
+
".fly",
|
|
40
|
+
".git-credentials",
|
|
41
|
+
".gnupg",
|
|
42
|
+
".kube",
|
|
43
|
+
".netrc",
|
|
44
|
+
".npmrc",
|
|
45
|
+
".ssh",
|
|
46
|
+
".vercel",
|
|
47
|
+
"Library/Application Support/gh",
|
|
48
|
+
"Library/Application Support/com.heroku.cli",
|
|
49
|
+
];
|
|
30
50
|
function normalizePathSlashes(value) {
|
|
31
51
|
return value.replaceAll("\\", "/");
|
|
32
52
|
}
|
|
@@ -161,10 +181,68 @@ export function resolvePathValue(obj, dottedPath) {
|
|
|
161
181
|
export function renderTemplate(template, data) {
|
|
162
182
|
return template.replace(/{{\s*([a-zA-Z0-9_.-]+)\s*}}/g, (_, path) => resolvePathValue(data, path));
|
|
163
183
|
}
|
|
184
|
+
const ISSUE_DOCUMENT_PROMPT_BODY_CHAR_LIMIT = 16_000;
|
|
185
|
+
function truncateIssueDocumentBody(body) {
|
|
186
|
+
if (body.length <= ISSUE_DOCUMENT_PROMPT_BODY_CHAR_LIMIT)
|
|
187
|
+
return body;
|
|
188
|
+
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.]`;
|
|
189
|
+
}
|
|
190
|
+
function formatDocumentHeading(key, title) {
|
|
191
|
+
const cleanTitle = typeof title === "string" ? title.trim() : "";
|
|
192
|
+
return cleanTitle ? `### ${key} — ${cleanTitle}` : `### ${key}`;
|
|
193
|
+
}
|
|
194
|
+
function readIssueDocumentPromptIssueId(input) {
|
|
195
|
+
const planIssueId = typeof input.planDocument?.issueId === "string" ? input.planDocument.issueId.trim() : "";
|
|
196
|
+
if (planIssueId)
|
|
197
|
+
return planIssueId;
|
|
198
|
+
for (const summary of input.documentSummaries ?? []) {
|
|
199
|
+
const issueId = typeof summary.issueId === "string" ? summary.issueId.trim() : "";
|
|
200
|
+
if (issueId)
|
|
201
|
+
return issueId;
|
|
202
|
+
}
|
|
203
|
+
return "<issue-id>";
|
|
204
|
+
}
|
|
205
|
+
export function buildIssueDocumentsPrompt(input) {
|
|
206
|
+
if (!input)
|
|
207
|
+
return "";
|
|
208
|
+
const sections = [];
|
|
209
|
+
const planKey = input.planDocument?.key?.trim() || input.legacyPlanDocument?.key?.trim() || "plan";
|
|
210
|
+
const planBody = input.planDocument?.body?.trim() || input.legacyPlanDocument?.body?.trim() || "";
|
|
211
|
+
if (planBody) {
|
|
212
|
+
sections.push([
|
|
213
|
+
formatDocumentHeading(planKey, input.planDocument?.title),
|
|
214
|
+
input.legacyPlanDocument ? "Source: legacy `<plan>` block in the issue description." : `Source: issue document \`${planKey}\`.`,
|
|
215
|
+
"",
|
|
216
|
+
truncateIssueDocumentBody(planBody),
|
|
217
|
+
].join("\n"));
|
|
218
|
+
}
|
|
219
|
+
const otherDocuments = (input.documentSummaries ?? []).filter((doc) => {
|
|
220
|
+
const key = typeof doc.key === "string" ? doc.key.trim() : "";
|
|
221
|
+
return key && key !== planKey;
|
|
222
|
+
});
|
|
223
|
+
if (otherDocuments.length > 0) {
|
|
224
|
+
const issueId = readIssueDocumentPromptIssueId(input);
|
|
225
|
+
sections.push([
|
|
226
|
+
"### Additional Issue Documents",
|
|
227
|
+
...otherDocuments.map((doc) => {
|
|
228
|
+
const key = doc.key?.trim() || "document";
|
|
229
|
+
const title = doc.title?.trim();
|
|
230
|
+
const revision = typeof doc.latestRevisionNumber === "number" ? `, revision ${doc.latestRevisionNumber}` : "";
|
|
231
|
+
const titlePart = title ? ` — ${title}` : "";
|
|
232
|
+
return `- \`${key}\`${titlePart}${revision}. Fetch with \`rudder issue documents get ${issueId} ${key} --json\`.`;
|
|
233
|
+
}),
|
|
234
|
+
].join("\n"));
|
|
235
|
+
}
|
|
236
|
+
if (sections.length === 0)
|
|
237
|
+
return "";
|
|
238
|
+
return ["## Issue Documents", ...sections].join("\n\n");
|
|
239
|
+
}
|
|
164
240
|
// Default prompt templates for different wake sources
|
|
165
241
|
export const DEFAULT_AGENT_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). Continue your Rudder work.
|
|
166
242
|
|
|
167
|
-
{{context.rudderWorkspace.orgResourcesPrompt}}
|
|
243
|
+
{{context.rudderWorkspace.orgResourcesPrompt}}
|
|
244
|
+
|
|
245
|
+
{{context.issueDocumentsPrompt}}`;
|
|
168
246
|
export const ISSUE_ASSIGN_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). You have been assigned to work on an issue.
|
|
169
247
|
|
|
170
248
|
{{context.rudderWorkspace.orgResourcesPrompt}}
|
|
@@ -179,6 +257,8 @@ export const ISSUE_ASSIGN_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent
|
|
|
179
257
|
**Description:**
|
|
180
258
|
{{issue.description}}
|
|
181
259
|
|
|
260
|
+
{{context.issueDocumentsPrompt}}
|
|
261
|
+
|
|
182
262
|
Your task is to review this issue and begin working on it. Use the available tools to explore the codebase, understand the requirements, and implement a solution.`;
|
|
183
263
|
export const COMMENT_MENTION_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). You were mentioned in a comment and your attention is needed.
|
|
184
264
|
|
|
@@ -192,6 +272,8 @@ export const COMMENT_MENTION_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{ag
|
|
|
192
272
|
**Issue Description:**
|
|
193
273
|
{{issue.description}}
|
|
194
274
|
|
|
275
|
+
{{context.issueDocumentsPrompt}}
|
|
276
|
+
|
|
195
277
|
**Comment:**
|
|
196
278
|
{{comment.body}}
|
|
197
279
|
|
|
@@ -209,10 +291,31 @@ export const ISSUE_COMMENTED_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{ag
|
|
|
209
291
|
**Issue Description:**
|
|
210
292
|
{{issue.description}}
|
|
211
293
|
|
|
294
|
+
{{context.issueDocumentsPrompt}}
|
|
295
|
+
|
|
212
296
|
**Latest Comment:**
|
|
213
297
|
{{comment.body}}
|
|
214
298
|
|
|
215
299
|
Review the new comment and continue the issue from the current state. Respond or take action as needed.`;
|
|
300
|
+
export const ISSUE_CHANGES_REQUESTED_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). A reviewer requested changes on an issue you own.
|
|
301
|
+
|
|
302
|
+
{{context.rudderWorkspace.orgResourcesPrompt}}
|
|
303
|
+
|
|
304
|
+
## Context
|
|
305
|
+
|
|
306
|
+
**Issue:** {{issue.title}}
|
|
307
|
+
**ID:** {{issue.id}}
|
|
308
|
+
**Status:** {{issue.status}}
|
|
309
|
+
|
|
310
|
+
**Issue Description:**
|
|
311
|
+
{{issue.description}}
|
|
312
|
+
|
|
313
|
+
{{context.issueDocumentsPrompt}}
|
|
314
|
+
|
|
315
|
+
**Reviewer Comment:**
|
|
316
|
+
{{comment.body}}
|
|
317
|
+
|
|
318
|
+
Review the requested changes and continue the issue from the current state. Address the reviewer feedback before handing it back for review.`;
|
|
216
319
|
export const ISSUE_RECOVERY_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). This is a recovery run, not a fresh task.
|
|
217
320
|
|
|
218
321
|
{{context.rudderWorkspace.orgResourcesPrompt}}
|
|
@@ -235,6 +338,8 @@ export const ISSUE_RECOVERY_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{age
|
|
|
235
338
|
- Description:
|
|
236
339
|
{{issue.description}}
|
|
237
340
|
|
|
341
|
+
{{context.issueDocumentsPrompt}}
|
|
342
|
+
|
|
238
343
|
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.`;
|
|
239
344
|
export const RECOVERY_PROMPT_TEMPLATE = `You are agent {{agent.id}} ({{agent.name}}). This is a recovery run, not a fresh task.
|
|
240
345
|
|
|
@@ -272,6 +377,8 @@ Reason: {{context.passiveFollowup.reason}}
|
|
|
272
377
|
- Description:
|
|
273
378
|
{{issue.description}}
|
|
274
379
|
|
|
380
|
+
{{context.issueDocumentsPrompt}}
|
|
381
|
+
|
|
275
382
|
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.`;
|
|
276
383
|
/**
|
|
277
384
|
* Selects the base heartbeat prompt template used by runtimes before final prompt assembly.
|
|
@@ -283,6 +390,9 @@ Before changing the issue, inspect the current issue state and any side effects
|
|
|
283
390
|
* - comment.mention:
|
|
284
391
|
* "You were mentioned in a comment ..."
|
|
285
392
|
* Includes issue summary plus mention comment body so the agent can respond without extra fetches.
|
|
393
|
+
* - issue_changes_requested:
|
|
394
|
+
* "A reviewer requested changes on an issue you own ..."
|
|
395
|
+
* Includes issue summary plus reviewer comment body so the assignee can act on feedback immediately.
|
|
286
396
|
* - issue_commented:
|
|
287
397
|
* "There is a new comment on an issue you own ..."
|
|
288
398
|
* Includes issue summary plus the newest comment body so the assignee can continue immediately.
|
|
@@ -331,6 +441,9 @@ export function selectPromptTemplate(configuredTemplate, context) {
|
|
|
331
441
|
if (wakeReason === "issue_passive_followup") {
|
|
332
442
|
return ISSUE_PASSIVE_FOLLOWUP_PROMPT_TEMPLATE;
|
|
333
443
|
}
|
|
444
|
+
if (wakeReason === "issue_changes_requested") {
|
|
445
|
+
return ISSUE_CHANGES_REQUESTED_PROMPT_TEMPLATE;
|
|
446
|
+
}
|
|
334
447
|
if (wakeSource === "assignment" || wakeReason === "issue_assigned") {
|
|
335
448
|
return ISSUE_ASSIGN_PROMPT_TEMPLATE;
|
|
336
449
|
}
|
|
@@ -362,10 +475,18 @@ export const RUDDER_AGENT_OPERATING_CONTRACT = [
|
|
|
362
475
|
"- Shared organization workspace root lives under `$RUDDER_ORG_WORKSPACE_ROOT`.",
|
|
363
476
|
"- Shared organization skills live under `$RUDDER_ORG_SKILLS_DIR`.",
|
|
364
477
|
"- Shared organization plans live under `$RUDDER_ORG_PLANS_DIR`.",
|
|
478
|
+
"- Shared organization artifacts live under `$RUDDER_ORG_ARTIFACTS_DIR`.",
|
|
479
|
+
"- Durable generated outputs such as screenshots, images, mockups, reports, CSVs, handoff logs, and other user-visible files should be written under `$RUDDER_ORG_ARTIFACTS_DIR` when available.",
|
|
480
|
+
"- Use `/tmp` only for transient scratch files and temporary verification artifacts; do not put durable work product there.",
|
|
481
|
+
"- Local trusted runtimes may expose the host operator home as `$RUDDER_OPERATOR_HOME`; use it only when a local skill or script intentionally needs operator-owned desktop app or CLI state. Do not replace `$HOME` with it.",
|
|
365
482
|
"- Durable shared work output should prefer these managed workspace paths instead of ad-hoc top-level `projects/` folders.",
|
|
366
483
|
"",
|
|
484
|
+
"When you create or copy a skill under `$AGENT_HOME/skills/<slug>/`, check the agent's Skills snapshot before claiming it will load in future runs. If it is installed but not enabled, say exactly that future runs will not load it until enabled, and offer to enable it with `rudder agent skills enable <agent-id> <selection-ref>` when you have permission.",
|
|
485
|
+
"",
|
|
367
486
|
"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.",
|
|
368
487
|
"",
|
|
488
|
+
"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.",
|
|
489
|
+
"",
|
|
369
490
|
"## Memory and Planning",
|
|
370
491
|
"",
|
|
371
492
|
"You MUST use the `para-memory-files` skill for all memory operations: storing facts, writing daily notes, creating entities, running weekly synthesis, recalling past context, and managing plans. The skill defines your three-layer memory system (knowledge graph, daily notes, tacit knowledge), the PARA folder structure, atomic fact schemas, memory decay rules, and recall/planning conventions.",
|
|
@@ -379,9 +500,40 @@ export const RUDDER_AGENT_OPERATING_CONTRACT = [
|
|
|
379
500
|
"- Never exfiltrate secrets or private data.",
|
|
380
501
|
"- Do not perform any destructive commands unless explicitly requested by the board.",
|
|
381
502
|
].join("\n");
|
|
503
|
+
function toPromptPath(pathValue) {
|
|
504
|
+
return pathValue.split(path.sep).join("/");
|
|
505
|
+
}
|
|
506
|
+
function isInsidePath(parentPath, childPath) {
|
|
507
|
+
const relativePath = path.relative(parentPath, childPath);
|
|
508
|
+
return relativePath === "" || (!relativePath.startsWith("..") && !path.isAbsolute(relativePath));
|
|
509
|
+
}
|
|
510
|
+
function displayInstructionPath(filePath, instructionsFilePath) {
|
|
511
|
+
const resolvedFilePath = path.resolve(filePath);
|
|
512
|
+
const resolvedInstructionsPath = path.resolve(instructionsFilePath);
|
|
513
|
+
const instructionsDir = path.dirname(resolvedInstructionsPath);
|
|
514
|
+
if (path.basename(instructionsDir) === "instructions") {
|
|
515
|
+
const agentHome = path.dirname(instructionsDir);
|
|
516
|
+
if (isInsidePath(agentHome, resolvedFilePath)) {
|
|
517
|
+
const relativePath = path.relative(agentHome, resolvedFilePath);
|
|
518
|
+
return relativePath ? `$AGENT_HOME/${toPromptPath(relativePath)}` : "$AGENT_HOME";
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return filePath;
|
|
522
|
+
}
|
|
523
|
+
function displayInstructionDir(filePath, instructionsFilePath) {
|
|
524
|
+
const displayPath = displayInstructionPath(filePath, instructionsFilePath);
|
|
525
|
+
const lastSlash = displayPath.lastIndexOf("/");
|
|
526
|
+
return lastSlash >= 0 ? `${displayPath.slice(0, lastSlash)}/` : "";
|
|
527
|
+
}
|
|
382
528
|
export async function loadAgentInstructionsPrefix(input) {
|
|
383
529
|
const instructionsFilePath = input.instructionsFilePath.trim();
|
|
384
530
|
const instructionsDir = instructionsFilePath ? `${path.dirname(instructionsFilePath)}/` : "";
|
|
531
|
+
const displayInstructionsFilePath = instructionsFilePath
|
|
532
|
+
? displayInstructionPath(instructionsFilePath, instructionsFilePath)
|
|
533
|
+
: "";
|
|
534
|
+
const displayInstructionsDir = instructionsFilePath
|
|
535
|
+
? displayInstructionDir(instructionsFilePath, instructionsFilePath)
|
|
536
|
+
: "";
|
|
385
537
|
const warningStream = input.warningStream ?? "stdout";
|
|
386
538
|
const operatingContractSection = `${RUDDER_AGENT_OPERATING_CONTRACT}\n\n` +
|
|
387
539
|
"The above Rudder agent operating contract was injected by Rudder at runtime.";
|
|
@@ -413,29 +565,31 @@ export async function loadAgentInstructionsPrefix(input) {
|
|
|
413
565
|
loadedPaths.add(path.resolve(instructionsFilePath));
|
|
414
566
|
entrySection =
|
|
415
567
|
`${instructionsContents}\n\n` +
|
|
416
|
-
`The above agent instructions were loaded from ${
|
|
417
|
-
`Resolve any relative file references from ${
|
|
418
|
-
await input.onLog("stdout", `[rudder] Loaded agent instructions file: ${
|
|
568
|
+
`The above agent instructions were loaded from ${displayInstructionsFilePath}. ` +
|
|
569
|
+
`Resolve any relative file references from ${displayInstructionsDir}.`;
|
|
570
|
+
await input.onLog("stdout", `[rudder] Loaded agent instructions file: ${displayInstructionsFilePath}\n`);
|
|
419
571
|
}
|
|
420
572
|
catch (err) {
|
|
421
573
|
const reason = err instanceof Error ? err.message : String(err);
|
|
422
574
|
await input.onLog(warningStream, `[rudder] Warning: could not read agent instructions file "${instructionsFilePath}": ${reason}\n`);
|
|
423
|
-
commandNotes.push(`Configured instructionsFilePath ${
|
|
575
|
+
commandNotes.push(`Configured instructionsFilePath ${displayInstructionsFilePath}, but file could not be read; continuing without injected instructions.`);
|
|
424
576
|
}
|
|
425
577
|
async function loadSiblingInstructionFile(siblingInput) {
|
|
426
578
|
const filePath = path.join(path.dirname(instructionsFilePath), siblingInput.fileName);
|
|
427
579
|
const resolvedPath = path.resolve(filePath);
|
|
580
|
+
const displayFilePath = displayInstructionPath(filePath, instructionsFilePath);
|
|
581
|
+
const displayFileDir = displayInstructionDir(filePath, instructionsFilePath);
|
|
428
582
|
if (loadedPaths.has(resolvedPath))
|
|
429
583
|
return { path: filePath, section: "" };
|
|
430
584
|
try {
|
|
431
585
|
const contents = await fs.readFile(filePath, "utf8");
|
|
432
586
|
loadedPaths.add(resolvedPath);
|
|
433
|
-
await input.onLog("stdout", `[rudder] Loaded ${siblingInput.logLabel}: ${
|
|
587
|
+
await input.onLog("stdout", `[rudder] Loaded ${siblingInput.logLabel}: ${displayFilePath}\n`);
|
|
434
588
|
return {
|
|
435
589
|
path: filePath,
|
|
436
590
|
section: `${contents}\n\n` +
|
|
437
|
-
`The above ${siblingInput.label} were loaded from ${
|
|
438
|
-
`Resolve any relative file references from ${
|
|
591
|
+
`The above ${siblingInput.label} were loaded from ${displayFilePath}. ` +
|
|
592
|
+
`Resolve any relative file references from ${displayFileDir}.`,
|
|
439
593
|
};
|
|
440
594
|
}
|
|
441
595
|
catch (err) {
|
|
@@ -451,26 +605,29 @@ export async function loadAgentInstructionsPrefix(input) {
|
|
|
451
605
|
label: "agent role and persona instructions",
|
|
452
606
|
logLabel: "agent soul instructions file",
|
|
453
607
|
});
|
|
454
|
-
if (soul.section)
|
|
455
|
-
commandNotes.push(`Loaded agent soul instructions from ${soul.path}`);
|
|
608
|
+
if (soul.section && soul.path) {
|
|
609
|
+
commandNotes.push(`Loaded agent soul instructions from ${displayInstructionPath(soul.path, instructionsFilePath)}`);
|
|
610
|
+
}
|
|
456
611
|
const tools = await loadSiblingInstructionFile({
|
|
457
612
|
fileName: "TOOLS.md",
|
|
458
613
|
label: "agent tool notes",
|
|
459
614
|
logLabel: "agent tool notes file",
|
|
460
615
|
});
|
|
461
|
-
if (tools.section)
|
|
462
|
-
commandNotes.push(`Loaded agent tool notes from ${tools.path}`);
|
|
616
|
+
if (tools.section && tools.path) {
|
|
617
|
+
commandNotes.push(`Loaded agent tool notes from ${displayInstructionPath(tools.path, instructionsFilePath)}`);
|
|
618
|
+
}
|
|
463
619
|
const memory = await loadSiblingInstructionFile({
|
|
464
620
|
fileName: "MEMORY.md",
|
|
465
621
|
label: "agent memory instructions",
|
|
466
622
|
logLabel: "agent memory instructions file",
|
|
467
623
|
});
|
|
468
|
-
if (memory.section)
|
|
469
|
-
commandNotes.push(`Loaded agent memory instructions from ${memory.path}`);
|
|
624
|
+
if (memory.section && memory.path) {
|
|
625
|
+
commandNotes.push(`Loaded agent memory instructions from ${displayInstructionPath(memory.path, instructionsFilePath)}`);
|
|
626
|
+
}
|
|
470
627
|
const memoryFilePath = memory.section ? memory.path : null;
|
|
471
628
|
const memorySection = memory.section;
|
|
472
629
|
if (entrySection)
|
|
473
|
-
commandNotes.splice(1, 0, `Loaded agent instructions from ${
|
|
630
|
+
commandNotes.splice(1, 0, `Loaded agent instructions from ${displayInstructionsFilePath}`);
|
|
474
631
|
const prefix = joinPromptSections([operatingContractSection, entrySection, soul.section, tools.section, memorySection]);
|
|
475
632
|
return {
|
|
476
633
|
prefix,
|
|
@@ -945,6 +1102,90 @@ export function writeRudderSkillSyncPreference(config, desiredSkills) {
|
|
|
945
1102
|
next.rudderSkillSync = current;
|
|
946
1103
|
return next;
|
|
947
1104
|
}
|
|
1105
|
+
function nonEmptyEnvPath(value) {
|
|
1106
|
+
return typeof value === "string" && value.trim().length > 0 ? path.resolve(value.trim()) : null;
|
|
1107
|
+
}
|
|
1108
|
+
export function resolveLocalOperatorHome(sourceEnv = process.env) {
|
|
1109
|
+
return (nonEmptyEnvPath(sourceEnv.RUDDER_OPERATOR_HOME)
|
|
1110
|
+
?? nonEmptyEnvPath(process.env.RUDDER_OPERATOR_HOME)
|
|
1111
|
+
?? nonEmptyEnvPath(process.env.HOME)
|
|
1112
|
+
?? nonEmptyEnvPath(sourceEnv.HOME)
|
|
1113
|
+
?? path.resolve(os.homedir()));
|
|
1114
|
+
}
|
|
1115
|
+
export function applyLocalCliHomeEnv(targetEnv, sourceEnv = process.env) {
|
|
1116
|
+
const home = nonEmptyEnvPath(sourceEnv.HOME) ?? path.resolve(os.homedir());
|
|
1117
|
+
targetEnv.HOME = home;
|
|
1118
|
+
const userProfile = nonEmptyEnvPath(sourceEnv.USERPROFILE);
|
|
1119
|
+
if (userProfile) {
|
|
1120
|
+
targetEnv.USERPROFILE = userProfile;
|
|
1121
|
+
}
|
|
1122
|
+
else if (process.platform === "win32") {
|
|
1123
|
+
targetEnv.USERPROFILE = home;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
async function localCliPathExists(candidate) {
|
|
1127
|
+
return fs.access(candidate).then(() => true).catch(() => false);
|
|
1128
|
+
}
|
|
1129
|
+
async function directoryIsEmpty(target) {
|
|
1130
|
+
const entries = await fs.readdir(target).catch(() => null);
|
|
1131
|
+
return Array.isArray(entries) && entries.length === 0;
|
|
1132
|
+
}
|
|
1133
|
+
async function ensureSymlinkToSource(target, source) {
|
|
1134
|
+
const existing = await fs.lstat(target).catch(() => null);
|
|
1135
|
+
if (!existing) {
|
|
1136
|
+
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
1137
|
+
await fs.symlink(source, target);
|
|
1138
|
+
return "created";
|
|
1139
|
+
}
|
|
1140
|
+
if (!existing.isSymbolicLink()) {
|
|
1141
|
+
if (existing.isDirectory() && await directoryIsEmpty(target)) {
|
|
1142
|
+
await fs.rmdir(target);
|
|
1143
|
+
await fs.symlink(source, target);
|
|
1144
|
+
return "repaired";
|
|
1145
|
+
}
|
|
1146
|
+
return "skipped";
|
|
1147
|
+
}
|
|
1148
|
+
const linkedPath = await fs.readlink(target).catch(() => null);
|
|
1149
|
+
if (!linkedPath)
|
|
1150
|
+
return "skipped";
|
|
1151
|
+
const resolvedLinkedPath = path.isAbsolute(linkedPath)
|
|
1152
|
+
? linkedPath
|
|
1153
|
+
: path.resolve(path.dirname(target), linkedPath);
|
|
1154
|
+
if (resolvedLinkedPath === source)
|
|
1155
|
+
return "skipped";
|
|
1156
|
+
await fs.unlink(target);
|
|
1157
|
+
await fs.symlink(source, target);
|
|
1158
|
+
return "repaired";
|
|
1159
|
+
}
|
|
1160
|
+
export async function syncLocalCliCredentialHomeEntries(input) {
|
|
1161
|
+
const sourceHome = nonEmptyEnvPath(input.sourceHome ?? undefined) ?? path.resolve(os.homedir());
|
|
1162
|
+
const targetHome = path.resolve(input.targetHome);
|
|
1163
|
+
const linked = [];
|
|
1164
|
+
const skipped = [];
|
|
1165
|
+
if (sourceHome === targetHome)
|
|
1166
|
+
return { linked, skipped };
|
|
1167
|
+
const entries = input.entries ?? DEFAULT_LOCAL_CLI_CREDENTIAL_HOME_ENTRIES;
|
|
1168
|
+
for (const relativeEntry of entries) {
|
|
1169
|
+
const source = path.join(sourceHome, relativeEntry);
|
|
1170
|
+
if (!(await localCliPathExists(source)))
|
|
1171
|
+
continue;
|
|
1172
|
+
const target = path.join(targetHome, relativeEntry);
|
|
1173
|
+
try {
|
|
1174
|
+
const result = await ensureSymlinkToSource(target, source);
|
|
1175
|
+
if (result === "skipped")
|
|
1176
|
+
skipped.push(relativeEntry);
|
|
1177
|
+
else
|
|
1178
|
+
linked.push(relativeEntry);
|
|
1179
|
+
}
|
|
1180
|
+
catch {
|
|
1181
|
+
skipped.push(relativeEntry);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
if (input.onLog && linked.length > 0) {
|
|
1185
|
+
await input.onLog("stdout", `[rudder] Shared ${linked.length} local CLI credential entr${linked.length === 1 ? "y" : "ies"} into managed HOME ${targetHome}: ${linked.join(", ")}\n`);
|
|
1186
|
+
}
|
|
1187
|
+
return { linked, skipped };
|
|
1188
|
+
}
|
|
948
1189
|
export async function ensureRudderSkillSymlink(source, target, linkSkill = (linkSource, linkTarget) => fs.symlink(linkSource, linkTarget)) {
|
|
949
1190
|
const existing = await fs.lstat(target).catch(() => null);
|
|
950
1191
|
if (!existing) {
|
|
@@ -1035,6 +1276,17 @@ export async function runChildProcess(runId, command, args, opts) {
|
|
|
1035
1276
|
for (const key of CLAUDE_CODE_NESTING_VARS) {
|
|
1036
1277
|
delete rawMerged[key];
|
|
1037
1278
|
}
|
|
1279
|
+
const GIT_IDENTITY_ENV_VARS = [
|
|
1280
|
+
"GIT_AUTHOR_NAME",
|
|
1281
|
+
"GIT_AUTHOR_EMAIL",
|
|
1282
|
+
"GIT_COMMITTER_NAME",
|
|
1283
|
+
"GIT_COMMITTER_EMAIL",
|
|
1284
|
+
];
|
|
1285
|
+
for (const key of GIT_IDENTITY_ENV_VARS) {
|
|
1286
|
+
if (rawMerged[key] === "" && !Object.prototype.hasOwnProperty.call(opts.env, key)) {
|
|
1287
|
+
delete rawMerged[key];
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1038
1290
|
// When Rudder isolates HOME for child agents, don't let zsh keep using the
|
|
1039
1291
|
// host user's startup dir via an inherited ZDOTDIR. That mismatch makes
|
|
1040
1292
|
// child `zsh -lc` invocations source the host `.zshenv` with the agent HOME.
|