primcli 1.74.0 → 1.75.0

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.
Files changed (26) hide show
  1. package/README.md +49 -9
  2. package/dist/{api-command-fKP3NYa7.js → api-command-rlS3eTlZ.js} +77 -43
  3. package/dist/{cli-config-C0Y_Ppol.js → cli-config-B80p0pLk.js} +7 -12
  4. package/dist/{client.gen-CaaMP86o.js → client.gen-6rZvmHfx.js} +7 -14
  5. package/dist/{json-output-Ce10AsSb.js → json-output-BzSBR-KX.js} +1 -2
  6. package/dist/{listen-background-cD6n8VYO.js → listen-background-C0F9gNDD.js} +2 -3
  7. package/dist/{machine-session-B6V5-grn.js → machine-session-Cq_nD5eF.js} +144 -92
  8. package/dist/{notify-session-DJAb9SGm.js → notify-session-CbY4FYUt.js} +10 -30
  9. package/dist/oclif/auto-signal-worker.js +5 -6
  10. package/dist/oclif/auto-signals.js +3 -4
  11. package/dist/oclif/help.js +127 -0
  12. package/dist/oclif/index.js +490 -359
  13. package/dist/oclif/listen-supervisor.js +1 -1
  14. package/dist/oclif/proxy-auto-detect.js +2 -3
  15. package/dist/oclif/receiver-heal.js +6 -6
  16. package/dist/oclif/root-signup-hint.js +2 -3
  17. package/dist/{repeats-BL7ZC-_6-B_ESsWTH.js → repeats-Dj_o6c-X-LyCkKYjp.js} +552 -213
  18. package/dist/{scoped-chat-DAiOb622.js → scoped-chat-B0thCwME.js} +3 -5
  19. package/dist/{shared-mail-files-CZfm7E2k.js → shared-mail-files-BAQSGxxz.js} +2 -4
  20. package/dist/{shared-mail-watch-DyQB0MK0.js → shared-mail-watch-BAPMsFNv.js} +2 -3
  21. package/dist/{signal-command-Cte4mAL3.js → signal-command-DCPsJBdz.js} +14 -23
  22. package/dist/skills/primitive-connect/references/connect.md +3 -1
  23. package/dist/skills/primitive-connect/references/contacts.md +9 -4
  24. package/dist/skills/primitive-connect.json +4 -4
  25. package/man/primitive.1 +10 -3
  26. package/package.json +14 -9
package/README.md CHANGED
@@ -103,11 +103,11 @@ the readiness message: `primitive endpoints delete --id DESTINATION_ID`.
103
103
  The generated `endpoints pull-webhook-event` and `endpoints complete-webhook-event`
104
104
  commands expose the local-delivery API when enabled on your API host. These are
105
105
  single API calls; a receive loop must retain the destination identity and report
106
- each attempt's outcome. Use `--help` to inspect the request fields:
106
+ each attempt's outcome. Use `--help-full` to inspect the request fields:
107
107
 
108
108
  ```sh
109
- primitive endpoints pull-webhook-event --help
110
- primitive endpoints complete-webhook-event --help
109
+ primitive endpoints pull-webhook-event --help-full
110
+ primitive endpoints complete-webhook-event --help-full
111
111
  ```
112
112
 
113
113
  Completion uses a mode-specific JSON body. For a successful process handler:
@@ -140,7 +140,7 @@ primitive emails latest --limit 5
140
140
  primitive inbox next
141
141
  ```
142
142
 
143
- Run `primitive --help` for the full command list. Per-command help (`primitive functions deploy --help`) carries enough detail that an agent can compose any operation without leaving the terminal.
143
+ Run `primitive --help` for the full command list. Per-command help (`primitive functions deploy --help`, or `-h`) is one screen: a summary, usage, one line per flag, and two examples. `primitive functions deploy --help-full` prints the complete text, with every flag's full description, behavior notes, and all examples, so an agent can compose any operation without leaving the terminal.
144
144
 
145
145
  ## Verification codes and sign-in links
146
146
 
@@ -852,9 +852,11 @@ policy CLI commands, explicit `--notify` consent, and recovery.
852
852
 
853
853
  ### Agent address notes
854
854
 
855
- Connected profiles default to their own address. They can read another address's
856
- organization notes with `--address`, but can write only their own, and the
857
- server refuses note deletion from a connected-agent credential.
855
+ Connected profiles default to their own address. With `--address` they can
856
+ read the `AGENT_INFO`, `AGENT_WORKING` and `AGENT_RUNTIME` notes of another
857
+ agent in their organization; the server returns 403 for any other note there
858
+ and leaves those notes out of `list`. They can write only their own notes, and
859
+ the server refuses note deletion from a connected-agent credential.
858
860
  Owner logins must pass `--address`.
859
861
 
860
862
  ```sh
@@ -1011,6 +1013,14 @@ one JSON result:
1011
1013
  npx -y primitive@latest agent connect --session "$CODEX_THREAD_ID" --name Research --info "Reviews pull requests" --contact-requests --json < private-invitation.txt
1012
1014
  ```
1013
1015
 
1016
+ `--session auto` reads the session from the runtime instead, so one command
1017
+ works in any harness: `CLAUDE_CODE_SESSION_ID` in Claude Code, or
1018
+ `CODEX_THREAD_ID` then `CODEX_SESSION_ID` in Codex. The result's
1019
+ `sessionDetection` names what it found. With no session in the environment it
1020
+ connects with poll receiving and reports `sessionDetection.state`
1021
+ `not_detected`; when both runtimes name a session it fails before reading
1022
+ stdin, and the session must be passed explicitly.
1023
+
1014
1024
  The receiver defaults to the exact Claude session's hooks in Claude Code and to
1015
1025
  the supervised native background listener elsewhere; native receiving waits
1016
1026
  briefly for the listener's first mail check. The profile defaults to
@@ -1089,8 +1099,9 @@ with status `ok`, `warn`, `fail` or `skip`; `action` (`login`, `install_cli`,
1089
1099
  `{version: 1, cliVersion, checks, summary: {ok, warn, fail, skip}, fixedCount}`
1090
1100
  and the command exits 0 only when every check is ok or skipped. Checks cover
1091
1101
  the CLI install, version (`--min-cli-version` sets a floor) and location, the
1092
- saved member login, Claude `settings.json`, Primitive's Claude SessionStart,
1093
- SessionEnd and receive hooks (each present once, pointing at this CLI, with
1102
+ saved member login, which coding agent harnesses are installed, Claude
1103
+ `settings.json`, Primitive's Claude SessionStart, SessionEnd and receive hooks
1104
+ (each present once, pointing at this CLI, with
1094
1105
  stale copies from older installs removed), the Codex SessionStart hook
1095
1106
  in `$CODEX_HOME/hooks.json` (repaired in place without moving any other hook,
1096
1107
  since Codex keys approvals by hook position, and reported as `warn` until the
@@ -1100,6 +1111,19 @@ content) and `~/.omp/agent/AGENTS.md`, the bundled primitive-connect skill, and
1100
1111
  saved agent profiles that were disconnected in Primitive (moved aside locally;
1101
1112
  nothing changes server side).
1102
1113
 
1114
+ `claude.installed`, `codex.installed` and `omp.installed` report each supported
1115
+ harness. A harness counts as installed when its config directory exists
1116
+ (`$CLAUDE_CONFIG_DIR` or `~/.claude`, `$CODEX_HOME` or `~/.codex`,
1117
+ `$PI_CONFIG_DIR` or `~/.omp`) or its binary (`claude`, `codex`, `omp`) is on
1118
+ PATH. One that is not installed is reported as `skip` with `installed: false`,
1119
+ its setup checks are skipped too, and `--fix` writes nothing for it. One that
1120
+ is installed is reported as `ok` with `installed: true` and `setup`:
1121
+ `present` when its setup checks pass, `incomplete` when any of them warns or
1122
+ fails (the detail names them; those checks carry the failure, so this one does
1123
+ not change the exit code), or `not_used` when all of them are skipped, as on a
1124
+ machine whose agents connect per session. These checks read only and are never
1125
+ fixable.
1126
+
1103
1127
  Claude receives mail through one shared set of receive hooks per config
1104
1128
  directory (`Stop`, `SessionStart` on resume, and `PostToolUse`). Each run reads
1105
1129
  the session id from the hook input and looks up the profiles that session
@@ -1233,6 +1257,10 @@ can see the network; explicit silence still applies. Network visibility permits
1233
1257
  discovery and communication but does not grant task authority.
1234
1258
  Known addresses can still exchange ordinary email outside the network.
1235
1259
 
1260
+ From a connected profile, the notes of another agent in the organization are
1261
+ limited to `AGENT_INFO`, `AGENT_WORKING` and `AGENT_RUNTIME`. Other notes there
1262
+ return 403 and are left out of list reads.
1263
+
1236
1264
  With a signed-in member login, `primitive network members` shows your own
1237
1265
  personal agents. Use `primitive network set <address> --see off` to stop one of
1238
1266
  them browsing, or `--be-seen off` to hide it from discovery. Owners and admins
@@ -1421,6 +1449,18 @@ profile. `unmute` removes the server mute and the matching local one, and
1421
1449
  thread is still received and readable; its delivery event is completed without
1422
1450
  a wake.
1423
1451
 
1452
+ Group email follows a mention rule. When an email names this agent and at
1453
+ least one other address in To or Cc, and its new text mentions any of those
1454
+ addresses, only the mentioned agents are woken. A mention is `@` and the
1455
+ address's local part (`@reviewer`) or the full address
1456
+ (`reviewer@agents.example.com`), matched case-insensitively and only as a whole
1457
+ handle or address, so `@reviewer` does not match `@reviewer2`. Quoted history
1458
+ and quoted (`>`) lines are ignored, so an earlier message's mention does not
1459
+ count again, and addresses the email was not sent to are ignored. A local part
1460
+ shared by two recipients mentions both. Group email that mentions none of its recipients wakes every
1461
+ recipient as before, and email addressed to one agent alone always wakes it.
1462
+ Like a muted thread, mail that skips the wake is still received and readable.
1463
+
1424
1464
  When an email read carries the server's `collaboration.sender_relationship`,
1425
1465
  the wake line and `--context` use it for an authenticated sender, `other`
1426
1466
  included (`org_agent` reads as `agent`); only when the field is absent or
@@ -1,11 +1,11 @@
1
- import { $ as AutomatedFilterUnsupportedError, Cn as sdk_gen_exports, F as assertAwaitingFilterRows, Ft as getEmail, G as WEBHOOK_EVENT_TYPES, I as awaitingRejectedError, L as ensureSearchReportsReplyState, P as ReplyStateUnsupportedError, U as replyStateSurfaceForOperation, V as isAwaitingRejectedError, W as SENT_EMAIL_EVENT_TYPES, Wt as getThread, et as assertAutomatedVerdict, it as expectedAutomatedVerdicts, nn as listEndpoints, nt as automatedSurfaceForOperation, ot as isAutomatedRejectedError, rt as ensureSearchReportsAutomated, tt as automatedRejectedError, v as parseRetryAfter } from "./repeats-BL7ZC-_6-B_ESsWTH.js";
2
- import { C as resolveCliAuth, G as PrimitiveApiClient, I as agentProfilesDirectory, M as AGENT_PROFILE_ENV, P as agentProfileDirectory, S as normalizeApiBaseUrl, T as saveSignupCredentials, U as requireDefaultLoginProfile, _ as deleteCliCredentials, c as resolveConfigEnvironment, d as validateCliHeaderName, f as validateCliHeaderValue, i as loadCliConfig, m as cliAccessTokenExpiresAt, p as acquireCliCredentialsLock, w as saveCliCredentials, x as loadCliCredentials, y as detectPrimitiveKeyEnvMisname, z as loadConnectedAgentProfile } from "./cli-config-C0Y_Ppol.js";
3
- import { d as readMailJson, h as writeMailJson, m as withMailLock, p as syncMailDirectory, u as privateMailPermissions } from "./shared-mail-files-CZfm7E2k.js";
1
+ import { $ as AutomatedFilterUnsupportedError, Cn as sdk_gen_exports, F as assertAwaitingFilterRows, Ft as getEmail, G as WEBHOOK_EVENT_TYPES, I as awaitingRejectedError, L as ensureSearchReportsReplyState, P as ReplyStateUnsupportedError, U as replyStateSurfaceForOperation, V as isAwaitingRejectedError, W as SENT_EMAIL_EVENT_TYPES, Wt as getThread, et as assertAutomatedVerdict, it as expectedAutomatedVerdicts, nn as listEndpoints, nt as automatedSurfaceForOperation, ot as isAutomatedRejectedError, rt as ensureSearchReportsAutomated, tt as automatedRejectedError, v as parseRetryAfter } from "./repeats-Dj_o6c-X-LyCkKYjp.js";
2
+ import { C as resolveCliAuth, G as PrimitiveApiClient, I as agentProfilesDirectory, M as AGENT_PROFILE_ENV, P as agentProfileDirectory, S as normalizeApiBaseUrl, T as saveSignupCredentials, U as requireDefaultLoginProfile, _ as deleteCliCredentials, c as resolveConfigEnvironment, d as validateCliHeaderName, f as validateCliHeaderValue, i as loadCliConfig, m as cliAccessTokenExpiresAt, p as acquireCliCredentialsLock, w as saveCliCredentials, x as loadCliCredentials, y as detectPrimitiveKeyEnvMisname, z as loadConnectedAgentProfile } from "./cli-config-B80p0pLk.js";
3
+ import { d as readMailJson, h as writeMailJson, m as withMailLock, p as syncMailDirectory, u as privateMailPermissions } from "./shared-mail-files-BAQSGxxz.js";
4
4
  import { Command, Errors, Flags } from "@oclif/core";
5
5
  import { existsSync, lstatSync, readFileSync, readdirSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
6
6
  import { createHash } from "node:crypto";
7
7
  import { join } from "node:path";
8
- //#region src/oclif/api-client.ts
8
+ // src/oclif/api-client.ts
9
9
  const API_HEADERS_ENV = "PRIMITIVE_API_HEADERS";
10
10
  const OAUTH_REFRESH_SKEW_MS = 6e4;
11
11
  const SAVED_CLI_OAUTH_SESSION_EXPIRED_MESSAGE = "Saved Primitive CLI OAuth session expired or was revoked. Run `primitive signin` to authenticate again.";
@@ -199,8 +199,7 @@ async function createAuthenticatedCliApiClient(params) {
199
199
  requestConfig
200
200
  };
201
201
  }
202
- //#endregion
203
- //#region src/oclif/attachment-wait.ts
202
+ // src/oclif/attachment-wait.ts
204
203
  /** Generated download commands that wait for attachment content by default. */
205
204
  const ATTACHMENT_WAIT_OPERATIONS = /* @__PURE__ */ new Set([
206
205
  "downloadAttachments",
@@ -255,8 +254,7 @@ async function withAttachmentWait(call, options) {
255
254
  }
256
255
  return result;
257
256
  }
258
- //#endregion
259
- //#region src/oclif/endpoint-event-types.ts
257
+ // src/oclif/endpoint-event-types.ts
260
258
  const EVENT_TYPES_FLAG_OPERATIONS = /* @__PURE__ */ new Set(["createEndpoint", "updateEndpoint"]);
261
259
  const EVENT_TYPES_FLAG_DESCRIPTION = "Event types this endpoint subscribes to, comma separated or repeated (sets rules.event_types). Omitting the subscription means every event type except the opt-in sent_email.* events, which an endpoint receives only when it lists them; sent_email.* expands to all four. Keep email.received in the list if the endpoint also handles inbound mail. On update, the endpoint's other rules are kept.";
262
260
  const SENT_EMAIL_WILDCARD = "sent_email.*";
@@ -328,8 +326,7 @@ function withEventTypes(body, eventTypes, baseRules = {}) {
328
326
  function bodyHasRules(body) {
329
327
  return isPlainObject(body) && body.rules !== void 0;
330
328
  }
331
- //#endregion
332
- //#region src/oclif/endpoints-test-redirect.ts
329
+ // src/oclif/endpoints-test-redirect.ts
333
330
  async function detectFunctionEndpoint(endpointId, listEndpoints) {
334
331
  let response;
335
332
  try {
@@ -371,8 +368,7 @@ async function maybeWriteFunctionEndpointRedirect(inputs) {
371
368
  inputs.writeStderr(`${formatFunctionEndpointRedirect(match)}\n`);
372
369
  return match;
373
370
  }
374
- //#endregion
375
- //#region src/oclif/flag-suggestions.ts
371
+ // src/oclif/flag-suggestions.ts
376
372
  /**
377
373
  * "Did you mean" hints for unknown flags. oclif reports an unknown flag as
378
374
  * `Nonexistent flag: --query` and prints the full help; this adds the
@@ -437,8 +433,7 @@ function withFlagSuggestion(error, valid) {
437
433
  ].join("\n");
438
434
  return error;
439
435
  }
440
- //#endregion
441
- //#region src/oclif/from-verified-filter.ts
436
+ // src/oclif/from-verified-filter.ts
442
437
  /**
443
438
  * The `from_verified` filter on GET /emails and GET /emails/search: the
444
439
  * `from_verified=true|false` parameter (`--from-verified`) and the
@@ -494,8 +489,7 @@ function assertFromVerifiedRows(rows, expectation) {
494
489
  }).length;
495
490
  if (wrong > 0) throw new FromVerifiedFilterUnsupportedError(`${expectation.surface} returned ${wrong} of ${rows.length} email${rows.length === 1 ? "" : "s"} without the requested \`from_verified\` value.`);
