@gtc6244/immediacy-daemon 0.1.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/src/actions.d.ts +22 -0
- package/dist/src/actions.js +44 -0
- package/dist/src/actions.js.map +1 -0
- package/dist/src/agent/agent.d.ts +89 -0
- package/dist/src/agent/agent.js +22 -0
- package/dist/src/agent/agent.js.map +1 -0
- package/dist/src/agent/claude.d.ts +70 -0
- package/dist/src/agent/claude.js +404 -0
- package/dist/src/agent/claude.js.map +1 -0
- package/dist/src/agent/codex.d.ts +44 -0
- package/dist/src/agent/codex.js +303 -0
- package/dist/src/agent/codex.js.map +1 -0
- package/dist/src/agent/mock.d.ts +31 -0
- package/dist/src/agent/mock.js +155 -0
- package/dist/src/agent/mock.js.map +1 -0
- package/dist/src/agent/model-error.d.ts +8 -0
- package/dist/src/agent/model-error.js +25 -0
- package/dist/src/agent/model-error.js.map +1 -0
- package/dist/src/agent/openrouter.d.ts +38 -0
- package/dist/src/agent/openrouter.js +60 -0
- package/dist/src/agent/openrouter.js.map +1 -0
- package/dist/src/agent/workspace-scope.d.ts +25 -0
- package/dist/src/agent/workspace-scope.js +71 -0
- package/dist/src/agent/workspace-scope.js.map +1 -0
- package/dist/src/allowlist.d.ts +56 -0
- package/dist/src/allowlist.js +141 -0
- package/dist/src/allowlist.js.map +1 -0
- package/dist/src/chatlog.d.ts +50 -0
- package/dist/src/chatlog.js +179 -0
- package/dist/src/chatlog.js.map +1 -0
- package/dist/src/cli/paths.d.ts +40 -0
- package/dist/src/cli/paths.js +76 -0
- package/dist/src/cli/paths.js.map +1 -0
- package/dist/src/cli/service.d.ts +20 -0
- package/dist/src/cli/service.js +245 -0
- package/dist/src/cli/service.js.map +1 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +227 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config.d.ts +33 -0
- package/dist/src/config.js +122 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/credentials.d.ts +38 -0
- package/dist/src/credentials.js +120 -0
- package/dist/src/credentials.js.map +1 -0
- package/dist/src/crypto.d.ts +49 -0
- package/dist/src/crypto.js +202 -0
- package/dist/src/crypto.js.map +1 -0
- package/dist/src/daemon-identity.d.ts +31 -0
- package/dist/src/daemon-identity.js +97 -0
- package/dist/src/daemon-identity.js.map +1 -0
- package/dist/src/envelope.d.ts +14 -0
- package/dist/src/envelope.js +28 -0
- package/dist/src/envelope.js.map +1 -0
- package/dist/src/events.d.ts +40 -0
- package/dist/src/events.js +24 -0
- package/dist/src/events.js.map +1 -0
- package/dist/src/forward.d.ts +51 -0
- package/dist/src/forward.js +170 -0
- package/dist/src/forward.js.map +1 -0
- package/dist/src/fs-scope.d.ts +17 -0
- package/dist/src/fs-scope.js +47 -0
- package/dist/src/fs-scope.js.map +1 -0
- package/dist/src/github.d.ts +70 -0
- package/dist/src/github.js +178 -0
- package/dist/src/github.js.map +1 -0
- package/dist/src/gitops.d.ts +113 -0
- package/dist/src/gitops.js +557 -0
- package/dist/src/gitops.js.map +1 -0
- package/dist/src/hub.d.ts +50 -0
- package/dist/src/hub.js +92 -0
- package/dist/src/hub.js.map +1 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/index.js +56 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/jobs/scheduler.d.ts +94 -0
- package/dist/src/jobs/scheduler.js +373 -0
- package/dist/src/jobs/scheduler.js.map +1 -0
- package/dist/src/jobs/store.d.ts +33 -0
- package/dist/src/jobs/store.js +111 -0
- package/dist/src/jobs/store.js.map +1 -0
- package/dist/src/log.d.ts +61 -0
- package/dist/src/log.js +166 -0
- package/dist/src/log.js.map +1 -0
- package/dist/src/migrate-state-dir.d.ts +1 -0
- package/dist/src/migrate-state-dir.js +47 -0
- package/dist/src/migrate-state-dir.js.map +1 -0
- package/dist/src/models.d.ts +36 -0
- package/dist/src/models.js +71 -0
- package/dist/src/models.js.map +1 -0
- package/dist/src/permission-gate.d.ts +48 -0
- package/dist/src/permission-gate.js +93 -0
- package/dist/src/permission-gate.js.map +1 -0
- package/dist/src/permission-scope.d.ts +77 -0
- package/dist/src/permission-scope.js +244 -0
- package/dist/src/permission-scope.js.map +1 -0
- package/dist/src/ports.d.ts +71 -0
- package/dist/src/ports.js +216 -0
- package/dist/src/ports.js.map +1 -0
- package/dist/src/projects.d.ts +83 -0
- package/dist/src/projects.js +205 -0
- package/dist/src/projects.js.map +1 -0
- package/dist/src/protocol.d.ts +1226 -0
- package/dist/src/protocol.js +16 -0
- package/dist/src/protocol.js.map +1 -0
- package/dist/src/repo-sync.d.ts +49 -0
- package/dist/src/repo-sync.js +83 -0
- package/dist/src/repo-sync.js.map +1 -0
- package/dist/src/server.d.ts +33 -0
- package/dist/src/server.js +973 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/terminal.d.ts +32 -0
- package/dist/src/terminal.js +92 -0
- package/dist/src/terminal.js.map +1 -0
- package/dist/src/titler.d.ts +15 -0
- package/dist/src/titler.js +72 -0
- package/dist/src/titler.js.map +1 -0
- package/dist/src/types.d.ts +99 -0
- package/dist/src/types.js +3 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/usage-limit.d.ts +49 -0
- package/dist/src/usage-limit.js +83 -0
- package/dist/src/usage-limit.js.map +1 -0
- package/dist/src/usage.d.ts +23 -0
- package/dist/src/usage.js +63 -0
- package/dist/src/usage.js.map +1 -0
- package/dist/src/workspace.d.ts +303 -0
- package/dist/src/workspace.js +1086 -0
- package/dist/src/workspace.js.map +1 -0
- package/dist/src/worktree.d.ts +133 -0
- package/dist/src/worktree.js +561 -0
- package/dist/src/worktree.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usage.js","sourceRoot":"","sources":["../../src/usage.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,MAAM,CAAC,GAAG,GAAoE,CAAC;IAC/E,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;IAClB,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAClD,MAAM,GAAG,GAAG,CAAC,CAAU,EAAU,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1F,MAAM,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,eAAe,GAAG,GAAG,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC;IACvD,MAAM,mBAAmB,GAAG,GAAG,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC;IAC/D,mEAAmE;IACnE,IAAI,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,mBAAmB,KAAK,CAAC,EAAE,CAAC;QAC7E,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC;IAC9B,OAAO;QACL,WAAW;QACX,YAAY;QACZ,eAAe;QACf,mBAAmB;QACnB,OAAO,EAAE,OAAO,IAAI,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;KAC9E,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,SAAS,IAAI,CAAC,CAAS;IACrB,OAAO,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC;AAED,0DAA0D;AAC1D,SAAS,MAAM,CAAC,CAAS;IACvB,IAAI,CAAC,IAAI,SAAS;QAAE,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAClE,IAAI,CAAC,IAAI,KAAK;QAAE,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC1D,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,CAAY;IAC1C,MAAM,OAAO,GAAG,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC,eAAe,GAAG,CAAC,CAAC,mBAAmB,CAAC;IAC1E,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC;IAChE,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI;QAAE,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAChE,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkspaceManager — owns the set of workspaces and, per workspace, its
|
|
3
|
+
* worktree, agent, and terminal. Translates agent events into broadcast wire
|
|
4
|
+
* messages and persists metadata so sessions survive a daemon restart (resume).
|
|
5
|
+
*/
|
|
6
|
+
import type { WebSocket } from "ws";
|
|
7
|
+
import type { ChatEntry, DeleteBatchResultPayload, PromptAttachment, QuestionAnswers, WorkspaceActionKind, WorkspaceSummary } from "./protocol.js";
|
|
8
|
+
import type { ProjectRecord, WorkspaceRecord } from "./types.js";
|
|
9
|
+
import type { Hub } from "./hub.js";
|
|
10
|
+
import type { SystemEvents } from "./events.js";
|
|
11
|
+
import { ChatLog } from "./chatlog.js";
|
|
12
|
+
import { ProjectStore } from "./projects.js";
|
|
13
|
+
import { AppConfigStore } from "./config.js";
|
|
14
|
+
import { CredentialsStore } from "./credentials.js";
|
|
15
|
+
import { AllowlistStore } from "./allowlist.js";
|
|
16
|
+
import type { PermissionResponse } from "./agent/agent.js";
|
|
17
|
+
export declare class WorkspaceManager {
|
|
18
|
+
private hub;
|
|
19
|
+
/** Durable per-workspace transcript, so history survives phone reboots. */
|
|
20
|
+
private chatlog;
|
|
21
|
+
/**
|
|
22
|
+
* In-process domain-event bus. Optional so existing callers/tests need no
|
|
23
|
+
* change; when present, the manager emits at each action chokepoint so the
|
|
24
|
+
* JobScheduler can drive reactive ("N minutes after X") triggers.
|
|
25
|
+
*/
|
|
26
|
+
private events?;
|
|
27
|
+
/** Registry of projects worktrees hang under (persisted separately). */
|
|
28
|
+
private projects;
|
|
29
|
+
/**
|
|
30
|
+
* Provider API keys (app-managed, env-seeded). Read at agent-spawn time to
|
|
31
|
+
* pick a session's credential: a stored/env key, else the CLI/SDK's own SSO
|
|
32
|
+
* login. Defaulted so existing callers/tests need no change.
|
|
33
|
+
*/
|
|
34
|
+
private credentials;
|
|
35
|
+
/**
|
|
36
|
+
* Daemon-owned app config (prompts + git behavior). Read live at spawn time
|
|
37
|
+
* (`prompts.general` → agent system prompt) and at worktree-create time
|
|
38
|
+
* (`git.branchPrefix*`). Defaulted so existing callers/tests need no change.
|
|
39
|
+
*/
|
|
40
|
+
private appConfig;
|
|
41
|
+
/**
|
|
42
|
+
* Daemon-global "Allow all" list. Handed to every spawned agent so a prior
|
|
43
|
+
* grant auto-approves matching calls, and appended to when a client answers
|
|
44
|
+
* a permission request with `allow_all`. Defaulted for existing callers/tests.
|
|
45
|
+
*/
|
|
46
|
+
private allowlist;
|
|
47
|
+
private workspaces;
|
|
48
|
+
/**
|
|
49
|
+
* The last workspace list we fanned out, JSON-encoded — so
|
|
50
|
+
* `broadcastWorkspaceList` can no-op when a recompute yields identical rows.
|
|
51
|
+
*/
|
|
52
|
+
private lastListJson;
|
|
53
|
+
constructor(hub: Hub,
|
|
54
|
+
/** Durable per-workspace transcript, so history survives phone reboots. */
|
|
55
|
+
chatlog?: ChatLog,
|
|
56
|
+
/**
|
|
57
|
+
* In-process domain-event bus. Optional so existing callers/tests need no
|
|
58
|
+
* change; when present, the manager emits at each action chokepoint so the
|
|
59
|
+
* JobScheduler can drive reactive ("N minutes after X") triggers.
|
|
60
|
+
*/
|
|
61
|
+
events?: SystemEvents | undefined,
|
|
62
|
+
/** Registry of projects worktrees hang under (persisted separately). */
|
|
63
|
+
projects?: ProjectStore,
|
|
64
|
+
/**
|
|
65
|
+
* Provider API keys (app-managed, env-seeded). Read at agent-spawn time to
|
|
66
|
+
* pick a session's credential: a stored/env key, else the CLI/SDK's own SSO
|
|
67
|
+
* login. Defaulted so existing callers/tests need no change.
|
|
68
|
+
*/
|
|
69
|
+
credentials?: CredentialsStore,
|
|
70
|
+
/**
|
|
71
|
+
* Daemon-owned app config (prompts + git behavior). Read live at spawn time
|
|
72
|
+
* (`prompts.general` → agent system prompt) and at worktree-create time
|
|
73
|
+
* (`git.branchPrefix*`). Defaulted so existing callers/tests need no change.
|
|
74
|
+
*/
|
|
75
|
+
appConfig?: AppConfigStore,
|
|
76
|
+
/**
|
|
77
|
+
* Daemon-global "Allow all" list. Handed to every spawned agent so a prior
|
|
78
|
+
* grant auto-approves matching calls, and appended to when a client answers
|
|
79
|
+
* a permission request with `allow_all`. Defaulted for existing callers/tests.
|
|
80
|
+
*/
|
|
81
|
+
allowlist?: AllowlistStore);
|
|
82
|
+
/** The daemon-global allowlist (for server-side admin: list/revoke/clear). */
|
|
83
|
+
allowlistStore(): AllowlistStore;
|
|
84
|
+
/** Is there a live workspace with this id? (used by the job scheduler). */
|
|
85
|
+
has(id: string): boolean;
|
|
86
|
+
load(): Promise<void>;
|
|
87
|
+
/** Registered projects (the sidebar groups). */
|
|
88
|
+
listProjects(): ProjectRecord[];
|
|
89
|
+
/**
|
|
90
|
+
* Reorder the registered projects. `ids` is the full list of project ids in
|
|
91
|
+
* the desired display order (see ProjectStore.reorder for how unknown/missing
|
|
92
|
+
* ids are handled).
|
|
93
|
+
*/
|
|
94
|
+
reorderProjects(ids: string[]): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Register a project from a blank repo (`git init`), a GitHub source, or an
|
|
97
|
+
* existing local path. GitHub/local are idempotent (by full name / resolved
|
|
98
|
+
* path); blank always creates. Does NOT create a worktree — it's a standing
|
|
99
|
+
* "+ new worktree" target.
|
|
100
|
+
*/
|
|
101
|
+
createProject(opts: {
|
|
102
|
+
blank?: boolean;
|
|
103
|
+
repo?: string;
|
|
104
|
+
github?: {
|
|
105
|
+
fullName: string;
|
|
106
|
+
defaultBranch?: string;
|
|
107
|
+
};
|
|
108
|
+
name?: string;
|
|
109
|
+
}): Promise<ProjectRecord>;
|
|
110
|
+
/**
|
|
111
|
+
* Branches available to base a new worktree on for a project (local + remote,
|
|
112
|
+
* deduped). Powers the "create worktree from an existing branch" pickers.
|
|
113
|
+
*/
|
|
114
|
+
listBranches(projectId: string): Promise<{
|
|
115
|
+
branches: string[];
|
|
116
|
+
defaultBranch?: string;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* A project's open pull requests, for the "create worktree from an open PR"
|
|
120
|
+
* picker. Empty when the project has no GitHub remote or `gh` isn't available.
|
|
121
|
+
*/
|
|
122
|
+
listPullRequests(projectId: string): Promise<import("./protocol.js").PullRequestSummary[]>;
|
|
123
|
+
/**
|
|
124
|
+
* A project's open issues (with bodies), for the "create worktree from an
|
|
125
|
+
* issue" picker + confirm step. Empty when there's no GitHub remote / gh.
|
|
126
|
+
*/
|
|
127
|
+
listIssues(projectId: string): Promise<import("./protocol.js").IssueSummary[]>;
|
|
128
|
+
/** Remove a project. Rejected while any worktree still references it. */
|
|
129
|
+
deleteProject(id: string): Promise<void>;
|
|
130
|
+
/** Persisted transcript for a workspace (chronological). */
|
|
131
|
+
history(id: string): ChatEntry[];
|
|
132
|
+
private persist;
|
|
133
|
+
list(): WorkspaceRecord[];
|
|
134
|
+
/**
|
|
135
|
+
* Create a workspace (worktree) under a project. Preferred: pass `projectId`.
|
|
136
|
+
* The legacy path — a bare `repo`/`github` with no projectId — find-or-creates
|
|
137
|
+
* the matching project first, so every worktree ends up grouped.
|
|
138
|
+
*/
|
|
139
|
+
create(opts: {
|
|
140
|
+
projectId?: string;
|
|
141
|
+
repo?: string;
|
|
142
|
+
github?: {
|
|
143
|
+
fullName: string;
|
|
144
|
+
defaultBranch?: string;
|
|
145
|
+
};
|
|
146
|
+
name?: string;
|
|
147
|
+
branchBase?: string;
|
|
148
|
+
/** Check out this existing branch instead of forking a fresh one. */
|
|
149
|
+
sourceBranch?: string;
|
|
150
|
+
/** Check out this open PR's head branch instead of forking a fresh one. */
|
|
151
|
+
sourcePr?: number;
|
|
152
|
+
/** Seed the agent with this first prompt right after creation. */
|
|
153
|
+
initialPrompt?: string;
|
|
154
|
+
model?: string;
|
|
155
|
+
}): Promise<WorkspaceRecord>;
|
|
156
|
+
/**
|
|
157
|
+
* Create a repo-less "chat" workspace — a free-form conversation with the
|
|
158
|
+
* agent, not tied to any GitHub project or git worktree (the Claude/ChatGPT
|
|
159
|
+
* desktop model). It starts named "New Chat"; the first prompt triggers an
|
|
160
|
+
* auto-title (see `prompt`). The agent still gets a real cwd — a private
|
|
161
|
+
* scratch dir under `~/.immediacy/chats/<id>` — so file/bash tools work,
|
|
162
|
+
* scoped to that folder by the usual workspace-scope rule.
|
|
163
|
+
*/
|
|
164
|
+
createChat(opts?: {
|
|
165
|
+
model?: string;
|
|
166
|
+
}): Promise<WorkspaceRecord>;
|
|
167
|
+
/**
|
|
168
|
+
* Rename a workspace and fan the new label out to every client. Used by the
|
|
169
|
+
* chat auto-title flow; the sidebar row updates in place without a full list
|
|
170
|
+
* refresh.
|
|
171
|
+
*/
|
|
172
|
+
private renameWorkspace;
|
|
173
|
+
/**
|
|
174
|
+
* Summarize a chat's first prompt into a short title and rename the workspace.
|
|
175
|
+
* Fire-and-forget: guards against a racing second prompt (only renames while
|
|
176
|
+
* the label is still the placeholder) and swallows any failure.
|
|
177
|
+
*/
|
|
178
|
+
private autoTitleChat;
|
|
179
|
+
/** Added/removed line totals vs base, per workspace (for the sidebar rows). */
|
|
180
|
+
diffStat(id: string): Promise<import("./worktree.js").DiffStat | null>;
|
|
181
|
+
/**
|
|
182
|
+
* The sidebar summaries: one row per workspace with its live diff-stat. Diffs
|
|
183
|
+
* are measured in parallel and best-effort (0/0 on any git hiccup); `added`/
|
|
184
|
+
* `removed` are omitted when zero so a clean worktree renders no counter.
|
|
185
|
+
*/
|
|
186
|
+
summaries(): Promise<WorkspaceSummary[]>;
|
|
187
|
+
/**
|
|
188
|
+
* Recompute the sidebar summaries and fan them out to every client — but only
|
|
189
|
+
* when something actually changed since the last fan-out. This is the single
|
|
190
|
+
* entry point for keeping the left-pane rows (diff-stat counters, name,
|
|
191
|
+
* branch, status) live: callers fire it whenever a worktree's state may have
|
|
192
|
+
* moved (an agent turn finished, files changed, the base advanced, a branch or
|
|
193
|
+
* PR was renamed) without having to know whether the numbers really shifted.
|
|
194
|
+
* The change-check keeps a frequently-polled path (git.status) from spamming
|
|
195
|
+
* identical lists at every connected device.
|
|
196
|
+
*/
|
|
197
|
+
broadcastWorkspaceList(): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Freshen every base repo's remote-tracking refs, then reconcile the sidebar.
|
|
200
|
+
* This is the "an app just (re)connected — make the left pane reflect GitHub,
|
|
201
|
+
* not a snapshot from whenever we last fetched" path: the client's first
|
|
202
|
+
* `workspace.list` gets an immediate (locally-computed) reply for a snappy
|
|
203
|
+
* paint, and this runs alongside it so a since-pushed base lands a moment
|
|
204
|
+
* later. One fetch per distinct repo, throttled + coalesced per repo (see
|
|
205
|
+
* maybeSyncRepo), so a workspace-heavy account still costs one fetch per repo
|
|
206
|
+
* per interval; the broadcast's change-check no-ops when nothing moved.
|
|
207
|
+
* Best-effort — an offline/no-remote repo keeps its last-known refs.
|
|
208
|
+
*/
|
|
209
|
+
syncAllReposAndRefresh(): Promise<void>;
|
|
210
|
+
delete(id: string): Promise<void>;
|
|
211
|
+
/** Tear down a repo-less chat: stop the agent, drop its scratch dir + log. */
|
|
212
|
+
private deleteChat;
|
|
213
|
+
/**
|
|
214
|
+
* Archive a workspace: a deliberate teardown that force-removes the worktree
|
|
215
|
+
* (discarding any uncommitted changes) and — only when
|
|
216
|
+
* git.deleteBranchOnArchive is set — deletes the *local* branch. The remote
|
|
217
|
+
* (pushed branch, PR, commits on origin) is never touched, so archiving a
|
|
218
|
+
* merged workspace is non-destructive to the shipped work. Distinct from
|
|
219
|
+
* delete, which always preserves the branch (§11).
|
|
220
|
+
*/
|
|
221
|
+
archive(id: string): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Run a prompt-backed agent action (code review, create PR, fix errors,
|
|
224
|
+
* resolve merge conflicts, rename branch). Composes the built-in instruction
|
|
225
|
+
* plus the user's matching prompts.* custom text, then injects it through the
|
|
226
|
+
* normal prompt path — the agent does the work with its own permission-gated
|
|
227
|
+
* tools. Returns false when the workspace is unknown.
|
|
228
|
+
*/
|
|
229
|
+
runAction(id: string, kind: WorkspaceActionKind): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Mass-delete worktrees and/or whole projects. Selected projects contribute
|
|
232
|
+
* all of their remaining worktrees to the removal set (a project can't be
|
|
233
|
+
* deleted while any worktree still references it), then the projects
|
|
234
|
+
* themselves are removed. Each item is attempted independently: a dirty
|
|
235
|
+
* worktree that refuses removal is collected as a failure rather than
|
|
236
|
+
* aborting the rest — and its owning project then fails too (correctly, since
|
|
237
|
+
* it still has a worktree). Callers broadcast fresh lists afterwards.
|
|
238
|
+
*/
|
|
239
|
+
deleteBatch(opts: {
|
|
240
|
+
workspaces?: string[];
|
|
241
|
+
projects?: string[];
|
|
242
|
+
}): Promise<DeleteBatchResultPayload>;
|
|
243
|
+
prompt(id: string, text: string, attachments?: PromptAttachment[]): void;
|
|
244
|
+
/**
|
|
245
|
+
* Interrupt the running agent turn. The session itself survives (its id is
|
|
246
|
+
* persisted), so the next prompt resumes the conversation in a fresh agent.
|
|
247
|
+
*/
|
|
248
|
+
stopAgent(id: string): Promise<void>;
|
|
249
|
+
respondPermission(id: string, requestId: string, decision: PermissionResponse): void;
|
|
250
|
+
answerQuestion(id: string, requestId: string, answers: QuestionAnswers, response?: string): void;
|
|
251
|
+
diff(id: string): Promise<import("./protocol.js").DiffFile[] | null>;
|
|
252
|
+
/** Full-codebase file listing for a workspace. */
|
|
253
|
+
tree(id: string): Promise<string[] | null>;
|
|
254
|
+
/** Read one worktree-relative file (for the in-app viewer). */
|
|
255
|
+
readFile(id: string, path: string): Promise<import("./worktree.js").FileContent | null>;
|
|
256
|
+
/** Overwrite one worktree file (in-app editor save). Returns bytes written, or null for an unknown workspace. */
|
|
257
|
+
writeFile(id: string, path: string, content: string): Promise<number | null>;
|
|
258
|
+
/** Get (or create) a device's terminal slot, re-binding it to `socket`. */
|
|
259
|
+
private deviceTerm;
|
|
260
|
+
/**
|
|
261
|
+
* Dispose any terminal keyed by `deviceId` across every workspace. Called when
|
|
262
|
+
* a socket closes, passing that connection's fallback `connId`: a client that
|
|
263
|
+
* sends no stable deviceId gets a fresh connId per connection, so without this
|
|
264
|
+
* its PTY would leak on every reconnect. Terminals under a *stable* deviceId
|
|
265
|
+
* are intentionally left intact so their scrollback survives a reconnect.
|
|
266
|
+
*/
|
|
267
|
+
reapDevice(deviceId: string): void;
|
|
268
|
+
terminalInput(id: string, deviceId: string, data: string, socket: WebSocket): void;
|
|
269
|
+
terminalResize(id: string, deviceId: string, cols: number, rows: number, socket: WebSocket): void;
|
|
270
|
+
/** This device's retained PTY scrollback ("" until it has started one). */
|
|
271
|
+
terminalSnapshot(id: string, deviceId: string, socket: WebSocket): string | null;
|
|
272
|
+
gitStatus(id: string, sync?: boolean): Promise<import("./protocol.js").GitStatusResultPayload | null>;
|
|
273
|
+
gitCommit(id: string, message: string): Promise<import("./protocol.js").GitResultPayload | null>;
|
|
274
|
+
gitPush(id: string): Promise<import("./protocol.js").GitResultPayload | null>;
|
|
275
|
+
gitResolve(id: string): Promise<import("./protocol.js").GitResultPayload | null>;
|
|
276
|
+
gitMerge(id: string, action: "ours" | "theirs" | "commit" | "abort", paths?: string[]): Promise<import("./protocol.js").GitResultPayload | null>;
|
|
277
|
+
prCreate(id: string, title: string, body?: string): Promise<import("./protocol.js").GitResultPayload | null>;
|
|
278
|
+
/** Merge the workspace branch's open PR on the remote (`gh pr merge`). */
|
|
279
|
+
prMerge(id: string): Promise<import("./protocol.js").GitResultPayload | null>;
|
|
280
|
+
/**
|
|
281
|
+
* Open a GitHub issue from a workspace's output — the mirror of `prCreate`.
|
|
282
|
+
* The result rides the shared `git.result` channel (`op: "issue"`) so clients
|
|
283
|
+
* reuse their existing PR-create plumbing (busy state, result banner).
|
|
284
|
+
*/
|
|
285
|
+
issueCreate(id: string, title: string, body?: string): Promise<{
|
|
286
|
+
ws: string;
|
|
287
|
+
op: "issue";
|
|
288
|
+
ok: boolean;
|
|
289
|
+
message: string;
|
|
290
|
+
url?: undefined;
|
|
291
|
+
} | {
|
|
292
|
+
ws: string;
|
|
293
|
+
op: "issue";
|
|
294
|
+
ok: boolean;
|
|
295
|
+
message: string;
|
|
296
|
+
url: string;
|
|
297
|
+
} | null>;
|
|
298
|
+
open(id: string, target: "finder" | "terminal" | "editor"): Promise<void>;
|
|
299
|
+
private spawnAgent;
|
|
300
|
+
private onAgentEvent;
|
|
301
|
+
private setStatus;
|
|
302
|
+
shutdown(): Promise<void>;
|
|
303
|
+
}
|