@north-light/crouter 0.3.164 → 0.3.166

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 (160) hide show
  1. package/dist/build-root.d.ts +6 -6
  2. package/dist/build-root.js +12 -13
  3. package/dist/builtin-memory/00-runtime-base.md +3 -4
  4. package/dist/builtin-memory/01-spine/01-no-manager.md +1 -1
  5. package/dist/builtin-memory/02-lifecycle/00-terminal.md +2 -0
  6. package/dist/builtin-memory/04-orchestration-kernel.md +16 -18
  7. package/dist/builtin-memory/05-kinds/advisor/00-base.md +0 -2
  8. package/dist/builtin-memory/05-kinds/advisor/01-orchestrator.md +3 -9
  9. package/dist/builtin-memory/05-kinds/developer/00-base.md +1 -3
  10. package/dist/builtin-memory/05-kinds/developer/01-orchestrator.md +2 -10
  11. package/dist/builtin-memory/05-kinds/explore/00-base.md +2 -2
  12. package/dist/builtin-memory/05-kinds/explore/01-orchestrator.md +0 -2
  13. package/dist/builtin-memory/05-kinds/general/00-base.md +3 -5
  14. package/dist/builtin-memory/05-kinds/general/01-orchestrator.md +0 -4
  15. package/dist/builtin-memory/05-kinds/plan/01-orchestrator.md +1 -3
  16. package/dist/builtin-memory/05-kinds/plan/reviewers/00-base.md +12 -0
  17. package/dist/builtin-memory/05-kinds/plan/reviewers/architecture-fit.md +0 -2
  18. package/dist/builtin-memory/05-kinds/plan/reviewers/code-smells.md +0 -2
  19. package/dist/builtin-memory/05-kinds/plan/reviewers/pattern-consistency.md +0 -2
  20. package/dist/builtin-memory/05-kinds/plan/reviewers/requirements-coverage.md +1 -1
  21. package/dist/builtin-memory/05-kinds/plan/reviewers/security.md +0 -2
  22. package/dist/builtin-memory/05-kinds/review/00-base.md +0 -2
  23. package/dist/builtin-memory/05-kinds/review/01-orchestrator.md +1 -3
  24. package/dist/builtin-memory/05-kinds/spec/00-base.md +1 -1
  25. package/dist/builtin-memory/05-kinds/spec/01-orchestrator.md +2 -4
  26. package/dist/builtin-memory/05-kinds/spec/requirements.md +1 -1
  27. package/dist/builtin-memory/advisor/council.md +40 -0
  28. package/dist/builtin-memory/design.md +8 -11
  29. package/dist/builtin-memory/development.md +6 -9
  30. package/dist/builtin-memory/internal/INDEX.md +4 -5
  31. package/dist/builtin-memory/internal/agent-shaping.md +5 -7
  32. package/dist/builtin-memory/internal/examples/imessage-assistant.md +3 -3
  33. package/dist/builtin-memory/internal/marketplaces.md +13 -14
  34. package/dist/builtin-memory/internal/nodes-and-canvas.md +4 -4
  35. package/dist/builtin-memory/internal/plugins.md +61 -45
  36. package/dist/builtin-memory/planning.md +4 -7
  37. package/dist/builtin-memory/spec.md +9 -12
  38. package/dist/builtin-memory/wedged-child-on-runaway-bash.md +8 -22
  39. package/dist/cli.js +1 -1
  40. package/dist/clients/attach/__tests__/attach-keybindings.test.js +17 -4
  41. package/dist/clients/attach/__tests__/context-message.test.js +62 -22
  42. package/dist/clients/attach/__tests__/crtr-output.test.js +39 -30
  43. package/dist/clients/attach/render/chat-view.d.ts +20 -20
  44. package/dist/clients/attach/render/chat-view.js +40 -54
  45. package/dist/clients/attach/render/{frozen-history.d.ts → condensed-history.d.ts} +1 -18
  46. package/dist/clients/attach/render/condensed-history.js +60 -0
  47. package/dist/clients/attach/render/context-message.d.ts +1 -1
  48. package/dist/clients/attach/render/context-message.js +18 -41
  49. package/dist/clients/attach/session/bindings.d.ts +5 -3
  50. package/dist/clients/attach/session/bindings.js +7 -13
  51. package/dist/clients/attach/session/keys.d.ts +2 -0
  52. package/dist/clients/attach/session/keys.js +36 -37
  53. package/dist/clients/attach/session/profile-files.d.ts +8 -0
  54. package/dist/clients/attach/session/profile-files.js +157 -0
  55. package/dist/clients/attach/viewer.js +528 -529
  56. package/dist/commands/node-context.js +3 -2
  57. package/dist/commands/node.js +2 -2
  58. package/dist/commands/pkg/plugin-inspect.js +6 -7
  59. package/dist/commands/pkg/plugin-manage.d.ts +1 -1
  60. package/dist/commands/pkg/plugin-manage.js +131 -19
  61. package/dist/commands/pkg/plugin.js +2 -2
  62. package/dist/commands/pkg.js +6 -11
  63. package/dist/commands/profile/env.js +3 -3
  64. package/dist/commands/sys/config.js +17 -76
  65. package/dist/commands/sys/doctor.js +5 -91
  66. package/dist/commands/sys/setup-wizard.d.ts +9 -11
  67. package/dist/commands/sys/setup-wizard.js +47 -81
  68. package/dist/core/__tests__/base-worker-prompt.test.js +18 -21
  69. package/dist/core/__tests__/command-plugins-surfaces.test.js +39 -5
  70. package/dist/core/__tests__/command-plugins.test.js +75 -16
  71. package/dist/core/__tests__/review-model-floor.test.js +2 -2
  72. package/dist/core/__tests__/tmux-surface.test.js +10 -1
  73. package/dist/core/command-manifests/manifest.d.ts +24 -0
  74. package/dist/core/{configured-clis → command-manifests}/manifest.js +28 -25
  75. package/dist/core/command-manifests/registry.d.ts +1 -2
  76. package/dist/core/command-manifests/registry.js +2 -2
  77. package/dist/core/command-manifests/schema.d.ts +11 -13
  78. package/dist/core/command-manifests/schema.js +53 -192
  79. package/dist/core/command-plugins/compose.d.ts +0 -6
  80. package/dist/core/command-plugins/compose.js +32 -75
  81. package/dist/core/command-plugins/discovery.d.ts +25 -58
  82. package/dist/core/command-plugins/discovery.js +171 -261
  83. package/dist/core/command-plugins/endpoint.d.ts +24 -0
  84. package/dist/core/command-plugins/endpoint.js +48 -0
  85. package/dist/core/command-plugins/store.d.ts +16 -0
  86. package/dist/core/command-plugins/store.js +64 -0
  87. package/dist/core/command-plugins/{adapter.d.ts → transport/exec-invoke.d.ts} +3 -3
  88. package/dist/core/command-plugins/{adapter.js → transport/exec-invoke.js} +4 -4
  89. package/dist/core/{configured-clis/fetch.d.ts → command-plugins/transport/http-fetch.d.ts} +9 -18
  90. package/dist/core/{configured-clis/fetch.js → command-plugins/transport/http-fetch.js} +15 -35
  91. package/dist/core/{configured-clis/invoker.d.ts → command-plugins/transport/http-invoke.d.ts} +7 -7
  92. package/dist/core/{configured-clis/invoker.js → command-plugins/transport/http-invoke.js} +21 -23
  93. package/dist/core/command.d.ts +8 -9
  94. package/dist/core/command.js +6 -9
  95. package/dist/core/config.js +6 -10
  96. package/dist/core/env-name.d.ts +6 -0
  97. package/dist/core/env-name.js +9 -0
  98. package/dist/core/io.d.ts +1 -1
  99. package/dist/core/keybindings/__tests__/resolve.test.js +40 -3
  100. package/dist/core/keybindings/attach-control.d.ts +37 -0
  101. package/dist/core/keybindings/attach-control.js +38 -0
  102. package/dist/core/keybindings/catalog.d.ts +5 -4
  103. package/dist/core/keybindings/catalog.js +16 -8
  104. package/dist/core/keybindings/index.d.ts +1 -0
  105. package/dist/core/keybindings/index.js +1 -0
  106. package/dist/core/keybindings/types.d.ts +1 -1
  107. package/dist/core/preview-registry.js +41 -74
  108. package/dist/core/runtime/bearings.d.ts +2 -5
  109. package/dist/core/runtime/bearings.js +2 -5
  110. package/dist/core/runtime/broker.js +3 -2
  111. package/dist/core/runtime/front-door.d.ts +1 -1
  112. package/dist/core/runtime/front-door.js +2 -2
  113. package/dist/core/runtime/kickoff.d.ts +3 -3
  114. package/dist/core/runtime/kickoff.js +4 -3
  115. package/dist/core/runtime/lifecycle.js +2 -2
  116. package/dist/core/runtime/situational-context.d.ts +1 -1
  117. package/dist/core/runtime/situational-context.js +1 -1
  118. package/dist/core/runtime/spawn.js +9 -9
  119. package/dist/core/runtime/tmux.js +29 -2
  120. package/dist/core/scope.d.ts +0 -5
  121. package/dist/core/scope.js +0 -10
  122. package/dist/core/user-settings.d.ts +193 -0
  123. package/dist/core/user-settings.js +252 -0
  124. package/dist/index.d.ts +4 -0
  125. package/dist/index.js +3 -0
  126. package/dist/pi-extensions/canvas-stophook.js +3 -2
  127. package/dist/prompts/review.js +4 -2
  128. package/dist/shared/generated-context.d.ts +34 -0
  129. package/dist/shared/generated-context.js +98 -0
  130. package/dist/types.d.ts +23 -16
  131. package/dist/types.js +3 -14
  132. package/dist/web-client/assets/index-BgLGlZ3D.css +2 -0
  133. package/dist/web-client/assets/{index-NIuSCOHM.js → index-CmoNqcCv.js} +19 -19
  134. package/dist/web-client/index.html +2 -2
  135. package/dist/web-client/sw.js +1 -1
  136. package/docs/public-api.md +1 -0
  137. package/package.json +1 -1
  138. package/runtime.lock.json +2 -2
  139. package/dist/builtin-memory/05-kinds/product/00-base.md +0 -25
  140. package/dist/builtin-memory/05-kinds/product/01-orchestrator.md +0 -15
  141. package/dist/builtin-memory/05-kinds/product/teardown.md +0 -15
  142. package/dist/builtin-memory/internal/workflow-codification.md +0 -82
  143. package/dist/builtin-memory/product.md +0 -80
  144. package/dist/clients/attach/render/frozen-history.js +0 -100
  145. package/dist/commands/pkg/cli-inspect.d.ts +0 -17
  146. package/dist/commands/pkg/cli-inspect.js +0 -190
  147. package/dist/commands/pkg/cli-manage.d.ts +0 -3
  148. package/dist/commands/pkg/cli-manage.js +0 -206
  149. package/dist/commands/pkg/cli.d.ts +0 -1
  150. package/dist/commands/pkg/cli.js +0 -14
  151. package/dist/core/configured-clis/cache.d.ts +0 -16
  152. package/dist/core/configured-clis/cache.js +0 -57
  153. package/dist/core/configured-clis/compose.d.ts +0 -14
  154. package/dist/core/configured-clis/compose.js +0 -60
  155. package/dist/core/configured-clis/discovery.d.ts +0 -47
  156. package/dist/core/configured-clis/discovery.js +0 -173
  157. package/dist/core/configured-clis/manifest.d.ts +0 -24
  158. package/dist/core/configured-clis/registration.d.ts +0 -40
  159. package/dist/core/configured-clis/registration.js +0 -201
  160. package/dist/web-client/assets/index-CqLKj8Xu.css +0 -2
