@crouton-kit/crouter 0.3.45 → 0.3.47

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 (52) hide show
  1. package/dist/build-root.js +0 -1
  2. package/dist/builtin-memory/00-runtime-base.md +3 -0
  3. package/dist/builtin-memory/internal/nodes-and-canvas.md +2 -2
  4. package/dist/builtin-memory/wedged-child-on-runaway-bash.md +2 -2
  5. package/dist/builtin-views/chat/web.jsx +1 -1
  6. package/dist/clients/attach/__tests__/crtr-output-render.test.js +11 -9
  7. package/dist/clients/attach/attach-cmd.js +557 -546
  8. package/dist/clients/attach/chat-view.d.ts +4 -0
  9. package/dist/clients/attach/chat-view.js +13 -2
  10. package/dist/clients/attach/mermaid-render.d.ts +23 -0
  11. package/dist/clients/attach/mermaid-render.js +124 -0
  12. package/dist/clients/web/source-cache.js +1 -1
  13. package/dist/commands/__tests__/revive-now-gate.test.js +2 -2
  14. package/dist/commands/canvas-history/read.js +3 -3
  15. package/dist/commands/canvas-history/search.js +1 -1
  16. package/dist/commands/canvas-history.js +11 -12
  17. package/dist/commands/canvas-rebuild-index.js +2 -2
  18. package/dist/commands/canvas.js +4 -4
  19. package/dist/commands/node-inspect-artifacts.d.ts +1 -0
  20. package/dist/commands/{canvas-history/show.js → node-inspect-artifacts.js} +7 -7
  21. package/dist/commands/node-lifecycle-revive.d.ts +12 -0
  22. package/dist/commands/node-lifecycle-revive.js +166 -0
  23. package/dist/commands/node-worktree.d.ts +2 -0
  24. package/dist/commands/{worktree.js → node-worktree.js} +15 -16
  25. package/dist/commands/node.js +16 -13
  26. package/dist/commands/push.js +1 -1
  27. package/dist/commands/revive.d.ts +0 -10
  28. package/dist/commands/revive.js +31 -181
  29. package/dist/core/__tests__/kickoff.test.js +2 -2
  30. package/dist/core/canvas/boot.js +1 -1
  31. package/dist/core/canvas/browse/app.js +6 -6
  32. package/dist/core/canvas/browse/render.js +1 -1
  33. package/dist/core/canvas/status-glyph.d.ts +1 -1
  34. package/dist/core/canvas/status-glyph.js +1 -1
  35. package/dist/core/preview-registry.js +27 -26
  36. package/dist/core/profiles/select.d.ts +12 -4
  37. package/dist/core/profiles/select.js +182 -22
  38. package/dist/core/runtime/bearings.js +1 -1
  39. package/dist/core/runtime/close.js +1 -1
  40. package/dist/core/runtime/kickoff.js +3 -3
  41. package/dist/core/runtime/revive.js +2 -2
  42. package/dist/core/view/stream-local.js +1 -1
  43. package/dist/core/worktree.js +4 -4
  44. package/dist/daemon/crtrd.js +3 -3
  45. package/dist/web/transport-stream.js +1 -1
  46. package/dist/web-client/assets/index-dpd0Rzuw.js +80 -0
  47. package/dist/web-client/index.html +1 -1
  48. package/package.json +2 -2
  49. package/scripts/postinstall.mjs +73 -0
  50. package/dist/commands/canvas-history/show.d.ts +0 -1
  51. package/dist/commands/worktree.d.ts +0 -2
  52. package/dist/web-client/assets/index-B00YpRQ1.js +0 -80
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <meta name="color-scheme" content="dark light" />
7
7
  <title>crouter</title>
8
- <script type="module" crossorigin src="/assets/index-B00YpRQ1.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-dpd0Rzuw.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-DrkcvANq.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crouton-kit/crouter",
3
- "version": "0.3.45",
3
+ "version": "0.3.47",
4
4
  "description": "crtr — agent runtime with memory, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "license": "MIT",
