@sagmans/dsh-tui 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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +266 -0
  3. package/cordis.patch.yml +123 -0
  4. package/lib/agent/fork.d.ts +24 -0
  5. package/lib/agent/fork.d.ts.map +1 -0
  6. package/lib/agent/fork.js +25 -0
  7. package/lib/agent/fork.js.map +1 -0
  8. package/lib/agent/history.d.ts +78 -0
  9. package/lib/agent/history.d.ts.map +1 -0
  10. package/lib/agent/history.js +179 -0
  11. package/lib/agent/history.js.map +1 -0
  12. package/lib/agent/host.d.ts +58 -0
  13. package/lib/agent/host.d.ts.map +1 -0
  14. package/lib/agent/host.js +59 -0
  15. package/lib/agent/host.js.map +1 -0
  16. package/lib/agent/model.d.ts +61 -0
  17. package/lib/agent/model.d.ts.map +1 -0
  18. package/lib/agent/model.js +92 -0
  19. package/lib/agent/model.js.map +1 -0
  20. package/lib/agent/present.d.ts +12 -0
  21. package/lib/agent/present.d.ts.map +1 -0
  22. package/lib/agent/present.js +52 -0
  23. package/lib/agent/present.js.map +1 -0
  24. package/lib/agent/presets.d.ts +75 -0
  25. package/lib/agent/presets.d.ts.map +1 -0
  26. package/lib/agent/presets.js +117 -0
  27. package/lib/agent/presets.js.map +1 -0
  28. package/lib/agent/projections.d.ts +16 -0
  29. package/lib/agent/projections.d.ts.map +1 -0
  30. package/lib/agent/projections.js +31 -0
  31. package/lib/agent/projections.js.map +1 -0
  32. package/lib/agent/status.d.ts +46 -0
  33. package/lib/agent/status.d.ts.map +1 -0
  34. package/lib/agent/status.js +67 -0
  35. package/lib/agent/status.js.map +1 -0
  36. package/lib/cards.d.ts +88 -0
  37. package/lib/cards.d.ts.map +1 -0
  38. package/lib/cards.js +218 -0
  39. package/lib/cards.js.map +1 -0
  40. package/lib/compat/probe.d.ts +33 -0
  41. package/lib/compat/probe.d.ts.map +1 -0
  42. package/lib/compat/probe.js +74 -0
  43. package/lib/compat/probe.js.map +1 -0
  44. package/lib/config.d.ts +13 -0
  45. package/lib/config.d.ts.map +1 -0
  46. package/lib/config.js +49 -0
  47. package/lib/config.js.map +1 -0
  48. package/lib/contracts.d.ts +32 -0
  49. package/lib/contracts.d.ts.map +1 -0
  50. package/lib/contracts.js +2 -0
  51. package/lib/contracts.js.map +1 -0
  52. package/lib/export.d.ts +15 -0
  53. package/lib/export.d.ts.map +1 -0
  54. package/lib/export.js +52 -0
  55. package/lib/export.js.map +1 -0
  56. package/lib/gates.d.ts +85 -0
  57. package/lib/gates.d.ts.map +1 -0
  58. package/lib/gates.js +216 -0
  59. package/lib/gates.js.map +1 -0
  60. package/lib/identity.d.ts +33 -0
  61. package/lib/identity.d.ts.map +1 -0
  62. package/lib/identity.js +49 -0
  63. package/lib/identity.js.map +1 -0
  64. package/lib/index.d.ts +24 -0
  65. package/lib/index.d.ts.map +1 -0
  66. package/lib/index.js +1196 -0
  67. package/lib/index.js.map +1 -0
  68. package/lib/input/completion.d.ts +22 -0
  69. package/lib/input/completion.d.ts.map +1 -0
  70. package/lib/input/completion.js +27 -0
  71. package/lib/input/completion.js.map +1 -0
  72. package/lib/input/submission.d.ts +62 -0
  73. package/lib/input/submission.d.ts.map +1 -0
  74. package/lib/input/submission.js +80 -0
  75. package/lib/input/submission.js.map +1 -0
  76. package/lib/jobs.d.ts +64 -0
  77. package/lib/jobs.d.ts.map +1 -0
  78. package/lib/jobs.js +123 -0
  79. package/lib/jobs.js.map +1 -0
  80. package/lib/startup.d.ts +17 -0
  81. package/lib/startup.d.ts.map +1 -0
  82. package/lib/startup.js +67 -0
  83. package/lib/startup.js.map +1 -0
  84. package/lib/subagents.d.ts +74 -0
  85. package/lib/subagents.d.ts.map +1 -0
  86. package/lib/subagents.js +141 -0
  87. package/lib/subagents.js.map +1 -0
  88. package/lib/terminal/bell.d.ts +18 -0
  89. package/lib/terminal/bell.d.ts.map +1 -0
  90. package/lib/terminal/bell.js +16 -0
  91. package/lib/terminal/bell.js.map +1 -0
  92. package/lib/terminal/clipboard.d.ts +11 -0
  93. package/lib/terminal/clipboard.d.ts.map +1 -0
  94. package/lib/terminal/clipboard.js +18 -0
  95. package/lib/terminal/clipboard.js.map +1 -0
  96. package/lib/terminal/restore.d.ts +17 -0
  97. package/lib/terminal/restore.d.ts.map +1 -0
  98. package/lib/terminal/restore.js +43 -0
  99. package/lib/terminal/restore.js.map +1 -0
  100. package/lib/terminal/title.d.ts +22 -0
  101. package/lib/terminal/title.d.ts.map +1 -0
  102. package/lib/terminal/title.js +34 -0
  103. package/lib/terminal/title.js.map +1 -0
  104. package/lib/text.d.ts +19 -0
  105. package/lib/text.d.ts.map +1 -0
  106. package/lib/text.js +61 -0
  107. package/lib/text.js.map +1 -0
  108. package/lib/theme.d.ts +47 -0
  109. package/lib/theme.d.ts.map +1 -0
  110. package/lib/theme.js +84 -0
  111. package/lib/theme.js.map +1 -0
  112. package/lib/transcript.d.ts +91 -0
  113. package/lib/transcript.d.ts.map +1 -0
  114. package/lib/transcript.js +315 -0
  115. package/lib/transcript.js.map +1 -0
  116. package/lib/ui/dock.d.ts +36 -0
  117. package/lib/ui/dock.d.ts.map +1 -0
  118. package/lib/ui/dock.js +110 -0
  119. package/lib/ui/dock.js.map +1 -0
  120. package/lib/ui/markdown.d.ts +17 -0
  121. package/lib/ui/markdown.d.ts.map +1 -0
  122. package/lib/ui/markdown.js +35 -0
  123. package/lib/ui/markdown.js.map +1 -0
  124. package/lib/ui/picker.d.ts +103 -0
  125. package/lib/ui/picker.d.ts.map +1 -0
  126. package/lib/ui/picker.js +165 -0
  127. package/lib/ui/picker.js.map +1 -0
  128. package/lib/ui/rows.d.ts +30 -0
  129. package/lib/ui/rows.d.ts.map +1 -0
  130. package/lib/ui/rows.js +49 -0
  131. package/lib/ui/rows.js.map +1 -0
  132. package/lib/ui/status.d.ts +49 -0
  133. package/lib/ui/status.d.ts.map +1 -0
  134. package/lib/ui/status.js +90 -0
  135. package/lib/ui/status.js.map +1 -0
  136. package/lib/ui/view.d.ts +56 -0
  137. package/lib/ui/view.d.ts.map +1 -0
  138. package/lib/ui/view.js +184 -0
  139. package/lib/ui/view.js.map +1 -0
  140. package/lib/work.d.ts +39 -0
  141. package/lib/work.d.ts.map +1 -0
  142. package/lib/work.js +97 -0
  143. package/lib/work.js.map +1 -0
  144. package/package.json +109 -0