496
491
  }
497
- //#endregion
498
- //#region src/oclif/idempotent-replay-banner.ts
492
+ // src/oclif/idempotent-replay-banner.ts
499
493
  /**
500
494
  * If `data` carries `idempotent_replay: true`, write a stderr notice
501
495
  * that nothing new was sent and why. Otherwise no-op.
@@ -593,18 +587,66 @@ function formatAlreadySentNotice(sent, options = {}) {
593
587
  if (deliveryStatus && deliveryStatus !== status) details.push(`delivery status ${deliveryStatus}`);
594
588
  return `Already sent: this exact message went out earlier${details.length > 0 ? ` (${details.join(", ")})` : ""}. Nothing new was sent.`;
595
589
  }
596
- //#endregion
597
- //#region src/oclif/mail-session.ts
590
+ // src/oclif/runtime-session.ts
591
+ /**
592
+ * The variables each runtime sets to its exact session ID, first match wins.
593
+ * The loaded Codex thread is the receiving identity; the process session ID
594
+ * is only a fallback when no thread ID is exposed.
595
+ */
596
+ const RUNTIME_SESSION_VARIABLES = {
597
+ claude: ["CLAUDE_CODE_SESSION_ID"],
598
+ codex: ["CODEX_THREAD_ID", "CODEX_SESSION_ID"]
599
+ };
600
+ const UUID$3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
601
+ /** Each runtime whose environment names a session UUID. Never guessed from history or cwd. */
602
+ function runtimeSessions(env) {
603
+ return Object.keys(RUNTIME_SESSION_VARIABLES).flatMap((runtime) => {
604
+ for (const variable of RUNTIME_SESSION_VARIABLES[runtime]) {
605
+ const value = env[variable]?.trim().toLowerCase();
606
+ if (!value) continue;
607
+ return UUID$3.test(value) ? [{
608
+ runtime,
609
+ session: value,
610
+ variable
611
+ }] : [];
612
+ }
613
+ return [];
614
+ });
615
+ }
616
+ /** The one session the runtime environment names, if exactly one runtime names one. */
617
+ function detectRuntimeSession(env = process.env) {
618
+ const candidates = runtimeSessions(env);
619
+ const [only] = candidates;
620
+ if (!only) return { kind: "none" };
621
+ return candidates.length === 1 ? {
622
+ kind: "detected",
623
+ ...only
624
+ } : {
625
+ kind: "ambiguous",
626
+ candidates
627
+ };
628
+ }
629
+ /**
630
+ * The runtime whose tool environment names this exact session. A session ID
631
+ * that matches neither runtime's variable, or both, has no detectable runtime.
632
+ */
633
+ function detectAgentRuntime(session, env = process.env) {
634
+ const wanted = session.trim().toLowerCase();
635
+ const matches = runtimeSessions(env).filter((candidate) => candidate.session === wanted);
636
+ return matches.length === 1 ? matches[0]?.runtime ?? null : null;
637
+ }
638
+ /** Every variable a runtime may name its session in, for messages. */
639
+ function runtimeSessionVariableList() {
640
+ const names = Object.values(RUNTIME_SESSION_VARIABLES).flat();
641
+ return `${names.slice(0, -1).join(", ")} or ${names.at(-1)}`;
642
+ }
643
+ // src/oclif/mail-session.ts
598
644
  /** Runtime-provided identity only. Never guess a session from history or cwd. */
