@mastra/factory 0.12.0-alpha.1 → 0.12.0-alpha.3

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 (68) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/factory.d.ts.map +1 -1
  3. package/dist/factory.js +24 -14
  4. package/dist/factory.js.map +1 -1
  5. package/dist/integrations/base.d.ts +9 -0
  6. package/dist/integrations/base.d.ts.map +1 -1
  7. package/dist/integrations/github/issue-reconciler.d.ts.map +1 -1
  8. package/dist/integrations/github/issue-reconciler.js +22 -14
  9. package/dist/integrations/github/issue-reconciler.js.map +1 -1
  10. package/dist/integrations/github/rules.d.ts +6 -0
  11. package/dist/integrations/github/rules.d.ts.map +1 -1
  12. package/dist/integrations/github/rules.js +58 -12
  13. package/dist/integrations/github/rules.js.map +1 -1
  14. package/dist/integrations/slack/feed-publisher.d.ts +26 -0
  15. package/dist/integrations/slack/feed-publisher.d.ts.map +1 -0
  16. package/dist/integrations/slack/feed-publisher.js +44 -0
  17. package/dist/integrations/slack/feed-publisher.js.map +1 -0
  18. package/dist/integrations/slack/integration.d.ts +2 -0
  19. package/dist/integrations/slack/integration.d.ts.map +1 -1
  20. package/dist/integrations/slack/integration.js +5 -0
  21. package/dist/integrations/slack/integration.js.map +1 -1
  22. package/dist/integrations/slack/slack.d.ts +13 -1
  23. package/dist/integrations/slack/slack.d.ts.map +1 -1
  24. package/dist/integrations/slack/slack.js +78 -6
  25. package/dist/integrations/slack/slack.js.map +1 -1
  26. package/dist/routes/surface.d.ts +5 -0
  27. package/dist/routes/surface.d.ts.map +1 -1
  28. package/dist/routes/surface.js +8 -4
  29. package/dist/routes/surface.js.map +1 -1
  30. package/dist/routes/work-items.d.ts.map +1 -1
  31. package/dist/routes/work-items.js +11 -1
  32. package/dist/routes/work-items.js.map +1 -1
  33. package/dist/rules/defaults.d.ts.map +1 -1
  34. package/dist/rules/defaults.js +20 -8
  35. package/dist/rules/defaults.js.map +1 -1
  36. package/dist/rules/dispatcher.d.ts.map +1 -1
  37. package/dist/rules/dispatcher.js +24 -10
  38. package/dist/rules/dispatcher.js.map +1 -1
  39. package/dist/rules/processor.d.ts.map +1 -1
  40. package/dist/rules/processor.js +2 -3
  41. package/dist/rules/processor.js.map +1 -1
  42. package/dist/rules/transition-service.d.ts +2 -2
  43. package/dist/rules/transition-service.d.ts.map +1 -1
  44. package/dist/rules/transition-service.js +33 -12
  45. package/dist/rules/transition-service.js.map +1 -1
  46. package/dist/rules/types.d.ts +27 -1
  47. package/dist/rules/types.d.ts.map +1 -1
  48. package/dist/rules/types.js +37 -1
  49. package/dist/rules/types.js.map +1 -1
  50. package/dist/rules/validation.d.ts.map +1 -1
  51. package/dist/rules/validation.js +3 -1
  52. package/dist/rules/validation.js.map +1 -1
  53. package/dist/storage/domains/comments/base.d.ts.map +1 -1
  54. package/dist/storage/domains/comments/base.js +2 -4
  55. package/dist/storage/domains/comments/base.js.map +1 -1
  56. package/dist/storage/domains/comments/domain.d.ts +9 -2
  57. package/dist/storage/domains/comments/domain.d.ts.map +1 -1
  58. package/dist/storage/domains/comments/domain.js +18 -15
  59. package/dist/storage/domains/comments/domain.js.map +1 -1
  60. package/dist/storage/domains/comments/feed-sync.d.ts +9 -26
  61. package/dist/storage/domains/comments/feed-sync.d.ts.map +1 -1
  62. package/dist/storage/domains/work-items/base.d.ts +23 -2
  63. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  64. package/dist/storage/domains/work-items/base.js +82 -50
  65. package/dist/storage/domains/work-items/base.js.map +1 -1
  66. package/factory-skills/factory-rereview/SKILL.md +13 -12
  67. package/factory-skills/factory-review/SKILL.md +12 -11
  68. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"domain.js","names":["#auth","#comments","#workItems","#projects","#channelIdentity","#members","#audit","#publishers","#pubsub","#rosterCache","#touchFeed","#mirrorComment","#cleanupMentionReceipts","#organizationRoster","#seenRoster"],"sources":["../../../../src/storage/domains/comments/domain.ts"],"sourcesContent":["/**\n * Comments domain — feed orchestration behind service methods; the HTTP layer\n * lives in `routes.ts` and only maps their result statuses. Service methods\n * take the author as a `FactoryActorRef` (never derived from the request\n * inside), so agent-authored comments later become a thin tool over\n * `createComment` instead of a re-implementation.\n */\n\nimport type { PubSub } from '@mastra/core/events';\nimport type { ApiRoute } from '@mastra/core/server';\n\nimport { touchFeed } from '../../../feed-events.js';\nimport type { RouteAuth } from '../../../routes/route.js';\nimport type { AuditEmitter } from '../audit/domain.js';\nimport type { ChannelIdentityStorage } from '../channel-identity/base.js';\nimport type { FactoryProjectsStorage } from '../projects/base.js';\nimport type { WorkItemRow, WorkItemsStorage } from '../work-items/base.js';\nimport { factoryMentionAttentionIdentity } from '../work-items/base.js';\nimport type { FactoryActorRef } from './actor.js';\nimport { isMentionableActorId } from './actor.js';\nimport type {\n EditWorkItemCommentResult,\n FactoryMentionRef,\n WorkItemCommentReplyRef,\n WorkItemCommentRow,\n WorkItemCommentsStorage,\n} from './base.js';\nimport { CommentTokenConflictError, commentBodyError, MAX_COMMENT_MENTIONS, MAX_COMMENT_QUOTE_LENGTH } from './base.js';\nimport type { WorkItemFeedPublisher } from './feed-sync.js';\nimport { buildCommentRoutes } from './routes.js';\n\nexport interface FactoryRosterMember {\n id: string;\n name?: string;\n avatarUrl?: string;\n}\n\nexport interface OrganizationMembersProvider {\n listOrganizationMembers(orgId: string): Promise<FactoryRosterMember[]>;\n}\n\nexport interface CommentsDomainOptions {\n auth: RouteAuth;\n comments: WorkItemCommentsStorage;\n workItems: WorkItemsStorage;\n projects: FactoryProjectsStorage;\n channelIdentity?: ChannelIdentityStorage;\n /** Host-wired org membership listing for the mention roster (e.g. WorkOS). */\n members?: OrganizationMembersProvider;\n audit?: AuditEmitter;\n /** Outbound platform mirrors (COR-1174); empty until a platform wires one. */\n publishers?: WorkItemFeedPublisher[];\n /** Carries feed touches to every replica's open SSE streams. */\n pubsub: PubSub;\n}\n\nexport interface CreateCommentServiceInput {\n orgId: string;\n workItemId: string;\n author: FactoryActorRef;\n body: string;\n replyTo?: { commentId: string; quote?: string };\n mentions?: FactoryMentionRef[];\n clientToken?: string;\n}\n\nexport type CreateCommentServiceResult =\n | { status: 'created'; comment: WorkItemCommentRow; workItem: WorkItemRow }\n | { status: 'work_item_not_found' }\n | { status: 'token_conflict' }\n | { status: 'invalid'; message: string };\n\nexport interface CommentEditor {\n userId: string;\n /** Lazily checked, only when the caller is not the author. */\n canModerate: () => Promise<boolean>;\n}\n\nexport interface EditCommentServiceInput {\n orgId: string;\n workItemId: string;\n commentId: string;\n editor: CommentEditor;\n body: string;\n mentions?: FactoryMentionRef[];\n expectedRevision?: number;\n}\n\nexport type EditCommentServiceResult =\n | ({ status: 'edited'; previousBody: string } & EditWorkItemCommentResult)\n | { status: 'not_found' }\n | { status: 'forbidden' }\n | { status: 'not_editable' }\n | { status: 'conflict' }\n | { status: 'invalid'; message: string };\n\nexport interface DeleteCommentServiceInput {\n orgId: string;\n workItemId: string;\n commentId: string;\n editor: CommentEditor;\n}\n\nexport type DeleteCommentServiceResult =\n | { status: 'deleted'; comment: WorkItemCommentRow }\n | { status: 'not_found' }\n | { status: 'forbidden' }\n | { status: 'not_editable' };\n\nconst MAX_ROSTER_SIZE = 100;\nconst ROSTER_CACHE_TTL_MS = 60_000;\n\nexport class CommentsDomain {\n readonly #auth: RouteAuth;\n readonly #comments: WorkItemCommentsStorage;\n readonly #workItems: WorkItemsStorage;\n readonly #projects: FactoryProjectsStorage;\n readonly #channelIdentity: ChannelIdentityStorage | undefined;\n readonly #members: OrganizationMembersProvider | undefined;\n readonly #audit: AuditEmitter | undefined;\n readonly #publishers: WorkItemFeedPublisher[];\n readonly #pubsub: PubSub;\n readonly #rosterCache = new Map<string, { at: number; members: FactoryRosterMember[] }>();\n\n constructor({\n auth,\n comments,\n workItems,\n projects,\n channelIdentity,\n members,\n audit,\n publishers,\n pubsub,\n }: CommentsDomainOptions) {\n this.#auth = auth;\n this.#comments = comments;\n this.#workItems = workItems;\n this.#projects = projects;\n this.#channelIdentity = channelIdentity;\n this.#members = members;\n this.#audit = audit;\n this.#publishers = publishers ?? [];\n this.#pubsub = pubsub;\n }\n\n /**\n * The one seam every feed mutation routes through — future\n * `WorkItemFeedIngest` impls included.\n */\n async #touchFeed(scope: { orgId: string; factoryProjectId: string; workItemId: string }): Promise<void> {\n await this.#comments.refreshWorkItemFeedActivity(scope);\n touchFeed(this.#pubsub, scope, scope.workItemId);\n }\n\n async createComment(input: CreateCommentServiceInput): Promise<CreateCommentServiceResult> {\n await this.#comments.ensureReady();\n await this.#workItems.ensureReady();\n\n const bodyError = commentBodyError(input.body);\n if (bodyError) return { status: 'invalid', message: bodyError };\n if ((input.mentions?.length ?? 0) > MAX_COMMENT_MENTIONS) {\n return { status: 'invalid', message: `At most ${MAX_COMMENT_MENTIONS} mentions per comment.` };\n }\n\n const workItem = await this.#workItems.get({ orgId: input.orgId, id: input.workItemId });\n if (!workItem) return { status: 'work_item_not_found' };\n\n let replyTo: WorkItemCommentReplyRef | undefined;\n if (input.replyTo) {\n const parent = await this.#comments.get({ orgId: input.orgId, commentId: input.replyTo.commentId });\n if (!parent || parent.workItemId !== input.workItemId) {\n return { status: 'invalid', message: 'Reply target is not a comment on this work item.' };\n }\n replyTo = {\n commentId: parent.id,\n ...(input.replyTo.quote ? { quote: input.replyTo.quote.slice(0, MAX_COMMENT_QUOTE_LENGTH) } : {}),\n authorId: parent.author.id,\n ...(parent.author.displayName ? { authorName: parent.author.displayName } : {}),\n };\n }\n\n let comment: WorkItemCommentRow;\n try {\n comment = await this.#comments.create({\n orgId: input.orgId,\n factoryProjectId: workItem.factoryProjectId,\n workItemId: input.workItemId,\n author: input.author,\n body: input.body,\n ...(replyTo ? { replyTo } : {}),\n ...(input.mentions ? { mentions: input.mentions } : {}),\n ...(input.clientToken ? { clientToken: input.clientToken } : {}),\n });\n } catch (error) {\n if (error instanceof CommentTokenConflictError) return { status: 'token_conflict' };\n throw error;\n }\n await this.#touchFeed({\n orgId: input.orgId,\n factoryProjectId: workItem.factoryProjectId,\n workItemId: input.workItemId,\n });\n await this.#mirrorComment(comment, workItem);\n return { status: 'created', comment, workItem };\n }\n\n /**\n * Best-effort: a failed publish never fails the create. The write-back is\n * the replay guard — a replayed create sees its own platform on the row and\n * skips it. Known ceiling, single publisher only: `external_source` is\n * single-valued, so with two publishers a replayed create re-publishes to\n * the one that is not recorded, and nothing persists a failed attempt for a\n * later pass to retry. Both need an outbox if a second publisher ever lands.\n */\n async #mirrorComment(comment: WorkItemCommentRow, workItem: WorkItemRow): Promise<void> {\n let current = comment;\n for (const publisher of this.#publishers) {\n if (current.externalSource?.integrationId === publisher.id) continue;\n try {\n const { source } = await publisher.publish(current, workItem);\n current =\n (await this.#comments.attachExternalSource({ orgId: current.orgId, commentId: current.id, source })) ??\n current;\n } catch (err) {\n console.warn('[Comments] Failed to mirror a comment to a platform', {\n publisherId: publisher.id,\n commentId: current.id,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n }\n\n async editComment(input: EditCommentServiceInput): Promise<EditCommentServiceResult> {\n await this.#comments.ensureReady();\n await this.#workItems.ensureReady();\n\n const bodyError = commentBodyError(input.body);\n if (bodyError) return { status: 'invalid', message: bodyError };\n if ((input.mentions?.length ?? 0) > MAX_COMMENT_MENTIONS) {\n return { status: 'invalid', message: `At most ${MAX_COMMENT_MENTIONS} mentions per comment.` };\n }\n\n const existing = await this.#comments.get({ orgId: input.orgId, commentId: input.commentId });\n if (!existing || existing.workItemId !== input.workItemId) return { status: 'not_found' };\n if (existing.deletedAt) return { status: 'not_editable' };\n if (existing.author.id !== input.editor.userId && !(await input.editor.canModerate())) {\n return { status: 'forbidden' };\n }\n\n const edited = await this.#comments.edit({\n orgId: input.orgId,\n commentId: input.commentId,\n body: input.body,\n editorId: input.editor.userId,\n ...(input.mentions ? { mentions: input.mentions } : {}),\n ...(input.expectedRevision !== undefined ? { expectedRevision: input.expectedRevision } : {}),\n });\n if (edited === 'conflict') return { status: 'conflict' };\n if (!edited) return { status: 'not_editable' };\n\n await this.#cleanupMentionReceipts(existing, edited.removedMentions);\n await this.#touchFeed({\n orgId: existing.orgId,\n factoryProjectId: existing.factoryProjectId,\n workItemId: existing.workItemId,\n });\n return { status: 'edited', previousBody: existing.body, ...edited };\n }\n\n async deleteComment(input: DeleteCommentServiceInput): Promise<DeleteCommentServiceResult> {\n await this.#comments.ensureReady();\n await this.#workItems.ensureReady();\n\n const existing = await this.#comments.get({ orgId: input.orgId, commentId: input.commentId });\n if (!existing || existing.workItemId !== input.workItemId) return { status: 'not_found' };\n if (existing.deletedAt) return { status: 'not_editable' };\n if (existing.author.id !== input.editor.userId && !(await input.editor.canModerate())) {\n return { status: 'forbidden' };\n }\n\n const deleted = await this.#comments.softDelete({\n orgId: input.orgId,\n commentId: input.commentId,\n deletedBy: input.editor.userId,\n });\n if (!deleted) return { status: 'not_editable' };\n\n await this.#workItems.deleteAttentionReceipts({\n orgId: existing.orgId,\n factoryProjectId: existing.factoryProjectId,\n identities: [factoryMentionAttentionIdentity(existing.id)],\n });\n await this.#touchFeed({\n orgId: existing.orgId,\n factoryProjectId: existing.factoryProjectId,\n workItemId: existing.workItemId,\n });\n return { status: 'deleted', comment: deleted };\n }\n\n /**\n * A removed mention deletes only that user's receipt: the receipt identity\n * is per-comment, and other still-mentioned users must keep their read state.\n */\n async #cleanupMentionReceipts(comment: WorkItemCommentRow, removed: FactoryMentionRef[]): Promise<void> {\n for (const mention of removed) {\n await this.#workItems.deleteAttentionReceipts({\n orgId: comment.orgId,\n factoryProjectId: comment.factoryProjectId,\n userId: mention.id,\n identities: [factoryMentionAttentionIdentity(comment.id)],\n });\n }\n }\n\n /**\n * Mentionable people: the host's org roster when it answers, otherwise the\n * people the project has actually seen (comment authors, linked channel\n * accounts). Cached per project so a dropdown session costs one read.\n */\n async mentionRoster({\n orgId,\n factoryProjectId,\n }: {\n orgId: string;\n factoryProjectId: string;\n }): Promise<FactoryRosterMember[]> {\n const cacheKey = `${orgId}\\0${factoryProjectId}`;\n const cached = this.#rosterCache.get(cacheKey);\n if (cached && Date.now() - cached.at < ROSTER_CACHE_TTL_MS) return cached.members;\n\n const members = await this.#organizationRoster(orgId);\n if (members.size === 0) await this.#seenRoster(orgId, factoryProjectId, members);\n\n const roster = [...members.values()].slice(0, MAX_ROSTER_SIZE);\n // Sweep on write: a long-lived server would otherwise hold one roster per\n // project it ever served.\n const cutoff = Date.now() - ROSTER_CACHE_TTL_MS;\n for (const [key, entry] of this.#rosterCache) {\n if (entry.at < cutoff) this.#rosterCache.delete(key);\n }\n this.#rosterCache.set(cacheKey, { at: Date.now(), members: roster });\n return roster;\n }\n\n /** Empty when no provider is wired, or when the host listing fails. */\n async #organizationRoster(orgId: string): Promise<Map<string, FactoryRosterMember>> {\n const members = new Map<string, FactoryRosterMember>();\n if (!this.#members) return members;\n try {\n for (const member of await this.#members.listOrganizationMembers(orgId)) {\n if (isMentionableActorId(member.id)) members.set(member.id, member);\n }\n } catch (err) {\n console.warn('[Comments] Failed to list organization members for the mention roster', {\n error: err instanceof Error ? err.message : String(err),\n });\n }\n return members;\n }\n\n async #seenRoster(orgId: string, factoryProjectId: string, members: Map<string, FactoryRosterMember>): Promise<void> {\n for (const author of await this.#comments.listRecentAuthors({ orgId, factoryProjectId })) {\n if (author.kind !== 'user' || !isMentionableActorId(author.id)) continue;\n members.set(author.id, {\n id: author.id,\n ...(author.displayName ? { name: author.displayName } : {}),\n ...(author.avatarUrl ? { avatarUrl: author.avatarUrl } : {}),\n });\n }\n if (!this.#channelIdentity) return;\n await this.#channelIdentity.ensureReady();\n for (const link of await this.#channelIdentity.listAccountLinksForOrg(orgId)) {\n if (members.has(link.userId)) continue;\n members.set(link.userId, {\n id: link.userId,\n ...(link.externalUserName ? { name: link.externalUserName } : {}),\n });\n }\n }\n\n routes(): ApiRoute[] {\n return buildCommentRoutes({\n domain: this,\n auth: this.#auth,\n comments: this.#comments,\n workItems: this.#workItems,\n projects: this.#projects,\n pubsub: this.#pubsub,\n ...(this.#audit ? { audit: this.#audit } : {}),\n });\n }\n}\n\nexport { toWireComment } from './wire.js';\nexport type { WireComment, WireCommentPage } from './wire.js';\n"],"mappings":";;;;;;;AA6GA,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAE5B,IAAa,iBAAb,MAA4B;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,+BAAwB,IAAI,IAA4D;CAExF,YAAY,EACV,MACA,UACA,WACA,UACA,iBACA,SACA,OACA,YACA,UACwB;EACxB,KAAKA,QAAQ;EACb,KAAKC,YAAY;EACjB,KAAKC,aAAa;EAClB,KAAKC,YAAY;EACjB,KAAKC,mBAAmB;EACxB,KAAKC,WAAW;EAChB,KAAKC,SAAS;EACd,KAAKC,cAAc,cAAc,CAAC;EAClC,KAAKC,UAAU;CACjB;;;;;CAMA,MAAME,WAAW,OAAuF;EACtG,MAAM,KAAKT,UAAU,4BAA4B,KAAK;EACtD,UAAU,KAAKO,SAAS,OAAO,MAAM,UAAU;CACjD;CAEA,MAAM,cAAc,OAAuE;EACzF,MAAM,KAAKP,UAAU,YAAY;EACjC,MAAM,KAAKC,WAAW,YAAY;EAElC,MAAM,YAAY,iBAAiB,MAAM,IAAI;EAC7C,IAAI,WAAW,OAAO;GAAE,QAAQ;GAAW,SAAS;EAAU;EAC9D,KAAK,MAAM,UAAU,UAAU,KAAA,IAC7B,OAAO;GAAE,QAAQ;GAAW,SAAS;EAAwD;EAG/F,MAAM,WAAW,MAAM,KAAKA,WAAW,IAAI;GAAE,OAAO,MAAM;GAAO,IAAI,MAAM;EAAW,CAAC;EACvF,IAAI,CAAC,UAAU,OAAO,EAAE,QAAQ,sBAAsB;EAEtD,IAAI;EACJ,IAAI,MAAM,SAAS;GACjB,MAAM,SAAS,MAAM,KAAKD,UAAU,IAAI;IAAE,OAAO,MAAM;IAAO,WAAW,MAAM,QAAQ;GAAU,CAAC;GAClG,IAAI,CAAC,UAAU,OAAO,eAAe,MAAM,Y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AY,EAAE,WAAW,OAAO,UAAU,IAAI,CAAC;GAC5D,CAAC;EACH;EACA,IAAI,CAAC,KAAKG,kBAAkB;EAC5B,MAAM,KAAKA,iBAAiB,YAAY;EACxC,KAAK,MAAM,QAAQ,MAAM,KAAKA,iBAAiB,uBAAuB,KAAK,GAAG;GAC5E,IAAI,QAAQ,IAAI,KAAK,MAAM,GAAG;GAC9B,QAAQ,IAAI,KAAK,QAAQ;IACvB,IAAI,KAAK;IACT,GAAI,KAAK,mBAAmB,EAAE,MAAM,KAAK,iBAAiB,IAAI,CAAC;GACjE,CAAC;EACH;CACF;CAEA,SAAqB;EACnB,OAAO,mBAAmB;GACxB,QAAQ;GACR,MAAM,KAAKJ;GACX,UAAU,KAAKC;GACf,WAAW,KAAKC;GAChB,UAAU,KAAKC;GACf,QAAQ,KAAKK;GACb,GAAI,KAAKF,SAAS,EAAE,OAAO,KAAKA,OAAO,IAAI,CAAC;EAC9C,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"domain.js","names":["#auth","#comments","#workItems","#projects","#channelIdentity","#members","#audit","#publishers","#pubsub","#rosterCache","#touchFeed","#mirrorComment","#cleanupMentionReceipts","#organizationRoster","#seenRoster"],"sources":["../../../../src/storage/domains/comments/domain.ts"],"sourcesContent":["/**\n * Comments domain — feed orchestration behind service methods; the HTTP layer\n * lives in `routes.ts` and only maps their result statuses. Service methods\n * take the author as a `FactoryActorRef` (never derived from the request\n * inside), so agent-authored comments later become a thin tool over\n * `createComment` instead of a re-implementation.\n */\n\nimport type { PubSub } from '@mastra/core/events';\nimport type { ApiRoute } from '@mastra/core/server';\n\nimport { touchFeed } from '../../../feed-events.js';\nimport type { RouteAuth } from '../../../routes/route.js';\nimport type { AuditEmitter } from '../audit/domain.js';\nimport type { ChannelIdentityStorage } from '../channel-identity/base.js';\nimport type { FactoryProjectsStorage } from '../projects/base.js';\nimport type { ExternalWorkItemSource, WorkItemRow, WorkItemsStorage } from '../work-items/base.js';\nimport { factoryMentionAttentionIdentity } from '../work-items/base.js';\nimport type { FactoryActorRef } from './actor.js';\nimport { isMentionableActorId } from './actor.js';\nimport type {\n EditWorkItemCommentResult,\n FactoryMentionRef,\n WorkItemCommentReplyRef,\n WorkItemCommentRow,\n WorkItemCommentsStorage,\n} from './base.js';\nimport { CommentTokenConflictError, commentBodyError, MAX_COMMENT_MENTIONS, MAX_COMMENT_QUOTE_LENGTH } from './base.js';\nimport type { WorkItemFeedPublisher } from './feed-sync.js';\nimport { buildCommentRoutes } from './routes.js';\n\nexport interface FactoryRosterMember {\n id: string;\n name?: string;\n avatarUrl?: string;\n}\n\nexport interface OrganizationMembersProvider {\n listOrganizationMembers(orgId: string): Promise<FactoryRosterMember[]>;\n}\n\nexport interface CommentsDomainOptions {\n auth: RouteAuth;\n comments: WorkItemCommentsStorage;\n workItems: WorkItemsStorage;\n projects: FactoryProjectsStorage;\n channelIdentity?: ChannelIdentityStorage;\n /** Host-wired org membership listing for the mention roster (e.g. WorkOS). */\n members?: OrganizationMembersProvider;\n audit?: AuditEmitter;\n /** Outbound platform mirrors (COR-1174); empty until a platform wires one. */\n publishers?: WorkItemFeedPublisher[];\n /** Carries feed touches to every replica's open SSE streams. */\n pubsub: PubSub;\n}\n\nexport interface CreateCommentServiceInput {\n orgId: string;\n workItemId: string;\n author: FactoryActorRef;\n body: string;\n replyTo?: { commentId: string; quote?: string };\n mentions?: FactoryMentionRef[];\n clientToken?: string;\n /** Set when the comment is a platform message being ingested, never by the web UI. */\n externalSource?: ExternalWorkItemSource;\n /** The platform's own timestamp; defaults to now for locally authored comments. */\n occurredAt?: Date;\n}\n\nexport type CreateCommentServiceResult =\n /** `mirrored` settles when the platforms have been posted to; nothing in the response waits on it. */\n | { status: 'created'; comment: WorkItemCommentRow; workItem: WorkItemRow; mirrored: Promise<void> }\n | { status: 'work_item_not_found' }\n | { status: 'token_conflict' }\n | { status: 'invalid'; message: string };\n\nexport interface CommentEditor {\n userId: string;\n /** Lazily checked, only when the caller is not the author. */\n canModerate: () => Promise<boolean>;\n}\n\nexport interface EditCommentServiceInput {\n orgId: string;\n workItemId: string;\n commentId: string;\n editor: CommentEditor;\n body: string;\n mentions?: FactoryMentionRef[];\n expectedRevision?: number;\n}\n\nexport type EditCommentServiceResult =\n | ({ status: 'edited'; previousBody: string } & EditWorkItemCommentResult)\n | { status: 'not_found' }\n | { status: 'forbidden' }\n | { status: 'not_editable' }\n | { status: 'conflict' }\n | { status: 'invalid'; message: string };\n\nexport interface DeleteCommentServiceInput {\n orgId: string;\n workItemId: string;\n commentId: string;\n editor: CommentEditor;\n}\n\nexport type DeleteCommentServiceResult =\n | { status: 'deleted'; comment: WorkItemCommentRow }\n | { status: 'not_found' }\n | { status: 'forbidden' }\n | { status: 'not_editable' };\n\nconst MAX_ROSTER_SIZE = 100;\nconst ROSTER_CACHE_TTL_MS = 60_000;\n\nexport class CommentsDomain {\n readonly #auth: RouteAuth;\n readonly #comments: WorkItemCommentsStorage;\n readonly #workItems: WorkItemsStorage;\n readonly #projects: FactoryProjectsStorage;\n readonly #channelIdentity: ChannelIdentityStorage | undefined;\n readonly #members: OrganizationMembersProvider | undefined;\n readonly #audit: AuditEmitter | undefined;\n readonly #publishers: WorkItemFeedPublisher[];\n readonly #pubsub: PubSub;\n readonly #rosterCache = new Map<string, { at: number; members: FactoryRosterMember[] }>();\n\n constructor({\n auth,\n comments,\n workItems,\n projects,\n channelIdentity,\n members,\n audit,\n publishers,\n pubsub,\n }: CommentsDomainOptions) {\n this.#auth = auth;\n this.#comments = comments;\n this.#workItems = workItems;\n this.#projects = projects;\n this.#channelIdentity = channelIdentity;\n this.#members = members;\n this.#audit = audit;\n this.#publishers = publishers ?? [];\n this.#pubsub = pubsub;\n }\n\n /** The one seam every feed mutation routes through, platform ingest included. */\n async #touchFeed(scope: { orgId: string; factoryProjectId: string; workItemId: string }): Promise<void> {\n await this.#comments.refreshWorkItemFeedActivity(scope);\n touchFeed(this.#pubsub, scope, scope.workItemId);\n }\n\n async createComment(input: CreateCommentServiceInput): Promise<CreateCommentServiceResult> {\n await this.#comments.ensureReady();\n await this.#workItems.ensureReady();\n\n const bodyError = commentBodyError(input.body);\n if (bodyError) return { status: 'invalid', message: bodyError };\n if ((input.mentions?.length ?? 0) > MAX_COMMENT_MENTIONS) {\n return { status: 'invalid', message: `At most ${MAX_COMMENT_MENTIONS} mentions per comment.` };\n }\n\n const workItem = await this.#workItems.get({ orgId: input.orgId, id: input.workItemId });\n if (!workItem) return { status: 'work_item_not_found' };\n\n let replyTo: WorkItemCommentReplyRef | undefined;\n if (input.replyTo) {\n const parent = await this.#comments.get({ orgId: input.orgId, commentId: input.replyTo.commentId });\n if (!parent || parent.workItemId !== input.workItemId) {\n return { status: 'invalid', message: 'Reply target is not a comment on this work item.' };\n }\n replyTo = {\n commentId: parent.id,\n ...(input.replyTo.quote ? { quote: input.replyTo.quote.slice(0, MAX_COMMENT_QUOTE_LENGTH) } : {}),\n authorId: parent.author.id,\n ...(parent.author.displayName ? { authorName: parent.author.displayName } : {}),\n };\n }\n\n let comment: WorkItemCommentRow;\n try {\n comment = await this.#comments.create({\n orgId: input.orgId,\n factoryProjectId: workItem.factoryProjectId,\n workItemId: input.workItemId,\n author: input.author,\n body: input.body,\n ...(replyTo ? { replyTo } : {}),\n ...(input.mentions ? { mentions: input.mentions } : {}),\n ...(input.clientToken ? { clientToken: input.clientToken } : {}),\n ...(input.externalSource ? { externalSource: input.externalSource } : {}),\n ...(input.occurredAt ? { occurredAt: input.occurredAt } : {}),\n });\n } catch (error) {\n if (error instanceof CommentTokenConflictError) return { status: 'token_conflict' };\n throw error;\n }\n await this.#touchFeed({\n orgId: input.orgId,\n factoryProjectId: workItem.factoryProjectId,\n workItemId: input.workItemId,\n });\n return { status: 'created', comment, workItem, mirrored: this.#mirrorComment(comment, workItem) };\n }\n\n /**\n * Runs past the response — the comment is stored, the feed frame is already\n * out, and nobody is waiting on Slack. A failed publish never fails the\n * create. The write-back is the replay guard: a replayed create sees its own\n * platform on the row and skips it. Known ceiling, single publisher only:\n * `external_source` is single-valued, so with two publishers a replayed\n * create re-publishes to the one that is not recorded, and a process that\n * restarts mid-flight drops the post. Both need an outbox.\n */\n async #mirrorComment(comment: WorkItemCommentRow, workItem: WorkItemRow): Promise<void> {\n let current = comment;\n for (const publisher of this.#publishers) {\n if (current.externalSource?.integrationId === publisher.id) continue;\n try {\n const published = await publisher.publish(current, workItem);\n if (!published) continue;\n current =\n (await this.#comments.attachExternalSource({\n orgId: current.orgId,\n commentId: current.id,\n source: published.source,\n })) ?? current;\n } catch (err) {\n console.warn('[Comments] Failed to mirror a comment to a platform', {\n publisherId: publisher.id,\n commentId: current.id,\n orgId: current.orgId,\n workItemId: workItem.id,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n }\n\n async editComment(input: EditCommentServiceInput): Promise<EditCommentServiceResult> {\n await this.#comments.ensureReady();\n await this.#workItems.ensureReady();\n\n const bodyError = commentBodyError(input.body);\n if (bodyError) return { status: 'invalid', message: bodyError };\n if ((input.mentions?.length ?? 0) > MAX_COMMENT_MENTIONS) {\n return { status: 'invalid', message: `At most ${MAX_COMMENT_MENTIONS} mentions per comment.` };\n }\n\n const existing = await this.#comments.get({ orgId: input.orgId, commentId: input.commentId });\n if (!existing || existing.workItemId !== input.workItemId) return { status: 'not_found' };\n if (existing.deletedAt) return { status: 'not_editable' };\n if (existing.author.id !== input.editor.userId && !(await input.editor.canModerate())) {\n return { status: 'forbidden' };\n }\n\n const edited = await this.#comments.edit({\n orgId: input.orgId,\n commentId: input.commentId,\n body: input.body,\n editorId: input.editor.userId,\n ...(input.mentions ? { mentions: input.mentions } : {}),\n ...(input.expectedRevision !== undefined ? { expectedRevision: input.expectedRevision } : {}),\n });\n if (edited === 'conflict') return { status: 'conflict' };\n if (!edited) return { status: 'not_editable' };\n\n await this.#cleanupMentionReceipts(existing, edited.removedMentions);\n await this.#touchFeed({\n orgId: existing.orgId,\n factoryProjectId: existing.factoryProjectId,\n workItemId: existing.workItemId,\n });\n return { status: 'edited', previousBody: existing.body, ...edited };\n }\n\n async deleteComment(input: DeleteCommentServiceInput): Promise<DeleteCommentServiceResult> {\n await this.#comments.ensureReady();\n await this.#workItems.ensureReady();\n\n const existing = await this.#comments.get({ orgId: input.orgId, commentId: input.commentId });\n if (!existing || existing.workItemId !== input.workItemId) return { status: 'not_found' };\n if (existing.deletedAt) return { status: 'not_editable' };\n if (existing.author.id !== input.editor.userId && !(await input.editor.canModerate())) {\n return { status: 'forbidden' };\n }\n\n const deleted = await this.#comments.softDelete({\n orgId: input.orgId,\n commentId: input.commentId,\n deletedBy: input.editor.userId,\n });\n if (!deleted) return { status: 'not_editable' };\n\n await this.#workItems.deleteAttentionReceipts({\n orgId: existing.orgId,\n factoryProjectId: existing.factoryProjectId,\n identities: [factoryMentionAttentionIdentity(existing.id)],\n });\n await this.#touchFeed({\n orgId: existing.orgId,\n factoryProjectId: existing.factoryProjectId,\n workItemId: existing.workItemId,\n });\n return { status: 'deleted', comment: deleted };\n }\n\n /**\n * A removed mention deletes only that user's receipt: the receipt identity\n * is per-comment, and other still-mentioned users must keep their read state.\n */\n async #cleanupMentionReceipts(comment: WorkItemCommentRow, removed: FactoryMentionRef[]): Promise<void> {\n for (const mention of removed) {\n await this.#workItems.deleteAttentionReceipts({\n orgId: comment.orgId,\n factoryProjectId: comment.factoryProjectId,\n userId: mention.id,\n identities: [factoryMentionAttentionIdentity(comment.id)],\n });\n }\n }\n\n /**\n * Mentionable people: the host's org roster when it answers, otherwise the\n * people the project has actually seen (comment authors, linked channel\n * accounts). Cached per project so a dropdown session costs one read.\n */\n async mentionRoster({\n orgId,\n factoryProjectId,\n }: {\n orgId: string;\n factoryProjectId: string;\n }): Promise<FactoryRosterMember[]> {\n const cacheKey = `${orgId}\\0${factoryProjectId}`;\n const cached = this.#rosterCache.get(cacheKey);\n if (cached && Date.now() - cached.at < ROSTER_CACHE_TTL_MS) return cached.members;\n\n const members = await this.#organizationRoster(orgId);\n if (members.size === 0) await this.#seenRoster(orgId, factoryProjectId, members);\n\n const roster = [...members.values()].slice(0, MAX_ROSTER_SIZE);\n // Sweep on write: a long-lived server would otherwise hold one roster per\n // project it ever served.\n const cutoff = Date.now() - ROSTER_CACHE_TTL_MS;\n for (const [key, entry] of this.#rosterCache) {\n if (entry.at < cutoff) this.#rosterCache.delete(key);\n }\n this.#rosterCache.set(cacheKey, { at: Date.now(), members: roster });\n return roster;\n }\n\n /** Empty when no provider is wired, or when the host listing fails. */\n async #organizationRoster(orgId: string): Promise<Map<string, FactoryRosterMember>> {\n const members = new Map<string, FactoryRosterMember>();\n if (!this.#members) return members;\n try {\n for (const member of await this.#members.listOrganizationMembers(orgId)) {\n if (isMentionableActorId(member.id)) members.set(member.id, member);\n }\n } catch (err) {\n console.warn('[Comments] Failed to list organization members for the mention roster', {\n error: err instanceof Error ? err.message : String(err),\n });\n }\n return members;\n }\n\n async #seenRoster(orgId: string, factoryProjectId: string, members: Map<string, FactoryRosterMember>): Promise<void> {\n for (const author of await this.#comments.listRecentAuthors({ orgId, factoryProjectId })) {\n if (author.kind !== 'user' || !isMentionableActorId(author.id)) continue;\n members.set(author.id, {\n id: author.id,\n ...(author.displayName ? { name: author.displayName } : {}),\n ...(author.avatarUrl ? { avatarUrl: author.avatarUrl } : {}),\n });\n }\n if (!this.#channelIdentity) return;\n await this.#channelIdentity.ensureReady();\n for (const link of await this.#channelIdentity.listAccountLinksForOrg(orgId)) {\n if (members.has(link.userId)) continue;\n members.set(link.userId, {\n id: link.userId,\n ...(link.externalUserName ? { name: link.externalUserName } : {}),\n });\n }\n }\n\n routes(): ApiRoute[] {\n return buildCommentRoutes({\n domain: this,\n auth: this.#auth,\n comments: this.#comments,\n workItems: this.#workItems,\n projects: this.#projects,\n pubsub: this.#pubsub,\n ...(this.#audit ? { audit: this.#audit } : {}),\n });\n }\n}\n\nexport { toWireComment } from './wire.js';\nexport type { WireComment, WireCommentPage } from './wire.js';\n"],"mappings":";;;;;;;AAkHA,MAAM,kBAAkB;AACxB,MAAM,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I,CAAC;IACzD,GAAI,OAAO,YAAY,EAAE,WAAW,OAAO,UAAU,IAAI,CAAC;GAC5D,CAAC;EACH;EACA,IAAI,CAAC,KAAKG,kBAAkB;EAC5B,MAAM,KAAKA,iBAAiB,YAAY;EACxC,KAAK,MAAM,QAAQ,MAAM,KAAKA,iBAAiB,uBAAuB,KAAK,GAAG;GAC5E,IAAI,QAAQ,IAAI,KAAK,MAAM,GAAG;GAC9B,QAAQ,IAAI,KAAK,QAAQ;IACvB,IAAI,KAAK;IACT,GAAI,KAAK,mBAAmB,EAAE,MAAM,KAAK,iBAAiB,IAAI,CAAC;GACjE,CAAC;EACH;CACF;CAEA,SAAqB;EACnB,OAAO,mBAAmB;GACxB,QAAQ;GACR,MAAM,KAAKJ;GACX,UAAU,KAAKC;GACf,WAAW,KAAKC;GAChB,UAAU,KAAKC;GACf,QAAQ,KAAKK;GACb,GAAI,KAAKF,SAAS,EAAE,OAAO,KAAKA,OAAO,IAAI,CAAC;EAC9C,CAAC;CACH;AACF"}
