@mastra/factory 0.29.0-alpha.2 → 0.29.0-alpha.4
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 +44 -5
- package/dist/factory.d.ts +8 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +26 -10
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/integrations/dependabot/rules.d.ts.map +1 -1
- package/dist/integrations/dependabot/rules.js +1 -5
- package/dist/integrations/dependabot/rules.js.map +1 -1
- package/dist/integrations/github/commits.d.ts +0 -21
- package/dist/integrations/github/commits.d.ts.map +1 -1
- package/dist/integrations/github/commits.js +1 -24
- package/dist/integrations/github/commits.js.map +1 -1
- package/dist/integrations/github/integration.d.ts +1 -1
- package/dist/integrations/github/integration.d.ts.map +1 -1
- package/dist/integrations/github/integration.js +2 -6
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/reconcile-worker.d.ts.map +1 -1
- package/dist/integrations/github/reconcile-worker.js +30 -1
- package/dist/integrations/github/reconcile-worker.js.map +1 -1
- package/dist/integrations/github/routes.d.ts +1 -11
- package/dist/integrations/github/routes.d.ts.map +1 -1
- package/dist/integrations/github/routes.js +6 -515
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +76 -13
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/github/sandbox.d.ts.map +1 -1
- package/dist/integrations/github/sandbox.js +11 -2
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/gitlab/discovery.d.ts +1 -1
- package/dist/integrations/gitlab/discovery.js +1 -1
- package/dist/integrations/gitlab/discovery.js.map +1 -1
- package/dist/integrations/gitlab/integration.d.ts.map +1 -1
- package/dist/integrations/gitlab/integration.js +0 -1
- package/dist/integrations/gitlab/integration.js.map +1 -1
- package/dist/integrations/gitlab/routes.d.ts +0 -2
- package/dist/integrations/gitlab/routes.d.ts.map +1 -1
- package/dist/integrations/gitlab/routes.js +49 -165
- package/dist/integrations/gitlab/routes.js.map +1 -1
- package/dist/integrations/gitlab/rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/rules.js +20 -7
- package/dist/integrations/gitlab/rules.js.map +1 -1
- package/dist/integrations/incidentio/routes.d.ts +5 -5
- package/dist/integrations/incidentio/routes.d.ts.map +1 -1
- package/dist/integrations/incidentio/routes.js +3 -59
- package/dist/integrations/incidentio/routes.js.map +1 -1
- package/dist/integrations/incidentio/rules.d.ts.map +1 -1
- package/dist/integrations/incidentio/rules.js +1 -5
- package/dist/integrations/incidentio/rules.js.map +1 -1
- package/dist/integrations/jira/issue-reconciler.d.ts +1 -1
- package/dist/integrations/jira/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/jira/issue-reconciler.js.map +1 -1
- package/dist/integrations/jira/routes.d.ts +2 -2
- package/dist/integrations/jira/routes.d.ts.map +1 -1
- package/dist/integrations/jira/routes.js +0 -68
- package/dist/integrations/jira/routes.js.map +1 -1
- package/dist/integrations/jira/rules.d.ts.map +1 -1
- package/dist/integrations/jira/rules.js +1 -5
- package/dist/integrations/jira/rules.js.map +1 -1
- package/dist/integrations/linear/routes.d.ts +2 -2
- package/dist/integrations/linear/routes.d.ts.map +1 -1
- package/dist/integrations/linear/routes.js +0 -83
- package/dist/integrations/linear/routes.js.map +1 -1
- package/dist/integrations/linear/rules.d.ts.map +1 -1
- package/dist/integrations/linear/rules.js +12 -5
- package/dist/integrations/linear/rules.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +1 -3
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/integrations/platform/jira/routes.d.ts +2 -2
- package/dist/integrations/platform/jira/routes.d.ts.map +1 -1
- package/dist/integrations/platform/jira/routes.js +0 -69
- package/dist/integrations/platform/jira/routes.js.map +1 -1
- package/dist/integrations/vanta/rules.d.ts.map +1 -1
- package/dist/integrations/vanta/rules.js +1 -5
- package/dist/integrations/vanta/rules.js.map +1 -1
- package/dist/metrics/collectors/postgres.d.ts +29 -0
- package/dist/metrics/collectors/postgres.d.ts.map +1 -0
- package/dist/metrics/collectors/postgres.js +121 -0
- package/dist/metrics/collectors/postgres.js.map +1 -0
- package/dist/metrics/collectors/probe.d.ts +22 -0
- package/dist/metrics/collectors/probe.d.ts.map +1 -0
- package/dist/metrics/collectors/probe.js +69 -0
- package/dist/metrics/collectors/probe.js.map +1 -0
- package/dist/metrics/collectors/process.d.ts +13 -0
- package/dist/metrics/collectors/process.d.ts.map +1 -0
- package/dist/metrics/collectors/process.js +85 -0
- package/dist/metrics/collectors/process.js.map +1 -0
- package/dist/metrics/collectors/redis.d.ts +29 -0
- package/dist/metrics/collectors/redis.d.ts.map +1 -0
- package/dist/metrics/collectors/redis.js +97 -0
- package/dist/metrics/collectors/redis.js.map +1 -0
- package/dist/metrics/config.d.ts +33 -0
- package/dist/metrics/config.d.ts.map +1 -0
- package/dist/metrics/config.js +65 -0
- package/dist/metrics/config.js.map +1 -0
- package/dist/metrics/index.d.ts +20 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +65 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/intake.d.ts +28 -0
- package/dist/metrics/intake.d.ts.map +1 -0
- package/dist/metrics/intake.js +76 -0
- package/dist/metrics/intake.js.map +1 -0
- package/dist/metrics/metrics.d.ts +60 -0
- package/dist/metrics/metrics.d.ts.map +1 -0
- package/dist/metrics/metrics.js +182 -0
- package/dist/metrics/metrics.js.map +1 -0
- package/dist/metrics/sandbox.d.ts +35 -0
- package/dist/metrics/sandbox.d.ts.map +1 -0
- package/dist/metrics/sandbox.js +156 -0
- package/dist/metrics/sandbox.js.map +1 -0
- package/dist/packages/_internals/workspace/dist/index.js.map +1 -1
- package/dist/routes/automation-runs.d.ts +0 -2
- package/dist/routes/automation-runs.d.ts.map +1 -1
- package/dist/routes/automation-runs.js +2 -6
- package/dist/routes/automation-runs.js.map +1 -1
- package/dist/routes/contracts.d.ts +0 -5
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +2 -4
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/fs.d.ts +10 -0
- package/dist/routes/fs.d.ts.map +1 -1
- package/dist/routes/fs.js +184 -11
- package/dist/routes/fs.js.map +1 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +4 -17
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/source-control-sessions.d.ts +0 -3
- package/dist/routes/source-control-sessions.d.ts.map +1 -1
- package/dist/routes/source-control-sessions.js +0 -19
- package/dist/routes/source-control-sessions.js.map +1 -1
- package/dist/routes/surface.d.ts +0 -2
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +2 -12
- package/dist/routes/surface.js.map +1 -1
- package/dist/rules/dispatcher.d.ts +1 -0
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +27 -13
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/processor.d.ts.map +1 -1
- package/dist/rules/processor.js +1 -6
- package/dist/rules/processor.js.map +1 -1
- package/dist/rules/start-coordinator.d.ts +1 -0
- package/dist/rules/start-coordinator.d.ts.map +1 -1
- package/dist/rules/start-coordinator.js +2 -1
- package/dist/rules/start-coordinator.js.map +1 -1
- package/dist/rules/transition-service.d.ts.map +1 -1
- package/dist/rules/transition-service.js +0 -2
- package/dist/rules/transition-service.js.map +1 -1
- package/dist/sandbox/session-retirement.d.ts.map +1 -1
- package/dist/sandbox/session-retirement.js +22 -14
- package/dist/sandbox/session-retirement.js.map +1 -1
- package/dist/sandbox/session-sandbox.d.ts +2 -0
- package/dist/sandbox/session-sandbox.d.ts.map +1 -1
- package/dist/sandbox/session-sandbox.js +7 -1
- package/dist/sandbox/session-sandbox.js.map +1 -1
- package/dist/storage/domains/boards/schemas.d.ts.map +1 -1
- package/dist/storage/domains/boards/schemas.js +0 -4
- package/dist/storage/domains/boards/schemas.js.map +1 -1
- package/dist/storage/domains/intake/base.d.ts +11 -10
- package/dist/storage/domains/intake/base.d.ts.map +1 -1
- package/dist/storage/domains/intake/base.js +30 -65
- package/dist/storage/domains/intake/base.js.map +1 -1
- package/dist/storage/domains/integrations/base.d.ts +0 -2
- package/dist/storage/domains/integrations/base.d.ts.map +1 -1
- package/dist/storage/domains/integrations/base.js +0 -6
- package/dist/storage/domains/integrations/base.js.map +1 -1
- package/dist/storage/domains/projects/base.d.ts.map +1 -1
- package/dist/storage/domains/projects/base.js +0 -12
- package/dist/storage/domains/projects/base.js.map +1 -1
- package/dist/storage/domains/source-control/base.d.ts +0 -10
- package/dist/storage/domains/source-control/base.d.ts.map +1 -1
- package/dist/storage/domains/source-control/base.js +1 -19
- package/dist/storage/domains/source-control/base.js.map +1 -1
- package/dist/storage/domains/source-control/inmemory.d.ts +1 -1
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/source-control/inmemory.js +1 -6
- package/dist/storage/domains/source-control/inmemory.js.map +1 -1
- package/dist/storage/domains/work-items/base.d.ts +6 -36
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +42 -82
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.d.ts +12 -3
- package/dist/storage/domains/work-items/work-item-schema.d.ts.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.js +12 -3
- package/dist/storage/domains/work-items/work-item-schema.js.map +1 -1
- package/dist/storage/legacy-collections.d.ts +9 -0
- package/dist/storage/legacy-collections.d.ts.map +1 -0
- package/dist/storage/legacy-collections.js +17 -0
- package/dist/storage/legacy-collections.js.map +1 -0
- package/dist/timing.d.ts +4 -1
- package/dist/timing.d.ts.map +1 -1
- package/dist/timing.js +12 -4
- package/dist/timing.js.map +1 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +8 -4
- package/dist/workspace.js.map +1 -1
- package/factory-skills/configure-factory-rules/SKILL.md +2 -2
- package/package.json +10 -10
- package/dist/session/filesystem-capture.d.ts +0 -50
- package/dist/session/filesystem-capture.d.ts.map +0 -1
- package/dist/session/filesystem-capture.js +0 -229
- package/dist/session/filesystem-capture.js.map +0 -1
- package/dist/storage/domains/filesystem/base.d.ts +0 -30
- package/dist/storage/domains/filesystem/base.d.ts.map +0 -1
- package/dist/storage/domains/filesystem/base.js +0 -78
- package/dist/storage/domains/filesystem/base.js.map +0 -1
|
@@ -112,10 +112,19 @@ export interface BoardItemDbRecord extends Record<string, unknown> {
|
|
|
112
112
|
}
|
|
113
113
|
/** Serializes first-copy migration with deletion without locking an entire project's cards. */
|
|
114
114
|
export declare const FACTORY_WORK_ITEM_SPLIT_LOCKS_SCHEMA: CollectionSchema;
|
|
115
|
-
/**
|
|
115
|
+
/**
|
|
116
|
+
* Deleted card ids: a card list refreshed by delta learns which cards went, and the split migration
|
|
117
|
+
* does not resurrect frozen legacy rows.
|
|
118
|
+
*/
|
|
116
119
|
export declare const FACTORY_BOARD_ITEM_TOMBSTONES_SCHEMA: CollectionSchema;
|
|
117
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* The pre-split card table. Frozen: only the split migration reads it, so it is registered only on a
|
|
122
|
+
* database an earlier release already created it in (or in split dry-run mode, which serves from it).
|
|
123
|
+
*/
|
|
118
124
|
export declare const WORK_ITEMS_SCHEMA: CollectionSchema;
|
|
119
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Records the newest legacy row a finished split pass covered; later boots skip unchanged legacy tables.
|
|
127
|
+
* Exists only alongside {@link WORK_ITEMS_SCHEMA}.
|
|
128
|
+
*/
|
|
120
129
|
export declare const FACTORY_WORK_ITEM_SPLIT_STATE_SCHEMA: CollectionSchema;
|
|
121
130
|
//# sourceMappingURL=work-item-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-item-schema.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/work-items/work-item-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,EAAE,gBAcvC,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,gCAAgC,EAAE,gBAoC9C,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,EAAE,gBAyCxC,CAAC;AAEF,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/D,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,sBAAuB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,YA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IAAI,GAAG,IAAI,CAAC;IACzB,iBAAiB,EAAE,IAAI,GAAG,IAAI,CAAC;IAC/B,oBAAoB,EAAE,IAAI,GAAG,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,IAAI,CAAC;IACjB,UAAU,EAAE,IAAI,CAAC;IACjB,wBAAwB,EAAE,IAAI,GAAG,IAAI,CAAC;IACtC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B;AAED,+FAA+F;AAC/F,eAAO,MAAM,oCAAoC,EAAE,gBAOlD,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"work-item-schema.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/work-items/work-item-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,SAAS,GACT,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,4EAA4E;AAC5E,eAAO,MAAM,yBAAyB,EAAE,gBAcvC,CAAC;AAEF,sFAAsF;AACtF,eAAO,MAAM,gCAAgC,EAAE,gBAoC9C,CA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AAC;IACjB,UAAU,EAAE,IAAI,CAAC;IACjB,wBAAwB,EAAE,IAAI,GAAG,IAAI,CAAC;IACtC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;CAC1B;AAED,+FAA+F;AAC/F,eAAO,MAAM,oCAAoC,EAAE,gBAOlD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oCAAoC,EAAE,gBAclD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,gBAgE/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oCAAoC,EAAE,gBAQlD,CAAC"}
|
|
@@ -205,7 +205,10 @@ const FACTORY_WORK_ITEM_SPLIT_LOCKS_SCHEMA = {
|
|
|
205
205
|
factory_project_id: { type: "text" }
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* Deleted card ids: a card list refreshed by delta learns which cards went, and the split migration
|
|
210
|
+
* does not resurrect frozen legacy rows.
|
|
211
|
+
*/
|
|
209
212
|
const FACTORY_BOARD_ITEM_TOMBSTONES_SCHEMA = {
|
|
210
213
|
name: "factory_board_item_tombstones",
|
|
211
214
|
columns: {
|
|
@@ -226,7 +229,10 @@ const FACTORY_BOARD_ITEM_TOMBSTONES_SCHEMA = {
|
|
|
226
229
|
]
|
|
227
230
|
}]
|
|
228
231
|
};
|
|
229
|
-
/**
|
|
232
|
+
/**
|
|
233
|
+
* The pre-split card table. Frozen: only the split migration reads it, so it is registered only on a
|
|
234
|
+
* database an earlier release already created it in (or in split dry-run mode, which serves from it).
|
|
235
|
+
*/
|
|
230
236
|
const WORK_ITEMS_SCHEMA = {
|
|
231
237
|
name: "work_items",
|
|
232
238
|
columns: {
|
|
@@ -332,7 +338,10 @@ const WORK_ITEMS_SCHEMA = {
|
|
|
332
338
|
}
|
|
333
339
|
]
|
|
334
340
|
};
|
|
335
|
-
/**
|
|
341
|
+
/**
|
|
342
|
+
* Records the newest legacy row a finished split pass covered; later boots skip unchanged legacy tables.
|
|
343
|
+
* Exists only alongside {@link WORK_ITEMS_SCHEMA}.
|
|
344
|
+
*/
|
|
336
345
|
const FACTORY_WORK_ITEM_SPLIT_STATE_SCHEMA = {
|
|
337
346
|
name: "factory_work_item_split_state",
|
|
338
347
|
columns: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-item-schema.js","names":[],"sources":["../../../../src/storage/domains/work-items/work-item-schema.ts"],"sourcesContent":["import type { CollectionSchema } from '@mastra/core/storage';\n\nimport type { FactoryTriageType } from '../../../rules/types.js';\n\nexport type WorkItemProvider =\n | 'github'\n | 'gitlab'\n | 'jira'\n | 'linear'\n | 'slack'\n | 'incidentio'\n | 'factory'\n | (string & {});\n\n/** The work itself; external identities and facts belong to its sources. */\nexport const FACTORY_WORK_ITEMS_SCHEMA: CollectionSchema = {\n name: 'factory_work_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n title: { type: 'text' },\n description: { type: 'text', nullable: true },\n parent_work_item_id: { type: 'text', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n indexes: [{ name: 'factory_work_items_org_project_idx', columns: ['org_id', 'factory_project_id'] }],\n};\n\n/** Several external records can describe one work item. Native work has no source. */\nexport const FACTORY_WORK_ITEM_SOURCES_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_sources',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n work_item_id: { type: 'text' },\n provider: { type: 'text' },\n integration_id: { type: 'text' },\n source_type: { type: 'text' },\n workspace_id: { type: 'text', nullable: true },\n external_id: { type: 'text' },\n source_key: { type: 'text', nullable: true },\n url: { type: 'text', nullable: true },\n key: { type: 'text', nullable: true },\n state: { type: 'text', nullable: true },\n labels: { type: 'json' },\n author: { type: 'text', nullable: true },\n metadata: { type: 'json', nullable: true },\n /** `origin` for the record the work item was created from, `attached` for one added later. Null (rows written before this column) reads as `origin`. */\n role: { type: 'text', nullable: true },\n revision: { type: 'integer', default: 1 },\n synced_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_work_item_sources_project_provider_external_unique',\n columns: ['org_id', 'factory_project_id', 'provider', 'external_id'],\n },\n ],\n indexes: [\n { name: 'factory_work_item_sources_work_item_idx', columns: ['work_item_id'] },\n { name: 'factory_work_item_sources_source_key_idx', columns: ['source_key'] },\n ],\n};\n\n/** Placement/process state. Its id preserves every legacy card reference. */\nexport const FACTORY_BOARD_ITEMS_SCHEMA: CollectionSchema = {\n name: 'factory_board_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n work_item_id: { type: 'text' },\n triage_type: { type: 'text', nullable: true },\n accepted_at: { type: 'timestamp', nullable: true },\n autonomy_armed_at: { type: 'timestamp', nullable: true },\n plans_preapproved_at: { type: 'timestamp', nullable: true },\n board: { type: 'text', nullable: true },\n parent_board_item_id: { type: 'text', nullable: true },\n stages: { type: 'json' },\n stage_history: { type: 'json' },\n sessions: { type: 'json' },\n metadata: { type: 'json', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_by: { type: 'text' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n migrated_from_updated_at: { type: 'timestamp', nullable: true },\n migrated_from_hash: { type: 'text', nullable: true },\n /** Moves on every change to the card, in any of its tables; board reloads read rows changed since. */\n changed_at: { type: 'timestamp', nullable: true },\n },\n uniqueIndexes: [{ name: 'factory_board_items_work_item_unique', columns: ['work_item_id'] }],\n indexes: [\n {\n name: 'factory_board_items_project_changed_at_idx',\n columns: ['org_id', 'factory_project_id', 'changed_at'],\n },\n {\n name: 'factory_board_items_org_project_created_at_id_idx',\n columns: ['org_id', 'factory_project_id', 'created_at', 'id'],\n },\n {\n name: 'factory_board_items_project_parent_idx',\n columns: ['org_id', 'factory_project_id', 'parent_board_item_id'],\n },\n ],\n};\n\nexport interface WorkItemDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n title: string;\n description: string | null;\n parent_work_item_id: string | null;\n revision: number;\n created_at: Date;\n updated_at: Date;\n}\n\nexport interface WorkItemSourceDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n work_item_id: string;\n provider: WorkItemProvider;\n integration_id: string;\n source_type: string;\n workspace_id: string | null;\n external_id: string;\n source_key: string | null;\n url: string | null;\n key: string | null;\n state: string | null;\n labels: string[];\n author: string | null;\n metadata: Record<string, unknown> | null;\n role?: WorkItemSourceRole | null;\n revision: number;\n synced_at: Date | null;\n created_at: Date;\n updated_at: Date;\n}\n\nexport type WorkItemSourceRole = 'origin' | 'attached';\n\nexport interface WorkItemSourceRow {\n id: string;\n workItemId: string;\n provider: WorkItemProvider;\n integrationId: string;\n sourceType: string;\n workspaceId: string | null;\n externalId: string;\n sourceKey: string | null;\n key: string | null;\n url: string | null;\n state: string | null;\n labels: string[];\n author: string | null;\n metadata: Record<string, unknown> | null;\n revision: number;\n syncedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport function primarySource(card: { workItem: { sources: readonly WorkItemSourceRow[] } }): WorkItemSourceRow | null {\n return card.workItem.sources[0] ?? null;\n}\n\nexport interface WorkItemRow {\n sources: WorkItemSourceRow[];\n id: string;\n orgId: string;\n factoryProjectId: string;\n provider: WorkItemProvider;\n externalId: string;\n key: string | null;\n url: string | null;\n title: string;\n state: string | null;\n labels: string[];\n author: string | null;\n parentWorkItemId: string | null;\n metadata: Record<string, unknown> | null;\n revision: number;\n syncedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface BoardItemDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n work_item_id: string;\n triage_type: FactoryTriageType | null;\n accepted_at: Date | null;\n autonomy_armed_at: Date | null;\n plans_preapproved_at: Date | null;\n board: string | null;\n parent_board_item_id: string | null;\n stages: string[];\n stage_history: unknown[];\n sessions: Record<string, unknown>;\n metadata: Record<string, unknown> | null;\n revision: number;\n created_by: string;\n created_at: Date;\n updated_at: Date;\n migrated_from_updated_at: Date | null;\n migrated_from_hash: string | null;\n changed_at?: Date | null;\n}\n\n/** Serializes first-copy migration with deletion without locking an entire project's cards. */\nexport const FACTORY_WORK_ITEM_SPLIT_LOCKS_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_split_locks',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n },\n};\n\n/** Deleted card ids prevent the boot migration resurrecting frozen legacy rows. */\nexport const FACTORY_BOARD_ITEM_TOMBSTONES_SCHEMA: CollectionSchema = {\n name: 'factory_board_item_tombstones',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n deleted_at: { type: 'timestamp', nullable: true },\n },\n indexes: [\n {\n name: 'factory_board_item_tombstones_project_deleted_at_idx',\n columns: ['org_id', 'factory_project_id', 'deleted_at'],\n },\n ],\n};\n\n/** The pre-split card table. Frozen: only the split migration reads it. */\nexport const WORK_ITEMS_SCHEMA: CollectionSchema = {\n name: 'work_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n board: { type: 'text', nullable: true },\n external_source: { type: 'json', nullable: true },\n source_key: { type: 'text', nullable: true },\n // Retained for existing tables; claims no longer govern work-item identity.\n claim_key: { type: 'text', nullable: true },\n parent_work_item_id: { type: 'text', nullable: true },\n title: { type: 'text' },\n description: { type: 'text', nullable: true },\n stages: { type: 'json' },\n stage_history: { type: 'json' },\n sessions: { type: 'json' },\n metadata: { type: 'json', nullable: true },\n triage_type: { type: 'text', nullable: true },\n autonomy_armed_at: { type: 'timestamp', nullable: true },\n // Retired hands-off plan grant: plans are approved per board (`exitTool`).\n plans_preapproved_at: { type: 'timestamp', nullable: true },\n accepted_at: { type: 'timestamp', nullable: true },\n // Retired comment summaries: kept so replicas still on the old release can write them.\n comment_count: { type: 'integer', default: 0 },\n feed_activity_at: { type: 'timestamp', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_by: { type: 'text' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'work_items_project_source_key_unique',\n columns: ['factory_project_id', 'source_key'],\n },\n {\n // One live card per claimed external record per org. NULL keys never\n // collide, so unclaimed cards are unaffected.\n name: 'work_items_org_claim_key_unique',\n columns: ['org_id', 'claim_key'],\n },\n ],\n indexes: [\n {\n name: 'work_items_org_project_created_at_id_idx',\n columns: ['org_id', 'factory_project_id', 'created_at', 'id'],\n },\n {\n name: 'work_items_project_parent_idx',\n columns: ['org_id', 'factory_project_id', 'parent_work_item_id'],\n },\n {\n // The unique index leads with `factory_project_id`, so it cannot serve a\n // lookup by the key alone — which is what a platform message has.\n name: 'work_items_source_key_idx',\n columns: ['source_key'],\n },\n {\n // Finds the newest legacy write without a scan, so a finished split can be confirmed at boot.\n name: 'work_items_updated_at_id_idx',\n columns: ['updated_at', 'id'],\n },\n ],\n};\n\n/** Records the newest legacy row a finished split pass covered; later boots skip unchanged legacy tables. */\nexport const FACTORY_WORK_ITEM_SPLIT_STATE_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_split_state',\n columns: {\n id: { type: 'text', primaryKey: true },\n legacy_updated_at: { type: 'timestamp', nullable: true },\n legacy_id: { type: 'text', nullable: true },\n completed_at: { type: 'timestamp' },\n },\n};\n"],"mappings":";;AAeA,MAAa,4BAA8C;CACzD,MAAM;CACN,SAAS;EACP,IAAI,EAAE,MAAM,UAAU;EACtB,QAAQ,EAAE,MAAM,OAAO;EACvB,oBAAoB,EAAE,MAAM,OAAO;EACnC,OAAO,EAAE,MAAM,OAAO;EACtB,aA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EAC7C,kBAAkB;GAAE,MAAM;GAAa,UAAU;EAAK;EACtD,UAAU;GAAE,MAAM;GAAW,SAAS;EAAE;EACxC,YAAY,EAAE,MAAM,OAAO;EAC3B,YAAY,EAAE,MAAM,YAAY;EAChC,YAAY,EAAE,MAAM,YAAY;CAClC;CACA,eAAe,CACb;EACE,MAAM;EACN,SAAS,CAAC,sBAAsB,YAAY;CAC9C,GACA;EAGE,MAAM;EACN,SAAS,CAAC,UAAU,WAAW;CACjC,CACF;CACA,SAAS;EACP;GACE,MAAM;GACN,SAAS;IAAC;IAAU;IAAsB;IAAc;GAAI;EAC9D;EACA;GACE,MAAM;GACN,SAAS;IAAC;IAAU;IAAsB;GAAqB;EACjE;EACA;GAGE,MAAM;GACN,SAAS,CAAC,YAAY;EACxB;EACA;GAEE,MAAM;GACN,SAAS,CAAC,cAAc,IAAI;EAC9B;CACF;AACF;;AAGA,MAAa,uCAAyD;CACpE,MAAM;CACN,SAAS;EACP,IAAI;GAAE,MAAM;GAAQ,YAAY;EAAK;EACrC,mBAAmB;GAAE,MAAM;GAAa,UAAU;EAAK;EACvD,WAAW;GAAE,MAAM;GAAQ,UAAU;EAAK;EAC1C,cAAc,EAAE,MAAM,YAAY;CACpC;AACF"}
|
|
1
|
+
{"version":3,"file":"work-item-schema.js","names":[],"sources":["../../../../src/storage/domains/work-items/work-item-schema.ts"],"sourcesContent":["import type { CollectionSchema } from '@mastra/core/storage';\n\nimport type { FactoryTriageType } from '../../../rules/types.js';\n\nexport type WorkItemProvider =\n | 'github'\n | 'gitlab'\n | 'jira'\n | 'linear'\n | 'slack'\n | 'incidentio'\n | 'factory'\n | (string & {});\n\n/** The work itself; external identities and facts belong to its sources. */\nexport const FACTORY_WORK_ITEMS_SCHEMA: CollectionSchema = {\n name: 'factory_work_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n title: { type: 'text' },\n description: { type: 'text', nullable: true },\n parent_work_item_id: { type: 'text', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n indexes: [{ name: 'factory_work_items_org_project_idx', columns: ['org_id', 'factory_project_id'] }],\n};\n\n/** Several external records can describe one work item. Native work has no source. */\nexport const FACTORY_WORK_ITEM_SOURCES_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_sources',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n work_item_id: { type: 'text' },\n provider: { type: 'text' },\n integration_id: { type: 'text' },\n source_type: { type: 'text' },\n workspace_id: { type: 'text', nullable: true },\n external_id: { type: 'text' },\n source_key: { type: 'text', nullable: true },\n url: { type: 'text', nullable: true },\n key: { type: 'text', nullable: true },\n state: { type: 'text', nullable: true },\n labels: { type: 'json' },\n author: { type: 'text', nullable: true },\n metadata: { type: 'json', nullable: true },\n /** `origin` for the record the work item was created from, `attached` for one added later. Null (rows written before this column) reads as `origin`. */\n role: { type: 'text', nullable: true },\n revision: { type: 'integer', default: 1 },\n synced_at: { type: 'timestamp', nullable: true },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'factory_work_item_sources_project_provider_external_unique',\n columns: ['org_id', 'factory_project_id', 'provider', 'external_id'],\n },\n ],\n indexes: [\n { name: 'factory_work_item_sources_work_item_idx', columns: ['work_item_id'] },\n { name: 'factory_work_item_sources_source_key_idx', columns: ['source_key'] },\n ],\n};\n\n/** Placement/process state. Its id preserves every legacy card reference. */\nexport const FACTORY_BOARD_ITEMS_SCHEMA: CollectionSchema = {\n name: 'factory_board_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n work_item_id: { type: 'text' },\n triage_type: { type: 'text', nullable: true },\n accepted_at: { type: 'timestamp', nullable: true },\n autonomy_armed_at: { type: 'timestamp', nullable: true },\n plans_preapproved_at: { type: 'timestamp', nullable: true },\n board: { type: 'text', nullable: true },\n parent_board_item_id: { type: 'text', nullable: true },\n stages: { type: 'json' },\n stage_history: { type: 'json' },\n sessions: { type: 'json' },\n metadata: { type: 'json', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_by: { type: 'text' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n migrated_from_updated_at: { type: 'timestamp', nullable: true },\n migrated_from_hash: { type: 'text', nullable: true },\n /** Moves on every change to the card, in any of its tables; board reloads read rows changed since. */\n changed_at: { type: 'timestamp', nullable: true },\n },\n uniqueIndexes: [{ name: 'factory_board_items_work_item_unique', columns: ['work_item_id'] }],\n indexes: [\n {\n name: 'factory_board_items_project_changed_at_idx',\n columns: ['org_id', 'factory_project_id', 'changed_at'],\n },\n {\n name: 'factory_board_items_org_project_created_at_id_idx',\n columns: ['org_id', 'factory_project_id', 'created_at', 'id'],\n },\n {\n name: 'factory_board_items_project_parent_idx',\n columns: ['org_id', 'factory_project_id', 'parent_board_item_id'],\n },\n ],\n};\n\nexport interface WorkItemDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n title: string;\n description: string | null;\n parent_work_item_id: string | null;\n revision: number;\n created_at: Date;\n updated_at: Date;\n}\n\nexport interface WorkItemSourceDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n work_item_id: string;\n provider: WorkItemProvider;\n integration_id: string;\n source_type: string;\n workspace_id: string | null;\n external_id: string;\n source_key: string | null;\n url: string | null;\n key: string | null;\n state: string | null;\n labels: string[];\n author: string | null;\n metadata: Record<string, unknown> | null;\n role?: WorkItemSourceRole | null;\n revision: number;\n synced_at: Date | null;\n created_at: Date;\n updated_at: Date;\n}\n\nexport type WorkItemSourceRole = 'origin' | 'attached';\n\nexport interface WorkItemSourceRow {\n id: string;\n workItemId: string;\n provider: WorkItemProvider;\n integrationId: string;\n sourceType: string;\n workspaceId: string | null;\n externalId: string;\n sourceKey: string | null;\n key: string | null;\n url: string | null;\n state: string | null;\n labels: string[];\n author: string | null;\n metadata: Record<string, unknown> | null;\n revision: number;\n syncedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport function primarySource(card: { workItem: { sources: readonly WorkItemSourceRow[] } }): WorkItemSourceRow | null {\n return card.workItem.sources[0] ?? null;\n}\n\nexport interface WorkItemRow {\n sources: WorkItemSourceRow[];\n id: string;\n orgId: string;\n factoryProjectId: string;\n provider: WorkItemProvider;\n externalId: string;\n key: string | null;\n url: string | null;\n title: string;\n state: string | null;\n labels: string[];\n author: string | null;\n parentWorkItemId: string | null;\n metadata: Record<string, unknown> | null;\n revision: number;\n syncedAt: Date | null;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface BoardItemDbRecord extends Record<string, unknown> {\n id: string;\n org_id: string;\n factory_project_id: string;\n work_item_id: string;\n triage_type: FactoryTriageType | null;\n accepted_at: Date | null;\n autonomy_armed_at: Date | null;\n plans_preapproved_at: Date | null;\n board: string | null;\n parent_board_item_id: string | null;\n stages: string[];\n stage_history: unknown[];\n sessions: Record<string, unknown>;\n metadata: Record<string, unknown> | null;\n revision: number;\n created_by: string;\n created_at: Date;\n updated_at: Date;\n migrated_from_updated_at: Date | null;\n migrated_from_hash: string | null;\n changed_at?: Date | null;\n}\n\n/** Serializes first-copy migration with deletion without locking an entire project's cards. */\nexport const FACTORY_WORK_ITEM_SPLIT_LOCKS_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_split_locks',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n },\n};\n\n/**\n * Deleted card ids: a card list refreshed by delta learns which cards went, and the split migration\n * does not resurrect frozen legacy rows.\n */\nexport const FACTORY_BOARD_ITEM_TOMBSTONES_SCHEMA: CollectionSchema = {\n name: 'factory_board_item_tombstones',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n deleted_at: { type: 'timestamp', nullable: true },\n },\n indexes: [\n {\n name: 'factory_board_item_tombstones_project_deleted_at_idx',\n columns: ['org_id', 'factory_project_id', 'deleted_at'],\n },\n ],\n};\n\n/**\n * The pre-split card table. Frozen: only the split migration reads it, so it is registered only on a\n * database an earlier release already created it in (or in split dry-run mode, which serves from it).\n */\nexport const WORK_ITEMS_SCHEMA: CollectionSchema = {\n name: 'work_items',\n columns: {\n id: { type: 'uuid-pk' },\n org_id: { type: 'text' },\n factory_project_id: { type: 'text' },\n board: { type: 'text', nullable: true },\n external_source: { type: 'json', nullable: true },\n source_key: { type: 'text', nullable: true },\n // Retained for existing tables; claims no longer govern work-item identity.\n claim_key: { type: 'text', nullable: true },\n parent_work_item_id: { type: 'text', nullable: true },\n title: { type: 'text' },\n description: { type: 'text', nullable: true },\n stages: { type: 'json' },\n stage_history: { type: 'json' },\n sessions: { type: 'json' },\n metadata: { type: 'json', nullable: true },\n triage_type: { type: 'text', nullable: true },\n autonomy_armed_at: { type: 'timestamp', nullable: true },\n // Retired hands-off plan grant: plans are approved per board (`exitTool`).\n plans_preapproved_at: { type: 'timestamp', nullable: true },\n accepted_at: { type: 'timestamp', nullable: true },\n // Retired comment summaries: kept so replicas still on the old release can write them.\n comment_count: { type: 'integer', default: 0 },\n feed_activity_at: { type: 'timestamp', nullable: true },\n revision: { type: 'integer', default: 1 },\n created_by: { type: 'text' },\n created_at: { type: 'timestamp' },\n updated_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'work_items_project_source_key_unique',\n columns: ['factory_project_id', 'source_key'],\n },\n {\n // One live card per claimed external record per org. NULL keys never\n // collide, so unclaimed cards are unaffected.\n name: 'work_items_org_claim_key_unique',\n columns: ['org_id', 'claim_key'],\n },\n ],\n indexes: [\n {\n name: 'work_items_org_project_created_at_id_idx',\n columns: ['org_id', 'factory_project_id', 'created_at', 'id'],\n },\n {\n name: 'work_items_project_parent_idx',\n columns: ['org_id', 'factory_project_id', 'parent_work_item_id'],\n },\n {\n // The unique index leads with `factory_project_id`, so it cannot serve a\n // lookup by the key alone — which is what a platform message has.\n name: 'work_items_source_key_idx',\n columns: ['source_key'],\n },\n {\n // Finds the newest legacy write without a scan, so a finished split can be confirmed at boot.\n name: 'work_items_updated_at_id_idx',\n columns: ['updated_at', 'id'],\n },\n ],\n};\n\n/**\n * Records the newest legacy row a finished split pass covered; later boots skip unchanged legacy tables.\n * Exists only alongside {@link WORK_ITEMS_SCHEMA}.\n */\nexport const FACTORY_WORK_ITEM_SPLIT_STATE_SCHEMA: CollectionSchema = {\n name: 'factory_work_item_split_state',\n columns: {\n id: { type: 'text', primaryKey: true },\n legacy_updated_at: { type: 'timestamp', nullable: true },\n legacy_id: { type: 'text', nullable: true },\n completed_at: { type: 'timestamp' },\n },\n};\n"],"mappings":";;AAeA,MAAa,4BAA8C;CACzD,MAAM;CACN,SAAS;EACP,IAAI,EAAE,MAAM,UAAU;EACtB,QAAQ,EAAE,MAAM,OAAO;EACvB,oBAAoB,EAAE,MAAM,OAAO;EACnC,OAAO,EAAE,MAAM,OAAO;EACtB,aAAa;GAAE,MAAM;GAAQ,UAAU;EAAK;EAC5C,qBAAqB;GAAE,MAAM;GAAQ,UAAU;EAAK;EACpD,UAAU;GAAE,MAAM;GAAW,SAAS;EAAE;EACxC,YAAY,EAAE,MAAM,YAAY;EAChC,YAAY,EAAE,MAAM,YAAY;CAClC;CACA,SAAS,CAAC;EAAE,MAAM;EAAsC,SAAS,CAAC,UAAU,oBAAoB;CAAE,CAAC;AACrG;;AAGA,MAAa,mCAAqD;CAChE,MAAM;CACN,SAAS;EACP,IAAI,EAAE,MAAM,UAAU;EACtB,QAAQ,EAAE,MAAM,OAAO;EACvB,oBAAoB,EAAE,MAAM,OAAO;EACnC,cAAc,EAAE,MAAM,OAAO;EAC7B,UAAU,EAAE,MAAM,OAAO;EACzB,gBAAgB,EAAE,MAAM,OAAO;EAC/B,aAAa,EAAE,MAAM,OAAO;EAC5B,cAAc;GAAE,MAAM;GAAQ,UAAU;EAAK;EAC7C,aAAa,EAA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CACN,SAAS;EACP,IAAI;GAAE,MAAM;GAAQ,YAAY;EAAK;EACrC,mBAAmB;GAAE,MAAM;GAAa,UAAU;EAAK;EACvD,WAAW;GAAE,MAAM;GAAQ,UAAU;EAAK;EAC1C,cAAc,EAAE,MAAM,YAAY;CACpC;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CollectionSchema, FactoryStorage } from '@mastra/core/storage';
|
|
2
|
+
/**
|
|
3
|
+
* Register collections an earlier release created only to migrate its data forward, and only on a
|
|
4
|
+
* database that already has the first one. A fresh database never gets them; an upgraded one keeps
|
|
5
|
+
* them and their data. A backend that cannot tell whether a table exists creates them as before.
|
|
6
|
+
* Returns whether they were registered, i.e. whether the caller may read or write them.
|
|
7
|
+
*/
|
|
8
|
+
export declare function ensureLegacyCollections(storage: FactoryStorage, schemas: CollectionSchema[]): Promise<boolean>;
|
|
9
|
+
//# sourceMappingURL=legacy-collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-collections.d.ts","sourceRoot":"","sources":["../../src/storage/legacy-collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE7E;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAMpH"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/storage/legacy-collections.ts
|
|
2
|
+
/**
|
|
3
|
+
* Register collections an earlier release created only to migrate its data forward, and only on a
|
|
4
|
+
* database that already has the first one. A fresh database never gets them; an upgraded one keeps
|
|
5
|
+
* them and their data. A backend that cannot tell whether a table exists creates them as before.
|
|
6
|
+
* Returns whether they were registered, i.e. whether the caller may read or write them.
|
|
7
|
+
*/
|
|
8
|
+
async function ensureLegacyCollections(storage, schemas) {
|
|
9
|
+
const [marker] = schemas;
|
|
10
|
+
if (!marker) return false;
|
|
11
|
+
if (storage.collectionExists && !await storage.collectionExists(marker.name)) return false;
|
|
12
|
+
await storage.ensureCollections(schemas);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
export { ensureLegacyCollections };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=legacy-collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-collections.js","names":[],"sources":["../../src/storage/legacy-collections.ts"],"sourcesContent":["import type { CollectionSchema, FactoryStorage } from '@mastra/core/storage';\n\n/**\n * Register collections an earlier release created only to migrate its data forward, and only on a\n * database that already has the first one. A fresh database never gets them; an upgraded one keeps\n * them and their data. A backend that cannot tell whether a table exists creates them as before.\n * Returns whether they were registered, i.e. whether the caller may read or write them.\n */\nexport async function ensureLegacyCollections(storage: FactoryStorage, schemas: CollectionSchema[]): Promise<boolean> {\n const [marker] = schemas;\n if (!marker) return false;\n if (storage.collectionExists && !(await storage.collectionExists(marker.name))) return false;\n await storage.ensureCollections(schemas);\n return true;\n}\n"],"mappings":";;;;;;;AAQA,eAAsB,wBAAwB,SAAyB,SAA+C;CACpH,MAAM,CAAC,UAAU;CACjB,IAAI,CAAC,QAAQ,OAAO;CACpB,IAAI,QAAQ,oBAAoB,CAAE,MAAM,QAAQ,iBAAiB,OAAO,IAAI,GAAI,OAAO;CACvF,MAAM,QAAQ,kBAAkB,OAAO;CACvC,OAAO;AACT"}
|
package/dist/timing.d.ts
CHANGED
|
@@ -36,7 +36,10 @@ export declare function instrumentMethods<T extends object>(target: T, label: st
|
|
|
36
36
|
* when timing is disabled.
|
|
37
37
|
*/
|
|
38
38
|
export declare function instrumentAsyncMethods<T extends object>(target: T, label: string): T;
|
|
39
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Run `fn`, logging its duration under `phase` when `bootDiagnosticsEnabled`. Workspace phases also
|
|
41
|
+
* feed the `sandbox` metrics, whether or not the line is logged.
|
|
42
|
+
*/
|
|
40
43
|
export declare function timedPhase<T>(phase: string, fn: () => Promise<T>): Promise<T>;
|
|
41
44
|
/**
|
|
42
45
|
* Run `fn`, logging only when it exceeds `thresholdMs`. Request-path use,
|
package/dist/timing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../src/timing.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"timing.d.ts","sourceRoot":"","sources":["../src/timing.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC;;;GAGG;AACH,eAAO,MAAM,oBAAoB,SAA2D,CAAC;AAE7F;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,SAGyB,CAAC;AAE7D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED,4EAA4E;AAC5E,wBAAsB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAQ9E;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,QAC1B,OAAO,QAAQ,MAAM,OAAO,CAAC,IAAI,CAAC,KAAG,OAAO,CAAC,IAAI,CAAC,CAQpE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,CAAC,CAgB3G;AAmBD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAyBpF;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAYnF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAUjH"}
|
package/dist/timing.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { recordWorkspacePhase } from "./metrics/sandbox.js";
|
|
1
2
|
// src/timing.ts
|
|
2
3
|
/**
|
|
3
4
|
* Verbose per-operation timing (HTTP requests, storage calls, sandbox
|
|
@@ -92,14 +93,21 @@ function instrumentAsyncMethods(target, label) {
|
|
|
92
93
|
return fn;
|
|
93
94
|
} });
|
|
94
95
|
}
|
|
95
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Run `fn`, logging its duration under `phase` when `bootDiagnosticsEnabled`. Workspace phases also
|
|
98
|
+
* feed the `sandbox` metrics, whether or not the line is logged.
|
|
99
|
+
*/
|
|
96
100
|
async function timedPhase(phase, fn) {
|
|
97
|
-
if (!bootDiagnosticsEnabled) return fn();
|
|
98
101
|
const start = performance.now();
|
|
102
|
+
let ok = false;
|
|
99
103
|
try {
|
|
100
|
-
|
|
104
|
+
const result = await fn();
|
|
105
|
+
ok = true;
|
|
106
|
+
return result;
|
|
101
107
|
} finally {
|
|
102
|
-
|
|
108
|
+
const elapsed = performance.now() - start;
|
|
109
|
+
if (bootDiagnosticsEnabled) process.stderr.write(`[factory:timing] ${phase} ${Math.round(elapsed)}ms\n`);
|
|
110
|
+
recordWorkspacePhase(phase, elapsed, ok);
|
|
103
111
|
}
|
|
104
112
|
}
|
|
105
113
|
/**
|
package/dist/timing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timing.js","names":[],"sources":["../src/timing.ts"],"sourcesContent":["/**\n * Lightweight phase timing for factory boot and hot request paths.\n *\n * Deliberately not a metrics framework: structured stderr lines that can be\n * grepped (`[factory:timing]`) and diffed across runs to localize slow boot\n * phases and slow per-request dependencies.\n */\n\nimport type { Context } from 'hono';\n\n/**\n * Verbose per-operation timing (HTTP requests, storage calls, sandbox\n * commands). Off by default; enable per deployment with `FACTORY_TIMING=1`.\n */\nexport const factoryTimingEnabled = /^(1|true|yes)$/i.test(process.env.FACTORY_TIMING ?? '');\n\n/**\n * Boot diagnostics (phase timings, integration config) are on by default so\n * slow or misconfigured deployed boots stay visible. `mastra factory dev`\n * (`MASTRA_FACTORY_DEV=true`) keeps first boot quiet unless run with\n * `--debug` (`MASTRA_FACTORY_DEBUG=true`) or `FACTORY_TIMING` is set.\n */\nexport const bootDiagnosticsEnabled =\n factoryTimingEnabled ||\n process.env.MASTRA_FACTORY_DEV !== 'true' ||\n /^(1|true)$/i.test(process.env.MASTRA_FACTORY_DEBUG ?? '');\n\nexport function logTiming(line: string): void {\n process.stderr.write(`[factory:timing] ${line}\\n`);\n}\n\n/** Run `fn`, logging its duration only when `FACTORY_TIMING` is enabled. */\nexport async function timed<T>(phase: string, fn: () => Promise<T>): Promise<T> {\n if (!factoryTimingEnabled) return fn();\n const start = performance.now();\n try {\n return await fn();\n } finally {\n logTiming(`${phase} ${Math.round(performance.now() - start)}ms`);\n }\n}\n\n/** Hono middleware logging method, path, status, and duration of each request. */\nexport function createRequestTimingMiddleware() {\n return async (c: Context, next: () => Promise<void>): Promise<void> => {\n const start = performance.now();\n try {\n await next();\n } finally {\n logTiming(`http ${c.req.method} ${c.req.path} ${c.res.status} ${Math.round(performance.now() - start)}ms`);\n }\n };\n}\n\n/**\n * Patch `methods` on `target` in place so each call logs `<label>.<method>`\n * duration. In-place (not a Proxy) so object identity is preserved.\n */\nexport function instrumentMethods<T extends object>(target: T, label: string, methods: readonly string[]): T {\n if (!factoryTimingEnabled) return target;\n const record = target as Record<string, unknown>;\n for (const name of methods) {\n const original = record[name];\n if (typeof original !== 'function') continue;\n record[name] = (...args: unknown[]) => {\n const start = performance.now();\n const result = original.apply(target, args);\n if (result instanceof Promise) {\n return result.finally(() => logTiming(`${label}.${name} ${Math.round(performance.now() - start)}ms`));\n }\n return result;\n };\n }\n return target;\n}\n\n/** Every method name on `target`'s prototype chain, excluding `Object.prototype`. */\nfunction prototypeMethodNames(target: object): string[] {\n const names = new Set<string>();\n for (\n let proto = Object.getPrototypeOf(target);\n proto && proto !== Object.prototype;\n proto = Object.getPrototypeOf(proto)\n ) {\n for (const name of Object.getOwnPropertyNames(proto)) {\n if (name === 'constructor') continue;\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (typeof descriptor?.value === 'function') names.add(name);\n }\n }\n return [...names];\n}\n\n/**\n * Wrap every async method on `target` so each call logs `<label>.<method>`\n * duration. Domains passed to a `registerDomain` method are instrumented in\n * place as `<label>.<domain name>`, so the handle it returns and later\n * `getDomain` lookups are the same timed object. Returns `target` unchanged\n * when timing is disabled.\n */\nexport function instrumentAsyncMethods<T extends object>(target: T, label: string): T {\n if (!factoryTimingEnabled) return target;\n const wrapped = new Map<PropertyKey, unknown>();\n return new Proxy(target, {\n get(obj, prop, receiver) {\n const value = Reflect.get(obj, prop, receiver);\n if (typeof value !== 'function' || typeof prop === 'symbol' || prop === 'constructor') return value;\n const cached = wrapped.get(prop);\n if (cached) return cached;\n const fn = (...args: unknown[]) => {\n const start = performance.now();\n const result = value.apply(obj, args);\n if (prop === 'registerDomain' && result && typeof result === 'object' && !(result instanceof Promise)) {\n const name = (result as { name?: unknown }).name;\n return instrumentMethods(result, `${label}.${String(name)}`, prototypeMethodNames(result));\n }\n if (result instanceof Promise) {\n return result.finally(() => logTiming(`${label}.${prop} ${Math.round(performance.now() - start)}ms`));\n }\n return result;\n };\n wrapped.set(prop, fn);\n return fn;\n },\n });\n}\n\n
|
|
1
|
+
{"version":3,"file":"timing.js","names":[],"sources":["../src/timing.ts"],"sourcesContent":["/**\n * Lightweight phase timing for factory boot and hot request paths.\n *\n * Deliberately not a metrics framework: structured stderr lines that can be\n * grepped (`[factory:timing]`) and diffed across runs to localize slow boot\n * phases and slow per-request dependencies.\n */\n\nimport type { Context } from 'hono';\n\nimport { recordWorkspacePhase } from './metrics/sandbox.js';\n\n/**\n * Verbose per-operation timing (HTTP requests, storage calls, sandbox\n * commands). Off by default; enable per deployment with `FACTORY_TIMING=1`.\n */\nexport const factoryTimingEnabled = /^(1|true|yes)$/i.test(process.env.FACTORY_TIMING ?? '');\n\n/**\n * Boot diagnostics (phase timings, integration config) are on by default so\n * slow or misconfigured deployed boots stay visible. `mastra factory dev`\n * (`MASTRA_FACTORY_DEV=true`) keeps first boot quiet unless run with\n * `--debug` (`MASTRA_FACTORY_DEBUG=true`) or `FACTORY_TIMING` is set.\n */\nexport const bootDiagnosticsEnabled =\n factoryTimingEnabled ||\n process.env.MASTRA_FACTORY_DEV !== 'true' ||\n /^(1|true)$/i.test(process.env.MASTRA_FACTORY_DEBUG ?? '');\n\nexport function logTiming(line: string): void {\n process.stderr.write(`[factory:timing] ${line}\\n`);\n}\n\n/** Run `fn`, logging its duration only when `FACTORY_TIMING` is enabled. */\nexport async function timed<T>(phase: string, fn: () => Promise<T>): Promise<T> {\n if (!factoryTimingEnabled) return fn();\n const start = performance.now();\n try {\n return await fn();\n } finally {\n logTiming(`${phase} ${Math.round(performance.now() - start)}ms`);\n }\n}\n\n/** Hono middleware logging method, path, status, and duration of each request. */\nexport function createRequestTimingMiddleware() {\n return async (c: Context, next: () => Promise<void>): Promise<void> => {\n const start = performance.now();\n try {\n await next();\n } finally {\n logTiming(`http ${c.req.method} ${c.req.path} ${c.res.status} ${Math.round(performance.now() - start)}ms`);\n }\n };\n}\n\n/**\n * Patch `methods` on `target` in place so each call logs `<label>.<method>`\n * duration. In-place (not a Proxy) so object identity is preserved.\n */\nexport function instrumentMethods<T extends object>(target: T, label: string, methods: readonly string[]): T {\n if (!factoryTimingEnabled) return target;\n const record = target as Record<string, unknown>;\n for (const name of methods) {\n const original = record[name];\n if (typeof original !== 'function') continue;\n record[name] = (...args: unknown[]) => {\n const start = performance.now();\n const result = original.apply(target, args);\n if (result instanceof Promise) {\n return result.finally(() => logTiming(`${label}.${name} ${Math.round(performance.now() - start)}ms`));\n }\n return result;\n };\n }\n return target;\n}\n\n/** Every method name on `target`'s prototype chain, excluding `Object.prototype`. */\nfunction prototypeMethodNames(target: object): string[] {\n const names = new Set<string>();\n for (\n let proto = Object.getPrototypeOf(target);\n proto && proto !== Object.prototype;\n proto = Object.getPrototypeOf(proto)\n ) {\n for (const name of Object.getOwnPropertyNames(proto)) {\n if (name === 'constructor') continue;\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (typeof descriptor?.value === 'function') names.add(name);\n }\n }\n return [...names];\n}\n\n/**\n * Wrap every async method on `target` so each call logs `<label>.<method>`\n * duration. Domains passed to a `registerDomain` method are instrumented in\n * place as `<label>.<domain name>`, so the handle it returns and later\n * `getDomain` lookups are the same timed object. Returns `target` unchanged\n * when timing is disabled.\n */\nexport function instrumentAsyncMethods<T extends object>(target: T, label: string): T {\n if (!factoryTimingEnabled) return target;\n const wrapped = new Map<PropertyKey, unknown>();\n return new Proxy(target, {\n get(obj, prop, receiver) {\n const value = Reflect.get(obj, prop, receiver);\n if (typeof value !== 'function' || typeof prop === 'symbol' || prop === 'constructor') return value;\n const cached = wrapped.get(prop);\n if (cached) return cached;\n const fn = (...args: unknown[]) => {\n const start = performance.now();\n const result = value.apply(obj, args);\n if (prop === 'registerDomain' && result && typeof result === 'object' && !(result instanceof Promise)) {\n const name = (result as { name?: unknown }).name;\n return instrumentMethods(result, `${label}.${String(name)}`, prototypeMethodNames(result));\n }\n if (result instanceof Promise) {\n return result.finally(() => logTiming(`${label}.${prop} ${Math.round(performance.now() - start)}ms`));\n }\n return result;\n };\n wrapped.set(prop, fn);\n return fn;\n },\n });\n}\n\n/**\n * Run `fn`, logging its duration under `phase` when `bootDiagnosticsEnabled`. Workspace phases also\n * feed the `sandbox` metrics, whether or not the line is logged.\n */\nexport async function timedPhase<T>(phase: string, fn: () => Promise<T>): Promise<T> {\n const start = performance.now();\n let ok = false;\n try {\n const result = await fn();\n ok = true;\n return result;\n } finally {\n const elapsed = performance.now() - start;\n if (bootDiagnosticsEnabled) process.stderr.write(`[factory:timing] ${phase} ${Math.round(elapsed)}ms\\n`);\n recordWorkspacePhase(phase, elapsed, ok);\n }\n}\n\n/**\n * Run `fn`, logging only when it exceeds `thresholdMs`. Request-path use,\n * where per-request logging would be noise but slow outliers must surface.\n */\nexport async function timedAboveThreshold<T>(phase: string, thresholdMs: number, fn: () => Promise<T>): Promise<T> {\n const start = performance.now();\n try {\n return await fn();\n } finally {\n const elapsed = performance.now() - start;\n if (elapsed > thresholdMs) {\n process.stderr.write(`[factory:timing] slow ${phase} ${Math.round(elapsed)}ms\\n`);\n }\n }\n}\n"],"mappings":";;;;;;AAgBA,MAAa,uBAAuB,kBAAkB,KAAK,QAAQ,IAAI,kBAAkB,EAAE;;;;;;;AAQ3F,MAAa,yBACX,wBACA,QAAQ,IAAI,uBAAuB,UACnC,cAAc,KAAK,QAAQ,IAAI,wBAAwB,EAAE;AAE3D,SAAgB,UAAU,MAAoB;CAC5C,QAAQ,OAAO,MAAM,oBAAoB,KAAK,GAAG;AACnD;;AAGA,eAAsB,MAAS,OAAe,IAAkC;CAC9E,IAAI,CAAC,sBAAsB,OAAO,GAAG;CACrC,MAAM,QAAQ,YAAY,IAAI;CAC9B,IAAI;EACF,OAAO,MAAM,GAAG;CAClB,UAAU;EACR,UAAU,GAAG,MAAM,GAAG,KAAK,MAAM,YAAY,IAAI,IAAI,KAAK,EAAE,GAAG;CACjE;AACF;;AAGA,SAAgB,gCAAgC;CAC9C,OAAO,OAAO,GAAY,SAA6C;EACrE,MAAM,QAAQ,YAAY,IAAI;EAC9B,IAAI;GACF,MAAM,KAAK;EACb,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/workspace.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAA2B,MAAM,mCAAmC,CAAC;AAKtG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAoB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EACV,cAAc,EAEd,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAG1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAA2B,MAAM,mCAAmC,CAAC;AAKtG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAoB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,KAAK,EACV,cAAc,EAEd,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EACjB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAG1F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAoC9E,OAAO,KAAK,EAAE,qBAAqB,EAA4C,MAAM,8BAA8B,CAAC;AAQpH,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAA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E,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,kGAAkG;AAClG,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,qBAAqB,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,8EAA8E;IAC9E,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAuBD;;;;GAIG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,IAAI,CAAC,0BAA0B,EAAE,qBAAqB,GAAG,cAAc,CAAC,EACjF,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,kBAAkB,CAAC,CAsD7B;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,kBAAkB,EAC/B,OAAO,EAAE;IACP,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAClG,WAAW,CAAC,EAAE,qBAAqB,CAAC,aAAa,CAAC,CAAC;CACpD,GACA,IAAI,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAe1C;AAED,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,6BAAkC,aA8uC/D,uBAAuB,2MACzC"}
|
package/dist/workspace.js
CHANGED
|
@@ -5,6 +5,7 @@ import { groupRepositoryIds, groupedRepositoryAccess } from "./environment/repos
|
|
|
5
5
|
import { getGithubPat } from "./integrations/github/pat.js";
|
|
6
6
|
import { DEFAULT_COMMAND_TIMEOUT_MS, SetupCommandError, checkoutSessionBranch, materializeRepo, runSetupCommand, runTeardownCommand, syncEnvironmentRepository } from "./integrations/github/sandbox.js";
|
|
7
7
|
import { registerGithubPatKind, registerGithubRefreshTarget, registerGithubTokenInjector, registerGithubTokenInjectorResolver } from "./integrations/github/token-refresh.js";
|
|
8
|
+
import { instrumentSandboxStart, markEagerSandboxStart, recordSandboxAcquired } from "./metrics/sandbox.js";
|
|
8
9
|
import { requireExec } from "./sandbox/materialization.js";
|
|
9
10
|
import { attachSandboxEnvRefresh, resolveSandboxEnv, resolveSandboxEnvOrEmpty, sandboxBuildContext } from "./sandbox/sandbox-env.js";
|
|
10
11
|
import { createEnvironmentSetupHook, createSessionSetupHook, evictSessionSandbox, getSessionSandbox, hasFailedSetupCommand, recordFailedSetupCommand, resolveSessionWorkdir } from "./sandbox/session-sandbox.js";
|
|
@@ -643,6 +644,7 @@ function createWorkspaceFactory(options = {}) {
|
|
|
643
644
|
"executeCommand",
|
|
644
645
|
"reconnect"
|
|
645
646
|
]);
|
|
647
|
+
instrumentSandboxStart(sandbox, factorySandbox.provider, session.sandboxId != null);
|
|
646
648
|
if (envScope && sandboxEnv) attachSandboxEnvRefresh(sandbox, {
|
|
647
649
|
initial: sandboxEnv,
|
|
648
650
|
revision: async () => (await sandboxEnvs.revisions(envScope.orgId, envScope.projectId))?.revision ?? "",
|
|
@@ -666,6 +668,7 @@ function createWorkspaceFactory(options = {}) {
|
|
|
666
668
|
};
|
|
667
669
|
}
|
|
668
670
|
sandbox.setOnStart((previous) => async (args) => {
|
|
671
|
+
recordSandboxAcquired(args.sandbox, args.outcome);
|
|
669
672
|
try {
|
|
670
673
|
await timedPhase(`workspace.onStart(${args.outcome})`, async () => {
|
|
671
674
|
await setupHook(args);
|
|
@@ -684,7 +687,10 @@ function createWorkspaceFactory(options = {}) {
|
|
|
684
687
|
const fireEagerStart = () => {
|
|
685
688
|
if (!startEagerly) return;
|
|
686
689
|
startEagerly = false;
|
|
687
|
-
Promise.resolve().then(() =>
|
|
690
|
+
Promise.resolve().then(() => {
|
|
691
|
+
markEagerSandboxStart(sessionEntry.sandbox);
|
|
692
|
+
return sessionEntry.sandbox.start?.();
|
|
693
|
+
}).catch((error) => {
|
|
688
694
|
console.warn(`[factory] Eager sandbox start for session ${session.id} failed:`, error);
|
|
689
695
|
});
|
|
690
696
|
};
|
|
@@ -1200,7 +1206,6 @@ function createWorkspaceFactory(options = {}) {
|
|
|
1200
1206
|
if (primaryError) throw primaryError;
|
|
1201
1207
|
};
|
|
1202
1208
|
const recordSetupResults = async (repos, states, failures, inFlight, repeated) => {
|
|
1203
|
-
const builtAt = /* @__PURE__ */ new Date();
|
|
1204
1209
|
try {
|
|
1205
1210
|
for (const state of states) {
|
|
1206
1211
|
if (state.setupStatus === "skipped") continue;
|
|
@@ -1213,8 +1218,7 @@ function createWorkspaceFactory(options = {}) {
|
|
|
1213
1218
|
orgId: session.orgId,
|
|
1214
1219
|
id: repo.projectRepositoryId,
|
|
1215
1220
|
status: state.setupStatus === "failed" ? "failed" : "configured",
|
|
1216
|
-
error: error === void 0 ? null : redactCredentials(error).slice(-2e3)
|
|
1217
|
-
builtAt
|
|
1221
|
+
error: error === void 0 ? null : redactCredentials(error).slice(-2e3)
|
|
1218
1222
|
});
|
|
1219
1223
|
}
|
|
1220
1224
|
} catch (error) {
|