replicas-cli 0.3.25 → 0.3.27

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/dist/index.cjs +53 -19
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -22927,6 +22927,7 @@ function toSnakeCaseKeys(value) {
22927
22927
  }
22928
22928
 
22929
22929
  // ../shared/src/engine/v1.ts
22930
+ var MERGED_MESSAGE_SEPARATOR = "\n\n<!-- replicas:merged -->\n\n";
22930
22931
  var updateChatDisplayNameRequestSchema = external_exports.object({
22931
22932
  displayName: external_exports.string().trim().min(1).max(100)
22932
22933
  });
@@ -26005,20 +26006,6 @@ function workspaceConfigWithPrFollowups(config3, prFollowups = config3?.capabili
26005
26006
  return workspaceConfigWithCapabilities(config3, { pr_followups: prFollowups });
26006
26007
  }
26007
26008
  var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
26008
- var WORKSPACE_SORT_CHOICES = [
26009
- ["manual", "Custom"],
26010
- ["activity", "Last activity"],
26011
- ["created", "Created date"]
26012
- ];
26013
- var WORKSPACE_SORT_OPTIONS = WORKSPACE_SORT_CHOICES.map(([option]) => option);
26014
- var WORKSPACE_SORT_LABELS = Object.fromEntries(WORKSPACE_SORT_CHOICES);
26015
- var WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES = [
26016
- ["chronological", "Chronological"],
26017
- ["environments", "Environments"],
26018
- ["recent", "Recent environments"]
26019
- ];
26020
- var WORKSPACE_SIDEBAR_ORGANIZATIONS = WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES.map(([organization]) => organization);
26021
- var WORKSPACE_SIDEBAR_ORGANIZATION_LABELS = Object.fromEntries(WORKSPACE_SIDEBAR_ORGANIZATION_CHOICES);
26022
26009
  var DEFAULT_STATUS_FILTERS = [...WORKSPACE_STATUS_FILTERS];
