archondev 2.19.8 → 2.19.10

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-OTODLPY4.js";
10
+ } from "./chunk-JFUG25H7.js";
11
11
  import {
12
12
  transitionAtom
13
13
  } from "./chunk-PCTP3LKJ.js";
@@ -4797,7 +4797,7 @@ function createPrompt() {
4797
4797
  }
4798
4798
  async function execute(atomId, options) {
4799
4799
  if (options.parallel && options.parallel.length > 0) {
4800
- const { parallelExecute } = await import("./parallel-KRBYFJ4O.js");
4800
+ const { parallelExecute } = await import("./parallel-ZBFFEUBW.js");
4801
4801
  const allAtomIds = [atomId, ...options.parallel];
4802
4802
  await parallelExecute(allAtomIds, { skipGates: options.skipGates === true });
4803
4803
  return;
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  listLocalAtoms,
8
8
  loadAtom
9
- } from "./chunk-OTODLPY4.js";
9
+ } from "./chunk-JFUG25H7.js";
10
10
  import {
11
11
  loadConfig
12
12
  } from "./chunk-SVU7MLG6.js";
@@ -899,12 +899,23 @@ async function plan(description, options) {
899
899
  requirements.length = 0;
900
900
  }
901
901
  }
902
- const classification = classifyTaskIntent({
902
+ let classification = classifyTaskIntent({
903
903
  description,
904
904
  requirements,
905
905
  references,
906
906
  deliverableTarget: deliverableTarget ?? void 0
907
907
  });
908
+ if (classification.kind === "mixed" && classification.confidence === "low") {
909
+ const clarifiedKind = await promptForTaskKindClarification(prompt2, description);
910
+ if (clarifiedKind) {
911
+ classification = {
912
+ ...classification,
913
+ kind: clarifiedKind,
914
+ confidence: "high",
915
+ signals: [...classification.signals, `user:${clarifiedKind}`]
916
+ };
917
+ }
918
+ }
908
919
  const isContentOnlyTask = classification.kind === "content";
909
920
  const designApproved = await promptForDesignApproval(prompt2, {
910
921
  description,
@@ -1275,7 +1286,8 @@ ${input.requirements.join("\n")}`.toLowerCase();
1275
1286
  /story|storytelling|storyboard|capsule|lesson|outline|narrative|plot|arc|character|conflict/,
1276
1287
  /illustration|visual|image|diagram|slides?|deck/,
1277
1288
  /write|draft|summarize|summarise|rewrite|edit|revise|polish/,
1278
- /teach|teaching|curriculum|learning objectives?|lesson plan/
1289
+ /teach|teaching|curriculum|learning objectives?|lesson plan/,
1290
+ /pdf|document|booklet|handout|report|formatted nicely|single file|compile .*lessons?|export/
1279
1291
  ];
1280
1292
  const codeCues = [
1281
1293
  /api|endpoint|server|backend|frontend|cli|database|schema|migration/,
@@ -1317,6 +1329,28 @@ ${input.requirements.join("\n")}`.toLowerCase();
1317
1329
  }
1318
1330
  return { kind, confidence, contentScore, codeScore, signals };
1319
1331
  }
1332
+ async function promptForTaskKindClarification(prompt2, description) {
1333
+ console.log(chalk2.yellow("\nThis request can be interpreted in multiple ways."));
1334
+ console.log(chalk2.dim("To keep planning on track, choose the primary outcome:"));
1335
+ console.log(chalk2.dim(" 1) Content deliverable (PDF/docs/slides/report)"));
1336
+ console.log(chalk2.dim(" 2) Code implementation (features/refactors/tests)"));
1337
+ console.log(chalk2.dim(" Enter to auto-pick based on your wording."));
1338
+ const answer = (await prompt2.ask("Primary outcome (1/2): ")).trim().toLowerCase();
1339
+ if (answer === "1" || answer.includes("content") || answer.includes("pdf") || answer.includes("doc")) {
1340
+ return "content";
1341
+ }
1342
+ if (answer === "2" || answer.includes("code") || answer.includes("implement") || answer.includes("feature")) {
1343
+ return "code";
1344
+ }
1345
+ const normalized = description.toLowerCase();
1346
+ if (/(pdf|document|report|slides?|lesson|curriculum|format)/.test(normalized)) {
1347
+ return "content";
1348
+ }
1349
+ if (/(api|endpoint|schema|migration|typescript|javascript|python|refactor|test|lint|build)/.test(normalized)) {
1350
+ return "code";
1351
+ }
1352
+ return null;
1353
+ }
1320
1354
  function shouldFallbackToContentPlan(input) {
1321
1355
  if (input.classification.kind === "content") return true;
1322
1356
  const text = input.description.toLowerCase();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listLocalAtoms
3
- } from "./chunk-OTODLPY4.js";
3
+ } from "./chunk-JFUG25H7.js";
4
4
 
5
5
  // src/cli/list.ts
6
6
  import chalk from "chalk";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  execute
3
- } from "./chunk-X5ZZCJBQ.js";
3
+ } from "./chunk-4E3LJAXF.js";
4
4
  import "./chunk-EBHHIUCB.js";
