@xn-intenton-z2a/agentic-lib 7.1.63 → 7.1.64
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/package.json
CHANGED
|
@@ -25,11 +25,10 @@ export async function maintainLibrary(context) {
|
|
|
25
25
|
return { outcome: "nop", details: "Mission already complete (MISSION_COMPLETE.md signal)" };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
28
|
+
const sourcesPath = config.paths.librarySources.path;
|
|
29
|
+
const sources = readOptionalFile(sourcesPath);
|
|
30
|
+
const mission = readOptionalFile(config.paths.mission.path);
|
|
31
|
+
const hasUrls = /https?:\/\//.test(sources);
|
|
33
32
|
|
|
34
33
|
const libraryPath = config.paths.library.path;
|
|
35
34
|
const libraryLimit = config.paths.library.limit;
|
|
@@ -37,26 +36,50 @@ export async function maintainLibrary(context) {
|
|
|
37
36
|
|
|
38
37
|
const agentInstructions = instructions || "Maintain the library by updating documents from sources.";
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
""
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
let prompt;
|
|
40
|
+
if (!hasUrls) {
|
|
41
|
+
// SOURCES.md has no URLs — ask the LLM to find relevant sources based on the mission
|
|
42
|
+
core.info("SOURCES.md has no URLs — asking LLM to discover relevant sources from the mission.");
|
|
43
|
+
prompt = [
|
|
44
|
+
"## Instructions",
|
|
45
|
+
agentInstructions,
|
|
46
|
+
"",
|
|
47
|
+
"## Mission",
|
|
48
|
+
mission || "(no mission file found)",
|
|
49
|
+
"",
|
|
50
|
+
"## Current SOURCES.md",
|
|
51
|
+
sources || "(empty)",
|
|
52
|
+
"",
|
|
53
|
+
"## Your Task",
|
|
54
|
+
`SOURCES.md has no URLs yet. Research the mission above and populate ${sourcesPath} with 3-8 relevant reference URLs.`,
|
|
55
|
+
"Find documentation, tutorials, API references, Wikipedia articles, or npm packages related to the mission's core topic.",
|
|
56
|
+
"Use web search to discover high-quality, stable URLs (prefer official docs, Wikipedia, MDN, npm).",
|
|
57
|
+
`Write the URLs as a markdown list in ${sourcesPath}, keeping the existing header text.`,
|
|
58
|
+
"",
|
|
59
|
+
formatPathsSection(writablePaths, config.readOnlyPaths, config),
|
|
60
|
+
].join("\n");
|
|
61
|
+
} else {
|
|
62
|
+
prompt = [
|
|
63
|
+
"## Instructions",
|
|
64
|
+
agentInstructions,
|
|
65
|
+
"",
|
|
66
|
+
"## Sources",
|
|
67
|
+
sources,
|
|
68
|
+
"",
|
|
69
|
+
`## Current Library Documents (${libraryDocs.length}/${libraryLimit} max)`,
|
|
70
|
+
...libraryDocs.map((d) => `### ${d.name}\n${d.content}`),
|
|
71
|
+
"",
|
|
72
|
+
"## Your Task",
|
|
73
|
+
"1. Read each URL in SOURCES.md and extract technical content.",
|
|
74
|
+
"2. Create or update library documents based on the source content.",
|
|
75
|
+
"3. Remove library documents that no longer have corresponding sources.",
|
|
76
|
+
"",
|
|
77
|
+
formatPathsSection(writablePaths, config.readOnlyPaths, config),
|
|
78
|
+
"",
|
|
79
|
+
"## Constraints",
|
|
80
|
+
`- Maximum ${libraryLimit} library documents`,
|
|
81
|
+
].join("\n");
|
|
82
|
+
}
|
|
60
83
|
|
|
61
84
|
const { tokensUsed, inputTokens, outputTokens, cost } = await runCopilotTask({
|
|
62
85
|
model,
|
|
@@ -67,13 +90,18 @@ export async function maintainLibrary(context) {
|
|
|
67
90
|
tuning: t,
|
|
68
91
|
});
|
|
69
92
|
|
|
93
|
+
const outcomeLabel = hasUrls ? "library-maintained" : "sources-discovered";
|
|
94
|
+
const detailsMsg = hasUrls
|
|
95
|
+
? `Maintained library (${libraryDocs.length} docs, limit ${libraryLimit})`
|
|
96
|
+
: `Discovered sources for SOURCES.md from mission`;
|
|
97
|
+
|
|
70
98
|
return {
|
|
71
|
-
outcome:
|
|
99
|
+
outcome: outcomeLabel,
|
|
72
100
|
tokensUsed,
|
|
73
101
|
inputTokens,
|
|
74
102
|
outputTokens,
|
|
75
103
|
cost,
|
|
76
104
|
model,
|
|
77
|
-
details:
|
|
105
|
+
details: detailsMsg,
|
|
78
106
|
};
|
|
79
107
|
}
|