@agent-deck/cli 2.0.0 → 2.1.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.
Files changed (63) hide show
  1. package/dist/agent-harness.d.ts +3 -0
  2. package/dist/agent-harness.d.ts.map +1 -1
  3. package/dist/agent-harness.js +64 -6
  4. package/dist/agent-harness.js.map +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +10 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/mcp-bridge.d.ts +83 -1
  9. package/dist/mcp-bridge.d.ts.map +1 -1
  10. package/dist/mcp-bridge.js +252 -7
  11. package/dist/mcp-bridge.js.map +1 -1
  12. package/dist/mcp-config.d.ts +13 -1
  13. package/dist/mcp-config.d.ts.map +1 -1
  14. package/dist/mcp-config.js +49 -1
  15. package/dist/mcp-config.js.map +1 -1
  16. package/dist/muse-skills/agent-deck-playbooks/SKILL.md +23 -0
  17. package/dist/muse-skills/agent-deck-run/SKILL.md +86 -0
  18. package/dist/muse-skills/agent-deck-session/SKILL.md +59 -0
  19. package/dist/muse-skills/agent-deck-setup/SKILL.md +32 -0
  20. package/dist/muse-skills.d.ts +42 -0
  21. package/dist/muse-skills.d.ts.map +1 -0
  22. package/dist/muse-skills.js +149 -0
  23. package/dist/muse-skills.js.map +1 -0
  24. package/dist/run-adapter.d.ts +100 -0
  25. package/dist/run-adapter.d.ts.map +1 -0
  26. package/dist/run-adapter.js +73 -0
  27. package/dist/run-adapter.js.map +1 -0
  28. package/dist/run-claude.d.ts +41 -0
  29. package/dist/run-claude.d.ts.map +1 -0
  30. package/dist/run-claude.js +91 -0
  31. package/dist/run-claude.js.map +1 -0
  32. package/dist/run-codex.d.ts +75 -0
  33. package/dist/run-codex.d.ts.map +1 -0
  34. package/dist/run-codex.js +337 -0
  35. package/dist/run-codex.js.map +1 -0
  36. package/dist/run-cursor.d.ts +79 -0
  37. package/dist/run-cursor.d.ts.map +1 -0
  38. package/dist/run-cursor.js +455 -0
  39. package/dist/run-cursor.js.map +1 -0
  40. package/dist/run-detach.d.ts +36 -0
  41. package/dist/run-detach.d.ts.map +1 -0
  42. package/dist/run-detach.js +233 -0
  43. package/dist/run-detach.js.map +1 -0
  44. package/dist/run-muse.d.ts +127 -0
  45. package/dist/run-muse.d.ts.map +1 -0
  46. package/dist/run-muse.js +499 -0
  47. package/dist/run-muse.js.map +1 -0
  48. package/dist/run-status.d.ts +62 -0
  49. package/dist/run-status.d.ts.map +1 -0
  50. package/dist/run-status.js +552 -0
  51. package/dist/run-status.js.map +1 -0
  52. package/dist/run.d.ts +191 -0
  53. package/dist/run.d.ts.map +1 -0
  54. package/dist/run.js +680 -0
  55. package/dist/run.js.map +1 -0
  56. package/dist/setup.d.ts.map +1 -1
  57. package/dist/setup.js +51 -10
  58. package/dist/setup.js.map +1 -1
  59. package/dist/use.d.ts +1 -1
  60. package/dist/use.d.ts.map +1 -1
  61. package/dist/use.js +16 -15
  62. package/dist/use.js.map +1 -1
  63. package/package.json +5 -4
