@north-light/crouter 0.3.217 → 0.3.219

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 (74) hide show
  1. package/dist/api/client.d.ts +5 -2
  2. package/dist/api/client.js +7 -1
  3. package/dist/api/dto/canvas.d.ts +9 -0
  4. package/dist/api/dto/nodes.d.ts +27 -1
  5. package/dist/builtin-memory/04-base-worker.md +7 -1
  6. package/dist/builtin-memory/internal/plugins.md +67 -0
  7. package/dist/builtin-memory/memory-read-orientation.md +13 -0
  8. package/dist/clients/attach/chrome/bash-jobs.js +1 -1
  9. package/dist/clients/attach/photon_rs_bg.wasm +0 -0
  10. package/dist/clients/attach/viewer.js +478 -478
  11. package/dist/commands/human/shared.js +1 -1
  12. package/dist/commands/memory/edit.js +6 -1
  13. package/dist/commands/memory/lint.d.ts +1 -6
  14. package/dist/commands/memory/lint.js +18 -126
  15. package/dist/commands/memory/list.d.ts +1 -0
  16. package/dist/commands/memory/list.js +17 -2
  17. package/dist/commands/memory/read.js +15 -6
  18. package/dist/commands/memory/shared.d.ts +32 -2
  19. package/dist/commands/memory/shared.js +179 -0
  20. package/dist/commands/memory/write.js +6 -1
  21. package/dist/commands/pkg/browse/catalog.js +2 -0
  22. package/dist/commands/pkg/browse/model.d.ts +4 -1
  23. package/dist/commands/pkg/plugin-manage.js +209 -148
  24. package/dist/core/bash-jobs.d.ts +2 -5
  25. package/dist/core/bash-jobs.js +4 -8
  26. package/dist/core/command-plugins/bundle.d.ts +4 -1
  27. package/dist/core/command-plugins/bundle.js +16 -2
  28. package/dist/core/human/component-docs.js +1 -0
  29. package/dist/core/human/scan.d.ts +5 -4
  30. package/dist/core/human/scan.js +7 -4
  31. package/dist/core/io.js +3 -2
  32. package/dist/core/manifest.d.ts +2 -0
  33. package/dist/core/manifest.js +5 -0
  34. package/dist/core/memory/extensions.d.ts +30 -0
  35. package/dist/core/memory/extensions.js +219 -0
  36. package/dist/core/preview-result-path.d.ts +4 -0
  37. package/dist/core/preview-result-path.js +25 -0
  38. package/dist/core/runtime/launch-config-worker.d.ts +1 -0
  39. package/dist/core/runtime/launch-config-worker.js +12 -0
  40. package/dist/core/runtime/launch.d.ts +16 -2
  41. package/dist/core/runtime/launch.js +55 -21
  42. package/dist/core/runtime/promote.d.ts +20 -2
  43. package/dist/core/runtime/promote.js +63 -59
  44. package/dist/core/runtime/recycle.js +2 -2
  45. package/dist/core/runtime/reset.js +2 -2
  46. package/dist/core/runtime/spawn.js +3 -3
  47. package/dist/core/runtime/warm-pool.js +9 -7
  48. package/dist/core/substrate/frontmatter-validation.d.ts +13 -0
  49. package/dist/core/substrate/frontmatter-validation.js +101 -0
  50. package/dist/core/substrate/index.d.ts +1 -0
  51. package/dist/core/substrate/index.js +1 -0
  52. package/dist/daemon/api/__tests__/bridge-heartbeat.test.d.ts +1 -0
  53. package/dist/daemon/api/__tests__/bridge-heartbeat.test.js +30 -0
  54. package/dist/daemon/api/__tests__/nodes-activity-query.test.d.ts +1 -0
  55. package/dist/daemon/api/__tests__/nodes-activity-query.test.js +101 -0
  56. package/dist/daemon/api/__tests__/seam/api-server.test.js +30 -0
  57. package/dist/daemon/api/bridge.d.ts +6 -0
  58. package/dist/daemon/api/bridge.js +39 -2
  59. package/dist/daemon/api/handlers/canvas.js +3 -0
  60. package/dist/daemon/api/handlers/inbox.js +4 -3
  61. package/dist/daemon/api/handlers/nodes.d.ts +1 -0
  62. package/dist/daemon/api/handlers/nodes.js +117 -36
  63. package/dist/daemon/api/handlers/reports.d.ts +4 -0
  64. package/dist/daemon/api/handlers/reports.js +14 -8
  65. package/dist/daemon/crtrd.js +7 -5
  66. package/dist/daemon/manage.d.ts +3 -0
  67. package/dist/daemon/manage.js +14 -0
  68. package/dist/pi-extensions/canvas-bash-valve.d.ts +4 -3
  69. package/dist/pi-extensions/canvas-bash-valve.js +19 -6
  70. package/dist/pi-extensions/canvas-preview-result.d.ts +0 -8
  71. package/dist/pi-extensions/canvas-preview-result.js +9 -23
  72. package/dist/types.d.ts +31 -0
  73. package/package.json +1 -1
  74. package/runtime.lock.json +2 -2
@@ -1,13 +1,13 @@
1
1
  // canvas-preview-result.ts — private structured result transport for crtr bash calls.
2
2
  //
3
3
  // A crtr leaf returns a record, but the CLI normally renders that record to
