@achasoft/dsh-advanced-sidebar 0.1.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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +205 -0
  3. package/cordis.patch.yml +158 -0
  4. package/lib/client.js +24890 -0
  5. package/lib/client.js.map +1 -0
  6. package/lib/host.js +3156 -0
  7. package/lib/index.js +20 -0
  8. package/lib/remote.js +1994 -0
  9. package/lib/typert.host.js +2000 -0
  10. package/package.json +136 -0
  11. package/types/client/ActionMenu.d.ts +36 -0
  12. package/types/client/Glyphs.d.ts +49 -0
  13. package/types/client/PanelHost.d.ts +24 -0
  14. package/types/client/Seats.d.ts +16 -0
  15. package/types/client/SettingsCard.d.ts +22 -0
  16. package/types/client/contract.d.ts +358 -0
  17. package/types/client/controller.d.ts +224 -0
  18. package/types/client/cx.d.ts +16 -0
  19. package/types/client/index.d.ts +39 -0
  20. package/types/client/locales.d.ts +474 -0
  21. package/types/client/panels/ChangesPanel.d.ts +22 -0
  22. package/types/client/panels/FilesPanel.d.ts +16 -0
  23. package/types/client/panels/PreviewPanel.d.ts +27 -0
  24. package/types/client/panels/TasksPanel.d.ts +28 -0
  25. package/types/client/panels/TerminalPanel.d.ts +40 -0
  26. package/types/client/panels/shared.d.ts +65 -0
  27. package/types/client/target.d.ts +23 -0
  28. package/types/client/terminal-screen.d.ts +95 -0
  29. package/types/client/ui/Alert.d.ts +30 -0
  30. package/types/client/ui/Badge.d.ts +24 -0
  31. package/types/client/ui/Button.d.ts +28 -0
  32. package/types/client/ui/Calendar.d.ts +65 -0
  33. package/types/client/ui/DatePicker.d.ts +41 -0
  34. package/types/client/ui/Dialog.d.ts +61 -0
  35. package/types/client/ui/DropdownMenu.d.ts +98 -0
  36. package/types/client/ui/Input.d.ts +25 -0
  37. package/types/client/ui/Layer.d.ts +56 -0
  38. package/types/client/ui/Select.d.ts +49 -0
  39. package/types/client/ui/Separator.d.ts +15 -0
  40. package/types/client/ui/Tabs.d.ts +49 -0
  41. package/types/client/ui/Toggle.d.ts +57 -0
  42. package/types/client/ui/Tooltip.d.ts +22 -0
  43. package/types/client/ui/anchor.d.ts +92 -0
  44. package/types/client/ui/index.d.ts +42 -0
  45. package/types/client/use-capability.d.ts +27 -0
  46. package/types/host/deletion.d.ts +57 -0
  47. package/types/host/files.d.ts +43 -0
  48. package/types/host/git.d.ts +198 -0
  49. package/types/host/index.d.ts +210 -0
  50. package/types/host/open-in.d.ts +93 -0
  51. package/types/host/paths.d.ts +55 -0
  52. package/types/host/porcelain.d.ts +51 -0
  53. package/types/host/preview.d.ts +185 -0
  54. package/types/host/run.d.ts +72 -0
  55. package/types/host/tasks.d.ts +80 -0
  56. package/types/host/terminals.d.ts +86 -0
  57. package/types/host/types.d.ts +877 -0
  58. package/types/index.d.ts +17 -0
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Background-task control for the Tasks panel.
3
+ *
4
+ * The list itself is not here: the Host already pushes `session/jobs` frames that the Web Client
5
+ * folds into its `jobsBySession` mirror, so the panel reads the same live data every other surface
6
+ * reads and this module owns only the two verbs that mirror has no wire for — stop, and output.
7
+ *
8
+ * Output is the delicate one. `ctx.jobs.read()` CONSUMES a stream job's delta, and the model reads
9
+ * the same cursor through its own jobs tool; draining it for a person would silently delete output
10
+ * the model was about to receive. So output is served only once the registry has marked the record
11
+ * reported — after a kill, a wait, or a model read — and the text is accumulated here so reopening
12
+ * the panel shows the same output instead of an empty second read.
13
+ * @module @achasoft/dsh-advanced-sidebar/host/tasks
14
+ */
15
+ import type { Context } from '@deepseek-ai/cordis';
16
+ import type { AdvancedSidebarSettings, CapabilityState, TaskKillRequest, TaskKillResult, TaskOutputRequest, TaskOutputResult } from './types.ts';
17
+ /**
18
+ * Stops and reads background tasks on behalf of the Tasks panel. One instance serves every request
19
+ * and retains the output it has already drained.
20
+ */
21
+ export declare class TaskController {
22
+ private readonly ctx;
23
+ private readonly source;
24
+ /** Accumulated output per job id, so a second panel open is not an empty read. */
25
+ private readonly collected;
26
+ /**
27
+ * Tasks whose output has already been taken.
28
+ *
29
+ * `read()` is CONSUMING for a stream job and IDEMPOTENT for a final-output one, and the snapshot
30
+ * does not say which kind a job is. Appending every read would therefore duplicate a
31
+ * final-output job's text once per poll, so each task is drained exactly once — after settlement,
32
+ * when there is nothing further to come.
33
+ */
34
+ private readonly drained;
35
+ /**
36
+ * @param ctx - Host context carrying the optional job registry and the agent registry.
37
+ * @param source - reads the current settings section; called per request.
38
+ */
39
+ constructor(ctx: Context, source: () => AdvancedSidebarSettings);
40
+ /**
41
+ * Report what the Tasks panel may do on this Host.
42
+ * @returns availability plus the two per-verb permissions.
43
+ */
44
+ describe(): CapabilityState & {
45
+ canKill: boolean;
46
+ canReadOutput: boolean;
47
+ };
48
+ /**
49
+ * Stop one live task.
50
+ *
51
+ * The registry marks a killed record reported, which suppresses the completion notice its
52
+ * producer would otherwise open a model turn to deliver. That is the correct trade for a person
53
+ * pressing Stop — the work is being cancelled on their authority, not the model's — and it is why
54
+ * this verb is gated by `allowTaskKill` rather than always on.
55
+ * @param request - the owning session and the task id.
56
+ * @returns what the registry did, or a classified failure.
57
+ */
58
+ kill(request: TaskKillRequest): Promise<TaskKillResult>;
59
+ /**
60
+ * Read one task's output, or say why it is withheld.
61
+ * @param request - the owning session and the task id.
62
+ * @returns the accumulated output, or a classified failure.
63
+ */
64
+ output(request: TaskOutputRequest): Promise<TaskOutputResult>;
65
+ /** Drop retained output. Called from the service's teardown effect. */
66
+ dispose(): void;
67
+ /**
68
+ * Drain whatever the registry will still hand over and append it to the retained text.
69
+ * @param sessionId - the owning session.
70
+ * @param taskId - the task id.
71
+ */
72
+ private absorb;
73
+ /**
74
+ * Resolve the registry, the owning agent, and the branded job id together.
75
+ * @param sessionId - the owning session, as the browser spelled it.
76
+ * @param taskId - the task id, as the browser spelled it.
77
+ * @returns the bound handles, or the failure to return.
78
+ */
79
+ private bind;
80
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Panel terminals: interactive shells this plugin owns, allocated straight from
3
+ * `ctx.subprocess.spawnTerminal`.
4
+ *
5
+ * Deliberately NOT `ctx.terminals`. That registry's sessions are owner-fenced to an `Agent` and are
6
+ * the model's working terminals; a person opening the Terminal panel is not the model, and joining
7
+ * them would let a human's keystrokes land in a session the model believes it controls. These are
8
+ * separate shells with the panel's own lifetime.
9
+ *
10
+ * There is no host-to-client push channel available to an out-of-tree plugin, so output is read by
11
+ * offset: the browser polls, and the offset it holds is the whole-stream position it has already
12
+ * rendered. That also makes a reconnecting panel replay exactly the retained scrollback rather than
13
+ * an empty screen.
14
+ * @module @achasoft/dsh-advanced-sidebar/host/terminals
15
+ */
16
+ import type { Context } from '@deepseek-ai/cordis';
17
+ import type { AdvancedSidebarSettings, CapabilityState, TerminalAckResult, TerminalCloseRequest, TerminalOpenRequest, TerminalOpenResult, TerminalReadRequest, TerminalReadResult, TerminalSignalRequest, TerminalWriteRequest } from './types.ts';
18
+ /**
19
+ * Owns every panel terminal in the process. One instance is created by the service and disposed
20
+ * with it, which is what guarantees no shell outlives the plugin.
21
+ */
22
+ export declare class PanelTerminals {
23
+ private readonly ctx;
24
+ private readonly source;
25
+ private readonly records;
26
+ private closing;
27
+ /**
28
+ * @param ctx - Host context carrying the subprocess and filesystem capabilities.
29
+ * @param source - reads the current settings section; called per request.
30
+ */
31
+ constructor(ctx: Context, source: () => AdvancedSidebarSettings);
32
+ /**
33
+ * Report whether a panel terminal can be allocated on this Host.
34
+ * @returns availability plus the shell that would answer.
35
+ */
36
+ describe(): CapabilityState;
37
+ /**
38
+ * Allocate one terminal in a workspace.
39
+ * @param request - the directory and the panel's measured geometry.
40
+ * @param signal - cancellation of the allocation; a published terminal owns its later lifetime.
41
+ * @returns the handle, or a classified failure.
42
+ */
43
+ open(request: TerminalOpenRequest, signal?: AbortSignal): Promise<TerminalOpenResult>;
44
+ /**
45
+ * Read output from a caller-owned offset.
46
+ * @param request - the handle and the offset already rendered.
47
+ * @returns the delta and the process state, or a classified failure.
48
+ */
49
+ read(request: TerminalReadRequest): TerminalReadResult;
50
+ /**
51
+ * Send keystrokes.
52
+ * @param request - the handle and the text to deliver verbatim.
53
+ * @returns settlement, or a classified failure.
54
+ */
55
+ write(request: TerminalWriteRequest): Promise<TerminalAckResult>;
56
+ /**
57
+ * Deliver a signal to the terminal's foreground process group.
58
+ * @param request - the handle and the signal.
59
+ * @returns settlement, or a classified failure.
60
+ */
61
+ signal(request: TerminalSignalRequest): Promise<TerminalAckResult>;
62
+ /**
63
+ * Close one terminal and forget it.
64
+ * @param request - the handle.
65
+ * @returns settlement, or a classified failure.
66
+ */
67
+ close(request: TerminalCloseRequest): Promise<TerminalAckResult>;
68
+ /**
69
+ * Terminate every terminal and refuse new ones. Called from the service's teardown effect.
70
+ * @returns after every terminal session has settled.
71
+ */
72
+ disposeAll(): Promise<void>;
73
+ /**
74
+ * The shell a new terminal starts: the configured one, then `$SHELL`, then the platform default.
75
+ * @returns an executable name or path.
76
+ */
77
+ private shell;
78
+ /**
79
+ * Drain one terminal's output into its retained scrollback and record its settlement.
80
+ *
81
+ * Attached at allocation rather than at first read: a shell prints its prompt immediately, and a
82
+ * stream nobody is reading would otherwise apply backpressure until the panel polled.
83
+ * @param record - the freshly registered terminal.
84
+ */
85
+ private collect;
86
+ }