@crouton-kit/crouter 0.3.20 → 0.3.22

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 (144) hide show
  1. package/dist/builtin-memory/crouter-development/marketplaces.md +2 -4
  2. package/dist/builtin-memory/crouter-development/personas/base-prompt.md +3 -5
  3. package/dist/builtin-memory/crouter-development/personas/orchestrator-prompt.md +3 -6
  4. package/dist/builtin-memory/crouter-development/personas.md +2 -6
  5. package/dist/builtin-memory/crouter-development/plugins.md +2 -4
  6. package/dist/builtin-memory/design.md +2 -4
  7. package/dist/builtin-memory/development.md +3 -3
  8. package/dist/builtin-memory/planning.md +3 -4
  9. package/dist/builtin-memory/spec.md +3 -10
  10. package/dist/builtin-personas/orchestration-kernel.md +1 -1
  11. package/dist/commands/canvas-history/read.d.ts +1 -0
  12. package/dist/commands/canvas-history/read.js +61 -0
  13. package/dist/commands/canvas-history/search.d.ts +1 -0
  14. package/dist/commands/canvas-history/search.js +270 -0
  15. package/dist/commands/canvas-history/show.d.ts +1 -0
  16. package/dist/commands/canvas-history/show.js +79 -0
  17. package/dist/commands/canvas-history.d.ts +2 -0
  18. package/dist/commands/canvas-history.js +33 -0
  19. package/dist/commands/canvas.js +3 -2
  20. package/dist/commands/human/queue.js +2 -2
  21. package/dist/commands/memory/__tests__/lint-schema.test.js +29 -0
  22. package/dist/commands/memory/find.js +14 -52
  23. package/dist/commands/memory/lint.d.ts +7 -0
  24. package/dist/commands/memory/lint.js +29 -35
  25. package/dist/commands/memory/list.js +8 -18
  26. package/dist/commands/memory/read.js +4 -37
  27. package/dist/commands/memory/shared.js +1 -2
  28. package/dist/commands/memory/write.js +6 -9
  29. package/dist/commands/node.js +47 -25
  30. package/dist/commands/pkg/bridge.d.ts +1 -0
  31. package/dist/commands/pkg/bridge.js +137 -0
  32. package/dist/commands/pkg/plugin-inspect.js +7 -6
  33. package/dist/commands/pkg.js +2 -1
  34. package/dist/commands/push.js +10 -15
  35. package/dist/commands/skill/author.js +35 -44
  36. package/dist/commands/skill/shared.d.ts +1 -5
  37. package/dist/commands/skill/shared.js +9 -63
  38. package/dist/commands/skill.js +5 -6
  39. package/dist/commands/sys/doctor.js +6 -144
  40. package/dist/commands/tmux-spread.js +16 -1
  41. package/dist/commands/view-cycle.js +9 -5
  42. package/dist/commands/view-run.js +3 -2
  43. package/dist/core/__tests__/broker-dormant-wake.test.js +71 -34
  44. package/dist/core/__tests__/canvas-inbox-watcher-hold.test.js +21 -5
  45. package/dist/core/__tests__/canvas-inbox-watcher.test.js +21 -5
  46. package/dist/core/__tests__/child-death-wake.test.js +133 -185
  47. package/dist/core/__tests__/context-intro.test.js +23 -27
  48. package/dist/core/__tests__/daemon-liveness.test.js +28 -258
  49. package/dist/core/__tests__/flagship-lifecycle.test.js +156 -135
  50. package/dist/core/__tests__/frame-decoder-perf.test.js +51 -25
  51. package/dist/core/__tests__/{broker-attach-limits.test.js → full/broker-attach-limits.test.js} +62 -35
  52. package/dist/core/__tests__/{broker-attach-stream.test.js → full/broker-attach-stream.test.js} +54 -31
  53. package/dist/core/__tests__/full/broker-crash-teardown.test.js +143 -0
  54. package/dist/core/__tests__/full/broker-dialogs.test.js +153 -0
  55. package/dist/core/__tests__/full/broker-lifecycle.test.js +116 -0
  56. package/dist/core/__tests__/{cascade-close.test.js → full/cascade-close.test.js} +4 -3
  57. package/dist/core/__tests__/full/daemon-liveness-pane.full.test.js +292 -0
  58. package/dist/core/__tests__/{dead-pane-regression.test.js → full/dead-pane-regression.test.js} +2 -2
  59. package/dist/core/__tests__/{detach-focus.test.js → full/detach-focus.test.js} +7 -7
  60. package/dist/core/__tests__/{human-new-window-regression.test.js → full/human-new-window-regression.test.js} +2 -2
  61. package/dist/core/__tests__/{placement-focus.test.js → full/placement-focus.test.js} +5 -5
  62. package/dist/core/__tests__/{placement-reconcile.test.js → full/placement-reconcile.test.js} +3 -3
  63. package/dist/core/__tests__/{placement-revive.test.js → full/placement-revive.test.js} +5 -5
  64. package/dist/core/__tests__/{placement-teardown.test.js → full/placement-teardown.test.js} +4 -4
  65. package/dist/core/__tests__/{review-render-pane-regression.test.js → full/review-render-pane-regression.test.js} +2 -2
  66. package/dist/core/__tests__/full/spike-harness.test.d.ts +1 -0
  67. package/dist/core/__tests__/full/spike-harness.test.js +117 -0
  68. package/dist/core/__tests__/grace-clock.test.js +72 -75
  69. package/dist/core/__tests__/helpers/harness.d.ts +35 -1
  70. package/dist/core/__tests__/helpers/harness.js +70 -12
  71. package/dist/core/__tests__/live-mutation-verbs.test.js +100 -105
  72. package/dist/core/__tests__/live-mutation.test.js +111 -134
  73. package/dist/core/__tests__/memory.test.js +4 -4
  74. package/dist/core/__tests__/revive.test.js +96 -86
  75. package/dist/core/__tests__/subscription-delivery.test.js +116 -138
  76. package/dist/core/__tests__/wake-origin.test.js +54 -50
  77. package/dist/core/bootstrap.js +18 -14
  78. package/dist/core/bridge-map.d.ts +19 -0
  79. package/dist/core/bridge-map.js +73 -0
  80. package/dist/core/canvas/history.d.ts +91 -0
  81. package/dist/core/canvas/history.js +389 -0
  82. package/dist/core/canvas/index.d.ts +1 -0
  83. package/dist/core/canvas/index.js +1 -0
  84. package/dist/core/config.js +3 -22
  85. package/dist/core/help.d.ts +2 -2
  86. package/dist/core/help.js +1 -1
  87. package/dist/core/memory-resolver.d.ts +9 -2
  88. package/dist/core/memory-resolver.js +47 -7
  89. package/dist/core/render.d.ts +4 -3
  90. package/dist/core/render.js +38 -41
  91. package/dist/core/resolver.d.ts +1 -30
  92. package/dist/core/resolver.js +6 -546
  93. package/dist/core/runtime/bearings.d.ts +2 -2
  94. package/dist/core/runtime/bearings.js +2 -2
  95. package/dist/core/runtime/persona.js +5 -7
  96. package/dist/core/scope.d.ts +7 -5
  97. package/dist/core/scope.js +16 -17
  98. package/dist/core/substrate/ceiling.d.ts +28 -0
  99. package/dist/core/substrate/ceiling.js +87 -0
  100. package/dist/core/substrate/index.d.ts +2 -0
  101. package/dist/core/substrate/index.js +1 -0
  102. package/dist/core/substrate/on-read.js +18 -2
  103. package/dist/core/substrate/render.d.ts +3 -5
  104. package/dist/core/substrate/render.js +68 -59
  105. package/dist/core/substrate/schema.d.ts +18 -13
  106. package/dist/core/substrate/schema.js +12 -11
  107. package/dist/pi-extensions/canvas-context-intro.js +5 -3
  108. package/dist/pi-extensions/canvas-inbox-watcher.js +19 -2
  109. package/dist/types.d.ts +3 -18
  110. package/dist/types.js +0 -8
  111. package/package.json +4 -3
  112. package/dist/builtin-skills/.crouter-plugin/plugin.json +0 -5
  113. package/dist/builtin-skills/skills/crouter-development/marketplaces/SKILL.md +0 -157
  114. package/dist/builtin-skills/skills/crouter-development/personas/SKILL.md +0 -106
  115. package/dist/builtin-skills/skills/crouter-development/personas/base-prompt/SKILL.md +0 -49
  116. package/dist/builtin-skills/skills/crouter-development/personas/orchestrator-prompt/SKILL.md +0 -49
  117. package/dist/builtin-skills/skills/crouter-development/plugins/SKILL.md +0 -156
  118. package/dist/builtin-skills/skills/design/SKILL.md +0 -51
  119. package/dist/builtin-skills/skills/development/SKILL.md +0 -109
  120. package/dist/builtin-skills/skills/planning/SKILL.md +0 -59
  121. package/dist/builtin-skills/skills/spec/SKILL.md +0 -83
  122. package/dist/commands/skill/state.d.ts +0 -3
  123. package/dist/commands/skill/state.js +0 -71
  124. package/dist/core/__tests__/broker-crash-teardown.test.js +0 -116
  125. package/dist/core/__tests__/broker-dialogs.test.js +0 -126
  126. package/dist/core/__tests__/broker-lifecycle.test.js +0 -87
  127. package/dist/core/__tests__/resolver.test.js +0 -181
  128. package/dist/core/__tests__/spike-harness.test.js +0 -242
  129. /package/dist/{core/__tests__/broker-attach-limits.test.d.ts → commands/memory/__tests__/lint-schema.test.d.ts} +0 -0
  130. /package/dist/core/__tests__/{broker-attach-stream.test.d.ts → full/broker-attach-limits.test.d.ts} +0 -0
  131. /package/dist/core/__tests__/{broker-crash-teardown.test.d.ts → full/broker-attach-stream.test.d.ts} +0 -0
  132. /package/dist/core/__tests__/{broker-dialogs.test.d.ts → full/broker-crash-teardown.test.d.ts} +0 -0
  133. /package/dist/core/__tests__/{broker-lifecycle.test.d.ts → full/broker-dialogs.test.d.ts} +0 -0
  134. /package/dist/core/__tests__/{cascade-close.test.d.ts → full/broker-lifecycle.test.d.ts} +0 -0
  135. /package/dist/core/__tests__/{dead-pane-regression.test.d.ts → full/cascade-close.test.d.ts} +0 -0
  136. /package/dist/core/__tests__/{detach-focus.test.d.ts → full/daemon-liveness-pane.full.test.d.ts} +0 -0
  137. /package/dist/core/__tests__/{human-new-window-regression.test.d.ts → full/dead-pane-regression.test.d.ts} +0 -0
  138. /package/dist/core/__tests__/{placement-focus.test.d.ts → full/detach-focus.test.d.ts} +0 -0
  139. /package/dist/core/__tests__/{placement-reconcile.test.d.ts → full/human-new-window-regression.test.d.ts} +0 -0
  140. /package/dist/core/__tests__/{placement-revive.test.d.ts → full/placement-focus.test.d.ts} +0 -0
  141. /package/dist/core/__tests__/{placement-teardown.test.d.ts → full/placement-reconcile.test.d.ts} +0 -0
  142. /package/dist/core/__tests__/{resolver.test.d.ts → full/placement-revive.test.d.ts} +0 -0
  143. /package/dist/core/__tests__/{review-render-pane-regression.test.d.ts → full/placement-teardown.test.d.ts} +0 -0
  144. /package/dist/core/__tests__/{spike-harness.test.d.ts → full/review-render-pane-regression.test.d.ts} +0 -0
