@north-light/cli 0.3.697 → 0.3.699

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.
@@ -20,7 +20,7 @@
20
20
  // for crouter-owned message/tool types it understands; other extension
21
21
  // `renderCall`/`renderResult` hooks degrade to the default ToolExecutionComponent
22
22
  // path while builtin tools, diffs, and partial-result streaming keep working.
23
- import { Container, Loader, Spacer, Text } from '@earendil-works/pi-tui';
23
+ import { Container, Loader, Markdown, Spacer, Text } from '@earendil-works/pi-tui';
24
24
  import { AssistantMessageComponent, BashExecutionComponent, BranchSummaryMessageComponent, CompactionSummaryMessageComponent, CustomMessageComponent, parseSkillBlock, SkillInvocationMessageComponent, ToolExecutionComponent, UserMessageComponent, } from '@earendil-works/pi-coding-agent';
25
25
  import { attachMarkdownTheme } from '../config.js';
26
26
  import { ContextMessageComponent } from './context-message.js';
@@ -274,6 +274,11 @@ export class ChatView {
274
274
  /** Standalone ChatViews render activity inline; the attach viewer supplies
275
275
  * `onActivityChange`, so its transcript excludes this container. */
276
276
  statusContainer = new MeasuredContainer();
277
+ /** Messages the person sent from this viewer that the engine has not echoed
278
+ * back yet, drawn gray below history. Outside `historyContainer`, so a
279
+ * welcome snapshot rebuild never drops them. */
280
+ pendingContainer = new MeasuredContainer();
281
+ pendingSends = [];
277
282
  /** Optional banner, above history and status in the viewport's flat source. */
278
283
  bannerContainer;
279
284
  transcript;
@@ -284,6 +289,7 @@ export class ChatView {
284
289
  /** Inline page blocks placed in this transcript, by page id — one block per
285
290
  * page, so a `--replace` revision refreshes the block already on screen. */
286
291
  pageBlocks = new Map();
292
+ pageRefresh = false;
287
293
  /** The person's inbox answers in the live region, each with its leading
288
294
  * spacer. Summary mode hides them with the settled pages they answer. */
289
295
  inboxAnswers = new Set();
@@ -435,11 +441,13 @@ export class ChatView {
435
441
  this.container.addChild(banner);
436
442
  }
437
443
  this.container.addChild(this.historyContainer);
444
+ this.container.addChild(this.pendingContainer);
438
445
  if (!this.onActivityChange)
439
446
  this.container.addChild(this.statusContainer);
440
447
  this.transcript = new CompositeViewportSource([
441
448
  ...(this.bannerContainer ? [this.bannerContainer] : []),
442
449
  this.historyContainer,
450
+ this.pendingContainer,
443
451
  ...(this.onActivityChange ? [] : [this.statusContainer]),
444
452
  ]);
445
453
  }
@@ -596,6 +604,7 @@ export class ChatView {
596
604
  }
597
605
  for (const turn of this.turns)
598
606
  this.refreshTurn(turn);
607
+ this.confirmPendingSendsIn(messages);
599
608
  // A rebuild constructs fresh components, which are born unfolded; re-apply the
600
609
  // setting so a reconnect/welcome does not silently unfold the transcript.
601
610
  this.applyToolDisplay();
@@ -847,9 +856,8 @@ export class ChatView {
847
856
  this.historyContainer.markDirty();
848
857
  this.tui.requestRender();
849
858
  }
850
- /** Replies only and Messages + summaries hide the back-and-forth with the
851
- * person: every settled inline page and every answer they gave from their
852
- * inbox. A page still awaiting an answer stays on screen. */
859
+ /** Replies only and Messages + summaries hide every answer the person gave
860
+ * from their inbox. A settled inline page hides in every mode. */
853
861
  hidesInboxExchange() {
854
862
  return this.showsGroupSummaries();
855
863
  }
@@ -858,7 +866,7 @@ export class ChatView {
858
866
  for (const component of this.inboxAnswers)
859
867
  this.historyContainer.setHidden(component, hide);
860
868
  for (const block of this.pageBlocks.values())
861
- this.historyContainer.setHidden(block, hide && block.settled);
869
+ this.historyContainer.setHidden(block, block.settled);
862
870
  }
863
871
  /** A broker rewrite landed for one turn. Stored first: it may precede the
864
872
  * turn's events, and snapshot rebuilds defer it through the writer gate. */
@@ -1030,6 +1038,8 @@ export class ChatView {
1030
1038
  break;
1031
1039
  }
1032
1040
  case 'message_start': {
1041
+ if (event.message.role === 'user' && isTrueUserMessage(event.message))
1042
+ this.confirmPendingSend(this.userMessageText(event.message).trim());
1033
1043
  if (event.message.role === 'custom' || event.message.role === 'user') {
1034
1044
  this.addMessageToChat(event.message);
1035
1045
  // A card that joined a folded turn hides at once.
@@ -1789,7 +1799,7 @@ export class ChatView {
1789
1799
  async loadPageBlock(block) {
1790
1800
  if (!(await block.refresh()))
1791
1801
  return;
1792
- this.historyContainer.setHidden(block, this.hidesInboxExchange() && block.settled);
1802
+ this.historyContainer.setHidden(block, block.settled);
1793
1803
  this.historyContainer.markDirty(block);
1794
1804
  this.tui.requestRender();
1795
1805
  }
@@ -1805,19 +1815,22 @@ export class ChatView {
1805
1815
  this.historyContainer.markDirty(component);
1806
1816
  this.tui.requestRender();
1807
1817
  }
1808
- /** Re-read every placed page through the daemon. Driven by the viewer's
1809
- * ticket-activity watcher, so an answer, a cancellation, or a `--replace`
1810
- * revision lands on the block already anchored in the transcript. */
1818
+ /** Re-read every unsettled page through the daemon. Driven by the viewer's
1819
+ * chrome poll, so an answer, a cancellation, or a `--replace` revision lands
1820
+ * on the block already anchored in the transcript, from any machine. */
1811
1821
  async refreshPageBlocks() {
1812
- const blocks = [...this.pageBlocks.values()];
1822
+ if (this.pageRefresh)
1823
+ return;
1824
+ const blocks = [...this.pageBlocks.values()].filter((block) => !block.settled);
1825
+ this.pageRefresh = true;
1813
1826
  const changed = await Promise.all(blocks.map(async (block) => {
1814
1827
  const moved = await block.refresh();
1815
1828
  if (moved) {
1816
- this.historyContainer.setHidden(block, this.hidesInboxExchange() && block.settled);
1829
+ this.historyContainer.setHidden(block, block.settled);
1817
1830
  this.historyContainer.markDirty(block);
1818
1831
  }
1819
1832
  return moved;
1820
- }));
1833
+ })).finally(() => { this.pageRefresh = false; });
1821
1834
  if (changed.some(Boolean))
1822
1835
  this.tui.requestRender();
1823
1836
  }
@@ -1855,6 +1868,50 @@ export class ChatView {
1855
1868
  this.historyContainer.markDirty(component);
1856
1869
  this.bashComponent = undefined;
1857
1870
  }
1871
+ /** Show a message the person just sent as pending: gray text, no background,
1872
+ * until the engine echoes it as a user message. */
1873
+ addPendingSend(text) {
1874
+ const trimmed = text.trim();
1875
+ if (!trimmed)
1876
+ return;
1877
+ const parts = [
1878
+ new Spacer(1),
1879
+ new Markdown(trimmed, 1, 1, attachMarkdownTheme(), { color: this.dimStyle }),
1880
+ ];
1881
+ for (const part of parts)
1882
+ this.pendingContainer.addChild(part);
1883
+ this.pendingSends.push({ text: trimmed, parts });
1884
+ this.tui.requestRender();
1885
+ }
1886
+ /** The engine echoed a user message: the matching pending send landed. */
1887
+ confirmPendingSend(text) {
1888
+ // The engine may reshape the text (image blocks, wrapping); with no exact
1889
+ // match the oldest pending send is the one that landed.
1890
+ const exact = this.pendingSends.findIndex((sent) => sent.text === text);
1891
+ const index = exact >= 0 ? exact : 0;
1892
+ if (this.pendingSends.length === 0)
1893
+ return;
1894
+ const [sent] = this.pendingSends.splice(index, 1);
1895
+ for (const part of sent.parts)
1896
+ this.pendingContainer.removeChild(part);
1897
+ }
1898
+ /** A snapshot rebuild: drop pending sends whose text the history now holds. */
1899
+ confirmPendingSendsIn(messages) {
1900
+ if (this.pendingSends.length === 0)
1901
+ return;
1902
+ const seen = new Set();
1903
+ for (const message of messages.slice(-50)) {
1904
+ if (message.role === 'user')
1905
+ seen.add(this.userMessageText(message).trim());
1906
+ }
1907
+ for (const sent of [...this.pendingSends]) {
1908
+ if (!seen.has(sent.text))
1909
+ continue;
1910
+ this.pendingSends.splice(this.pendingSends.indexOf(sent), 1);
1911
+ for (const part of sent.parts)
1912
+ this.pendingContainer.removeChild(part);
1913
+ }
1914
+ }
1858
1915
  /** Swap the single active activity indicator (working/compaction/retry). */
1859
1916
  setActivity(loader) {
1860
1917
  this.activityLoader?.stop();
@@ -92,6 +92,7 @@ export function createInputController(ctx, km, capabilities, hooks) {
92
92
  },
93
93
  onColor: hooks.setChipColor,
94
94
  onPromptSent: hooks.onPromptSent,
95
+ onMessageSent: hooks.onMessageSent,
95
96
  frecency: hooks.frecency,
96
97
  knownRefNames: () => editor.getResolvedRefNames(),
97
98
  // Global display toggles (Ctrl+O tools / Ctrl+T thinking) — pure render
@@ -54,7 +54,6 @@ import { openReviewSurfaceById, takeStartupReviewId } from '../inbox/review/laun
54
54
  import { ViewerSurfaceHost } from './session/surface-host.js';
55
55
  import { createInboxSurface } from '../inbox/surface.js';
56
56
  import { loadProfileManifest } from '../../core/profiles/manifest.js';
57
- import { watchInboxActivity } from '../../core/human/root.js';
58
57
  import { byNewestFirst, inboxRowFromDTO } from '../inbox/dto-adapt.js';
59
58
  import { cliClient } from '../../commands/api-client.js';
60
59
  import { installPersonSettingsDto, loadPersonSettingsViaApi } from '../../commands/person-settings.js';
@@ -276,12 +275,6 @@ onConnected) {
276
275
  return [...merged.values()].sort(byNewestFirst);
277
276
  } }),
