@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/relaunch.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `remote relaunch` — bring back local tmux sessions whose CLI has dropped to a
|
|
3
|
+
* shell (in situ, keeping the windows), each resuming ITS OWN conversation.
|
|
4
|
+
*
|
|
5
|
+
* Why a dedicated command: closing the terminal windows does NOT kill the tmux
|
|
6
|
+
* sessions, and `remote restore` goes through `remote run -r`, which the
|
|
7
|
+
* single-writer guard refuses while the (idle) session still holds the
|
|
8
|
+
* conversation. This relaunches the CLI inside the existing session — no
|
|
9
|
+
* `remote run`, no guard fight — and crucially resumes each session's OWN
|
|
10
|
+
* convId (from the registry), never "most recent", so the N sessions that share
|
|
11
|
+
* a cwd never collide on one .jsonl.
|
|
12
|
+
*/
|
|
13
|
+
import { isCliProfile, resolveProfile, resumeArgsFor } from "./profiles.js";
|
|
14
|
+
/** The shell command that resumes `convId` for `profile`, or undefined if the */
|
|
15
|
+
/** profile has no resume form (e.g. shell). */
|
|
16
|
+
export function resumeCommandFor(profile, convId) {
|
|
17
|
+
if (!isCliProfile(profile))
|
|
18
|
+
return undefined;
|
|
19
|
+
const cfg = resolveProfile(profile);
|
|
20
|
+
const args = resumeArgsFor(cfg, convId);
|
|
21
|
+
if (args.length === 0)
|
|
22
|
+
return undefined;
|
|
23
|
+
return [cfg.command, ...args].join(" ");
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Decide what to relaunch. Pure: takes fully-resolved candidates (idle flag +
|
|
27
|
+
* convId already gathered) so it is unit-testable without tmux/registry I/O.
|
|
28
|
+
* Skips running sessions (never disturb a live CLI), sessions with no known
|
|
29
|
+
* convId (relaunch by hand rather than guess and risk a collision), and
|
|
30
|
+
* profiles with no resume form. Also refuses to point two sessions at the SAME
|
|
31
|
+
* convId (defensive: the registry should already be 1:1).
|
|
32
|
+
*/
|
|
33
|
+
export function planRelaunch(candidates) {
|
|
34
|
+
const actions = [];
|
|
35
|
+
const skipped = [];
|
|
36
|
+
const claimed = new Map(); // convId -> slug that took it
|
|
37
|
+
for (const c of candidates) {
|
|
38
|
+
if (!c.idle) {
|
|
39
|
+
skipped.push({ slug: c.slug, reason: "CLI is running — left alone" });
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (!c.convId) {
|
|
43
|
+
skipped.push({
|
|
44
|
+
slug: c.slug,
|
|
45
|
+
reason: "no convId in the registry — relaunch manually",
|
|
46
|
+
});
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const prior = claimed.get(c.convId);
|
|
50
|
+
if (prior) {
|
|
51
|
+
skipped.push({
|
|
52
|
+
slug: c.slug,
|
|
53
|
+
reason: `conversation ${c.convId} already taken by ${prior} — would collide`,
|
|
54
|
+
});
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const cmd = resumeCommandFor(c.profile, c.convId);
|
|
58
|
+
if (!cmd) {
|
|
59
|
+
skipped.push({
|
|
60
|
+
slug: c.slug,
|
|
61
|
+
reason: `profile "${c.profile}" has no resume form`,
|
|
62
|
+
});
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
claimed.set(c.convId, c.slug);
|
|
66
|
+
actions.push({
|
|
67
|
+
slug: c.slug,
|
|
68
|
+
name: c.name,
|
|
69
|
+
profile: c.profile,
|
|
70
|
+
convId: c.convId,
|
|
71
|
+
cmd,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return { actions, skipped };
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=relaunch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relaunch.js","sourceRoot":"","sources":["../src/relaunch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE5E,iFAAiF;AACjF,+CAA+C;AAC/C,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,MAAc;IAEd,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;QAAE,OAAO,SAAS,CAAC;IAC7C,MAAM,GAAG,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACxC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACxC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC;AA8BD;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,UAA4C;IAE5C,MAAM,OAAO,GAAqB,EAAE,CAAC;IACrC,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC,CAAC,8B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,MAAM;YAChB,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `remote restore` — relaunch recent local dev sessions (claude/codex) in their
|
|
3
|
+
* layout, each tab a remote-managed tmux session (durable, live-named).
|
|
4
|
+
*
|
|
5
|
+
* This OWNS the launcher logic in the CLI (discovery + grouping + layout +
|
|
6
|
+
* terminal launch), so `~/bin/resume-dev-sessions` is just `exec remote
|
|
7
|
+
* restore`. SCW sessions and persisted positions come later.
|
|
8
|
+
*/
|
|
9
|
+
import { type LayoutConfig } from "./config.js";
|
|
10
|
+
import { type RegistryEntry } from "./registry.js";
|
|
11
|
+
export type DiscoveredSession = {
|
|
12
|
+
project: string;
|
|
13
|
+
mtimeMs: number;
|
|
14
|
+
tool: "claude" | "codex" | "agy";
|
|
15
|
+
sid: string;
|
|
16
|
+
cwd: string;
|
|
17
|
+
/** "registry" = enrolled live session (reliable); "scan" = mtime guess. */
|
|
18
|
+
origin?: "registry" | "scan";
|
|
19
|
+
/** Preferred tab label (registry entries carry a reliable one). */
|
|
20
|
+
label?: string;
|
|
21
|
+
/** Pinned llm-mesh gateway posture (from an explicit --gw/--no-gw at launch). */
|
|
22
|
+
gatewayMode?: "gateway" | "direct";
|
|
23
|
+
};
|
|
24
|
+
export type LayoutTab = {
|
|
25
|
+
cwd: string;
|
|
26
|
+
label: string;
|
|
27
|
+
/** local resume (claude/codex tmux) */
|
|
28
|
+
tool?: string;
|
|
29
|
+
sid?: string;
|
|
30
|
+
/** SCW session attached via `remote attach <id> --exec` */
|
|
31
|
+
remoteId?: string;
|
|
32
|
+
/** discovery provenance, shown as [registry]/[guess] in --dry-run */
|
|
33
|
+
origin?: "registry" | "scan";
|
|
34
|
+
/** Pinned llm-mesh gateway posture; re-emitted as --gw/--no-gw on restore. */
|
|
35
|
+
gatewayMode?: "gateway" | "direct";
|
|
36
|
+
};
|
|
37
|
+
export type LayoutWindow = {
|
|
38
|
+
title: string;
|
|
39
|
+
tabs: LayoutTab[];
|
|
40
|
+
};
|
|
41
|
+
/** A pre-resolved SCW tab for a remote group (built by the caller from `remote ls`). */
|
|
42
|
+
export type RemoteTab = {
|
|
43
|
+
id: string;
|
|
44
|
+
label: string;
|
|
45
|
+
cwd: string;
|
|
46
|
+
};
|
|
47
|
+
/** Discover claude + codex sessions under ~/src/* newer than maxAgeMs. */
|
|
48
|
+
export declare function discoverSessions(maxAgeMs: number, home?: string): DiscoveredSession[];
|
|
49
|
+
/**
|
|
50
|
+
* REGISTRY-FIRST discovery: live registry entries (local kinds) mapped to
|
|
51
|
+
* discovered sessions. label/cwd/convId come straight from enrolment, no
|
|
52
|
+
* mtime guessing. `entries` is injectable for tests (defaults to listLive()).
|
|
53
|
+
*/
|
|
54
|
+
export declare function registrySessions(home?: string, entries?: RegistryEntry[]): DiscoveredSession[];
|
|
55
|
+
/**
|
|
56
|
+
* Merge discovery sources: registry entries win; the filesystem scan only
|
|
57
|
+
* completes projects that have NO registry entry (tagged origin "scan").
|
|
58
|
+
*/
|
|
59
|
+
export declare function mergeDiscovered(registry: DiscoveredSession[], scanned: DiscoveredSession[]): DiscoveredSession[];
|
|
60
|
+
/**
|
|
61
|
+
* Identity slug used to dedup a LOCAL discovered session against a REMOTE tab
|
|
62
|
+
* (bug #3). Both sides are reduced to lowercase alnum runs so "Sentropic
|
|
63
|
+
* Remote"/"sentropic-remote"/"sentropic_remote" collapse to one key. A `#N`
|
|
64
|
+
* fan-out suffix is kept distinct (it is a different session).
|
|
65
|
+
*/
|
|
66
|
+
export declare function sessionIdentitySlug(name: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Bug #3 — a session that was MOVED to a remote Pod keeps reappearing as a fresh
|
|
69
|
+
* LOCAL tmux because the local conversation files (claude .jsonl / codex
|
|
70
|
+
* rollout) and any stale local registry entry survive the move, so the local
|
|
71
|
+
* discovery still emits a tab for that project. Drop every local discovered
|
|
72
|
+
* session whose project/label identity is already covered by a REMOTE tab: the
|
|
73
|
+
* remote group owns it, and re-launching it locally would spawn a ghost
|
|
74
|
+
* duplicate. Match is by identity slug of the local `label` (else `project`)
|
|
75
|
+
* against the remote tab `label` — the remote tab's cwd is the Pod path (often
|
|
76
|
+
* absent locally) so cwd can't be the key; the friendly name is. Pure; the
|
|
77
|
+
* remote-backed locals are returned separately so the caller can report them.
|
|
78
|
+
*/
|
|
79
|
+
export declare function dropRemoteBackedLocals(locals: DiscoveredSession[], remoteTabs: ReadonlyArray<{
|
|
80
|
+
label: string;
|
|
81
|
+
}>): {
|
|
82
|
+
kept: DiscoveredSession[];
|
|
83
|
+
dropped: DiscoveredSession[];
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Group discovered sessions into terminal windows per the layout config:
|
|
87
|
+
* - explicit groups first (their projects leave the shared pool),
|
|
88
|
+
* - the rest round-robin into `sharedWindows` windows,
|
|
89
|
+
* - capped at `maxPerWindow` tabs each,
|
|
90
|
+
* - keeping the N most recent sessions per project (`multiSession`, def 1).
|
|
91
|
+
*/
|
|
92
|
+
export declare function groupSessions(sessions: DiscoveredSession[], cfg: LayoutConfig): {
|
|
93
|
+
windows: LayoutWindow[];
|
|
94
|
+
dropped: number;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Per-tab command: SCW via `attach --exec`; a LOCAL session that is already
|
|
98
|
+
* live → `remote attach <slug>` (do NOT `remote run -r`, which the single-writer
|
|
99
|
+
* guard refuses while that session still holds the conversation — this is what
|
|
100
|
+
* broke a `restore` over still-detached sessions); otherwise create it via
|
|
101
|
+
* `remote run … --resume …` (which attaches by default). `liveSlugs` = slugs of
|
|
102
|
+
* currently-live local tmux sessions (empty for the reproducible layout snapshot).
|
|
103
|
+
*/
|
|
104
|
+
export declare function tabCommand(tab: LayoutTab, liveSlugs?: ReadonlySet<string>, opts?: {
|
|
105
|
+
forceGateway?: "gateway" | "direct";
|
|
106
|
+
}): string;
|
|
107
|
+
/**
|
|
108
|
+
* Launch the layout in gnome-terminal: one window per group, one tab per session.
|
|
109
|
+
*
|
|
110
|
+
* Default behaviour (reattach=false): sessions already live in tmux are SKIPPED —
|
|
111
|
+
* no new terminal tab is opened for them. The assumption is that if a tmux session
|
|
112
|
+
* exists, the user either has a terminal showing it or intentionally left it running.
|
|
113
|
+
* Use reattach=true (--reattach flag) to reopen a terminal tab for every session
|
|
114
|
+
* regardless of its current tmux state.
|
|
115
|
+
*/
|
|
116
|
+
export declare function launchLayout(windows: LayoutWindow[], stderr?: NodeJS.WriteStream, opts?: {
|
|
117
|
+
reattach?: boolean;
|
|
118
|
+
forceGateway?: "gateway" | "direct";
|
|
119
|
+
}): {
|
|
120
|
+
opened: number;
|
|
121
|
+
skippedLive: string[];
|
|
122
|
+
};
|
|
123
|
+
export type RestoreOptions = {
|
|
124
|
+
dryRun?: boolean;
|
|
125
|
+
/** Launch only the group whose title matches (exact or slug-normalized). */
|
|
126
|
+
group?: string;
|
|
127
|
+
/** Pre-resolved SCW tabs (from `remote ls`), used to fill `remote: true` groups. */
|
|
128
|
+
remoteTabs?: RemoteTab[];
|
|
129
|
+
/**
|
|
130
|
+
* When true, open a new terminal tab even for sessions already live in tmux.
|
|
131
|
+
* Default (false): sessions already in tmux are skipped — no redundant tab.
|
|
132
|
+
*/
|
|
133
|
+
reattach?: boolean;
|
|
134
|
+
/**
|
|
135
|
+
* Force the llm-mesh gateway posture for the WHOLE restore, overriding every
|
|
136
|
+
* session's pinned gatewayMode. Live sessions on the wrong posture are
|
|
137
|
+
* relaunched (--replace) so the switch actually takes effect.
|
|
138
|
+
*/
|
|
139
|
+
forceGateway?: "gateway" | "direct";
|
|
140
|
+
stderr?: NodeJS.WriteStream;
|
|
141
|
+
};
|
|
142
|
+
/** Full restore: discover (local) + inject SCW (remote) -> order -> filter -> launch. */
|
|
143
|
+
export declare function restore(opts?: RestoreOptions): {
|
|
144
|
+
windows: LayoutWindow[];
|
|
145
|
+
total: number;
|
|
146
|
+
dropped: number;
|
|
147
|
+
};
|
|
148
|
+
export type LastLayout = {
|
|
149
|
+
at: string;
|
|
150
|
+
group?: string;
|
|
151
|
+
windows: Array<{
|
|
152
|
+
title: string;
|
|
153
|
+
tabs: Array<{
|
|
154
|
+
cwd: string;
|
|
155
|
+
label: string;
|
|
156
|
+
cmd: string;
|
|
157
|
+
}>;
|
|
158
|
+
}>;
|
|
159
|
+
};
|
|
160
|
+
export declare function lastLayoutPath(): string;
|
|
161
|
+
/** Persist the just-launched layout to <configDir>/layout-last.json (atomic). */
|
|
162
|
+
export declare function writeLastLayout(windows: LayoutWindow[], group?: string): void;
|
|
163
|
+
/** Read the recorded layout, or undefined when none was launched yet. */
|
|
164
|
+
export declare function readLastLayout(): LastLayout | undefined;
|
|
165
|
+
//# sourceMappingURL=restore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore.d.ts","sourceRoot":"","sources":["../src/restore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAG7D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,2EAA2E;IAC3E,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC7B,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,WAAW,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ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