@zosmaai/pi-llm-wiki 0.10.5 → 0.10.6

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/README.md CHANGED
@@ -440,6 +440,13 @@ Thanks to everyone who has contributed! This list is regenerated automatically b
440
440
  <sub><b>Akshay</b></sub>
441
441
  </a>
442
442
  </td>
443
+ <td align="center">
444
+ <a href="https://github.com/danielnaab">
445
+ <img src="https://avatars.githubusercontent.com/u/136512?v=4" width="64;" alt="danielnaab"/>
446
+ <br />
447
+ <sub><b>Daniel Naab</b></sub>
448
+ </a>
449
+ </td>
443
450
  <td align="center">
444
451
  <a href="https://github.com/mystery4f">
445
452
  <img src="https://avatars.githubusercontent.com/u/40482524?v=4" width="64;" alt="mystery4f"/>
@@ -2,7 +2,7 @@ import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { basename, join } from "node:path";
3
3
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
4
4
  import { installGuardrails } from "./lib/guardrails.js";
5
- import { buildAgentStartInjection } from "./lib/inject.js";
5
+ import { buildAgentStartInjection, normalizeSystemPrompt } from "./lib/inject.js";
6
6
  import { registerWikiModelCommand } from "./lib/model-command.js";
7
7
  import {
8
8
  buildSessionNotice,
@@ -303,13 +303,12 @@ Then call wiki_bootstrap with the inferred topic and mode to finalize the setup.
303
303
 
304
304
  // Split into a cache-stable system prompt (static footer only) and a
305
305
  // volatile tail message (issue #92). See lib/inject.ts for the contract.
306
- const { systemPrompt, message } = buildAgentStartInjection(event.systemPrompt || "", [
307
- dynamicContext,
308
- ]);
306
+ const priorSystemPrompt = normalizeSystemPrompt(event.systemPrompt);
307
+ const { systemPrompt, message } = buildAgentStartInjection(priorSystemPrompt, [dynamicContext]);
309
308
 
310
309
  // Only claim a systemPrompt change when the footer actually altered the
311
310
  // string (a carry-forward turn already carries it, so this no-ops).
312
- const systemPromptChanged = systemPrompt !== event.systemPrompt;
311
+ const systemPromptChanged = systemPrompt !== priorSystemPrompt;
313
312
  if (!systemPromptChanged && !message) return;
314
313
  return {
315
314
  ...(systemPromptChanged ? { systemPrompt } : {}),
@@ -33,6 +33,14 @@ export function appendWikiStatus(systemPrompt: string): string {
33
33
  return `${base}\n\n${WIKI_STATUS_BLOCK}`;
34
34
  }
35
35
 
36
+ /** Normalize upstream Pi and OMP system-prompt representations. */
37
+ export function normalizeSystemPrompt(
38
+ systemPrompt: string | readonly string[] | null | undefined,
39
+ ): string {
40
+ if (Array.isArray(systemPrompt)) return systemPrompt.join("\n\n");
41
+ return typeof systemPrompt === "string" ? systemPrompt : "";
42
+ }
43
+
36
44
  /** customType of the hidden tail message carrying volatile per-turn context. */
37
45
  export const WIKI_RECALL_MESSAGE_TYPE = "wiki-recall-context";
38
46
 
@@ -69,10 +77,10 @@ export interface AgentStartInjection {
69
77
  * Pure and side-effect free — see test/agent-start-injection.test.ts.
70
78
  */
71
79
  export function buildAgentStartInjection(
72
- baseSystemPrompt: string,
80
+ baseSystemPrompt: string | readonly string[] | null | undefined,
73
81
  dynamicBlocks: Array<string | undefined>,
74
82
  ): AgentStartInjection {
75
- const systemPrompt = appendWikiStatus(baseSystemPrompt);
83
+ const systemPrompt = appendWikiStatus(normalizeSystemPrompt(baseSystemPrompt));
76
84
  const content = dynamicBlocks
77
85
  .map((b) => b?.trim())
78
86
  .filter((b): b is string => Boolean(b))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zosmaai/pi-llm-wiki",
3
- "version": "0.10.5",
3
+ "version": "0.10.6",
4
4
  "description": "Self-maintaining LLM Wiki for Pi — Karpathy-pattern knowledge base with immutable source capture, automated ingestion, search, linting, and Obsidian-compatible vault. auto-updating personal & company wiki.",
5
5
  "keywords": [
6
6
  "pi",