@@ -1,38 +1,21 @@
1
1
  /**
2
- * Two-way platform sync seam (COR-1174). Interfaces only — no platform code
3
- * ships here. Echo prevention is two layers: `source_key` idempotency for rows
4
- * born on the platform, and the host's bot-sender check for the window between
5
- * an outbound publish and its `attachExternalSource` write-back.
2
+ * Outbound half of the two-way platform sync (COR-1174). Inbound needs no seam:
3
+ * a platform message is a comment, so ingest calls `createComment` with an
4
+ * `externalSource`.
5
+ *
6
+ * Echo prevention is three layers: `source_key` idempotency, the fan-out
7
+ * skipping a comment's own platform, and the host's bot-sender check for the
8
+ * window between a publish and its `attachExternalSource` write-back.
6
9
  */
7
10
  import type { ExternalWorkItemSource, WorkItemRow } from '../work-items/base.js';
8
- import type { FactoryActorRef } from './actor.js';
9
11
  import type { WorkItemCommentRow } from './base.js';
10
- /**
11
- * Inbound: platform messages become comments, keyed by a stable source
12
- * (e.g. `slack:message:<channel>:<ts>` — `ts` survives edits, so an edit
13
- * re-upserts the same row and a delete tombstones it).
14
- */
15
- export interface WorkItemFeedIngest {
16
- upsertMessage(input: {
17
- orgId: string;
18
- workItemId: string;
19
- author: FactoryActorRef;
20
- body: string;
21
- occurredAt: Date;
22
- source: ExternalWorkItemSource;
23
- }): Promise<WorkItemCommentRow>;
24
- deleteMessage(input: {
25
- orgId: string;
26
- factoryProjectId: string;
27
- source: ExternalWorkItemSource;
28
- }): Promise<void>;
29
- }
30
12
  /** Outbound: mirrors a created comment to one platform. */
