tmux-ide 2.9.20 → 2.9.22
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.
- package/bin/cli.js +16998 -4283
- package/package.json +3 -2
- package/packages/contracts/src/command-catalog.ts +116 -0
- package/packages/contracts/src/commands.ts +5 -4
- package/packages/contracts/src/daemon-events.ts +2 -1
- package/packages/contracts/src/index.ts +3 -0
- package/packages/contracts/src/pane-reader.ts +121 -0
- package/packages/contracts/src/pane-stream.ts +18 -0
- package/packages/contracts/src/plain-text.ts +61 -0
- package/packages/contracts/src/visual-theme-presets.ts +58 -2
- package/packages/daemon/dist/command-center/command-catalog-routes.js +78 -0
- package/packages/daemon/dist/command-center/plugin-routes.js +84 -0
- package/packages/daemon/dist/command-center/server.js +13 -0
- package/packages/daemon/dist/command-center/tmux-server-reader.js +41 -0
- package/packages/daemon/dist/command-center/tmux-servers.js +6 -0
- package/packages/daemon/dist/doctor.js +106 -43
- package/packages/daemon/dist/lib/cli-action-bridge.js +15 -0
- package/packages/daemon/dist/lib/cli-command.js +13 -0
- package/packages/daemon/dist/lib/daemon-embed.js +39 -1
- package/packages/daemon/dist/lib/headless-daemon.js +1 -0
- package/packages/daemon/dist/lib/pane-reader-files.js +226 -0
- package/packages/daemon/dist/lib/remote-tmux-command.js +8 -5
- package/packages/daemon/dist/lib/tmux-client-execution.js +73 -7
- package/packages/daemon/dist/lib/tmux-pane-reader.js +105 -0
- package/packages/daemon/dist/lib/tmux-server-features.js +38 -0
- package/packages/daemon/dist/lib/tmux-server-owner.js +9 -0
- package/packages/daemon/dist/lib/worktree.js +18 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Info.plist +2 -2
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/MacOS/tmux-ide-notifier +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/Resources/Assets.car +0 -0
- package/packages/daemon/dist/native/TmuxIdeNotifier.app/Contents/_CodeSignature/CodeResources +2 -2
- package/packages/daemon/dist/open-browser.js +26 -12
- package/packages/daemon/dist/open-reader.js +84 -0
- package/packages/daemon/dist/plugins/action-catalog.js +129 -0
- package/packages/daemon/dist/plugins/action-cli.js +212 -0
- package/packages/daemon/dist/plugins/api-table.js +303 -0
- package/packages/daemon/dist/plugins/cli.js +556 -0
- package/packages/daemon/dist/plugins/consent.js +107 -0
- package/packages/daemon/dist/plugins/daemon-plugins.js +124 -0
- package/packages/daemon/dist/plugins/discovery.js +142 -0
- package/packages/daemon/dist/plugins/examples/worktree-tasks.js +115 -0
- package/packages/daemon/dist/plugins/exec-sandbox.js +202 -0
- package/packages/daemon/dist/plugins/host/actions-prelude.js +279 -0
- package/packages/daemon/dist/plugins/host/entry.js +4 -0
- package/packages/daemon/dist/plugins/host/host-api-prelude.js +232 -0
- package/packages/daemon/dist/plugins/host/lua-state.js +493 -0
- package/packages/daemon/dist/plugins/host/main.js +322 -0
- package/packages/daemon/dist/plugins/host/sandbox.js +299 -0
- package/packages/daemon/dist/plugins/host-calls.js +279 -0
- package/packages/daemon/dist/plugins/manifest.js +69 -0
- package/packages/daemon/dist/plugins/plugin-exec.js +261 -0
- package/packages/daemon/dist/plugins/plugin-log.js +54 -0
- package/packages/daemon/dist/plugins/plugin-store.js +74 -0
- package/packages/daemon/dist/plugins/protocol.js +252 -0
- package/packages/daemon/dist/plugins/safe-files.js +97 -0
- package/packages/daemon/dist/plugins/supervisor.js +790 -0
- package/packages/daemon/dist/plugins/worktree-calls.js +154 -0
- package/packages/daemon/dist/restore.js +57 -40
- package/packages/daemon/dist/terminal/mirror/session-channel.js +4 -1
- package/packages/daemon/dist/terminal/pane-stream/pane-stream-websocket.js +12 -3
- package/packages/daemon/dist/terminal/protocol/reader-option.js +66 -0
- package/packages/daemon/dist/terminal/protocol/session-descriptor-discovery.js +7 -2
- package/packages/daemon/dist/tmux-upgrade/cli.js +106 -0
- package/packages/daemon/dist/tmux-upgrade/io.js +540 -0
- package/packages/daemon/dist/tmux-upgrade/plan.js +238 -0
- package/packages/daemon/dist/tmux-upgrade/run.js +199 -0
- package/packages/daemon/dist/tui/chrome/snapshot.js +3 -4
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agent-navigation.js +64 -4
- package/packages/daemon/dist/tui/mirror/runtime/application-home-agents-owner.js +62 -5
- package/packages/daemon/dist/tui/mirror/runtime/application-home-experience.js +2 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-machine-agent-navigation.js +12 -8
- package/packages/daemon/dist/tui/mirror/runtime/application-palette-command-owner.js +30 -2
- package/packages/daemon/dist/tui/mirror/runtime/application-plugin-commands.js +152 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-plugin-form.js +251 -0
- package/packages/daemon/dist/tui/mirror/runtime/application-terminal-interaction-controller.js +125 -111
- package/packages/daemon/dist/tui/mirror/workspace/application-command-description.js +14 -0
- package/packages/daemon/dist/tui/mirror/workspace/palette-list-layout.js +5 -0
- package/packages/daemon/src/command-center/command-catalog-routes.ts +116 -0
- package/packages/daemon/src/command-center/plugin-routes.ts +110 -0
- package/packages/daemon/src/command-center/server.ts +15 -0
- package/packages/daemon/src/command-center/tmux-server-reader.ts +62 -0
- package/packages/daemon/src/command-center/tmux-servers.ts +6 -0
- package/packages/daemon/src/doctor.ts +118 -45
- package/packages/daemon/src/lib/cli-action-bridge.ts +19 -0
- package/packages/daemon/src/lib/cli-command.ts +16 -0
- package/packages/daemon/src/lib/daemon-embed.ts +59 -0
- package/packages/daemon/src/lib/headless-daemon.ts +1 -0
- package/packages/daemon/src/lib/pane-reader-files.ts +294 -0
- package/packages/daemon/src/lib/remote-tmux-command.ts +13 -6
- package/packages/daemon/src/lib/tmux-client-execution.ts +79 -7
- package/packages/daemon/src/lib/tmux-pane-reader.ts +144 -0
- package/packages/daemon/src/lib/tmux-server-features.ts +43 -0
- package/packages/daemon/src/lib/tmux-server-owner.ts +9 -0
- package/packages/daemon/src/lib/worktree.ts +16 -0
- package/packages/daemon/src/open-browser.ts +59 -18
- package/packages/daemon/src/open-reader.ts +148 -0
- package/packages/daemon/src/plugins/action-catalog.ts +141 -0
- package/packages/daemon/src/plugins/action-cli.ts +248 -0
- package/packages/daemon/src/plugins/api-table.ts +346 -0
- package/packages/daemon/src/plugins/cli.ts +630 -0
- package/packages/daemon/src/plugins/consent.ts +125 -0
- package/packages/daemon/src/plugins/daemon-plugins.ts +172 -0
- package/packages/daemon/src/plugins/discovery.ts +176 -0
- package/packages/daemon/src/plugins/examples/worktree-tasks.ts +120 -0
- package/packages/daemon/src/plugins/exec-sandbox.ts +264 -0
- package/packages/daemon/src/plugins/host/actions-prelude.ts +280 -0
- package/packages/daemon/src/plugins/host/entry.ts +5 -0
- package/packages/daemon/src/plugins/host/host-api-prelude.ts +233 -0
- package/packages/daemon/src/plugins/host/lua-state.ts +557 -0
- package/packages/daemon/src/plugins/host/main.ts +359 -0
- package/packages/daemon/src/plugins/host/sandbox.ts +301 -0
- package/packages/daemon/src/plugins/host-calls.ts +343 -0
- package/packages/daemon/src/plugins/manifest.ts +74 -0
- package/packages/daemon/src/plugins/plugin-exec.ts +326 -0
- package/packages/daemon/src/plugins/plugin-log.ts +63 -0
- package/packages/daemon/src/plugins/plugin-store.ts +80 -0
- package/packages/daemon/src/plugins/protocol.ts +275 -0
- package/packages/daemon/src/plugins/safe-files.ts +105 -0
- package/packages/daemon/src/plugins/supervisor.ts +954 -0
- package/packages/daemon/src/plugins/worktree-calls.ts +183 -0
- package/packages/daemon/src/restore.ts +80 -44
- package/packages/daemon/src/terminal/mirror/events.ts +2 -0
- package/packages/daemon/src/terminal/mirror/session-channel.ts +6 -1
- package/packages/daemon/src/terminal/pane-stream/pane-stream-websocket.ts +15 -2
- package/packages/daemon/src/terminal/protocol/reader-option.ts +77 -0
- package/packages/daemon/src/terminal/protocol/session-descriptor-discovery.ts +10 -1
- package/packages/daemon/src/tmux-upgrade/cli.ts +118 -0
- package/packages/daemon/src/tmux-upgrade/io.ts +596 -0
- package/packages/daemon/src/tmux-upgrade/plan.ts +353 -0
- package/packages/daemon/src/tmux-upgrade/run.ts +325 -0
- package/packages/daemon/src/tui/chrome/snapshot.ts +3 -4
- package/packages/daemon/src/tui/mirror/runtime/application-fleet-switcher.tsx +3 -1
- package/packages/daemon/src/tui/mirror/runtime/application-home-agent-navigation.ts +110 -10
- package/packages/daemon/src/tui/mirror/runtime/application-home-agents-owner.ts +90 -6
- package/packages/daemon/src/tui/mirror/runtime/application-home-experience.ts +2 -0
- package/packages/daemon/src/tui/mirror/runtime/application-machine-agent-navigation.ts +20 -9
- package/packages/daemon/src/tui/mirror/runtime/application-palette-command-owner.ts +42 -2
- package/packages/daemon/src/tui/mirror/runtime/application-palette-preview.tsx +7 -1
- package/packages/daemon/src/tui/mirror/runtime/application-plugin-commands.ts +229 -0
- package/packages/daemon/src/tui/mirror/runtime/application-plugin-form.ts +312 -0
- package/packages/daemon/src/tui/mirror/runtime/application-root-v2.tsx +2 -2
- package/packages/daemon/src/tui/mirror/runtime/application-terminal-interaction-controller.ts +149 -128
- package/packages/daemon/src/tui/mirror/workspace/application-command-description.ts +44 -2
- package/packages/daemon/src/tui/mirror/workspace/palette-list-layout.ts +4 -0
- package/packages/tmux-bridge/src/runner.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tmux-ide",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.22",
|
|
4
4
|
"description": "The open-source workspace for coding agents: run Claude Code, Codex and other agents in tmux with live status",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"demo:themes": "bun --preload @opentui/solid/preload docs/scripts/render-theme-gallery.tsx && node docs/scripts/rasterize-theme-gallery.mjs",
|
|
74
74
|
"demo:font": "node docs/scripts/tui-demo-font/build.mjs",
|
|
75
75
|
"readme:media": "node docs/scripts/readme-media.mjs",
|
|
76
|
-
"test:tui-renderer": "bun test --preload @opentui/solid/preload --preload ./packages/daemon/test-support/opentui-renderer-preload.ts ./packages/daemon/src/tui/mirror/automatic-contrast-renderer.test.tsx ./packages/daemon/src/tui/mirror/pane-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/native-grid-projection-renderer.test.tsx ./packages/daemon/src/tui/mirror/widget-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/missions-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/recipes-gallery-renderer.test.tsx ./packages/daemon/src/tui/mirror/shell-chrome-renderer.test.tsx ./packages/daemon/src/tui/mirror/sidebar-renderer.test.tsx ./packages/daemon/src/tui/mirror/home-files-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/changes-terminal-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/activity-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/features/files/session-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-terminal-workspace-renderer.test.tsx ./packages/daemon/src/tui/mirror/testing/styled-frame-oracle.test.tsx ./packages/daemon/src/tui/mirror/runtime/terminal-transient-frame-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/terminal-draw-failure-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-shell-view-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-root-error-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-backpressure-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-demand-cadence-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/files-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/changes-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/missions-activity-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/dialogs-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/optional-feature-registry-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/palette-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/pane-scoped-terminal-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/features/rich-preview/feature.test.ts ./packages/daemon/src/tui/mirror/runtime/rich-preview-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/application-shell-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/pane-frame-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/terminal-pane-chrome-view.test.tsx ./packages/daemon/src/tui/mirror/workspace/terminal-window-strip-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/workbench-shell-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/workbench-dock-dual-host-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/agent-terminal-canvas-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/command-palette-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/opentui-insertion-stability-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-shell-home-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/terminal-pane-header-polish-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-home-agent-roster-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-home-agent-flow-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/guided-tour-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-shell-sidebar-catalog-renderer.test.tsx ./packages/daemon/src/tui/mirror/ui/ui-renderer.test.tsx ./packages/daemon/src/tui/mirror/ui/pane-interaction-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-machine-sidebar-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-add-machine-dialog-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-new-agent-dialog-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-fleet-switcher-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-palette-preview-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-fleet-palette-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-fleet-session-actions-renderer.test.tsx ./packages/daemon/src/tui/mirror/ui/agent-team-renderer.test.tsx ./scripts/solid-conditional-props.test.tsx",
|
|
76
|
+
"test:tui-renderer": "bun test --preload @opentui/solid/preload --preload ./packages/daemon/test-support/opentui-renderer-preload.ts ./packages/daemon/src/tui/mirror/automatic-contrast-renderer.test.tsx ./packages/daemon/src/tui/mirror/pane-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/native-grid-projection-renderer.test.tsx ./packages/daemon/src/tui/mirror/widget-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/missions-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/recipes-gallery-renderer.test.tsx ./packages/daemon/src/tui/mirror/shell-chrome-renderer.test.tsx ./packages/daemon/src/tui/mirror/sidebar-renderer.test.tsx ./packages/daemon/src/tui/mirror/home-files-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/changes-terminal-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/activity-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/features/files/session-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-terminal-workspace-renderer.test.tsx ./packages/daemon/src/tui/mirror/testing/styled-frame-oracle.test.tsx ./packages/daemon/src/tui/mirror/runtime/terminal-transient-frame-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/terminal-draw-failure-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-shell-view-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-root-error-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-backpressure-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-demand-cadence-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/files-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/changes-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/missions-activity-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/dialogs-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/optional-feature-registry-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/palette-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/pane-scoped-terminal-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/features/rich-preview/feature.test.ts ./packages/daemon/src/tui/mirror/runtime/rich-preview-optional-feature-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/application-shell-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/pane-frame-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/terminal-pane-chrome-view.test.tsx ./packages/daemon/src/tui/mirror/workspace/terminal-window-strip-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/workbench-shell-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/workbench-dock-dual-host-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/agent-terminal-canvas-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/command-palette-surface-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/opentui-insertion-stability-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-shell-home-renderer.test.tsx ./packages/daemon/src/tui/mirror/workspace/terminal-pane-header-polish-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-home-agent-roster-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-home-agent-flow-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/guided-tour-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-shell-sidebar-catalog-renderer.test.tsx ./packages/daemon/src/tui/mirror/ui/ui-renderer.test.tsx ./packages/daemon/src/tui/mirror/ui/pane-interaction-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-machine-sidebar-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-add-machine-dialog-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-new-agent-dialog-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-fleet-switcher-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-palette-preview-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-fleet-palette-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-plugin-palette-renderer.test.tsx ./packages/daemon/src/tui/mirror/runtime/application-fleet-session-actions-renderer.test.tsx ./packages/daemon/src/tui/mirror/ui/agent-team-renderer.test.tsx ./scripts/solid-conditional-props.test.tsx",
|
|
77
77
|
"test:tui-smoke": "bun scripts/smoke-tui-missions.mjs",
|
|
78
78
|
"test:tui-live": "node scripts/tui-testdrive.mjs smoke",
|
|
79
79
|
"test:tui-testdrive": "node --test scripts/lib/tui-testdrive-clipboard-hook.test.mjs scripts/lib/tui-testdrive-input.test.mjs",
|
|
@@ -143,6 +143,7 @@
|
|
|
143
143
|
"js-yaml": "^4.3.1",
|
|
144
144
|
"node-pty": "1.2.0-beta.12",
|
|
145
145
|
"string-width": "^7.2.0",
|
|
146
|
+
"wasmoon": "1.16.0",
|
|
146
147
|
"ws": "^8.21.0",
|
|
147
148
|
"zod": "^4.3.6"
|
|
148
149
|
},
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { plainTextSchema } from "./plain-text.ts";
|
|
3
|
+
import {
|
|
4
|
+
CommandDescriptorSchemaZ,
|
|
5
|
+
CommandIdSchemaZ,
|
|
6
|
+
CommandSourceKindSchemaZ,
|
|
7
|
+
} from "./commands.ts";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The command catalog: every command a palette, a key binding or the CLI can
|
|
11
|
+
* offer, built-in daemon actions and plugin actions alike. Plugin actions
|
|
12
|
+
* carry a parameter list the palette turns into a form before invoking.
|
|
13
|
+
*/
|
|
14
|
+
export const COMMAND_CATALOG_VERSION = 1 as const;
|
|
15
|
+
|
|
16
|
+
export const CommandParamTypeSchemaZ = z.enum(["string", "text", "number", "boolean", "choice"]);
|
|
17
|
+
export type CommandParamType = z.infer<typeof CommandParamTypeSchemaZ>;
|
|
18
|
+
|
|
19
|
+
export const CommandParamNameSchemaZ = z.string().regex(/^[a-z_][a-z0-9_]{0,63}$/u);
|
|
20
|
+
|
|
21
|
+
export const CommandChoiceSchemaZ = z
|
|
22
|
+
.object({
|
|
23
|
+
value: plainTextSchema(0, 500),
|
|
24
|
+
label: plainTextSchema(1, 200),
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
export type CommandChoice = z.infer<typeof CommandChoiceSchemaZ>;
|
|
28
|
+
|
|
29
|
+
export const CommandParamSchemaZ = z
|
|
30
|
+
.object({
|
|
31
|
+
name: CommandParamNameSchemaZ,
|
|
32
|
+
type: CommandParamTypeSchemaZ,
|
|
33
|
+
label: plainTextSchema(1, 120),
|
|
34
|
+
description: plainTextSchema(0, 500).optional(),
|
|
35
|
+
/** False only when the plugin marked it `optional = true`. */
|
|
36
|
+
required: z.boolean(),
|
|
37
|
+
/** A fixed default; `dynamicDefault` means the plugin computes one per invocation. */
|
|
38
|
+
default: z.union([plainTextSchema(0, 10_000), z.number(), z.boolean()]).optional(),
|
|
39
|
+
dynamicDefault: z.boolean(),
|
|
40
|
+
/** Fixed choices for `choice`; `dynamicChoices` means ask the plugin. */
|
|
41
|
+
choices: z.array(CommandChoiceSchemaZ).max(500).optional(),
|
|
42
|
+
dynamicChoices: z.boolean(),
|
|
43
|
+
})
|
|
44
|
+
.strict();
|
|
45
|
+
export type CommandParam = z.infer<typeof CommandParamSchemaZ>;
|
|
46
|
+
|
|
47
|
+
export const CommandCatalogEntrySchemaZ = z
|
|
48
|
+
.object({
|
|
49
|
+
descriptor: CommandDescriptorSchemaZ,
|
|
50
|
+
/** The plugin that registered it; absent for built-in commands. */
|
|
51
|
+
plugin: z.string().min(1).max(64).optional(),
|
|
52
|
+
params: z.array(CommandParamSchemaZ).max(32),
|
|
53
|
+
})
|
|
54
|
+
.strict();
|
|
55
|
+
export type CommandCatalogEntry = z.infer<typeof CommandCatalogEntrySchemaZ>;
|
|
56
|
+
|
|
57
|
+
export const CommandCatalogResourceSchemaZ = z
|
|
58
|
+
.object({
|
|
59
|
+
version: z.literal(COMMAND_CATALOG_VERSION),
|
|
60
|
+
revision: z.number().int().nonnegative(),
|
|
61
|
+
entries: z.array(CommandCatalogEntrySchemaZ).max(2000),
|
|
62
|
+
})
|
|
63
|
+
.strict();
|
|
64
|
+
export type CommandCatalogResource = z.infer<typeof CommandCatalogResourceSchemaZ>;
|
|
65
|
+
|
|
66
|
+
/** Where an invocation came from, so a plugin can act on the right session and pane. */
|
|
67
|
+
export const CommandInvocationContextSchemaZ = z
|
|
68
|
+
.object({
|
|
69
|
+
source: CommandSourceKindSchemaZ,
|
|
70
|
+
session: z.string().min(1).max(200).optional(),
|
|
71
|
+
window: z.string().min(1).max(200).optional(),
|
|
72
|
+
pane: z.string().min(1).max(200).optional(),
|
|
73
|
+
})
|
|
74
|
+
.strict();
|
|
75
|
+
export type CommandInvocationContext = z.infer<typeof CommandInvocationContextSchemaZ>;
|
|
76
|
+
|
|
77
|
+
export const CommandArgValueSchemaZ = z.union([z.string().max(100_000), z.number(), z.boolean()]);
|
|
78
|
+
|
|
79
|
+
export const CommandInvokeRequestSchemaZ = z
|
|
80
|
+
.object({
|
|
81
|
+
id: CommandIdSchemaZ,
|
|
82
|
+
args: z.record(CommandParamNameSchemaZ, CommandArgValueSchemaZ),
|
|
83
|
+
context: CommandInvocationContextSchemaZ,
|
|
84
|
+
/** Required for a dangerous command: the person confirmed it. */
|
|
85
|
+
confirmed: z.boolean().optional(),
|
|
86
|
+
})
|
|
87
|
+
.strict();
|
|
88
|
+
export type CommandInvokeRequest = z.infer<typeof CommandInvokeRequestSchemaZ>;
|
|
89
|
+
|
|
90
|
+
export const CommandInvokeResultSchemaZ = z.discriminatedUnion("ok", [
|
|
91
|
+
z.object({ ok: z.literal(true), value: z.json().optional() }).strict(),
|
|
92
|
+
z.object({ ok: z.literal(false), error: z.string() }).strict(),
|
|
93
|
+
]);
|
|
94
|
+
export type CommandInvokeResult = z.infer<typeof CommandInvokeResultSchemaZ>;
|
|
95
|
+
|
|
96
|
+
/** Ask a plugin for one parameter's choices and default, for the current context. */
|
|
97
|
+
export const CommandParamOptionsRequestSchemaZ = z
|
|
98
|
+
.object({
|
|
99
|
+
id: CommandIdSchemaZ,
|
|
100
|
+
param: CommandParamNameSchemaZ,
|
|
101
|
+
context: CommandInvocationContextSchemaZ,
|
|
102
|
+
})
|
|
103
|
+
.strict();
|
|
104
|
+
export type CommandParamOptionsRequest = z.infer<typeof CommandParamOptionsRequestSchemaZ>;
|
|
105
|
+
|
|
106
|
+
export const CommandParamOptionsResultSchemaZ = z.discriminatedUnion("ok", [
|
|
107
|
+
z
|
|
108
|
+
.object({
|
|
109
|
+
ok: z.literal(true),
|
|
110
|
+
choices: z.array(CommandChoiceSchemaZ).max(500).optional(),
|
|
111
|
+
default: z.union([z.string().max(10_000), z.number(), z.boolean()]).optional(),
|
|
112
|
+
})
|
|
113
|
+
.strict(),
|
|
114
|
+
z.object({ ok: z.literal(false), error: z.string() }).strict(),
|
|
115
|
+
]);
|
|
116
|
+
export type CommandParamOptionsResult = z.infer<typeof CommandParamOptionsResultSchemaZ>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { plainTextSchema } from "./plain-text.ts";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Stable, process-neutral command protocol shared by daemon and renderer hosts.
|
|
@@ -17,7 +18,7 @@ export const CommandIdSchemaZ = z
|
|
|
17
18
|
"command id must be a dot-namespaced identifier",
|
|
18
19
|
);
|
|
19
20
|
|
|
20
|
-
export const CommandOwnerSchemaZ = z.enum(["daemon", "renderer"]);
|
|
21
|
+
export const CommandOwnerSchemaZ = z.enum(["daemon", "renderer", "plugin"]);
|
|
21
22
|
|
|
22
23
|
export const CommandSourceKindSchemaZ = z.enum([
|
|
23
24
|
"cli",
|
|
@@ -52,9 +53,9 @@ export const CommandDescriptorSchemaZ = z
|
|
|
52
53
|
version: z.literal(COMMAND_PROTOCOL_VERSION),
|
|
53
54
|
id: CommandIdSchemaZ,
|
|
54
55
|
owner: CommandOwnerSchemaZ,
|
|
55
|
-
label:
|
|
56
|
-
description:
|
|
57
|
-
category:
|
|
56
|
+
label: plainTextSchema(1, 160),
|
|
57
|
+
description: plainTextSchema(1, 500).optional(),
|
|
58
|
+
category: plainTextSchema(1, 80),
|
|
58
59
|
schemas: CommandSchemaReferencesSchemaZ,
|
|
59
60
|
dangerous: z.boolean(),
|
|
60
61
|
confirmation: CommandConfirmationSchemaZ,
|
|
@@ -21,7 +21,7 @@ const SessionNamesSchemaZ = z.array(z.string());
|
|
|
21
21
|
export const DaemonEventResourceInterestSchemaZ = z.discriminatedUnion("resource", [
|
|
22
22
|
z
|
|
23
23
|
.object({
|
|
24
|
-
resource: z.enum(["workspace-catalog", "fleet-catalog"]),
|
|
24
|
+
resource: z.enum(["workspace-catalog", "fleet-catalog", "command-catalog"]),
|
|
25
25
|
workspaceName: z.null(),
|
|
26
26
|
})
|
|
27
27
|
.strict(),
|
|
@@ -168,6 +168,7 @@ export const DaemonEventResourceKindSchemaZ = z.enum([
|
|
|
168
168
|
"workspace-files",
|
|
169
169
|
"workspace-changes",
|
|
170
170
|
"workspace-missions",
|
|
171
|
+
"command-catalog",
|
|
171
172
|
]);
|
|
172
173
|
export type DaemonEventResourceKind = z.infer<typeof DaemonEventResourceKindSchemaZ>;
|
|
173
174
|
|
|
@@ -33,6 +33,8 @@ export * from "./terminal-attachments.ts";
|
|
|
33
33
|
export * from "./pane-stream.ts";
|
|
34
34
|
export * from "./control.ts";
|
|
35
35
|
export * from "./commands.ts";
|
|
36
|
+
export * from "./command-catalog.ts";
|
|
37
|
+
export * from "./plain-text.ts";
|
|
36
38
|
// Explicit leaf exports let bundled transport clients avoid desktop resources.
|
|
37
39
|
export {
|
|
38
40
|
DesktopDaemonCapabilityErrorCodeSchemaZ,
|
|
@@ -117,6 +119,7 @@ export * from "./visual-terminal-palette.ts";
|
|
|
117
119
|
export * from "./window-split-layout.ts";
|
|
118
120
|
export * from "./pane-editor-context.ts";
|
|
119
121
|
export * from "./native-browser.ts";
|
|
122
|
+
export * from "./pane-reader.ts";
|
|
120
123
|
|
|
121
124
|
export * from "./tmux-agent-open.ts";
|
|
122
125
|
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PaneEditorContextTargetSchemaZ } from "./pane-editor-context.ts";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The native Markdown reader (card #756). The daemon serves only the file named
|
|
6
|
+
* by the pane's `@tmux_ide_reader` option; the app never names a path. Bytes go
|
|
7
|
+
* out base64-encoded in pages so every response stays under the client's 1 MiB
|
|
8
|
+
* read limit; the app decodes UTF-8 itself.
|
|
9
|
+
*/
|
|
10
|
+
export const PANE_READER_PAGE_BYTES = 512 * 1024;
|
|
11
|
+
export const PANE_READER_MAX_BYTES = 4 * 1024 * 1024;
|
|
12
|
+
export const PANE_READER_ASSET_MAX_BYTES = 10 * 1024 * 1024;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* C0 controls, DEL and C1 controls (U+0080 to U+009F): Unicode's control
|
|
16
|
+
* characters, the same rule the app applies to a reader's name and folder, so
|
|
17
|
+
* nothing the daemon sends is refused there. Checked by code point so the
|
|
18
|
+
* rule needs no control-character regex.
|
|
19
|
+
*/
|
|
20
|
+
export function hasControlCharacter(value: string): boolean {
|
|
21
|
+
for (const character of value) {
|
|
22
|
+
const code = character.codePointAt(0)!;
|
|
23
|
+
if (code < 32 || (code >= 127 && code <= 159)) return true;
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const PaneReaderRevisionSchemaZ = z.string().regex(/^[0-9a-f]{32}$/u);
|
|
29
|
+
export const PaneReaderPageSchemaZ = z
|
|
30
|
+
.object({
|
|
31
|
+
revision: PaneReaderRevisionSchemaZ,
|
|
32
|
+
offset: z.number().int().nonnegative().max(PANE_READER_ASSET_MAX_BYTES),
|
|
33
|
+
})
|
|
34
|
+
.strict();
|
|
35
|
+
export type PaneReaderPage = z.infer<typeof PaneReaderPageSchemaZ>;
|
|
36
|
+
|
|
37
|
+
export const PaneReaderRequestSchemaZ = z
|
|
38
|
+
.object({
|
|
39
|
+
target: PaneEditorContextTargetSchemaZ,
|
|
40
|
+
have: PaneReaderRevisionSchemaZ.nullable(),
|
|
41
|
+
page: PaneReaderPageSchemaZ.nullable(),
|
|
42
|
+
})
|
|
43
|
+
.strict();
|
|
44
|
+
export type PaneReaderRequest = z.infer<typeof PaneReaderRequestSchemaZ>;
|
|
45
|
+
|
|
46
|
+
export const PaneReaderAssetRequestSchemaZ = z
|
|
47
|
+
.object({
|
|
48
|
+
target: PaneEditorContextTargetSchemaZ,
|
|
49
|
+
src: z.string().min(1).max(2048),
|
|
50
|
+
page: PaneReaderPageSchemaZ.nullable(),
|
|
51
|
+
})
|
|
52
|
+
.strict();
|
|
53
|
+
export type PaneReaderAssetRequest = z.infer<typeof PaneReaderAssetRequestSchemaZ>;
|
|
54
|
+
|
|
55
|
+
const NameSchema = z
|
|
56
|
+
.string()
|
|
57
|
+
.min(1)
|
|
58
|
+
.max(255)
|
|
59
|
+
.refine((value) => !hasControlCharacter(value) && !value.includes("/"), "Expected a file name");
|
|
60
|
+
const FolderSchema = z
|
|
61
|
+
.string()
|
|
62
|
+
.max(255)
|
|
63
|
+
.refine((value) => !hasControlCharacter(value) && !value.includes("/"), "Expected a folder name");
|
|
64
|
+
const Base64Schema = z.string().regex(/^[A-Za-z0-9+/]*={0,2}$/u);
|
|
65
|
+
const SizeSchema = z.number().int().nonnegative();
|
|
66
|
+
const Named = { version: z.literal(1), name: NameSchema, folder: FolderSchema };
|
|
67
|
+
|
|
68
|
+
export const PaneReaderResponseSchemaZ = z.discriminatedUnion("state", [
|
|
69
|
+
z
|
|
70
|
+
.object({ ...Named, state: z.literal("unchanged"), revision: PaneReaderRevisionSchemaZ })
|
|
71
|
+
.strict(),
|
|
72
|
+
z
|
|
73
|
+
.object({
|
|
74
|
+
...Named,
|
|
75
|
+
state: z.literal("ok"),
|
|
76
|
+
revision: PaneReaderRevisionSchemaZ,
|
|
77
|
+
size: SizeSchema.max(PANE_READER_MAX_BYTES),
|
|
78
|
+
offset: SizeSchema,
|
|
79
|
+
chunk: Base64Schema,
|
|
80
|
+
})
|
|
81
|
+
.strict(),
|
|
82
|
+
z.object({ ...Named, state: z.literal("changed") }).strict(),
|
|
83
|
+
z
|
|
84
|
+
.object({
|
|
85
|
+
...Named,
|
|
86
|
+
state: z.literal("too_large"),
|
|
87
|
+
revision: PaneReaderRevisionSchemaZ,
|
|
88
|
+
size: SizeSchema,
|
|
89
|
+
})
|
|
90
|
+
.strict(),
|
|
91
|
+
z.object({ ...Named, state: z.literal("missing") }).strict(),
|
|
92
|
+
]);
|
|
93
|
+
export type PaneReaderResponse = z.infer<typeof PaneReaderResponseSchemaZ>;
|
|
94
|
+
|
|
95
|
+
export const PaneReaderAssetMimeSchemaZ = z.enum([
|
|
96
|
+
"image/png",
|
|
97
|
+
"image/jpeg",
|
|
98
|
+
"image/gif",
|
|
99
|
+
"image/webp",
|
|
100
|
+
"image/svg+xml",
|
|
101
|
+
]);
|
|
102
|
+
export const PaneReaderAssetResponseSchemaZ = z.discriminatedUnion("state", [
|
|
103
|
+
z
|
|
104
|
+
.object({
|
|
105
|
+
version: z.literal(1),
|
|
106
|
+
state: z.literal("ok"),
|
|
107
|
+
mime: PaneReaderAssetMimeSchemaZ,
|
|
108
|
+
revision: PaneReaderRevisionSchemaZ,
|
|
109
|
+
size: SizeSchema.max(PANE_READER_ASSET_MAX_BYTES),
|
|
110
|
+
offset: SizeSchema,
|
|
111
|
+
chunk: Base64Schema,
|
|
112
|
+
})
|
|
113
|
+
.strict(),
|
|
114
|
+
z
|
|
115
|
+
.object({
|
|
116
|
+
version: z.literal(1),
|
|
117
|
+
state: z.enum(["changed", "refused", "missing", "too_large"]),
|
|
118
|
+
})
|
|
119
|
+
.strict(),
|
|
120
|
+
]);
|
|
121
|
+
export type PaneReaderAssetResponse = z.infer<typeof PaneReaderAssetResponseSchemaZ>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hasControlCharacter } from "./pane-reader.ts";
|
|
1
2
|
import {
|
|
2
3
|
TerminalSurfaceWatchSchemaZ,
|
|
3
4
|
TerminalSurfaceReceiverSchemaZ,
|
|
@@ -251,6 +252,11 @@ export const PANE_STREAM_INPUT_LIFETIME_CAPABILITY_VERSION = 105;
|
|
|
251
252
|
export const PANE_STREAM_INPUT_BYTES_CAPABILITY_VERSION = 106;
|
|
252
253
|
/** Bundles zlib capability 102 and optional browser icon metadata; fixed 16×16 RGBA hex, empty means browser fallback. */
|
|
253
254
|
export const PANE_STREAM_BROWSER_ICON_CAPABILITY_VERSION = 117;
|
|
255
|
+
/**
|
|
256
|
+
* Bundles 117 (browser icons with zlib 102) and adds `reader` pane metadata.
|
|
257
|
+
* Offered in place of 117 because the offer array has nine slots.
|
|
258
|
+
*/
|
|
259
|
+
export const PANE_STREAM_READER_CAPABILITY_VERSION = 118;
|
|
254
260
|
export const PaneStreamInputLifetimeSchemaZ = z
|
|
255
261
|
.object({
|
|
256
262
|
generation: z.string().min(1).max(256),
|
|
@@ -565,6 +571,18 @@ export const PaneStreamLayoutFrameSchemaZ = z
|
|
|
565
571
|
.regex(/^(?:[0-9a-f]{2048})?$/u)
|
|
566
572
|
.nullable()
|
|
567
573
|
.optional(),
|
|
574
|
+
/** Only with capability 118: the Markdown reader's file name, never its path. */
|
|
575
|
+
reader: z
|
|
576
|
+
.object({
|
|
577
|
+
name: z
|
|
578
|
+
.string()
|
|
579
|
+
.min(1)
|
|
580
|
+
.max(255)
|
|
581
|
+
.refine((value) => !hasControlCharacter(value) && !value.includes("/")),
|
|
582
|
+
})
|
|
583
|
+
.strict()
|
|
584
|
+
.nullable()
|
|
585
|
+
.optional(),
|
|
568
586
|
left: CellCoordinateSchemaZ,
|
|
569
587
|
top: CellCoordinateSchemaZ,
|
|
570
588
|
width: GridCellSchemaZ,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Text that comes from plugins (titles, labels, choices, results, errors)
|
|
5
|
+
* ends up in terminals. C0 controls, DEL and C1 controls would let it
|
|
6
|
+
* drive the terminal (OSC 52 writes the clipboard, `ESC[2K` rewrites a
|
|
7
|
+
* prompt line), bidi and other format characters would let it reorder or
|
|
8
|
+
* hide what is shown, and U+2028/U+2029 break lines in some viewers.
|
|
9
|
+
*/
|
|
10
|
+
// The same classes as the app's clean(): controls (Cc: C0, DEL, C1), format
|
|
11
|
+
// characters (Cf: bidi controls, zero-width characters, U+FEFF, soft hyphen,
|
|
12
|
+
// …) and the line and paragraph separators.
|
|
13
|
+
const UNSAFE_CLASS = "[\\p{Cc}\\p{Cf}\\u2028\\u2029]";
|
|
14
|
+
const UNSAFE = new RegExp(UNSAFE_CLASS, "u");
|
|
15
|
+
const UNSAFE_GLOBAL = new RegExp(UNSAFE_CLASS, "gu");
|
|
16
|
+
|
|
17
|
+
export function hasUnsafeText(text: string): boolean {
|
|
18
|
+
return UNSAFE.test(text);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** One line of plain text: every unsafe character becomes a space. */
|
|
22
|
+
export function terminalSafe(text: string, max = 2000): string {
|
|
23
|
+
return text.replace(UNSAFE_GLOBAL, " ").slice(0, max);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Several lines of plain text, for whole outputs: newlines and tabs stay,
|
|
28
|
+
* every other unsafe character becomes a space.
|
|
29
|
+
*/
|
|
30
|
+
export function terminalSafeBlock(text: string): string {
|
|
31
|
+
return text.replace(UNSAFE_GLOBAL, (char) => (char === "\n" || char === "\t" ? char : " "));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Every string inside a JSON value made terminal-safe. Values keep their
|
|
36
|
+
* newlines and tabs (program output is several lines); keys become one line.
|
|
37
|
+
*/
|
|
38
|
+
export function terminalSafeDeep(value: unknown, max = 10_000): unknown {
|
|
39
|
+
if (typeof value === "string") return terminalSafeBlock(value).slice(0, max);
|
|
40
|
+
if (Array.isArray(value)) return value.map((item) => terminalSafeDeep(item, max));
|
|
41
|
+
if (value && typeof value === "object")
|
|
42
|
+
return Object.fromEntries(
|
|
43
|
+
Object.entries(value).map(([key, item]) => [
|
|
44
|
+
terminalSafe(key, 200),
|
|
45
|
+
terminalSafeDeep(item, max),
|
|
46
|
+
]),
|
|
47
|
+
);
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** A string schema that refuses control, DEL, C1 and bidi characters, newlines included. */
|
|
52
|
+
export function plainTextSchema(min: number, max: number) {
|
|
53
|
+
return z
|
|
54
|
+
.string()
|
|
55
|
+
.min(min)
|
|
56
|
+
.max(max)
|
|
57
|
+
.refine(
|
|
58
|
+
(value) => !hasUnsafeText(value),
|
|
59
|
+
"must be plain text: no control characters or newlines",
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -195,6 +195,51 @@ const palettes = {
|
|
|
195
195
|
selected: "#cdb796",
|
|
196
196
|
selectedText: "#211810",
|
|
197
197
|
},
|
|
198
|
+
// tmux-ide's own pair (#746): warm and low in contrast, with one accent.
|
|
199
|
+
// Warning is the accent, so "needs input" (ANSI yellow) is the only accented
|
|
200
|
+
// state; link and info keep the terminal's blue and cyan distinct.
|
|
201
|
+
linen: {
|
|
202
|
+
name: "Linen",
|
|
203
|
+
bg: "#f7f4ee",
|
|
204
|
+
panel: "#eeeae2",
|
|
205
|
+
border: "#e3ddd2",
|
|
206
|
+
borderFocused: "#984822",
|
|
207
|
+
text: "#2b2722",
|
|
208
|
+
textDim: "#625a4f",
|
|
209
|
+
textBright: "#17140f",
|
|
210
|
+
textMuted: "#8f8679",
|
|
211
|
+
positive: "#4f7034",
|
|
212
|
+
negative: "#a33a30",
|
|
213
|
+
neutral: "#8f8679",
|
|
214
|
+
warning: "#984822",
|
|
215
|
+
link: "#3b6587",
|
|
216
|
+
info: "#36706d",
|
|
217
|
+
cardBorder: "#e1dbcf",
|
|
218
|
+
header: "#e7e1d6",
|
|
219
|
+
selected: "#e3d9c8",
|
|
220
|
+
selectedText: "#2b2722",
|
|
221
|
+
},
|
|
222
|
+
"linen-dark": {
|
|
223
|
+
name: "Linen Dark",
|
|
224
|
+
bg: "#211f1b",
|
|
225
|
+
panel: "#1b1916",
|
|
226
|
+
border: "#36322c",
|
|
227
|
+
borderFocused: "#e0874f",
|
|
228
|
+
text: "#e9e3d8",
|
|
229
|
+
textDim: "#a39a8d",
|
|
230
|
+
textBright: "#fbf7f0",
|
|
231
|
+
textMuted: "#7d7569",
|
|
232
|
+
positive: "#a3b77a",
|
|
233
|
+
negative: "#e0705f",
|
|
234
|
+
neutral: "#7d7569",
|
|
235
|
+
warning: "#e0874f",
|
|
236
|
+
link: "#85a9c8",
|
|
237
|
+
info: "#8cbfb8",
|
|
238
|
+
cardBorder: "#3a362f",
|
|
239
|
+
header: "#2c2925",
|
|
240
|
+
selected: "#45403a",
|
|
241
|
+
selectedText: "#e9e3d8",
|
|
242
|
+
},
|
|
198
243
|
"github-light": {
|
|
199
244
|
name: "GitHub Light",
|
|
200
245
|
bg: "#ffffff",
|
|
@@ -472,7 +517,9 @@ export const VISUAL_THEME_PRESETS: readonly VisualThemeDocumentV1[] = Object.ent
|
|
|
472
517
|
secondary: color(p.textDim),
|
|
473
518
|
muted: color(p.textDim),
|
|
474
519
|
bright: color(p.textBright),
|
|
475
|
-
link
|
|
520
|
+
// A preset may name its own link and info hues (ANSI blue and cyan);
|
|
521
|
+
// otherwise both follow the focused border.
|
|
522
|
+
link: readable("link" in p ? p.link : p.borderFocused, p.panel),
|
|
476
523
|
},
|
|
477
524
|
borders: {
|
|
478
525
|
default: color(p.border),
|
|
@@ -484,7 +531,7 @@ export const VISUAL_THEME_PRESETS: readonly VisualThemeDocumentV1[] = Object.ent
|
|
|
484
531
|
},
|
|
485
532
|
statusTone: {
|
|
486
533
|
neutral: color(p.neutral),
|
|
487
|
-
info: color(p.borderFocused),
|
|
534
|
+
info: color("info" in p ? p.info : p.borderFocused),
|
|
488
535
|
warning: color(p.warning),
|
|
489
536
|
danger: color(p.negative),
|
|
490
537
|
success: color(p.positive),
|
|
@@ -494,6 +541,15 @@ export const VISUAL_THEME_PRESETS: readonly VisualThemeDocumentV1[] = Object.ent
|
|
|
494
541
|
};
|
|
495
542
|
},
|
|
496
543
|
);
|
|
544
|
+
/**
|
|
545
|
+
* The Mac app's pane card border, for the presets that name their own (#746).
|
|
546
|
+
* Every other preset keeps the app's default card border.
|
|
547
|
+
*/
|
|
548
|
+
export const VISUAL_THEME_CARD_BORDERS: Readonly<Record<string, string>> = Object.freeze(
|
|
549
|
+
Object.fromEntries(
|
|
550
|
+
Object.entries(palettes).flatMap(([id, p]) => ("cardBorder" in p ? [[id, p.cardBorder]] : [])),
|
|
551
|
+
),
|
|
552
|
+
);
|
|
497
553
|
export function findVisualThemePreset(id: unknown): VisualThemeDocumentV1 | undefined {
|
|
498
554
|
return typeof id === "string" ? VISUAL_THEME_PRESETS.find((p) => p.id === id) : undefined;
|
|
499
555
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command catalog and plugin action invocation, owner-only and never for
|
|
3
|
+
* browsers (the same gate as the plugin routes):
|
|
4
|
+
* GET /api/resources/command-catalog built-in and plugin commands
|
|
5
|
+
* POST /api/v2/commands/invoke run a plugin action
|
|
6
|
+
* POST /api/v2/commands/param-options one parameter's choices and default
|
|
7
|
+
*
|
|
8
|
+
* Built-in actions keep their own typed route, `/api/v2/action/:name`; the
|
|
9
|
+
* catalog lists them so the CLI and palettes see one list.
|
|
10
|
+
*/
|
|
11
|
+
import { COMMAND_CATALOG_VERSION, CommandInvokeRequestSchemaZ, CommandParamOptionsRequestSchemaZ, } from "@tmux-ide/contracts";
|
|
12
|
+
import { bodyLimit } from "hono/body-limit";
|
|
13
|
+
import { ownerOnlyNonBrowserGuard } from "./plugin-routes.js";
|
|
14
|
+
export function buildCommandCatalog(builtins, plugins) {
|
|
15
|
+
const pluginCatalog = plugins?.actionCatalog() ?? { revision: 0, entries: [] };
|
|
16
|
+
return {
|
|
17
|
+
version: COMMAND_CATALOG_VERSION,
|
|
18
|
+
revision: pluginCatalog.revision,
|
|
19
|
+
entries: [
|
|
20
|
+
...builtins.map((descriptor) => ({ descriptor, params: [] })),
|
|
21
|
+
...pluginCatalog.entries,
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function mountCommandCatalogRoutes(app, options) {
|
|
26
|
+
const guard = ownerOnlyNonBrowserGuard(options.ownerToken);
|
|
27
|
+
app.get("/api/resources/command-catalog", (c) => {
|
|
28
|
+
const gate = guard(c);
|
|
29
|
+
if (gate)
|
|
30
|
+
return gate;
|
|
31
|
+
c.header("Cache-Control", "no-store");
|
|
32
|
+
return c.json(buildCommandCatalog(options.builtins(), options.backend));
|
|
33
|
+
});
|
|
34
|
+
app.post("/api/v2/commands/invoke", bodyLimit({ maxSize: 256 * 1024 }), async (c) => {
|
|
35
|
+
const gate = guard(c);
|
|
36
|
+
if (gate)
|
|
37
|
+
return gate;
|
|
38
|
+
c.header("Cache-Control", "no-store");
|
|
39
|
+
let body;
|
|
40
|
+
try {
|
|
41
|
+
body = await c.req.json();
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return c.json({ error: "Invalid invoke request" }, 400);
|
|
45
|
+
}
|
|
46
|
+
const parsed = CommandInvokeRequestSchemaZ.safeParse(body);
|
|
47
|
+
if (!parsed.success)
|
|
48
|
+
return c.json({ error: "Invalid invoke request" }, 400);
|
|
49
|
+
if (!parsed.data.id.startsWith("plugin."))
|
|
50
|
+
return c.json({ error: "Built-in commands use /api/v2/action/:name" }, 404);
|
|
51
|
+
if (!options.backend)
|
|
52
|
+
return c.json({ error: "Plugins are not enabled in this daemon" }, 503);
|
|
53
|
+
const { id, args, context, confirmed } = parsed.data;
|
|
54
|
+
const result = await options.backend.invokeAction(id, args, context, {
|
|
55
|
+
confirmed: confirmed === true,
|
|
56
|
+
});
|
|
57
|
+
return c.json(result);
|
|
58
|
+
});
|
|
59
|
+
app.post("/api/v2/commands/param-options", bodyLimit({ maxSize: 16 * 1024 }), async (c) => {
|
|
60
|
+
const gate = guard(c);
|
|
61
|
+
if (gate)
|
|
62
|
+
return gate;
|
|
63
|
+
c.header("Cache-Control", "no-store");
|
|
64
|
+
let body;
|
|
65
|
+
try {
|
|
66
|
+
body = await c.req.json();
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return c.json({ error: "Invalid options request" }, 400);
|
|
70
|
+
}
|
|
71
|
+
const parsed = CommandParamOptionsRequestSchemaZ.safeParse(body);
|
|
72
|
+
if (!parsed.success)
|
|
73
|
+
return c.json({ error: "Invalid options request" }, 400);
|
|
74
|
+
if (!options.backend)
|
|
75
|
+
return c.json({ error: "Plugins are not enabled in this daemon" }, 503);
|
|
76
|
+
return c.json(await options.backend.actionParamOptions(parsed.data.id, parsed.data.param, parsed.data.context));
|
|
77
|
+
});
|
|
78
|
+
}
|