49
49
  "dependencies": {
50
- "@crouton-kit/humanloop": "^0.3.20",
50
+ "@crouton-kit/humanloop": "^0.3.22",
51
51
  "@earendil-works/pi-agent-core": "0.80.2",
52
52
  "@earendil-works/pi-ai": "0.80.3",
53
53
  "@earendil-works/pi-coding-agent": "0.80.2",
@@ -1,4 +1,77 @@
1
1
  #!/usr/bin/env node
2
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { dirname, join } from 'node:path';
5
+
6
+ // Patch pi's tree navigator so multiple session-tree ROOTS render in
7
+ // chronological (file/append) order instead of floating the active-leaf branch
8
+ // to the top. crtr overloads sibling roots to mean sequential refresh-yield
9
+ // cycles (session-cycles.ts): each cycle is a new root, and the live cycle
10
+ // always holds the active leaf, so pi's default active-first root sort renders
11
+ // the newest cycle on top and prior cycles below it — reverse-chronological,
12
+ // which reads as "weird ordering" in the Esc-Esc / `/tree` navigator.
13
+ //
14
+ // The active-first ordering is applied RECURSIVELY in pi's flattenTree, so no
15
+ // tree-data reshaping on crtr's side can defeat it — the only fix is at the
16
+ // root sort. We keep active-first WITHIN a cycle's branches (in-cycle fork
17
+ // navigation is untouched); only the cross-root sort is dropped. The attach
18
+ // viewer is esbuild-bundled, so this must run before `npm run build` — hence it
19
+ // lives in postinstall (runs after `npm ci`/`npm install`, including in CI)
20
+ // ahead of the CI early-exit below. Idempotent + version-guarded + never fails
21
+ // install; on a pi bump the version guard no-ops with a warning so we notice.
22
+ function patchPiTreeRootOrdering() {
23
+ // pi's `exports` is ESM-only and blocks the `./package.json` subpath, so
24
+ // resolve the main entry (respecting the `import` condition) and walk up to
25
+ // the package root (the dir holding package.json).
26
+ let dir;
27
+ try {
28
+ dir = dirname(fileURLToPath(import.meta.resolve('@earendil-works/pi-coding-agent')));
29
+ } catch {
30
+ return; // pi not installed here (e.g. a consumer without the viewer)
31
+ }
32
+ let pkgJsonPath;
33
+ while (dir !== dirname(dir)) {
34
+ const candidate = join(dir, 'package.json');
35
+ if (existsSync(candidate)) {
36
+ const name = JSON.parse(readFileSync(candidate, 'utf8')).name;
37
+ if (name === '@earendil-works/pi-coding-agent') {
38
+ pkgJsonPath = candidate;
39
+ break;
40
+ }
41
+ }
42
+ dir = dirname(dir);
43
+ }
44
+ if (!pkgJsonPath) return;
45
+ const pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
46
+ const EXPECTED = '0.80.2';
47
+ if (pkg.version !== EXPECTED) {
48
+ console.warn(
49
+ `[crtr postinstall] pi is ${pkg.version}, tree-root-ordering patch targets ${EXPECTED} — skipped. ` +
50
+ `Re-verify the patch against the new pi and update EXPECTED in scripts/postinstall.mjs.`,
51
+ );
52
+ return;
53
+ }
54
+ const filePath = join(dirname(pkgJsonPath), 'dist/modes/interactive/components/tree-selector.js');
55
+ const src = readFileSync(filePath, 'utf8');
56
+ if (src.includes('/* crtr-patch:roots-chronological */')) return; // already applied
57
+ const TARGET =
58
+ 'const orderedRoots = [...roots].sort((a, b) => Number(containsActive.get(b)) - Number(containsActive.get(a)));';
59
+ if (!src.includes(TARGET)) {
60
+ console.warn(
61
+ '[crtr postinstall] pi tree-root-ordering patch target not found — pi internals changed; patch skipped.',
62
+ );
63
+ return;
64
+ }
65
+ const patched = src.replace(TARGET, 'const orderedRoots = [...roots]; /* crtr-patch:roots-chronological */');
66
+ writeFileSync(filePath, patched);
67
+ }
68
+
69
+ try {
70
+ patchPiTreeRootOrdering();
71
+ } catch (err) {
72
+ console.warn('[crtr postinstall] pi tree-root-ordering patch failed (non-fatal):', err?.message ?? err);
73
+ }
74
+
2
75
  try {
3
76
  if (process.env.CI) process.exit(0);
4
77
  console.log('crouter installed. Run `crtr sys setup` to install companion pi plugins (mode-switch, crtr-extensions, Claude OAuth), tmux/nvim, and your Exa key.');
@@ -1 +0,0 @@
1
- export declare const showLeaf: import("../../core/command.js").LeafDef;
@@ -1,2 +0,0 @@
1
- import { type BranchDef } from '../core/command.js';
2
- export declare function registerWorktree(): BranchDef;