31
13
  export interface WorkItemFeedPublisher {
32
14
  /** Matches `ExternalWorkItemSource.integrationId`; fan-out skips a comment's own platform. */
33
15
  readonly id: string;
16
+ /** `null` when the work item is not bound to this platform — nothing to mirror. */
34
17
  publish(comment: WorkItemCommentRow, workItem: WorkItemRow): Promise<{
35
18
  source: ExternalWorkItemSource;
36
- }>;
19
+ } | null>;
37
20
  }
38
21
  //# sourceMappingURL=feed-sync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feed-sync.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/comments/feed-sync.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,CAAC,KAAK,EAAE;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,eAAe,CAAC;QACxB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,IAAI,CAAC;QACjB,MAAM,EAAE,sBAAsB,CAAC;KAChC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAChC,aAAa,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,sBAAsB,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClH;AAED,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,sBAAsB,CAAA;KAAE,CAAC,CAAC;CAC1G"}
1
+ {"version":3,"file":"feed-sync.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/comments/feed-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAEpD,2DAA2D;AAC3D,MAAM,WAAW,qBAAqB;IACpC,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,mFAAmF;IACnF,OAAO,CAAC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,sBAAsB,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;CACjH"}
@@ -15,6 +15,12 @@ export declare function factoryDecisionHash(decision: Record<string, unknown>):
15
15
  export interface ExternalWorkItemSource {
16
16
  integrationId: string;
17
17
  type: string;
18
+ /**
19
+ * The tenant on the platform, never ours: a Slack team (`T0ABC…`), a Discord
20
+ * guild. Scopes the key, because a platform id such as a channel or a message
21
+ * `ts` is only unique inside the workspace that issued it.
22
+ */
23
+ workspaceId?: string;
18
24
  externalId: string;
19
25
  url?: string;
20
26
  }
@@ -307,8 +313,10 @@ export interface CommitFactoryTransitionInput {
307
313
  code: string;
308
314
  reason: string;
309
315
  };
310
- /** Arm autonomy in the same revision-checked update that commits the transition. */
311
- armAutonomy?: boolean;
316
+ /** Arm or disarm autonomy in the same revision-checked update that commits the transition. */
317
+ autonomy?: 'arm' | 'disarm';
318
+ /** Consent-bearing actor behind the flip; their id pre-approves the runs this transition queues. */
319
+ consentedBy?: string;
312
320
  /** Triage classification reported by an authenticated triage binding. */
313
321
  triageType?: FactoryTriageType;
314
322
  }
@@ -406,6 +414,12 @@ export interface UpsertWorkItemResult {
406
414
  previous: WorkItemPriorState;
407
415
  }
408
416
  export declare const WORK_ITEMS_SCHEMA: CollectionSchema;
417
+ /**
418
+ * The one shape a platform id takes in a lookup key, for cards and for the
419
+ * comments mirrored off them alike: whoever writes a second builder reopens the
420
+ * cross-workspace collision the `workspaceId` is here to close.
421
+ */
422
+ export declare function externalSourceKey(source: ExternalWorkItemSource | null | undefined): string | null;
409
423
  export declare class WorkItemRelationError extends Error {
410
424
  readonly code = "invalid_work_item_relation";
411
425
  }
