primcli 3.0.0-preview.21 → 3.0.0-preview.23
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 +12 -1
- package/dist/{api-command-Bab30eNp.js → api-command-CP8ir5Pv.js} +536 -209
- package/dist/{cli-command-names-BYbYdipl.js → cli-command-names-DteMqL-H.js} +43 -1
- package/dist/{cli-config-Ms_0vNjq.js → cli-config-DUQEYQ42.js} +489 -4
- package/dist/{json-output-xgN0ZLWP.js → json-output-BMZrLH47.js} +1 -1
- package/dist/{machine-session-cfgMKQ_U.js → machine-session-CE31cwx2.js} +6 -6
- package/dist/{notify-session-BRK9_xSb.js → notify-session-Dx54UpkT.js} +2 -2
- package/dist/oclif/auto-signal-worker.js +3 -3
- package/dist/oclif/auto-signals.js +1 -1
- package/dist/oclif/command-not-found.js +3 -2
- package/dist/oclif/index.js +849 -83
- package/dist/oclif/proxy-auto-detect.js +1 -1
- package/dist/oclif/receiver-heal.js +2 -3
- package/dist/oclif/root-signup-hint.js +1 -1
- package/dist/{repeats-Dj_o6c-X-CraZzs4t.js → repeats-Dj_o6c-X-x61TNLz-.js} +55 -4
- package/dist/{scoped-chat-YucNhX6U.js → scoped-chat-Bss3OjFI.js} +1 -1
- package/dist/{shared-mail-watch-BAPMsFNv.js → shared-mail-watch-DdtgJOrV.js} +12 -0
- package/dist/{signal-command-AOnn_Him.js → signal-command-CA55RTJh.js} +11 -7
- package/package.json +5 -5
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
// src/oclif/cli-command-names.ts
|
|
2
|
+
/** Direct generated/task pairs share one canonical command. */
|
|
3
|
+
const COMMAND_PAIR_RENAMES = {
|
|
4
|
+
"contacts:delete-contact": "contacts:delete",
|
|
5
|
+
"contacts:get-contact": "contacts:get",
|
|
6
|
+
"contacts:list-contacts": "contacts:list",
|
|
7
|
+
"credentials:get-key": "keys:get",
|
|
8
|
+
"credentials:list-keys": "keys:list",
|
|
9
|
+
"credits:get-credit-balance": "credits:balance",
|
|
10
|
+
"functions:redeploy-function": "functions:redeploy",
|
|
11
|
+
"functions:set-function-route": "functions:set-route",
|
|
12
|
+
"functions:set-function-secret": "functions:set-secret",
|
|
13
|
+
"functions:unset-function-route": "functions:unset-route",
|
|
14
|
+
"mailbox-access:list-groups": "roles:groups",
|
|
15
|
+
"mailbox-access:list-mailbox-access": "roles:mailbox-access",
|
|
16
|
+
"memories:delete-memory": "memories:delete",
|
|
17
|
+
"memories:get-memory": "memories:get",
|
|
18
|
+
"memories:search-memories": "memories:search",
|
|
19
|
+
"memories:set-memory": "memories:set",
|
|
20
|
+
"projects:list-organization-people": "members:list",
|
|
21
|
+
"roles-and-members:get-access-mode": "roles:access-mode",
|
|
22
|
+
"roles-and-members:list-roles": "roles:list",
|
|
23
|
+
"roles:members": "members:list",
|
|
24
|
+
"routes:create-route": "routes:create",
|
|
25
|
+
"routes:delete-route": "routes:delete",
|
|
26
|
+
"routes:list-routes": "routes:list",
|
|
27
|
+
"routes:reorder-routes": "routes:reorder",
|
|
28
|
+
"routes:update-route": "routes:update",
|
|
29
|
+
"threads:mute-thread": "threads:mute",
|
|
30
|
+
"threads:unmute-thread": "threads:unmute",
|
|
31
|
+
"wake:create-wake-authorization": "wake:authorizations:create",
|
|
32
|
+
"wake:create-wake-schedule": "wake:schedules:create",
|
|
33
|
+
"wake:delete-wake-authorization": "wake:authorizations:delete",
|
|
34
|
+
"wake:delete-wake-schedule": "wake:schedules:delete",
|
|
35
|
+
"wake:get-wake-schedule": "wake:schedules:get",
|
|
36
|
+
"wake:list-wake-authorizations": "wake:authorizations:list",
|
|
37
|
+
"wake:list-wake-dispatches": "wake:dispatches:list",
|
|
38
|
+
"wake:list-wake-schedules": "wake:schedules:list",
|
|
39
|
+
"wake:run-wake-schedule": "wake:schedules:run",
|
|
40
|
+
"wake:update-wake-authorization": "wake:authorizations:update",
|
|
41
|
+
"wake:update-wake-schedule": "wake:schedules:update"
|
|
42
|
+
};
|
|
2
43
|
/** Canonical executable names. API operation identifiers stay unchanged. */
|
|
3
44
|
const COMMAND_RENAMES = {
|
|
45
|
+
...COMMAND_PAIR_RENAMES,
|
|
4
46
|
"account:get-account": "account:get",
|
|
5
47
|
"account:get-storage-stats": "account:storage",
|
|
6
48
|
"account:get-webhook-secret": "account:webhook-secret",
|
|
@@ -317,4 +359,4 @@ function retiredCommandTarget(argv) {
|
|
|
317
359
|
}
|
|
318
360
|
return match;
|
|
319
361
|
}
|
|
320
|
-
export {
|
|
362
|
+
export { canonicalCommandId as a, operationCommandId as c, canonicalCliText as i, retiredCommandTarget as l, COMMAND_RENAMES as n, canonicalCommands as o, canonicalBodyFlagName as r, canonicalOperation as s, COMMAND_PAIR_RENAMES as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as createConfig, t as createClient } from "./client.gen-6rZvmHfx.js";
|
|
2
2
|
import { c as mailTime, d as readMailJson, h as writeMailJson, i as mailId, l as privateMailDirectory, o as mailObject, r as mailAddress, s as mailString } from "./shared-mail-files-BAQSGxxz.js";
|
|
3
3
|
import { Errors } from "@oclif/core";
|
|
4
|
-
import { chmodSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { randomUUID } from "node:crypto";
|
|
6
|
-
import { dirname, join } from "node:path";
|
|
4
|
+
import { chmodSync, lstatSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
6
|
+
import { dirname, join, resolve } from "node:path";
|
|
7
7
|
// ../packages/api-core/src/client.ts
|
|
8
8
|
/**
|
|
9
9
|
* Host-aware Primitive API client and shared error type.
|
|
@@ -38,6 +38,456 @@ var PrimitiveApiClient = class {
|
|
|
38
38
|
return this.client.setConfig(config);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
|
+
// src/oclif/runtime-session.ts
|
|
42
|
+
/**
|
|
43
|
+
* The variables each runtime sets to its exact session ID, first match wins.
|
|
44
|
+
* The loaded Codex thread is the receiving identity; the process session ID
|
|
45
|
+
* is only a fallback when no thread ID is exposed.
|
|
46
|
+
*/
|
|
47
|
+
const RUNTIME_SESSION_VARIABLES = {
|
|
48
|
+
claude: ["CLAUDE_CODE_SESSION_ID"],
|
|
49
|
+
codex: ["CODEX_THREAD_ID", "CODEX_SESSION_ID"]
|
|
50
|
+
};
|
|
51
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
52
|
+
/** Each runtime whose environment names a session UUID. Never guessed from history or cwd. */
|
|
53
|
+
function runtimeSessions(env) {
|
|
54
|
+
return Object.keys(RUNTIME_SESSION_VARIABLES).flatMap((runtime) => {
|
|
55
|
+
for (const variable of RUNTIME_SESSION_VARIABLES[runtime]) {
|
|
56
|
+
const value = env[variable]?.trim().toLowerCase();
|
|
57
|
+
if (!value) continue;
|
|
58
|
+
return UUID.test(value) ? [{
|
|
59
|
+
runtime,
|
|
60
|
+
session: value,
|
|
61
|
+
variable
|
|
62
|
+
}] : [];
|
|
63
|
+
}
|
|
64
|
+
return [];
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** The one session the runtime environment names, if exactly one runtime names one. */
|
|
68
|
+
function detectRuntimeSession(env = process.env) {
|
|
69
|
+
const candidates = runtimeSessions(env);
|
|
70
|
+
const [only] = candidates;
|
|
71
|
+
if (!only) return { kind: "none" };
|
|
72
|
+
return candidates.length === 1 ? {
|
|
73
|
+
kind: "detected",
|
|
74
|
+
...only
|
|
75
|
+
} : {
|
|
76
|
+
kind: "ambiguous",
|
|
77
|
+
candidates
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The runtime whose tool environment names this exact session. A session ID
|
|
82
|
+
* that matches neither runtime's variable, or both, has no detectable runtime.
|
|
83
|
+
*/
|
|
84
|
+
function detectAgentRuntime(session, env = process.env) {
|
|
85
|
+
const wanted = session.trim().toLowerCase();
|
|
86
|
+
const matches = runtimeSessions(env).filter((candidate) => candidate.session === wanted);
|
|
87
|
+
return matches.length === 1 ? matches[0]?.runtime ?? null : null;
|
|
88
|
+
}
|
|
89
|
+
/** Every variable a runtime may name its session in, for messages. */
|
|
90
|
+
function runtimeSessionVariableList() {
|
|
91
|
+
const names = Object.values(RUNTIME_SESSION_VARIABLES).flat();
|
|
92
|
+
return `${names.slice(0, -1).join(", ")} or ${names.at(-1)}`;
|
|
93
|
+
}
|
|
94
|
+
// src/oclif/agent-pass.ts
|
|
95
|
+
const AGENT_PASS_PROFILE_ENV = "PRIMITIVE_AGENT_PASS_PROFILE";
|
|
96
|
+
const AGENT_PASS_DIR = "agent-passes";
|
|
97
|
+
const PROFILE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,62}$/;
|
|
98
|
+
const TOKEN_PATTERN = /\b(pit_v1_[A-Za-z0-9_-]{16,256})\b/;
|
|
99
|
+
const EXACT_TOKEN_PATTERN = /^pit_v1_[A-Za-z0-9_-]{16,256}$/;
|
|
100
|
+
var AgentPassAuthError = class extends Error {
|
|
101
|
+
constructor(message) {
|
|
102
|
+
super(message);
|
|
103
|
+
this.name = "AgentPassAuthError";
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
function isRecord$3(value) {
|
|
107
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
108
|
+
}
|
|
109
|
+
function stripTrailingSlashes(value) {
|
|
110
|
+
let end = value.length;
|
|
111
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
|
|
112
|
+
return value.slice(0, end);
|
|
113
|
+
}
|
|
114
|
+
function normalizeBaseUrl(raw) {
|
|
115
|
+
const trimmed = raw?.trim();
|
|
116
|
+
if (!trimmed) return DEFAULT_API_BASE_URL;
|
|
117
|
+
return stripTrailingSlashes(trimmed);
|
|
118
|
+
}
|
|
119
|
+
function isLocalhostHostname(hostname) {
|
|
120
|
+
const lower = hostname.toLowerCase();
|
|
121
|
+
return lower === "localhost" || lower === "127.0.0.1" || lower === "[::1]" || lower === "::1";
|
|
122
|
+
}
|
|
123
|
+
function validateAccessBaseUrl(rawUrl) {
|
|
124
|
+
let parsed;
|
|
125
|
+
try {
|
|
126
|
+
parsed = new URL(rawUrl);
|
|
127
|
+
} catch {
|
|
128
|
+
throw new AgentPassAuthError("Access Pass URL is not a valid URL. Paste the full presigned access URL or pit_v1_ token.");
|
|
129
|
+
}
|
|
130
|
+
if (parsed.username || parsed.password) throw new AgentPassAuthError("Access Pass URL must not include embedded credentials.");
|
|
131
|
+
const isHttps = parsed.protocol === "https:";
|
|
132
|
+
const isLocalHttp = parsed.protocol === "http:" && isLocalhostHostname(parsed.hostname);
|
|
133
|
+
if (!isHttps && !isLocalHttp) throw new AgentPassAuthError("Access Pass URL must use https (or http only for localhost).");
|
|
134
|
+
const cleanPath = stripTrailingSlashes(parsed.pathname);
|
|
135
|
+
const lowerPath = cleanPath.toLowerCase();
|
|
136
|
+
const accessIdx = lowerPath.indexOf("/v1/access/");
|
|
137
|
+
let basePath;
|
|
138
|
+
if (accessIdx !== -1) basePath = cleanPath.slice(0, accessIdx + 3);
|
|
139
|
+
else if (lowerPath === "/v1" || lowerPath.endsWith("/v1")) basePath = cleanPath;
|
|
140
|
+
else if (cleanPath === "" || cleanPath === "/") basePath = "/v1";
|
|
141
|
+
else basePath = `${cleanPath}/v1`;
|
|
142
|
+
return `${parsed.protocol}//${parsed.host}${basePath}`;
|
|
143
|
+
}
|
|
144
|
+
function validateAgentPassProfileName(profile) {
|
|
145
|
+
const trimmed = profile.trim();
|
|
146
|
+
if (!PROFILE_NAME_PATTERN.test(trimmed)) throw new AgentPassAuthError("Profile name must start with a letter or number and contain only letters, numbers, dots, underscores, or hyphens (at most 63 characters).");
|
|
147
|
+
return trimmed;
|
|
148
|
+
}
|
|
149
|
+
function agentPassTokenSha256(token) {
|
|
150
|
+
return createHash("sha256").update(token).digest("hex");
|
|
151
|
+
}
|
|
152
|
+
function trimWrapperChars(value) {
|
|
153
|
+
const leading = `"'<>()\`[`;
|
|
154
|
+
const trailing = `"'<>()\`].,;`;
|
|
155
|
+
let start = 0;
|
|
156
|
+
let end = value.length;
|
|
157
|
+
while (start < end && leading.includes(value[start] ?? "")) start += 1;
|
|
158
|
+
while (end > start && trailing.includes(value[end - 1] ?? "")) end -= 1;
|
|
159
|
+
return value.slice(start, end);
|
|
160
|
+
}
|
|
161
|
+
function extractUrlWithToken(input) {
|
|
162
|
+
for (const rawPiece of input.split(/\s+/)) {
|
|
163
|
+
const piece = trimWrapperChars(rawPiece);
|
|
164
|
+
const lower = piece.toLowerCase();
|
|
165
|
+
if (!lower.startsWith("http://") && !lower.startsWith("https://")) continue;
|
|
166
|
+
let parsed;
|
|
167
|
+
try {
|
|
168
|
+
parsed = new URL(piece);
|
|
169
|
+
} catch {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const idx = parsed.pathname.toLowerCase().indexOf("/v1/access/");
|
|
173
|
+
if (idx === -1) continue;
|
|
174
|
+
const token = parsed.pathname.slice(idx + 11).split("/")[0] ?? "";
|
|
175
|
+
if (EXACT_TOKEN_PATTERN.test(token)) return {
|
|
176
|
+
url: piece,
|
|
177
|
+
token
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
function parseAccessPassInput(rawInput, explicitApiBaseUrl) {
|
|
183
|
+
const trimmed = rawInput.trim();
|
|
184
|
+
if (!trimmed) throw new AgentPassAuthError("No Access Pass URL or pit_v1_ token was provided. Pass it as an argument or pipe it on stdin.");
|
|
185
|
+
const urlMatch = extractUrlWithToken(trimmed);
|
|
186
|
+
if (urlMatch) {
|
|
187
|
+
const inferredBaseUrl = validateAccessBaseUrl(urlMatch.url);
|
|
188
|
+
const apiBaseUrl = explicitApiBaseUrl?.trim() ? validateAccessBaseUrl(normalizeBaseUrl(explicitApiBaseUrl)) : inferredBaseUrl;
|
|
189
|
+
return {
|
|
190
|
+
token: urlMatch.token,
|
|
191
|
+
apiBaseUrl
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
const tokenMatch = TOKEN_PATTERN.exec(trimmed);
|
|
195
|
+
if (tokenMatch?.[1]) {
|
|
196
|
+
const apiBaseUrl = explicitApiBaseUrl?.trim() ? validateAccessBaseUrl(normalizeBaseUrl(explicitApiBaseUrl)) : DEFAULT_API_BASE_URL;
|
|
197
|
+
return {
|
|
198
|
+
token: tokenMatch[1],
|
|
199
|
+
apiBaseUrl
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
throw new AgentPassAuthError("Could not find a valid Primitive Access Pass URL or pit_v1_ token in the input.");
|
|
203
|
+
}
|
|
204
|
+
function agentPassMetadata(pass) {
|
|
205
|
+
const { api_key: _redacted, ...meta } = pass;
|
|
206
|
+
return meta;
|
|
207
|
+
}
|
|
208
|
+
function agentPassRootDir(configDir) {
|
|
209
|
+
return join(configDir, AGENT_PASS_DIR);
|
|
210
|
+
}
|
|
211
|
+
function agentPassClaimCachePath(configDir, tokenHash) {
|
|
212
|
+
return join(agentPassRootDir(configDir), "claims", `${tokenHash}.json`);
|
|
213
|
+
}
|
|
214
|
+
function resolveAgentPassSlot(params) {
|
|
215
|
+
const env = params.env ?? process.env;
|
|
216
|
+
const profileName = params.profile?.trim() || env["PRIMITIVE_AGENT_PASS_PROFILE"]?.trim() || void 0;
|
|
217
|
+
if (profileName) {
|
|
218
|
+
const safe = validateAgentPassProfileName(profileName);
|
|
219
|
+
return {
|
|
220
|
+
path: join(agentPassRootDir(params.configDir), "profiles", `${safe}.json`),
|
|
221
|
+
binding: {
|
|
222
|
+
kind: "profile",
|
|
223
|
+
profile: safe
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
const detected = detectRuntimeSession(env);
|
|
228
|
+
if (detected.kind === "ambiguous") throw new AgentPassAuthError(`Multiple coding agent sessions were detected in this environment (${detected.candidates.map((c) => `${c.variable}=${c.session}`).join(", ")}). Pass --profile <name> or set ${AGENT_PASS_PROFILE_ENV} to bind an Access Pass explicitly.`);
|
|
229
|
+
if (detected.kind === "detected") return {
|
|
230
|
+
path: join(agentPassRootDir(params.configDir), "sessions", `${detected.runtime}-${detected.session}.json`),
|
|
231
|
+
binding: {
|
|
232
|
+
kind: "session",
|
|
233
|
+
runtime: detected.runtime,
|
|
234
|
+
session: detected.session
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
return {
|
|
238
|
+
path: join(agentPassRootDir(params.configDir), "default.json"),
|
|
239
|
+
binding: { kind: "default" }
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function ensurePrivateDir(dirPath, stopAtDir) {
|
|
243
|
+
mkdirSync(dirPath, {
|
|
244
|
+
mode: 448,
|
|
245
|
+
recursive: true
|
|
246
|
+
});
|
|
247
|
+
if (process.platform === "win32") return;
|
|
248
|
+
const resolvedStop = stopAtDir ? resolve(stopAtDir) : null;
|
|
249
|
+
let current = resolve(dirPath);
|
|
250
|
+
for (;;) {
|
|
251
|
+
try {
|
|
252
|
+
if (lstatSync(current).isSymbolicLink()) throw new AgentPassAuthError(`Refusing to use symlinked Access Pass directory at ${current}.`);
|
|
253
|
+
chmodSync(current, 448);
|
|
254
|
+
} catch (error) {
|
|
255
|
+
if (error instanceof AgentPassAuthError) throw error;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
if (!resolvedStop || current === resolvedStop) break;
|
|
259
|
+
const parent = dirname(current);
|
|
260
|
+
if (parent === current) break;
|
|
261
|
+
current = parent;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
function assertPrivateRegularFile(filePath) {
|
|
265
|
+
const st = lstatSync(filePath);
|
|
266
|
+
if (st.isSymbolicLink() || !st.isFile()) throw new AgentPassAuthError(`Refusing to read Access Pass at ${filePath}: expected a regular file.`);
|
|
267
|
+
if (process.platform !== "win32" && (st.mode & 63) !== 0) throw new AgentPassAuthError(`Refusing to read Access Pass at ${filePath}: file permissions are too open. Run \`chmod 600 "${filePath}"\` or \`primitive disconnect --local-only\`.`);
|
|
268
|
+
}
|
|
269
|
+
function writePrivateJsonAtomic(filePath, data, privateRootDir) {
|
|
270
|
+
ensurePrivateDir(dirname(filePath), privateRootDir);
|
|
271
|
+
try {
|
|
272
|
+
if (lstatSync(filePath).isSymbolicLink()) throw new AgentPassAuthError(`Refusing to overwrite symlinked Access Pass file at ${filePath}.`);
|
|
273
|
+
} catch (error) {
|
|
274
|
+
if (error instanceof AgentPassAuthError) throw error;
|
|
275
|
+
if (!(error && typeof error === "object" && error.code === "ENOENT")) throw error;
|
|
276
|
+
}
|
|
277
|
+
const tempPath = `${filePath}.${process.pid}.${randomUUID()}.tmp`;
|
|
278
|
+
try {
|
|
279
|
+
writeFileSync(tempPath, `${JSON.stringify(data, null, 2)}\n`, {
|
|
280
|
+
flag: "wx",
|
|
281
|
+
mode: 384
|
|
282
|
+
});
|
|
283
|
+
if (process.platform !== "win32") chmodSync(tempPath, 384);
|
|
284
|
+
renameSync(tempPath, filePath);
|
|
285
|
+
if (process.platform !== "win32") chmodSync(filePath, 384);
|
|
286
|
+
} catch (error) {
|
|
287
|
+
rmSync(tempPath, { force: true });
|
|
288
|
+
throw error;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function parseStoredAgentPass(raw) {
|
|
292
|
+
if (!isRecord$3(raw) || raw.version !== 1 || raw.auth_method !== "agent_pass") throw new AgentPassAuthError("Saved Access Pass file is malformed. Run `primitive disconnect --local-only` and reconnect with a fresh pass.");
|
|
293
|
+
if (typeof raw.api_key !== "string" || raw.api_key.trim().length === 0) throw new AgentPassAuthError("Saved Access Pass file is missing its credential. Run `primitive disconnect --local-only` and reconnect.");
|
|
294
|
+
if (typeof raw.api_base_url !== "string" || raw.api_base_url.trim().length === 0) throw new AgentPassAuthError("Saved Access Pass file is missing api_base_url. Run `primitive disconnect --local-only` and reconnect.");
|
|
295
|
+
if (typeof raw.expires_at !== "string" || Number.isNaN(Date.parse(raw.expires_at))) throw new AgentPassAuthError("Saved Access Pass file has an invalid expires_at timestamp. Run `primitive disconnect --local-only` and reconnect.");
|
|
296
|
+
const bindingRaw = isRecord$3(raw.binding) ? raw.binding : null;
|
|
297
|
+
let binding = { kind: "default" };
|
|
298
|
+
if (bindingRaw?.kind === "session" && typeof bindingRaw.runtime === "string" && typeof bindingRaw.session === "string") binding = {
|
|
299
|
+
kind: "session",
|
|
300
|
+
runtime: bindingRaw.runtime,
|
|
301
|
+
session: bindingRaw.session
|
|
302
|
+
};
|
|
303
|
+
else if (bindingRaw?.kind === "profile" && typeof bindingRaw.profile === "string") binding = {
|
|
304
|
+
kind: "profile",
|
|
305
|
+
profile: bindingRaw.profile
|
|
306
|
+
};
|
|
307
|
+
return {
|
|
308
|
+
version: 1,
|
|
309
|
+
auth_method: "agent_pass",
|
|
310
|
+
api_key: raw.api_key,
|
|
311
|
+
api_base_url: validateAccessBaseUrl(normalizeBaseUrl(raw.api_base_url)),
|
|
312
|
+
pass_id: typeof raw.pass_id === "string" ? raw.pass_id : null,
|
|
313
|
+
key_id: typeof raw.key_id === "string" ? raw.key_id : null,
|
|
314
|
+
label: typeof raw.label === "string" && raw.label ? raw.label : "Agent Pass",
|
|
315
|
+
mode: typeof raw.mode === "string" && raw.mode ? raw.mode : "read_only",
|
|
316
|
+
...typeof raw.purpose === "string" ? { purpose: raw.purpose } : {},
|
|
317
|
+
...typeof raw.profile_hint === "string" ? { profile_hint: raw.profile_hint } : {},
|
|
318
|
+
...typeof raw.mcp_url === "string" ? { mcp_url: raw.mcp_url } : {},
|
|
319
|
+
expires_at: raw.expires_at,
|
|
320
|
+
slice_summary: typeof raw.slice_summary === "string" ? raw.slice_summary : null,
|
|
321
|
+
claimed_at: typeof raw.claimed_at === "string" ? raw.claimed_at : (/* @__PURE__ */ new Date()).toISOString(),
|
|
322
|
+
revoked_at: typeof raw.revoked_at === "string" ? raw.revoked_at : null,
|
|
323
|
+
token_sha256: typeof raw.token_sha256 === "string" ? raw.token_sha256 : "",
|
|
324
|
+
binding
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function readAgentPassFile(filePath) {
|
|
328
|
+
let rawText;
|
|
329
|
+
try {
|
|
330
|
+
assertPrivateRegularFile(filePath);
|
|
331
|
+
rawText = readFileSync(filePath, "utf8");
|
|
332
|
+
} catch (error) {
|
|
333
|
+
if (error instanceof AgentPassAuthError) throw error;
|
|
334
|
+
if (error && typeof error === "object" && error.code === "ENOENT") return null;
|
|
335
|
+
throw new AgentPassAuthError(`Could not read saved Access Pass: ${error instanceof Error ? error.message : String(error)}`);
|
|
336
|
+
}
|
|
337
|
+
let parsed;
|
|
338
|
+
try {
|
|
339
|
+
parsed = JSON.parse(rawText);
|
|
340
|
+
} catch {
|
|
341
|
+
throw new AgentPassAuthError("Saved Access Pass file is not valid JSON. Run `primitive disconnect --local-only` and reconnect.");
|
|
342
|
+
}
|
|
343
|
+
return parseStoredAgentPass(parsed);
|
|
344
|
+
}
|
|
345
|
+
function isAgentPassExpired(pass, now = Date.now) {
|
|
346
|
+
if (pass.revoked_at) return true;
|
|
347
|
+
return Date.parse(pass.expires_at) <= now();
|
|
348
|
+
}
|
|
349
|
+
function saveAgentPass(params) {
|
|
350
|
+
const rootDir = agentPassRootDir(params.configDir);
|
|
351
|
+
writePrivateJsonAtomic(params.slotPath, params.pass, rootDir);
|
|
352
|
+
if (params.pass.token_sha256) writePrivateJsonAtomic(agentPassClaimCachePath(params.configDir, params.pass.token_sha256), params.pass, rootDir);
|
|
353
|
+
}
|
|
354
|
+
function loadCachedAgentPassByToken(params) {
|
|
355
|
+
const hash = agentPassTokenSha256(params.token);
|
|
356
|
+
const cachePath = agentPassClaimCachePath(params.configDir, hash);
|
|
357
|
+
try {
|
|
358
|
+
const cached = readAgentPassFile(cachePath);
|
|
359
|
+
if (!cached || isAgentPassExpired(cached, params.now)) return null;
|
|
360
|
+
return cached;
|
|
361
|
+
} catch {
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function loadActiveAgentPass(params) {
|
|
366
|
+
const env = params.env ?? process.env;
|
|
367
|
+
const explicitProfile = params.profile?.trim() || env["PRIMITIVE_AGENT_PASS_PROFILE"]?.trim() || void 0;
|
|
368
|
+
const slot = resolveAgentPassSlot({
|
|
369
|
+
configDir: params.configDir,
|
|
370
|
+
profile: explicitProfile,
|
|
371
|
+
env
|
|
372
|
+
});
|
|
373
|
+
const pass = readAgentPassFile(slot.path);
|
|
374
|
+
if (!pass) {
|
|
375
|
+
if (explicitProfile) throw new AgentPassAuthError(`Access Pass profile "${explicitProfile}" selected by ${AGENT_PASS_PROFILE_ENV} is not saved on this machine. Run \`primitive connect --profile ${explicitProfile} <url>\` or unset ${AGENT_PASS_PROFILE_ENV}.`);
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
if (isAgentPassExpired(pass, params.now)) throw new AgentPassAuthError(`The Primitive Access Pass bound to ${slot.binding.kind === "session" ? "this session" : slot.binding.kind === "profile" ? `profile "${slot.binding.profile}"` : "this machine"} (${pass.label}) has ${pass.revoked_at ? "been revoked" : `expired at ${pass.expires_at}`}. Refusing to fall back to any other login. Request a fresh Access Pass and run \`primitive connect <url>\`, or run \`primitive disconnect --local-only\` to clear the binding.`);
|
|
379
|
+
return {
|
|
380
|
+
pass,
|
|
381
|
+
path: slot.path
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function deleteAgentPass(params) {
|
|
385
|
+
rmSync(params.slotPath, { force: true });
|
|
386
|
+
if (params.tokenSha256) rmSync(agentPassClaimCachePath(params.configDir, params.tokenSha256), { force: true });
|
|
387
|
+
}
|
|
388
|
+
function extractErrorMessage(payload, status) {
|
|
389
|
+
if (isRecord$3(payload)) {
|
|
390
|
+
const inner = isRecord$3(payload.error) ? payload.error : payload;
|
|
391
|
+
const message = typeof inner.message === "string" ? inner.message : typeof payload.message === "string" ? payload.message : null;
|
|
392
|
+
const code = typeof inner.code === "string" ? inner.code : null;
|
|
393
|
+
if (message && code) return `${message} (${code}, HTTP ${status})`;
|
|
394
|
+
if (message) return `${message} (HTTP ${status})`;
|
|
395
|
+
if (code) return `${code} (HTTP ${status})`;
|
|
396
|
+
}
|
|
397
|
+
return `Request failed with HTTP ${status}`;
|
|
398
|
+
}
|
|
399
|
+
function deriveSliceSummary(data, grantSummary) {
|
|
400
|
+
if (typeof data.slice_summary === "string" && data.slice_summary.trim()) return data.slice_summary.trim();
|
|
401
|
+
const mailScope = grantSummary && isRecord$3(grantSummary.mail_scope) ? grantSummary.mail_scope : null;
|
|
402
|
+
if (!mailScope) return null;
|
|
403
|
+
if (mailScope.kind === "snapshot") {
|
|
404
|
+
const label = typeof mailScope.snapshot_label === "string" && mailScope.snapshot_label.trim() ? mailScope.snapshot_label.trim() : "Frozen snapshot";
|
|
405
|
+
const count = typeof mailScope.snapshot_email_count === "number" ? mailScope.snapshot_email_count : null;
|
|
406
|
+
return count !== null ? `${label} (${count} ${count === 1 ? "email" : "emails"})` : label;
|
|
407
|
+
}
|
|
408
|
+
if (mailScope.kind === "org") return "Organization mailboxes";
|
|
409
|
+
const parts = [];
|
|
410
|
+
if (Array.isArray(mailScope.addresses) && mailScope.addresses.length > 0) {
|
|
411
|
+
const addrs = mailScope.addresses.filter((a) => typeof a === "string" && a.length > 0);
|
|
412
|
+
if (addrs.length > 0) parts.push(addrs.join(", "));
|
|
413
|
+
}
|
|
414
|
+
if (Array.isArray(mailScope.domains) && mailScope.domains.length > 0) {
|
|
415
|
+
const doms = mailScope.domains.filter((d) => typeof d === "string" && d.length > 0);
|
|
416
|
+
if (doms.length > 0) parts.push(`domains: ${doms.join(", ")}`);
|
|
417
|
+
}
|
|
418
|
+
if (Array.isArray(mailScope.rules) && mailScope.rules.length > 0) parts.push(`${mailScope.rules.length} rule(s)`);
|
|
419
|
+
return parts.length > 0 ? parts.join("; ") : null;
|
|
420
|
+
}
|
|
421
|
+
async function claimAccessPassRemote(params) {
|
|
422
|
+
const fetchImpl = params.fetch ?? fetch;
|
|
423
|
+
const endpoint = `${normalizeBaseUrl(params.apiBaseUrl)}/access/claim`;
|
|
424
|
+
let response;
|
|
425
|
+
try {
|
|
426
|
+
response = await fetchImpl(endpoint, {
|
|
427
|
+
method: "POST",
|
|
428
|
+
headers: {
|
|
429
|
+
"content-type": "application/json",
|
|
430
|
+
accept: "application/json"
|
|
431
|
+
},
|
|
432
|
+
body: JSON.stringify({ token: params.token })
|
|
433
|
+
});
|
|
434
|
+
} catch (error) {
|
|
435
|
+
throw new AgentPassAuthError(`Could not reach Primitive to claim the Access Pass: ${error instanceof Error ? error.message : String(error)}`);
|
|
436
|
+
}
|
|
437
|
+
const payload = await response.json().catch(() => null);
|
|
438
|
+
if (!response.ok) throw new AgentPassAuthError(`Could not claim Access Pass: ${extractErrorMessage(payload, response.status)}`);
|
|
439
|
+
const data = isRecord$3(payload) && isRecord$3(payload.data) ? payload.data : payload;
|
|
440
|
+
if (!isRecord$3(data) || typeof data.api_key !== "string" || !data.api_key) throw new AgentPassAuthError("Primitive returned an unexpected Access Pass claim response.");
|
|
441
|
+
const grantSummary = isRecord$3(data.grant_summary) ? data.grant_summary : null;
|
|
442
|
+
const expiresAt = typeof data.expires_at === "string" && !Number.isNaN(Date.parse(data.expires_at)) ? data.expires_at : new Date(Date.now() + 144e5).toISOString();
|
|
443
|
+
const resolvedApiBaseUrl = typeof data.api_base_url === "string" && data.api_base_url.trim() ? validateAccessBaseUrl(data.api_base_url.trim()) : validateAccessBaseUrl(normalizeBaseUrl(params.apiBaseUrl));
|
|
444
|
+
const label = grantSummary && typeof grantSummary.label === "string" && grantSummary.label.trim() ? grantSummary.label.trim() : typeof data.label === "string" && data.label.trim() ? data.label.trim() : typeof data.name === "string" && data.name.trim() ? data.name.trim() : "Agent Pass";
|
|
445
|
+
const mode = grantSummary && typeof grantSummary.mode === "string" && grantSummary.mode.trim() ? grantSummary.mode.trim() : typeof data.mode === "string" && data.mode.trim() ? data.mode.trim() : "read_only";
|
|
446
|
+
const purpose = typeof data.purpose === "string" && data.purpose.trim() ? data.purpose.trim() : grantSummary && typeof grantSummary.purpose === "string" && grantSummary.purpose.trim() ? grantSummary.purpose.trim() : null;
|
|
447
|
+
return {
|
|
448
|
+
api_key: data.api_key,
|
|
449
|
+
api_base_url: resolvedApiBaseUrl,
|
|
450
|
+
pass_id: typeof data.pass_id === "string" ? data.pass_id : typeof data.invitation_id === "string" ? data.invitation_id : null,
|
|
451
|
+
key_id: typeof data.key_id === "string" ? data.key_id : null,
|
|
452
|
+
label,
|
|
453
|
+
mode,
|
|
454
|
+
purpose,
|
|
455
|
+
profile_hint: typeof data.profile_hint === "string" && data.profile_hint.trim() ? data.profile_hint.trim() : null,
|
|
456
|
+
mcp_url: typeof data.mcp_url === "string" && data.mcp_url.trim() ? data.mcp_url.trim() : null,
|
|
457
|
+
expires_at: expiresAt,
|
|
458
|
+
slice_summary: deriveSliceSummary(data, grantSummary),
|
|
459
|
+
grant_summary: grantSummary,
|
|
460
|
+
preview: data.preview ?? null,
|
|
461
|
+
guide: data.guide ?? null
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
async function revokeAccessPassRemote(params) {
|
|
465
|
+
const fetchImpl = params.fetch ?? fetch;
|
|
466
|
+
const endpoint = `${validateAccessBaseUrl(normalizeBaseUrl(params.apiBaseUrl))}/keys/me/revoke`;
|
|
467
|
+
let response;
|
|
468
|
+
try {
|
|
469
|
+
response = await fetchImpl(endpoint, {
|
|
470
|
+
method: "POST",
|
|
471
|
+
headers: {
|
|
472
|
+
authorization: `Bearer ${params.apiKey}`,
|
|
473
|
+
accept: "application/json"
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
} catch (error) {
|
|
477
|
+
throw new AgentPassAuthError(`Could not reach Primitive to revoke the Access Pass: ${error instanceof Error ? error.message : String(error)}`);
|
|
478
|
+
}
|
|
479
|
+
if (response.ok) return {
|
|
480
|
+
revoked: true,
|
|
481
|
+
alreadyRevoked: false
|
|
482
|
+
};
|
|
483
|
+
if (response.status === 401) return {
|
|
484
|
+
revoked: true,
|
|
485
|
+
alreadyRevoked: true
|
|
486
|
+
};
|
|
487
|
+
const payload = await response.json().catch(() => null);
|
|
488
|
+
const hint = response.status === 403 || response.status === 404 ? " Local credentials were kept so you can retry; revoke the pass in the Primitive dashboard or pass --local-only to remove only the local file." : "";
|
|
489
|
+
throw new AgentPassAuthError(`Could not revoke Access Pass: ${extractErrorMessage(payload, response.status)}.${hint}`);
|
|
490
|
+
}
|
|
41
491
|
// src/oclif/connected-agent-profile.ts
|
|
42
492
|
const AGENT_PROFILE_ENV = "PRIMITIVE_AGENT_PROFILE";
|
|
43
493
|
/**
|
|
@@ -748,6 +1198,41 @@ function resolveCliAuth(params) {
|
|
|
748
1198
|
source: "connected-profile"
|
|
749
1199
|
};
|
|
750
1200
|
}
|
|
1201
|
+
const env = params.env ?? process.env;
|
|
1202
|
+
const passProfile = env["PRIMITIVE_AGENT_PASS_PROFILE"]?.trim() || void 0;
|
|
1203
|
+
if (passProfile !== void 0) {
|
|
1204
|
+
const activePass = loadActiveAgentPass({
|
|
1205
|
+
configDir: params.configDir,
|
|
1206
|
+
profile: passProfile,
|
|
1207
|
+
env
|
|
1208
|
+
});
|
|
1209
|
+
if (activePass) {
|
|
1210
|
+
const validatedOverrideBase = params.apiBaseUrl !== void 0 ? validateAccessBaseUrl(apiBaseUrl) : void 0;
|
|
1211
|
+
if (apiKey && apiKey !== activePass.pass.api_key || validatedOverrideBase !== void 0 && validatedOverrideBase !== activePass.pass.api_base_url) throw new AgentPassAuthError(`An explicit API key or API origin conflicts with Access Pass profile ${passProfile} selected by ${AGENT_PASS_PROFILE_ENV}; drop the override or unset ${AGENT_PASS_PROFILE_ENV}.`);
|
|
1212
|
+
return {
|
|
1213
|
+
apiKey: activePass.pass.api_key,
|
|
1214
|
+
apiBaseUrl: activePass.pass.api_base_url,
|
|
1215
|
+
credentials: null,
|
|
1216
|
+
agentPass: agentPassMetadata(activePass.pass),
|
|
1217
|
+
source: "agent-pass"
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
const activePass = loadActiveAgentPass({
|
|
1222
|
+
configDir: params.configDir,
|
|
1223
|
+
env
|
|
1224
|
+
});
|
|
1225
|
+
if (activePass) {
|
|
1226
|
+
const validatedOverrideBase = params.apiBaseUrl !== void 0 ? validateAccessBaseUrl(apiBaseUrl) : void 0;
|
|
1227
|
+
if (apiKey && apiKey !== activePass.pass.api_key || validatedOverrideBase !== void 0 && validatedOverrideBase !== activePass.pass.api_base_url) throw new AgentPassAuthError(`An explicit API key or API origin conflicts with the active Access Pass (${activePass.pass.label}) bound to this session; run \`primitive disconnect\` or unset PRIMITIVE_API_KEY to use a different credential.`);
|
|
1228
|
+
return {
|
|
1229
|
+
apiKey: activePass.pass.api_key,
|
|
1230
|
+
apiBaseUrl: activePass.pass.api_base_url,
|
|
1231
|
+
credentials: null,
|
|
1232
|
+
agentPass: agentPassMetadata(activePass.pass),
|
|
1233
|
+
source: "agent-pass"
|
|
1234
|
+
};
|
|
1235
|
+
}
|
|
751
1236
|
if (apiKey) return {
|
|
752
1237
|
apiKey,
|
|
753
1238
|
apiBaseUrl,
|
|
@@ -946,4 +1431,4 @@ function redactCliEnvironment(environment) {
|
|
|
946
1431
|
...headers ? { headers } : {}
|
|
947
1432
|
};
|
|
948
1433
|
}
|
|
949
|
-
export {
|
|
1434
|
+
export { loadCachedAgentPassByToken as $, saveActiveChatState as A, parseConnectedAgentProfile as B, resolveCliAuth as C, deleteChatState as D, chatStatePath as E, agentProfileName as F, AGENT_PASS_PROFILE_ENV as G, profileAlreadyConnectedMessage as H, agentProfilesDirectory as I, agentPassTokenSha256 as J, AgentPassAuthError as K, connectedAgentIdentity as L, AGENT_PROFILE_ENV as M, AgentConnectionSetupError as N, loadActiveChatState as O, agentProfileDirectory as P, loadActiveAgentPass as Q, connectedApiBaseUrl as R, normalizeApiBaseUrl as S, saveSignupCredentials as T, requireDefaultLoginProfile as U, parseOwnerMemberAddress as V, saveConnectedAgentProfile as W, deleteAgentPass as X, claimAccessPassRemote as Y, isAgentPassExpired as Z, credentialsPath as _, normalizeCliEnvironmentName as a, detectAgentRuntime as at, detectPrimitiveKeyEnvMisname as b, removeCliEnvironment as c, PrimitiveApiClient as ct, upsertCliEnvironment as d, parseAccessPassInput as et, validateCliHeaderName as f, credentialsLockPath as g, cliAccessTokenExpiresAt as h, loadCliConfig as i, saveAgentPass as it, AGENT_ADDRESS_ENV as j, loadChatConversationByLocalId as k, resolveConfigEnvironment as l, acquireCliCredentialsLock as m, deleteCliConfig as n, resolveAgentPassSlot as nt, parseHeaderAssignment as o, detectRuntimeSession as ot, validateCliHeaderValue as p, agentPassMetadata as q, emptyCliConfig as r, revokeAccessPassRemote as rt, redactCliEnvironment as s, runtimeSessionVariableList as st, DEFAULT_ENVIRONMENT as t, readAgentPassFile as tt, saveCliConfig as u, deleteCliCredentials as v, saveCliCredentials as w, loadCliCredentials as x, deleteCliCredentialsLock as y, loadConnectedAgentProfile as z };
|
|
@@ -343,4 +343,4 @@ function guardJsonOutputCommands(commands) {
|
|
|
343
343
|
if (flags && "json" in flags || enableJsonFlag === true) guardJsonOutput(command);
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
export {
|
|
346
|
+
export { runStreamingJson as a, jsonOutputRequested as i, captureOutput as n, thrownErrorBody as o, guardJsonOutputCommands as r, JSON_OUTPUT_FLAG as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import { An as putAgentContact, Ft as getContact, Gn as sendEmail, Hn as searchEmails, Mn as putContact, Pt as getAgentContactPolicy, St as deleteContact, an as listAgentContacts, fr as __exportAll, in as listAgentConnections, jn as putAgentContactPolicy, sn as listContacts, tn as inviteAgentConnection, un as listDomains, wn as listSentEmails, xt as deleteAgentContact, zt as getEmail } from "./repeats-Dj_o6c-X-
|
|
3
|
-
import {
|
|
1
|
+
import { B as parseConnectedAgentProfile, F as agentProfileName, H as profileAlreadyConnectedMessage, I as agentProfilesDirectory, L as connectedAgentIdentity, M as AGENT_PROFILE_ENV, N as AgentConnectionSetupError, P as agentProfileDirectory, R as connectedApiBaseUrl, V as parseOwnerMemberAddress, W as saveConnectedAgentProfile, at as detectAgentRuntime, ct as PrimitiveApiClient, x as loadCliCredentials, z as loadConnectedAgentProfile } from "./cli-config-DUQEYQ42.js";
|
|
2
|
+
import { An as putAgentContact, Ft as getContact, Gn as sendEmail, Hn as searchEmails, Mn as putContact, Pt as getAgentContactPolicy, St as deleteContact, an as listAgentContacts, fr as __exportAll, in as listAgentConnections, jn as putAgentContactPolicy, sn as listContacts, tn as inviteAgentConnection, un as listDomains, wn as listSentEmails, xt as deleteAgentContact, zt as getEmail } from "./repeats-Dj_o6c-X-x61TNLz-.js";
|
|
3
|
+
import { bn as refreshStoredCliCredentials, jt as defaultConnectionName, kt as cliInvocation, xn as refuseOrgSelectionForProfile } from "./api-command-CP8ir5Pv.js";
|
|
4
4
|
import { _ as acquireListenLock, b as listenLockHeld, c as mailTime, d as readMailJson, f as removeMailFile, g as ListenStateError, h as writeMailJson, i as mailId, l as privateMailDirectory, o as mailObject, p as syncMailDirectory, r as mailAddress, s as mailString } from "./shared-mail-files-BAQSGxxz.js";
|
|
5
|
-
import { C as readBundledConnectSkill, a as NotificationRetryError, b as installSkill, d as SESSION_UUID, f as connectNativeSession, m as NativeSessionDisconnectedError, p as defaultSessionSocket, t as notificationScope } from "./notify-session-
|
|
5
|
+
import { C as readBundledConnectSkill, a as NotificationRetryError, b as installSkill, d as SESSION_UUID, f as connectNativeSession, m as NativeSessionDisconnectedError, p as defaultSessionSocket, t as notificationScope } from "./notify-session-Dx54UpkT.js";
|
|
6
6
|
import { a as backgroundListenStatus, d as stopBackgroundListen } from "./listen-background-DyBYca28.js";
|
|
7
|
-
import { t as readSharedMailOwner } from "./shared-mail-watch-
|
|
7
|
+
import { t as readSharedMailOwner } from "./shared-mail-watch-DdtgJOrV.js";
|
|
8
8
|
import { withoutOrgSelection } from "./oclif/global-org-flag.js";
|
|
9
|
-
import { o as scopedChatSenderTrust } from "./scoped-chat-
|
|
9
|
+
import { o as scopedChatSenderTrust } from "./scoped-chat-Bss3OjFI.js";
|
|
10
10
|
import { accessSync, chmodSync, closeSync, constants, copyFileSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, rmdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
|
|
11
11
|
import { createHash, randomUUID } from "node:crypto";
|
|
12
12
|
import { basename, delimiter, dirname, isAbsolute, join, resolve } from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as isTrustedSender, c as classifySignalContent, g as isEmailReceivedEvent, kt as downloadEmailAttachmentPart, v as parseWebhookEvent } from "./repeats-Dj_o6c-X-
|
|
2
|
-
import {
|
|
1
|
+
import { _ as isTrustedSender, c as classifySignalContent, g as isEmailReceivedEvent, kt as downloadEmailAttachmentPart, v as parseWebhookEvent } from "./repeats-Dj_o6c-X-x61TNLz-.js";
|
|
2
|
+
import { R as skillFirstLine, et as wakeInteractionSentence, z as wakeReadCommand } from "./api-command-CP8ir5Pv.js";
|
|
3
3
|
import { _ as acquireListenLock, g as ListenStateError, y as listenIdentity } from "./shared-mail-files-BAQSGxxz.js";
|
|
4
4
|
import { closeSync, copyFileSync, existsSync, fsyncSync, lstatSync, mkdirSync, openSync, opendirSync, readFileSync, readdirSync, readlinkSync, renameSync, rmSync, statSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { createHash, randomUUID, scryptSync } from "node:crypto";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Qt as getSentEmail } from "../repeats-Dj_o6c-X-
|
|
2
|
-
import {
|
|
1
|
+
import { Qt as getSentEmail } from "../repeats-Dj_o6c-X-x61TNLz-.js";
|
|
2
|
+
import { P as readThreadContext, vn as createAuthenticatedCliApiClient } from "../api-command-CP8ir5Pv.js";
|
|
3
3
|
import { AUTO_SIGNAL_KIND_ENV, AUTO_WORKING_RENEW_MS, autoSignalsDisabled, clearWorkingSending, markWorkingSending, readAutoClaim, readWorkingLease, recordRenewer, stopWorkingLease, writeWorkingLease } from "./auto-signals.js";
|
|
4
4
|
import { _ as acquireListenLock } from "../shared-mail-files-BAQSGxxz.js";
|
|
5
|
-
import { t as sendSignal } from "../signal-command-
|
|
5
|
+
import { t as sendSignal } from "../signal-command-CA55RTJh.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
// src/oclif/auto-signal-worker.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as isPlainChatReply, o as scopedChatSenderTrust } from "../scoped-chat-
|
|
1
|
+
import { n as isPlainChatReply, o as scopedChatSenderTrust } from "../scoped-chat-Bss3OjFI.js";
|
|
2
2
|
import { d as readMailJson, h as writeMailJson, i as mailId, l as privateMailDirectory, r as mailAddress } from "../shared-mail-files-BAQSGxxz.js";
|
|
3
3
|
import { existsSync, readFileSync, readdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as COMMAND_RENAMES } from "../cli-command-names-DteMqL-H.js";
|
|
2
|
+
import { i as jsonOutputRequested } from "../json-output-BMZrLH47.js";
|
|
3
3
|
// src/oclif/command-not-found.ts
|
|
4
4
|
/** At most this many commands are suggested for one word. */
|
|
5
5
|
const MOST_SUGGESTED = 3;
|
|
@@ -81,6 +81,7 @@ function visibleEntries(commands, topics) {
|
|
|
81
81
|
function commandNotFoundMessage(id, lookup) {
|
|
82
82
|
const parts = id.split(":");
|
|
83
83
|
const typed = `primitive ${parts.join(" ")}`;
|
|
84
|
+
if (id === "focus:get" && lookup.visible?.includes("focus") && lookup.find("focus")) return unknown(typed, ["focus"], "Run \"primitive focus --help\" to see its options.", lookup);
|
|
84
85
|
const replacement = Object.hasOwn(COMMAND_RENAMES, id) ? COMMAND_RENAMES[id] : void 0;
|
|
85
86
|
if (replacement && lookup.visible?.includes(replacement)) return unknown(typed, [replacement], "Run \"primitive --help\" to see the commands.", lookup);
|
|
86
87
|
for (let end = parts.length - 1; end > 0; end -= 1) {
|