@@ -0,0 +1,157 @@
1
+ // session/profile-files.ts — fuzzy file search across a node's local profile.
2
+ //
3
+ // The popup searches the current workspace plus every project named by the
4
+ // node's profile manifest. Ancestor `.crouter/memory/` stores are added with
5
+ // ignore rules disabled, so project memory remains findable even when a parent
6
+ // ignore file hides `.crouter/`. fzf owns selection and nvim owns viewing; the
7
+ // attach viewer only resolves the relevant roots and wires the two popups.
8
+ import { constants, accessSync, existsSync, mkdtempSync, readFileSync, rmSync, statSync } from 'node:fs';
9
+ import { tmpdir } from 'node:os';
10
+ import { delimiter, dirname, join, resolve, sep } from 'node:path';
11
+ import { execFile, spawnSync } from 'node:child_process';
12
+ import { loadProfileManifest } from '../../../core/profiles/manifest.js';
13
+ import { shellQuote } from '../../../core/runtime/placement-tmux.js';
14
+ import { surfaceTmuxStyleArgs } from '../../../core/runtime/surface-bg.js';
15
+ function isDirectory(path) {
16
+ try {
17
+ return statSync(path).isDirectory();
18
+ }
19
+ catch {
20
+ return false;
21
+ }
22
+ }
23
+ function executableCandidates(name, preferred) {
24
+ const candidates = [
25
+ ...(preferred === undefined || preferred === null ? [] : [preferred]),
26
+ ...(process.env['PATH'] ?? '').split(delimiter).filter(Boolean).map((dir) => join(dir, name)),
27
+ ];
28
+ return [...new Set(candidates)];
29
+ }
30
+ /** Return the first PATH candidate that can actually execute. Checking only
31
+ * X_OK is insufficient when a managed tool cache contains a binary for a
32
+ * different host platform. This runs only when the user opens the search. */
33
+ function workingExecutable(name, preferred) {
34
+ for (const candidate of executableCandidates(name, preferred)) {
35
+ try {
36
+ accessSync(candidate, constants.X_OK);
37
+ }
38
+ catch {
39
+ continue;
40
+ }
41
+ const probe = spawnSync(candidate, ['--version'], { stdio: 'ignore' });
42
+ if (probe.status === 0)
43
+ return candidate;
44
+ }
45
+ return null;
46
+ }
47
+ function profileProjectDirs(profileId) {
48
+ if (profileId === null || profileId === '')
49
+ return [];
50
+ try {
51
+ return loadProfileManifest(profileId).manifest.projects;
52
+ }
53
+ catch {
54
+ return [];
55
+ }
56
+ }
57
+ function dedupeExistingDirs(paths) {
58
+ const seen = new Set();
59
+ const out = [];
60
+ for (const path of paths) {
61
+ const absolute = resolve(path);
62
+ if (seen.has(absolute) || !isDirectory(absolute))
63
+ continue;
64
+ seen.add(absolute);
65
+ out.push(absolute);
66
+ }
67
+ return out;
68
+ }
69
+ /** Keep only the outermost search roots. An outer profile project already
70
+ * covers a cwd or another project nested beneath it, and avoiding the second
71
+ * fd walk keeps every candidate unique without a separate dedupe process. */
72
+ function outermostDirs(paths) {
73
+ return paths.filter((path) => !paths.some((other) => other !== path && path.startsWith(other + sep)));
74
+ }
75
+ /** Every existing `<ancestor>/.crouter/memory/` from each pointer through the
76
+ * filesystem root. A dedicated no-ignore fd pass guarantees these files are
77
+ * present even when the wider project scan respects an ignore rule. */
78
+ function ancestorMemoryDirs(pointers) {
79
+ const found = [];
80
+ for (const pointer of pointers) {
81
+ let cursor = resolve(pointer);
82
+ for (;;) {
83
+ const memory = join(cursor, '.crouter', 'memory');
84
+ if (isDirectory(memory))
85
+ found.push(memory);
86
+ const parent = dirname(cursor);
87
+ if (parent === cursor)
88
+ break;
89
+ cursor = parent;
90
+ }
91
+ }
92
+ return dedupeExistingDirs(found);
93
+ }
94
+ function selectionPath(path) {
95
+ try {
96
+ const bytes = readFileSync(path);
97
+ if (bytes.length === 0)
98
+ return null;
99
+ const end = bytes[bytes.length - 1] === 0 ? bytes.length - 1 : bytes.length;
100
+ return bytes.subarray(0, end).toString('utf8') || null;
101
+ }
102
+ catch {
103
+ return null;
104
+ }
105
+ }
106
+ export function launchProfileFileSearch(opts) {
107
+ const fd = workingExecutable('fd', opts.fdPath);
108
+ if (fd === null) {
109
+ opts.onNotice('fd is required for profile file search');
110
+ return;
111
+ }
112
+ const fzf = workingExecutable('fzf');
113
+ if (fzf === null) {
114
+ opts.onNotice('fzf is required for profile file search');
115
+ return;
116
+ }
117
+ const nvim = workingExecutable('nvim');
118
+ if (nvim === null) {
119
+ opts.onNotice('Neovim is required for profile file search');
120
+ return;
121
+ }
122
+ const pointers = dedupeExistingDirs([opts.cwd, ...profileProjectDirs(opts.profileId)]);
123
+ if (pointers.length === 0) {
124
+ opts.onNotice('No profile file-search directories exist');
125
+ return;
126
+ }
127
+ const roots = outermostDirs(pointers);
128
+ const memoryDirs = ancestorMemoryDirs(pointers);
129
+ const tempDir = mkdtempSync(join(tmpdir(), 'crtr-profile-files-'));
130
+ const selected = join(tempDir, 'selection');
131
+ const scans = [
132
+ ...roots.map((root) => `${shellQuote(fd)} --type f --hidden --exclude .git --exclude ${shellQuote('**/.crouter/memory/**')} --print0 . ${shellQuote(root)}`),
133
+ ...memoryDirs.map((memory) => `${shellQuote(fd)} --type f --hidden --exclude .git --no-ignore --print0 . ${shellQuote(memory)}`),
134
+ ];
135
+ const command = `{ ${scans.map((scan) => `${scan} &`).join(' ')} wait; } | ${shellQuote(fzf)} --read0 --print0 --preview ${shellQuote('head -100 -- {}')} > ${shellQuote(selected)}`;
136
+ try {
137
+ execFile('tmux', ['display-popup', '-E', '-T', ' profile files ', '-w', '80%', '-h', '60%', ...surfaceTmuxStyleArgs(), command], () => {
138
+ const file = selectionPath(selected);
139
+ if (file === null || !existsSync(file)) {
140
+ rmSync(tempDir, { recursive: true, force: true });
141
+ return;
142
+ }
143
+ const open = `exec ${shellQuote(nvim)} -- ${shellQuote(file)}`;
144
+ try {
145
+ execFile('tmux', ['display-popup', '-E', '-T', ' profile file ', '-w', '90%', '-h', '90%', ...surfaceTmuxStyleArgs(), open], () => rmSync(tempDir, { recursive: true, force: true }));
146
+ }
147
+ catch (err) {
148
+ rmSync(tempDir, { recursive: true, force: true });
149
+ opts.onNotice(`Could not open profile file: ${err instanceof Error ? err.message : String(err)}`);
150
+ }
151
+ });
152
+ }
153
+ catch (err) {
154
+ rmSync(tempDir, { recursive: true, force: true });
155
+ opts.onNotice(`Could not open profile file search: ${err instanceof Error ? err.message : String(err)}`);
156
+ }
157
+ }