@crouton-kit/crouter 0.3.24 → 0.3.26

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 (38) hide show
  1. package/dist/builtin-memory/internal/INDEX.md +21 -0
  2. package/dist/builtin-memory/internal/examples/INDEX.md +15 -0
  3. package/dist/builtin-memory/internal/examples/imessage-assistant.md +100 -0
  4. package/dist/builtin-memory/internal/nodes-and-canvas.md +49 -0
  5. package/dist/builtin-memory/internal/storage-tiers.md +32 -0
  6. package/dist/builtin-memory/memory-authoring.md +100 -0
  7. package/dist/builtin-personas/orchestration-kernel.md +4 -4
  8. package/dist/clients/attach/attach-cmd.js +26 -0
  9. package/dist/commands/node.d.ts +15 -6
  10. package/dist/commands/node.js +33 -9
  11. package/dist/commands/skill/shared.d.ts +0 -5
  12. package/dist/commands/skill/shared.js +0 -81
  13. package/dist/core/__tests__/context-intro.test.js +23 -20
  14. package/dist/core/__tests__/full/broker-pane-resolution.test.d.ts +1 -0
  15. package/dist/core/__tests__/full/broker-pane-resolution.test.js +84 -0
  16. package/dist/core/__tests__/memory-resolver.test.js +21 -2
  17. package/dist/core/memory-resolver.js +17 -12
  18. package/dist/core/runtime/bearings.d.ts +1 -1
  19. package/dist/core/runtime/bearings.js +2 -2
  20. package/dist/core/runtime/broker.js +4 -2
  21. package/dist/core/runtime/launch.d.ts +2 -2
  22. package/dist/core/runtime/launch.js +2 -2
  23. package/dist/core/runtime/placement.d.ts +13 -0
  24. package/dist/core/runtime/placement.js +23 -7
  25. package/dist/core/runtime/recycle.js +65 -10
  26. package/dist/core/substrate/ceiling.d.ts +0 -7
  27. package/dist/core/substrate/ceiling.js +0 -16
  28. package/dist/core/substrate/index.d.ts +2 -2
  29. package/dist/core/substrate/index.js +2 -2
  30. package/dist/core/substrate/render.d.ts +19 -20
  31. package/dist/core/substrate/render.js +271 -171
  32. package/dist/core/substrate/session-cache.d.ts +0 -13
  33. package/dist/core/substrate/session-cache.js +0 -12
  34. package/dist/index.d.ts +19 -1
  35. package/dist/index.js +26 -1
  36. package/dist/pi-extensions/canvas-context-intro.js +3 -3
  37. package/dist/pi-extensions/canvas-doc-substrate.js +13 -5
  38. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1 +1,19 @@
1
- export {};
1
+ export { spawnChild } from './core/runtime/spawn.js';
2
+ export type { SpawnChildOpts, SpawnChildResult } from './core/runtime/spawn.js';
3
+ export { reviveNode } from './core/runtime/revive.js';
4
+ export type { ReviveResult } from './core/runtime/revive.js';
5
+ export { closeNode } from './core/runtime/close.js';
6
+ export type { CloseNodeResult } from './core/runtime/close.js';
7
+ export { appendInbox } from './core/feed/inbox.js';
8
+ export type { InboxEntry, InboxTier, InboxKind } from './core/feed/inbox.js';
9
+ export { getNode, listNodes } from './core/canvas/canvas.js';
10
+ export { nodeDir } from './core/canvas/paths.js';
11
+ export type { NodeMeta, NodeRow, NodeStatus, Lifecycle, Mode, } from './core/canvas/types.js';
12
+ export { asksForNodes, asksAcrossCanvas } from './core/canvas/attention.js';
13
+ export type { AskEntry } from './core/canvas/attention.js';
14
+ export { readTelemetry, readContextTokens } from './core/canvas/telemetry.js';
15
+ export type { Telemetry } from './core/canvas/telemetry.js';
16
+ export { ViewSocketClient, BrokerUnavailableError } from './clients/attach/view-socket.js';
17
+ export { encodeFrame, FrameDecoder, FrameOverflowError, CLIENT_READ_CAPS, BROKER_READ_CAPS, } from './core/runtime/broker-protocol.js';
18
+ export type { FrameDecoderCaps, BrokerSnapshot, ClientRole, WelcomeFrame, ControlChangedFrame, AckFrame, ErrorFrame, ExtensionUIRequestFrame, BrokerToClient, HelloFrame, PromptFrame, SteerFrame, FollowUpFrame, AbortFrame, RequestControlFrame, ReleaseControlFrame, ByeFrame, ShutdownFrame, SetModelFrame, CycleModelFrame, SetThinkingLevelFrame, SetAutoRetryFrame, SetAutoCompactionFrame, CompactFrame, NewSessionFrame, SwitchSessionFrame, ForkFrame, SetSessionNameFrame, GetCommandsFrame, NavigateTreeFrame, ReloadFrame, ExportFrame, ClientToBroker, RpcExtensionUIRequest, RpcExtensionUIResponse, ExtensionUIResponseFrame, } from './core/runtime/broker-protocol.js';
19
+ export type { SessionStats } from '@earendil-works/pi-coding-agent';
package/dist/index.js CHANGED
@@ -1 +1,26 @@
1
- export {};
1
+ // @crouton-kit/crouter — the sanctioned library surface (design D1).
2
+ //
3
+ // This barrel is the ONLY supported way to import crouter as a library; the
4
+ // `exports` map gates off deep subpath imports, so consumers (notably
5
+ // @crouton-kit/crouter-web) depend on exactly the symbols re-exported here.
6
+ // Everything below is a stable, server-facing surface: runtime control that
7
+ // keeps the canvas-row ⇄ pi-session lockstep guarantees, read-only canvas/
8
+ // telemetry queries, and the broker socket client + wire protocol. Nothing
9
+ // internal (CLI plumbing, helpers) is exported. This module has no load-time
10
+ // side effects and no circular imports — keep it that way.
11
+ // ── Runtime control ──────────────────────────────────────────────────────
12
+ // Sanctioned launchers/mutators. reviveNode is the ONLY sanctioned launcher of
13
+ // `pi --session`; spawnChild's host is chosen via `hostKind: 'tmux' | 'broker'`.
14
+ export { spawnChild } from './core/runtime/spawn.js';
15
+ export { reviveNode } from './core/runtime/revive.js';
16
+ export { closeNode } from './core/runtime/close.js';
17
+ export { appendInbox } from './core/feed/inbox.js';
18
+ // ── Canvas reads ─────────────────────────────────────────────────────────
19
+ export { getNode, listNodes } from './core/canvas/canvas.js';
20
+ export { nodeDir } from './core/canvas/paths.js';
21
+ export { asksForNodes, asksAcrossCanvas } from './core/canvas/attention.js';
22
+ export { readTelemetry, readContextTokens } from './core/canvas/telemetry.js';
23
+ // ── Broker client ────────────────────────────────────────────────────────
24
+ export { ViewSocketClient, BrokerUnavailableError } from './clients/attach/view-socket.js';
25
+ // ── Broker wire protocol (codec + frame/protocol types) ──────────────────
26
+ export { encodeFrame, FrameDecoder, FrameOverflowError, CLIENT_READ_CAPS, BROKER_READ_CAPS, } from './core/runtime/broker-protocol.js';
@@ -15,11 +15,11 @@
15
15
  //
16
16
  // The block carries: the path to the node's own context dir and the framing for
17
17
  // what belongs there (a shared document store for the other nodes). EVERY node
18
- // also gets a `## References` block rendered from the document substrate —
18
+ // also gets a `<references>` block rendered from the document substrate —
19
19
  // eligible `reference` docs at their system-prompt visibility rung, plus the
20
20
  // node's own node-local substrate docs — so the bearings name what to read on
21
- // demand. (Skills and preferences surface as their own `## Skills` /
22
- // `## Preferences` sections of the system prompt, not in this block.) An
21
+ // demand. (Skills and preferences surface as their own `<skills>` /
22
+ // `<preferences>` blocks of the system prompt, not in this block.) An
23
23
  // orchestrator additionally gets the across-refresh-cycles framing (the one
24
24
  // thing a terminal worker's bearings drop). The prose lives in
25
25
  // core/runtime/bearings.ts (shared with the promotion guidance dump).
@@ -9,8 +9,9 @@
9
9
  // It owns the substrate's two new pi hooks:
10
10
  //
11
11
  // 1. before_agent_start — the BOOT system-prompt half. Splices the rendered
12
- // `## Skills` + `## Preferences` sections into `event.systemPrompt`, right
13
- // after pi's native "Available tools" list (before the `\n\nGuidelines:`
12
+ // `<skills>` + `<preferences>` + `<memory-guidance>` blocks into
13
+ // `event.systemPrompt`, right after pi's native "Available tools" list
14
+ // (before the `\n\nGuidelines:`
14
15
  // anchor), so the substrate's skills/preferences sit in the tool-selection
15
16
  // frame the agent reads while choosing a capability — mirroring the
16
17
  // personal crouter-help.ts anchor logic. Falls back to appending when the
@@ -33,7 +34,7 @@
33
34
  // with no dep on the pi packages. Mirrors canvas-context-intro.ts.
34
35
  import { homedir } from 'node:os';
35
36
  import { join, resolve } from 'node:path';
36
- import { renderOnReadDocs, renderPreferencesSection, renderSkillsSection, } from '../core/substrate/index.js';
37
+ import { renderMemoryGuidance, renderOnReadDocs, renderPreferencesSection, renderSkillsSection, } from '../core/substrate/index.js';
37
38
  import { clearSessionCache } from '../core/substrate/session-cache.js';
38
39
  // ---------------------------------------------------------------------------
39
40
  // Extension
@@ -64,10 +65,17 @@ export function registerCanvasDocSubstrate(pi) {
64
65
  injectedDocs.clear();
65
66
  clearSessionCache();
66
67
  });
67
- // 1. BOOT system-prompt half — splice `## Skills` + `## Preferences`.
68
+ // 1. BOOT system-prompt half — splice `<skills>` + `<preferences>` +
69
+ // `<memory-guidance>`. The guidance block is always present for a canvas
70
+ // node (the memory system always exists), so the splice is never empty even
71
+ // when both trees are.
68
72
  pi.on('before_agent_start', (event) => {
69
73
  try {
70
- const sections = [renderSkillsSection(nodeId), renderPreferencesSection(nodeId)].filter((s) => s !== '');
74
+ const sections = [
75
+ renderSkillsSection(nodeId),
76
+ renderPreferencesSection(nodeId),
77
+ renderMemoryGuidance(),
78
+ ].filter((s) => s !== '');
71
79
  if (sections.length === 0)
72
80
  return; // nothing eligible — leave the prompt untouched
73
81
  const block = sections.join('\n\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crouton-kit/crouter",
3
- "version": "0.3.24",
3
+ "version": "0.3.26",
4
4
  "description": "crtr — fast access to skills, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",