@xn-intenton-z2a/agentic-lib 7.1.73 → 7.1.74
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/.github/workflows/agentic-lib-schedule.yml +4 -4
- package/.github/workflows/agentic-lib-workflow.yml +9 -0
- package/package.json +1 -1
- package/src/actions/agentic-step/action.yml +2 -0
- package/src/actions/agentic-step/copilot.js +22 -0
- package/src/actions/agentic-step/index.js +1 -0
- package/src/actions/agentic-step/tasks/discussions.js +1 -0
- package/src/actions/agentic-step/tasks/enhance-issue.js +2 -0
- package/src/actions/agentic-step/tasks/fix-code.js +5 -5
- package/src/actions/agentic-step/tasks/maintain-features.js +4 -3
- package/src/actions/agentic-step/tasks/maintain-library.js +4 -3
- package/src/actions/agentic-step/tasks/resolve-issue.js +3 -3
- package/src/actions/agentic-step/tasks/review-issue.js +3 -0
- package/src/actions/agentic-step/tasks/transform.js +5 -4
- package/src/seeds/zero-package.json +1 -1
|
@@ -81,10 +81,10 @@ jobs:
|
|
|
81
81
|
|
|
82
82
|
const SCHEDULE_MAP = {
|
|
83
83
|
off: null,
|
|
84
|
-
weekly: '
|
|
85
|
-
daily: '
|
|
86
|
-
hourly: '
|
|
87
|
-
continuous: '
|
|
84
|
+
weekly: '15 6 * * 1',
|
|
85
|
+
daily: '15 6 * * *',
|
|
86
|
+
hourly: '15 * * * *',
|
|
87
|
+
continuous: '5,15,25,35,45,55 * * * *',
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
// Update agentic-lib-workflow.yml schedule
|
|
@@ -375,6 +375,7 @@ jobs:
|
|
|
375
375
|
echo "libraryWritablePaths=${LIBRARY};${SOURCES}" >> $GITHUB_OUTPUT
|
|
376
376
|
|
|
377
377
|
- name: Maintain features
|
|
378
|
+
id: maintain-features
|
|
378
379
|
if: steps.mission-check.outputs.mission-complete != 'true'
|
|
379
380
|
uses: ./.github/agentic-lib/actions/agentic-step
|
|
380
381
|
env:
|
|
@@ -388,6 +389,7 @@ jobs:
|
|
|
388
389
|
model: ${{ needs.params.outputs.model }}
|
|
389
390
|
|
|
390
391
|
- name: Maintain library
|
|
392
|
+
id: maintain-library
|
|
391
393
|
if: steps.mission-check.outputs.mission-complete != 'true'
|
|
392
394
|
uses: ./.github/agentic-lib/actions/agentic-step
|
|
393
395
|
env:
|
|
@@ -400,6 +402,13 @@ jobs:
|
|
|
400
402
|
writable-paths: ${{ steps.config.outputs.libraryWritablePaths }}
|
|
401
403
|
model: ${{ needs.params.outputs.model }}
|
|
402
404
|
|
|
405
|
+
- name: Log narrative thread
|
|
406
|
+
if: steps.mission-check.outputs.mission-complete != 'true'
|
|
407
|
+
run: |
|
|
408
|
+
echo "## Maintain Narrative Thread" >> $GITHUB_STEP_SUMMARY
|
|
409
|
+
echo "- **Features:** ${{ steps.maintain-features.outputs.narrative }}" >> $GITHUB_STEP_SUMMARY
|
|
410
|
+
echo "- **Library:** ${{ steps.maintain-library.outputs.narrative }}" >> $GITHUB_STEP_SUMMARY
|
|
411
|
+
|
|
403
412
|
- name: Commit and push changes
|
|
404
413
|
if: github.repository != 'xn-intenton-z2a/agentic-lib' && needs.params.outputs.dry-run != 'true'
|
|
405
414
|
uses: ./.github/agentic-lib/actions/commit-if-changed
|
package/package.json
CHANGED
|
@@ -56,6 +56,8 @@ outputs:
|
|
|
56
56
|
description: "Action chosen by the task (e.g. request-supervisor, create-feature, nop)"
|
|
57
57
|
action-arg:
|
|
58
58
|
description: "Argument for the chosen action (free text)"
|
|
59
|
+
narrative:
|
|
60
|
+
description: "One-sentence English narrative of what the task did and why"
|
|
59
61
|
|
|
60
62
|
runs:
|
|
61
63
|
using: "node24"
|
|
@@ -398,6 +398,28 @@ async function _runCopilotTaskOnce({
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
+
/**
|
|
402
|
+
* Extract a [NARRATIVE] line from an LLM response.
|
|
403
|
+
* Returns the text after the tag, or a fallback summary.
|
|
404
|
+
*
|
|
405
|
+
* @param {string} content - Raw LLM response content
|
|
406
|
+
* @param {string} [fallback] - Fallback if no [NARRATIVE] tag found
|
|
407
|
+
* @returns {string} The narrative sentence
|
|
408
|
+
*/
|
|
409
|
+
export function extractNarrative(content, fallback) {
|
|
410
|
+
if (!content) return fallback || "";
|
|
411
|
+
const match = content.match(/\[NARRATIVE\]\s*(.+)/);
|
|
412
|
+
if (match) return match[1].trim();
|
|
413
|
+
return fallback || "";
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Narrative solicitation to append to system messages.
|
|
418
|
+
* Asks the LLM to end its response with a one-sentence summary.
|
|
419
|
+
*/
|
|
420
|
+
export const NARRATIVE_INSTRUCTION =
|
|
421
|
+
"\n\nAfter completing your task, end your response with a line starting with [NARRATIVE] followed by one plain English sentence describing what you did and why, for the activity log.";
|
|
422
|
+
|
|
401
423
|
/**
|
|
402
424
|
* Read a file, returning empty string on failure. For optional context files.
|
|
403
425
|
*
|
|
@@ -98,6 +98,7 @@ async function run() {
|
|
|
98
98
|
if (result.model) core.setOutput("model", result.model);
|
|
99
99
|
if (result.action) core.setOutput("action", result.action);
|
|
100
100
|
if (result.actionArg) core.setOutput("action-arg", result.actionArg);
|
|
101
|
+
if (result.narrative) core.setOutput("narrative", result.narrative);
|
|
101
102
|
|
|
102
103
|
const profileName = config.tuning?.profileName || "unknown";
|
|
103
104
|
|
|
@@ -336,6 +336,7 @@ export async function discussions(context) {
|
|
|
336
336
|
cost,
|
|
337
337
|
model,
|
|
338
338
|
details: `Action: ${action}${argSuffix}\nReply: ${replyBody.substring(0, 200)}`,
|
|
339
|
+
narrative: `Responded to discussion with action ${action}${argSuffix}.`,
|
|
339
340
|
action,
|
|
340
341
|
actionArg,
|
|
341
342
|
replyBody,
|
|
@@ -102,6 +102,7 @@ async function enhanceSingleIssue({ octokit, repo, config, issueNumber, instruct
|
|
|
102
102
|
cost,
|
|
103
103
|
model,
|
|
104
104
|
details: `Enhanced issue #${issueNumber} with acceptance criteria`,
|
|
105
|
+
narrative: `Enhanced issue #${issueNumber} with testable acceptance criteria.`,
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
|
|
@@ -173,5 +174,6 @@ export async function enhanceIssue(context) {
|
|
|
173
174
|
.map((r) => r.details)
|
|
174
175
|
.join("; ")
|
|
175
176
|
.substring(0, 500)}`,
|
|
177
|
+
narrative: `Enhanced ${enhanced} issue(s) with testable acceptance criteria.`,
|
|
176
178
|
};
|
|
177
179
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import * as core from "@actions/core";
|
|
10
10
|
import { readFileSync } from "fs";
|
|
11
11
|
import { execSync } from "child_process";
|
|
12
|
-
import { runCopilotTask, formatPathsSection } from "../copilot.js";
|
|
12
|
+
import { runCopilotTask, formatPathsSection, extractNarrative, NARRATIVE_INSTRUCTION } from "../copilot.js";
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Extract run_id from a check run's details_url.
|
|
@@ -100,7 +100,7 @@ async function resolveConflicts({ config, pr, prNumber, instructions, model, wri
|
|
|
100
100
|
const t = config.tuning || {};
|
|
101
101
|
const { tokensUsed, inputTokens, outputTokens, cost, content: resultContent } = await runCopilotTask({
|
|
102
102
|
model,
|
|
103
|
-
systemMessage: `You are resolving git merge conflicts on PR #${prNumber}. Write resolved versions of each conflicted file, removing all conflict markers. Preserve the PR's feature intent while incorporating main's updates
|
|
103
|
+
systemMessage: `You are resolving git merge conflicts on PR #${prNumber}. Write resolved versions of each conflicted file, removing all conflict markers. Preserve the PR's feature intent while incorporating main's updates.` + NARRATIVE_INSTRUCTION,
|
|
104
104
|
prompt,
|
|
105
105
|
writablePaths,
|
|
106
106
|
tuning: t,
|
|
@@ -116,7 +116,7 @@ async function resolveConflicts({ config, pr, prNumber, instructions, model, wri
|
|
|
116
116
|
cost,
|
|
117
117
|
model,
|
|
118
118
|
details: `Resolved ${conflicts.length} conflicted file(s) on PR #${prNumber}`,
|
|
119
|
-
narrative: (resultContent
|
|
119
|
+
narrative: extractNarrative(resultContent, `Resolved ${conflicts.length} merge conflict(s) on PR #${prNumber}.`),
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
|
|
@@ -189,7 +189,7 @@ export async function fixCode(context) {
|
|
|
189
189
|
const t = config.tuning || {};
|
|
190
190
|
const { tokensUsed, inputTokens, outputTokens, cost, content: resultContent } = await runCopilotTask({
|
|
191
191
|
model,
|
|
192
|
-
systemMessage: `You are an autonomous coding agent fixing failing tests on PR #${prNumber}. Make minimal, targeted changes to fix the test failures
|
|
192
|
+
systemMessage: `You are an autonomous coding agent fixing failing tests on PR #${prNumber}. Make minimal, targeted changes to fix the test failures.` + NARRATIVE_INSTRUCTION,
|
|
193
193
|
prompt,
|
|
194
194
|
writablePaths,
|
|
195
195
|
tuning: t,
|
|
@@ -205,6 +205,6 @@ export async function fixCode(context) {
|
|
|
205
205
|
cost,
|
|
206
206
|
model,
|
|
207
207
|
details: `Applied fix for ${failedChecks.length} failing check(s) on PR #${prNumber}`,
|
|
208
|
-
narrative: (resultContent
|
|
208
|
+
narrative: extractNarrative(resultContent, `Fixed ${failedChecks.length} failing check(s) on PR #${prNumber}.`),
|
|
209
209
|
};
|
|
210
210
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// prunes completed/irrelevant features, and ensures quality.
|
|
7
7
|
|
|
8
8
|
import { existsSync } from "fs";
|
|
9
|
-
import { runCopilotTask, readOptionalFile, scanDirectory, formatPathsSection, extractFeatureSummary } from "../copilot.js";
|
|
9
|
+
import { runCopilotTask, readOptionalFile, scanDirectory, formatPathsSection, extractFeatureSummary, extractNarrative, NARRATIVE_INSTRUCTION } from "../copilot.js";
|
|
10
10
|
import { checkWipLimit } from "../safety.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -83,10 +83,10 @@ export async function maintainFeatures(context) {
|
|
|
83
83
|
"- Feature files must be markdown with a descriptive filename (e.g. HTTP_SERVER.md)",
|
|
84
84
|
].join("\n");
|
|
85
85
|
|
|
86
|
-
const { tokensUsed, inputTokens, outputTokens, cost } = await runCopilotTask({
|
|
86
|
+
const { content: resultContent, tokensUsed, inputTokens, outputTokens, cost } = await runCopilotTask({
|
|
87
87
|
model,
|
|
88
88
|
systemMessage:
|
|
89
|
-
"You are a feature lifecycle manager. Create, update, and prune feature specification files to keep the project focused on its mission.",
|
|
89
|
+
"You are a feature lifecycle manager. Create, update, and prune feature specification files to keep the project focused on its mission." + NARRATIVE_INSTRUCTION,
|
|
90
90
|
prompt,
|
|
91
91
|
writablePaths,
|
|
92
92
|
tuning: t,
|
|
@@ -100,5 +100,6 @@ export async function maintainFeatures(context) {
|
|
|
100
100
|
cost,
|
|
101
101
|
model,
|
|
102
102
|
details: `Maintained features (${features.length} existing, limit ${featureLimit})`,
|
|
103
|
+
narrative: extractNarrative(resultContent, `Maintained ${features.length} features (limit ${featureLimit}).`),
|
|
103
104
|
};
|
|
104
105
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import * as core from "@actions/core";
|
|
9
9
|
import { existsSync } from "fs";
|
|
10
|
-
import { runCopilotTask, readOptionalFile, scanDirectory, formatPathsSection } from "../copilot.js";
|
|
10
|
+
import { runCopilotTask, readOptionalFile, scanDirectory, formatPathsSection, extractNarrative, NARRATIVE_INSTRUCTION } from "../copilot.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Maintain the library of knowledge documents from source URLs.
|
|
@@ -81,10 +81,10 @@ export async function maintainLibrary(context) {
|
|
|
81
81
|
].join("\n");
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
const { tokensUsed, inputTokens, outputTokens, cost } = await runCopilotTask({
|
|
84
|
+
const { content: resultContent, tokensUsed, inputTokens, outputTokens, cost } = await runCopilotTask({
|
|
85
85
|
model,
|
|
86
86
|
systemMessage:
|
|
87
|
-
"You are a knowledge librarian. Maintain a library of technical documents extracted from web sources.",
|
|
87
|
+
"You are a knowledge librarian. Maintain a library of technical documents extracted from web sources." + NARRATIVE_INSTRUCTION,
|
|
88
88
|
prompt,
|
|
89
89
|
writablePaths,
|
|
90
90
|
tuning: t,
|
|
@@ -103,5 +103,6 @@ export async function maintainLibrary(context) {
|
|
|
103
103
|
cost,
|
|
104
104
|
model,
|
|
105
105
|
details: detailsMsg,
|
|
106
|
+
narrative: extractNarrative(resultContent, detailsMsg),
|
|
106
107
|
};
|
|
107
108
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import * as core from "@actions/core";
|
|
9
9
|
import { checkAttemptLimit, checkWipLimit, isIssueResolved } from "../safety.js";
|
|
10
|
-
import { runCopilotTask, readOptionalFile, formatPathsSection } from "../copilot.js";
|
|
10
|
+
import { runCopilotTask, readOptionalFile, formatPathsSection, extractNarrative, NARRATIVE_INSTRUCTION } from "../copilot.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Resolve a GitHub issue by generating code and creating a PR.
|
|
@@ -81,7 +81,7 @@ export async function resolveIssue(context) {
|
|
|
81
81
|
const t = config.tuning || {};
|
|
82
82
|
const { content: resultContent, tokensUsed, inputTokens, outputTokens, cost } = await runCopilotTask({
|
|
83
83
|
model,
|
|
84
|
-
systemMessage: `You are an autonomous coding agent resolving GitHub issue #${issueNumber}. Write clean, tested code. Only modify files listed under "Writable" paths. Read-only paths are for context only
|
|
84
|
+
systemMessage: `You are an autonomous coding agent resolving GitHub issue #${issueNumber}. Write clean, tested code. Only modify files listed under "Writable" paths. Read-only paths are for context only.` + NARRATIVE_INSTRUCTION,
|
|
85
85
|
prompt,
|
|
86
86
|
writablePaths,
|
|
87
87
|
tuning: t,
|
|
@@ -99,6 +99,6 @@ export async function resolveIssue(context) {
|
|
|
99
99
|
model,
|
|
100
100
|
commitUrl: null,
|
|
101
101
|
details: `Generated code for issue #${issueNumber}: ${resultContent.substring(0, 200)}`,
|
|
102
|
-
narrative: (resultContent
|
|
102
|
+
narrative: extractNarrative(resultContent, `Generated code for issue #${issueNumber}.`),
|
|
103
103
|
};
|
|
104
104
|
}
|
|
@@ -161,6 +161,7 @@ async function reviewSingleIssue({ octokit, repo, config, targetIssueNumber, ins
|
|
|
161
161
|
cost,
|
|
162
162
|
model,
|
|
163
163
|
details: `Closed issue #${targetIssueNumber}: ${verdict.substring(0, 200)}`,
|
|
164
|
+
narrative: `Reviewed issue #${targetIssueNumber} and closed it as resolved.`,
|
|
164
165
|
};
|
|
165
166
|
}
|
|
166
167
|
|
|
@@ -173,6 +174,7 @@ async function reviewSingleIssue({ octokit, repo, config, targetIssueNumber, ins
|
|
|
173
174
|
cost,
|
|
174
175
|
model,
|
|
175
176
|
details: `Issue #${targetIssueNumber} remains open: ${verdict.substring(0, 200)}`,
|
|
177
|
+
narrative: `Reviewed issue #${targetIssueNumber} — still open, not yet resolved.`,
|
|
176
178
|
};
|
|
177
179
|
}
|
|
178
180
|
|
|
@@ -271,5 +273,6 @@ export async function reviewIssue(context) {
|
|
|
271
273
|
.map((r) => r.details)
|
|
272
274
|
.join("; ")
|
|
273
275
|
.substring(0, 500)}`,
|
|
276
|
+
narrative: `Reviewed ${reviewed} issue(s), closed ${closed} as resolved.`,
|
|
274
277
|
};
|
|
275
278
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import * as core from "@actions/core";
|
|
9
9
|
import { writeFileSync, existsSync } from "fs";
|
|
10
|
-
import { runCopilotTask, readOptionalFile, scanDirectory, formatPathsSection, filterIssues, summariseIssue, extractFeatureSummary } from "../copilot.js";
|
|
10
|
+
import { runCopilotTask, readOptionalFile, scanDirectory, formatPathsSection, filterIssues, summariseIssue, extractFeatureSummary, extractNarrative, NARRATIVE_INSTRUCTION } from "../copilot.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Run the full transformation pipeline from mission to code.
|
|
@@ -162,7 +162,7 @@ export async function transform(context) {
|
|
|
162
162
|
} = await runCopilotTask({
|
|
163
163
|
model,
|
|
164
164
|
systemMessage:
|
|
165
|
-
"You are an autonomous code transformation agent. Your goal is to advance the repository toward its mission by making the most impactful change possible in a single step.",
|
|
165
|
+
"You are an autonomous code transformation agent. Your goal is to advance the repository toward its mission by making the most impactful change possible in a single step." + NARRATIVE_INSTRUCTION,
|
|
166
166
|
prompt,
|
|
167
167
|
writablePaths,
|
|
168
168
|
tuning: t,
|
|
@@ -201,7 +201,7 @@ export async function transform(context) {
|
|
|
201
201
|
cost,
|
|
202
202
|
model,
|
|
203
203
|
details: resultContent.substring(0, 500),
|
|
204
|
-
narrative: (resultContent
|
|
204
|
+
narrative: extractNarrative(resultContent, "Transformation step completed."),
|
|
205
205
|
promptBudget,
|
|
206
206
|
contextNotes: `Transformed with ${sourceFiles.length} source files (mtime-sorted, cleaned), ${features.length} features, ${openIssues.length} issues (${rawIssues.length - openIssues.length} stale filtered).`,
|
|
207
207
|
};
|
|
@@ -324,7 +324,7 @@ async function transformTdd({
|
|
|
324
324
|
const phase2 = await runCopilotTask({
|
|
325
325
|
model,
|
|
326
326
|
systemMessage:
|
|
327
|
-
"You are a TDD agent. A failing test was written in Phase 1. Write the minimum implementation to make it pass. Do not modify the test.",
|
|
327
|
+
"You are a TDD agent. A failing test was written in Phase 1. Write the minimum implementation to make it pass. Do not modify the test." + NARRATIVE_INSTRUCTION,
|
|
328
328
|
prompt: implPrompt,
|
|
329
329
|
writablePaths,
|
|
330
330
|
tuning: t,
|
|
@@ -341,5 +341,6 @@ async function transformTdd({
|
|
|
341
341
|
cost: (phase1.cost || 0) + (phase2.cost || 0),
|
|
342
342
|
model,
|
|
343
343
|
details: `TDD transformation: Phase 1 (failing test) + Phase 2 (implementation). ${testResult.substring(0, 200)}`,
|
|
344
|
+
narrative: extractNarrative(phase2.content, "TDD transformation: wrote failing test then implementation."),
|
|
344
345
|
};
|
|
345
346
|
}
|