278
277
  });
279
- // Page mutations (publish, --replace, answer, cancel) touch the activity file
280
- // whether or not the page went to the inbox, so transcript blocks refresh live.
281
- const stopPageWatch = remote ? () => { } : watchInboxActivity(() => {
282
- void chatView.refreshPageBlocks();
283
- void strip.refresh();
284
- });
285
278
  // The inline ticket page under the editor — what Enter on a strip row opens.
286
279
  // Review tickets and unreadable pages fall back to the full-pane inbox.
287
280
  const ticketPanel = createTicketPanel(ctx, {
@@ -452,7 +445,7 @@ onConnected) {
452
445
  refreshIdentity: () => identity.refresh(),
453
446
  renderFooter,
454
447
  renderExtensionWidgets,
455
- refreshInFlightTools: () => chatView.refreshInFlightTools(),
448
+ refreshInFlightTools: () => { chatView.refreshInFlightTools(); void chatView.refreshPageBlocks(); },
456
449
  pollGit: editorChrome.pollGit,
457
450
  });
458
451
  // Input layer — session/input-wiring.ts answers every hook InputController
@@ -476,6 +469,7 @@ onConnected) {
476
469
  if (userConfig.whip_mode)
477
470
  whipAnimation.play();
478
471
  },
472
+ onMessageSent: (text) => chatView.addPendingSend(text),
479
473
  frecency,
