@mastra/factory 0.21.0-alpha.4 → 0.21.0-alpha.5
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.
|
@@ -3,8 +3,8 @@ import type { BoardRegistry } from './registry.js';
|
|
|
3
3
|
/** Rows that predate persisted boards used source-type routing. */
|
|
4
4
|
export declare function effectiveBoard(item: WorkItemRow): string;
|
|
5
5
|
/**
|
|
6
|
-
* Put one card on `targetBoard`, at `targetStage` or the board's initial phase. Terminal cards
|
|
7
|
-
* cards with a session attached to a current stage stay put; so does a card that changed under us
|
|
6
|
+
* Put one card on `targetBoard`, at `targetStage` or the board's initial phase. Terminal cards,
|
|
7
|
+
* cards on a board that is not installed, and cards with a session attached to a current stage stay put; so does a card that changed under us
|
|
8
8
|
* (a run started or someone moved it), a card already on the target board when no phase is named,
|
|
9
9
|
* and a card already sitting at the named destination.
|
|
10
10
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relocate.d.ts","sourceRoot":"","sources":["../../src/boards/relocate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,aAAa,EACb,MAAM,EACN,IAAI,EACJ,WAAW,EACX,WAAW,GACZ,EAAE;IACD,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,+BAA+B,CAAC,CAAC;IAC9E,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"relocate.d.ts","sourceRoot":"","sources":["../../src/boards/relocate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,EACpC,SAAS,EACT,aAAa,EACb,MAAM,EACN,IAAI,EACJ,WAAW,EACX,WAAW,GACZ,EAAE;IACD,SAAS,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,+BAA+B,CAAC,CAAC;IAC9E,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC,CAiD7C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,EAAE,CAGtD"}
|
package/dist/boards/relocate.js
CHANGED
|
@@ -5,8 +5,8 @@ function effectiveBoard(item) {
|
|
|
5
5
|
return item.board ?? (item.externalSource?.type === "pull-request" ? "review" : "work");
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* Put one card on `targetBoard`, at `targetStage` or the board's initial phase. Terminal cards
|
|
9
|
-
* cards with a session attached to a current stage stay put; so does a card that changed under us
|
|
8
|
+
* Put one card on `targetBoard`, at `targetStage` or the board's initial phase. Terminal cards,
|
|
9
|
+
* cards on a board that is not installed, and cards with a session attached to a current stage stay put; so does a card that changed under us
|
|
10
10
|
* (a run started or someone moved it), a card already on the target board when no phase is named,
|
|
11
11
|
* and a card already sitting at the named destination.
|
|
12
12
|
*/
|
|
@@ -18,9 +18,10 @@ async function moveCardToBoard({ workItems, boardRegistry, userId, item, targetB
|
|
|
18
18
|
const currentBoard = effectiveBoard(item);
|
|
19
19
|
if (currentBoard === targetBoard && (targetStage === void 0 || item.stages.length === 1 && item.stages[0] === stage)) return "unchanged";
|
|
20
20
|
const current = boardRegistry.get(currentBoard);
|
|
21
|
+
if (!current) return "skipped";
|
|
21
22
|
if (!item.stages.every((currentStage) => {
|
|
22
|
-
if (current
|
|
23
|
-
const role = current
|
|
23
|
+
if (current.phases[currentStage]?.kind === "terminal") return false;
|
|
24
|
+
const role = current.roleForPhase(currentStage);
|
|
24
25
|
return role === void 0 || item.sessions[role] === void 0;
|
|
25
26
|
})) return "skipped";
|
|
26
27
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relocate.js","names":[],"sources":["../../src/boards/relocate.ts"],"sourcesContent":["import { WorkItemUpdateConflictError } from '../storage/domains/work-items/base.js';\nimport type { WorkItemRow, WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport type { BoardRegistry } from './registry.js';\n\n/** Rows that predate persisted boards used source-type routing. */\nexport function effectiveBoard(item: WorkItemRow): string {\n return item.board ?? (item.externalSource?.type === 'pull-request' ? 'review' : 'work');\n}\n\n/**\n * Put one card on `targetBoard`, at `targetStage` or the board's initial phase. Terminal cards
|
|
1
|
+
{"version":3,"file":"relocate.js","names":[],"sources":["../../src/boards/relocate.ts"],"sourcesContent":["import { WorkItemUpdateConflictError } from '../storage/domains/work-items/base.js';\nimport type { WorkItemRow, WorkItemsStorage } from '../storage/domains/work-items/base.js';\nimport type { BoardRegistry } from './registry.js';\n\n/** Rows that predate persisted boards used source-type routing. */\nexport function effectiveBoard(item: WorkItemRow): string {\n return item.board ?? (item.externalSource?.type === 'pull-request' ? 'review' : 'work');\n}\n\n/**\n * Put one card on `targetBoard`, at `targetStage` or the board's initial phase. Terminal cards,\n * cards on a board that is not installed, and cards with a session attached to a current stage stay put; so does a card that changed under us\n * (a run started or someone moved it), a card already on the target board when no phase is named,\n * and a card already sitting at the named destination.\n */\nexport async function moveCardToBoard({\n workItems,\n boardRegistry,\n userId,\n item,\n targetBoard,\n targetStage,\n}: {\n workItems: Pick<WorkItemsStorage, 'update' | 'supersedeDecisionsForWorkItem'>;\n boardRegistry: BoardRegistry;\n userId: string;\n item: WorkItemRow;\n targetBoard: string;\n /** Phase to file the card on; defaults to the target board's initial phase. */\n targetStage?: string;\n}): Promise<'moved' | 'skipped' | 'unchanged'> {\n const target = boardRegistry.get(targetBoard);\n if (!target) return 'unchanged';\n const stage = targetStage ?? target.initialPhase;\n // An unknown phase is not a placement this board can hold.\n if (targetStage !== undefined && target.phases[targetStage] === undefined) return 'unchanged';\n const currentBoard = effectiveBoard(item);\n // A caller that names no phase is asking for the board's landing spot, and a\n // card already on that board is where it needs to be — dragging a card out of\n // a working phase back to the initial one is not what a rebind or a label\n // route change means. A named phase is a placement, so the destination being\n // identical — board *and* phase — is the only case with nothing to do.\n if (\n currentBoard === targetBoard &&\n (targetStage === undefined || (item.stages.length === 1 && item.stages[0] === stage))\n )\n return 'unchanged';\n const current = boardRegistry.get(currentBoard);\n // Without the board definition we can't tell terminal phases or attached sessions apart, so leave the card alone.\n if (!current) return 'skipped';\n // Sessions are keyed by the phase's role, not the phase id.\n const movable = item.stages.every(currentStage => {\n if (current.phases[currentStage]?.kind === 'terminal') return false;\n const role = current.roleForPhase(currentStage);\n return role === undefined || item.sessions[role] === undefined;\n });\n if (!movable) return 'skipped';\n try {\n const updated = await workItems.update({\n orgId: item.orgId,\n id: item.id,\n userId,\n patch: { board: targetBoard, stages: [stage] },\n expectedRevision: item.revision,\n expectedBoard: item.board,\n });\n if (!updated) return 'skipped';\n // Runs proposed by the old board's phases (e.g. Work's triage) mean nothing on the new board.\n await workItems.supersedeDecisionsForWorkItem({\n orgId: item.orgId,\n factoryProjectId: item.factoryProjectId,\n workItemId: item.id,\n supersededAt: new Date(),\n });\n return 'moved';\n } catch (error) {\n if (!(error instanceof WorkItemUpdateConflictError)) throw error;\n return 'skipped';\n }\n}\n\nexport function cardLabels(item: WorkItemRow): string[] {\n const labels = item.metadata?.labels;\n return Array.isArray(labels) ? labels.filter((label): label is string => typeof label === 'string') : [];\n}\n"],"mappings":";;;AAKA,SAAgB,eAAe,MAA2B;CACxD,OAAO,KAAK,UAAU,KAAK,gBAAgB,SAAS,iBAAiB,WAAW;AAClF;;;;;;;AAQA,eAAsB,gBAAgB,EACpC,WACA,eACA,QACA,MACA,aACA,eAS6C;CAC7C,MAAM,SAAS,cAAc,IAAI,WAAW;CAC5C,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,QAAQ,eAAe,OAAO;CAEpC,IAAI,gBAAgB,KAAA,KAAa,OAAO,OAAO,iBAAiB,KAAA,GAAW,OAAO;CAClF,MAAM,eAAe,eAAe,IAAI;CAMxC,IACE,iBAAiB,gBAChB,gBAAgB,KAAA,KAAc,KAAK,OAAO,WAAW,KAAK,KAAK,OAAO,OAAO,QAE9E,OAAO;CACT,MAAM,UAAU,cAAc,IAAI,YAAY;CAE9C,IAAI,CAAC,SAAS,OAAO;CAOrB,IAAI,CALY,KAAK,OAAO,OAAM,iBAAgB;EAChD,IAAI,QAAQ,OAAO,aAAa,EAAE,SAAS,YAAY,OAAO;EAC9D,MAAM,OAAO,QAAQ,aAAa,YAAY;EAC9C,OAAO,SAAS,KAAA,KAAa,KAAK,SAAS,UAAU,KAAA;CACvD,CACW,GAAG,OAAO;CACrB,IAAI;EASF,IAAI,CAAC,MARiB,UAAU,OAAO;GACrC,OAAO,KAAK;GACZ,IAAI,KAAK;GACT;GACA,OAAO;IAAE,OAAO;IAAa,QAAQ,CAAC,KAAK;GAAE;GAC7C,kBAAkB,KAAK;GACvB,eAAe,KAAK;EACtB,CAAC,GACa,OAAO;EAErB,MAAM,UAAU,8BAA8B;GAC5C,OAAO,KAAK;GACZ,kBAAkB,KAAK;GACvB,YAAY,KAAK;GACjB,8BAAc,IAAI,KAAK;EACzB,CAAC;EACD,OAAO;CACT,SAAS,OAAO;EACd,IAAI,EAAE,iBAAiB,8BAA8B,MAAM;EAC3D,OAAO;CACT;AACF;AAEA,SAAgB,WAAW,MAA6B;CACtD,MAAM,SAAS,KAAK,UAAU;CAC9B,OAAO,MAAM,QAAQ,MAAM,IAAI,OAAO,QAAQ,UAA2B,OAAO,UAAU,QAAQ,IAAI,CAAC;AACzG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/factory",
|
|
3
|
-
"version": "0.21.0-alpha.
|
|
3
|
+
"version": "0.21.0-alpha.5",
|
|
4
4
|
"description": "Mastra Software Factory module: the server core behind the Mastra Software Factory — storage domains, integrations, and surfaces for agent-powered software delivery",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -57,11 +57,11 @@
|
|
|
57
57
|
"hono": "^4.13.7",
|
|
58
58
|
"posthog-node": "^5.46.1",
|
|
59
59
|
"zod": "^4.6.4",
|
|
60
|
-
"@mastra/
|
|
60
|
+
"@mastra/code-sdk": "1.12.0-alpha.5",
|
|
61
61
|
"@mastra/auth-workos": "1.6.6",
|
|
62
|
-
"@mastra/code-sdk": "1.12.0-alpha.4",
|
|
63
62
|
"@mastra/slack": "1.7.2",
|
|
64
|
-
"@mastra/core": "1.76.0-alpha.
|
|
63
|
+
"@mastra/core": "1.76.0-alpha.5",
|
|
64
|
+
"@mastra/auth-studio": "1.3.9-alpha.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/node": "22.20.1",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"vitest": "4.1.11",
|
|
73
73
|
"@internal/lint": "0.0.141",
|
|
74
74
|
"@mastra/libsql": "1.26.0-alpha.2",
|
|
75
|
-
"@mastra/pg": "1.31.0-alpha.3",
|
|
76
75
|
"@internal/workspace": "0.0.13",
|
|
77
|
-
"@internal/types-builder": "0.0.116"
|
|
76
|
+
"@internal/types-builder": "0.0.116",
|
|
77
|
+
"@mastra/pg": "1.31.0-alpha.3"
|
|
78
78
|
},
|
|
79
79
|
"engines": {
|
|
80
80
|
"node": ">=22.19.0"
|