dsh-remote-vs 0.27.0 → 0.28.0

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 (48) hide show
  1. package/README.en.md +110 -19
  2. package/README.md +82 -19
  3. package/lib/client.js +6789 -6607
  4. package/lib/index.js +546 -16
  5. package/lib/types/changes/recorder.d.ts +119 -2
  6. package/lib/types/client/CodeEditor.d.ts +15 -0
  7. package/lib/types/client/api.d.ts +17 -1
  8. package/lib/types/client/changes/apply-failure.d.ts +41 -0
  9. package/lib/types/client/changes/block-confirm.d.ts +97 -0
  10. package/lib/types/client/changes/diff-outcome.d.ts +56 -0
  11. package/lib/types/client/changes/freshness.d.ts +51 -0
  12. package/lib/types/client/changes/model.d.ts +19 -1
  13. package/lib/types/client/changes/session-diff.d.ts +100 -0
  14. package/lib/types/client/changes/staleness.d.ts +98 -0
  15. package/lib/types/client/changes/turn-reverted.d.ts +82 -0
  16. package/lib/types/client/changes/turn-view.d.ts +131 -0
  17. package/lib/types/client/changes/undo-affordance.d.ts +44 -10
  18. package/lib/types/client/changes/undo-target.d.ts +12 -0
  19. package/lib/types/client/i18n.d.ts +1 -1
  20. package/lib/types/client/store.d.ts +91 -1
  21. package/lib/types/client/vsc/change-marks.d.ts +21 -0
  22. package/lib/types/protocol.d.ts +99 -1
  23. package/package.json +1 -1
  24. package/src/changes/recorder.ts +851 -8
  25. package/src/client/CodeEditor.tsx +43 -3
  26. package/src/client/EditorPane.tsx +64 -7
  27. package/src/client/api.ts +30 -3
  28. package/src/client/changes/ChangesDock.tsx +539 -54
  29. package/src/client/changes/apply-failure.ts +73 -0
  30. package/src/client/changes/block-confirm.ts +180 -0
  31. package/src/client/changes/changes.css +45 -0
  32. package/src/client/changes/diff-outcome.ts +97 -0
  33. package/src/client/changes/freshness.ts +68 -0
  34. package/src/client/changes/model.ts +56 -1
  35. package/src/client/changes/session-diff.ts +187 -0
  36. package/src/client/changes/staleness.ts +148 -0
  37. package/src/client/changes/turn-reverted.ts +254 -0
  38. package/src/client/changes/turn-view.ts +195 -0
  39. package/src/client/changes/undo-affordance.ts +295 -63
  40. package/src/client/changes/undo-target.ts +12 -0
  41. package/src/client/i18n.ts +102 -4
  42. package/src/client/scm/DiffView.tsx +32 -13
  43. package/src/client/store.tsx +392 -16
  44. package/src/client/vsc/change-marks.ts +21 -0
  45. package/src/client/vsc/preview-document.tsx +4 -1
  46. package/src/client/vsc/vsc.css +6642 -6509
  47. package/src/protocol.ts +101 -1
  48. package/src/routes.ts +20 -9
@@ -521,6 +521,82 @@ export interface RemoteChangedFile {
521
521
  */
522
522
  revert?: 'patch' | 'delete';
523
523
  }
