@xn-intenton-z2a/agentic-lib 7.4.25 → 7.4.27

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.
@@ -16,8 +16,8 @@ run-name: "agentic-lib-test [${{ github.ref_name }}]"
16
16
  #@dist cancel-in-progress: true
17
17
 
18
18
  on:
19
- schedule:
20
- - cron: "40 * * * *"
19
+ #@dist schedule:
20
+ #@dist - cron: "40 * * * *"
21
21
  #@dist push:
22
22
  #@dist branches: [main]
23
23
  #@dist paths:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xn-intenton-z2a/agentic-lib",
3
- "version": "7.4.25",
3
+ "version": "7.4.27",
4
4
  "description": "Agentic-lib Agentic Coding Systems SDK powering automated GitHub workflows.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -43,7 +43,7 @@ function buildFileListing(dirPath, extension, maxFiles = 30) {
43
43
  * @returns {Promise<Object>} Result with outcome, tokensUsed, model
44
44
  */
45
45
  export async function maintainLibrary(context) {
46
- const { config, instructions, writablePaths, model, logFilePath, screenshotFilePath } = context;
46
+ const { config, instructions, writablePaths, model, logFilePath, screenshotFilePath, octokit, repo } = context;
47
47
  const t = config.tuning || {};
48
48
 
49
49
  // Check mission-complete signal (skip in maintenance mode)
@@ -57,63 +57,76 @@ export async function maintainLibrary(context) {
57
57
  const sourcesPath = config.paths.librarySources.path;
58
58
  const sources = readOptionalFile(sourcesPath);
59
59
  const mission = readOptionalFile(config.paths.mission.path);
60
- const hasUrls = /https?:\/\//.test(sources);
60
+ const hasUrls = /https?:\/\//.test(sources); // used in prompt to guide Step 1 wording
61
61
 
62
62
  const libraryPath = config.paths.library.path;
63
63
  const libraryLimit = config.paths.library.limit;
64
64
  const libraryFiles = buildFileListing(libraryPath, ".md");
65
65
 
66
+ // Read feature specs and open issues so library sources reflect active work
67
+ const featureFiles = buildFileListing(config.paths.features?.path || "features/", ".md");
68
+ let openIssuesSummary = [];
69
+ try {
70
+ if (octokit && repo) {
71
+ const { data: issues } = await octokit.rest.issues.listForRepo({
72
+ ...repo, state: "open", labels: "automated", per_page: 10,
73
+ sort: "created", direction: "desc",
74
+ });
75
+ openIssuesSummary = issues
76
+ .filter((i) => !i.pull_request)
77
+ .map((i) => `#${i.number}: ${i.title}`);
78
+ }
79
+ } catch { /* no issues access */ }
80
+
66
81
  const agentInstructions = instructions || "Maintain the library by updating documents from sources.";
67
82
 
68
- let prompt;
69
- if (!hasUrls) {
70
- // SOURCES.md has no URLs — ask the LLM to find relevant sources based on the mission
71
- core.info("SOURCES.md has no URLs — asking LLM to discover relevant sources from the mission.");
72
- prompt = [
73
- "## Instructions",
74
- agentInstructions,
75
- "",
76
- "## Mission",
77
- mission || "(no mission file found)",
78
- "",
79
- "## Current SOURCES.md",
80
- sources || "(empty)",
81
- "",
82
- "## Your Task",
83
- `SOURCES.md has no URLs yet. Research the mission above and populate ${sourcesPath} with 3-8 relevant reference URLs.`,
84
- "Find documentation, tutorials, API references, Wikipedia articles, or npm packages related to the mission's core topic.",
85
- "Use web search to discover high-quality, stable URLs (prefer official docs, Wikipedia, MDN, npm).",
86
- `Write the URLs as a markdown list in ${sourcesPath}, keeping the existing header text.`,
83
+ const prompt = [
84
+ "## Instructions",
85
+ agentInstructions,
86
+ "",
87
+ "## Mission",
88
+ mission || "(no mission file found)",
89
+ "",
90
+ "## Current SOURCES.md",
91
+ sources || "(empty — no URLs yet)",
92
+ "",
93
+ `## Current Library Documents (${libraryFiles.length}/${libraryLimit} max)`,
94
+ libraryFiles.length > 0 ? libraryFiles.join(", ") : "(none — library is empty)",
95
+ "",
96
+ ...(featureFiles.length > 0 ? [
97
+ `## Active Features (${featureFiles.length})`,
98
+ featureFiles.join(", "),
87
99
  "",
88
- formatPathsSection(writablePaths, config.readOnlyPaths, config),
100
+ ] : []),
101
+ ...(openIssuesSummary.length > 0 ? [
102
+ `## Open Issues (${openIssuesSummary.length})`,
103
+ openIssuesSummary.join("\n"),
89
104
  "",
90
- "## Constraints",
91
- `- Token budget: ~${maxTokens} tokens. Be concise avoid verbose explanations or unnecessary tool calls.`,
92
- ].join("\n");
93
- } else {
94
- prompt = [
95
- "## Instructions",
96
- agentInstructions,
97
- "",
98
- "## Sources",
99
- sources,
100
- "",
101
- `## Current Library Documents (${libraryFiles.length}/${libraryLimit} max)`,
102
- libraryFiles.length > 0 ? libraryFiles.join(", ") : "none",
103
- "",
104
- "## Your Task",
105
- "Use read_file to read existing library documents.",
106
- "1. Read each URL in SOURCES.md and extract technical content.",
107
- "2. Create or update library documents based on the source content.",
108
- "3. Remove library documents that no longer have corresponding sources.",
109
- "",
110
- formatPathsSection(writablePaths, config.readOnlyPaths, config),
111
- "",
112
- "## Constraints",
113
- `- Maximum ${libraryLimit} library documents`,
114
- `- Token budget: ~${maxTokens} tokens. Be concise — avoid verbose explanations or unnecessary tool calls.`,
115
- ].join("\n");
116
- }
105
+ ] : []),
106
+ "## Your TaskTwo Steps (always do both)",
107
+ "",
108
+ `**Step 1: Update ${sourcesPath}**`,
109
+ "Review the current SOURCES.md against the mission, features, and open issues.",
110
+ hasUrls
111
+ ? "Add URLs for topics not yet covered. Remove URLs that are no longer relevant. Keep existing URLs that are still useful."
112
+ : "SOURCES.md has no URLs yet. Research the mission and add 3-8 relevant reference URLs.",
113
+ "Find documentation, tutorials, API references, Wikipedia articles, or npm packages.",
114
+ "Prioritise sources relevant to the active features and open issues listed above.",
115
+ "Use web search to discover high-quality, stable URLs (prefer official docs, Wikipedia, MDN, npm).",
116
+ `Write the URLs as a markdown list in ${sourcesPath}.`,
117
+ "",
118
+ `**Step 2: Update library documents in \`${libraryPath}\`**`,
119
+ "After updating SOURCES.md, read it back and maintain the library:",
120
+ "- Fetch each URL and create or update a library document with the key technical content.",
121
+ "- Remove library documents whose sources have been removed.",
122
+ "- Name documents descriptively (e.g. `MDN_ARRAY_METHODS.md`, `WIKIPEDIA_HAMMING_DISTANCE.md`).",
123
+ "",
124
+ formatPathsSection(writablePaths, config.readOnlyPaths, config),
125
+ "",
126
+ "## Constraints",
127
+ `- Maximum ${libraryLimit} library documents`,
128
+ `- Token budget: ~${maxTokens} tokens. Be concise — avoid verbose explanations or unnecessary tool calls.`,
129
+ ].join("\n");
117
130
 
118
131
  const systemPrompt =
119
132
  "You are a knowledge librarian. Maintain a library of technical documents extracted from web sources." +
@@ -139,13 +152,10 @@ export async function maintainLibrary(context) {
139
152
  logger: { info: core.info, warning: core.warning, error: core.error, debug: core.debug },
140
153
  });
141
154
 
142
- const outcomeLabel = hasUrls ? "library-maintained" : "sources-discovered";
143
- const detailsMsg = hasUrls
144
- ? `Maintained library (${libraryFiles.length} docs, limit ${libraryLimit})`
145
- : `Discovered sources for SOURCES.md from mission`;
155
+ const detailsMsg = `Maintained sources and library (${libraryFiles.length} existing docs, limit ${libraryLimit})`;
146
156
 
147
157
  return {
148
- outcome: outcomeLabel,
158
+ outcome: "library-maintained",
149
159
  tokensUsed: result.tokensIn + result.tokensOut,
150
160
  inputTokens: result.tokensIn,
151
161
  outputTokens: result.tokensOut,
@@ -17,7 +17,7 @@
17
17
  "author": "",
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "@xn-intenton-z2a/agentic-lib": "^7.4.25"
20
+ "@xn-intenton-z2a/agentic-lib": "^7.4.27"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@playwright/test": "^1.58.0",