archondev 2.19.39 → 2.19.40

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.
@@ -7,7 +7,7 @@ import {
7
7
  UsageRecorder,
8
8
  handleInsufficientCreditsRecovery,
9
9
  loadAtom
10
- } from "./chunk-LGWUWEEJ.js";
10
+ } from "./chunk-M63U52NF.js";
11
11
  import {
12
12
  transitionAtom
13
13
  } from "./chunk-WGLVDEZC.js";
@@ -4832,7 +4832,7 @@ async function attemptPathScopeAutoRecovery(atom, cwd, parseSchema, options) {
4832
4832
  if (allowedPaths.length === 0) {
4833
4833
  return false;
4834
4834
  }
4835
- const { listLocalAtoms, plan } = await import("./plan-S5EULQKJ.js");
4835
+ const { listLocalAtoms, plan } = await import("./plan-6FM5N36D.js");
4836
4836
  const before = await listLocalAtoms();
4837
4837
  const recoveryStartedAt = Date.now();
4838
4838
  const recoverySource = atom.description ?? atom.title;
@@ -4900,7 +4900,7 @@ async function execute(atomId, options) {
4900
4900
  process.exit(1);
4901
4901
  };
4902
4902
  if (options.parallel && options.parallel.length > 0) {
4903
- const { parallelExecute } = await import("./parallel-N74S3MFF.js");
4903
+ const { parallelExecute } = await import("./parallel-V2OGLOQH.js");
4904
4904
  const allAtomIds = [atomId, ...options.parallel];
4905
4905
  await parallelExecute(allAtomIds, { skipGates: options.skipGates === true });
4906
4906
  return;
@@ -35,7 +35,7 @@ import {
35
35
  import chalk2 from "chalk";
36
36
  import { existsSync } from "fs";
37
37
  import { readFile, writeFile, mkdir, stat } from "fs/promises";
38
- import { join } from "path";
38
+ import { join, dirname, basename, extname } from "path";
39
39
  import { createInterface } from "readline";
40
40
 
41
41
  // src/agents/sentinel.ts
@@ -1458,17 +1458,20 @@ function buildContentPlan(input) {
1458
1458
  const stepsFromNumbering = extractNumberedSteps(input.description);
1459
1459
  const stepsFromRequirements = input.requirements.map((req) => `Create: ${req}`);
1460
1460
  const steps = stepsFromNumbering.length > 0 ? stepsFromNumbering : stepsFromRequirements.length > 0 ? stepsFromRequirements : ["Draft a clear outline", "Write the content", "Review and refine", "Finalize deliverable"];
1461
- const files = /* @__PURE__ */ new Set();
1462
- input.referencedFiles.forEach((f) => files.add(f));
1463
- if (input.deliverableTarget) files.add(input.deliverableTarget);
1461
+ const files = resolveContentOutputTargets(
1462
+ input.description,
1463
+ input.referencedFiles,
1464
+ input.deliverableTarget
1465
+ );
1464
1466
  const risks = [];
1465
1467
  if (input.missingFiles.length > 0) {
1466
1468
  risks.push(`Missing inputs: ${input.missingFiles.join(", ")}`);
1467
1469
  }
1468
1470
  risks.push("Source material may be incomplete; validate against lesson content.");
1471
+ risks.push("Do not modify source lesson files; write deliverables to output capsule files only.");
1469
1472
  return {
1470
1473
  steps,
1471
- files_to_modify: Array.from(files),
1474
+ files_to_modify: files,
1472
1475
  dependencies: [],
1473
1476
  risks,
1474
1477
  estimated_complexity: steps.length > 6 ? "MEDIUM" : "LOW"
@@ -1491,17 +1494,41 @@ function buildConversationalFallbackPlan(input) {
1491
1494
  if (input.deliverableTarget) {
1492
1495
  steps.push(`Write output to ${input.deliverableTarget}`);
1493
1496
  }
1497
+ const filesToModify = resolveContentOutputTargets(
1498
+ input.description,
1499
+ input.references,
1500
+ input.deliverableTarget
1501
+ );
1494
1502
  return {
1495
1503
  steps,
1496
- files_to_modify: input.references,
1504
+ files_to_modify: filesToModify,
1497
1505
  dependencies: [],
1498
1506
  risks: [
1499
1507
  "Reference mismatch risk: confirm inferred requirements against provided source documents.",
1500
- "Scope drift risk: keep first increment focused on the requested sample deliverable."
1508
+ "Scope drift risk: keep first increment focused on the requested sample deliverable.",
1509
+ "Do not modify source inputs directly; write to a dedicated output file."
1501
1510
  ],
1502
1511
  estimated_complexity: "LOW"
1503
1512
  };
1504
1513
  }
1514
+ function resolveContentOutputTargets(description, referencedFiles, deliverableTarget) {
1515
+ if (deliverableTarget && deliverableTarget.trim().length > 0) {
1516
+ return [deliverableTarget.trim()];
1517
+ }
1518
+ return [deriveDefaultContentOutputPath(description, referencedFiles)];
1519
+ }
1520
+ function deriveDefaultContentOutputPath(description, referencedFiles) {
1521
+ const sampleSuffix = /\b(sample|first lesson)\b/i.test(description) ? ".sample-capsule" : ".capsule";
1522
+ const primaryRef = referencedFiles.find((ref) => /\.(md|txt|markdown)$/i.test(ref));
1523
+ if (!primaryRef) {
1524
+ return `capsule-output${sampleSuffix}.md`;
1525
+ }
1526
+ const baseDir = dirname(primaryRef);
1527
+ const fileBase = basename(primaryRef, extname(primaryRef));
1528
+ const outName = `${fileBase}${sampleSuffix}.md`;
1529
+ const output = baseDir === "." ? outName : join(baseDir, outName);
1530
+ return output.replace(/\\/g, "/");
1531
+ }
1505
1532
  function extractReferencedFiles(description) {
1506
1533
  const references = /* @__PURE__ */ new Set();
1507
1534
  const barePattern = /\b[\w./-]+\.(md|txt|json|yaml|yml|png|jpg|jpeg|gif|svg|pdf)\b/gi;
@@ -1641,9 +1668,9 @@ async function listLocalAtoms() {
1641
1668
  const files = await readdir(atomsDir);
1642
1669
  const atoms = [];
1643
1670
  for (const file of files) {
1644
- if (file.endsWith(".json")) {
1671
+ if (/^ATOM-\d+\.json$/i.test(file)) {
1645
1672
  const atom = await loadAtom(file.replace(".json", ""));
1646
- if (atom) {
1673
+ if (atom && typeof atom.externalId === "string" && atom.externalId.length > 0) {
1647
1674
  atoms.push(atom);
1648
1675
  }
1649
1676
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listLocalAtoms
3
- } from "./chunk-LGWUWEEJ.js";
3
+ } from "./chunk-M63U52NF.js";
4
4
 
5
5
  // src/cli/list.ts
6
6
  import chalk from "chalk";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadAtom
3
- } from "./chunk-LGWUWEEJ.js";
3
+ } from "./chunk-M63U52NF.js";
4
4
 
5
5
  // src/cli/show.ts
6
6
  import chalk from "chalk";
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  listLocalAtoms,
8
8
  loadAtom
9
- } from "./chunk-LGWUWEEJ.js";
9
+ } from "./chunk-M63U52NF.js";
10
10
  import {
11
11
  loadConfig
12
12
  } from "./chunk-SVU7MLG6.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  execute
3
- } from "./chunk-3E5QISRH.js";
3
+ } from "./chunk-LZPNQBZX.js";
4
4
  import "./chunk-EBHHIUCB.js";
5
- import "./chunk-LGWUWEEJ.js";
5
+ import "./chunk-M63U52NF.js";
6
6
  import "./chunk-WGLVDEZC.js";
7
7
  import "./chunk-3MZOEZUH.js";
8
8
  import "./chunk-F7R3QKHP.js";
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-6URKZ7NB.js";
14
14
  import {
15
15
  show
16
- } from "./chunk-4C6XR7WP.js";
16
+ } from "./chunk-VHKKRWDF.js";
17
17
  import {
18
18
  bugReport
19
19
  } from "./chunk-AHK2ITJX.js";
@@ -50,13 +50,13 @@ import {
50
50
  parallelRunWaves,
51
51
  parallelSchedule,
52
52
  parallelStatus
53
- } from "./chunk-CFEX6EWG.js";
53
+ } from "./chunk-ZA43HOLZ.js";
54
54
  import {
55
55
  DependencyParser,
56
56
  EnvironmentConfigLoader,
57
57
  EnvironmentValidator,
58
58
  execute
59
- } from "./chunk-3E5QISRH.js";
59
+ } from "./chunk-LZPNQBZX.js";
60
60
  import {
61
61
  cloudCancel,
62
62
  cloudLogs,
@@ -64,12 +64,12 @@ import {
64
64
  } from "./chunk-EBHHIUCB.js";
65
65
  import {
66
66
  list
67
- } from "./chunk-Y2QXZ2UR.js";
67
+ } from "./chunk-Q2PJ7JSI.js";
68
68
  import {
69
69
  listLocalAtoms,
70
70
  loadAtom,
71
71
  plan
72
- } from "./chunk-LGWUWEEJ.js";
72
+ } from "./chunk-M63U52NF.js";
73
73
  import "./chunk-WGLVDEZC.js";
