@mastra/factory 0.25.0-alpha.4 → 0.25.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/auth.js +1 -2
- package/dist/boards/define-board.js +1 -2
- package/dist/boards/index.js +1 -2
- package/dist/boards/registry.js +1 -2
- package/dist/boards/relocate.js +1 -2
- package/dist/boards/review.js +1 -2
- package/dist/boards/semantics.js +1 -2
- package/dist/boards/transition-policy.js +1 -2
- package/dist/boards/work-tool-rules.js +1 -2
- package/dist/boards/work-transition-policy.js +1 -2
- package/dist/boards/work.js +1 -2
- package/dist/default-thinking-level.d.ts +3 -0
- package/dist/default-thinking-level.d.ts.map +1 -0
- package/dist/default-thinking-level.js +5 -0
- package/dist/default-thinking-level.js.map +1 -0
- package/dist/environment/build-runner.js +1 -2
- package/dist/environment/build-schedule.js +1 -2
- package/dist/environment/build-workflow.js +1 -2
- package/dist/environment/build.js +1 -2
- package/dist/environment/heads.js +1 -2
- package/dist/factory.d.ts +4 -2
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +62 -21
- package/dist/factory.js.map +1 -1
- package/dist/feed-events.js +1 -2
- package/dist/index.js +2 -2
- package/dist/integrations/channel-thread-announcements.d.ts +8 -0
- package/dist/integrations/channel-thread-announcements.d.ts.map +1 -0
- package/dist/integrations/channel-thread-announcements.js +16 -0
- package/dist/integrations/channel-thread-announcements.js.map +1 -0
- package/dist/integrations/github/acceptance-labels.js +1 -2
- package/dist/integrations/github/app-identity.js +1 -2
- package/dist/integrations/github/commits.js +1 -2
- package/dist/integrations/github/config.js +1 -2
- package/dist/integrations/github/default-rules.js +2 -3
- package/dist/integrations/github/integration.js +3 -4
- package/dist/integrations/github/issue-reconciler.js +1 -2
- package/dist/integrations/github/pat.js +1 -2
- package/dist/integrations/github/provenance.d.ts.map +1 -1
- package/dist/integrations/github/provenance.js +2 -5
- package/dist/integrations/github/provenance.js.map +1 -1
- package/dist/integrations/github/reconcile-worker.js +1 -2
- package/dist/integrations/github/reconciliation-config.js +1 -2
- package/dist/integrations/github/routes.js +4 -5
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +14 -3
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/github/sandbox-release.js +1 -2
- package/dist/integrations/github/sandbox.js +1 -2
- package/dist/integrations/github/session-subscriptions.js +1 -2
- package/dist/integrations/github/settle-or-abort.js +1 -2
- package/dist/integrations/github/stale-reviews.js +1 -2
- package/dist/integrations/github/subscriptions.js +1 -2
- package/dist/integrations/github/token-refresh.js +1 -2
- package/dist/integrations/github/webhook.d.ts.map +1 -1
- package/dist/integrations/github/webhook.js +17 -3
- package/dist/integrations/github/webhook.js.map +1 -1
- package/dist/integrations/gitlab/agent-tools.js +1 -2
- package/dist/integrations/gitlab/api.js +1 -2
- package/dist/integrations/gitlab/default-rules.js +1 -2
- package/dist/integrations/gitlab/integration.d.ts +4 -0
- package/dist/integrations/gitlab/integration.d.ts.map +1 -1
- package/dist/integrations/gitlab/integration.js +12 -4
- package/dist/integrations/gitlab/integration.js.map +1 -1
- package/dist/integrations/gitlab/issue-reconciler.js +1 -2
- package/dist/integrations/gitlab/merge-request-reconciler.js +1 -2
- package/dist/integrations/gitlab/reconciler.js +1 -2
- package/dist/integrations/gitlab/reconciliation-config.js +1 -2
- package/dist/integrations/gitlab/routes.d.ts +6 -0
- package/dist/integrations/gitlab/routes.d.ts.map +1 -1
- package/dist/integrations/gitlab/routes.js +154 -3
- 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 +5 -3
- package/dist/integrations/gitlab/rules.js.map +1 -1
- package/dist/integrations/gitlab/session-subscriptions.js +1 -2
- package/dist/integrations/gitlab/subscriptions.js +1 -2
- package/dist/integrations/gitlab/version-control.js +1 -2
- package/dist/integrations/gitlab/webhook-dispatch.js +1 -2
- package/dist/integrations/gitlab/webhook.js +1 -2
- package/dist/integrations/incidentio/agent-tools.js +1 -2
- package/dist/integrations/incidentio/api.js +1 -2
- package/dist/integrations/incidentio/claim.js +1 -2
- package/dist/integrations/incidentio/default-rules.js +1 -2
- package/dist/integrations/incidentio/intake.js +1 -2
- package/dist/integrations/incidentio/integration.js +1 -2
- package/dist/integrations/incidentio/issue-reconciler.js +1 -2
- package/dist/integrations/incidentio/reconciliation-config.js +1 -2
- package/dist/integrations/incidentio/routes.js +1 -2
- package/dist/integrations/incidentio/rules.js +1 -2
- package/dist/integrations/issue-reconcile-worker.js +1 -2
- package/dist/integrations/issue-reconciler.js +1 -2
- package/dist/integrations/jira/adf.js +1 -2
- package/dist/integrations/jira/agent-tools.js +1 -2
- package/dist/integrations/jira/api.d.ts +1 -1
- package/dist/integrations/jira/api.d.ts.map +1 -1
- package/dist/integrations/jira/api.js +2 -3
- package/dist/integrations/jira/api.js.map +1 -1
- package/dist/integrations/jira/claim.js +1 -2
- package/dist/integrations/jira/default-rules.js +1 -2
- package/dist/integrations/jira/integration.d.ts +3 -1
- package/dist/integrations/jira/integration.d.ts.map +1 -1
- package/dist/integrations/jira/integration.js +18 -4
- package/dist/integrations/jira/integration.js.map +1 -1
- package/dist/integrations/jira/issue-reconciler.js +1 -2
- package/dist/integrations/jira/reconciliation-config.js +1 -2
- package/dist/integrations/jira/routes.js +1 -2
- package/dist/integrations/jira/rules.js +1 -2
- package/dist/integrations/linear/agent-tools.d.ts +1 -1
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -1
- package/dist/integrations/linear/agent-tools.js +5 -5
- package/dist/integrations/linear/agent-tools.js.map +1 -1
- package/dist/integrations/linear/claim.js +1 -2
- package/dist/integrations/linear/default-rules.js +1 -2
- package/dist/integrations/linear/integration.d.ts +2 -0
- package/dist/integrations/linear/integration.d.ts.map +1 -1
- package/dist/integrations/linear/integration.js +2 -2
- package/dist/integrations/linear/integration.js.map +1 -1
- package/dist/integrations/linear/issue-reconciler.js +1 -2
- package/dist/integrations/linear/reconciliation-config.js +1 -2
- package/dist/integrations/linear/routes.js +1 -2
- package/dist/integrations/linear/rules.js +1 -2
- package/dist/integrations/platform/api-client.js +1 -2
- package/dist/integrations/platform/connect/routes.js +1 -2
- package/dist/integrations/platform/github/event-worker.js +6 -2
- package/dist/integrations/platform/github/event-worker.js.map +1 -1
- package/dist/integrations/platform/github/integration.js +1 -2
- package/dist/integrations/platform/gitlab/event-worker.js +1 -2
- package/dist/integrations/platform/gitlab/integration.js +1 -2
- package/dist/integrations/platform/incidentio/integration.js +1 -2
- package/dist/integrations/platform/jira/agent-tools.js +1 -2
- package/dist/integrations/platform/jira/integration.js +1 -2
- package/dist/integrations/platform/jira/routes.js +1 -2
- package/dist/integrations/platform/linear/event-worker.js +1 -2
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -1
- package/dist/integrations/platform/linear/integration.js +2 -2
- package/dist/integrations/platform/linear/integration.js.map +1 -1
- package/dist/integrations/pull-request-head.d.ts +1 -0
- package/dist/integrations/pull-request-head.d.ts.map +1 -1
- package/dist/integrations/pull-request-head.js +3 -3
- package/dist/integrations/pull-request-head.js.map +1 -1
- package/dist/integrations/reconciliation-config.js +1 -2
- package/dist/integrations/slack/channel-reply-processor.d.ts +1 -0
- package/dist/integrations/slack/channel-reply-processor.d.ts.map +1 -1
- package/dist/integrations/slack/channel-reply-processor.js +16 -6
- package/dist/integrations/slack/channel-reply-processor.js.map +1 -1
- package/dist/integrations/slack/channel-session-link-processor.d.ts +1 -0
- package/dist/integrations/slack/channel-session-link-processor.d.ts.map +1 -1
- package/dist/integrations/slack/channel-session-link-processor.js +2 -3
- package/dist/integrations/slack/channel-session-link-processor.js.map +1 -1
- package/dist/integrations/slack/connect-route.js +1 -2
- package/dist/integrations/slack/emoji-shortcodes.generated.js +1 -2
- package/dist/integrations/slack/emoji.js +1 -2
- package/dist/integrations/slack/feed-publisher.js +1 -2
- package/dist/integrations/slack/integration.d.ts +5 -0
- package/dist/integrations/slack/integration.d.ts.map +1 -1
- package/dist/integrations/slack/integration.js +13 -2
- package/dist/integrations/slack/integration.js.map +1 -1
- package/dist/integrations/slack/reply-reminder-processor.js +1 -2
- package/dist/integrations/slack/reply-tool.d.ts.map +1 -1
- package/dist/integrations/slack/reply-tool.js +4 -13
- package/dist/integrations/slack/reply-tool.js.map +1 -1
- package/dist/integrations/slack/run-error-card.d.ts +3 -0
- package/dist/integrations/slack/run-error-card.d.ts.map +1 -0
- package/dist/integrations/slack/run-error-card.js +44 -0
- package/dist/integrations/slack/run-error-card.js.map +1 -0
- package/dist/integrations/slack/share-file-tool.js +1 -2
- package/dist/integrations/slack/slack.d.ts.map +1 -1
- package/dist/integrations/slack/slack.js +7 -4
- package/dist/integrations/slack/slack.js.map +1 -1
- package/dist/integrations/subscription-session.js +1 -2
- package/dist/integrations/workos/integration.js +1 -2
- package/dist/mcp/disconnect.js +1 -2
- package/dist/mcp/events.js +2 -3
- package/dist/mcp/routes.js +1 -2
- package/dist/packages/_internals/workspace/dist/index.js +1 -2
- package/dist/packages/_internals/workspace/dist/index.js.map +1 -1
- package/dist/platform-auth-host.js +1 -2
- package/dist/provider-display-name.js +1 -2
- package/dist/review-verdict.d.ts +1 -0
- package/dist/review-verdict.d.ts.map +1 -1
- package/dist/review-verdict.js +9 -3
- package/dist/review-verdict.js.map +1 -1
- package/dist/routes/attention-activity.js +1 -2
- package/dist/routes/attention-parked.js +1 -2
- package/dist/routes/attention-proposed.js +1 -2
- package/dist/routes/attention-providers.js +1 -2
- package/dist/routes/attention.js +1 -2
- package/dist/routes/automation-runs.js +1 -2
- package/dist/routes/config.d.ts +7 -0
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +29 -3
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/contracts.js +1 -2
- package/dist/routes/custom-provider-source.js +1 -2
- package/dist/routes/fs.js +1 -2
- package/dist/routes/intake.js +6 -4
- package/dist/routes/intake.js.map +1 -1
- package/dist/routes/knowledge.js +1 -2
- package/dist/routes/oauth.js +1 -2
- package/dist/routes/projects.js +1 -2
- package/dist/routes/provider-credentials.js +1 -2
- package/dist/routes/route.js +1 -2
- package/dist/routes/session-access.js +1 -2
- package/dist/routes/skills.js +1 -2
- package/dist/routes/source-control-sessions.js +5 -6
- package/dist/routes/source-control-settings.js +1 -2
- package/dist/routes/surface.js +3 -4
- package/dist/routes/surface.js.map +1 -1
- package/dist/routes/telemetry.js +1 -2
- package/dist/routes/tenant-credentials.js +1 -2
- package/dist/routes/work-items.js +2 -3
- package/dist/rules/binding-context.js +1 -2
- package/dist/rules/decision-applicability.js +1 -2
- package/dist/rules/dispatch-errors.js +1 -2
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +9 -3
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/event-rules.js +1 -2
- package/dist/rules/processor.js +1 -2
- package/dist/rules/resolve.js +1 -2
- package/dist/rules/review-source-tool.js +1 -2
- package/dist/rules/start-coordinator.js +1 -2
- package/dist/rules/terminal-cleanup.js +1 -2
- package/dist/rules/tools.js +1 -2
- package/dist/rules/transition-service.js +1 -2
- package/dist/rules/types.d.ts +4 -1
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js +1 -2
- package/dist/rules/types.js.map +1 -1
- package/dist/rules/validation.js +1 -2
- package/dist/run-error.d.ts +13 -0
- package/dist/run-error.d.ts.map +1 -0
- package/dist/run-error.js +81 -0
- package/dist/run-error.js.map +1 -0
- package/dist/sandbox/callback-factory-sandbox.js +1 -2
- package/dist/sandbox/git-ref.js +1 -2
- package/dist/sandbox/local-factory-sandbox.d.ts +12 -4
- package/dist/sandbox/local-factory-sandbox.d.ts.map +1 -1
- package/dist/sandbox/local-factory-sandbox.js +32 -7
- package/dist/sandbox/local-factory-sandbox.js.map +1 -1
- package/dist/sandbox/materialization.js +1 -2
- package/dist/sandbox/session-retirement.js +1 -2
- package/dist/sandbox/session-sandbox.js +1 -2
- package/dist/sandbox/workdir.js +1 -2
- package/dist/secret-encryption.js +1 -2
- package/dist/server-error.js +1 -2
- package/dist/session/credential-policy.js +1 -2
- package/dist/session/default-model-hydration.js +1 -2
- package/dist/session/environment-repositories.js +1 -2
- package/dist/session/environment-state-processor.d.ts +0 -1
- package/dist/session/environment-state-processor.d.ts.map +1 -1
- package/dist/session/environment-state-processor.js +2 -3
- package/dist/session/environment-state-processor.js.map +1 -1
- package/dist/session/factory-session.js +1 -2
- package/dist/session/filesystem-capture.js +2 -3
- package/dist/session/filesystem-capture.js.map +1 -1
- package/dist/session/first-exec-capture.js +2 -3
- package/dist/session/first-exec-capture.js.map +1 -1
- package/dist/session/first-message-capture.js +1 -2
- package/dist/session/live-sessions.js +1 -2
- package/dist/session/memory-settings-hydration.js +1 -2
- package/dist/session/org-seed.js +1 -2
- package/dist/session/reply-credential-processor.js +1 -2
- package/dist/session/resource-migration.js +1 -2
- package/dist/session/run-audit.js +1 -2
- package/dist/session/session-threads.js +1 -2
- package/dist/session/session-title.js +1 -2
- package/dist/session/shell-commands.js +1 -2
- package/dist/session/source-control-tools.js +2 -3
- package/dist/session/thinking-default.d.ts +1 -1
- package/dist/session/thinking-default.d.ts.map +1 -1
- package/dist/session/thinking-default.js +11 -13
- package/dist/session/thinking-default.js.map +1 -1
- package/dist/session/thread-session-stamp.js +1 -2
- package/dist/session/thread-title-mirror.js +1 -2
- package/dist/session/thread-title-mirror.js.map +1 -1
- package/dist/session/work-item-repository.js +1 -2
- package/dist/session-owner-signal.js +1 -2
- package/dist/skills/catalog.js +1 -2
- package/dist/skills/service.js +1 -2
- package/dist/spa-static.js +1 -2
- package/dist/state-signing.js +1 -2
- package/dist/storage/domains/audit/actions.js +1 -2
- package/dist/storage/domains/audit/actors.js +1 -2
- package/dist/storage/domains/audit/agent-audit.js +1 -2
- package/dist/storage/domains/audit/base.js +1 -2
- package/dist/storage/domains/audit/domain.js +1 -2
- package/dist/storage/domains/audit/wire.js +1 -2
- package/dist/storage/domains/channel-identity/base.js +1 -2
- package/dist/storage/domains/comments/activity.js +1 -2
- package/dist/storage/domains/comments/actor.js +1 -2
- package/dist/storage/domains/comments/base.js +1 -2
- package/dist/storage/domains/comments/domain.js +1 -2
- package/dist/storage/domains/comments/feed-context.js +1 -2
- package/dist/storage/domains/comments/parse.js +1 -2
- package/dist/storage/domains/comments/routes.js +1 -2
- package/dist/storage/domains/comments/schema.js +1 -2
- package/dist/storage/domains/comments/wire.js +1 -2
- package/dist/storage/domains/credentials/base.d.ts +4 -1
- package/dist/storage/domains/credentials/base.d.ts.map +1 -1
- package/dist/storage/domains/credentials/base.js +40 -44
- package/dist/storage/domains/credentials/base.js.map +1 -1
- package/dist/storage/domains/custom-providers/base.js +1 -2
- package/dist/storage/domains/filesystem/base.js +1 -2
- package/dist/storage/domains/intake/base.d.ts +5 -0
- package/dist/storage/domains/intake/base.d.ts.map +1 -1
- package/dist/storage/domains/intake/base.js +10 -2
- package/dist/storage/domains/intake/base.js.map +1 -1
- package/dist/storage/domains/integrations/base.js +1 -2
- package/dist/storage/domains/memory-settings/base.js +1 -2
- package/dist/storage/domains/model-defaults/base.js +1 -2
- package/dist/storage/domains/projects/base.d.ts +0 -1
- package/dist/storage/domains/projects/base.d.ts.map +1 -1
- package/dist/storage/domains/projects/base.js +5 -6
- package/dist/storage/domains/projects/base.js.map +1 -1
- package/dist/storage/domains/queue-health/base.js +1 -2
- package/dist/storage/domains/source-control/base.js +1 -2
- package/dist/storage/domains/source-control/inmemory.js +1 -2
- package/dist/storage/domains/work-items/base.js +1 -2
- package/dist/storage/domains/work-items/board-version.js +1 -2
- package/dist/storage/domains/work-items/metrics.js +1 -2
- package/dist/telemetry-types.js +1 -2
- package/dist/telemetry.js +1 -2
- package/dist/timing.js +1 -2
- package/dist/tools/annotations.js +1 -2
- package/dist/tools/approval-tools.js +1 -2
- package/dist/tools/deliver.js +2 -3
- package/dist/tools/index.js +1 -2
- package/dist/tools/messaging-tools.js +1 -2
- package/dist/tools/permissions.js +1 -2
- package/dist/tools/read-tools.js +1 -2
- package/dist/tools/reports.js +1 -2
- package/dist/tools/run-watch.d.ts +0 -2
- package/dist/tools/run-watch.d.ts.map +1 -1
- package/dist/tools/run-watch.js +4 -44
- package/dist/tools/run-watch.js.map +1 -1
- package/dist/tools/sandbox-tools.js +1 -2
- package/dist/tools/scope.js +2 -3
- package/dist/tools/session-tools.js +1 -2
- package/dist/tools/sessions-state-processor.js +1 -2
- package/dist/tools/side-sessions.js +1 -2
- package/dist/tools/work-item-tools.js +1 -2
- package/dist/work-item-branch.js +1 -2
- package/dist/work-item-branch.js.map +1 -1
- package/dist/work-items/create-work-item.js +1 -2
- package/dist/work-items/decision-actions.js +1 -2
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +1 -3
- package/dist/workspace.js.map +1 -1
- package/factory-skills/factory-gitlab-review/SKILL.md +1 -1
- package/factory-skills/factory-plan/SKILL.md +1 -1
- package/factory-skills/factory-rereview/SKILL.md +14 -3
- package/factory-skills/factory-review/SKILL.md +14 -3
- package/factory-skills/factory-self-review/SKILL.md +1 -1
- package/factory-skills/factory-triage/SKILL.md +52 -29
- package/package.json +19 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/platform-auth-host.ts
|
|
2
2
|
const PLATFORM_AUTH_PROVIDER = "mastra-studio";
|
|
3
3
|
const CUSTOM_DOMAIN_UNSUPPORTED_ERROR = "custom_domain_unsupported";
|
|
4
4
|
const PLATFORM_AUTH_DOMAINS = ["mastra.cloud", "mastra.ai"];
|
|
@@ -12,7 +12,6 @@ function isPlatformAuthSupportedHost(hostname) {
|
|
|
12
12
|
if (LOOPBACK_HOSTS.has(normalizedHostname) || normalizedHostname.endsWith(".localhost")) return true;
|
|
13
13
|
return PLATFORM_AUTH_DOMAINS.some((domain) => normalizedHostname === domain || normalizedHostname.endsWith(`.${domain}`));
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { CUSTOM_DOMAIN_UNSUPPORTED_ERROR, PLATFORM_AUTH_PROVIDER, isPlatformAuthSupportedHost };
|
|
17
16
|
|
|
18
17
|
//# sourceMappingURL=platform-auth-host.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/provider-display-name.ts
|
|
2
2
|
const PROVIDER_DISPLAY_NAMES = {
|
|
3
3
|
anthropic: "Anthropic",
|
|
4
4
|
"github-copilot": "GitHub Copilot",
|
|
@@ -10,7 +10,6 @@ const PROVIDER_DISPLAY_NAMES = {
|
|
|
10
10
|
function providerDisplayName(provider) {
|
|
11
11
|
return PROVIDER_DISPLAY_NAMES[provider] ?? provider.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
12
12
|
}
|
|
13
|
-
//#endregion
|
|
14
13
|
export { providerDisplayName };
|
|
15
14
|
|
|
16
15
|
//# sourceMappingURL=provider-display-name.js.map
|
package/dist/review-verdict.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Normalizes the first non-empty line of a review body so its `Verdict:` line can be read
|
|
3
3
|
* regardless of the markdown it is wrapped in (`**Verdict:** request changes`, `# Verdict: ...`).
|
|
4
|
+
* A leading proxy attribution line is skipped.
|
|
4
5
|
*/
|
|
5
6
|
export declare function normalizedVerdictLine(body: string | undefined): string | undefined;
|
|
6
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-verdict.d.ts","sourceRoot":"","sources":["../src/review-verdict.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"review-verdict.d.ts","sourceRoot":"","sources":["../src/review-verdict.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAWlF;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAOxE"}
|
package/dist/review-verdict.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
// src/review-verdict.ts
|
|
2
|
+
/**
|
|
3
|
+
* The Platform GitHub proxy prefixes bodies it writes for a session with
|
|
4
|
+
* `> Opened by @<actor>`, which pushes the skill's verdict off the first line.
|
|
5
|
+
*/
|
|
6
|
+
const ACTOR_ATTRIBUTION_LINE = /^>\s*Opened by\s+\S+$/;
|
|
2
7
|
/**
|
|
3
8
|
* Normalizes the first non-empty line of a review body so its `Verdict:` line can be read
|
|
4
9
|
* regardless of the markdown it is wrapped in (`**Verdict:** request changes`, `# Verdict: ...`).
|
|
10
|
+
* A leading proxy attribution line is skipped.
|
|
5
11
|
*/
|
|
6
12
|
function normalizedVerdictLine(body) {
|
|
7
|
-
const
|
|
13
|
+
const lines = body?.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
|
|
14
|
+
const firstLine = lines?.[0] && ACTOR_ATTRIBUTION_LINE.test(lines[0]) ? lines[1] : lines?.[0];
|
|
8
15
|
if (!firstLine) return void 0;
|
|
9
16
|
return firstLine.replaceAll(/[*_`#>\s]+/g, " ").trim().toLowerCase();
|
|
10
17
|
}
|
|
@@ -23,7 +30,6 @@ function requestsChangesVerdict(body) {
|
|
|
23
30
|
if (!normalized) return false;
|
|
24
31
|
return /^verdict: ?(request changes|changes requested)$/.test(normalized);
|
|
25
32
|
}
|
|
26
|
-
//#endregion
|
|
27
33
|
export { normalizedVerdictLine, requestsChangesVerdict };
|
|
28
34
|
|
|
29
35
|
//# sourceMappingURL=review-verdict.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-verdict.js","names":[],"sources":["../src/review-verdict.ts"],"sourcesContent":["/**\n * Normalizes the first non-empty line of a review body so its `Verdict:` line can be read\n * regardless of the markdown it is wrapped in (`**Verdict:** request changes`, `# Verdict: ...`).\n */\nexport function normalizedVerdictLine(body: string | undefined): string | undefined {\n const
|
|
1
|
+
{"version":3,"file":"review-verdict.js","names":[],"sources":["../src/review-verdict.ts"],"sourcesContent":["/**\n * The Platform GitHub proxy prefixes bodies it writes for a session with\n * `> Opened by @<actor>`, which pushes the skill's verdict off the first line.\n */\nconst ACTOR_ATTRIBUTION_LINE = /^>\\s*Opened by\\s+\\S+$/;\n\n/**\n * Normalizes the first non-empty line of a review body so its `Verdict:` line can be read\n * regardless of the markdown it is wrapped in (`**Verdict:** request changes`, `# Verdict: ...`).\n * A leading proxy attribution line is skipped.\n */\nexport function normalizedVerdictLine(body: string | undefined): string | undefined {\n const lines = body\n ?.split('\\n')\n .map(line => line.trim())\n .filter(line => line.length > 0);\n const firstLine = lines?.[0] && ACTOR_ATTRIBUTION_LINE.test(lines[0]) ? lines[1] : lines?.[0];\n if (!firstLine) return undefined;\n return firstLine\n .replaceAll(/[*_`#>\\s]+/g, ' ')\n .trim()\n .toLowerCase();\n}\n\n/**\n * Detects the `factory-review` handoff verdict in a comment body.\n *\n * GitHub forbids an app from reviewing a pull request it authored, so on\n * Factory-authored PRs the review skill falls back to posting its verdict as a\n * plain comment. That comment is the only signal the authoring agent gets, so\n * it has to be readable back out. The skill's handoff contract puts the verdict\n * on the first line (`Verdict: request changes`), so only that line is\n * inspected — a verdict quoted later in the findings must not count.\n */\nexport function requestsChangesVerdict(body: string | undefined): boolean {\n // Tolerate the markdown the skill wraps the line in (`**Verdict: ...**`).\n const normalized = normalizedVerdictLine(body);\n if (!normalized) return false;\n // Match the verdict exactly so negated phrasings (\"Verdict: do not request\n // changes\") cannot wake the author.\n return /^verdict: ?(request changes|changes requested)$/.test(normalized);\n}\n"],"mappings":";;;;;AAIA,MAAM,yBAAyB;;;;;;AAO/B,SAAgB,sBAAsB,MAA8C;CAClF,MAAM,QAAQ,MACV,MAAM,IAAI,CAAC,CACZ,KAAI,SAAQ,KAAK,KAAK,CAAC,CAAC,CACxB,QAAO,SAAQ,KAAK,SAAS,CAAC;CACjC,MAAM,YAAY,QAAQ,MAAM,uBAAuB,KAAK,MAAM,EAAE,IAAI,MAAM,KAAK,QAAQ;CAC3F,IAAI,CAAC,WAAW,OAAO,KAAA;CACvB,OAAO,UACJ,WAAW,eAAe,GAAG,CAAC,CAC9B,KAAK,CAAC,CACN,YAAY;AACjB;;;;;;;;;;;AAYA,SAAgB,uBAAuB,MAAmC;CAExE,MAAM,aAAa,sBAAsB,IAAI;CAC7C,IAAI,CAAC,YAAY,OAAO;CAGxB,OAAO,kDAAkD,KAAK,UAAU;AAC1E"}
|
|
@@ -2,7 +2,7 @@ import { boardForWorkItem } from "../boards/semantics.js";
|
|
|
2
2
|
import "../boards/index.js";
|
|
3
3
|
import { factoryActivityAttentionIdentity, factoryAttentionKey } from "../storage/domains/work-items/base.js";
|
|
4
4
|
import { collectPage, markScanRead, matchesView, receiptScope, scanBatches } from "./attention-providers.js";
|
|
5
|
-
|
|
5
|
+
// src/routes/attention-activity.ts
|
|
6
6
|
/** Projects `activity.ts` fan-out rows. */
|
|
7
7
|
var ActivityAttentionProvider = class {
|
|
8
8
|
kind = "activity";
|
|
@@ -149,7 +149,6 @@ function toActivityItem(scope, resolved) {
|
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
//#endregion
|
|
153
152
|
export { ActivityAttentionProvider };
|
|
154
153
|
|
|
155
154
|
//# sourceMappingURL=attention-activity.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factoryAgentWaitingAttentionIdentity, factoryAttentionKey } from "../storage/domains/work-items/base.js";
|
|
2
2
|
import { matchesView, receiptScope } from "./attention-providers.js";
|
|
3
|
-
|
|
3
|
+
// src/routes/attention-parked.ts
|
|
4
4
|
function parkedRunLabel(toolName) {
|
|
5
5
|
return toolName === "submit_plan" ? "Plan waiting for review" : "Agent is waiting for an answer";
|
|
6
6
|
}
|
|
@@ -130,7 +130,6 @@ var ParkedRunAttentionProvider = class {
|
|
|
130
130
|
return { hasMore: false };
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
-
//#endregion
|
|
134
133
|
export { ParkedRunAttentionProvider };
|
|
135
134
|
|
|
136
135
|
//# sourceMappingURL=attention-parked.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { factoryProposalAttentionIdentity } from "../storage/domains/work-items/base.js";
|
|
2
2
|
import { factoryDecisionType } from "./attention-providers.js";
|
|
3
|
-
|
|
3
|
+
// src/routes/attention-proposed.ts
|
|
4
4
|
function proposedAction(decision) {
|
|
5
5
|
const { type, stage, role } = decision.decision;
|
|
6
6
|
if (type === "transition" && typeof stage === "string") return `move to ${stage.slice(0, 64)}`;
|
|
@@ -15,7 +15,6 @@ const proposedDecisionAttentionSpec = {
|
|
|
15
15
|
detail: (decision) => `Waiting for approval to ${proposedAction(decision)}`,
|
|
16
16
|
matches: (decision, item, search) => item?.title.toLowerCase().includes(search) === true || proposedAction(decision).toLowerCase().includes(search) || factoryDecisionType(decision).toLowerCase().includes(search)
|
|
17
17
|
};
|
|
18
|
-
//#endregion
|
|
19
18
|
export { proposedDecisionAttentionSpec };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=attention-proposed.js.map
|
|
@@ -3,7 +3,7 @@ import "../boards/index.js";
|
|
|
3
3
|
import { factoryDispatchFailureMetadata } from "../rules/dispatch-errors.js";
|
|
4
4
|
import { factoryAttentionKey, factoryDecisionAttentionIdentity, factoryMentionAttentionIdentity } from "../storage/domains/work-items/base.js";
|
|
5
5
|
import { decisionRetryable, overtakenDecisionIds } from "../rules/decision-applicability.js";
|
|
6
|
-
|
|
6
|
+
// src/routes/attention-providers.ts
|
|
7
7
|
/**
|
|
8
8
|
* Per-kind attention providers. Each kind owns its counts, its bounded page
|
|
9
9
|
* scan, and its wire item shape; the route layer k-way merges provider pages
|
|
@@ -391,7 +391,6 @@ function receiptScope(scope) {
|
|
|
391
391
|
userId: scope.userId
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
|
-
//#endregion
|
|
395
394
|
export { DecisionAttentionProvider, MentionAttentionProvider, SCAN_PAGE_SIZE, collectPage, factoryDecisionType, failedDecisionAttentionSpec, markScanRead, matchesView, receiptScope, scanBatches };
|
|
396
395
|
|
|
397
396
|
//# sourceMappingURL=attention-providers.js.map
|
package/dist/routes/attention.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ActivityAttentionProvider } from "./attention-activity.js";
|
|
|
5
5
|
import { ParkedRunAttentionProvider } from "./attention-parked.js";
|
|
6
6
|
import { proposedDecisionAttentionSpec } from "./attention-proposed.js";
|
|
7
7
|
import { registerApiRoute } from "@mastra/core/server";
|
|
8
|
-
|
|
8
|
+
// src/routes/attention.ts
|
|
9
9
|
function encodeAttentionCursor(cursors) {
|
|
10
10
|
const wire = {};
|
|
11
11
|
for (const [kind, position] of cursors) wire[kind] = position ? [position.occurredAt.toISOString(), position.id] : null;
|
|
@@ -212,7 +212,6 @@ function buildAttentionRoutes(dependencies) {
|
|
|
212
212
|
receiptRoute(dependencies, "restore", "restore")
|
|
213
213
|
];
|
|
214
214
|
}
|
|
215
|
-
//#endregion
|
|
216
215
|
export { buildAttentionRoutes, factoryDecisionType };
|
|
217
216
|
|
|
218
217
|
//# sourceMappingURL=attention.js.map
|
|
@@ -2,7 +2,7 @@ import { FACTORY_ROUTE_CONTRACTS } from "./contracts.js";
|
|
|
2
2
|
import { Route } from "./route.js";
|
|
3
3
|
import { auditRequestContext } from "../storage/domains/audit/domain.js";
|
|
4
4
|
import { registerApiRoute } from "@mastra/core/server";
|
|
5
|
-
|
|
5
|
+
// src/routes/automation-runs.ts
|
|
6
6
|
function loose(c) {
|
|
7
7
|
return c;
|
|
8
8
|
}
|
|
@@ -190,7 +190,6 @@ var AutomationRunRoutes = class extends Route {
|
|
|
190
190
|
function buildAutomationRunRoutes(deps) {
|
|
191
191
|
return new AutomationRunRoutes(deps).routes();
|
|
192
192
|
}
|
|
193
|
-
//#endregion
|
|
194
193
|
export { AutomationRunRoutes, buildAutomationRunRoutes };
|
|
195
194
|
|
|
196
195
|
//# sourceMappingURL=automation-runs.js.map
|
package/dist/routes/config.d.ts
CHANGED
|
@@ -48,8 +48,12 @@ export interface ProviderInfo {
|
|
|
48
48
|
* when one shadows the other.
|
|
49
49
|
*/
|
|
50
50
|
userCredential?: 'oauth' | 'api_key';
|
|
51
|
+
/** Tenant mode: the caller's personal sign-in could not be renewed and must be redone. */
|
|
52
|
+
userCredentialExpired?: true;
|
|
51
53
|
/** Tenant mode: the shared org credential for this provider, if any. */
|
|
52
54
|
orgCredential?: 'oauth' | 'api_key';
|
|
55
|
+
/** Tenant mode: the shared org sign-in could not be renewed and must be redone. */
|
|
56
|
+
orgCredentialExpired?: true;
|
|
53
57
|
/** Web OAuth sign-in capability, when the provider supports it. */
|
|
54
58
|
oauth?: {
|
|
55
59
|
supported: true;
|
|
@@ -81,6 +85,9 @@ export interface ModelCatalog {
|
|
|
81
85
|
id: string;
|
|
82
86
|
defaultModelId?: string;
|
|
83
87
|
}>;
|
|
88
|
+
getDefaultMode?: () => {
|
|
89
|
+
defaultModelId?: string;
|
|
90
|
+
};
|
|
84
91
|
getSession?: (sessionId: string) => Promise<OMSession | undefined>;
|
|
85
92
|
}
|
|
86
93
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/routes/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/routes/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,mCAAmC,CAAC;AAO7F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAOpD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,oBAA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/D;;;OAGG;IACH,mBAAmB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,YAAa,SAAQ,KAAK,CAAC,gBAAgB,CAAC;IACvD,MAAM,IAAI,QAAQ,EAAE;CAywBrB"}
|
package/dist/routes/config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WEB_OAUTH_PROVIDERS, credentialLabel, getAuthProviderId, listTenantCredentialsForRequest, resolveCredentialContext, tenantOrgId } from "./provider-credentials.js";
|
|
2
|
+
import { resolveTenantProviderDefaultModel } from "./tenant-credentials.js";
|
|
2
3
|
import { effectiveModelScope } from "../storage/domains/projects/base.js";
|
|
3
4
|
import { THINKING_LEVELS } from "./contracts.js";
|
|
4
5
|
import { resolveFactoryModelPolicy, routedPersonalDefaults } from "../session/credential-policy.js";
|
|
@@ -14,7 +15,7 @@ import { resolveAutoOMModelId } from "@mastra/code-sdk/onboarding/packs";
|
|
|
14
15
|
import { MASTRA_GATEWAY_PROVIDER, getCustomProviderId } from "@mastra/code-sdk/onboarding/settings";
|
|
15
16
|
import { AMAZON_BEDROCK_GATEWAY_ID } from "@mastra/code-sdk/providers/amazon-bedrock-gateway";
|
|
16
17
|
import { getModelReasoningOptions } from "@mastra/core/llm";
|
|
17
|
-
|
|
18
|
+
// src/routes/config.ts
|
|
18
19
|
/** Widen a route-local Hono context to the plain `Context` the auth helpers take. */
|
|
19
20
|
function loose(c) {
|
|
20
21
|
return c;
|
|
@@ -44,13 +45,17 @@ async function listProviders({ controller, authStorage, tenantCredentials, deplo
|
|
|
44
45
|
let source = "none";
|
|
45
46
|
let orgKey;
|
|
46
47
|
let userCredential;
|
|
48
|
+
let userCredentialExpired = false;
|
|
47
49
|
let orgCredential;
|
|
50
|
+
let orgCredentialExpired = false;
|
|
48
51
|
if (tenantCredentials) {
|
|
49
52
|
const userRec = tenantCredentials.find((r) => r.scope === "user" && r.provider === authProviderId);
|
|
50
53
|
const orgRec = tenantCredentials.find((r) => r.scope === "org" && r.provider === authProviderId);
|
|
51
54
|
orgKey = orgRec !== void 0;
|
|
52
55
|
userCredential = userRec?.credential.type;
|
|
56
|
+
userCredentialExpired = userRec?.refreshFailedAt !== void 0;
|
|
53
57
|
orgCredential = orgRec?.credential.type;
|
|
58
|
+
orgCredentialExpired = orgRec?.refreshFailedAt !== void 0;
|
|
54
59
|
if (userRec?.credential.type === "oauth") source = "oauth-user";
|
|
55
60
|
else if (userRec?.credential.type === "api_key") source = "stored-user";
|
|
56
61
|
else if (orgRec?.credential.type === "oauth") source = "oauth-org";
|
|
@@ -66,7 +71,9 @@ async function listProviders({ controller, authStorage, tenantCredentials, deplo
|
|
|
66
71
|
source,
|
|
67
72
|
...orgKey !== void 0 ? { orgKey } : {},
|
|
68
73
|
...userCredential ? { userCredential } : {},
|
|
74
|
+
...userCredentialExpired ? { userCredentialExpired: true } : {},
|
|
69
75
|
...orgCredential ? { orgCredential } : {},
|
|
76
|
+
...orgCredentialExpired ? { orgCredentialExpired: true } : {},
|
|
70
77
|
...flowKind ? { oauth: {
|
|
71
78
|
supported: true,
|
|
72
79
|
modes: [flowKind]
|
|
@@ -647,6 +654,7 @@ var ConfigRoutes = class extends Route {
|
|
|
647
654
|
const tenant = auth.tenant(c);
|
|
648
655
|
let tenantCredentials = allTenantCredentials;
|
|
649
656
|
let sessionPolicy;
|
|
657
|
+
let credentialTenant;
|
|
650
658
|
const resourceId = c.req.query("resourceId");
|
|
651
659
|
const threadId = c.req.query("threadId");
|
|
652
660
|
const sessionId = c.req.query("sessionId");
|
|
@@ -710,6 +718,11 @@ var ConfigRoutes = class extends Route {
|
|
|
710
718
|
const scope = z.enum(["org", "user"]).safeParse(c.req.query("scope"));
|
|
711
719
|
if (!scope.success) return c.json({ error: "invalid_model_scope" }, 400);
|
|
712
720
|
tenantCredentials = allTenantCredentials?.filter((record) => record.scope === scope.data);
|
|
721
|
+
if (tenant) credentialTenant = {
|
|
722
|
+
orgId: tenantOrgId(tenant),
|
|
723
|
+
userId: tenant.userId,
|
|
724
|
+
credentialScope: scope.data === "user" ? "user" : "factory"
|
|
725
|
+
};
|
|
713
726
|
} else if (allTenantCredentials && factoryProjectId && tenant) {
|
|
714
727
|
if (!options.factoryProjects) return c.json({ error: "factory_unavailable" }, 503);
|
|
715
728
|
await options.factoryProjects.ensureReady();
|
|
@@ -720,6 +733,11 @@ var ConfigRoutes = class extends Route {
|
|
|
720
733
|
if (!project) return c.json({ error: "factory_project_not_found" }, 404);
|
|
721
734
|
const credentialScope = project.modelScope === "user" ? "user" : "org";
|
|
722
735
|
tenantCredentials = allTenantCredentials.filter((record) => record.scope === credentialScope);
|
|
736
|
+
credentialTenant = {
|
|
737
|
+
orgId: tenantOrgId(tenant),
|
|
738
|
+
userId: tenant.userId,
|
|
739
|
+
credentialScope: credentialScope === "user" ? "user" : "factory"
|
|
740
|
+
};
|
|
723
741
|
}
|
|
724
742
|
const customProviders = options.customProviders;
|
|
725
743
|
const models = await buildModelCatalog({
|
|
@@ -736,10 +754,19 @@ var ConfigRoutes = class extends Route {
|
|
|
736
754
|
return "response" in ctx ? [] : ctx.storage.list({ orgId: ctx.orgId });
|
|
737
755
|
} : void 0
|
|
738
756
|
});
|
|
739
|
-
return c.json({
|
|
757
|
+
if (!credentialTenant) return c.json({
|
|
740
758
|
...sessionPolicy,
|
|
741
759
|
models
|
|
742
760
|
});
|
|
761
|
+
const modeModelId = controller.getDefaultMode?.().defaultModelId;
|
|
762
|
+
const candidate = await resolveTenantProviderDefaultModel(credentialTenant, modeModelId).catch((error) => {
|
|
763
|
+
console.warn("[Factory Config] Failed to resolve a provider default model", { error: error instanceof Error ? error.message : String(error) });
|
|
764
|
+
}) ?? modeModelId;
|
|
765
|
+
const fallbackModelId = models.find((model) => model.id === candidate)?.id ?? null;
|
|
766
|
+
return c.json({
|
|
767
|
+
fallbackModelId,
|
|
768
|
+
models
|
|
769
|
+
});
|
|
743
770
|
} catch (error) {
|
|
744
771
|
return c.json({ error: error instanceof Error ? error.message : String(error) }, 500);
|
|
745
772
|
}
|
|
@@ -1099,7 +1126,6 @@ var ConfigRoutes = class extends Route {
|
|
|
1099
1126
|
];
|
|
1100
1127
|
}
|
|
1101
1128
|
};
|
|
1102
|
-
//#endregion
|
|
1103
1129
|
export { ConfigRoutes, DEPLOYMENT_MODEL_PROVIDERS, buildModelCatalog, buildProviderAccess, isDeploymentModelProvider, listProviders, listSessionScopedCredentials, resolveDeploymentModelProviders };
|
|
1104
1130
|
|
|
1105
1131
|
//# sourceMappingURL=config.js.map
|