primcli 3.0.0-preview.1 → 3.0.0-preview.11
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 +21 -11
- package/dist/api-command-CkMEFiBL.js +56583 -0
- package/dist/{json-output-BzSBR-KX.js → json-output-ch756TXV.js} +14 -1
- package/dist/{listen-background-C0F9gNDD.js → listen-background-DyBYca28.js} +323 -36
- package/dist/{machine-session-Cp_eQ9t_.js → machine-session-D39TUEGF.js} +6 -6
- package/dist/{notify-session-BN0JTPZ3.js → notify-session-DcFHxUL9.js} +3 -3
- package/dist/oclif/auto-signal-worker.js +3 -3
- package/dist/oclif/auto-signals.js +1 -1
- package/dist/oclif/command-not-found.js +62 -0
- package/dist/oclif/index.js +14204 -51004
- package/dist/oclif/listen-supervisor.js +1 -1
- package/dist/oclif/proxy-auto-detect.js +1 -1
- package/dist/oclif/receiver-heal.js +4 -3
- package/dist/oclif/root-signup-hint.js +15 -15
- package/dist/{repeats-Dj_o6c-X-Bf9G0xds.js → repeats-Dj_o6c-X-ChTwFlyB.js} +758 -226
- package/dist/{scoped-chat-DZ42V3jq.js → scoped-chat-DVhJu-DF.js} +1 -1
- package/dist/{signal-command-CRUMUCNa.js → signal-command-CGgHQ_po.js} +4 -4
- package/man/primitive.1 +20 -4
- package/package.json +18 -6
- package/dist/api-command-ctHBqTL5.js +0 -3634
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { l as runBackgroundListenSupervisor } from "../listen-background-DyBYca28.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { N as agentProfileDirectory, P as agentProfileName, R as loadConnectedAgentProfile, j as AGENT_PROFILE_ENV } from "../cli-config-Ms_0vNjq.js";
|
|
2
|
-
import { a as
|
|
3
|
-
import { d as SESSION_UUID, t as notificationScope } from "../notify-session-
|
|
4
|
-
import {
|
|
2
|
+
import { a as backgroundListenStatus, i as backgroundListenRestartable, s as claimBackgroundListenRestart, t as BACKGROUND_LISTEN_RELAUNCH_ENV } from "../listen-background-DyBYca28.js";
|
|
3
|
+
import { d as SESSION_UUID, t as notificationScope } from "../notify-session-DcFHxUL9.js";
|
|
4
|
+
import { Lt as detectAgentRuntime } from "../api-command-CkMEFiBL.js";
|
|
5
5
|
import { d as readMailJson } from "../shared-mail-files-BAQSGxxz.js";
|
|
6
6
|
import { join } from "node:path";
|
|
7
7
|
import { spawn } from "node:child_process";
|
|
@@ -66,6 +66,7 @@ function healSelectedReceiver(options = {}) {
|
|
|
66
66
|
PRIMITIVE_CONFIG_DIR: configDir,
|
|
67
67
|
[RECEIVER_HEAL_ENV]: "0"
|
|
68
68
|
};
|
|
69
|
+
delete childEnv[BACKGROUND_LISTEN_RELAUNCH_ENV];
|
|
69
70
|
(options.spawnListener ?? spawnDetached)(listenArgv, childEnv);
|
|
70
71
|
return {
|
|
71
72
|
action: "restarting",
|
|
@@ -31,23 +31,23 @@ function readRootCredentials(configDir) {
|
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return `${apiBaseUrl.replace(/\/+$/, "")}/
|
|
34
|
+
function whoamiEndpoint(apiBaseUrl) {
|
|
35
|
+
return `${apiBaseUrl.replace(/\/+$/, "")}/whoami`;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function parseRootIdentity(payload) {
|
|
38
38
|
if (payload === null || typeof payload !== "object" || Array.isArray(payload)) return null;
|
|
39
39
|
const data = payload.data;
|
|
40
40
|
if (data === null || typeof data !== "object" || Array.isArray(data)) return null;
|
|
41
|
-
const
|
|
42
|
-
if (typeof
|
|
43
|
-
|
|
41
|
+
const identity = data;
|
|
42
|
+
if (typeof identity.org_id !== "string" || !identity.org_id.trim()) return null;
|
|
43
|
+
const member = identity.member_address;
|
|
44
44
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
memberAddress: member && typeof member.address === "string" && member.address.trim() ? member.address : null,
|
|
46
|
+
orgId: identity.org_id
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
function rootAuthLine(
|
|
50
|
-
return `Signed in as ${
|
|
49
|
+
function rootAuthLine(identity) {
|
|
50
|
+
return identity.memberAddress ? `Signed in as ${identity.memberAddress} (org ${identity.orgId})\n\n` : `Signed in (org ${identity.orgId})\n\n`;
|
|
51
51
|
}
|
|
52
52
|
function rootRequestConfig(configDir, env) {
|
|
53
53
|
const config = loadCliConfig(configDir);
|
|
@@ -60,11 +60,11 @@ function rootRequestConfig(configDir, env) {
|
|
|
60
60
|
headers: currentEnvironment?.config.headers
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
async function
|
|
63
|
+
async function fetchRootIdentity(params) {
|
|
64
64
|
const controller = new AbortController();
|
|
65
65
|
const timer = setTimeout(() => controller.abort(), params.timeoutMs);
|
|
66
66
|
try {
|
|
67
|
-
const response = await params.fetch(
|
|
67
|
+
const response = await params.fetch(whoamiEndpoint(params.apiBaseUrl), {
|
|
68
68
|
headers: {
|
|
69
69
|
...params.headers ?? {},
|
|
70
70
|
accept: "application/json",
|
|
@@ -73,7 +73,7 @@ async function fetchRootAccount(params) {
|
|
|
73
73
|
signal: controller.signal
|
|
74
74
|
});
|
|
75
75
|
if (!response.ok) return null;
|
|
76
|
-
return
|
|
76
|
+
return parseRootIdentity(await response.json().catch(() => null));
|
|
77
77
|
} catch {
|
|
78
78
|
return null;
|
|
79
79
|
} finally {
|
|
@@ -95,14 +95,14 @@ async function rootSignedInSummary(options = {}) {
|
|
|
95
95
|
const stored = explicitApiKey ? null : readRootCredentials(configDir);
|
|
96
96
|
const apiKey = explicitApiKey || stored?.accessToken;
|
|
97
97
|
if (!apiKey) return null;
|
|
98
|
-
const
|
|
98
|
+
const identity = await fetchRootIdentity({
|
|
99
99
|
apiBaseUrl: stored?.apiBaseUrl ?? requestConfig.apiBaseUrl,
|
|
100
100
|
apiKey,
|
|
101
101
|
fetch: options.fetch ?? fetch,
|
|
102
102
|
headers: requestConfig.headers,
|
|
103
103
|
timeoutMs: options.timeoutMs ?? ROOT_AUTH_TIMEOUT_MS
|
|
104
104
|
});
|
|
105
|
-
return
|
|
105
|
+
return identity ? rootAuthLine(identity) : null;
|
|
106
106
|
}
|
|
107
107
|
function shouldShowLoggedOutSignupHint(options = {}) {
|
|
108
108
|
if ((options.argv ?? process.argv.slice(2)).length > 0) return false;
|