@agenr/skeln-plugin 3.3.0 → 2026.6.2
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/build-before-turn-artifact-NPUHVWFE.js +71 -0
- package/dist/build-recall-artifact-F3LS3PZX.js +62 -0
- package/dist/chunk-5AXMFBHR.js +14 -0
- package/dist/chunk-5AYIXQRF.js +4452 -0
- package/dist/{chunk-Z5X7T4QZ.js → chunk-5TIP2EPP.js} +1519 -2565
- package/dist/{chunk-5LADPJ4C.js → chunk-GAERET5Q.js} +138 -504
- package/dist/chunk-GF3PX3VM.js +41 -0
- package/dist/chunk-GKZQ5AG5.js +44 -0
- package/dist/chunk-LDJN7CVU.js +3231 -0
- package/dist/{chunk-ZYADFKX3.js → chunk-MC3C2XM5.js} +34 -1
- package/dist/chunk-NBS62ES5.js +3012 -0
- package/dist/chunk-NSLTJBUC.js +270 -0
- package/dist/chunk-OJSIZDZD.js +9 -0
- package/dist/chunk-OWGQWQUP.js +45 -0
- package/dist/chunk-Q5UTJXHZ.js +1069 -0
- package/dist/{chunk-M5M65AYP.js → chunk-SOQW7356.js} +271 -1934
- package/dist/chunk-VBPYU7GO.js +597 -0
- package/dist/chunk-VTHBPXDQ.js +1750 -0
- package/dist/{chunk-KH52KJSJ.js → chunk-XFJ4S4G2.js} +844 -39
- package/dist/chunk-Y5NB3FTH.js +106 -0
- package/dist/{chunk-RYMSM3OS.js → chunk-ZX55JBV2.js} +1710 -322
- package/dist/claim-slot-policy-CdrW_1l4.d.ts +13 -0
- package/dist/index.d.ts +630 -51
- package/dist/index.js +881 -4682
- package/dist/lifecycle-checkpoint-IAC5FCQU.js +154 -0
- package/dist/{claim-slot-policy-CQ-h0GaV.d.ts → ports-C4QkwDBS.d.ts} +168 -78
- package/dist/scan-6JKPOQHD.js +6 -0
- package/dist/service-EKFACEN6.js +15 -0
- package/dist/service-RHNB5AEQ.js +861 -0
- package/dist/sink-AUAAWC5O.js +8 -0
- package/package.json +1 -1
- package/dist/cli.d.ts +0 -1
- package/dist/internal-eval-server.d.ts +0 -1
- package/dist/internal-recall-eval-server.d.ts +0 -1
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// src/app/working-memory/projection-render.ts
|
|
2
|
+
var UTF8_BYTE_LENGTH = new TextEncoder();
|
|
3
|
+
function byteLength(content) {
|
|
4
|
+
return UTF8_BYTE_LENGTH.encode(content).length;
|
|
5
|
+
}
|
|
6
|
+
function createWorkingContextStubProjection(input) {
|
|
7
|
+
const content = [
|
|
8
|
+
"<agenr_work_context>",
|
|
9
|
+
"Working memory is unavailable for this turn.",
|
|
10
|
+
`Reason: ${input.reason}`,
|
|
11
|
+
"Treat this as transient task-state metadata, not durable truth.",
|
|
12
|
+
"</agenr_work_context>"
|
|
13
|
+
].join("\n");
|
|
14
|
+
return {
|
|
15
|
+
kind: "working_set",
|
|
16
|
+
renderMode: "stub",
|
|
17
|
+
content,
|
|
18
|
+
...input.workingSetId ? { workingSetId: input.workingSetId } : {},
|
|
19
|
+
...input.revision !== void 0 ? { revision: input.revision } : {},
|
|
20
|
+
sourceRef: input.sourceRef,
|
|
21
|
+
byteLength: byteLength(content)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function createWorkingContextFullProjection(workingSet, sourceRef) {
|
|
25
|
+
const snapshot = workingSet.snapshot;
|
|
26
|
+
const lines = [
|
|
27
|
+
"<agenr_work_context>",
|
|
28
|
+
"This is transient working memory for the current task, not durable truth.",
|
|
29
|
+
"It may be stale or hypothetical. Prefer current filesystem, git, tests, tool output, and the user's latest message for current-state claims.",
|
|
30
|
+
"",
|
|
31
|
+
`Scope: ${escapeText(workingSet.scopeKind)} ${escapeText(workingSet.scopeKey)}`,
|
|
32
|
+
`Working set: ${escapeText(workingSet.id)}`,
|
|
33
|
+
`Revision: ${workingSet.revision}`,
|
|
34
|
+
`Status: ${escapeText(workingSet.status)}`,
|
|
35
|
+
...optionalLine("Objective", snapshot.objective ?? workingSet.title),
|
|
36
|
+
...optionalLine("Summary", snapshot.summary),
|
|
37
|
+
...renderStringList("Current plan", snapshot.currentPlan),
|
|
38
|
+
...renderCheckpoint(snapshot.checkpoint?.summary),
|
|
39
|
+
...renderNextActions(snapshot.nextActions),
|
|
40
|
+
...renderLabeledNotes(
|
|
41
|
+
"Touched files",
|
|
42
|
+
snapshot.files,
|
|
43
|
+
(file) => file.path.trim().length > 0,
|
|
44
|
+
(file) => {
|
|
45
|
+
const note = file.note ? ` - ${escapeText(file.note)}` : "";
|
|
46
|
+
return `${escapeText(file.path)}${note}`;
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
...renderLabeledNotes(
|
|
50
|
+
"Recent commands",
|
|
51
|
+
snapshot.commands,
|
|
52
|
+
(command) => command.command.trim().length > 0,
|
|
53
|
+
(command) => {
|
|
54
|
+
const outcome = command.outcome ? ` - ${escapeText(command.outcome)}` : "";
|
|
55
|
+
return `${escapeText(command.command)}${outcome}`;
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
...renderLabeledNotes(
|
|
59
|
+
"Decisions",
|
|
60
|
+
snapshot.decisions,
|
|
61
|
+
(decision) => decision.decision.trim().length > 0,
|
|
62
|
+
(decision) => {
|
|
63
|
+
const rationale = decision.rationale ? ` - ${escapeText(decision.rationale)}` : "";
|
|
64
|
+
return `${escapeText(decision.decision)}${rationale}`;
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
...renderLabeledNotes(
|
|
68
|
+
"Assumptions",
|
|
69
|
+
snapshot.assumptions,
|
|
70
|
+
(assumption) => assumption.assumption.trim().length > 0,
|
|
71
|
+
(assumption) => {
|
|
72
|
+
const confidence = assumption.confidence ? ` [${assumption.confidence}]` : "";
|
|
73
|
+
const validated = assumption.validated === true ? " (validated)" : assumption.validated === false ? " (unvalidated)" : "";
|
|
74
|
+
return `${escapeText(assumption.assumption)}${confidence}${validated}`;
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
...renderStringList("Blockers", snapshot.blockers),
|
|
78
|
+
...renderStringList("Open questions", snapshot.openQuestions),
|
|
79
|
+
...renderCandidates(snapshot.candidates),
|
|
80
|
+
"",
|
|
81
|
+
"Rules:",
|
|
82
|
+
"- Update this working set when material task state changes.",
|
|
83
|
+
"- Leave a checkpoint before pausing, handing off, compacting, forking, or waiting.",
|
|
84
|
+
"- Do not close this working set; only the user clears goals with /goal clear.",
|
|
85
|
+
"- Do not store transient WIP with agenr_store.",
|
|
86
|
+
"- Promote only durable facts, decisions, preferences, or reusable procedures explicitly.",
|
|
87
|
+
"</agenr_work_context>"
|
|
88
|
+
];
|
|
89
|
+
const content = lines.join("\n");
|
|
90
|
+
return {
|
|
91
|
+
kind: "working_set",
|
|
92
|
+
renderMode: "full",
|
|
93
|
+
content,
|
|
94
|
+
workingSetId: workingSet.id,
|
|
95
|
+
revision: workingSet.revision,
|
|
96
|
+
sourceRef,
|
|
97
|
+
byteLength: byteLength(content)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function escapeText(value) {
|
|
101
|
+
return value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
102
|
+
}
|
|
103
|
+
function optionalLine(label, value) {
|
|
104
|
+
const normalized = value?.trim();
|
|
105
|
+
return normalized ? [`${label}: ${escapeText(normalized)}`] : [];
|
|
106
|
+
}
|
|
107
|
+
function renderStringList(title, values) {
|
|
108
|
+
const items = (values ?? []).map((value) => value.trim()).filter((value) => value.length > 0);
|
|
109
|
+
if (items.length === 0) {
|
|
110
|
+
return [];
|
|
111
|
+
}
|
|
112
|
+
return ["", `${title}:`, ...items.map((item) => `- ${escapeText(item)}`)];
|
|
113
|
+
}
|
|
114
|
+
function renderCheckpoint(summary) {
|
|
115
|
+
const normalized = summary?.trim();
|
|
116
|
+
return normalized ? ["", "Last checkpoint:", escapeText(normalized)] : [];
|
|
117
|
+
}
|
|
118
|
+
function renderLabeledNotes(title, items, isValid, formatLine) {
|
|
119
|
+
const filtered = (items ?? []).filter(isValid);
|
|
120
|
+
if (filtered.length === 0) {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
return ["", `${title}:`, ...filtered.map((item) => `- ${formatLine(item)}`)];
|
|
124
|
+
}
|
|
125
|
+
function renderNextActions(actions) {
|
|
126
|
+
const items = (actions ?? []).filter((action) => action.text.trim().length > 0);
|
|
127
|
+
if (items.length === 0) {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
return [
|
|
131
|
+
"",
|
|
132
|
+
"Next actions:",
|
|
133
|
+
...items.map((action) => {
|
|
134
|
+
const status = action.status ? ` [${action.status}]` : "";
|
|
135
|
+
const ref = action.ref ? ` (${escapeText(action.ref)})` : "";
|
|
136
|
+
return `- ${escapeText(action.text)}${status}${ref}`;
|
|
137
|
+
})
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
function renderCandidates(candidates) {
|
|
141
|
+
const pending = (candidates ?? []).filter((candidate) => candidate.promotionStatus === "pending");
|
|
142
|
+
if (pending.length === 0) {
|
|
143
|
+
return [];
|
|
144
|
+
}
|
|
145
|
+
return [
|
|
146
|
+
"",
|
|
147
|
+
"Pending memory candidates:",
|
|
148
|
+
...pending.map((candidate) => {
|
|
149
|
+
if (candidate.kind === "episodic") {
|
|
150
|
+
return `- episodic: ${escapeText(candidate.summary)}`;
|
|
151
|
+
}
|
|
152
|
+
return `- ${candidate.kind}: ${escapeText(candidate.subject)}`;
|
|
153
|
+
})
|
|
154
|
+
];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/app/working-memory/results.ts
|
|
158
|
+
function createFailure(code, message, details) {
|
|
159
|
+
return {
|
|
160
|
+
ok: false,
|
|
161
|
+
code,
|
|
162
|
+
message,
|
|
163
|
+
...details ? { details } : {}
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function writeFailureToResult(workingSetId, failure) {
|
|
167
|
+
switch (failure.kind) {
|
|
168
|
+
case "not_found":
|
|
169
|
+
return createFailure("not_found", "Working set was not found.", workingSetId ? { workingSetId } : void 0);
|
|
170
|
+
case "revision_conflict":
|
|
171
|
+
return createFailure("revision_conflict", "Working-set revision conflict.", {
|
|
172
|
+
actualRevision: failure.actualRevision,
|
|
173
|
+
...workingSetId ? { workingSetId } : {}
|
|
174
|
+
});
|
|
175
|
+
case "terminal_status":
|
|
176
|
+
return createFailure("terminal_status", `Working set is already ${failure.status}.`, {
|
|
177
|
+
status: failure.status,
|
|
178
|
+
...workingSetId ? { workingSetId } : {}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// src/app/working-memory/ready.ts
|
|
184
|
+
var WORKING_MEMORY_DISABLED_MESSAGE = "Working memory is disabled by the workingMemory feature flag.";
|
|
185
|
+
var WORKING_MEMORY_MISCONFIGURED_MESSAGE = "Working memory is enabled, but no working-memory repository was wired into the runtime.";
|
|
186
|
+
function workingMemoryNotReadyFailure(input) {
|
|
187
|
+
if (!input.featureEnabled) {
|
|
188
|
+
return createFailure("feature_disabled", WORKING_MEMORY_DISABLED_MESSAGE);
|
|
189
|
+
}
|
|
190
|
+
if (!input.repository) {
|
|
191
|
+
return createFailure("misconfigured", WORKING_MEMORY_MISCONFIGURED_MESSAGE);
|
|
192
|
+
}
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// src/app/working-memory/limits.ts
|
|
197
|
+
function normalizeBoundedLimit(value, fallback, max) {
|
|
198
|
+
if (value === void 0 || !Number.isInteger(value) || value <= 0) {
|
|
199
|
+
return fallback;
|
|
200
|
+
}
|
|
201
|
+
return Math.min(value, max);
|
|
202
|
+
}
|
|
203
|
+
function normalizeEventLimit(value) {
|
|
204
|
+
return normalizeBoundedLimit(value, 50, 200);
|
|
205
|
+
}
|
|
206
|
+
function normalizeListLimit(value) {
|
|
207
|
+
return normalizeBoundedLimit(value, 20, 100);
|
|
208
|
+
}
|
|
209
|
+
var CLOSE_EVENT_HISTORY_LIMIT = 1e3;
|
|
210
|
+
|
|
211
|
+
// src/app/working-memory/operations/manifest.ts
|
|
212
|
+
var MODEL_VISIBLE_OPERATION_TYPES = [
|
|
213
|
+
"set_objective",
|
|
214
|
+
"replace_plan",
|
|
215
|
+
"merge_checkpoint",
|
|
216
|
+
"add_file_note",
|
|
217
|
+
"add_command_note",
|
|
218
|
+
"record_decision",
|
|
219
|
+
"record_assumption",
|
|
220
|
+
"set_next_actions",
|
|
221
|
+
"add_candidate"
|
|
222
|
+
];
|
|
223
|
+
var TRUSTED_HOST_ONLY_OPERATION_TYPES = ["configure_budget", "account_usage", "set_continuation_policy"];
|
|
224
|
+
var HOST_ONLY_OPERATION_TYPES = ["set_status", ...TRUSTED_HOST_ONLY_OPERATION_TYPES];
|
|
225
|
+
var WORKING_UPDATE_OPERATION_TYPES = [...MODEL_VISIBLE_OPERATION_TYPES, ...HOST_ONLY_OPERATION_TYPES];
|
|
226
|
+
function isModelVisibleOperationType(type) {
|
|
227
|
+
return MODEL_VISIBLE_OPERATION_TYPES.includes(type);
|
|
228
|
+
}
|
|
229
|
+
function isTrustedHostOnlyWorkingOperation(type) {
|
|
230
|
+
return TRUSTED_HOST_ONLY_OPERATION_TYPES.includes(type);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// src/app/working-memory/constants.ts
|
|
234
|
+
var OPEN_WORKING_SET_STATUSES = ["active", "paused", "blocked", "waiting", "needs_review", "budget_limited"];
|
|
235
|
+
var CURRENT_WORKING_SET_STATUSES = [...OPEN_WORKING_SET_STATUSES, "complete"];
|
|
236
|
+
var CLOSE_MANAGED_WORKING_SET_STATUSES = ["closed", "abandoned"];
|
|
237
|
+
var TRUSTED_HOST_MUTATION_SOURCES = ["goal_command", "lifecycle_hook", "consolidation_job"];
|
|
238
|
+
var WORKING_CANDIDATE_PROMOTION_STATUSES = ["pending", "promoted", "dismissed"];
|
|
239
|
+
function isMutableWorkingSetStatus(status) {
|
|
240
|
+
return OPEN_WORKING_SET_STATUSES.includes(status);
|
|
241
|
+
}
|
|
242
|
+
function isCloseManagedStatus(status) {
|
|
243
|
+
return CLOSE_MANAGED_WORKING_SET_STATUSES.includes(status);
|
|
244
|
+
}
|
|
245
|
+
function isTrustedHostMutationSource(source) {
|
|
246
|
+
return source !== void 0 && TRUSTED_HOST_MUTATION_SOURCES.includes(source);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export {
|
|
250
|
+
createWorkingContextStubProjection,
|
|
251
|
+
createWorkingContextFullProjection,
|
|
252
|
+
normalizeBoundedLimit,
|
|
253
|
+
normalizeEventLimit,
|
|
254
|
+
normalizeListLimit,
|
|
255
|
+
CLOSE_EVENT_HISTORY_LIMIT,
|
|
256
|
+
isModelVisibleOperationType,
|
|
257
|
+
isTrustedHostOnlyWorkingOperation,
|
|
258
|
+
OPEN_WORKING_SET_STATUSES,
|
|
259
|
+
CURRENT_WORKING_SET_STATUSES,
|
|
260
|
+
CLOSE_MANAGED_WORKING_SET_STATUSES,
|
|
261
|
+
WORKING_CANDIDATE_PROMOTION_STATUSES,
|
|
262
|
+
isMutableWorkingSetStatus,
|
|
263
|
+
isCloseManagedStatus,
|
|
264
|
+
isTrustedHostMutationSource,
|
|
265
|
+
createFailure,
|
|
266
|
+
writeFailureToResult,
|
|
267
|
+
WORKING_MEMORY_DISABLED_MESSAGE,
|
|
268
|
+
WORKING_MEMORY_MISCONFIGURED_MESSAGE,
|
|
269
|
+
workingMemoryNotReadyFailure
|
|
270
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createWorkingContextFullProjection
|
|
3
|
+
} from "./chunk-NSLTJBUC.js";
|
|
4
|
+
|
|
5
|
+
// src/app/working-memory/projection.ts
|
|
6
|
+
function createToolSuccessProjection(workingSet, action, timestamp) {
|
|
7
|
+
return createWorkingContextFullProjection(workingSet, `agenr_work:${action}:${timestamp}`);
|
|
8
|
+
}
|
|
9
|
+
function shouldInjectWorkingContext(projection) {
|
|
10
|
+
return projection.renderMode === "full" && projection.content.trim().length > 0;
|
|
11
|
+
}
|
|
12
|
+
function toWorkingContextAuditPointer(projection) {
|
|
13
|
+
if (projection.workingSetId === void 0 || projection.revision === void 0) {
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
source: "agenr_work",
|
|
18
|
+
workingSetId: projection.workingSetId,
|
|
19
|
+
revision: projection.revision,
|
|
20
|
+
sourceRef: projection.sourceRef,
|
|
21
|
+
bytes: projection.byteLength,
|
|
22
|
+
summary: projection.renderMode === "full" ? `Working set ${projection.workingSetId} rev ${projection.revision}` : `Working memory stub (${projection.sourceRef})`
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/app/working-memory/goal-generation.ts
|
|
27
|
+
var INITIAL_GOAL_GENERATION = 1;
|
|
28
|
+
function readGoalGeneration(snapshot) {
|
|
29
|
+
return snapshot?.goalGeneration ?? INITIAL_GOAL_GENERATION;
|
|
30
|
+
}
|
|
31
|
+
function nextGoalGenerationAfterObjectiveChange(snapshot, nextObjective) {
|
|
32
|
+
if (snapshot.objective === nextObjective) {
|
|
33
|
+
return readGoalGeneration(snapshot);
|
|
34
|
+
}
|
|
35
|
+
return readGoalGeneration(snapshot) + 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
createToolSuccessProjection,
|
|
40
|
+
shouldInjectWorkingContext,
|
|
41
|
+
toWorkingContextAuditPointer,
|
|
42
|
+
INITIAL_GOAL_GENERATION,
|
|
43
|
+
readGoalGeneration,
|
|
44
|
+
nextGoalGenerationAfterObjectiveChange
|
|
45
|
+
};
|