replicas-cli 0.3.505 → 0.3.506

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 +331 -249
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -232,6 +232,7 @@ var init_urls = __esm({
232
232
  environment: "/environment",
233
233
  analytics: "/analytics",
234
234
  review: "/review",
235
+ issues: "/issues",
235
236
  dashboard: DASHBOARD_PATH,
236
237
  agents: `${DASHBOARD_PATH}/agents`,
237
238
  integrations: `${DASHBOARD_PATH}/integrations`,
@@ -27549,10 +27550,307 @@ var init_message_origin = __esm({
27549
27550
  }
27550
27551
  });
27551
27552
 
27553
+ // ../shared/src/tag-blocks.ts
27554
+ var ATTRIBUTE, MULTITASK_EVENT_TAG, tagBlockPattern, parseTagAttributes;
27555
+ var init_tag_blocks = __esm({
27556
+ "../shared/src/tag-blocks.ts"() {
27557
+ "use strict";
27558
+ ATTRIBUTE = /(\w+)="([^"]*)"/g;
27559
+ MULTITASK_EVENT_TAG = "multitask_event";
27560
+ tagBlockPattern = (tag) => new RegExp(`<${tag}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${tag}>`, "g");
27561
+ parseTagAttributes = (raw) => Object.fromEntries([...raw.matchAll(ATTRIBUTE)].map(([, key, value]) => [key, value.replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&")]));
27562
+ }
27563
+ });
27564
+
27565
+ // ../shared/src/routes/issues.ts
27566
+ var ISSUE_STATUSES, ISSUE_PRIORITIES, ISSUE_ACTOR_TYPES, ISSUE_SUBSCRIBER_ROLES, ISSUE_RELATION_TYPES, ISSUE_PULL_REQUEST_STATES, issueStatusSchema, issuePrioritySchema, issueSubscriberRoleSchema, issueRelationTypeSchema, issuePullRequestStateSchema, ISSUE_STATUS_LABELS, ISSUE_PRIORITY_LABELS, issueActorSchema, ISSUE_KEY_RE, timestamp, nullableTimestamp, issueSchema, issueSubscriberSchema, issueRelationSchema, issuePullRequestSchema, issueCommentSchema, change, nullableId, ISSUE_EVENT_TYPES, issueEventDataSchemas, issueEventBase, issueEventVariant, issueEventSchema, clientMutationId, title2, description, body, createIssueRequestSchema, updateIssueRequestSchema, issueActorRequestSchema, createIssueCommentRequestSchema, updateIssueCommentRequestSchema, createIssueRelationRequestSchema, linkIssuePullRequestRequestSchema, updateIssuePullRequestRequestSchema, issueMutationRequestSchema, updateIssueSettingsRequestSchema, listIssuesQuerySchema, issueDetailResponseSchema, listIssuesResponseSchema, issuesDeltaQuerySchema, issueInboxQuerySchema, markIssueInboxReadRequestSchema;
27567
+ var init_issues2 = __esm({
27568
+ "../shared/src/routes/issues.ts"() {
27569
+ "use strict";
27570
+ init_zod();
27571
+ ISSUE_STATUSES = ["backlog", "todo", "in_progress", "in_review", "done", "canceled", "duplicate"];
27572
+ ISSUE_PRIORITIES = ["none", "urgent", "high", "medium", "low"];
27573
+ ISSUE_ACTOR_TYPES = ["user", "workspace"];
27574
+ ISSUE_SUBSCRIBER_ROLES = ["assignee", "creator", "mentioned", "manual"];
27575
+ ISSUE_RELATION_TYPES = ["blocks", "duplicate_of"];
27576
+ ISSUE_PULL_REQUEST_STATES = ["draft", "open", "merged", "closed"];
27577
+ issueStatusSchema = external_exports.enum(ISSUE_STATUSES);
27578
+ issuePrioritySchema = external_exports.enum(ISSUE_PRIORITIES);
27579
+ issueSubscriberRoleSchema = external_exports.enum(ISSUE_SUBSCRIBER_ROLES);
27580
+ issueRelationTypeSchema = external_exports.enum(ISSUE_RELATION_TYPES);
27581
+ issuePullRequestStateSchema = external_exports.enum(ISSUE_PULL_REQUEST_STATES);
27582
+ ISSUE_STATUS_LABELS = { backlog: "Backlog", todo: "Todo", in_progress: "In Progress", in_review: "In Review", done: "Done", canceled: "Canceled", duplicate: "Duplicate" };
27583
+ ISSUE_PRIORITY_LABELS = { none: "No priority", urgent: "Urgent", high: "High", medium: "Medium", low: "Low" };
27584
+ issueActorSchema = external_exports.object({
27585
+ type: external_exports.enum(ISSUE_ACTOR_TYPES),
27586
+ id: external_exports.string().toLowerCase().uuid()
27587
+ });
27588
+ ISSUE_KEY_RE = /^[A-Z][A-Z0-9]{0,9}$/;
27589
+ timestamp = external_exports.string();
27590
+ nullableTimestamp = timestamp.nullable();
27591
+ issueSchema = external_exports.object({
27592
+ id: external_exports.string().uuid(),
27593
+ organization_id: external_exports.string().uuid(),
27594
+ number: external_exports.number().int(),
27595
+ identifier: external_exports.string(),
27596
+ title: external_exports.string(),
27597
+ description: external_exports.string(),
27598
+ status: issueStatusSchema,
27599
+ priority: issuePrioritySchema,
27600
+ parent_id: external_exports.string().uuid().nullable(),
27601
+ manager_id: external_exports.string().uuid().nullable(),
27602
+ creator: issueActorSchema,
27603
+ /** Fractional: to move an issue between two others, send the midpoint of their sort orders. */
27604
+ sort_order: external_exports.number(),
27605
+ created_at: timestamp,
27606
+ updated_at: timestamp,
27607
+ completed_at: nullableTimestamp,
27608
+ canceled_at: nullableTimestamp,
27609
+ archived_at: nullableTimestamp
27610
+ });
27611
+ issueSubscriberSchema = external_exports.object({
27612
+ issue_id: external_exports.string().uuid(),
27613
+ subscriber: issueActorSchema,
27614
+ role: issueSubscriberRoleSchema,
27615
+ created_at: timestamp
27616
+ });
27617
+ issueRelationSchema = external_exports.object({
27618
+ id: external_exports.string().uuid(),
27619
+ type: issueRelationTypeSchema,
27620
+ issue_id: external_exports.string().uuid(),
27621
+ related_issue_id: external_exports.string().uuid(),
27622
+ created_at: timestamp
27623
+ });
27624
+ issuePullRequestSchema = external_exports.object({
27625
+ id: external_exports.string().uuid(),
27626
+ issue_id: external_exports.string().uuid(),
27627
+ url: external_exports.string(),
27628
+ pull_request_id: external_exports.string().uuid().nullable(),
27629
+ title: external_exports.string().nullable(),
27630
+ state: issuePullRequestStateSchema,
27631
+ created_at: timestamp,
27632
+ updated_at: timestamp
27633
+ });
27634
+ issueCommentSchema = external_exports.object({
27635
+ id: external_exports.string().uuid(),
27636
+ issue_id: external_exports.string().uuid(),
27637
+ author: issueActorSchema,
27638
+ body: external_exports.string(),
27639
+ created_at: timestamp,
27640
+ updated_at: timestamp
27641
+ });
27642
+ change = (value) => external_exports.object({ from: value, to: value });
27643
+ nullableId = external_exports.string().uuid().nullable();
27644
+ ISSUE_EVENT_TYPES = [
27645
+ "created",
27646
+ "title_changed",
27647
+ "description_changed",
27648
+ "status_changed",
27649
+ "priority_changed",
27650
+ "parent_changed",
27651
+ "manager_changed",
27652
+ "sort_order_changed",
27653
+ "assignee_added",
27654
+ "assignee_removed",
27655
+ "subscriber_added",
27656
+ "subscriber_removed",
27657
+ "relation_added",
27658
+ "relation_removed",
27659
+ "pr_linked",
27660
+ "pr_unlinked",
27661
+ "pr_state_changed",
27662
+ "comment_added",
27663
+ "comment_edited",
27664
+ "comment_deleted",
27665
+ "archived",
27666
+ "restored"
27667
+ ];
27668
+ issueEventDataSchemas = {
27669
+ created: external_exports.object({ issue: issueSchema }),
27670
+ title_changed: change(external_exports.string()),
27671
+ description_changed: change(external_exports.string()),
27672
+ status_changed: change(issueStatusSchema).extend({ completed_at: nullableTimestamp, canceled_at: nullableTimestamp }),
27673
+ priority_changed: change(issuePrioritySchema),
27674
+ parent_changed: change(nullableId),
27675
+ manager_changed: change(nullableId),
27676
+ sort_order_changed: change(external_exports.number()),
27677
+ /** `subscriber` is the row after the change: an unassigned principal stays subscribed with role `manual`. */
27678
+ assignee_added: external_exports.object({ subscriber: issueSubscriberSchema }),
27679
+ assignee_removed: external_exports.object({ subscriber: issueSubscriberSchema }),
27680
+ subscriber_added: external_exports.object({ subscriber: issueSubscriberSchema }),
27681
+ subscriber_removed: external_exports.object({ subscriber: issueSubscriberSchema }),
27682
+ relation_added: external_exports.object({ relation: issueRelationSchema }),
27683
+ relation_removed: external_exports.object({ relation: issueRelationSchema }),
27684
+ pr_linked: external_exports.object({ pull_request: issuePullRequestSchema }),
27685
+ pr_unlinked: external_exports.object({ pull_request: issuePullRequestSchema }),
27686
+ pr_state_changed: external_exports.object({ pull_request: issuePullRequestSchema, from: issuePullRequestStateSchema }),
27687
+ comment_added: external_exports.object({ comment: issueCommentSchema }),
27688
+ comment_edited: external_exports.object({ comment: issueCommentSchema, from: external_exports.string() }),
27689
+ comment_deleted: external_exports.object({ comment: issueCommentSchema }),
27690
+ archived: external_exports.object({ archived_at: timestamp }),
27691
+ restored: external_exports.object({
27692
+ issue: issueSchema,
27693
+ subscribers: external_exports.array(issueSubscriberSchema),
27694
+ relations: external_exports.array(issueRelationSchema),
27695
+ pull_requests: external_exports.array(issuePullRequestSchema)
27696
+ })
27697
+ };
27698
+ issueEventBase = external_exports.object({
27699
+ sync_id: external_exports.number().int(),
27700
+ issue_id: external_exports.string().uuid(),
27701
+ actor: issueActorSchema,
27702
+ /** Echo of the `client_mutation_id` sent with the write, so the writer can settle its optimistic change. */
27703
+ client_mutation_id: external_exports.string().nullable(),
27704
+ created_at: timestamp
27705
+ });
27706
+ issueEventVariant = (type) => issueEventBase.extend({ type: external_exports.literal(type), data: issueEventDataSchemas[type] });
27707
+ issueEventSchema = external_exports.discriminatedUnion("type", [issueEventVariant(ISSUE_EVENT_TYPES[0]), ...ISSUE_EVENT_TYPES.slice(1).map(issueEventVariant)]);
27708
+ clientMutationId = external_exports.string().min(1).max(128).optional();
27709
+ title2 = external_exports.string().trim().min(1).max(500);
27710
+ description = external_exports.string().max(1e5);
27711
+ body = external_exports.string().trim().min(1).max(1e5);
27712
+ createIssueRequestSchema = external_exports.object({
27713
+ /** Client-generated id, so an optimistic create can be referenced before the server answers. */
27714
+ id: external_exports.string().uuid().optional(),
27715
+ title: title2,
27716
+ description: description.optional(),
27717
+ status: issueStatusSchema.optional(),
27718
+ priority: issuePrioritySchema.optional(),
27719
+ parent_id: external_exports.string().uuid().optional(),
27720
+ manager_id: external_exports.string().uuid().optional(),
27721
+ sort_order: external_exports.number().finite().optional(),
27722
+ assignees: external_exports.array(issueActorSchema).max(20).optional(),
27723
+ subscribers: external_exports.array(issueActorSchema).max(50).optional(),
27724
+ client_mutation_id: clientMutationId
27725
+ });
27726
+ updateIssueRequestSchema = external_exports.object({
27727
+ title: title2.optional(),
27728
+ description: description.optional(),
27729
+ status: issueStatusSchema.optional(),
27730
+ priority: issuePrioritySchema.optional(),
27731
+ // PATCH semantics: null clears the parent or Manager, omitting it leaves it unchanged.
27732
+ parent_id: nullableId.optional(),
27733
+ manager_id: nullableId.optional(),
27734
+ sort_order: external_exports.number().finite().optional(),
27735
+ client_mutation_id: clientMutationId
27736
+ });
27737
+ issueActorRequestSchema = issueActorSchema.partial().extend({ client_mutation_id: clientMutationId });
27738
+ createIssueCommentRequestSchema = external_exports.object({
27739
+ id: external_exports.string().uuid().optional(),
27740
+ body,
27741
+ client_mutation_id: clientMutationId
27742
+ });
27743
+ updateIssueCommentRequestSchema = external_exports.object({ body, client_mutation_id: clientMutationId });
27744
+ createIssueRelationRequestSchema = external_exports.object({
27745
+ id: external_exports.string().uuid().optional(),
27746
+ type: issueRelationTypeSchema,
27747
+ related_issue: external_exports.string().min(1),
27748
+ client_mutation_id: clientMutationId
27749
+ });
27750
+ linkIssuePullRequestRequestSchema = external_exports.object({
27751
+ id: external_exports.string().uuid().optional(),
27752
+ url: external_exports.string().url().max(2e3),
27753
+ title: external_exports.string().max(500).optional(),
27754
+ state: issuePullRequestStateSchema.optional(),
27755
+ pull_request_id: external_exports.string().uuid().optional(),
27756
+ client_mutation_id: clientMutationId
27757
+ });
27758
+ updateIssuePullRequestRequestSchema = external_exports.object({
27759
+ state: issuePullRequestStateSchema,
27760
+ client_mutation_id: clientMutationId
27761
+ });
27762
+ issueMutationRequestSchema = external_exports.object({ client_mutation_id: clientMutationId });
27763
+ updateIssueSettingsRequestSchema = external_exports.object({ issue_key: external_exports.string().trim().toUpperCase().regex(ISSUE_KEY_RE) });
27764
+ listIssuesQuerySchema = external_exports.object({
27765
+ status: external_exports.string().optional(),
27766
+ priority: external_exports.string().optional(),
27767
+ assignee: external_exports.string().optional(),
27768
+ subscriber: external_exports.string().optional(),
27769
+ creator: external_exports.string().optional(),
27770
+ manager_id: external_exports.string().optional(),
27771
+ parent_id: external_exports.string().optional(),
27772
+ q: external_exports.string().max(200).optional(),
27773
+ include_archived: external_exports.enum(["true", "false"]).optional(),
27774
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
27775
+ cursor: external_exports.coerce.number().int().min(0).max(2147483647).optional()
27776
+ });
27777
+ issueDetailResponseSchema = external_exports.object({
27778
+ issue: issueSchema,
27779
+ subscribers: external_exports.array(issueSubscriberSchema),
27780
+ relations: external_exports.array(issueRelationSchema),
27781
+ pull_requests: external_exports.array(issuePullRequestSchema),
27782
+ comments: external_exports.array(issueCommentSchema),
27783
+ events: external_exports.array(issueEventSchema),
27784
+ sub_issues: external_exports.array(issueSchema)
27785
+ });
27786
+ listIssuesResponseSchema = external_exports.object({ issues: external_exports.array(issueSchema), next_cursor: external_exports.number().nullable() });
27787
+ issuesDeltaQuerySchema = external_exports.object({
27788
+ after: external_exports.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
27789
+ limit: external_exports.coerce.number().int().min(1).max(1e3).optional()
27790
+ });
27791
+ issueInboxQuerySchema = external_exports.object({
27792
+ limit: external_exports.coerce.number().int().min(1).max(100).optional(),
27793
+ before: external_exports.coerce.number().int().min(1).optional()
27794
+ });
27795
+ markIssueInboxReadRequestSchema = external_exports.object({ sync_id: external_exports.number().int().min(0).optional() });
27796
+ }
27797
+ });
27798
+
27799
+ // ../shared/src/issue-events.ts
27800
+ function parseChange(line, excerpt) {
27801
+ const match = line.match(CHANGE_LINE);
27802
+ const rest = (match ? match[3] + match[4] : line).replaceAll(" (agent)", "").replace(/(?:\. Now)?:$/, "");
27803
+ const [, field2, from, to] = rest.match(TRANSITION) ?? [];
27804
+ const transition = transitionSchema.safeParse({ field: field2, from, to }).data;
27805
+ const labels = !transition ? [] : transition.field === "status" ? [ISSUE_STATUS_LABELS[transition.from], ISSUE_STATUS_LABELS[transition.to]] : [ISSUE_PRIORITY_LABELS[transition.from], ISSUE_PRIORITY_LABELS[transition.to]];
27806
+ const text4 = transition ? `changed the ${transition.field}: ${labels.join(" \u2192 ")}` : rest;
27807
+ return { actor: match?.[1] ?? "", agent: Boolean(match?.[2]), text: excerpt ? `${text4}: ${excerpt}` : text4, ...transition ? { transition } : {} };
27808
+ }
27809
+ function extractIssueEvents(text4) {
27810
+ return [...text4.matchAll(tagBlockPattern(ISSUE_EVENT_TAG))].flatMap((match) => {
27811
+ const attributes = parseTagAttributes(match[1]);
27812
+ if (!attributes.issue) return [];
27813
+ const detail = match[2].replaceAll(`<\\/${ISSUE_EVENT_TAG}`, `</${ISSUE_EVENT_TAG}`).trim();
27814
+ const changes = detail.split("\n\n").flatMap((paragraph) => {
27815
+ const [line, ...quoted] = paragraph.split("\n");
27816
+ if (!line.trim() || line.startsWith(">")) return [];
27817
+ return [parseChange(line, line.endsWith(". Now:") ? void 0 : quoted.map((quote) => quote.replace(/^>\s?/, "").trim()).find(Boolean))];
27818
+ });
27819
+ return [{
27820
+ id: `${attributes.issue}:${attributes.sync_id ?? ""}`,
27821
+ at: "",
27822
+ kind: "issue",
27823
+ agentId: attributes.issue,
27824
+ agentName: attributes.issue,
27825
+ summary: changes.map(issueChangeSentence).join(" \xB7 "),
27826
+ ...detail ? { detail } : {},
27827
+ issue: { title: attributes.title ?? "", url: attributes.url ?? "", changes }
27828
+ }];
27829
+ });
27830
+ }
27831
+ var ISSUE_EVENT_TAG, transitionSchema, issueEventChangeSchema, CHANGE_LINE, TRANSITION, issueChangeSentence;
27832
+ var init_issue_events = __esm({
27833
+ "../shared/src/issue-events.ts"() {
27834
+ "use strict";
27835
+ init_zod();
27836
+ init_issues2();
27837
+ init_tag_blocks();
27838
+ ISSUE_EVENT_TAG = "issue_event";
27839
+ transitionSchema = external_exports.discriminatedUnion("field", [
27840
+ external_exports.object({ field: external_exports.literal("status"), from: issueStatusSchema, to: issueStatusSchema }),
27841
+ external_exports.object({ field: external_exports.literal("priority"), from: issuePrioritySchema, to: issuePrioritySchema })
27842
+ ]);
27843
+ issueEventChangeSchema = external_exports.object({ actor: external_exports.string(), agent: external_exports.boolean(), text: external_exports.string(), transition: transitionSchema.optional() });
27844
+ CHANGE_LINE = /^(.+?)( \(agent\))? (created it|renamed it|edited |changed the |made it|moved it|removed |assigned |unassigned |marked |linked |unlinked |pull request |commented|deleted a comment|archived it|restored it)(.*)$/;
27845
+ TRANSITION = /^changed the (status|priority): (\w+) → (\w+)$/;
27846
+ issueChangeSentence = (change2) => [change2.actor, change2.text].filter(Boolean).join(" ");
27847
+ }
27848
+ });
27849
+
27552
27850
  // ../shared/src/manager-events.ts
27553
27851
  function extractManagerEvents(text4) {
27554
27852
  return [...text4.matchAll(BLOCK)].flatMap((match) => {
27555
- const attributes = Object.fromEntries([...match[1].matchAll(ATTRIBUTE)].map(([, key, value]) => [key, unescapeAttribute(value)]));
27853
+ const attributes = parseTagAttributes(match[1]);
27556
27854
  if (!attributes.kind || !attributes.id || !attributes.agent_id) return [];
27557
27855
  const kind = MANAGER_EVENT_KINDS.find((candidate) => candidate === attributes.kind) ?? UNKNOWN_EVENT_KIND;
27558
27856
  const [summary, ...rest] = match[2].replaceAll(`<\\/${TAG}`, `</${TAG}`).split("\n\n");
@@ -27572,13 +27870,13 @@ function extractManagerEvents(text4) {
27572
27870
  });
27573
27871
  }
27574
27872
  function parseManagerEvents(text4) {
27575
- const events = extractManagerEvents(text4);
27576
- return events.length > 0 && text4.replace(BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
27873
+ const events = [...extractManagerEvents(text4), ...extractIssueEvents(text4)];
27874
+ return events.length > 0 && text4.replace(BLOCK, "").replace(ISSUE_BLOCK, "").replaceAll(MERGED_MESSAGE_SEPARATOR.trim(), "").trim() === "" ? events : null;
27577
27875
  }
27578
27876
  function stripManagerEventNotes(content) {
27579
- return stripInstructionBlocksOutside(content, [...content.matchAll(BLOCK)].map((block) => [block.index, block.index + block[0].length]));
27877
+ return stripInstructionBlocksOutside(content, [...content.matchAll(BLOCK), ...content.matchAll(ISSUE_BLOCK)].map((block) => [block.index, block.index + block[0].length]));
27580
27878
  }
27581
- var MANAGER_EVENT_KINDS, UNKNOWN_EVENT_KIND, MANAGER_EVENT_TYPE, managerEventSchema, TAG, BLOCK, ATTRIBUTE, unescapeAttribute;
27879
+ var MANAGER_EVENT_KINDS, UNKNOWN_EVENT_KIND, MANAGER_EVENT_TYPE, managerEventSchema, TAG, BLOCK, ISSUE_BLOCK;
27582
27880
  var init_manager_events = __esm({
27583
27881
  "../shared/src/manager-events.ts"() {
27584
27882
  "use strict";
@@ -27587,13 +27885,15 @@ var init_manager_events = __esm({
27587
27885
  init_prompts();
27588
27886
  init_message_origin();
27589
27887
  init_urls();
27888
+ init_tag_blocks();
27889
+ init_issue_events();
27590
27890
  MANAGER_EVENT_KINDS = ["finished", "ready", "needs_attention", "approved", "merged", "closed", "archived", "replied"];
27591
27891
  UNKNOWN_EVENT_KIND = "update";
27592
27892
  MANAGER_EVENT_TYPE = "multitask-event";
27593
27893
  managerEventSchema = external_exports.object({
27594
27894
  id: external_exports.string(),
27595
27895
  at: external_exports.string(),
27596
- kind: external_exports.enum([...MANAGER_EVENT_KINDS, UNKNOWN_EVENT_KIND]),
27896
+ kind: external_exports.enum([...MANAGER_EVENT_KINDS, UNKNOWN_EVENT_KIND, "issue"]),
27597
27897
  agentId: external_exports.string(),
27598
27898
  agentName: external_exports.string(),
27599
27899
  summary: external_exports.string(),
@@ -27601,13 +27901,13 @@ var init_manager_events = __esm({
27601
27901
  // Set when the subagent is a chat in this workspace rather than a ship; agentId is then that chat's id.
27602
27902
  chatId: external_exports.string().optional(),
27603
27903
  ticket: external_exports.object({ id: external_exports.string(), title: external_exports.string() }).optional(),
27904
+ issue: external_exports.object({ title: external_exports.string(), url: external_exports.string(), changes: external_exports.array(issueEventChangeSchema) }).optional(),
27604
27905
  // Set on events recorded before every kind woke the orchestrator, which were shown as a row when they happened.
27605
27906
  noticed: external_exports.boolean().optional()
27606
27907
  });
27607
- TAG = "multitask_event";
27608
- BLOCK = new RegExp(`<${TAG}((?:\\s+\\w+="[^"]*")*)>\\n?([\\s\\S]*?)\\n?</${TAG}>`, "g");
27609
- ATTRIBUTE = /(\w+)="([^"]*)"/g;
27610
- unescapeAttribute = (value) => value.replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
27908
+ TAG = MULTITASK_EVENT_TAG;
27909
+ BLOCK = tagBlockPattern(TAG);
27910
+ ISSUE_BLOCK = tagBlockPattern(ISSUE_EVENT_TAG);
27611
27911
  }
27612
27912
  });
27613
27913
 
@@ -35708,7 +36008,7 @@ var init_workspace_target = __esm({
35708
36008
  });
35709
36009
 
35710
36010
  // ../shared/src/manager-board.ts
35711
- var MANAGER_TICKET_LIMITS, L, tooLong, text3, clearable, httpsUrl, inlineMarkdown, markdown, linearIdentifier, mediaSchema, questionSchema, managerTicketTitleSchema, managerTicketTaskSchema, managerTicketMediaSchema, managerTicketQuestionsSchema, issueSchema, fixSchema, updateManagerTicketRequestSchema, updateManagerBoardRequestSchema, answerManagerTicketRequestSchema, managerTicketAnswerRefSchema, replyOnManagerTicketRequestSchema, managerTicketReplyRefSchema, managerTicketThreadSchema, LINEAR_ISSUE_SUMMARIES_MAX, linearIssueSummariesRequestSchema;
36011
+ var MANAGER_TICKET_LIMITS, L, tooLong, text3, clearable, httpsUrl, inlineMarkdown, markdown, linearIdentifier, mediaSchema, questionSchema, managerTicketTitleSchema, managerTicketTaskSchema, managerTicketMediaSchema, managerTicketQuestionsSchema, issueSchema2, fixSchema, updateManagerTicketRequestSchema, updateManagerBoardRequestSchema, answerManagerTicketRequestSchema, managerTicketAnswerRefSchema, replyOnManagerTicketRequestSchema, managerTicketReplyRefSchema, managerTicketThreadSchema, LINEAR_ISSUE_SUMMARIES_MAX, linearIssueSummariesRequestSchema;
35712
36012
  var init_manager_board = __esm({
35713
36013
  "../shared/src/manager-board.ts"() {
35714
36014
  "use strict";
@@ -35755,11 +36055,11 @@ var init_manager_board = __esm({
35755
36055
  managerTicketTaskSchema = text3(L.task);
35756
36056
  managerTicketMediaSchema = external_exports.array(mediaSchema);
35757
36057
  managerTicketQuestionsSchema = external_exports.array(questionSchema.extend({ id: external_exports.string() }));
35758
- issueSchema = clearable(text3(L.issue)).describe(`What was wrong or what was asked, in a few plain sentences a busy reader understands: the problem, not the fix. Carry the evidence: Slack and Linear threads as links, customer quotes in quotation marks, and screenshots in \`media\`. ${markdown} At most ${L.issue} characters.`);
36058
+ issueSchema2 = clearable(text3(L.issue)).describe(`What was wrong or what was asked, in a few plain sentences a busy reader understands: the problem, not the fix. Carry the evidence: Slack and Linear threads as links, customer quotes in quotation marks, and screenshots in \`media\`. ${markdown} At most ${L.issue} characters.`);
35759
36059
  fixSchema = clearable(text3(L.fix)).describe(`What was done or is being done about it, with pull requests as #number. Keep it current as the work goes on, and say how it ended once the pull requests land. ${markdown} At most ${L.fix} characters.`);
35760
36060
  updateManagerTicketRequestSchema = external_exports.object({
35761
36061
  title: managerTicketTitleSchema.optional(),
35762
- issue: issueSchema,
36062
+ issue: issueSchema2,
35763
36063
  fix: fixSchema,
35764
36064
  media: external_exports.array(mediaSchema).max(L.media).optional().describe(`Screenshots and recordings that show the result, uploaded with \`replicas media upload\`, at most ${L.media}. Replaces the ticket's media.`),
35765
36065
  questions: external_exports.array(questionSchema).max(L.questions).optional().describe(`Questions only the user can answer, at most ${L.questions}. Replaces the open ones; pass [] once they are answered. Their answer comes back to you in this chat.`),
@@ -35770,7 +36070,7 @@ var init_manager_board = __esm({
35770
36070
  tickets: external_exports.array(external_exports.object({
35771
36071
  id: external_exports.uuid(),
35772
36072
  title: managerTicketTitleSchema.optional(),
35773
- issue: issueSchema,
36073
+ issue: issueSchema2,
35774
36074
  fix: fixSchema,
35775
36075
  pull_requests: external_exports.array(httpsUrl).max(20).optional().describe("Pull request URLs that came out of this ticket's task. They move here from any other ticket. Each pull request is filed under the ticket its ship was working on when it opened it, so pass this only to correct that."),
35776
36076
  note: clearable(text3(L.note)).describe(`Your one short comment on the ticket, shown under its row, replacing the last. ${inlineMarkdown}. "" removes it. At most ${L.note} characters.`),
@@ -39392,7 +39692,19 @@ var init_keyboard_shortcuts = __esm({
39392
39692
  copyPullRequestGitHubLink: { label: "Copy GitHub link", group: "Review", prefix: "c", keys: { key: "g" } },
39393
39693
  copyPullRequest: { label: "Copy PR", group: "Review", prefix: "c", keys: { key: "p" } },
39394
39694
  openReviewChat: { label: "Start chat", group: "Review", keys: { key: ";", mod: true } },
39395
- mergePullRequest: { label: "Merge", group: "Review", keys: { key: "m" } }
39695
+ mergePullRequest: { label: "Merge", group: "Review", keys: { key: "m" } },
39696
+ createIssue: { label: "Create issue", group: "Issues", keys: { key: "c" } },
39697
+ setIssueStatus: { label: "Change status", group: "Issues", keys: { key: "s" } },
39698
+ setIssuePriority: { label: "Change priority", group: "Issues", keys: { key: "p" } },
39699
+ setIssueAssignees: { label: "Assign", group: "Issues", keys: { key: "a" } },
39700
+ nextIssue: { label: "Next issue", group: "Issues", keys: { key: "j" } },
39701
+ previousIssue: { label: "Previous issue", group: "Issues", keys: { key: "k" } },
39702
+ openIssue: { label: "Open issue", group: "Issues", keys: { key: "Enter" } },
39703
+ peekIssue: { label: "Peek issue", group: "Issues", keys: { key: " " } },
39704
+ selectIssue: { label: "Select issue", group: "Issues", keys: { key: "x" } },
39705
+ toggleIssueLayout: { label: "Switch list / board", group: "Issues", keys: { key: "b", mod: true, shift: true } },
39706
+ copyIssueIdentifier: { label: "Copy issue ID", group: "Issues", keys: { key: ".", mod: true } },
39707
+ copyIssueLink: { label: "Copy issue link", group: "Issues", keys: { key: ",", mod: true, shift: true } }
39396
39708
  };
39397
39709
  COMPOSER_SEND_SHORTCUTS = {
39398
39710
  enter: { send: KEYBOARD_SHORTCUTS.send, sendAlternate: KEYBOARD_SHORTCUTS.sendAlternate, newLine: KEYBOARD_SHORTCUTS.newLine },
@@ -39827,7 +40139,7 @@ var CLI_VERSION;
39827
40139
  var init_cli_version = __esm({
39828
40140
  "../shared/src/cli-version.ts"() {
39829
40141
  "use strict";
39830
- CLI_VERSION = "0.3.505";
40142
+ CLI_VERSION = "0.3.506";
39831
40143
  }
39832
40144
  });
39833
40145
 
@@ -50397,238 +50709,6 @@ var init_feature_flags = __esm({
50397
50709
  }
50398
50710
  });
50399
50711
 
50400
- // ../shared/src/routes/issues.ts
50401
- var ISSUE_STATUSES, ISSUE_PRIORITIES, ISSUE_ACTOR_TYPES, ISSUE_SUBSCRIBER_ROLES, ISSUE_RELATION_TYPES, ISSUE_PULL_REQUEST_STATES, issueStatusSchema, issuePrioritySchema, issueSubscriberRoleSchema, issueRelationTypeSchema, issuePullRequestStateSchema, issueActorSchema, ISSUE_KEY_RE, timestamp, nullableTimestamp, issueSchema2, issueSubscriberSchema, issueRelationSchema, issuePullRequestSchema, issueCommentSchema, change, nullableId, ISSUE_EVENT_TYPES, issueEventDataSchemas, issueEventBase, issueEventVariant, issueEventSchema, clientMutationId, title2, description, body, createIssueRequestSchema, updateIssueRequestSchema, issueActorRequestSchema, createIssueCommentRequestSchema, updateIssueCommentRequestSchema, createIssueRelationRequestSchema, linkIssuePullRequestRequestSchema, updateIssuePullRequestRequestSchema, issueMutationRequestSchema, updateIssueSettingsRequestSchema, listIssuesQuerySchema, issueDetailResponseSchema, listIssuesResponseSchema, issuesDeltaQuerySchema, issueInboxQuerySchema, markIssueInboxReadRequestSchema;
50402
- var init_issues2 = __esm({
50403
- "../shared/src/routes/issues.ts"() {
50404
- "use strict";
50405
- init_zod();
50406
- ISSUE_STATUSES = ["backlog", "todo", "in_progress", "in_review", "done", "canceled", "duplicate"];
50407
- ISSUE_PRIORITIES = ["none", "urgent", "high", "medium", "low"];
50408
- ISSUE_ACTOR_TYPES = ["user", "workspace"];
50409
- ISSUE_SUBSCRIBER_ROLES = ["assignee", "creator", "mentioned", "manual"];
50410
- ISSUE_RELATION_TYPES = ["blocks", "duplicate_of"];
50411
- ISSUE_PULL_REQUEST_STATES = ["draft", "open", "merged", "closed"];
50412
- issueStatusSchema = external_exports.enum(ISSUE_STATUSES);
50413
- issuePrioritySchema = external_exports.enum(ISSUE_PRIORITIES);
50414
- issueSubscriberRoleSchema = external_exports.enum(ISSUE_SUBSCRIBER_ROLES);
50415
- issueRelationTypeSchema = external_exports.enum(ISSUE_RELATION_TYPES);
50416
- issuePullRequestStateSchema = external_exports.enum(ISSUE_PULL_REQUEST_STATES);
50417
- issueActorSchema = external_exports.object({
50418
- type: external_exports.enum(ISSUE_ACTOR_TYPES),
50419
- id: external_exports.string().toLowerCase().uuid()
50420
- });
50421
- ISSUE_KEY_RE = /^[A-Z][A-Z0-9]{0,9}$/;
50422
- timestamp = external_exports.string();
50423
- nullableTimestamp = timestamp.nullable();
50424
- issueSchema2 = external_exports.object({
50425
- id: external_exports.string().uuid(),
50426
- organization_id: external_exports.string().uuid(),
50427
- number: external_exports.number().int(),
50428
- identifier: external_exports.string(),
50429
- title: external_exports.string(),
50430
- description: external_exports.string(),
50431
- status: issueStatusSchema,
50432
- priority: issuePrioritySchema,
50433
- parent_id: external_exports.string().uuid().nullable(),
50434
- manager_id: external_exports.string().uuid().nullable(),
50435
- creator: issueActorSchema,
50436
- /** Fractional: to move an issue between two others, send the midpoint of their sort orders. */
50437
- sort_order: external_exports.number(),
50438
- created_at: timestamp,
50439
- updated_at: timestamp,
50440
- completed_at: nullableTimestamp,
50441
- canceled_at: nullableTimestamp,
50442
- archived_at: nullableTimestamp
50443
- });
50444
- issueSubscriberSchema = external_exports.object({
50445
- issue_id: external_exports.string().uuid(),
50446
- subscriber: issueActorSchema,
50447
- role: issueSubscriberRoleSchema,
50448
- created_at: timestamp
50449
- });
50450
- issueRelationSchema = external_exports.object({
50451
- id: external_exports.string().uuid(),
50452
- type: issueRelationTypeSchema,
50453
- issue_id: external_exports.string().uuid(),
50454
- related_issue_id: external_exports.string().uuid(),
50455
- created_at: timestamp
50456
- });
50457
- issuePullRequestSchema = external_exports.object({
50458
- id: external_exports.string().uuid(),
50459
- issue_id: external_exports.string().uuid(),
50460
- url: external_exports.string(),
50461
- pull_request_id: external_exports.string().uuid().nullable(),
50462
- title: external_exports.string().nullable(),
50463
- state: issuePullRequestStateSchema,
50464
- created_at: timestamp,
50465
- updated_at: timestamp
50466
- });
50467
- issueCommentSchema = external_exports.object({
50468
- id: external_exports.string().uuid(),
50469
- issue_id: external_exports.string().uuid(),
50470
- author: issueActorSchema,
50471
- body: external_exports.string(),
50472
- created_at: timestamp,
50473
- updated_at: timestamp
50474
- });
50475
- change = (value) => external_exports.object({ from: value, to: value });
50476
- nullableId = external_exports.string().uuid().nullable();
50477
- ISSUE_EVENT_TYPES = [
50478
- "created",
50479
- "title_changed",
50480
- "description_changed",
50481
- "status_changed",
50482
- "priority_changed",
50483
- "parent_changed",
50484
- "manager_changed",
50485
- "sort_order_changed",
50486
- "assignee_added",
50487
- "assignee_removed",
50488
- "subscriber_added",
50489
- "subscriber_removed",
50490
- "relation_added",
50491
- "relation_removed",
50492
- "pr_linked",
50493
- "pr_unlinked",
50494
- "pr_state_changed",
50495
- "comment_added",
50496
- "comment_edited",
50497
- "comment_deleted",
50498
- "archived",
50499
- "restored"
50500
- ];
50501
- issueEventDataSchemas = {
50502
- created: external_exports.object({ issue: issueSchema2 }),
50503
- title_changed: change(external_exports.string()),
50504
- description_changed: change(external_exports.string()),
50505
- status_changed: change(issueStatusSchema).extend({ completed_at: nullableTimestamp, canceled_at: nullableTimestamp }),
50506
- priority_changed: change(issuePrioritySchema),
50507
- parent_changed: change(nullableId),
50508
- manager_changed: change(nullableId),
50509
- sort_order_changed: change(external_exports.number()),
50510
- /** `subscriber` is the row after the change: an unassigned principal stays subscribed with role `manual`. */
50511
- assignee_added: external_exports.object({ subscriber: issueSubscriberSchema }),
50512
- assignee_removed: external_exports.object({ subscriber: issueSubscriberSchema }),
50513
- subscriber_added: external_exports.object({ subscriber: issueSubscriberSchema }),
50514
- subscriber_removed: external_exports.object({ subscriber: issueSubscriberSchema }),
50515
- relation_added: external_exports.object({ relation: issueRelationSchema }),
50516
- relation_removed: external_exports.object({ relation: issueRelationSchema }),
50517
- pr_linked: external_exports.object({ pull_request: issuePullRequestSchema }),
50518
- pr_unlinked: external_exports.object({ pull_request: issuePullRequestSchema }),
50519
- pr_state_changed: external_exports.object({ pull_request: issuePullRequestSchema, from: issuePullRequestStateSchema }),
50520
- comment_added: external_exports.object({ comment: issueCommentSchema }),
50521
- comment_edited: external_exports.object({ comment: issueCommentSchema, from: external_exports.string() }),
50522
- comment_deleted: external_exports.object({ comment: issueCommentSchema }),
50523
- archived: external_exports.object({ archived_at: timestamp }),
50524
- restored: external_exports.object({
50525
- issue: issueSchema2,
50526
- subscribers: external_exports.array(issueSubscriberSchema),
50527
- relations: external_exports.array(issueRelationSchema),
50528
- pull_requests: external_exports.array(issuePullRequestSchema)
50529
- })
50530
- };
50531
- issueEventBase = external_exports.object({
50532
- sync_id: external_exports.number().int(),
50533
- issue_id: external_exports.string().uuid(),
50534
- actor: issueActorSchema,
50535
- /** Echo of the `client_mutation_id` sent with the write, so the writer can settle its optimistic change. */
50536
- client_mutation_id: external_exports.string().nullable(),
50537
- created_at: timestamp
50538
- });
50539
- issueEventVariant = (type) => issueEventBase.extend({ type: external_exports.literal(type), data: issueEventDataSchemas[type] });
50540
- issueEventSchema = external_exports.discriminatedUnion("type", [issueEventVariant(ISSUE_EVENT_TYPES[0]), ...ISSUE_EVENT_TYPES.slice(1).map(issueEventVariant)]);
50541
- clientMutationId = external_exports.string().min(1).max(128).optional();
50542
- title2 = external_exports.string().trim().min(1).max(500);
50543
- description = external_exports.string().max(1e5);
50544
- body = external_exports.string().trim().min(1).max(1e5);
50545
- createIssueRequestSchema = external_exports.object({
50546
- /** Client-generated id, so an optimistic create can be referenced before the server answers. */
50547
- id: external_exports.string().uuid().optional(),
50548
- title: title2,
50549
- description: description.optional(),
50550
- status: issueStatusSchema.optional(),
50551
- priority: issuePrioritySchema.optional(),
50552
- parent_id: external_exports.string().uuid().optional(),
50553
- manager_id: external_exports.string().uuid().optional(),
50554
- sort_order: external_exports.number().finite().optional(),
50555
- assignees: external_exports.array(issueActorSchema).max(20).optional(),
50556
- subscribers: external_exports.array(issueActorSchema).max(50).optional(),
50557
- client_mutation_id: clientMutationId
50558
- });
50559
- updateIssueRequestSchema = external_exports.object({
50560
- title: title2.optional(),
50561
- description: description.optional(),
50562
- status: issueStatusSchema.optional(),
50563
- priority: issuePrioritySchema.optional(),
50564
- // PATCH semantics: null clears the parent or Manager, omitting it leaves it unchanged.
50565
- parent_id: nullableId.optional(),
50566
- manager_id: nullableId.optional(),
50567
- sort_order: external_exports.number().finite().optional(),
50568
- client_mutation_id: clientMutationId
50569
- });
50570
- issueActorRequestSchema = issueActorSchema.partial().extend({ client_mutation_id: clientMutationId });
50571
- createIssueCommentRequestSchema = external_exports.object({
50572
- id: external_exports.string().uuid().optional(),
50573
- body,
50574
- client_mutation_id: clientMutationId
50575
- });
50576
- updateIssueCommentRequestSchema = external_exports.object({ body, client_mutation_id: clientMutationId });
50577
- createIssueRelationRequestSchema = external_exports.object({
50578
- id: external_exports.string().uuid().optional(),
50579
- type: issueRelationTypeSchema,
50580
- related_issue: external_exports.string().min(1),
50581
- client_mutation_id: clientMutationId
50582
- });
50583
- linkIssuePullRequestRequestSchema = external_exports.object({
50584
- id: external_exports.string().uuid().optional(),
50585
- url: external_exports.string().url().max(2e3),
50586
- title: external_exports.string().max(500).optional(),
50587
- state: issuePullRequestStateSchema.optional(),
50588
- pull_request_id: external_exports.string().uuid().optional(),
50589
- client_mutation_id: clientMutationId
50590
- });
50591
- updateIssuePullRequestRequestSchema = external_exports.object({
50592
- state: issuePullRequestStateSchema,
50593
- client_mutation_id: clientMutationId
50594
- });
50595
- issueMutationRequestSchema = external_exports.object({ client_mutation_id: clientMutationId });
50596
- updateIssueSettingsRequestSchema = external_exports.object({ issue_key: external_exports.string().trim().toUpperCase().regex(ISSUE_KEY_RE) });
50597
- listIssuesQuerySchema = external_exports.object({
50598
- status: external_exports.string().optional(),
50599
- priority: external_exports.string().optional(),
50600
- assignee: external_exports.string().optional(),
50601
- subscriber: external_exports.string().optional(),
50602
- creator: external_exports.string().optional(),
50603
- manager_id: external_exports.string().optional(),
50604
- parent_id: external_exports.string().optional(),
50605
- q: external_exports.string().max(200).optional(),
50606
- include_archived: external_exports.enum(["true", "false"]).optional(),
50607
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
50608
- cursor: external_exports.coerce.number().int().min(0).max(2147483647).optional()
50609
- });
50610
- issueDetailResponseSchema = external_exports.object({
50611
- issue: issueSchema2,
50612
- subscribers: external_exports.array(issueSubscriberSchema),
50613
- relations: external_exports.array(issueRelationSchema),
50614
- pull_requests: external_exports.array(issuePullRequestSchema),
50615
- comments: external_exports.array(issueCommentSchema),
50616
- events: external_exports.array(issueEventSchema),
50617
- sub_issues: external_exports.array(issueSchema2)
50618
- });
50619
- listIssuesResponseSchema = external_exports.object({ issues: external_exports.array(issueSchema2), next_cursor: external_exports.number().nullable() });
50620
- issuesDeltaQuerySchema = external_exports.object({
50621
- after: external_exports.coerce.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
50622
- limit: external_exports.coerce.number().int().min(1).max(1e3).optional()
50623
- });
50624
- issueInboxQuerySchema = external_exports.object({
50625
- limit: external_exports.coerce.number().int().min(1).max(100).optional(),
50626
- before: external_exports.coerce.number().int().min(1).optional()
50627
- });
50628
- markIssueInboxReadRequestSchema = external_exports.object({ sync_id: external_exports.number().int().min(0).optional() });
50629
- }
50630
- });
50631
-
50632
50712
  // ../shared/src/routes/repo-files.ts
50633
50713
  var MAX_REPO_FILE_CONTENT_BYTES;
50634
50714
  var init_repo_files = __esm({
@@ -51055,6 +51135,8 @@ var init_src = __esm({
51055
51135
  init_slash_commands();
51056
51136
  init_keyboard_shortcuts();
51057
51137
  init_prompts();
51138
+ init_issue_events();
51139
+ init_tag_blocks();
51058
51140
  init_manager_events();
51059
51141
  init_message_origin();
51060
51142
  init_user_message_attachments();
@@ -56671,7 +56753,7 @@ var init_issue = __esm({
56671
56753
  result: external_exports.object({ content: external_exports.array(external_exports.object({ type: external_exports.string(), text: external_exports.string().optional() })).optional(), isError: external_exports.boolean().optional() }).optional(),
56672
56754
  error: external_exports.object({ message: external_exports.string() }).optional()
56673
56755
  });
56674
- mutationSchema = external_exports.object({ issue: issueSchema2 });
56756
+ mutationSchema = external_exports.object({ issue: issueSchema });
56675
56757
  csv = (value) => value?.split(",").map((entry) => entry.trim()).filter(Boolean).join(",");
56676
56758
  printMutation = ({ issue: issue3 }) => console.log(`${import_chalk29.default.green("\u2713")} ${import_chalk29.default.cyan(issue3.identifier)} ${issue3.title} (${issue3.status})`);
56677
56759
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.3.505",
3
+ "version": "0.3.506",
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": {