@north-light/crouter 0.3.310 → 0.3.312

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 (68) hide show
  1. package/dist/builtin-pi-packages/pi-crtr-extensions/package-lock.json +3 -3
  2. package/dist/clients/attach/viewer.js +389 -389
  3. package/dist/commands/__tests__/integration/dashboard-snapshot.test.d.ts +1 -0
  4. package/dist/commands/__tests__/integration/dashboard-snapshot.test.js +212 -0
  5. package/dist/commands/api-client.d.ts +1 -0
  6. package/dist/commands/api-client.js +4 -2
  7. package/dist/commands/canvas-roster.js +24 -17
  8. package/dist/commands/dashboard.js +23 -16
  9. package/dist/core/__tests__/context-intro.test.js +4 -4
  10. package/dist/core/__tests__/cron-timeout-descendants.test.d.ts +1 -0
  11. package/dist/core/__tests__/cron-timeout-descendants.test.js +102 -0
  12. package/dist/core/__tests__/human-deliver.test.js +18 -18
  13. package/dist/core/__tests__/integration/human-deliver-e2e.test.js +5 -5
  14. package/dist/core/__tests__/integration/lifecycle-hooks.test.js +299 -1
  15. package/dist/core/__tests__/integration/spawn-root.test.js +11 -11
  16. package/dist/core/__tests__/on-read-crouter-home-fence.test.js +2 -2
  17. package/dist/core/__tests__/on-read-dedup-resume.test.js +6 -6
  18. package/dist/core/__tests__/on-read-nested-store.test.js +6 -6
  19. package/dist/core/__tests__/profile-project-memory-delivery.test.js +31 -31
  20. package/dist/core/__tests__/spawn-worktree-id-conflict.test.js +3 -3
  21. package/dist/core/__tests__/warm-claim-preference-snapshot.test.js +1 -1
  22. package/dist/core/canvas/__tests__/remote-canvas-source.test.js +24 -11
  23. package/dist/core/canvas/remote-canvas-source.d.ts +4 -0
  24. package/dist/core/canvas/remote-canvas-source.js +58 -6
  25. package/dist/core/canvas/render-source.d.ts +4 -4
  26. package/dist/core/canvas/render-source.js +49 -48
  27. package/dist/core/canvas/source.d.ts +2 -0
  28. package/dist/core/canvas/source.js +4 -1
  29. package/dist/core/command-hooks/artifact.d.ts +6 -0
  30. package/dist/core/command-hooks/artifact.js +22 -6
  31. package/dist/core/command-hooks/discovery.d.ts +2 -0
  32. package/dist/core/command-hooks/discovery.js +2 -0
  33. package/dist/core/command-hooks/lifecycle-catalog.d.ts +20 -2
  34. package/dist/core/command-hooks/lifecycle-catalog.js +7 -2
  35. package/dist/core/command-hooks/lifecycle-create.d.ts +4 -0
  36. package/dist/core/command-hooks/lifecycle-create.js +51 -0
  37. package/dist/core/command-hooks/schema.d.ts +2 -2
  38. package/dist/core/command-hooks/schema.js +5 -4
  39. package/dist/core/command-hooks/transport/exec-invoke.js +3 -1
  40. package/dist/core/command-hooks/transport/exec-lifecycle.d.ts +18 -8
  41. package/dist/core/command-hooks/transport/exec-lifecycle.js +89 -30
  42. package/dist/core/errors.d.ts +1 -0
  43. package/dist/core/errors.js +4 -0
  44. package/dist/core/human/feedback-companion.js +1 -1
  45. package/dist/core/review/companion.d.ts +1 -1
  46. package/dist/core/review/companion.js +2 -2
  47. package/dist/core/review/realize.js +6 -6
  48. package/dist/core/runtime/nodes.d.ts +5 -1
  49. package/dist/core/runtime/nodes.js +26 -11
  50. package/dist/core/runtime/recycle.js +16 -12
  51. package/dist/core/runtime/reset.js +4 -1
  52. package/dist/core/runtime/revive.js +13 -12
  53. package/dist/core/runtime/spawn.d.ts +4 -1
  54. package/dist/core/runtime/spawn.js +30 -3
  55. package/dist/core/runtime/warm-pool.d.ts +2 -2
  56. package/dist/core/runtime/warm-pool.js +23 -3
  57. package/dist/daemon/__tests__/node-outcome-birth-invariants.test.js +2 -2
  58. package/dist/daemon/api/__tests__/profile-launch-gates.test.js +2 -2
  59. package/dist/daemon/api/__tests__/seam/profile-delete.test.js +2 -2
  60. package/dist/daemon/api/handlers/human.js +5 -2
  61. package/dist/daemon/api/handlers/nodes.d.ts +1 -0
  62. package/dist/daemon/api/handlers/nodes.js +34 -29
  63. package/dist/daemon/cron-run.js +49 -15
  64. package/dist/hook-authoring.d.ts +28 -2
  65. package/dist/hook-authoring.js +53 -1
  66. package/dist/index.d.ts +1 -1
  67. package/package.json +1 -1
  68. package/runtime.lock.json +5 -5
@@ -246,6 +246,28 @@ function validateRequest(value) {
246
246
  if (typeof value['operationId'] !== 'string' || !/^[0-9a-f]{32}$/.test(value['operationId'])) {
247
247
  return invalid('operationId must be a 32-character lowercase hexadecimal string');
248
248
  }
249
+ if (value['event'] === 'node:create') {
250
+ if (!hasOnlyKeys(value, ['protocolVersion', 'op', 'event', 'phase', 'operationId', 'create', 'runtime', 'context']))
251
+ return invalid('node:create request contains unknown fields');
252
+ if (value['phase'] !== 'before')
253
+ return invalid('node:create phase must be before');
254
+ if (!isNodeCreate(value['create']))
255
+ return invalid('node:create request create contains invalid fields');
256
+ if (!isCreateRuntime(value['runtime']))
257
+ return invalid('node:create request runtime contains invalid fields');
258
+ if (!isLifecycleContext(value['context']))
259
+ return invalid('node:create request context must contain cwd');
260
+ return valid({
261
+ protocolVersion: 1,
262
+ op: value['op'],
263
+ event: 'node:create',
264
+ phase: 'before',
265
+ operationId: value['operationId'],
266
+ create: value['create'],
267
+ runtime: value['runtime'],
268
+ context: value['context'],
269
+ });
270
+ }
249
271
  if (value['phase'] === 'on') {
250
272
  if (!hasOnlyKeys(value, ['protocolVersion', 'op', 'event', 'phase', 'operationId', 'node', 'runtime', 'context']))
251
273
  return invalid('lifecycle request contains unknown fields');
@@ -295,10 +317,21 @@ function validateRequest(value) {
295
317
  return invalid('phase must be before, after, or replace');
296
318
  if (Object.hasOwn(value, 'result'))
297
319
  return invalid('only after requests may contain result');
320
+ if (value['phase'] === 'before') {
321
+ return valid({
322
+ protocolVersion: 1,
323
+ op: value['op'],
324
+ phase: 'before',
325
+ command: value['command'],
326
+ operationId: value['operationId'],
327
+ input: value['input'],
328
+ context: value['context'],
329
+ });
330
+ }
298
331
  return valid({
299
332
  protocolVersion: 1,
300
333
  op: value['op'],
301
- phase: value['phase'],
334
+ phase: 'replace',
302
335
  command: value['command'],
303
336
  operationId: value['operationId'],
304
337
  input: value['input'],
@@ -342,6 +375,25 @@ function isContext(value) {
342
375
  function isLifecycleContext(value) {
343
376
  return isRecord(value) && hasOnlyKeys(value, ['cwd']) && typeof value['cwd'] === 'string';
344
377
  }
378
+ function isNodeCreate(value) {
379
+ return isRecord(value)
380
+ && hasOnlyKeys(value, ['kind', 'mode', 'cwd', 'profile', 'root', 'parentId', 'requestingNodeId', 'lifecycle', 'replaces'])
381
+ && typeof value['kind'] === 'string'
382
+ && typeof value['mode'] === 'string'
383
+ && typeof value['cwd'] === 'string'
384
+ && (typeof value['profile'] === 'string' || value['profile'] === null)
385
+ && typeof value['root'] === 'boolean'
386
+ && (typeof value['parentId'] === 'string' || value['parentId'] === null)
387
+ && (typeof value['requestingNodeId'] === 'string' || value['requestingNodeId'] === null)
388
+ && (value['lifecycle'] === 'resident' || value['lifecycle'] === 'terminal')
389
+ && (typeof value['replaces'] === 'string' || value['replaces'] === null);
390
+ }
391
+ function isCreateRuntime(value) {
392
+ return isRecord(value)
393
+ && hasOnlyKeys(value, ['canvasHome', 'profile'])
394
+ && typeof value['canvasHome'] === 'string'
395
+ && (typeof value['profile'] === 'string' || value['profile'] === null);
396
+ }
345
397
  function isLifecycleNode(value) {
346
398
  return isRecord(value)
347
399
  && hasOnlyKeys(value, ['id', 'name', 'kind', 'mode', 'lifecycle', 'cwd', 'nodeDir', 'contextDir', 'jobDir', 'reportsDir'])
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export { nowIso } from './core/fs-utils.js';
23
23
  export { validateOperationId, buildEnvelope, operationIdContext, errorClassCodes, serializeEventRecord, errorClassFromError, } from './core/events/index.js';
24
24
  export type { BuildEnvelopeInput, ErrorClass, ErrorClassCode, ErrorClassHints, EventComponent, EventEnvelope, EventError, EventField, EventLevel, EventOutcome, OperationId, OperationIdContext, RetryDisposition, } from './core/events/index.js';
25
25
  export { forwardHook, hookError, runHookExecutable, runLocalHookProcess } from './hook-authoring.js';
26
- export type { AfterHookRequest, BeforeHookRequest, ForwardHookOptions, HookContext, HookError, HookFailure, HookHandler, HookHandlers, HookJson, HookPhase, HookRequest, HookResponse, HookSuccess, LocalHookProcessOptions, LocalHookProcessResult, LocalHookProcessSuccess, ReplaceHookRequest, RunHookExecutableOptions, } from './hook-authoring.js';
26
+ export type { AfterHookRequest, BeforeHookRequest, ForwardHookOptions, HookContext, HookError, HookFailure, HookHandler, HookHandlers, HookJson, HookPhase, HookRequest, HookResponse, HookSuccess, LocalHookProcessOptions, LocalHookProcessResult, LocalHookProcessSuccess, LifecycleHookNode, LifecycleHookRequest, LifecycleHookRuntime, NodeCreateHookRequest, ReplaceHookRequest, RunHookExecutableOptions, } from './hook-authoring.js';
27
27
  export { validateCommandManifest } from './core/command-manifests/manifest.js';
28
28
  export type { CommandManifestValidation, ValidatedCommandManifest } from './core/command-manifests/manifest.js';
29
29
  export type { CommandManifestIssue, TransportKind } from './core/command-manifests/schema.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.310",
3
+ "version": "0.3.312",
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.310",
3
+ "version": "0.3.312",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/crouter",
9
- "version": "0.3.310",
9
+ "version": "0.3.312",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "workspaces": [
@@ -5206,17 +5206,17 @@
5206
5206
  },
5207
5207
  "packages/crouter-api": {
5208
5208
  "name": "@north-light/crouter-api",
5209
- "version": "0.3.310",
5209
+ "version": "0.3.312",
5210
5210
  "license": "UNLICENSED"
5211
5211
  },
5212
5212
  "packages/crouter-env-docker": {
5213
5213
  "name": "@north-light/crouter-env-docker",
5214
- "version": "0.3.310",
5214
+ "version": "0.3.312",
5215
5215
  "license": "UNLICENSED"
5216
5216
  },
5217
5217
  "packages/crouter-sdk": {
5218
5218
  "name": "@north-light/crouter-sdk",
5219
- "version": "0.3.310",
5219
+ "version": "0.3.312",
5220
5220
  "license": "UNLICENSED",
5221
5221
  "dependencies": {
5222
5222
  "@north-light/crouter-api": "^0.3.295"