@@ -460,6 +474,13 @@ export declare class WorkItemsStorage extends FactoryStorageDomain {
460
474
  orgId: string;
461
475
  id: string;
462
476
  }): Promise<WorkItemRow | null>;
477
+ /**
478
+ * Resolve the card a platform thread created, given only its external source.
479
+ * Bare of org/project because an inbound platform message carries neither: an
480
+ * unlinked sender has no tenant. Tenant safety rides on the key's
481
+ * `workspaceId` instead. Ambiguous matches resolve to nothing, not a guess.
482
+ */
483
+ getBySource(source: ExternalWorkItemSource): Promise<WorkItemRow | null>;
463
484
  getForProject(orgId: string, factoryProjectId: string, id: string): Promise<WorkItemRow | null>;
464
485
  getTransitionResultByIngress(orgId: string, factoryProjectId: string, identity: string): Promise<Record<string, unknown> | null>;
465
486
  commitTransition(input: CommitFactoryTransitionInput): Promise<CommitFactoryTransitionResult>;
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/work-items/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,oBAAoB,EAAwB,MAAM,sBAAsB,CAAC;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AM,CAAC;KAC1B,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAkBzB,MAAM,CAAC,EACX,KAAK,EACL,EAAE,EACF,MAAM,EACN,KAAK,GACN,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,mBAAmB,CAAC;KAC5B,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,QAAQ,EAAE,kBAAkB,CAAA;KAAE,GAAG,IAAI,CAAC;IAuBvE;;;;;OAKG;IACG,WAAW,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IA0FxF,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CA2BxF"}
@@ -147,25 +147,39 @@ const WORK_ITEMS_SCHEMA = {
147
147
  name: "work_items_project_source_key_unique",
148
148
  columns: ["factory_project_id", "source_key"]
149
149
  }],
