@stravica-ai/digital-operator-pa 0.1.25 → 0.1.26
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.
|
@@ -36,11 +36,12 @@ import { getRepoRoot } from '../pa/repo-root.mjs';
|
|
|
36
36
|
|
|
37
37
|
// --- rule-variant text (spec §5.2 verbatim) ------------------------------
|
|
38
38
|
//
|
|
39
|
-
// Every entry mirrors an existing rule in
|
|
40
|
-
// Bucket 4 (Knowledge & memory).
|
|
41
|
-
// let the JSON envelope be indexed
|
|
42
|
-
// string-matching the file body.
|
|
43
|
-
// REMOTE deltas come from
|
|
39
|
+
// Every entry mirrors an existing rule in the operator's
|
|
40
|
+
// `agents/<paName>/CLAUDE.md` under Bucket 4 (Knowledge & memory).
|
|
41
|
+
// `bucket` + `ruleNumber` + `ruleTitle` let the JSON envelope be indexed
|
|
42
|
+
// against the CLAUDE.md file without string-matching the file body.
|
|
43
|
+
// `simple` is the historic wording; the REMOTE deltas come from
|
|
44
|
+
// remote-library spec §5.2.
|
|
44
45
|
export const RULE_VARIANTS = [
|
|
45
46
|
{
|
|
46
47
|
bucket: 4,
|
|
@@ -83,25 +84,41 @@ Exit codes (tooling standard §6):
|
|
|
83
84
|
|
|
84
85
|
/**
|
|
85
86
|
* Build the envelope for the resolved library variant. Pure: takes an
|
|
86
|
-
* already-resolved config
|
|
87
|
+
* already-resolved config plus the resolved paName, returns the
|
|
88
|
+
* printable / JSON-emittable shape.
|
|
89
|
+
*
|
|
90
|
+
* `paName` is the boot-resolved operator name (from merged preferences,
|
|
91
|
+
* same source `buildSessionPlan` uses). When null (diagnostic call with
|
|
92
|
+
* absent preferences), the rendered path degrades to the `<paName>`
|
|
93
|
+
* placeholder so the diagnostic still emits without lying about which
|
|
94
|
+
* operator's file the variants target.
|
|
87
95
|
*
|
|
88
96
|
* @param {{mode: 'simple'|'remote', remoteEndpoint?: string, remoteKey?: string}} config
|
|
97
|
+
* @param {{paName?: string|null}} [opts]
|
|
89
98
|
* @returns {{
|
|
90
99
|
* verb: 'context',
|
|
91
100
|
* libraryMode: 'simple'|'remote',
|
|
92
101
|
* libraryVariant: 'simple'|'remote',
|
|
93
102
|
* remoteEndpoint: string|null,
|
|
103
|
+
* paName: string|null,
|
|
104
|
+
* agentClaudePath: string,
|
|
94
105
|
* ruleVariants: Array<{bucket:number, ruleNumber:number, ruleTitle:string, effective:string, mode:'simple'|'remote'}>,
|
|
95
106
|
* specReference: string,
|
|
96
107
|
* }}
|
|
97
108
|
*/
|
|
98
|
-
export function buildContextEnvelope(config) {
|
|
109
|
+
export function buildContextEnvelope(config, opts = {}) {
|
|
99
110
|
const variant = getLibraryVariant(config);
|
|
111
|
+
const paName = typeof opts.paName === 'string' && opts.paName.length > 0
|
|
112
|
+
? opts.paName
|
|
113
|
+
: null;
|
|
114
|
+
const agentClaudePath = `agents/${paName ?? '<paName>'}/CLAUDE.md`;
|
|
100
115
|
return {
|
|
101
116
|
verb: 'context',
|
|
102
117
|
libraryMode: config.mode,
|
|
103
118
|
libraryVariant: variant,
|
|
104
119
|
remoteEndpoint: config.mode === 'remote' ? config.remoteEndpoint : null,
|
|
120
|
+
paName,
|
|
121
|
+
agentClaudePath,
|
|
105
122
|
ruleVariants: RULE_VARIANTS.map((r) => ({
|
|
106
123
|
bucket: r.bucket,
|
|
107
124
|
ruleNumber: r.ruleNumber,
|
|
@@ -126,7 +143,7 @@ export function formatContextTable(envelope) {
|
|
|
126
143
|
lines.push(`remoteEndpoint: ${envelope.remoteEndpoint}`);
|
|
127
144
|
}
|
|
128
145
|
lines.push('');
|
|
129
|
-
lines.push(
|
|
146
|
+
lines.push(`Effective CLAUDE.md rule variants (${envelope.agentClaudePath}, Bucket 4):`);
|
|
130
147
|
lines.push('');
|
|
131
148
|
for (const r of envelope.ruleVariants) {
|
|
132
149
|
lines.push(` Rule ${r.bucket}.${r.ruleNumber} — ${r.ruleTitle} [${r.mode}]`);
|
|
@@ -236,7 +253,16 @@ export async function runContext(argv, seam = {}) {
|
|
|
236
253
|
return 2;
|
|
237
254
|
}
|
|
238
255
|
|
|
239
|
-
|
|
256
|
+
// paName is the boot-resolved operator name. Sourced from the same
|
|
257
|
+
// merged preferences `buildSessionPlan` consumes — no new config, no
|
|
258
|
+
// second read. Absent prefs (readPreferences === null) keeps paName
|
|
259
|
+
// null and the envelope renders the `<paName>` placeholder so the
|
|
260
|
+
// diagnostic remains usable when the boot path itself is refusing.
|
|
261
|
+
const paName = (prefs && typeof prefs.paName === 'string' && prefs.paName.length > 0)
|
|
262
|
+
? prefs.paName
|
|
263
|
+
: null;
|
|
264
|
+
|
|
265
|
+
const envelope = buildContextEnvelope(config, { paName });
|
|
240
266
|
if (flags.format === 'json') {
|
|
241
267
|
stdout.write(JSON.stringify(envelope, null, 2) + '\n');
|
|
242
268
|
} else {
|
package/package.json
CHANGED