shellpuppet 0.0.1 → 0.2.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 (137) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +31 -0
  3. package/README.md +499 -8
  4. package/dist/cli/desktopShortcut.d.ts +22 -0
  5. package/dist/cli/desktopShortcut.js +157 -0
  6. package/dist/cli/desktopShortcut.js.map +1 -0
  7. package/dist/cli/index.d.ts +13 -0
  8. package/dist/cli/index.js +846 -0
  9. package/dist/cli/index.js.map +1 -0
  10. package/dist/client/http.d.ts +143 -0
  11. package/dist/client/http.js +581 -0
  12. package/dist/client/http.js.map +1 -0
  13. package/dist/core/dialogs.d.ts +96 -0
  14. package/dist/core/dialogs.js +226 -0
  15. package/dist/core/dialogs.js.map +1 -0
  16. package/dist/core/echo.d.ts +71 -0
  17. package/dist/core/echo.js +249 -0
  18. package/dist/core/echo.js.map +1 -0
  19. package/dist/core/find.d.ts +34 -0
  20. package/dist/core/find.js +41 -0
  21. package/dist/core/find.js.map +1 -0
  22. package/dist/core/keys.d.ts +22 -0
  23. package/dist/core/keys.js +80 -0
  24. package/dist/core/keys.js.map +1 -0
  25. package/dist/core/manager.d.ts +96 -0
  26. package/dist/core/manager.js +271 -0
  27. package/dist/core/manager.js.map +1 -0
  28. package/dist/core/nativePty.d.ts +73 -0
  29. package/dist/core/nativePty.js +161 -0
  30. package/dist/core/nativePty.js.map +1 -0
  31. package/dist/core/policy.d.ts +61 -0
  32. package/dist/core/policy.js +143 -0
  33. package/dist/core/policy.js.map +1 -0
  34. package/dist/core/promptDetector.d.ts +109 -0
  35. package/dist/core/promptDetector.js +897 -0
  36. package/dist/core/promptDetector.js.map +1 -0
  37. package/dist/core/reasoning.d.ts +265 -0
  38. package/dist/core/reasoning.js +933 -0
  39. package/dist/core/reasoning.js.map +1 -0
  40. package/dist/core/regexBudget.d.ts +64 -0
  41. package/dist/core/regexBudget.js +103 -0
  42. package/dist/core/regexBudget.js.map +1 -0
  43. package/dist/core/renderer.d.ts +127 -0
  44. package/dist/core/renderer.js +316 -0
  45. package/dist/core/renderer.js.map +1 -0
  46. package/dist/core/selection.d.ts +6 -0
  47. package/dist/core/selection.js +48 -0
  48. package/dist/core/selection.js.map +1 -0
  49. package/dist/core/session.d.ts +565 -0
  50. package/dist/core/session.js +1450 -0
  51. package/dist/core/session.js.map +1 -0
  52. package/dist/core/types.d.ts +316 -0
  53. package/dist/core/types.js +71 -0
  54. package/dist/core/types.js.map +1 -0
  55. package/dist/core/waiter.d.ts +94 -0
  56. package/dist/core/waiter.js +310 -0
  57. package/dist/core/waiter.js.map +1 -0
  58. package/dist/core/windowsConsoleHost.d.ts +147 -0
  59. package/dist/core/windowsConsoleHost.js +588 -0
  60. package/dist/core/windowsConsoleHost.js.map +1 -0
  61. package/dist/core/windowsPtyStart.d.ts +161 -0
  62. package/dist/core/windowsPtyStart.js +236 -0
  63. package/dist/core/windowsPtyStart.js.map +1 -0
  64. package/dist/daemon/audit.d.ts +23 -0
  65. package/dist/daemon/audit.js +51 -0
  66. package/dist/daemon/audit.js.map +1 -0
  67. package/dist/daemon/auth.d.ts +197 -0
  68. package/dist/daemon/auth.js +366 -0
  69. package/dist/daemon/auth.js.map +1 -0
  70. package/dist/daemon/config.d.ts +119 -0
  71. package/dist/daemon/config.js +568 -0
  72. package/dist/daemon/config.js.map +1 -0
  73. package/dist/daemon/folderPicker.d.ts +27 -0
  74. package/dist/daemon/folderPicker.js +115 -0
  75. package/dist/daemon/folderPicker.js.map +1 -0
  76. package/dist/daemon/index.d.ts +7 -0
  77. package/dist/daemon/index.js +88 -0
  78. package/dist/daemon/index.js.map +1 -0
  79. package/dist/daemon/launchProfiles.d.ts +155 -0
  80. package/dist/daemon/launchProfiles.js +554 -0
  81. package/dist/daemon/launchProfiles.js.map +1 -0
  82. package/dist/daemon/liveness.d.ts +36 -0
  83. package/dist/daemon/liveness.js +71 -0
  84. package/dist/daemon/liveness.js.map +1 -0
  85. package/dist/daemon/logger.d.ts +7 -0
  86. package/dist/daemon/logger.js +29 -0
  87. package/dist/daemon/logger.js.map +1 -0
  88. package/dist/daemon/meta.d.ts +9 -0
  89. package/dist/daemon/meta.js +24 -0
  90. package/dist/daemon/meta.js.map +1 -0
  91. package/dist/daemon/paths.d.ts +85 -0
  92. package/dist/daemon/paths.js +154 -0
  93. package/dist/daemon/paths.js.map +1 -0
  94. package/dist/daemon/screenshot.d.ts +144 -0
  95. package/dist/daemon/screenshot.js +402 -0
  96. package/dist/daemon/screenshot.js.map +1 -0
  97. package/dist/daemon/server.d.ts +453 -0
  98. package/dist/daemon/server.js +3954 -0
  99. package/dist/daemon/server.js.map +1 -0
  100. package/dist/daemon/sessionFeed.d.ts +48 -0
  101. package/dist/daemon/sessionFeed.js +101 -0
  102. package/dist/daemon/sessionFeed.js.map +1 -0
  103. package/dist/daemon/terminalReports.d.ts +38 -0
  104. package/dist/daemon/terminalReports.js +84 -0
  105. package/dist/daemon/terminalReports.js.map +1 -0
  106. package/dist/daemon/viewerLauncher.d.ts +226 -0
  107. package/dist/daemon/viewerLauncher.js +562 -0
  108. package/dist/daemon/viewerLauncher.js.map +1 -0
  109. package/dist/daemon/viewerSync.d.ts +38 -0
  110. package/dist/daemon/viewerSync.js +83 -0
  111. package/dist/daemon/viewerSync.js.map +1 -0
  112. package/dist/mcp/config.d.ts +50 -0
  113. package/dist/mcp/config.js +95 -0
  114. package/dist/mcp/config.js.map +1 -0
  115. package/dist/mcp/index.d.ts +10 -0
  116. package/dist/mcp/index.js +78 -0
  117. package/dist/mcp/index.js.map +1 -0
  118. package/dist/mcp/tools.d.ts +66 -0
  119. package/dist/mcp/tools.js +638 -0
  120. package/dist/mcp/tools.js.map +1 -0
  121. package/dist/viewer/dashboard-folders.js +20 -0
  122. package/dist/viewer/dashboard-layout.js +52 -0
  123. package/dist/viewer/dashboard.css +67 -0
  124. package/dist/viewer/dashboard.html +44 -0
  125. package/dist/viewer/dashboard.js +1518 -0
  126. package/dist/viewer/icon-16.png +0 -0
  127. package/dist/viewer/icon-180.png +0 -0
  128. package/dist/viewer/icon-32.png +0 -0
  129. package/dist/viewer/icon-512.png +0 -0
  130. package/dist/viewer/icon.ico +0 -0
  131. package/dist/viewer/icon.svg +66 -0
  132. package/dist/viewer/index.html +61 -0
  133. package/dist/viewer/pane.js +736 -0
  134. package/dist/viewer/viewer.css +95 -0
  135. package/dist/viewer/viewer.js +84 -0
  136. package/package.json +66 -7
  137. package/index.js +0 -4
