@agent-deck/cli 2.5.0 → 2.5.1
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/bin.js +0 -0
- package/dist/codex-plugin.d.ts +23 -26
- package/dist/codex-plugin.d.ts.map +1 -1
- package/dist/codex-plugin.js +113 -58
- package/dist/codex-plugin.js.map +1 -1
- package/dist/host-connection.d.ts +159 -0
- package/dist/host-connection.d.ts.map +1 -0
- package/dist/host-connection.js +568 -0
- package/dist/host-connection.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/launcher-migration.d.ts +45 -2
- package/dist/launcher-migration.d.ts.map +1 -1
- package/dist/launcher-migration.js +134 -25
- package/dist/launcher-migration.js.map +1 -1
- package/dist/mcp-config.d.ts +8 -0
- package/dist/mcp-config.d.ts.map +1 -1
- package/dist/mcp-config.js +58 -0
- package/dist/mcp-config.js.map +1 -1
- package/dist/menubar.d.ts +7 -0
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +11 -1
- package/dist/menubar.js.map +1 -1
- package/dist/start.d.ts +2 -2
- package/dist/start.d.ts.map +1 -1
- package/dist/start.js +22 -4
- package/dist/start.js.map +1 -1
- package/dist/upgrade-scan.d.ts +20 -0
- package/dist/upgrade-scan.d.ts.map +1 -0
- package/dist/upgrade-scan.js +113 -0
- package/dist/upgrade-scan.js.map +1 -0
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +76 -20
- package/dist/upgrade.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure-MCP host connection classifier (NOT-574).
|
|
3
|
+
*
|
|
4
|
+
* Per host and folder, reports the real connection state instead of
|
|
5
|
+
* install state: whether an Agent Deck entry exists, whether the daemon
|
|
6
|
+
* is up, whether a live session for this host and folder was observed,
|
|
7
|
+
* and — for the hosts that gate project config — whether the folder is
|
|
8
|
+
* trusted (and, for Muse, whether the folder is inside a git repository
|
|
9
|
+
* and whether a stale same-name stdio entry conflicts with the HTTP
|
|
10
|
+
* entry).
|
|
11
|
+
*
|
|
12
|
+
* Daemon health is `up` (`backendUp && mcpUp` from `probeAgentDeck`)
|
|
13
|
+
* plus the live-session list from the read-only
|
|
14
|
+
* `GET /api/scope/bindings` (same source as the menu bar). A session
|
|
15
|
+
* counts toward a host and folder only when its MCP `clientName`
|
|
16
|
+
* identifies that host and its `workspaceRoot` is this folder or
|
|
17
|
+
* absent (folder-less sessions come from global headerless entries and
|
|
18
|
+
* cannot contradict any folder). A session from another folder or
|
|
19
|
+
* another host never reads as connected.
|
|
20
|
+
*/
|
|
21
|
+
export type HostId = 'codex' | 'claude' | 'cursor' | 'muse';
|
|
22
|
+
export type HostConnectionState = 'no-entry' | 'entry-daemon-down' | 'entry-daemon-up-no-session' | 'connected' | 'folder-not-trusted' | 'folder-not-repository' | 'stale-conflicting-entry';
|
|
23
|
+
/**
|
|
24
|
+
* Live MCP session as `GET /api/scope/bindings` reports it — the subset
|
|
25
|
+
* the classifier attributes. Both fields are optional on the wire:
|
|
26
|
+
* `clientName` is the MCP `clientInfo.name` the host sent at
|
|
27
|
+
* initialize, and `workspaceRoot` is absent for folder-less sessions
|
|
28
|
+
* (global headerless entries that never bound a folder).
|
|
29
|
+
*/
|
|
30
|
+
export interface HostLiveSession {
|
|
31
|
+
workspaceRoot?: string;
|
|
32
|
+
clientName?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface DaemonHealth {
|
|
35
|
+
up: boolean;
|
|
36
|
+
sessions: HostLiveSession[];
|
|
37
|
+
}
|
|
38
|
+
export interface HostConnectionInput {
|
|
39
|
+
host: HostId;
|
|
40
|
+
/** Folder the connection state is reported for (session attribution). */
|
|
41
|
+
folder: string;
|
|
42
|
+
hasProjectEntry: boolean;
|
|
43
|
+
hasGlobalEntry: boolean;
|
|
44
|
+
/** Meaningful only when a project entry exists; otherwise ignored. */
|
|
45
|
+
folderTrusted: boolean;
|
|
46
|
+
/** Muse only; other hosts pass true. */
|
|
47
|
+
folderInRepository: boolean;
|
|
48
|
+
/** Muse only; other hosts pass false. */
|
|
49
|
+
hasStaleConflict: boolean;
|
|
50
|
+
daemonUp: boolean;
|
|
51
|
+
/** Live sessions from `/api/scope/bindings`, attributed per host and folder. */
|
|
52
|
+
sessions: HostLiveSession[];
|
|
53
|
+
}
|
|
54
|
+
export interface HostConnectionResult {
|
|
55
|
+
host: HostId;
|
|
56
|
+
state: HostConnectionState;
|
|
57
|
+
remedy: string;
|
|
58
|
+
detail: string;
|
|
59
|
+
}
|
|
60
|
+
/** Host a live session's `clientName` identifies, or undefined when unknown. */
|
|
61
|
+
export declare function hostIdForClientName(clientName: string | undefined): HostId | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* True when a live session belongs to this host and folder: the
|
|
64
|
+
* `clientName` must identify the host, and the `workspaceRoot` must be
|
|
65
|
+
* this folder (canonically compared, so `/tmp/x` matches
|
|
66
|
+
* `/private/tmp/x`) or absent — a folder-less session comes from a
|
|
67
|
+
* global headerless entry and cannot contradict any folder.
|
|
68
|
+
*/
|
|
69
|
+
export declare function sessionMatchesHostFolder(session: HostLiveSession, host: HostId, folder: string): boolean;
|
|
70
|
+
/** Live sessions attributed to this host and folder. */
|
|
71
|
+
export declare function countMatchingSessions(sessions: HostLiveSession[], host: HostId, folder: string): number;
|
|
72
|
+
/**
|
|
73
|
+
* Pure classifier: the Muse stale-conflict and repository gates first
|
|
74
|
+
* (they block even with the daemon up), then daemon reachability, then
|
|
75
|
+
* the trust gate, then the attributed live-session count. Daemon-down
|
|
76
|
+
* takes precedence over folder-not-trusted for every host: a trust
|
|
77
|
+
* remedy cannot help while the daemon is stopped. Trust and repository
|
|
78
|
+
* gates apply only when a project entry exists — the global headerless
|
|
79
|
+
* fallback needs neither.
|
|
80
|
+
*/
|
|
81
|
+
export declare function classifyHostConnection(input: HostConnectionInput): HostConnectionResult;
|
|
82
|
+
/** One-line remedy per host and state. */
|
|
83
|
+
export declare function remedyFor(host: HostId, state: HostConnectionState): string;
|
|
84
|
+
export declare function formatHostConnectionLine(result: HostConnectionResult): string;
|
|
85
|
+
/** Canonical folder for trust comparisons (`/tmp` vs `/private/tmp` on macOS). */
|
|
86
|
+
export declare function canonicalFolder(folder: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* Raw `agent-deck` entry from a JSON MCP config, or undefined when the
|
|
89
|
+
* file is missing, unparsable, or holds no such key. Any defined object
|
|
90
|
+
* counts as an entry — HTTP, legacy launcher, or custom — since only
|
|
91
|
+
* presence gates the classifier; shape matters solely for the Muse
|
|
92
|
+
* stale-conflict check.
|
|
93
|
+
*/
|
|
94
|
+
export declare function readJsonAgentDeckEntry(configPath: string): unknown;
|
|
95
|
+
/** True for a stdio entry: an explicit command, or `type: 'stdio'`. */
|
|
96
|
+
export declare function isStdioAgentDeckEntry(entry: unknown): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Muse merges a same-name project entry with the user entry field by
|
|
99
|
+
* field, so a stdio entry on one side and an HTTP entry on the other
|
|
100
|
+
* rejects the server as `invalid_transport_combination`. True only for
|
|
101
|
+
* that mismatched pair — a single legacy entry still connects.
|
|
102
|
+
*/
|
|
103
|
+
export declare function hasMuseStaleConflict(projectEntry: unknown, globalEntry: unknown): boolean;
|
|
104
|
+
/** True when `folder` sits inside a git working tree (`.git` here or above). */
|
|
105
|
+
export declare function isInsideGitRepository(folder: string): boolean;
|
|
106
|
+
/** Every `[projects."<path>"]` path whose body sets `trust_level = "trusted"`. */
|
|
107
|
+
export declare function parseCodexTrustedProjects(userToml: string): string[];
|
|
108
|
+
/**
|
|
109
|
+
* Codex trusts a folder only via the user `config.toml` projects table —
|
|
110
|
+
* a `-c` override is not enough. A trusted ancestor covers its children.
|
|
111
|
+
*/
|
|
112
|
+
export declare function isCodexFolderTrusted(userToml: string, folder: string): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Claude approves a project `.mcp.json` server per folder: the server
|
|
115
|
+
* name lands in `~/.claude.json` projects[<folder>].enabledMcpjsonServers
|
|
116
|
+
* once approved. `enableAllProjectMcpServers` in user or project
|
|
117
|
+
* settings auto-approves. A folder whose trust dialog was never accepted
|
|
118
|
+
* (`hasTrustDialogAccepted === false`) is not trusted.
|
|
119
|
+
*/
|
|
120
|
+
export declare function isClaudeProjectApproved(home: string, folder: string): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Cursor's per-folder approval slug: the canonical path with every run
|
|
123
|
+
* of non-alphanumeric characters collapsed to one `-`, trimmed. E.g.
|
|
124
|
+
* `/Users/x/y` → `Users-x-y`, `/private/tmp/smoke` → `private-tmp-smoke`.
|
|
125
|
+
*/
|
|
126
|
+
export declare function cursorProjectSlug(folder: string): string;
|
|
127
|
+
/**
|
|
128
|
+
* Cursor approves a project server per folder in
|
|
129
|
+
* `~/.cursor/projects/<slug>/mcp-approvals.json`, a JSON array holding
|
|
130
|
+
* `agent-deck-<hash>` once approved. Any `agent-deck`-prefixed entry
|
|
131
|
+
* counts — the hash suffix is Cursor-internal.
|
|
132
|
+
*/
|
|
133
|
+
export declare function isCursorProjectApproved(home: string, folder: string): boolean;
|
|
134
|
+
export declare function museTrustPath(home: string, xdgConfigHome?: string): string;
|
|
135
|
+
export declare function museGlobalSettingsPath(home: string, xdgConfigHome?: string): string;
|
|
136
|
+
/**
|
|
137
|
+
* Muse trusts a folder via `trust.json` projects[<canonical>].decision —
|
|
138
|
+
* a trusted ancestor covers its children. Canonical paths only:
|
|
139
|
+
* `/private/tmp/...`, never `/tmp/...`.
|
|
140
|
+
*/
|
|
141
|
+
export declare function isMuseFolderTrusted(home: string, folder: string, xdgConfigHome?: string): boolean;
|
|
142
|
+
export interface InspectHostConnectionOptions {
|
|
143
|
+
home?: string;
|
|
144
|
+
/** Overrides $XDG_CONFIG_HOME for the Muse paths (tests). */
|
|
145
|
+
xdgConfigHome?: string;
|
|
146
|
+
/** Overrides $CODEX_HOME for the Codex user config (tests). */
|
|
147
|
+
codexHome?: string;
|
|
148
|
+
daemon: DaemonHealth;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Read-only inspection for one host and folder: config presence from
|
|
152
|
+
* the host's own files, trust/approval from the host's own store, repo
|
|
153
|
+
* membership for Muse, and the caller-supplied daemon health. Never
|
|
154
|
+
* writes and never launches a host CLI.
|
|
155
|
+
*/
|
|
156
|
+
export declare function inspectHostConnection(host: HostId, folder: string, options: InspectHostConnectionOptions): HostConnectionResult;
|
|
157
|
+
/** Inspect all four pure-MCP hosts for one folder (doctor order). */
|
|
158
|
+
export declare function inspectAllHostConnections(folder: string, options: InspectHostConnectionOptions): HostConnectionResult[];
|
|
159
|
+
//# sourceMappingURL=host-connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-connection.d.ts","sourceRoot":"","sources":["../src/host-connection.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE5D,MAAM,MAAM,mBAAmB,GAC3B,UAAU,GACV,mBAAmB,GACnB,4BAA4B,GAC5B,WAAW,GACX,oBAAoB,GACpB,uBAAuB,GACvB,yBAAyB,CAAC;AAE9B;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,sEAAsE;IACtE,aAAa,EAAE,OAAO,CAAC;IACvB,wCAAwC;IACxC,kBAAkB,EAAE,OAA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