150
- indexes: [{
151
- name: "work_items_org_project_created_at_id_idx",
152
- columns: [
153
- "org_id",
154
- "factory_project_id",
155
- "created_at",
156
- "id"
157
- ]
158
- }, {
159
- name: "work_items_project_parent_idx",
160
- columns: [
161
- "org_id",
162
- "factory_project_id",
163
- "parent_work_item_id"
164
- ]
165
- }]
150
+ indexes: [
151
+ {
152
+ name: "work_items_org_project_created_at_id_idx",
153
+ columns: [
154
+ "org_id",
155
+ "factory_project_id",
156
+ "created_at",
157
+ "id"
158
+ ]
159
+ },
160
+ {
161
+ name: "work_items_project_parent_idx",
162
+ columns: [
163
+ "org_id",
164
+ "factory_project_id",
165
+ "parent_work_item_id"
166
+ ]
167
+ },
168
+ {
169
+ name: "work_items_source_key_idx",
170
+ columns: ["source_key"]
171
+ }
172
+ ]
166
173
  };
167
- function sourceKey(source) {
168
- return source ? `${source.integrationId}:${source.type}:${source.externalId}` : null;
174
+ /**
175
+ * The one shape a platform id takes in a lookup key, for cards and for the
176
+ * comments mirrored off them alike: whoever writes a second builder reopens the
177
+ * cross-workspace collision the `workspaceId` is here to close.
178
+ */
179
+ function externalSourceKey(source) {
180
+ if (!source) return null;
181
+ const workspace = source.workspaceId ? `${source.workspaceId}:` : "";
182
+ return `${source.integrationId}:${source.type}:${workspace}${source.externalId}`;
169
183
  }
170
184
  function toWorkItem(row) {
171
185
  return {
@@ -199,7 +213,7 @@ function patchColumns(changes) {
199
213
  ...changes.sessions !== void 0 ? { sessions: changes.sessions } : {},
200
214
  ...changes.metadata !== void 0 ? { metadata: changes.metadata } : {},
201
215
  ...changes.triageType !== void 0 ? { triage_type: changes.triageType } : {},
202
- ...changes.autonomyArmedAt !== void 0 && changes.autonomyArmedAt !== null ? { autonomy_armed_at: changes.autonomyArmedAt } : {},
216
+ ...changes.autonomyArmedAt !== void 0 ? { autonomy_armed_at: changes.autonomyArmedAt } : {},
203
217
  ...changes.revision !== void 0 ? { revision: changes.revision } : {},
204
218
  ...changes.updatedAt !== void 0 ? { updated_at: changes.updatedAt } : {}
205
219
  };
@@ -891,6 +905,16 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
891
905
  });
892
906
  return row ? toWorkItem(row) : null;
893
907
  }