4
- // stdout for the agent. stdout is model context, so this hook assigns every
5
- // bash call a private file, lets crtr atomically mirror its record there, then
6
- // attaches the record to Pi's ToolResult.details. The attach viewer can render
7
- // a structured preview without parsing the agent-facing text.
8
- import { existsSync, mkdirSync, readFileSync, rmSync } from 'node:fs';
9
- import { tmpdir } from 'node:os';
10
- import { join } from 'node:path';
4
+ // stdout for the agent. stdout is model context, so the bash valve hands every
5
+ // bash call a private file path in the child environment, crtr atomically
6
+ // mirrors its record there, and this hook attaches the record to Pi's
7
+ // ToolResult.details. The attach viewer can render a structured preview
8
+ // without parsing the agent-facing text.
9
+ import { existsSync, readFileSync, rmSync } from 'node:fs';
10
+ import { previewResultPath } from '../core/preview-result-path.js';
11
11
  function isPreviewRecord(value) {
12
12
  if (value === null || typeof value !== 'object' || typeof value['path'] !== 'string')
13
13
  return false;
@@ -21,24 +21,10 @@ function isPreviewRecord(value) {
21
21
  export function registerCanvasPreviewResult(pi) {
22
22
  if (process.env['CRTR_NODE_ID'] === undefined || process.env['CRTR_NODE_ID'] === '')
23
23
  return;
24
- const directory = join(tmpdir(), 'crouter-preview-results');
25
- const paths = new Map();
26
- pi.on('tool_call', (event) => {
27
- if (event.toolName !== 'bash' || typeof event.input.command !== 'string')
28
- return;
29
- mkdirSync(directory, { recursive: true });
30
- const path = join(directory, `${encodeURIComponent(event.toolCallId)}.json`);
31
- paths.set(event.toolCallId, path);
32
- // Export before the complete script rather than prefixing its first simple
33
- // command: agent bash calls routinely start with `cd … &&`, a compound
34
- // statement, or setup commands before crtr itself.
35
- event.input.command = `export CRTR_PREVIEW_RESULT_PATH=${JSON.stringify(path)}\n${event.input.command}`;
36
- });
37
24
  pi.on('tool_result', (event) => {
38
- const path = paths.get(event.toolCallId);
39
- if (path === undefined)
25
+ if (event.toolName !== 'bash')
40
26
  return;
41
- paths.delete(event.toolCallId);
27
+ const path = previewResultPath(event.toolCallId);
42
28
  if (!existsSync(path))
43
29
  return;
44
30
  try {
package/dist/types.d.ts CHANGED
@@ -27,6 +27,33 @@ export interface PluginBundle {
27
27
  endpoint: string;
28
28
  authEnv?: string;
29
29
  }
30
+ export type MemoryExtensionScalar = string | boolean | number;
31
+ export type MemoryExtensionFieldType = 'boolean' | 'string' | 'number' | 'enum';
32
+ interface MemoryExtensionDeclarationBase {
33
+ write_help: string;
34
+ edit_help: string;
35
+ }
36
+ export interface BooleanMemoryExtensionDeclaration extends MemoryExtensionDeclarationBase {
37
+ type: 'boolean';
38
+ default?: boolean;
39
+ }
40
+ export interface StringMemoryExtensionDeclaration extends MemoryExtensionDeclarationBase {
41
+ type: 'string';
42
+ default?: string;
43
+ }
44
+ export interface NumberMemoryExtensionDeclaration extends MemoryExtensionDeclarationBase {
45
+ type: 'number';
46
+ default?: number;
47
+ }
48
+ export interface EnumMemoryExtensionDeclaration extends MemoryExtensionDeclarationBase {
49
+ type: 'enum';
50
+ values: string[];
51
+ default?: string;
52
+ }
53
+ export type MemoryExtensionDeclaration = BooleanMemoryExtensionDeclaration | StringMemoryExtensionDeclaration | NumberMemoryExtensionDeclaration | EnumMemoryExtensionDeclaration;
54
+ /** Field declarations owned by one plugin manifest. The plugin's `name` is
55
+ * the namespace; keys here are its lowercase kebab-case local field names. */
56
+ export type MemoryExtensionDeclarations = Record<string, MemoryExtensionDeclaration>;
30
57
  export interface PluginManifest {
31
58
  name: string;
32
59
  version?: string;
@@ -47,6 +74,9 @@ export interface PluginManifest {
47
74
  * Archive plugins declare this in `bundle.json`; the installer copies the
48
75
  * validated block into this synthesized manifest. */
49
76
  kinds?: Record<string, Partial<KindConfig>>;
77
+ /** Plugin-owned typed metadata declarations for memory document frontmatter.
78
+ * Values live at `extensions.<this manifest name>.<field>`. */
79
+ memory_extensions?: MemoryExtensionDeclarations;
50
80
  /** Page-component contributions: the same registration objects a scope
51
81
  * `config.json` `page_components` block carries (kind plus its display,
52
82
  * description, use guidance, and docs metadata). `resolvePageComponents`
@@ -446,3 +476,4 @@ export declare function defaultRemoteCanvasConfig(): RemoteCanvasConfig;
446
476
  export declare function defaultKindsConfig(): Record<string, KindConfig>;
447
477
  export declare function defaultModelLaddersConfig(): ModelLaddersConfig;
448
478
  export declare function defaultScopeState(): ScopeState;
479
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.217",
3
+ "version": "0.3.219",
4
4
  "description": "crtr — agent runtime with memory, plugins, and marketplaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/runtime.lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.217",
3
+ "version": "0.3.219",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/crouter",
9
- "version": "0.3.217",
9
+ "version": "0.3.219",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {