@mastra/factory 0.0.0-esbuild-bundle-worker-20260807173433
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/CHANGELOG.md +1008 -0
- package/LICENSE.md +30 -0
- package/README.md +27 -0
- package/dist/auth.d.ts +183 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +507 -0
- package/dist/auth.js.map +1 -0
- package/dist/capabilities/connection.d.ts +9 -0
- package/dist/capabilities/connection.d.ts.map +1 -0
- package/dist/capabilities/connection.js +1 -0
- package/dist/capabilities/intake.d.ts +141 -0
- package/dist/capabilities/intake.d.ts.map +1 -0
- package/dist/capabilities/intake.js +1 -0
- package/dist/capabilities/version-control.d.ts +247 -0
- package/dist/capabilities/version-control.d.ts.map +1 -0
- package/dist/capabilities/version-control.js +1 -0
- package/dist/factory.d.ts +159 -0
- package/dist/factory.d.ts.map +1 -0
- package/dist/factory.js +491 -0
- package/dist/factory.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/integrations/base.d.ts +254 -0
- package/dist/integrations/base.d.ts.map +1 -0
- package/dist/integrations/base.js +1 -0
- package/dist/integrations/github/config.d.ts +60 -0
- package/dist/integrations/github/config.d.ts.map +1 -0
- package/dist/integrations/github/config.js +42 -0
- package/dist/integrations/github/config.js.map +1 -0
- package/dist/integrations/github/integration.d.ts +220 -0
- package/dist/integrations/github/integration.d.ts.map +1 -0
- package/dist/integrations/github/integration.js +1162 -0
- package/dist/integrations/github/integration.js.map +1 -0
- package/dist/integrations/github/issue-triage.d.ts +27 -0
- package/dist/integrations/github/issue-triage.d.ts.map +1 -0
- package/dist/integrations/github/issue-triage.js +82 -0
- package/dist/integrations/github/issue-triage.js.map +1 -0
- package/dist/integrations/github/pat.d.ts +38 -0
- package/dist/integrations/github/pat.d.ts.map +1 -0
- package/dist/integrations/github/pat.js +59 -0
- package/dist/integrations/github/pat.js.map +1 -0
- package/dist/integrations/github/provenance.d.ts +27 -0
- package/dist/integrations/github/provenance.d.ts.map +1 -0
- package/dist/integrations/github/provenance.js +75 -0
- package/dist/integrations/github/provenance.js.map +1 -0
- package/dist/integrations/github/reconcile-worker.d.ts +41 -0
- package/dist/integrations/github/reconcile-worker.d.ts.map +1 -0
- package/dist/integrations/github/reconcile-worker.js +125 -0
- package/dist/integrations/github/reconcile-worker.js.map +1 -0
- package/dist/integrations/github/routes.d.ts +69 -0
- package/dist/integrations/github/routes.d.ts.map +1 -0
- package/dist/integrations/github/routes.js +1335 -0
- package/dist/integrations/github/routes.js.map +1 -0
- package/dist/integrations/github/rules.d.ts +105 -0
- package/dist/integrations/github/rules.d.ts.map +1 -0
- package/dist/integrations/github/rules.js +551 -0
- package/dist/integrations/github/rules.js.map +1 -0
- package/dist/integrations/github/sandbox-release.d.ts +53 -0
- package/dist/integrations/github/sandbox-release.d.ts.map +1 -0
- package/dist/integrations/github/sandbox-release.js +115 -0
- package/dist/integrations/github/sandbox-release.js.map +1 -0
- package/dist/integrations/github/sandbox.d.ts +281 -0
- package/dist/integrations/github/sandbox.d.ts.map +1 -0
- package/dist/integrations/github/sandbox.js +547 -0
- package/dist/integrations/github/sandbox.js.map +1 -0
- package/dist/integrations/github/session-subscriptions.d.ts +26 -0
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/session-subscriptions.js +192 -0
- package/dist/integrations/github/session-subscriptions.js.map +1 -0
- package/dist/integrations/github/subscriptions.d.ts +54 -0
- package/dist/integrations/github/subscriptions.d.ts.map +1 -0
- package/dist/integrations/github/subscriptions.js +62 -0
- package/dist/integrations/github/subscriptions.js.map +1 -0
- package/dist/integrations/github/token-refresh.d.ts +12 -0
- package/dist/integrations/github/token-refresh.d.ts.map +1 -0
- package/dist/integrations/github/token-refresh.js +24 -0
- package/dist/integrations/github/token-refresh.js.map +1 -0
- package/dist/integrations/github/webhook.d.ts +107 -0
- package/dist/integrations/github/webhook.d.ts.map +1 -0
- package/dist/integrations/github/webhook.js +371 -0
- package/dist/integrations/github/webhook.js.map +1 -0
- package/dist/integrations/linear/agent-tools.d.ts +34 -0
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -0
- package/dist/integrations/linear/agent-tools.js +85 -0
- package/dist/integrations/linear/agent-tools.js.map +1 -0
- package/dist/integrations/linear/integration.d.ts +235 -0
- package/dist/integrations/linear/integration.d.ts.map +1 -0
- package/dist/integrations/linear/integration.js +676 -0
- package/dist/integrations/linear/integration.js.map +1 -0
- package/dist/integrations/linear/routes.d.ts +61 -0
- package/dist/integrations/linear/routes.d.ts.map +1 -0
- package/dist/integrations/linear/routes.js +240 -0
- package/dist/integrations/linear/routes.js.map +1 -0
- package/dist/integrations/linear/rules.d.ts +44 -0
- package/dist/integrations/linear/rules.d.ts.map +1 -0
- package/dist/integrations/linear/rules.js +133 -0
- package/dist/integrations/linear/rules.js.map +1 -0
- package/dist/integrations/linear/storage.d.ts +65 -0
- package/dist/integrations/linear/storage.d.ts.map +1 -0
- package/dist/integrations/linear/storage.js +1 -0
- package/dist/integrations/platform/api-client.d.ts +26 -0
- package/dist/integrations/platform/api-client.d.ts.map +1 -0
- package/dist/integrations/platform/api-client.js +156 -0
- package/dist/integrations/platform/api-client.js.map +1 -0
- package/dist/integrations/platform/github/event-worker.d.ts +44 -0
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -0
- package/dist/integrations/platform/github/event-worker.js +349 -0
- package/dist/integrations/platform/github/event-worker.js.map +1 -0
- package/dist/integrations/platform/github/integration.d.ts +64 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -0
- package/dist/integrations/platform/github/integration.js +1006 -0
- package/dist/integrations/platform/github/integration.js.map +1 -0
- package/dist/integrations/platform/linear/integration.d.ts +46 -0
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -0
- package/dist/integrations/platform/linear/integration.js +483 -0
- package/dist/integrations/platform/linear/integration.js.map +1 -0
- package/dist/integrations/slack/connect-route.d.ts +46 -0
- package/dist/integrations/slack/connect-route.d.ts.map +1 -0
- package/dist/integrations/slack/connect-route.js +186 -0
- package/dist/integrations/slack/connect-route.js.map +1 -0
- package/dist/integrations/slack/integration.d.ts +62 -0
- package/dist/integrations/slack/integration.d.ts.map +1 -0
- package/dist/integrations/slack/integration.js +68 -0
- package/dist/integrations/slack/integration.js.map +1 -0
- package/dist/integrations/slack/slack.d.ts +200 -0
- package/dist/integrations/slack/slack.d.ts.map +1 -0
- package/dist/integrations/slack/slack.js +411 -0
- package/dist/integrations/slack/slack.js.map +1 -0
- package/dist/integrations/workos/integration.d.ts +39 -0
- package/dist/integrations/workos/integration.d.ts.map +1 -0
- package/dist/integrations/workos/integration.js +91 -0
- package/dist/integrations/workos/integration.js.map +1 -0
- package/dist/routes/config.d.ts +235 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +972 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/custom-provider-source.d.ts +52 -0
- package/dist/routes/custom-provider-source.d.ts.map +1 -0
- package/dist/routes/custom-provider-source.js +124 -0
- package/dist/routes/custom-provider-source.js.map +1 -0
- package/dist/routes/fs.d.ts +151 -0
- package/dist/routes/fs.d.ts.map +1 -0
- package/dist/routes/fs.js +708 -0
- package/dist/routes/fs.js.map +1 -0
- package/dist/routes/intake.d.ts +23 -0
- package/dist/routes/intake.d.ts.map +1 -0
- package/dist/routes/intake.js +179 -0
- package/dist/routes/intake.js.map +1 -0
- package/dist/routes/oauth.d.ts +43 -0
- package/dist/routes/oauth.d.ts.map +1 -0
- package/dist/routes/oauth.js +463 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/projects.d.ts +19 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +461 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/provider-credentials.d.ts +81 -0
- package/dist/routes/provider-credentials.d.ts.map +1 -0
- package/dist/routes/provider-credentials.js +86 -0
- package/dist/routes/provider-credentials.js.map +1 -0
- package/dist/routes/route.d.ts +48 -0
- package/dist/routes/route.d.ts.map +1 -0
- package/dist/routes/route.js +15 -0
- package/dist/routes/route.js.map +1 -0
- package/dist/routes/skills.d.ts +30 -0
- package/dist/routes/skills.d.ts.map +1 -0
- package/dist/routes/skills.js +168 -0
- package/dist/routes/skills.js.map +1 -0
- package/dist/routes/surface.d.ts +107 -0
- package/dist/routes/surface.d.ts.map +1 -0
- package/dist/routes/surface.js +297 -0
- package/dist/routes/surface.js.map +1 -0
- package/dist/routes/tenant-credentials.d.ts +74 -0
- package/dist/routes/tenant-credentials.d.ts.map +1 -0
- package/dist/routes/tenant-credentials.js +156 -0
- package/dist/routes/tenant-credentials.js.map +1 -0
- package/dist/routes/work-items.d.ts +40 -0
- package/dist/routes/work-items.d.ts.map +1 -0
- package/dist/routes/work-items.js +695 -0
- package/dist/routes/work-items.js.map +1 -0
- package/dist/rules/binding-context.d.ts +5 -0
- package/dist/rules/binding-context.d.ts.map +1 -0
- package/dist/rules/binding-context.js +28 -0
- package/dist/rules/binding-context.js.map +1 -0
- package/dist/rules/defaults.d.ts +9 -0
- package/dist/rules/defaults.d.ts.map +1 -0
- package/dist/rules/defaults.js +322 -0
- package/dist/rules/defaults.js.map +1 -0
- package/dist/rules/dispatcher.d.ts +43 -0
- package/dist/rules/dispatcher.d.ts.map +1 -0
- package/dist/rules/dispatcher.js +547 -0
- package/dist/rules/dispatcher.js.map +1 -0
- package/dist/rules/index.d.ts +7 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +5 -0
- package/dist/rules/processor.d.ts +54 -0
- package/dist/rules/processor.d.ts.map +1 -0
- package/dist/rules/processor.js +378 -0
- package/dist/rules/processor.js.map +1 -0
- package/dist/rules/resolve.d.ts +17 -0
- package/dist/rules/resolve.d.ts.map +1 -0
- package/dist/rules/resolve.js +30 -0
- package/dist/rules/resolve.js.map +1 -0
- package/dist/rules/start-coordinator.d.ts +60 -0
- package/dist/rules/start-coordinator.d.ts.map +1 -0
- package/dist/rules/start-coordinator.js +175 -0
- package/dist/rules/start-coordinator.js.map +1 -0
- package/dist/rules/tools.d.ts +10 -0
- package/dist/rules/tools.d.ts.map +1 -0
- package/dist/rules/tools.js +59 -0
- package/dist/rules/tools.js.map +1 -0
- package/dist/rules/transition-service.d.ts +49 -0
- package/dist/rules/transition-service.d.ts.map +1 -0
- package/dist/rules/transition-service.js +232 -0
- package/dist/rules/transition-service.js.map +1 -0
- package/dist/rules/types.d.ts +261 -0
- package/dist/rules/types.d.ts.map +1 -0
- package/dist/rules/types.js +43 -0
- package/dist/rules/types.js.map +1 -0
- package/dist/rules/validation.d.ts +11 -0
- package/dist/rules/validation.d.ts.map +1 -0
- package/dist/rules/validation.js +308 -0
- package/dist/rules/validation.js.map +1 -0
- package/dist/sandbox/fleet.d.ts +222 -0
- package/dist/sandbox/fleet.d.ts.map +1 -0
- package/dist/sandbox/fleet.js +322 -0
- package/dist/sandbox/fleet.js.map +1 -0
- package/dist/sandbox/reattach.d.ts +3 -0
- package/dist/sandbox/reattach.d.ts.map +1 -0
- package/dist/sandbox/reattach.js +16 -0
- package/dist/sandbox/reattach.js.map +1 -0
- package/dist/server-error.d.ts +12 -0
- package/dist/server-error.d.ts.map +1 -0
- package/dist/server-error.js +16 -0
- package/dist/server-error.js.map +1 -0
- package/dist/session/factory-session.d.ts +116 -0
- package/dist/session/factory-session.d.ts.map +1 -0
- package/dist/session/factory-session.js +162 -0
- package/dist/session/factory-session.js.map +1 -0
- package/dist/skills/service.d.ts +48 -0
- package/dist/skills/service.d.ts.map +1 -0
- package/dist/skills/service.js +40 -0
- package/dist/skills/service.js.map +1 -0
- package/dist/spa-static.d.ts +33 -0
- package/dist/spa-static.d.ts.map +1 -0
- package/dist/spa-static.js +104 -0
- package/dist/spa-static.js.map +1 -0
- package/dist/state-signing.d.ts +59 -0
- package/dist/state-signing.d.ts.map +1 -0
- package/dist/state-signing.js +83 -0
- package/dist/state-signing.js.map +1 -0
- package/dist/storage/domains/audit/agent-audit.d.ts +27 -0
- package/dist/storage/domains/audit/agent-audit.d.ts.map +1 -0
- package/dist/storage/domains/audit/agent-audit.js +66 -0
- package/dist/storage/domains/audit/agent-audit.js.map +1 -0
- package/dist/storage/domains/audit/base.d.ts +140 -0
- package/dist/storage/domains/audit/base.d.ts.map +1 -0
- package/dist/storage/domains/audit/base.js +184 -0
- package/dist/storage/domains/audit/base.js.map +1 -0
- package/dist/storage/domains/audit/domain.d.ts +76 -0
- package/dist/storage/domains/audit/domain.d.ts.map +1 -0
- package/dist/storage/domains/audit/domain.js +269 -0
- package/dist/storage/domains/audit/domain.js.map +1 -0
- package/dist/storage/domains/channel-identity/base.d.ts +96 -0
- package/dist/storage/domains/channel-identity/base.d.ts.map +1 -0
- package/dist/storage/domains/channel-identity/base.js +149 -0
- package/dist/storage/domains/channel-identity/base.js.map +1 -0
- package/dist/storage/domains/credentials/base.d.ts +134 -0
- package/dist/storage/domains/credentials/base.d.ts.map +1 -0
- package/dist/storage/domains/credentials/base.js +273 -0
- package/dist/storage/domains/credentials/base.js.map +1 -0
- package/dist/storage/domains/custom-providers/base.d.ts +57 -0
- package/dist/storage/domains/custom-providers/base.d.ts.map +1 -0
- package/dist/storage/domains/custom-providers/base.js +145 -0
- package/dist/storage/domains/custom-providers/base.js.map +1 -0
- package/dist/storage/domains/intake/base.d.ts +38 -0
- package/dist/storage/domains/intake/base.d.ts.map +1 -0
- package/dist/storage/domains/intake/base.js +80 -0
- package/dist/storage/domains/intake/base.js.map +1 -0
- package/dist/storage/domains/integrations/base.d.ts +126 -0
- package/dist/storage/domains/integrations/base.d.ts.map +1 -0
- package/dist/storage/domains/integrations/base.js +317 -0
- package/dist/storage/domains/integrations/base.js.map +1 -0
- package/dist/storage/domains/memory-settings/base.d.ts +62 -0
- package/dist/storage/domains/memory-settings/base.d.ts.map +1 -0
- package/dist/storage/domains/memory-settings/base.js +126 -0
- package/dist/storage/domains/memory-settings/base.js.map +1 -0
- package/dist/storage/domains/model-packs/base.d.ts +49 -0
- package/dist/storage/domains/model-packs/base.d.ts.map +1 -0
- package/dist/storage/domains/model-packs/base.js +96 -0
- package/dist/storage/domains/model-packs/base.js.map +1 -0
- package/dist/storage/domains/projects/base.d.ts +58 -0
- package/dist/storage/domains/projects/base.d.ts.map +1 -0
- package/dist/storage/domains/projects/base.js +111 -0
- package/dist/storage/domains/projects/base.js.map +1 -0
- package/dist/storage/domains/queue-health/base.d.ts +52 -0
- package/dist/storage/domains/queue-health/base.d.ts.map +1 -0
- package/dist/storage/domains/queue-health/base.js +122 -0
- package/dist/storage/domains/queue-health/base.js.map +1 -0
- package/dist/storage/domains/source-control/base.d.ts +360 -0
- package/dist/storage/domains/source-control/base.d.ts.map +1 -0
- package/dist/storage/domains/source-control/base.js +914 -0
- package/dist/storage/domains/source-control/base.js.map +1 -0
- package/dist/storage/domains/source-control/inmemory.d.ts +175 -0
- package/dist/storage/domains/source-control/inmemory.d.ts.map +1 -0
- package/dist/storage/domains/source-control/inmemory.js +380 -0
- package/dist/storage/domains/source-control/inmemory.js.map +1 -0
- package/dist/storage/domains/work-items/base.d.ts +412 -0
- package/dist/storage/domains/work-items/base.d.ts.map +1 -0
- package/dist/storage/domains/work-items/base.js +1320 -0
- package/dist/storage/domains/work-items/base.js.map +1 -0
- package/dist/storage/domains/work-items/metrics.d.ts +101 -0
- package/dist/storage/domains/work-items/metrics.d.ts.map +1 -0
- package/dist/storage/domains/work-items/metrics.js +221 -0
- package/dist/storage/domains/work-items/metrics.js.map +1 -0
- package/dist/timing.d.ts +15 -0
- package/dist/timing.d.ts.map +1 -0
- package/dist/timing.js +34 -0
- package/dist/timing.js.map +1 -0
- package/dist/workspace.d.ts +24 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +287 -0
- package/dist/workspace.js.map +1 -0
- package/factory-skills/configure-factory-rules/SKILL.md +67 -0
- package/factory-skills/factory-plan/SKILL.md +61 -0
- package/factory-skills/factory-review/SKILL.md +157 -0
- package/factory-skills/factory-triage/SKILL.md +99 -0
- package/package.json +83 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import type { AuthStorage } from '@mastra/code-sdk/auth/storage';
|
|
2
|
+
import type { ModePack, ProviderAccess } from '@mastra/code-sdk/onboarding/packs';
|
|
3
|
+
import type { ApiRoute } from '@mastra/core/server';
|
|
4
|
+
import type { CredentialRecord, LoginSessionKind, ModelCredentialsStorage } from '../storage/domains/credentials/base.js';
|
|
5
|
+
import type { CustomProvidersStorage } from '../storage/domains/custom-providers/base.js';
|
|
6
|
+
import type { MemorySettingsStorage } from '../storage/domains/memory-settings/base.js';
|
|
7
|
+
import type { ModelPacksStorage } from '../storage/domains/model-packs/base.js';
|
|
8
|
+
import { Route } from './route.js';
|
|
9
|
+
import type { RouteDependencies } from './route.js';
|
|
10
|
+
/**
|
|
11
|
+
* Server-side configuration routes for the web app.
|
|
12
|
+
*
|
|
13
|
+
* The browser has no access to the credential store or the model catalog, so
|
|
14
|
+
* the web settings panel asks the server — which owns both — to list providers
|
|
15
|
+
* and manage API keys. This mirrors the TUI's `/api-keys` command, exposing the
|
|
16
|
+
* same `AuthStorage`-backed key management over HTTP.
|
|
17
|
+
*
|
|
18
|
+
* Keys are never returned to the client; only their presence and source.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Where a provider's active credential comes from, as seen by the caller.
|
|
22
|
+
* Local mode reports `oauth`/`stored` (server-global `auth.json`); tenant mode
|
|
23
|
+
* reports the scoped variants (`oauth-user`/`stored-user`/`stored-org`).
|
|
24
|
+
*/
|
|
25
|
+
export type ProviderCredentialSource = 'oauth' | 'stored' | 'env' | 'none' | 'oauth-user' | 'stored-user' | 'stored-org';
|
|
26
|
+
/** A model provider with the current source of its credentials. */
|
|
27
|
+
export interface ProviderInfo {
|
|
28
|
+
provider: string;
|
|
29
|
+
/** Env var the provider's key is read from, if any. */
|
|
30
|
+
envVar?: string;
|
|
31
|
+
/** Where the active credential comes from. */
|
|
32
|
+
source: ProviderCredentialSource;
|
|
33
|
+
/**
|
|
34
|
+
* Tenant mode: whether an org-wide API key exists for this provider, even
|
|
35
|
+
* when the caller's personal credential shadows it. Lets the UI tell
|
|
36
|
+
* "shared with the org" apart from "only works for me".
|
|
37
|
+
*/
|
|
38
|
+
orgKey?: boolean;
|
|
39
|
+
/** Web OAuth sign-in capability, when the provider supports it. */
|
|
40
|
+
oauth?: {
|
|
41
|
+
supported: true;
|
|
42
|
+
modes: LoginSessionKind[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** Minimal session surface a pack activation touches. */
|
|
46
|
+
interface PackSession {
|
|
47
|
+
mode: {
|
|
48
|
+
get: () => string;
|
|
49
|
+
};
|
|
50
|
+
model: {
|
|
51
|
+
switch: (args: {
|
|
52
|
+
modelId: string;
|
|
53
|
+
}) => Promise<void>;
|
|
54
|
+
};
|
|
55
|
+
subagents: {
|
|
56
|
+
model: {
|
|
57
|
+
set: (args: {
|
|
58
|
+
modelId: string;
|
|
59
|
+
agentType: string;
|
|
60
|
+
}) => Promise<void>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
thread: {
|
|
64
|
+
getId: () => string | null;
|
|
65
|
+
setSetting: (args: {
|
|
66
|
+
key: string;
|
|
67
|
+
value: unknown;
|
|
68
|
+
}) => Promise<void>;
|
|
69
|
+
list: () => Promise<Array<{
|
|
70
|
+
id: string;
|
|
71
|
+
metadata?: Record<string, unknown>;
|
|
72
|
+
}>>;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** One observational-memory role's read/switch surface. */
|
|
76
|
+
interface OMRole {
|
|
77
|
+
modelId: () => string | undefined;
|
|
78
|
+
threshold: () => number | undefined;
|
|
79
|
+
switchModel: (args: {
|
|
80
|
+
modelId: string;
|
|
81
|
+
}) => Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Session-state fields the OM config routes write. The index signatures mirror
|
|
85
|
+
* `MastraCodeState` so the concrete `Session.state.set(Partial<MastraCodeState>)`
|
|
86
|
+
* stays assignable to this minimal surface (contravariant parameter check).
|
|
87
|
+
*/
|
|
88
|
+
interface OMStateWrites {
|
|
89
|
+
[key: string]: unknown;
|
|
90
|
+
[key: `subagentModelId_${string}`]: string | undefined;
|
|
91
|
+
observationThreshold?: number;
|
|
92
|
+
reflectionThreshold?: number;
|
|
93
|
+
observeAttachments?: 'auto' | boolean;
|
|
94
|
+
}
|
|
95
|
+
/** Minimal session surface the OM config routes touch. */
|
|
96
|
+
export interface OMSession extends PackSession {
|
|
97
|
+
state: {
|
|
98
|
+
get: () => Record<string, unknown> | undefined;
|
|
99
|
+
set: (updates: OMStateWrites) => Promise<void> | void;
|
|
100
|
+
};
|
|
101
|
+
om: {
|
|
102
|
+
observer: OMRole;
|
|
103
|
+
reflector: OMRole;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/** Minimal controller surface this module needs (model catalog + modes + sessions). */
|
|
107
|
+
interface ModelCatalog {
|
|
108
|
+
listAvailableModels: () => Promise<Array<{
|
|
109
|
+
id?: string;
|
|
110
|
+
modelName?: string;
|
|
111
|
+
provider: string;
|
|
112
|
+
hasApiKey: boolean;
|
|
113
|
+
apiKeyEnvVar?: string;
|
|
114
|
+
}>>;
|
|
115
|
+
listModes?: () => Array<{
|
|
116
|
+
id: string;
|
|
117
|
+
defaultModelId?: string;
|
|
118
|
+
}>;
|
|
119
|
+
getSessionByResource?: (resourceId: string, scope?: string) => Promise<OMSession | undefined>;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Build a deduplicated, sorted list of providers from the model catalog,
|
|
123
|
+
* annotated with where each provider's credential currently comes from.
|
|
124
|
+
* Mirrors the TUI's `/api-keys` provider list.
|
|
125
|
+
*
|
|
126
|
+
* When `tenantCredentials` is given (deployed mode), sources reflect the
|
|
127
|
+
* *caller's* tenant rows with user > org precedence and the server-global
|
|
128
|
+
* `authStorage` is ignored; otherwise the local `auth.json` view is reported.
|
|
129
|
+
*/
|
|
130
|
+
export declare function listProviders({ controller, authStorage, tenantCredentials, }: {
|
|
131
|
+
controller: ModelCatalog;
|
|
132
|
+
authStorage?: AuthStorage;
|
|
133
|
+
tenantCredentials?: CredentialRecord[];
|
|
134
|
+
}): Promise<ProviderInfo[]>;
|
|
135
|
+
/** A user-defined OpenAI-compatible provider, with key presence (never the key). */
|
|
136
|
+
export interface CustomProviderInfo {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
url: string;
|
|
140
|
+
hasApiKey: boolean;
|
|
141
|
+
models: string[];
|
|
142
|
+
}
|
|
143
|
+
/** A model pack as surfaced to the web client, with an `active` flag. */
|
|
144
|
+
export interface ModelPackInfo extends ModePack {
|
|
145
|
+
custom: boolean;
|
|
146
|
+
active: boolean;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Compute which providers the user can reach, mirroring the TUI's
|
|
150
|
+
* `/models-pack` access derivation: OAuth/api-key from the credential store for
|
|
151
|
+
* the named providers, plus any other provider that has a usable key.
|
|
152
|
+
*/
|
|
153
|
+
export declare function buildProviderAccess({ controller, authStorage, tenantCredentials, }: {
|
|
154
|
+
controller: ModelCatalog;
|
|
155
|
+
authStorage?: AuthStorage;
|
|
156
|
+
tenantCredentials?: CredentialRecord[];
|
|
157
|
+
}): Promise<ProviderAccess>;
|
|
158
|
+
/**
|
|
159
|
+
* Where a request's custom model packs live. Same posture as memory settings
|
|
160
|
+
* and custom providers: the `model-packs` factory storage domain, scoped per
|
|
161
|
+
* org in deployed mode and to a sentinel `local` org in no-auth mode — never
|
|
162
|
+
* settings.json.
|
|
163
|
+
*/
|
|
164
|
+
export interface PackContext {
|
|
165
|
+
storage: ModelPacksStorage;
|
|
166
|
+
orgId: string;
|
|
167
|
+
userId: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* List available model packs (built-in, gated by provider access, plus saved
|
|
171
|
+
* custom packs from the request's pack context). Drops the synthetic
|
|
172
|
+
* "New Custom" placeholder — the web client has its own create flow. `active`
|
|
173
|
+
* is set from the given session's thread when a resourceId is supplied.
|
|
174
|
+
*/
|
|
175
|
+
export declare function listModelPacks({ controller, authStorage, tenantCredentials, packContext, activePackId, }: {
|
|
176
|
+
controller: ModelCatalog;
|
|
177
|
+
authStorage?: AuthStorage;
|
|
178
|
+
tenantCredentials?: CredentialRecord[];
|
|
179
|
+
packContext: PackContext;
|
|
180
|
+
activePackId?: string | null;
|
|
181
|
+
}): Promise<ModelPackInfo[]>;
|
|
182
|
+
/** Read the current OM config from a session. */
|
|
183
|
+
export interface OMConfigInfo {
|
|
184
|
+
observerModelId: string;
|
|
185
|
+
reflectorModelId: string;
|
|
186
|
+
observationThreshold: number;
|
|
187
|
+
reflectionThreshold: number;
|
|
188
|
+
observeAttachments: 'auto' | boolean;
|
|
189
|
+
}
|
|
190
|
+
export interface ProviderOMDefaultsResponse {
|
|
191
|
+
ok: true;
|
|
192
|
+
config: OMConfigInfo;
|
|
193
|
+
}
|
|
194
|
+
export declare function readOMConfig(session: OMSession): OMConfigInfo;
|
|
195
|
+
/** Dependencies injected into {@link ConfigRoutes}. */
|
|
196
|
+
export interface ConfigRoutesDeps extends RouteDependencies {
|
|
197
|
+
controller: ModelCatalog;
|
|
198
|
+
authStorage?: AuthStorage;
|
|
199
|
+
/** Tenant credential domain handle; absent in local (no-DB) mode. */
|
|
200
|
+
modelCredentials?: ModelCredentialsStorage;
|
|
201
|
+
/** Tenant model-packs domain handle; absent in local (no-DB) mode. */
|
|
202
|
+
modelPacks?: ModelPacksStorage;
|
|
203
|
+
/** Tenant memory-settings domain handle; absent in local (no-DB) mode. */
|
|
204
|
+
memorySettings?: MemorySettingsStorage;
|
|
205
|
+
/** Custom-providers domain handle; absent when the app database is missing. */
|
|
206
|
+
customProviders?: CustomProvidersStorage;
|
|
207
|
+
/** Notifies the host after tenant credentials change so caches can be dropped. */
|
|
208
|
+
onCredentialsChanged?: (tenant: {
|
|
209
|
+
orgId: string;
|
|
210
|
+
userId?: string;
|
|
211
|
+
}) => void;
|
|
212
|
+
/** Notifies the host after custom providers change so model-router caches can be dropped. */
|
|
213
|
+
onCustomProvidersChanged?: (tenant: {
|
|
214
|
+
orgId: string;
|
|
215
|
+
}) => void;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The web config routes as Mastra `apiRoutes`:
|
|
219
|
+
* - `GET /web/config/providers` — list providers + key source
|
|
220
|
+
* - `PUT /web/config/providers/:provider/key` — set/update a provider's API key
|
|
221
|
+
* - `DELETE /web/config/providers/:provider/key` — remove a stored API key
|
|
222
|
+
* - `GET /web/config/models` — list available models (credentialed providers)
|
|
223
|
+
* - `GET /web/config/custom-providers` — list custom OpenAI-compatible providers
|
|
224
|
+
* - `POST /web/config/custom-providers` — create/update a custom provider
|
|
225
|
+
* - `DELETE /web/config/custom-providers/:id` — remove a custom provider
|
|
226
|
+
* - `GET /web/config/om` — read OM models/thresholds/observe-attachments
|
|
227
|
+
* - `PUT /web/config/om/:role/model` — switch observer/reflector model
|
|
228
|
+
* - `PUT /web/config/om/thresholds` — set observation/reflection thresholds
|
|
229
|
+
* - `PUT /web/config/om/observe-attachments` — set observe-attachments (auto/on/off)
|
|
230
|
+
*/
|
|
231
|
+
export declare class ConfigRoutes extends Route<ConfigRoutesDeps> {
|
|
232
|
+
routes(): ApiRoute[];
|
|
233
|
+
}
|
|
234
|
+
export {};
|
|
235
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/routes/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAGjE,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAuB,MAAM,mCAAmC,CAAC;AAGvG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EA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