looply-cli 0.5.27 → 0.5.29
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/account-connect.d.ts +66 -0
- package/dist/account-connect.d.ts.map +1 -0
- package/dist/account-connect.js +279 -0
- package/dist/account-connect.js.map +1 -0
- package/dist/bin.d.ts.map +1 -1
- package/dist/bin.js +5 -3
- package/dist/bin.js.map +1 -1
- package/dist/branch-delivery-wiring.d.ts.map +1 -1
- package/dist/branch-delivery-wiring.js +2 -0
- package/dist/branch-delivery-wiring.js.map +1 -1
- package/dist/branch-delivery.d.ts +43 -0
- package/dist/branch-delivery.d.ts.map +1 -1
- package/dist/branch-delivery.js +106 -3
- package/dist/branch-delivery.js.map +1 -1
- package/dist/config.d.ts +5 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/connect-node.d.ts.map +1 -1
- package/dist/connect-node.js +23 -1
- package/dist/connect-node.js.map +1 -1
- package/dist/connect.d.ts +2 -0
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +13 -5
- package/dist/connect.js.map +1 -1
- package/dist/daemon-cmd.d.ts +3 -0
- package/dist/daemon-cmd.d.ts.map +1 -1
- package/dist/daemon-cmd.js +15 -1
- package/dist/daemon-cmd.js.map +1 -1
- package/dist/daemon.d.ts +5 -0
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +4 -0
- package/dist/daemon.js.map +1 -1
- package/dist/effective-gates.d.ts +58 -0
- package/dist/effective-gates.d.ts.map +1 -0
- package/dist/effective-gates.js +153 -0
- package/dist/effective-gates.js.map +1 -0
- package/dist/environment-hold.d.ts.map +1 -1
- package/dist/environment-hold.js +10 -0
- package/dist/environment-hold.js.map +1 -1
- package/dist/feature-report.d.ts +10 -3
- package/dist/feature-report.d.ts.map +1 -1
- package/dist/feature-report.js +44 -1
- package/dist/feature-report.js.map +1 -1
- package/dist/gate-draft.d.ts +16 -0
- package/dist/gate-draft.d.ts.map +1 -1
- package/dist/gate-draft.js +86 -4
- package/dist/gate-draft.js.map +1 -1
- package/dist/gate-health.d.ts +157 -0
- package/dist/gate-health.d.ts.map +1 -0
- package/dist/gate-health.js +432 -0
- package/dist/gate-health.js.map +1 -0
- package/dist/github-api.d.ts +2 -0
- package/dist/github-api.d.ts.map +1 -1
- package/dist/github-api.js +1 -0
- package/dist/github-api.js.map +1 -1
- package/dist/init-detect.d.ts +2 -0
- package/dist/init-detect.d.ts.map +1 -1
- package/dist/init-detect.js +4 -0
- package/dist/init-detect.js.map +1 -1
- package/dist/integration-deps.d.ts.map +1 -1
- package/dist/integration-deps.js +17 -6
- package/dist/integration-deps.js.map +1 -1
- package/dist/machine-secrets.d.ts +6 -1
- package/dist/machine-secrets.d.ts.map +1 -1
- package/dist/machine-secrets.js +13 -1
- package/dist/machine-secrets.js.map +1 -1
- package/dist/model-transport.d.ts.map +1 -1
- package/dist/model-transport.js +18 -1
- package/dist/model-transport.js.map +1 -1
- package/dist/pair-cmd.d.ts +13 -1
- package/dist/pair-cmd.d.ts.map +1 -1
- package/dist/pair-cmd.js +30 -13
- package/dist/pair-cmd.js.map +1 -1
- package/dist/provider-accounts-cmd.d.ts.map +1 -1
- package/dist/provider-accounts-cmd.js +11 -2
- package/dist/provider-accounts-cmd.js.map +1 -1
- package/dist/provider-accounts.d.ts +49 -2
- package/dist/provider-accounts.d.ts.map +1 -1
- package/dist/provider-accounts.js +149 -7
- package/dist/provider-accounts.js.map +1 -1
- package/dist/provider-cmd.d.ts +5 -0
- package/dist/provider-cmd.d.ts.map +1 -1
- package/dist/provider-cmd.js +21 -1
- package/dist/provider-cmd.js.map +1 -1
- package/dist/provider-ready.js +1 -1
- package/dist/provider-ready.js.map +1 -1
- package/dist/run-cmd.d.ts.map +1 -1
- package/dist/run-cmd.js +104 -7
- package/dist/run-cmd.js.map +1 -1
- package/dist/server-client.d.ts +10 -0
- package/dist/server-client.d.ts.map +1 -1
- package/dist/server-client.js +8 -0
- package/dist/server-client.js.map +1 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +5 -1
- package/dist/setup.js.map +1 -1
- package/dist/workspace-provisioner.d.ts +8 -0
- package/dist/workspace-provisioner.d.ts.map +1 -1
- package/dist/workspace-provisioner.js +9 -1
- package/dist/workspace-provisioner.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type AccountsCmdDeps } from './provider-accounts-cmd';
|
|
2
|
+
/**
|
|
3
|
+
* CONNECT A CLAUDE ACCOUNT STARTED IN AUTORYN (core `account-connect.ts`).
|
|
4
|
+
*
|
|
5
|
+
* The heartbeat says a sign-in waits for this machine. One daemon on the machine
|
|
6
|
+
* (a lock file; many daemons serve one machine) runs Claude Code's own sign-in,
|
|
7
|
+
* `claude auth login`, in the account's profile, with no terminal: Claude Code
|
|
8
|
+
* then prints its sign-in link and reads the code from its input. The link goes
|
|
9
|
+
* back to AutoRyn; the code the person pastes there comes back sealed to this
|
|
10
|
+
* machine, is opened here and typed into the waiting sign-in. On success the
|
|
11
|
+
* account is added (or, for an existing sign-in, refreshed) and checked.
|
|
12
|
+
*
|
|
13
|
+
* 🔴 THE CODE IS NEVER LOGGED OR REPORTED, and no browser is opened on this PC:
|
|
14
|
+
* the person signs in wherever they are looking at AutoRyn.
|
|
15
|
+
*/
|
|
16
|
+
export declare const CONNECT_LOCK_FILE = "account-connect.lock";
|
|
17
|
+
/** How often the daemon running a sign-in looks for the code, or for a person cancelling it. */
|
|
18
|
+
export declare const CONNECT_POLL_MS = 3000;
|
|
19
|
+
/** Claude Code prints its link at once; this long without one is a failure. */
|
|
20
|
+
export declare const CONNECT_LINK_TIMEOUT_MS = 60000;
|
|
21
|
+
export interface ConnectClient {
|
|
22
|
+
accountConnect(): Promise<{
|
|
23
|
+
session: unknown;
|
|
24
|
+
sealedCode: string | null;
|
|
25
|
+
}>;
|
|
26
|
+
reportAccountConnect(body: Record<string, unknown>): Promise<{
|
|
27
|
+
session: unknown;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export interface ConnectChild {
|
|
31
|
+
stdin: {
|
|
32
|
+
write(s: string): unknown;
|
|
33
|
+
end(): unknown;
|
|
34
|
+
} | null;
|
|
35
|
+
stdout: {
|
|
36
|
+
on(ev: 'data', fn: (b: Buffer | string) => void): unknown;
|
|
37
|
+
} | null;
|
|
38
|
+
stderr: {
|
|
39
|
+
on(ev: 'data', fn: (b: Buffer | string) => void): unknown;
|
|
40
|
+
} | null;
|
|
41
|
+
on(ev: 'exit', fn: (code: number | null) => void): unknown;
|
|
42
|
+
on(ev: 'error', fn: (e: Error) => void): unknown;
|
|
43
|
+
kill(): unknown;
|
|
44
|
+
}
|
|
45
|
+
export interface ConnectDeps {
|
|
46
|
+
client: ConnectClient;
|
|
47
|
+
log: (line: string) => void;
|
|
48
|
+
/** The accounts commands' dependencies: Claude Code's executable and the readiness check. */
|
|
49
|
+
accounts: () => AccountsCmdDeps | undefined;
|
|
50
|
+
home?: string;
|
|
51
|
+
spawn?: (exe: string, argv: readonly string[], env: Record<string, string>) => ConnectChild;
|
|
52
|
+
sleep?: (ms: number) => Promise<void>;
|
|
53
|
+
now?: () => number;
|
|
54
|
+
pollMs?: number;
|
|
55
|
+
linkTimeoutMs?: number;
|
|
56
|
+
}
|
|
57
|
+
/** The environment Claude Code's sign-in runs with: this profile, no browser, and no credential from this shell. */
|
|
58
|
+
export declare function connectEnv(profileDir: string, base?: NodeJS.ProcessEnv): Record<string, string>;
|
|
59
|
+
/** The plain sentence Claude Code ended with ("Login failed: …"), without any link. */
|
|
60
|
+
export declare function connectProblemOf(output: string): string | null;
|
|
61
|
+
/**
|
|
62
|
+
* Called with the session id the heartbeat named. Returns at once when another
|
|
63
|
+
* daemon (or this one) already runs it, or when there is nothing to start.
|
|
64
|
+
*/
|
|
65
|
+
export declare function makeAccountConnect(deps: ConnectDeps): (turnId: string) => Promise<void>;
|
|
66
|
+
//# sourceMappingURL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NECT_POLL_MS = exports.CONNECT_LOCK_FILE = void 0;
|
|
4
|
+
exports.connectEnv = connectEnv;
|
|
5
|
+
exports.connectProblemOf = connectProblemOf;
|
|
6
|
+
exports.makeAccountConnect = makeAccountConnect;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_os_1 = require("node:os");
|
|
10
|
+
const node_path_1 = require("node:path");
|
|
11
|
+
const core_1 = require("@looply/core");
|
|
12
|
+
const machine_secrets_1 = require("./machine-secrets");
|
|
13
|
+
const provider_accounts_1 = require("./provider-accounts");
|
|
14
|
+
const provider_accounts_cmd_1 = require("./provider-accounts-cmd");
|
|
15
|
+
/**
|
|
16
|
+
* CONNECT A CLAUDE ACCOUNT STARTED IN AUTORYN (core `account-connect.ts`).
|
|
17
|
+
*
|
|
18
|
+
* The heartbeat says a sign-in waits for this machine. One daemon on the machine
|
|
19
|
+
* (a lock file; many daemons serve one machine) runs Claude Code's own sign-in,
|
|
20
|
+
* `claude auth login`, in the account's profile, with no terminal: Claude Code
|
|
21
|
+
* then prints its sign-in link and reads the code from its input. The link goes
|
|
22
|
+
* back to AutoRyn; the code the person pastes there comes back sealed to this
|
|
23
|
+
* machine, is opened here and typed into the waiting sign-in. On success the
|
|
24
|
+
* account is added (or, for an existing sign-in, refreshed) and checked.
|
|
25
|
+
*
|
|
26
|
+
* 🔴 THE CODE IS NEVER LOGGED OR REPORTED, and no browser is opened on this PC:
|
|
27
|
+
* the person signs in wherever they are looking at AutoRyn.
|
|
28
|
+
*/
|
|
29
|
+
exports.CONNECT_LOCK_FILE = 'account-connect.lock';
|
|
30
|
+
/** How often the daemon running a sign-in looks for the code, or for a person cancelling it. */
|
|
31
|
+
exports.CONNECT_POLL_MS = 3000;
|
|
32
|
+
/** Claude Code prints its link at once; this long without one is a failure. */
|
|
33
|
+
exports.CONNECT_LINK_TIMEOUT_MS = 60_000;
|
|
34
|
+
/** Claude Code reads BROWSER: a program that does not exist, so it prints the link instead of opening one here. */
|
|
35
|
+
const NO_BROWSER = 'looply-no-browser';
|
|
36
|
+
/** The environment Claude Code's sign-in runs with: this profile, no browser, and no credential from this shell. */
|
|
37
|
+
function connectEnv(profileDir, base = process.env) {
|
|
38
|
+
const env = {};
|
|
39
|
+
for (const [k, v] of Object.entries(base)) {
|
|
40
|
+
if (v === undefined)
|
|
41
|
+
continue;
|
|
42
|
+
if (k === 'ANTHROPIC_API_KEY' || k === 'CLAUDE_CODE_OAUTH_TOKEN' || k === 'ANTHROPIC_AUTH_TOKEN')
|
|
43
|
+
continue;
|
|
44
|
+
env[k] = v;
|
|
45
|
+
}
|
|
46
|
+
env['CLAUDE_CONFIG_DIR'] = profileDir;
|
|
47
|
+
env['BROWSER'] = NO_BROWSER;
|
|
48
|
+
return env;
|
|
49
|
+
}
|
|
50
|
+
/** The plain sentence Claude Code ended with ("Login failed: …"), without any link. */
|
|
51
|
+
function connectProblemOf(output) {
|
|
52
|
+
const line = output.split(/\r?\n/).map((l) => l.replace(/Paste code here if prompted >\s*/g, '').trim()).find((l) => /^Login failed/i.test(l));
|
|
53
|
+
return line ? line.replace(/https?:\/\/\S+/g, '[link]').slice(0, 300) : null;
|
|
54
|
+
}
|
|
55
|
+
function takeLock(home, id, ttlMs, now) {
|
|
56
|
+
const dir = (0, node_path_1.join)(home, '.looply');
|
|
57
|
+
const file = (0, node_path_1.join)(dir, exports.CONNECT_LOCK_FILE);
|
|
58
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
59
|
+
try {
|
|
60
|
+
if (now - (0, node_fs_1.statSync)(file).mtimeMs > ttlMs)
|
|
61
|
+
(0, node_fs_1.rmSync)(file, { force: true });
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
/* no lock yet */
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
(0, node_fs_1.writeFileSync)(file, JSON.stringify({ id, pid: process.pid, at: new Date(now).toISOString() }), { flag: 'wx' });
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function dropLock(home, id) {
|
|
75
|
+
const file = (0, node_path_1.join)(home, '.looply', exports.CONNECT_LOCK_FILE);
|
|
76
|
+
try {
|
|
77
|
+
if (JSON.parse((0, node_fs_1.readFileSync)(file, 'utf8')).id === id)
|
|
78
|
+
(0, node_fs_1.rmSync)(file, { force: true });
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
/* already gone */
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/* istanbul ignore next — a real process; the flow is tested with a fake */
|
|
85
|
+
function defaultSpawn(exe, argv, env) {
|
|
86
|
+
return (0, node_child_process_1.spawn)(exe, [...argv], {
|
|
87
|
+
env,
|
|
88
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
89
|
+
windowsHide: true,
|
|
90
|
+
shell: process.platform === 'win32' && exe.toLowerCase().endsWith('.cmd'),
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Called with the session id the heartbeat named. Returns at once when another
|
|
95
|
+
* daemon (or this one) already runs it, or when there is nothing to start.
|
|
96
|
+
*/
|
|
97
|
+
function makeAccountConnect(deps) {
|
|
98
|
+
const home = deps.home ?? (0, node_os_1.homedir)();
|
|
99
|
+
const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
100
|
+
const now = deps.now ?? (() => Date.now());
|
|
101
|
+
const pollMs = deps.pollMs ?? exports.CONNECT_POLL_MS;
|
|
102
|
+
const linkTimeoutMs = deps.linkTimeoutMs ?? exports.CONNECT_LINK_TIMEOUT_MS;
|
|
103
|
+
let running = null;
|
|
104
|
+
const report = async (s, body) => {
|
|
105
|
+
try {
|
|
106
|
+
return (0, core_1.accountConnectOf)((await deps.client.reportAccountConnect({ id: s.id, ...body })).session);
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
deps.log(`accounts: could not tell AutoRyn how the sign-in goes — ${e.message}`);
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return async (turnId) => {
|
|
114
|
+
if (running !== null)
|
|
115
|
+
return;
|
|
116
|
+
let listed;
|
|
117
|
+
try {
|
|
118
|
+
listed = await deps.client.accountConnect();
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const session = (0, core_1.accountConnectOf)(listed.session);
|
|
124
|
+
if (session === null || session.id !== turnId || session.state !== 'requested')
|
|
125
|
+
return;
|
|
126
|
+
const ttl = Math.max(Date.parse(session.expiresAt) - now(), 60_000);
|
|
127
|
+
if (!takeLock(home, session.id, ttl, now()))
|
|
128
|
+
return;
|
|
129
|
+
running = session.id;
|
|
130
|
+
try {
|
|
131
|
+
await run(session, Date.parse(session.expiresAt));
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
running = null;
|
|
135
|
+
dropLock(home, session.id);
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
async function run(s, deadline) {
|
|
139
|
+
const accountsDeps = deps.accounts();
|
|
140
|
+
const exe = accountsDeps?.claudeExecutable() ?? null;
|
|
141
|
+
if (accountsDeps === undefined || exe === null) {
|
|
142
|
+
await report(s, { state: 'failed', problem: 'Claude Code is not installed on this PC — run `looply provider install` there' });
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const before = (0, provider_accounts_1.readAccounts)(home).find((a) => a.name === s.name);
|
|
146
|
+
if (before?.source === 'token') {
|
|
147
|
+
await report(s, { state: 'failed', problem: `"${s.name}" is an account added with a token on this PC; pick another name` });
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (before !== undefined && before.provider !== 'claude') {
|
|
151
|
+
await report(s, { state: 'failed', problem: `"${s.name}" is a ${before.provider} account on this PC; pick another name` });
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
await report(s, { state: 'starting' });
|
|
155
|
+
const profileDir = (0, provider_accounts_1.accountProfileDir)(s.name, home);
|
|
156
|
+
(0, node_fs_1.mkdirSync)(profileDir, { recursive: true });
|
|
157
|
+
deps.log(`accounts: signing "${s.name}" in for AutoRyn (Claude Code's own sign-in)`);
|
|
158
|
+
let output = '';
|
|
159
|
+
let exitCode;
|
|
160
|
+
let child;
|
|
161
|
+
try {
|
|
162
|
+
child = (deps.spawn ?? defaultSpawn)(exe, ['auth', 'login', s.method === 'console' ? '--console' : '--claudeai'], connectEnv(profileDir));
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
await report(s, { state: 'failed', problem: `Claude Code could not start: ${e.message}`.slice(0, 300) });
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const take = (b) => {
|
|
169
|
+
output = (output + b.toString()).slice(-20_000);
|
|
170
|
+
};
|
|
171
|
+
child.stdout?.on('data', take);
|
|
172
|
+
child.stderr?.on('data', take);
|
|
173
|
+
child.on('exit', (code) => {
|
|
174
|
+
exitCode = code;
|
|
175
|
+
});
|
|
176
|
+
child.on('error', (e) => {
|
|
177
|
+
take(`\nLogin failed: ${e.message}\n`);
|
|
178
|
+
exitCode = exitCode ?? 1;
|
|
179
|
+
});
|
|
180
|
+
const stop = () => {
|
|
181
|
+
try {
|
|
182
|
+
child.kill();
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
/* already gone */
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const startedAt = now();
|
|
189
|
+
let linkSent = false;
|
|
190
|
+
let codeSent = false;
|
|
191
|
+
for (;;) {
|
|
192
|
+
if (exitCode !== undefined)
|
|
193
|
+
break;
|
|
194
|
+
if (!linkSent) {
|
|
195
|
+
const url = (0, core_1.signInUrlOf)(output);
|
|
196
|
+
if (url !== null) {
|
|
197
|
+
const after = await report(s, { state: 'waiting_for_code', signInUrl: url });
|
|
198
|
+
if (after !== null && core_1.ACCOUNT_CONNECT_ENDED.includes(after.state)) {
|
|
199
|
+
stop();
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
linkSent = true;
|
|
203
|
+
}
|
|
204
|
+
else if (now() - startedAt > linkTimeoutMs) {
|
|
205
|
+
stop();
|
|
206
|
+
await report(s, { state: 'failed', problem: 'Claude Code did not give a sign-in link; update it with `looply provider update` and try again' });
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (now() > deadline) {
|
|
211
|
+
stop();
|
|
212
|
+
await report(s, { state: 'expired', problem: 'the sign-in was not finished in time; start again' });
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
await sleep(pollMs);
|
|
216
|
+
if (exitCode !== undefined)
|
|
217
|
+
break;
|
|
218
|
+
if (!linkSent || codeSent)
|
|
219
|
+
continue;
|
|
220
|
+
let listed;
|
|
221
|
+
try {
|
|
222
|
+
listed = await deps.client.accountConnect();
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
const cur = (0, core_1.accountConnectOf)(listed.session);
|
|
228
|
+
if (cur === null || cur.id !== s.id || core_1.ACCOUNT_CONNECT_ENDED.includes(cur.state)) {
|
|
229
|
+
// A person cancelled it, started another, or it ran out of time. Said apart: "stopped" for
|
|
230
|
+
// an expiry sent the owner looking for a cancel nobody pressed.
|
|
231
|
+
stop();
|
|
232
|
+
const why = cur !== null && cur.id === s.id && cur.state === 'expired'
|
|
233
|
+
? 'expired: no code came back from AutoRyn in time; start it again there'
|
|
234
|
+
: cur !== null && cur.id !== s.id
|
|
235
|
+
? 'replaced by a newer sign-in started in AutoRyn'
|
|
236
|
+
: cur !== null && cur.state === 'cancelled'
|
|
237
|
+
? 'stopped in AutoRyn'
|
|
238
|
+
: 'ended in AutoRyn (cancelled there, or not finished within 15 minutes); start it again there';
|
|
239
|
+
deps.log(`accounts: the sign-in of "${s.name}" ${why}`);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (cur.state === 'code_sent' && typeof listed.sealedCode === 'string') {
|
|
243
|
+
let code;
|
|
244
|
+
try {
|
|
245
|
+
code = (0, core_1.openSealed)((0, machine_secrets_1.ensureSealKey)(home).privateKey, listed.sealedCode).trim();
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
stop();
|
|
249
|
+
await report(s, { state: 'failed', problem: 'this PC could not open the code (it was sealed to another key); start again' });
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
child.stdin?.write(`${code}\n`);
|
|
253
|
+
child.stdin?.end();
|
|
254
|
+
codeSent = true;
|
|
255
|
+
await report(s, { state: 'signing_in' });
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Claude Code ended: signed in, or not.
|
|
259
|
+
if (exitCode !== 0) {
|
|
260
|
+
await report(s, {
|
|
261
|
+
state: 'failed',
|
|
262
|
+
problem: connectProblemOf(output) ?? (codeSent ? 'Claude did not accept the sign-in; start again' : 'the sign-in stopped before it finished'),
|
|
263
|
+
});
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const isNew = before === undefined && s.name !== 'default';
|
|
267
|
+
const entry = isNew ? (0, provider_accounts_1.addAccount)({ name: s.name, provider: 'claude' }, home) : (0, provider_accounts_1.readAccounts)(home).find((a) => a.name === s.name);
|
|
268
|
+
const auth = (0, provider_accounts_cmd_1.checkAccount)(entry, { ...accountsDeps, home });
|
|
269
|
+
if (!auth.ok) {
|
|
270
|
+
if (isNew)
|
|
271
|
+
(0, provider_accounts_1.removeAccount)(s.name, home);
|
|
272
|
+
await report(s, { state: 'failed', problem: `the sign-in finished but Claude Code does not see it: ${auth.because}`.slice(0, 300) });
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
deps.log(`accounts: "${s.name}" signed in from AutoRyn`);
|
|
276
|
+
await report(s, { state: 'connected', authMethod: auth.authMethod, plan: auth.plan });
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=account-connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-connect.js","sourceRoot":"","sources":["../src/account-connect.ts"],"names":[],"mappings":";;;AA4DA,gCAUC;AAGD,4CAGC;AA0CD,gDA6KC;AAnSD,2DAAwD;AACxD,qCAAmF;AACnF,qCAAkC;AAClC,yCAAiC;AACjC,uCAAqH;AACrH,uDAAkD;AAClD,2DAAiG;AACjG,mEAA6E;AAE7E;;;;;;;;;;;;;GAaG;AAEU,QAAA,iBAAiB,GAAG,sBAAsB,CAAC;AACxD,gGAAgG;AACnF,QAAA,eAAe,GAAG,IAAI,CAAC;AACpC,+EAA+E;AAClE,QAAA,uBAAuB,GAAG,MAAM,CAAC;AAC9C,mHAAmH;AACnH,MAAM,UAAU,GAAG,mBAAmB,CAAC;AA6BvC,oHAAoH;AACpH,SAAgB,UAAU,CAAC,UAAkB,EAAE,OAA0B,OAAO,CAAC,GAAG;IAClF,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1C,IAAI,CAAC,KAAK,SAAS;YAAE,SAAS;QAC9B,IAAI,CAAC,KAAK,mBAAmB,IAAI,CAAC,KAAK,yBAAyB,IAAI,CAAC,KAAK,sBAAsB;YAAE,SAAS;QAC3G,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,GAAG,CAAC,mBAAmB,CAAC,GAAG,UAAU,CAAC;IACtC,GAAG,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;IAC5B,OAAO,GAAG,CAAC;AACb,CAAC;AAED,uFAAuF;AACvF,SAAgB,gBAAgB,CAAC,MAAc;IAC7C,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC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":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AAk4FA,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAqF1D"}
|
package/dist/bin.js
CHANGED
|
@@ -56,6 +56,7 @@ const serve_cmd_1 = require("./serve-cmd");
|
|
|
56
56
|
const connect_1 = require("./connect");
|
|
57
57
|
const connect_node_1 = require("./connect-node");
|
|
58
58
|
const repo_init_1 = require("./repo-init");
|
|
59
|
+
const workspace_provisioner_1 = require("./workspace-provisioner");
|
|
59
60
|
const refresh_gates_1 = require("./refresh-gates");
|
|
60
61
|
const core_1 = require("@looply/core");
|
|
61
62
|
const sessions_cmd_1 = require("./sessions-cmd");
|
|
@@ -92,7 +93,7 @@ usage:
|
|
|
92
93
|
looply connect [--root <dir>]... [--yes] [--no-start]
|
|
93
94
|
once per machine: pair it (if needed), then set up and serve every git
|
|
94
95
|
repository under each root; new ones there, and clones you ask for, follow
|
|
95
|
-
looply pair [--server <url>] pair this machine
|
|
96
|
+
looply pair [--server <url>] pair this machine only (AutoRyn: Add machine, or the Looply phone app)
|
|
96
97
|
looply daemon [--once] [--yes] stay connected: presence, and ship the ledger
|
|
97
98
|
looply serve add [path] serve this repository (or <path>) from one machine-wide supervisor
|
|
98
99
|
looply serve remove <path> stop serving a repository
|
|
@@ -1896,7 +1897,7 @@ async function runs(argv) {
|
|
|
1896
1897
|
*/
|
|
1897
1898
|
let carried = [];
|
|
1898
1899
|
try {
|
|
1899
|
-
carried =
|
|
1900
|
+
carried = (0, workspace_provisioner_1.declaredCarry)(process.cwd());
|
|
1900
1901
|
}
|
|
1901
1902
|
catch {
|
|
1902
1903
|
/* no config, or an unreadable one: nothing is excused, which is the old behaviour */
|
|
@@ -2189,7 +2190,8 @@ async function run(argv) {
|
|
|
2189
2190
|
* Read from the config the run itself will read, so the two cannot
|
|
2190
2191
|
* disagree about what this checkout needs.
|
|
2191
2192
|
*/
|
|
2192
|
-
|
|
2193
|
+
loadConfig((0, path_1.join)(here, git_driver_1.STATE_DIR, 'config.yaml'));
|
|
2194
|
+
const carry = (0, workspace_provisioner_1.declaredCarry)(here);
|
|
2193
2195
|
workspace = await (0, workspace_1.createWorkspace)(git, here, tag, `looply/${tag}`, base, (0, node_os_1.homedir)(), carry);
|
|
2194
2196
|
process.stdout.write(` workspace: ${workspace}\n`);
|
|
2195
2197
|
/**
|