@inneranimalmedia/agentsam-sdk 2.4.1 → 2.6.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 (233) hide show
  1. package/AGENTSAM.md +55 -0
  2. package/README.md +17 -12
  3. package/bin/agentsam +2 -0
  4. package/docs/AGENTSAM_ASTRA_OPENAI_INTEGRATION.md +1363 -0
  5. package/docs/AGENTSAM_WORKBENCH.md +30 -0
  6. package/docs/AUTH_IDENTITY_CONTRACT.md +52 -0
  7. package/docs/CAPABILITIES.md +5 -3
  8. package/docs/CLI_SHELL.md +167 -80
  9. package/docs/CMS_STUDIO.md +101 -0
  10. package/docs/CONTEXT.md +170 -0
  11. package/docs/LOCAL_OLLAMA.md +58 -0
  12. package/docs/MERKLE.md +19 -19
  13. package/docs/PORTABLE_CONTEXT.md +4 -3
  14. package/docs/PROJECT_CONFIG.md +72 -0
  15. package/docs/RELEASES.md +35 -2
  16. package/docs/REPOSITORY_INTELLIGENCE.md +1 -1
  17. package/docs/REPOSITORY_KNOWLEDGE.md +114 -0
  18. package/docs/SDK_WORKER.md +86 -0
  19. package/docs/SECURITY.md +59 -22
  20. package/docs/client-cms-editor.md +15 -0
  21. package/docs/local-studio/WORKMODE_DONOR_NOTES.md +485 -0
  22. package/package.json +35 -10
  23. package/packages/connectors/cloudflare/package.json +10 -0
  24. package/packages/connectors/cloudflare/src/index.js +127 -0
  25. package/packages/connectors/cloudflare/src/owner.js +76 -0
  26. package/packages/connectors/cloudflare/src/routes.js +223 -0
  27. package/packages/connectors/cloudflare/src/vault.js +80 -0
  28. package/packages/connectors/cloudflare/tests/connector.test.mjs +44 -0
  29. package/packages/identity/package.json +10 -1
  30. package/packages/identity/src/contracts/auth-config.js +109 -0
  31. package/packages/identity/src/index.js +1 -0
  32. package/packages/identity/src/oauth/README.md +2 -2
  33. package/packages/identity/src/oauth/credentials.js +11 -4
  34. package/packages/identity/src/oauth/iam-platform.js +3 -3
  35. package/packages/identity/src/providers/iam/index.js +7 -7
  36. package/packages/identity/src/providers/iam/oauth.js +6 -4
  37. package/packages/identity/src/providers/iam/profile.js +5 -5
  38. package/packages/identity/tests/auth-config.test.mjs +61 -0
  39. package/packages/identity/tests/oauth-credentials.test.mjs +13 -2
  40. package/protocol/FILEMETA_V1.md +95 -0
  41. package/protocol/INSPECT_VIEWS_V1.md +40 -0
  42. package/protocol/MERKLE_PERSISTENCE_V1.md +50 -0
  43. package/protocol/MERKLE_V1.md +3 -1
  44. package/protocol/README.md +1 -0
  45. package/protocol/capabilities/cloudflare-cpu-audit-input.schema.json +19 -0
  46. package/protocol/capabilities/cloudflare-cpu-profile-input.schema.json +13 -0
  47. package/protocol/capabilities/cloudflare-wrangler-native-input.schema.json +19 -0
  48. package/protocol/capabilities/manifest.json +79 -3
  49. package/protocol/capabilities/repository-snapshot.schema.json +1 -0
  50. package/protocol/context/context-budget.schema.json +36 -0
  51. package/protocol/context/context-item.schema.json +19 -0
  52. package/protocol/context/resolved-context-pack.schema.json +47 -0
  53. package/protocol/context/result-policy.schema.json +17 -0
  54. package/protocol/knowledge/context-pack.schema.json +33 -0
  55. package/protocol/knowledge/retrieval-query.schema.json +68 -13
  56. package/protocol/models/README.md +373 -0
  57. package/protocol/models/model-inventory-v2.schema.json +212 -0
  58. package/python/README.md +15 -7
  59. package/python/agentsam_sdk/cli.py +0 -21
  60. package/python/agentsam_sdk/tui/README.md +17 -12
  61. package/python/agentsam_sdk/tui/bootstrap.py +2 -2
  62. package/python/agentsam_sdk/tui/demo.py +25 -10
  63. package/python/agentsam_sdk/tui/onboarding.py +208 -0
  64. package/python/tests/test_tui_cli.py +7 -6
  65. package/skills/README.md +21 -0
  66. package/skills/agentsam-app-fundamentals/SKILL.md +165 -0
  67. package/skills/agentsam-app-fundamentals/references/graphs-contracts-ast-merkle.md +89 -0
  68. package/skills/agentsam-app-fundamentals/references/trust-credentials-and-destinations.md +99 -0
  69. package/skills/agentsam-cloudflare-workers/SKILL.md +53 -0
  70. package/skills/agentsam-cloudflare-workers/references/cpu-profiling.md +16 -0
  71. package/skills/agentsam-cloudflare-workers/references/errors-and-observability.md +29 -0
  72. package/skills/agentsam-cloudflare-workers/references/wrangler-native-map.md +28 -0
  73. package/skills/agentsam-jr-dev/SKILL.md +232 -0
  74. package/skills/agentsam-jr-dev/references/real-application-logic.md +156 -0
  75. package/skills/agentsam-jr-dev/references/web-application-fundamentals.md +240 -0
  76. package/skills/agentsam-progression-guard/SKILL.md +197 -0
  77. package/skills/agentsam-progression-guard/references/checkpoint-chain.md +111 -0
  78. package/skills/agentsam-progression-guard/references/hooks-operational-io.md +96 -0
  79. package/skills/catalog.json +71 -0
  80. package/src/agent/capability-adapter.js +25 -13
  81. package/src/agent/index.js +1 -0
  82. package/src/agent/responses-runner.js +325 -0
  83. package/src/capabilities/index.js +7 -0
  84. package/src/capabilities/repository-snapshot-view.js +238 -0
  85. package/src/capabilities/repository-snapshot.js +28 -14
  86. package/src/cli.js +198 -76
  87. package/src/cloudflare/cpu-profile.js +115 -0
  88. package/src/cloudflare/index.js +14 -0
  89. package/src/cloudflare/wrangler.js +132 -0
  90. package/src/commands/account-auth.js +47 -0
  91. package/src/commands/cloudflare.js +58 -0
  92. package/src/commands/connections.js +93 -0
  93. package/src/commands/context-economics.js +114 -0
  94. package/src/commands/context.js +14 -2
  95. package/src/commands/db.js +4 -7
  96. package/src/commands/deploy.js +54 -32
  97. package/src/commands/eval.js +63 -0
  98. package/src/commands/interactive.js +18 -0
  99. package/src/commands/knowledge.js +27 -4
  100. package/src/commands/merkle-persist.js +118 -0
  101. package/src/commands/merkle.js +32 -17
  102. package/src/commands/models.js +152 -0
  103. package/src/commands/ollama.js +259 -0
  104. package/src/commands/preferences.js +144 -0
  105. package/src/commands/product.js +86 -16
  106. package/src/commands/resume.js +67 -0
  107. package/src/commands/security.js +8 -6
  108. package/src/commands/shell.js +405 -100
  109. package/src/commands/skills.js +66 -0
  110. package/src/commands/start-local.js +1 -1
  111. package/src/commands/tunnel.js +5 -4
  112. package/src/commands/whoami.js +86 -0
  113. package/src/context/budget.js +120 -0
  114. package/src/context/compact.js +28 -0
  115. package/src/context/index.js +7 -0
  116. package/src/context/rehydrate.js +35 -0
  117. package/src/context/resolve.js +116 -0
  118. package/src/context/result-policy.js +66 -0
  119. package/src/errors/diagnostic.js +160 -0
  120. package/src/errors/index.js +9 -0
  121. package/src/eval/context.js +191 -0
  122. package/src/eval/index.js +1 -0
  123. package/src/index.js +70 -0
  124. package/src/indexing/execution-boundary.js +144 -0
  125. package/src/indexing/index.js +8 -0
  126. package/src/indexing/provider.js +41 -0
  127. package/src/knowledge/config.js +2 -2
  128. package/src/knowledge/context-pack.js +12 -1
  129. package/src/knowledge/contracts.js +9 -4
  130. package/src/knowledge/engine.js +7 -3
  131. package/src/knowledge/service/server.js +1 -1
  132. package/src/lib/account-session.js +98 -0
  133. package/src/lib/agent-instructions.js +73 -0
  134. package/src/lib/auth.js +4 -0
  135. package/src/lib/bridge-client.js +7 -5
  136. package/src/lib/cli-preferences.js +78 -0
  137. package/src/lib/core-client.js +8 -8
  138. package/src/lib/deploy/git-guard.js +69 -0
  139. package/src/lib/deploy/health.js +57 -0
  140. package/src/lib/deploy/local-studio.js +283 -0
  141. package/src/lib/deploy/secret-scan.js +65 -0
  142. package/src/lib/deploy-receipt/index.js +5 -2
  143. package/src/lib/detect-context.js +6 -5
  144. package/src/lib/execution-approvals.js +59 -0
  145. package/src/lib/identity-scaffold.js +1 -1
  146. package/src/lib/local-scaffold.js +35 -33
  147. package/src/lib/local-sessions.js +127 -0
  148. package/src/lib/local-status.js +9 -17
  149. package/src/lib/merkle/cloudflare-persistence.js +321 -0
  150. package/src/lib/merkle/filemeta.js +43 -0
  151. package/src/lib/merkle/git-ignore.js +24 -0
  152. package/src/lib/merkle/hash.js +1 -0
  153. package/src/lib/merkle/index.js +22 -0
  154. package/src/lib/merkle/persistence.js +72 -0
  155. package/src/lib/merkle/semantic.js +359 -0
  156. package/src/lib/merkle/snapshot.js +9 -3
  157. package/src/lib/merkle/tree.js +11 -6
  158. package/src/lib/project-config.js +227 -0
  159. package/src/lib/project-rules.js +68 -0
  160. package/src/lib/provider-credentials.js +83 -0
  161. package/src/lib/save-sdk-token.js +1 -1
  162. package/src/lib/scaffold/templates/worker-api/index.js +101 -20
  163. package/src/lib/scaffold/wizards/worker-api.js +27 -11
  164. package/src/lib/slash-commands.js +22 -15
  165. package/src/lib/tools.js +11 -5
  166. package/src/models/catalog.js +135 -0
  167. package/src/models/index.js +7 -0
  168. package/src/providers/index.js +5 -0
  169. package/src/providers/openai-responses.js +275 -0
  170. package/src/security/index.js +1 -0
  171. package/src/security/inventory.js +4 -1
  172. package/src/security/process.js +35 -9
  173. package/src/security/render.js +27 -5
  174. package/src/security/scan.js +24 -9
  175. package/src/security/trust-boundary.js +24 -0
  176. package/src/skills/index.js +64 -0
  177. package/src/telemetry/contracts.js +203 -0
  178. package/src/telemetry/events.js +48 -0
  179. package/src/telemetry/index.js +8 -0
  180. package/src/tools/hydrate.js +35 -0
  181. package/src/tools/index.js +2 -0
  182. package/src/tools/search.js +70 -0
  183. package/src/ui/ansi.js +1 -1
  184. package/src/ui/boot.js +54 -0
  185. package/src/ui/merkle/render.js +1 -0
  186. package/src/ui/runtime-activity.js +192 -0
  187. package/src/ui/theme.js +19 -18
  188. package/test/account-session.test.mjs +36 -0
  189. package/test/app-building-skills.test.mjs +61 -0
  190. package/test/apps-scaffold-contract.test.mjs +56 -0
  191. package/test/capabilities.test.mjs +53 -4
  192. package/test/cli-preferences.test.mjs +46 -0
  193. package/test/cloudflare-connector.test.mjs +96 -0
  194. package/test/cloudflare-runtime.test.mjs +75 -0
  195. package/test/context.test.mjs +144 -0
  196. package/test/deploy-health-scan.test.mjs +67 -0
  197. package/test/error-diagnostics.test.mjs +59 -0
  198. package/test/eval-context.test.mjs +37 -0
  199. package/test/execution-approvals.test.mjs +27 -0
  200. package/test/indexing-provider.test.mjs +29 -0
  201. package/test/jr-dev-skill.test.mjs +26 -0
  202. package/test/knowledge-context-pack.test.mjs +19 -0
  203. package/test/knowledge.test.mjs +1 -1
  204. package/test/local-sessions.test.mjs +42 -0
  205. package/test/local-studio-deploy.test.mjs +83 -0
  206. package/test/merkle-persistence.test.mjs +91 -0
  207. package/test/merkle.test.mjs +77 -3
  208. package/test/model-catalog.test.mjs +43 -0
  209. package/test/models.test.mjs +51 -0
  210. package/test/npm10-lock.test.mjs +29 -0
  211. package/test/ollama.test.mjs +94 -0
  212. package/test/openai-responses.test.mjs +95 -0
  213. package/test/project-config.test.mjs +81 -0
  214. package/test/project-rules.test.mjs +44 -0
  215. package/test/provider-credentials.test.mjs +52 -0
  216. package/test/rehydrate.test.mjs +25 -0
  217. package/test/release-hygiene.test.mjs +34 -0
  218. package/test/repository-snapshot-view.test.mjs +112 -0
  219. package/test/responses-runner.test.mjs +148 -0
  220. package/test/runtime-activity.test.mjs +98 -0
  221. package/test/sdk-worker-contract.test.mjs +68 -0
  222. package/test/security.test.mjs +46 -0
  223. package/test/shell.test.mjs +55 -21
  224. package/test/skills.test.mjs +22 -0
  225. package/test/smoke.mjs +5 -2
  226. package/test/telemetry.test.mjs +79 -0
  227. package/test/theme-portability.test.mjs +14 -0
  228. package/test/tools-search.test.mjs +40 -0
  229. package/test/whoami-resume.test.mjs +56 -0
  230. package/examples/agentsam-tui-ansi.mjs +0 -149
  231. package/src/commands/tui.js +0 -120
  232. package/src/ui/splash-xterm.js +0 -290
  233. package/src/ui/splash.js +0 -426
@@ -1,290 +0,0 @@
1
- /**
2
- * @file src/ui/splash-xterm.js
3
- * @description In-app splash renderer for xterm.js panels.
4
- *
5
- * Same choreography as splash.js (CLI) but writes to an xterm Terminal
6
- * instance instead of process.stdout. Used by XTermShell.tsx.
7
- *
8
- * Usage in XTermShell.tsx:
9
- * import { runXtermSplash } from '@inneranimalmedia/agentsam-sdk/ui/splash-xterm';
10
- * import { getXtermOptions } from '@inneranimalmedia/agentsam-sdk/ui/theme';
11
- *
12
- * const targetType = connection?.target_type ?? 'platform_vm';
13
- * const term = new Terminal({
14
- * ...getXtermOptions(targetType),
15
- * cols: dimensions.cols,
16
- * rows: dimensions.rows,
17
- * });
18
- *
19
- * // After term.open(containerRef.current):
20
- * const stopFlicker = await runXtermSplash(term, {
21
- * apiBase: 'https://inneranimalmedia.com',
22
- * workspaceId: activeWorkspace?.id,
23
- * authToken: session?.token,
24
- * targetType,
25
- * skipArt: !isFirstSession,
26
- * });
27
- *
28
- * // On cleanup:
29
- * return () => { stopFlicker(); term.dispose(); };
30
- */
31
-
32
- import { PALETTE, getLaneTheme } from './theme.js';
33
- import { probeAll } from './splash.js';
34
-
35
- // ─────────────────────────────────────────────────────────────────────────────
36
- // xterm write helpers
37
- // ─────────────────────────────────────────────────────────────────────────────
38
-
39
- const ESC = '\x1b';
40
- const CSI = `${ESC}[`;
41
-
42
- const X = {
43
- reset: `${CSI}0m`,
44
- bold: `${CSI}1m`,
45
- hide: `${CSI}?25l`,
46
- show: `${CSI}?25h`,
47
- clearLine: `${CSI}2K\r`,
48
- up: (n = 1) => `${CSI}${n}A`,
49
- fg: (hex) => {
50
- const h = hex.replace('#', '');
51
- const r = parseInt(h.slice(0, 2), 16);
52
- const g = parseInt(h.slice(2, 4), 16);
53
- const b = parseInt(h.slice(4, 6), 16);
54
- return `${CSI}38;2;${r};${g};${b}m`;
55
- },
56
- };
57
-
58
- const sleep = (ms) => new Promise(r => setTimeout(r, ms));
59
-
60
- // ─────────────────────────────────────────────────────────────────────────────
61
- // COLOR BUILDER (per-lane)
62
- // ─────────────────────────────────────────────────────────────────────────────
63
-
64
- function buildColors() {
65
- const R = X.reset;
66
- const B = X.bold;
67
- return {
68
- R, B,
69
- TEAL: X.fg(PALETTE.teal300),
70
- AMBER: X.fg(PALETTE.amber300),
71
- STONE: X.fg('#3a3530'),
72
- STONE2: X.fg('#2a2520'),
73
- VINE: X.fg('#1a4a2a'),
74
- VINE2: X.fg('#0f6b3a'),
75
- FIRE1: X.fg('#f97316'),
76
- FIRE2: X.fg('#ef4444'),
77
- FIREY: X.fg('#fef08a'),
78
- GRILL: X.fg('#1e2830'),
79
- GRILL2: X.fg('#2d3d4a'),
80
- PELT: X.fg('#8b6f5a'),
81
- DIM: X.fg('#444444'),
82
- GHOST: X.fg('#888888'),
83
- WHT: X.fg('#e2e8f0'),
84
- };
85
- }
86
-
87
- // ─────────────────────────────────────────────────────────────────────────────
88
- // SCENE DATA
89
- // ─────────────────────────────────────────────────────────────────────────────
90
-
91
- function gorillaRows(C) {
92
- const { R, GRILL, GRILL2, PELT, DIM } = C;
93
- return [
94
- ` ${DIM}░░▒${R}${GRILL2}▓▓▓▓▓▓▓▓${R}${DIM}▒░░${R}`,
95
- ` ${DIM}░${R}${GRILL2}▒▓▓${R}${GRILL}█████████████${R}${GRILL2}▓▓▒${R}${DIM}░${R}`,
96
- ` ${GRILL2}▒▓${R}${GRILL}███${R}${GRILL2}▒▒${R}${GRILL}████████${R}${GRILL2}▒▒${R}${GRILL}███${R}${GRILL2}▓▒${R}`,
97
- ` ${GRILL2}▓${R}${GRILL}████${R} ${DIM}▒▒▒▒▒▒▒▒${R} ${GRILL}████${R}${GRILL2}▓${R}`,
98
- ` ${GRILL}▓███${R}${GRILL2}▒${R} ${PELT}██${R}${DIM}▒${R}${PELT}████${R}${DIM}▒${R}${PELT}██${R} ${GRILL2}▒${R}${GRILL}███▓${R}`,
99
- ` ${GRILL}████${R} ${PELT}███${R}${DIM}▒▒▒▒${R}${PELT}███${R} ${GRILL}████${R}`,
100
- ` ${GRILL}████${R}${GRILL2}▒${R} ${PELT}██████████${R} ${GRILL2}▒${R}${GRILL}████${R}`,
101
- ` ${GRILL}████${R} ${DIM}▒▒▒▒▒▒▒▒▒▒${R} ${GRILL}████${R}`,
102
- ` ${GRILL2}▒${R}${GRILL}████${R}${GRILL2}▓▓▓${R}${GRILL}████████████${R}${GRILL2}▓▓▓${R}${GRILL}████${R}${GRILL2}▒${R}`,
103
- ` ${GRILL}██████████████████████████${R}`,
104
- ` ${DIM}▒▒${R}${GRILL}████████${R}${GRILL2}▒▒▒▒▒▒▒▒▒▒▒▒${R}${GRILL}████████${R}${DIM}▒▒${R}`,
105
- ` ${PELT}▓${R}${GRILL}██████████${R}${DIM}░░░░░░░░░░░░░░${R}${GRILL}██████████${R}${PELT}▓${R}`,
106
- ];
107
- }
108
-
109
- function titleBoxLines(C) {
110
- const { R, B, TEAL, AMBER } = C;
111
- const wide = 26;
112
- const h = `${TEAL}═${R}`;
113
- return [
114
- `${TEAL}╔${R}${h.repeat(wide)}${TEAL}╗${R}`,
115
- `${TEAL}║${R} ${B}${AMBER}INNERANIMAL MEDIA${R} ${TEAL}║${R}`,
116
- `${TEAL}║${R} ${TEAL}inneranimalmedia.com${R} ${TEAL}║${R}`,
117
- `${TEAL}╚${R}${h.repeat(wide)}${TEAL}╝${R}`,
118
- ];
119
- }
120
-
121
- function ladderRows(C) {
122
- const { R, TEAL } = C;
123
- return [
124
- ` ${TEAL}║${R} ${TEAL}║${R}`,
125
- ` ${TEAL}╠═══╣${R}`,
126
- ` ${TEAL}║${R} ${TEAL}║${R}`,
127
- ` ${TEAL}╠═══╣${R}`,
128
- ` ${TEAL}║${R} ${TEAL}║${R}`,
129
- ` ${TEAL}╠═══╣${R}`,
130
- ` ${TEAL}║${R} ${TEAL}║${R}`,
131
- ];
132
- }
133
-
134
- // ─────────────────────────────────────────────────────────────────────────────
135
- // HUD RENDER
136
- // ─────────────────────────────────────────────────────────────────────────────
137
-
138
- const HUD_ITEMS = [
139
- { key: 'workspace', icon: '⊞', label: 'Workspace' },
140
- { key: 'runtime', icon: '▣', label: 'Runtime' },
141
- { key: 'tunnel', icon: '⟁', label: 'Tunnel' },
142
- { key: 'agent', icon: '⬡', label: 'Agent' },
143
- ];
144
-
145
- const READY_LABELS = {
146
- workspace: 'active',
147
- runtime: 'ready',
148
- tunnel: 'connected',
149
- agent: 'online',
150
- };
151
-
152
- function renderHUDLine(states, C) {
153
- const { R, B, TEAL, GHOST, WHT, DIM } = C;
154
- return HUD_ITEMS.map((item, i) => {
155
- const state = states[item.key] || 'checking';
156
- let stateStr;
157
- if (state === 'ready') {
158
- stateStr = `${TEAL}● ${READY_LABELS[item.key]}${R}`;
159
- } else if (state === 'checking') {
160
- stateStr = `${GHOST}◌ checking...${R}`;
161
- } else if (state === 'error') {
162
- stateStr = `${X.fg('#ef4444')}✗ error${R}`;
163
- } else {
164
- stateStr = `${X.fg('#666666')}○ offline${R}`;
165
- }
166
- const div = i < HUD_ITEMS.length - 1 ? ` ${DIM}│${R} ` : '';
167
- return `${GHOST}${item.icon}${R} ${B}${WHT}${item.label}${R} ${stateStr}${div}`;
168
- }).join('');
169
- }
170
-
171
- // ─────────────────────────────────────────────────────────────────────────────
172
- // MAIN XTERM SPLASH
173
- // ─────────────────────────────────────────────────────────────────────────────
174
-
175
- /**
176
- * @param {import('@xterm/xterm').Terminal} term
177
- * @param {object} opts
178
- * @param {string} opts.apiBase
179
- * @param {string} opts.workspaceId
180
- * @param {string} opts.authToken
181
- * @param {'user_hosted_tunnel'|'platform_vm'|'sandbox'} opts.targetType
182
- * @param {boolean} opts.skipArt
183
- * @returns {Promise<() => void>} stopFlicker — call on unmount
184
- */
185
- export async function runXtermSplash(term, {
186
- apiBase = '',
187
- workspaceId = '',
188
- authToken = '',
189
- targetType = 'platform_vm',
190
- skipArt = false,
191
- } = {}) {
192
-
193
- const lane = getLaneTheme(targetType);
194
- const C = buildColors();
195
- const { R, B, TEAL, AMBER, GHOST, WHT, DIM, STONE, STONE2, FIRE1, FIRE2 } = C;
196
- const PRIMARY = X.fg(lane.colors.primary);
197
- const W = term.cols || 80;
198
-
199
- const w = (s) => term.write(s);
200
- const wl = (s = '') => term.write(s + '\r\n');
201
-
202
- w(X.hide);
203
- w(`${ESC}c`); // full reset
204
- await sleep(60);
205
-
206
- // cd verb flash
207
- w(` ${GHOST}$ ${R}${AMBER}cd ~/inneranimalmedia${R}`);
208
- await sleep(340);
209
- w(`\r${X.clearLine}`);
210
- await sleep(60);
211
-
212
- if (!skipArt) {
213
- wl();
214
-
215
- const rows = gorillaRows(C);
216
- const title = titleBoxLines(C);
217
- const TITLE_START = 3;
218
-
219
- for (let i = 0; i < rows.length; i++) {
220
- const titleIdx = i - TITLE_START;
221
- const titlePart = (titleIdx >= 0 && titleIdx < title.length)
222
- ? ' ' + title[titleIdx]
223
- : '';
224
- wl(` ${rows[i]}${titlePart}`);
225
- await sleep(24);
226
- }
227
-
228
- wl();
229
-
230
- // Torches
231
- w(` ${FIRE1} ▓▓▓${R}`);
232
- await sleep(90);
233
- wl(`${' '.repeat(Math.max(0, W - 14))}${FIRE2}▓▓▓${R}`);
234
- await sleep(30);
235
-
236
- // Ledge
237
- w(' ');
238
- for (let i = 0; i < W - 4; i++) {
239
- w((i % 2 === 0) ? `${STONE}█${R}` : `${STONE2}▓${R}`);
240
- await sleep(4);
241
- }
242
- wl();
243
- wl(` ${DIM}${'╌'.repeat(W - 4)}${R}`);
244
- await sleep(50);
245
-
246
- // Ladder
247
- for (const rung of ladderRows(C)) {
248
- wl(rung);
249
- await sleep(30);
250
- }
251
- }
252
-
253
- wl();
254
-
255
- // Start prompt
256
- await sleep(skipArt ? 0 : 70);
257
- wl(` ${B}${AMBER}Start ${PRIMARY}▸${R}`);
258
- await sleep(40);
259
- wl(` ${GHOST}Type a command to begin.${R}`);
260
- await sleep(skipArt ? 0 : 70);
261
- wl();
262
-
263
- // HUD — fire probes in parallel
264
- const probePromise = probeAll({ apiBase, workspaceId, authToken });
265
- const initStates = { workspace: 'checking', runtime: 'checking', tunnel: 'checking', agent: 'checking' };
266
-
267
- wl(` ${DIM}${'─'.repeat(W - 4)}${R}`);
268
- wl();
269
- w(` ${renderHUDLine(initStates, C)}`);
270
- wl(); wl();
271
- wl(` ${DIM}${'─'.repeat(W - 4)}${R}`);
272
- wl();
273
-
274
- // Update HUD in-place when probes resolve
275
- const LINES_BELOW = 4;
276
- probePromise.then(resolved => {
277
- w(X.up(LINES_BELOW));
278
- w(`\r${X.clearLine}`);
279
- w(` ${renderHUDLine(resolved, C)}`);
280
- w('\r\n'.repeat(LINES_BELOW));
281
- w(X.show);
282
- w(` ${PRIMARY}>${R} `);
283
- });
284
-
285
- // Torch flicker is handled via CSS animation on the panel wrapper
286
- // (terminal-lanes.css) — xterm.js decoration API in Phase 2.
287
- return () => {};
288
- }
289
-
290
- export default { runXtermSplash };