@mastra/factory 0.28.0-alpha.4 → 0.28.0-alpha.6
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 +52 -28
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +12 -6
- package/dist/auth.js.map +1 -1
- package/dist/boards/board-writes.d.ts.map +1 -1
- package/dist/boards/board-writes.js +6 -7
- package/dist/boards/board-writes.js.map +1 -1
- package/dist/boards/index.d.ts +1 -1
- package/dist/boards/index.d.ts.map +1 -1
- package/dist/boards/index.js +2 -2
- package/dist/boards/project-boards.d.ts +30 -4
- package/dist/boards/project-boards.d.ts.map +1 -1
- package/dist/boards/project-boards.js +71 -19
- package/dist/boards/project-boards.js.map +1 -1
- package/dist/boards/registry.d.ts +7 -1
- package/dist/boards/registry.d.ts.map +1 -1
- package/dist/boards/registry.js +16 -3
- package/dist/boards/registry.js.map +1 -1
- package/dist/boards/semantics.d.ts +5 -4
- package/dist/boards/semantics.d.ts.map +1 -1
- package/dist/boards/semantics.js +5 -4
- package/dist/boards/semantics.js.map +1 -1
- package/dist/boards/work-migrations.d.ts +4 -3
- package/dist/boards/work-migrations.d.ts.map +1 -1
- package/dist/boards/work-migrations.js +6 -5
- package/dist/boards/work-migrations.js.map +1 -1
- package/dist/boards/work-seeds.d.ts +9 -0
- package/dist/boards/work-seeds.d.ts.map +1 -0
- package/dist/boards/work-seeds.js +56 -0
- package/dist/boards/work-seeds.js.map +1 -0
- package/dist/boards/work.d.ts +2 -2
- package/dist/boards/work.d.ts.map +1 -1
- package/dist/boards/work.js +0 -16
- package/dist/boards/work.js.map +1 -1
- package/dist/factory.d.ts +8 -4
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +33 -73
- package/dist/factory.js.map +1 -1
- package/dist/feed-events.d.ts +4 -4
- package/dist/feed-events.d.ts.map +1 -1
- package/dist/feed-events.js +6 -6
- package/dist/feed-events.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/integrations/base.d.ts +0 -11
- package/dist/integrations/base.d.ts.map +1 -1
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -1
- package/dist/integrations/linear/agent-tools.js +1 -1
- package/dist/integrations/linear/agent-tools.js.map +1 -1
- package/dist/integrations/slack/integration.d.ts +0 -2
- package/dist/integrations/slack/integration.d.ts.map +1 -1
- package/dist/integrations/slack/integration.js +0 -5
- package/dist/integrations/slack/integration.js.map +1 -1
- package/dist/integrations/slack/run-error-card.js +1 -0
- package/dist/integrations/slack/run-error-card.js.map +1 -1
- package/dist/integrations/slack/slack.d.ts +3 -18
- package/dist/integrations/slack/slack.d.ts.map +1 -1
- package/dist/integrations/slack/slack.js +3 -74
- package/dist/integrations/slack/slack.js.map +1 -1
- package/dist/links.d.ts +1 -2
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +1 -2
- package/dist/links.js.map +1 -1
- package/dist/provider-display-name.d.ts.map +1 -1
- package/dist/provider-display-name.js +1 -0
- package/dist/provider-display-name.js.map +1 -1
- package/dist/routes/attention-providers.d.ts +0 -25
- package/dist/routes/attention-providers.d.ts.map +1 -1
- package/dist/routes/attention-providers.js +2 -150
- package/dist/routes/attention-providers.js.map +1 -1
- package/dist/routes/attention.d.ts +0 -2
- package/dist/routes/attention.d.ts.map +1 -1
- package/dist/routes/attention.js +2 -13
- package/dist/routes/attention.js.map +1 -1
- package/dist/routes/config.d.ts +7 -1
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +105 -22
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/contracts.d.ts +6 -14
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +4 -2
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/feed-events.d.ts +15 -0
- package/dist/routes/feed-events.d.ts.map +1 -0
- package/dist/routes/feed-events.js +68 -0
- package/dist/routes/feed-events.js.map +1 -0
- package/dist/routes/knowledge.js +1 -1
- package/dist/routes/mastra-gateway.d.ts +19 -0
- package/dist/routes/mastra-gateway.d.ts.map +1 -0
- package/dist/routes/mastra-gateway.js +120 -0
- package/dist/routes/mastra-gateway.js.map +1 -0
- package/dist/routes/projects.d.ts +1 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +1 -1
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/provider-credentials.d.ts +6 -1
- package/dist/routes/provider-credentials.d.ts.map +1 -1
- package/dist/routes/provider-credentials.js +32 -2
- package/dist/routes/provider-credentials.js.map +1 -1
- package/dist/routes/route.d.ts +6 -0
- package/dist/routes/route.d.ts.map +1 -1
- package/dist/routes/route.js.map +1 -1
- package/dist/routes/surface.d.ts +0 -7
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +1 -5
- package/dist/routes/surface.js.map +1 -1
- package/dist/routes/tenant-credentials.d.ts.map +1 -1
- package/dist/routes/tenant-credentials.js +5 -1
- package/dist/routes/tenant-credentials.js.map +1 -1
- package/dist/routes/work-items.d.ts +0 -3
- package/dist/routes/work-items.d.ts.map +1 -1
- package/dist/routes/work-items.js +0 -1
- package/dist/routes/work-items.js.map +1 -1
- package/dist/rules/dispatcher.d.ts +0 -3
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +5 -7
- package/dist/rules/dispatcher.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 +38 -5
- package/dist/run-error.js.map +1 -1
- package/dist/session/live-sessions.d.ts +11 -4
- package/dist/session/live-sessions.d.ts.map +1 -1
- package/dist/session/live-sessions.js +31 -10
- package/dist/session/live-sessions.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 +0 -4
- package/dist/storage/domains/audit/actions.js.map +1 -1
- package/dist/storage/domains/boards/base.d.ts +15 -1
- package/dist/storage/domains/boards/base.d.ts.map +1 -1
- package/dist/storage/domains/boards/base.js +21 -5
- package/dist/storage/domains/boards/base.js.map +1 -1
- package/dist/storage/domains/channel-identity/base.d.ts +0 -4
- package/dist/storage/domains/channel-identity/base.d.ts.map +1 -1
- package/dist/storage/domains/channel-identity/base.js +0 -7
- package/dist/storage/domains/channel-identity/base.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts +12 -17
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +42 -117
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/storage/domains/work-items/board-version.d.ts +6 -2
- package/dist/storage/domains/work-items/board-version.d.ts.map +1 -1
- package/dist/storage/domains/work-items/board-version.js +20 -9
- package/dist/storage/domains/work-items/board-version.js.map +1 -1
- package/dist/storage/domains/work-items/cards.d.ts +3 -3
- package/dist/storage/domains/work-items/cards.d.ts.map +1 -1
- package/dist/storage/domains/work-items/cards.js +10 -10
- package/dist/storage/domains/work-items/cards.js.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.d.ts +1 -2
- package/dist/storage/domains/work-items/work-item-schema.d.ts.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.js +8 -8
- package/dist/storage/domains/work-items/work-item-schema.js.map +1 -1
- package/dist/tools/read-tools.d.ts +0 -2
- package/dist/tools/read-tools.d.ts.map +1 -1
- package/dist/tools/read-tools.js +3 -14
- package/dist/tools/read-tools.js.map +1 -1
- package/dist/tools/work-item-tools.d.ts +0 -3
- package/dist/tools/work-item-tools.d.ts.map +1 -1
- package/dist/tools/work-item-tools.js +8 -18
- 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 +3 -2
- package/dist/work-items/create-work-item.js.map +1 -1
- package/dist/work-items/description-context.d.ts +5 -0
- package/dist/work-items/description-context.d.ts.map +1 -0
- package/dist/work-items/description-context.js +17 -0
- package/dist/work-items/description-context.js.map +1 -0
- package/dist/work-items/split-migration.d.ts.map +1 -1
- package/dist/work-items/split-migration.js +1 -6
- package/dist/work-items/split-migration.js.map +1 -1
- package/factory-skills/configure-factory-rules/SKILL.md +3 -3
- package/factory-skills/factory-gitlab-rereview/SKILL.md +4 -4
- package/factory-skills/factory-gitlab-review/SKILL.md +5 -5
- package/factory-skills/factory-rereview/SKILL.md +70 -24
- package/factory-skills/factory-review/SKILL.md +70 -24
- package/factory-skills/factory-self-review/SKILL.md +5 -6
- package/factory-skills/factory-triage/SKILL.md +11 -22
- package/package.json +8 -8
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts +0 -8
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts.map +0 -1
- package/dist/integrations/slack/emoji-shortcodes.generated.js +0 -1984
- package/dist/integrations/slack/emoji-shortcodes.generated.js.map +0 -1
- package/dist/integrations/slack/emoji.d.ts +0 -3
- package/dist/integrations/slack/emoji.d.ts.map +0 -1
- package/dist/integrations/slack/emoji.js +0 -11
- package/dist/integrations/slack/emoji.js.map +0 -1
- package/dist/integrations/slack/feed-publisher.d.ts +0 -26
- package/dist/integrations/slack/feed-publisher.d.ts.map +0 -1
- package/dist/integrations/slack/feed-publisher.js +0 -43
- package/dist/integrations/slack/feed-publisher.js.map +0 -1
- package/dist/routes/attention-activity.d.ts +0 -23
- package/dist/routes/attention-activity.d.ts.map +0 -1
- package/dist/routes/attention-activity.js +0 -154
- package/dist/routes/attention-activity.js.map +0 -1
- package/dist/storage/domains/comments/activity.d.ts +0 -40
- package/dist/storage/domains/comments/activity.d.ts.map +0 -1
- package/dist/storage/domains/comments/activity.js +0 -93
- package/dist/storage/domains/comments/activity.js.map +0 -1
- package/dist/storage/domains/comments/actor.d.ts +0 -51
- package/dist/storage/domains/comments/actor.d.ts.map +0 -1
- package/dist/storage/domains/comments/actor.js +0 -37
- package/dist/storage/domains/comments/actor.js.map +0 -1
- package/dist/storage/domains/comments/base.d.ts +0 -245
- package/dist/storage/domains/comments/base.d.ts.map +0 -1
- package/dist/storage/domains/comments/base.js +0 -539
- package/dist/storage/domains/comments/base.js.map +0 -1
- package/dist/storage/domains/comments/domain.d.ts +0 -135
- package/dist/storage/domains/comments/domain.d.ts.map +0 -1
- package/dist/storage/domains/comments/domain.js +0 -284
- package/dist/storage/domains/comments/domain.js.map +0 -1
- package/dist/storage/domains/comments/feed-context.d.ts +0 -22
- package/dist/storage/domains/comments/feed-context.d.ts.map +0 -1
- package/dist/storage/domains/comments/feed-context.js +0 -88
- package/dist/storage/domains/comments/feed-context.js.map +0 -1
- package/dist/storage/domains/comments/feed-sync.d.ts +0 -21
- package/dist/storage/domains/comments/feed-sync.d.ts.map +0 -1
- package/dist/storage/domains/comments/feed-sync.js +0 -1
- package/dist/storage/domains/comments/parse.d.ts +0 -23
- package/dist/storage/domains/comments/parse.d.ts.map +0 -1
- package/dist/storage/domains/comments/parse.js +0 -89
- package/dist/storage/domains/comments/parse.js.map +0 -1
- package/dist/storage/domains/comments/routes.d.ts +0 -24
- package/dist/storage/domains/comments/routes.d.ts.map +0 -1
- package/dist/storage/domains/comments/routes.js +0 -299
- package/dist/storage/domains/comments/routes.js.map +0 -1
- package/dist/storage/domains/comments/schema.d.ts +0 -5
- package/dist/storage/domains/comments/schema.d.ts.map +0 -1
- package/dist/storage/domains/comments/schema.js +0 -178
- package/dist/storage/domains/comments/schema.js.map +0 -1
- package/dist/storage/domains/comments/wire.d.ts +0 -40
- package/dist/storage/domains/comments/wire.d.ts.map +0 -1
- package/dist/storage/domains/comments/wire.js +0 -36
- package/dist/storage/domains/comments/wire.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed-events.js","names":[],"sources":["../../src/routes/feed-events.ts"],"sourcesContent":["/**\n * The project's live-board stream: one SSE frame each time something on the\n * board changes, so open boards re-read instead of polling.\n */\n\nimport { withAck } from '@mastra/core/events';\nimport type { EventCallback, PubSub } from '@mastra/core/events';\nimport type { ApiRoute } from '@mastra/core/server';\nimport { registerApiRoute } from '@mastra/core/server';\nimport { streamSSE } from 'hono/streaming';\n\nimport { feedTopic } from '../feed-events.js';\nimport type { FactoryProjectsStorage } from '../storage/domains/projects/base.js';\nimport { loose } from './route.js';\nimport type { RouteAuth } from './route.js';\n\n/** Proxies drop an idle stream, and `write` can't detect a dead peer. */\nconst FEED_KEEPALIVE_MS = 25_000;\n// Ceiling: one broker subscription per open tab, not per project. A per-replica\n// topic multiplexer is the upgrade path if tab counts ever make that hurt.\n\nconst UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\n\nexport interface FeedEventsRouteDependencies {\n auth: RouteAuth;\n projects: FactoryProjectsStorage;\n pubsub: PubSub;\n}\n\nexport function buildFeedEventsRoutes({ auth, projects, pubsub }: FeedEventsRouteDependencies): ApiRoute[] {\n return [\n registerApiRoute('/web/factory/projects/:id/feed-events', {\n method: 'GET',\n handler: async cc => {\n const c = loose(cc);\n await auth.ensureUser(c);\n const tenant = auth.tenant(c);\n if (!tenant) return c.json({ error: 'unauthorized' }, 401);\n if (!tenant.orgId) {\n return c.json({ error: 'organization_required', message: 'The board stream requires an organization.' }, 403);\n }\n const orgId = tenant.orgId;\n\n const projectId = c.req.param('id');\n if (!projectId || !UUID_RE.test(projectId)) return c.json({ error: 'Project not found' }, 404);\n await projects.ensureReady();\n const project = await projects.get({ orgId, id: projectId });\n if (!project) return c.json({ error: 'Project not found' }, 404);\n\n const topic = feedTopic(orgId, projectId);\n return streamSSE(c, async stream => {\n // `withAck` settles every delivery: on a durable broker (Redis\n // Streams) an unacked event stays in the subscription's pending set\n // and in the broker client's in-flight bookkeeping for the life of\n // this connection — a leak that grows with every board change on\n // long-lived dashboard tabs. Frames are fire-and-forget\n // invalidations, so a delivery is acked even when the tab is gone.\n const onEvent: EventCallback = withAck(async () => {\n if (stream.aborted) return;\n try {\n await stream.writeSSE({ event: 'feed', data: '{}' });\n } catch {\n // A write to a half-closed socket must not reach `withAck` as a\n // rejection: the nack would republish the event to the shared\n // topic, duplicating the invalidation for every tab.\n }\n });\n // Claimed before any await: `onAbort` handlers registered after the\n // reader is gone never run, and a broker subscribe is a round trip.\n const closed = new Promise<void>(resolve => stream.onAbort(resolve));\n let keepalive: ReturnType<typeof setInterval> | undefined;\n try {\n // Without `latest`, a retaining broker replays its whole backlog into\n // every new connection as spurious invalidations.\n await pubsub.subscribe(topic, onEvent, { startFrom: 'latest' });\n if (!stream.aborted) {\n const ping = () => {\n if (stream.aborted) return;\n void stream.write(': ping\\n\\n');\n };\n // A proxy that holds the response until its first byte would keep the reader waiting a whole keepalive.\n ping();\n keepalive = setInterval(ping, FEED_KEEPALIVE_MS);\n // `streamSSE` closes the stream the moment this callback returns.\n await closed;\n }\n } finally {\n clearInterval(keepalive);\n await pubsub.unsubscribe(topic, onEvent);\n }\n });\n },\n }),\n ];\n}\n"],"mappings":";;;;;;;;;;;AAiBA,MAAM,oBAAoB;AAI1B,MAAM,UAAU;AAQhB,SAAgB,sBAAsB,EAAE,MAAM,UAAU,UAAmD;CACzG,OAAO,CACL,iBAAiB,yCAAyC;EACxD,QAAQ;EACR,SAAS,OAAM,OAAM;GACnB,MAAM,IAAI,MAAM,EAAE;GAClB,MAAM,KAAK,WAAW,CAAC;GACvB,MAAM,SAAS,KAAK,OAAO,CAAC;GAC5B,IAAI,CAAC,QAAQ,OAAO,EAAE,KAAK,EAAE,OAAO,eAAe,GAAG,GAAG;GACzD,IAAI,CAAC,OAAO,OACV,OAAO,EAAE,KAAK;IAAE,OAAO;IAAyB,SAAS;GAA6C,GAAG,GAAG;GAE9G,MAAM,QAAQ,OAAO;GAErB,MAAM,YAAY,EAAE,IAAI,MAAM,IAAI;GAClC,IAAI,CAAC,aAAa,CAAC,QAAQ,KAAK,SAAS,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,oBAAoB,GAAG,GAAG;GAC7F,MAAM,SAAS,YAAY;GAE3B,IAAI,CAAC,MADiB,SAAS,IAAI;IAAE;IAAO,IAAI;GAAU,CAAC,GAC7C,OAAO,EAAE,KAAK,EAAE,OAAO,oBAAoB,GAAG,GAAG;GAE/D,MAAM,QAAQ,UAAU,OAAO,SAAS;GACxC,OAAO,UAAU,GAAG,OAAM,WAAU;IAOlC,MAAM,UAAyB,QAAQ,YAAY;KACjD,IAAI,OAAO,SAAS;KACpB,IAAI;MACF,MAAM,OAAO,SAAS;OAAE,OAAO;OAAQ,MAAM;MAAK,CAAC;KACrD,QAAQ,CAIR;IACF,CAAC;IAGD,MAAM,SAAS,IAAI,SAAc,YAAW,OAAO,QAAQ,OAAO,CAAC;IACnE,IAAI;IACJ,IAAI;KAGF,MAAM,OAAO,UAAU,OAAO,SAAS,EAAE,WAAW,SAAS,CAAC;KAC9D,IAAI,CAAC,OAAO,SAAS;MACnB,MAAM,aAAa;OACjB,IAAI,OAAO,SAAS;OACpB,OAAY,MAAM,YAAY;MAChC;MAEA,KAAK;MACL,YAAY,YAAY,MAAM,iBAAiB;MAE/C,MAAM;KACR;IACF,UAAU;KACR,cAAc,SAAS;KACvB,MAAM,OAAO,YAAY,OAAO,OAAO;IACzC;GACF,CAAC;EACH;CACF,CAAC,CACH;AACF"}
|
package/dist/routes/knowledge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Route, loose } from "./route.js";
|
|
2
2
|
import { registerApiRoute } from "@mastra/core/server";
|
|
3
|
-
import { KnowledgeDeclarationError, listKnowledgeTreeChildren, readKnowledgePage, readKnowledgePageActivity, readKnowledgePageGraph, readKnowledgeScopeGrants, searchKnowledgeExplorerPages } from "@mastra/core/knowledge";
|
|
4
3
|
import { streamSSE } from "hono/streaming";
|
|
4
|
+
import { KnowledgeDeclarationError, listKnowledgeTreeChildren, readKnowledgePage, readKnowledgePageActivity, readKnowledgePageGraph, readKnowledgeScopeGrants, searchKnowledgeExplorerPages } from "@mastra/core/knowledge";
|
|
5
5
|
// src/routes/knowledge.ts
|
|
6
6
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
7
7
|
/** Ids and cursors are opaque, but bounded so an unbounded query string never reaches storage. */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Context } from 'hono';
|
|
2
|
+
import type { RouteAuth } from './route.js';
|
|
3
|
+
export declare const MASTRA_SIGN_IN_REQUIRED = "The Mastra Gateway needs a Factory signed in with a Mastra account.";
|
|
4
|
+
export declare class MastraGatewayError extends Error {
|
|
5
|
+
readonly status: 400 | 403 | 409 | 502;
|
|
6
|
+
constructor(status: 400 | 403 | 409 | 502, message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare function createGatewayKey(auth: RouteAuth, c: Context, orgId: string, scope: 'org' | 'user'): Promise<string>;
|
|
9
|
+
export interface MastraGatewayCredits {
|
|
10
|
+
/** Dollars (1 credit = $1); absent when the platform reports no balance for the pool. */
|
|
11
|
+
remaining?: number;
|
|
12
|
+
unlimited: boolean;
|
|
13
|
+
/** Mastra lets only organization admins buy credits. */
|
|
14
|
+
canAddCredits: boolean;
|
|
15
|
+
addCreditsUrl: string;
|
|
16
|
+
}
|
|
17
|
+
/** Read like the platform dashboard's `useCreditBalance`. */
|
|
18
|
+
export declare function getGatewayCredits(auth: RouteAuth, c: Context, orgId: string): Promise<MastraGatewayCredits>;
|
|
19
|
+
//# sourceMappingURL=mastra-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mastra-gateway.d.ts","sourceRoot":"","sources":["../../src/routes/mastra-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAiB5C,eAAO,MAAM,uBAAuB,wEAAwE,CAAC;AAE7G,qBAAa,kBAAmB,SAAQ,KAAK;IAEzC,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;IADxC,YACW,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EACtC,OAAO,EAAE,MAAM,EAGhB;CACF;AAwDD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,mBAkBvG;AA6BD,MAAM,WAAW,oBAAoB;IACnC,yFAAyF;IACzF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,wDAAwD;IACxD,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAQD,6DAA6D;AAC7D,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAcjH"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// src/routes/mastra-gateway.ts
|
|
3
|
+
const MASTRA_PROJECTS_URL = process.env.MASTRA_PROJECTS_URL || "https://projects.mastra.ai";
|
|
4
|
+
/** The Starter plan's gateway credit pool, used when the customer names none. */
|
|
5
|
+
const STARTER_CREDIT_POOL = "gateway_credits";
|
|
6
|
+
/**
|
|
7
|
+
* Provisions a Gateway project with a v1 key, which the live gateway accepts. Organization (v2) keys
|
|
8
|
+
* aren't released yet, so Factory doesn't ask for one (the CLI does the same).
|
|
9
|
+
*/
|
|
10
|
+
const GATEWAY_PROVISION_PATH = "/gateway/projects/provision";
|
|
11
|
+
const PLATFORM_TIMEOUT_MS = 15e3;
|
|
12
|
+
const PLATFORM_UNREACHABLE = "Could not reach Mastra. Try again.";
|
|
13
|
+
const MASTRA_SIGN_IN_REQUIRED = "The Mastra Gateway needs a Factory signed in with a Mastra account.";
|
|
14
|
+
var MastraGatewayError = class extends Error {
|
|
15
|
+
status;
|
|
16
|
+
constructor(status, message) {
|
|
17
|
+
super(message);
|
|
18
|
+
this.status = status;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
function platformUnavailable(message) {
|
|
22
|
+
return new MastraGatewayError(502, message);
|
|
23
|
+
}
|
|
24
|
+
async function platformFetch(auth, c, path, init = {}, unreachable = PLATFORM_UNREACHABLE) {
|
|
25
|
+
if (!auth.fetchPlatformAsUser) throw new MastraGatewayError(400, MASTRA_SIGN_IN_REQUIRED);
|
|
26
|
+
let res;
|
|
27
|
+
try {
|
|
28
|
+
res = await auth.fetchPlatformAsUser(c, path, {
|
|
29
|
+
...init,
|
|
30
|
+
signal: AbortSignal.timeout(PLATFORM_TIMEOUT_MS)
|
|
31
|
+
});
|
|
32
|
+
} catch {
|
|
33
|
+
throw platformUnavailable(unreachable);
|
|
34
|
+
}
|
|
35
|
+
if (!res || res.status === 401) throw new MastraGatewayError(400, "Your Mastra sign-in expired. Sign in again.");
|
|
36
|
+
return res;
|
|
37
|
+
}
|
|
38
|
+
async function readJson(res, schema, failure) {
|
|
39
|
+
const parsed = schema.safeParse(await res.json().catch(() => void 0));
|
|
40
|
+
if (!parsed.success) throw platformUnavailable(failure);
|
|
41
|
+
return parsed.data;
|
|
42
|
+
}
|
|
43
|
+
const PlatformMe = z.object({
|
|
44
|
+
organizationId: z.string().nullish(),
|
|
45
|
+
role: z.string().nullish(),
|
|
46
|
+
user: z.object({ email: z.string().nullish() }).nullish()
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* The signed-in user on Mastra, once their session is confirmed to be on this
|
|
50
|
+
* Factory's organization. Platform keys and billing follow the session's
|
|
51
|
+
* active organization, which differs from a Factory pinned to another one.
|
|
52
|
+
*/
|
|
53
|
+
async function platformMember(auth, c, orgId) {
|
|
54
|
+
const res = await platformFetch(auth, c, "/auth/me");
|
|
55
|
+
if (!res.ok) throw platformUnavailable(PLATFORM_UNREACHABLE);
|
|
56
|
+
const me = await readJson(res, PlatformMe, PLATFORM_UNREACHABLE);
|
|
57
|
+
if (me.organizationId !== orgId) throw new MastraGatewayError(409, "Your Mastra sign-in is on a different organization than this Factory. Sign in again with this Factory’s organization.");
|
|
58
|
+
return {
|
|
59
|
+
email: me.user?.email ?? void 0,
|
|
60
|
+
isAdmin: me.role === "admin" || me.role === "owner"
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const CreatedGatewayKey = z.object({ apiKey: z.string().min(1) });
|
|
64
|
+
async function createGatewayKey(auth, c, orgId, scope) {
|
|
65
|
+
const { email } = await platformMember(auth, c, orgId);
|
|
66
|
+
const label = scope === "org" ? "Factory · Shared" : `Factory · ${email ?? "Personal"}`;
|
|
67
|
+
const res = await platformFetch(auth, c, GATEWAY_PROVISION_PATH, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
headers: { "Content-Type": "application/json" },
|
|
70
|
+
body: JSON.stringify({
|
|
71
|
+
name: label,
|
|
72
|
+
keyLabel: label
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
if (res.status === 403) throw new MastraGatewayError(403, "Your Mastra role cannot create gateway keys for this organization. Ask an admin to connect it.");
|
|
76
|
+
const failure = "Could not create a Mastra Gateway key. Try again.";
|
|
77
|
+
if (!res.ok) throw platformUnavailable(failure);
|
|
78
|
+
const { apiKey } = await readJson(res, CreatedGatewayKey, failure);
|
|
79
|
+
return apiKey;
|
|
80
|
+
}
|
|
81
|
+
const CustomerBalance = z.object({
|
|
82
|
+
featureId: z.string().nullish(),
|
|
83
|
+
remaining: z.number().nullish(),
|
|
84
|
+
granted: z.number().nullish(),
|
|
85
|
+
usage: z.number().nullish(),
|
|
86
|
+
unlimited: z.boolean().nullish()
|
|
87
|
+
});
|
|
88
|
+
const BillingCustomer = z.object({ customer: z.object({
|
|
89
|
+
balances: z.record(z.string(), CustomerBalance.nullish()).nullish(),
|
|
90
|
+
creditPool: z.object({ featureId: z.string().nullish() }).nullish()
|
|
91
|
+
}).nullish() });
|
|
92
|
+
async function billingCustomer(auth, c, failure) {
|
|
93
|
+
const res = await platformFetch(auth, c, "/billing/customer");
|
|
94
|
+
if (!res.ok) throw platformUnavailable(failure);
|
|
95
|
+
return (await readJson(res, BillingCustomer, failure)).customer ?? void 0;
|
|
96
|
+
}
|
|
97
|
+
function addCreditsUrl(orgId) {
|
|
98
|
+
return `${MASTRA_PROJECTS_URL}/add-credits/${encodeURIComponent(orgId)}`;
|
|
99
|
+
}
|
|
100
|
+
function remainingCredits(balance) {
|
|
101
|
+
if (balance?.remaining != null) return Math.max(0, balance.remaining);
|
|
102
|
+
if (balance?.granted != null) return Math.max(0, balance.granted - (balance.usage ?? 0));
|
|
103
|
+
}
|
|
104
|
+
/** Read like the platform dashboard's `useCreditBalance`. */
|
|
105
|
+
async function getGatewayCredits(auth, c, orgId) {
|
|
106
|
+
const member = await platformMember(auth, c, orgId);
|
|
107
|
+
const customer = await billingCustomer(auth, c, "Could not read Mastra Gateway credits. Try again.");
|
|
108
|
+
const featureId = customer?.creditPool?.featureId ?? STARTER_CREDIT_POOL;
|
|
109
|
+
const balances = customer?.balances;
|
|
110
|
+
const balance = balances ? Object.values(balances).find((entry) => entry?.featureId === featureId) ?? balances[featureId] : void 0;
|
|
111
|
+
return {
|
|
112
|
+
remaining: remainingCredits(balance),
|
|
113
|
+
unlimited: balance?.unlimited === true,
|
|
114
|
+
canAddCredits: member.isAdmin,
|
|
115
|
+
addCreditsUrl: addCreditsUrl(orgId)
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
export { MASTRA_SIGN_IN_REQUIRED, MastraGatewayError, createGatewayKey, getGatewayCredits };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=mastra-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mastra-gateway.js","names":[],"sources":["../../src/routes/mastra-gateway.ts"],"sourcesContent":["import type { Context } from 'hono';\nimport { z } from 'zod';\n\nimport type { RouteAuth } from './route.js';\n\nconst MASTRA_PROJECTS_URL = process.env.MASTRA_PROJECTS_URL || 'https://projects.mastra.ai';\n\n/** The Starter plan's gateway credit pool, used when the customer names none. */\nconst STARTER_CREDIT_POOL = 'gateway_credits';\n\n/**\n * Provisions a Gateway project with a v1 key, which the live gateway accepts. Organization (v2) keys\n * aren't released yet, so Factory doesn't ask for one (the CLI does the same).\n */\nconst GATEWAY_PROVISION_PATH = '/gateway/projects/provision';\n\nconst PLATFORM_TIMEOUT_MS = 15_000;\n\nconst PLATFORM_UNREACHABLE = 'Could not reach Mastra. Try again.';\n\nexport const MASTRA_SIGN_IN_REQUIRED = 'The Mastra Gateway needs a Factory signed in with a Mastra account.';\n\nexport class MastraGatewayError extends Error {\n constructor(\n readonly status: 400 | 403 | 409 | 502,\n message: string,\n ) {\n super(message);\n }\n}\n\nfunction platformUnavailable(message: string): MastraGatewayError {\n return new MastraGatewayError(502, message);\n}\n\nasync function platformFetch(\n auth: RouteAuth,\n c: Context,\n path: string,\n init: RequestInit = {},\n unreachable = PLATFORM_UNREACHABLE,\n): Promise<Response> {\n if (!auth.fetchPlatformAsUser) throw new MastraGatewayError(400, MASTRA_SIGN_IN_REQUIRED);\n let res: Response | null;\n try {\n res = await auth.fetchPlatformAsUser(c, path, { ...init, signal: AbortSignal.timeout(PLATFORM_TIMEOUT_MS) });\n } catch {\n throw platformUnavailable(unreachable);\n }\n if (!res || res.status === 401) throw new MastraGatewayError(400, 'Your Mastra sign-in expired. Sign in again.');\n return res;\n}\n\nasync function readJson<T>(res: Response, schema: z.ZodType<T>, failure: string): Promise<T> {\n const parsed = schema.safeParse(await res.json().catch(() => undefined));\n if (!parsed.success) throw platformUnavailable(failure);\n return parsed.data;\n}\n\nconst PlatformMe = z.object({\n organizationId: z.string().nullish(),\n role: z.string().nullish(),\n user: z.object({ email: z.string().nullish() }).nullish(),\n});\n\n/**\n * The signed-in user on Mastra, once their session is confirmed to be on this\n * Factory's organization. Platform keys and billing follow the session's\n * active organization, which differs from a Factory pinned to another one.\n */\nasync function platformMember(auth: RouteAuth, c: Context, orgId: string) {\n const res = await platformFetch(auth, c, '/auth/me');\n if (!res.ok) throw platformUnavailable(PLATFORM_UNREACHABLE);\n const me = await readJson(res, PlatformMe, PLATFORM_UNREACHABLE);\n if (me.organizationId !== orgId) {\n throw new MastraGatewayError(\n 409,\n 'Your Mastra sign-in is on a different organization than this Factory. Sign in again with this Factory’s organization.',\n );\n }\n return { email: me.user?.email ?? undefined, isAdmin: me.role === 'admin' || me.role === 'owner' };\n}\n\nconst CreatedGatewayKey = z.object({ apiKey: z.string().min(1) });\n\nexport async function createGatewayKey(auth: RouteAuth, c: Context, orgId: string, scope: 'org' | 'user') {\n const { email } = await platformMember(auth, c, orgId);\n const label = scope === 'org' ? 'Factory · Shared' : `Factory · ${email ?? 'Personal'}`;\n const res = await platformFetch(auth, c, GATEWAY_PROVISION_PATH, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ name: label, keyLabel: label }),\n });\n if (res.status === 403) {\n throw new MastraGatewayError(\n 403,\n 'Your Mastra role cannot create gateway keys for this organization. Ask an admin to connect it.',\n );\n }\n const failure = 'Could not create a Mastra Gateway key. Try again.';\n if (!res.ok) throw platformUnavailable(failure);\n const { apiKey } = await readJson(res, CreatedGatewayKey, failure);\n return apiKey;\n}\n\nconst CustomerBalance = z.object({\n featureId: z.string().nullish(),\n remaining: z.number().nullish(),\n granted: z.number().nullish(),\n usage: z.number().nullish(),\n unlimited: z.boolean().nullish(),\n});\n\nconst BillingCustomer = z.object({\n customer: z\n .object({\n balances: z.record(z.string(), CustomerBalance.nullish()).nullish(),\n creditPool: z.object({ featureId: z.string().nullish() }).nullish(),\n })\n .nullish(),\n});\n\nasync function billingCustomer(auth: RouteAuth, c: Context, failure: string) {\n const res = await platformFetch(auth, c, '/billing/customer');\n if (!res.ok) throw platformUnavailable(failure);\n return (await readJson(res, BillingCustomer, failure)).customer ?? undefined;\n}\n\nfunction addCreditsUrl(orgId: string): string {\n return `${MASTRA_PROJECTS_URL}/add-credits/${encodeURIComponent(orgId)}`;\n}\n\nexport interface MastraGatewayCredits {\n /** Dollars (1 credit = $1); absent when the platform reports no balance for the pool. */\n remaining?: number;\n unlimited: boolean;\n /** Mastra lets only organization admins buy credits. */\n canAddCredits: boolean;\n addCreditsUrl: string;\n}\n\nfunction remainingCredits(balance: z.infer<typeof CustomerBalance> | null | undefined): number | undefined {\n if (balance?.remaining != null) return Math.max(0, balance.remaining);\n if (balance?.granted != null) return Math.max(0, balance.granted - (balance.usage ?? 0));\n return undefined;\n}\n\n/** Read like the platform dashboard's `useCreditBalance`. */\nexport async function getGatewayCredits(auth: RouteAuth, c: Context, orgId: string): Promise<MastraGatewayCredits> {\n const member = await platformMember(auth, c, orgId);\n const customer = await billingCustomer(auth, c, 'Could not read Mastra Gateway credits. Try again.');\n const featureId = customer?.creditPool?.featureId ?? STARTER_CREDIT_POOL;\n const balances = customer?.balances;\n const balance = balances\n ? (Object.values(balances).find(entry => entry?.featureId === featureId) ?? balances[featureId])\n : undefined;\n return {\n remaining: remainingCredits(balance),\n unlimited: balance?.unlimited === true,\n canAddCredits: member.isAdmin,\n addCreditsUrl: addCreditsUrl(orgId),\n };\n}\n"],"mappings":";;AAKA,MAAM,sBAAsB,QAAQ,IAAI,uBAAuB;;AAG/D,MAAM,sBAAsB;;;;;AAM5B,MAAM,yBAAyB;AAE/B,MAAM,sBAAsB;AAE5B,MAAM,uBAAuB;AAE7B,MAAa,0BAA0B;AAEvC,IAAa,qBAAb,cAAwC,MAAM;CAEjC;CADX,YACE,QACA,SACA;EACA,MAAM,OAAO;EAHJ,KAAA,SAAA;CAIX;AACF;AAEA,SAAS,oBAAoB,SAAqC;CAChE,OAAO,IAAI,mBAAmB,KAAK,OAAO;AAC5C;AAEA,eAAe,cACb,MACA,GACA,MACA,OAAoB,CAAC,GACrB,cAAc,sBACK;CACnB,IAAI,CAAC,KAAK,qBAAqB,MAAM,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,KAAA;AACrE;AAEA,SAAS,cAAc,OAAuB;CAC5C,OAAO,GAAG,oBAAoB,eAAe,mBAAmB,KAAK;AACvE;AAWA,SAAS,iBAAiB,SAAiF;CACzG,IAAI,SAAS,aAAa,MAAM,OAAO,KAAK,IAAI,GAAG,QAAQ,SAAS;CACpE,IAAI,SAAS,WAAW,MAAM,OAAO,KAAK,IAAI,GAAG,QAAQ,WAAW,QAAQ,SAAS,EAAE;AAEzF;;AAGA,eAAsB,kBAAkB,MAAiB,GAAY,OAA8C;CACjH,MAAM,SAAS,MAAM,eAAe,MAAM,GAAG,KAAK;CAClD,MAAM,WAAW,MAAM,gBAAgB,MAAM,GAAG,mDAAmD;CACnG,MAAM,YAAY,UAAU,YAAY,aAAa;CACrD,MAAM,WAAW,UAAU;CAC3B,MAAM,UAAU,WACX,OAAO,OAAO,QAAQ,CAAC,CAAC,MAAK,UAAS,OAAO,cAAc,SAAS,KAAK,SAAS,aACnF,KAAA;CACJ,OAAO;EACL,WAAW,iBAAiB,OAAO;EACnC,WAAW,SAAS,cAAc;EAClC,eAAe,OAAO;EACtB,eAAe,cAAc,KAAK;CACpC;AACF"}
|
|
@@ -63,7 +63,7 @@ export interface ProjectRoutesDeps extends RouteDependencies {
|
|
|
63
63
|
/** Intake bindings, released when their Factory project is deleted. */
|
|
64
64
|
intake?: Pick<IntakeStorage, 'ensureReady' | 'clearProjectBindings'>;
|
|
65
65
|
/** The per-project boards; loading a new project stores its copies of the code boards. */
|
|
66
|
-
boards?: Pick<ProjectBoardCache, 'describe'>;
|
|
66
|
+
boards?: Pick<ProjectBoardCache, 'describe' | 'seedNewProject'>;
|
|
67
67
|
}
|
|
68
68
|
export declare class ProjectRoutes extends Route<ProjectRoutesDeps> {
|
|
69
69
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/routes/projects.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MA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AAQ,EAAE,CAshBnB;CACF"}
|
package/dist/routes/projects.js
CHANGED
|
@@ -484,7 +484,7 @@ var ProjectRoutes = class extends Route {
|
|
|
484
484
|
userId: tenant.userId,
|
|
485
485
|
input: parsed.data
|
|
486
486
|
});
|
|
487
|
-
await this.deps.boards?.
|
|
487
|
+
await this.deps.boards?.seedNewProject({
|
|
488
488
|
orgId: tenant.orgId,
|
|
489
489
|
factoryProjectId: project.id
|
|
490
490
|
}).catch((error) => {
|