5
- import "./chunk-OTODLPY4.js";
5
+ import "./chunk-JFUG25H7.js";
6
6
  import "./chunk-PCTP3LKJ.js";
7
7
  import "./chunk-PJRQI5UN.js";
8
8
  import "./chunk-EIEU3IIY.js";
package/dist/index.js CHANGED
@@ -47,13 +47,13 @@ import {
47
47
  parallelRunWaves,
48
48
  parallelSchedule,
49
49
  parallelStatus
50
- } from "./chunk-KDWIKBM2.js";
50
+ } from "./chunk-FP4B73CC.js";
51
51
  import {
52
52
  DependencyParser,
53
53
  EnvironmentConfigLoader,
54
54
  EnvironmentValidator,
55
55
  execute
56
- } from "./chunk-X5ZZCJBQ.js";
56
+ } from "./chunk-4E3LJAXF.js";
57
57
  import {
58
58
  cloudCancel,
59
59
  cloudLogs,
@@ -61,12 +61,12 @@ import {
61
61
  } from "./chunk-EBHHIUCB.js";
62
62
  import {
63
63
  list
64
- } from "./chunk-W6TYXCZA.js";
64
+ } from "./chunk-MBRWJ3SX.js";
65
65
  import {
66
66
  listLocalAtoms,
67
67
  loadAtom,
68
68
  plan
69
- } from "./chunk-OTODLPY4.js";
69
+ } from "./chunk-JFUG25H7.js";
70
70
  import "./chunk-PCTP3LKJ.js";
71
71
  import "./chunk-PJRQI5UN.js";
72
72
  import {
@@ -2844,6 +2844,55 @@ async function start(options = {}) {
2844
2844
  } catch {
2845
2845
  }
2846
2846
  }
2847
+ if (currentTier === "BYOK" && config.accessToken) {
2848
+ try {
2849
+ let usageStats = await fetchByokUsageStats(config.accessToken);
2850
+ const usageStatsUnavailable = !usageStats;
2851
+ if (!usageStats) {
2852
+ usageStats = {
2853
+ totalInputTokens: 0,
2854
+ totalOutputTokens: 0,
2855
+ totalBaseCost: 0,
2856
+ byModel: []
2857
+ };
2858
+ }
2859
+ console.log();
2860
+ console.log(chalk6.bold("\u{1F4CA} BYOK Usage"));
2861
+ console.log(chalk6.dim("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"));
2862
+ if (usageStats.periodStart) {
2863
+ const periodStart = new Date(usageStats.periodStart);
2864
+ const periodEnd = usageStats.periodEnd ? new Date(usageStats.periodEnd) : null;
2865
+ const formattedStart = isNaN(periodStart.getTime()) ? usageStats.periodStart : periodStart.toLocaleDateString();
2866
+ const formattedEnd = periodEnd && !isNaN(periodEnd.getTime()) ? periodEnd.toLocaleDateString() : void 0;
2867
+ if (formattedEnd) {
2868
+ console.log(chalk6.dim(` Period: ${formattedStart} \u2192 ${formattedEnd}`));
2869
+ } else {
2870
+ console.log(chalk6.dim(` Period start: ${formattedStart}`));
2871
+ }
2872
+ } else {
2873
+ console.log(chalk6.dim(" Period: Current month to date"));
2874
+ }
2875
+ const totalTokens = usageStats.totalInputTokens + usageStats.totalOutputTokens;
2876
+ console.log(` Tokens: ${chalk6.dim(totalTokens.toLocaleString())}`);
2877
+ console.log(` Estimated provider spend: ${chalk6.dim(`$${usageStats.totalBaseCost.toFixed(4)}`)}`);
2878
+ console.log();
2879
+ console.log(chalk6.dim(" Model Usage:"));
2880
+ if (usageStats.byModel.length > 0) {
2881
+ for (const model of usageStats.byModel) {
2882
+ const modelName = model.model.length > 32 ? model.model.slice(0, 29) + "..." : model.model;
2883
+ console.log(chalk6.dim(` ${modelName.padEnd(34)} $${model.cost.toFixed(4)}`));
2884
+ }
2885
+ } else {
2886
+ console.log(chalk6.dim(` ${"No usage yet".padEnd(34)} $0.0000`));
2887
+ }
2888
+ console.log(chalk6.dim("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501"));
2889
+ if (usageStatsUnavailable) {
2890
+ console.log(chalk6.dim("Usage details may be delayed. Run `archon usage` to refresh."));
2891
+ }
2892
+ console.log(chalk6.dim("View details: archon usage | Models: archon preferences | Switch tier: archon upgrade"));
2893
+ } catch {
2894
+ }
2895
+ }
2847
2896
  if (currentTier === "BYOK") {
2848
2897
  const { keyManager } = await import("./keys-THCHXIFD.js");
2849
2898
  const hasKeys = await keyManager.hasAnyKey();
@@ -2988,6 +3037,38 @@ async function fetchCreditsUsageStats(accessToken, authId) {
2988
3037
  }
2989
3038
  return fetchCreditsUsageStatsFromSupabase(accessToken, authId);
2990
3039
  }
3040
+ async function fetchByokUsageStats(accessToken) {
3041
+ try {
3042
+ const { API_URL: API_URL3 } = await import("./constants-XDIWFFPN.js");
3043
+ const response = await fetch(`${API_URL3}/api/usage`, {
3044
+ headers: {
3045
+ "Authorization": `Bearer ${accessToken}`
3046
+ }
3047
+ });
3048
+ if (!response.ok) {
3049
+ return null;
3050
+ }
3051
+ const data = await response.json();
3052
+ if (data.tier && data.tier !== "BYOK") {
3053
+ return null;
3054
+ }
3055
+ const byModel = [...data.byModel ?? []].map((row) => ({
3056
+ model: row.model,
3057
+ cost: typeof row.cost === "number" ? row.cost : 0
3058
+ })).sort((a, b) => b.cost - a.cost);
3059
+ return {
3060
+ totalInputTokens: data.totalInputTokens ?? 0,
3061
+ totalOutputTokens: data.totalOutputTokens ?? 0,
3062
+ totalBaseCost: data.totalBaseCost ?? 0,
3063
+ byModel,
3064
+ periodStart: data.periodStart,
3065
+ periodEnd: data.periodEnd,
3066
+ periodSource: data.periodSource
3067
+ };
3068
+ } catch {
3069
+ return null;
3070
+ }
3071
+ }
2991
3072
  async function fetchCreditsUsageStatsFromSupabase(accessToken, authId) {
2992
3073
  try {
2993
3074
  const { SUPABASE_URL: SUPABASE_URL2, SUPABASE_ANON_KEY: SUPABASE_ANON_KEY2 } = await import("./constants-XDIWFFPN.js");
@@ -3192,7 +3273,7 @@ async function handleNewProject(cwd, _state) {
3192
3273
  }
3193
3274
  if (intent.mode === "ad_hoc" && intent.confidence >= 0.7) {
3194
3275
  console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
3195
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3276
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3196
3277
  await plan2(initialResponse, {});
3197
3278
  return;
3198
3279
  }
@@ -3217,7 +3298,7 @@ async function handleNewProject(cwd, _state) {
3217
3298
  }
3218
3299
  if (trimmed === "2") {
3219
3300
  console.log(chalk6.dim("\n> Creating a task for this...\n"));
3220
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3301
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3221
3302
  await plan2(initialResponse, {});
3222
3303
  return;
3223
3304
  }
@@ -3256,7 +3337,7 @@ async function showNewProjectMenu(cwd) {
3256
3337
  case "3": {
3257
3338
  const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
3258
3339
  if (description.trim()) {
3259
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3340
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3260
3341
  await plan2(description, {});
3261
3342
  }
3262
3343
  break;
@@ -3338,7 +3419,7 @@ async function runExploreFlow(cwd, followUpInput) {
3338
3419
  case "1": {
3339
3420
  const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
3340
3421
  if (description.trim()) {
3341
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3422
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3342
3423
  await plan2(description, {});
3343
3424
  }
3344
3425
  await showMainMenu();
@@ -3613,7 +3694,7 @@ ${state.forbiddenPatterns?.length ? `- **Forbidden patterns:** ${state.forbidden
3613
3694
  if (continueChoice) {
3614
3695
  const description = await promptWithCommands("Describe what you want to build first", { allowMultiline: true });
3615
3696
  if (description.trim()) {
3616
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3697
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3617
3698
  await plan2(description, {});
3618
3699
  }
3619
3700
  }
@@ -3667,7 +3748,7 @@ async function handleAdaptExisting(cwd, state) {
3667
3748
  }
3668
3749
  if (intent.mode === "ad_hoc" && intent.confidence >= 0.7) {
3669
3750
  console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
3670
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3751
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3671
3752
  await plan2(response, {});
3672
3753
  return;
3673
3754
  }
@@ -3705,7 +3786,7 @@ async function showAdaptExistingMenu(cwd, state) {
3705
3786
  case "2": {
3706
3787
  const description = await promptWithCommands("Describe what you want to do", { allowMultiline: true });
3707
3788
  if (description.trim()) {
3708
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3789
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3709
3790
  await plan2(description, {});
3710
3791
  }
3711
3792
  break;
@@ -3896,7 +3977,7 @@ async function handleFreeformJourneyInput(cwd, input) {
3896
3977
  return true;
3897
3978
  }
3898
3979
  console.log(chalk6.dim("\n> Got it! Creating a task for this...\n"));
3899
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
3980
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3900
3981
  await plan2(freeform, {});
3901
3982
  return true;
3902
3983
  }
@@ -3946,7 +4027,7 @@ async function handlePostExploreAction(cwd, request) {
3946
4027
  } else {
3947
4028
  console.log(chalk6.dim("> Got it! Creating a task for this...\n"));
3948
4029
  }
3949
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
4030
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3950
4031
  await plan2(request, {});
3951
4032
  }
3952
4033
  async function showReviewProgress(cwd) {
@@ -3968,18 +4049,18 @@ async function showReviewProgress(cwd) {
3968
4049
  }
3969
4050
  }
3970
4051
  async function planTask() {
3971
- const { plan: plan2 } = await import("./plan-7SCZH7EA.js");
4052
+ const { plan: plan2 } = await import("./plan-AR6Y4QUD.js");
3972
4053
  const description = await promptWithCommands("Describe what you want to build", { allowMultiline: true });
3973
4054
  if (description.trim()) {
3974
4055
  await plan2(description, {});
3975
4056
  }
3976
4057
  }
3977
4058
  async function listAtoms() {
3978
- const { list: list2 } = await import("./list-SKRHIZ5T.js");
4059
+ const { list: list2 } = await import("./list-3IMEKFQZ.js");
3979
4060
  await list2({});
3980
4061
  }
3981
4062
  async function executeNext() {
3982
- const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-7SCZH7EA.js");
4063
+ const { listLocalAtoms: listLocalAtoms2 } = await import("./plan-AR6Y4QUD.js");
3983
4064
  const { analyzeProject, getComplexityDescription, getModeDescription } = await import("./orchestration-HIF3KP25.js");
3984
4065
  const { loadExecutionPreferences } = await import("./preferences-4V4C7MVD.js");
3985
4066
  const cwd = process.cwd();
@@ -4050,11 +4131,11 @@ async function executeNext() {
4050
4131
  }
4051
4132
  }
4052
4133
  if (selectedMode === "parallel-cloud") {
4053
- const { parallelExecuteCloud: parallelExecuteCloud2 } = await import("./parallel-KRBYFJ4O.js");
4134
+ const { parallelExecuteCloud: parallelExecuteCloud2 } = await import("./parallel-ZBFFEUBW.js");
4054
4135
  await parallelExecuteCloud2(runIds);
4055
4136
  return;
4056
4137
  }
4057
- const { parallelExecute } = await import("./parallel-KRBYFJ4O.js");
4138
+ const { parallelExecute } = await import("./parallel-ZBFFEUBW.js");
4058
4139
  await parallelExecute(runIds);
4059
4140
  return;
4060
4141
  }
@@ -4062,7 +4143,7 @@ async function executeNext() {
4062
4143
  const atomId = await prompt("Enter atom ID to execute (or press Enter for first pending)");
4063
4144
  const targetId = atomId.trim() || pendingAtoms[0]?.id;
4064
4145
  if (targetId) {
4065
- const { execute: execute2 } = await import("./execute-DBNVIJ3P.js");
4146
+ const { execute: execute2 } = await import("./execute-UWJPIG6C.js");
4066
4147
  await execute2(targetId, {});
4067
4148
  } else {
4068
4149
  console.log(chalk6.yellow("No atom to execute."));
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  list
3
- } from "./chunk-W6TYXCZA.js";
4
- import "./chunk-OTODLPY4.js";
3
+ } from "./chunk-MBRWJ3SX.js";
4
+ import "./chunk-JFUG25H7.js";
5
5
  import "./chunk-PCTP3LKJ.js";
6
6
  import "./chunk-PJRQI5UN.js";
7
7
  import "./chunk-EIEU3IIY.js";
@@ -6,9 +6,9 @@ import {
6
6
  parallelRunWaves,
7
7
  parallelSchedule,
8
8
  parallelStatus
9
- } from "./chunk-KDWIKBM2.js";
9
+ } from "./chunk-FP4B73CC.js";
10
10
  import "./chunk-EBHHIUCB.js";
11
- import "./chunk-OTODLPY4.js";
11
+ import "./chunk-JFUG25H7.js";
12
12
  import "./chunk-PCTP3LKJ.js";
13
13
  import "./chunk-PJRQI5UN.js";
14
14
  import "./chunk-EIEU3IIY.js";
@@ -3,7 +3,7 @@ import {
3
3
  loadAtom,
4
4
  parseAtomDescription,
5
5
  plan
6
- } from "./chunk-OTODLPY4.js";
6
+ } from "./chunk-JFUG25H7.js";
7
7
  import "./chunk-PCTP3LKJ.js";
8
8
  import "./chunk-PJRQI5UN.js";
9
9
  import "./chunk-EIEU3IIY.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "archondev",
3
- "version": "2.19.8",
3
+ "version": "2.19.10",
4
4
  "description": "Local-first AI-powered development governance system",
5
5
  "main": "dist/index.js",
6
6
  "bin": {