replicas-cli 0.3.26 → 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 +51 -5
  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
  });
@@ -26172,6 +26173,46 @@ function removeReplicasInstructions(text2) {
26172
26173
  }
26173
26174
  var MULTITASK_INSTRUCTIONS_BLOCK = new RegExp(`\\s*<${MULTITASK_INSTRUCTIONS_TAG}>\\n([\\s\\S]*?)\\n</${MULTITASK_INSTRUCTIONS_TAG}>`);
26174
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
+
26175
26216
  // ../shared/src/user-message-attachments.ts
26176
26217
  var ATTACHMENT_PLACEHOLDER_REGEX = /^\[\d+ (?:(?:images?|files?)(?: and \d+ files?)? attached|(?:image )?attachments?)\]$/;
26177
26218
  var WALKTHROUGH_NOTE_REGEX = /(?:^|\n\n)<replicas_walkthrough path="([^"\n]+)" duration_seconds="(\d+)" audio="(true|false)">\n[^<]*\n<\/replicas_walkthrough>$/;
@@ -28025,6 +28066,11 @@ function applyInterruptions(messages, events) {
28025
28066
  function applyEngineNotices(messages, events) {
28026
28067
  const notices = [];
28027
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
+ }
28028
28074
  if (event.type === CHAT_MESSAGE_REJECTED_EVENT_TYPE) {
28029
28075
  notices.push({
28030
28076
  id: `message-rejected-${event.timestamp}-${index}`,
@@ -28380,7 +28426,7 @@ var headlessAgentRequestSchema = external_exports.object({
28380
28426
  });
28381
28427
 
28382
28428
  // ../shared/src/cli-version.ts
28383
- var CLI_VERSION = "0.3.26";
28429
+ var CLI_VERSION = "0.3.27";
28384
28430
 
28385
28431
  // ../shared/src/version.ts
28386
28432
  function compareVersions(v1, v2) {
@@ -29209,7 +29255,7 @@ async function authenticatedFetch(url2, options) {
29209
29255
 
29210
29256
  // src/lib/output.ts
29211
29257
  var import_chalk = __toESM(require("chalk"));
29212
- var import_prompts4 = __toESM(require("prompts"));
29258
+ var import_prompts5 = __toESM(require("prompts"));
29213
29259
  var jsonMode = false;
29214
29260
  function enableJsonMode() {
29215
29261
  jsonMode = true;
@@ -29238,7 +29284,7 @@ async function ask(question) {
29238
29284
  if (!isInteractive()) {
29239
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.`);
29240
29286
  }
29241
- return (0, import_prompts4.default)(question);
29287
+ return (0, import_prompts5.default)(question);
29242
29288
  }
29243
29289
 
29244
29290
  // src/lib/organization.ts
@@ -29931,7 +29977,7 @@ var import_chalk9 = __toESM(require("chalk"));
29931
29977
 
29932
29978
  // src/lib/command-utils.ts
29933
29979
  var import_chalk7 = __toESM(require("chalk"));
29934
- var import_prompts5 = __toESM(require("prompts"));
29980
+ var import_prompts6 = __toESM(require("prompts"));
29935
29981
  function formatDate(dateString) {
29936
29982
  return new Date(dateString).toLocaleString();
29937
29983
  }
@@ -29952,7 +29998,7 @@ function parseKeyValuePairs(pairs) {
29952
29998
  }
29953
29999
  async function confirmAction(message2) {
29954
30000
  if (!isInteractive()) throw new Error(`${message2} Pass -f to confirm without a terminal.`);
29955
- 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 });
29956
30002
  if (!confirm) console.log(import_chalk7.default.yellow("\nCancelled."));
29957
30003
  return Boolean(confirm);
29958
30004
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.26",
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": {