908
+ /**
909
+ * Resolve the card a platform thread created, given only its external source.
910
+ * Bare of org/project because an inbound platform message carries neither: an
911
+ * unlinked sender has no tenant. Tenant safety rides on the key's
912
+ * `workspaceId` instead. Ambiguous matches resolve to nothing, not a guess.
913
+ */
914
+ async getBySource(source) {
915
+ const rows = await this.#db.findMany("work_items", { source_key: externalSourceKey(source) });
916
+ return rows.length === 1 ? toWorkItem(rows[0]) : null;
917
+ }
894
918
  async getForProject(orgId, factoryProjectId, id) {
895
919
  const row = await this.#db.findOne("work_items", {
896
920
  id,
@@ -940,19 +964,22 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
940
964
  reason = input.evaluation.reason;
941
965
  return null;
942
966
  }
943
- const arm = input.armAutonomy === true && !existing.autonomyArmedAt;
967
+ const arm = input.autonomy === "arm" && !existing.autonomyArmedAt;
968
+ const disarm = input.autonomy === "disarm" && existing.autonomyArmedAt !== null;
944
969
  const triageType = existing.triageType ?? input.triageType ?? null;
945
970
  const classified = triageType !== existing.triageType;
946
- if (existing.stages.length === 1 && existing.stages[0] === input.destinationStage) return arm || classified ? patchColumns({
971
+ if (existing.stages.length === 1 && existing.stages[0] === input.destinationStage) return arm || disarm || classified ? patchColumns({
947
972
  ...arm ? { autonomyArmedAt: now } : {},
948
- ...classified ? { triageType } : {},
973
+ ...disarm ? { autonomyArmedAt: null } : {},
949
974
  ...classified ? {
975
+ triageType,
950
976
  revision: existing.revision + 1,
951
977
  updatedAt: now
952
978
  } : {}
953
979
  }) : null;
954
980
  return patchColumns({
955
981
  ...arm ? { autonomyArmedAt: now } : {},
982
+ ...disarm ? { autonomyArmedAt: null } : {},
956
983
  ...classified ? { triageType } : {},
957
984
  stages: [input.destinationStage],
958
985
  stageHistory: applyStageTransition(existing.stageHistory, existing.stages, [input.destinationStage], input.actorId, now),
@@ -1001,29 +1028,34 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
1001
1028
  causal_chain: input.causalChain,
1002
1029
  created_at: now
1003
1030
  });
1004
- if (outcome === "accepted" && input.evaluation.outcome === "accepted") for (const [index, decision] of input.evaluation.decisions.entries()) await ops.insertOne("factory_deferred_decisions", {
1005
- org_id: input.orgId,
1006
- factory_project_id: input.factoryProjectId,
1007
- evaluation_id: evaluation.id,
1008
- work_item_id: item.id,
1009
- source_key: decisionSourceKey(decision),
1010
- idempotency_key: String(decision.idempotencyKey),
1011
- effect_ordinal: index,
1012
- effect_hash: factoryDecisionHash(decision),
1013
- causal_chain: input.causalChain,
1014
- actor: null,
1015
- decision,
1016
- status: "pending",
1017
- attempts: 0,
1018
- delivery_generation: 0,
1019
- available_at: now,
1020
- lease_owner: null,
1021
- lease_expires_at: null,
1022
- last_error: null,
1023
- completed_at: null,
1024
- created_at: new Date(now.getTime() + index),
1025
- updated_at: now
1026
- });
1031
+ if (outcome === "accepted" && input.evaluation.outcome === "accepted") for (const [index, decision] of input.evaluation.decisions.entries()) {
1032
+ const approvedBy = decision.type === "invokeSkill" ? input.consentedBy ?? null : null;
1033
+ await ops.insertOne("factory_deferred_decisions", {
1034
+ org_id: input.orgId,
1035
+ factory_project_id: input.factoryProjectId,
1036
+ evaluation_id: evaluation.id,
1037
+ work_item_id: item.id,
1038
+ source_key: decisionSourceKey(decision),
1039
+ idempotency_key: String(decision.idempotencyKey),
1040
+ effect_ordinal: index,
1041
+ effect_hash: factoryDecisionHash(decision),
1042
+ causal_chain: input.causalChain,
1043
+ actor: null,
1044
+ decision,
1045
+ status: "pending",
1046
+ attempts: 0,
1047
+ delivery_generation: 0,
1048
+ available_at: now,
1049
+ lease_owner: null,
1050
+ lease_expires_at: null,
1051
+ last_error: null,
1052
+ approved_at: approvedBy ? now : null,
1053
+ approved_by: approvedBy,
1054
+ completed_at: null,
1055
+ created_at: new Date(now.getTime() + index),
1056
+ updated_at: now
1057
+ });
1058
+ }
1027
1059
  }
1028
1060
  return {
1029
1061
  status: "committed",
@@ -1809,10 +1841,10 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
1809
1841
  id: input.workItem.id,
1810
1842
  org_id: input.orgId,
1811
1843
  factory_project_id: input.factoryProjectId
1812
- }) : sourceKey(create.externalSource) ? await ops.findOne("work_items", {
1844
+ }) : externalSourceKey(create.externalSource) ? await ops.findOne("work_items", {
1813
1845
  org_id: input.orgId,
1814
1846
  factory_project_id: input.factoryProjectId,
1815
- source_key: sourceKey(create.externalSource)
1847
+ source_key: externalSourceKey(create.externalSource)
1816
1848
  }) : null;
1817
1849
  let item;
1818
1850
  if (row) {
@@ -1834,7 +1866,7 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
1834
1866
  created_by: input.userId,
1835
1867
  factory_project_id: input.factoryProjectId,
1836
1868
  external_source: create.externalSource ?? null,
1837
- source_key: sourceKey(create.externalSource),
1869
+ source_key: externalSourceKey(create.externalSource),
1838
1870
  parent_work_item_id: create.parentWorkItemId ?? null,
1839
1871
  title: create.title,
1840
1872
  stages: create.stages ?? [],
@@ -1944,7 +1976,7 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
1944
1976
  }
1945
1977
  }
1946
1978
  async #upsert({ orgId, userId, factoryProjectId, input, reuseMode = "update" }, ops) {
1947
- const key = sourceKey(input.externalSource);
1979
+ const key = externalSourceKey(input.externalSource);
1948
1980
  const reuse = async () => {
1949
1981
  if (!key) return null;
1950
1982
  const existing = await ops.findOne("work_items", {
@@ -2189,6 +2221,6 @@ var WorkItemsStorage = class extends FactoryStorageDomain {
2189
2221
  }
2190
2222
  };
2191
2223
  //#endregion
2192
- export { FACTORY_PULL_REQUEST_RECONCILIATION_KEY, FACTORY_RULE_MATERIALIZATION_KEY, WORK_ITEMS_SCHEMA, WorkItemRelationError, WorkItemsStorage, applyStageTransition, factoryActivityAttentionIdentity, factoryAttentionKey, factoryDecisionAttentionIdentity, factoryDecisionHash, factoryMentionAttentionIdentity, isAgentActor, stampSessions, validateParentRelation };
2224
+ export { FACTORY_PULL_REQUEST_RECONCILIATION_KEY, FACTORY_RULE_MATERIALIZATION_KEY, WORK_ITEMS_SCHEMA, WorkItemRelationError, WorkItemsStorage, applyStageTransition, externalSourceKey, factoryActivityAttentionIdentity, factoryAttentionKey, factoryDecisionAttentionIdentity, factoryDecisionHash, factoryMentionAttentionIdentity, isAgentActor, stampSessions, validateParentRelation };
2193
2225
 
2194
2226
  //# sourceMappingURL=base.js.map