@mastra/factory 0.29.0-alpha.7 → 0.29.0
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.
- package/README.md +50 -20
- package/dist/boards/board-events.d.ts +23 -0
- package/dist/boards/board-events.d.ts.map +1 -1
- package/dist/boards/board-events.js +37 -3
- package/dist/boards/board-events.js.map +1 -1
- package/dist/boards/board-writes.d.ts +6 -4
- package/dist/boards/board-writes.d.ts.map +1 -1
- package/dist/boards/board-writes.js +9 -6
- package/dist/boards/board-writes.js.map +1 -1
- package/dist/boards/intake-routing.d.ts +30 -16
- package/dist/boards/intake-routing.d.ts.map +1 -1
- package/dist/boards/intake-routing.js +41 -28
- package/dist/boards/intake-routing.js.map +1 -1
- package/dist/boards/project-boards.d.ts +15 -0
- package/dist/boards/project-boards.d.ts.map +1 -1
- package/dist/boards/project-boards.js +43 -7
- package/dist/boards/project-boards.js.map +1 -1
- package/dist/factory.d.ts +4 -14
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +22 -15
- package/dist/factory.js.map +1 -1
- package/dist/integrations/github/integration.d.ts.map +1 -1
- package/dist/integrations/github/integration.js +101 -0
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +7 -3
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/github/sandbox.d.ts +7 -1
- package/dist/integrations/github/sandbox.d.ts.map +1 -1
- package/dist/integrations/github/sandbox.js +15 -1
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/github/session-subscriptions.js +1 -1
- package/dist/integrations/github/session-subscriptions.js.map +1 -1
- package/dist/integrations/gitlab/rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/rules.js +2 -1
- package/dist/integrations/gitlab/rules.js.map +1 -1
- package/dist/integrations/gitlab/session-subscriptions.js +1 -1
- package/dist/integrations/gitlab/session-subscriptions.js.map +1 -1
- package/dist/integrations/slack/channel-reply-processor.d.ts +1 -0
- package/dist/integrations/slack/channel-reply-processor.d.ts.map +1 -1
- package/dist/integrations/slack/channel-reply-processor.js +4 -1
- package/dist/integrations/slack/channel-reply-processor.js.map +1 -1
- package/dist/integrations/slack/run-error-card.js +6 -1
- package/dist/integrations/slack/run-error-card.js.map +1 -1
- package/dist/links.d.ts +4 -2
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +5 -3
- package/dist/links.js.map +1 -1
- package/dist/routes/boards.d.ts +1 -1
- package/dist/routes/boards.d.ts.map +1 -1
- package/dist/routes/boards.js.map +1 -1
- package/dist/routes/contracts.d.ts +32 -5
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +36 -9
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/intake-check.d.ts.map +1 -1
- package/dist/routes/intake-check.js +3 -1
- package/dist/routes/intake-check.js.map +1 -1
- package/dist/routes/intake-routes.d.ts +0 -3
- package/dist/routes/intake-routes.d.ts.map +1 -1
- package/dist/routes/intake-routes.js +1 -1
- package/dist/routes/intake-routes.js.map +1 -1
- package/dist/routes/skills.d.ts +1 -1
- package/dist/routes/skills.d.ts.map +1 -1
- package/dist/routes/skills.js +92 -28
- package/dist/routes/skills.js.map +1 -1
- package/dist/routes/surface.d.ts +0 -3
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +0 -1
- package/dist/routes/surface.js.map +1 -1
- package/dist/rules/dispatch-errors.d.ts +6 -0
- package/dist/rules/dispatch-errors.d.ts.map +1 -1
- package/dist/rules/dispatch-errors.js +10 -1
- package/dist/rules/dispatch-errors.js.map +1 -1
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +74 -32
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/event-rules.d.ts +3 -2
- package/dist/rules/event-rules.d.ts.map +1 -1
- package/dist/rules/event-rules.js +5 -3
- package/dist/rules/event-rules.js.map +1 -1
- package/dist/rules/public-failure-reason.d.ts +11 -0
- package/dist/rules/public-failure-reason.d.ts.map +1 -0
- package/dist/rules/public-failure-reason.js +136 -0
- package/dist/rules/public-failure-reason.js.map +1 -0
- package/dist/rules/transition-service.d.ts +13 -0
- package/dist/rules/transition-service.d.ts.map +1 -1
- package/dist/rules/transition-service.js +5 -1
- package/dist/rules/transition-service.js.map +1 -1
- package/dist/rules/types.d.ts +12 -0
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js.map +1 -1
- package/dist/rules/validation.d.ts.map +1 -1
- package/dist/rules/validation.js +11 -2
- package/dist/rules/validation.js.map +1 -1
- package/dist/run-error.d.ts +1 -1
- package/dist/run-error.d.ts.map +1 -1
- package/dist/run-error.js +21 -12
- package/dist/run-error.js.map +1 -1
- package/dist/session/environment-state-processor.d.ts.map +1 -1
- package/dist/session/environment-state-processor.js +6 -2
- package/dist/session/environment-state-processor.js.map +1 -1
- package/dist/session/source-control-tools.d.ts.map +1 -1
- package/dist/session/source-control-tools.js +5 -3
- package/dist/session/source-control-tools.js.map +1 -1
- package/dist/skills/app-skills.d.ts +3 -2
- package/dist/skills/app-skills.d.ts.map +1 -1
- package/dist/skills/app-skills.js +5 -3
- package/dist/skills/app-skills.js.map +1 -1
- package/dist/skills/catalog.d.ts +23 -4
- package/dist/skills/catalog.d.ts.map +1 -1
- package/dist/skills/catalog.js +61 -28
- package/dist/skills/catalog.js.map +1 -1
- package/dist/storage/domains/audit/actions.d.ts +1 -1
- package/dist/storage/domains/audit/actions.d.ts.map +1 -1
- package/dist/storage/domains/audit/actions.js +6 -1
- package/dist/storage/domains/audit/actions.js.map +1 -1
- package/dist/storage/domains/boards/base.d.ts +12 -0
- package/dist/storage/domains/boards/base.d.ts.map +1 -1
- package/dist/storage/domains/boards/base.js +3 -0
- package/dist/storage/domains/boards/base.js.map +1 -1
- package/dist/storage/domains/boards/schemas.d.ts.map +1 -1
- package/dist/storage/domains/boards/schemas.js +4 -0
- package/dist/storage/domains/boards/schemas.js.map +1 -1
- package/dist/storage/domains/skill-overrides/base.d.ts +28 -4
- package/dist/storage/domains/skill-overrides/base.d.ts.map +1 -1
- package/dist/storage/domains/skill-overrides/base.js +54 -1
- package/dist/storage/domains/skill-overrides/base.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts +2 -0
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +13 -5
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/tools/audit-events-tool.d.ts +1 -1
- package/dist/tools/read-tools.d.ts.map +1 -1
- package/dist/tools/read-tools.js +0 -1
- package/dist/tools/read-tools.js.map +1 -1
- package/dist/tools/work-item-tools.d.ts.map +1 -1
- package/dist/tools/work-item-tools.js +0 -3
- package/dist/tools/work-item-tools.js.map +1 -1
- package/dist/work-items/create-work-item.d.ts.map +1 -1
- package/dist/work-items/create-work-item.js +2 -1
- package/dist/work-items/create-work-item.js.map +1 -1
- package/dist/workspace.d.ts +5 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +69 -9
- package/dist/workspace.js.map +1 -1
- package/package.json +13 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-subscriptions.js","names":[],"sources":["../../../src/integrations/gitlab/session-subscriptions.ts"],"sourcesContent":["import type { AgentControllerRequestContext } from '@mastra/core/agent-controller';\nimport type { RequestContext } from '@mastra/core/request-context';\nimport { createTool } from '@mastra/core/tools';\nimport { z } from 'zod';\n\nimport { getFactoryAuthOrgId, getFactoryAuthUserFromContext, getFactoryAuthUserId } from '../../auth.js';\nimport type {\n ProjectRepository,\n ProjectSourceControlConnection,\n SourceControlInstallation,\n SourceControlRepository,\n} from '../../storage/domains/source-control/base.js';\nimport type { GitLabIntegrationBase } from './integration.js';\nimport { normalizeGitLabHost } from './integration.js';\nimport { subscribeToMergeRequest, unsubscribeFromMergeRequest } from './subscriptions.js';\nimport type { GitLabSignalSubscriptionSource } from './subscriptions.js';\n\ntype RepositorySessionState = { factoryProjectId?: string; projectRepositoryId?: string };\n\nconst MERGE_REQUEST_URL = /^https?:\\/\\/([^/\\s]+)\\/(.+?)\\/-\\/merge_requests\\/(\\d+)\\/?$/i;\n\nfunction sessionUserId(requestContext: RequestContext): string | undefined {\n return getFactoryAuthUserId(getFactoryAuthUserFromContext(requestContext));\n}\n\nfunction sessionOrgId(requestContext: RequestContext): string | undefined {\n return getFactoryAuthOrgId(getFactoryAuthUserFromContext(requestContext));\n}\n\nconst mergeRequestInputSchema = z.object({\n mergeRequest: z.union([z.number().int().positive(), z.string().min(1)]),\n});\n\ninterface SessionTarget {\n context: AgentControllerRequestContext<RepositorySessionState>;\n projectRepository: ProjectRepository;\n connection: ProjectSourceControlConnection;\n installation: SourceControlInstallation;\n repository: SourceControlRepository;\n host: string;\n orgId: string;\n userId: string;\n}\n\nfunction normalizePath(value: string): string {\n return value.replace(/^\\/+|\\/+$/g, '').toLowerCase();\n}\n\nexport function parseMergeRequestUrl(url: string): { host: string; projectPath: string; iid: number } | undefined {\n const match = url.trim().match(MERGE_REQUEST_URL);\n if (!match) return undefined;\n const iid = Number(match[3]);\n if (!Number.isSafeInteger(iid) || iid < 1) return undefined;\n return { host: normalizeGitLabHost(match[1]!), projectPath: match[2]!.replace(/\\/+$/, ''), iid };\n}\n\nfunction parseMergeRequest(value: number | string, target: SessionTarget): number {\n if (typeof value === 'number') return value;\n if (/^\\d+$/.test(value)) return Number(value);\n const parsed = parseMergeRequestUrl(value);\n if (\n !parsed ||\n parsed.host !== target.host ||\n normalizePath(parsed.projectPath) !== normalizePath(target.repository.slug)\n ) {\n throw new Error(`Merge request must belong to ${target.host}/${target.repository.slug}.`);\n }\n return parsed.iid;\n}\n\n/**\n * Whether the current request comes from a session that merge-request\n * subscriptions can ever apply to: an authenticated org user on a factory\n * session with an active thread. Mirrors the GitHub gate; whether the\n * session's repository is GitLab-linked is only known after a storage read,\n * so the entry points verify that and fail loudly for the explicit tools.\n */\nfunction isRepositorySession(requestContext: RequestContext): boolean {\n const context = requestContext.get('controller') as AgentControllerRequestContext<RepositorySessionState> | undefined;\n return Boolean(\n context?.threadId &&\n context.getState().factoryProjectId &&\n sessionOrgId(requestContext) &&\n sessionUserId(requestContext),\n );\n}\n\nasync function resolveSessionTarget(\n requestContext: RequestContext,\n gitlab: GitLabIntegrationBase,\n): Promise<SessionTarget | undefined> {\n const context = requestContext.get('controller') as AgentControllerRequestContext<RepositorySessionState> | undefined;\n const orgId = sessionOrgId(requestContext);\n const userId = sessionUserId(requestContext);\n if (!context || !context.threadId || !context.getState().factoryProjectId || !orgId || !userId) {\n throw new Error('GitLab subscriptions require an authenticated repository session with an active thread.');\n }\n const storage = gitlab.sourceControlStorage;\n if (!storage) throw new Error('GitLab source control is unavailable.');\n\n // Merge requests stay bound to the link the session is filed under: the\n // controller state names it for dispatched sessions, the session row for\n // the rest. A session filed under no link cannot subscribe.\n const projectRepositoryId =\n context.getState().projectRepositoryId ??\n (await storage.sessions.getBySessionId(context.sessionId))?.projectRepositoryId;\n if (!projectRepositoryId) return undefined;\n\n // The handle is scoped to GitLab rows, so a GitHub-linked repository is\n // simply absent here rather than misidentified.\n const projectRepository = await storage.projectRepositories.get({ orgId, id: projectRepositoryId });\n if (!projectRepository) return undefined;\n const connection = await storage.connections.get({ orgId, id: projectRepository.connectionId });\n if (!connection || connection.integrationId !== 'gitlab') return undefined;\n const repository = await storage.repositories.get({ orgId, id: projectRepository.repositoryId });\n if (!repository) throw new Error('Repository not found for this organization.');\n const installation = await storage.installations.get({ orgId, id: connection.installationId });\n if (!installation) throw new Error('Source-control installation not found for this organization.');\n const host = installation.providerMetadata.host;\n if (typeof host !== 'string' || !host) throw new Error('GitLab installation is missing its instance host.');\n return {\n context,\n projectRepository,\n connection,\n installation,\n repository,\n host: normalizeGitLabHost(host),\n orgId,\n userId,\n };\n}\n\nasync function requireGitLabSessionTarget(\n requestContext: RequestContext,\n gitlab: GitLabIntegrationBase,\n): Promise<SessionTarget> {\n const target = await resolveSessionTarget(requestContext, gitlab);\n if (!target) throw new Error('The active session is not backed by a GitLab repository.');\n return target;\n}\n\nasync function verifyMergeRequest(target: SessionTarget, iid: number, gitlab: GitLabIntegrationBase): Promise<void> {\n const repositoryTarget = await gitlab.versionControl.getRepositoryTarget({\n orgId: target.orgId,\n repositoryId: target.repository.id,\n });\n const mergeRequest = await gitlab.versionControl.getPullRequest({ ...repositoryTarget, pullRequestId: String(iid) });\n if (!mergeRequest) throw new Error(`Merge request !${iid} was not found in ${target.repository.slug}.`);\n const parsed = parseMergeRequestUrl(mergeRequest.url);\n if (\n parsed &&\n (parsed.host !== target.host || normalizePath(parsed.projectPath) !== normalizePath(target.repository.slug))\n ) {\n throw new Error('Merge request project does not match the active project repository.');\n }\n}\n\nfunction subscriptionInput(target: SessionTarget, iid: number) {\n return {\n orgId: target.orgId,\n host: target.host,\n projectId: target.repository.externalId,\n projectPath: target.repository.slug,\n projectRepositoryId: target.projectRepository.id,\n installationExternalId: target.installation.externalId,\n changeRequestId: String(iid),\n sessionId: target.context.session.id,\n ownerId: target.context.session.ownerId,\n resourceId: target.connection.factoryProjectId,\n threadId: target.context.threadId!,\n source: 'explicit-tool' as GitLabSignalSubscriptionSource,\n subscribedByUserId: target.userId,\n };\n}\n\nexport async function subscribeCurrentSessionToMergeRequest(\n requestContext: RequestContext,\n mergeRequest: number | string,\n source: GitLabSignalSubscriptionSource,\n gitlab: GitLabIntegrationBase,\n): Promise<number | undefined> {\n // The auto path observes every successful change-request creation in every\n // session, including GitHub-project sessions where a GitLab subscription can\n // never apply. Skip silently there; only the explicit tool should surface\n // \"this session cannot subscribe\" as an error.\n if (source === 'auto-create-change-request') {\n if (!isRepositorySession(requestContext)) return undefined;\n const target = await resolveSessionTarget(requestContext, gitlab);\n if (!target) return undefined;\n const iid = parseMergeRequest(mergeRequest, target);\n await verifyMergeRequest(target, iid, gitlab);\n await subscribeToMergeRequest({ ...subscriptionInput(target, iid), source }, gitlab.integrationStorage);\n return iid;\n }\n const target = await requireGitLabSessionTarget(requestContext, gitlab);\n const iid = parseMergeRequest(mergeRequest, target);\n await verifyMergeRequest(target, iid, gitlab);\n await subscribeToMergeRequest({ ...subscriptionInput(target, iid), source }, gitlab.integrationStorage);\n return iid;\n}\n\nexport async function unsubscribeCurrentSessionFromMergeRequest(\n requestContext: RequestContext,\n mergeRequest: number | string,\n gitlab: GitLabIntegrationBase,\n): Promise<number> {\n const target = await requireGitLabSessionTarget(requestContext, gitlab);\n const iid = parseMergeRequest(mergeRequest, target);\n await unsubscribeFromMergeRequest(subscriptionInput(target, iid), gitlab.integrationStorage);\n return iid;\n}\n\nexport function createGitLabSubscriptionTools(requestContext: RequestContext, gitlab: GitLabIntegrationBase) {\n if (!isRepositorySession(requestContext)) return {};\n\n return {\n gitlab_subscribe_mr: createTool({\n id: 'gitlab_subscribe_mr',\n description:\n 'Subscribe this thread to GitLab merge request activity. You usually do not need this tool: successful source_control_create_change_request calls subscribe automatically. Use it for an existing MR or to recover when automatic subscription did not occur. Closed or merged MRs are unsubscribed automatically. Accepts an MR IID or canonical URL for the active project.',\n inputSchema: mergeRequestInputSchema,\n execute: async ({ mergeRequest }) => {\n const iid = await subscribeCurrentSessionToMergeRequest(requestContext, mergeRequest, 'explicit-tool', gitlab);\n return { subscribed: true, mergeRequestIid: iid };\n },\n }),\n gitlab_unsubscribe_mr: createTool({\n id: 'gitlab_unsubscribe_mr',\n description:\n 'Manually unsubscribe this thread from GitLab merge request activity. You usually do not need this tool because closed or merged MRs are unsubscribed automatically. Use it to stop notifications before then. Accepts an MR IID or canonical URL for the active project.',\n inputSchema: mergeRequestInputSchema,\n execute: async ({ mergeRequest }) => {\n const iid = await unsubscribeCurrentSessionFromMergeRequest(requestContext, mergeRequest, gitlab);\n return { subscribed: false, mergeRequestIid: iid };\n },\n }),\n };\n}\n\n/**\n * The merge request URL a successful provider-neutral change-request creation\n * reported, when that URL is a GitLab one. Anything else is not ours to observe.\n */\nexport function parseCreatedMergeRequest(context: {\n toolName: string;\n input: unknown;\n output?: unknown;\n error?: unknown;\n}): string | undefined {\n if (context.toolName !== 'source_control_create_change_request' || context.error) return undefined;\n const url = (context.output as { url?: unknown } | undefined)?.url;\n if (typeof url !== 'string' || !parseMergeRequestUrl(url)) return undefined;\n return url.trim().replace(/\\/$/, '');\n}\n"],"mappings":";;;;;;AAmBA,MAAM,oBAAoB;AAE1B,SAAS,cAAc,gBAAoD;CACzE,OAAO,qBAAqB,8BAA8B,cAAc,CAAC;AAC3E;AAEA,SAAS,aAAa,gBAAoD;CACxE,OAAO,oBAAoB,8BAA8B,cAAc,CAAC;AAC1E;AAEA,MAAM,0BAA0B,EAAE,OAAO,EACvC,cAAc,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EACxE,CAAC;AAaD,SAAS,cAAc,OAAuB;CAC5C,OAAO,MAAM,QAAQ,cAAc,EAAE,CAAC,CAAC,YAAY;AACrD;AAEA,SAAgB,qBAAqB,KAA6E;CAChH,MAAM,QAAQ,IAAI,KAAK,CAAC,CAAC,MAAM,iBAAiB;CAChD,IAAI,CAAC,OAAO,OAAO,KAAA;CACnB,MAAM,MAAM,OAAO,MAAM,EAAE;CAC3B,IAAI,CAAC,OAAO,cAAc,GAAG,KAAK,MAAM,GAAG,OAAO,KAAA;CAClD,OAAO;EAAE,MAAM,oBAAoB,MAAM,EAAG;EAAG,aAAa,MAAM,EAAE,CAAE,QAAQ,QAAQ,EAAE;EAAG;CAAI;AACjG;AAEA,SAAS,kBAAkB,OAAwB,QAA+B;CAChF,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,IAAI,QAAQ,KAAK,KAAK,GAAG,OAAO,OAAO,KAAK;CAC5C,MAAM,SAAS,qBAAqB,KAAK;CACzC,IACE,CAAC,UACD,OAAO,SAAS,OAAO,QACvB,cAAc,OAAO,WAAW,MAAM,cAAc,OAAO,WAAW,IAAI,GAE1E,MAAM,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AAO,iBAAiB,MAD3B,0CAA0C,gBAAgB,cAAc,MAAM;IAC/C;GACnD;EACF,CAAC;CACH;AACF;;;;;AAMA,SAAgB,yBAAyB,SAKlB;CACrB,IAAI,QAAQ,aAAa,0CAA0C,QAAQ,OAAO,OAAO,KAAA;CACzF,MAAM,MAAO,QAAQ,QAA0C;CAC/D,IAAI,OAAO,QAAQ,YAAY,CAAC,qBAAqB,GAAG,GAAG,OAAO,KAAA;CAClE,OAAO,IAAI,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;AACrC"}
|
|
1
|
+
{"version":3,"file":"session-subscriptions.js","names":[],"sources":["../../../src/integrations/gitlab/session-subscriptions.ts"],"sourcesContent":["import type { AgentControllerRequestContext } from '@mastra/core/agent-controller';\nimport type { RequestContext } from '@mastra/core/request-context';\nimport { createTool } from '@mastra/core/tools';\nimport { z } from 'zod';\n\nimport { getFactoryAuthOrgId, getFactoryAuthUserFromContext, getFactoryAuthUserId } from '../../auth.js';\nimport type {\n ProjectRepository,\n ProjectSourceControlConnection,\n SourceControlInstallation,\n SourceControlRepository,\n} from '../../storage/domains/source-control/base.js';\nimport type { GitLabIntegrationBase } from './integration.js';\nimport { normalizeGitLabHost } from './integration.js';\nimport { subscribeToMergeRequest, unsubscribeFromMergeRequest } from './subscriptions.js';\nimport type { GitLabSignalSubscriptionSource } from './subscriptions.js';\n\ntype RepositorySessionState = { factoryProjectId?: string; projectRepositoryId?: string };\n\nconst MERGE_REQUEST_URL = /^https?:\\/\\/([^/\\s]+)\\/(.+?)\\/-\\/merge_requests\\/(\\d+)\\/?$/i;\n\nfunction sessionUserId(requestContext: RequestContext): string | undefined {\n return getFactoryAuthUserId(getFactoryAuthUserFromContext(requestContext));\n}\n\nfunction sessionOrgId(requestContext: RequestContext): string | undefined {\n return getFactoryAuthOrgId(getFactoryAuthUserFromContext(requestContext));\n}\n\nconst mergeRequestInputSchema = z.object({\n mergeRequest: z.union([z.number().int().positive(), z.string().min(1)]),\n});\n\ninterface SessionTarget {\n context: AgentControllerRequestContext<RepositorySessionState>;\n projectRepository: ProjectRepository;\n connection: ProjectSourceControlConnection;\n installation: SourceControlInstallation;\n repository: SourceControlRepository;\n host: string;\n orgId: string;\n userId: string;\n}\n\nfunction normalizePath(value: string): string {\n return value.replace(/^\\/+|\\/+$/g, '').toLowerCase();\n}\n\nexport function parseMergeRequestUrl(url: string): { host: string; projectPath: string; iid: number } | undefined {\n const match = url.trim().match(MERGE_REQUEST_URL);\n if (!match) return undefined;\n const iid = Number(match[3]);\n if (!Number.isSafeInteger(iid) || iid < 1) return undefined;\n return { host: normalizeGitLabHost(match[1]!), projectPath: match[2]!.replace(/\\/+$/, ''), iid };\n}\n\nfunction parseMergeRequest(value: number | string, target: SessionTarget): number {\n if (typeof value === 'number') return value;\n if (/^\\d+$/.test(value)) return Number(value);\n const parsed = parseMergeRequestUrl(value);\n if (\n !parsed ||\n parsed.host !== target.host ||\n normalizePath(parsed.projectPath) !== normalizePath(target.repository.slug)\n ) {\n throw new Error(`Merge request must belong to ${target.host}/${target.repository.slug}.`);\n }\n return parsed.iid;\n}\n\n/**\n * Whether the current request comes from a session that merge-request\n * subscriptions can ever apply to: an authenticated org user on a factory\n * session with an active thread. Mirrors the GitHub gate; whether the\n * session's repository is GitLab-linked is only known after a storage read,\n * so the entry points verify that and fail loudly for the explicit tools.\n */\nfunction isRepositorySession(requestContext: RequestContext): boolean {\n const context = requestContext.get('controller') as AgentControllerRequestContext<RepositorySessionState> | undefined;\n return Boolean(\n context?.threadId &&\n context.getState().factoryProjectId &&\n sessionOrgId(requestContext) &&\n sessionUserId(requestContext),\n );\n}\n\nasync function resolveSessionTarget(\n requestContext: RequestContext,\n gitlab: GitLabIntegrationBase,\n): Promise<SessionTarget | undefined> {\n const context = requestContext.get('controller') as AgentControllerRequestContext<RepositorySessionState> | undefined;\n const orgId = sessionOrgId(requestContext);\n const userId = sessionUserId(requestContext);\n if (!context || !context.threadId || !context.getState().factoryProjectId || !orgId || !userId) {\n throw new Error('GitLab subscriptions require an authenticated repository session with an active thread.');\n }\n const storage = gitlab.sourceControlStorage;\n if (!storage) throw new Error('GitLab source control is unavailable.');\n\n // Merge requests stay bound to the link the session is filed under: the\n // controller state names it for dispatched sessions, the session row for\n // the rest. A session filed under no link cannot subscribe.\n const projectRepositoryId =\n context.getState().projectRepositoryId ??\n (await storage.sessions.getBySessionId(context.sessionId))?.projectRepositoryId;\n if (!projectRepositoryId) return undefined;\n\n // The handle is scoped to GitLab rows, so a GitHub-linked repository is\n // simply absent here rather than misidentified.\n const projectRepository = await storage.projectRepositories.get({ orgId, id: projectRepositoryId });\n if (!projectRepository) return undefined;\n const connection = await storage.connections.get({ orgId, id: projectRepository.connectionId });\n if (!connection || connection.integrationId !== 'gitlab') return undefined;\n const repository = await storage.repositories.get({ orgId, id: projectRepository.repositoryId });\n if (!repository) throw new Error('Repository not found for this organization.');\n const installation = await storage.installations.get({ orgId, id: connection.installationId });\n if (!installation) throw new Error('Source-control installation not found for this organization.');\n const host = installation.providerMetadata.host;\n if (typeof host !== 'string' || !host) throw new Error('GitLab installation is missing its instance host.');\n return {\n context,\n projectRepository,\n connection,\n installation,\n repository,\n host: normalizeGitLabHost(host),\n orgId,\n userId,\n };\n}\n\nasync function requireGitLabSessionTarget(\n requestContext: RequestContext,\n gitlab: GitLabIntegrationBase,\n): Promise<SessionTarget> {\n const target = await resolveSessionTarget(requestContext, gitlab);\n if (!target) throw new Error('The active session is not backed by a GitLab repository.');\n return target;\n}\n\nasync function verifyMergeRequest(target: SessionTarget, iid: number, gitlab: GitLabIntegrationBase): Promise<void> {\n const repositoryTarget = await gitlab.versionControl.getRepositoryTarget({\n orgId: target.orgId,\n repositoryId: target.repository.id,\n });\n const mergeRequest = await gitlab.versionControl.getPullRequest({ ...repositoryTarget, pullRequestId: String(iid) });\n if (!mergeRequest) throw new Error(`Merge request !${iid} was not found in ${target.repository.slug}.`);\n const parsed = parseMergeRequestUrl(mergeRequest.url);\n if (\n parsed &&\n (parsed.host !== target.host || normalizePath(parsed.projectPath) !== normalizePath(target.repository.slug))\n ) {\n throw new Error('Merge request project does not match the active project repository.');\n }\n}\n\nfunction subscriptionInput(target: SessionTarget, iid: number) {\n return {\n orgId: target.orgId,\n host: target.host,\n projectId: target.repository.externalId,\n projectPath: target.repository.slug,\n projectRepositoryId: target.projectRepository.id,\n installationExternalId: target.installation.externalId,\n changeRequestId: String(iid),\n sessionId: target.context.session.id,\n ownerId: target.context.session.ownerId,\n resourceId: target.connection.factoryProjectId,\n threadId: target.context.threadId!,\n source: 'explicit-tool' as GitLabSignalSubscriptionSource,\n subscribedByUserId: target.userId,\n };\n}\n\nexport async function subscribeCurrentSessionToMergeRequest(\n requestContext: RequestContext,\n mergeRequest: number | string,\n source: GitLabSignalSubscriptionSource,\n gitlab: GitLabIntegrationBase,\n): Promise<number | undefined> {\n // The auto path observes every successful change-request creation in every\n // session, including GitHub-project sessions where a GitLab subscription can\n // never apply. Skip silently there; only the explicit tool should surface\n // \"this session cannot subscribe\" as an error.\n if (source === 'auto-create-change-request') {\n if (!isRepositorySession(requestContext)) return undefined;\n const target = await resolveSessionTarget(requestContext, gitlab);\n if (!target) return undefined;\n const iid = parseMergeRequest(mergeRequest, target);\n await verifyMergeRequest(target, iid, gitlab);\n await subscribeToMergeRequest({ ...subscriptionInput(target, iid), source }, gitlab.integrationStorage);\n return iid;\n }\n const target = await requireGitLabSessionTarget(requestContext, gitlab);\n const iid = parseMergeRequest(mergeRequest, target);\n await verifyMergeRequest(target, iid, gitlab);\n await subscribeToMergeRequest({ ...subscriptionInput(target, iid), source }, gitlab.integrationStorage);\n return iid;\n}\n\nexport async function unsubscribeCurrentSessionFromMergeRequest(\n requestContext: RequestContext,\n mergeRequest: number | string,\n gitlab: GitLabIntegrationBase,\n): Promise<number> {\n const target = await requireGitLabSessionTarget(requestContext, gitlab);\n const iid = parseMergeRequest(mergeRequest, target);\n await unsubscribeFromMergeRequest(subscriptionInput(target, iid), gitlab.integrationStorage);\n return iid;\n}\n\nexport function createGitLabSubscriptionTools(requestContext: RequestContext, gitlab: GitLabIntegrationBase) {\n if (!isRepositorySession(requestContext)) return {};\n\n return {\n gitlab_subscribe_mr: createTool({\n id: 'gitlab_subscribe_mr',\n description:\n 'Subscribe this thread to GitLab merge request activity. MRs created with source_control_create_change_request are subscribed automatically. Call this when you start working on an existing MR you did not create in this thread (reviewing it, fixing merge conflicts, addressing review comments, fixing CI, pushing to its branch), or to recover when automatic subscription did not occur. Closed or merged MRs are unsubscribed automatically. Accepts an MR IID or canonical URL for the active project.',\n inputSchema: mergeRequestInputSchema,\n execute: async ({ mergeRequest }) => {\n const iid = await subscribeCurrentSessionToMergeRequest(requestContext, mergeRequest, 'explicit-tool', gitlab);\n return { subscribed: true, mergeRequestIid: iid };\n },\n }),\n gitlab_unsubscribe_mr: createTool({\n id: 'gitlab_unsubscribe_mr',\n description:\n 'Manually unsubscribe this thread from GitLab merge request activity. You usually do not need this tool because closed or merged MRs are unsubscribed automatically. Use it to stop notifications before then. Accepts an MR IID or canonical URL for the active project.',\n inputSchema: mergeRequestInputSchema,\n execute: async ({ mergeRequest }) => {\n const iid = await unsubscribeCurrentSessionFromMergeRequest(requestContext, mergeRequest, gitlab);\n return { subscribed: false, mergeRequestIid: iid };\n },\n }),\n };\n}\n\n/**\n * The merge request URL a successful provider-neutral change-request creation\n * reported, when that URL is a GitLab one. Anything else is not ours to observe.\n */\nexport function parseCreatedMergeRequest(context: {\n toolName: string;\n input: unknown;\n output?: unknown;\n error?: unknown;\n}): string | undefined {\n if (context.toolName !== 'source_control_create_change_request' || context.error) return undefined;\n const url = (context.output as { url?: unknown } | undefined)?.url;\n if (typeof url !== 'string' || !parseMergeRequestUrl(url)) return undefined;\n return url.trim().replace(/\\/$/, '');\n}\n"],"mappings":";;;;;;AAmBA,MAAM,oBAAoB;AAE1B,SAAS,cAAc,gBAAoD;CACzE,OAAO,qBAAqB,8BAA8B,cAAc,CAAC;AAC3E;AAEA,SAAS,aAAa,gBAAoD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AC,QAAQ,OAAO,EAAE;AACrC"}
|
|
@@ -35,6 +35,7 @@ export interface SessionLinkTarget {
|
|
|
35
35
|
*/
|
|
36
36
|
export declare function sessionLink({ threadId, sessionId, resourceId, factoryProjectId, }: SessionLinkTarget): string | undefined;
|
|
37
37
|
export declare function modelSettingsLink(factoryProjectId: string): string | undefined;
|
|
38
|
+
export declare function memorySettingsLink(factoryProjectId: string): string | undefined;
|
|
38
39
|
/** `VOICE_INPUT_ANCHOR` in factory-ui's `settingsSections.ts`; the voice section scrolls itself into view on this hash. */
|
|
39
40
|
export declare function voiceSettingsLink(factoryProjectId: string): string | undefined;
|
|
40
41
|
//# sourceMappingURL=channel-reply-processor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-reply-processor.d.ts","sourceRoot":"","sources":["../../../src/integrations/slack/channel-reply-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAQ/E,eAAO,MAAM,kBAAkB,wBAAmB,CAAC;AAanD;;;;;;;;;;;;GAYG;AACH,qBAAa,4BAA6B,YAAW,SAAS;IAC5D,QAAQ,CAAC,EAAE,2BAAM;IAEjB,gBAAgB,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,oBAAoB;;kBA+B5E;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,UAAU,EACV,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAQxC;AAED,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE9E;AAED,2HAA2H;AAC3H,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG9E"}
|
|
1
|
+
{"version":3,"file":"channel-reply-processor.d.ts","sourceRoot":"","sources":["../../../src/integrations/slack/channel-reply-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAQ/E,eAAO,MAAM,kBAAkB,wBAAmB,CAAC;AAanD;;;;;;;;;;;;GAYG;AACH,qBAAa,4BAA6B,YAAW,SAAS;IAC5D,QAAQ,CAAC,EAAE,2BAAM;IAEjB,gBAAgB,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,oBAAoB;;kBA+B5E;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,SAAS,EACT,UAAU,EACV,gBAAgB,GACjB,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,CAQxC;AAED,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE9E;AAED,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/E;AAED,2HAA2H;AAC3H,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG9E"}
|
|
@@ -70,11 +70,14 @@ function sessionLink({ threadId, sessionId, resourceId, factoryProjectId }) {
|
|
|
70
70
|
function modelSettingsLink(factoryProjectId) {
|
|
71
71
|
return factorySettingsUrl(factoryProjectId, "models");
|
|
72
72
|
}
|
|
73
|
+
function memorySettingsLink(factoryProjectId) {
|
|
74
|
+
return factorySettingsUrl(factoryProjectId, "memory");
|
|
75
|
+
}
|
|
73
76
|
/** `VOICE_INPUT_ANCHOR` in factory-ui's `settingsSections.ts`; the voice section scrolls itself into view on this hash. */
|
|
74
77
|
function voiceSettingsLink(factoryProjectId) {
|
|
75
78
|
const models = modelSettingsLink(factoryProjectId);
|
|
76
79
|
return models && `${models}#voice-input`;
|
|
77
80
|
}
|
|
78
|
-
export { FactoryChannelReplyProcessor, SESSION_LINK_LABEL, modelSettingsLink, sessionLink, voiceSettingsLink };
|
|
81
|
+
export { FactoryChannelReplyProcessor, SESSION_LINK_LABEL, memorySettingsLink, modelSettingsLink, sessionLink, voiceSettingsLink };
|
|
79
82
|
|
|
80
83
|
//# sourceMappingURL=channel-reply-processor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel-reply-processor.js","names":[],"sources":["../../../src/integrations/slack/channel-reply-processor.ts"],"sourcesContent":["import type { ProcessInputStepArgs, Processor } from '@mastra/core/processors';\nimport { factorySettingsUrl, factoryUiOrigin } from '../../links.js';\n\n/** Mirrors `REPLY_TOOL_NAME` in `reply-tool.ts`, which imports this module. */\nconst REPLY_TOOL = 'reply_in_thread';\n\nconst ID = 'factory-channel-reply';\n\nexport const SESSION_LINK_LABEL = 'Open session ↗';\n\n/**\n * Chat surfaces show what the agent writes as-is, so a bare `#28467`,\n * `FACT-526` or `52db47cd` is a dead end for the reader. Every channel run\n * gets this, whether it speaks in reply text or through the reply tool.\n */\nconst LINK_REFERENCES = [\n 'Write every pull request, issue, commit, Linear ticket or other reference you mention in the thread as a markdown link to its page, with the ID as plain link text: [#28467](https://github.com/<owner>/<repo>/pull/28467), [52db47cd](https://github.com/<owner>/<repo>/commit/52db47cd), [FACT-526](<the ticket URL>). Never leave one as a bare ID or wrap it in code formatting.',\n \"Build GitHub and GitLab links from the repository the reference belongs to, from the repositories listed in your environment or a tool result; with more than one repository, don't assume which one a bare number belongs to. Build Linear links from the workspace URL pattern in the `linear_get_issue` tool description, or from a URL a tool returned. Don't guess a URL; leave a reference unlinked only when you can't work out its URL.\",\n 'Link Factory work items and sessions the same way, with the `url` the Factory tools return: [#123](<item url>). When something needs a person, ask them for it here and link the item; only send them to the web UI when the channel cannot do it, and then link the exact page.',\n].join('\\n');\n\n/**\n * Tells the agent how to open a reply when the run came in over a chat\n * channel (Slack, …): acknowledge a job in one line that names it — \"On it —\n * sleeping 30s, then running the echo\" — before starting, so the sender sees\n * a task-specific first message rather than a silent typing status until the\n * first tool finishes. The channel driver posts that opener on its own before\n * the tool widget, so the instruction and the rendering agree. The session\n * link is not the model's job: `FactoryChannelSessionLinkProcessor` appends it\n * to the first reply of a new session, so it is there whether or not the\n * model judged the request worth an opener. A run on a Slack-linked session\n * that didn't start from Slack gets a shorter note on when to post there; runs\n * with no channel at all (Studio, API, boards) get nothing.\n */\nexport class FactoryChannelReplyProcessor implements Processor {\n readonly id = ID;\n\n processInputStep({ messageList, requestContext, tools }: ProcessInputStepArgs) {\n if (!requestContext?.get('channel')) {\n // A run on a Slack-linked session that didn't start from a Slack message\n // (a web prompt, a woken run) still has the reply tool; core's channel\n // prompt says the thread is linked, this says how to use it.\n if (!tools || !(REPLY_TOOL in tools)) return undefined;\n messageList.addSystem(\n {\n role: 'system',\n content: `Post to that thread with \\`${REPLY_TOOL}\\`. This request came from outside it, so don't post an opener or progress there; post the outcome when the people in the thread asked for this work or are waiting on it, or when you're asked to. Don't write a note about what you posted. When you open a pull request, its link is posted to this thread for you, and again when it merges, so don't post the link yourself.\\n${LINK_REFERENCES}`,\n },\n ID,\n );\n return { messageList };\n }\n // With reply text hidden the thread only sees what the reply tool posts,\n // so the opener advice becomes advice about when to call it.\n const content =\n tools && REPLY_TOOL in tools\n ? [\n `Only messages you send with \\`${REPLY_TOOL}\\` reach this thread; your other text stays in the session. Don't write a note about what you posted. After a reply, either keep working or end your turn with an empty message; any text you write after posting is wasted.`,\n `When a request will take tools or more than a moment, post one short line first that says what you are about to do, then do the work and post the outcome when you finish — not a replay of the steps.`,\n `Post again in between only when you need an answer or have news the people in the thread would want. When a message that doesn't mention you needs nothing from you, don't call it.`,\n `When you open a pull request, its link is posted to this thread for you, and again when it merges, so don't post the link yourself.`,\n ]\n : [\n 'When a request will take tools or more than a moment to answer, reply first with one short line that says what you are about to do — \"On it — <the task in a few words>.\" — then do the work; the opener posts as its own message before any progress is shown. Give direct answers and trivial replies without an opener.',\n 'Finish with the outcome, not a replay of the steps.',\n ];\n messageList.addSystem({ role: 'system', content: [...content, LINK_REFERENCES].join('\\n') }, ID);\n return { messageList };\n }\n}\n\nexport interface SessionLinkTarget {\n threadId: string;\n sessionId: string;\n resourceId: string;\n factoryProjectId?: string;\n}\n\n/**\n * The web URL for a session, or undefined without a public origin. Same\n * routes the Factory UI navigates to: a repo-backed thread's Factory session\n * id is the workspace segment; chat-only threads keep the literal `channel`\n * segment and name their session in the query; a session with no factory\n * falls back to the factory-agnostic /threads/ redirect, which forwards the\n * query through.\n */\nexport function sessionLink({\n threadId,\n sessionId,\n resourceId,\n factoryProjectId,\n}: SessionLinkTarget): string | undefined {\n const origin = factoryUiOrigin();\n if (!origin) return undefined;\n const isChatOnly = resourceId.startsWith('channel:');\n const sessionParam = `?sessionId=${encodeURIComponent(sessionId)}`;\n if (!factoryProjectId) return `${origin}/threads/${encodeURIComponent(threadId)}${sessionParam}`;\n const workspaceSegment = isChatOnly ? 'channel' : encodeURIComponent(sessionId);\n return `${origin}/factories/${encodeURIComponent(factoryProjectId)}/workspaces/${workspaceSegment}/threads/${encodeURIComponent(threadId)}${isChatOnly ? sessionParam : ''}`;\n}\n\nexport function modelSettingsLink(factoryProjectId: string): string | undefined {\n return factorySettingsUrl(factoryProjectId, 'models');\n}\n\n/** `VOICE_INPUT_ANCHOR` in factory-ui's `settingsSections.ts`; the voice section scrolls itself into view on this hash. */\nexport function voiceSettingsLink(factoryProjectId: string): string | undefined {\n const models = modelSettingsLink(factory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8C;CAC9E,MAAM,SAAS,kBAAkB,gBAAgB;CACjD,OAAO,UAAU,GAAG,OAAO;AAC7B"}
|
|
1
|
+
{"version":3,"file":"channel-reply-processor.js","names":[],"sources":["../../../src/integrations/slack/channel-reply-processor.ts"],"sourcesContent":["import type { ProcessInputStepArgs, Processor } from '@mastra/core/processors';\nimport { factorySettingsUrl, factoryUiOrigin } from '../../links.js';\n\n/** Mirrors `REPLY_TOOL_NAME` in `reply-tool.ts`, which imports this module. */\nconst REPLY_TOOL = 'reply_in_thread';\n\nconst ID = 'factory-channel-reply';\n\nexport const SESSION_LINK_LABEL = 'Open session ↗';\n\n/**\n * Chat surfaces show what the agent writes as-is, so a bare `#28467`,\n * `FACT-526` or `52db47cd` is a dead end for the reader. Every channel run\n * gets this, whether it speaks in reply text or through the reply tool.\n */\nconst LINK_REFERENCES = [\n 'Write every pull request, issue, commit, Linear ticket or other reference you mention in the thread as a markdown link to its page, with the ID as plain link text: [#28467](https://github.com/<owner>/<repo>/pull/28467), [52db47cd](https://github.com/<owner>/<repo>/commit/52db47cd), [FACT-526](<the ticket URL>). Never leave one as a bare ID or wrap it in code formatting.',\n \"Build GitHub and GitLab links from the repository the reference belongs to, from the repositories listed in your environment or a tool result; with more than one repository, don't assume which one a bare number belongs to. Build Linear links from the workspace URL pattern in the `linear_get_issue` tool description, or from a URL a tool returned. Don't guess a URL; leave a reference unlinked only when you can't work out its URL.\",\n 'Link Factory work items and sessions the same way, with the `url` the Factory tools return: [#123](<item url>). When something needs a person, ask them for it here and link the item; only send them to the web UI when the channel cannot do it, and then link the exact page.',\n].join('\\n');\n\n/**\n * Tells the agent how to open a reply when the run came in over a chat\n * channel (Slack, …): acknowledge a job in one line that names it — \"On it —\n * sleeping 30s, then running the echo\" — before starting, so the sender sees\n * a task-specific first message rather than a silent typing status until the\n * first tool finishes. The channel driver posts that opener on its own before\n * the tool widget, so the instruction and the rendering agree. The session\n * link is not the model's job: `FactoryChannelSessionLinkProcessor` appends it\n * to the first reply of a new session, so it is there whether or not the\n * model judged the request worth an opener. A run on a Slack-linked session\n * that didn't start from Slack gets a shorter note on when to post there; runs\n * with no channel at all (Studio, API, boards) get nothing.\n */\nexport class FactoryChannelReplyProcessor implements Processor {\n readonly id = ID;\n\n processInputStep({ messageList, requestContext, tools }: ProcessInputStepArgs) {\n if (!requestContext?.get('channel')) {\n // A run on a Slack-linked session that didn't start from a Slack message\n // (a web prompt, a woken run) still has the reply tool; core's channel\n // prompt says the thread is linked, this says how to use it.\n if (!tools || !(REPLY_TOOL in tools)) return undefined;\n messageList.addSystem(\n {\n role: 'system',\n content: `Post to that thread with \\`${REPLY_TOOL}\\`. This request came from outside it, so don't post an opener or progress there; post the outcome when the people in the thread asked for this work or are waiting on it, or when you're asked to. Don't write a note about what you posted. When you open a pull request, its link is posted to this thread for you, and again when it merges, so don't post the link yourself.\\n${LINK_REFERENCES}`,\n },\n ID,\n );\n return { messageList };\n }\n // With reply text hidden the thread only sees what the reply tool posts,\n // so the opener advice becomes advice about when to call it.\n const content =\n tools && REPLY_TOOL in tools\n ? [\n `Only messages you send with \\`${REPLY_TOOL}\\` reach this thread; your other text stays in the session. Don't write a note about what you posted. After a reply, either keep working or end your turn with an empty message; any text you write after posting is wasted.`,\n `When a request will take tools or more than a moment, post one short line first that says what you are about to do, then do the work and post the outcome when you finish — not a replay of the steps.`,\n `Post again in between only when you need an answer or have news the people in the thread would want. When a message that doesn't mention you needs nothing from you, don't call it.`,\n `When you open a pull request, its link is posted to this thread for you, and again when it merges, so don't post the link yourself.`,\n ]\n : [\n 'When a request will take tools or more than a moment to answer, reply first with one short line that says what you are about to do — \"On it — <the task in a few words>.\" — then do the work; the opener posts as its own message before any progress is shown. Give direct answers and trivial replies without an opener.',\n 'Finish with the outcome, not a replay of the steps.',\n ];\n messageList.addSystem({ role: 'system', content: [...content, LINK_REFERENCES].join('\\n') }, ID);\n return { messageList };\n }\n}\n\nexport interface SessionLinkTarget {\n threadId: string;\n sessionId: string;\n resourceId: string;\n factoryProjectId?: string;\n}\n\n/**\n * The web URL for a session, or undefined without a public origin. Same\n * routes the Factory UI navigates to: a repo-backed thread's Factory session\n * id is the workspace segment; chat-only threads keep the literal `channel`\n * segment and name their session in the query; a session with no factory\n * falls back to the factory-agnostic /threads/ redirect, which forwards the\n * query through.\n */\nexport function sessionLink({\n threadId,\n sessionId,\n resourceId,\n factoryProjectId,\n}: SessionLinkTarget): string | undefined {\n const origin = factoryUiOrigin();\n if (!origin) return undefined;\n const isChatOnly = resourceId.startsWith('channel:');\n const sessionParam = `?sessionId=${encodeURIComponent(sessionId)}`;\n if (!factoryProjectId) return `${origin}/threads/${encodeURIComponent(threadId)}${sessionParam}`;\n const workspaceSegment = isChatOnly ? 'channel' : encodeURIComponent(sessionId);\n return `${origin}/factories/${encodeURIComponent(factoryProjectId)}/workspaces/${workspaceSegment}/threads/${encodeURIComponent(threadId)}${isChatOnly ? sessionParam : ''}`;\n}\n\nexport function modelSettingsLink(factoryProjectId: string): string | undefined {\n return factorySettingsUrl(factoryProjectId, 'models');\n}\n\nexport function memorySettingsLink(factoryProjectId: string): string | undefined {\n return factorySettingsUrl(factoryProjectId, 'memory');\n}\n\n/** `VOICE_INPUT_ANCHOR` in factory-ui's `settingsSections.ts`; the voice section scrolls itself into view on this hash. */\nexport function voiceSettingsLink(factoryProjectId: string): string | undefined {\n const models = modelSettingsLink(factoryProjectId);\n return models && `${models}#voice-input`;\n}\n"],"mappings":";;;AAIA,MAAM,aAAa;AAEnB,MAAM,KAAK;AAEX,MAAa,qBAAqB;;;;;;AAOlC,MAAM,kBAAkB;CACtB;CACA;CACA;AACF,CAAC,CAAC,KAAK,IAAI;;;;;;;;;;;;;;AAeX,IAAa,+BAAb,MAA+D;CAC7D,KAAc;CAEd,iBAAiB,EAAE,aAAa,gBAAgB,SAA+B;EAC7E,IAAI,CAAC,gBAAgB,IAAI,SAAS,GAAG;GAInC,IAAI,CAAC,SAAS,EAAE,cAAc,QAAQ,OAAO,KAAA;GAC7C,YAAY,UACV;IACE,MAAM;IACN,SAAS,8BAA8B,WAAW,qXAAqX;GACza,GACA,EACF;GACA,OAAO,EAAE,YAAY;EACvB;EAGA,MAAM,UACJ,SAAS,cAAc,QACnB;GACE,iCAAiC,WAAW;GAC5C;GACA;GACA;EACF,IACA,CACE,gUACA,qDACF;EACN,YAAY,UAAU;GAAE,MAAM;GAAU,SAAS,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC,KAAK,IAAI;EAAE,GAAG,EAAE;EAC/F,OAAO,EAAE,YAAY;CACvB;AACF;;;;;;;;;AAiBA,SAAgB,YAAY,EAC1B,UACA,WACA,YACA,oBACwC;CACxC,MAAM,SAAS,gBAAgB;CAC/B,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,MAAM,aAAa,WAAW,WAAW,UAAU;CACnD,MAAM,eAAe,cAAc,mBAAmB,SAAS;CAC/D,IAAI,CAAC,kBAAkB,OAAO,GAAG,OAAO,WAAW,mBAAmB,QAAQ,IAAI;CAElF,OAAO,GAAG,OAAO,aAAa,mBAAmB,gBAAgB,EAAE,cAD1C,aAAa,YAAY,mBAAmB,SAAS,EACoB,WAAW,mBAAmB,QAAQ,IAAI,aAAa,eAAe;AAC1K;AAEA,SAAgB,kBAAkB,kBAA8C;CAC9E,OAAO,mBAAmB,kBAAkB,QAAQ;AACtD;AAEA,SAAgB,mBAAmB,kBAA8C;CAC/E,OAAO,mBAAmB,kBAAkB,QAAQ;AACtD;;AAGA,SAAgB,kBAAkB,kBAA8C;CAC9E,MAAM,SAAS,kBAAkB,gBAAgB;CACjD,OAAO,UAAU,GAAG,OAAO;AAC7B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFactorySessionScope } from "../../rules/binding-context.js";
|
|
2
2
|
import { describeRunError } from "../../run-error.js";
|
|
3
3
|
import { runCredential } from "../../session/reply-credential-processor.js";
|
|
4
|
-
import { modelSettingsLink } from "./channel-reply-processor.js";
|
|
4
|
+
import { memorySettingsLink, modelSettingsLink } from "./channel-reply-processor.js";
|
|
5
5
|
import { sessionLinkFromRequest } from "./channel-session-link-processor.js";
|
|
6
6
|
import { providerRequestId } from "@mastra/core/error";
|
|
7
7
|
import { Actions, Card, CardText, LinkButton } from "chat";
|
|
@@ -35,6 +35,7 @@ function credentialLine(requestContext, failedModel) {
|
|
|
35
35
|
function recoveryLinks(requestContext, recoveries) {
|
|
36
36
|
const factoryProjectId = readFactorySessionScope(requestContext)?.factoryProjectId;
|
|
37
37
|
const settingsUrl = factoryProjectId && modelSettingsLink(factoryProjectId);
|
|
38
|
+
const memoryUrl = factoryProjectId && memorySettingsLink(factoryProjectId);
|
|
38
39
|
const sessionUrl = sessionLinkFromRequest(requestContext);
|
|
39
40
|
const links = recoveries.flatMap((recovery) => {
|
|
40
41
|
switch (recovery) {
|
|
@@ -46,6 +47,10 @@ function recoveryLinks(requestContext, recoveries) {
|
|
|
46
47
|
url: sessionUrl,
|
|
47
48
|
label: "Change model"
|
|
48
49
|
}] : [];
|
|
50
|
+
case "memory_model": return memoryUrl ? [{
|
|
51
|
+
url: memoryUrl,
|
|
52
|
+
label: "Change memory model"
|
|
53
|
+
}] : [];
|
|
49
54
|
case "credits": return [];
|
|
50
55
|
case "continue":
|
|
51
56
|
case "new_session": return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-error-card.js","names":[],"sources":["../../../src/integrations/slack/run-error-card.ts"],"sourcesContent":["import type { AgentControllerRequestContext } from '@mastra/core/agent-controller';\nimport type { ChannelErrorContext } from '@mastra/core/channels';\nimport { providerRequestId } from '@mastra/core/error';\nimport type { RequestContext } from '@mastra/core/request-context';\nimport { Actions, Card, CardText, LinkButton } from 'chat';\n\nimport { readFactorySessionScope } from '../../rules/binding-context.js';\nimport type { RunErrorRecovery } from '../../run-error.js';\nimport { describeRunError } from '../../run-error.js';\nimport { runCredential } from '../../session/reply-credential-processor.js';\nimport { modelSettingsLink } from './channel-reply-processor.js';\nimport { sessionLinkFromRequest } from './channel-session-link-processor.js';\n\nexport function slackRunErrorCard(error: Error, { requestContext }: ChannelErrorContext) {\n const { title, message, recoveries, model } = describeRunError(error);\n const requestId = providerRequestId(error);\n const facts = [model && `Model: ${model}`, requestId && `Request id: ${requestId}`].filter(Boolean).join(' · ');\n const credential = model && recoveries.includes('credentials') ? credentialLine(requestContext, model) : undefined;\n const links = requestContext ? recoveryLinks(requestContext, recoveries) : [];\n return Card({\n title: `❌ ${title}`,\n children: [\n CardText(message),\n ...(credential ? [CardText(credential, { style: 'muted' })] : []),\n ...(facts ? [CardText(facts, { style: 'muted' })] : []),\n ...(links.length ? [Actions(links.map(link => LinkButton(link)))] : []),\n ],\n });\n}\n\n/** Only while the session's model is the one that failed: its provider is what names the credential. */\nfunction credentialLine(requestContext: RequestContext | undefined, failedModel: string): string | undefined {\n const controller = requestContext?.get('controller') as AgentControllerRequestContext | undefined;\n const sessionModelId = controller?.session?.modelId;\n if (!sessionModelId) return undefined;\n const slash = sessionModelId.indexOf('/');\n if (slash <= 0 || (sessionModelId !== failedModel && sessionModelId.slice(slash + 1) !== failedModel))\n return undefined;\n const credential = runCredential(requestContext, sessionModelId.slice(0, slash));\n if (!credential) return undefined;\n return `Runs on ${credential.label} · ${credential.ownerId ? 'Personal credential' : 'Shared by the organization'}`;\n}\n\nfunction recoveryLinks(requestContext: RequestContext, recoveries: RunErrorRecovery[]) {\n const factoryProjectId = readFactorySessionScope(requestContext)?.factoryProjectId;\n const settingsUrl = factoryProjectId && modelSettingsLink(factoryProjectId);\n const sessionUrl = sessionLinkFromRequest(requestContext);\n const links = recoveries.flatMap(recovery => {\n switch (recovery) {\n case 'credentials':\n return settingsUrl ? [{ url: settingsUrl, label: 'Review credentials' }] : [];\n case 'model':\n return sessionUrl ? [{ url: sessionUrl, label: 'Change model' }] : [];\n case 'credits':\n return [];\n // A reply in the thread continues the run; a mention in a new thread starts a new session.\n case 'continue':\n case 'new_session':\n return [];\n }\n });\n if (links.length || !sessionUrl) return links;\n return [{ url: sessionUr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M,mBAAmB,wBAAwB,cAAc,CAAC,EAAE;CAClE,MAAM,cAAc,oBAAoB,kBAAkB,gBAAgB;CAC1E,MAAM,aAAa,uBAAuB,cAAc;CACxD,MAAM,QAAQ,WAAW,SAAQ,aAAY;EAC3C,QAAQ,UAAR;GACE,KAAK,eACH,OAAO,cAAc,CAAC;IAAE,KAAK;IAAa,OAAO;GAAqB,CAAC,IAAI,CAAC;GAC9E,KAAK,SACH,OAAO,aAAa,CAAC;IAAE,KAAK;IAAY,OAAO;GAAe,CAAC,IAAI,CAAC;GACtE,KAAK,WACH,OAAO,CAAC;GAEV,KAAK;GACL,KAAK,eACH,OAAO,CAAC;EACZ;CACF,CAAC;CACD,IAAI,MAAM,UAAU,CAAC,YAAY,OAAO;CACxC,OAAO,CAAC;EAAE,KAAK;EAAY,OAAO;CAAe,CAAC;AACpD"}
|
|
1
|
+
{"version":3,"file":"run-error-card.js","names":[],"sources":["../../../src/integrations/slack/run-error-card.ts"],"sourcesContent":["import type { AgentControllerRequestContext } from '@mastra/core/agent-controller';\nimport type { ChannelErrorContext } from '@mastra/core/channels';\nimport { providerRequestId } from '@mastra/core/error';\nimport type { RequestContext } from '@mastra/core/request-context';\nimport { Actions, Card, CardText, LinkButton } from 'chat';\n\nimport { readFactorySessionScope } from '../../rules/binding-context.js';\nimport type { RunErrorRecovery } from '../../run-error.js';\nimport { describeRunError } from '../../run-error.js';\nimport { runCredential } from '../../session/reply-credential-processor.js';\nimport { memorySettingsLink, modelSettingsLink } from './channel-reply-processor.js';\nimport { sessionLinkFromRequest } from './channel-session-link-processor.js';\n\nexport function slackRunErrorCard(error: Error, { requestContext }: ChannelErrorContext) {\n const { title, message, recoveries, model } = describeRunError(error);\n const requestId = providerRequestId(error);\n const facts = [model && `Model: ${model}`, requestId && `Request id: ${requestId}`].filter(Boolean).join(' · ');\n const credential = model && recoveries.includes('credentials') ? credentialLine(requestContext, model) : undefined;\n const links = requestContext ? recoveryLinks(requestContext, recoveries) : [];\n return Card({\n title: `❌ ${title}`,\n children: [\n CardText(message),\n ...(credential ? [CardText(credential, { style: 'muted' })] : []),\n ...(facts ? [CardText(facts, { style: 'muted' })] : []),\n ...(links.length ? [Actions(links.map(link => LinkButton(link)))] : []),\n ],\n });\n}\n\n/** Only while the session's model is the one that failed: its provider is what names the credential. */\nfunction credentialLine(requestContext: RequestContext | undefined, failedModel: string): string | undefined {\n const controller = requestContext?.get('controller') as AgentControllerRequestContext | undefined;\n const sessionModelId = controller?.session?.modelId;\n if (!sessionModelId) return undefined;\n const slash = sessionModelId.indexOf('/');\n if (slash <= 0 || (sessionModelId !== failedModel && sessionModelId.slice(slash + 1) !== failedModel))\n return undefined;\n const credential = runCredential(requestContext, sessionModelId.slice(0, slash));\n if (!credential) return undefined;\n return `Runs on ${credential.label} · ${credential.ownerId ? 'Personal credential' : 'Shared by the organization'}`;\n}\n\nfunction recoveryLinks(requestContext: RequestContext, recoveries: RunErrorRecovery[]) {\n const factoryProjectId = readFactorySessionScope(requestContext)?.factoryProjectId;\n const settingsUrl = factoryProjectId && modelSettingsLink(factoryProjectId);\n const memoryUrl = factoryProjectId && memorySettingsLink(factoryProjectId);\n const sessionUrl = sessionLinkFromRequest(requestContext);\n const links = recoveries.flatMap(recovery => {\n switch (recovery) {\n case 'credentials':\n return settingsUrl ? [{ url: settingsUrl, label: 'Review credentials' }] : [];\n case 'model':\n return sessionUrl ? [{ url: sessionUrl, label: 'Change model' }] : [];\n case 'memory_model':\n return memoryUrl ? [{ url: memoryUrl, label: 'Change memory model' }] : [];\n case 'credits':\n return [];\n // A reply in the thread continues the run; a mention in a new thread starts a new session.\n case 'continue':\n case 'new_session':\n return [];\n }\n });\n if (links.length || !sessionUrl) return links;\n return [{ url: sessionUrl, label: 'Open session' }];\n}\n"],"mappings":";;;;;;;;AAaA,SAAgB,kBAAkB,OAAc,EAAE,kBAAuC;CACvF,MAAM,EAAE,OAAO,SAAS,YAAY,UAAU,iBAAiB,KAAK;CACpE,MAAM,YAAY,kBAAk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D,MAAM,QAAQ,WAAW,SAAQ,aAAY;EAC3C,QAAQ,UAAR;GACE,KAAK,eACH,OAAO,cAAc,CAAC;IAAE,KAAK;IAAa,OAAO;GAAqB,CAAC,IAAI,CAAC;GAC9E,KAAK,SACH,OAAO,aAAa,CAAC;IAAE,KAAK;IAAY,OAAO;GAAe,CAAC,IAAI,CAAC;GACtE,KAAK,gBACH,OAAO,YAAY,CAAC;IAAE,KAAK;IAAW,OAAO;GAAsB,CAAC,IAAI,CAAC;GAC3E,KAAK,WACH,OAAO,CAAC;GAEV,KAAK;GACL,KAAK,eACH,OAAO,CAAC;EACZ;CACF,CAAC;CACD,IAAI,MAAM,UAAU,CAAC,YAAY,OAAO;CACxC,OAAO,CAAC;EAAE,KAAK;EAAY,OAAO;CAAe,CAAC;AACpD"}
|
package/dist/links.d.ts
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
/** The configured web UI origin, trimmed and without a trailing slash; null when unset or blank. */
|
|
7
7
|
export declare function factoryUiOrigin(raw?: string | undefined): string | null;
|
|
8
8
|
export declare function factoryBoardUrl(factoryProjectId: string, board: string): string | undefined;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* A card, opened as the board opens it on a click: the UI sends the link on to the session the card
|
|
11
|
+
* shows (its current phase's, else its last visited one's), or to a draft that starts one.
|
|
12
|
+
*/
|
|
10
13
|
export declare function factoryWorkItemUrl(input: {
|
|
11
14
|
factoryProjectId: string;
|
|
12
|
-
board: string;
|
|
13
15
|
workItemId: string;
|
|
14
16
|
}): string | undefined;
|
|
15
17
|
export declare function factorySessionUrl(input: {
|
package/dist/links.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAM,GAAG,SAA6C,GAAG,MAAM,GAAG,IAAI,CAE1G;AAYD,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE3F;AAED
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAM,GAAG,SAA6C,GAAG,MAAM,GAAG,IAAI,CAE1G;AAYD,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE3F;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CAE9G;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,GAAG,SAAS,CAKrB;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhG;AAED,wBAAgB,eAAe,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5F"}
|
package/dist/links.js
CHANGED
|
@@ -20,10 +20,12 @@ function boardSegment(board) {
|
|
|
20
20
|
function factoryBoardUrl(factoryProjectId, board) {
|
|
21
21
|
return factoryUrl(factoryProjectId, boardSegment(board));
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* A card, opened as the board opens it on a click: the UI sends the link on to the session the card
|
|
25
|
+
* shows (its current phase's, else its last visited one's), or to a draft that starts one.
|
|
26
|
+
*/
|
|
24
27
|
function factoryWorkItemUrl(input) {
|
|
25
|
-
|
|
26
|
-
return factoryUrl(input.factoryProjectId, `${boardSegment(input.board)}?${query}`);
|
|
28
|
+
return factoryUrl(input.factoryProjectId, `/cards/${encodeURIComponent(input.workItemId)}`);
|
|
27
29
|
}
|
|
28
30
|
function factorySessionUrl(input) {
|
|
29
31
|
return factoryUrl(input.factoryProjectId, `/workspaces/${encodeURIComponent(input.sessionId)}/threads/${encodeURIComponent(input.threadId)}`);
|
package/dist/links.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.js","names":[],"sources":["../src/links.ts"],"sourcesContent":["/**\n * Web UI links to Factory entities, so channels (Slack, TUI, GitHub) can point people at the exact\n * thing instead of telling them to \"go use the UI\". Every builder returns undefined when\n * `MASTRACODE_PUBLIC_URL` is unset or blank: an unconfigured server has no address to link to.\n */\n\nimport { DEFAULT_BOARD_ID } from './boards/default-board.js';\n\n/** The configured web UI origin, trimmed and without a trailing slash; null when unset or blank. */\nexport function factoryUiOrigin(raw: string | undefined = process.env.MASTRACODE_PUBLIC_URL): string | null {\n return raw?.trim().replace(/\\/+$/, '') || null;\n}\n\nfunction factoryUrl(factoryProjectId: string, path: string): string | undefined {\n const origin = factoryUiOrigin();\n return origin ? `${origin}/factories/${encodeURIComponent(factoryProjectId)}${path}` : undefined;\n}\n\n/** Board path segment: the default board has its own route, others live under /boards/:id. */\nfunction boardSegment(board: string): string {\n return board === DEFAULT_BOARD_ID ? '/work' : `/boards/${encodeURIComponent(board)}`;\n}\n\nexport function factoryBoardUrl(factoryProjectId: string, board: string): string | undefined {\n return factoryUrl(factoryProjectId, boardSegment(board));\n}\n\n
|
|
1
|
+
{"version":3,"file":"links.js","names":[],"sources":["../src/links.ts"],"sourcesContent":["/**\n * Web UI links to Factory entities, so channels (Slack, TUI, GitHub) can point people at the exact\n * thing instead of telling them to \"go use the UI\". Every builder returns undefined when\n * `MASTRACODE_PUBLIC_URL` is unset or blank: an unconfigured server has no address to link to.\n */\n\nimport { DEFAULT_BOARD_ID } from './boards/default-board.js';\n\n/** The configured web UI origin, trimmed and without a trailing slash; null when unset or blank. */\nexport function factoryUiOrigin(raw: string | undefined = process.env.MASTRACODE_PUBLIC_URL): string | null {\n return raw?.trim().replace(/\\/+$/, '') || null;\n}\n\nfunction factoryUrl(factoryProjectId: string, path: string): string | undefined {\n const origin = factoryUiOrigin();\n return origin ? `${origin}/factories/${encodeURIComponent(factoryProjectId)}${path}` : undefined;\n}\n\n/** Board path segment: the default board has its own route, others live under /boards/:id. */\nfunction boardSegment(board: string): string {\n return board === DEFAULT_BOARD_ID ? '/work' : `/boards/${encodeURIComponent(board)}`;\n}\n\nexport function factoryBoardUrl(factoryProjectId: string, board: string): string | undefined {\n return factoryUrl(factoryProjectId, boardSegment(board));\n}\n\n/**\n * A card, opened as the board opens it on a click: the UI sends the link on to the session the card\n * shows (its current phase's, else its last visited one's), or to a draft that starts one.\n */\nexport function factoryWorkItemUrl(input: { factoryProjectId: string; workItemId: string }): string | undefined {\n return factoryUrl(input.factoryProjectId, `/cards/${encodeURIComponent(input.workItemId)}`);\n}\n\nexport function factorySessionUrl(input: {\n factoryProjectId: string;\n sessionId: string;\n threadId: string;\n}): string | undefined {\n return factoryUrl(\n input.factoryProjectId,\n `/workspaces/${encodeURIComponent(input.sessionId)}/threads/${encodeURIComponent(input.threadId)}`,\n );\n}\n\n/** A settings page, e.g. `models`, `general`, or `connections/slack`. */\nexport function factorySettingsUrl(factoryProjectId: string, section: string): string | undefined {\n return factoryUrl(factoryProjectId, `/settings/${section.split('/').map(encodeURIComponent).join('/')}`);\n}\n\nexport function factoryRulesUrl(factoryProjectId: string, group?: string): string | undefined {\n return factoryUrl(factoryProjectId, group ? `/rules?${new URLSearchParams({ group })}` : '/rules');\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,gBAAgB,MAA0B,QAAQ,IAAI,uBAAsC;CAC1G,OAAO,KAAK,KAAK,CAAC,CAAC,QAAQ,QAAQ,EAAE,KAAK;AAC5C;AAEA,SAAS,WAAW,kBAA0B,MAAkC;CAC9E,MAAM,SAAS,gBAAgB;CAC/B,OAAO,SAAS,GAAG,OAAO,aAAa,mBAAmB,gBAAgB,IAAI,SAAS,KAAA;AACzF;;AAGA,SAAS,aAAa,OAAuB;CAC3C,OAAO,UAAA,SAA6B,UAAU,WAAW,mBAAmB,KAAK;AACnF;AAEA,SAAgB,gBAAgB,kBAA0B,OAAmC;CAC3F,OAAO,WAAW,kBAAkB,aAAa,KAAK,CAAC;AACzD;;;;;AAMA,SAAgB,mBAAmB,OAA6E;CAC9G,OAAO,WAAW,MAAM,kBAAkB,UAAU,mBAAmB,MAAM,UAAU,GAAG;AAC5F;AAEA,SAAgB,kBAAkB,OAIX;CACrB,OAAO,WACL,MAAM,kBACN,eAAe,mBAAmB,MAAM,SAAS,EAAE,WAAW,mBAAmB,MAAM,QAAQ,GACjG;AACF;;AAGA,SAAgB,mBAAmB,kBAA0B,SAAqC;CAChG,OAAO,WAAW,kBAAkB,aAAa,QAAQ,MAAM,GAAG,CAAC,CAAC,IAAI,kBAAkB,CAAC,CAAC,KAAK,GAAG,GAAG;AACzG;AAEA,SAAgB,gBAAgB,kBAA0B,OAAoC;CAC5F,OAAO,WAAW,kBAAkB,QAAQ,UAAU,IAAI,gBAAgB,EAAE,MAAM,CAAC,MAAM,QAAQ;AACnG"}
|
package/dist/routes/boards.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export interface BoardRoutesDeps extends RouteDependencies {
|
|
|
22
22
|
workItems: Pick<WorkItemsStorage, 'listShared' | 'releaseReviewCards'>;
|
|
23
23
|
storage: StoredBoardsStorage;
|
|
24
24
|
/** The per-project boards: the code boards and their seeds, skills, and the cache to invalidate. */
|
|
25
|
-
boards: Pick<ProjectBoardCache, 'describe' | 'invalidate' | 'codeRegistry' | 'codeSkills' | 'seedFor'>;
|
|
25
|
+
boards: Pick<ProjectBoardCache, 'describe' | 'invalidate' | 'codeRegistry' | 'codeSkills' | 'projectSkillNames' | 'seedFor'>;
|
|
26
26
|
}
|
|
27
27
|
export declare class BoardRoutes extends Route<BoardRoutesDeps> {
|
|
28
28
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boards.d.ts","sourceRoot":"","sources":["../../src/routes/boards.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EAAoB,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAS,KAAK,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,oDAAoD;IACpD,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,oBAAoB,CAAC,CAAC;IACvE,OAAO,EAAE,mBAAmB,CAAC;IAC7B,oGAAoG;IACpG,MAAM,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"boards.d.ts","sourceRoot":"","sources":["../../src/routes/boards.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EAAoB,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAC/F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAS,KAAK,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,sBAAsB,CAAC;IACjC,oDAAoD;IACpD,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,YAAY,GAAG,oBAAoB,CAAC,CAAC;IACvE,OAAO,EAAE,mBAAmB,CAAC;IAC7B,oGAAoG;IACpG,MAAM,EAAE,IAAI,CACV,iBAAiB,EACjB,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,YAAY,GAAG,mBAAmB,GAAG,SAAS,CAC5F,CAAC;CACH;AAYD,qBAAa,WAAY,SAAQ,KAAK,CAAC,eAAe,CAAC;;IAwGrD,MAAM,IAAI,QAAQ,EAAE,CAgEnB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boards.js","names":[],"sources":["../../src/routes/boards.ts"],"sourcesContent":["/**\n * Mastra `apiRoutes` for managing a project's stored boards.\n *\n * Reads need project membership; writes need an organization admin in tenant mode. Factory stores\n * the built-in Work board and app boards in each project once, and they are edited under their own\n * key; their code behaviour stays attached, so an edit it can't honour is refused\n * (`code_behaviour`), and reset rewrites Factory's current definition at the next revision. They\n * can't be created over, and Work can't be deleted. The writes themselves are `BoardWrites`.\n */\n\nimport type { ApiRoute } from '@mastra/core/server';\nimport { registerApiRoute } from '@mastra/core/server';\nimport type { Context } from 'hono';\nimport { BoardWriteError, BoardWrites, issueMessage } from '../boards/board-writes.js';\n\nimport type { BoardWriter } from '../boards/board-writes.js';\nimport type { ProjectBoardCache } from '../boards/project-boards.js';\nimport { codeBehaviourOf } from '../boards/stored-board.js';\nimport type { AuditEmitter } from '../storage/domains/audit/domain.js';\nimport type { StoredBoardScope, StoredBoardsStorage } from '../storage/domains/boards/base.js';\nimport type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';\nimport type { WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport { FACTORY_ROUTE_CONTRACTS } from './contracts.js';\nimport type { RouteDependencies } from './route.js';\nimport { loose, Route } from './route.js';\n\nexport interface BoardRoutesDeps extends RouteDependencies {\n audit: AuditEmitter;\n projects: FactoryProjectsStorage;\n /** Read to refuse edits that would strand cards. */\n workItems: Pick<WorkItemsStorage, 'listShared' | 'releaseReviewCards'>;\n storage: StoredBoardsStorage;\n /** The per-project boards: the code boards and their seeds, skills, and the cache to invalidate. */\n boards: Pick<ProjectBoardCache, 'describe' | 'invalidate' | 'codeRegistry' | 'codeSkills' | 'seedFor'>;\n}\n\ntype Resolved = StoredBoardScope & { userId: string };\n\n/** A response the handler returns as is: a refusal or an error. */\nclass Refusal {\n constructor(\n readonly status: 400 | 401 | 403 | 404 | 409 | 422,\n readonly body: Record<string, unknown>,\n ) {}\n}\n\nexport class BoardRoutes extends Route<BoardRoutesDeps> {\n readonly #writes = new BoardWrites(this.deps);\n\n async #resolve(c: Context): Promise<Resolved> {\n const { auth, projects } = this.deps;\n await auth.ensureUser(c);\n const tenant = auth.tenant(c);\n if (!tenant) throw new Refusal(401, { error: 'unauthorized' });\n if (!tenant.orgId) {\n throw new Refusal(403, { error: 'organization_required', message: 'Boards belong to an organization.' });\n }\n const parsed = FACTORY_ROUTE_CONTRACTS.boardCatalog.pathSchema.safeParse({ id: c.req.param('id') });\n if (!parsed.success) throw new Refusal(404, { error: 'Project not found' });\n await projects.ensureReady();\n if (!(await projects.get({ orgId: tenant.orgId, id: parsed.data.id }))) {\n throw new Refusal(404, { error: 'Project not found' });\n }\n return { orgId: tenant.orgId, userId: tenant.userId, factoryProjectId: parsed.data.id };\n }\n\n async #requireAdmin(c: Context, scope: Resolved): Promise<void> {\n const { auth } = this.deps;\n if (auth.enabled() && !(await auth.isOrganizationAdmin(c, scope.orgId))) {\n throw new Refusal(403, {\n error: 'organization_admin_required',\n message: 'Organization administrator access is required to change boards.',\n });\n }\n }\n\n async #body(c: Context): Promise<unknown> {\n try {\n return await c.req.json();\n } catch {\n throw new Refusal(400, { error: 'invalid_request', message: 'Invalid JSON body.' });\n }\n }\n\n #boardKey(c: Context): string {\n const parsed = FACTORY_ROUTE_CONTRACTS.boardGet.pathSchema.safeParse({\n id: c.req.param('id'),\n boardKey: c.req.param('boardKey'),\n });\n if (!parsed.success) throw new Refusal(404, { error: 'board_not_found' });\n return parsed.data.boardKey;\n }\n\n async #respond(c: Context, scope: Resolved, key: string, status: 200 | 201 = 200) {\n const { auth } = this.deps;\n const canEdit = !auth.enabled() || (await auth.isOrganizationAdmin(c, scope.orgId));\n const project = await this.deps.boards.describe(scope);\n const details = project.details.get(key);\n const code = this.deps.boards.codeRegistry.get(key);\n const row = await this.deps.storage.get(scope, key);\n if (!row) return c.json({ error: 'board_not_found', message: `Board \"${key}\" does not exist.` }, 404);\n // A board that failed to load, or a stored row its code board hides, is a project problem.\n const rowProblems = project.problems.filter(\n problem =>\n problem.startsWith(`Board '${key}' could not be loaded:`) || problem.startsWith(`Stored board \"${key}\" `),\n );\n return c.json(\n {\n board: {\n key: row.key,\n name: row.name,\n description: row.description,\n phases: row.phases.map(({ position: _position, ...phase }) => phase),\n revision: row.revision,\n source: details?.source ?? 'stored',\n editable: true,\n codeBehaviour: code ? codeBehaviourOf(code) : null,\n problems: [...(details?.problems ?? []), ...rowProblems.filter(p => !details?.problems.includes(p))],\n },\n canEdit,\n },\n status,\n );\n }\n\n #route(\n contract: { path: string; method: 'GET' | 'POST' | 'PATCH' | 'DELETE' },\n handle: (c: Context) => Promise<Response>,\n ): ApiRoute {\n return registerApiRoute(contract.path, {\n method: contract.method,\n requiresAuth: false,\n handler: async c => {\n const context = loose(c);\n try {\n return await handle(context);\n } catch (error) {\n if (error instanceof Refusal) return context.json(error.body, error.status);\n if (error instanceof BoardWriteError) return context.json(error.body, error.status);\n throw error;\n }\n },\n });\n }\n\n /** The request's user, as the board's author and the audit event's actor. */\n #writer(c: Context, scope: Resolved): BoardWriter {\n return { id: scope.userId, audit: input => this.deps.audit.emit({ context: c, input }) };\n }\n\n routes(): ApiRoute[] {\n const contracts = FACTORY_ROUTE_CONTRACTS;\n const writes = this.#writes;\n return [\n this.#route(contracts.boardGet, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n return this.#respond(c, scope, key);\n }),\n\n this.#route(contracts.boardCreate, async c => {\n const scope = await this.#resolve(c);\n await this.#requireAdmin(c, scope);\n const row = await writes.create(scope, await this.#body(c), this.#writer(c, scope));\n return this.#respond(c, scope, row.key, 201);\n }),\n\n this.#route(contracts.boardReplace, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n writes.refuseCodeBoard(key, 'edit');\n const parsed = contracts.boardReplace.bodySchema.safeParse(await this.#body(c));\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_board', message: issueMessage(parsed.error.issues) });\n }\n const { expectedRevision, ...definition } = parsed.data;\n await writes.replace(scope, key, definition, { expectedRevision, writer: this.#writer(c, scope) });\n return this.#respond(c, scope, key);\n }),\n\n this.#route(contracts.boardDelete, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n writes.refuseCodeBoard(key, 'delete');\n const parsed = contracts.boardDelete.querySchema.safeParse({\n expectedRevision: c.req.query('expectedRevision'),\n });\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_request', message: issueMessage(parsed.error.issues) });\n }\n await writes.remove(scope, key, {\n expectedRevision: parsed.data.expectedRevision,\n writer: this.#writer(c, scope),\n });\n return c.body(null, 204);\n }),\n\n this.#route(contracts.boardReset, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n const parsed = contracts.boardReset.bodySchema.safeParse(await this.#body(c));\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_request', message: issueMessage(parsed.error.issues) });\n }\n await writes.reset(scope, key, {\n expectedRevision: parsed.data.expectedRevision,\n writer: this.#writer(c, scope),\n });\n return this.#respond(c, scope, key);\n }),\n ];\n }\n}\n"],"mappings":";;;;;;;AAuCA,IAAM,UAAN,MAAc;CAED;CACA;CAFX,YACE,QACA,MACA;EAFS,KAAA,SAAA;EACA,KAAA,OAAA;CACR;AACL;AAEA,IAAa,cAAb,cAAiC,MAAuB;CACtD,UAAmB,IAAI,YAAY,KAAK,IAAI;CAE5C,MAAM,SAAS,GAA+B;EAC5C,MAAM,EAAE,MAAM,aAAa,KAAK;EAChC,MAAM,KAAK,WAAW,CAAC;EACvB,MAAM,SAAS,KAAK,OAAO,CAAC;EAC5B,IAAI,CAAC,QAAQ,MAAM,IAAI,QAAQ,KAAK,EAAE,OAAO,eAAe,CAAC;EAC7D,IAAI,CAAC,OAAO,OACV,MAAM,IAAI,QAAQ,KAAK;GAAE,OAAO;GAAyB,SAAS;EAAoC,CAAC;EAEzG,MAAM,SAAS,wBAAwB,aAAa,WAAW,UAAU,EAAE,IAAI,EAAE,IAAI,MAAM,IAAI,EAAE,CAAC;EAClG,IAAI,CAAC,OAAO,SAAS,MAAM,IAAI,QAAQ,KAAK,EAAE,OAAO,oBAAoB,CAAC;EAC1E,MAAM,SAAS,YAAY;EAC3B,IAAI,CAAE,MAAM,SAAS,IAAI;GAAE,OAAO,OAAO;GAAO,IAAI,OAAO,KAAK;EAAG,CAAC,GAClE,MAAM,IAAI,QAAQ,KAAK,EAAE,OAAO,oBAAoB,CAAC;EAEvD,OAAO;GAAE,OAAO,OAAO;GAAO,QAAQ,OAAO;GAAQ,kBAAkB,OAAO,KAAK;EAAG;CACxF;CA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AC9B,kBAAkB,OAAO,KAAK;KAC9B,QAAQ,KAAK,QAAQ,GAAG,KAAK;IAC/B,CAAC;IACD,OAAO,EAAE,KAAK,MAAM,GAAG;GACzB,CAAC;GAED,KAAK,OAAO,UAAU,YAAY,OAAM,MAAK;IAC3C,MAAM,QAAQ,MAAM,KAAK,SAAS,CAAC;IACnC,MAAM,MAAM,KAAK,UAAU,CAAC;IAC5B,MAAM,KAAK,cAAc,GAAG,KAAK;IACjC,MAAM,SAAS,UAAU,WAAW,WAAW,UAAU,MAAM,KAAK,MAAM,CAAC,CAAC;IAC5E,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,QAAQ,KAAK;KAAE,OAAO;KAAmB,SAAS,aAAa,OAAO,MAAM,MAAM;IAAE,CAAC;IAEjG,MAAM,OAAO,MAAM,OAAO,KAAK;KAC7B,kBAAkB,OAAO,KAAK;KAC9B,QAAQ,KAAK,QAAQ,GAAG,KAAK;IAC/B,CAAC;IACD,OAAO,KAAK,SAAS,GAAG,OAAO,GAAG;GACpC,CAAC;EACH;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"boards.js","names":[],"sources":["../../src/routes/boards.ts"],"sourcesContent":["/**\n * Mastra `apiRoutes` for managing a project's stored boards.\n *\n * Reads need project membership; writes need an organization admin in tenant mode. Factory stores\n * the built-in Work board and app boards in each project once, and they are edited under their own\n * key; their code behaviour stays attached, so an edit it can't honour is refused\n * (`code_behaviour`), and reset rewrites Factory's current definition at the next revision. They\n * can't be created over, and Work can't be deleted. The writes themselves are `BoardWrites`.\n */\n\nimport type { ApiRoute } from '@mastra/core/server';\nimport { registerApiRoute } from '@mastra/core/server';\nimport type { Context } from 'hono';\nimport { BoardWriteError, BoardWrites, issueMessage } from '../boards/board-writes.js';\n\nimport type { BoardWriter } from '../boards/board-writes.js';\nimport type { ProjectBoardCache } from '../boards/project-boards.js';\nimport { codeBehaviourOf } from '../boards/stored-board.js';\nimport type { AuditEmitter } from '../storage/domains/audit/domain.js';\nimport type { StoredBoardScope, StoredBoardsStorage } from '../storage/domains/boards/base.js';\nimport type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';\nimport type { WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport { FACTORY_ROUTE_CONTRACTS } from './contracts.js';\nimport type { RouteDependencies } from './route.js';\nimport { loose, Route } from './route.js';\n\nexport interface BoardRoutesDeps extends RouteDependencies {\n audit: AuditEmitter;\n projects: FactoryProjectsStorage;\n /** Read to refuse edits that would strand cards. */\n workItems: Pick<WorkItemsStorage, 'listShared' | 'releaseReviewCards'>;\n storage: StoredBoardsStorage;\n /** The per-project boards: the code boards and their seeds, skills, and the cache to invalidate. */\n boards: Pick<\n ProjectBoardCache,\n 'describe' | 'invalidate' | 'codeRegistry' | 'codeSkills' | 'projectSkillNames' | 'seedFor'\n >;\n}\n\ntype Resolved = StoredBoardScope & { userId: string };\n\n/** A response the handler returns as is: a refusal or an error. */\nclass Refusal {\n constructor(\n readonly status: 400 | 401 | 403 | 404 | 409 | 422,\n readonly body: Record<string, unknown>,\n ) {}\n}\n\nexport class BoardRoutes extends Route<BoardRoutesDeps> {\n readonly #writes = new BoardWrites(this.deps);\n\n async #resolve(c: Context): Promise<Resolved> {\n const { auth, projects } = this.deps;\n await auth.ensureUser(c);\n const tenant = auth.tenant(c);\n if (!tenant) throw new Refusal(401, { error: 'unauthorized' });\n if (!tenant.orgId) {\n throw new Refusal(403, { error: 'organization_required', message: 'Boards belong to an organization.' });\n }\n const parsed = FACTORY_ROUTE_CONTRACTS.boardCatalog.pathSchema.safeParse({ id: c.req.param('id') });\n if (!parsed.success) throw new Refusal(404, { error: 'Project not found' });\n await projects.ensureReady();\n if (!(await projects.get({ orgId: tenant.orgId, id: parsed.data.id }))) {\n throw new Refusal(404, { error: 'Project not found' });\n }\n return { orgId: tenant.orgId, userId: tenant.userId, factoryProjectId: parsed.data.id };\n }\n\n async #requireAdmin(c: Context, scope: Resolved): Promise<void> {\n const { auth } = this.deps;\n if (auth.enabled() && !(await auth.isOrganizationAdmin(c, scope.orgId))) {\n throw new Refusal(403, {\n error: 'organization_admin_required',\n message: 'Organization administrator access is required to change boards.',\n });\n }\n }\n\n async #body(c: Context): Promise<unknown> {\n try {\n return await c.req.json();\n } catch {\n throw new Refusal(400, { error: 'invalid_request', message: 'Invalid JSON body.' });\n }\n }\n\n #boardKey(c: Context): string {\n const parsed = FACTORY_ROUTE_CONTRACTS.boardGet.pathSchema.safeParse({\n id: c.req.param('id'),\n boardKey: c.req.param('boardKey'),\n });\n if (!parsed.success) throw new Refusal(404, { error: 'board_not_found' });\n return parsed.data.boardKey;\n }\n\n async #respond(c: Context, scope: Resolved, key: string, status: 200 | 201 = 200) {\n const { auth } = this.deps;\n const canEdit = !auth.enabled() || (await auth.isOrganizationAdmin(c, scope.orgId));\n const project = await this.deps.boards.describe(scope);\n const details = project.details.get(key);\n const code = this.deps.boards.codeRegistry.get(key);\n const row = await this.deps.storage.get(scope, key);\n if (!row) return c.json({ error: 'board_not_found', message: `Board \"${key}\" does not exist.` }, 404);\n // A board that failed to load, or a stored row its code board hides, is a project problem.\n const rowProblems = project.problems.filter(\n problem =>\n problem.startsWith(`Board '${key}' could not be loaded:`) || problem.startsWith(`Stored board \"${key}\" `),\n );\n return c.json(\n {\n board: {\n key: row.key,\n name: row.name,\n description: row.description,\n phases: row.phases.map(({ position: _position, ...phase }) => phase),\n revision: row.revision,\n source: details?.source ?? 'stored',\n editable: true,\n codeBehaviour: code ? codeBehaviourOf(code) : null,\n problems: [...(details?.problems ?? []), ...rowProblems.filter(p => !details?.problems.includes(p))],\n },\n canEdit,\n },\n status,\n );\n }\n\n #route(\n contract: { path: string; method: 'GET' | 'POST' | 'PATCH' | 'DELETE' },\n handle: (c: Context) => Promise<Response>,\n ): ApiRoute {\n return registerApiRoute(contract.path, {\n method: contract.method,\n requiresAuth: false,\n handler: async c => {\n const context = loose(c);\n try {\n return await handle(context);\n } catch (error) {\n if (error instanceof Refusal) return context.json(error.body, error.status);\n if (error instanceof BoardWriteError) return context.json(error.body, error.status);\n throw error;\n }\n },\n });\n }\n\n /** The request's user, as the board's author and the audit event's actor. */\n #writer(c: Context, scope: Resolved): BoardWriter {\n return { id: scope.userId, audit: input => this.deps.audit.emit({ context: c, input }) };\n }\n\n routes(): ApiRoute[] {\n const contracts = FACTORY_ROUTE_CONTRACTS;\n const writes = this.#writes;\n return [\n this.#route(contracts.boardGet, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n return this.#respond(c, scope, key);\n }),\n\n this.#route(contracts.boardCreate, async c => {\n const scope = await this.#resolve(c);\n await this.#requireAdmin(c, scope);\n const row = await writes.create(scope, await this.#body(c), this.#writer(c, scope));\n return this.#respond(c, scope, row.key, 201);\n }),\n\n this.#route(contracts.boardReplace, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n writes.refuseCodeBoard(key, 'edit');\n const parsed = contracts.boardReplace.bodySchema.safeParse(await this.#body(c));\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_board', message: issueMessage(parsed.error.issues) });\n }\n const { expectedRevision, ...definition } = parsed.data;\n await writes.replace(scope, key, definition, { expectedRevision, writer: this.#writer(c, scope) });\n return this.#respond(c, scope, key);\n }),\n\n this.#route(contracts.boardDelete, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n writes.refuseCodeBoard(key, 'delete');\n const parsed = contracts.boardDelete.querySchema.safeParse({\n expectedRevision: c.req.query('expectedRevision'),\n });\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_request', message: issueMessage(parsed.error.issues) });\n }\n await writes.remove(scope, key, {\n expectedRevision: parsed.data.expectedRevision,\n writer: this.#writer(c, scope),\n });\n return c.body(null, 204);\n }),\n\n this.#route(contracts.boardReset, async c => {\n const scope = await this.#resolve(c);\n const key = this.#boardKey(c);\n await this.#requireAdmin(c, scope);\n const parsed = contracts.boardReset.bodySchema.safeParse(await this.#body(c));\n if (!parsed.success) {\n throw new Refusal(422, { error: 'invalid_request', message: issueMessage(parsed.error.issues) });\n }\n await writes.reset(scope, key, {\n expectedRevision: parsed.data.expectedRevision,\n writer: this.#writer(c, scope),\n });\n return this.#respond(c, scope, key);\n }),\n ];\n }\n}\n"],"mappings":";;;;;;;AA0CA,IAAM,UAAN,MAAc;CAED;CACA;CAFX,YACE,QACA,MACA;EAFS,KAAA,SAAA;EACA,KAAA,OAAA;CACR;AACL;AAEA,IAAa,cAAb,cAAiC,MAAuB;CACtD,UAAmB,IAAI,YAAY,KAAK,IAAI;CAE5C,MAAM,SAAS,GAA+B;EAC5C,MAAM,EAAE,MAAM,aAAa,KAAK;EAChC,MAAM,KAAK,WAAW,CAAC;EACvB,MAAM,SAAS,KAAK,OAAO,CAAC;EAC5B,IAAI,CAAC,QAAQ,MAAM,IAAI,QAAQ,KAAK,EAAE,OAAO,eAAe,CAAC;EAC7D,IAAI,CAAC,OAAO,OACV,MAAM,IAAI,QAAQ,KAAK;GAAE,OAAO;GAAyB,SAAS;EAAoC,CAAC;EAEzG,MAAM,SAAS,wBAAwB,aAAa,WAAW,UAAU,EAAE,IAAI,EAAE,IAAI,MAAM,IAAI,EAAE,CAAC;EAClG,IAAI,CAAC,OAAO,SAAS,MAAM,IAAI,QAAQ,KAAK,EAAE,OAAO,oBAAoB,CAAC;EAC1E,MAAM,SAAS,YAAY;EAC3B,IAAI,CAAE,MAAM,SAAS,IAAI;GAAE,OAAO,OAAO;GAAO,IAAI,OAAO,KAAK;EAAG,CAAC,GAClE,MAAM,IAAI,QAAQ,KAAK,EAAE,OAAO,oBAAoB,CAAC;EAEvD,OAAO;GAAE,OAAO,OAAO;GAAO,QAAQ,OAAO;GAAQ,kBAAkB,OAAO,KAAK;EAAG;CACxF;CAEA,MAAM,cAAc,GAAY,OAAgC;EAC9D,MAAM,EAAE,SAAS,KAAK;EACtB,IAAI,KAAK,QAAQ,KAAK,CAAE,MAAM,KAAK,oBAAoB,GAAG,MA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GAED,KAAK,OAAO,UAAU,YAAY,OAAM,MAAK;IAC3C,MAAM,QAAQ,MAAM,KAAK,SAAS,CAAC;IACnC,MAAM,MAAM,KAAK,UAAU,CAAC;IAC5B,MAAM,KAAK,cAAc,GAAG,KAAK;IACjC,MAAM,SAAS,UAAU,WAAW,WAAW,UAAU,MAAM,KAAK,MAAM,CAAC,CAAC;IAC5E,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,QAAQ,KAAK;KAAE,OAAO;KAAmB,SAAS,aAAa,OAAO,MAAM,MAAM;IAAE,CAAC;IAEjG,MAAM,OAAO,MAAM,OAAO,KAAK;KAC7B,kBAAkB,OAAO,KAAK;KAC9B,QAAQ,KAAK,QAAQ,GAAG,KAAK;IAC/B,CAAC;IACD,OAAO,KAAK,SAAS,GAAG,OAAO,GAAG;GACpC,CAAC;EACH;CACF;AACF"}
|
|
@@ -80,6 +80,7 @@ export declare const intakeRouteInputSchema: z.ZodObject<{
|
|
|
80
80
|
"work_item.updated": "work_item.updated";
|
|
81
81
|
}>>>;
|
|
82
82
|
pullRequestOpenedMovesOnly: z.ZodOptional<z.ZodLiteral<true>>;
|
|
83
|
+
outsiderPullRequestsGated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
83
84
|
}, z.core.$strict>;
|
|
84
85
|
/** Changes the named fields; send the `revision` you read so a concurrent edit is not overwritten. */
|
|
85
86
|
export declare const intakeRoutePatchSchema: z.ZodObject<{
|
|
@@ -106,6 +107,7 @@ export declare const intakeRoutePatchSchema: z.ZodObject<{
|
|
|
106
107
|
"work_item.reopened": "work_item.reopened";
|
|
107
108
|
"work_item.updated": "work_item.updated";
|
|
108
109
|
}>>>;
|
|
110
|
+
outsiderPullRequestsGated: z.ZodOptional<z.ZodLiteral<false>>;
|
|
109
111
|
expectedRevision: z.ZodNumber;
|
|
110
112
|
}, z.core.$strict>;
|
|
111
113
|
export declare const intakeRouteReorderBodySchema: z.ZodObject<{
|
|
@@ -1156,6 +1158,11 @@ export declare const skillOverrideSaveRequestSchema: z.ZodObject<{
|
|
|
1156
1158
|
name: z.ZodString;
|
|
1157
1159
|
content: z.ZodString;
|
|
1158
1160
|
}, z.core.$strip>;
|
|
1161
|
+
/** A new skill's SKILL.md must load under the name it is created with, exactly as the runtime validates it. */
|
|
1162
|
+
export declare const skillCreateBodySchema: z.ZodObject<{
|
|
1163
|
+
name: z.ZodString;
|
|
1164
|
+
content: z.ZodString;
|
|
1165
|
+
}, z.core.$strict>;
|
|
1159
1166
|
export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
1160
1167
|
readonly projectList: {
|
|
1161
1168
|
readonly method: 'GET';
|
|
@@ -2081,6 +2088,7 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
2081
2088
|
"work_item.updated": "work_item.updated";
|
|
2082
2089
|
}>>;
|
|
2083
2090
|
pullRequestOpenedMovesOnly: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2091
|
+
outsiderPullRequestsGated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2084
2092
|
revision: z.ZodNumber;
|
|
2085
2093
|
createdBy: z.ZodString;
|
|
2086
2094
|
createdAt: z.ZodString;
|
|
@@ -2127,6 +2135,7 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
2127
2135
|
"work_item.updated": "work_item.updated";
|
|
2128
2136
|
}>>;
|
|
2129
2137
|
pullRequestOpenedMovesOnly: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2138
|
+
outsiderPullRequestsGated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2130
2139
|
revision: z.ZodNumber;
|
|
2131
2140
|
createdBy: z.ZodString;
|
|
2132
2141
|
createdAt: z.ZodString;
|
|
@@ -2168,6 +2177,7 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
2168
2177
|
"work_item.updated": "work_item.updated";
|
|
2169
2178
|
}>>>;
|
|
2170
2179
|
pullRequestOpenedMovesOnly: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2180
|
+
outsiderPullRequestsGated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2171
2181
|
}, z.core.$strict>;
|
|
2172
2182
|
readonly responseSchema: z.ZodObject<{
|
|
2173
2183
|
intakeRoute: z.ZodObject<{
|
|
@@ -2197,6 +2207,7 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
2197
2207
|
"work_item.updated": "work_item.updated";
|
|
2198
2208
|
}>>;
|
|
2199
2209
|
pullRequestOpenedMovesOnly: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2210
|
+
outsiderPullRequestsGated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2200
2211
|
revision: z.ZodNumber;
|
|
2201
2212
|
createdBy: z.ZodString;
|
|
2202
2213
|
createdAt: z.ZodString;
|
|
@@ -2238,6 +2249,7 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
2238
2249
|
"work_item.reopened": "work_item.reopened";
|
|
2239
2250
|
"work_item.updated": "work_item.updated";
|
|
2240
2251
|
}>>>;
|
|
2252
|
+
outsiderPullRequestsGated: z.ZodOptional<z.ZodLiteral<false>>;
|
|
2241
2253
|
expectedRevision: z.ZodNumber;
|
|
2242
2254
|
}, z.core.$strict>;
|
|
2243
2255
|
readonly responseSchema: z.ZodObject<{
|
|
@@ -2268,6 +2280,7 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
2268
2280
|
"work_item.updated": "work_item.updated";
|
|
2269
2281
|
}>>;
|
|
2270
2282
|
pullRequestOpenedMovesOnly: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2283
|
+
outsiderPullRequestsGated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2271
2284
|
revision: z.ZodNumber;
|
|
2272
2285
|
createdBy: z.ZodString;
|
|
2273
2286
|
createdAt: z.ZodString;
|
|
@@ -2357,6 +2370,7 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
2357
2370
|
"work_item.updated": "work_item.updated";
|
|
2358
2371
|
}>>;
|
|
2359
2372
|
pullRequestOpenedMovesOnly: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2373
|
+
outsiderPullRequestsGated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
2360
2374
|
revision: z.ZodNumber;
|
|
2361
2375
|
createdBy: z.ZodString;
|
|
2362
2376
|
createdAt: z.ZodString;
|
|
@@ -2390,7 +2404,6 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
2390
2404
|
evaluatorSource: z.ZodEnum<{
|
|
2391
2405
|
env: "env";
|
|
2392
2406
|
legacy: "legacy";
|
|
2393
|
-
option: "option";
|
|
2394
2407
|
project: "project";
|
|
2395
2408
|
}>;
|
|
2396
2409
|
projectEvaluator: z.ZodNullable<z.ZodEnum<{
|
|
@@ -2435,7 +2448,6 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
2435
2448
|
evaluatorSource: z.ZodEnum<{
|
|
2436
2449
|
env: "env";
|
|
2437
2450
|
legacy: "legacy";
|
|
2438
|
-
option: "option";
|
|
2439
2451
|
project: "project";
|
|
2440
2452
|
}>;
|
|
2441
2453
|
projectEvaluator: z.ZodNullable<z.ZodEnum<{
|
|
@@ -3651,10 +3663,25 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
3651
3663
|
canEdit: z.ZodOptional<z.ZodBoolean>;
|
|
3652
3664
|
}, z.core.$strip>;
|
|
3653
3665
|
};
|
|
3666
|
+
readonly skillCreate: {
|
|
3667
|
+
readonly method: 'POST';
|
|
3668
|
+
readonly path: '/web/factory/projects/:id/skills';
|
|
3669
|
+
readonly description: 'Create a skill for one Factory project';
|
|
3670
|
+
readonly pathSchema: z.ZodObject<{
|
|
3671
|
+
id: z.ZodString;
|
|
3672
|
+
}, z.core.$strip>;
|
|
3673
|
+
readonly bodySchema: z.ZodObject<{
|
|
3674
|
+
name: z.ZodString;
|
|
3675
|
+
content: z.ZodString;
|
|
3676
|
+
}, z.core.$strict>;
|
|
3677
|
+
readonly responseSchema: z.ZodObject<{
|
|
3678
|
+
skill: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
3679
|
+
}, z.core.$strip>;
|
|
3680
|
+
};
|
|
3654
3681
|
readonly skillOverrideSave: {
|
|
3655
3682
|
readonly method: 'PUT';
|
|
3656
3683
|
readonly path: '/web/factory/projects/:id/skills/:name';
|
|
3657
|
-
readonly description: "Save a project's
|
|
3684
|
+
readonly description: "Save a project's SKILL.md for a Factory skill: an edit of an app skill, or a skill it created";
|
|
3658
3685
|
readonly pathSchema: z.ZodObject<{
|
|
3659
3686
|
id: z.ZodString;
|
|
3660
3687
|
name: z.ZodString;
|
|
@@ -3669,13 +3696,13 @@ export declare const FACTORY_ROUTE_CONTRACTS: {
|
|
|
3669
3696
|
readonly skillOverrideRevert: {
|
|
3670
3697
|
readonly method: 'DELETE';
|
|
3671
3698
|
readonly path: '/web/factory/projects/:id/skills/:name';
|
|
3672
|
-
readonly description: "Revert a project's edited Factory skill to its original SKILL.md";
|
|
3699
|
+
readonly description: "Revert a project's edited Factory skill to its original SKILL.md, or delete a skill the project created";
|
|
3673
3700
|
readonly pathSchema: z.ZodObject<{
|
|
3674
3701
|
id: z.ZodString;
|
|
3675
3702
|
name: z.ZodString;
|
|
3676
3703
|
}, z.core.$strip>;
|
|
3677
3704
|
readonly responseSchema: z.ZodObject<{
|
|
3678
|
-
skill: z.ZodRecord<z.ZodString, z.ZodUnknown
|
|
3705
|
+
skill: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3679
3706
|
}, z.core.$strip>;
|
|
3680
3707
|
};
|
|
3681
3708
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/routes/contracts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA4BxB,eAAO,MAAM,eAAe,EAA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