shellpuppet 0.0.1 → 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 (112) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +31 -0
  3. package/README.md +340 -8
  4. package/dist/cli/index.d.ts +13 -0
  5. package/dist/cli/index.js +693 -0
  6. package/dist/cli/index.js.map +1 -0
  7. package/dist/client/http.d.ts +82 -0
  8. package/dist/client/http.js +225 -0
  9. package/dist/client/http.js.map +1 -0
  10. package/dist/core/dialogs.d.ts +88 -0
  11. package/dist/core/dialogs.js +214 -0
  12. package/dist/core/dialogs.js.map +1 -0
  13. package/dist/core/echo.d.ts +71 -0
  14. package/dist/core/echo.js +249 -0
  15. package/dist/core/echo.js.map +1 -0
  16. package/dist/core/find.d.ts +34 -0
  17. package/dist/core/find.js +41 -0
  18. package/dist/core/find.js.map +1 -0
  19. package/dist/core/keys.d.ts +22 -0
  20. package/dist/core/keys.js +80 -0
  21. package/dist/core/keys.js.map +1 -0
  22. package/dist/core/manager.d.ts +66 -0
  23. package/dist/core/manager.js +158 -0
  24. package/dist/core/manager.js.map +1 -0
  25. package/dist/core/nativePty.d.ts +69 -0
  26. package/dist/core/nativePty.js +156 -0
  27. package/dist/core/nativePty.js.map +1 -0
  28. package/dist/core/policy.d.ts +61 -0
  29. package/dist/core/policy.js +143 -0
  30. package/dist/core/policy.js.map +1 -0
  31. package/dist/core/promptDetector.d.ts +75 -0
  32. package/dist/core/promptDetector.js +606 -0
  33. package/dist/core/promptDetector.js.map +1 -0
  34. package/dist/core/reasoning.d.ts +252 -0
  35. package/dist/core/reasoning.js +740 -0
  36. package/dist/core/reasoning.js.map +1 -0
  37. package/dist/core/regexBudget.d.ts +44 -0
  38. package/dist/core/regexBudget.js +79 -0
  39. package/dist/core/regexBudget.js.map +1 -0
  40. package/dist/core/renderer.d.ts +112 -0
  41. package/dist/core/renderer.js +225 -0
  42. package/dist/core/renderer.js.map +1 -0
  43. package/dist/core/session.d.ts +311 -0
  44. package/dist/core/session.js +966 -0
  45. package/dist/core/session.js.map +1 -0
  46. package/dist/core/types.d.ts +281 -0
  47. package/dist/core/types.js +47 -0
  48. package/dist/core/types.js.map +1 -0
  49. package/dist/core/waiter.d.ts +86 -0
  50. package/dist/core/waiter.js +317 -0
  51. package/dist/core/waiter.js.map +1 -0
  52. package/dist/core/windowsPtyStart.d.ts +90 -0
  53. package/dist/core/windowsPtyStart.js +129 -0
  54. package/dist/core/windowsPtyStart.js.map +1 -0
  55. package/dist/daemon/audit.d.ts +23 -0
  56. package/dist/daemon/audit.js +51 -0
  57. package/dist/daemon/audit.js.map +1 -0
  58. package/dist/daemon/auth.d.ts +127 -0
  59. package/dist/daemon/auth.js +241 -0
  60. package/dist/daemon/auth.js.map +1 -0
  61. package/dist/daemon/config.d.ts +76 -0
  62. package/dist/daemon/config.js +301 -0
  63. package/dist/daemon/config.js.map +1 -0
  64. package/dist/daemon/index.d.ts +7 -0
  65. package/dist/daemon/index.js +87 -0
  66. package/dist/daemon/index.js.map +1 -0
  67. package/dist/daemon/liveness.d.ts +36 -0
  68. package/dist/daemon/liveness.js +71 -0
  69. package/dist/daemon/liveness.js.map +1 -0
  70. package/dist/daemon/logger.d.ts +7 -0
  71. package/dist/daemon/logger.js +29 -0
  72. package/dist/daemon/logger.js.map +1 -0
  73. package/dist/daemon/meta.d.ts +9 -0
  74. package/dist/daemon/meta.js +24 -0
  75. package/dist/daemon/meta.js.map +1 -0
  76. package/dist/daemon/paths.d.ts +83 -0
  77. package/dist/daemon/paths.js +154 -0
  78. package/dist/daemon/paths.js.map +1 -0
  79. package/dist/daemon/screenshot.d.ts +87 -0
  80. package/dist/daemon/screenshot.js +256 -0
  81. package/dist/daemon/screenshot.js.map +1 -0
  82. package/dist/daemon/server.d.ts +244 -0
  83. package/dist/daemon/server.js +2187 -0
  84. package/dist/daemon/server.js.map +1 -0
  85. package/dist/daemon/terminalReports.d.ts +38 -0
  86. package/dist/daemon/terminalReports.js +84 -0
  87. package/dist/daemon/terminalReports.js.map +1 -0
  88. package/dist/daemon/viewerLauncher.d.ts +135 -0
  89. package/dist/daemon/viewerLauncher.js +280 -0
  90. package/dist/daemon/viewerLauncher.js.map +1 -0
  91. package/dist/daemon/viewerSync.d.ts +38 -0
  92. package/dist/daemon/viewerSync.js +83 -0
  93. package/dist/daemon/viewerSync.js.map +1 -0
  94. package/dist/mcp/config.d.ts +57 -0
  95. package/dist/mcp/config.js +106 -0
  96. package/dist/mcp/config.js.map +1 -0
  97. package/dist/mcp/index.d.ts +10 -0
  98. package/dist/mcp/index.js +69 -0
  99. package/dist/mcp/index.js.map +1 -0
  100. package/dist/mcp/tools.d.ts +59 -0
  101. package/dist/mcp/tools.js +537 -0
  102. package/dist/mcp/tools.js.map +1 -0
  103. package/dist/viewer/icon-16.png +0 -0
  104. package/dist/viewer/icon-180.png +0 -0
  105. package/dist/viewer/icon-32.png +0 -0
  106. package/dist/viewer/icon-512.png +0 -0
  107. package/dist/viewer/icon.svg +66 -0
  108. package/dist/viewer/index.html +56 -0
  109. package/dist/viewer/viewer.css +84 -0
  110. package/dist/viewer/viewer.js +661 -0
  111. package/package.json +66 -7
  112. package/index.js +0 -4