74
74
  import "./chunk-3MZOEZUH.js";
75
75
  import {
@@ -3255,7 +3255,7 @@ async function runExploreFlow(cwd, followUpInput, options = {}) {
3255
3255
  case "1": {
3256
3256
  const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
3257
3257
  if (description.trim()) {
3258
- const { plan: plan2 } = await import("./plan-S5EULQKJ.js");
3258
+ const { plan: plan2 } = await import("./plan-6FM5N36D.js");
3259
3259
  await plan2(description, { conversational: true });
3260
3260
  }
3261
3261
  await showMainMenu();
@@ -3500,7 +3500,7 @@ ${state.forbiddenPatterns?.length ? `- **Forbidden patterns:** ${state.forbidden
3500
3500
  const hintedTask = initialTaskHint?.trim() ?? "";
3501
3501
  if (hintedTask) {
3502
3502
  console.log(chalk5.dim("Using your request above as the first task.\n"));
3503
- const { plan: plan2 } = await import("./plan-S5EULQKJ.js");
3503
+ const { plan: plan2 } = await import("./plan-6FM5N36D.js");
3504
3504
  await plan2(hintedTask, { conversational: true });
3505
3505
  return;
3506
3506
  }
@@ -3525,7 +3525,7 @@ ${state.forbiddenPatterns?.length ? `- **Forbidden patterns:** ${state.forbidden
3525
3525
  description = continueAnswer.trim();
3526
3526
  }
3527
3527
  if (description.trim()) {
3528
- const { plan: plan2 } = await import("./plan-S5EULQKJ.js");
3528
+ const { plan: plan2 } = await import("./plan-6FM5N36D.js");
3529
3529
  await plan2(description, { conversational: true });
3530
3530
  }
3531
3531
  }
@@ -3689,7 +3689,7 @@ async function handleAgentConversationInput(cwd, input) {
3689
3689
  pendingAnalysisCapsuleCount = null;
3690
3690
  const enrichedRequest = enrichApprovedAnalysisRequest(request, reviewedFiles, capsuleCount);
3691
3691
  console.log(chalk5.dim("\n> Great. Creating a governed task from the approved analysis plan.\n"));
3692
- const { plan: plan3 } = await import("./plan-S5EULQKJ.js");
3692
+ const { plan: plan3 } = await import("./plan-6FM5N36D.js");
3693
3693
  await plan3(await withAllowedPathScope(cwd, enrichedRequest), { conversational: true });
3694
3694
  console.log(chalk5.dim("\n> Starting implementation now...\n"));
3695
3695
  await continueWithCurrentTask(cwd);
@@ -3730,7 +3730,7 @@ async function handleAgentConversationInput(cwd, input) {
3730
3730
  return true;
3731
3731
  }
3732
3732
  console.log(chalk5.dim("\n> Got it! Creating a task for this...\n"));
3733
- const { plan: plan2 } = await import("./plan-S5EULQKJ.js");
3733
+ const { plan: plan2 } = await import("./plan-6FM5N36D.js");
3734
3734
  await plan2(await withAllowedPathScope(cwd, input), { conversational: true });
3735
3735
  if (shouldAutoExecuteAfterPlanning(input)) {
3736
3736
  await continueWithCurrentTask(cwd);
@@ -3777,7 +3777,7 @@ async function showProposalForApproval(input) {
3777
3777
  }
3778
3778
  }
3779
3779
  async function showLatestPlannedAtom(cwd) {
3780
- const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-S5EULQKJ.js");
3780
+ const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-6FM5N36D.js");
3781
3781
  const atoms = await listLocalAtoms2();
3782
3782
  if (atoms.length === 0) {
3783
3783
  console.log(chalk5.yellow("No atoms found yet. Tell me what to plan."));
@@ -3795,7 +3795,7 @@ async function showLatestPlannedAtom(cwd) {
3795
3795
  console.log(chalk5.dim(`
3796
3796
  Showing latest planned atom (${latest.externalId})...
3797
3797
  `));
3798
- const { show: show2 } = await import("./show-DYDXCREZ.js");
3798
+ const { show: show2 } = await import("./show-VCXYN4P6.js");
3799
3799
  await show2(latest.externalId);
3800
3800
  }
3801
3801
  function isContinuationDirective(input) {
@@ -3892,7 +3892,7 @@ async function applyApprovedProposal(cwd) {
3892
3892
  return;
3893
3893
  }
3894
3894
  console.log(chalk5.dim("\n> Great. I will create the task from your approved request.\n"));
3895
- const { plan: plan2 } = await import("./plan-S5EULQKJ.js");
3895
+ const { plan: plan2 } = await import("./plan-6FM5N36D.js");
3896
3896
  await plan2(await withAllowedPathScope(cwd, approvedRequest), { conversational: true });
3897
3897
  if (shouldAutoExecuteAfterPlanning(approvedRequest)) {
3898
3898
  await continueWithCurrentTask(cwd);
@@ -4049,7 +4049,7 @@ function buildSampleCapsuleDraft(cwd, files, capsuleCount) {
4049
4049
  ].join("\n");
4050
4050
  }
4051
4051
  async function continueWithCurrentTask(cwd) {
4052
- const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-S5EULQKJ.js");
4052
+ const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-6FM5N36D.js");
4053
4053
  const atoms = await listLocalAtoms2();
4054
4054
  const byMostRecent = (a, b) => {
4055
4055
  const aTime = new Date(String(a.updatedAt ?? a.createdAt ?? "")).getTime() || 0;
@@ -4082,11 +4082,11 @@ async function continueWithCurrentTask(cwd) {
4082
4082
  console.log(chalk5.dim(`
4083
4083
  Continuing with ${nextAtom.externalId}...
4084
4084
  `));
4085
- const { execute: execute2 } = await import("./execute-6YDCYC4Z.js");
4085
+ const { execute: execute2 } = await import("./execute-OB4P4UYU.js");
4086
4086
  await execute2(nextAtom.externalId, { nonTerminating: true });
4087
4087
  }
4088
4088
  async function replanLatestBlockedAtom(cwd) {
4089
- const { listLocalAtoms: listLocalAtoms2, plan: plan2 } = await import("./plan-S5EULQKJ.js");
4089
+ const { listLocalAtoms: listLocalAtoms2, plan: plan2 } = await import("./plan-6FM5N36D.js");
4090
4090
  const atoms = await listLocalAtoms2();
4091
4091
  const blocked = atoms.filter((a) => a.status === "BLOCKED" && (a.errorMessage ?? "").toLowerCase().includes("outside the allowed paths")).sort((a, b) => {
4092
4092
  const aTime = new Date(String(a.updatedAt ?? a.createdAt ?? "")).getTime() || 0;
@@ -4192,7 +4192,7 @@ async function handleFreeformJourneyInput(cwd, input) {
4192
4192
  const state = detectProjectState(cwd);
4193
4193
  if (state.hasArchitecture) {
4194
4194
  console.log(chalk5.dim("\n> Got it! Creating a task for this...\n"));
4195
- const { plan: plan3 } = await import("./plan-S5EULQKJ.js");
4195
+ const { plan: plan3 } = await import("./plan-6FM5N36D.js");
4196
4196
  await plan3(await withAllowedPathScope(cwd, freeform), { conversational: true });
4197
4197
  return true;
4198
4198
  }
@@ -4201,7 +4201,7 @@ async function handleFreeformJourneyInput(cwd, input) {
4201
4201
  return true;
4202
4202
  }
4203
4203
  console.log(chalk5.dim("\n> Got it! Creating a task for this...\n"));
4204
- const { plan: plan2 } = await import("./plan-S5EULQKJ.js");
4204
+ const { plan: plan2 } = await import("./plan-6FM5N36D.js");
4205
4205
  await plan2(await withAllowedPathScope(cwd, freeform), { conversational: true });
4206
4206
  return true;
4207
4207
  }
@@ -4260,7 +4260,7 @@ async function handlePostExploreAction(cwd, request, options = {}) {
4260
4260
  } else {
4261
4261
  console.log(chalk5.dim("> Got it! Creating a task for this...\n"));
4262
4262
  }
4263
- const { plan: plan2 } = await import("./plan-S5EULQKJ.js");
4263
+ const { plan: plan2 } = await import("./plan-6FM5N36D.js");
4264
4264
  await plan2(await withAllowedPathScope(cwd, request), { conversational: true });
4265
4265
  if (options.agentMode) {
4266
4266
  if (shouldAutoExecuteAfterPlanning(sourceInput)) {
@@ -4284,18 +4284,18 @@ Constraints:
4284
4284
  - If required files are outside this scope, propose the minimum architecture path update first.`;
4285
4285
  }
4286
4286
  async function planTask() {
4287
- const { plan: plan2 } = await import("./plan-S5EULQKJ.js");
4287
+ const { plan: plan2 } = await import("./plan-6FM5N36D.js");
4288
4288
  const description = await promptWithCommands("Describe what you want to build", { allowMultiline: true });
4289
4289
  if (description.trim()) {
4290
4290
  await plan2(description, { conversational: true });
4291
4291
  }
4292
4292
  }
4293
4293
  async function listAtoms() {
4294
- const { list: list2 } = await import("./list-WW6WUNBG.js");
4294
+ const { list: list2 } = await import("./list-D2TUCX2L.js");
4295
4295
  await list2({});
4296
4296
  }
4297
4297
  async function executeNext() {
4298
- const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-S5EULQKJ.js");
4298
+ const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-6FM5N36D.js");
4299
4299
  const { analyzeProject, getComplexityDescription, getModeDescription } = await import("./orchestration-HIF3KP25.js");
4300
4300
  const { loadExecutionPreferences } = await import("./preferences-AGIZD5E5.js");
4301
4301
  const cwd = process.cwd();
@@ -4366,11 +4366,11 @@ async function executeNext() {
4366
4366
  }
4367
4367
  }
4368
4368
  if (selectedMode === "parallel-cloud") {
4369
- const { parallelExecuteCloud: parallelExecuteCloud2 } = await import("./parallel-N74S3MFF.js");
4369
+ const { parallelExecuteCloud: parallelExecuteCloud2 } = await import("./parallel-V2OGLOQH.js");
4370
4370
  await parallelExecuteCloud2(runIds);
4371
4371
  return;
4372
4372
  }
4373
- const { parallelExecute } = await import("./parallel-N74S3MFF.js");
4373
+ const { parallelExecute } = await import("./parallel-V2OGLOQH.js");
4374
4374
  await parallelExecute(runIds);
4375
4375
  return;
4376
4376
  }
@@ -4378,7 +4378,7 @@ async function executeNext() {
4378
4378
  const atomId = await prompt("Enter atom ID to execute (or press Enter for first pending)");
4379
4379
  const targetId = atomId.trim() || pendingAtoms[0]?.id;
4380
4380
  if (targetId) {
4381
- const { execute: execute2 } = await import("./execute-6YDCYC4Z.js");
4381
+ const { execute: execute2 } = await import("./execute-OB4P4UYU.js");
4382
4382
  await execute2(targetId, {});
4383
4383
  } else {
4384
4384
  console.log(chalk5.yellow("No atom to execute."));
@@ -4527,7 +4527,7 @@ async function handleSlashCommand(input) {
4527
4527
  const arg = parts.slice(1).join(" ").trim();
4528
4528
  switch (command) {
4529
4529
  case "/plan": {
4530
- const { plan: plan2 } = await import("./plan-S5EULQKJ.js");
4530
+ const { plan: plan2 } = await import("./plan-6FM5N36D.js");
4531
4531
  if (arg) {
4532
4532
  await plan2(arg, { conversational: true });
4533
4533
  } else {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  list
3
- } from "./chunk-Y2QXZ2UR.js";
4
- import "./chunk-LGWUWEEJ.js";
3
+ } from "./chunk-Q2PJ7JSI.js";
4
+ import "./chunk-M63U52NF.js";
5
5
  import "./chunk-WGLVDEZC.js";
6
6
  import "./chunk-3MZOEZUH.js";
7
7
  import "./chunk-F7R3QKHP.js";
@@ -6,9 +6,9 @@ import {
6
6
  parallelRunWaves,
7
7
  parallelSchedule,
8
8
  parallelStatus
9
- } from "./chunk-CFEX6EWG.js";
9
+ } from "./chunk-ZA43HOLZ.js";
10
10
  import "./chunk-EBHHIUCB.js";
11
- import "./chunk-LGWUWEEJ.js";
11
+ import "./chunk-M63U52NF.js";
12
12
  import "./chunk-WGLVDEZC.js";
13
13
  import "./chunk-3MZOEZUH.js";
14
14
  import "./chunk-F7R3QKHP.js";
@@ -3,7 +3,7 @@ import {
3
3
  loadAtom,
4
4
  parseAtomDescription,
5
5
  plan
6
- } from "./chunk-LGWUWEEJ.js";
6
+ } from "./chunk-M63U52NF.js";
7
7
  import "./chunk-WGLVDEZC.js";
8
8
  import "./chunk-3MZOEZUH.js";
9
9
  import "./chunk-F7R3QKHP.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  show
3
- } from "./chunk-4C6XR7WP.js";
4
- import "./chunk-LGWUWEEJ.js";
3
+ } from "./chunk-VHKKRWDF.js";
4
+ import "./chunk-M63U52NF.js";
5
5
  import "./chunk-WGLVDEZC.js";
6
6
  import "./chunk-3MZOEZUH.js";
7
7
  import "./chunk-F7R3QKHP.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archondev",
3
- "version": "2.19.39",
3
+ "version": "2.19.40",
4
4
  "description": "Local-first AI-powered development governance system",
5
5
  "main": "dist/index.js",
6
6
  "bin": {