@dreamlake/dreamlake-cli 0.97.2 → 0.99.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/api/client.d.ts +1 -1
- package/dist/api/client.js +4 -4
- package/dist/api/http.d.ts +48 -1
- package/dist/api/http.js +111 -4
- package/dist/api/index.d.ts +217 -511
- package/dist/api/index.js +12 -2
- package/dist/api/native-experiments.d.ts +77 -0
- package/dist/api/native-experiments.js +31 -0
- package/dist/api/note-edits.d.ts +40 -2
- package/dist/api/note-edits.js +197 -2
- package/dist/api/note-events.d.ts +40 -4
- package/dist/api/note-events.js +55 -2
- package/dist/api/note-facade.d.ts +268 -0
- package/dist/api/note-facade.js +376 -0
- package/dist/api/note-reading.d.ts +27 -0
- package/dist/api/note-reading.js +27 -0
- package/dist/api/note-write.d.ts +110 -0
- package/dist/api/note-write.js +217 -0
- package/dist/api/notes.d.ts +33 -44
- package/dist/api/notes.js +44 -34
- package/dist/api/sessions.d.ts +240 -7
- package/dist/api/sessions.js +56 -1
- package/dist/api/skills.d.ts +122 -0
- package/dist/api/skills.js +220 -0
- package/dist/cli/client.d.ts +2 -41
- package/dist/cli/client.js +13 -90
- package/dist/cli/experiments/index.js +2 -0
- package/dist/cli/experiments/native-commands.d.ts +13 -0
- package/dist/cli/experiments/native-commands.js +88 -0
- package/dist/cli/help-examples.generated.js +23 -6
- package/dist/cli/index.js +2 -0
- package/dist/cli/notes/api-transport.js +6 -6
- package/dist/cli/notes/document.d.ts +32 -26
- package/dist/cli/notes/document.js +150 -95
- package/dist/cli/notes/edit-commands.d.ts +26 -5
- package/dist/cli/notes/edit-commands.js +163 -36
- package/dist/cli/notes/events.d.ts +3 -33
- package/dist/cli/notes/events.js +4 -51
- package/dist/cli/notes/html-read.d.ts +6 -0
- package/dist/cli/notes/html-read.js +12 -0
- package/dist/cli/notes/index.d.ts +10 -1
- package/dist/cli/notes/index.js +98 -27
- package/dist/cli/notes/move-command.d.ts +4 -0
- package/dist/cli/notes/move-command.js +7 -0
- package/dist/cli/session-affiliation.js +3 -2
- package/dist/cli/sessions/affiliation.d.ts +12 -1
- package/dist/cli/sessions/affiliation.js +37 -0
- package/dist/cli/sessions/control.d.ts +11 -0
- package/dist/cli/sessions/control.js +49 -4
- package/dist/cli/sessions/index.js +70 -17
- package/dist/cli/sessions/live.d.ts +85 -0
- package/dist/cli/sessions/live.js +258 -0
- package/dist/cli/sessions/runner/exec.d.ts +118 -6
- package/dist/cli/sessions/runner/exec.js +298 -47
- package/dist/cli/sessions/runner/native.js +4 -1
- package/dist/cli/sessions/runner/serve.d.ts +37 -2
- package/dist/cli/sessions/runner/serve.js +273 -28
- package/dist/cli/sessions/wrap.d.ts +63 -0
- package/dist/cli/sessions/wrap.js +226 -0
- package/dist/cli/skill/index.d.ts +19 -1
- package/dist/cli/skill/index.js +65 -12
- package/dist/cli/skill/read.d.ts +25 -0
- package/dist/cli/skill/read.js +65 -0
- package/dist/cli/skill/registry.d.ts +95 -0
- package/dist/cli/skill/registry.js +284 -0
- package/dist/cli/skill/reminders.js +2 -1
- package/dist/cli/vault/sshTransfer.d.ts +1 -1
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
|
@@ -19,23 +19,37 @@ export interface RunOptions {
|
|
|
19
19
|
export type Run = (command: string, args: string[], options?: RunOptions) => Promise<RunResult>;
|
|
20
20
|
/** Default process runner: own process group, bounded output and time, killable through `signal`. */
|
|
21
21
|
export declare const run: Run;
|
|
22
|
+
/** `checkpoint` is what is known about a side effect; `detail` is why it failed (exit code, signal, bounded
|
|
23
|
+
* and redacted output tails), so a receipt carries the underlying error text and not only a code. */
|
|
22
24
|
export declare class RunnerError extends Error {
|
|
23
25
|
readonly code: string;
|
|
24
26
|
readonly uncertain: boolean;
|
|
25
27
|
readonly checkpoint: Record<string, unknown>;
|
|
26
|
-
|
|
28
|
+
readonly detail: Record<string, unknown>;
|
|
29
|
+
constructor(code: string, message?: string, uncertain?: boolean, checkpoint?: Record<string, unknown>, detail?: Record<string, unknown>);
|
|
27
30
|
}
|
|
28
31
|
export type PermissionLevel = 'read-only' | 'workspace-write' | 'full-access';
|
|
29
32
|
export declare function hasTmux(exec: Run): Promise<boolean>;
|
|
30
33
|
export declare function tmuxAlive(exec: Run, name: string): Promise<boolean>;
|
|
31
34
|
/** The owner marker is written by this runner at creation; a session with another or no marker is not ours to type into or kill. */
|
|
32
35
|
export declare const ownerMarker: (runnerKey: string, nativeSessionId: string) => string;
|
|
33
|
-
|
|
36
|
+
/** `policy` records the permission level the process was launched under (`@dreamlake_policy`), so a later
|
|
37
|
+
* resume or send can tell whether the live process still matches the authorized level. */
|
|
38
|
+
export declare function markOwnership(exec: Run, name: string, marker: string, policy?: PermissionLevel): Promise<void>;
|
|
39
|
+
/** The level an owned tmux session's process was launched under, or `null` when it was not recorded (a
|
|
40
|
+
* session launched by an older runner) — which is not proof of anything, and is treated as such. */
|
|
41
|
+
export declare function livePolicy(exec: Run, name: string): Promise<PermissionLevel | null>;
|
|
42
|
+
/** Refuses to type into a live process whose launch level is not the authorized one. Equal: proceed.
|
|
43
|
+
* Different: the caller relaunches at the authorized level. Unknown: refused, a restart is the way out. */
|
|
44
|
+
export declare function assertLivePolicy(live: PermissionLevel | null, authorized: PermissionLevel): 'matches' | 'relaunch';
|
|
34
45
|
export declare function verifyOwnership(exec: Run, name: string, marker: string): Promise<'absent' | 'owned' | 'foreign'>;
|
|
35
46
|
/** One message, pasted whole (bracketed) and submitted once; every step's exit code counts. */
|
|
36
47
|
export declare function tmuxSend(exec: Run, name: string, marker: string, text: string, signal?: AbortSignal): Promise<void>;
|
|
37
48
|
export declare function tmuxStop(exec: Run, name: string, marker: string): Promise<boolean>;
|
|
38
|
-
/** A fresh worktree next to the user's other DreamLake worktrees, never inside the source checkout.
|
|
49
|
+
/** A fresh worktree next to the user's other DreamLake worktrees, never inside the source checkout.
|
|
50
|
+
* `prepared` receives the record (path, branch, whether the branch is new, its starting tip) just before
|
|
51
|
+
* `git worktree add`: an add that is cancelled or times out may already have registered the worktree and
|
|
52
|
+
* created the branch, and that record is what lets the caller reconcile such a partial creation. */
|
|
39
53
|
export declare function createWorktree(exec: Run, input: {
|
|
40
54
|
repo: string;
|
|
41
55
|
branch?: string;
|
|
@@ -43,11 +57,45 @@ export declare function createWorktree(exec: Run, input: {
|
|
|
43
57
|
home: string;
|
|
44
58
|
signal?: AbortSignal;
|
|
45
59
|
checkpoint?: (value: Record<string, unknown>) => void;
|
|
60
|
+
prepared?: (record: Worktree) => void;
|
|
46
61
|
}): Promise<{
|
|
62
|
+
gitDir: string | null;
|
|
63
|
+
branchOid: string | null;
|
|
47
64
|
path: string;
|
|
48
65
|
branch: string;
|
|
49
66
|
root: string;
|
|
67
|
+
createdBranch: boolean;
|
|
68
|
+
identity: string;
|
|
50
69
|
}>;
|
|
70
|
+
/** A worktree this runner created, with what cleanup needs to recognise it later: `identity` is the nonce
|
|
71
|
+
* of this creation, written to `<gitDir>/dreamlake-session` once `git worktree add` returned; `gitDir` the
|
|
72
|
+
* admin directory git assigned (the `gitdir:` pointer in `<path>/.git`); `branchOid` where the branch
|
|
73
|
+
* pointed when the start began. */
|
|
74
|
+
export interface Worktree {
|
|
75
|
+
path: string;
|
|
76
|
+
branch: string;
|
|
77
|
+
root: string;
|
|
78
|
+
createdBranch: boolean;
|
|
79
|
+
gitDir: string | null;
|
|
80
|
+
branchOid: string | null;
|
|
81
|
+
identity: string;
|
|
82
|
+
}
|
|
83
|
+
export interface WorktreeTeardown {
|
|
84
|
+
removed: boolean;
|
|
85
|
+
branchDeleted: boolean;
|
|
86
|
+
reason?: string;
|
|
87
|
+
}
|
|
88
|
+
/** The identity of the creation that made the worktree at `path`, or null when it carries none. */
|
|
89
|
+
export declare function worktreeIdentity(path: string): string | null;
|
|
90
|
+
/** Remove a worktree this runner created for a start that never became a session, and the branch it
|
|
91
|
+
* created for it. Nothing is destroyed unless it is still exactly what this start made: the worktree at
|
|
92
|
+
* the path must carry this creation's identity file (a replacement, a re-creation at the same path or a
|
|
93
|
+
* worktree whose creation never completed does not, and is kept as `identity_missing`), be checked out
|
|
94
|
+
* on the branch, and the branch must still point at its initial tip (a provider that committed and then
|
|
95
|
+
* failed has made the branch worth keeping). Removal is never `--force` (edits keep it); the branch is
|
|
96
|
+
* deleted with `update-ref -d <old>`, which refuses a branch that moved, and never while any worktree
|
|
97
|
+
* has it checked out. A kept worktree or branch is reported with the reason. */
|
|
98
|
+
export declare function removeWorktree(exec: Run, where: Worktree): Promise<WorktreeTeardown>;
|
|
51
99
|
export interface Launch {
|
|
52
100
|
provider: Provider;
|
|
53
101
|
cwd: string;
|
|
@@ -55,21 +103,62 @@ export interface Launch {
|
|
|
55
103
|
prompt?: string;
|
|
56
104
|
nativeSessionId?: string;
|
|
57
105
|
claudeConfigDir?: string | null;
|
|
106
|
+
defaultClaudeConfigDir?: string;
|
|
58
107
|
codexRoot: string;
|
|
59
108
|
signal?: AbortSignal;
|
|
60
109
|
checkpoint?: (value: Record<string, unknown>) => void;
|
|
61
110
|
}
|
|
111
|
+
export type ClaudeConfigReason = 'inherited' | 'default_config_dir' | 'profile_missing' | 'profile_not_owned' | 'profile_logged_out' | 'exported';
|
|
112
|
+
/** What the runner did with a session's recorded `claudeConfigDir`; reported in every receipt of a Claude turn. */
|
|
113
|
+
export interface ClaudeConfigDecision {
|
|
114
|
+
dir: string | null;
|
|
115
|
+
exported: boolean;
|
|
116
|
+
reason: ClaudeConfigReason;
|
|
117
|
+
}
|
|
118
|
+
/** Whose profile directories the runner may export: those owned by this Unix user (by uid), or inside this user's home. */
|
|
119
|
+
export interface ProfileOwner {
|
|
120
|
+
home: string;
|
|
121
|
+
uid: number | null;
|
|
122
|
+
}
|
|
123
|
+
export declare const currentProfileOwner: () => ProfileOwner;
|
|
124
|
+
/** Claude Code keeps its login in `<config dir>/.claude.json`, and the default profile is `~/.claude.json`,
|
|
125
|
+
* not `~/.claude/.claude.json`. Exporting `CLAUDE_CONFIG_DIR=~/.claude` (what Nymph records for a default
|
|
126
|
+
* session) therefore makes Claude create an empty, logged-out profile and answer "Not logged in". The
|
|
127
|
+
* variable is exported only for a non-default directory that holds a logged-in profile; otherwise the
|
|
128
|
+
* process inherits the runner's own environment, which is how the user runs Claude.
|
|
129
|
+
*
|
|
130
|
+
* A session descriptor can name any readable path, so the directory is accepted only when it is this
|
|
131
|
+
* user's own — owned by the current uid, or inside the current home — and that is decided on the resolved
|
|
132
|
+
* path (symlinks followed first, so a link inside this home to a directory elsewhere is judged by where
|
|
133
|
+
* it points) before its profile is read; another Unix user's profile is not this user's login. A login
|
|
134
|
+
* means a non-empty `oauthAccount` object or a non-empty `primaryApiKey`; `{ "oauthAccount": {} }` is
|
|
135
|
+
* logged out. */
|
|
136
|
+
export declare function claudeConfigDecision(requested: string | null | undefined, defaultDir: string, owner?: ProfileOwner): ClaudeConfigDecision;
|
|
137
|
+
/** The exact command line of a headless turn (`claude -p` / `codex exec`); echoed in every receipt so the
|
|
138
|
+
* permission mode a process actually ran under is readable next to the level that was authorized. */
|
|
139
|
+
export declare function headlessArgv(input: {
|
|
140
|
+
provider: Provider;
|
|
141
|
+
nativeSessionId?: string;
|
|
142
|
+
permissionLevel: PermissionLevel;
|
|
143
|
+
resume: boolean;
|
|
144
|
+
cwd?: string;
|
|
145
|
+
}): string[];
|
|
62
146
|
/** Headless: one provider turn that creates the session; the prompt travels on stdin. */
|
|
63
147
|
export declare function startHeadless(exec: Run, launch: Launch): Promise<{
|
|
64
148
|
nativeSessionId: string;
|
|
65
149
|
reply: string | null;
|
|
150
|
+
argv: string[];
|
|
151
|
+
claudeConfig?: ClaudeConfigDecision;
|
|
66
152
|
}>;
|
|
67
|
-
/** Interactive: a detached, owner-marked tmux session. Prompts sit behind `--`.
|
|
153
|
+
/** Interactive: a detached, owner-marked tmux session. Prompts sit behind `--`. `argv` is the program the
|
|
154
|
+
* tmux session runs (with an `env CLAUDE_CONFIG_DIR=…` prefix when one was exported). */
|
|
68
155
|
export declare function startTmux(exec: Run, launch: Launch & {
|
|
69
156
|
marker: (nativeSessionId: string) => string;
|
|
70
157
|
}): Promise<{
|
|
71
158
|
nativeSessionId: string;
|
|
72
159
|
tmuxSession: string;
|
|
160
|
+
argv: string[];
|
|
161
|
+
claudeConfig?: ClaudeConfigDecision;
|
|
73
162
|
}>;
|
|
74
163
|
export interface Resume {
|
|
75
164
|
provider: Provider;
|
|
@@ -77,6 +166,7 @@ export interface Resume {
|
|
|
77
166
|
nativeSessionId: string;
|
|
78
167
|
permissionLevel: PermissionLevel;
|
|
79
168
|
claudeConfigDir?: string | null;
|
|
169
|
+
defaultClaudeConfigDir?: string;
|
|
80
170
|
prompt?: string;
|
|
81
171
|
marker: string;
|
|
82
172
|
signal?: AbortSignal;
|
|
@@ -88,6 +178,17 @@ export declare function resumeTmux(exec: Run, input: Resume): Promise<{
|
|
|
88
178
|
tmuxSession: string;
|
|
89
179
|
created: boolean;
|
|
90
180
|
delivered: boolean;
|
|
181
|
+
argv: string[] | null;
|
|
182
|
+
processLevel: PermissionLevel | null;
|
|
183
|
+
} | {
|
|
184
|
+
claudeConfig?: ClaudeConfigDecision | undefined;
|
|
185
|
+
relaunched?: true | undefined;
|
|
186
|
+
previousProcessLevel?: PermissionLevel | undefined;
|
|
187
|
+
tmuxSession: string;
|
|
188
|
+
created: boolean;
|
|
189
|
+
delivered: boolean;
|
|
190
|
+
argv: string[] | null;
|
|
191
|
+
processLevel: PermissionLevel;
|
|
91
192
|
}>;
|
|
92
193
|
/** Headless message: one resumed turn under the session's permission ceiling; the text travels on stdin. */
|
|
93
194
|
export declare function sendHeadless(exec: Run, input: {
|
|
@@ -96,13 +197,24 @@ export declare function sendHeadless(exec: Run, input: {
|
|
|
96
197
|
nativeSessionId: string;
|
|
97
198
|
permissionLevel: PermissionLevel;
|
|
98
199
|
claudeConfigDir?: string | null;
|
|
200
|
+
defaultClaudeConfigDir?: string;
|
|
99
201
|
text: string;
|
|
100
202
|
signal?: AbortSignal;
|
|
101
203
|
}): Promise<{
|
|
102
204
|
reply: string | null;
|
|
205
|
+
argv: string[];
|
|
206
|
+
claudeConfig?: ClaudeConfigDecision;
|
|
103
207
|
}>;
|
|
104
|
-
/**
|
|
105
|
-
export
|
|
208
|
+
/** The exact transcript state one of this runner's own turns left behind, keyed by the native session. */
|
|
209
|
+
export interface TranscriptMark {
|
|
210
|
+
mtimeMs: number;
|
|
211
|
+
size: number;
|
|
212
|
+
}
|
|
213
|
+
export declare function transcriptMark(transcriptPath: string | null): TranscriptMark | null;
|
|
214
|
+
/** Someone (a person, another runner) is writing this conversation right now. A transcript that still
|
|
215
|
+
* reads exactly as this runner's own last turn left it was not written by anyone else, however recent;
|
|
216
|
+
* the runner identifies its own writes by that recorded state, never by how long ago they happened. */
|
|
217
|
+
export declare function nativeWriterBusy(transcriptPath: string | null, now?: number, windowMs?: number, own?: TranscriptMark | null): boolean;
|
|
106
218
|
export declare function claudeReply(stdout: string): string | null;
|
|
107
219
|
export declare function codexThreadId(stdout: string): string | null;
|
|
108
220
|
export declare function codexReply(stdout: string): string | null;
|