@@ -0,0 +1,33 @@
1
+ import type { LauncherAgentIdentity } from '@deepseek-ai/dsh-agent-loop';
2
+ /** A command line that cannot be resolved into one launch identity. */
3
+ export declare class LaunchUsageError extends Error {
4
+ }
5
+ /** Resolved intent of the arguments dsh handed to this app. */
6
+ export interface LaunchIntent {
7
+ /** Exact session id to resume, or empty for a fresh session. */
8
+ readonly resumeId: string;
9
+ /** Whether to open the history picker instead of starting a turn immediately. */
10
+ readonly resumePicker: boolean;
11
+ /** Whether the user explicitly asked for a new session. */
12
+ readonly fresh: boolean;
13
+ }
14
+ /**
15
+ * Resolve the app's own arguments into one identity decision.
16
+ *
17
+ * The three ways to name a session (positional `resume <id>`, `--resume [id]`,
18
+ * and `--new`) overlap, so an ambiguous combination is refused here rather
19
+ * than silently picking one: a wrong guess would resume the wrong conversation.
20
+ */
21
+ export declare function resolveLaunchIntent(input: {
22
+ readonly mode: string | undefined;
23
+ readonly session: string | undefined;
24
+ readonly resumeFlag: string | boolean | undefined;
25
+ readonly newSession: boolean | undefined;
26
+ }): LaunchIntent;
27
+ /** Identity the agent-loop row would adopt when a profile configures one. */
28
+ export declare function identityOf(intent: LaunchIntent, uuid: string): LauncherAgentIdentity;
29
+ /** Profile the surface is installed into; only used for the resume hint. */
30
+ export declare const PROFILE_NAME = "tui";
31
+ /** Line printed after the terminal is handed back, so the session is recoverable. */
32
+ export declare function resumeHint(sessionId: string, profile: string): string;
33
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AAExE,uEAAuE;AACvE,qBAAa,gBAAiB,SAAQ,KAAK;CAAG;AAE9C,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;IACjD,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,SAAS,CAAA;CACzC,GAAG,YAAY,CAwBf;AAED,6EAA6E;AAC7E,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAIpF;AAED,4EAA4E;AAC5E,eAAO,MAAM,YAAY,QAAQ,CAAA;AAEjC,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAErE"}
@@ -0,0 +1,49 @@
1
+ import { SessionId } from '@deepseek-ai/dsh-session';
2
+ /** A command line that cannot be resolved into one launch identity. */
3
+ export class LaunchUsageError extends Error {
4
+ }
5
+ /**
6
+ * Resolve the app's own arguments into one identity decision.
7
+ *
8
+ * The three ways to name a session (positional `resume <id>`, `--resume [id]`,
9
+ * and `--new`) overlap, so an ambiguous combination is refused here rather
10
+ * than silently picking one: a wrong guess would resume the wrong conversation.
11
+ */
12
+ export function resolveLaunchIntent(input) {
13
+ const mode = input.mode?.trim() ?? '';
14
+ if (mode !== '' && mode !== 'resume') {
15
+ throw new LaunchUsageError(`unknown argument "${mode}" (expected "resume")`);
16
+ }
17
+ const flagValue = typeof input.resumeFlag === 'string' ? input.resumeFlag.trim() : '';
18
+ const positional = input.session?.trim() ?? '';
19
+ if (flagValue !== '' && positional !== '' && flagValue !== positional) {
20
+ throw new LaunchUsageError('session id given twice with different values (--resume and positional)');
21
+ }
22
+ if (positional !== '' && mode === '' && input.resumeFlag === undefined) {
23
+ throw new LaunchUsageError('a session id requires resume mode or --resume');
24
+ }
25
+ const resumeId = flagValue !== '' ? flagValue : positional;
26
+ const resumeRequested = mode === 'resume' || input.resumeFlag !== undefined || positional !== '';
27
+ if (input.newSession === true && resumeRequested) {
28
+ throw new LaunchUsageError('--new cannot be combined with a resume session id or mode');
29
+ }
30
+ return {
31
+ resumeId,
32
+ // An empty --resume (bare flag) asks for the picker rather than a fresh session.
33
+ resumePicker: resumeId === '' && (mode === 'resume' || input.resumeFlag !== undefined),
34
+ fresh: input.newSession === true,
35
+ };
36
+ }
37
+ /** Identity the agent-loop row would adopt when a profile configures one. */
38
+ export function identityOf(intent, uuid) {
39
+ return intent.resumeId === ''
40
+ ? { id: SessionId(`tui-session-${uuid}`), resume: false }
41
+ : { id: SessionId(intent.resumeId), resume: true };
42
+ }
43
+ /** Profile the surface is installed into; only used for the resume hint. */
44
+ export const PROFILE_NAME = 'tui';
45
+ /** Line printed after the terminal is handed back, so the session is recoverable. */
46
+ export function resumeHint(sessionId, profile) {
47
+ return `To resume this session: dsh --profile ${profile} --resume=${sessionId}`;
48
+ }
49
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAGpD,uEAAuE;AACvE,MAAM,OAAO,gBAAiB,SAAQ,KAAK;CAAG;AAY9C;;;;;;GAMG;AAC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AAI,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,KAAK,SAAS,CAAC;QACtF,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI;KACjC,CAAA;AACH,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,UAAU,CAAC,MAAoB,EAAE,IAAY;IAC3D,OAAO,MAAM,CAAC,QAAQ,KAAK,EAAE;QAC3B,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,eAAe,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE;QACzD,CAAC,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;AACtD,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAA;AAEjC,qFAAqF;AACrF,MAAM,UAAU,UAAU,CAAC,SAAiB,EAAE,OAAe;IAC3D,OAAO,yCAAyC,OAAO,aAAa,SAAS,EAAE,CAAA;AACjF,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ export declare const name = "tui";
3
+ /** `agents` is the only service the surface cannot run without. */
4
+ export declare const inject: string[];
5
+ /**
6
+ * Refuse to run without a real terminal.
7
+ *
8
+ * A terminal surface that silently degrades to line mode hides deployment
9
+ * mistakes and changes interaction semantics, so an unattended invocation
10
+ * fails loud instead: a caller that wants one-shot output uses headless mode.
11
+ */
12
+ export declare function assertInteractiveTerminal(input?: {
13
+ readonly stdinIsTTY?: boolean;
14
+ readonly stdoutIsTTY?: boolean;
15
+ }): void;
16
+ /**
17
+ * Mount the terminal surface over the composed agent plane.
18
+ *
19
+ * The plugin owns input and presentation only: agent lifecycle, session
20
+ * persistence, tool execution, and the model-facing question tool stay with
21
+ * the composition rows around it.
22
+ */
23
+ export declare function apply(ctx: Context, config: unknown): void;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAkDlD,eAAO,MAAM,IAAI,QAAQ,CAAA;AAEzB,mEAAmE;AACnE,eAAO,MAAM,MAAM,UAAa,CAAA;AAgChC;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,GAAE;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAC1B,GAAG,IAAI,CAMZ;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAioCzD"}