@@ -1,14 +1,18 @@
1
1
  // Default stdout rendering: the result a leaf returns is written FOR the model
2
2
  // to act on, not as data to parse. Output is a continuation of the agent's
3
- // prompt — light XML fences around markdown, prose where prose belongs. The
4
- // raw JSON object is still available behind the `--json` global for tooling.
3
+ // prompt — PLAIN MARKDOWN, no XML wrapper. Scalars list as `- name: value`
4
+ // bullets in output-schema order, prose fields render as paragraphs, and arrays
5
+ // become a count lead-in plus a markdown table (objects) or bullets (scalars).
6
+ // The raw JSON object is still available behind the `--json` global for tooling.
5
7
  //
6
8
  // A leaf may hand `defineLeaf` a bespoke `render(result)` for instruction-shaped
7
- // output (see `node new`, `push`, `feed read`). Everything else falls through to
8
- // the schema-driven generic renderer here, so every command obeys the paradigm
9
- // without a hand-written renderer.
9
+ // output that leads with the outcome (see `node new`, `push`, `feed read`).
10
+ // Everything else falls through to the schema-driven generic renderer here, so
11
+ // every command obeys the markdown paradigm without a hand-written renderer.
12
+ // `renderError` is the one sanctioned exception: a failure is a different domain
13
+ // from a result, so it keeps its `<error>` block.
10
14
  // Field names whose value is prose the agent reads, not a scalar it keys on —
11
- // these always render as their own fenced block, never as a tag attribute.
15
+ // these always render as their own paragraph, never as a `- name: value` bullet.
12
16
  const PROSE_FIELDS = new Set([
13
17
  'follow_up', 'digest', 'message', 'next', 'result', 'content', 'body', 'guide',
14
18
  'summary', 'note', 'reason', 'detail', 'details', 'hint', 'instruction',
@@ -37,20 +41,17 @@ function isProse(name, v) {
37
41
  return true;
38
42
  return v.includes('\n') || v.length > 80;
39
43
  }
40
- /** Short, space-free scalars ride as attributes on the open tag (ids, statuses,
41
- * counts); everything else that isn't prose lists as a markdown bullet. */
42
- function isAttr(v) {
43
- if (typeof v === 'number' || typeof v === 'boolean')
44
- return true;
45
- return typeof v === 'string' && v.length <= 40 && !v.includes(' ') && !v.includes('\n');
46
- }
47
- /** Root element name = the command path with spaces hyphenated. */
48
- function rootTag(help) {
49
- return help.name.trim().split(/\s+/).join('-').replace(/[^a-zA-Z0-9_-]/g, '') || 'result';
44
+ /** Keep a value safe inside a markdown table cell: pipes would split columns,
45
+ * newlines would break the row. */
46
+ function cellEsc(v) {
47
+ return scalarStr(v).replace(/\|/g, '\\|').replace(/\n/g, ' ');
50
48
  }
49
+ /** An array renders as a count lead-in followed by the collection: a markdown
50
+ * table when every element is an object, plain bullets otherwise. */
51
51
  function renderArray(name, arr) {
52
52
  if (arr.length === 0)
53
- return `<${name} count="0"></${name}>`;
53
+ return `0 ${name}.`;
54
+ const lead = `${arr.length} ${name}:`;
54
55
  const allObjects = arr.every((x) => x !== null && typeof x === 'object' && !Array.isArray(x));
55
56
  if (allObjects) {
56
57
  const rows = arr;
@@ -61,55 +62,51 @@ function renderArray(name, arr) {
61
62
  cols.push(k);
62
63
  const head = `| ${cols.join(' | ')} |`;
63
64
  const sep = `| ${cols.map(() => '---').join(' | ')} |`;
64
- const body = rows.map((r) => `| ${cols.map((c) => scalarStr(r[c])).join(' | ')} |`).join('\n');
65
- return `<${name} count="${arr.length}">\n${head}\n${sep}\n${body}\n</${name}>`;
65
+ const body = rows.map((r) => `| ${cols.map((c) => cellEsc(r[c])).join(' | ')} |`).join('\n');
66
+ return `${lead}\n\n${head}\n${sep}\n${body}`;
66
67
  }
67
68
  const items = arr.map((x) => `- ${scalarStr(x)}`).join('\n');
68
- return `<${name} count="${arr.length}">\n${items}\n</${name}>`;
69
+ return `${lead}\n${items}`;
69
70
  }
70
- /** Schema-driven fallback: turn a result object into agent-ready XML+markdown.
71
+ /** Schema-driven fallback: turn a result object into agent-ready plain markdown.
71
72
  * Field order follows the leaf's declared output schema; any extra keys append
72
- * after. Scalars become attributes or a bullet list, prose and collections
73
- * become their own fenced blocks. */
73
+ * after. Scalars (and nested objects) list as `- name: value` bullets, prose
74
+ * fields render as paragraphs, and arrays become a count lead-in plus a table
75
+ * or bullets. No root tag — the result is read as a continuation of the prompt. */
74
76
  export function renderResult(result, help) {
75
77
  const order = help.output.map((f) => f.name);
76
78
  for (const k of Object.keys(result))
77
79
  if (!order.includes(k))
78
80
  order.push(k);
79
- const attrs = [];
80
81
  const bullets = [];
81
- const blocks = [];
82
+ const proseFields = [];
83
+ const arrays = [];
82
84
  for (const name of order) {
83
85
  const v = result[name];
84
86
  if (v === undefined || v === null)
85
87
  continue;
86
88
  if (Array.isArray(v)) {
87
- blocks.push(renderArray(name, v));
88
- continue;
89
- }
90
- if (typeof v === 'object') {
91
- blocks.push(`<${name}>\n${JSON.stringify(v, null, 2)}\n</${name}>`);
89
+ arrays.push(renderArray(name, v));
92
90
  continue;
93
91
  }
94
92
  if (isProse(name, v)) {
95
- blocks.push(`<${name}>\n${v}\n</${name}>`);
96
- continue;
97
- }
98
- if (isAttr(v)) {
99
- attrs.push(`${name}="${attrEsc(v)}"`);
93
+ proseFields.push({ name, text: v });
100
94
  continue;
101
95
  }
96
+ // Scalars and nested objects alike list as a bullet (objects via compact JSON).
102
97
  bullets.push(`- ${name}: ${scalarStr(v)}`);
103
98
  }
104
- const tag = rootTag(help);
105
- const open = attrs.length > 0 ? `<${tag} ${attrs.join(' ')}>` : `<${tag}>`;
106
99
  const parts = [];
107
100
  if (bullets.length > 0)
108
101
  parts.push(bullets.join('\n'));
109
- if (blocks.length > 0)
110
- parts.push(blocks.join('\n\n'));
111
- const inner = parts.join('\n\n');
112
- return inner !== '' ? `${open}\n${inner}\n</${tag}>` : `${open}</${tag}>`;
102
+ // Label prose only when more than one block would otherwise blur together.
103
+ const labelProse = proseFields.length > 1;
104
+ for (const { name, text } of proseFields) {
105
+ parts.push(labelProse ? `**${name}:** ${text}` : text);
106
+ }
107
+ for (const block of arrays)
108
+ parts.push(block);
109
+ return parts.join('\n\n');
113
110
  }
114
111
  /** Render a structured failure as an instruction-shaped block: what broke, what
115
112
  * was received, and the recovery road sign — the same recovery info the JSON
@@ -1,25 +1,7 @@
1
- import type { InstalledMarketplace, InstalledPlugin, Scope, ScopeConfig, Skill } from '../types.js';
1
+ import type { InstalledMarketplace, InstalledPlugin, Scope } from '../types.js';
2
2
  export declare function listInstalledPlugins(scope: Scope): InstalledPlugin[];
3
3
  export declare function listAllPlugins(): InstalledPlugin[];
4
4
  export declare function findPluginByName(name: string, scope?: Scope): InstalledPlugin | null;
5
- interface ScopeConfigs {
6
- project?: ScopeConfig;
7
- user: ScopeConfig;
8
- }
9
- export declare function effectiveSkillEnabled(pluginName: string, skillName: string, cfgs: ScopeConfigs): {
10
- enabled: boolean;
11
- disabledIn?: Scope;
12
- };
13
- export declare function listSkillsInPlugin(plugin: InstalledPlugin, cfgs?: ScopeConfigs): Skill[];
14
- export declare function listScopeRootSkills(scope: Scope, cfgs?: ScopeConfigs): Skill[];
15
- export declare function listAllSkills(scopeFilter?: Scope): Skill[];
16
- export declare function listSkillSiblings(skill: Skill): Skill[];
17
- export declare function listSkillChildren(skill: Skill): Skill[];
18
- export interface SkillResolutionOpts {
19
- scope?: Scope;
20
- pluginFilter?: string;
21
- }
22
- export declare function resolveSkill(rawName: string, opts?: SkillResolutionOpts): Skill;
23
5
  export interface ParsedSkillQualifier {
24
6
  scope?: Scope;
25
7
  segments: string[];
@@ -28,15 +10,4 @@ export declare function parseSkillQualifier(raw: string): ParsedSkillQualifier;
28
10
  export declare function listInstalledMarketplaces(scope: Scope): InstalledMarketplace[];
29
11
  export declare function listAllMarketplaces(): InstalledMarketplace[];
30
12
  export declare function findMarketplaceByName(name: string, scope?: Scope): InstalledMarketplace | null;
31
- export interface CategoryResolution {
32
- id: string;
33
- plugin: string | undefined;
34
- scope: Scope | undefined;
35
- dir: string;
36
- indexPath: string | undefined;
37
- skills: Skill[];
38
- }
39
- export declare function resolveCategory(name: string, opts?: SkillResolutionOpts): CategoryResolution | null;
40
- export declare function buildCategoryIndex(cat: CategoryResolution): string;
41
13
  export declare function scopeRootsLabel(): string;
42
- export {};