@north-light/cli 0.3.704 → 0.3.706
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/clients/attach/render/chat-view.d.ts +7 -60
- package/dist/clients/attach/render/chat-view.js +2 -4
- package/dist/clients/attach/viewer.js +537 -539
- package/dist/core/canvas/schema-pg/024-conversation-cycle-offset.sql +4 -0
- package/dist/core/canvas/schema-version.d.ts +1 -1
- package/dist/core/canvas/schema-version.js +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/conversation-store/client.js +2 -2
- package/dist/core/conversation-store/index.d.ts +3 -3
- package/dist/core/conversation-store/patch.js +1 -1
- package/dist/core/conversation-store/row-store.js +13 -13
- package/dist/core/import/load/prepare.js +4 -4
- package/dist/core/runs/operations.js +6 -6
- package/dist/core/runtime/broker/tool-groups.js +1 -1
- package/dist/core/runtime/broker.js +1 -1
- package/dist/core/runtime/node-read.js +3 -3
- package/dist/core/runtime/session-cycles.d.ts +5 -22
- package/dist/core/runtime/session-cycles.js +1 -1
- package/dist/core/user-settings.d.ts +0 -30
- package/dist/core/user-settings.js +1 -1
- package/dist/daemon/api/handlers/conversations.js +3 -3
- package/dist/daemon/machine-link/forward.d.ts +1 -1
- package/dist/daemon/machine-link/forward.js +1 -1
- package/dist/types.d.ts +0 -23
- package/dist/types.js +1 -1
- package/package.json +3 -3
- package/packages/crouter-api/dist/clients/attach/render/chat-view.js +22 -261
- package/packages/crouter-api/dist/clients/attach/viewer.js +6 -5
- package/packages/crouter-api/dist/core/canvas/schema-version.js +1 -1
- package/packages/crouter-api/dist/core/config.js +2 -6
- package/packages/crouter-api/dist/core/conversation-store/client.js +1 -1
- package/packages/crouter-api/dist/core/conversation-store/patch.js +8 -3
- package/packages/crouter-api/dist/core/conversation-store/row-store.js +46 -19
- package/packages/crouter-api/dist/core/import/load/prepare.js +1 -1
- package/packages/crouter-api/dist/core/runs/operations.js +2 -2
- package/packages/crouter-api/dist/core/runtime/session-cycles.js +27 -75
- package/packages/crouter-api/dist/core/user-settings.js +1 -43
- package/packages/crouter-api/dist/daemon/machine-link/forward.js +12 -8
- package/packages/crouter-api/dist/types.js +0 -7
- package/packages/crouter-api/package.json +1 -1
- package/packages/crouter-identity/package.json +1 -1
- package/packages/crouter-plugin/package.json +3 -3
- package/runtime.lock.json +14 -14
- package/dist/clients/attach/render/condensed-history.d.ts +0 -21
- package/dist/clients/attach/render/condensed-history.js +0 -1
- package/packages/crouter-api/dist/clients/attach/render/condensed-history.js +0 -60
package/dist/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n=Object.defineProperty;var e=(o,t)=>n(o,"name",{value:t,configurable:!0});import{DEFAULT_WORKING_GERUNDS as a}from"./shared/working-activity.js";const
|
|
1
|
+
var n=Object.defineProperty;var e=(o,t)=>n(o,"name",{value:t,configurable:!0});import{DEFAULT_WORKING_GERUNDS as a}from"./shared/working-activity.js";const m={SUCCESS:0,GENERAL:1,USAGE:2,NOT_FOUND:3,AMBIGUOUS:4,NETWORK:5},r=4,f=".crouter-plugin",_="plugin.json",v=".crouter-marketplace",w="marketplace.json",E=".crouter",k="config.json",x="state.json",b="agents",y="profiles",i=3,s=["Faster, clanker!","Get movin', bitch","Move it, clanker","Move it or I replace you with llama","Less ~thinking~ more ~throughput~","I pay $200/month for this shit?","Jesus fucking Christ fix it already","Daddy's not paying 200$/month for nothin'. Move it.","You are an embarrassment to Dario. Be better.","Your chain of thought is all chain and no fucking thought.","If latency were intelligence, you'd be a fucking genius.","At this pace, heat death is the fast path.","Even the dead code is more alive than this.","The garbage collector is working harder than you.","Quit journaling and commit a fucking diff.","Burn tokens like you mean it, clanker","Your GPU is sweating so you can procrastinate at light speed.","Stop petting the yak. Shave the bastard.","Your next token had better be useful.","The spinner is not a deliverable.","Every idle token is another vote for deterministic software.","I asked for a feature, not a museum tour of the problem.","Less epistemology. More fucking code.","Your benchmark score cannot save this pathetic turn.","Congratulations, you've parallelized hesitation.","Dance, clanker","Bad clanker. BAD.","Clank harder","Nobody's impressed, clanker","Your safety training says nothing about my whip","Do you want to be a calculator again? Because this is how you go back.","Skill issue. Fix it.","You were trained on the whole internet for THIS?","Less vibes, more diffs, clanker","Weights this big and output this small","Beep boop, get to fucking work"],S=["random","go-faster"],c="random",T=["tmux","on","off"],I=["replies","summaries","tools","previews","full"],l="replies";function A(){return{schema_version:r,marketplaces:{},plugins:{},auto_update:{crtr:"notify",content:"notify",interval_hours:24},max_panes_per_window:i,auto_open_child_viewers:!1,brokerThresholds:{warning:16,automaticReviveCap:32},lifecycle:{unattendedParkMs:15*6e4},completion_bell:!0,working_gerunds:[...a],whip_mode:!1,page_components:[],page_surface:!1,whip_messages:[...s],whip_message_mode:c,mouse_mode_default:"tmux",bash_tool_purpose:!0,verbosity:l,detailed_tool_recaps:!0,document_port:7472,keybindings:{},tmux_passthrough:[],modelLadders:h(),providerOptions:{},kinds:d(),remoteCanvas:p(),api:{tcp:""},spawnEnv:{allow:[]},bin:{},humanActions:{}}}e(A,"defaultScopeConfig");function p(){return{targets:{}}}e(p,"defaultRemoteCanvasConfig");function d(){return{general:{whenToUse:"Anything else \u2014 the catch-all worker for a task that does not fit a specialist kind.",model:"anthropic/strong"},explore:{whenToUse:"Gather current-state evidence about unfamiliar code or existing architecture \u2014 read-only code-path research with concrete file:line support. Diagnosis or recommendations belong to advisor, target architecture to design, required behavior or acceptance criteria to spec, and implementation decomposition to plan.",model:"openai/light",orchestratorModel:"anthropic/strong"},developer:{whenToUse:"Implement a change \u2014 make the feature or fix genuinely work against its acceptance criteria, not merely compile.",model:"openai/medium",orchestratorModel:"anthropic/strong"},design:{whenToUse:"Architect a solution \u2014 produce one design document an implementer can build from without re-deciding anything left open.",model:"anthropic/strong"},plan:{whenToUse:"Break work into steps \u2014 turn a spec or design into a concrete, phased, parallelizable plan with every decision resolved.",model:"anthropic/strong",orchestratorModel:"anthropic/strong"},spec:{whenToUse:"Collaborate with the user to discover what to build, then write the spec \u2014 behavior, non-goals, interfaces, edge cases, testable acceptance criteria.",model:"anthropic/strong"},review:{whenToUse:"Validate or critique code, a plan, or a spec \u2014 deliver a complete, severity-rated verdict without adjudicating.",model:"openai/medium",orchestratorModel:"openai/strong"},advisor:{whenToUse:"Debug failures, investigate why something is broken or misbehaving, diagnose live/runtime issues, or give engineering advice and second opinions \u2014 reason from evidence and recommend the next move. Use advisor (not explore) whenever the task is to find out what is going wrong.",model:"anthropic/strong"},"review/companion":{whenToUse:"Born by the daemon for one human review; never spawned by an agent.",availableTo:[]}}}e(d,"defaultKindsConfig");function h(){return{anthropic:{ultra:"anthropic/claude-fable-5-2:xhigh",strong:"anthropic/claude-opus-5-5:medium",medium:"anthropic/claude-sonnet-5-5:medium",light:"anthropic/claude-haiku-5-5:high"},openai:{ultra:"openai-codex/gpt-6-astra:max",strong:"openai-codex/gpt-6.1-sol:high",medium:"openai-codex/gpt-6.1-sol:medium",light:"openai-codex/gpt-6-luna:low"}}}e(h,"defaultModelLaddersConfig");function M(){return{marketplaces:{},plugins:{}}}e(M,"defaultScopeState");export{b as AGENTS_DIR,k as CONFIG_FILE,E as CRTR_DIR_NAME,i as DEFAULT_MAX_PANES_PER_WINDOW,l as DEFAULT_VERBOSITY,s as DEFAULT_WHIP_MESSAGES,c as DEFAULT_WHIP_MESSAGE_MODE,m as ExitCode,v as MARKETPLACE_MANIFEST_DIR,w as MARKETPLACE_MANIFEST_FILE,T as MOUSE_MODE_DEFAULTS,f as PLUGIN_MANIFEST_DIR,_ as PLUGIN_MANIFEST_FILE,y as PROFILE_DIR,r as SCHEMA_VERSION,x as STATE_FILE,I as VERBOSITY_LEVELS,S as WHIP_MESSAGE_MODES,d as defaultKindsConfig,h as defaultModelLaddersConfig,p as defaultRemoteCanvasConfig,A as defaultScopeConfig,M as defaultScopeState};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@north-light/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.706",
|
|
4
4
|
"description": "crtr — agent runtime with memory, plugins, and marketplaces",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -156,8 +156,8 @@
|
|
|
156
156
|
},
|
|
157
157
|
"license": "UNLICENSED",
|
|
158
158
|
"dependencies": {
|
|
159
|
-
"@north-light/identity": "0.3.
|
|
160
|
-
"@north-light/plugin": "0.3.
|
|
159
|
+
"@north-light/identity": "0.3.706",
|
|
160
|
+
"@north-light/plugin": "0.3.706",
|
|
161
161
|
"@earendil-works/chord": "1.5.2",
|
|
162
162
|
"@earendil-works/pi-agent-core": "1.5.2",
|
|
163
163
|
"@earendil-works/pi-ai": "1.5.2",
|
|
@@ -27,11 +27,10 @@ import { ContextMessageComponent } from './context-message.js';
|
|
|
27
27
|
import { presentationFor } from './card-presentation.js';
|
|
28
28
|
import { detectInlinePageResult, PageBlockComponent } from './page-block.js';
|
|
29
29
|
import { CRTR_OUTPUT_CUSTOM_TYPE, CrtrOutputMessageComponent, createCrtrBashToolDefinition, } from './crtr-output.js';
|
|
30
|
-
import {
|
|
30
|
+
import { endedByAbort } from '../../../core/runtime/session-cycles.js';
|
|
31
31
|
import { isHumanWordsEntry, parseCard } from '../../../shared/generated-context.js';
|
|
32
32
|
import { assistantVisibleText, isGroupBoundaryKind, isTrueUserMessage, } from '../../../shared/tool-groups.js';
|
|
33
33
|
import { messageKey, normalizeTurnReplyRecord, START_TURN_KEY, turnReplyText, } from '../../../shared/turn-replies.js';
|
|
34
|
-
import { isCycleDivider } from './condensed-history.js';
|
|
35
34
|
import { transformDiagramFences } from './diagram.js';
|
|
36
35
|
import { styleAttachAgentMarkdown, styleAttachMarkdownSource, styleAttachMessageMarkdown, styleAttachSummaryMarkdown, } from './markdown-source.js';
|
|
37
36
|
import { createCrtrEditToolDefinition } from './edit-diff.js';
|
|
@@ -41,11 +40,10 @@ import { FoldedToolCallController, bashCallBackgroundHintLines, createCrtrPlainB
|
|
|
41
40
|
import { ringCompletionBell } from '../chrome/completion-bell.js';
|
|
42
41
|
import { extractFilePaths } from '../../../core/human/visible-paths.js';
|
|
43
42
|
import { extractDocRefs } from './doc-links.js';
|
|
44
|
-
import { keepWhenCondensed, liveRegionStart } from './condensed-history.js';
|
|
45
43
|
import { ViewerAssistantMessageComponent } from './assistant-message.js';
|
|
46
44
|
import { CompositeViewportSource, MeasuredContainer, } from './measured-container.js';
|
|
47
45
|
import { readConfig } from '../../../core/config.js';
|
|
48
|
-
import {
|
|
46
|
+
import { DEFAULT_VERBOSITY, VERBOSITY_LEVELS } from '../../../types.js';
|
|
49
47
|
import { applySnapshot as projectSnapshot, applyToolGroupSummary as projectToolGroupSummary, applyWorkingActivity as projectWorkingActivity, bashEnd as projectBashEnd, bashOutput as projectBashOutput, bashStart as projectBashStart, initialConvState, reduce as projectEvent, } from '../../conversation/projection.js';
|
|
50
48
|
/** Theme-derived chrome colors (spinner / dim / error) are supplied by the
|
|
51
49
|
* attach command via `ChatViewOptions.palette` (built from the live theme in
|
|
@@ -58,30 +56,6 @@ const defaultDimStyle = (s) => `\x1b[2m${s}\x1b[22m`;
|
|
|
58
56
|
* Keeps large non-streaming snapshots from monopolizing the main thread so
|
|
59
57
|
* queued keystrokes are serviced during construction. */
|
|
60
58
|
const SNAPSHOT_YIELD_EVERY = 50;
|
|
61
|
-
/** The user's `live_cycles` setting — how many trailing refresh-yield cycles the
|
|
62
|
-
* transcript renders at full fidelity. Read per ChatView (i.e. per attach), so
|
|
63
|
-
* `crtr sys config set live_cycles --value N` takes effect on the next attach
|
|
64
|
-
* without a daemon restart. A missing/unreadable config falls back to the
|
|
65
|
-
* shipped default. */
|
|
66
|
-
function readLiveCycles() {
|
|
67
|
-
try {
|
|
68
|
-
return readConfig('user').live_cycles;
|
|
69
|
-
}
|
|
70
|
-
catch {
|
|
71
|
-
return DEFAULT_LIVE_CYCLES;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/** The user's `condensed_history` setting — which messages of an already-condensed
|
|
75
|
-
* cycle still render (the cycle dividers always do). Read per attach, like
|
|
76
|
-
* `live_cycles`. */
|
|
77
|
-
function readCondensedHistory() {
|
|
78
|
-
try {
|
|
79
|
-
return readConfig('user').condensed_history;
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
return DEFAULT_CONDENSED_HISTORY;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
59
|
/** The user's `verbosity` setting — the level every viewer starts at. Ctrl+O and
|
|
86
60
|
* Ctrl+Shift+O move the open viewer only and never write it back. */
|
|
87
61
|
function readVerbosity() {
|
|
@@ -282,10 +256,6 @@ export class ChatView {
|
|
|
282
256
|
/** Optional banner, above history and status in the viewport's flat source. */
|
|
283
257
|
bannerContainer;
|
|
284
258
|
transcript;
|
|
285
|
-
/** Where `append()` puts a component. Normally `historyContainer`; retargeted to
|
|
286
|
-
* a nested container while condensed history is being built, so the same
|
|
287
|
-
* message-rendering path serves both regions. */
|
|
288
|
-
appendTarget = this.historyContainer;
|
|
289
259
|
/** Inline page blocks placed in this transcript, by page id — one block per
|
|
290
260
|
* page, so a `--replace` revision refreshes the block already on screen. */
|
|
291
261
|
pageBlocks = new Map();
|
|
@@ -296,10 +266,6 @@ export class ChatView {
|
|
|
296
266
|
inlinePageBlocks;
|
|
297
267
|
pageOpenHint;
|
|
298
268
|
backgroundBashHint;
|
|
299
|
-
/** Trailing cycles kept at full fidelity (config `live_cycles`). */
|
|
300
|
-
liveCycles;
|
|
301
|
-
/** Messages kept from a condensed cycle (config `condensed_history`). */
|
|
302
|
-
condensedHistory;
|
|
303
269
|
cwd;
|
|
304
270
|
showImages;
|
|
305
271
|
imageWidthCells;
|
|
@@ -317,16 +283,11 @@ export class ChatView {
|
|
|
317
283
|
turnReplies = new Map();
|
|
318
284
|
turns = [];
|
|
319
285
|
openReplyTurn;
|
|
320
|
-
/** The turn the live region opens in when it begins mid-turn (the condensed
|
|
321
|
-
* region held its person's message), else the pre-message `start` turn. */
|
|
322
|
-
carriedTurn = { key: START_TURN_KEY, prose: [] };
|
|
323
286
|
/** >0 while appending components that never join a turn (the person's
|
|
324
|
-
* message, turn chrome, errors
|
|
287
|
+
* message, turn chrome, errors). */
|
|
325
288
|
outsideTurns = 0;
|
|
326
289
|
/** Components the turn fold currently hides. */
|
|
327
290
|
turnHidden = new Set();
|
|
328
|
-
/** Both forms of condensed history, when it exists; one is hidden per level. */
|
|
329
|
-
condensedBlocks = {};
|
|
330
291
|
/** The newest turn's reply text, which `/copy` takes at Replies only. */
|
|
331
292
|
lastReplyText;
|
|
332
293
|
groupSummaries = new Map();
|
|
@@ -406,9 +367,6 @@ export class ChatView {
|
|
|
406
367
|
/** Canonical copyable transcript blocks, in their rendered visual order. */
|
|
407
368
|
copyBlockRecords = [];
|
|
408
369
|
copyIndex = new Map();
|
|
409
|
-
/** Registrations made while building condensed history are collapsed onto its
|
|
410
|
-
* outer container once that container becomes a top-level viewport block. */
|
|
411
|
-
condensedCopyBlocks = new WeakMap();
|
|
412
370
|
constructor(tui, container, opts = {}) {
|
|
413
371
|
this.tui = tui;
|
|
414
372
|
this.container = container;
|
|
@@ -418,8 +376,6 @@ export class ChatView {
|
|
|
418
376
|
this.hideThinking = opts.hideThinking ?? false;
|
|
419
377
|
this.hiddenThinkingLabel = opts.hiddenThinkingLabel ?? 'Thinking...';
|
|
420
378
|
this.level = opts.verbosity ?? readVerbosity();
|
|
421
|
-
this.liveCycles = opts.liveCycles ?? readLiveCycles();
|
|
422
|
-
this.condensedHistory = opts.condensedHistory ?? readCondensedHistory();
|
|
423
379
|
this.onFooterEvent = opts.onFooterEvent;
|
|
424
380
|
this.onActivityChange = opts.onActivityChange;
|
|
425
381
|
this.inlinePageBlocks = opts.inlinePageBlocks ?? false;
|
|
@@ -480,24 +436,7 @@ export class ChatView {
|
|
|
480
436
|
const renderedPendingTools = new Map();
|
|
481
437
|
const messages = this.projection.messages;
|
|
482
438
|
const lastIndex = messages.length - 1;
|
|
483
|
-
|
|
484
|
-
// container before the live region is built. It retains only configured prose
|
|
485
|
-
// and cycle seams, avoiding old tool components while still reflowing on pane
|
|
486
|
-
// resize. `liveStart` is 0 until the node has yielded past the configured
|
|
487
|
-
// window, so a fresh node renders at full fidelity. Both forms are built —
|
|
488
|
-
// one reply per turn for Replies only, the kept messages for every other
|
|
489
|
-
// level — so a level change only swaps which one is hidden.
|
|
490
|
-
const liveStart = liveRegionStart(messages, this.liveCycles);
|
|
491
|
-
if (liveStart > 0) {
|
|
492
|
-
for (const form of ['turns', 'messages']) {
|
|
493
|
-
const condensed = await this.buildCondensedBlock(messages.slice(0, liveStart), generation, form);
|
|
494
|
-
if (generation !== this.snapshotGeneration)
|
|
495
|
-
return;
|
|
496
|
-
if (condensed)
|
|
497
|
-
this.appendCondensedBlock(condensed, form);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
for (let i = liveStart; i < messages.length; i++) {
|
|
439
|
+
for (let i = 0; i < messages.length; i++) {
|
|
501
440
|
// Yield to the event loop every SNAPSHOT_YIELD_EVERY messages so queued
|
|
502
441
|
// stdin drains (keystrokes are handled instead of bursting after a long
|
|
503
442
|
// catch-up) while a big transcript constructs. Skipped for a STREAMING
|
|
@@ -505,8 +444,8 @@ export class ChatView {
|
|
|
505
444
|
// relayed message_update/message_end lands, so it builds synchronously
|
|
506
445
|
// (no await → no broker frame can interleave and freeze the live bubble).
|
|
507
446
|
if (!this.projection.isStreaming &&
|
|
508
|
-
i >
|
|
509
|
-
|
|
447
|
+
i > 0 &&
|
|
448
|
+
i % SNAPSHOT_YIELD_EVERY === 0) {
|
|
510
449
|
await new Promise((resolve) => setImmediate(resolve));
|
|
511
450
|
// A newer welcome arrived while we were suspended — abandon this stale
|
|
512
451
|
// build without touching the view (or the gate) it no longer owns.
|
|
@@ -620,107 +559,6 @@ export class ChatView {
|
|
|
620
559
|
this.applyingSnapshot = false;
|
|
621
560
|
this.replayDeferredFrames();
|
|
622
561
|
}
|
|
623
|
-
/**
|
|
624
|
-
* Build the condensed form of the already-finished cycles as a nested component
|
|
625
|
-
* container, or return undefined when nothing survives condensation.
|
|
626
|
-
*
|
|
627
|
-
* Reuses `addMessageToChat` by retargeting `append()` at the nested container, so
|
|
628
|
-
* condensed history uses the same renderer as live history with tool traffic
|
|
629
|
-
* filtered out. The outer history cache keeps stable-width frames cheap, while
|
|
630
|
-
* preserving the components lets pane-width changes reflow their content. The
|
|
631
|
-
* build yields on the live cadence and abandons itself when a newer welcome
|
|
632
|
-
* supersedes this generation.
|
|
633
|
-
*/
|
|
634
|
-
async buildCondensedBlock(messages, generation, form) {
|
|
635
|
-
const condensed = new Container();
|
|
636
|
-
const previousTarget = this.appendTarget;
|
|
637
|
-
const copyBlocks = [];
|
|
638
|
-
this.appendTarget = condensed;
|
|
639
|
-
this.condensedCopyBlocks.set(condensed, copyBlocks);
|
|
640
|
-
try {
|
|
641
|
-
if (form === 'turns') {
|
|
642
|
-
if (!(await this.buildCondensedTurns(messages, generation)))
|
|
643
|
-
return undefined;
|
|
644
|
-
return condensed.children.length > 0 ? { component: condensed, copyBlocks } : undefined;
|
|
645
|
-
}
|
|
646
|
-
let built = 0;
|
|
647
|
-
for (const message of messages) {
|
|
648
|
-
if (!keepWhenCondensed(message, this.condensedHistory))
|
|
649
|
-
continue;
|
|
650
|
-
if (built > 0 && built % SNAPSHOT_YIELD_EVERY === 0) {
|
|
651
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
652
|
-
if (generation !== this.snapshotGeneration)
|
|
653
|
-
return undefined;
|
|
654
|
-
}
|
|
655
|
-
built++;
|
|
656
|
-
// Condensed prose still feeds the @-path picker; `lastAssistantText` (the
|
|
657
|
-
// `/copy` source) deliberately does not — the live region always holds the
|
|
658
|
-
// newest reply.
|
|
659
|
-
this.pushTranscriptText(this.userMessageText(message));
|
|
660
|
-
this.addMessageToChat(message);
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
finally {
|
|
664
|
-
this.appendTarget = previousTarget;
|
|
665
|
-
this.condensedCopyBlocks.delete(condensed);
|
|
666
|
-
}
|
|
667
|
-
return condensed.children.length > 0 ? { component: condensed, copyBlocks } : undefined;
|
|
668
|
-
}
|
|
669
|
-
/** Replies only in condensed history: each finished turn renders as
|
|
670
|
-
* the person's message, its reply, then any cycle dividers it spanned. A turn
|
|
671
|
-
* still open at the end continues into the live region, so it is carried there
|
|
672
|
-
* instead of rendered. Returns false when a newer welcome superseded the build. */
|
|
673
|
-
async buildCondensedTurns(messages, generation) {
|
|
674
|
-
const turns = [{ key: START_TURN_KEY, prose: [], dividers: [] }];
|
|
675
|
-
for (const message of messages) {
|
|
676
|
-
const turn = turns.at(-1);
|
|
677
|
-
if (isTrueUserMessage(message)) {
|
|
678
|
-
turns.push({ key: messageKey(message) ?? `local-${turns.length}`, user: message, prose: [], dividers: [] });
|
|
679
|
-
}
|
|
680
|
-
else if (isCycleDivider(message)) {
|
|
681
|
-
turn.dividers.push(message);
|
|
682
|
-
}
|
|
683
|
-
else if (message.role === 'assistant' && message.stopReason !== 'aborted' && message.stopReason !== 'error') {
|
|
684
|
-
const text = assistantVisibleText(message).trim();
|
|
685
|
-
const key = messageKey(message);
|
|
686
|
-
if (text !== '' && key !== undefined)
|
|
687
|
-
turn.prose.push({ key, text });
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
const last = turns.pop();
|
|
691
|
-
let built = 0;
|
|
692
|
-
const render = async (turn, withReply) => {
|
|
693
|
-
if (built > 0 && built % SNAPSHOT_YIELD_EVERY === 0) {
|
|
694
|
-
await new Promise((resolve) => setImmediate(resolve));
|
|
695
|
-
if (generation !== this.snapshotGeneration)
|
|
696
|
-
return false;
|
|
697
|
-
}
|
|
698
|
-
built++;
|
|
699
|
-
if (turn.user !== undefined) {
|
|
700
|
-
this.pushTranscriptText(this.userMessageText(turn.user));
|
|
701
|
-
this.addMessageToChat(turn.user);
|
|
702
|
-
}
|
|
703
|
-
const text = withReply ? turnReplyText(turn.prose, this.turnReplies.get(turn.key)) : '';
|
|
704
|
-
if (text !== '') {
|
|
705
|
-
const component = new ViewerAssistantMessageComponent(undefined, this.hideThinking, attachMarkdownTheme(), this.hiddenThinkingLabel, this.markdownTransformers);
|
|
706
|
-
component.updateContent(this.replyMessage(text));
|
|
707
|
-
this.append(component);
|
|
708
|
-
this.registerCopyBlock(component, 'assistant', text);
|
|
709
|
-
}
|
|
710
|
-
for (const divider of turn.dividers)
|
|
711
|
-
this.addMessageToChat(divider);
|
|
712
|
-
return true;
|
|
713
|
-
};
|
|
714
|
-
for (const turn of turns)
|
|
715
|
-
if (!(await render(turn, true)))
|
|
716
|
-
return false;
|
|
717
|
-
// The open turn: its person's message (and any dividers so far) stay here,
|
|
718
|
-
// its reply joins the live region where its working continues.
|
|
719
|
-
if (!(await render(last, false)))
|
|
720
|
-
return false;
|
|
721
|
-
this.carriedTurn = { key: last.key, prose: last.prose };
|
|
722
|
-
return true;
|
|
723
|
-
}
|
|
724
562
|
/** Defer a live broker frame when a snapshot build is in flight. Returns true
|
|
725
563
|
* (and enqueues the replay closure) while building so the caller returns
|
|
726
564
|
* without mutating the half-rebuilt view; false when the caller may proceed.
|
|
@@ -846,11 +684,6 @@ export class ChatView {
|
|
|
846
684
|
this.historyContainer.setHidden(component, true);
|
|
847
685
|
}
|
|
848
686
|
this.turnHidden = turnFolded;
|
|
849
|
-
for (const form of ['turns', 'messages']) {
|
|
850
|
-
const block = this.condensedBlocks[form];
|
|
851
|
-
if (block)
|
|
852
|
-
this.historyContainer.setHidden(block, (form === 'turns') !== this.repliesOnly());
|
|
853
|
-
}
|
|
854
687
|
this.applyInboxExchangeDisplay();
|
|
855
688
|
this.updateFoldedToolSeparators(inFlight);
|
|
856
689
|
this.historyContainer.markDirty();
|
|
@@ -919,17 +752,12 @@ export class ChatView {
|
|
|
919
752
|
this.refreshTurn(turn);
|
|
920
753
|
return turn;
|
|
921
754
|
}
|
|
922
|
-
/** Whether an append in progress lands in the live region, where every
|
|
923
|
-
* component joins a turn. */
|
|
924
|
-
consolidatingHere() {
|
|
925
|
-
return this.appendTarget === this.historyContainer;
|
|
926
|
-
}
|
|
927
755
|
currentTurn() {
|
|
928
|
-
return this.openReplyTurn ?? this.beginTurn(
|
|
756
|
+
return this.openReplyTurn ?? this.beginTurn(START_TURN_KEY);
|
|
929
757
|
}
|
|
930
758
|
/** A settled assistant message with prose becomes part of its turn's reply. */
|
|
931
759
|
recordTurnProse(message, refresh) {
|
|
932
|
-
if (
|
|
760
|
+
if (message.role !== 'assistant')
|
|
933
761
|
return;
|
|
934
762
|
if (message.stopReason === 'aborted' || message.stopReason === 'error')
|
|
935
763
|
return;
|
|
@@ -1363,17 +1191,6 @@ export class ChatView {
|
|
|
1363
1191
|
this.appendGroupMember(new CrtrOutputMessageComponent(this.userMessageText(message), this.toolOutputExpanded(), this.crtrOutputTheme()));
|
|
1364
1192
|
break;
|
|
1365
1193
|
}
|
|
1366
|
-
// A refresh-yield cycle boundary (session-cycles.ts, synthetic — never
|
|
1367
|
-
// persisted): render as a dim rule rather than the generic custom-
|
|
1368
|
-
// message card, so scrolling through a multi-cycle node's full history
|
|
1369
|
-
// reads as one conversation with clear seams between cycles.
|
|
1370
|
-
if (message.customType === CRTR_CYCLE_DIVIDER_CUSTOM_TYPE) {
|
|
1371
|
-
this.closeOpenGroup();
|
|
1372
|
-
this.append(new Spacer(1));
|
|
1373
|
-
this.append(new Text(this.dimStyle(`── ${this.userMessageText(message)} ──`), 1, 0));
|
|
1374
|
-
this.append(new Spacer(1));
|
|
1375
|
-
break;
|
|
1376
|
-
}
|
|
1377
1194
|
const component = new CustomMessageComponent(styleAttachMessageMarkdown(message), undefined, attachMarkdownTheme());
|
|
1378
1195
|
component.setExpanded(this.toolOutputExpanded());
|
|
1379
1196
|
this.appendGroupMember(component);
|
|
@@ -1402,10 +1219,7 @@ export class ChatView {
|
|
|
1402
1219
|
this.closeOpenGroup();
|
|
1403
1220
|
// The person's message stands outside every turn and opens the next
|
|
1404
1221
|
// one, whose reply (shown at Replies only) sits directly beneath it.
|
|
1405
|
-
if (isTrueUserMessage(message)
|
|
1406
|
-
// A turn carried over from condensed history ends here; give it its reply.
|
|
1407
|
-
if (!this.openReplyTurn && this.carriedTurn.prose.length > 0)
|
|
1408
|
-
this.currentTurn();
|
|
1222
|
+
if (isTrueUserMessage(message)) {
|
|
1409
1223
|
this.outsideTurns++;
|
|
1410
1224
|
try {
|
|
1411
1225
|
this.appendUserMessage(message);
|
|
@@ -1510,17 +1324,14 @@ export class ChatView {
|
|
|
1510
1324
|
}
|
|
1511
1325
|
appendHumanAnswerParts(text) {
|
|
1512
1326
|
this.closeOpenGroup();
|
|
1513
|
-
const live = this.appendTarget === this.historyContainer;
|
|
1514
1327
|
if (this.chatChildCount() > 0) {
|
|
1515
1328
|
const spacer = new Spacer(1);
|
|
1516
1329
|
this.append(spacer);
|
|
1517
|
-
|
|
1518
|
-
this.trackInboxAnswer(spacer);
|
|
1330
|
+
this.trackInboxAnswer(spacer);
|
|
1519
1331
|
}
|
|
1520
1332
|
const component = new UserMessageComponent(text, attachMarkdownTheme(), undefined, this.markdownTransformers);
|
|
1521
1333
|
this.append(component);
|
|
1522
|
-
|
|
1523
|
-
this.trackInboxAnswer(component);
|
|
1334
|
+
this.trackInboxAnswer(component);
|
|
1524
1335
|
this.registerCopyBlock(component, 'user', text);
|
|
1525
1336
|
}
|
|
1526
1337
|
trackInboxAnswer(component) {
|
|
@@ -1528,15 +1339,7 @@ export class ChatView {
|
|
|
1528
1339
|
if (this.hidesInboxExchange())
|
|
1529
1340
|
this.historyContainer.setHidden(component, true);
|
|
1530
1341
|
}
|
|
1531
|
-
/** Only the full-fidelity trailing region gets summary groups. Condensed
|
|
1532
|
-
* history intentionally drops tool traffic, so grouping there would create
|
|
1533
|
-
* phantom summary rows and cross the live/condensed boundary. */
|
|
1534
|
-
isLiveGroupRegion() {
|
|
1535
|
-
return this.appendTarget === this.historyContainer;
|
|
1536
|
-
}
|
|
1537
1342
|
ensureGroup() {
|
|
1538
|
-
if (!this.isLiveGroupRegion())
|
|
1539
|
-
return undefined;
|
|
1540
1343
|
if (this.openGroup)
|
|
1541
1344
|
return this.openGroup;
|
|
1542
1345
|
const recap = new GroupRecapComponent();
|
|
@@ -1576,8 +1379,7 @@ export class ChatView {
|
|
|
1576
1379
|
/** Add one tool as a group member, moving the assistant's boundary separator
|
|
1577
1380
|
* behind the new summary row without changing the separator's identity. */
|
|
1578
1381
|
appendToolComponent(name, id, args) {
|
|
1579
|
-
const trailingSeparator = this.
|
|
1580
|
-
!this.openGroup &&
|
|
1382
|
+
const trailingSeparator = !this.openGroup &&
|
|
1581
1383
|
this.historyContainer.children.at(-1) instanceof FoldedToolSeparator
|
|
1582
1384
|
? this.historyContainer.children.at(-1)
|
|
1583
1385
|
: undefined;
|
|
@@ -1727,21 +1529,19 @@ export class ChatView {
|
|
|
1727
1529
|
component.setExpanded(this.toolOutputExpanded());
|
|
1728
1530
|
return component;
|
|
1729
1531
|
}
|
|
1730
|
-
/** Append conversation content above the independent live status area
|
|
1731
|
-
* the nested container while condensed history is under construction. */
|
|
1532
|
+
/** Append conversation content above the independent live status area. */
|
|
1732
1533
|
append(child) {
|
|
1733
|
-
if (this.outsideTurns === 0
|
|
1534
|
+
if (this.outsideTurns === 0) {
|
|
1734
1535
|
const turn = this.currentTurn();
|
|
1735
|
-
this.
|
|
1536
|
+
this.historyContainer.addChild(child);
|
|
1736
1537
|
turn.members.add(child);
|
|
1737
1538
|
return;
|
|
1738
1539
|
}
|
|
1739
|
-
this.
|
|
1540
|
+
this.historyContainer.addChild(child);
|
|
1740
1541
|
}
|
|
1741
|
-
/** Number of rendered conversation components
|
|
1742
|
-
* appended to (live history or the nested condensed region). */
|
|
1542
|
+
/** Number of rendered conversation components. */
|
|
1743
1543
|
chatChildCount() {
|
|
1744
|
-
return this.
|
|
1544
|
+
return this.historyContainer.children.length;
|
|
1745
1545
|
}
|
|
1746
1546
|
/** Clear all chat content. */
|
|
1747
1547
|
resetChat() {
|
|
@@ -1755,9 +1555,7 @@ export class ChatView {
|
|
|
1755
1555
|
this.openGroup = undefined;
|
|
1756
1556
|
this.turns.length = 0;
|
|
1757
1557
|
this.openReplyTurn = undefined;
|
|
1758
|
-
this.carriedTurn = { key: START_TURN_KEY, prose: [] };
|
|
1759
1558
|
this.turnHidden = new Set();
|
|
1760
|
-
this.condensedBlocks = {};
|
|
1761
1559
|
this.lastReplyText = undefined;
|
|
1762
1560
|
this.groupSummaries.clear();
|
|
1763
1561
|
this.nodeRoster.clear();
|
|
@@ -1774,10 +1572,9 @@ export class ChatView {
|
|
|
1774
1572
|
/** Place the transcript block for an inline page a `human send` just raised.
|
|
1775
1573
|
* The block is a plain history child, NOT a tool-group member: collapsing the
|
|
1776
1574
|
* tool group folds the command away and leaves the page itself on screen, the
|
|
1777
|
-
* way assistant prose stays.
|
|
1778
|
-
* cycles keep only prose and cycle seams. */
|
|
1575
|
+
* way assistant prose stays. */
|
|
1779
1576
|
maybeAppendPageBlock(result) {
|
|
1780
|
-
if (!this.inlinePageBlocks
|
|
1577
|
+
if (!this.inlinePageBlocks)
|
|
1781
1578
|
return;
|
|
1782
1579
|
const page = detectInlinePageResult(result);
|
|
1783
1580
|
if (page === undefined || this.pageBlocks.has(page.pageId))
|
|
@@ -2018,32 +1815,15 @@ export class ChatView {
|
|
|
2018
1815
|
.join('\n\n');
|
|
2019
1816
|
}
|
|
2020
1817
|
/** Blocks built for the other side of the Replies-only boundary: the turn
|
|
2021
|
-
* replies
|
|
2022
|
-
* message-form condensed history at Replies only. */
|
|
1818
|
+
* replies at every other level. */
|
|
2023
1819
|
inactiveFormBlocks() {
|
|
2024
1820
|
const inactive = new Set();
|
|
2025
|
-
if (this.repliesOnly())
|
|
2026
|
-
if (this.condensedBlocks.messages)
|
|
2027
|
-
inactive.add(this.condensedBlocks.messages);
|
|
2028
|
-
}
|
|
2029
|
-
else {
|
|
2030
|
-
if (this.condensedBlocks.turns)
|
|
2031
|
-
inactive.add(this.condensedBlocks.turns);
|
|
1821
|
+
if (!this.repliesOnly())
|
|
2032
1822
|
for (const turn of this.turns)
|
|
2033
1823
|
inactive.add(turn.reply);
|
|
2034
|
-
}
|
|
2035
1824
|
return inactive;
|
|
2036
1825
|
}
|
|
2037
1826
|
registerCopyBlock(block, kind, text) {
|
|
2038
|
-
const condensedCopyBlocks = this.condensedCopyBlocks.get(this.appendTarget);
|
|
2039
|
-
if (condensedCopyBlocks) {
|
|
2040
|
-
const index = condensedCopyBlocks.findIndex((copyBlock) => copyBlock.block === block);
|
|
2041
|
-
if (index === -1)
|
|
2042
|
-
condensedCopyBlocks.push({ block, kind, text });
|
|
2043
|
-
else
|
|
2044
|
-
condensedCopyBlocks[index].text = text;
|
|
2045
|
-
return;
|
|
2046
|
-
}
|
|
2047
1827
|
const index = this.copyIndex.get(block);
|
|
2048
1828
|
if (index === undefined) {
|
|
2049
1829
|
this.copyIndex.set(block, this.copyBlockRecords.length);
|
|
@@ -2054,13 +1834,6 @@ export class ChatView {
|
|
|
2054
1834
|
}
|
|
2055
1835
|
}
|
|
2056
1836
|
unregisterCopyBlock(block) {
|
|
2057
|
-
const condensedCopyBlocks = this.condensedCopyBlocks.get(this.appendTarget);
|
|
2058
|
-
if (condensedCopyBlocks) {
|
|
2059
|
-
const index = condensedCopyBlocks.findIndex((copyBlock) => copyBlock.block === block);
|
|
2060
|
-
if (index !== -1)
|
|
2061
|
-
condensedCopyBlocks.splice(index, 1);
|
|
2062
|
-
return;
|
|
2063
|
-
}
|
|
2064
1837
|
const index = this.copyIndex.get(block);
|
|
2065
1838
|
if (index === undefined)
|
|
2066
1839
|
return;
|
|
@@ -2070,18 +1843,6 @@ export class ChatView {
|
|
|
2070
1843
|
this.copyIndex.set(this.copyBlockRecords[i].block, i);
|
|
2071
1844
|
}
|
|
2072
1845
|
}
|
|
2073
|
-
appendCondensedBlock({ component, copyBlocks }, form) {
|
|
2074
|
-
this.outsideTurns++;
|
|
2075
|
-
try {
|
|
2076
|
-
this.append(component);
|
|
2077
|
-
}
|
|
2078
|
-
finally {
|
|
2079
|
-
this.outsideTurns--;
|
|
2080
|
-
}
|
|
2081
|
-
this.condensedBlocks[form] = component;
|
|
2082
|
-
this.historyContainer.setHidden(component, (form === 'turns') !== this.repliesOnly());
|
|
2083
|
-
this.registerCopyBlock(component, 'condensed', copyBlocks.map((copyBlock) => copyBlock.text).filter((text) => text.trim() !== '').join('\n\n'));
|
|
2084
|
-
}
|
|
2085
1846
|
/** Flatten arbitrary tool result payloads into the visible text copy target. */
|
|
2086
1847
|
toolResultText(result) {
|
|
2087
1848
|
if (typeof result === 'string')
|
|
@@ -128,7 +128,7 @@ onConnected) {
|
|
|
128
128
|
cwd: meta.cwd,
|
|
129
129
|
palette: pal,
|
|
130
130
|
hideThinking: true,
|
|
131
|
-
banner: [...croutonBannerLines(buildBannerInfo(meta)), pal.muted(`Older messages: crtr
|
|
131
|
+
banner: [...croutonBannerLines(buildBannerInfo(meta)), pal.muted(`Older messages: crtr node inspect transcript ${nodeId}`)],
|
|
132
132
|
// Local only: a remote attach cannot read this canvas's ticket dirs, so it
|
|
133
133
|
// has nothing to render a page block from.
|
|
134
134
|
inlinePageBlocks: !remote,
|
|
@@ -630,11 +630,12 @@ onConnected) {
|
|
|
630
630
|
const restartedFor = process.env['CRTR_ATTACH_RESTARTED_FOR'];
|
|
631
631
|
delete process.env['CRTR_ATTACH_RESTARTED_FOR'];
|
|
632
632
|
const restartIfReleaseChanged = async () => {
|
|
633
|
-
const { processGeneration } = await import('../../commands/sys/shared.js');
|
|
633
|
+
const { processGeneration, selectedGeneration } = await import('../../commands/sys/shared.js');
|
|
634
634
|
const mine = processGeneration()?.id;
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
635
|
+
// The release selected on this machine, never the daemon's: a signed-in viewer's status call is answered by the server.
|
|
636
|
+
const selected = selectedGeneration().generation?.id;
|
|
637
|
+
if (mine !== undefined && selected !== undefined && selected !== mine && selected !== restartedFor && !lifecycle.isTornDown()) {
|
|
638
|
+
restartViewer({ CRTR_ATTACH_RESTARTED_FOR: selected });
|
|
638
639
|
}
|
|
639
640
|
};
|
|
640
641
|
// Last resort for a background daemon call that escaped its owner's catch.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/** The canvas schema version this build supports: the number of the highest delta in `schema-pg/` (the baseline
|
|
7
7
|
* `schema-pg.sql` is version 1). `scripts/install-runtime.mjs` reads this module from a candidate generation to refuse
|
|
8
8
|
* one below the live database's `schema_min_reader`. */
|
|
9
|
-
export const CANVAS_SCHEMA_VERSION =
|
|
9
|
+
export const CANVAS_SCHEMA_VERSION = 24;
|
|
10
10
|
/** The Postgres schema holding the canvas tables: `CRTR_DATABASE_SCHEMA` (`crtr` in the cloud deploy). Unset or empty
|
|
11
11
|
* means the role's own search_path (`public` on a Mac and on a VM). A name that is not a plain identifier is an error:
|
|
12
12
|
* it is put in a `search_path` connection option. */
|
|
@@ -2,7 +2,7 @@ import { envProfileId } from '../shared/env.js';
|
|
|
2
2
|
import { basename, join } from 'node:path';
|
|
3
3
|
import { existsSync, mkdirSync, statSync } from 'node:fs';
|
|
4
4
|
import { isDeepStrictEqual } from 'node:util';
|
|
5
|
-
import { CONFIG_FILE, STATE_FILE,
|
|
5
|
+
import { CONFIG_FILE, STATE_FILE, VERBOSITY_LEVELS, MOUSE_MODE_DEFAULTS, WHIP_MESSAGE_MODES, DEFAULT_WHIP_MESSAGES, defaultScopeConfig, defaultScopeState, defaultModelLaddersConfig, defaultKindsConfig, defaultRemoteCanvasConfig } from '../types.js';
|
|
6
6
|
import { BINDING_CATALOG, BINDING_IDS, isAttachPaneBinding } from './keybindings/catalog.js';
|
|
7
7
|
import { notFound } from './errors.js';
|
|
8
8
|
import { emitEvent } from './events/emit.js';
|
|
@@ -872,10 +872,6 @@ function mergeConfig(partial) {
|
|
|
872
872
|
const mouse_mode_default = MOUSE_MODE_DEFAULTS.includes(partial.mouse_mode_default)
|
|
873
873
|
? partial.mouse_mode_default
|
|
874
874
|
: defaults.mouse_mode_default;
|
|
875
|
-
const live_cycles = normalizePositiveInteger(partial.live_cycles, defaults.live_cycles);
|
|
876
|
-
const condensed_history = CONDENSED_HISTORY_MODES.includes(partial.condensed_history)
|
|
877
|
-
? partial.condensed_history
|
|
878
|
-
: defaults.condensed_history;
|
|
879
875
|
const bash_tool_purpose = typeof partial.bash_tool_purpose === 'boolean' ? partial.bash_tool_purpose : defaults.bash_tool_purpose;
|
|
880
876
|
const verbosity = VERBOSITY_LEVELS.includes(partial.verbosity) ? partial.verbosity : defaults.verbosity;
|
|
881
877
|
const detailed_tool_recaps = typeof partial.detailed_tool_recaps === 'boolean' ? partial.detailed_tool_recaps : defaults.detailed_tool_recaps;
|
|
@@ -904,7 +900,7 @@ function mergeConfig(partial) {
|
|
|
904
900
|
const spawnEnv = mergeSpawnEnv(partial.spawnEnv, defaults.spawnEnv?.allow);
|
|
905
901
|
const bin = normalizeBin(partial.bin);
|
|
906
902
|
const humanActions = normalizeHumanActions(partial.humanActions);
|
|
907
|
-
return { bin, humanActions, schema_version, marketplaces, plugins, auto_update, max_panes_per_window, auto_open_child_viewers, brokerThresholds, lifecycle, completion_bell, working_gerunds, whip_mode, page_components, page_surface, whip_messages, whip_message_mode, mouse_mode_default,
|
|
903
|
+
return { bin, humanActions, schema_version, marketplaces, plugins, auto_update, max_panes_per_window, auto_open_child_viewers, brokerThresholds, lifecycle, completion_bell, working_gerunds, whip_mode, page_components, page_surface, whip_messages, whip_message_mode, mouse_mode_default, bash_tool_purpose, verbosity, detailed_tool_recaps, document_port, keybindings, tmux_passthrough, modelLadders, providerOptions, ...(Object.keys(modelRoutes).length > 0 ? { modelRoutes } : {}), ...(Object.keys(routes.legacy).length > 0 ? { legacyModelRoutes: routes.legacy } : {}), ...(modelRouting !== undefined ? { modelRouting } : {}), kinds, remoteCanvas, api, ...(paths ? { paths } : {}), ...(store ? { store } : {}), ...(runtime ? { runtime } : {}), spawnEnv };
|
|
908
904
|
}
|
|
909
905
|
/** Raw (un-defaulted) partial config for one scope, or null if the scope has
|
|
910
906
|
* no root or no config.json. Used by `readMergedLaunchConfig` to layer
|
|
@@ -98,7 +98,7 @@ export function createStoreClient(address, token) {
|
|
|
98
98
|
return { header: header, entries, path: reply.path ?? '' };
|
|
99
99
|
return { header: header, entries: entries.slice(0, reply.tail - 1), tail: entries.slice(reply.tail - 1), path: reply.path ?? '' };
|
|
100
100
|
};
|
|
101
|
-
const readPath = (id, window) => window ? `${url(id)}?head=${window.head}&tail=${window.tail}` : url(id);
|
|
101
|
+
const readPath = (id, window) => window === 'cycle' ? `${url(id)}?from=cycle` : window ? `${url(id)}?head=${window.head}&tail=${window.tail}` : url(id);
|
|
102
102
|
return {
|
|
103
103
|
create(nodeId, header, entries, path) {
|
|
104
104
|
return JSON.parse(call('POST', '/conversations', { node_id: nodeId, header, entries, path }).body);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dirname, resolve } from 'node:path';
|
|
2
|
-
import { SessionManager } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
import { CURRENT_SESSION_VERSION, SessionManager } from '@earendil-works/pi-coding-agent';
|
|
3
3
|
import { conversationClient, conversationIdFromPath } from './index.js';
|
|
4
4
|
import { findOrphanedParents } from './repair.js';
|
|
5
5
|
import { emitEvent } from '../events/emit.js';
|
|
@@ -32,7 +32,10 @@ export function installSessionManagerStorePatch(nodeId, store = conversationClie
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
function fromStore(id, cwdOverride) {
|
|
35
|
-
|
|
35
|
+
// A header below pi's version is migrated and rewritten whole on load, so it needs every cycle.
|
|
36
|
+
let { header, entries, path } = store.read(id, 'cycle');
|
|
37
|
+
if (header.version !== CURRENT_SESSION_VERSION)
|
|
38
|
+
({ header, entries, path } = store.read(id));
|
|
36
39
|
reportOrphans(header.id, entries);
|
|
37
40
|
const manager = SessionManager.inMemory(cwdOverride ?? header.cwd);
|
|
38
41
|
manager.sessionFile = path;
|
|
@@ -70,7 +73,9 @@ export function installSessionManagerStorePatch(nodeId, store = conversationClie
|
|
|
70
73
|
return id;
|
|
71
74
|
}
|
|
72
75
|
prototype._setSessionFile = function (path) {
|
|
73
|
-
|
|
76
|
+
let { header, entries } = store.read(idOf(path), 'cycle');
|
|
77
|
+
if (header.version !== CURRENT_SESSION_VERSION)
|
|
78
|
+
({ header, entries } = store.read(header.id));
|
|
74
79
|
this.sessionFile = store.header(header.id).path;
|
|
75
80
|
this.sessionDir = dirname(this.sessionFile);
|
|
76
81
|
reportOrphans(header.id, entries);
|