@@ -0,0 +1,95 @@
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
+ 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 29px; height: 29px; box-sizing: border-box; padding: 6px 14px;
36
+ background: #12191f; color: #9fb4c7;
37
+ border-bottom: 1px solid #22303c; font-size: 12px;
38
+ display: flex; gap: 14px; align-items: center; white-space: nowrap; overflow: hidden;
39
+ }
40
+ #identity-purpose { color: #d7e3ee; font-weight: 600; }
41
+ #identity-meta { color: #7d93a6; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
42
+ overflow: hidden; text-overflow: ellipsis; }
43
+
44
+ /* Amber, not the banner's red: a held prompt is the session waiting on YOU, not
45
+ a fault. Deliberately loud: the whole feature exists because a held prompt
46
+ can go unnoticed for minutes at a time. */
47
+ #prompt-alert {
48
+ padding: 8px 14px; background: #3d2f14; color: #f0c674;
49
+ border-bottom: 1px solid #7a5c1e; font-size: 12px;
50
+ }
51
+ #prompt-alert .question {
52
+ font-weight: 600; color: #ffd479;
53
+ }
54
+ #prompt-alert .options {
55
+ margin: 4px 0 0; padding-left: 20px; color: #d8b46a;
56
+ }
57
+ .zoom { display: flex; gap: 4px; align-items: center; }
58
+ .zoom button { padding: 3px 8px; min-width: 26px; line-height: 1; }
59
+ .zoom button.active { background: #14303d; border-color: #2f6b86; color: #6cb6ff; }
60
+
61
+ /* The wrap centres the terminal. A HELD session keeps a fixed grid (it was asked
62
+ for explicitly and the PTY must keep it), so it is scaled to fill the window
63
+ by FONT SIZE rather than by changing the grid: see fitGridByFont in viewer.js.
64
+ Centring keeps any leftover margin even instead of stranding the content in
65
+ the top-left corner. */
66
+ #wrap {
67
+ flex: 1 1 auto; min-height: 0; padding: 6px 8px; box-sizing: border-box;
68
+ overflow: hidden; position: relative;
69
+ }
70
+ /* Notices paint above the terminal and never participate in its fit box.
71
+ The pane places them in the half away from the cursor. */
72
+ #notices {
73
+ position: absolute; z-index: 2; left: 8px; right: 8px;
74
+ box-sizing: border-box; overflow-y: auto; pointer-events: none;
75
+ box-shadow: 0 4px 14px #0009;
76
+ }
77
+ #notices:has(> :not([hidden])) { border: 1px solid #27313d; }
78
+ #notices :is(button, a) { pointer-events: auto; }
79
+ /* #term must keep filling the available box so the fit addon measures the real
80
+ space. So the centring has to happen INSIDE it, on the .xterm element
81
+ the addon actually sizes. Centring #wrap's children does nothing, because
82
+ #term is the only child and it is already 100% of the box. */
83
+ #term { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
84
+
85
+ /* Capture mode (headless screenshot): the terminal and nothing else. */
86
+ body.capture header, body.capture #identity, body.capture #notices {
87
+ display: none;
88
+ }
89
+ #term .xterm { margin: 0 auto; }
90
+ /* auto, not xterm's default scroll: a scrollbar track drawn permanently down the
91
+ edge implies there is something to scroll to, and with the grid fitted to the
92
+ window there usually is not. */
93
+ .xterm-viewport { overflow-y: auto !important; }
94
+ .xterm-viewport::-webkit-scrollbar { width: 10px; }
95
+ .xterm-viewport::-webkit-scrollbar-thumb { background: #2d3542; border-radius: 5px; }
@@ -0,0 +1,84 @@
1
+ /** The single-session viewer page: grant URL, page controls and layout. */
2
+
3
+ /* global ShellPuppetPane */
4
+
5
+ (() => {
6
+ 'use strict';
7
+
8
+ const params = new URLSearchParams(location.search);
9
+ // A session id in the path is accepted as well as the query form.
10
+ const sessionId = params.get('s') || location.pathname.split('/')[2] || '';
11
+ const captureMode = params.get('capture') === '1';
12
+ const redactedCapture = captureMode && params.get('redact') === '1';
13
+ if (captureMode) document.body.classList.add('capture');
14
+
15
+ // The grant has already been redeemed for an HttpOnly cookie. Keep the
16
+ // session id for reloads while removing the spent grant from the URL.
17
+ history.replaceState(null, '', `/view?s=${encodeURIComponent(sessionId)}`);
18
+
19
+ const banner = document.getElementById('banner');
20
+ document.getElementById('session-label').textContent = sessionId;
21
+ if (!sessionId) {
22
+ banner.textContent = 'This viewer link is missing its session id. Ask the agent for a fresh viewer URL.';
23
+ banner.hidden = false;
24
+ return;
25
+ }
26
+
27
+ const MIN_FONT_PX = 6;
28
+ const MAX_FONT_PX = 40;
29
+ const FONT_PREF_KEY = 'shellpuppet.fontSize';
30
+ const clampFont = (px) => Math.min(MAX_FONT_PX, Math.max(MIN_FONT_PX, px));
31
+ let fontOverride = null;
32
+ try {
33
+ const saved = window.localStorage.getItem(FONT_PREF_KEY);
34
+ if (saved !== null && saved !== 'auto') {
35
+ const parsed = Number.parseInt(saved, 10);
36
+ if (Number.isFinite(parsed)) fontOverride = clampFont(parsed);
37
+ }
38
+ } catch {
39
+ // A blocked preference store leaves the automatic font size in place.
40
+ }
41
+
42
+ const pane = ShellPuppetPane.create({
43
+ container: document.getElementById('term'),
44
+ sessionId,
45
+ captureMode,
46
+ redactedCapture,
47
+ initialFontOverride: fontOverride,
48
+ onTitleChange: (title) => { document.title = title; },
49
+ onFontOverrideChange: (value) => {
50
+ try {
51
+ window.localStorage.setItem(FONT_PREF_KEY, value === null ? 'auto' : String(value));
52
+ } catch {
53
+ // The selected size still applies for this page.
54
+ }
55
+ },
56
+ elements: {
57
+ dot: document.getElementById('dot'),
58
+ banner,
59
+ size: document.getElementById('size'),
60
+ inputSource: document.getElementById('input-source'),
61
+ readonly: document.getElementById('readonly'),
62
+ modeHint: document.getElementById('mode-hint'),
63
+ zoomAuto: document.getElementById('zoom-auto'),
64
+ identity: document.getElementById('identity'),
65
+ identityPurpose: document.getElementById('identity-purpose'),
66
+ identityMeta: document.getElementById('identity-meta'),
67
+ sessionAgent: document.getElementById('session-agent'),
68
+ promptAlert: document.getElementById('prompt-alert'),
69
+ },
70
+ });
71
+
72
+ document.getElementById('readonly').addEventListener('click', () => {
73
+ if (!pane.isReadOnlyEnforced()) pane.setReadOnly(!pane.isReadOnly());
74
+ });
75
+ document.getElementById('zoom-in').addEventListener('click', () => pane.nudgeFont(1));
76
+ document.getElementById('zoom-out').addEventListener('click', () => pane.nudgeFont(-1));
77
+ document.getElementById('zoom-auto').addEventListener('click', () => pane.setFontOverride(null));
78
+
79
+ let resizeTimer = null;
80
+ window.addEventListener('resize', () => {
81
+ clearTimeout(resizeTimer);
82
+ resizeTimer = setTimeout(() => pane.relayout(true), 120);
83
+ });
84
+ })();
package/package.json CHANGED
@@ -1,10 +1,69 @@
1
1
  {
2
2
  "name": "shellpuppet",
3
- "version": "0.0.1",
4
- "description": "Supervised terminal sessions for AI agents — an agent drives a real terminal while a human watches, types and approves in the same live session. Placeholder ahead of the first public release.",
5
- "keywords": ["terminal", "pty", "ai", "agents", "supervision", "mcp"],
6
- "author": "Red Eagle Tech (https://redeagle.tech)",
7
- "license": "UNLICENSED",
8
- "homepage": "https://redeagle.tech",
9
- "files": ["index.js", "README.md"]
3
+ "version": "0.2.0",
4
+ "description": "Supervised terminal sessions for AI agents: an agent drives a real terminal while you watch, type and approve. Like Playwright, but for the terminal. An MCP server and CLI over a per-user daemon, with a live browser viewer on the same session.",
5
+ "license": "Apache-2.0",
6
+ "author": "Red Eagle Tech Ltd",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/intermeld/shellpuppet.git"
10
+ },
11
+ "homepage": "https://github.com/intermeld/shellpuppet#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/intermeld/shellpuppet/issues"
14
+ },
15
+ "keywords": [
16
+ "terminal",
17
+ "pty",
18
+ "mcp",
19
+ "ai-agents",
20
+ "supervision",
21
+ "tui",
22
+ "agent-cli"
23
+ ],
24
+ "type": "module",
25
+ "bin": {
26
+ "shellpuppet": "dist/cli/index.js"
27
+ },
28
+ "files": [
29
+ "dist",
30
+ "LICENSE",
31
+ "NOTICE",
32
+ "README.md"
33
+ ],
34
+ "engines": {
35
+ "node": ">=22"
36
+ },
37
+ "allowScripts": {
38
+ "node-pty@1.2.0-beta.18": true
39
+ },
40
+ "scripts": {
41
+ "build": "tsc -p tsconfig.build.json && node scripts/copy-viewer-assets.mjs",
42
+ "typecheck": "tsc -p tsconfig.json",
43
+ "lint": "eslint .",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "test:coverage": "vitest run --coverage"
47
+ },
48
+ "dependencies": {
49
+ "@modelcontextprotocol/sdk": "^1.32.2",
50
+ "@xterm/addon-fit": "^0.11.0",
51
+ "@xterm/addon-serialize": "^0.14.0",
52
+ "@xterm/headless": "^6.0.0",
53
+ "@xterm/xterm": "^6.0.0",
54
+ "chrome-launcher": "^1.2.2",
55
+ "node-pty": "1.2.0-beta.18",
56
+ "ws": "^8.22.0",
57
+ "zod": "^4.6.7"
58
+ },
59
+ "devDependencies": {
60
+ "@eslint/js": "^10.0.1",
61
+ "@types/node": "^22.20.5",
62
+ "@types/ws": "^8.18.2",
63
+ "@vitest/coverage-v8": "^5.0.5",
64
+ "eslint": "^10.13.0",
65
+ "typescript": "^6.0.3",
66
+ "typescript-eslint": "^8.72.1",
67
+ "vitest": "^5.0.5"
68
+ }
10
69
  }
package/index.js DELETED
@@ -1,4 +0,0 @@
1
- // ShellPuppet's first release is on its way. Until then, this package simply
2
- // reserves the name for the real thing. https://redeagle.tech
3
- module.exports = {};
4
- console.error('ShellPuppet: first release coming soon — https://redeagle.tech');