@sentropic/h2a-runtime 0.81.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.
- package/dist/account-pool.d.ts +168 -0
- package/dist/account-pool.d.ts.map +1 -0
- package/dist/account-pool.js +385 -0
- package/dist/account-pool.js.map +1 -0
- package/dist/agents-projection.d.ts +56 -0
- package/dist/agents-projection.d.ts.map +1 -0
- package/dist/agents-projection.js +82 -0
- package/dist/agents-projection.js.map +1 -0
- package/dist/attach.d.ts +75 -0
- package/dist/attach.d.ts.map +1 -0
- package/dist/attach.js +432 -0
- package/dist/attach.js.map +1 -0
- package/dist/auth-bundle.d.ts +21 -0
- package/dist/auth-bundle.d.ts.map +1 -0
- package/dist/auth-bundle.js +112 -0
- package/dist/auth-bundle.js.map +1 -0
- package/dist/auth-diagnostics.d.ts +18 -0
- package/dist/auth-diagnostics.d.ts.map +1 -0
- package/dist/auth-diagnostics.js +23 -0
- package/dist/auth-diagnostics.js.map +1 -0
- package/dist/auth-login.d.ts +9 -0
- package/dist/auth-login.d.ts.map +1 -0
- package/dist/auth-login.js +21 -0
- package/dist/auth-login.js.map +1 -0
- package/dist/auth-refresh.d.ts +32 -0
- package/dist/auth-refresh.d.ts.map +1 -0
- package/dist/auth-refresh.js +83 -0
- package/dist/auth-refresh.js.map +1 -0
- package/dist/auth-tools.d.ts +55 -0
- package/dist/auth-tools.d.ts.map +1 -0
- package/dist/auth-tools.js +163 -0
- package/dist/auth-tools.js.map +1 -0
- package/dist/browser-bridge-local.d.ts +27 -0
- package/dist/browser-bridge-local.d.ts.map +1 -0
- package/dist/browser-bridge-local.js +51 -0
- package/dist/browser-bridge-local.js.map +1 -0
- package/dist/browser.d.ts +53 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +61 -0
- package/dist/browser.js.map +1 -0
- package/dist/conductor-launch.d.ts +179 -0
- package/dist/conductor-launch.d.ts.map +1 -0
- package/dist/conductor-launch.js +414 -0
- package/dist/conductor-launch.js.map +1 -0
- package/dist/config.d.ts +182 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +334 -0
- package/dist/config.js.map +1 -0
- package/dist/conv-guard.d.ts +76 -0
- package/dist/conv-guard.d.ts.map +1 -0
- package/dist/conv-guard.js +131 -0
- package/dist/conv-guard.js.map +1 -0
- package/dist/convsync.d.ts +24 -0
- package/dist/convsync.d.ts.map +1 -0
- package/dist/convsync.js +108 -0
- package/dist/convsync.js.map +1 -0
- package/dist/cred-health.d.ts +96 -0
- package/dist/cred-health.d.ts.map +1 -0
- package/dist/cred-health.js +170 -0
- package/dist/cred-health.js.map +1 -0
- package/dist/delegate.d.ts +406 -0
- package/dist/delegate.d.ts.map +1 -0
- package/dist/delegate.js +739 -0
- package/dist/delegate.js.map +1 -0
- package/dist/enroll.d.ts +91 -0
- package/dist/enroll.d.ts.map +1 -0
- package/dist/enroll.js +248 -0
- package/dist/enroll.js.map +1 -0
- package/dist/fanout.d.ts +63 -0
- package/dist/fanout.d.ts.map +1 -0
- package/dist/fanout.js +115 -0
- package/dist/fanout.js.map +1 -0
- package/dist/forward.d.ts +66 -0
- package/dist/forward.d.ts.map +1 -0
- package/dist/forward.js +141 -0
- package/dist/forward.js.map +1 -0
- package/dist/gitdiff.d.ts +31 -0
- package/dist/gitdiff.d.ts.map +1 -0
- package/dist/gitdiff.js +133 -0
- package/dist/gitdiff.js.map +1 -0
- package/dist/h2a-bridge.d.ts +102 -0
- package/dist/h2a-bridge.d.ts.map +1 -0
- package/dist/h2a-bridge.js +333 -0
- package/dist/h2a-bridge.js.map +1 -0
- package/dist/h2a-jobs.d.ts +235 -0
- package/dist/h2a-jobs.d.ts.map +1 -0
- package/dist/h2a-jobs.js +388 -0
- package/dist/h2a-jobs.js.map +1 -0
- package/dist/h2a-ping.d.ts +38 -0
- package/dist/h2a-ping.d.ts.map +1 -0
- package/dist/h2a-ping.js +58 -0
- package/dist/h2a-ping.js.map +1 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5887 -0
- package/dist/index.js.map +1 -0
- package/dist/interactive-throttle.d.ts +164 -0
- package/dist/interactive-throttle.d.ts.map +1 -0
- package/dist/interactive-throttle.js +194 -0
- package/dist/interactive-throttle.js.map +1 -0
- package/dist/lineage-client.d.ts +77 -0
- package/dist/lineage-client.d.ts.map +1 -0
- package/dist/lineage-client.js +117 -0
- package/dist/lineage-client.js.map +1 -0
- package/dist/lineage-lease.d.ts +152 -0
- package/dist/lineage-lease.d.ts.map +1 -0
- package/dist/lineage-lease.js +303 -0
- package/dist/lineage-lease.js.map +1 -0
- package/dist/llm-gateway-runtime/accounts.d.ts +48 -0
- package/dist/llm-gateway-runtime/accounts.d.ts.map +1 -0
- package/dist/llm-gateway-runtime/accounts.js +226 -0
- package/dist/llm-gateway-runtime/accounts.js.map +1 -0
- package/dist/llm-gateway-runtime/index.d.ts +4 -0
- package/dist/llm-gateway-runtime/index.d.ts.map +1 -0
- package/dist/llm-gateway-runtime/index.js +58 -0
- package/dist/llm-gateway-runtime/index.js.map +1 -0
- package/dist/llm-gateway-runtime/model-catalog.d.ts +36 -0
- package/dist/llm-gateway-runtime/model-catalog.d.ts.map +1 -0
- package/dist/llm-gateway-runtime/model-catalog.js +146 -0
- package/dist/llm-gateway-runtime/model-catalog.js.map +1 -0
- package/dist/llm-gateway-runtime/proxy-anthropic.d.ts +3 -0
- package/dist/llm-gateway-runtime/proxy-anthropic.d.ts.map +1 -0
- package/dist/llm-gateway-runtime/proxy-anthropic.js +139 -0
- package/dist/llm-gateway-runtime/proxy-anthropic.js.map +1 -0
- package/dist/llm-gateway-runtime/proxy-openai.d.ts +117 -0
- package/dist/llm-gateway-runtime/proxy-openai.d.ts.map +1 -0
- package/dist/llm-gateway-runtime/proxy-openai.js +1132 -0
- package/dist/llm-gateway-runtime/proxy-openai.js.map +1 -0
- package/dist/llm-gateway-runtime/session-ledger.d.ts +32 -0
- package/dist/llm-gateway-runtime/session-ledger.d.ts.map +1 -0
- package/dist/llm-gateway-runtime/session-ledger.js +62 -0
- package/dist/llm-gateway-runtime/session-ledger.js.map +1 -0
- package/dist/llm-gateway-runtime/sticky.d.ts +40 -0
- package/dist/llm-gateway-runtime/sticky.d.ts.map +1 -0
- package/dist/llm-gateway-runtime/sticky.js +254 -0
- package/dist/llm-gateway-runtime/sticky.js.map +1 -0
- package/dist/llm-mesh.d.ts +102 -0
- package/dist/llm-mesh.d.ts.map +1 -0
- package/dist/llm-mesh.js +433 -0
- package/dist/llm-mesh.js.map +1 -0
- package/dist/migrate-candidates.d.ts +35 -0
- package/dist/migrate-candidates.d.ts.map +1 -0
- package/dist/migrate-candidates.js +128 -0
- package/dist/migrate-candidates.js.map +1 -0
- package/dist/migrate.d.ts +125 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +561 -0
- package/dist/migrate.js.map +1 -0
- package/dist/plugin-manifest.d.ts +143 -0
- package/dist/plugin-manifest.d.ts.map +1 -0
- package/dist/plugin-manifest.js +233 -0
- package/dist/plugin-manifest.js.map +1 -0
- package/dist/plugin.d.ts +274 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +919 -0
- package/dist/plugin.js.map +1 -0
- package/dist/pod-liveness.d.ts +51 -0
- package/dist/pod-liveness.d.ts.map +1 -0
- package/dist/pod-liveness.js +80 -0
- package/dist/pod-liveness.js.map +1 -0
- package/dist/profile-menu.d.ts +7 -0
- package/dist/profile-menu.d.ts.map +1 -0
- package/dist/profile-menu.js +52 -0
- package/dist/profile-menu.js.map +1 -0
- package/dist/profiles.d.ts +23 -0
- package/dist/profiles.d.ts.map +1 -0
- package/dist/profiles.js +66 -0
- package/dist/profiles.js.map +1 -0
- package/dist/protocol-local.d.ts +27 -0
- package/dist/protocol-local.d.ts.map +1 -0
- package/dist/protocol-local.js +12 -0
- package/dist/protocol-local.js.map +1 -0
- package/dist/pty.d.ts +26 -0
- package/dist/pty.d.ts.map +1 -0
- package/dist/pty.js +45 -0
- package/dist/pty.js.map +1 -0
- package/dist/readiness.d.ts +38 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +169 -0
- package/dist/readiness.js.map +1 -0
- package/dist/registry.d.ts +258 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +570 -0
- package/dist/registry.js.map +1 -0
- package/dist/relaunch.d.ts +52 -0
- package/dist/relaunch.d.ts.map +1 -0
- package/dist/relaunch.js +76 -0
- package/dist/relaunch.js.map +1 -0
- package/dist/restore.d.ts +165 -0
- package/dist/restore.d.ts.map +1 -0
- package/dist/restore.js +530 -0
- package/dist/restore.js.map +1 -0
- package/dist/run.d.ts +29 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +206 -0
- package/dist/run.js.map +1 -0
- package/dist/secrets.d.ts +25 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +98 -0
- package/dist/secrets.js.map +1 -0
- package/dist/session-restore.d.ts +26 -0
- package/dist/session-restore.d.ts.map +1 -0
- package/dist/session-restore.js +122 -0
- package/dist/session-restore.js.map +1 -0
- package/dist/skills-sync.d.ts +126 -0
- package/dist/skills-sync.d.ts.map +1 -0
- package/dist/skills-sync.js +255 -0
- package/dist/skills-sync.js.map +1 -0
- package/dist/smoke.d.ts +23 -0
- package/dist/smoke.d.ts.map +1 -0
- package/dist/smoke.js +138 -0
- package/dist/smoke.js.map +1 -0
- package/dist/soft-refresh.d.ts +107 -0
- package/dist/soft-refresh.d.ts.map +1 -0
- package/dist/soft-refresh.js +426 -0
- package/dist/soft-refresh.js.map +1 -0
- package/dist/sync-status.d.ts +22 -0
- package/dist/sync-status.d.ts.map +1 -0
- package/dist/sync-status.js +41 -0
- package/dist/sync-status.js.map +1 -0
- package/dist/sync.d.ts +77 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +302 -0
- package/dist/sync.js.map +1 -0
- package/dist/throttle-signatures.d.ts +43 -0
- package/dist/throttle-signatures.d.ts.map +1 -0
- package/dist/throttle-signatures.js +116 -0
- package/dist/throttle-signatures.js.map +1 -0
- package/dist/tmux.d.ts +286 -0
- package/dist/tmux.d.ts.map +1 -0
- package/dist/tmux.js +970 -0
- package/dist/tmux.js.map +1 -0
- package/dist/tunnel.d.ts +25 -0
- package/dist/tunnel.d.ts.map +1 -0
- package/dist/tunnel.js +127 -0
- package/dist/tunnel.js.map +1 -0
- package/dist/workspace-merge.d.ts +17 -0
- package/dist/workspace-merge.d.ts.map +1 -0
- package/dist/workspace-merge.js +153 -0
- package/dist/workspace-merge.js.map +1 -0
- package/dist/workspace-sync-incremental.d.ts +64 -0
- package/dist/workspace-sync-incremental.d.ts.map +1 -0
- package/dist/workspace-sync-incremental.js +199 -0
- package/dist/workspace-sync-incremental.js.map +1 -0
- package/dist/workspace-sync.d.ts +3 -0
- package/dist/workspace-sync.d.ts.map +1 -0
- package/dist/workspace-sync.js +187 -0
- package/dist/workspace-sync.js.map +1 -0
- package/dist/workspace.d.ts +70 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +173 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +44 -0
package/dist/tmux.d.ts
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* tmux-backed session management.
|
|
3
|
+
*
|
|
4
|
+
* Two uses, one battle-tested multiplexer:
|
|
5
|
+
* - LOCAL sessions: `remote run <profile>` starts the CLI inside a local tmux
|
|
6
|
+
* session (`remote-<slug>`), so `remote ls`/`attach`/`stop` manage local and
|
|
7
|
+
* remote sessions uniformly, and detach/reattach is native.
|
|
8
|
+
* - REMOTE attach via exec: `remote attach <id> --exec` runs
|
|
9
|
+
* `kubectl exec -it … tmux attach` straight into the Pod's tmux session, so
|
|
10
|
+
* the LOCAL terminal owns scrollback + copy (OSC52) with no WS proxy in the
|
|
11
|
+
* middle — this is what fixes "I can't copy the code claude printed".
|
|
12
|
+
*/
|
|
13
|
+
import type { TunnelConfig } from "./config.js";
|
|
14
|
+
/** tmux session-name prefix marking a remote-managed local session. */
|
|
15
|
+
export declare const LOCAL_PREFIX = "remote-";
|
|
16
|
+
/** Pod tmux session the session-agent runs the CLI in (see agent.ts). */
|
|
17
|
+
export declare const POD_TMUX_SESSION = "main";
|
|
18
|
+
/** Default remote-owned tmux profile name stored in remote CLI config. */
|
|
19
|
+
export declare const REMOTE_TMUX_PROFILE_NAME = "remote";
|
|
20
|
+
/**
|
|
21
|
+
* The embedded, scroll-safe tmux profile remote owns. The commands are applied
|
|
22
|
+
* directly to the running tmux server; no user ~/.tmux.conf entry is required.
|
|
23
|
+
*/
|
|
24
|
+
export declare const REMOTE_TMUX_PROFILE: {
|
|
25
|
+
readonly name: "remote";
|
|
26
|
+
readonly version: 1;
|
|
27
|
+
readonly invariants: ({
|
|
28
|
+
line: string;
|
|
29
|
+
prefix?: never;
|
|
30
|
+
} | {
|
|
31
|
+
prefix: string;
|
|
32
|
+
line?: never;
|
|
33
|
+
})[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Persistent-box wrapper (local twin of the Pod one): run the CLI, and when it
|
|
37
|
+
* exits drop into a login shell on the workdir instead of ending the tmux
|
|
38
|
+
* session. Invoked as `bash -lc WRAPPER <relaunch> <cli> <args…>`, so the FIRST
|
|
39
|
+
* positional lands in `$0` (the relaunch hint), the CLI in `$1`, args in `$2…`.
|
|
40
|
+
*/
|
|
41
|
+
export declare const LOCAL_WRAPPER = "relaunch=\"$0\"; cli=\"$1\"; shift\n\"$cli\" \"$@\"; code=$?\nprintf '\\n[remote] %s exited (code %s) \u2014 shell on %s.\\n' \"$cli\" \"$code\" \"$PWD\"\nprintf '[remote] relaunch: %s (or Ctrl-D to end this session)\\n' \"$relaunch\"\nif [ -t 0 ]; then exec /bin/bash -l; else exit \"$code\"; fi";
|
|
42
|
+
/**
|
|
43
|
+
* Run-once-exit wrapper for HEADLESS delegated jobs — the OPPOSITE of
|
|
44
|
+
* LOCAL_WRAPPER's drop-to-shell. Redirects the CLI's stdout+stderr to an output
|
|
45
|
+
* log, writes a result.json with the final state + exit code, then lets the
|
|
46
|
+
* tmux session END (no `exec bash`). Invoked as
|
|
47
|
+
* `bash -lc HEADLESS_WRAPPER <resultJson> <outputLog> <cli> <args…>`:
|
|
48
|
+
* `$0`=result.json path, `$1`=output.log path, `$2`=cli, `$3…`=cli args.
|
|
49
|
+
*/
|
|
50
|
+
export declare const HEADLESS_WRAPPER = "result=\"$0\"; log=\"$1\"; cli=\"$2\"; shift 2\n\"$cli\" \"$@\" >\"$log\" 2>&1; code=$?\nif [ \"$code\" -eq 0 ]; then state=done; else state=failed; fi\nprintf '{\"state\":\"%s\",\"exitCode\":%s}\\n' \"$state\" \"$code\" >\"$result\"";
|
|
51
|
+
/**
|
|
52
|
+
* The `remote run …` line that recreates this exact local session — shown when
|
|
53
|
+
* the CLI exits so the user can copy-paste it. Pure, exported for tests.
|
|
54
|
+
*/
|
|
55
|
+
export declare function localRelaunchCommand(profile: string, cwd: string, label: string | undefined, resumeArgs?: ReadonlyArray<string>): string;
|
|
56
|
+
/**
|
|
57
|
+
* Distinct session labels for a fan-out of `count` parallel agents on one base.
|
|
58
|
+
* `count <= 1` → just the base (the normal single-session case). `#k` suffixes
|
|
59
|
+
* keep each tmux session distinct (the slug derives from the label), so you can
|
|
60
|
+
* run more than the per-project layout cap of parallel claude/codex agents.
|
|
61
|
+
*/
|
|
62
|
+
export declare function fanoutLabels(base: string, count: number): string[];
|
|
63
|
+
/**
|
|
64
|
+
* Window name for the h2a MCP server side window — the a2a launcher contract:
|
|
65
|
+
* agents live in NAMED tmux windows, with `h2a mcp-serve` running next to them
|
|
66
|
+
* so the agent is reachable/wakeable through ~/h2a-workspace/.h2a.
|
|
67
|
+
*/
|
|
68
|
+
export declare const H2A_WINDOW_NAME = "h2a";
|
|
69
|
+
export type LocalSession = {
|
|
70
|
+
/** full tmux session name, e.g. `remote-surch` */
|
|
71
|
+
name: string;
|
|
72
|
+
/** short name shown to the user, e.g. `surch` */
|
|
73
|
+
slug: string;
|
|
74
|
+
/** profile recorded on the session (claude/codex/…), or "?" if unknown */
|
|
75
|
+
profile: string;
|
|
76
|
+
/** working directory */
|
|
77
|
+
path: string;
|
|
78
|
+
/** is a client currently attached */
|
|
79
|
+
attached: boolean;
|
|
80
|
+
/** custom display name set via `remote rename`, if any */
|
|
81
|
+
displayName?: string;
|
|
82
|
+
};
|
|
83
|
+
export declare function tmuxAvailable(): boolean;
|
|
84
|
+
export declare function slugify(p: string): string;
|
|
85
|
+
/** tmux session name for a workdir slug. */
|
|
86
|
+
export declare function localSessionName(slug: string): string;
|
|
87
|
+
/** List remote-managed local tmux sessions (best-effort; [] if no server). */
|
|
88
|
+
export declare function listLocalSessions(): LocalSession[];
|
|
89
|
+
/** Find a local session by its full name or its slug. */
|
|
90
|
+
export declare function findLocalSession(target: string): LocalSession | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Store a custom display name on a local tmux session WITHOUT calling
|
|
93
|
+
* `rename-window`. This avoids tmux's per-window `allow-rename off` side-effect
|
|
94
|
+
* that an explicit `rename-window` triggers — keeping the window name free to
|
|
95
|
+
* follow the agent's live OSC title (activity status). The name is persisted as a
|
|
96
|
+
* tmux session option `@display_name` and surfaced by `listLocalSessions` /
|
|
97
|
+
* `remote ls`.
|
|
98
|
+
*/
|
|
99
|
+
export declare function setLocalSessionDisplayName(session: string, displayName: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Read the custom display name stored on a local tmux session via
|
|
102
|
+
* `setLocalSessionDisplayName`, if any. Returns `undefined` when no display name
|
|
103
|
+
* has been set or the session cannot be reached.
|
|
104
|
+
*/
|
|
105
|
+
export declare function getLocalSessionDisplayName(session: string): string | undefined;
|
|
106
|
+
export type StartLocalResult = {
|
|
107
|
+
name: string;
|
|
108
|
+
slug: string;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* Pure builder for the global tmux options applied at every run/attach. Split
|
|
112
|
+
* out of `ensureScrollConfig` so the option set (scroll/clipboard AND the
|
|
113
|
+
* title-following options for the GNOME tab) is unit-testable without a tmux
|
|
114
|
+
* server. `clip` is the detected clipboard command (undefined → no copy-command).
|
|
115
|
+
*
|
|
116
|
+
* Title chain (bug #1 — "the tab name doesn't follow the agent"): the agent
|
|
117
|
+
* (claude/codex) emits its live title as an OSC sequence, which tmux records as
|
|
118
|
+
* `pane_title`. tmux only RE-EMITS that title to the OUTER terminal (the GNOME
|
|
119
|
+
* tab) when `set-titles on`; it is OFF by default, so the OSC title was trapped
|
|
120
|
+
* inside tmux and the GNOME tab kept the static launcher `--title`. We turn
|
|
121
|
+
* `set-titles on` and point `set-titles-string` at `#{pane_title}` (the agent's
|
|
122
|
+
* live title) with a friendly fallback (the window name, then the session name)
|
|
123
|
+
* when the agent has not set a title yet. `allow-rename on` lets the window NAME
|
|
124
|
+
* track the OSC title too. We deliberately NEVER touch `automatic-rename`
|
|
125
|
+
* (project rule); it stays at its default `on`, which is what lets the window
|
|
126
|
+
* follow the title.
|
|
127
|
+
*/
|
|
128
|
+
export declare function buildTmuxGlobalOptions(clip: string | undefined, profile?: string): Array<ReadonlyArray<string>>;
|
|
129
|
+
export declare function validateManagedTmuxProfile(cmds: ReadonlyArray<ReadonlyArray<string>>): string[];
|
|
130
|
+
/**
|
|
131
|
+
* Wayland image paste bridge for Codex panes. Terminals/tmux cannot paste image
|
|
132
|
+
* bytes into a TTY, so the reliable path is: read the clipboard image with
|
|
133
|
+
* wl-paste, save it under the pane cwd, then paste the resulting file path into
|
|
134
|
+
* Codex. The binding is guarded by the current tmux session/window profile and
|
|
135
|
+
* clipboard MIME type; when the guard fails, Ctrl+V is forwarded unchanged.
|
|
136
|
+
*/
|
|
137
|
+
export declare function buildCodexImagePasteBinding(): ReadonlyArray<string>;
|
|
138
|
+
/**
|
|
139
|
+
* Make the LOCAL tmux server scroll the conversation on the wheel AND copy
|
|
140
|
+
* selections to the system clipboard — same scroll settings the Pod image bakes
|
|
141
|
+
* into /etc/tmux.conf. Without `mouse on`, the terminal falls back to
|
|
142
|
+
* alternateScroll (wheel → arrow keys → the CLI's input history), which reads as
|
|
143
|
+
* "scrolling scrolls the input history". With mouse on, a drag is tmux's
|
|
144
|
+
* selection: `copy-command` pipes it to wl-copy/xclip so Ctrl+Shift+V / paste
|
|
145
|
+
* works (VTE drops OSC52, so set-clipboard alone is not enough). Wheel events
|
|
146
|
+
* follow the proven old-PC baseline: enter copy-mode on wheel-up and forward the
|
|
147
|
+
* real mouse event (`send-keys -M`) instead of synthetic copy-mode scroll
|
|
148
|
+
* commands. Native selection (for Ctrl+Shift+C) stays available via Shift+drag;
|
|
149
|
+
* if Ctrl+Shift+C reaches tmux while in copy-mode, remote explicitly maps it to
|
|
150
|
+
* copy-pipe-and-cancel so the same gesture still copies through copy-command.
|
|
151
|
+
* ALSO turns on the
|
|
152
|
+
* title-following options (see buildTmuxGlobalOptions) so the GNOME tab tracks
|
|
153
|
+
* the agent's live title. Global, idempotent, applied at every run/attach so it
|
|
154
|
+
* works even without ~/.tmux.conf.
|
|
155
|
+
*/
|
|
156
|
+
export declare function ensureManagedTmuxProfile(profile?: string): void;
|
|
157
|
+
/** Backwards-compatible name kept for older callers/tests. */
|
|
158
|
+
export declare function ensureScrollConfig(profile?: string): void;
|
|
159
|
+
/**
|
|
160
|
+
* Start a CLI in a detached local tmux session. Idempotent on name: if a
|
|
161
|
+
* session with the same slug already exists it is reused (returns it). The slug
|
|
162
|
+
* defaults to the workdir basename; pass `label` to override it (e.g. to keep
|
|
163
|
+
* several sessions of the same project distinct: "sentropic#2").
|
|
164
|
+
*/
|
|
165
|
+
export declare function startLocalSession(profile: string, command: string, cwd: string, args?: ReadonlyArray<string>, label?: string, tmuxProfile?: string): StartLocalResult;
|
|
166
|
+
/**
|
|
167
|
+
* Start a HEADLESS delegated job in a detached local tmux session under the
|
|
168
|
+
* run-once-exit wrapper: the CLI runs, its output is captured to `outputLog`,
|
|
169
|
+
* a `resultJson` is written, then the session ENDS. The task lands as a single
|
|
170
|
+
* argv token inside `args` (no shell concat). Idempotent on slug like
|
|
171
|
+
* startLocalSession. Returns the session name + slug.
|
|
172
|
+
*/
|
|
173
|
+
export declare function startHeadlessSession(profile: string, command: string, cwd: string, args: ReadonlyArray<string>, resultJson: string, outputLog: string, label: string, tmuxProfile?: string): StartLocalResult;
|
|
174
|
+
/**
|
|
175
|
+
* The raw tmux `#{session_attached}` count for a session: 0 = DETACHED (no client
|
|
176
|
+
* attached), ≥1 = a client (a human terminal) is attached. `undefined` when the
|
|
177
|
+
* session is gone / tmux can't be reached. The interactive throttle auto-resume
|
|
178
|
+
* uses this as its HARD guard — it only ever nudges a pane whose count is 0, so
|
|
179
|
+
* we never send keys into a session a human is driving. Best-effort.
|
|
180
|
+
*/
|
|
181
|
+
export declare function sessionAttachedCount(name: string): number | undefined;
|
|
182
|
+
/** Last `lines` of a session's main pane (interactive job logs). "" if gone. */
|
|
183
|
+
export declare function capturePane(name: string, lines?: number): string;
|
|
184
|
+
/**
|
|
185
|
+
* tmux args adding a detached NAMED window to an existing session, running
|
|
186
|
+
* `commandLine` (a shell line, quoting preserved) under the drop-to-shell
|
|
187
|
+
* wrapper. Pure — exported for tests.
|
|
188
|
+
*/
|
|
189
|
+
export declare function buildSessionWindowArgs(session: string, windowName: string, cwd: string, commandLine: string, agentPane?: string): string[];
|
|
190
|
+
/** Window names of a session (best-effort; [] if tmux/session is gone). */
|
|
191
|
+
export declare function sessionWindowNames(session: string): string[];
|
|
192
|
+
/** Add a detached named window running `commandLine` to an existing session. */
|
|
193
|
+
export declare function addSessionWindow(session: string, windowName: string, cwd: string, commandLine: string, agentPane?: string): boolean;
|
|
194
|
+
/** Is `cmd` resolvable in PATH (login shell, same as the tmux windows use)? */
|
|
195
|
+
export declare function commandAvailable(cmd: string): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Resolve the durable agent pane for a given h2a instance.
|
|
198
|
+
* Parses host:label[:uuid] → finds the matching managed tmux session
|
|
199
|
+
* (remote-<label>, @remote_agent_host === host) → returns its @remote_agent_pane.
|
|
200
|
+
* Returns undefined if no pane is known for this instance.
|
|
201
|
+
*/
|
|
202
|
+
export declare function resolveAgentPaneForInstance(instance: string): string | undefined;
|
|
203
|
+
/** Agent pane used as h2a local-tmux wake target, persisted on the tmux session. */
|
|
204
|
+
export declare function resolveAgentPane(session: string): string | undefined;
|
|
205
|
+
/**
|
|
206
|
+
* Opt-in launcher contract: start `h2a mcp-serve …` in a side window named
|
|
207
|
+
* "h2a" of the agent's tmux session, so the agent is reachable/wakeable by the
|
|
208
|
+
* h2a file-based network. Never fails the run: a missing h2a binary (or tmux
|
|
209
|
+
* error) is a warning, and an already-present "h2a" window is reused as-is.
|
|
210
|
+
*/
|
|
211
|
+
export declare function startH2aWindow(session: string, cwd: string, commandLine: string, stderr?: {
|
|
212
|
+
write(chunk: string): unknown;
|
|
213
|
+
}): boolean;
|
|
214
|
+
/**
|
|
215
|
+
* Attach the real terminal to a local tmux session. Blocks until the user
|
|
216
|
+
* detaches (Ctrl-b d) or the session ends. Returns the tmux exit status.
|
|
217
|
+
*/
|
|
218
|
+
export declare function attachLocalSession(name: string): number;
|
|
219
|
+
export declare function currentTmuxSessionIs(name: string): boolean;
|
|
220
|
+
export declare function runLocalCliForeground(command: string, args: string[]): number;
|
|
221
|
+
/** Kill a local tmux session. */
|
|
222
|
+
export declare function killLocalSession(name: string): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* M3 — is a `remote jobs conduct` conductor process running right now? Used by
|
|
225
|
+
* `jobs ls` to warn when there are queued jobs but nothing to drain them. Matches
|
|
226
|
+
* the conductor's command line via pgrep, NOT a tmux marker (the conductor may run
|
|
227
|
+
* in any window/shell). Best-effort: any error (no pgrep, etc.) returns false so
|
|
228
|
+
* we err toward SHOWING the advisory rather than hiding a real stall. Excludes the
|
|
229
|
+
* current pid so a `conduct` process that itself shells out to `jobs ls` for
|
|
230
|
+
* status doesn't self-detect.
|
|
231
|
+
*/
|
|
232
|
+
export declare function conductorRunning(): boolean;
|
|
233
|
+
/**
|
|
234
|
+
* True when a session's main pane is an IDLE shell (its CLI exited and dropped
|
|
235
|
+
* to the wrapper's `bash -l`). Idle = pane command is bash/sh AND that pane
|
|
236
|
+
* process has no child — the relaunch wrapper keeps the CLI as a child of bash,
|
|
237
|
+
* so `pane_current_command` alone reads "bash" even with a live CLI; the child
|
|
238
|
+
* count disambiguates. `/proc` scan because the relaunch wrapper context may
|
|
239
|
+
* lack ps; falls back to ps when /proc is unavailable. Best-effort: on any
|
|
240
|
+
* doubt returns false (treat as live → never disturbed).
|
|
241
|
+
*/
|
|
242
|
+
export declare function localSessionIdle(name: string): boolean;
|
|
243
|
+
export type LocalSessionGatewayEnvStatus = "current" | "missing" | "stale" | "unknown";
|
|
244
|
+
/**
|
|
245
|
+
* Inspect the real CLI child process under the tmux wrapper and compare its
|
|
246
|
+
* Anthropic gateway env with the token remote is about to use. Unknown is
|
|
247
|
+
* deliberately non-actionable; callers should only repair missing/stale.
|
|
248
|
+
*/
|
|
249
|
+
export declare function localSessionGatewayEnvStatus(name: string, expected: {
|
|
250
|
+
baseUrl: string;
|
|
251
|
+
authToken: string;
|
|
252
|
+
}): LocalSessionGatewayEnvStatus;
|
|
253
|
+
/**
|
|
254
|
+
* Relaunch a CLI inside an EXISTING session's main pane, in situ: send the
|
|
255
|
+
* command to the idle shell (it runs at the prompt; when it exits the shell is
|
|
256
|
+
* still there). Does NOT recreate windows or go through `remote run`/the guard.
|
|
257
|
+
*/
|
|
258
|
+
export declare function relaunchInSession(name: string, command: string): boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Is a tmux session ATTACHED right now (a client is connected)? Reads
|
|
261
|
+
* `#{session_attached}` for the EXACT session ("=" prefix → no prefix match).
|
|
262
|
+
* Returns true (CONSERVATIVE) on ANY doubt — missing/erroring tmux, unparseable
|
|
263
|
+
* count — so the interactive throttle resume NEVER types into a pane we cannot
|
|
264
|
+
* prove is detached. The throttle-phase-2 HARD GUARD lives here AND in the pure
|
|
265
|
+
* planner; this is the live, last-line-of-defence re-check.
|
|
266
|
+
*/
|
|
267
|
+
export declare function sessionAttached(name: string): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Send a LITERAL line into a session's main pane, then submit it with a real
|
|
270
|
+
* Enter key event. The keys ride `send-keys -l <keys>` as a SINGLE literal
|
|
271
|
+
* argument — tmux does NOT interpret it (no key-name lookup, no shell), so an
|
|
272
|
+
* arbitrary nudge string is safe. Enter is sent as a separate, NON-literal
|
|
273
|
+
* key-name so it is a real carriage return rather than the word "Enter". Used by
|
|
274
|
+
* the interactive throttle auto-resume to un-stick a rate-limited pane. Returns
|
|
275
|
+
* whether tmux accepted both sends.
|
|
276
|
+
*/
|
|
277
|
+
export declare function sendKeysLiteral(name: string, keys: string): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* Attach the real terminal straight into the Pod's tmux session via
|
|
280
|
+
* `kubectl exec -it`. The local terminal talks to tmux directly (no WS proxy),
|
|
281
|
+
* so scrollback + copy-to-local-clipboard (OSC52) work natively. Requires a
|
|
282
|
+
* tmux-backed session (Pod started by the tmux-wrapping agent). Blocks until
|
|
283
|
+
* detach/exit; returns the kubectl exit status.
|
|
284
|
+
*/
|
|
285
|
+
export declare function attachPodTmux(tunnel: TunnelConfig, sessionId: string): number;
|
|
286
|
+
//# sourceMappingURL=tmux.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tmux.d.ts","sourceRoot":"","sources":["../src/tmux.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIhD,uEAAuE;AACvE,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAEvC,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,WAAW,CAAC;AAMjD;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;CA0BtB,CAAC;AAEX;;;;;GAKG;A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