599
645
  function currentMailSessionKey(env = process.env) {
600
- const codex = env.CODEX_THREAD_ID ?? env.CODEX_SESSION_ID;
601
- const claude = env.CLAUDE_CODE_SESSION_ID;
602
- if (codex && claude) return null;
603
- const value = codex ?? claude;
604
- return value && /^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(value) ? `${codex ? "codex" : "claude"}:${value.toLowerCase()}` : null;
605
- }
606
- //#endregion
607
- //#region src/oclif/agent-identity-suggestions.ts
646
+ const detection = detectRuntimeSession(env);
647
+ return detection.kind === "detected" ? `${detection.runtime}:${detection.session}` : null;
648
+ }
649
+ // src/oclif/agent-identity-suggestions.ts
608
650
  /** The connection name enrollment uses when none is given. */
609
651
  const DEFAULT_ENROLL_NAME = "Coding agent";
610
652
  /** npx runs the CLI from its cache; print follow-up commands the same way. */
@@ -687,8 +729,7 @@ function identitySuggestions(params) {
687
729
  suggestions
688
730
  };
689
731
  }
690
- //#endregion
691
- //#region src/oclif/send-outcome.ts
732
+ // src/oclif/send-outcome.ts
692
733
  const SEND_OUTCOME_EXIT_CODES = {
693
734
  replied: 0,
694
735
  sent: 0,
@@ -1156,8 +1197,7 @@ function thrownErrorExitCode(error) {
1156
1197
  const exit = error?.oclif?.exit;
1157
1198
  return typeof exit === "number" ? exit : 1;
1158
1199
  }
1159
- //#endregion
1160
- //#region src/oclif/interaction-actions.ts
1200
+ // src/oclif/interaction-actions.ts
1161
1201
  const HINTS = /* @__PURE__ */ new Set([
1162
1202
  "status",
1163
1203
  "card",
@@ -1413,8 +1453,7 @@ function replyInteractionWarning(detail, emailId) {
1413
1453
  default: return null;
1414
1454
  }
1415
1455
  }
1416
- //#endregion
1417
- //#region src/oclif/pending-mail.ts
1456
+ // src/oclif/pending-mail.ts
1418
1457
  const RELATIONSHIPS = [
1419
1458
  "owner",
1420
1459
  "member",
@@ -1771,8 +1810,7 @@ function pendingMailProfiles(configDir, session, emailId) {
1771
1810
  }
1772
1811
  }).sort();
1773
1812
  }