480
474
  });
481
475
  const whip = () => {
@@ -669,7 +663,6 @@ onConnected) {
669
663
  removeFileOpenListener();
670
664
  removeRejectionGuard();
671
665
  documentLinks.dispose();
672
- stopPageWatch();
673
666
  try {
674
667
  chatView.dispose();
675
668
  }
@@ -15,7 +15,7 @@ export function newId() {
15
15
  return id;
16
16
  }
17
17
  function stringify(value, name) {
18
- const json = JSON.stringify(value);
18
+ const json = JSON.stringify(value, (_key, v) => (typeof v === 'string' ? v.replace(/\p{Cs}/gu, '\uFFFD') : v));
19
19
  if (json === undefined)
20
20
  throw new TypeError(`${name} must be JSON-serializable`);
21
21
  return json;
@@ -73,15 +73,16 @@ export function buildScopedModelsData(id, session) {
73
73
  }
74
74
  export function buildGetTreeData(id, session, boundaryReviewId) {
75
75
  const manager = session.sessionManager;
76
- const tree = boundaryReviewId !== undefined ? boundaryRootedTree(manager.getTree(), boundaryReviewId) : manager.getTree();
76
+ const fullTree = boundaryReviewId !== undefined ? boundaryRootedTree(manager.getTree(), boundaryReviewId) : manager.getTree();
77
77
  const visibleEntryIds = new Set();
78
- const collectEntryIds = (nodes) => {
79
- for (const node of nodes) {
80
- visibleEntryIds.add(node.entry.id);
81
- collectEntryIds(node.children);
82
- }
83
- };
84
- collectEntryIds(tree);
78
+ // A copy without tool output: the picker shows a tool result as its call, and the output is most of a long conversation's bytes.
79
+ const withoutToolOutput = (nodes) => nodes.map((node) => {
80
+ visibleEntryIds.add(node.entry.id);
81
+ const { entry } = node;
82
+ const light = entry.type === 'message' && entry.message.role === 'toolResult' ? { ...entry, message: { ...entry.message, content: [], details: undefined } } : entry;
83
+ return { ...node, entry: light, children: withoutToolOutput(node.children) };
84
+ });
85
+ const tree = withoutToolOutput(fullTree);
85
86
  const forkPoints = session.getUserMessagesForForking()
86
87
  .filter((user) => visibleEntryIds.has(user.entryId))
87
88
  .map((user) => ({ id: user.entryId, text: user.text, timestamp: manager.getEntry(user.entryId)?.timestamp }));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/api",
3
- "version": "0.3.697",
3
+ "version": "0.3.699",
4
4
  "description": "Typed crtrd /v1 API contract — DTOs, route builders, the error contract, the CrtrClient, and the command-plugin manifest format. Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/api/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/identity",
3
- "version": "0.3.697",
3
+ "version": "0.3.699",
4
4
  "description": "Northlight access-token verification and scope rules",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@north-light/plugin",
3
- "version": "0.3.697",
3
+ "version": "0.3.699",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -27,8 +27,8 @@
27
27
  "postpack": "node ../../scripts/pack-minify.mjs postpack packages/crouter-plugin"
28
28
  },
29
29
  "dependencies": {
30
- "@north-light/api": "0.3.697",
31
- "@north-light/identity": "0.3.697"
30
+ "@north-light/api": "0.3.699",
31
+ "@north-light/identity": "0.3.699"
32
32
  },
33
33
  "license": "UNLICENSED",
34
34
  "publishConfig": {
package/runtime.lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@north-light/cli",
3
- "version": "0.3.697",
3
+ "version": "0.3.699",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@north-light/cli",
9
- "version": "0.3.697",
9
+ "version": "0.3.699",
10
10
  "hasInstallScript": true,
11
11
  "license": "UNLICENSED",
12
12
  "workspaces": [
@@ -28,8 +28,8 @@
28
28
  "@milkdown/preset-gfm": "^7.22.3",
29
29
  "@milkdown/prose": "^7.22.3",
30
30
  "@milkdown/utils": "^7.22.3",
31
- "@north-light/identity": "0.3.697",
32
- "@north-light/plugin": "0.3.697",
31
+ "@north-light/identity": "0.3.699",
32
+ "@north-light/plugin": "0.3.699",
33
33
  "cron-parser": "^5.6.0",
34
34
  "esbuild": "0.28.2",
35
35
  "jose": "^6.2.12",
@@ -10667,17 +10667,17 @@
10667
10667
  },
10668
10668
  "packages/crouter-api": {
10669
10669
  "name": "@north-light/api",
10670
- "version": "0.3.697",
10670
+ "version": "0.3.699",
10671
10671
  "license": "UNLICENSED"
10672
10672
  },
10673
10673
  "packages/crouter-env-docker": {
10674
10674
  "name": "@north-light/env-docker",
10675
- "version": "0.3.697",
10675
+ "version": "0.3.699",
10676
10676
  "license": "UNLICENSED"
10677
10677
  },
10678
10678
  "packages/crouter-identity": {
10679
10679
  "name": "@north-light/identity",
10680
- "version": "0.3.697",
10680
+ "version": "0.3.699",
10681
10681
  "license": "UNLICENSED",
10682
10682
  "dependencies": {
10683
10683
  "jose": "^6.2.1"
@@ -10685,21 +10685,21 @@
10685
10685
  },
10686
10686
  "packages/crouter-plugin": {
10687
10687
  "name": "@north-light/plugin",
10688
- "version": "0.3.697",
10688
+ "version": "0.3.699",
10689
10689
  "license": "UNLICENSED",
10690
10690
  "dependencies": {
10691
- "@north-light/api": "0.3.697",
10692
- "@north-light/identity": "0.3.697"
10691
+ "@north-light/api": "0.3.699",
10692
+ "@north-light/identity": "0.3.699"
10693
10693
  }
10694
10694
  },
10695
10695
  "packages/crouter-sdk": {
10696
10696
  "name": "@north-light/sdk",
10697
- "version": "0.3.697",
10697
+ "version": "0.3.699",
10698
10698
  "license": "UNLICENSED",
10699
10699
  "dependencies": {
10700
- "@north-light/api": "0.3.697",
10701
- "@north-light/identity": "0.3.697",
10702
- "@north-light/plugin": "0.3.697",
10700
+ "@north-light/api": "0.3.699",
10701
+ "@north-light/identity": "0.3.699",
10702
+ "@north-light/plugin": "0.3.699",
10703
10703
  "jose": "^6.2.1"
10704
10704
  },
10705
10705
  "bin": {