@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.
Files changed (211) hide show
  1. package/README.md +44 -5
  2. package/dist/factory.d.ts +8 -0
  3. package/dist/factory.d.ts.map +1 -1
  4. package/dist/factory.js +26 -10
  5. package/dist/factory.js.map +1 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +1 -2
  9. package/dist/integrations/dependabot/rules.d.ts.map +1 -1
  10. package/dist/integrations/dependabot/rules.js +1 -5
  11. package/dist/integrations/dependabot/rules.js.map +1 -1
  12. package/dist/integrations/github/commits.d.ts +0 -21
  13. package/dist/integrations/github/commits.d.ts.map +1 -1
  14. package/dist/integrations/github/commits.js +1 -24
  15. package/dist/integrations/github/commits.js.map +1 -1
  16. package/dist/integrations/github/integration.d.ts +1 -1
  17. package/dist/integrations/github/integration.d.ts.map +1 -1
  18. package/dist/integrations/github/integration.js +2 -6
  19. package/dist/integrations/github/integration.js.map +1 -1
  20. package/dist/integrations/github/reconcile-worker.d.ts.map +1 -1
  21. package/dist/integrations/github/reconcile-worker.js +30 -1
  22. package/dist/integrations/github/reconcile-worker.js.map +1 -1
  23. package/dist/integrations/github/routes.d.ts +1 -11
  24. package/dist/integrations/github/routes.d.ts.map +1 -1
  25. package/dist/integrations/github/routes.js +6 -515
  26. package/dist/integrations/github/routes.js.map +1 -1
  27. package/dist/integrations/github/rules.d.ts.map +1 -1
  28. package/dist/integrations/github/rules.js +76 -13
  29. package/dist/integrations/github/rules.js.map +1 -1
  30. package/dist/integrations/github/sandbox.d.ts.map +1 -1
  31. package/dist/integrations/github/sandbox.js +11 -2
  32. package/dist/integrations/github/sandbox.js.map +1 -1
  33. package/dist/integrations/gitlab/discovery.d.ts +1 -1
  34. package/dist/integrations/gitlab/discovery.js +1 -1
  35. package/dist/integrations/gitlab/discovery.js.map +1 -1
  36. package/dist/integrations/gitlab/integration.d.ts.map +1 -1
  37. package/dist/integrations/gitlab/integration.js +0 -1
  38. package/dist/integrations/gitlab/integration.js.map +1 -1
  39. package/dist/integrations/gitlab/routes.d.ts +0 -2
  40. package/dist/integrations/gitlab/routes.d.ts.map +1 -1
  41. package/dist/integrations/gitlab/routes.js +49 -165
  42. package/dist/integrations/gitlab/routes.js.map +1 -1
  43. package/dist/integrations/gitlab/rules.d.ts.map +1 -1
  44. package/dist/integrations/gitlab/rules.js +20 -7
  45. package/dist/integrations/gitlab/rules.js.map +1 -1
  46. package/dist/integrations/incidentio/routes.d.ts +5 -5
  47. package/dist/integrations/incidentio/routes.d.ts.map +1 -1
  48. package/dist/integrations/incidentio/routes.js +3 -59
  49. package/dist/integrations/incidentio/routes.js.map +1 -1
  50. package/dist/integrations/incidentio/rules.d.ts.map +1 -1
  51. package/dist/integrations/incidentio/rules.js +1 -5
  52. package/dist/integrations/incidentio/rules.js.map +1 -1
  53. package/dist/integrations/jira/issue-reconciler.d.ts +1 -1
  54. package/dist/integrations/jira/issue-reconciler.d.ts.map +1 -1
  55. package/dist/integrations/jira/issue-reconciler.js.map +1 -1
  56. package/dist/integrations/jira/routes.d.ts +2 -2
  57. package/dist/integrations/jira/routes.d.ts.map +1 -1
  58. package/dist/integrations/jira/routes.js +0 -68
  59. package/dist/integrations/jira/routes.js.map +1 -1
  60. package/dist/integrations/jira/rules.d.ts.map +1 -1
  61. package/dist/integrations/jira/rules.js +1 -5
  62. package/dist/integrations/jira/rules.js.map +1 -1
  63. package/dist/integrations/linear/routes.d.ts +2 -2
  64. package/dist/integrations/linear/routes.d.ts.map +1 -1
  65. package/dist/integrations/linear/routes.js +0 -83
  66. package/dist/integrations/linear/routes.js.map +1 -1
  67. package/dist/integrations/linear/rules.d.ts.map +1 -1
  68. package/dist/integrations/linear/rules.js +12 -5
  69. package/dist/integrations/linear/rules.js.map +1 -1
  70. package/dist/integrations/platform/github/integration.d.ts.map +1 -1
  71. package/dist/integrations/platform/github/integration.js +1 -3
  72. package/dist/integrations/platform/github/integration.js.map +1 -1
  73. package/dist/integrations/platform/jira/routes.d.ts +2 -2
  74. package/dist/integrations/platform/jira/routes.d.ts.map +1 -1
  75. package/dist/integrations/platform/jira/routes.js +0 -69
  76. package/dist/integrations/platform/jira/routes.js.map +1 -1
  77. package/dist/integrations/vanta/rules.d.ts.map +1 -1
  78. package/dist/integrations/vanta/rules.js +1 -5
  79. package/dist/integrations/vanta/rules.js.map +1 -1
  80. package/dist/metrics/collectors/postgres.d.ts +29 -0
  81. package/dist/metrics/collectors/postgres.d.ts.map +1 -0
  82. package/dist/metrics/collectors/postgres.js +121 -0
  83. package/dist/metrics/collectors/postgres.js.map +1 -0
  84. package/dist/metrics/collectors/probe.d.ts +22 -0
  85. package/dist/metrics/collectors/probe.d.ts.map +1 -0
  86. package/dist/metrics/collectors/probe.js +69 -0
  87. package/dist/metrics/collectors/probe.js.map +1 -0
  88. package/dist/metrics/collectors/process.d.ts +13 -0
  89. package/dist/metrics/collectors/process.d.ts.map +1 -0
  90. package/dist/metrics/collectors/process.js +85 -0
  91. package/dist/metrics/collectors/process.js.map +1 -0
  92. package/dist/metrics/collectors/redis.d.ts +29 -0
  93. package/dist/metrics/collectors/redis.d.ts.map +1 -0
  94. package/dist/metrics/collectors/redis.js +97 -0
  95. package/dist/metrics/collectors/redis.js.map +1 -0
  96. package/dist/metrics/config.d.ts +33 -0
  97. package/dist/metrics/config.d.ts.map +1 -0
  98. package/dist/metrics/config.js +65 -0
  99. package/dist/metrics/config.js.map +1 -0
  100. package/dist/metrics/index.d.ts +20 -0
  101. package/dist/metrics/index.d.ts.map +1 -0
  102. package/dist/metrics/index.js +65 -0
  103. package/dist/metrics/index.js.map +1 -0
  104. package/dist/metrics/intake.d.ts +28 -0
  105. package/dist/metrics/intake.d.ts.map +1 -0
  106. package/dist/metrics/intake.js +76 -0
  107. package/dist/metrics/intake.js.map +1 -0
  108. package/dist/metrics/metrics.d.ts +60 -0
  109. package/dist/metrics/metrics.d.ts.map +1 -0
  110. package/dist/metrics/metrics.js +182 -0
  111. package/dist/metrics/metrics.js.map +1 -0
  112. package/dist/metrics/sandbox.d.ts +35 -0
  113. package/dist/metrics/sandbox.d.ts.map +1 -0
  114. package/dist/metrics/sandbox.js +156 -0
  115. package/dist/metrics/sandbox.js.map +1 -0
  116. package/dist/packages/_internals/workspace/dist/index.js.map +1 -1
  117. package/dist/routes/automation-runs.d.ts +0 -2
  118. package/dist/routes/automation-runs.d.ts.map +1 -1
  119. package/dist/routes/automation-runs.js +2 -6
  120. package/dist/routes/automation-runs.js.map +1 -1
  121. package/dist/routes/contracts.d.ts +0 -5
  122. package/dist/routes/contracts.d.ts.map +1 -1
  123. package/dist/routes/contracts.js +2 -4
  124. package/dist/routes/contracts.js.map +1 -1
  125. package/dist/routes/fs.d.ts +10 -0
  126. package/dist/routes/fs.d.ts.map +1 -1
  127. package/dist/routes/fs.js +184 -11
  128. package/dist/routes/fs.js.map +1 -1
  129. package/dist/routes/projects.d.ts.map +1 -1
  130. package/dist/routes/projects.js +4 -17
  131. package/dist/routes/projects.js.map +1 -1
  132. package/dist/routes/source-control-sessions.d.ts +0 -3
  133. package/dist/routes/source-control-sessions.d.ts.map +1 -1
  134. package/dist/routes/source-control-sessions.js +0 -19
  135. package/dist/routes/source-control-sessions.js.map +1 -1
  136. package/dist/routes/surface.d.ts +0 -2
  137. package/dist/routes/surface.d.ts.map +1 -1
  138. package/dist/routes/surface.js +2 -12
  139. package/dist/routes/surface.js.map +1 -1
  140. package/dist/rules/dispatcher.d.ts +1 -0
  141. package/dist/rules/dispatcher.d.ts.map +1 -1
  142. package/dist/rules/dispatcher.js +27 -13
  143. package/dist/rules/dispatcher.js.map +1 -1
  144. package/dist/rules/processor.d.ts.map +1 -1
  145. package/dist/rules/processor.js +1 -6
  146. package/dist/rules/processor.js.map +1 -1
  147. package/dist/rules/start-coordinator.d.ts +1 -0
  148. package/dist/rules/start-coordinator.d.ts.map +1 -1
  149. package/dist/rules/start-coordinator.js +2 -1
  150. package/dist/rules/start-coordinator.js.map +1 -1
  151. package/dist/rules/transition-service.d.ts.map +1 -1
  152. package/dist/rules/transition-service.js +0 -2
  153. package/dist/rules/transition-service.js.map +1 -1
  154. package/dist/sandbox/session-retirement.d.ts.map +1 -1
  155. package/dist/sandbox/session-retirement.js +22 -14
  156. package/dist/sandbox/session-retirement.js.map +1 -1
  157. package/dist/sandbox/session-sandbox.d.ts +2 -0
  158. package/dist/sandbox/session-sandbox.d.ts.map +1 -1
  159. package/dist/sandbox/session-sandbox.js +7 -1
  160. package/dist/sandbox/session-sandbox.js.map +1 -1
  161. package/dist/storage/domains/boards/schemas.d.ts.map +1 -1
  162. package/dist/storage/domains/boards/schemas.js +0 -4
  163. package/dist/storage/domains/boards/schemas.js.map +1 -1
  164. package/dist/storage/domains/intake/base.d.ts +11 -10
  165. package/dist/storage/domains/intake/base.d.ts.map +1 -1
  166. package/dist/storage/domains/intake/base.js +30 -65
  167. package/dist/storage/domains/intake/base.js.map +1 -1
  168. package/dist/storage/domains/integrations/base.d.ts +0 -2
  169. package/dist/storage/domains/integrations/base.d.ts.map +1 -1
  170. package/dist/storage/domains/integrations/base.js +0 -6
  171. package/dist/storage/domains/integrations/base.js.map +1 -1
  172. package/dist/storage/domains/projects/base.d.ts.map +1 -1
  173. package/dist/storage/domains/projects/base.js +0 -12
  174. package/dist/storage/domains/projects/base.js.map +1 -1
  175. package/dist/storage/domains/source-control/base.d.ts +0 -10
  176. package/dist/storage/domains/source-control/base.d.ts.map +1 -1
  177. package/dist/storage/domains/source-control/base.js +1 -19
  178. package/dist/storage/domains/source-control/base.js.map +1 -1
  179. package/dist/storage/domains/source-control/inmemory.d.ts +1 -1
  180. package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -1
  181. package/dist/storage/domains/source-control/inmemory.js +1 -6
  182. package/dist/storage/domains/source-control/inmemory.js.map +1 -1
  183. package/dist/storage/domains/work-items/base.d.ts +6 -36
  184. package/dist/storage/domains/work-items/base.d.ts.map +1 -1
  185. package/dist/storage/domains/work-items/base.js +42 -82
  186. package/dist/storage/domains/work-items/base.js.map +1 -1
  187. package/dist/storage/domains/work-items/work-item-schema.d.ts +12 -3
  188. package/dist/storage/domains/work-items/work-item-schema.d.ts.map +1 -1
  189. package/dist/storage/domains/work-items/work-item-schema.js +12 -3
  190. package/dist/storage/domains/work-items/work-item-schema.js.map +1 -1
  191. package/dist/storage/legacy-collections.d.ts +9 -0
  192. package/dist/storage/legacy-collections.d.ts.map +1 -0
  193. package/dist/storage/legacy-collections.js +17 -0
  194. package/dist/storage/legacy-collections.js.map +1 -0
  195. package/dist/timing.d.ts +4 -1
  196. package/dist/timing.d.ts.map +1 -1
  197. package/dist/timing.js +12 -4
  198. package/dist/timing.js.map +1 -1
  199. package/dist/workspace.d.ts.map +1 -1
  200. package/dist/workspace.js +8 -4
  201. package/dist/workspace.js.map +1 -1
  202. package/factory-skills/configure-factory-rules/SKILL.md +2 -2
  203. package/package.json +10 -10
  204. package/dist/session/filesystem-capture.d.ts +0 -50
  205. package/dist/session/filesystem-capture.d.ts.map +0 -1
  206. package/dist/session/filesystem-capture.js +0 -229
  207. package/dist/session/filesystem-capture.js.map +0 -1
  208. package/dist/storage/domains/filesystem/base.d.ts +0 -30
  209. package/dist/storage/domains/filesystem/base.d.ts.map +0 -1
  210. package/dist/storage/domains/filesystem/base.js +0 -78
  211. package/dist/storage/domains/filesystem/base.js.map +0 -1
@@ -72,7 +72,7 @@ To make a custom phase terminal or seat an agent in it, change its `kind`/`role`
72
72
 
73
73
  Use the custom-board execution example in the Factory README as the configuration pattern. Board and phase identifiers are case-sensitive, 1–128 letters, digits, underscores, or hyphens, beginning with a letter or digit, without surrounding whitespace. Lifecycle, tool-result, and integration decisions may target installed custom phases. Validate membership on the target board, never against a union of installed phase names.
74
74
 
75
- A `transition` decision stays on the item's assigned board. An `upsertLinkedWorkItem` decision may target another installed board; materialization enters that board's declared initial phase before the requested destination. Neither decision can reassign an existing card. Targets are checked before acceptance and before uncommitted deferred effects execute. Preserve committed replay and its original `configVersion` even if the installed configuration changes.
75
+ A `transition` decision stays on the item's assigned board. An `upsertLinkedWorkItem` decision may target another installed board; materialization enters that board's declared initial phase before the requested destination. Neither decision can reassign an existing card. Targets are checked before acceptance and before uncommitted deferred effects execute. Committed replay returns its recorded result even if the installed configuration changes.
76
76
 
77
77
  Working roles identify bindings on the shared Code Agent, not separately configured agents. There is no per-role agent registration option. Declare `invokeSkill` decisions with the working role and a board-owned prompt (or an available skill); do not invent an `agents` configuration. For automatic session preparation, verify the deployment's GitHub integration, project connection and linked repository, sandbox, organization model credentials, and that the phase starts on its own (`autoStart`, optionally `autoStartWhen`); there is no project setting. Enter a working phase through the public transition route as an authorized human when approval is required.
78
78
 
@@ -96,7 +96,7 @@ Before changing a built-in handler:
96
96
 
97
97
  ## Version changes
98
98
 
99
- Set an explicit, deployment-owned `configVersion` on `MastraFactory`. Change it whenever rule behavior changes. It labels persisted evaluations and audit records (stored in the `rule_set_version` column); it must not be used as event identity or added to ingress deduplication keys.
99
+ Set an explicit, deployment-owned `configVersion` on `MastraFactory`. Change it whenever rule behavior changes. It is recorded in transition audit event metadata and the session kickoff header; it must not be used as event identity or added to ingress deduplication keys.
100
100
 
101
101
  ## Safety rules
102
102
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/factory",
3
- "version": "0.29.0-alpha.2",
3
+ "version": "0.29.0-alpha.4",
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": {
@@ -60,10 +60,10 @@
60
60
  "zod": "^4.6.7",
61
61
  "@mastra/auth-studio": "1.4.0",
62
62
  "@mastra/auth-workos": "1.6.9",
63
- "@mastra/code-sdk": "1.19.1-alpha.2",
64
- "@mastra/connect": "1.4.1-alpha.0",
65
- "@mastra/core": "1.84.0-alpha.2",
66
- "@mastra/mcp": "2.9.0",
63
+ "@mastra/code-sdk": "1.19.1-alpha.4",
64
+ "@mastra/connect": "1.4.1-alpha.1",
65
+ "@mastra/core": "1.84.0-alpha.3",
66
+ "@mastra/mcp": "2.10.0-alpha.0",
67
67
  "@mastra/platform-workspace": "1.13.0",
68
68
  "@mastra/slack": "1.9.0"
69
69
  },
@@ -74,13 +74,13 @@
74
74
  "tsdown": "0.23.1",
75
75
  "typescript": "^6.0.3",
76
76
  "vitest": "5.1.0",
77
- "@internal/types-builder": "0.0.124",
78
77
  "@internal/lint": "0.0.149",
78
+ "@internal/types-builder": "0.0.124",
79
79
  "@internal/workspace": "0.0.21",
80
- "@mastra/deployer": "1.84.0-alpha.2",
81
- "@mastra/libsql": "1.30.1-alpha.0",
82
- "@mastra/pg": "1.36.1-alpha.0",
83
- "@mastra/server": "1.84.0-alpha.2"
80
+ "@mastra/deployer": "1.84.0-alpha.3",
81
+ "@mastra/libsql": "1.31.0-alpha.1",
82
+ "@mastra/pg": "1.37.0-alpha.1",
83
+ "@mastra/server": "1.84.0-alpha.3"
84
84
  },
85
85
  "engines": {
86
86
  "node": ">=22.19.0"
@@ -1,50 +0,0 @@
1
- import type { AgentControllerEvent, SessionBeforeAgentEndListener } from '@mastra/core/agent-controller';
2
- import type { WorkspaceSandbox } from '@mastra/core/workspace';
3
- import type { FilesystemFile, FilesystemStorage } from '../storage/domains/filesystem/base.js';
4
- import type { SourceControlStorageHandle } from '../storage/domains/source-control/base.js';
5
- /**
6
- * Regular files directly under the workspace root written since the session
7
- * was created ($2 is a UTC `touch -t` stamp, `YYYYMMDDhhmm.SS`), such as the
8
- * agent's notes. Files the template shipped with predate the session and stay
9
- * out; the checkouts are covered by git. Dotfiles are never listed: a listed
10
- * path becomes readable through the thread's file route, and the root is where
11
- * setup leaves `.env`, `.pgpass`, `.netrc` and other credential files.
12
- * `touch -t` plus `-newer` works on GNU and BSD find alike; `-newermt
13
- * "@epoch"` is GNU only.
14
- */
15
- export declare const ROOT_FILES_LIST_COMMAND: string;
16
- /** `touch -t` stamp of a moment, in UTC. */
17
- export declare function touchStamp(date: Date): string;
18
- export interface FilesystemCaptureSession {
19
- readonly identity: {
20
- getId(): string;
21
- };
22
- readonly thread: {
23
- requireId(): string;
24
- };
25
- getWorkspace(): {
26
- sandbox?: Pick<WorkspaceSandbox, 'executeCommand'>;
27
- } | undefined;
28
- onBeforeAgentEnd(listener: SessionBeforeAgentEndListener): () => void;
29
- subscribe(listener: (event: AgentControllerEvent) => void): () => void;
30
- }
31
- export interface FilesystemCaptureDependencies {
32
- filesystem: Pick<FilesystemStorage, 'replaceFiles'>;
33
- sourceControl: {
34
- sessions: Pick<SourceControlStorageHandle['sessions'], 'getBySessionId'>;
35
- };
36
- }
37
- export declare function parseFilesystemCaptureFiles(output: string): FilesystemFile[];
38
- export declare function captureSessionFilesystem(session: FilesystemCaptureSession, { filesystem, sourceControl }: FilesystemCaptureDependencies, ids?: {
39
- sessionId: string;
40
- threadId: string;
41
- }): Promise<void>;
42
- /**
43
- * Resolve once the session's in-flight filesystem capture (if any) has
44
- * persisted, or after `timeoutMs` so a reader that arrives mid-capture is
45
- * never blocked by the execs' worst-case 30s timeouts. Never rejects: the
46
- * capture body is fully try/catch contained.
47
- */
48
- export declare function waitForPendingFilesystemCapture(sessionId: string, timeoutMs?: number): Promise<void>;
49
- export declare function observeSessionFilesystem(session: FilesystemCaptureSession, dependencies: FilesystemCaptureDependencies): () => void;
50
- //# sourceMappingURL=filesystem-capture.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filesystem-capture.d.ts","sourceRoot":"","sources":["../../src/session/filesystem-capture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AACzG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC/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S,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB1G;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,wBAAwB,EACjC,YAAY,EAAE,6BAA6B,GAC1C,MAAM,IAAI,CAwFZ"}
@@ -1,229 +0,0 @@
1
- import { peekSessionSandbox, sessionLayout } from "../sandbox/session-sandbox.js";
2
- import { peekSessionEnvironment } from "./environment-state-processor.js";
3
- import { isMeaningfulToolName } from "./first-exec-capture.js";
4
- // src/session/filesystem-capture.ts
5
- /** Exit code of `GIT_CHANGED_FILES_SCRIPT` when the checkout is not there: the repository is skipped, not failed. */
6
- const CHECKOUT_MISSING_EXIT_CODE = 3;
7
- const GIT_CHANGED_FILES_SCRIPT = `
8
- set -e
9
- workdir=$1
10
- base_branch=$2
11
- test -d "$workdir" || exit ${CHECKOUT_MISSING_EXIT_CODE}
12
- base=HEAD
13
- if merge_base=$(git -C "$workdir" merge-base HEAD "origin/$base_branch" 2>/dev/null); then
14
- base=$merge_base
15
- fi
16
- git -C "$workdir" diff --name-only -z --find-renames --diff-filter=ACMRTUXB "$base"
17
- git -C "$workdir" ls-files --others --exclude-standard -z
18
- `;
19
- const ARTIFACTS_LIST_COMMAND = "cd \"$1\" && test -d .artifacts && find .artifacts -type f -print0 || true";
20
- /**
21
- * Regular files directly under the workspace root written since the session
22
- * was created ($2 is a UTC `touch -t` stamp, `YYYYMMDDhhmm.SS`), such as the
23
- * agent's notes. Files the template shipped with predate the session and stay
24
- * out; the checkouts are covered by git. Dotfiles are never listed: a listed
25
- * path becomes readable through the thread's file route, and the root is where
26
- * setup leaves `.env`, `.pgpass`, `.netrc` and other credential files.
27
- * `touch -t` plus `-newer` works on GNU and BSD find alike; `-newermt
28
- * "@epoch"` is GNU only.
29
- */
30
- const ROOT_FILES_LIST_COMMAND = [
31
- "cd \"$1\" && ref=$(mktemp) && TZ=UTC touch -t \"$2\" \"$ref\"",
32
- "&& find . -mindepth 1 -maxdepth 1 -type f ! -name '.*' -newer \"$ref\" -print0",
33
- "; status=$?; rm -f \"$ref\"; exit $status"
34
- ].join(" ");
35
- /** `touch -t` stamp of a moment, in UTC. */
36
- function touchStamp(date) {
37
- const two = (value) => String(value).padStart(2, "0");
38
- return `${date.getUTCFullYear()}${two(date.getUTCMonth() + 1)}${two(date.getUTCDate())}${two(date.getUTCHours())}${two(date.getUTCMinutes())}.${two(date.getUTCSeconds())}`;
39
- }
40
- function parseFilesystemCaptureFiles(output) {
41
- const files = /* @__PURE__ */ new Map();
42
- for (const record of output.split("\0")) {
43
- if (!record) continue;
44
- const path = record.replace(/^\.\//, "");
45
- if (path) files.set(path, { path });
46
- }
47
- return [...files.values()].toSorted((a, b) => a.path.localeCompare(b.path));
48
- }
49
- async function captureSessionFilesystem(session, { filesystem, sourceControl }, ids) {
50
- try {
51
- const sessionId = ids?.sessionId ?? session.identity.getId();
52
- const threadId = ids?.threadId ?? session.thread.requireId();
53
- const sourceSession = await sourceControl.sessions.getBySessionId(sessionId);
54
- const sandbox = session.getWorkspace()?.sandbox;
55
- if (!sourceSession || !sandbox?.executeCommand) return;
56
- const entry = peekSessionSandbox(sourceSession.id);
57
- if (!entry) return;
58
- if (entry.sandbox.status !== "running") return;
59
- const layout = sessionLayout(entry);
60
- if (!layout) return;
61
- const multiRepo = layout.repos.length > 1;
62
- const environment = multiRepo ? peekSessionEnvironment(sourceSession.sessionId) : void 0;
63
- const ownRepo = entry.ownRepo.toLowerCase();
64
- const baseBranchFor = (repo) => {
65
- if (repo.slug.toLowerCase() === ownRepo) return sourceSession.baseBranch;
66
- return (environment?.repositories.find((candidate) => candidate.slug.toLowerCase() === repo.slug.toLowerCase()))?.defaultBranch ?? "HEAD";
67
- };
68
- const targets = layout.repos.map((repo) => ({
69
- repo,
70
- baseBranch: baseBranchFor(repo)
71
- }));
72
- const executeCommand = sandbox.executeCommand.bind(sandbox);
73
- const results = await Promise.all(targets.map(({ repo, baseBranch }) => executeCommand("sh", [
74
- "-c",
75
- GIT_CHANGED_FILES_SCRIPT,
76
- "mastracode-changed-files",
77
- repo.dir,
78
- baseBranch
79
- ], { timeout: 3e4 })));
80
- const files = /* @__PURE__ */ new Map();
81
- let captured = 0;
82
- for (const [index, result] of results.entries()) {
83
- if (result.exitCode === CHECKOUT_MISSING_EXIT_CODE) continue;
84
- if (result.exitCode !== 0) {
85
- console.warn("[Factory filesystem capture] Unable to inspect Git changes.", result.stderr);
86
- return;
87
- }
88
- captured += 1;
89
- const prefix = targets[index].repo.prefix;
90
- for (const file of parseFilesystemCaptureFiles(result.stdout)) files.set(`${prefix}${file.path}`, { path: `${prefix}${file.path}` });
91
- }
92
- if (captured === 0) return;
93
- const artifacts = await executeCommand("sh", [
94
- "-c",
95
- ARTIFACTS_LIST_COMMAND,
96
- "sh",
97
- layout.root
98
- ], { timeout: 3e4 });
99
- if (artifacts.exitCode !== 0) {
100
- console.warn("[Factory filesystem capture] Unable to list workspace artifacts.", artifacts.stderr);
101
- return;
102
- }
103
- for (const path of artifacts.stdout.split("\0")) {
104
- const normalizedPath = path.replace(/^\.\//, "");
105
- if (normalizedPath) files.set(normalizedPath, { path: normalizedPath });
106
- }
107
- if (multiRepo) {
108
- const since = touchStamp(sourceSession.createdAt);
109
- const rootFiles = await executeCommand("sh", [
110
- "-c",
111
- ROOT_FILES_LIST_COMMAND,
112
- "sh",
113
- layout.root,
114
- since
115
- ], { timeout: 3e4 });
116
- if (rootFiles.exitCode !== 0) console.warn("[Factory filesystem capture] Unable to list workspace root files.", rootFiles.stderr);
117
- else for (const path of rootFiles.stdout.split("\0")) {
118
- const normalizedPath = path.replace(/^\.\//, "");
119
- if (normalizedPath && !normalizedPath.startsWith(".")) files.set(normalizedPath, { path: normalizedPath });
120
- }
121
- }
122
- await filesystem.replaceFiles({
123
- resourceId: sessionId,
124
- threadId,
125
- files: [...files.values()].toSorted((a, b) => a.path.localeCompare(b.path))
126
- });
127
- } catch (error) {
128
- console.warn("[Factory filesystem capture] Unable to persist files.", error);
129
- }
130
- }
131
- /**
132
- * In-flight capture chains keyed by session id. Serves two purposes: readers
133
- * of the persisted file listing (the /web/workspace routes) await the capture
134
- * for the turn that just ended instead of racing it, and captures for the same
135
- * session stay sequential (last write wins). In-process only: the factory
136
- * server that runs the session controller also serves those routes.
137
- */
138
- const pendingCaptures = /* @__PURE__ */ new Map();
139
- /**
140
- * Resolve once the session's in-flight filesystem capture (if any) has
141
- * persisted, or after `timeoutMs` so a reader that arrives mid-capture is
142
- * never blocked by the execs' worst-case 30s timeouts. Never rejects: the
143
- * capture body is fully try/catch contained.
144
- */
145
- async function waitForPendingFilesystemCapture(sessionId, timeoutMs = 1e4) {
146
- let pending = pendingCaptures.get(sessionId);
147
- if (!pending) return;
148
- let timer;
149
- let timedOut = false;
150
- const deadline = new Promise((resolve) => {
151
- timer = setTimeout(() => {
152
- timedOut = true;
153
- resolve();
154
- }, timeoutMs);
155
- });
156
- try {
157
- while (pending && !timedOut) {
158
- await Promise.race([pending, deadline]);
159
- const next = pendingCaptures.get(sessionId);
160
- pending = next === pending ? void 0 : next;
161
- }
162
- } finally {
163
- clearTimeout(timer);
164
- }
165
- }
166
- function observeSessionFilesystem(session, dependencies) {
167
- let fallbackChain = Promise.resolve();
168
- let workspaceTouched = false;
169
- const toolNames = /* @__PURE__ */ new Map();
170
- const suspended = /* @__PURE__ */ new Set();
171
- const unsubscribeEvents = session.subscribe((event) => {
172
- switch (event.type) {
173
- case "tool_start":
174
- toolNames.set(event.toolCallId, event.toolName);
175
- return;
176
- case "tool_suspended":
177
- suspended.add(event.toolCallId);
178
- return;
179
- case "tool_suspension_cancelled":
180
- toolNames.delete(event.toolCallId);
181
- suspended.delete(event.toolCallId);
182
- return;
183
- case "agent_end":
184
- for (const id of toolNames.keys()) if (!suspended.has(id)) toolNames.delete(id);
185
- return;
186
- case "tool_end": {
187
- const toolName = toolNames.get(event.toolCallId);
188
- toolNames.delete(event.toolCallId);
189
- suspended.delete(event.toolCallId);
190
- if (event.isError || event.denied) return;
191
- if (isMeaningfulToolName(toolName)) workspaceTouched = true;
192
- break;
193
- }
194
- }
195
- });
196
- const unsubscribeEnd = session.onBeforeAgentEnd(() => {
197
- if (!workspaceTouched) return;
198
- workspaceTouched = false;
199
- let sessionId;
200
- try {
201
- sessionId = session.identity.getId();
202
- } catch {
203
- fallbackChain = fallbackChain.then(() => captureSessionFilesystem(session, dependencies));
204
- return;
205
- }
206
- let threadId;
207
- try {
208
- threadId = session.thread.requireId();
209
- } catch {
210
- return;
211
- }
212
- const ids = {
213
- sessionId,
214
- threadId
215
- };
216
- const chain = (pendingCaptures.get(sessionId) ?? Promise.resolve()).then(() => captureSessionFilesystem(session, dependencies, ids));
217
- pendingCaptures.set(sessionId, chain);
218
- chain.finally(() => {
219
- if (pendingCaptures.get(sessionId) === chain) pendingCaptures.delete(sessionId);
220
- });
221
- });
222
- return () => {
223
- unsubscribeEvents();
224
- unsubscribeEnd();
225
- };
226
- }
227
- export { ROOT_FILES_LIST_COMMAND, captureSessionFilesystem, observeSessionFilesystem, parseFilesystemCaptureFiles, touchStamp, waitForPendingFilesystemCapture };
228
-
229
- //# sourceMappingURL=filesystem-capture.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filesystem-capture.js","names":[],"sources":["../../src/session/filesystem-capture.ts"],"sourcesContent":["import type { AgentControllerEvent, SessionBeforeAgentEndListener } from '@mastra/core/agent-controller';\nimport type { WorkspaceSandbox } from '@mastra/core/workspace';\nimport { peekSessionSandbox, sessionLayout } from '../sandbox/session-sandbox.js';\nimport type { SessionLayoutRepository } from '../sandbox/session-sandbox.js';\n\nimport type { FilesystemFile, FilesystemStorage } from '../storage/domains/filesystem/base.js';\nimport type { SourceControlStorageHandle } from '../storage/domains/source-control/base.js';\nimport { peekSessionEnvironment } from './environment-state-processor.js';\nimport { isMeaningfulToolName } from './first-exec-capture.js';\n\n/** Exit code of `GIT_CHANGED_FILES_SCRIPT` when the checkout is not there: the repository is skipped, not failed. */\nconst CHECKOUT_MISSING_EXIT_CODE = 3;\nconst GIT_CHANGED_FILES_SCRIPT = `\nset -e\nworkdir=$1\nbase_branch=$2\ntest -d \"$workdir\" || exit ${CHECKOUT_MISSING_EXIT_CODE}\nbase=HEAD\nif merge_base=$(git -C \"$workdir\" merge-base HEAD \"origin/$base_branch\" 2>/dev/null); then\n base=$merge_base\nfi\ngit -C \"$workdir\" diff --name-only -z --find-renames --diff-filter=ACMRTUXB \"$base\"\ngit -C \"$workdir\" ls-files --others --exclude-standard -z\n`;\nconst ARTIFACTS_LIST_COMMAND = 'cd \"$1\" && test -d .artifacts && find .artifacts -type f -print0 || true';\n/**\n * Regular files directly under the workspace root written since the session\n * was created ($2 is a UTC `touch -t` stamp, `YYYYMMDDhhmm.SS`), such as the\n * agent's notes. Files the template shipped with predate the session and stay\n * out; the checkouts are covered by git. Dotfiles are never listed: a listed\n * path becomes readable through the thread's file route, and the root is where\n * setup leaves `.env`, `.pgpass`, `.netrc` and other credential files.\n * `touch -t` plus `-newer` works on GNU and BSD find alike; `-newermt\n * \"@epoch\"` is GNU only.\n */\nexport const ROOT_FILES_LIST_COMMAND = [\n 'cd \"$1\" && ref=$(mktemp) && TZ=UTC touch -t \"$2\" \"$ref\"',\n '&& find . -mindepth 1 -maxdepth 1 -type f ! -name \\'.*\\' -newer \"$ref\" -print0',\n '; status=$?; rm -f \"$ref\"; exit $status',\n].join(' ');\n\n/** `touch -t` stamp of a moment, in UTC. */\nexport function touchStamp(date: Date): string {\n const two = (value: number) => String(value).padStart(2, '0');\n return (\n `${date.getUTCFullYear()}${two(date.getUTCMonth() + 1)}${two(date.getUTCDate())}` +\n `${two(date.getUTCHours())}${two(date.getUTCMinutes())}.${two(date.getUTCSeconds())}`\n );\n}\n\nexport interface FilesystemCaptureSession {\n readonly identity: { getId(): string };\n readonly thread: { requireId(): string };\n getWorkspace(): { sandbox?: Pick<WorkspaceSandbox, 'executeCommand'> } | undefined;\n onBeforeAgentEnd(listener: SessionBeforeAgentEndListener): () => void;\n subscribe(listener: (event: AgentControllerEvent) => void): () => void;\n}\n\nexport interface FilesystemCaptureDependencies {\n filesystem: Pick<FilesystemStorage, 'replaceFiles'>;\n sourceControl: {\n sessions: Pick<SourceControlStorageHandle['sessions'], 'getBySessionId'>;\n };\n}\n\nexport function parseFilesystemCaptureFiles(output: string): FilesystemFile[] {\n const files = new Map<string, FilesystemFile>();\n for (const record of output.split('\\0')) {\n if (!record) continue;\n const path = record.replace(/^\\.\\//, '');\n if (path) files.set(path, { path });\n }\n\n return [...files.values()].toSorted((a, b) => a.path.localeCompare(b.path));\n}\n\nexport async function captureSessionFilesystem(\n session: FilesystemCaptureSession,\n { filesystem, sourceControl }: FilesystemCaptureDependencies,\n ids?: { sessionId: string; threadId: string },\n): Promise<void> {\n try {\n // Scheduled captures pass ids read at schedule time: a session deleted\n // before the queued capture runs has already cleared its thread.\n const sessionId = ids?.sessionId ?? session.identity.getId();\n const threadId = ids?.threadId ?? session.thread.requireId();\n const sourceSession = await sourceControl.sessions.getBySessionId(sessionId);\n // Chat-only sessions run without a workspace; there is nothing to capture.\n const sandbox = session.getWorkspace()?.sandbox;\n if (!sourceSession || !sandbox?.executeCommand) return;\n // The live workdir comes from the per-process memo (the deterministic\n // truth) ONLY — never the persisted observability column, which a row\n // written under a previous provider can point at a workdir that no\n // longer exists (the stale-workdir incident class). No memo entry means\n // no live sandbox worth capturing in this replica; capture is\n // best-effort telemetry, so skip.\n const entry = peekSessionSandbox(sourceSession.id);\n if (!entry) return;\n // Telemetry must never provision a VM: executeCommand lazily starts the\n // sandbox via ensureRunning, so a chat turn that never touched the\n // workspace would otherwise boot (and clone into) a fresh VM just to\n // capture an empty git status. Only capture when the turn already has a\n // running sandbox.\n if (entry.sandbox.status !== 'running') return;\n // Running-but-unresolved should not happen (the start hook resolves the\n // workdir), but capture is best-effort: skip rather than guess.\n const layout = sessionLayout(entry);\n if (!layout) return;\n\n // One git pass per checkout, in parallel so three repositories stay well\n // inside the 10 s readers wait for a pending capture. The session's own\n // repository compares against the session base branch; the others sit on\n // their default branch and compare against that. A repository whose\n // checkout is missing (exit 3) is skipped: it has nothing to list and\n // must not block the others. Any other failure is treated as transient\n // and leaves the previous listing in place.\n const multiRepo = layout.repos.length > 1;\n const environment = multiRepo ? peekSessionEnvironment(sourceSession.sessionId) : undefined;\n const ownRepo = entry.ownRepo.toLowerCase();\n // The boot records the state at its end, after every setup command; until\n // then a secondary checkout compares against its own `origin/HEAD`.\n const baseBranchFor = (repo: SessionLayoutRepository): string => {\n if (repo.slug.toLowerCase() === ownRepo) return sourceSession.baseBranch;\n const state = environment?.repositories.find(\n candidate => candidate.slug.toLowerCase() === repo.slug.toLowerCase(),\n );\n return state?.defaultBranch ?? 'HEAD';\n };\n const targets = layout.repos.map(repo => ({ repo, baseBranch: baseBranchFor(repo) }));\n const executeCommand = sandbox.executeCommand.bind(sandbox);\n const results = await Promise.all(\n targets.map(({ repo, baseBranch }) =>\n executeCommand('sh', ['-c', GIT_CHANGED_FILES_SCRIPT, 'mastracode-changed-files', repo.dir, baseBranch], {\n timeout: 30_000,\n }),\n ),\n );\n const files = new Map<string, FilesystemFile>();\n let captured = 0;\n for (const [index, result] of results.entries()) {\n if (result.exitCode === CHECKOUT_MISSING_EXIT_CODE) continue;\n if (result.exitCode !== 0) {\n console.warn('[Factory filesystem capture] Unable to inspect Git changes.', result.stderr);\n return;\n }\n captured += 1;\n const prefix = targets[index]!.repo.prefix;\n for (const file of parseFilesystemCaptureFiles(result.stdout)) {\n files.set(`${prefix}${file.path}`, { path: `${prefix}${file.path}` });\n }\n }\n if (captured === 0) return;\n\n const artifacts = await executeCommand('sh', ['-c', ARTIFACTS_LIST_COMMAND, 'sh', layout.root], {\n timeout: 30_000,\n });\n if (artifacts.exitCode !== 0) {\n console.warn('[Factory filesystem capture] Unable to list workspace artifacts.', artifacts.stderr);\n return;\n }\n for (const path of artifacts.stdout.split('\\0')) {\n const normalizedPath = path.replace(/^\\.\\//, '');\n if (normalizedPath) {\n files.set(normalizedPath, { path: normalizedPath });\n }\n }\n\n // With several checkouts the root is a plain directory nothing else lists.\n // A failed listing is logged and the git and artifact results still land.\n if (multiRepo) {\n const since = touchStamp(sourceSession.createdAt);\n const rootFiles = await executeCommand('sh', ['-c', ROOT_FILES_LIST_COMMAND, 'sh', layout.root, since], {\n timeout: 30_000,\n });\n if (rootFiles.exitCode !== 0) {\n console.warn('[Factory filesystem capture] Unable to list workspace root files.', rootFiles.stderr);\n } else {\n for (const path of rootFiles.stdout.split('\\0')) {\n const normalizedPath = path.replace(/^\\.\\//, '');\n if (normalizedPath && !normalizedPath.startsWith('.')) {\n files.set(normalizedPath, { path: normalizedPath });\n }\n }\n }\n }\n\n // The listing describes the session's workspace, not its memory resource,\n // which the session shares with others: rows are keyed by the session id.\n await filesystem.replaceFiles({\n resourceId: sessionId,\n threadId,\n files: [...files.values()].toSorted((a, b) => a.path.localeCompare(b.path)),\n });\n } catch (error) {\n console.warn('[Factory filesystem capture] Unable to persist files.', error);\n }\n}\n\n/**\n * In-flight capture chains keyed by session id. Serves two purposes: readers\n * of the persisted file listing (the /web/workspace routes) await the capture\n * for the turn that just ended instead of racing it, and captures for the same\n * session stay sequential (last write wins). In-process only: the factory\n * server that runs the session controller also serves those routes.\n */\nconst pendingCaptures = new Map<string, Promise<void>>();\n\n/**\n * Resolve once the session's in-flight filesystem capture (if any) has\n * persisted, or after `timeoutMs` so a reader that arrives mid-capture is\n * never blocked by the execs' worst-case 30s timeouts. Never rejects: the\n * capture body is fully try/catch contained.\n */\nexport async function waitForPendingFilesystemCapture(sessionId: string, timeoutMs = 10_000): Promise<void> {\n let pending = pendingCaptures.get(sessionId);\n if (!pending) return;\n let timer: ReturnType<typeof setTimeout> | undefined;\n let timedOut = false;\n const deadline = new Promise<void>(resolve => {\n timer = setTimeout(() => {\n timedOut = true;\n resolve();\n }, timeoutMs);\n });\n try {\n // A turn that ends while we wait chains a successor capture; keep waiting\n // until the latest chain settles so the final snapshot is not lost.\n while (pending && !timedOut) {\n await Promise.race([pending, deadline]);\n const next = pendingCaptures.get(sessionId);\n pending = next === pending ? undefined : next;\n }\n } finally {\n clearTimeout(timer);\n }\n}\n\nexport function observeSessionFilesystem(\n session: FilesystemCaptureSession,\n dependencies: FilesystemCaptureDependencies,\n): () => void {\n let fallbackChain = Promise.resolve();\n // Capture only runs after a turn that actually touched the workspace: a\n // successful workspace tool call both proves the sandbox is awake and is\n // the only way the listing can have changed. Without this gate every chat\n // turn would run two sandbox execs — and since executeCommand resumes an\n // idle VM, a pure-chat turn would keep waking a sandbox it never used.\n // Same bookkeeping as first-exec capture: tool names resolve at tool_end\n // via the tool_start map, and suspended calls survive agent_end so a\n // resumed run's eventual completion still counts for that turn.\n let workspaceTouched = false;\n const toolNames = new Map<string, string>();\n const suspended = new Set<string>();\n const unsubscribeEvents = session.subscribe(event => {\n switch (event.type) {\n case 'tool_start': {\n toolNames.set(event.toolCallId, event.toolName);\n return;\n }\n case 'tool_suspended': {\n suspended.add(event.toolCallId);\n return;\n }\n case 'tool_suspension_cancelled': {\n toolNames.delete(event.toolCallId);\n suspended.delete(event.toolCallId);\n return;\n }\n case 'agent_end': {\n for (const id of toolNames.keys()) {\n if (!suspended.has(id)) toolNames.delete(id);\n }\n return;\n }\n case 'tool_end': {\n const toolName = toolNames.get(event.toolCallId);\n toolNames.delete(event.toolCallId);\n suspended.delete(event.toolCallId);\n if (event.isError || event.denied) return;\n if (isMeaningfulToolName(toolName)) workspaceTouched = true;\n break;\n }\n }\n });\n const unsubscribeEnd = session.onBeforeAgentEnd(() => {\n // onBeforeAgentEnd fires before agent_end is emitted, so every tool_end\n // of the finishing run has already been observed; read then reset.\n if (!workspaceTouched) return;\n workspaceTouched = false;\n // Chain so captures stay sequential (last write wins), but do NOT return\n // the chain: finishAgentRun awaits every listener before emitting\n // agent_end, and the capture's sandbox execs (git status + artifacts\n // find, 30s timeouts each) must not gate turn completion. Readers that\n // need the fresh listing await the pending capture through\n // waitForPendingFilesystemCapture instead. The un-returned chain cannot\n // leak an unhandled rejection: captureSessionFilesystem's entire body\n // runs inside its own try/catch, and disposal of this listener does not\n // cancel an in-flight chain, so a final turn's capture still persists.\n let sessionId: string;\n try {\n sessionId = session.identity.getId();\n } catch {\n // No identity means no route can address this session's listing; keep\n // a per-observer chain so captures still run sequentially.\n fallbackChain = fallbackChain.then(() => captureSessionFilesystem(session, dependencies));\n return;\n }\n let threadId: string;\n try {\n threadId = session.thread.requireId();\n } catch {\n return;\n }\n const ids = { sessionId, threadId };\n const chain = (pendingCaptures.get(sessionId) ?? Promise.resolve()).then(() =>\n captureSessionFilesystem(session, dependencies, ids),\n );\n pendingCaptures.set(sessionId, chain);\n void chain.finally(() => {\n if (pendingCaptures.get(sessionId) === chain) {\n pendingCaptures.delete(sessionId);\n }\n });\n });\n return () => {\n unsubscribeEvents();\n unsubscribeEnd();\n };\n}\n"],"mappings":";;;;;AAWA,MAAM,6BAA6B;AACnC,MAAM,2BAA2B;;;;6BAIJ,2BAA2B;;;;;;;;AAQxD,MAAM,yBAAyB;;;;;;;;;;;AAW/B,MAAa,0BAA0B;CACrC;CACA;CACA;AACF,CAAC,CAAC,KAAK,GAAG;;AAGV,SAAgB,WAAW,MAAoB;CAC7C,MAAM,OAAO,UAAkB,OAAO,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG;CAC5D,OACE,GAAG,KAAK,eAAe,IAAI,IAAI,KAAK,YAAY,IAAI,CAAC,IAAI,IAAI,KAAK,WAAW,CAAC,IAC3E,IAAI,KAAK,YAAY,CAAC,IAAI,IAAI,KAAK,cAAc,CAAC,EAAE,GAAG,IAAI,KAAK,cAAc,CAAC;AAEtF;AAiBA,SAAgB,4BAA4B,QAAkC;CAC5E,MAAM,wBAAQ,IAAI,IAA4B;CAC9C,KAAK,MAAM,UAAU,OAAO,MAAM,IAAI,GAAG;EACvC,IAAI,CAAC,QAAQ;EACb,MAAM,OAAO,OAAO,QAAQ,SAAS,EAAE;EACvC,IAAI,MAAM,MAAM,IAAI,MAAM,EAAE,KAAK,CAAC;CACpC;CAEA,OAA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,WAAW,UAAU,IAAI,MAAM,UAAU;IAC/C,UAAU,OAAO,MAAM,UAAU;IACjC,UAAU,OAAO,MAAM,UAAU;IACjC,IAAI,MAAM,WAAW,MAAM,QAAQ;IACnC,IAAI,qBAAqB,QAAQ,GAAG,mBAAmB;IACvD;GACF;EACF;CACF,CAAC;CACD,MAAM,iBAAiB,QAAQ,uBAAuB;EAGpD,IAAI,CAAC,kBAAkB;EACvB,mBAAmB;EAUnB,IAAI;EACJ,IAAI;GACF,YAAY,QAAQ,SAAS,MAAM;EACrC,QAAQ;GAGN,gBAAgB,cAAc,WAAW,yBAAyB,SAAS,YAAY,CAAC;GACxF;EACF;EACA,IAAI;EACJ,IAAI;GACF,WAAW,QAAQ,OAAO,UAAU;EACtC,QAAQ;GACN;EACF;EACA,MAAM,MAAM;GAAE;GAAW;EAAS;EAClC,MAAM,SAAS,gBAAgB,IAAI,SAAS,KAAK,QAAQ,QAAQ,EAAA,CAAG,WAClE,yBAAyB,SAAS,cAAc,GAAG,CACrD;EACA,gBAAgB,IAAI,WAAW,KAAK;EACpC,MAAW,cAAc;GACvB,IAAI,gBAAgB,IAAI,SAAS,MAAM,OACrC,gBAAgB,OAAO,SAAS;EAEpC,CAAC;CACH,CAAC;CACD,aAAa;EACX,kBAAkB;EAClB,eAAe;CACjB;AACF"}
@@ -1,30 +0,0 @@
1
- import { FactoryStorageDomain } from '@mastra/core/storage';
2
- import type { CollectionSchema } from '@mastra/core/storage';
3
- export interface FilesystemFile {
4
- path: string;
5
- }
6
- export interface ReplaceFilesystemFilesInput {
7
- resourceId: string;
8
- threadId: string;
9
- files: FilesystemFile[];
10
- }
11
- export declare const FILESYSTEM_SCHEMAS: CollectionSchema[];
12
- export declare class FilesystemStorage extends FactoryStorageDomain {
13
- constructor();
14
- init(): Promise<void>;
15
- dangerouslyClearAll(): Promise<void>;
16
- replaceFiles(input: ReplaceFilesystemFilesInput): Promise<void>;
17
- listFiles(args: {
18
- resourceId: string;
19
- threadId: string;
20
- }): Promise<FilesystemFile[]>;
21
- deleteFiles(args: {
22
- resourceId: string;
23
- threadId: string;
24
- }): Promise<number>;
25
- /** Drop every thread's captured listing for a resource (e.g. its sandbox was recreated). */
26
- deleteResourceFiles(args: {
27
- resourceId: string;
28
- }): Promise<number>;
29
- }
30
- //# sourceMappingURL=base.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/storage/domains/filesystem/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB;AAED,eAAO,MAAM,kBAAkB,EAAE,gBAAgB,EAiBhD,CAAC;AAuCF,qBAAa,iBAAkB,SAAQ,oBAAoB;IACzD,cAEC;IAEK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1B;IAEK,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC,CAEzC;IAEK,YAAY,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAUpE;IAEK,SAAS,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAOzF;IAEK,WAAW,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAGjF;IAED,4FAA4F;IACtF,mBAAmB,CAAC,IAAI,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAGvE;CACF"}
@@ -1,78 +0,0 @@
1
- import { FactoryStorageDomain } from "@mastra/core/storage";
2
- // src/storage/domains/filesystem/base.ts
3
- const SNAPSHOTS = "filesystem_snapshots";
4
- const FILESYSTEM_SCHEMAS = [{
5
- name: SNAPSHOTS,
6
- columns: {
7
- id: { type: "uuid-pk" },
8
- resource_id: { type: "text" },
9
- thread_id: { type: "text" },
10
- files: { type: "json" },
11
- captured_at: { type: "timestamp" }
12
- },
13
- uniqueIndexes: [{
14
- name: "filesystem_snapshots_resource_thread_unique",
15
- columns: ["resource_id", "thread_id"]
16
- }]
17
- }];
18
- function assertIdentifier(value, label) {
19
- if (!value.trim()) throw new Error(`[FilesystemStorage] ${label} must not be empty.`);
20
- }
21
- function assertRelativePath(value) {
22
- if (!value || value.startsWith("/") || value.split("/").some((segment) => !segment || segment === "." || segment === "..")) throw new Error("[FilesystemStorage] path must be a non-empty relative path.");
23
- }
24
- function assertScope(args) {
25
- assertIdentifier(args.resourceId, "resourceId");
26
- assertIdentifier(args.threadId, "threadId");
27
- }
28
- function validateFiles(files) {
29
- const paths = /* @__PURE__ */ new Set();
30
- for (const file of files) {
31
- assertRelativePath(file.path);
32
- if (paths.has(file.path)) throw new Error(`[FilesystemStorage] duplicate file path: ${file.path}`);
33
- paths.add(file.path);
34
- }
35
- }
36
- var FilesystemStorage = class extends FactoryStorageDomain {
37
- constructor() {
38
- super("filesystem");
39
- }
40
- async init() {
41
- await this.ensureCollections(FILESYSTEM_SCHEMAS);
42
- }
43
- async dangerouslyClearAll() {
44
- await this.ops.deleteMany(SNAPSHOTS, {});
45
- }
46
- async replaceFiles(input) {
47
- assertScope(input);
48
- validateFiles(input.files);
49
- await this.ops.upsertOne(SNAPSHOTS, ["resource_id", "thread_id"], {
50
- resource_id: input.resourceId,
51
- thread_id: input.threadId,
52
- files: input.files.toSorted((a, b) => a.path.localeCompare(b.path)),
53
- captured_at: /* @__PURE__ */ new Date()
54
- });
55
- }
56
- async listFiles(args) {
57
- assertScope(args);
58
- return (await this.ops.findOne(SNAPSHOTS, {
59
- resource_id: args.resourceId,
60
- thread_id: args.threadId
61
- }))?.files ?? [];
62
- }
63
- async deleteFiles(args) {
64
- assertScope(args);
65
- return this.ops.deleteMany(SNAPSHOTS, {
66
- resource_id: args.resourceId,
67
- thread_id: args.threadId
68
- });
69
- }
70
- /** Drop every thread's captured listing for a resource (e.g. its sandbox was recreated). */
71
- async deleteResourceFiles(args) {
72
- assertIdentifier(args.resourceId, "resourceId");
73
- return this.ops.deleteMany(SNAPSHOTS, { resource_id: args.resourceId });
74
- }
75
- };
76
- export { FILESYSTEM_SCHEMAS, FilesystemStorage };
77
-
78
- //# sourceMappingURL=base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base.js","names":[],"sources":["../../../../src/storage/domains/filesystem/base.ts"],"sourcesContent":["import { FactoryStorageDomain } from '@mastra/core/storage';\nimport type { CollectionSchema } from '@mastra/core/storage';\n\nconst SNAPSHOTS = 'filesystem_snapshots';\n\nexport interface FilesystemFile {\n path: string;\n}\n\nexport interface ReplaceFilesystemFilesInput {\n resourceId: string;\n threadId: string;\n files: FilesystemFile[];\n}\n\nexport const FILESYSTEM_SCHEMAS: CollectionSchema[] = [\n {\n name: SNAPSHOTS,\n columns: {\n id: { type: 'uuid-pk' },\n resource_id: { type: 'text' },\n thread_id: { type: 'text' },\n files: { type: 'json' },\n captured_at: { type: 'timestamp' },\n },\n uniqueIndexes: [\n {\n name: 'filesystem_snapshots_resource_thread_unique',\n columns: ['resource_id', 'thread_id'],\n },\n ],\n },\n];\n\ninterface FilesystemSnapshotDbRow extends Record<string, unknown> {\n id: string;\n resource_id: string;\n thread_id: string;\n files: FilesystemFile[];\n captured_at: Date;\n}\n\nfunction assertIdentifier(value: string, label: string): void {\n if (!value.trim()) throw new Error(`[FilesystemStorage] ${label} must not be empty.`);\n}\n\nfunction assertRelativePath(value: string): void {\n if (\n !value ||\n value.startsWith('/') ||\n value.split('/').some(segment => !segment || segment === '.' || segment === '..')\n ) {\n throw new Error('[FilesystemStorage] path must be a non-empty relative path.');\n }\n}\n\nfunction assertScope(args: { resourceId: string; threadId: string }): void {\n assertIdentifier(args.resourceId, 'resourceId');\n assertIdentifier(args.threadId, 'threadId');\n}\n\nfunction validateFiles(files: FilesystemFile[]): void {\n const paths = new Set<string>();\n\n for (const file of files) {\n assertRelativePath(file.path);\n if (paths.has(file.path)) throw new Error(`[FilesystemStorage] duplicate file path: ${file.path}`);\n paths.add(file.path);\n }\n}\n\nexport class FilesystemStorage extends FactoryStorageDomain {\n constructor() {\n super('filesystem');\n }\n\n async init(): Promise<void> {\n await this.ensureCollections(FILESYSTEM_SCHEMAS);\n }\n\n async dangerouslyClearAll(): Promise<void> {\n await this.ops.deleteMany(SNAPSHOTS, {});\n }\n\n async replaceFiles(input: ReplaceFilesystemFilesInput): Promise<void> {\n assertScope(input);\n validateFiles(input.files);\n\n await this.ops.upsertOne<FilesystemSnapshotDbRow>(SNAPSHOTS, ['resource_id', 'thread_id'], {\n resource_id: input.resourceId,\n thread_id: input.threadId,\n files: input.files.toSorted((a, b) => a.path.localeCompare(b.path)),\n captured_at: new Date(),\n });\n }\n\n async listFiles(args: { resourceId: string; threadId: string }): Promise<FilesystemFile[]> {\n assertScope(args);\n const snapshot = await this.ops.findOne<FilesystemSnapshotDbRow>(SNAPSHOTS, {\n resource_id: args.resourceId,\n thread_id: args.threadId,\n });\n return snapshot?.files ?? [];\n }\n\n async deleteFiles(args: { resourceId: string; threadId: string }): Promise<number> {\n assertScope(args);\n return this.ops.deleteMany(SNAPSHOTS, { resource_id: args.resourceId, thread_id: args.threadId });\n }\n\n /** Drop every thread's captured listing for a resource (e.g. its sandbox was recreated). */\n async deleteResourceFiles(args: { resourceId: string }): Promise<number> {\n assertIdentifier(args.resourceId, 'resourceId');\n return this.ops.deleteMany(SNAPSHOTS, { resource_id: args.resourceId });\n }\n}\n"],"mappings":";;AAGA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