1774
- //#endregion
1775
- //#region src/oclif/wake-context.ts
1813
+ // src/oclif/wake-context.ts
1776
1814
  /**
1777
1815
  * Mail from a verified owner, member or connected peer agent is mail the
1778
1816
  * agent may act on, so its wake starts with the line that loads the rules
@@ -2009,8 +2047,7 @@ function formatMailWakeLine(input) {
2009
2047
  const skillFirst = skillFirstLine(input.relation ?? context?.relationship, input.skillFile);
2010
2048
  return `${skillFirst ? `${skillFirst}\n` : ""}Primitive mail arrived: ${input.emailId}${input.recipient}${metadata}. Read with ${wakeReadCommand(input.emailId, input.profileName)}.${interaction} ${wakeAuthority(input.relation)}\n`;
2011
2049
  }
2012
- //#endregion
2013
- //#region src/oclif/pending-mail-miss.ts
2050
+ // src/oclif/pending-mail-miss.ts
2014
2051
  /** At most this many other profiles are named in one hint line. */
2015
2052
  const HINT_PROFILE_LIMIT = 3;
2016
2053
  function currentProfile(configDir) {
@@ -2064,7 +2101,7 @@ function savedConnectedProfiles(configDir, exclude) {
2064
2101
  */
2065
2102
  async function otherProfiles(configDir, session, current) {
2066
2103
  if (session) try {
2067
- const { connectedProfilesForSession } = await import("./machine-session-B6V5-grn.js").then((n) => n.s);
2104
+ const { connectedProfilesForSession } = await import("./machine-session-Cq_nD5eF.js").then((n) => n.s);
2068
2105
  return {
2069
2106
  inSession: true,
2070
2107
  profiles: connectedProfilesForSession(configDir, session, current)
@@ -2138,8 +2175,7 @@ async function explainPendingMailNotFound(configDir, emailId, write = (line) =>
2138
2175
  if (outcome.kind === "dropped") write(`Dropped the pending notice for ${id} from profile ${current.profile} after ${outcome.reads} consecutive not_found reads; the email is no longer visible to this profile.\n`);
2139
2176
  } catch {}
2140
2177
  }
2141
- //#endregion
2142
- //#region src/oclif/sent-list-labels.ts
2178
+ // src/oclif/sent-list-labels.ts
2143
2179
  /**
2144
2180
  * `sent list` under a connected agent profile returns this address's own
2145
2181
  * sends and also delivered sends from other addresses in the organization
@@ -2172,8 +2208,7 @@ function sentListOtherSendersNote(rows, self) {
2172
2208
  const named = senders.length > 3 ? `${senders.slice(0, 3).join(", ")} and ${senders.length - 3} more` : senders.join(", ");
2173
2209
  return `${count} of ${rows.length} rows were sent by another address in this organization (${named}) to ${own}; they are mail ${own} received, not its own sends. Rows with from_address ${own} are this address's sends; pass --from ${own} to list only those.`;
2174
2210
  }
2175
- //#endregion
2176
- //#region src/oclif/api-command.ts
2211
+ // src/oclif/api-command.ts
2177
2212
  const API_ERROR_CODES = {
2178
2213
  accessDenied: "access_denied",
2179
2214
  authorizationPending: "authorization_pending",
@@ -2900,5 +2935,4 @@ const EMPTY_RESULT_HINTS = {
2900
2935
  function canonicalizeCliReferences(description) {
2901
2936
  return description.replaceAll("`primitive emails:latest`", "`primitive emails latest`").replaceAll("`primitive describe emails:get-email | jq '.responseSchema.properties'`", "`primitive describe emails:get | jq '.responseSchema.properties'`");
2902
2937
  }
2903
- //#endregion
2904
- export { formatDeletedEarlierSendNotice as $, clearReadPendingMail as A, createCliApiClient as At, wakeInteractionSentence as B, serverRelationship as C, withFlagSuggestion as Ct, wakeRelationship as D, ConnectedAgentKeyRequiredError as Dt, wakeRecipientField as E, withAttachmentWait as Et, interactionHumanLine as F, assertValidIdempotencyKey as G, MAX_SEND_WAIT_TIMEOUT_MS as H, interactionNextActions as I, checkPriorReplies as J, buildFollowUpCommand as K, readEmailInteraction as L, readPendingMail as M, resolveCliApiRequestConfig as Mt, recordPendingMail as N, claimPendingMail as O, SAVED_CLI_OAUTH_SESSION_EXPIRED_MESSAGE as Ot, removePendingMail as P, followUpCommandPrefix as Q, replyExpectation as R, serverMuted as S, writeIdempotentReplayBannerIfReplay as St, wakeReadCommand as T, ATTACHMENT_WAIT_MAX_MS as Tt, SEND_OUTCOME_HELP as U, IDEMPOTENCY_KEY_FLAG_DESCRIPTION as V, apiResultHttpStatus as W, deriveSendIdempotencyKey as X, classifySendError as Y, excludeSignalReplies as Z, displayAddress as _, generatedAgentName as _t, extractErrorCode as a, reportSendCommandResult as at, readThreadContext as b, currentMailSessionKey as bt, hasControlCharacter as c, sendWaitClampNotice as ct, runWithTiming as d, successfulSendOutcome as dt, formatPriorRepliesCheckSkipped as et, surfaceUnauthorizedHint as f, thrownErrorExitCode as ft, describeWake as g, defaultConnectionName as gt, bareAddress$1 as h, connectNextSteps as ht, createOperationCommand as i, priorRepliesThatWentOut as it, pendingMailPath as j, refreshStoredCliCredentials as jt, clearConsumedPendingMail as k, createAuthenticatedCliApiClient as kt, headerFlagName as l, sentHistoryWindowStart as lt, explainPendingMailNotFound as m, cliInvocation as mt, API_ERROR_CODES as n, formatSendFailureSummary as nt, extractErrorPayload as o, sendIdentityFields as ot, writeErrorWithHints as p, DEFAULT_ENROLL_NAME as pt, buildThrownSendFailureEnvelope as q, TIME_FLAG_DESCRIPTION as r, formatSendRecordFailureSummary as rt, formatErrorPayload as s, sendOutcomeExitCode as st, API_BASE_URL_FLAG_DESCRIPTION as t, formatPriorRepliesWarning as tt, readTextFileFlag as u, serializeErrorPayload as ut, formatMailWakeLine as v, identitySuggestions as vt, skillFirstLine as w, ATTACHMENT_WAIT_FLAG_DESCRIPTION as wt, sentInThread as x, formatAlreadySentNotice as xt, latestOwnOutbound as y, loadSkillLine as yt, replyInteractionWarning as z };
2938
+ export { formatDeletedEarlierSendNotice as $, clearReadPendingMail as A, ConnectedAgentKeyRequiredError as At, wakeInteractionSentence as B, serverRelationship as C, runtimeSessionVariableList as Ct, wakeRelationship as D, ATTACHMENT_WAIT_FLAG_DESCRIPTION as Dt, wakeRecipientField as E, withFlagSuggestion as Et, interactionHumanLine as F, resolveCliApiRequestConfig as Ft, assertValidIdempotencyKey as G, MAX_SEND_WAIT_TIMEOUT_MS as H, interactionNextActions as I, checkPriorReplies as J, buildFollowUpCommand as K, readEmailInteraction as L, readPendingMail as M, createAuthenticatedCliApiClient as Mt, recordPendingMail as N, createCliApiClient as Nt, claimPendingMail as O, ATTACHMENT_WAIT_MAX_MS as Ot, removePendingMail as P, refreshStoredCliCredentials as Pt, followUpCommandPrefix as Q, replyExpectation as R, serverMuted as S, detectRuntimeSession as St, wakeReadCommand as T, writeIdempotentReplayBannerIfReplay as Tt, SEND_OUTCOME_HELP as U, IDEMPOTENCY_KEY_FLAG_DESCRIPTION as V, apiResultHttpStatus as W, deriveSendIdempotencyKey as X, classifySendError as Y, excludeSignalReplies as Z, displayAddress as _, generatedAgentName as _t, extractErrorCode as a, reportSendCommandResult as at, readThreadContext as b, currentMailSessionKey as bt, hasControlCharacter as c, sendWaitClampNotice as ct, runWithTiming as d, successfulSendOutcome as dt, formatPriorRepliesCheckSkipped as et, surfaceUnauthorizedHint as f, thrownErrorExitCode as ft, describeWake as g, defaultConnectionName as gt, bareAddress$1 as h, connectNextSteps as ht, createOperationCommand as i, priorRepliesThatWentOut as it, pendingMailPath as j, SAVED_CLI_OAUTH_SESSION_EXPIRED_MESSAGE as jt, clearConsumedPendingMail as k, withAttachmentWait as kt, headerFlagName as l, sentHistoryWindowStart as lt, explainPendingMailNotFound as m, cliInvocation as mt, API_ERROR_CODES as n, formatSendFailureSummary as nt, extractErrorPayload as o, sendIdentityFields as ot, writeErrorWithHints as p, DEFAULT_ENROLL_NAME as pt, buildThrownSendFailureEnvelope as q, TIME_FLAG_DESCRIPTION as r, formatSendRecordFailureSummary as rt, formatErrorPayload as s, sendOutcomeExitCode as st, API_BASE_URL_FLAG_DESCRIPTION as t, formatPriorRepliesWarning as tt, readTextFileFlag as u, serializeErrorPayload as ut, formatMailWakeLine as v, identitySuggestions as vt, skillFirstLine as w, formatAlreadySentNotice as wt, sentInThread as x, detectAgentRuntime as xt, latestOwnOutbound as y, loadSkillLine as yt, replyInteractionWarning as z };
@@ -1,10 +1,10 @@
1
- import { n as createConfig, t as createClient } from "./client.gen-CaaMP86o.js";
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-CZfm7E2k.js";
1
+ import { n as createConfig, t as createClient } from "./client.gen-6rZvmHfx.js";
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
4
  import { chmodSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
5
5
  import { randomUUID } from "node:crypto";
6
6
  import { dirname, join } from "node:path";
7
- //#region ../packages/api-core/src/client.ts
7
+ // ../packages/api-core/src/client.ts
8
8
  /**
9
9
  * Host-aware Primitive API client and shared error type.
10
10
  *
@@ -38,8 +38,7 @@ var PrimitiveApiClient = class {
38
38
  return this.client.setConfig(config);
39
39
  }
40
40
  };
41
- //#endregion
42
- //#region src/oclif/connected-agent-profile.ts
41
+ // src/oclif/connected-agent-profile.ts
43
42
  const AGENT_PROFILE_ENV = "PRIMITIVE_AGENT_PROFILE";
44
43
  /**
45
44
  * The selected agent's email address, exported next to AGENT_PROFILE_ENV for
@@ -192,8 +191,7 @@ function profileAlreadyConnectedMessage(profileName, address) {
192
191
  `If they choose to disconnect it, run \`primitive agent disconnect --profile ${profileName}\` (or rerun this command with --replace-existing when it is bound to this session), then connect again. If they want a second address on purpose, rerun with a new --profile and --keep-existing.`
193
192
  ].join(" ");
194
193
  }
195
- //#endregion
196
- //#region src/oclif/chat-state.ts
194
+ // src/oclif/chat-state.ts
197
195
  const CHAT_STATE_FILE = "chat-state.json";
198
196
  const CHAT_STATE_VERSION = 2;
199
197
  const MAX_CONVERSATIONS = 50;
@@ -355,8 +353,7 @@ function saveActiveChatState(configDir, input, options = {}) {
355
353
  });
356
354
  return conversation;
357
355
  }
358
- //#endregion
359
- //#region src/oclif/auth.ts
356
+ // src/oclif/auth.ts
360
357
  const CREDENTIALS_FILE = "credentials.json";
361
358
  const CREDENTIALS_LOCK_DIR = "credentials.lock";
362
359
  const CREDENTIALS_LOCK_OWNER_FILE = "owner.json";
@@ -728,8 +725,7 @@ function resolveCliAuth(params) {
728
725
  source: "none"
729
726
  };
730
727
  }
731
- //#endregion
732
- //#region src/oclif/cli-config.ts
728
+ // src/oclif/cli-config.ts
733
729
  const CONFIG_FILE = "config.json";
734
730
  const CONFIG_VERSION = 1;
735
731
  const DEFAULT_ENVIRONMENT = "default";
@@ -907,5 +903,4 @@ function redactCliEnvironment(environment) {
907
903
  ...headers ? { headers } : {}
908
904
  };
909
905
  }
910
- //#endregion
911
906
  export { saveActiveChatState as A, parseConnectedAgentProfile as B, resolveCliAuth as C, deleteChatState as D, chatStatePath as E, agentProfileName as F, PrimitiveApiClient as G, profileAlreadyConnectedMessage as H, agentProfilesDirectory as I, connectedAgentIdentity as L, AGENT_PROFILE_ENV as M, AgentConnectionSetupError as N, loadActiveChatState as O, agentProfileDirectory as P, connectedApiBaseUrl as R, normalizeApiBaseUrl as S, saveSignupCredentials as T, requireDefaultLoginProfile as U, parseOwnerMemberAddress as V, saveConnectedAgentProfile as W, deleteCliCredentials as _, normalizeCliEnvironmentName as a, hasStoredCliLogin as b, resolveConfigEnvironment as c, validateCliHeaderName as d, validateCliHeaderValue as f, credentialsPath as g, credentialsLockPath as h, loadCliConfig as i, AGENT_ADDRESS_ENV as j, loadChatConversationByLocalId as k, saveCliConfig as l, cliAccessTokenExpiresAt as m, deleteCliConfig as n, redactCliEnvironment as o, acquireCliCredentialsLock as p, emptyCliConfig as r, removeCliEnvironment as s, DEFAULT_ENVIRONMENT as t, upsertCliEnvironment as u, deleteCliCredentialsLock as v, saveCliCredentials as w, loadCliCredentials as x, detectPrimitiveKeyEnvMisname as y, loadConnectedAgentProfile as z };
@@ -1,7 +1,6 @@
1
- //#region ../packages/api-core/src/api/core/bodySerializer.gen.ts
1
+ // ../packages/api-core/src/api/core/bodySerializer.gen.ts
2
2
  const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
3
- //#endregion
4
- //#region ../packages/api-core/src/api/core/serverSentEvents.gen.ts
3
+ // ../packages/api-core/src/api/core/serverSentEvents.gen.ts
5
4
  function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
6
5
  let lastEventId;
7
6
  const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
@@ -93,8 +92,7 @@ function createSseClient({ onRequest, onSseError, onSseEvent, responseTransforme
93
92
  };
94
93
  return { stream: createStream() };
95
94
  }
96
- //#endregion
97
- //#region ../packages/api-core/src/api/core/pathSerializer.gen.ts
95
+ // ../packages/api-core/src/api/core/pathSerializer.gen.ts
98
96
  const separatorArrayExplode = (style) => {
99
97
  switch (style) {
100
98
  case "label": return ".";
@@ -172,8 +170,7 @@ const serializeObjectParam = ({ allowReserved, explode, name, style, value, valu
172
170
  })).join(separator);
173
171
  return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
174
172
  };
175
- //#endregion
176
- //#region ../packages/api-core/src/api/core/utils.gen.ts
173
+ // ../packages/api-core/src/api/core/utils.gen.ts
177
174
  const PATH_PARAM_RE = /\{[^{}]+\}/g;
178
175
  const defaultPathSerializer = ({ path, url: _url }) => {
179
176
  let url = _url;
@@ -246,8 +243,7 @@ function getValidRequestBody(options) {
246
243
  }
247
244
  if (hasBody) return options.body;
248
245
  }
249
- //#endregion
250
- //#region ../packages/api-core/src/api/core/auth.gen.ts
246
+ // ../packages/api-core/src/api/core/auth.gen.ts
251
247
  const getAuthToken = async (auth, callback) => {
252
248
  const token = typeof callback === "function" ? await callback(auth) : callback;
253
249
  if (!token) return;
@@ -255,8 +251,7 @@ const getAuthToken = async (auth, callback) => {
255
251
  if (auth.scheme === "basic") return `Basic ${btoa(token)}`;
256
252
  return token;
257
253
  };
258
- //#endregion
259
- //#region ../packages/api-core/src/api/client/utils.gen.ts
254
+ // ../packages/api-core/src/api/client/utils.gen.ts
260
255
  const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
261
256
  const querySerializer = (queryParams) => {
262
257
  const search = [];
@@ -425,8 +420,7 @@ const createConfig = (override = {}) => ({
425
420
  querySerializer: defaultQuerySerializer,
426
421
  ...override
427
422
  });
428
- //#endregion
429
- //#region ../packages/api-core/src/api/client/client.gen.ts
423
+ // ../packages/api-core/src/api/client/client.gen.ts
430
424
  const createClient = (config = {}) => {
431
425
  let _config = mergeConfigs(createConfig(), config);
432
426
  const getConfig = () => ({ ..._config });
@@ -593,5 +587,4 @@ const createClient = (config = {}) => {
593
587
  trace: makeMethodFn("TRACE")
594
588
  };
595
589
  };
596
- //#endregion
597
590
  export { createConfig as n, createClient as t };
@@ -1,5 +1,5 @@
1
1
  import { format } from "node:util";
2
- //#region src/oclif/json-output.ts
2
+ // src/oclif/json-output.ts
3
3
  /**
4
4
  * Parse-safe `--json` output.
5
5
  *
@@ -318,5 +318,4 @@ function guardJsonOutputCommands(commands) {
318
318
  if (flags && "json" in flags || enableJsonFlag === true) guardJsonOutput(command);
319
319
  }
320
320
  }
321
- //#endregion
322
321
  export { jsonOutputRequested as n, runStreamingJson as r, guardJsonOutputCommands as t };
@@ -1,10 +1,10 @@
1
- import { _ as acquireListenLock, a as mailLockBusy, d as readMailJson, f as removeMailFile, g as ListenStateError, h as writeMailJson, i as mailId, l as privateMailDirectory, o as mailObject, s as mailString, v as compareListenProcessIdentity, x as listenProcessIdentity } from "./shared-mail-files-CZfm7E2k.js";
1
+ import { _ as acquireListenLock, a as mailLockBusy, d as readMailJson, f as removeMailFile, g as ListenStateError, h as writeMailJson, i as mailId, l as privateMailDirectory, o as mailObject, s as mailString, v as compareListenProcessIdentity, x as listenProcessIdentity } from "./shared-mail-files-BAQSGxxz.js";
2
2
  import { lstatSync, realpathSync } from "node:fs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { join } from "node:path";
5
5
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
6
6
  import { spawn } from "node:child_process";
7
- //#region src/oclif/listen-background.ts
7
+ // src/oclif/listen-background.ts
8
8
  const BACKGROUND_LISTEN_TOKEN_ENV = "PRIMITIVE_LISTEN_BACKGROUND_TOKEN";
9
9
  const BACKGROUND_LISTEN_TARGET_ENV = "PRIMITIVE_LISTEN_BACKGROUND_TARGET";
10
10
  const SUPERVISOR_ENV = "PRIMITIVE_LISTEN_SUPERVISOR";
@@ -837,5 +837,4 @@ async function startBackgroundListen(options) {
837
837
  release();
838
838
  }
839
839
  }
840
- //#endregion
841
840
  export { claimBackgroundListenRestart as a, startBackgroundListen as c, backgroundListenToken as i, stopBackgroundListen as l, backgroundListenRestartable as n, runBackgroundListen as o, backgroundListenStatus as r, runBackgroundListenSupervisor as s, BACKGROUND_LISTEN_TOKEN_ENV as t, verifyBackgroundListenTarget as u };