@caupulican/pi-adaptative 0.80.76 → 0.80.78
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/CHANGELOG.md +20 -0
- package/dist/core/agent-session.d.ts +16 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +29 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/learning/skill-curator.d.ts +71 -0
- package/dist/core/learning/skill-curator.d.ts.map +1 -0
- package/dist/core/learning/skill-curator.js +179 -0
- package/dist/core/learning/skill-curator.js.map +1 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +10 -4
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +7 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +38 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -34,6 +34,7 @@ import { disposeExtensionEventSubscriptions } from "./extensions/loader.js";
|
|
|
34
34
|
import { emitSessionShutdownEvent } from "./extensions/runner.js";
|
|
35
35
|
import { GatewayRegistry } from "./gateways/channel-provider.js";
|
|
36
36
|
import { decideDemand, ReflectionEngine, } from "./learning/reflection-engine.js";
|
|
37
|
+
import { isPromotedFrontmatter, SkillCurator } from "./learning/skill-curator.js";
|
|
37
38
|
import { EffectivenessTracker } from "./memory/effectiveness-tracker.js";
|
|
38
39
|
import { MemoryManager } from "./memory/memory-manager.js";
|
|
39
40
|
import { FileStoreProvider } from "./memory/providers/file-store.js";
|
|
@@ -135,6 +136,8 @@ export class AgentSession {
|
|
|
135
136
|
_lastCostGuardDecision;
|
|
136
137
|
/** One-shot latch so the cost guard downgrades reasoning once per over-threshold episode, not every call. */
|
|
137
138
|
_costGuardDowngraded = false;
|
|
139
|
+
/** Lazily-built skill curator (#32) over `<agentDir>/skills`. */
|
|
140
|
+
_skillCuratorInstance;
|
|
138
141
|
/** Set on dispose so in-flight background reflection bails instead of writing to a dead session (Bug #21). */
|
|
139
142
|
_disposed = false;
|
|
140
143
|
/** Aborts in-flight background reflection completions on dispose (Bug #21). */
|
|
@@ -337,6 +340,27 @@ export class AgentSession {
|
|
|
337
340
|
getLastCostGuardDecision() {
|
|
338
341
|
return this._lastCostGuardDecision;
|
|
339
342
|
}
|
|
343
|
+
get _skillCurator() {
|
|
344
|
+
if (!this._skillCuratorInstance) {
|
|
345
|
+
this._skillCuratorInstance = new SkillCurator(join(this._agentDir, "skills"));
|
|
346
|
+
}
|
|
347
|
+
return this._skillCuratorInstance;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Skill curator (#32): PROPOSE (never auto-apply) archival of stale reflection-promoted skills and
|
|
351
|
+
* consolidation of overlapping ones. The host surfaces these (e.g. a `/curate` command) for approval.
|
|
352
|
+
*/
|
|
353
|
+
proposeSkillCuration(options) {
|
|
354
|
+
return this._skillCurator.proposeCuration(Date.now(), options);
|
|
355
|
+
}
|
|
356
|
+
/** Archive a promoted skill into `skills/.archive/` (restorable, non-destructive). Returns true if moved. */
|
|
357
|
+
archivePromotedSkill(name) {
|
|
358
|
+
return this._skillCurator.archiveSkill(name);
|
|
359
|
+
}
|
|
360
|
+
/** Restore a previously-archived promoted skill. Returns true if moved back. */
|
|
361
|
+
restorePromotedSkill(name) {
|
|
362
|
+
return this._skillCurator.restoreSkill(name);
|
|
363
|
+
}
|
|
340
364
|
_installAgentTurnRefresh() {
|
|
341
365
|
const previousPrepareNextTurn = this.agent.prepareNextTurn?.bind(this.agent);
|
|
342
366
|
this.agent.prepareNextTurn = async (signal) => {
|
|
@@ -1328,6 +1352,11 @@ export class AgentSession {
|
|
|
1328
1352
|
return text; // Unknown or profile-blocked skill, pass through unchanged
|
|
1329
1353
|
try {
|
|
1330
1354
|
const content = readFileSync(skill.filePath, "utf-8");
|
|
1355
|
+
// Curator (#32): record use of a reflection-PROMOTED skill so stale ones can later be proposed
|
|
1356
|
+
// for archival. Only promoted skills carry the marker, so hand-authored skills are untouched.
|
|
1357
|
+
if (isPromotedFrontmatter(content)) {
|
|
1358
|
+
this._skillCurator.recordUse(skill.name, Date.now());
|
|
1359
|
+
}
|
|
1331
1360
|
const body = stripResourceProfileBlocks(stripFrontmatter(content)).trim();
|
|
1332
1361
|
const skillBlock = `<skill name="${skill.name}" location="${skill.filePath}">\nReferences are relative to ${skill.baseDir}.\n\n${body}\n</skill>`;
|
|
1333
1362
|
return args ? `${skillBlock}\n\n${args}` : skillBlock;
|