@mastra/factory 0.29.0-alpha.3 → 0.29.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -64
- package/dist/boards/board-events.d.ts +89 -9
- package/dist/boards/board-events.d.ts.map +1 -1
- package/dist/boards/board-events.js +176 -13
- package/dist/boards/board-events.js.map +1 -1
- package/dist/boards/board-writes.d.ts.map +1 -1
- package/dist/boards/board-writes.js +14 -1
- package/dist/boards/board-writes.js.map +1 -1
- package/dist/boards/busy-card.d.ts +11 -0
- package/dist/boards/busy-card.d.ts.map +1 -0
- package/dist/boards/busy-card.js +15 -0
- package/dist/boards/busy-card.js.map +1 -0
- package/dist/boards/card-facts.d.ts.map +1 -1
- package/dist/boards/card-facts.js +18 -4
- package/dist/boards/card-facts.js.map +1 -1
- package/dist/boards/index.d.ts +2 -1
- package/dist/boards/index.d.ts.map +1 -1
- package/dist/boards/index.js +3 -2
- package/dist/boards/intake-dry-run.d.ts +109 -0
- package/dist/boards/intake-dry-run.d.ts.map +1 -0
- package/dist/boards/intake-dry-run.js +158 -0
- package/dist/boards/intake-dry-run.js.map +1 -0
- package/dist/boards/intake-lookup.d.ts +32 -0
- package/dist/boards/intake-lookup.d.ts.map +1 -0
- package/dist/boards/intake-lookup.js +12 -0
- package/dist/boards/intake-lookup.js.map +1 -0
- package/dist/boards/intake-order.d.ts +32 -0
- package/dist/boards/intake-order.d.ts.map +1 -0
- package/dist/boards/intake-order.js +60 -0
- package/dist/boards/intake-order.js.map +1 -0
- package/dist/boards/intake-routing.d.ts +246 -35
- package/dist/boards/intake-routing.d.ts.map +1 -1
- package/dist/boards/intake-routing.js +437 -52
- package/dist/boards/intake-routing.js.map +1 -1
- package/dist/boards/reroute.d.ts +7 -3
- package/dist/boards/reroute.d.ts.map +1 -1
- package/dist/boards/reroute.js +21 -4
- package/dist/boards/reroute.js.map +1 -1
- package/dist/boards/semantics.d.ts +8 -28
- package/dist/boards/semantics.d.ts.map +1 -1
- package/dist/boards/semantics.js +7 -39
- package/dist/boards/semantics.js.map +1 -1
- package/dist/boards/work-routes.d.ts +31 -11
- package/dist/boards/work-routes.d.ts.map +1 -1
- package/dist/boards/work-routes.js +104 -20
- package/dist/boards/work-routes.js.map +1 -1
- package/dist/factory.d.ts +27 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +32 -18
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/integrations/base.d.ts +9 -0
- package/dist/integrations/base.d.ts.map +1 -1
- package/dist/integrations/dependabot/rules.d.ts.map +1 -1
- package/dist/integrations/dependabot/rules.js +2 -6
- 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/default-rules.d.ts +22 -1
- package/dist/integrations/github/default-rules.d.ts.map +1 -1
- package/dist/integrations/github/default-rules.js +23 -5
- package/dist/integrations/github/default-rules.js.map +1 -1
- package/dist/integrations/github/intake-lookup.d.ts +16 -0
- package/dist/integrations/github/intake-lookup.d.ts.map +1 -0
- package/dist/integrations/github/intake-lookup.js +76 -0
- package/dist/integrations/github/intake-lookup.js.map +1 -0
- package/dist/integrations/github/integration.d.ts +20 -6
- package/dist/integrations/github/integration.d.ts.map +1 -1
- package/dist/integrations/github/integration.js +23 -12
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/review-status-reporter.js +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 +20 -517
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/github/rules.d.ts +12 -1
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +275 -38
- 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 +30 -4
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/gitlab/default-rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/default-rules.js +19 -3
- package/dist/integrations/gitlab/default-rules.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/intake-lookup.d.ts +17 -0
- package/dist/integrations/gitlab/intake-lookup.d.ts.map +1 -0
- package/dist/integrations/gitlab/intake-lookup.js +85 -0
- package/dist/integrations/gitlab/intake-lookup.js.map +1 -0
- package/dist/integrations/gitlab/integration.d.ts +5 -0
- package/dist/integrations/gitlab/integration.d.ts.map +1 -1
- package/dist/integrations/gitlab/integration.js +21 -2
- 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 +20 -0
- package/dist/integrations/gitlab/rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/rules.js +128 -19
- 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 +15 -9
- 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 +13 -7
- 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 +14 -7
- package/dist/integrations/linear/rules.js.map +1 -1
- package/dist/integrations/platform/github/event-worker.js +9 -1
- package/dist/integrations/platform/github/event-worker.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts +6 -6
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +23 -6
- 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/pull-request-head.d.ts +1 -1
- package/dist/integrations/pull-request-head.d.ts.map +1 -1
- package/dist/integrations/pull-request-head.js +5 -0
- package/dist/integrations/pull-request-head.js.map +1 -1
- package/dist/integrations/vanta/rules.d.ts.map +1 -1
- package/dist/integrations/vanta/rules.js +2 -6
- package/dist/integrations/vanta/rules.js.map +1 -1
- 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/board-snapshot.d.ts +8 -1
- package/dist/routes/board-snapshot.d.ts.map +1 -1
- package/dist/routes/board-snapshot.js +33 -7
- package/dist/routes/board-snapshot.js.map +1 -1
- package/dist/routes/boards.js.map +1 -1
- package/dist/routes/config.d.ts +6 -0
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +5 -2
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/contracts.d.ts +1258 -5
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +588 -17
- 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/intake-check.d.ts +92 -0
- package/dist/routes/intake-check.d.ts.map +1 -0
- package/dist/routes/intake-check.js +322 -0
- package/dist/routes/intake-check.js.map +1 -0
- package/dist/routes/intake-routes.d.ts +10 -2
- package/dist/routes/intake-routes.d.ts.map +1 -1
- package/dist/routes/intake-routes.js +292 -11
- package/dist/routes/intake-routes.js.map +1 -1
- package/dist/routes/mastra-gateway.d.ts.map +1 -1
- package/dist/routes/mastra-gateway.js +3 -2
- package/dist/routes/mastra-gateway.js.map +1 -1
- package/dist/routes/project-sessions.d.ts +49 -0
- package/dist/routes/project-sessions.d.ts.map +1 -0
- package/dist/routes/project-sessions.js +93 -0
- package/dist/routes/project-sessions.js.map +1 -0
- 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/run-queue.d.ts +6 -6
- package/dist/routes/run-queue.d.ts.map +1 -1
- package/dist/routes/run-queue.js +28 -8
- package/dist/routes/run-queue.js.map +1 -1
- package/dist/routes/session-rows.d.ts +30 -0
- package/dist/routes/session-rows.d.ts.map +1 -0
- package/dist/routes/session-rows.js +98 -0
- package/dist/routes/session-rows.js.map +1 -0
- package/dist/routes/source-control-sessions.d.ts +4 -8
- package/dist/routes/source-control-sessions.d.ts.map +1 -1
- package/dist/routes/source-control-sessions.js +8 -106
- package/dist/routes/source-control-sessions.js.map +1 -1
- package/dist/routes/surface.d.ts +13 -3
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +25 -38
- package/dist/routes/surface.js.map +1 -1
- package/dist/routes/work-item-starters.d.ts +1 -0
- package/dist/routes/work-item-starters.d.ts.map +1 -1
- package/dist/routes/work-item-starters.js +14 -2
- package/dist/routes/work-item-starters.js.map +1 -1
- package/dist/routes/work-items.d.ts +13 -0
- package/dist/routes/work-items.d.ts.map +1 -1
- package/dist/routes/work-items.js +87 -34
- package/dist/routes/work-items.js.map +1 -1
- package/dist/rules/dispatch-errors.js +1 -1
- package/dist/rules/dispatch-errors.js.map +1 -1
- package/dist/rules/dispatcher.d.ts +39 -7
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +362 -127
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/event-rules.d.ts +69 -1
- package/dist/rules/event-rules.d.ts.map +1 -1
- package/dist/rules/event-rules.js +151 -5
- package/dist/rules/event-rules.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/review-source-tool.js +1 -1
- package/dist/rules/rule-group.d.ts +18 -1
- package/dist/rules/rule-group.d.ts.map +1 -1
- package/dist/rules/rule-group.js +52 -8
- package/dist/rules/rule-group.js.map +1 -1
- package/dist/rules/run-bearing.d.ts +8 -0
- package/dist/rules/run-bearing.d.ts.map +1 -0
- package/dist/rules/run-bearing.js +11 -0
- package/dist/rules/run-bearing.js.map +1 -0
- package/dist/rules/start-coordinator.d.ts +2 -3
- package/dist/rules/start-coordinator.d.ts.map +1 -1
- package/dist/rules/start-coordinator.js +27 -35
- package/dist/rules/start-coordinator.js.map +1 -1
- package/dist/rules/tools.js +2 -1
- package/dist/rules/tools.js.map +1 -1
- package/dist/rules/transition-service.d.ts +16 -0
- package/dist/rules/transition-service.d.ts.map +1 -1
- package/dist/rules/transition-service.js +34 -12
- package/dist/rules/transition-service.js.map +1 -1
- package/dist/rules/types.d.ts +18 -5
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js +2 -1
- package/dist/rules/types.js.map +1 -1
- package/dist/rules/update-fold.d.ts +32 -0
- package/dist/rules/update-fold.d.ts.map +1 -0
- package/dist/rules/update-fold.js +60 -0
- package/dist/rules/update-fold.js.map +1 -0
- package/dist/rules/validation.d.ts.map +1 -1
- package/dist/rules/validation.js +54 -6
- package/dist/rules/validation.js.map +1 -1
- package/dist/session/resource-migration.d.ts.map +1 -1
- package/dist/session/resource-migration.js +2 -3
- package/dist/session/resource-migration.js.map +1 -1
- package/dist/session/run-audit.d.ts +9 -0
- package/dist/session/run-audit.d.ts.map +1 -1
- package/dist/session/run-audit.js +9 -1
- package/dist/session/run-audit.js.map +1 -1
- package/dist/session/self-review-gate.d.ts +26 -2
- package/dist/session/self-review-gate.d.ts.map +1 -1
- package/dist/session/self-review-gate.js +60 -10
- package/dist/session/self-review-gate.js.map +1 -1
- package/dist/session/session-row-query.d.ts +25 -0
- package/dist/session/session-row-query.d.ts.map +1 -0
- package/dist/session/session-row-query.js +47 -0
- package/dist/session/session-row-query.js.map +1 -0
- package/dist/session/session-row-status.d.ts +16 -0
- package/dist/session/session-row-status.d.ts.map +1 -0
- package/dist/session/session-row-status.js +14 -0
- package/dist/session/session-row-status.js.map +1 -0
- package/dist/session/session-row-view.d.ts +14 -0
- package/dist/session/session-row-view.d.ts.map +1 -0
- package/dist/session/session-row-view.js +125 -0
- package/dist/session/session-row-view.js.map +1 -0
- package/dist/session/session-rows.d.ts +46 -0
- package/dist/session/session-rows.d.ts.map +1 -0
- package/dist/session/session-rows.js +232 -0
- package/dist/session/session-rows.js.map +1 -0
- package/dist/session/session-threads.d.ts.map +1 -1
- package/dist/session/session-threads.js +1 -0
- package/dist/session/session-threads.js.map +1 -1
- package/dist/session/source-control-tools.d.ts +14 -7
- package/dist/session/source-control-tools.d.ts.map +1 -1
- package/dist/session/source-control-tools.js +10 -2
- package/dist/session/source-control-tools.js.map +1 -1
- package/dist/session/work-item-repository.d.ts +44 -0
- package/dist/session/work-item-repository.d.ts.map +1 -1
- package/dist/session/work-item-repository.js +80 -1
- package/dist/session/work-item-repository.js.map +1 -1
- package/dist/session/work-item-state-processor.d.ts.map +1 -1
- package/dist/session/work-item-state-processor.js +44 -8
- package/dist/session/work-item-state-processor.js.map +1 -1
- package/dist/storage/domains/audit/actions.d.ts +2 -1
- package/dist/storage/domains/audit/actions.d.ts.map +1 -1
- package/dist/storage/domains/audit/actions.js +3 -1
- package/dist/storage/domains/audit/actions.js.map +1 -1
- package/dist/storage/domains/boards/base.d.ts +162 -14
- package/dist/storage/domains/boards/base.d.ts.map +1 -1
- package/dist/storage/domains/boards/base.js +415 -41
- package/dist/storage/domains/boards/base.js.map +1 -1
- package/dist/storage/domains/boards/schemas.d.ts +6 -0
- package/dist/storage/domains/boards/schemas.d.ts.map +1 -1
- package/dist/storage/domains/boards/schemas.js +93 -3
- 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 +19 -22
- 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 +6 -21
- 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 +49 -53
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +152 -156
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/storage/domains/work-items/cards.d.ts +3 -2
- package/dist/storage/domains/work-items/cards.d.ts.map +1 -1
- package/dist/storage/domains/work-items/cards.js +4 -2
- package/dist/storage/domains/work-items/cards.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/storage/probed-list.d.ts +11 -0
- package/dist/storage/probed-list.d.ts.map +1 -0
- package/dist/storage/probed-list.js +52 -0
- package/dist/storage/probed-list.js.map +1 -0
- package/dist/tools/audit-events-tool.d.ts +2 -2
- package/dist/tools/read-tools.d.ts +0 -3
- package/dist/tools/read-tools.d.ts.map +1 -1
- package/dist/tools/read-tools.js +4 -42
- package/dist/tools/read-tools.js.map +1 -1
- package/dist/tools/session-tools.d.ts.map +1 -1
- package/dist/tools/session-tools.js +5 -9
- package/dist/tools/session-tools.js.map +1 -1
- package/dist/tools/work-item-tools.d.ts +3 -0
- package/dist/tools/work-item-tools.d.ts.map +1 -1
- package/dist/tools/work-item-tools.js +8 -4
- package/dist/tools/work-item-tools.js.map +1 -1
- package/dist/work-item-branch.d.ts +4 -0
- package/dist/work-item-branch.d.ts.map +1 -1
- package/dist/work-item-branch.js +7 -1
- package/dist/work-item-branch.js.map +1 -1
- package/dist/work-items/card-context-sessions.d.ts +50 -0
- package/dist/work-items/card-context-sessions.d.ts.map +1 -0
- package/dist/work-items/card-context-sessions.js +84 -0
- package/dist/work-items/card-context-sessions.js.map +1 -0
- package/dist/work-items/change-requests.d.ts +87 -0
- package/dist/work-items/change-requests.d.ts.map +1 -0
- package/dist/work-items/change-requests.js +134 -0
- package/dist/work-items/change-requests.js.map +1 -0
- package/dist/work-items/create-work-item.d.ts +7 -2
- package/dist/work-items/create-work-item.d.ts.map +1 -1
- package/dist/work-items/create-work-item.js +44 -13
- package/dist/work-items/create-work-item.js.map +1 -1
- package/dist/work-items/list-related-cards.d.ts.map +1 -1
- package/dist/work-items/list-related-cards.js +1 -1
- package/dist/work-items/list-related-cards.js.map +1 -1
- package/dist/work-items/providers/github.d.ts.map +1 -1
- package/dist/work-items/providers/github.js +1 -0
- package/dist/work-items/providers/github.js.map +1 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +1 -3
- package/dist/workspace.js.map +1 -1
- package/factory-skills/configure-factory-rules/SKILL.md +2 -2
- package/factory-skills/factory-build/SKILL.md +1 -1
- package/factory-skills/factory-plan/SKILL.md +5 -3
- package/factory-skills/factory-self-review/SKILL.md +2 -0
- package/factory-skills/factory-triage/SKILL.md +1 -1
- 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
package/dist/routes/fs.js
CHANGED
|
@@ -102,10 +102,11 @@ function assertRelativePath(path, label) {
|
|
|
102
102
|
if (!normalized || normalized === ".." || normalized.startsWith(`..${sep}`)) throw new Error(`${label} escapes workspace`);
|
|
103
103
|
return normalized;
|
|
104
104
|
}
|
|
105
|
-
function assertApprovedRenderedRoot(renderedRoot) {
|
|
105
|
+
function assertApprovedRenderedRoot(renderedRoot, layout) {
|
|
106
106
|
const safeRoot = assertRelativePath(renderedRoot, "root");
|
|
107
|
-
if (
|
|
108
|
-
return safeRoot;
|
|
107
|
+
if (APPROVED_RENDERED_ROOTS.has(safeRoot)) return safeRoot;
|
|
108
|
+
if (layout?.repos.length && layout.repos.some((repo) => `${repo.prefix}.artifacts` === safeRoot)) return safeRoot;
|
|
109
|
+
throw new Error("Root is not approved for rendered workspace access");
|
|
109
110
|
}
|
|
110
111
|
async function confinedWorkspacePath(root, workspacePath) {
|
|
111
112
|
const resolvedRoot = await realOrResolved(resolveFsRoot(root));
|
|
@@ -330,8 +331,8 @@ function repositoryBaseBranches(session, layout, ownRepo) {
|
|
|
330
331
|
}
|
|
331
332
|
/** List an approved rendered root inside a Factory session's sandbox workdir. */
|
|
332
333
|
async function listSessionRenderedPath(session, renderedRoot) {
|
|
333
|
-
const safeRoot = assertApprovedRenderedRoot(renderedRoot);
|
|
334
334
|
const handle = await sessionSandbox(session);
|
|
335
|
+
const safeRoot = assertApprovedRenderedRoot(renderedRoot, handle?.layout);
|
|
335
336
|
const rootPath = posix.join(handle?.layout.root ?? "", safeRoot);
|
|
336
337
|
const empty = {
|
|
337
338
|
workspacePath: session.sessionId,
|
|
@@ -340,6 +341,8 @@ async function listSessionRenderedPath(session, renderedRoot) {
|
|
|
340
341
|
entries: []
|
|
341
342
|
};
|
|
342
343
|
if (!handle) return empty;
|
|
344
|
+
const physical = await realPaths(handle.sandbox, handle.layout.root, [safeRoot]);
|
|
345
|
+
if (physical.paths[0] && physical.paths[0] !== posix.join(physical.root, safeRoot)) throw new Error("Path is not available in this session");
|
|
343
346
|
const quotedRoot = `'${rootPath.replace(/'/g, `'\\''`)}'`;
|
|
344
347
|
const result = await handle.sandbox.executeCommand("sh", ["-c", `test -d ${quotedRoot} && find ${quotedRoot} -mindepth 1 -printf '%y\\t%s\\t%T@\\t%p\\n' 2>/dev/null || true`], {
|
|
345
348
|
timeout: 3e4,
|
|
@@ -420,13 +423,13 @@ async function ignoredPaths(sandbox, repoDir, paths) {
|
|
|
420
423
|
}
|
|
421
424
|
/**
|
|
422
425
|
* The real absolute location of each path (relative to `root`), following
|
|
423
|
-
* every symlink, or `''` when it
|
|
424
|
-
* as positional arguments and come back NUL-separated.
|
|
426
|
+
* every symlink, or `''` when it fails `test` (exists, or is a file); plus
|
|
427
|
+
* `root`'s own. Paths go in as positional arguments and come back NUL-separated.
|
|
425
428
|
*/
|
|
426
|
-
async function realPaths(sandbox, root, paths) {
|
|
429
|
+
async function realPaths(sandbox, root, paths, test = "-e") {
|
|
427
430
|
const result = await sandbox.executeCommand("sh", [
|
|
428
431
|
"-c",
|
|
429
|
-
|
|
432
|
+
`cd "$1" && shift && printf '%s\\0' "$(pwd -P)" && for p; do printf '%s\\0' "$([ ${test} "$p" ] && readlink -f -- "$p")"; done`,
|
|
430
433
|
"sh",
|
|
431
434
|
root,
|
|
432
435
|
...paths
|
|
@@ -542,6 +545,160 @@ async function listSessionWorkspaceTree(session, path = "") {
|
|
|
542
545
|
entries
|
|
543
546
|
};
|
|
544
547
|
}
|
|
548
|
+
const MAX_FILE_INDEX_BYTES = 4194304;
|
|
549
|
+
/** Prints gitlinks and symlinks as NUL-terminated `<mode> …\t<path>` records; it lstats only untracked entries, which are few. */
|
|
550
|
+
const SPECIAL_ENTRIES_SCRIPT = `
|
|
551
|
+
set -e
|
|
552
|
+
cd "$1"
|
|
553
|
+
staged=$(mktemp)
|
|
554
|
+
untracked=$(mktemp)
|
|
555
|
+
trap 'rm -f "$staged" "$untracked"' EXIT
|
|
556
|
+
git ls-files -z --stage >"$staged"
|
|
557
|
+
git ls-files -z --others --exclude-standard >"$untracked"
|
|
558
|
+
grep -z '^1[26]0000 ' "$staged" || [ $? -eq 1 ]
|
|
559
|
+
xargs -0 sh -c 'for p; do if [ -L "$p" ]; then printf "120000 untracked\\t%s\\0" "$p"; fi; done' sh <"$untracked"
|
|
560
|
+
`;
|
|
561
|
+
/** Whole NUL-terminated paths of a listing capped at `MAX_FILE_INDEX_BYTES + 1` bytes, and whether the cap cut it. */
|
|
562
|
+
function boundedPaths(stdout) {
|
|
563
|
+
const truncated = Buffer.byteLength(stdout) > MAX_FILE_INDEX_BYTES;
|
|
564
|
+
return {
|
|
565
|
+
paths: (truncated ? stdout.slice(0, stdout.lastIndexOf("\0") + 1) : stdout).split("\0"),
|
|
566
|
+
truncated
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
async function refusedLinks(sandbox, layout, links) {
|
|
570
|
+
if (links.length === 0) return /* @__PURE__ */ new Set();
|
|
571
|
+
const real = await realPaths(sandbox, layout.root, links, "-f");
|
|
572
|
+
const targets = links.map((_, i) => treePathOf(layout, real.root, real.paths[i] ?? ""));
|
|
573
|
+
const ignored = await ignoredTreePaths(sandbox, layout, targets.filter((target) => target !== void 0));
|
|
574
|
+
return new Set(links.filter((_, i) => {
|
|
575
|
+
const target = targets[i];
|
|
576
|
+
return target === void 0 || ignored.has(target);
|
|
577
|
+
}));
|
|
578
|
+
}
|
|
579
|
+
async function checkoutFiles(sandbox, layout, repo) {
|
|
580
|
+
const options = {
|
|
581
|
+
timeout: 3e4,
|
|
582
|
+
maxRetainedBytes: Infinity
|
|
583
|
+
};
|
|
584
|
+
const [listed, deleted, special] = await Promise.all([
|
|
585
|
+
sandbox.executeCommand("sh", [
|
|
586
|
+
"-c",
|
|
587
|
+
BOUNDED_OUTPUT_SCRIPT,
|
|
588
|
+
"mastracode-bounded",
|
|
589
|
+
String(4194305),
|
|
590
|
+
"git",
|
|
591
|
+
"-C",
|
|
592
|
+
repo.dir,
|
|
593
|
+
"ls-files",
|
|
594
|
+
"-z",
|
|
595
|
+
"--cached",
|
|
596
|
+
"--others",
|
|
597
|
+
"--exclude-standard"
|
|
598
|
+
], options),
|
|
599
|
+
sandbox.executeCommand("git", [
|
|
600
|
+
"-C",
|
|
601
|
+
repo.dir,
|
|
602
|
+
"ls-files",
|
|
603
|
+
"-z",
|
|
604
|
+
"--deleted"
|
|
605
|
+
], options),
|
|
606
|
+
sandbox.executeCommand("sh", [
|
|
607
|
+
"-c",
|
|
608
|
+
SPECIAL_ENTRIES_SCRIPT,
|
|
609
|
+
"mastracode-special-entries",
|
|
610
|
+
repo.dir
|
|
611
|
+
], options)
|
|
612
|
+
]);
|
|
613
|
+
for (const result of [
|
|
614
|
+
listed,
|
|
615
|
+
deleted,
|
|
616
|
+
special
|
|
617
|
+
]) if (result.exitCode !== 0) throw new Error(`Unable to list files: ${result.stderr.trim() || "git failed"}`);
|
|
618
|
+
const listing = boundedPaths(listed.stdout);
|
|
619
|
+
const records = special.stdout.split("\0");
|
|
620
|
+
const entriesOfMode = (mode) => records.filter((record) => record.startsWith(`${mode} `)).map((record) => record.slice(record.indexOf(" ") + 1));
|
|
621
|
+
const unopenable = /* @__PURE__ */ new Set([...deleted.stdout.split("\0"), ...entriesOfMode("160000")]);
|
|
622
|
+
const paths = new Set(listing.paths.filter((path) => path && !path.endsWith("/") && !unopenable.has(path) && !path.split("/").some((segment) => HIDDEN_TREE_ENTRIES.has(segment))));
|
|
623
|
+
const refused = await refusedLinks(sandbox, layout, [...new Set(entriesOfMode("120000"))].filter((path) => paths.has(path)).map((path) => `${repo.prefix}${path}`));
|
|
624
|
+
return {
|
|
625
|
+
paths: Array.from(paths, (path) => `${repo.prefix}${path}`).filter((path) => !refused.has(path)),
|
|
626
|
+
truncated: listing.truncated
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
/** Walks a multi-repository root as the tree does: no ignore rules, no git internals or setup markers, no symlinked folders. */
|
|
630
|
+
async function rootFiles(sandbox, layout) {
|
|
631
|
+
const options = {
|
|
632
|
+
timeout: 3e4,
|
|
633
|
+
maxRetainedBytes: Infinity
|
|
634
|
+
};
|
|
635
|
+
const skipped = [...[...HIDDEN_TREE_ENTRIES].map((name) => ["-name", name]), ...layout.repos.map((repo) => ["-path", `./${repo.prefix.slice(0, -1)}`])].flatMap((test, i) => i === 0 ? test : ["-o", ...test]);
|
|
636
|
+
const walk = [
|
|
637
|
+
"-c",
|
|
638
|
+
"cd \"$1\" && shift && exec find . \"$@\"",
|
|
639
|
+
"mastracode-root-files",
|
|
640
|
+
layout.root,
|
|
641
|
+
"(",
|
|
642
|
+
...skipped,
|
|
643
|
+
")",
|
|
644
|
+
"-prune",
|
|
645
|
+
"-o"
|
|
646
|
+
];
|
|
647
|
+
const [listed, linked] = await Promise.all([sandbox.executeCommand("sh", [
|
|
648
|
+
"-c",
|
|
649
|
+
BOUNDED_OUTPUT_SCRIPT,
|
|
650
|
+
"mastracode-bounded",
|
|
651
|
+
String(4194305),
|
|
652
|
+
"sh",
|
|
653
|
+
...walk,
|
|
654
|
+
"(",
|
|
655
|
+
"-type",
|
|
656
|
+
"f",
|
|
657
|
+
"-o",
|
|
658
|
+
"-type",
|
|
659
|
+
"l",
|
|
660
|
+
")",
|
|
661
|
+
"-print0"
|
|
662
|
+
], options), sandbox.executeCommand("sh", [
|
|
663
|
+
...walk,
|
|
664
|
+
"-type",
|
|
665
|
+
"l",
|
|
666
|
+
"-print0"
|
|
667
|
+
], options)]);
|
|
668
|
+
for (const result of [listed, linked]) if (result.exitCode !== 0) throw new Error(`Unable to list files: ${result.stderr.trim() || "find failed"}`);
|
|
669
|
+
const listing = boundedPaths(listed.stdout);
|
|
670
|
+
const paths = new Set(listing.paths.filter(Boolean).map((path) => path.slice(2)));
|
|
671
|
+
const refused = await refusedLinks(sandbox, layout, linked.stdout.split("\0").map((path) => path.slice(2)).filter((path) => paths.has(path)));
|
|
672
|
+
return {
|
|
673
|
+
paths: [...paths].filter((path) => !refused.has(path)),
|
|
674
|
+
truncated: listing.truncated
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
async function listSessionWorkspaceFiles(session) {
|
|
678
|
+
const handle = await sessionSandbox(session);
|
|
679
|
+
if (!handle) return {
|
|
680
|
+
workspacePath: session.sessionId,
|
|
681
|
+
available: false,
|
|
682
|
+
paths: [],
|
|
683
|
+
truncated: false
|
|
684
|
+
};
|
|
685
|
+
const { layout, sandbox } = handle;
|
|
686
|
+
const physical = layout.repos.length > 1 ? realPaths(sandbox, layout.root, layout.repos.map((repo) => repo.prefix)) : void 0;
|
|
687
|
+
const settled = await Promise.allSettled([...layout.repos.map(async (repo, i) => {
|
|
688
|
+
const real = await physical;
|
|
689
|
+
if (real && `${real.paths[i]}/` !== posix.join(real.root, repo.prefix)) throw new Error("Path is not available in this session");
|
|
690
|
+
return checkoutFiles(sandbox, layout, repo);
|
|
691
|
+
}), ...layout.repos.length > 1 ? [rootFiles(sandbox, layout)] : []]);
|
|
692
|
+
const checkouts = settled.flatMap((checkout) => checkout.status === "fulfilled" ? [checkout.value] : []);
|
|
693
|
+
const failed = settled.find((checkout) => checkout.status === "rejected");
|
|
694
|
+
if (failed && checkouts.length === 0) throw failed.reason;
|
|
695
|
+
return {
|
|
696
|
+
workspacePath: session.sessionId,
|
|
697
|
+
available: true,
|
|
698
|
+
paths: checkouts.flatMap((checkout) => checkout.paths),
|
|
699
|
+
truncated: failed !== void 0 || checkouts.some((checkout) => checkout.truncated)
|
|
700
|
+
};
|
|
701
|
+
}
|
|
545
702
|
/**
|
|
546
703
|
* Read a file inside a session's sandbox: anything under an approved rendered
|
|
547
704
|
* root, or anything the tree would list (not git internals, not ignored by its
|
|
@@ -552,13 +709,13 @@ async function readSessionWorkspaceFile(session, path) {
|
|
|
552
709
|
const handle = await sessionSandbox(session);
|
|
553
710
|
if (!handle) throw new Error("Session workspace is not available");
|
|
554
711
|
const { layout, sandbox } = handle;
|
|
555
|
-
treeLocation(layout, safePath);
|
|
712
|
+
const location = treeLocation(layout, safePath);
|
|
556
713
|
const parent = posix.dirname(safePath);
|
|
557
714
|
const real = await realPaths(sandbox, layout.root, parent === "." ? [safePath] : [safePath, parent]);
|
|
558
715
|
const target = treePathOf(layout, real.root, real.paths[0]);
|
|
559
716
|
const throughLink = parent !== "." && real.paths[1] !== posix.join(real.root, parent);
|
|
560
717
|
if (target === void 0 || throughLink) throw new Error("Path is not available in this session");
|
|
561
|
-
const trusted = APPROVED_RENDERED_ROOTS.has(safePath.split("/")[0] ?? "");
|
|
718
|
+
const trusted = APPROVED_RENDERED_ROOTS.has(safePath.split("/")[0] ?? "") || Boolean(location.repo && location.relative.startsWith(".artifacts/"));
|
|
562
719
|
if ((await ignoredTreePaths(sandbox, layout, [.../* @__PURE__ */ new Set([...trusted ? [] : [safePath], ...target === safePath ? [] : [target]])])).size > 0) throw new Error("Path is not available in this session");
|
|
563
720
|
const { filesystem } = handle;
|
|
564
721
|
const info = await filesystem.stat(safePath);
|
|
@@ -1076,6 +1233,22 @@ function buildFsRoutes(options = {}) {
|
|
|
1076
1233
|
}
|
|
1077
1234
|
}
|
|
1078
1235
|
}),
|
|
1236
|
+
registerApiRoute("/web/workspace/files", {
|
|
1237
|
+
method: "GET",
|
|
1238
|
+
requiresAuth: false,
|
|
1239
|
+
handler: async (c) => {
|
|
1240
|
+
const workspacePath = c.req.query("workspacePath");
|
|
1241
|
+
if (!workspacePath) return c.json({ error: "Missing required query param: workspacePath" }, 400);
|
|
1242
|
+
try {
|
|
1243
|
+
const session = await resolveAuthorizedSession(loose(c), sessionFs, workspacePath);
|
|
1244
|
+
if (!session || !sessionFs) return c.json({ error: "Session workspace is not available" }, 403);
|
|
1245
|
+
return c.json(await listSessionWorkspaceFiles(session));
|
|
1246
|
+
} catch (error) {
|
|
1247
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1248
|
+
return c.json({ error: message }, message.includes("not available") ? 403 : 500);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
}),
|
|
1079
1252
|
registerApiRoute("/web/workspace/file", {
|
|
1080
1253
|
method: "GET",
|
|
1081
1254
|
requiresAuth: false,
|
|
@@ -1117,6 +1290,6 @@ function buildFsRoutes(options = {}) {
|
|
|
1117
1290
|
})
|
|
1118
1291
|
];
|
|
1119
1292
|
}
|
|
1120
|
-
export { buildFsRoutes, listArtifacts, listDirectory, listSessionRenderedPath, listSessionWorkspaceChanges, listSessionWorkspacePatches, listSessionWorkspaceTree, listWorkspaceRenderedPath, parseWorkspaceChangeStats, parseWorkspaceChanges, parseWorkspaceTrackedChanges, readSessionWorkspaceFile, readWorkspaceFile, resolveCodebase, resolveFsRoot };
|
|
1293
|
+
export { buildFsRoutes, listArtifacts, listDirectory, listSessionRenderedPath, listSessionWorkspaceChanges, listSessionWorkspaceFiles, listSessionWorkspacePatches, listSessionWorkspaceTree, listWorkspaceRenderedPath, parseWorkspaceChangeStats, parseWorkspaceChanges, parseWorkspaceTrackedChanges, readSessionWorkspaceFile, readWorkspaceFile, resolveCodebase, resolveFsRoot };
|
|
1121
1294
|
|
|
1122
1295
|
//# sourceMappingURL=fs.js.map
|