@north-light/crouter 0.3.188 → 0.3.189

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.
@@ -16,6 +16,10 @@ export interface CreateNodeRequest {
16
16
  name?: string;
17
17
  parent?: NodeIdDTO | null;
18
18
  root?: boolean;
19
+ /** Lifecycle of an independent root. Defaults to `resident`; use `terminal`
20
+ * for bounded, unattended work that must finalize rather than remain an
21
+ * ongoing conversation. Only valid with `root: true`. */
22
+ root_lifecycle?: LifecycleDTO;
19
23
  /** Worktree branch name, or true for an auto-named managed worktree. */
20
24
  worktree?: string | boolean;
21
25
  fork_from?: string;
@@ -85,6 +85,15 @@ function parseCreateBody(body) {
85
85
  if (typeof b['kind'] !== 'string' || b['kind'].trim() === '') {
86
86
  throw usage('a node create requires a kind');
87
87
  }
88
+ const rootLifecycle = b['root_lifecycle'];
89
+ if (rootLifecycle !== undefined &&
90
+ rootLifecycle !== 'resident' &&
91
+ rootLifecycle !== 'terminal') {
92
+ throw usage("root_lifecycle must be 'resident' or 'terminal'");
93
+ }
94
+ if (rootLifecycle !== undefined && b['root'] !== true) {
95
+ throw usage('root_lifecycle is only valid with root: true');
96
+ }
88
97
  return b;
89
98
  }
90
99
  /** The directory a new node is pinned to. An explicit `pin_cwd` wins; else a
@@ -122,6 +131,9 @@ function buildRecipe(req, parent, cwd) {
122
131
  recipe.parent = parent;
123
132
  if (req.root === true)
124
133
  recipe.root = true;
134
+ if (req.root_lifecycle !== undefined) {
135
+ recipe.rootLifecycle = req.root_lifecycle;
136
+ }
125
137
  if (req.worktree === true || typeof req.worktree === 'string')
126
138
  recipe.worktree = true;
127
139
  if (typeof req.worktree === 'string')
@@ -143,7 +155,8 @@ function buildRecipe(req, parent, cwd) {
143
155
  * kickoff, so anything that shapes the node AT BIRTH — a prompt to run, a
144
156
  * forked conversation, a managed worktree, a caller-pinned node id, a spine
145
157
  * parent — disqualifies it. `kind`, `mode`, `model`, `name`, `situational_context`
146
- * and `output_schema` are all applied at claim time and so do not. */
158
+ * and `output_schema` are all applied at claim time and so do not. A terminal
159
+ * root is not warm-compatible: every spare is resident. */
147
160
  function warmRequestFor(req, cwd, profileId) {
148
161
  if (!warmPoolEnabled())
149
162
  return null;
@@ -151,6 +164,8 @@ function warmRequestFor(req, cwd, profileId) {
151
164
  return null;
152
165
  if (req.root !== true || req.parent != null)
153
166
  return null;
167
+ if (req.root_lifecycle === 'terminal')
168
+ return null;
154
169
  if ((req.prompt ?? '') !== '')
155
170
  return null;
156
171
  if (req.fork_from !== undefined || req.worktree !== undefined || req.node_id !== undefined)
@@ -210,7 +225,7 @@ export async function handleCreate(ctx, deps = {}) {
210
225
  const profileId = await resolveProfileId(req.profile, parent ?? null, contextCwd);
211
226
  const cwd = resolveNodeCwd(req, parent, profileId, contextCwd);
212
227
  const launch = buildLaunchSpec(req.kind, (req.mode ?? 'base'), {
213
- lifecycle: req.root === true ? 'resident' : 'terminal',
228
+ lifecycle: req.root === true ? (req.root_lifecycle ?? 'resident') : 'terminal',
214
229
  hasManager: req.root !== true,
215
230
  ...(req.model !== undefined ? { model: req.model } : {}),
216
231
  cwd,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/crouter",
3
- "version": "0.3.188",
3
+ "version": "0.3.189",
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.188",
3
+ "version": "0.3.189",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/crouter",
9
- "version": "0.3.188",
9
+ "version": "0.3.189",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {