@north-light/crouter 0.3.161 → 0.3.163

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 (130) hide show
  1. package/dist/api/client.d.ts +3 -1
  2. package/dist/api/client.js +6 -0
  3. package/dist/api/dto/modelauth.d.ts +32 -0
  4. package/dist/api/dto/modelauth.js +2 -1
  5. package/dist/api/routes.d.ts +1 -0
  6. package/dist/api/routes.js +1 -0
  7. package/dist/builtin-memory/00-runtime-base.md +1 -0
  8. package/dist/builtin-memory/04-orchestration-kernel.md +1 -0
  9. package/dist/builtin-memory/init.md +38 -0
  10. package/dist/builtin-memory/wedged-child-on-runaway-bash.md +2 -2
  11. package/dist/builtin-pi-packages/pi-crtr-extensions/README.md +0 -1
  12. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/provider-rotation.test.ts +88 -396
  13. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +215 -419
  14. package/dist/clients/attach/__tests__/crtr-output.test.js +14 -9
  15. package/dist/clients/attach/__tests__/edit-diff.test.d.ts +1 -0
  16. package/dist/clients/attach/__tests__/edit-diff.test.js +34 -0
  17. package/dist/clients/attach/__tests__/editor-frame-title.test.d.ts +1 -0
  18. package/dist/clients/attach/__tests__/editor-frame-title.test.js +19 -0
  19. package/dist/clients/attach/render/chat-view.js +8 -3
  20. package/dist/clients/attach/render/crtr-output.js +31 -2
  21. package/dist/clients/attach/render/edit-diff.js +26 -2
  22. package/dist/clients/attach/render/tool-calls.d.ts +7 -2
  23. package/dist/clients/attach/render/tool-calls.js +25 -4
  24. package/dist/clients/attach/session/connection.d.ts +1 -1
  25. package/dist/clients/attach/session/editor-frame.d.ts +5 -1
  26. package/dist/clients/attach/session/editor-frame.js +21 -15
  27. package/dist/clients/attach/session/identity.d.ts +1 -1
  28. package/dist/clients/attach/viewer.js +441 -439
  29. package/dist/commands/__tests__/api-canvas-source.test.d.ts +1 -0
  30. package/dist/commands/__tests__/api-canvas-source.test.js +37 -0
  31. package/dist/commands/__tests__/human.test.js +2 -0
  32. package/dist/commands/__tests__/search-contents.test.d.ts +1 -0
  33. package/dist/commands/__tests__/search-contents.test.js +52 -0
  34. package/dist/commands/api-client.js +1 -0
  35. package/dist/commands/human/prompts.js +2 -2
  36. package/dist/commands/human/shared.d.ts +1 -0
  37. package/dist/commands/human/shared.js +7 -4
  38. package/dist/commands/memory/lint.d.ts +6 -0
  39. package/dist/commands/memory/lint.js +177 -35
  40. package/dist/commands/memory/read.js +22 -1
  41. package/dist/commands/memory/write.js +18 -4
  42. package/dist/commands/memory.js +1 -1
  43. package/dist/commands/search/contents.js +2 -2
  44. package/dist/commands/sys/__tests__/sync-deps.test.js +12 -21
  45. package/dist/commands/sys/__tests__/sync-import.test.js +30 -29
  46. package/dist/commands/sys/setup-wizard.d.ts +8 -1
  47. package/dist/commands/sys/setup-wizard.js +209 -58
  48. package/dist/commands/sys/sync-deps.js +14 -18
  49. package/dist/commands/sys/sync-project-guidance.js +16 -19
  50. package/dist/core/__tests__/broker-launch-candidates.test.js +13 -3
  51. package/dist/core/__tests__/broker-sdk-wiring.test.js +53 -25
  52. package/dist/core/__tests__/full/broker-provider-retry.test.js +6 -122
  53. package/dist/core/__tests__/migration.test.js +8 -3
  54. package/dist/core/__tests__/model-pin-durability.test.js +7 -5
  55. package/dist/core/__tests__/model-routes.test.d.ts +1 -0
  56. package/dist/core/__tests__/model-routes.test.js +41 -0
  57. package/dist/core/__tests__/on-read-crouter-home-fence.test.js +7 -10
  58. package/dist/core/__tests__/on-read-dedup-resume.test.js +13 -25
  59. package/dist/core/__tests__/on-read-identity.test.js +8 -15
  60. package/dist/core/__tests__/review-model-floor.test.js +2 -2
  61. package/dist/core/__tests__/revive.test.js +2 -2
  62. package/dist/core/__tests__/tmux-surface.test.js +10 -4
  63. package/dist/core/__tests__/worktree.test.js +3 -3
  64. package/dist/core/auth-file.d.ts +3 -2
  65. package/dist/core/auth-file.js +5 -3
  66. package/dist/core/canvas/extensions.d.ts +1 -1
  67. package/dist/core/canvas/extensions.js +18 -11
  68. package/dist/core/canvas/labels.d.ts +4 -5
  69. package/dist/core/canvas/labels.js +9 -9
  70. package/dist/core/canvas/types.d.ts +6 -1
  71. package/dist/core/command-manifests/schema.js +18 -5
  72. package/dist/core/command.js +17 -7
  73. package/dist/core/config.d.ts +3 -1
  74. package/dist/core/config.js +88 -2
  75. package/dist/core/configured-clis/invoker.js +2 -0
  76. package/dist/core/help.d.ts +3 -1
  77. package/dist/core/help.js +5 -2
  78. package/dist/core/keybindings/__tests__/resolve.test.js +5 -2
  79. package/dist/core/keybindings/catalog.d.ts +3 -2
  80. package/dist/core/keybindings/catalog.js +34 -25
  81. package/dist/core/keybindings/index.d.ts +1 -1
  82. package/dist/core/keybindings/resolve.js +8 -0
  83. package/dist/core/keybindings/types.d.ts +6 -1
  84. package/dist/core/memory/doc-link-grammar.d.ts +20 -0
  85. package/dist/core/memory/doc-link-grammar.js +110 -0
  86. package/dist/core/memory-resolver.d.ts +5 -0
  87. package/dist/core/memory-resolver.js +12 -1
  88. package/dist/core/model-routes.d.ts +37 -0
  89. package/dist/core/model-routes.js +140 -0
  90. package/dist/core/runtime/bearings.d.ts +8 -8
  91. package/dist/core/runtime/bearings.js +20 -16
  92. package/dist/core/runtime/broker.d.ts +0 -4
  93. package/dist/core/runtime/broker.js +119 -385
  94. package/dist/core/runtime/canvas-extensions.d.ts +1 -0
  95. package/dist/core/runtime/canvas-extensions.js +2 -0
  96. package/dist/core/runtime/launch.d.ts +10 -12
  97. package/dist/core/runtime/launch.js +16 -22
  98. package/dist/core/runtime/managed-provider-cooling.d.ts +0 -14
  99. package/dist/core/runtime/managed-provider-cooling.js +0 -19
  100. package/dist/core/runtime/model-swap.js +7 -1
  101. package/dist/core/runtime/promote.js +1 -0
  102. package/dist/core/runtime/tmux.js +136 -100
  103. package/dist/core/scope.js +4 -5
  104. package/dist/core/subscription-state.d.ts +12 -36
  105. package/dist/core/subscription-state.js +19 -203
  106. package/dist/core/substrate/ceiling.d.ts +3 -6
  107. package/dist/core/substrate/ceiling.js +13 -15
  108. package/dist/core/substrate/index.d.ts +2 -3
  109. package/dist/core/substrate/index.js +2 -2
  110. package/dist/core/substrate/on-read.d.ts +4 -13
  111. package/dist/core/substrate/on-read.js +142 -262
  112. package/dist/core/substrate/render.js +4 -4
  113. package/dist/core/substrate/schema.d.ts +3 -2
  114. package/dist/core/substrate/schema.js +5 -5
  115. package/dist/daemon/api/__tests__/full/api-server.test.js +9 -6
  116. package/dist/daemon/api/__tests__/full/b10-attach-modelauth.test.js +123 -1
  117. package/dist/daemon/api/handlers/modelauth.js +51 -2
  118. package/dist/daemon/api/handlers/nodes.js +2 -0
  119. package/dist/pi-extensions/__tests__/canvas-tool-guide.test.d.ts +1 -0
  120. package/dist/pi-extensions/__tests__/canvas-tool-guide.test.js +96 -0
  121. package/dist/pi-extensions/canvas-doc-substrate.js +7 -8
  122. package/dist/pi-extensions/canvas-tool-guide.d.ts +14 -0
  123. package/dist/pi-extensions/canvas-tool-guide.js +74 -0
  124. package/dist/types.d.ts +17 -0
  125. package/dist/web-client/assets/{index-B76ZKfT_.js → index-NIuSCOHM.js} +1 -1
  126. package/dist/web-client/index.html +1 -1
  127. package/dist/web-client/sw.js +1 -1
  128. package/package.json +1 -1
  129. package/runtime.lock.json +2 -2
  130. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/crouter-help.ts +0 -95
@@ -16,12 +16,12 @@
16
16
  // carries the <project_context> block (buildProjectContextBlock), which is
17
17
  // now only the <environment> snapshot: a host/runtime line (platform,
18
18
  // hostname, node, tmux-or-not), the cwd dir listing, and git status.
19
- // Project guidance rides the
20
- // document substrate instead: migrated CLAUDE.md/AGENTS.md docs live in the
21
- // source dir's own `.crouter/memory/AGENTS.md` and surface through the
22
- // <memory kind="knowledge"> block below (renderKnowledgeBlock) via the
23
- // profile-widened boot render — no parallel project-context loader lives
24
- // here anymore (see `crtr memory read taste/document-substrate`);
19
+ // Project guidance rides the document substrate instead: a workspace's
20
+ // `.crouter/memory/INDEX.md` declares `applies-to: "."` and surfaces through
21
+ // an <auto-loaded-context> block when cwd/profile mounts that workspace;
22
+ // ordinary boot-routed knowledge remains in the <memory kind="knowledge">
23
+ // block below. No parallel project-context loader lives here (see
24
+ // `crtr memory read taste/document-substrate`);
25
25
  // • promote.ts folds orchestratorContextNote() into the promotion guidance
26
26
  // dump, so a node that becomes an orchestrator MID-LIFE gets the
27
27
  // orchestrator framing it never received at spawn — it spawned as a base
@@ -45,7 +45,7 @@ import { readdirSync } from 'node:fs';
45
45
  import { spawnSync } from 'node:child_process';
46
46
  import { hostname } from 'node:os';
47
47
  import { cadenceDisplay } from '../wake.js';
48
- import { renderKnowledgeBlock } from '../substrate/index.js';
48
+ import { renderKnowledgeBlock, renderWorkspaceOpenDocs } from '../substrate/index.js';
49
49
  import { loadProfileManifest } from '../profiles/manifest.js';
50
50
  import { situationalContextBlock } from './situational-context.js';
51
51
  function escapeAttribute(value) {
@@ -391,14 +391,14 @@ export function buildWakeBearings(origin) {
391
391
  * note. The across-cycles context-dir framing is added ONLY for an
392
392
  * orchestrator (by mode) — the one node whose dir a future cycle resumes
393
393
  * from.
394
- * 2. `<memory kind="knowledge">` — the consultable catalog, a SIBLING of the
395
- * bearings (never nested under the context dir). Dropped when empty.
396
- * 3. `<project_context>` — the cwd/git environment snapshot. pi's own
397
- * AGENTS.md/CLAUDE.md system-prompt injection stays suppressed
398
- * (noContextFiles in broker.ts); project guidance instead rides the
399
- * `<memory kind="knowledge">` block above via the document substrate
400
- * (`crtr sys sync project-guidance` migrates each CLAUDE.md/AGENTS.md into
401
- * that dir's own `.crouter/memory/AGENTS.md`). */
394
+ * 2. `<memory kind="knowledge">` — the consultable boot catalog, a SIBLING of
395
+ * the bearings (never nested under the context dir). Dropped when empty.
396
+ * 3. `<auto-loaded-context>` — memories whose `applies-to: "."` fires because
397
+ * cwd/profile mounted their owning project store. Dropped when empty.
398
+ * 4. `<project_context>` — the cwd/git environment snapshot. pi's own
399
+ * AGENTS.md/CLAUDE.md injection stays suppressed (`noContextFiles` in
400
+ * broker.ts); `crtr sys sync project-guidance` imports that guidance into
401
+ * the directory's `.crouter/memory/INDEX.md` front door. */
402
402
  export function buildContextBearings(nodeId) {
403
403
  const node = getNode(nodeId);
404
404
  const bearings = ['<crtr-bearings>', buildIdentityAssertion(nodeId)];
@@ -420,10 +420,14 @@ export function buildContextBearings(nodeId) {
420
420
  bearings.push('</crtr-bearings>');
421
421
  // The consultable catalog rides BESIDE the bearings, not inside them.
422
422
  const knowledge = renderKnowledgeBlock(nodeId);
423
+ // A workspace mount is the initial read of its root (`applies-to: "."`).
424
+ const workspaceContext = renderWorkspaceOpenDocs(nodeId);
423
425
  // Hidden applet/situation-origin ambient context (see situational-context.ts)
424
426
  // — a SIBLING block, never nested under <crtr-bearings>, and never routed
425
427
  // through the visible chat/digest path. '' when nothing was ever set.
426
428
  const situational = situationalContextBlock(nodeId);
427
429
  const projectCtx = node?.cwd !== undefined ? buildProjectContextBlock(node.cwd) : '';
428
- return [bearings.join('\n'), knowledge, situational, projectCtx].filter((s) => s !== '').join('\n');
430
+ return [bearings.join('\n'), knowledge, workspaceContext, situational, projectCtx]
431
+ .filter((s) => s !== '')
432
+ .join('\n');
429
433
  }
@@ -3,7 +3,6 @@ import { type AgentSessionRuntime, type AgentSessionServices, type CreateAgentSe
3
3
  import { type ImageContent } from '@earendil-works/pi-ai';
4
4
  import { type BrokerSdkConfig } from './launch.js';
5
5
  import { type BrokerEngine } from './broker-sdk.js';
6
- import { type ManagedProviderRotationPolicyControl } from './managed-provider-cooling.js';
7
6
  import { type KnownStreamWaitControl } from './stream-watchdog.js';
8
7
  import { FrameDecoder, type BrokerSnapshot, type BrokerToClient, type ClientRole, type RpcExtensionUIRequest, type RpcExtensionUIResponse } from './broker-protocol.js';
9
8
  /**
@@ -231,9 +230,6 @@ export interface BrokerDialogDeps {
231
230
  /** Broadcast a non-blocking display frame (setStatus/setWidget/setTitle) to ALL
232
231
  * viewers — the relay path for pi's fire-and-forget extension-UI surface. */
233
232
  broadcast: (frame: BrokerToClient) => void;
234
- /** Live provider-fallback policy. This is a callback because an explicit
235
- * set_model updates the running broker's pin state without a revive. */
236
- providerRotationPolicy?: ManagedProviderRotationPolicyControl;
237
233
  /** Optional broker-owned control for a deliberate, deadline-bounded provider
238
234
  * wait: pause the dead-stream watchdog while the provider extension sleeps to
239
235
  * a known finite future deadline, returning a release fn that resumes it. Put