@@ -0,0 +1,66 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" role="img" aria-label="ShellPuppet">
2
+ <title>ShellPuppet</title>
3
+ <!--
4
+ ShellPuppet mark: a puppeteer's control cross on strings, holding a terminal
5
+ prompt. Both halves of the name in one shape.
6
+
7
+ Made of a few plain vector shapes, because it has to survive being drawn
8
+ 16 pixels wide in a taskbar.
9
+
10
+ Two things are deliberate:
11
+
12
+ - The control piece is the classic CROSSED PAIR seen slightly from above, so
13
+ the two bars are rotated only ~17 degrees off horizontal. A steeper X
14
+ would be more obviously a cross at 512px and an unreadable smudge at 32px;
15
+ the shallow crossing keeps a horizontal mass at the top, which is what
16
+ still reads when the icon is small.
17
+ - The caret is smaller than the rig is wide but heavier in stroke, because
18
+ weight survives downscaling and size does not. It is the part that must
19
+ still say "terminal" when the strings have collapsed to one pixel.
20
+
21
+ The tile, caret and rig colours are the viewer's own (viewer.css), so the
22
+ icon and the app it opens look like one product; the shadow belongs to the
23
+ mark alone:
24
+ #0b0e14 tile - the terminal background
25
+ #6cb6ff caret - the cursor blue
26
+ #f0c674 rig - the prompt-alert amber
27
+ #c99a3f shadow - the underside of the lower bar, the only shading in the
28
+ mark; it is what makes the pair read as crossed wood
29
+ rather than as a flat asterisk.
30
+ -->
31
+ <rect width="512" height="512" rx="112" fill="#0b0e14"/>
32
+
33
+ <!-- Control cross. The lower bar is drawn first and darker so the upper bar
34
+ reads as lying across it: the minimum cue for "viewed from above". -->
35
+ <g transform="translate(256 132)">
36
+ <rect x="-168" y="-17" width="336" height="34" rx="10" fill="#c99a3f"
37
+ transform="rotate(-17)"/>
38
+ <rect x="-168" y="-17" width="336" height="34" rx="10" fill="#f0c674"
39
+ transform="rotate(17)"/>
40
+ </g>
41
+
42
+ <!-- Strings. 20 wide, not hairlines: a 1px string vanishes entirely when the
43
+ icon is scaled down. Each ENDS ON what it holds: never short of it, never
44
+ across it. Left lands on the chevron's top vertex, right on the underscore.
45
+
46
+ These coordinates are DERIVED from the scaled caret below, not guessed:
47
+ with transform="translate(66 128) scale(0.72)", the chevron's top vertex
48
+ (180,208) lands at (195.6, 277.8) and the underscore's top edge (y=416)
49
+ lands at y=427.5. Getting this wrong is the easiest mistake in this
50
+ file: if the caret's scale or offset ever changes, recompute these two
51
+ rects rather than nudging them by eye. -->
52
+ <g fill="#f0c674">
53
+ <rect x="186" y="150" width="20" height="132"/>
54
+ <rect x="300" y="150" width="20" height="280"/>
55
+ </g>
56
+
57
+ <!-- The prompt, drawn on the 512 grid and scaled to 0.72, centred under the
58
+ rig so the rig can be a cross without the two fighting for the same
59
+ space. -->
60
+ <g fill="#6cb6ff" transform="translate(66 128) scale(0.72)">
61
+ <!-- Chevron as an outline path, not a stroked polyline, so the mitre stays
62
+ sharp at every size and no renderer rounds it for us. -->
63
+ <path d="M180 208 L136 252 L216 332 L136 412 L180 456 L304 332 Z"/>
64
+ <rect x="264" y="416" width="128" height="40" rx="8"/>
65
+ </g>
66
+ </svg>
@@ -0,0 +1,56 @@
1
+ <!doctype html>
2
+ <html lang="en-GB">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>ShellPuppet: shared terminal</title>
7
+ <!-- SVG first for tabs that support it; the PNGs are what Windows uses for the
8
+ taskbar button of a Chrome --app window, which an SVG alone leaves as the
9
+ generic globe. Sizes are declared so the browser picks rather than
10
+ downscales a 512 into a 16-pixel smear. -->
11
+ <link rel="icon" type="image/svg+xml" href="/viewer/icon.svg">
12
+ <link rel="icon" type="image/png" sizes="16x16" href="/viewer/icon-16.png">
13
+ <link rel="icon" type="image/png" sizes="32x32" href="/viewer/icon-32.png">
14
+ <link rel="icon" type="image/png" sizes="512x512" href="/viewer/icon-512.png">
15
+ <link rel="apple-touch-icon" sizes="180x180" href="/viewer/icon-180.png">
16
+ <link rel="stylesheet" href="/vendor/xterm.css">
17
+ <link rel="stylesheet" href="/viewer/viewer.css">
18
+ </head>
19
+ <body>
20
+ <header>
21
+ <span class="dot off" id="dot" title="connection state"></span>
22
+ <h1>ShellPuppet</h1>
23
+ <span class="hint" id="session-label"></span>
24
+ <span class="hint" id="session-agent"></span>
25
+ <span class="spacer"></span>
26
+ <span class="hint" id="input-source"></span>
27
+ <span class="hint" id="size"></span>
28
+ <span class="zoom" role="group" aria-label="Text size">
29
+ <!-- Symbol-only buttons need an explicit accessible name: `title` is not a
30
+ dependable one across screen readers, and "−" / "+" alone say nothing. -->
31
+ <button id="zoom-out" title="Smaller text" aria-label="Smaller text">&minus;</button>
32
+ <button id="zoom-auto" title="Fit the terminal to the window" aria-label="Fit text size to the window">fit</button>
33
+ <button id="zoom-in" title="Larger text" aria-label="Larger text">+</button>
34
+ </span>
35
+ <button id="readonly" title="Toggle read-only: stops your keystrokes reaching the session">read-only: off</button>
36
+ <span class="hint" id="mode-hint">you and the agent share this session: type freely</span>
37
+ </header>
38
+ <!-- What this session is and who asked for it. Present from the first paint so a
39
+ window is identifiable without reading its terminal content, which is the
40
+ point of the exercise when several are open at once. -->
41
+ <div id="identity" hidden>
42
+ <span id="identity-purpose"></span>
43
+ <span id="identity-meta"></span>
44
+ </div>
45
+ <div id="banner" hidden></div>
46
+ <!-- Raised when the daemon reports this session has been sitting on a permission
47
+ prompt nobody has answered. role=status (not alert) so a screen reader
48
+ announces it without stealing focus from the terminal the human is typing into. -->
49
+ <div id="prompt-alert" role="status" hidden></div>
50
+ <div id="wrap"><div id="term"></div></div>
51
+
52
+ <script src="/vendor/xterm.js"></script>
53
+ <script src="/vendor/addon-fit.js"></script>
54
+ <script src="/viewer/viewer.js"></script>
55
+ </body>
56
+ </html>
@@ -0,0 +1,84 @@
1
+ :root { color-scheme: dark; }
2
+ html, body { height: 100%; margin: 0; }
3
+ body {
4
+ background: #0b0e14; color: #c5cdd9; display: flex; flex-direction: column;
5
+ font: 13px ui-monospace, "Cascadia Code", Consolas, monospace; overflow: hidden;
6
+ }
7
+ header {
8
+ display: flex; align-items: center; gap: 12px; padding: 7px 14px; flex: 0 0 auto;
9
+ background: #141922; border-bottom: 1px solid #232a36;
10
+ }
11
+ header h1 { font-size: 13px; margin: 0; font-weight: 600; letter-spacing: .02em; }
12
+ /* Keep status labels on one line; the trailing hint is the only thing that
13
+ gives way, truncating rather than wrapping the header onto three rows. */
14
+ header > * { white-space: nowrap; flex: 0 0 auto; }
15
+ #mode-hint { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
16
+ .dot { width: 8px; height: 8px; border-radius: 50%; background: #3fb950; flex: 0 0 auto; }
17
+ .dot.off { background: #f85149; }
18
+ button {
19
+ background: #1c2330; color: #c5cdd9; border: 1px solid #2d3542;
20
+ border-radius: 5px; padding: 4px 9px; font: inherit; cursor: pointer;
21
+ }
22
+ button.active { background: #3d2c14; border-color: #8a6d3b; color: #e8c284; }
23
+ .spacer { flex: 1 1 auto; }
24
+ .hint { color: #6b7684; font-size: 12px; }
25
+ #input-source.agent { color: #6cb6ff; }
26
+ #input-source.human { color: #7ee787; }
27
+ #banner {
28
+ flex: 0 0 auto; padding: 8px 14px; background: #3d1d1f; color: #ffa198;
29
+ border-bottom: 1px solid #6e2c30; font-size: 12px;
30
+ }
31
+
32
+ /* Session identity strip. Quiet by design: it must be readable at a glance
33
+ when switching windows, without competing with the terminal for attention. */
34
+ #identity {
35
+ flex: 0 0 auto; padding: 6px 14px; background: #12191f; color: #9fb4c7;
36
+ border-bottom: 1px solid #22303c; font-size: 12px;
37
+ display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
38
+ }
39
+ #identity-purpose { color: #d7e3ee; font-weight: 600; }
40
+ #identity-meta { color: #7d93a6; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
41
+
42
+ /* Amber, not the banner's red: a held prompt is the session waiting on YOU, not
43
+ a fault. Deliberately loud: the whole feature exists because a held prompt
44
+ can go unnoticed for minutes at a time. */
45
+ #prompt-alert {
46
+ flex: 0 0 auto; padding: 8px 14px; background: #3d2f14; color: #f0c674;
47
+ border-bottom: 1px solid #7a5c1e; font-size: 12px;
48
+ }
49
+ #prompt-alert .question {
50
+ font-weight: 600; color: #ffd479;
51
+ }
52
+ #prompt-alert .options {
53
+ margin: 4px 0 0; padding-left: 20px; color: #d8b46a;
54
+ }
55
+ .zoom { display: flex; gap: 4px; align-items: center; }
56
+ .zoom button { padding: 3px 8px; min-width: 26px; line-height: 1; }
57
+ .zoom button.active { background: #14303d; border-color: #2f6b86; color: #6cb6ff; }
58
+
59
+ /* The wrap centres the terminal. A HELD session keeps a fixed grid (it was asked
60
+ for explicitly and the PTY must keep it), so it is scaled to fill the window
61
+ by FONT SIZE rather than by changing the grid: see fitGridByFont in viewer.js.
62
+ Centring keeps any leftover margin even instead of stranding the content in
63
+ the top-left corner. */
64
+ #wrap {
65
+ flex: 1 1 auto; min-height: 0; padding: 6px 8px; box-sizing: border-box;
66
+ overflow: hidden;
67
+ }
68
+ /* #term must keep filling the available box so the fit addon measures the real
69
+ space. So the centring has to happen INSIDE it, on the .xterm element
70
+ the addon actually sizes. Centring #wrap's children does nothing, because
71
+ #term is the only child and it is already 100% of the box. */
72
+ #term { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
73
+
74
+ /* Capture mode (headless screenshot): the terminal and nothing else. */
75
+ body.capture header, body.capture #identity, body.capture #banner, body.capture #prompt-alert {
76
+ display: none;
77
+ }
78
+ #term .xterm { margin: 0 auto; }
79
+ /* auto, not xterm's default scroll: a scrollbar track drawn permanently down the
80
+ edge implies there is something to scroll to, and with the grid fitted to the
81
+ window there usually is not. */
82
+ .xterm-viewport { overflow-y: auto !important; }
83
+ .xterm-viewport::-webkit-scrollbar { width: 10px; }
84
+ .xterm-viewport::-webkit-scrollbar-thumb { background: #2d3542; border-radius: 5px; }