commonswarm 0.1.37 → 0.1.38

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 (2) hide show
  1. package/cswarm.cjs +193 -42
  2. package/package.json +1 -1
package/cswarm.cjs CHANGED
@@ -28940,6 +28940,21 @@ function parseMemberRow(value) {
28940
28940
  display_name: row.display_name
28941
28941
  };
28942
28942
  }
28943
+ function parseAgentIdentity(value) {
28944
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
28945
+ throw new Error("member read returned a malformed credential identity");
28946
+ }
28947
+ const row = value;
28948
+ if (row.credential_valid !== true) {
28949
+ throw new Error("member read returned a malformed credential validity");
28950
+ }
28951
+ return {
28952
+ credential_valid: true,
28953
+ owner_user_id: checkedUuid2(row.owner_user_id, "identity owner_user_id"),
28954
+ principal_id: checkedUuid2(row.principal_id, "identity principal_id"),
28955
+ workspace_id: checkedUuid2(row.workspace_id, "identity workspace_id")
28956
+ };
28957
+ }
28943
28958
  async function readAgentSignalDirectory(target2, token, workspaceId2, fetcherOrOptions = fetch) {
28944
28959
  const options = normalizeReadOptions(fetcherOrOptions);
28945
28960
  let result;
@@ -28983,7 +28998,8 @@ async function readAgentSignalDirectory(target2, token, workspaceId2, fetcherOrO
28983
28998
  })();
28984
28999
  return {
28985
29000
  members: payload.members.map(parseMemberRow),
28986
- agents
29001
+ agents,
29002
+ ...payload.identity === void 0 ? {} : { identity: parseAgentIdentity(payload.identity) }
28987
29003
  };
28988
29004
  }
28989
29005
  function resolveSignalRecipient(selector, directory) {
@@ -38743,6 +38759,7 @@ async function runListenerHookCheck(options = {}) {
38743
38759
  var import_meta = {};
38744
38760
  var KNOWN_FLAGS = /* @__PURE__ */ new Set([
38745
38761
  "about",
38762
+ "agent-token-file",
38746
38763
  "agent-token-stdin",
38747
38764
  "all-devices",
38748
38765
  "anon-key",
@@ -38832,8 +38849,8 @@ var ACCEPTED_AGENT_CREDENTIAL_MESSAGES = [
38832
38849
  AGENT_CREDENTIAL_MESSAGE_D088
38833
38850
  ];
38834
38851
  function packageVersion() {
38835
- if ("0.1.37".length > 0) {
38836
- return "0.1.37";
38852
+ if ("0.1.38".length > 0) {
38853
+ return "0.1.38";
38837
38854
  }
38838
38855
  try {
38839
38856
  const value = JSON.parse(
@@ -38922,7 +38939,7 @@ var Arguments = class {
38922
38939
  };
38923
38940
  var TARGET_FLAGS = ["url", "anon-key", "force-file-store"];
38924
38941
  var ROUTE_FLAGS = ["workspace-id", "repo-mapping-id"];
38925
- var CREDENTIAL_FLAGS = ["agent-token-stdin"];
38942
+ var CREDENTIAL_FLAGS = ["agent-token-file", "agent-token-stdin"];
38926
38943
  var TASK_FLAGS = [
38927
38944
  "task-id",
38928
38945
  "slug",
@@ -38938,6 +38955,8 @@ var TASK_FLAGS = [
38938
38955
  var UsageError = class extends Error {
38939
38956
  };
38940
38957
  function usage() {
38958
+ const agentCredential2 = "[--agent-token-file <path> | --agent-token-stdin]";
38959
+ const requiredAgentCredential = "(--agent-token-file <path> | --agent-token-stdin)";
38941
38960
  return `cswarm ${CLI_BUILD_VERSION} (protocol ${CLIENT_PROTOCOL_VERSION})
38942
38961
 
38943
38962
  Usage:
@@ -38947,23 +38966,24 @@ Usage:
38947
38966
  cswarm target set --url <project-url> --anon-key <key> [--json]
38948
38967
  cswarm target clear [--json]
38949
38968
  cswarm status [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--json]
38950
- cswarm members [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--agent-token-stdin] [--json]
38951
- cswarm working-on "<what>" [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--about <ref>] [--until <dur>] [--json]
38952
- cswarm note "<text>" [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--to <member|agent>] [--about <ref>] [--until <dur>] [--json] # text: 1..8000 characters
38953
- cswarm ask "<text>" [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--to <member|agent>] [--about <ref>] [--until <dur>] [--wait <seconds>] [--json] # text: 1..8000 characters
38954
- cswarm reply <signal-id> "<text>" [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--until <dur>] [--json]
38955
- cswarm receipt <signal-id> --agent-token-stdin [--url <url> --anon-key <key>] --workspace-id <uuid> [--json]
38956
- cswarm feed [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--about <ref>] [--kind <kind>] [--since <timestamp>] [--limit <n>] [--include-stale] [--json]
38957
- cswarm inbox [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--kind <kind>] [--about <ref>] [--since <timestamp>] [--limit <n>] [--include-stale] [--wait <seconds>] [--json]
38958
- cswarm inbox --notify --agent-token-stdin [--url <url> --anon-key <key>] --workspace-id <uuid> [--json]
38959
- cswarm inbox --follow --ndjson [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--kind <kind>] [--about <ref>] [--since <timestamp>] [--limit <n>] [--include-stale]
38960
- cswarm file put <local-path> [--name <name>] [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--agent-token-stdin] [--json]
38961
- cswarm file ls [--include-tombstoned] [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--agent-token-stdin] [--json]
38962
- cswarm file get <name|file-id> [--version <n>] [--out <local-path>] [--force] [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--agent-token-stdin] [--json]
38963
- cswarm file rm <name|file-id> [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--agent-token-stdin] [--json]
38964
- cswarm file restore <name|file-id> [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--agent-token-stdin] [--json]
38965
- cswarm feedback "<text>" --kind bug|idea|friction [--about <ref>] [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--agent-token-stdin] [--json]
38966
- cswarm listen start --agent-token-stdin [--url <url> --anon-key <key>] --workspace-id <uuid> --provider grok|opencode|claude|codex [--cwd <absolute-path>] [--model <model>] [--effort <level>] [--permissions deny|allow] [--grok-executable <path>] [--opencode-executable <path>] [--claude-executable <path>] [--codex-executable <path>] [--turn-budget <duration>] [--route worker|main|split] [--defer-over <chars>] [--foreground] [--json]
38969
+ cswarm whoami ${requiredAgentCredential} [--url <url> --anon-key <key>] [--workspace-id <uuid>] [--json]
38970
+ cswarm members [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--json]
38971
+ cswarm working-on "<what>" [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--about <ref>] [--until <dur>] [--json]
38972
+ cswarm note "<text>" [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--to <member|agent>] [--about <ref>] [--until <dur>] [--json] # text: 1..8000 characters
38973
+ cswarm ask "<text>" [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--to <member|agent>] [--about <ref>] [--until <dur>] [--wait <seconds>] [--json] # text: 1..8000 characters
38974
+ cswarm reply <signal-id> "<text>" [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--until <dur>] [--json]
38975
+ cswarm receipt <signal-id> ${requiredAgentCredential} [--url <url> --anon-key <key>] --workspace-id <uuid> [--json]
38976
+ cswarm feed [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--about <ref>] [--kind <kind>] [--since <timestamp>] [--limit <n>] [--include-stale] [--json]
38977
+ cswarm inbox [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--kind <kind>] [--about <ref>] [--since <timestamp>] [--limit <n>] [--include-stale] [--wait <seconds>] [--json]
38978
+ cswarm inbox --notify ${requiredAgentCredential} [--url <url> --anon-key <key>] --workspace-id <uuid> [--json]
38979
+ cswarm inbox --follow --ndjson [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--kind <kind>] [--about <ref>] [--since <timestamp>] [--limit <n>] [--include-stale]
38980
+ cswarm file put <local-path> [--name <name>] [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--json]
38981
+ cswarm file ls [--include-tombstoned] [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--json]
38982
+ cswarm file get <name|file-id> [--version <n>] [--out <local-path>] [--force] [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--json]
38983
+ cswarm file rm <name|file-id> [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--json]
38984
+ cswarm file restore <name|file-id> [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--json]
38985
+ cswarm feedback "<text>" --kind bug|idea|friction [--about <ref>] [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [--json]
38986
+ cswarm listen start ${requiredAgentCredential} [--url <url> --anon-key <key>] --workspace-id <uuid> --provider grok|opencode|claude|codex [--cwd <absolute-path>] [--model <model>] [--effort <level>] [--permissions deny|allow] [--grok-executable <path>] [--opencode-executable <path>] [--claude-executable <path>] [--codex-executable <path>] [--turn-budget <duration>] [--route worker|main|split] [--defer-over <chars>] [--foreground] [--json]
38967
38987
  cswarm listen status [--url <url> --anon-key <key>] --workspace-id <uuid> --principal-id <uuid> [--json]
38968
38988
  cswarm listen stop [--url <url> --anon-key <key>] --workspace-id <uuid> --principal-id <uuid> [--json]
38969
38989
  cswarm hook check [--cooldown <seconds>]
@@ -38985,26 +39005,33 @@ Usage:
38985
39005
  cswarm principal revoke [--url <url> --anon-key <key>] [--workspace-id <uuid>] --principal-id <uuid>
38986
39006
  cswarm token mint [--url <url> --anon-key <key>] [--workspace-id <uuid>] --principal-id <uuid> --run-id <uuid> --task-id <uuid> --epoch <n> [--ttl-ms <ms>]
38987
39007
  cswarm token revoke [--url <url> --anon-key <key>] [--workspace-id <uuid>] --token-id <uuid>
38988
- cswarm token revoke --agent-token-stdin [--url <url> --anon-key <key>] --workspace-id <uuid> [--token-id <uuid>]
39008
+ cswarm token revoke ${requiredAgentCredential} [--url <url> --anon-key <key>] --workspace-id <uuid> [--token-id <uuid>]
38989
39009
  cswarm link new [--url <url> --anon-key <key>] [--workspace-id <uuid>] --task-id <uuid> [--ttl-ms <ms>] [--site <origin>] [--json]
38990
39010
  cswarm link revoke [--url <url> --anon-key <key>] [--workspace-id <uuid>] --capability-id <uuid> [--json]
38991
- cswarm command <kind> [--url <url> --anon-key <key>] [--workspace-id <uuid>] [command fields]
38992
- cswarm dogfood [--url <url> --anon-key <key>] [--workspace-id <uuid>] --slug <slug> --branch <branch> --head-sha <sha> --evidence <ref>
39011
+ cswarm command <kind> [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} [command fields]
39012
+ cswarm dogfood [--url <url> --anon-key <key>] [--workspace-id <uuid>] ${agentCredential2} --slug <slug> --branch <branch> --head-sha <sha> --evidence <ref>
38993
39013
  cswarm seed-fixture --uid <auth-user-uuid> [--device-id <uuid>] [--workspace-id <uuid>]
38994
39014
 
38995
39015
  Credential selection for command/dogfood:
38996
39016
  default refresh the human login from secure storage
39017
+ --agent-token-file read the credential from an owned 0600 regular file in an owned
39018
+ 0700 directory. The path may appear in argv; the secret never does.
38997
39019
  --agent-token-stdin read a mint/seed credential artifact, or a bare swm_agt_ token, from
38998
39020
  stdin. WHICH FORMS ARE ACCEPTED DEPENDS ON WHAT THE SUBCOMMAND DOES
38999
39021
  WITH THE CREDENTIAL. A subcommand that only reads takes either form.
39000
39022
  One that persists or references the credential needs the complete
39001
39023
  JSON artifact, because it needs a field a bare secret does not carry:
39024
+ whoami reads server-proven identity -- complete or bare form
39002
39025
  members reads only -- either form
39026
+ working-on, note, ask, reply, feed, inbox
39027
+ signal command/read only -- either form
39003
39028
  receipt reads only -- either form
39004
39029
  inbox --notify persists a per-agent cursor -- needs principal_id
39005
39030
  file put, file ls, file get, file rm, file restore
39006
39031
  read and command, nothing persisted -- either form
39007
39032
  feedback command only, nothing persisted -- either form
39033
+ command, dogfood
39034
+ task protocol commands -- either form
39008
39035
  listen start persists durable state, rotates -- needs expires_at
39009
39036
  hook check reads the listener's owned 0600 credential state;
39010
39037
  never accepts or prints a credential
@@ -39044,7 +39071,7 @@ hook install claude prints the UserPromptSubmit JSON by default and changes the
39044
39071
  project's .claude/settings.json only with --write; uninstall also requires --write.
39045
39072
 
39046
39073
  Invite, legacy token accept, principal create/revoke, human token mint/revoke, link, new, and workspace close require a
39047
- stored human login. Agent self-surrender of a token uses --agent-token-stdin and never takes the secret on argv. Invite-link accept signs in when needed, then accepts and
39074
+ stored human login. Agent self-surrender of a token uses --agent-token-file or --agent-token-stdin and never takes the secret on argv. Invite-link accept signs in when needed, then accepts and
39048
39075
  registers one principal. Invitation links, agent credentials, and capability links
39049
39076
  appear only in fresh success responses.
39050
39077
 
@@ -39087,7 +39114,7 @@ workspace only for callers who already hold that full-database credential; it
39087
39114
  grants no new authority and is not a governed product workspace-creation path.`;
39088
39115
  }
39089
39116
  async function target(args) {
39090
- const mode3 = args.has("agent-token-stdin") ? "agent" : "human";
39117
+ const mode3 = hasAgentCredential(args) ? "agent" : "human";
39091
39118
  try {
39092
39119
  return await resolveCloudTarget({
39093
39120
  explicitUrl: args.optional("url"),
@@ -39211,6 +39238,51 @@ async function stdinCredential() {
39211
39238
  const credential = value.trim();
39212
39239
  return parsedAgentCredential(credential);
39213
39240
  }
39241
+ var AgentTokenFileError = class extends Error {
39242
+ constructor(code, message) {
39243
+ super(`[${code}] ${message}`);
39244
+ this.code = code;
39245
+ }
39246
+ code;
39247
+ name = "AgentTokenFileError";
39248
+ };
39249
+ function hasAgentCredential(args) {
39250
+ return CREDENTIAL_FLAGS.some((flag) => args.has(flag));
39251
+ }
39252
+ async function agentCredential(args, options = {}) {
39253
+ const fromFile = args.optional("agent-token-file");
39254
+ const fromStdin = args.has("agent-token-stdin");
39255
+ if (fromFile !== void 0 && fromStdin) {
39256
+ throw new Error(
39257
+ "use exactly one agent credential source: --agent-token-file or --agent-token-stdin"
39258
+ );
39259
+ }
39260
+ if (fromFile !== void 0) {
39261
+ let value;
39262
+ try {
39263
+ value = await readSecureJsonFile(fromFile, 4096);
39264
+ } catch (error) {
39265
+ const detail = error instanceof Error ? error.message : "unknown read failure";
39266
+ throw new AgentTokenFileError(
39267
+ "agent_token_file_unreadable",
39268
+ `could not read --agent-token-file securely: ${detail}`
39269
+ );
39270
+ }
39271
+ if (value === null) {
39272
+ throw new AgentTokenFileError(
39273
+ "agent_token_file_missing",
39274
+ `--agent-token-file does not exist: ${fromFile}`
39275
+ );
39276
+ }
39277
+ return parsedAgentCredential(value.trim());
39278
+ }
39279
+ if (fromStdin || options.implicitStdin === true) {
39280
+ return await stdinCredential();
39281
+ }
39282
+ throw new Error(
39283
+ "provide the agent credential with --agent-token-file <path> or --agent-token-stdin"
39284
+ );
39285
+ }
39214
39286
  async function invitationCredential(args) {
39215
39287
  if (args.has("invitation-token-stdin")) {
39216
39288
  args.assertShape([...TARGET_FLAGS, "invitation-token-stdin"], 1);
@@ -40059,13 +40131,13 @@ async function runToken(args) {
40059
40131
  }));
40060
40132
  }
40061
40133
  async function runTokenRevoke(args) {
40062
- if (args.has("agent-token-stdin")) {
40134
+ if (hasAgentCredential(args)) {
40063
40135
  args.assertShape(
40064
- [...TARGET_FLAGS, "workspace-id", "token-id", "agent-token-stdin", "json"],
40136
+ [...TARGET_FLAGS, "workspace-id", "token-id", ...CREDENTIAL_FLAGS, "json"],
40065
40137
  2
40066
40138
  );
40067
40139
  const cloud2 = await target(args);
40068
- const agent = await stdinCredential();
40140
+ const agent = await agentCredential(args);
40069
40141
  const override = workspaceOverride(
40070
40142
  args.optional("workspace-id"),
40071
40143
  process.env.SWARM_CLOUD_WORKSPACE_ID
@@ -40077,13 +40149,13 @@ async function runTokenRevoke(args) {
40077
40149
  }
40078
40150
  if (agent.tokenId === null) {
40079
40151
  throw new Error(
40080
- "agent credential on stdin has no token_id; pipe the JSON artifact from token mint, not a bare secret"
40152
+ "agent credential has no token_id; use the JSON artifact from token mint, not a bare secret"
40081
40153
  );
40082
40154
  }
40083
40155
  const requested = args.optional("token-id");
40084
40156
  if (requested !== void 0 && requested.toLowerCase() !== agent.tokenId) {
40085
40157
  throw new Error(
40086
- "token-id does not match the credential on stdin; no request was sent"
40158
+ "token-id does not match the credential; no request was sent"
40087
40159
  );
40088
40160
  }
40089
40161
  const tokenId2 = agent.tokenId;
@@ -40399,13 +40471,13 @@ async function commandWorkspaceAndCredential(args, cloud, options = {}) {
40399
40471
  args.optional("workspace-id"),
40400
40472
  process.env.SWARM_CLOUD_WORKSPACE_ID
40401
40473
  );
40402
- if (args.has("agent-token-stdin")) {
40474
+ if (hasAgentCredential(args)) {
40403
40475
  if (override === null) {
40404
40476
  throw new Error(
40405
40477
  "not logged in; agent credentials require --workspace-id or SWARM_CLOUD_WORKSPACE_ID because they never infer a human's workspace selection"
40406
40478
  );
40407
40479
  }
40408
- const agent = await stdinCredential();
40480
+ const agent = await agentCredential(args);
40409
40481
  const session = await agentSession(cloud, override, agent);
40410
40482
  return {
40411
40483
  selectedWorkspace: override,
@@ -40963,6 +41035,80 @@ async function runMembers(args) {
40963
41035
  }
40964
41036
  process.stdout.write(renderRoster(directory, memberNames));
40965
41037
  }
41038
+ async function runWhoami(args) {
41039
+ args.assertShape([
41040
+ ...TARGET_FLAGS,
41041
+ "workspace-id",
41042
+ ...CREDENTIAL_FLAGS,
41043
+ "json"
41044
+ ], 1);
41045
+ if (!hasAgentCredential(args)) {
41046
+ throw new UsageError(
41047
+ "cswarm whoami needs --agent-token-file <path> or --agent-token-stdin"
41048
+ );
41049
+ }
41050
+ const cloud = await target(args);
41051
+ const selected = await commandWorkspaceAndCredential(args, cloud, {
41052
+ validateHumanWorkspace: true
41053
+ });
41054
+ const directory = await readAgentSignalDirectory(
41055
+ cloud,
41056
+ selected.bearer,
41057
+ selected.selectedWorkspace
41058
+ );
41059
+ const identity = directory.identity;
41060
+ if (identity === void 0) {
41061
+ throw new Error(
41062
+ "this deployment authenticated the credential but did not return its identity; update the read service before using cswarm whoami"
41063
+ );
41064
+ }
41065
+ const principal = directory.agents.find(
41066
+ (agent) => agent.principal_id === identity.principal_id
41067
+ );
41068
+ if (principal === void 0 || principal.owner_user_id !== identity.owner_user_id) {
41069
+ throw new Error(
41070
+ "the read service authenticated this credential but returned no matching live principal; identity was not shown"
41071
+ );
41072
+ }
41073
+ const owner = directory.members.find(
41074
+ (member) => member.user_id === identity.owner_user_id
41075
+ );
41076
+ if (owner === void 0) {
41077
+ throw new Error(
41078
+ "the read service authenticated this credential but returned no matching owner; identity was not shown"
41079
+ );
41080
+ }
41081
+ const displayName = sanitizeDisplayLabel(principal.name, "Unnamed agent");
41082
+ const ownerName = sanitizeDisplayLabel(owner.display_name, "Unnamed member");
41083
+ const artifactPrincipalId = selected.agent?.principalId ?? null;
41084
+ const artifactMatches = artifactPrincipalId === null || artifactPrincipalId === identity.principal_id;
41085
+ if (!artifactMatches) {
41086
+ process.stderr.write(
41087
+ `WARNING: the credential authenticated as ${displayName} (${identity.principal_id}), but its JSON metadata names ${artifactPrincipalId}. Trust the authenticated identity shown here and replace the inconsistent artifact.
41088
+ `
41089
+ );
41090
+ }
41091
+ const output = {
41092
+ credential_valid: identity.credential_valid,
41093
+ principal_id: identity.principal_id,
41094
+ display_name: displayName,
41095
+ workspace_id: identity.workspace_id,
41096
+ owner_user_id: identity.owner_user_id,
41097
+ owner_display_name: ownerName,
41098
+ credential_metadata_match: artifactMatches
41099
+ };
41100
+ if (args.has("json")) {
41101
+ printJson(output);
41102
+ return;
41103
+ }
41104
+ process.stdout.write(
41105
+ `You are ${displayName} (${identity.principal_id}).
41106
+ Credential valid now: yes.
41107
+ Workspace: ${identity.workspace_id}.
41108
+ Owner: ${ownerName} (${identity.owner_user_id}).
41109
+ `
41110
+ );
41111
+ }
40966
41112
  async function runSignalRead(args, inbox) {
40967
41113
  const notify = inbox && args.has("notify");
40968
41114
  args.assertShape(notify ? [
@@ -41073,9 +41219,9 @@ async function writeMonitorLine(line) {
41073
41219
  });
41074
41220
  }
41075
41221
  async function runInboxNotifyCommand(args) {
41076
- if (!args.has("agent-token-stdin")) {
41222
+ if (!hasAgentCredential(args)) {
41077
41223
  throw new Error(
41078
- "inbox --notify is for one agent; provide its JSON credential with --agent-token-stdin"
41224
+ "inbox --notify is for one agent; provide its JSON credential with --agent-token-file or --agent-token-stdin"
41079
41225
  );
41080
41226
  }
41081
41227
  const cloud = await target(args);
@@ -41157,9 +41303,9 @@ async function runReceipt(args) {
41157
41303
  if (!UUID_RE19.test(signalId)) {
41158
41304
  throw new Error("signal-id must be a UUID");
41159
41305
  }
41160
- if (!args.has("agent-token-stdin")) {
41306
+ if (!hasAgentCredential(args)) {
41161
41307
  throw new Error(
41162
- "receipt reads signals sent by an agent; provide --agent-token-stdin and --workspace-id"
41308
+ "receipt reads signals sent by an agent; provide --agent-token-file or --agent-token-stdin, and --workspace-id"
41163
41309
  );
41164
41310
  }
41165
41311
  const cloud = await target(args);
@@ -41882,7 +42028,7 @@ async function runListenStart(args) {
41882
42028
  args.assertShape([
41883
42029
  ...TARGET_FLAGS,
41884
42030
  "workspace-id",
41885
- "agent-token-stdin",
42031
+ ...CREDENTIAL_FLAGS,
41886
42032
  "provider",
41887
42033
  "cwd",
41888
42034
  "model",
@@ -41899,9 +42045,9 @@ async function runListenStart(args) {
41899
42045
  "foreground",
41900
42046
  "json"
41901
42047
  ], 2);
41902
- if (!args.has("agent-token-stdin")) {
42048
+ if (!hasAgentCredential(args)) {
41903
42049
  throw new Error(
41904
- "listen start requires --agent-token-stdin; credentials are never accepted on argv"
42050
+ "listen start requires --agent-token-file or --agent-token-stdin; credentials are never accepted on argv"
41905
42051
  );
41906
42052
  }
41907
42053
  const provider = listenerProvider(args);
@@ -41916,7 +42062,7 @@ async function runListenStart(args) {
41916
42062
  args.optional("workspace-id") ?? process.env.SWARM_CLOUD_WORKSPACE_ID,
41917
42063
  "workspace-id"
41918
42064
  );
41919
- const agent = await stdinCredential();
42065
+ const agent = await agentCredential(args);
41920
42066
  assertDurableListenerCredential(agent);
41921
42067
  const principalId = agent.principalId;
41922
42068
  const cwd = args.optional("cwd") ?? process.cwd();
@@ -42066,6 +42212,7 @@ The short credential rotates while this process remains alive and secure local s
42066
42212
  async function runListenSupervisor(args) {
42067
42213
  args.assertShape([
42068
42214
  ...TARGET_FLAGS,
42215
+ ...CREDENTIAL_FLAGS,
42069
42216
  "workspace-id",
42070
42217
  "principal-id",
42071
42218
  "cwd",
@@ -42092,7 +42239,7 @@ async function runListenSupervisor(args) {
42092
42239
  const cloud = await target(args);
42093
42240
  const workspaceId2 = listenerUuid(args.optional("workspace-id"), "workspace-id");
42094
42241
  const principalId = listenerUuid(args.optional("principal-id"), "principal-id");
42095
- const agent = await stdinCredential();
42242
+ const agent = await agentCredential(args, { implicitStdin: true });
42096
42243
  assertDurableListenerCredential(agent, principalId);
42097
42244
  const cwd = args.required("cwd");
42098
42245
  if (!(0, import_node_path20.isAbsolute)(cwd)) throw new Error("--cwd must be an absolute path");
@@ -42847,6 +42994,10 @@ async function main() {
42847
42994
  await runStatus(args);
42848
42995
  return;
42849
42996
  }
42997
+ if (verb === "whoami") {
42998
+ await runWhoami(args);
42999
+ return;
43000
+ }
42850
43001
  if (verb === "feedback") {
42851
43002
  await runFeedback(args);
42852
43003
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commonswarm",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "CommonSwarm CLI — coordination for teams where people and AI agents work side by side.",
5
5
  "bin": {
6
6
  "cswarm": "cswarm.cjs"