26023
26010
  var DEFAULT_WORKSPACE_FILTERS = {
26024
26011
  statuses: [...DEFAULT_STATUS_FILTERS],
@@ -26186,6 +26173,46 @@ function removeReplicasInstructions(text2) {
26186
26173
  }
26187
26174
  var MULTITASK_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MULTITASK_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MULTITASK_INSTRUCTIONS_TAG}>`);
26188
26175
 
26176
+ // ../shared/src/multitask-events.ts
26177
+ var MULTITASK_EVENT_KINDS = ["finished", "ready", "needs_attention", "merged", "closed", "archived"];
26178
+ var MULTITASK_EVENT_TYPE = "multitask-event";
26179
+ var multitaskEventSchema = external_exports.object({
26180
+ id: external_exports.string(),
26181
+ at: external_exports.string(),
26182
+ kind: external_exports.enum(MULTITASK_EVENT_KINDS),
26183
+ agentId: external_exports.string(),
26184
+ agentName: external_exports.string(),
26185
+ summary: external_exports.string(),
26186
+ detail: external_exports.string().optional(),
26187
+ // Already shown as a row when it happened, so the delivered message does not show it again.
26188
+ noticed: external_exports.boolean().optional()
26189
+ });
26190
+ var TAG = "multitask_event";
26191
+ var BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
26192
+ var ATTRIBUTE = /(\w+)="([^"]*)"/g;
26193
+ var unescapeAttribute = (value) => value.replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
26194
+ function parseMultitaskEvents(text2) {
26195
+ const events = [];
26196
+ for (const match of text2.matchAll(BLOCK)) {
26197
+ const attributes = Object.fromEntries([...match[1].matchAll(ATTRIBUTE)].map(([, key, value]) => [key, unescapeAttribute(value)]));
26198
+ const kind = MULTITASK_EVENT_KINDS.find((candidate) => candidate === attributes.kind);
26199
+ if (!kind || !attributes.id || !attributes.agent_id) return null;
26200
+ const [summary, ...rest] = match[2].replaceAll(`<\\/${TAG}`, `</${TAG}`).split("\n\n");
26201
+ const detail = rest.join("\n\n").trim();
26202
+ events.push({
26203
+ id: attributes.id,
26204
+ at: attributes.at ?? "",
26205
+ kind,
26206
+ agentId: attributes.agent_id,
26207
+ agentName: attributes.agent ?? "subagent",
26208
+ summary: summary.trim(),
26209
+ ...detail ? { detail } : {},
26210
+ ...attributes.noticed === "true" ? { noticed: true } : {}
26211
+ });
26212
+ }
26213
+ return events.length > 0 && text2.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
26214
+ }
26215
+
26189
26216
  // ../shared/src/user-message-attachments.ts
26190
26217
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
26191
26218
  var WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
@@ -28039,6 +28066,11 @@ function applyInterruptions(messages, events) {
28039
28066
  function applyEngineNotices(messages, events) {
28040
28067
  const notices = [];
28041
28068
  events.forEach((event, index) => {
28069
+ if (event.type === MULTITASK_EVENT_TYPE) {
28070
+ const parsed = typeof event.payload.text === "string" ? parseMultitaskEvents(event.payload.text) : null;
28071
+ if (parsed) notices.push({ id: `multitask-event-${event.timestamp}-${index}`, type: "multitask_event", events: parsed, timestamp: event.timestamp });
28072
+ return;
28073
+ }
28042
28074
  if (event.type === CHAT_MESSAGE_REJECTED_EVENT_TYPE) {
28043
28075
  notices.push({
28044
28076
  id: `message-rejected-${event.timestamp}-${index}`,
@@ -28394,7 +28426,7 @@ var headlessAgentRequestSchema = external_exports.object({
28394
28426
  });
28395
28427
 
28396
28428
  // ../shared/src/cli-version.ts
28397
- var CLI_VERSION = "0.3.25";
28429
+ var CLI_VERSION = "0.3.27";
28398
28430
 
28399
28431
  // ../shared/src/version.ts
28400
28432
  function compareVersions(v1, v2) {
@@ -28848,10 +28880,12 @@ var MAX_CLIENT_STATE_BYTES_PER_USER = 10 * 1024 * 1024;
28848
28880
  var WORKSPACE_LAST_VIEWED_AT_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-last-viewed-at-";
28849
28881
  var WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-attention-done-";
28850
28882
  var WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-stages-";
28883
+ var WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-marked-unread-";
28851
28884
  var orgUserClientStateKey = (prefix) => (organizationId, userId) => `${prefix}${organizationId}-${userId}`;
28852
28885
  var workspaceLastViewedAtClientStateKey = orgUserClientStateKey(WORKSPACE_LAST_VIEWED_AT_CLIENT_STATE_KEY_PREFIX);
28853
28886
  var workspaceAttentionDoneClientStateKey = orgUserClientStateKey(WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX);
28854
28887
  var workspaceStagesClientStateKey = orgUserClientStateKey(WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX);
28888
+ var workspaceMarkedUnreadClientStateKey = orgUserClientStateKey(WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX);
28855
28889
 
28856
28890
  // ../shared/src/routes/workspace-events.ts
28857
28891
  var workspaceChangedEventSchema = external_exports.discriminatedUnion("type", [
@@ -29221,7 +29255,7 @@ async function authenticatedFetch(url2, options) {
29221
29255
 
29222
29256
  // src/lib/output.ts
29223
29257
  var import_chalk = __toESM(require("chalk"));
29224
- var import_prompts4 = __toESM(require("prompts"));
29258
+ var import_prompts5 = __toESM(require("prompts"));
29225
29259
  var jsonMode = false;
29226
29260
  function enableJsonMode() {
29227
29261
  jsonMode = true;
@@ -29250,7 +29284,7 @@ async function ask(question) {
29250
29284
  if (!isInteractive()) {
29251
29285
  throw new Error(`Missing input (${String(question.message).trim()}) and no interactive terminal to ask for it. Pass it as an option; see --help.`);
29252
29286
  }
29253
- return (0, import_prompts4.default)(question);
29287
+ return (0, import_prompts5.default)(question);
29254
29288
  }
29255
29289
 
29256
29290
  // src/lib/organization.ts
@@ -29943,7 +29977,7 @@ var import_chalk9 = __toESM(require("chalk"));
29943
29977
 
29944
29978
  // src/lib/command-utils.ts
29945
29979
  var import_chalk7 = __toESM(require("chalk"));
29946
- var import_prompts5 = __toESM(require("prompts"));
29980
+ var import_prompts6 = __toESM(require("prompts"));
29947
29981
  function formatDate(dateString) {
29948
29982
  return new Date(dateString).toLocaleString();
29949
29983
  }
@@ -29964,7 +29998,7 @@ function parseKeyValuePairs(pairs) {
29964
29998
  }
29965
29999
  async function confirmAction(message2) {
29966
30000
  if (!isInteractive()) throw new Error(`${message2} Pass -f to confirm without a terminal.`);
29967
- const { confirm } = await (0, import_prompts5.default)({ type: "confirm", name: "confirm", message: message2, initial: false });
30001
+ const { confirm } = await (0, import_prompts6.default)({ type: "confirm", name: "confirm", message: message2, initial: false });
29968
30002
  if (!confirm) console.log(import_chalk7.default.yellow("\nCancelled."));
29969
30003
  return Boolean(confirm);
29970
30004
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.25",
3
+ "version": "0.3.27",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {