@primitivedotdev/cli 3.0.0-preview.2 → 3.0.0-preview.20
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 +81 -26
- package/dist/api-command-DXiAX_N2.js +60960 -0
- package/dist/help-inputs-NGARVZL_.js +109 -0
- package/dist/{json-output-BzSBR-KX.js → json-output-xgN0ZLWP.js} +31 -6
- package/dist/{listen-background-C0F9gNDD.js → listen-background-DyBYca28.js} +323 -36
- package/dist/{machine-session-g-xPd3X0.js → machine-session-Cvo9BqYB.js} +7 -7
- package/dist/{notify-session-Bo8WgG3q.js → notify-session-C8USviF_.js} +71 -32
- package/dist/oclif/auto-signal-worker.js +3 -3
- package/dist/oclif/auto-signals.js +1 -1
- package/dist/oclif/command-not-found.js +129 -0
- package/dist/oclif/help.js +70 -13
- package/dist/oclif/index.js +36758 -71899
- 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-BzXj5ICh.js → repeats-Dj_o6c-X-CliyH3ge.js} +14615 -13905
- package/dist/retry-ids-04ZPJCZY.js +59 -0
- package/dist/{scoped-chat-TJlyUTi7.js → scoped-chat-CUy0Ta_y.js} +1 -1
- package/dist/{signal-command-BO93dM2Q.js → signal-command-DHwFky03.js} +12 -6
- package/man/primitive.1 +27 -11
- package/package.json +22 -7
- package/dist/api-command-B37DPKFA.js +0 -3634
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
function object(value) {
|
|
3
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
4
|
+
}
|
|
5
|
+
/** Only explicit annotations on UUID input fields enable defaults. */
|
|
6
|
+
function retryIdFields(schema) {
|
|
7
|
+
if (!object(schema) || !object(schema.properties)) return [];
|
|
8
|
+
return Object.entries(schema.properties).filter(([, property]) => object(property) && property["x-primitive-retry-id"] === true && property.type === "string" && property.format === "uuid").map(([name]) => name);
|
|
9
|
+
}
|
|
10
|
+
function prepareRetryIds(schema, body, bodyFlagToProperty, generate = randomUUID) {
|
|
11
|
+
if (body !== void 0 && !object(body)) return {
|
|
12
|
+
body,
|
|
13
|
+
ids: []
|
|
14
|
+
};
|
|
15
|
+
const flags = new Map([...bodyFlagToProperty].map(([flag, property]) => [property, `--${flag}`]));
|
|
16
|
+
let prepared = body;
|
|
17
|
+
const ids = [];
|
|
18
|
+
for (const field of retryIdFields(schema)) {
|
|
19
|
+
if (object(prepared) && Object.hasOwn(prepared, field)) continue;
|
|
20
|
+
if (prepared === body) prepared = { ...object(body) ? body : {} };
|
|
21
|
+
const value = generate();
|
|
22
|
+
Object.defineProperty(prepared, field, {
|
|
23
|
+
value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
ids.push({
|
|
29
|
+
field,
|
|
30
|
+
flag: flags.get(field) ?? null,
|
|
31
|
+
json_path: /^[A-Za-z_][A-Za-z0-9_]*$/.test(field) ? `$.${field}` : `$[${JSON.stringify(field)}]`,
|
|
32
|
+
value,
|
|
33
|
+
source: "generated"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
body: prepared,
|
|
38
|
+
ids
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const generatedIds = /* @__PURE__ */ new WeakMap();
|
|
42
|
+
/** Store metadata per invocation, never on a shared command class or alias. */
|
|
43
|
+
function rememberRetryIds(command, ids) {
|
|
44
|
+
if (ids.length) generatedIds.set(command, ids);
|
|
45
|
+
else generatedIds.delete(command);
|
|
46
|
+
}
|
|
47
|
+
function takeRetryIds(command) {
|
|
48
|
+
const ids = generatedIds.get(command) ?? [];
|
|
49
|
+
generatedIds.delete(command);
|
|
50
|
+
return ids;
|
|
51
|
+
}
|
|
52
|
+
function writeRetryIdNotice(ids) {
|
|
53
|
+
for (const id of ids) {
|
|
54
|
+
const reference = id.flag ?? id.json_path;
|
|
55
|
+
const retry = id.flag ? `with ${id.flag} ${id.value}` : `with ${id.json_path} set to this value in your JSON body`;
|
|
56
|
+
process.stderr.write(`Retry ID (${reference}): ${id.value}\nRetry the same operation and inputs ${retry}.\n`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export { writeRetryIdNotice as a, takeRetryIds as i, rememberRetryIds as n, retryIdFields as r, prepareRetryIds as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as retryTransient, _ as isTrustedSender, c as classifySignalContent } from "./repeats-Dj_o6c-X-CliyH3ge.js";
|
|
2
2
|
// src/oclif/presence-provenance.ts
|
|
3
3
|
function readPresenceProjection(detail) {
|
|
4
4
|
if (!detail || typeof detail !== "object") return null;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Gn as sendEmail, S as describeApiFailure, h as sendPreparedSignal, ht as createEndpoint, p as prepareSignalEmail, wn as listSentEmails, zt as getEmail } from "./repeats-Dj_o6c-X-CliyH3ge.js";
|
|
2
|
+
import { M as bareAddress, ft as classifySendError, kt as successfulSendOutcome, s as extractErrorPayload } from "./api-command-DXiAX_N2.js";
|
|
3
3
|
import { recordSentSignal } from "./oclif/auto-signals.js";
|
|
4
4
|
import { _ as acquireListenLock, c as mailTime, d as readMailJson, f as removeMailFile, h as writeMailJson, i as mailId, l as privateMailDirectory, m as withMailLock, n as invalidSharedMail, o as mailObject, p as syncMailDirectory, r as mailAddress, s as mailString, t as SharedMailStateError, v as compareListenProcessIdentity, x as listenProcessIdentity, y as listenIdentity } from "./shared-mail-files-BAQSGxxz.js";
|
|
5
|
-
import { i as readApiBeforeDeadline, n as isPlainChatReply, o as scopedChatSenderTrust } from "./scoped-chat-
|
|
5
|
+
import { i as readApiBeforeDeadline, n as isPlainChatReply, o as scopedChatSenderTrust } from "./scoped-chat-CUy0Ta_y.js";
|
|
6
6
|
import { n as tryOwnSharedMail, r as waitForSharedMailChange, t as readSharedMailOwner } from "./shared-mail-watch-BAPMsFNv.js";
|
|
7
7
|
import { Errors } from "@oclif/core";
|
|
8
8
|
import { opendirSync } from "node:fs";
|
|
9
9
|
import { createHash, randomUUID, scryptSync } from "node:crypto";
|
|
10
10
|
import { dirname, join } from "node:path";
|
|
11
11
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
12
|
-
// ../sdk-node/dist/api-
|
|
12
|
+
// ../sdk-node/dist/api-DgSs0mmn.js
|
|
13
13
|
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
14
14
|
function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
|
|
15
15
|
let lastEventId;
|
|
@@ -1831,6 +1831,10 @@ async function openSharedMailStore(options) {
|
|
|
1831
1831
|
/** The API's code for an account credential creating a pull subscription. */
|
|
1832
1832
|
const AGENT_CONNECTION_REQUIRED = "pull_subscription_requires_agent_connection";
|
|
1833
1833
|
const AGENT_CONNECTION_REQUIRED_MESSAGE = "primitive listen needs a connected agent credential, which limits the subscription to one address. Connect one with primitive agent connect and select its profile. With an account API key, watch mail with primitive emails watch or receive it at an HTTP webhook endpoint instead.";
|
|
1834
|
+
/** The API's code for a full API key that was revoked. */
|
|
1835
|
+
const KEY_REVOKED = "key_revoked";
|
|
1836
|
+
/** What a listener says when its agent's key was revoked: connect again, as signing in cannot bring it back. */
|
|
1837
|
+
const KEY_REVOKED_MESSAGE = "This agent's key was revoked, so it no longer works. Connect the agent again for a new one; signing in does not bring it back.";
|
|
1834
1838
|
/** Connected-agent API keys are the only credentials that can create pull subscriptions. */
|
|
1835
1839
|
function isConnectedAgentKey(apiKey) {
|
|
1836
1840
|
return apiKey?.startsWith("pconn_") === true;
|
|
@@ -1855,7 +1859,9 @@ async function ensureSharedMailSubscription(options) {
|
|
|
1855
1859
|
responseStyle: "fields"
|
|
1856
1860
|
});
|
|
1857
1861
|
if (result.error || !result.data?.data) {
|
|
1858
|
-
|
|
1862
|
+
const error = result.error;
|
|
1863
|
+
if (error?.error?.code === "pull_subscription_requires_agent_connection") throw new EventReceiverError(AGENT_CONNECTION_REQUIRED_MESSAGE, AGENT_CONNECTION_REQUIRED, 403);
|
|
1864
|
+
if (error?.error?.code === "key_revoked") throw new EventReceiverError(KEY_REVOKED_MESSAGE, KEY_REVOKED, 401);
|
|
1859
1865
|
throw new EventReceiverError("Could not open the shared inbound subscription.", "subscription_failed", result.response?.status ?? 0);
|
|
1860
1866
|
}
|
|
1861
1867
|
const created = result.data.data;
|
|
@@ -2338,4 +2344,4 @@ async function sendSignal(context, options) {
|
|
|
2338
2344
|
release();
|
|
2339
2345
|
}
|
|
2340
2346
|
}
|
|
2341
|
-
export { ensureSharedMailSubscription as a,
|
|
2347
|
+
export { EventConnection as _, ensureSharedMailSubscription as a, KEY_REVOKED as c, createSharedMailWaiter as d, openSharedMailStore as f, otherParticipants as g, readConversationFollow as h, sharedMailScope as i, KEY_REVOKED_MESSAGE as l, followEmailConversation as m, reconcileChatSend as n, AGENT_CONNECTION_REQUIRED as o, reserveSharedMailSubscription as p, openSharedMailReceiver as r, AGENT_CONNECTION_REQUIRED_MESSAGE as s, sendSignal as t, isConnectedAgentKey as u, EventReceiverError as v };
|
package/man/primitive.1
CHANGED
|
@@ -35,16 +35,20 @@ array; a failure adds
|
|
|
35
35
|
.B error
|
|
36
36
|
and
|
|
37
37
|
.BR exit_code .
|
|
38
|
-
Generated API commands
|
|
38
|
+
Generated API commands print the API's response body with
|
|
39
39
|
.BR --json :
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
to get the full response envelope, with the pagination cursor in
|
|
40
|
+
.BR data ,
|
|
41
|
+
and
|
|
42
|
+
.B meta
|
|
43
|
+
with the pagination cursor in
|
|
45
44
|
.B meta.cursor
|
|
46
|
-
|
|
45
|
+
where the route sends it, plus the CLI's own
|
|
47
46
|
.BR summary .
|
|
47
|
+
Without
|
|
48
|
+
.BR --json ,
|
|
49
|
+
stdout is the data payload and the
|
|
50
|
+
.B next cursor:
|
|
51
|
+
line goes to stderr.
|
|
48
52
|
.B primitive listen
|
|
49
53
|
streams JSONL and is not covered by this rule.
|
|
50
54
|
.SH LOCAL WEBHOOK EVENTS
|
|
@@ -214,9 +218,15 @@ to see API keys and their permissions; neither shows a secret.
|
|
|
214
218
|
.B rotate
|
|
215
219
|
and
|
|
216
220
|
.B update
|
|
217
|
-
|
|
218
|
-
waits for the one-time token the page shows
|
|
219
|
-
|
|
221
|
+
run directly. If your organization requires approval, the command prints the
|
|
222
|
+
approval link and waits for the one-time token the page shows, or takes it with
|
|
223
|
+
.BR --step-up-token .
|
|
224
|
+
A new secret is printed once and never saved.
|
|
225
|
+
.B primitive keys update ID --expires-at TIME
|
|
226
|
+
extends a key before it expires; rotating keeps its expiry unless
|
|
227
|
+
.B rotate
|
|
228
|
+
is given
|
|
229
|
+
.BR --expires-at .
|
|
220
230
|
.B primitive keys revoke ID
|
|
221
231
|
revokes a key.
|
|
222
232
|
.B primitive whoami --check PERMISSION
|
|
@@ -231,7 +241,8 @@ signed in with
|
|
|
231
241
|
can leave; API keys are refused. The only owner of an organization cannot leave
|
|
232
242
|
it. If the server asks for a dashboard confirmation, open the page it names and
|
|
233
243
|
paste the token at the prompt, or pass it with --step-up-token. Refusals from
|
|
234
|
-
the server are printed as returned.
|
|
244
|
+
the server are printed as returned. Without a terminal and without --yes, it
|
|
245
|
+
exits 2 before anything is sent.
|
|
235
246
|
.PP
|
|
236
247
|
Run
|
|
237
248
|
.B primitive whoami
|
|
@@ -312,6 +323,11 @@ Manage the repeating sends you created.
|
|
|
312
323
|
As the recipient, stop a repeat. ID is the repeat id from the message footer
|
|
313
324
|
or the id of a received message of the repeat.
|
|
314
325
|
.TP
|
|
326
|
+
.B primitive skills install [NAME] --runtime claude|codex
|
|
327
|
+
Install the skills bundled with this CLI, or only NAME, into the runtime's
|
|
328
|
+
skills folder (--project for the current directory's). A copy already at the
|
|
329
|
+
bundled version is left unchanged.
|
|
330
|
+
.TP
|
|
315
331
|
.B primitive list-operations
|
|
316
332
|
Print the generated API operation manifest.
|
|
317
333
|
.TP
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primitivedotdev/cli",
|
|
3
|
-
"version": "3.0.0-preview.
|
|
3
|
+
"version": "3.0.0-preview.20",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"tag": "preview"
|
|
6
6
|
},
|
|
@@ -42,6 +42,9 @@
|
|
|
42
42
|
"identifier": "COMMANDS"
|
|
43
43
|
},
|
|
44
44
|
"dirname": "primitive",
|
|
45
|
+
"hooks": {
|
|
46
|
+
"command_not_found": "./dist/oclif/command-not-found.js"
|
|
47
|
+
},
|
|
45
48
|
"plugins": [
|
|
46
49
|
"@oclif/plugin-help",
|
|
47
50
|
"@oclif/plugin-autocomplete",
|
|
@@ -70,6 +73,9 @@
|
|
|
70
73
|
"machine": {
|
|
71
74
|
"description": "Check and repair this machine's setup for coding agents. Use `primitive machine doctor --json` to inspect and `--fix` to repair."
|
|
72
75
|
},
|
|
76
|
+
"skills": {
|
|
77
|
+
"description": "Install the agent skills bundled with this CLI. Use `primitive skills install --runtime claude` to install them all."
|
|
78
|
+
},
|
|
73
79
|
"agent-connections": {
|
|
74
80
|
"description": "Create, list, invite, revoke, and remove connected agents; claim private invitations through stdin."
|
|
75
81
|
},
|
|
@@ -92,7 +98,7 @@
|
|
|
92
98
|
"description": "Check inbound email setup and readiness, and work through mail awaiting your reply. Prefer `primitive inbox setup` for a guided setup path, `primitive inbox status` for the readiness table, and `primitive inbox next` for the oldest email awaiting your reply."
|
|
93
99
|
},
|
|
94
100
|
"emails": {
|
|
95
|
-
"description": "List, inspect, and wait for received emails. Prefer task aliases like `primitive emails list`, `primitive emails get`, `primitive emails latest`, `primitive emails wait`, and `primitive emails watch`; generated API names remain available for compatibility."
|
|
101
|
+
"description": "List, inspect, and wait for received emails, and see what the classifier read from one. Prefer task aliases like `primitive emails list`, `primitive emails get`, `primitive emails latest`, `primitive emails facts`, `primitive emails wait`, and `primitive emails watch`; generated API names remain available for compatibility. For a one-line-per-email table, `primitive emails latest --limit 100`."
|
|
96
102
|
},
|
|
97
103
|
"search": {
|
|
98
104
|
"description": "Cross-corpus semantic search. Prefer `primitive search <query>` for lexical inbound search and `primitive semantic-search <query>` for meaning-aware ranking across inbound and outbound.",
|
|
@@ -102,10 +108,10 @@
|
|
|
102
108
|
"description": "Send outbound emails. Prefer `primitive send` for fresh sends and `primitive reply --id <inbound-id>` for replies. Use `primitive domains list` or `primitive inbox status` to find usable sender domains for --from; `primitive sending permissions` lists recipient-scope destinations you may send to."
|
|
103
109
|
},
|
|
104
110
|
"signin": {
|
|
105
|
-
"description": "Sign in
|
|
111
|
+
"description": "Sign in with browser approval or an emailed code"
|
|
106
112
|
},
|
|
107
113
|
"login": {
|
|
108
|
-
"description": "Log in
|
|
114
|
+
"description": "Log in with browser approval or an emailed code"
|
|
109
115
|
},
|
|
110
116
|
"otp": {
|
|
111
117
|
"description": "Authenticate with an emailed one-time code"
|
|
@@ -144,10 +150,10 @@
|
|
|
144
150
|
"description": "Global secrets shared across every function. Use `primitive org secrets list|set|remove`. Changes land in a function on its next redeploy; a function secret of the same name overrides the global."
|
|
145
151
|
},
|
|
146
152
|
"keys": {
|
|
147
|
-
"description": "Organization API keys: list and show them (metadata only, never secrets), create, rotate and change them
|
|
153
|
+
"description": "Organization API keys: list and show them (metadata only, never secrets), create, rotate and change them (with browser approval where your organization requires it), and revoke them."
|
|
148
154
|
},
|
|
149
155
|
"roles": {
|
|
150
|
-
"description": "Read roles, groups, mailbox access and the access mode. Use `primitive roles list|groups|mailbox-access|access-mode`; generated API names remain available."
|
|
156
|
+
"description": "Read roles, members, groups, mailbox access and the access mode. Use `primitive roles list|members|groups|mailbox-access|access-mode`; generated API names remain available."
|
|
151
157
|
},
|
|
152
158
|
"projects": {
|
|
153
159
|
"description": "Organization people, shared projects and project invitations"
|
|
@@ -164,6 +170,9 @@
|
|
|
164
170
|
"organization-settings": {
|
|
165
171
|
"description": "Your connected apps and CLI logins, the organization's connected apps, name, logo, search settings and billing"
|
|
166
172
|
},
|
|
173
|
+
"members": {
|
|
174
|
+
"description": "List the organization's members and their roles. Use `primitive members list` (the same as `primitive roles members`)."
|
|
175
|
+
},
|
|
167
176
|
"roles-and-members": {
|
|
168
177
|
"description": "Roles, member roles and removal, the mailbox access mode, break-glass, transfers and suspensions, and leaving the organization"
|
|
169
178
|
},
|
|
@@ -179,9 +188,15 @@
|
|
|
179
188
|
"stats": {
|
|
180
189
|
"description": "Received and sent mail per hour, and how webhook deliveries ended"
|
|
181
190
|
},
|
|
191
|
+
"activity": {
|
|
192
|
+
"description": "Where you learn what others asked of you and did to your mail: `primitive activity asked` (rule requests for your mail and objections to your rules), `primitive activity concerning` (other members' rules that started covering your mail or changed), and `primitive activity created` (what you created, including your requests and how they were decided). `primitive doctor` sums up what is waiting for you."
|
|
193
|
+
},
|
|
182
194
|
"email-rules": {
|
|
183
195
|
"description": "Rules written in plain English that pick out received mail"
|
|
184
196
|
},
|
|
197
|
+
"email-rule-oversight": {
|
|
198
|
+
"description": "The email rules that reach your own mailboxes, whoever wrote them, read-only, and objections asking a rule's author to turn it off"
|
|
199
|
+
},
|
|
185
200
|
"routes": {
|
|
186
201
|
"description": "Manage recipient routes. Bind an address pattern to an endpoint or function: `primitive routes add alice@d --function <id>`, `primitive routes list`, `primitive routes test <recipient>`, `primitive routes remove <id>`."
|
|
187
202
|
},
|
|
@@ -192,7 +207,7 @@
|
|
|
192
207
|
"description": "Manage repeating sends you created with `primitive send` or `primitive reply` and --repeat-every. Use `primitive repeats list|get|pause|resume|cancel`."
|
|
193
208
|
},
|
|
194
209
|
"changes": {
|
|
195
|
-
"description": "Long-poll
|
|
210
|
+
"description": "Long-poll a replayable feed of mail, send, thread mute and read-state, agent and access changes, for a login or key with changes:read. Use `primitive changes list --since start` for a baseline, then `--since <next_cursor> --wait 20`; add `--expand message` to inline each message and `--address a@x,b@y` to keep only mail to or from those addresses. Rule requests and rules over your mail are in `primitive activity asked` and `primitive activity concerning`."
|
|
196
211
|
},
|
|
197
212
|
"repeating-sends": {
|
|
198
213
|
"description": "Generated API operations for repeating sends. Prefer `primitive repeats ...` (sender) and `primitive repeat stop` (recipient)."
|