524
+ /**
525
+ * The most recent COMPLETED turn, as the review panel switches to it.
526
+ *
527
+ * "This turn" is answered from the ledger's own turn boundaries: the host keeps
528
+ * every listed path's text at each turn close and compares the next close
529
+ * against it. Deliberately ONE turn deep — a per-turn history would need the
530
+ * full text of every file at every boundary, and the panel's job is "what did
531
+ * the turn I just ran change", not a time machine.
532
+ */
533
+ export interface RemoteChangesTurnView {
534
+ /** Turn number the delta describes (0 = no turn has closed yet). */
535
+ turn: number;
536
+ /** Files this turn changed, with THIS TURN's counts (not the session total). */
537
+ files: RemoteChangedFile[];
538
+ added: number;
539
+ deleted: number;
540
+ /** Wall-clock ms when the delta was computed. */
541
+ at: number;
542
+ /**
543
+ * Whether the per-file hunks behind `turnDiff` are cached.
544
+ *
545
+ * `false` = the turn's contents were too large for the memory budget (or the
546
+ * file cap made attribution unreliable): the counts above are still real, but
547
+ * clicking a row cannot paint hunks or revert. Honest degradation — the
548
+ * alternative would be comparing the next turn against a half-updated
549
+ * snapshot and attributing old changes to it.
550
+ */
551
+ cached: boolean;
552
+ /** Why `cached` is false (shown to the user, never swallowed). */
553
+ reason?: string;
554
+ /**
555
+ * This view is INCOMPLETE — and it is not "a prefix of a longer list".
556
+ *
557
+ * Three ways rows go missing:
558
+ * - the file cap cut the list (`files` is the first N of the scanned paths);
559
+ * - the previous turn's snapshot was cut by that cap, or a previous side was
560
+ * withheld (binary / over the read cap), so a path that cannot be compared is
561
+ * DROPPED instead of being guessed as a whole-file creation;
562
+ * - the previous turn's slow scan never landed before this turn closed, so a
563
+ * file missing from that snapshot cannot be proven new either.
564
+ *
565
+ * A partial view must say so: "these rows are what this turn provably changed",
566
+ * not "this is everything the turn changed".
567
+ */
568
+ truncated?: true;
569
+ /**
570
+ * The turn's slow scan (`git ls-files --others`) has not landed yet.
571
+ *
572
+ * The same turn is REBUILT when it does (`correctTurn`), so this list may still
573
+ * grow — it is never relabelled as the next turn. When a newer turn closes
574
+ * first, the view stops waiting and `truncated` records that it never caught
575
+ * up.
576
+ */
577
+ pending?: true;
578
+ }
579
+ /**
580
+ * Body of `op: 'list'` on the changes route (the request half of
581
+ * {@link RemoteChangesSummary}).
582
+ *
583
+ * The two refresh intents are separated because they cost very different things
584
+ * on the remote:
585
+ * - {@link RemoteChangesListRequest.force} (`⟳`) — tracked scan NOW and re-arm the
586
+ * slow `git ls-files --others` walk (clears its write-off). Deliberate click.
587
+ * - {@link RemoteChangesListRequest.trackedOnly} — "the user came back to the
588
+ * page": tracked files now, but the slow walk keeps its cadence and its
589
+ * written-off verdict. Focus events repeat every few seconds; re-arming an 11s
590
+ * (cold: minutes) walk on each one would multiply the remote load.
591
+ */
592
+ export interface RemoteChangesListRequest {
593
+ op: 'list';
594
+ sessionId: string;
595
+ force?: true;
596
+ trackedOnly?: true;
597
+ /** Repository directory from the Source Control panel ('' = the session root). */
598
+ repoSubdir?: string;
599
+ }
524
600
  /**
525
601
  * What one session changed on its remote host since the session's baseline.
526
602
  *
@@ -562,10 +638,30 @@ export interface RemoteChangesSummary {
562
638
  pending: boolean;
563
639
  /** Why this session has no ledger (local session, no git, timeout, …). */
564
640
  unavailable?: string;
641
+ /**
642
+ * The last completed turn's delta, when the host computed one.
643
+ *
644
+ * Optional on purpose: an older host (or a session with no closed turn yet)
645
+ * omits it and the panel stays on the session-cumulative view it has always
646
+ * shown. A client that does not know the field ignores it.
647
+ */
648
+ turnView?: RemoteChangesTurnView;
565
649
  }
566
650
  /** One file's whole-session comparison, ready for editor decorations. */
567
651
  export interface RemoteChangesDiff {
568
- kind: 'text' | 'binary' | 'missing';
652
+ /**
653
+ * `unavailable` / `stale` belong to the per-turn comparison only.
654
+ *
655
+ * - `unavailable`: the host has no cached per-turn hunks for this session
656
+ * (memory budget, file cap, or no completed turn) — `reason` says which;
657
+ * - `stale`: the file changed after the turn closed, so the cached comparison
658
+ * no longer describes what is on disk; the client falls back to the
659
+ * session-cumulative view instead of painting wrong lines.
660
+ *
661
+ * The whole-session `diff` never returns them, so a client that switches on
662
+ * the old three kinds keeps working unchanged.
663
+ */
664
+ kind: 'text' | 'binary' | 'missing' | 'unavailable' | 'stale';
569
665
  /** Remote absolute POSIX path. */
570
666
  path: string;
571
667
  display: string;
@@ -584,6 +680,8 @@ export interface RemoteChangesDiff {
584
680
  status?: 'A' | 'M' | 'D' | 'R' | 'C' | 'T' | 'U';
585
681
  /** The diff was cut at the byte cap: `hunks` is a prefix. */
586
682
  truncated?: true;
683
+ /** For `unavailable` / `stale`: what happened, in words the panel can show. */
684
+ reason?: string;
587
685
  }
588
686
  /** One row of the side-by-side diff projection. */
589
687
  export interface DiffRow {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-remote-vs",
3
3
  "description": "VSCode-style remote development for DSH: SSH host manager (key/password), helper deploy pipeline with version check, remote file explorer + editor + terminal in dsh-better-sidebar.",
4
- "version": "0.27.0",
4
+ "version": "0.28.0",
5
5
  "icon": "icon.svg",
6
6
  "keywords": [
7
7
  "dsh",