intentional-cognition-os 1.2.2 → 1.2.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.2.3] - 2026-05-22
4
+
5
+ - fix(cli,plugin): ask --json + run.sh orchestrator + first real dog-food run (P1 bug filed) (#80) (0fb8b00)
6
+
7
+
3
8
  ## [v1.2.2] - 2026-05-21
4
9
 
5
10
  - docs(dogfood): author intent-eval-core-v1 question bank + session-1 journal (#79) (1a0cb0d)
package/README.md CHANGED
@@ -152,7 +152,7 @@ Global flags on every command: `--workspace <path>`, `--json`, `--verbose`, `--q
152
152
 
153
153
  ## Status
154
154
 
155
- **v1.0.5 — stable.** 1.2.2 tests passing across 5 packages. Used daily by the author. Public release on npm.
155
+ **v1.0.5 — stable.** 1.2.3 tests passing across 5 packages. Used daily by the author. Public release on npm.
156
156
 
157
157
  - **Stable**: all 14 commands, the compilation passes, ask + research + recall + render + promote, the audit chain.
158
158
  - **In progress**: post-v1 coverage uplift on compiler + cli packages; mutation-testing baseline.
package/dist/index.js CHANGED
@@ -10088,7 +10088,32 @@ function resolveWorkspace(options) {
10088
10088
  }
10089
10089
 
10090
10090
  // src/commands/ask.ts
10091
- function printNoKnowledgeFallback(question, workspacePath) {
10091
+ function printNoKnowledgeFallback(question, workspacePath, asJson = false) {
10092
+ if (asJson) {
10093
+ const rawPath2 = join13(workspacePath, "raw");
10094
+ process.stdout.write(
10095
+ JSON.stringify({
10096
+ question,
10097
+ answer: "",
10098
+ citations: [],
10099
+ question_type: null,
10100
+ retrieved_pages: [],
10101
+ tokens_in: 0,
10102
+ tokens_out: 0,
10103
+ tokens_total: 0,
10104
+ cost_usd: 0,
10105
+ model: null,
10106
+ latency_ms: 0,
10107
+ verified_citations: 0,
10108
+ unverified_citations: 0,
10109
+ provenance_chain: [],
10110
+ suggest_research: false,
10111
+ no_knowledge: true,
10112
+ has_uncompiled_sources: existsSync15(rawPath2)
10113
+ }) + "\n"
10114
+ );
10115
+ return;
10116
+ }
10092
10117
  process.stdout.write("\n");
10093
10118
  process.stdout.write(formatWarning(`No compiled knowledge found for: "${question}"`) + "\n");
10094
10119
  process.stdout.write("\n");
@@ -10165,7 +10190,7 @@ async function runAsk(question, askOptions, globalOpts) {
10165
10190
  }
10166
10191
  const analysis = analysisResult.value;
10167
10192
  if (analysis.relevantPages.length === 0) {
10168
- printNoKnowledgeFallback(question, wsPath);
10193
+ printNoKnowledgeFallback(question, wsPath, globalOpts.json === true);
10169
10194
  return;
10170
10195
  }
10171
10196
  const boostResult = findRelevantPages(db, question, analysis.type, 5);
@@ -10183,10 +10208,10 @@ async function runAsk(question, askOptions, globalOpts) {
10183
10208
  pagesWithContent.push({ path: page.path, title: page.title, content });
10184
10209
  }
10185
10210
  if (pagesWithContent.length === 0) {
10186
- printNoKnowledgeFallback(question, wsPath);
10211
+ printNoKnowledgeFallback(question, wsPath, globalOpts.json === true);
10187
10212
  return;
10188
10213
  }
10189
- process.stdout.write(dim("Generating answer...") + "\n");
10214
+ process.stderr.write(dim("Generating answer...") + "\n");
10190
10215
  const generateResult = await generateAnswer(client, question, pagesWithContent, {
10191
10216
  model,
10192
10217
  ...askOptions.maxTokens !== void 0 && { maxTokens: askOptions.maxTokens }
@@ -10220,6 +10245,37 @@ async function runAsk(question, askOptions, globalOpts) {
10220
10245
  verifiedCitations: verified.length,
10221
10246
  unverifiedCitations: unverified.length
10222
10247
  });
10248
+ if (globalOpts.json) {
10249
+ const totalTokens2 = inputTokens + outputTokens;
10250
+ const cost2 = calculateCost(inputTokens, outputTokens, model);
10251
+ const verifiedSet = new Set(verified.map((c) => c.pagePath));
10252
+ const payload = {
10253
+ question,
10254
+ answer,
10255
+ citations: citations.map((c) => ({
10256
+ source: `wiki/${c.pagePath}`,
10257
+ title: c.pageTitle,
10258
+ verified: verifiedSet.has(c.pagePath)
10259
+ })),
10260
+ question_type: analysis.type,
10261
+ retrieved_pages: topPages.map((p) => p.path),
10262
+ tokens_in: inputTokens,
10263
+ tokens_out: outputTokens,
10264
+ tokens_total: totalTokens2,
10265
+ cost_usd: Number(cost2.toFixed(4)),
10266
+ model,
10267
+ latency_ms: latencyMs,
10268
+ verified_citations: verified.length,
10269
+ unverified_citations: unverified.length,
10270
+ provenance_chain: provenanceChain.map((e) => ({
10271
+ level: e.level,
10272
+ path: "path" in e ? e.path : null
10273
+ })),
10274
+ suggest_research: analysis.suggestResearch
10275
+ };
10276
+ process.stdout.write(JSON.stringify(payload) + "\n");
10277
+ return;
10278
+ }
10223
10279
  process.stdout.write("\n");
10224
10280
  process.stdout.write(formatHeader("Answer") + "\n\n");
10225
10281
  const displayAnswer = answer.split("\n").map((line) => ` ${line}`).join("\n");