@sift-wiki/conductor 0.1.0 → 0.2.0-beta.2
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/README.md +28 -58
- package/dist/adapters/claudeAgent.js +1 -0
- package/dist/adapters/claudeAgent.js.map +1 -1
- package/dist/adapters/codexAgent.js +1 -0
- package/dist/adapters/codexAgent.js.map +1 -1
- package/dist/adapters/fakeAgent.js +1 -0
- package/dist/adapters/fakeAgent.js.map +1 -1
- package/dist/adapters/httpAgent.js +1 -0
- package/dist/adapters/httpAgent.js.map +1 -1
- package/dist/adapters/processAgent.js +4 -0
- package/dist/adapters/processAgent.js.map +1 -1
- package/dist/adapters/provider/runProvider.js +4 -0
- package/dist/adapters/provider/runProvider.js.map +1 -1
- package/dist/adapters/provider/store.js +3 -4
- package/dist/adapters/provider/store.js.map +1 -1
- package/dist/adapters/types.d.ts +9 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.js +44 -3
- package/dist/cli.js.map +1 -1
- package/dist/conductorClient.d.ts +245 -17
- package/dist/conductorClient.js +147 -38
- package/dist/conductorClient.js.map +1 -1
- package/dist/config.js +4 -5
- package/dist/config.js.map +1 -1
- package/dist/daemon.d.ts +23 -6
- package/dist/daemon.js +173 -95
- package/dist/daemon.js.map +1 -1
- package/dist/desktop/app/contracts.d.ts +71 -0
- package/dist/desktop/app/contracts.js +19 -0
- package/dist/desktop/app/contracts.js.map +1 -0
- package/dist/desktop/app/controller.d.ts +58 -0
- package/dist/desktop/app/controller.js +161 -0
- package/dist/desktop/app/controller.js.map +1 -0
- package/dist/desktop/app/runtimeController.d.ts +29 -0
- package/dist/desktop/app/runtimeController.js +55 -0
- package/dist/desktop/app/runtimeController.js.map +1 -0
- package/dist/localApi/authorizedPairing.d.ts +12 -0
- package/dist/localApi/authorizedPairing.js +18 -0
- package/dist/localApi/authorizedPairing.js.map +1 -0
- package/dist/localApi/contracts.d.ts +264 -0
- package/dist/localApi/contracts.js +191 -0
- package/dist/localApi/contracts.js.map +1 -0
- package/dist/localApi/recovery.d.ts +66 -0
- package/dist/localApi/recovery.js +115 -0
- package/dist/localApi/recovery.js.map +1 -0
- package/dist/localApi/server.d.ts +20 -0
- package/dist/localApi/server.js +414 -0
- package/dist/localApi/server.js.map +1 -0
- package/dist/localApi/workConsole.d.ts +74 -0
- package/dist/localApi/workConsole.js +342 -0
- package/dist/localApi/workConsole.js.map +1 -0
- package/dist/localApi/workContracts.d.ts +213 -0
- package/dist/localApi/workContracts.js +130 -0
- package/dist/localApi/workContracts.js.map +1 -0
- package/dist/localApp/platform.d.ts +2 -0
- package/dist/localApp/platform.js +57 -0
- package/dist/localApp/platform.js.map +1 -0
- package/dist/localApp/service.d.ts +25 -0
- package/dist/localApp/service.js +126 -0
- package/dist/localApp/service.js.map +1 -0
- package/dist/protocol/fenced.d.ts +135 -0
- package/dist/protocol/fenced.js +142 -0
- package/dist/protocol/fenced.js.map +1 -0
- package/dist/redaction.js +2 -0
- package/dist/redaction.js.map +1 -1
- package/dist/runtime/atomicFile.d.ts +6 -0
- package/dist/runtime/atomicFile.js +78 -0
- package/dist/runtime/atomicFile.js.map +1 -0
- package/dist/runtime/daemonCapabilities.d.ts +7 -0
- package/dist/runtime/daemonCapabilities.js +24 -0
- package/dist/runtime/daemonCapabilities.js.map +1 -0
- package/dist/runtime/eventOutbox.d.ts +100 -0
- package/dist/runtime/eventOutbox.js +206 -0
- package/dist/runtime/eventOutbox.js.map +1 -0
- package/dist/runtime/executionJournal.d.ts +102 -0
- package/dist/runtime/executionJournal.js +209 -0
- package/dist/runtime/executionJournal.js.map +1 -0
- package/dist/runtime/executionSafety.d.ts +76 -0
- package/dist/runtime/executionSafety.js +207 -0
- package/dist/runtime/executionSafety.js.map +1 -0
- package/dist/runtime/fencedExecutionState.d.ts +43 -0
- package/dist/runtime/fencedExecutionState.js +158 -0
- package/dist/runtime/fencedExecutionState.js.map +1 -0
- package/dist/runtime/leaseManager.d.ts +38 -0
- package/dist/runtime/leaseManager.js +102 -0
- package/dist/runtime/leaseManager.js.map +1 -0
- package/dist/runtime/localLogSpool.d.ts +1 -0
- package/dist/runtime/localLogSpool.js +4 -0
- package/dist/runtime/localLogSpool.js.map +1 -1
- package/dist/runtime/localRunQueue.d.ts +1 -1
- package/dist/runtime/localRunQueue.js +8 -0
- package/dist/runtime/localRunQueue.js.map +1 -1
- package/dist/runtime/localSessionCache.d.ts +1 -1
- package/dist/runtime/localSessionCache.js.map +1 -1
- package/dist/runtime/process.d.ts +13 -1
- package/dist/runtime/process.js +39 -9
- package/dist/runtime/process.js.map +1 -1
- package/dist/runtime/recoveryCoordinator.d.ts +19 -0
- package/dist/runtime/recoveryCoordinator.js +183 -0
- package/dist/runtime/recoveryCoordinator.js.map +1 -0
- package/dist/runtime/runtimeLock.d.ts +33 -0
- package/dist/runtime/runtimeLock.js +140 -0
- package/dist/runtime/runtimeLock.js.map +1 -0
- package/dist/runtime/runtimeService.d.ts +6 -1
- package/dist/runtime/runtimeService.js +54 -20
- package/dist/runtime/runtimeService.js.map +1 -1
- package/dist/runtime/taskExecution.d.ts +2 -0
- package/dist/runtime/taskExecution.js +18 -12
- package/dist/runtime/taskExecution.js.map +1 -1
- package/dist/types.d.ts +28 -13
- package/dist/userAuth/service.d.ts +26 -0
- package/dist/userAuth/service.js +170 -0
- package/dist/userAuth/service.js.map +1 -0
- package/dist/userAuth/store.d.ts +42 -0
- package/dist/userAuth/store.js +160 -0
- package/dist/userAuth/store.js.map +1 -0
- package/dist/userAuth/types.d.ts +63 -0
- package/dist/userAuth/types.js +29 -0
- package/dist/userAuth/types.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/workTypes.d.ts +162 -31
- package/dist/workTypes.js +31 -0
- package/dist/workTypes.js.map +1 -1
- package/dist-web/assets/index-CWAdDb9V.js +72 -0
- package/dist-web/assets/index-CWfnzdLn.css +1 -0
- package/dist-web/index.html +15 -0
- package/docs/provider-setup.md +81 -0
- package/docs/quickstart.md +62 -0
- package/docs/troubleshooting.md +63 -0
- package/package.json +13 -3
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ProviderSetupService } from "../../adapters/provider/setup.js";
|
|
4
|
+
import { createProviderAgentConfig, ProviderAgentStore, } from "../../adapters/provider/store.js";
|
|
5
|
+
import { FileConfigStore } from "../../config.js";
|
|
6
|
+
import { ConductorHttpClient } from "../../conductorClient.js";
|
|
7
|
+
import { logoutDesktopConductor, pairDesktopConductor, readDesktopSafeStatus, } from "../pairing.js";
|
|
8
|
+
import { DesktopRuntimeController } from "./runtimeController.js";
|
|
9
|
+
const providerSchema = z.enum(["codex", "claude-code"]);
|
|
10
|
+
const accessProfileSchema = z.enum(["inspect", "workspace"]);
|
|
11
|
+
const draftSchema = z.object({
|
|
12
|
+
provider: providerSchema,
|
|
13
|
+
displayName: z.string().trim().min(1).max(100),
|
|
14
|
+
folderToken: z.string().min(1),
|
|
15
|
+
accessProfile: accessProfileSchema,
|
|
16
|
+
model: z.string().trim().min(1).max(200).optional(),
|
|
17
|
+
}).strict();
|
|
18
|
+
const pairSchema = z.object({
|
|
19
|
+
apiBaseUrl: z.url(),
|
|
20
|
+
code: z.string().min(1),
|
|
21
|
+
displayName: z.string().trim().min(1).max(100),
|
|
22
|
+
}).strict();
|
|
23
|
+
export class DesktopController {
|
|
24
|
+
deps;
|
|
25
|
+
configStore;
|
|
26
|
+
agentStore;
|
|
27
|
+
setup;
|
|
28
|
+
runtime;
|
|
29
|
+
folderTokens = new Map();
|
|
30
|
+
nextFolderToken = 1;
|
|
31
|
+
constructor(deps) {
|
|
32
|
+
this.deps = deps;
|
|
33
|
+
this.configStore = deps.configStore ?? new FileConfigStore();
|
|
34
|
+
this.agentStore = deps.agentStore ?? new ProviderAgentStore();
|
|
35
|
+
this.setup = deps.setup ?? new ProviderSetupService({
|
|
36
|
+
store: this.agentStore,
|
|
37
|
+
advertise: (agent) => this.advertise(agent),
|
|
38
|
+
});
|
|
39
|
+
this.runtime = deps.runtime ?? new DesktopRuntimeController({
|
|
40
|
+
configStore: this.configStore,
|
|
41
|
+
agentStore: this.agentStore,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
pairedStatus() {
|
|
45
|
+
return readDesktopSafeStatus(this.configStore);
|
|
46
|
+
}
|
|
47
|
+
pair(input) {
|
|
48
|
+
const parsed = pairSchema.parse(input);
|
|
49
|
+
return pairDesktopConductor({
|
|
50
|
+
...parsed,
|
|
51
|
+
client: new ConductorHttpClient({ apiBaseUrl: parsed.apiBaseUrl }),
|
|
52
|
+
store: this.configStore,
|
|
53
|
+
capabilities: { platform: process.platform, adapters: ["codex", "claude-code"] },
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async logout() {
|
|
57
|
+
await this.runtime.stop();
|
|
58
|
+
return logoutDesktopConductor(this.configStore);
|
|
59
|
+
}
|
|
60
|
+
listAgents() {
|
|
61
|
+
return this.setup.list();
|
|
62
|
+
}
|
|
63
|
+
async selectFolder() {
|
|
64
|
+
const selected = await this.deps.selectFolder();
|
|
65
|
+
if (selected === undefined)
|
|
66
|
+
return undefined;
|
|
67
|
+
const token = `folder-${String(this.nextFolderToken)}`;
|
|
68
|
+
this.nextFolderToken += 1;
|
|
69
|
+
this.folderTokens.set(token, selected);
|
|
70
|
+
return { token, name: path.basename(selected) };
|
|
71
|
+
}
|
|
72
|
+
async inspectDraft(input) {
|
|
73
|
+
const config = this.configFromDraft(draftSchema.parse(input));
|
|
74
|
+
const view = await this.setup.inspect(config);
|
|
75
|
+
return {
|
|
76
|
+
status: view.status,
|
|
77
|
+
message: view.message,
|
|
78
|
+
...(view.hint === undefined ? {} : { hint: view.hint }),
|
|
79
|
+
...(view.remediation === undefined ? {} : { remediation: view.remediation }),
|
|
80
|
+
...(view.providerVersion === undefined ? {} : { providerVersion: view.providerVersion }),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
login(input) {
|
|
84
|
+
return this.setup.login(this.configFromDraft(draftSchema.parse(input)));
|
|
85
|
+
}
|
|
86
|
+
async verifyAndAdd(input) {
|
|
87
|
+
const view = await this.setup.verifyAndSave(this.configFromDraft(draftSchema.parse(input)));
|
|
88
|
+
await this.runtime.refreshAdapters();
|
|
89
|
+
return view;
|
|
90
|
+
}
|
|
91
|
+
async updateAgent(input) {
|
|
92
|
+
const parsed = z.object({
|
|
93
|
+
localKey: z.string().min(1),
|
|
94
|
+
displayName: z.string().trim().min(1).max(100),
|
|
95
|
+
accessProfile: accessProfileSchema,
|
|
96
|
+
folderToken: z.string().min(1).optional(),
|
|
97
|
+
}).strict().parse(input);
|
|
98
|
+
const existing = (await this.agentStore.read()).find((agent) => agent.localKey === parsed.localKey);
|
|
99
|
+
if (existing === undefined)
|
|
100
|
+
throw new Error("Local agent was not found.");
|
|
101
|
+
const workspacePath = parsed.folderToken === undefined
|
|
102
|
+
? existing.workspacePath
|
|
103
|
+
: this.requiredFolder(parsed.folderToken);
|
|
104
|
+
const view = await this.setup.verifyAndSave({
|
|
105
|
+
...existing,
|
|
106
|
+
displayName: parsed.displayName,
|
|
107
|
+
accessProfile: parsed.accessProfile,
|
|
108
|
+
workspacePath,
|
|
109
|
+
enabled: true,
|
|
110
|
+
});
|
|
111
|
+
await this.runtime.refreshAdapters();
|
|
112
|
+
return view;
|
|
113
|
+
}
|
|
114
|
+
async pauseAgent(localKey, paused) {
|
|
115
|
+
const view = await this.setup.pause(z.string().min(1).parse(localKey), z.boolean().parse(paused));
|
|
116
|
+
await this.runtime.refreshAdapters();
|
|
117
|
+
return view;
|
|
118
|
+
}
|
|
119
|
+
async removeAgent(localKey) {
|
|
120
|
+
await this.setup.remove(z.string().min(1).parse(localKey));
|
|
121
|
+
await this.runtime.refreshAdapters();
|
|
122
|
+
}
|
|
123
|
+
installPlan(provider) {
|
|
124
|
+
return Promise.resolve(this.setup.installPlan(providerSchema.parse(provider)));
|
|
125
|
+
}
|
|
126
|
+
async openOfficialProviderPage(provider) {
|
|
127
|
+
await this.deps.openExternal(this.setup.installPlan(providerSchema.parse(provider)).officialUrl);
|
|
128
|
+
}
|
|
129
|
+
runtimeStatus() {
|
|
130
|
+
return Promise.resolve(this.runtime.status());
|
|
131
|
+
}
|
|
132
|
+
startRuntime() {
|
|
133
|
+
return this.runtime.start();
|
|
134
|
+
}
|
|
135
|
+
stopRuntime() {
|
|
136
|
+
return this.runtime.stop();
|
|
137
|
+
}
|
|
138
|
+
configFromDraft(input) {
|
|
139
|
+
return createProviderAgentConfig({
|
|
140
|
+
provider: input.provider,
|
|
141
|
+
displayName: input.displayName,
|
|
142
|
+
workspacePath: this.requiredFolder(input.folderToken),
|
|
143
|
+
accessProfile: input.accessProfile,
|
|
144
|
+
...(input.model === undefined ? {} : { model: input.model }),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
requiredFolder(token) {
|
|
148
|
+
const selected = this.folderTokens.get(token);
|
|
149
|
+
if (selected === undefined)
|
|
150
|
+
throw new Error("Selected folder expired. Choose the folder again.");
|
|
151
|
+
return selected;
|
|
152
|
+
}
|
|
153
|
+
async advertise(agent) {
|
|
154
|
+
const config = await this.configStore.read();
|
|
155
|
+
if (config === undefined)
|
|
156
|
+
throw new Error("Pair this Conductor before adding an agent.");
|
|
157
|
+
const client = new ConductorHttpClient({ apiBaseUrl: config.apiBaseUrl });
|
|
158
|
+
await client.advertiseAgents(config.credential, [agent]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/desktop/app/controller.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO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C,mDAAmD,CAAC,CAAC;QACjG,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEO,KAAK,CAAC,SAAS,CAAC,KAAoE;QAC1F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;QAC7C,IAAI,MAAM,KAAK,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACzF,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;QAC1E,MAAM,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ProviderAgentStore } from "../../adapters/provider/store.js";
|
|
2
|
+
import { FileConfigStore } from "../../config.js";
|
|
3
|
+
import { type RuntimeServiceStatus } from "../../runtime/runtimeService.js";
|
|
4
|
+
import { RuntimeIdentityLock } from "../../runtime/runtimeLock.js";
|
|
5
|
+
import type { LocalRuntimeSessionCache } from "../../runtime/localSessionCache.js";
|
|
6
|
+
import type { LocalLogSpool } from "../../runtime/localLogSpool.js";
|
|
7
|
+
import type { RunEventRetryBuffer } from "../../runtime/runEventRetryBuffer.js";
|
|
8
|
+
import { ExecutionJournalStore } from "../../runtime/executionJournal.js";
|
|
9
|
+
import { DurableEventOutbox } from "../../runtime/eventOutbox.js";
|
|
10
|
+
export declare class DesktopRuntimeController {
|
|
11
|
+
private readonly deps;
|
|
12
|
+
private service;
|
|
13
|
+
private readonly adapters;
|
|
14
|
+
constructor(deps: {
|
|
15
|
+
configStore: FileConfigStore;
|
|
16
|
+
agentStore: ProviderAgentStore;
|
|
17
|
+
sessionCache?: LocalRuntimeSessionCache | undefined;
|
|
18
|
+
logSpool?: LocalLogSpool | undefined;
|
|
19
|
+
eventRetryBuffer?: RunEventRetryBuffer | undefined;
|
|
20
|
+
runtimeLock?: RuntimeIdentityLock | undefined;
|
|
21
|
+
journalStore?: ExecutionJournalStore | undefined;
|
|
22
|
+
eventOutbox?: DurableEventOutbox | undefined;
|
|
23
|
+
});
|
|
24
|
+
status(): RuntimeServiceStatus;
|
|
25
|
+
start(): Promise<RuntimeServiceStatus>;
|
|
26
|
+
stop(): Promise<RuntimeServiceStatus>;
|
|
27
|
+
restart(): Promise<RuntimeServiceStatus>;
|
|
28
|
+
refreshAdapters(): Promise<RuntimeServiceStatus>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createConfiguredAdapters } from "../../adapters/config.js";
|
|
2
|
+
import { ConductorHttpClient } from "../../conductorClient.js";
|
|
3
|
+
import { HeadlessRuntimeService } from "../../runtime/runtimeService.js";
|
|
4
|
+
import { RuntimeIdentityLock } from "../../runtime/runtimeLock.js";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { ExecutionJournalStore } from "../../runtime/executionJournal.js";
|
|
7
|
+
import { DurableEventOutbox } from "../../runtime/eventOutbox.js";
|
|
8
|
+
export class DesktopRuntimeController {
|
|
9
|
+
deps;
|
|
10
|
+
service;
|
|
11
|
+
adapters = [];
|
|
12
|
+
constructor(deps) {
|
|
13
|
+
this.deps = deps;
|
|
14
|
+
}
|
|
15
|
+
status() {
|
|
16
|
+
return this.service?.status() ?? { state: "stopped" };
|
|
17
|
+
}
|
|
18
|
+
async start() {
|
|
19
|
+
if (this.service?.status().state === "running")
|
|
20
|
+
return this.service.status();
|
|
21
|
+
const paired = await this.deps.configStore.read();
|
|
22
|
+
if (paired === undefined)
|
|
23
|
+
throw new Error("Pair this Conductor before starting the runtime.");
|
|
24
|
+
await this.refreshAdapters();
|
|
25
|
+
const client = new ConductorHttpClient({ apiBaseUrl: paired.apiBaseUrl });
|
|
26
|
+
this.service = new HeadlessRuntimeService({
|
|
27
|
+
store: this.deps.configStore,
|
|
28
|
+
client,
|
|
29
|
+
workClient: client,
|
|
30
|
+
adapters: this.adapters,
|
|
31
|
+
sessionCache: this.deps.sessionCache,
|
|
32
|
+
logSpool: this.deps.logSpool,
|
|
33
|
+
eventRetryBuffer: this.deps.eventRetryBuffer,
|
|
34
|
+
journalStore: this.deps.journalStore ?? new ExecutionJournalStore(path.join(path.dirname(this.deps.configStore.path), "runtime", "executions")),
|
|
35
|
+
eventOutbox: this.deps.eventOutbox ?? new DurableEventOutbox(path.join(path.dirname(this.deps.configStore.path), "runtime", "event-outbox.json")),
|
|
36
|
+
}, this.deps.runtimeLock ?? new RuntimeIdentityLock(path.join(path.dirname(this.deps.configStore.path), "runtime", "conductor.lock")));
|
|
37
|
+
return this.service.start();
|
|
38
|
+
}
|
|
39
|
+
async stop() {
|
|
40
|
+
if (this.service === undefined)
|
|
41
|
+
return { state: "stopped" };
|
|
42
|
+
return this.service.stop();
|
|
43
|
+
}
|
|
44
|
+
async restart() {
|
|
45
|
+
if (this.service === undefined)
|
|
46
|
+
return this.start();
|
|
47
|
+
return this.service.restart();
|
|
48
|
+
}
|
|
49
|
+
async refreshAdapters() {
|
|
50
|
+
const next = createConfiguredAdapters(await this.deps.agentStore.read());
|
|
51
|
+
this.adapters.splice(0, this.adapters.length, ...next);
|
|
52
|
+
return this.status();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=runtimeController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeController.js","sourceRoot":"","sources":["../../../src/desktop/app/runtimeController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,sBAAsB,EAA6B,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,OAAO,EAAE,qBAAqB,EAAE,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IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ConductorHttpClient } from "../conductorClient.js";
|
|
2
|
+
import type { DesktopConductorApi } from "../desktop/app/contracts.js";
|
|
3
|
+
import type { ConductorUserAuthorizationService } from "../userAuth/service.js";
|
|
4
|
+
export declare class AuthorizedPairingService {
|
|
5
|
+
private readonly input;
|
|
6
|
+
constructor(input: {
|
|
7
|
+
authorization: Pick<ConductorUserAuthorizationService, "status" | "credential">;
|
|
8
|
+
controller: Pick<DesktopConductorApi, "pair">;
|
|
9
|
+
createClient?: ((apiBaseUrl: string, workspaceId: string) => Pick<ConductorHttpClient, "createPairingCode">) | undefined;
|
|
10
|
+
});
|
|
11
|
+
pair(displayName: string): Promise<import("../pairing.js").SafeStatus>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ConductorHttpClient } from "../conductorClient.js";
|
|
2
|
+
export class AuthorizedPairingService {
|
|
3
|
+
input;
|
|
4
|
+
constructor(input) {
|
|
5
|
+
this.input = input;
|
|
6
|
+
}
|
|
7
|
+
async pair(displayName) {
|
|
8
|
+
const status = await this.input.authorization.status();
|
|
9
|
+
if (status.state !== "authorized") {
|
|
10
|
+
throw new Error("Sign in to Sift before connecting this computer automatically.");
|
|
11
|
+
}
|
|
12
|
+
const client = (this.input.createClient ?? ((apiBaseUrl, workspaceId) => new ConductorHttpClient({ apiBaseUrl, userWorkspaceId: workspaceId })))(status.apiBaseUrl, status.workspaceId);
|
|
13
|
+
const credential = await this.input.authorization.credential();
|
|
14
|
+
const pairing = await client.createPairingCode(credential, displayName);
|
|
15
|
+
return this.input.controller.pair({ apiBaseUrl: status.apiBaseUrl, code: pairing.code, displayName });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=authorizedPairing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorizedPairing.js","sourceRoot":"","sources":["../../src/localApi/authorizedPairing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI5D,MAAM,OAAO,wBAAwB;IACN;IAA7B,YAA6B,KAI5B;QAJ4B,UAAK,GAAL,KAAK,CAIjC;IAAG,CAAC;IAEL,KAAK,CAAC,IAAI,CAAC,WAAmB;QAC5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;QACvD,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACpF,CAAC;QACD,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC,UAAU,EAAE,WAAW,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;QACxL,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC;QAC/D,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;IACxG,CAAC;CACF"}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ProviderAgentView, ProviderInstallPlan } from "../adapters/provider/setup.js";
|
|
3
|
+
import type { ProviderAccessProfile, ProviderType } from "../adapters/provider/types.js";
|
|
4
|
+
import type { DesktopConductorApi, DesktopPairRequest, ProviderDraft, ProviderDraftStatus, SelectedFolder } from "../desktop/app/contracts.js";
|
|
5
|
+
import type { RuntimeServiceStatus } from "../runtime/runtimeService.js";
|
|
6
|
+
import { type UserAuthorizationStatus } from "../userAuth/types.js";
|
|
7
|
+
import { localRecoveryActionSchema, localRecoveryProjectionSchema, type LocalRecoveryAction, type LocalRecoveryProjection } from "./recovery.js";
|
|
8
|
+
import type { WorkConsoleSnapshot, createTaskRequestSchema, updateTaskRequestSchema, commentTaskRequestSchema, dispatchTaskRequestSchema, approvalDecisionRequestSchema } from "./workContracts.js";
|
|
9
|
+
export type LocalPairingStatus = {
|
|
10
|
+
paired: false;
|
|
11
|
+
} | {
|
|
12
|
+
paired: true;
|
|
13
|
+
apiBaseUrl: string;
|
|
14
|
+
conductorId?: string | undefined;
|
|
15
|
+
displayName: string;
|
|
16
|
+
protocolVersion: string;
|
|
17
|
+
};
|
|
18
|
+
export type LocalHealth = {
|
|
19
|
+
ok: true;
|
|
20
|
+
version: string;
|
|
21
|
+
protocolVersion: string;
|
|
22
|
+
};
|
|
23
|
+
export type LocalSessionStatus = {
|
|
24
|
+
authenticated: true;
|
|
25
|
+
csrfToken: string;
|
|
26
|
+
expiresAt: string;
|
|
27
|
+
};
|
|
28
|
+
export type ConductorLocalApi = {
|
|
29
|
+
health(): Promise<LocalHealth>;
|
|
30
|
+
pairedStatus(): Promise<LocalPairingStatus>;
|
|
31
|
+
pair(input: DesktopPairRequest): Promise<LocalPairingStatus>;
|
|
32
|
+
pairAuthorized(displayName: string): Promise<LocalPairingStatus>;
|
|
33
|
+
logout(): Promise<LocalPairingStatus>;
|
|
34
|
+
listAgents(): Promise<ProviderAgentView[]>;
|
|
35
|
+
selectFolder(): Promise<SelectedFolder | undefined>;
|
|
36
|
+
inspectDraft(input: ProviderDraft): Promise<ProviderDraftStatus>;
|
|
37
|
+
login(input: ProviderDraft): Promise<{
|
|
38
|
+
ok: boolean;
|
|
39
|
+
message: string;
|
|
40
|
+
}>;
|
|
41
|
+
verifyAndAdd(input: ProviderDraft): Promise<ProviderAgentView>;
|
|
42
|
+
updateAgent(input: {
|
|
43
|
+
localKey: string;
|
|
44
|
+
displayName: string;
|
|
45
|
+
accessProfile: ProviderAccessProfile;
|
|
46
|
+
folderToken?: string | undefined;
|
|
47
|
+
}): Promise<ProviderAgentView>;
|
|
48
|
+
pauseAgent(localKey: string, paused: boolean): Promise<ProviderAgentView>;
|
|
49
|
+
removeAgent(localKey: string): Promise<void>;
|
|
50
|
+
installPlan(provider: ProviderType): Promise<ProviderInstallPlan>;
|
|
51
|
+
openOfficialProviderPage(provider: ProviderType): Promise<void>;
|
|
52
|
+
runtimeStatus(): Promise<RuntimeServiceStatus>;
|
|
53
|
+
startRuntime(): Promise<RuntimeServiceStatus>;
|
|
54
|
+
stopRuntime(): Promise<RuntimeServiceStatus>;
|
|
55
|
+
recoveryStatus(): Promise<LocalRecoveryProjection>;
|
|
56
|
+
performRecoveryAction(action: LocalRecoveryAction): Promise<LocalRecoveryProjection>;
|
|
57
|
+
clearLocalDiagnostics(): Promise<void>;
|
|
58
|
+
userAuthorizationStatus(): Promise<UserAuthorizationStatus>;
|
|
59
|
+
beginUserAuthorization(input?: {
|
|
60
|
+
apiBaseUrl?: string | undefined;
|
|
61
|
+
deviceLabel?: string | undefined;
|
|
62
|
+
}): Promise<UserAuthorizationStatus>;
|
|
63
|
+
signOutUser(): Promise<UserAuthorizationStatus>;
|
|
64
|
+
workSnapshot(input: {
|
|
65
|
+
projectId?: string | undefined;
|
|
66
|
+
taskId?: string | undefined;
|
|
67
|
+
}): Promise<WorkConsoleSnapshot>;
|
|
68
|
+
createTask(input: z.infer<typeof createTaskRequestSchema>): Promise<unknown>;
|
|
69
|
+
updateTask(input: z.infer<typeof updateTaskRequestSchema>): Promise<unknown>;
|
|
70
|
+
commentTask(input: z.infer<typeof commentTaskRequestSchema>): Promise<unknown>;
|
|
71
|
+
dispatchTask(input: z.infer<typeof dispatchTaskRequestSchema>): Promise<unknown>;
|
|
72
|
+
decideApproval(input: z.infer<typeof approvalDecisionRequestSchema>): Promise<unknown>;
|
|
73
|
+
cancelRun(runId: string): Promise<unknown>;
|
|
74
|
+
};
|
|
75
|
+
export declare const localPairingStatusSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
76
|
+
paired: z.ZodLiteral<false>;
|
|
77
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
78
|
+
paired: z.ZodLiteral<true>;
|
|
79
|
+
apiBaseUrl: z.ZodURL;
|
|
80
|
+
conductorId: z.ZodOptional<z.ZodString>;
|
|
81
|
+
displayName: z.ZodString;
|
|
82
|
+
protocolVersion: z.ZodString;
|
|
83
|
+
}, z.core.$strict>], "paired">;
|
|
84
|
+
export declare const localHealthSchema: z.ZodObject<{
|
|
85
|
+
ok: z.ZodLiteral<true>;
|
|
86
|
+
version: z.ZodString;
|
|
87
|
+
protocolVersion: z.ZodString;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
export declare const runtimeServiceStatusSchema: z.ZodObject<{
|
|
90
|
+
state: z.ZodEnum<{
|
|
91
|
+
failed: "failed";
|
|
92
|
+
starting: "starting";
|
|
93
|
+
running: "running";
|
|
94
|
+
stopping: "stopping";
|
|
95
|
+
stopped: "stopped";
|
|
96
|
+
}>;
|
|
97
|
+
startedAt: z.ZodOptional<z.ZodString>;
|
|
98
|
+
stoppedAt: z.ZodOptional<z.ZodString>;
|
|
99
|
+
lastResult: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
100
|
+
status: z.ZodLiteral<"idle">;
|
|
101
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
102
|
+
status: z.ZodLiteral<"completed">;
|
|
103
|
+
runId: z.ZodString;
|
|
104
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
105
|
+
status: z.ZodLiteral<"cancelled">;
|
|
106
|
+
runId: z.ZodString;
|
|
107
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
108
|
+
status: z.ZodLiteral<"interrupted">;
|
|
109
|
+
runId: z.ZodString;
|
|
110
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
111
|
+
status: z.ZodLiteral<"failed">;
|
|
112
|
+
runId: z.ZodString;
|
|
113
|
+
}, z.core.$strict>], "status">>;
|
|
114
|
+
lastErrorMessage: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strict>;
|
|
116
|
+
export declare const providerAgentViewSchema: z.ZodObject<{
|
|
117
|
+
localKey: z.ZodString;
|
|
118
|
+
displayName: z.ZodString;
|
|
119
|
+
provider: z.ZodEnum<{
|
|
120
|
+
codex: "codex";
|
|
121
|
+
"claude-code": "claude-code";
|
|
122
|
+
}>;
|
|
123
|
+
workspaceName: z.ZodString;
|
|
124
|
+
accessProfile: z.ZodEnum<{
|
|
125
|
+
inspect: "inspect";
|
|
126
|
+
workspace: "workspace";
|
|
127
|
+
}>;
|
|
128
|
+
enabled: z.ZodBoolean;
|
|
129
|
+
status: z.ZodEnum<{
|
|
130
|
+
error: "error";
|
|
131
|
+
ready: "ready";
|
|
132
|
+
}>;
|
|
133
|
+
message: z.ZodString;
|
|
134
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
135
|
+
remediation: z.ZodOptional<z.ZodEnum<{
|
|
136
|
+
resume: "resume";
|
|
137
|
+
install: "install";
|
|
138
|
+
login: "login";
|
|
139
|
+
upgrade: "upgrade";
|
|
140
|
+
"select-folder": "select-folder";
|
|
141
|
+
retry: "retry";
|
|
142
|
+
}>>;
|
|
143
|
+
providerVersion: z.ZodOptional<z.ZodString>;
|
|
144
|
+
}, z.core.$strict>;
|
|
145
|
+
export declare const selectedFolderSchema: z.ZodObject<{
|
|
146
|
+
token: z.ZodString;
|
|
147
|
+
name: z.ZodString;
|
|
148
|
+
}, z.core.$strict>;
|
|
149
|
+
export declare const providerDraftStatusSchema: z.ZodObject<{
|
|
150
|
+
status: z.ZodEnum<{
|
|
151
|
+
error: "error";
|
|
152
|
+
ready: "ready";
|
|
153
|
+
}>;
|
|
154
|
+
message: z.ZodString;
|
|
155
|
+
hint: z.ZodOptional<z.ZodString>;
|
|
156
|
+
remediation: z.ZodOptional<z.ZodEnum<{
|
|
157
|
+
resume: "resume";
|
|
158
|
+
install: "install";
|
|
159
|
+
login: "login";
|
|
160
|
+
upgrade: "upgrade";
|
|
161
|
+
"select-folder": "select-folder";
|
|
162
|
+
retry: "retry";
|
|
163
|
+
}>>;
|
|
164
|
+
providerVersion: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strict>;
|
|
166
|
+
export declare const providerInstallPlanSchema: z.ZodObject<{
|
|
167
|
+
provider: z.ZodEnum<{
|
|
168
|
+
codex: "codex";
|
|
169
|
+
"claude-code": "claude-code";
|
|
170
|
+
}>;
|
|
171
|
+
title: z.ZodString;
|
|
172
|
+
source: z.ZodString;
|
|
173
|
+
command: z.ZodOptional<z.ZodString>;
|
|
174
|
+
officialUrl: z.ZodURL;
|
|
175
|
+
}, z.core.$strict>;
|
|
176
|
+
export declare const providerLoginResultSchema: z.ZodObject<{
|
|
177
|
+
ok: z.ZodBoolean;
|
|
178
|
+
message: z.ZodString;
|
|
179
|
+
}, z.core.$strict>;
|
|
180
|
+
export declare const localSessionStatusSchema: z.ZodObject<{
|
|
181
|
+
authenticated: z.ZodLiteral<true>;
|
|
182
|
+
csrfToken: z.ZodString;
|
|
183
|
+
expiresAt: z.ZodISODateTime;
|
|
184
|
+
}, z.core.$strict>;
|
|
185
|
+
export declare const localPairRequestSchema: z.ZodObject<{
|
|
186
|
+
apiBaseUrl: z.ZodURL;
|
|
187
|
+
code: z.ZodString;
|
|
188
|
+
displayName: z.ZodString;
|
|
189
|
+
}, z.core.$strict>;
|
|
190
|
+
export declare const localAuthorizedPairRequestSchema: z.ZodObject<{
|
|
191
|
+
displayName: z.ZodString;
|
|
192
|
+
}, z.core.$strict>;
|
|
193
|
+
export declare const localUserAuthorizationBeginSchema: z.ZodObject<{
|
|
194
|
+
apiBaseUrl: z.ZodOptional<z.ZodURL>;
|
|
195
|
+
deviceLabel: z.ZodOptional<z.ZodString>;
|
|
196
|
+
}, z.core.$strict>;
|
|
197
|
+
export declare const localProviderDraftSchema: z.ZodObject<{
|
|
198
|
+
provider: z.ZodEnum<{
|
|
199
|
+
codex: "codex";
|
|
200
|
+
"claude-code": "claude-code";
|
|
201
|
+
}>;
|
|
202
|
+
displayName: z.ZodString;
|
|
203
|
+
folderToken: z.ZodString;
|
|
204
|
+
accessProfile: z.ZodEnum<{
|
|
205
|
+
inspect: "inspect";
|
|
206
|
+
workspace: "workspace";
|
|
207
|
+
}>;
|
|
208
|
+
model: z.ZodOptional<z.ZodString>;
|
|
209
|
+
}, z.core.$strict>;
|
|
210
|
+
export declare const localAgentUpdateSchema: z.ZodObject<{
|
|
211
|
+
localKey: z.ZodString;
|
|
212
|
+
displayName: z.ZodString;
|
|
213
|
+
accessProfile: z.ZodEnum<{
|
|
214
|
+
inspect: "inspect";
|
|
215
|
+
workspace: "workspace";
|
|
216
|
+
}>;
|
|
217
|
+
folderToken: z.ZodOptional<z.ZodString>;
|
|
218
|
+
}, z.core.$strict>;
|
|
219
|
+
export declare const localAgentPauseSchema: z.ZodObject<{
|
|
220
|
+
localKey: z.ZodString;
|
|
221
|
+
paused: z.ZodBoolean;
|
|
222
|
+
}, z.core.$strict>;
|
|
223
|
+
export declare const localAgentKeySchema: z.ZodObject<{
|
|
224
|
+
localKey: z.ZodString;
|
|
225
|
+
}, z.core.$strict>;
|
|
226
|
+
export declare const localProviderSchema: z.ZodObject<{
|
|
227
|
+
provider: z.ZodEnum<{
|
|
228
|
+
codex: "codex";
|
|
229
|
+
"claude-code": "claude-code";
|
|
230
|
+
}>;
|
|
231
|
+
}, z.core.$strict>;
|
|
232
|
+
export declare function localHealth(): LocalHealth;
|
|
233
|
+
export declare function createLocalControllerApi(controller: DesktopConductorApi, userAuthorization?: {
|
|
234
|
+
status(): Promise<UserAuthorizationStatus>;
|
|
235
|
+
begin(input?: {
|
|
236
|
+
apiBaseUrl?: string | undefined;
|
|
237
|
+
deviceLabel?: string | undefined;
|
|
238
|
+
}): Promise<UserAuthorizationStatus>;
|
|
239
|
+
signOut(): Promise<UserAuthorizationStatus>;
|
|
240
|
+
}, work?: WorkConsolePort, authorizedPairing?: AuthorizedPairingPort, localDiagnostics?: LocalDiagnosticsPort, recovery?: LocalRecoveryPort): ConductorLocalApi;
|
|
241
|
+
type WorkConsolePort = {
|
|
242
|
+
snapshot(input: {
|
|
243
|
+
projectId?: string | undefined;
|
|
244
|
+
taskId?: string | undefined;
|
|
245
|
+
}): Promise<WorkConsoleSnapshot>;
|
|
246
|
+
createTask(input: z.infer<typeof createTaskRequestSchema>): Promise<unknown>;
|
|
247
|
+
updateTask(input: z.infer<typeof updateTaskRequestSchema>): Promise<unknown>;
|
|
248
|
+
comment(input: z.infer<typeof commentTaskRequestSchema>): Promise<unknown>;
|
|
249
|
+
dispatch(input: z.infer<typeof dispatchTaskRequestSchema>): Promise<unknown>;
|
|
250
|
+
decideApproval(input: z.infer<typeof approvalDecisionRequestSchema>): Promise<unknown>;
|
|
251
|
+
cancelRun(runId: string): Promise<unknown>;
|
|
252
|
+
};
|
|
253
|
+
type AuthorizedPairingPort = {
|
|
254
|
+
pair(displayName: string): ReturnType<DesktopConductorApi["pair"]>;
|
|
255
|
+
};
|
|
256
|
+
type LocalDiagnosticsPort = {
|
|
257
|
+
clear(): Promise<void> | void;
|
|
258
|
+
};
|
|
259
|
+
type LocalRecoveryPort = {
|
|
260
|
+
status(): Promise<LocalRecoveryProjection>;
|
|
261
|
+
perform(action: LocalRecoveryAction): Promise<LocalRecoveryProjection>;
|
|
262
|
+
};
|
|
263
|
+
export { localRecoveryActionSchema, localRecoveryProjectionSchema };
|
|
264
|
+
export type { LocalRecoveryAction, LocalRecoveryProjection };
|