package/dist/run.d.ts ADDED
@@ -0,0 +1,191 @@
1
+ import { resolveMcpLaunchPlan } from './mcp-launcher';
2
+ import { type RunClient, type RunToolsProfile } from './run-adapter';
3
+ import { type ClaudeAdapterDeps, type RunQueryFn } from './run-claude';
4
+ import { type CodexAdapterDeps } from './run-codex';
5
+ import { type CursorAdapterDeps } from './run-cursor';
6
+ import { type MuseAdapterDeps } from './run-muse';
7
+ export { allowedToolsForProfile, RUN_EDIT_TOOLS, RUN_PERMISSION_MODE, RUN_READONLY_TOOLS, RUN_SETTING_SOURCES, RUN_TOOL_PROFILES, type RunToolsProfile, } from './run-adapter';
8
+ export type { RunClient } from './run-adapter';
9
+ export type { ClaudeAdapterDeps, RunQueryFn, RunQueryMessage, RunQueryOptions } from './run-claude';
10
+ export type { CodexAdapterDeps } from './run-codex';
11
+ export type { CursorAdapterDeps } from './run-cursor';
12
+ export type { MuseAdapterDeps } from './run-muse';
13
+ export type RunOptions = {
14
+ deckRef: string;
15
+ client: RunClient;
16
+ cwd: string;
17
+ prompt?: string;
18
+ promptFile?: string;
19
+ tools: RunToolsProfile;
20
+ log?: string;
21
+ resume?: string;
22
+ detach: boolean;
23
+ /** Internal: the starter passes the allocated run id so the child reuses it. */
24
+ runIdOverride?: string;
25
+ };
26
+ export declare function parseRunArgs(args: string[]): RunOptions | {
27
+ error: string;
28
+ };
29
+ export type RunLogLine = {
30
+ t: 'text';
31
+ ts: string;
32
+ text: string;
33
+ } | {
34
+ t: 'tool';
35
+ ts: string;
36
+ name: string;
37
+ } | {
38
+ t: 'result';
39
+ ts: string;
40
+ sessionId: string | null;
41
+ subtype: string;
42
+ result: unknown;
43
+ } | {
44
+ t: 'end';
45
+ ts: string;
46
+ sessionId: string | null;
47
+ } | {
48
+ t: 'notice';
49
+ ts: string;
50
+ message: string;
51
+ sessionId: string | null;
52
+ } | {
53
+ t: 'error';
54
+ ts: string;
55
+ message: string;
56
+ sessionId: string | null;
57
+ };
58
+ export type RunMeta = {
59
+ runId: string;
60
+ deck: string;
61
+ client: RunClient;
62
+ tools: RunToolsProfile;
63
+ cwd: string;
64
+ pid: number;
65
+ startedAt: string;
66
+ state: 'running' | 'ended' | 'error';
67
+ sessionId?: string;
68
+ /** Present only when the launch bypassed a client workspace-trust guard. */
69
+ trustOverride?: true;
70
+ };
71
+ export type RunDeps = {
72
+ /** NOT-400 seam, kept for compatibility: injected `query()` for the Claude adapter. */
73
+ query?: RunQueryFn;
74
+ /** Injected in tests; production lazily requires the Claude Agent SDK. */
75
+ claude?: ClaudeAdapterDeps;
76
+ /** Injected in tests; production spawns the real `codex` binary. */
77
+ codex?: CodexAdapterDeps;
78
+ /** Injected in tests; production spawns the real `cursor-agent` binary. */
79
+ cursor?: CursorAdapterDeps;
80
+ /** Injected in tests; production spawns the real `muse` binary. */
81
+ muse?: MuseAdapterDeps;
82
+ resolveDeck?: (ref: string) => Promise<{
83
+ id: string;
84
+ name: string;
85
+ } | null>;
86
+ resolveLaunchPlan?: typeof resolveMcpLaunchPlan;
87
+ homeDir?: string;
88
+ /** Injected in tests; production probes the local Claude Code CLI (NOT-405). */
89
+ claudeProbe?: ClaudeClientProbe;
90
+ };
91
+ /** Outcome of the Claude Code client probe: installed and signed in, or why not. */
92
+ export type ClaudeClientStatus = {
93
+ ok: true;
94
+ } | {
95
+ ok: false;
96
+ reason: 'not-installed' | 'not-signed-in';
97
+ };
98
+ export type ClaudeClientProbe = () => Promise<ClaudeClientStatus> | ClaudeClientStatus;
99
+ /** The one fix command both preflight remedies name. Verified against `claude auth --help`. */
100
+ export declare const CLAUDE_AUTH_LOGIN_COMMAND = "claude auth login";
101
+ export declare const RUN_CLAUDE_NOT_INSTALLED_ERROR = "Claude Code is not installed (no `claude` on PATH). Install Claude Code, then run `claude auth login` to sign in, then retry.";
102
+ export declare const RUN_CLAUDE_NOT_SIGNED_IN_ERROR = "Claude Code is not signed in. Run `claude auth login` to sign in with your own account, then retry.";
103
+ /** First executable `name` on `pathEnv`, or null. Pure apart from the fs check. */
104
+ export declare function findExecutableOnPath(name: string, pathEnv?: string): string | null;
105
+ /**
106
+ * True only when `claude auth status` JSON reports a login. Never throws:
107
+ * garbage, an empty string, or a logged-out report all read as signed out.
108
+ */
109
+ export declare function claudeAuthStatusShowsLogin(stdout: string): boolean;
110
+ /**
111
+ * Default Claude Code preflight: the `claude` CLI must be on PATH and
112
+ * `claude auth status` must report a login. Local only — no model call.
113
+ * An explicit ANTHROPIC_API_KEY passes without the OAuth check once the
114
+ * `claude` CLI is found on PATH (API-key onboarding stays out of scope;
115
+ * the friend path signs in via `claude auth login`). Any other failure —
116
+ * logged out, unparseable output, a hung or crashed `claude` — reads as
117
+ * not signed in; re-running the login is the remedy in every case.
118
+ */
119
+ export declare function defaultClaudeClientProbe(): Promise<ClaudeClientStatus>;
120
+ /**
121
+ * Test-only fake runner for the `run --detach` integration suite. The detached
122
+ * child is a real process, so dependency injection cannot reach it; instead the
123
+ * suite points AGENT_DECK_RUN_FAKE at a JSON behavior file and both the starter
124
+ * (deck lookup) and the child (deck lookup + model stream) honor it. Explicit
125
+ * `deps` always win, so unit tests are unaffected. Never set in production.
126
+ */
127
+ export declare const RUN_FAKE_ENV = "AGENT_DECK_RUN_FAKE";
128
+ export type RunFakeBehavior = {
129
+ deckId?: string;
130
+ deckName?: string;
131
+ /** success: yield text then a success result; fail: throw; crash: exit silently-ish. */
132
+ mode?: 'success' | 'fail' | 'crash';
133
+ lineDelayMs?: number;
134
+ endDelayMs?: number;
135
+ sessionId?: string;
136
+ text?: string;
137
+ error?: string;
138
+ exitCode?: number;
139
+ crashStderr?: string;
140
+ /** When set, the received { prompt, options } are recorded here as JSON. */
141
+ recordOptionsPath?: string;
142
+ };
143
+ export declare function loadRunFakeBehavior(): RunFakeBehavior | null;
144
+ export type RunPrereqDeps = Pick<RunDeps, 'resolveDeck' | 'resolveLaunchPlan' | 'claudeProbe'>;
145
+ export declare function newRunId(): string;
146
+ /**
147
+ * Atomic run-record write: readers (`run status`, detach tests, orchestrators)
148
+ * poll meta.json while the run child rewrites it, and a plain writeFileSync
149
+ * truncates before writing — a concurrent read lands on empty/partial bytes
150
+ * and JSON.parse throws. Writing to a sibling temp file and renaming keeps
151
+ * every observed state a complete document (rename is atomic on POSIX and
152
+ * Windows). The pid suffix keeps the starter's and the child's temp files
153
+ * distinct when both target the same meta.json.
154
+ */
155
+ export declare function writeRunMeta(metaPath: string, meta: RunMeta): void;
156
+ /**
157
+ * Session receipt check: the agent harness prints the bound deck as one
158
+ * `get_session_context` receipt line rendering `display_summary`
159
+ * (e.g. `◆ dev · 2 MCP · 0 keys · 1 playbooks`). Returns the mismatching deck
160
+ * token when the log positively shows a deck other than the requested one;
161
+ * a missing receipt is not a mismatch (the pre-start assignment gate is the
162
+ * fail-closed check; this is a second net for a mis-bound session).
163
+ * The fragments are joined before scanning: real clients stream token-level
164
+ * deltas, so one receipt line can arrive split across many text events and a
165
+ * per-fragment scan would miss the mismatch.
166
+ */
167
+ export declare function findReceiptDeckMismatch(texts: readonly string[], deck: {
168
+ id: string;
169
+ name: string;
170
+ }): string | null;
171
+ /**
172
+ * Everything a run must prove before it may start streaming: a readable brief,
173
+ * an existing cwd, a known deck, and a folder assignment already bound to that
174
+ * deck. Shared by the foreground run and the `--detach` starter so both fail
175
+ * closed on the same inputs with the same messages.
176
+ */
177
+ export declare function validateRunPrereqs(options: RunOptions, deps?: RunPrereqDeps): Promise<{
178
+ promptText: string;
179
+ deck: {
180
+ id: string;
181
+ name: string;
182
+ };
183
+ } | {
184
+ error: string;
185
+ }>;
186
+ export declare function printRunHelp(): void;
187
+ export declare function runRun(options: RunOptions, deps?: RunDeps): Promise<number>;
188
+ export declare function runRunCommand(args: string[], deps?: RunDeps & {
189
+ followPollMs?: number;
190
+ }): Promise<number>;
191
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,UAAU,EAGhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAIrE,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,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