guardian-framework 0.1.118 → 0.1.120

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/cli.js CHANGED
@@ -3202,7 +3202,7 @@ __export(exports_package, {
3202
3202
  bin: () => bin,
3203
3203
  author: () => author
3204
3204
  });
3205
- var name = "guardian-framework", version = "0.1.118", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
3205
+ var name = "guardian-framework", version = "0.1.120", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
3206
3206
  var init_package = __esm(() => {
3207
3207
  exports = {
3208
3208
  ".": {
package/dist/exports.js CHANGED
@@ -1987,7 +1987,7 @@ __export(exports_package, {
1987
1987
  bin: () => bin,
1988
1988
  author: () => author
1989
1989
  });
1990
- var name = "guardian-framework", version = "0.1.118", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
1990
+ var name = "guardian-framework", version = "0.1.120", description = "Token-optimized agentic framework scaffolder with pi-first architecture", type = "module", main = "dist/exports.js", exports, types = "dist/exports.d.ts", bin, files, engines, scripts, publishConfig, pi, repository, homepage = "https://github.com/arman-jalili/guardian-framework#readme", bugs, dependencies, devDependencies, keywords, author = "Arman Wolkensteiner-Jalili", license = "MIT", package_default;
1991
1991
  var init_package = __esm(() => {
1992
1992
  exports = {
1993
1993
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "guardian-framework",
3
- "version": "0.1.118",
3
+ "version": "0.1.120",
4
4
  "description": "Token-optimized agentic framework scaffolder with pi-first architecture",
5
5
  "type": "module",
6
6
  "main": "dist/exports.js",
@@ -223,7 +223,15 @@ function mergeRawJson(existing: Record<string, unknown>, incoming: Record<string
223
223
  });
224
224
  }
225
225
  merged.boundedContexts = Array.from(bcMap.values());
226
- for (const key of ["businessContext", "openQuestions", "aggregateRoots", "status"]) {
226
+ // Original prompt/context is immutable once seeded — later saves (summaries,
227
+ // edits) must never erase it.
228
+ for (const key of ["businessContext", "originalPrompt"]) {
229
+ const cur = existing[key];
230
+ const v = incoming[key];
231
+ if (cur !== undefined && String(cur).trim() !== "") merged[key] = cur;
232
+ else if (v !== undefined && String(v).trim() !== "" && String(v).trim() !== "None") merged[key] = v;
233
+ }
234
+ for (const key of ["openQuestions", "aggregateRoots", "status"]) {
227
235
  const v = incoming[key];
228
236
  if (v !== undefined && String(v).trim() !== "" && String(v).trim() !== "None") merged[key] = v;
229
237
  }
@@ -422,6 +430,19 @@ export default function (pi: ExtensionAPI) {
422
430
  parsedJson = mergeRawJson(existing, parsedJson);
423
431
  } catch { /* ignore unreadable prior state */ }
424
432
  }
433
+ // Backfill business context from the explore stub if the agent never
434
+ // supplied it (front matter business_context survives across saves).
435
+ if (String(parsedJson.businessContext ?? "").trim() === "") {
436
+ const stubPath = path.join(ctx.cwd, ".pi", "domain", "exploration", sessionId + ".md");
437
+ if (fs.existsSync(stubPath)) {
438
+ try {
439
+ const stub = fs.readFileSync(stubPath, "utf-8");
440
+ const m = stub.match(/^business_context:\s*"((?:[^"\\]|\\.)*)"/m);
441
+ if (m) parsedJson.businessContext = m[1].replace(/\\"/g, '"');
442
+ } catch { /* ignore */ }
443
+ }
444
+ }
445
+
425
446
 
426
447
  const now = new Date().toISOString().split("T")[0];
427
448
  const explorationDir = path.join(ctx.cwd, ".pi", "domain", "exploration");
@@ -812,6 +833,21 @@ export default function (pi: ExtensionAPI) {
812
833
  fs.renameSync(glPath + ".tmp", glPath);
813
834
  }
814
835
 
836
+ // Seed the structured session with the ORIGINAL prompt so it is never
837
+ // lost: businessContext/originalPrompt carry the full business text and
838
+ // survive every domain_save_result merge (protected in mergeRawJson).
839
+ const seedRaw = {
840
+ sessionId,
841
+ businessContext: sanitized,
842
+ originalPrompt: sanitized,
843
+ status: "draft",
844
+ createdAt: new Date().toISOString(),
845
+ };
846
+ const seedPath = path.join(explorationDir, sessionId + ".raw.json");
847
+ const seedTmp = seedPath + ".tmp";
848
+ fs.writeFileSync(seedTmp, JSON.stringify(seedRaw, null, 2), "utf-8");
849
+ fs.renameSync(seedTmp, seedPath);
850
+
815
851
  ctx.ui.notify(
816
852
  "Domain analysis requested: " + sessionId,
817
853
  "success",
@@ -833,6 +869,7 @@ export default function (pi: ExtensionAPI) {
833
869
  "1. STRATEGIC PASS (this message): reply with ONLY this JSON, nothing else —",
834
870
  '```json',
835
871
  '{',
872
+ ' "businessContext": "one-line summary of the domain",',
836
873
  ' "actors": [{ "name": "...", "description": "...", "interactions": "..." }],',
837
874
  ' "assumptions": [{ "assumption": "...", "impactIfWrong": "...", "mitigation": "..." }],',
838
875
  ' "boundedContexts": [',
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2026-09-04T19:12:06Z",
2
+ "timestamp": "2026-09-04T19:53:19Z",
3
3
  "mode": "all",
4
4
  "stages_run": [],
5
5
  "summary": {