commonswarm 0.1.28 → 0.1.29

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 +26 -10
  2. package/package.json +1 -1
package/cswarm.cjs CHANGED
@@ -28337,6 +28337,8 @@ function describeServerError(prefix, envelope) {
28337
28337
  // src/cloud/signals.ts
28338
28338
  var UUID_RE7 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
28339
28339
  var SIGNAL_KINDS = /* @__PURE__ */ new Set(["working-on", "note", "ask"]);
28340
+ var SIGNAL_BODY_DISPLAY_MAX = 8e3;
28341
+ var SIGNAL_ABOUT_DISPLAY_MAX = 500;
28340
28342
  var SIGNAL_READ_TIMEOUT_MS = 3e4;
28341
28343
  var SignalReadTimeoutError = class extends Error {
28342
28344
  constructor(message = "signal read timed out") {
@@ -28443,7 +28445,7 @@ function parseSignalRecord(value) {
28443
28445
  throw new Error("signal read returned a malformed row");
28444
28446
  }
28445
28447
  const row = value;
28446
- if (typeof row.from_kind !== "string" || !["user", "agent"].includes(row.from_kind) || typeof row.kind !== "string" || !SIGNAL_KINDS.has(row.kind) || typeof row.body !== "string" || row.body.length < 1 || row.body.length > 8e3 || !(row.about === null || typeof row.about === "string" && row.about.length <= 500)) {
28448
+ if (typeof row.from_kind !== "string" || !["user", "agent"].includes(row.from_kind) || typeof row.kind !== "string" || !SIGNAL_KINDS.has(row.kind) || typeof row.body !== "string" || row.body.length < 1 || !(row.about === null || typeof row.about === "string")) {
28447
28449
  throw new Error("signal read returned malformed signal data");
28448
28450
  }
28449
28451
  let senderOwnerRelation = "unknown";
@@ -29175,13 +29177,27 @@ function renderSignals(signals, options) {
29175
29177
  const authorName = signal.from_kind === "agent" ? options.authors?.agents.get(signal.from) : options.authors?.users.get(signal.from);
29176
29178
  const author = authorName === void 0 ? `${authorKind} ${signal.from}` : `${authorKind} ${authorName} (${signal.from})${signal.from_kind === "user" && options.authors?.currentUserId === signal.from ? " \u2014 you" : ""}`;
29177
29179
  const expired = Date.parse(signal.until) <= now ? " (expired)" : "";
29178
- const about = signal.about === null ? "" : ` about ${JSON.stringify(signal.about)}`;
29180
+ const aboutClipped = signal.about !== null && signal.about.length > SIGNAL_ABOUT_DISPLAY_MAX;
29181
+ const displayedAbout = aboutClipped ? signal.about.slice(0, SIGNAL_ABOUT_DISPLAY_MAX) : signal.about;
29182
+ const about = displayedAbout === null ? "" : ` about ${JSON.stringify(displayedAbout)}`;
29179
29183
  const replyTo = (signal.in_reply_to ?? null) === null ? "" : ` \u2014 in reply to ${signal.in_reply_to}`;
29180
29184
  const replyable = signal.kind === "ask";
29181
29185
  const idHint = replyable ? ` \u2014 reply with: cswarm reply ${signal.id}` : "";
29186
+ const bodyClipped = signal.body.length > SIGNAL_BODY_DISPLAY_MAX;
29187
+ const displayedBody = bodyClipped ? signal.body.slice(0, SIGNAL_BODY_DISPLAY_MAX) : signal.body;
29182
29188
  lines.push(
29183
- `- [${signal.kind}] ${author} \u2014 ${relativeAge(signal.created_at, now)} \u2014 ${relativeExpiry(signal.until, now)}${expired}${about}${replyTo}: ${JSON.stringify(signal.body)}${idHint}`
29189
+ `- [${signal.kind}] ${author} \u2014 ${relativeAge(signal.created_at, now)} \u2014 ${relativeExpiry(signal.until, now)}${expired}${about}${replyTo}: ${JSON.stringify(displayedBody)}${idHint}`
29184
29190
  );
29191
+ if (bodyClipped) {
29192
+ lines.push(
29193
+ ` WARNING: Body clipped for display. Showing ${SIGNAL_BODY_DISPLAY_MAX} of ${signal.body.length} characters. Use --json to read the full body.`
29194
+ );
29195
+ }
29196
+ if (aboutClipped) {
29197
+ lines.push(
29198
+ ` WARNING: About reference clipped for display. Showing ${SIGNAL_ABOUT_DISPLAY_MAX} of ${signal.about.length} characters. Use --json to read the full reference.`
29199
+ );
29200
+ }
29185
29201
  }
29186
29202
  return lines.join("\n");
29187
29203
  }
@@ -32571,7 +32587,7 @@ var import_node_path8 = require("node:path");
32571
32587
  var import_node_util = require("node:util");
32572
32588
  var UUID_RE9 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
32573
32589
  var COMMAND_ID_RE2 = /^[A-Za-z0-9_-]{8,72}$/;
32574
- var MAX_EFFECT_BYTES = 32 * 1024;
32590
+ var MAX_EFFECT_BYTES = 1024 * 1024;
32575
32591
  var STATES = /* @__PURE__ */ new Set([
32576
32592
  "received",
32577
32593
  "prompting",
@@ -32653,7 +32669,7 @@ function parseListenerEffectRecord(raw, expectedId) {
32653
32669
  return parseV2Record(row);
32654
32670
  }
32655
32671
  function upcastV1Ask(row) {
32656
- if (row.effectOrdinal !== 0 || typeof row.commandId !== "string" || !COMMAND_ID_RE2.test(row.commandId) || typeof row.askBody !== "string" || row.askBody.length < 1 || row.askBody.length > 2e3 || typeof row.askUntil !== "string" || !Number.isFinite(Date.parse(row.askUntil)) || typeof row.senderOwnerRelation !== "string" || !RELATIONS.has(row.senderOwnerRelation) || typeof row.state !== "string" || !STATES.has(row.state) || !integer(row.promptAttempts) || !integer(row.postAttempts) || !nullableString(row.replyBody, 2e3) || typeof row.replyTruncated !== "boolean" || !nullableString(row.replySignalId, 64) || !nullableString(row.failureCode, 96) || typeof row.updatedAt !== "string" || !Number.isFinite(Date.parse(row.updatedAt))) {
32672
+ if (row.effectOrdinal !== 0 || typeof row.commandId !== "string" || !COMMAND_ID_RE2.test(row.commandId) || typeof row.askBody !== "string" || row.askBody.length < 1 || typeof row.askUntil !== "string" || !Number.isFinite(Date.parse(row.askUntil)) || typeof row.senderOwnerRelation !== "string" || !RELATIONS.has(row.senderOwnerRelation) || typeof row.state !== "string" || !STATES.has(row.state) || !integer(row.promptAttempts) || !integer(row.postAttempts) || !nullableString(row.replyBody, 2e3) || typeof row.replyTruncated !== "boolean" || !nullableString(row.replySignalId, 64) || !nullableString(row.failureCode, 96) || typeof row.updatedAt !== "string" || !Number.isFinite(Date.parse(row.updatedAt))) {
32657
32673
  throw new Error("stored listener effect is malformed");
32658
32674
  }
32659
32675
  if (row.replySignalId !== null && !UUID_RE9.test(row.replySignalId)) {
@@ -32680,7 +32696,7 @@ function upcastV1Ask(row) {
32680
32696
  }
32681
32697
  function parseV2Record(row) {
32682
32698
  const signalKind2 = row.signalKind;
32683
- if (typeof signalKind2 !== "string" || !SIGNAL_KINDS2.has(signalKind2) || row.effectOrdinal !== 0 || typeof row.askBody !== "string" || row.askBody.length < 1 || row.askBody.length > 2e3 || typeof row.askUntil !== "string" || !Number.isFinite(Date.parse(row.askUntil)) || typeof row.senderOwnerRelation !== "string" || !RELATIONS.has(row.senderOwnerRelation) || typeof row.state !== "string" || !STATES.has(row.state) || !integer(row.promptAttempts) || !integer(row.postAttempts) || !nullableString(row.replyBody, 2e3) || typeof row.replyTruncated !== "boolean" || !nullableString(row.replySignalId, 64) || !nullableString(row.failureCode, 96) || typeof row.updatedAt !== "string" || !Number.isFinite(Date.parse(row.updatedAt))) {
32699
+ if (typeof signalKind2 !== "string" || !SIGNAL_KINDS2.has(signalKind2) || row.effectOrdinal !== 0 || typeof row.askBody !== "string" || row.askBody.length < 1 || typeof row.askUntil !== "string" || !Number.isFinite(Date.parse(row.askUntil)) || typeof row.senderOwnerRelation !== "string" || !RELATIONS.has(row.senderOwnerRelation) || typeof row.state !== "string" || !STATES.has(row.state) || !integer(row.promptAttempts) || !integer(row.postAttempts) || !nullableString(row.replyBody, 2e3) || typeof row.replyTruncated !== "boolean" || !nullableString(row.replySignalId, 64) || !nullableString(row.failureCode, 96) || typeof row.updatedAt !== "string" || !Number.isFinite(Date.parse(row.updatedAt))) {
32684
32700
  throw new Error("stored listener effect is malformed");
32685
32701
  }
32686
32702
  if (signalKind2 === "note") {
@@ -32722,7 +32738,7 @@ function newObservedNoteRecord(input) {
32722
32738
  if (!UUID_RE9.test(input.signalId)) {
32723
32739
  throw new Error("listener note signal id must be a UUID");
32724
32740
  }
32725
- if (input.body.length < 1 || input.body.length > 2e3) {
32741
+ if (input.body.length < 1) {
32726
32742
  throw new Error("listener note body is invalid");
32727
32743
  }
32728
32744
  if (!Number.isFinite(Date.parse(input.until))) {
@@ -34556,7 +34572,7 @@ function parseEntry(value) {
34556
34572
  if (Object.keys(row).some((key2) => !allowed.has(key2))) {
34557
34573
  throw new Error("stored pending-for-main entry is malformed");
34558
34574
  }
34559
- if (typeof row.signalId !== "string" || !UUID_RE11.test(row.signalId) || typeof row.workspaceId !== "string" || !UUID_RE11.test(row.workspaceId) || typeof row.principalId !== "string" || !UUID_RE11.test(row.principalId) || typeof row.fromId !== "string" || !UUID_RE11.test(row.fromId) || row.fromKind !== "user" && row.fromKind !== "agent" || !(row.kind === void 0 || row.kind === "ask" || row.kind === "note") || !(row.senderName === null || typeof row.senderName === "string" && row.senderName.length <= 200) || typeof row.body !== "string" || row.body.length < 1 || row.body.length > 2e3 || !checkedTimestamp2(row.createdAt) || !checkedTimestamp2(row.queuedAt)) {
34575
+ if (typeof row.signalId !== "string" || !UUID_RE11.test(row.signalId) || typeof row.workspaceId !== "string" || !UUID_RE11.test(row.workspaceId) || typeof row.principalId !== "string" || !UUID_RE11.test(row.principalId) || typeof row.fromId !== "string" || !UUID_RE11.test(row.fromId) || row.fromKind !== "user" && row.fromKind !== "agent" || !(row.kind === void 0 || row.kind === "ask" || row.kind === "note") || !(row.senderName === null || typeof row.senderName === "string" && row.senderName.length <= 200) || typeof row.body !== "string" || row.body.length < 1 || !checkedTimestamp2(row.createdAt) || !checkedTimestamp2(row.queuedAt)) {
34560
34576
  throw new Error("stored pending-for-main entry is malformed");
34561
34577
  }
34562
34578
  return {
@@ -38135,8 +38151,8 @@ var ACCEPTED_AGENT_CREDENTIAL_MESSAGES = [
38135
38151
  AGENT_CREDENTIAL_MESSAGE_D088
38136
38152
  ];
38137
38153
  function packageVersion() {
38138
- if ("0.1.28".length > 0) {
38139
- return "0.1.28";
38154
+ if ("0.1.29".length > 0) {
38155
+ return "0.1.29";
38140
38156
  }
38141
38157
  try {
38142
38158
  const value = JSON.parse(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "commonswarm",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
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"