@mrciphersmith/keryx 0.2.113 → 0.2.115

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.
Files changed (4) hide show
  1. package/README.md +13 -0
  2. package/dist/cli.js +2700 -867
  3. package/dist/core.js +82 -2
  4. package/package.json +1 -1
package/dist/core.js CHANGED
@@ -8678,6 +8678,21 @@ var init_evidence = __esm(() => {
8678
8678
  CLAIM_TYPES = new Set(["observation", "hypothesis", "decision", "instruction"]);
8679
8679
  });
8680
8680
 
8681
+ // src/wiki/think-tags.ts
8682
+ function maskCodeRegions(text) {
8683
+ const maskMatch = (m) => "\x00".repeat(m.length);
8684
+ return text.replace(FENCE_RE2, maskMatch).replace(INLINE_CODE_RE, maskMatch);
8685
+ }
8686
+ function containsThinkTags(text) {
8687
+ return STRAY_THINK_TAG_RE.test(maskCodeRegions(text));
8688
+ }
8689
+ var STRAY_THINK_TAG_RE, FENCE_RE2, INLINE_CODE_RE;
8690
+ var init_think_tags = __esm(() => {
8691
+ STRAY_THINK_TAG_RE = /<\/?think(?:ing)?>/i;
8692
+ FENCE_RE2 = /```[\s\S]*?```/g;
8693
+ INLINE_CODE_RE = /``[^`\n]*?``|`[^`\n]*?`/g;
8694
+ });
8695
+
8681
8696
  // src/wiki/templates.ts
8682
8697
  function templateKindForPageType(type) {
8683
8698
  return WIKI_TEMPLATE_CONTRACTS.find((contract) => contract.pageTypes.includes(type))?.kind ?? null;
@@ -9138,9 +9153,22 @@ async function wikiStatus(cwd) {
9138
9153
  count: pages.filter((page) => page.pageType === type).length
9139
9154
  })),
9140
9155
  lastIndexGeneratedAt: await readIndexGeneratedAt(cwd),
9141
- lastLinkCheck: await readLinkCheckState(cwd)
9156
+ lastLinkCheck: await readLinkCheckState(cwd),
9157
+ pagesWithThinkTags: await findPagesWithThinkTags(pages)
9142
9158
  };
9143
9159
  }
9160
+ async function findPagesWithThinkTags(pages) {
9161
+ const flagged = [];
9162
+ for (const page of pages) {
9163
+ try {
9164
+ const content = await readFile20(page.absolutePath, "utf8");
9165
+ if (containsThinkTags(content)) {
9166
+ flagged.push(page.relativePath);
9167
+ }
9168
+ } catch {}
9169
+ }
9170
+ return flagged;
9171
+ }
9144
9172
  async function wikiCreatePage(input) {
9145
9173
  const typeConfig = WIKI_PAGE_TYPES.find((entry) => entry.type === input.type);
9146
9174
  if (!typeConfig) {
@@ -10227,6 +10255,7 @@ var init_service2 = __esm(() => {
10227
10255
  init_section_index();
10228
10256
  init_section_tombstone();
10229
10257
  init_staleness2();
10258
+ init_think_tags();
10230
10259
  init_templates();
10231
10260
  init_types2();
10232
10261
  EXTERNAL_LINK = /^(https?:|mailto:|tel:)/i;
@@ -22840,6 +22869,54 @@ function readToolCalls(value) {
22840
22869
  }
22841
22870
  return calls.length > 0 ? calls : undefined;
22842
22871
  }
22872
+ function readReplayItems(value) {
22873
+ if (!Array.isArray(value)) {
22874
+ return;
22875
+ }
22876
+ const items = [];
22877
+ for (const entry of value) {
22878
+ if (entry === null || typeof entry !== "object") {
22879
+ continue;
22880
+ }
22881
+ const record = entry;
22882
+ const { providerId, kind } = record;
22883
+ if (typeof providerId !== "string" || providerId.length === 0) {
22884
+ continue;
22885
+ }
22886
+ if (typeof kind !== "string" || kind.length === 0) {
22887
+ continue;
22888
+ }
22889
+ if (!("data" in record)) {
22890
+ continue;
22891
+ }
22892
+ items.push({ providerId, kind, data: record.data });
22893
+ }
22894
+ return items.length > 0 ? items : undefined;
22895
+ }
22896
+ function readReasoning(value) {
22897
+ if (value === null || typeof value !== "object") {
22898
+ return;
22899
+ }
22900
+ const record = value;
22901
+ const out = {};
22902
+ if (typeof record.text === "string" && record.text.length > 0) {
22903
+ out.text = record.text;
22904
+ }
22905
+ if (record.redacted === true) {
22906
+ out.redacted = true;
22907
+ }
22908
+ const replay = readReplayItems(record.replay);
22909
+ if (replay !== undefined) {
22910
+ out.replay = replay;
22911
+ }
22912
+ if (typeof record.durationMs === "number" && Number.isFinite(record.durationMs) && record.durationMs >= 0) {
22913
+ out.durationMs = record.durationMs;
22914
+ }
22915
+ if (typeof record.tokens === "number" && Number.isFinite(record.tokens) && record.tokens >= 0) {
22916
+ out.tokens = record.tokens;
22917
+ }
22918
+ return Object.keys(out).length > 0 ? out : undefined;
22919
+ }
22843
22920
  function nowIso2() {
22844
22921
  return new Date().toISOString();
22845
22922
  }
@@ -22912,12 +22989,15 @@ function readJsonl2(file) {
22912
22989
  continue;
22913
22990
  }
22914
22991
  const toolCalls = readToolCalls(o.toolCalls);
22992
+ const reasoning = readReasoning(o.reasoning);
22915
22993
  out.push({
22916
22994
  role: o.role,
22917
22995
  content: o.content,
22918
22996
  ...o.provenance === "trusted" || o.provenance === "project" || o.provenance === "model" || o.provenance === "tool" ? { provenance: o.provenance } : {},
22919
22997
  ...toolCalls !== undefined ? { toolCalls } : {},
22920
- ...typeof o.toolCallId === "string" && o.toolCallId.length > 0 ? { toolCallId: o.toolCallId } : {}
22998
+ ...typeof o.toolCallId === "string" && o.toolCallId.length > 0 ? { toolCallId: o.toolCallId } : {},
22999
+ ...typeof o.ts === "string" && o.ts.length > 0 ? { ts: o.ts } : {},
23000
+ ...reasoning !== undefined ? { reasoning } : {}
22921
23001
  });
22922
23002
  } catch {}
22923
23003
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrciphersmith/keryx",
3
- "version": "0.2.113",
3
+ "version": "0.2.115",
4
4
  "description": "Version-controlled project context for AI coding agents: code graph, architecture wiki, project memory, relevant tests, quality signals, and task flows.",
5
5
  "private": false,
6
6
  "publishConfig": {