@north-light/crouter 0.3.175 → 0.3.176
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.
- package/dist/api/dto/nodes.d.ts +7 -1
- package/dist/api/dto/profiles.d.ts +3 -0
- package/dist/clients/attach/render/crtr-output.d.ts +3 -3
- package/dist/clients/attach/render/crtr-output.js +25 -13
- package/dist/clients/attach/viewer.js +531 -561
- package/dist/commands/node/create.js +7 -3
- package/dist/commands/profile/list.js +3 -1
- package/dist/commands/profile/new.js +4 -1
- package/dist/commands/profile/project.js +23 -9
- package/dist/commands/profile/show.js +3 -1
- package/dist/commands/profile.js +2 -2
- package/dist/commands/sys/logs.js +4 -2
- package/dist/core/__tests__/branded-host-concurrency.test.js +1 -1
- package/dist/core/__tests__/on-read-crouter-home-fence.test.js +1 -1
- package/dist/core/__tests__/on-read-dedup-resume.test.js +1 -1
- package/dist/core/canvas/extensions.d.ts +1 -1
- package/dist/core/canvas/extensions.js +7 -1
- package/dist/core/command-plugins/transport/http-invoke.js +10 -2
- package/dist/core/command.js +3 -1
- package/dist/core/config.js +4 -27
- package/dist/core/exclusive-lock.d.ts +14 -0
- package/dist/core/exclusive-lock.js +124 -0
- package/dist/core/human/claim.js +2 -1
- package/dist/core/human/convention.d.ts +0 -10
- package/dist/core/human/convention.js +1 -123
- package/dist/core/io.d.ts +23 -0
- package/dist/core/io.js +60 -0
- package/dist/core/preview-registry.d.ts +10 -5
- package/dist/core/preview-registry.js +136 -2537
- package/dist/core/profiles/manifest.d.ts +12 -1
- package/dist/core/profiles/manifest.js +57 -48
- package/dist/core/review/store.d.ts +4 -1
- package/dist/core/review/store.js +10 -0
- package/dist/core/runtime/branded-host.js +6 -84
- package/dist/core/runtime/broker-extension-render.js +1 -1
- package/dist/core/runtime/canvas-extensions.d.ts +1 -0
- package/dist/core/runtime/canvas-extensions.js +2 -0
- package/dist/core/runtime/tmux-bindings.js +1 -1
- package/dist/core/runtime/warm-pool.d.ts +9 -8
- package/dist/core/runtime/warm-pool.js +58 -62
- package/dist/core/substrate/index.d.ts +2 -1
- package/dist/core/substrate/index.js +2 -1
- package/dist/core/substrate/on-read-node.d.ts +7 -0
- package/dist/core/substrate/on-read-node.js +37 -0
- package/dist/core/substrate/on-read.d.ts +7 -5
- package/dist/core/substrate/on-read.js +15 -23
- package/dist/core/termrender/termrender.js +16 -96
- package/dist/core/worktree.js +11 -100
- package/dist/daemon/api/handlers/nodes.js +32 -9
- package/dist/daemon/api/handlers/review-comments.js +5 -44
- package/dist/daemon/api/handlers/reviews.js +5 -53
- package/dist/daemon/api/handlers/validate.d.ts +22 -0
- package/dist/daemon/api/handlers/validate.js +59 -0
- package/dist/daemon/api/map.js +1 -0
- package/dist/daemon/review/finish.js +1 -10
- package/dist/pi-extensions/canvas-doc-substrate.js +1 -1
- package/dist/pi-extensions/canvas-preview-result.d.ts +22 -0
- package/dist/pi-extensions/canvas-preview-result.js +60 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
- package/runtime.lock.json +2 -2
- package/dist/core/substrate/on-read-pure.d.ts +0 -7
- package/dist/core/substrate/on-read-pure.js +0 -272
package/dist/api/dto/nodes.d.ts
CHANGED
|
@@ -5,7 +5,13 @@ export interface CreateNodeRequest {
|
|
|
5
5
|
prompt?: string;
|
|
6
6
|
profile?: string;
|
|
7
7
|
mode?: ModeDTO;
|
|
8
|
+
/** The DIRECTORY CONTEXT the create came from — not necessarily where the
|
|
9
|
+
* node lands. It is what the daemon selects a profile from when the request
|
|
10
|
+
* neither names one nor inherits one from a parent. */
|
|
8
11
|
cwd?: string;
|
|
12
|
+
/** Pin the node to this exact directory, overriding the profile home a node
|
|
13
|
+
* otherwise runs in. See `crtr node new --cwd`. */
|
|
14
|
+
pin_cwd?: string;
|
|
9
15
|
/** Display name (tmux window + resume picker). Defaults to the kind. */
|
|
10
16
|
name?: string;
|
|
11
17
|
parent?: NodeIdDTO | null;
|
|
@@ -22,7 +28,7 @@ export interface CreateNodeRequest {
|
|
|
22
28
|
* HTTP 409 `node_id_exists`). See `crtr node new --node-id`. */
|
|
23
29
|
node_id?: string;
|
|
24
30
|
/** Serve this create from the warm pool when a pre-booted spare matches the
|
|
25
|
-
* request's frozen launch tuple (kind, mode, cwd, profile, model,
|
|
31
|
+
* request's frozen launch tuple (kind, mode, resolved cwd, profile, model,
|
|
26
32
|
* situational_context) — answering in milliseconds instead of waiting out a
|
|
27
33
|
* full engine boot. Only a bare root with no kickoff qualifies; anything the
|
|
28
34
|
* pool cannot honor (or an empty pool) falls back to an ordinary cold spawn,
|
|
@@ -9,6 +9,9 @@ export interface ProfileDTO {
|
|
|
9
9
|
id: string;
|
|
10
10
|
name: string;
|
|
11
11
|
projects: string[];
|
|
12
|
+
/** Where nodes under this profile run — one of `projects` (the first unless
|
|
13
|
+
* re-pointed), or null when the profile owns none. */
|
|
14
|
+
home: string | null;
|
|
12
15
|
/** The directory this profile is pinned as default for, if any. */
|
|
13
16
|
default_dir?: string | null;
|
|
14
17
|
}
|
|
@@ -28,9 +28,9 @@ export declare function isCrtrHelpInvocation(command: unknown): boolean;
|
|
|
28
28
|
* cross-process command-tree lookup, so there is no cache/resolver/invalidate
|
|
29
29
|
* machinery here, and no path from the attach bundle into the command tree.
|
|
30
30
|
* Command-owned computed summaries (memory read, memory lint, ...) are a
|
|
31
|
-
* separate lookup entirely — render() below
|
|
32
|
-
* (preview-registry.ts)
|
|
33
|
-
*
|
|
31
|
+
* separate lookup entirely — render() below gives summarizePath
|
|
32
|
+
* (preview-registry.ts) the private structured CLI result attached by the
|
|
33
|
+
* canvas preview extension. Invocation tokens provide only static chrome. */
|
|
34
34
|
export interface CrtrPreviewState {
|
|
35
35
|
isHelp: boolean;
|
|
36
36
|
suppressOutput: boolean;
|
|
@@ -182,6 +182,17 @@ function resultText(result) {
|
|
|
182
182
|
.join('\n')
|
|
183
183
|
.trimEnd();
|
|
184
184
|
}
|
|
185
|
+
/** The canvas preview extension attaches the CLI's exact result record here.
|
|
186
|
+
* This deliberately validates only the transport envelope; command-owned
|
|
187
|
+
* summaries validate the fields they use in preview-registry.ts. */
|
|
188
|
+
function previewFromDetails(details) {
|
|
189
|
+
if (details === null || typeof details !== 'object')
|
|
190
|
+
return undefined;
|
|
191
|
+
const preview = details['crtrPreview'];
|
|
192
|
+
if (preview === null || typeof preview !== 'object' || typeof preview['path'] !== 'string')
|
|
193
|
+
return undefined;
|
|
194
|
+
return preview;
|
|
195
|
+
}
|
|
185
196
|
function styledLabelValue(indent, marker, label, separator, value, theme) {
|
|
186
197
|
const styledMarker = marker === '' ? '' : theme.fg('accent', marker);
|
|
187
198
|
return `${indent}${styledMarker}${theme.fg('dim', label)}${theme.fg('dim', separator)}${theme.fg('text', value)}`;
|
|
@@ -556,17 +567,19 @@ class CrtrResultComponent {
|
|
|
556
567
|
theme;
|
|
557
568
|
command;
|
|
558
569
|
staticPreview;
|
|
570
|
+
structuredPreview;
|
|
559
571
|
constructor(text, options, context, theme,
|
|
560
572
|
/** Source command for the preview lookup (the bash-call path). Omit (or
|
|
561
573
|
* pass a static preview below) for a path with no per-leaf lookup, e.g.
|
|
562
574
|
* CrtrOutputMessageComponent. */
|
|
563
|
-
command, staticPreview = DEFAULT_PREVIEW_STATE) {
|
|
575
|
+
command, staticPreview = DEFAULT_PREVIEW_STATE, structuredPreview) {
|
|
564
576
|
this.text = text;
|
|
565
577
|
this.options = options;
|
|
566
578
|
this.context = context;
|
|
567
579
|
this.theme = theme;
|
|
568
580
|
this.command = command;
|
|
569
581
|
this.staticPreview = staticPreview;
|
|
582
|
+
this.structuredPreview = structuredPreview;
|
|
570
583
|
}
|
|
571
584
|
/** Both isHelp and suppressOutput are synchronous structural lookups (see
|
|
572
585
|
* commandPreviewMeta), so this never needs to invalidate/upgrade a later
|
|
@@ -598,14 +611,11 @@ class CrtrResultComponent {
|
|
|
598
611
|
return wrapRenderedLines(['', ...statusLines, ...commandLine, ...styled.split('\n')], width);
|
|
599
612
|
}
|
|
600
613
|
// Collapse order (rule 12, inline-ui-placement): help schema synthesis,
|
|
601
|
-
// then a command-owned
|
|
602
|
-
//
|
|
603
|
-
//
|
|
604
|
-
//
|
|
605
|
-
//
|
|
606
|
-
// (findings) IS command-owned computed content the same as its 0-findings
|
|
607
|
-
// success shape, not noise to suppress — only when the summarizer
|
|
608
|
-
// recognizes neither shape (returns null) does the raw failed output show.
|
|
614
|
+
// then a command-owned structured summary (summarizePath), then a bare
|
|
615
|
+
// suppressOutput hint, then generic truncation. A still-RUNNING command
|
|
616
|
+
// is always shown raw — there is nothing to summarize yet. Structured
|
|
617
|
+
// errors can be summarized too; a result without a preview record retains
|
|
618
|
+
// the exact generic raw fallback.
|
|
609
619
|
// suppressOutput stays success-only (checked below): a failure is exactly
|
|
610
620
|
// when a suppressed leaf's raw output becomes diagnostically important.
|
|
611
621
|
if (!isPartial) {
|
|
@@ -623,10 +633,12 @@ class CrtrResultComponent {
|
|
|
623
633
|
return clampRenderedLines(['', ...statusLines, ...lines, hint], width);
|
|
624
634
|
}
|
|
625
635
|
const tokens = this.command !== undefined ? extractCrtrInvocationTokens(this.command) : undefined;
|
|
626
|
-
const summary = tokens !== undefined
|
|
636
|
+
const summary = tokens !== undefined && this.structuredPreview !== undefined
|
|
637
|
+
? summarizePath(this.structuredPreview, tokens)
|
|
638
|
+
: null;
|
|
627
639
|
if (summary !== null) {
|
|
628
|
-
// A command-owned
|
|
629
|
-
//
|
|
640
|
+
// A command-owned summary of the leaf's exact result object — never
|
|
641
|
+
// a parse of its rendered payload.
|
|
630
642
|
const firstContentIndex = summary.findIndex((line) => line.text !== '');
|
|
631
643
|
const summaryLines = summary.map((line, index) => renderSummaryLine(line, this.theme, index === firstContentIndex));
|
|
632
644
|
const truncated = truncateToVisualLines(summaryLines.join('\n'), PREVIEW_BODY_BUDGET, width);
|
|
@@ -715,7 +727,7 @@ export function createCrtrBashToolDefinition(args, fold = new FoldedToolCallCont
|
|
|
715
727
|
return fold.capture(new Text(`${styledPrefix}${styledPath}`, 0, 0));
|
|
716
728
|
},
|
|
717
729
|
renderResult(result, options, theme, context) {
|
|
718
|
-
return new CrtrResultComponent(resultText(result), options, context, theme, command);
|
|
730
|
+
return new CrtrResultComponent(resultText(result), options, context, theme, command, DEFAULT_PREVIEW_STATE, previewFromDetails(result.details));
|
|
719
731
|
},
|
|
720
732
|
};
|
|
721
733
|
}
|