@north-light/crouter 0.3.274 → 0.3.276

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 (35) hide show
  1. package/dist/builtin-memory/02-turn-lifecycle/01-terminal.md +1 -1
  2. package/dist/clients/attach/viewer.js +459 -459
  3. package/dist/commands/cron.js +3 -3
  4. package/dist/commands/node/create.js +3 -1
  5. package/dist/commands/node-worktree.js +7 -7
  6. package/dist/commands/pkg/plugin-manage.js +19 -8
  7. package/dist/commands/push.js +1 -1
  8. package/dist/core/__tests__/helpers/harness.d.ts +1 -0
  9. package/dist/core/__tests__/helpers/harness.js +12 -10
  10. package/dist/core/__tests__/integration/worktree-land.test.js +7 -2
  11. package/dist/core/__tests__/seam/broker-provider-retry.test.js +3 -16
  12. package/dist/core/canvas/browse/render.js +82 -67
  13. package/dist/core/canvas/status-glyph.d.ts +4 -3
  14. package/dist/core/canvas/status-glyph.js +17 -9
  15. package/dist/core/canvas/types.d.ts +18 -0
  16. package/dist/core/command-plugins/bundle.d.ts +7 -0
  17. package/dist/core/command-plugins/bundle.js +18 -4
  18. package/dist/core/git.d.ts +5 -1
  19. package/dist/core/git.js +18 -4
  20. package/dist/core/runtime/spawn.d.ts +2 -0
  21. package/dist/core/runtime/spawn.js +1 -1
  22. package/dist/core/runtime/surface-bg.d.ts +6 -4
  23. package/dist/core/runtime/surface-bg.js +39 -22
  24. package/dist/core/tui/draw.d.ts +2 -0
  25. package/dist/core/tui/draw.js +15 -0
  26. package/dist/core/worktree-sweep.js +28 -5
  27. package/dist/core/worktree.d.ts +1 -12
  28. package/dist/core/worktree.js +222 -10
  29. package/dist/daemon/api/handlers/crons.js +5 -4
  30. package/dist/daemon/api/handlers/messages.js +5 -0
  31. package/dist/daemon/api/handlers/nodes.js +2 -0
  32. package/dist/daemon/api/handlers/reports.js +11 -7
  33. package/dist/types.d.ts +1 -1
  34. package/package.json +1 -1
  35. package/runtime.lock.json +2 -2
@@ -9,7 +9,7 @@ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
9
9
  import { join } from 'node:path';
10
10
  import { getNode } from '../../../core/canvas/canvas.js';
11
11
  import { push, FinalizationError } from '../../../core/feed/feed.js';
12
- import { autoDropCleanManagedWorktree, hasOpenManagedWorktree, missingWorktreeRecoveryHint } from '../../../core/worktree.js';
12
+ import { autoDropCleanManagedWorktree, branchIsPushedAtCurrentTip, hasOpenManagedWorktree, missingWorktreeRecoveryHint } from '../../../core/worktree.js';
13
13
  import { reportsDir } from '../../../core/canvas/paths.js';
14
14
  import { notFound, usage } from '../../../core/errors.js';
15
15
  import { InputError } from '../../../core/io.js';
@@ -51,14 +51,19 @@ async function handlePush(ctx) {
51
51
  // `final` with an OPEN managed worktree, BEFORE the push/transition (spec
52
52
  // §6.2 — worktree fs ops are server-side). A provably-clean, zero-commit
53
53
  // worktree is auto-dropped so a read-only or already-landed node
54
- // can finish without an explicit `node worktree close`; any real unlanded
55
- // work instead blocks with the parity `open_managed_worktree` error,
54
+ // can finish without an explicit `node worktree close`; a clean worktree
55
+ // whose exact tip is already on origin can also finish while retaining its
56
+ // branch and checkout. Any work that is neither locally landed nor remotely
57
+ // retained instead blocks with the parity `open_managed_worktree` error,
56
58
  // round-tripped via CrtrError.details so the CLI renders the same InputError
57
59
  // (next-hint included) it surfaced before B-5 re-homed this to the server.
58
60
  let autoDroppedPath;
59
61
  if (req.tier === 'final' && hasOpenManagedWorktree(getNode(id))) {
60
62
  const dropped = autoDropCleanManagedWorktree(id);
61
- if (dropped === null) {
63
+ if (dropped !== null) {
64
+ autoDroppedPath = dropped.worktree_path;
65
+ }
66
+ else if (!(await branchIsPushedAtCurrentTip(getNode(id).managed_worktree))) {
62
67
  // Thrown as InputError so `toErrorBody` round-trips the FULL structured
63
68
  // payload (code + message + next) into `ApiError.details`, and the CLI's
64
69
  // shared `apiErrorToCliError` reconstructs it byte-for-byte — no
@@ -70,11 +75,10 @@ async function handlePush(ctx) {
70
75
  const wt = getNode(id)?.managed_worktree;
71
76
  return wt !== null && wt !== undefined && wt.state === 'open' && !existsSync(wt.path)
72
77
  ? missingWorktreeRecoveryHint(wt)
73
- : 'Commit the remaining work in the worktree, run `crtr node worktree close`, then rerun `crtr push final`.';
78
+ : 'Commit the remaining work in the worktree, push its branch to origin at its current tip, then rerun `crtr push final`; or run `crtr node worktree close` to land it locally.';
74
79
  })(),
75
80
  });
76
81
  }
77
- autoDroppedPath = dropped.worktree_path;
78
82
  }
79
83
  const result = await pushOrRethrow(id, req);
80
84
  const transitioned = req.tier === 'final' && before !== undefined
@@ -100,7 +104,7 @@ async function pushOrRethrow(id, req) {
100
104
  throw new InputError({
101
105
  error: 'already_finalized',
102
106
  message: 'This node already submitted its canonical final result.',
103
- next: 'Do not push another final from this node.',
107
+ next: 'Push an update with the new information, then stop.',
104
108
  });
105
109
  }
106
110
  if (err instanceof FinalizationError && err.code === 'finalization_forbidden') {
package/dist/types.d.ts CHANGED
@@ -97,7 +97,7 @@ export interface PluginManifest {
97
97
  commands?: string;
98
98
  /** Plugin-root-relative path to a declarative hook manifest (`hooks.json`).
99
99
  * Must be declared together with `hookExecutable`; hooks are trusted local
100
- * code and are unavailable to endpoint archive plugins. */
100
+ * code. */
101
101
  hooks?: string;
102
102
  /** Plugin-root-relative executable that dispatches declarations in `hooks`.
103
103
  * Must be a regular file with a POSIX executable permission bit. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.274",
3
+ "version": "0.3.276",
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.274",
3
+ "version": "0.3.276",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/crouter",
9
- "version": "0.3.274",
9
+ "version": "0.3.276",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {