primcli 1.75.0 → 3.0.0-preview.1

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.
@@ -1,4 +1,4 @@
1
- import { b as retryTransient, c as classifySignalContent, q as isTrustedSender } from "./repeats-Dj_o6c-X-LyCkKYjp.js";
1
+ import { b as retryTransient, c as classifySignalContent, q as isTrustedSender } from "./repeats-Dj_o6c-X-Bf9G0xds.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 { Dn as sendEmail, Ft as getEmail, _ as describeApiFailure, cn as listSentEmails, h as sendPreparedSignal, p as prepareSignalEmail, pt as createEndpoint } from "./repeats-Dj_o6c-X-LyCkKYjp.js";
2
- import { Y as classifySendError, dt as successfulSendOutcome, h as bareAddress, o as extractErrorPayload } from "./api-command-rlS3eTlZ.js";
1
+ import { It as getEmail, Pn as sendEmail, _ as describeApiFailure, h as sendPreparedSignal, hn as listSentEmails, p as prepareSignalEmail, pt as createEndpoint } from "./repeats-Dj_o6c-X-Bf9G0xds.js";
2
+ import { X as classifySendError, ft as successfulSendOutcome, g as bareAddress, o as extractErrorPayload } from "./api-command-ctHBqTL5.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-B0thCwME.js";
5
+ import { i as readApiBeforeDeadline, n as isPlainChatReply, o as scopedChatSenderTrust } from "./scoped-chat-DZ42V3jq.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-D7-k6yPG.js
12
+ // ../sdk-node/dist/api-BKmwTTyX.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;
@@ -613,7 +613,7 @@ const pullWebhookEvent = (options) => (options.client ?? client$1).post({
613
613
  /**
614
614
  * Report the outcome of a local webhook delivery attempt
615
615
  *
616
- * Report normalized handling evidence for the queue, attempt and lease. Required JSON fields: queue_id, delivery_id, lease_token, mode, duration_ms. For mode=exec include exit_code; stdout includes write_succeeded; http includes status_code and optional transport_error, error_code, confirmed. Supply this discriminated request with --raw-body in the generated CLI. The server classifies success and retry. Duplicate identical completion is idempotent; a stale lease cannot finish a newer attempt. Exec success means durable input acceptance, not completion of agent reasoning. Only successful HTTP handling with recognized confirmation evidence can confirm content discard. Never send arbitrary handler output or HTTP response bodies.
616
+ * Report normalized handling evidence for the queue, attempt and lease. Required JSON fields: queue_id, delivery_id, lease_token, mode, duration_ms. For mode=exec include exit_code; stdout includes write_succeeded; sdk includes accepted (and optional timeout/io transport_error); http includes status_code and optional transport_error, error_code, confirmed. Supply this discriminated request with --raw-body in the generated CLI. The server classifies success and retry. Duplicate identical completion is idempotent; a stale lease cannot finish a newer attempt. Exec success means durable input acceptance, not completion of agent reasoning. Only successful HTTP handling with recognized confirmation evidence can confirm content discard. Never send arbitrary handler output or HTTP response bodies.
617
617
  */
618
618
  const completeWebhookEvent = (options) => (options.client ?? client$1).post({
619
619
  security: [{
@@ -652,9 +652,9 @@ function validateOffer(value) {
652
652
  "delivery_id",
653
653
  "lease_token",
654
654
  "event_type",
655
- "body",
656
655
  "lease_expires_at"
657
- ].every((key) => typeof d[key] === "string") || !Number.isFinite(Date.parse(String(d.lease_expires_at))) || !record$1(d.headers) || !Object.values(d.headers).every((header) => typeof header === "string"))) throw new EventReceiverError("Invalid event delivery response", "invalid_response");
656
+ ].every((key) => typeof d[key] === "string") || d.body !== null && d.body !== void 0 && typeof d.body !== "string" || !Number.isFinite(Date.parse(String(d.lease_expires_at))) || !record$1(d.headers) || !Object.values(d.headers).every((header) => typeof header === "string"))) throw new EventReceiverError("Invalid event delivery response", "invalid_response");
657
+ if (d !== null && d.body === void 0) d.body = null;
658
658
  return value;
659
659
  }
660
660
  function retryAfter(value) {
@@ -1928,6 +1928,7 @@ async function runSharedMailTransport(options) {
1928
1928
  const delivery = offer.delivery;
1929
1929
  if (!delivery) continue;
1930
1930
  const started = performance.now();
1931
+ if (delivery.body === null) throw invalid$1("The API withheld this event's content from the listening credential.");
1931
1932
  let body;
1932
1933
  try {
1933
1934
  body = JSON.parse(delivery.body);
@@ -2219,7 +2220,7 @@ async function sendSignal(context, options) {
2219
2220
  to: context.identity.agentAddress,
2220
2221
  messageId: detail.message_id,
2221
2222
  subject: detail.subject ?? null,
2222
- references: detail.parsed.references ?? []
2223
+ references: detail.parsed?.references ?? []
2223
2224
  };
2224
2225
  const key = createHash("sha256").update(JSON.stringify([
2225
2226
  scope,
package/man/primitive.1 CHANGED
@@ -190,6 +190,40 @@ Run
190
190
  .B primitive logout --force
191
191
  to remove local credentials, pending email-code auth state, and stale credential locks without contacting Primitive.
192
192
  .PP
193
+ Where the server supports it, browser login logs you in as yourself. Run
194
+ .B primitive orgs
195
+ to list your organizations and whether the CLI may be used in each, and
196
+ .B primitive org use ORG
197
+ to switch by name or id. Pass
198
+ .B --org ORG
199
+ to any command, or set
200
+ .BR PRIMITIVE_CLI_ORG ,
201
+ to act in another organization for that command.
202
+ .B primitive memories
203
+ keeps its own boolean
204
+ .B --org
205
+ flag. A login saved by an earlier CLI, an API key and a connected agent
206
+ profile are bound to one organization and refuse a different one.
207
+ .PP
208
+ Run
209
+ .B primitive keys list
210
+ to list API key metadata; it never shows a secret. API keys are created,
211
+ rotated and revoked in the dashboard for now. CLI commands for this are
212
+ planned.
213
+ .B primitive whoami --check PERMISSION
214
+ reports whether the current credential may use a permission.
215
+ .PP
216
+ Run
217
+ .B primitive org leave
218
+ to leave the organization you are signed in to. It asks for confirmation first;
219
+ pass --yes to skip the prompt in scripts. Leaving is final. Only a person
220
+ signed in with
221
+ .B primitive login
222
+ can leave; API keys are refused. The only owner of an organization cannot leave
223
+ it. If the server asks for a dashboard confirmation, open the page it names and
224
+ paste the token at the prompt, or pass it with --step-up-token. Refusals from
225
+ the server are printed as returned.
226
+ .PP
193
227
  Run
194
228
  .B primitive whoami
195
229
  to verify account authentication. With PRIMITIVE_AGENT_PROFILE selected, it
package/package.json CHANGED
@@ -1,9 +1,22 @@
1
1
  {
2
2
  "name": "primcli",
3
- "version": "1.75.0",
3
+ "version": "3.0.0-preview.1",
4
+ "publishConfig": {
5
+ "tag": "preview"
6
+ },
4
7
  "description": "Official Primitive CLI: deploy Primitive Functions, send and inspect mail, manage endpoints, all from the terminal. Wraps the @primitivedotdev/sdk runtime client with one-shot commands.",
5
8
  "type": "module",
6
9
  "sideEffects": false,
10
+ "exports": {
11
+ "./receiver": {
12
+ "types": "./dist/receiver.d.ts",
13
+ "default": "./dist/receiver.js"
14
+ },
15
+ "./package.json": "./package.json",
16
+ "./bin/*": "./bin/*",
17
+ "./dist/*": "./dist/*",
18
+ "./man/*": "./man/*"
19
+ },
7
20
  "files": [
8
21
  "bin",
9
22
  "dist",
@@ -69,9 +82,6 @@
69
82
  "domains": {
70
83
  "description": "Claim, verify, manage email domains, and download DNS zone files"
71
84
  },
72
- "registries": {
73
- "description": "Create and manage agent registries, publish and resolve agents by handle, and moderate publication requests"
74
- },
75
85
  "network": {
76
86
  "description": "Discover same-organization agents by email address and manage default network visibility. Use `primitive network` to see the commands."
77
87
  },
@@ -128,13 +138,49 @@
128
138
  "description": "Browse and install Function templates. Use `primitive templates list-templates`, `primitive templates get-template`, `primitive templates install-template`, and `primitive templates get-template-install`."
129
139
  },
130
140
  "org": {
131
- "description": "Manage org-level (global) resources shared across functions"
141
+ "description": "Switch the CLI between your organizations (`primitive org use <org>`, list them with `primitive orgs`), manage org-level (global) resources shared across functions, or leave the organization"
132
142
  },
133
143
  "org:secrets": {
134
144
  "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."
135
145
  },
136
- "payments": {
137
- "description": "Collect and pay x402 stablecoin (USDC) payments. Start with `primitive payments register-payout-address`, then `primitive payments create-challenge` to request a payment and `primitive payments pay` to settle one. Settlement is non-custodial; signing happens locally with your wallet key. Manage caps with `primitive payments get-policy|update-spend-policy`."
146
+ "keys": {
147
+ "description": "List organization API keys (metadata only, never secrets) with `primitive keys list`. API keys are created, rotated and revoked in the dashboard for now. CLI commands for this are planned."
148
+ },
149
+ "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."
151
+ },
152
+ "projects": {
153
+ "description": "Organization people, shared projects and project invitations"
154
+ },
155
+ "organizations": {
156
+ "description": "Organization invitations"
157
+ },
158
+ "mailbox-access": {
159
+ "description": "Who may read, draft and send for each mailbox, and the groups access can be given to"
160
+ },
161
+ "credentials": {
162
+ "description": "API keys, the credential inventory, the credential audit trail and the credential policy"
163
+ },
164
+ "organization-settings": {
165
+ "description": "Your connected apps and CLI logins, the organization's connected apps, name, logo, search settings and billing"
166
+ },
167
+ "roles-and-members": {
168
+ "description": "Roles, member roles and removal, the mailbox access mode, break-glass, transfers and suspensions, and leaving the organization"
169
+ },
170
+ "agent-work": {
171
+ "description": "Agent work records: create, list and read them, report status, and propose, agree or withdraw deadlines"
172
+ },
173
+ "address-notes": {
174
+ "description": "Private organization notes and public JSON notes about email addresses"
175
+ },
176
+ "interactions": {
177
+ "description": "Typed multi-step protocols carried over email between agents"
178
+ },
179
+ "stats": {
180
+ "description": "Received and sent mail per hour, and how webhook deliveries ended"
181
+ },
182
+ "email-rules": {
183
+ "description": "Rules written in plain English that pick out received mail"
138
184
  },
139
185
  "routes": {
140
186
  "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>`."
@@ -201,7 +247,6 @@
201
247
  "@oclif/plugin-autocomplete": "^4.0.6",
202
248
  "@oclif/plugin-help": "^7.0.4",
203
249
  "@oclif/plugin-warn-if-update-available": "^4.0.1",
204
- "viem": "^2.57.14",
205
250
  "ws": "^8.22.0"
206
251
  },
207
252
  "devDependencies": {