@cat-factory/node-server 0.107.11 → 0.107.13
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/dist/config.d.ts.map +1 -1
- package/dist/config.js +240 -198
- package/dist/config.js.map +1 -1
- package/dist/container-account-deps.d.ts +40 -0
- package/dist/container-account-deps.d.ts.map +1 -0
- package/dist/container-account-deps.js +142 -0
- package/dist/container-account-deps.js.map +1 -0
- package/dist/container-github-deps.d.ts +56 -0
- package/dist/container-github-deps.d.ts.map +1 -0
- package/dist/container-github-deps.js +275 -0
- package/dist/container-github-deps.js.map +1 -0
- package/dist/container-model-deps.d.ts +50 -0
- package/dist/container-model-deps.d.ts.map +1 -0
- package/dist/container-model-deps.js +127 -0
- package/dist/container-model-deps.js.map +1 -0
- package/dist/container-realtime-deps.d.ts +34 -0
- package/dist/container-realtime-deps.d.ts.map +1 -0
- package/dist/container-realtime-deps.js +112 -0
- package/dist/container-realtime-deps.js.map +1 -0
- package/dist/container-run-services-deps.d.ts +44 -0
- package/dist/container-run-services-deps.d.ts.map +1 -0
- package/dist/container-run-services-deps.js +148 -0
- package/dist/container-run-services-deps.js.map +1 -0
- package/dist/container-transport-deps.d.ts +72 -0
- package/dist/container-transport-deps.d.ts.map +1 -0
- package/dist/container-transport-deps.js +88 -0
- package/dist/container-transport-deps.js.map +1 -0
- package/dist/container.d.ts +2 -23
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +173 -785
- package/dist/container.js.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-account-deps.d.ts","sourceRoot":"","sources":["../src/container-account-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EAMvB,MAAM,2BAA2B,CAAA;AAElC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAA4B,MAAM,wBAAwB,CAAA;AAE7F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAG/C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAE1E,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAEpE,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;IACtB,MAAM,EAAE,SAAS,CAAA;IACjB,EAAE,EAAE,SAAS,CAAA;IACb,KAAK,EAAE,gBAAgB,CAAA;IACvB,WAAW,EAAE,WAAW,CAAA;IACxB,KAAK,EAAE,KAAK,CAAA;IACZ,2FAA2F;IAC3F,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,+FAA+F;IAC/F,2BAA2B,EAAE,gBAAgB,CAAC,6BAA6B,CAAC,CAAA;IAC5E,4BAA4B,CAAC,EAAE,qBAAqB,CAAA;IACpD,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,oBAAoB;;;;;;EAoJ/D"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { ACCOUNT_SETTINGS_CIPHER_INFO, AccountSettingsService, INCIDENT_ENRICHMENT_CIPHER_INFO, OBSERVABILITY_CIPHER_INFO, RegistryReleaseHealthProvider, WorkspaceIncidentEnrichmentProvider, defaultObservabilityRegistry, } from '@cat-factory/integrations';
|
|
2
|
+
import { wireIncidentEnrichment, wireReleaseHealthProvider } from '@cat-factory/gates';
|
|
3
|
+
import { WebCryptoSecretCipher, logger, makeResolveBinaryArtifactStore, } from '@cat-factory/server';
|
|
4
|
+
import { S3BinaryBlobBackend } from '@cat-factory/provider-s3';
|
|
5
|
+
import { FilesystemBinaryBlobBackend } from './storage/FilesystemBinaryBlobBackend.js';
|
|
6
|
+
import { PostgresBinaryBlobBackend } from './storage/PostgresBinaryBlobBackend.js';
|
|
7
|
+
/**
|
|
8
|
+
* The per-account settings + binary-artifact storage + observability/incident gate wiring of
|
|
9
|
+
* the Node composition root, lifted out of `buildNodeContainer` so that root stays within the
|
|
10
|
+
* file-size budget. Wires the release-health + incident-enrichment gate providers onto the
|
|
11
|
+
* app-owned `providerRegistry` (a side effect — call BEFORE `applyGateProviders`), and builds
|
|
12
|
+
* the per-account settings service + the content-storage blob backend factory it resolves the
|
|
13
|
+
* binary-artifact store from.
|
|
14
|
+
*/
|
|
15
|
+
export function buildNodeAccountDeps(input) {
|
|
16
|
+
const { env, config, db, repos, idGenerator, clock, providerRegistry, packageRegistrySecretCipher, contentStorageDefaultBackend, caches, } = input;
|
|
17
|
+
// Binary-artifact storage (UI screenshots + reference design images) for the
|
|
18
|
+
// visual-confirmation gate. The backend is configured PER ACCOUNT in the UI (no env vars):
|
|
19
|
+
// the metadata always lives in Postgres; the bytes go to the account's chosen blob backend
|
|
20
|
+
// (`fs` → the local filesystem; `db` → a Postgres `bytea` table; `s3` → an S3 bucket).
|
|
21
|
+
const contentStorageCapability = {
|
|
22
|
+
supportedBackends: ['off', 'fs', 's3', 'db'],
|
|
23
|
+
defaultBackend: contentStorageDefaultBackend ?? 'off',
|
|
24
|
+
};
|
|
25
|
+
const buildBlobBackend = (kind, opts) => {
|
|
26
|
+
switch (kind) {
|
|
27
|
+
case 'fs':
|
|
28
|
+
// NOTE: the filesystem backend is local-disk only. It is correct for the local facade
|
|
29
|
+
// and a single-instance Node deployment with a persistent volume, but NOT for a scaled
|
|
30
|
+
// (multi-replica) or ephemeral-disk deployment — bytes written on one replica are
|
|
31
|
+
// invisible to the others and lost on redeploy. Scaled deployments should pick `s3`.
|
|
32
|
+
return new FilesystemBinaryBlobBackend({ basePath: opts.fs?.basePath });
|
|
33
|
+
case 'db':
|
|
34
|
+
return new PostgresBinaryBlobBackend(db);
|
|
35
|
+
case 's3':
|
|
36
|
+
if (!opts.s3)
|
|
37
|
+
return null;
|
|
38
|
+
// Omitting credentials is intentional: the S3 client then falls back to the ambient AWS
|
|
39
|
+
// credential chain (instance role / `AWS_*` env), which is the right behaviour for a
|
|
40
|
+
// deployment running on AWS with an attached role. The UI requires explicit keys, so this
|
|
41
|
+
// path is only reached by a config written through another channel.
|
|
42
|
+
return new S3BinaryBlobBackend({
|
|
43
|
+
...opts.s3,
|
|
44
|
+
...(opts.s3Credentials ? { credentials: opts.s3Credentials } : {}),
|
|
45
|
+
});
|
|
46
|
+
default:
|
|
47
|
+
// `r2`/`memory` are not served on Node/local — null ⇒ storage unavailable.
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
// Observability post-release-health: wire the gate + the release-health settings module
|
|
52
|
+
// when enabled (+ ENCRYPTION_KEY), mirroring the Worker's `selectReleaseHealthDeps`. Off →
|
|
53
|
+
// the `post-release-health` gate is a pass-through and the module isn't assembled.
|
|
54
|
+
const releaseHealthDeps = {};
|
|
55
|
+
if (config.releaseHealth.enabled && config.releaseHealth.encryptionKey) {
|
|
56
|
+
const observabilitySecretCipher = new WebCryptoSecretCipher({
|
|
57
|
+
masterKeyBase64: config.releaseHealth.encryptionKey,
|
|
58
|
+
info: OBSERVABILITY_CIPHER_INFO,
|
|
59
|
+
});
|
|
60
|
+
releaseHealthDeps.observabilityConnectionRepository = repos.observabilityConnectionRepository;
|
|
61
|
+
releaseHealthDeps.releaseHealthConfigRepository = repos.releaseHealthConfigRepository;
|
|
62
|
+
releaseHealthDeps.observabilitySecretCipher = observabilitySecretCipher;
|
|
63
|
+
// The post-release-health gate + on-call escalation now live in `@cat-factory/gates`; wire
|
|
64
|
+
// their providers into the gate suite. The observability repos/cipher above stay on
|
|
65
|
+
// CoreDependencies — they power the management API (ReleaseHealthService), not the gate.
|
|
66
|
+
wireReleaseHealthProvider(providerRegistry, new RegistryReleaseHealthProvider({
|
|
67
|
+
observabilityConnectionRepository: repos.observabilityConnectionRepository,
|
|
68
|
+
releaseHealthConfigRepository: repos.releaseHealthConfigRepository,
|
|
69
|
+
blockRepository: repos.blockRepository,
|
|
70
|
+
secretCipher: observabilitySecretCipher,
|
|
71
|
+
registry: defaultObservabilityRegistry,
|
|
72
|
+
}));
|
|
73
|
+
}
|
|
74
|
+
// Per-workspace incident-enrichment (PagerDuty + incident.io): credentials moved out of
|
|
75
|
+
// env into a sealed per-workspace row, resolved + decrypted at enrichment time. Wired
|
|
76
|
+
// whenever the shared ENCRYPTION_KEY is present (independent of the release-health gate).
|
|
77
|
+
const encryptionKey = env.ENCRYPTION_KEY?.trim();
|
|
78
|
+
// Per-workspace private package registries (npm private orgs, GitHub Packages): the
|
|
79
|
+
// management API over the same repo + cipher the dispatch resolver rides.
|
|
80
|
+
const packageRegistryDeps = packageRegistrySecretCipher
|
|
81
|
+
? {
|
|
82
|
+
packageRegistryConnectionRepository: repos.packageRegistryConnectionRepository,
|
|
83
|
+
packageRegistrySecretCipher,
|
|
84
|
+
}
|
|
85
|
+
: {};
|
|
86
|
+
const incidentEnrichmentDeps = {};
|
|
87
|
+
if (encryptionKey) {
|
|
88
|
+
const incidentEnrichmentSecretCipher = new WebCryptoSecretCipher({
|
|
89
|
+
masterKeyBase64: encryptionKey,
|
|
90
|
+
info: INCIDENT_ENRICHMENT_CIPHER_INFO,
|
|
91
|
+
});
|
|
92
|
+
incidentEnrichmentDeps.incidentEnrichmentConnectionRepository =
|
|
93
|
+
repos.incidentEnrichmentConnectionRepository;
|
|
94
|
+
incidentEnrichmentDeps.incidentEnrichmentSecretCipher = incidentEnrichmentSecretCipher;
|
|
95
|
+
// The on-call enrichment provider now lives in `@cat-factory/gates`; wire the
|
|
96
|
+
// workspace-backed provider into the gate suite. The connection repo + cipher above
|
|
97
|
+
// stay on CoreDependencies to power the management API.
|
|
98
|
+
wireIncidentEnrichment(providerRegistry, new WorkspaceIncidentEnrichmentProvider({
|
|
99
|
+
incidentEnrichmentConnectionRepository: repos.incidentEnrichmentConnectionRepository,
|
|
100
|
+
secretCipher: incidentEnrichmentSecretCipher,
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
// Per-account deployment settings (Slack OAuth + web-search keys + content-storage), built
|
|
104
|
+
// once so the service's short-TTL cache spans requests; the Slack OAuth + content-storage
|
|
105
|
+
// resolvers derive from it.
|
|
106
|
+
const accountSettings = encryptionKey
|
|
107
|
+
? new AccountSettingsService({
|
|
108
|
+
accountSettingsRepository: repos.accountSettingsRepository,
|
|
109
|
+
secretCipher: new WebCryptoSecretCipher({
|
|
110
|
+
masterKeyBase64: encryptionKey,
|
|
111
|
+
info: ACCOUNT_SETTINGS_CIPHER_INFO,
|
|
112
|
+
}),
|
|
113
|
+
clock,
|
|
114
|
+
contentStorageCapability,
|
|
115
|
+
...(caches ? { settingsCache: caches.accountSettings } : {}),
|
|
116
|
+
})
|
|
117
|
+
: undefined;
|
|
118
|
+
// Resolve the binary-artifact store for a workspace's account from its content-storage
|
|
119
|
+
// settings (the blob backend is per-account; the metadata is the shared Postgres store).
|
|
120
|
+
// Without `accountSettings` (no encryption key) there is no per-account override, so every
|
|
121
|
+
// workspace falls back to the runtime default — which on Node is `off`, so the resolver then
|
|
122
|
+
// returns null and the controllers 503 / the gate passes through. Caches per account, so a
|
|
123
|
+
// backend switch rebuilds and the many workspaces under one account share a store.
|
|
124
|
+
const resolveBinaryArtifactStore = makeResolveBinaryArtifactStore({
|
|
125
|
+
accountSettings,
|
|
126
|
+
accountOf: (workspaceId) => repos.workspaceRepository.accountOf(workspaceId),
|
|
127
|
+
metadata: repos.binaryArtifactMetadataStore,
|
|
128
|
+
idGenerator,
|
|
129
|
+
clock,
|
|
130
|
+
buildBlobBackend,
|
|
131
|
+
defaultBackend: contentStorageCapability.defaultBackend,
|
|
132
|
+
logger,
|
|
133
|
+
});
|
|
134
|
+
return {
|
|
135
|
+
releaseHealthDeps,
|
|
136
|
+
packageRegistryDeps,
|
|
137
|
+
incidentEnrichmentDeps,
|
|
138
|
+
accountSettings,
|
|
139
|
+
resolveBinaryArtifactStore,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=container-account-deps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-account-deps.js","sourceRoot":"","sources":["../src/container-account-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,+BAA+B,EAC/B,yBAAyB,EACzB,6BAA6B,EAC7B,mCAAmC,EACnC,4BAA4B,GAC7B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAGtF,OAAO,EAGL,qBAAqB,EACrB,MAAM,EACN,8BAA8B,GAC/B,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAE9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAA;AACtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAA;AAqBlF;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAA2B;IAC9D,MAAM,EACJ,GAAG,EACH,MAAM,EACN,EAAE,EACF,KAAK,EACL,WAAW,EACX,KAAK,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,4BAA4B,EAC5B,MAAM,GACP,GAAG,KAAK,CAAA;IAET,6EAA6E;IAC7E,2FAA2F;IAC3F,2FAA2F;IAC3F,uFAAuF;IACvF,MAAM,wBAAwB,GAA6B;QACzD,iBAAiB,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;QAC5C,cAAc,EAAE,4BAA4B,IAAI,KAAK;KACtD,CAAA;IACD,MAAM,gBAAgB,GAAqB,CAAC,IAAI,EAAE,IAAI,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,YAAY,EAAE,IAAI,qBAAqB,CAAC;gBACtC,eAAe,EAAE,aAAa;gBAC9B,IAAI,EAAE,4BAA4B;aACnC,CAAC;YACF,KAAK;YACL,wBAAwB;YACxB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC7D,CAAC;QACJ,CAAC,CAAC,SAAS,CAAA;IAEb,uFAAuF;IACvF,yFAAyF;IACzF,2FAA2F;IAC3F,6FAA6F;IAC7F,2FAA2F;IAC3F,mFAAmF;IACnF,MAAM,0BAA0B,GAAG,8BAA8B,CAAC;QAChE,eAAe;QACf,SAAS,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,SAAS,CAAC,WAAW,CAAC;QAC5E,QAAQ,EAAE,KAAK,CAAC,2BAA2B;QAC3C,WAAW;QACX,KAAK;QACL,gBAAgB;QAChB,cAAc,EAAE,wBAAwB,CAAC,cAAc;QACvD,MAAM;KACP,CAAC,CAAA;IAEF,OAAO;QACL,iBAAiB;QACjB,mBAAmB;QACnB,sBAAsB;QACtB,eAAe;QACf,0BAA0B;KAC3B,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IssueWritebackService } from '@cat-factory/integrations';
|
|
2
|
+
import type { AppCaches, BlockRepository, Clock, GitHubClient, GitHubInstallationRepository, IdGenerator, ProviderRegistry, RepoProjectionRepository, ResolveUserGitHubToken, TaskConnectionRepository, TrackerSettingsRepository } from '@cat-factory/kernel';
|
|
3
|
+
import type { CoreDependencies } from '@cat-factory/orchestration';
|
|
4
|
+
import { type AppConfig, type GitHubAppRegistry, type ResolveRepoTarget } from '@cat-factory/server';
|
|
5
|
+
import { buildNodeGitHubIssueFiler } from './container-executor-deps.js';
|
|
6
|
+
import type { DrizzleDb } from './db/client.js';
|
|
7
|
+
/** The result shape of {@link selectNodeTasksDeps}: the module deps plus the raw connection repo. */
|
|
8
|
+
export interface NodeTasksDeps {
|
|
9
|
+
deps: Partial<CoreDependencies>;
|
|
10
|
+
taskConnectionRepository?: TaskConnectionRepository;
|
|
11
|
+
}
|
|
12
|
+
/** Inputs {@link selectNodeGitHubDeps} needs from the composition root. */
|
|
13
|
+
export interface NodeGitHubDepsInput {
|
|
14
|
+
config: AppConfig;
|
|
15
|
+
db: DrizzleDb;
|
|
16
|
+
/** Undefined in a standard build; the full-surface remote registry in mothership mode. */
|
|
17
|
+
remoteRepos: Record<string, unknown> | undefined;
|
|
18
|
+
/** Source one org/durable repo from the remote registry (mothership) else the Drizzle db. */
|
|
19
|
+
sourced: <T>(name: string, build: (d: DrizzleDb) => T) => T;
|
|
20
|
+
idGenerator: IdGenerator;
|
|
21
|
+
clock: Clock;
|
|
22
|
+
appRegistry: GitHubAppRegistry | undefined;
|
|
23
|
+
/** An injected client (the local facade's PAT-backed one) wins over the App-minted client. */
|
|
24
|
+
githubClientOverride?: GitHubClient;
|
|
25
|
+
resolveUserGitHubToken?: ResolveUserGitHubToken;
|
|
26
|
+
/** The GitLab-backed engine client, used as the gate/merge fallback when no GitHub App is set. */
|
|
27
|
+
gitlabEngineClient: GitHubClient | undefined;
|
|
28
|
+
providerRegistry: ProviderRegistry;
|
|
29
|
+
resolveRepoTarget: ResolveRepoTarget;
|
|
30
|
+
githubInstallationRepository: GitHubInstallationRepository;
|
|
31
|
+
repoProjectionRepository: RepoProjectionRepository;
|
|
32
|
+
blockRepository: BlockRepository;
|
|
33
|
+
trackerSettingsRepository: TrackerSettingsRepository;
|
|
34
|
+
caches?: AppCaches;
|
|
35
|
+
}
|
|
36
|
+
/** The GitHub-client-dependent wiring {@link selectNodeGitHubDeps} produces. */
|
|
37
|
+
export interface NodeGitHubDeps {
|
|
38
|
+
/** The GitHub-issue-specific client (App or injected); NOT the GitLab fallback. */
|
|
39
|
+
githubClient: GitHubClient | undefined;
|
|
40
|
+
tasks: NodeTasksDeps;
|
|
41
|
+
fileGitHubIssue: ReturnType<typeof buildNodeGitHubIssueFiler>;
|
|
42
|
+
issueWritebackProvider: IssueWritebackService;
|
|
43
|
+
githubGateDeps: Partial<CoreDependencies>;
|
|
44
|
+
githubModuleDeps: Partial<CoreDependencies>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The GitHub-client-dependent slice of the Node composition root, lifted out of
|
|
48
|
+
* `buildNodeContainer` so that root stays within the file-size budget (the same reason
|
|
49
|
+
* `container-executor-deps.ts` / `container-content-library-deps.ts` exist). Mirrors the
|
|
50
|
+
* Worker's `selectGitHubDeps`: build the engine's GitHub client, wire the CI / mergeability /
|
|
51
|
+
* review / doc-quality gate providers onto the app-owned `providerRegistry`, and assemble the
|
|
52
|
+
* GitHub gate + projection/sync module deps. As a side effect it registers the gate providers;
|
|
53
|
+
* call it at the point the region occupied so the ordering (before `applyGateProviders`) holds.
|
|
54
|
+
*/
|
|
55
|
+
export declare function selectNodeGitHubDeps(input: NodeGitHubDepsInput): NodeGitHubDeps;
|
|
56
|
+
//# sourceMappingURL=container-github-deps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-github-deps.d.ts","sourceRoot":"","sources":["../src/container-github-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,qBAAqB,EAItB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,KAAK,EACL,YAAY,EACZ,4BAA4B,EAC5B,WAAW,EACX,gBAAgB,EAGhB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EAExB,yBAAyB,EAC1B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EACL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAcvB,MAAM,qBAAqB,CAAA;AAO5B,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B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C7D,sBAAsB,EAAE,qBAAqB,CAAA;IAC7C,cAAc,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;IACzC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAA;CAC5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,CAmS/E"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { GitHubIssuesProvider, IssueWritebackService, JiraProvider, LinearTaskProvider, githubIssuesLogic, } from '@cat-factory/integrations';
|
|
2
|
+
import { FetchGitHubClient, FetchGitHubProvisioningClient, GitHubBranchUpdater, GitHubCiStatusProvider, GitHubDocQualityProvider, GitHubMergeabilityProvider, GitHubPullRequestMerger, GitHubPullRequestReviewProvider, PatPreferringAppRegistry, WebCryptoSecretCipher, WebCryptoWebhookVerifier, makeResolveRepoFilesForCoords, makeResolveRunRepoContext, } from '@cat-factory/server';
|
|
3
|
+
import { wireCiStatusProvider, wireDocQualityProvider, wireMergeabilityProvider, wirePullRequestReviewProvider, } from '@cat-factory/gates';
|
|
4
|
+
import { buildNodeGitHubIssueFiler } from './container-executor-deps.js';
|
|
5
|
+
import { DrizzleDocumentRepository } from './repositories/documents.js';
|
|
6
|
+
import { DrizzleBranchProjectionRepository, DrizzleCheckRunProjectionRepository, DrizzleCommitProjectionRepository, DrizzleIssueProjectionRepository, DrizzlePullRequestProjectionRepository, } from './repositories/github.js';
|
|
7
|
+
import { DrizzleTaskConnectionRepository, DrizzleTaskRepository, DrizzleTaskSourceSettingsRepository, } from './repositories/tasks.js';
|
|
8
|
+
import { DrizzleUserRepoAccessRepository } from './repositories/userRepoAccess.js';
|
|
9
|
+
// The engine's CI/mergeability gate reads never persist rate-limit snapshots (that is the
|
|
10
|
+
// GitHub sync/webhook path's job), so the client backing them takes a no-op rate-limit store.
|
|
11
|
+
class NoopRateLimitRepository {
|
|
12
|
+
record(_snapshot) {
|
|
13
|
+
return Promise.resolve();
|
|
14
|
+
}
|
|
15
|
+
deleteOlderThan(_epochMs) {
|
|
16
|
+
return Promise.resolve(0);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Wire the task-source integration for the Node facade (Jira + Linear always; GitHub Issues
|
|
21
|
+
* only when a GitHub client is available, since it reuses the workspace's App installation).
|
|
22
|
+
* Mirrors the Cloudflare facade's `config.github.enabled` gate (see CLAUDE.md parity rule).
|
|
23
|
+
* Whether a workspace OFFERS a source is the per-workspace toggle (task_source_settings), not
|
|
24
|
+
* a deployment env gate.
|
|
25
|
+
*/
|
|
26
|
+
function selectNodeTasksDeps(config, db, githubClient, installations) {
|
|
27
|
+
if (!config.tasks.enabled || !config.tasks.encryptionKey)
|
|
28
|
+
return { deps: {} };
|
|
29
|
+
// Jira and Linear are always registered (their credentials are per-workspace, entered in the UI).
|
|
30
|
+
const providers = [new JiraProvider(), new LinearTaskProvider()];
|
|
31
|
+
// GitHub Issues reuse the workspace's installed GitHub App, so this provider is
|
|
32
|
+
// wired whenever a GitHub client is available (the App is configured) — it has no
|
|
33
|
+
// credentials of its own and resolves the installation per issue.
|
|
34
|
+
if (githubClient) {
|
|
35
|
+
providers.push(new GitHubIssuesProvider({ githubClient, installations }));
|
|
36
|
+
}
|
|
37
|
+
const taskConnectionRepository = new DrizzleTaskConnectionRepository(db,
|
|
38
|
+
// Source credentials are encrypted at rest under a tasks-scoped HKDF info (the
|
|
39
|
+
// same domain the Cloudflare facade uses), keyed by the shared ENCRYPTION_KEY.
|
|
40
|
+
new WebCryptoSecretCipher({
|
|
41
|
+
masterKeyBase64: config.tasks.encryptionKey,
|
|
42
|
+
info: 'cat-factory:tasks',
|
|
43
|
+
}));
|
|
44
|
+
return {
|
|
45
|
+
deps: {
|
|
46
|
+
taskSourceProviders: providers,
|
|
47
|
+
taskConnectionRepository,
|
|
48
|
+
taskSourceSettingsRepository: new DrizzleTaskSourceSettingsRepository(db),
|
|
49
|
+
taskRepository: new DrizzleTaskRepository(db),
|
|
50
|
+
},
|
|
51
|
+
taskConnectionRepository,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The GitHub-client-dependent slice of the Node composition root, lifted out of
|
|
56
|
+
* `buildNodeContainer` so that root stays within the file-size budget (the same reason
|
|
57
|
+
* `container-executor-deps.ts` / `container-content-library-deps.ts` exist). Mirrors the
|
|
58
|
+
* Worker's `selectGitHubDeps`: build the engine's GitHub client, wire the CI / mergeability /
|
|
59
|
+
* review / doc-quality gate providers onto the app-owned `providerRegistry`, and assemble the
|
|
60
|
+
* GitHub gate + projection/sync module deps. As a side effect it registers the gate providers;
|
|
61
|
+
* call it at the point the region occupied so the ordering (before `applyGateProviders`) holds.
|
|
62
|
+
*/
|
|
63
|
+
export function selectNodeGitHubDeps(input) {
|
|
64
|
+
const { config, db, remoteRepos, sourced, idGenerator, clock, appRegistry, githubClientOverride, resolveUserGitHubToken, gitlabEngineClient, providerRegistry, resolveRepoTarget, githubInstallationRepository, repoProjectionRepository, blockRepository, trackerSettingsRepository, caches, } = input;
|
|
65
|
+
// GitHub-issue tracker: file the tech-debt pipeline's issue through the workspace's
|
|
66
|
+
// own GitHub App installation (per-tenant), resolving the service's repo from the
|
|
67
|
+
// github_repos projection — the same per-tenant infra the container executor uses.
|
|
68
|
+
const fileGitHubIssue = buildNodeGitHubIssueFiler(config, appRegistry, resolveRepoTarget);
|
|
69
|
+
// The GitHub client backing the CI gate + merge / mergeability providers: an injected
|
|
70
|
+
// one wins (the local facade supplies a PAT-backed client), else — when the GitHub App
|
|
71
|
+
// is configured — one minted from the shared App registry, so a stock Node deployment
|
|
72
|
+
// with an App ALSO gates on real GitHub Actions CI and merges the PR for real (parity
|
|
73
|
+
// with the Worker). Undefined → these stay unwired and the gates pass through.
|
|
74
|
+
// Prefer the run initiator's per-user PAT (when stored) over the App token for the
|
|
75
|
+
// engine's CI gate + merge reads, so those are attributed to them too. The engine
|
|
76
|
+
// sets the initiator in ambient context around the gate-probe / merge boundaries.
|
|
77
|
+
const engineRegistry = appRegistry && resolveUserGitHubToken
|
|
78
|
+
? new PatPreferringAppRegistry(appRegistry, resolveUserGitHubToken)
|
|
79
|
+
: appRegistry;
|
|
80
|
+
const githubClient = githubClientOverride ??
|
|
81
|
+
(engineRegistry
|
|
82
|
+
? new FetchGitHubClient({
|
|
83
|
+
registry: engineRegistry,
|
|
84
|
+
rateLimitRepository: new NoopRateLimitRepository(),
|
|
85
|
+
idGenerator,
|
|
86
|
+
clock,
|
|
87
|
+
apiBase: config.github.apiBase,
|
|
88
|
+
})
|
|
89
|
+
: undefined);
|
|
90
|
+
// The client the engine's gate / merge / RepoFiles seams read through: the real GitHub client
|
|
91
|
+
// when present, else the GitLab-backed fallback so a GitLab-only deployment still gates on real
|
|
92
|
+
// CI and merges for real (the GitHub App wins when both are configured). Kept SEPARATE from
|
|
93
|
+
// `githubClient` on purpose — the GitHub-issue-specific consumers below (the GitHub Issues task
|
|
94
|
+
// source, issue writeback, the App projection module) must NOT be fed the GitLab client, or a
|
|
95
|
+
// GitLab-only deployment would offer a non-functional "GitHub Issues" source (it resolves the
|
|
96
|
+
// empty github_installations projection). Parity with the Worker, which keeps the App client
|
|
97
|
+
// distinct from its GitLab engine fallback.
|
|
98
|
+
const engineVcsClient = githubClient ?? gitlabEngineClient;
|
|
99
|
+
// Task-source integration (Jira + GitHub issues). Tenants connect their own Jira
|
|
100
|
+
// site through the UI (credentials stored per-workspace, encrypted at rest); the
|
|
101
|
+
// tracker resolves each workspace's own credentials from this same store. GitHub
|
|
102
|
+
// issues reuse the workspace's installed App, so they wire only when `githubClient`
|
|
103
|
+
// is available — kept here, after the client is built, for parity with the Worker.
|
|
104
|
+
const tasks = selectNodeTasksDeps(config, db, githubClient, githubInstallationRepository);
|
|
105
|
+
// Issue-tracker writeback (comment-on-PR-open + close-on-merge of a task's linked
|
|
106
|
+
// issue), gated per workspace + per task inside the provider. GitHub uses the same
|
|
107
|
+
// per-tenant client + installation lookup as the tracker/CI/merge providers; Jira
|
|
108
|
+
// reuses the workspace's encrypted connection. Wired whenever the tracker-settings
|
|
109
|
+
// repo exists (always on Node) so the engine can write back when a tracker is set.
|
|
110
|
+
const resolveWritebackIssue = githubClient
|
|
111
|
+
? async (workspaceId, externalId) => {
|
|
112
|
+
const parsed = githubIssuesLogic.parseGitHubIssueExternalId(externalId);
|
|
113
|
+
if (!parsed)
|
|
114
|
+
return null;
|
|
115
|
+
const installation = await githubInstallationRepository.getByWorkspace(workspaceId);
|
|
116
|
+
if (!installation)
|
|
117
|
+
return null;
|
|
118
|
+
return { installationId: installation.installationId, parsed };
|
|
119
|
+
}
|
|
120
|
+
: undefined;
|
|
121
|
+
const issueWritebackProvider = new IssueWritebackService({
|
|
122
|
+
trackerSettingsRepository,
|
|
123
|
+
taskRepository: sourced('taskRepository', (d) => new DrizzleTaskRepository(d)),
|
|
124
|
+
fetchImpl: fetch,
|
|
125
|
+
...(githubClient && resolveWritebackIssue
|
|
126
|
+
? {
|
|
127
|
+
commentOnGitHubIssue: async (workspaceId, externalId, body) => {
|
|
128
|
+
const target = await resolveWritebackIssue(workspaceId, externalId);
|
|
129
|
+
if (!target)
|
|
130
|
+
return;
|
|
131
|
+
await githubClient.comment(target.installationId, { owner: target.parsed.owner, repo: target.parsed.repo }, target.parsed.number, body);
|
|
132
|
+
},
|
|
133
|
+
closeGitHubIssue: async (workspaceId, externalId) => {
|
|
134
|
+
const target = await resolveWritebackIssue(workspaceId, externalId);
|
|
135
|
+
if (!target)
|
|
136
|
+
return;
|
|
137
|
+
await githubClient.closeIssue(target.installationId, { owner: target.parsed.owner, repo: target.parsed.repo }, target.parsed.number);
|
|
138
|
+
},
|
|
139
|
+
labelGitHubIssue: async (workspaceId, externalId, label) => {
|
|
140
|
+
const target = await resolveWritebackIssue(workspaceId, externalId);
|
|
141
|
+
if (!target)
|
|
142
|
+
return;
|
|
143
|
+
await githubClient.applyIssueLabel?.(target.installationId, { owner: target.parsed.owner, repo: target.parsed.repo }, target.parsed.number, label);
|
|
144
|
+
},
|
|
145
|
+
}
|
|
146
|
+
: {}),
|
|
147
|
+
...(tasks.taskConnectionRepository
|
|
148
|
+
? {
|
|
149
|
+
resolveJiraConnection: async (workspaceId) => {
|
|
150
|
+
const connection = await tasks.taskConnectionRepository.getByWorkspace(workspaceId, 'jira');
|
|
151
|
+
const { baseUrl, accountEmail, apiToken } = connection?.credentials ?? {};
|
|
152
|
+
if (!baseUrl || !accountEmail || !apiToken)
|
|
153
|
+
return null;
|
|
154
|
+
return { baseUrl, accountEmail, apiToken };
|
|
155
|
+
},
|
|
156
|
+
resolveLinearConnection: async (workspaceId) => {
|
|
157
|
+
const connection = await tasks.taskConnectionRepository.getByWorkspace(workspaceId, 'linear');
|
|
158
|
+
const { apiKey, token } = connection?.credentials ?? {};
|
|
159
|
+
return apiKey || token ? { apiKey, token } : null;
|
|
160
|
+
},
|
|
161
|
+
}
|
|
162
|
+
: {}),
|
|
163
|
+
});
|
|
164
|
+
let githubGateDeps = {};
|
|
165
|
+
if (engineVcsClient) {
|
|
166
|
+
// The `ci` / `conflicts` gates now live in `@cat-factory/gates`; wire their providers into
|
|
167
|
+
// the gate suite instead of onto the engine's CoreDependencies (single-process startup, so
|
|
168
|
+
// the deployment-global handles are set once here). Parity with the Worker's selectGitHubDeps.
|
|
169
|
+
// These read through `engineVcsClient` (GitHub App or the GitLab fallback), so a GitLab-only
|
|
170
|
+
// deployment gates + merges for real too.
|
|
171
|
+
wireCiStatusProvider(providerRegistry, new GitHubCiStatusProvider({
|
|
172
|
+
githubClient: engineVcsClient,
|
|
173
|
+
resolveRepoTarget,
|
|
174
|
+
blockRepository,
|
|
175
|
+
}));
|
|
176
|
+
wireMergeabilityProvider(providerRegistry, new GitHubMergeabilityProvider({
|
|
177
|
+
githubClient: engineVcsClient,
|
|
178
|
+
resolveRepoTarget,
|
|
179
|
+
blockRepository,
|
|
180
|
+
}));
|
|
181
|
+
wirePullRequestReviewProvider(providerRegistry, new GitHubPullRequestReviewProvider({
|
|
182
|
+
githubClient: engineVcsClient,
|
|
183
|
+
resolveRepoTarget,
|
|
184
|
+
blockRepository,
|
|
185
|
+
}));
|
|
186
|
+
wireDocQualityProvider(providerRegistry, new GitHubDocQualityProvider({
|
|
187
|
+
githubClient: engineVcsClient,
|
|
188
|
+
resolveRepoTarget,
|
|
189
|
+
blockRepository,
|
|
190
|
+
// The gate resolves a workspace-linked template (WS1) for the block's kind, so it checks
|
|
191
|
+
// against the SAME sections the doc-writer followed. In db-less mothership mode the writer
|
|
192
|
+
// resolves the template through the RPC-proxied documents repo (getRoleLink is run-path
|
|
193
|
+
// allow-listed), so the gate MUST use that same repo — not `undefined` — or a doc written
|
|
194
|
+
// to the workspace template would be graded against the built-in skeleton (writer/gate drift).
|
|
195
|
+
documentRepository: db
|
|
196
|
+
? new DrizzleDocumentRepository(db)
|
|
197
|
+
: remoteRepos?.documentRepository,
|
|
198
|
+
}));
|
|
199
|
+
githubGateDeps = {
|
|
200
|
+
// The engine binds a registered custom kind's pre/post-op hooks to a run's repo
|
|
201
|
+
// via this checkout-free RepoFiles resolver, composed from the same client +
|
|
202
|
+
// repo-target walk the gates/merger use — parity with the Worker. The `repoFiles`
|
|
203
|
+
// cache (slice 4) makes the post-op idempotency re-reads a read-through hit.
|
|
204
|
+
resolveRunRepoContext: makeResolveRunRepoContext(engineVcsClient, resolveRepoTarget, caches?.repoFiles),
|
|
205
|
+
// Block-less repo resolver for the environments module's on-demand repo
|
|
206
|
+
// validation / config bootstrap (operator names owner+repo).
|
|
207
|
+
resolveRepoFilesForCoords: makeResolveRepoFilesForCoords(engineVcsClient, githubInstallationRepository, repoProjectionRepository),
|
|
208
|
+
branchUpdater: new GitHubBranchUpdater({
|
|
209
|
+
githubClient: engineVcsClient,
|
|
210
|
+
resolveRepoTarget,
|
|
211
|
+
blockRepository,
|
|
212
|
+
}),
|
|
213
|
+
pullRequestMerger: new GitHubPullRequestMerger({
|
|
214
|
+
githubClient: engineVcsClient,
|
|
215
|
+
resolveRepoTarget,
|
|
216
|
+
blockRepository,
|
|
217
|
+
}),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
// GitHub installation + projections + sync/webhook module: wired when the App is
|
|
221
|
+
// configured (a real githubClient), mirroring the Worker's selectGitHubDeps. This
|
|
222
|
+
// turns the GitHub read endpoints + the inline webhook/backfill sync on for Node —
|
|
223
|
+
// the sync engine (GitHubSyncService) is runtime-neutral, so populating the
|
|
224
|
+
// projection repos here makes the inline ingest actually persist (parity with the
|
|
225
|
+
// Worker, which fans the same sync through a queue/Workflow). `canCreateRepos` /
|
|
226
|
+
// `workflowsGranted` come from the App registry when present (advisory).
|
|
227
|
+
const githubModuleDeps = config.github.enabled && githubClient
|
|
228
|
+
? {
|
|
229
|
+
githubClient,
|
|
230
|
+
githubInstallationRepository,
|
|
231
|
+
repoProjectionRepository,
|
|
232
|
+
// The five GitHub projection repos share one shape (remote in mothership mode, else
|
|
233
|
+
// Drizzle over `db`), routed through the shared `sourced` helper.
|
|
234
|
+
branchProjectionRepository: sourced('branchProjectionRepository', (d) => new DrizzleBranchProjectionRepository(d)),
|
|
235
|
+
pullRequestProjectionRepository: sourced('pullRequestProjectionRepository', (d) => new DrizzlePullRequestProjectionRepository(d)),
|
|
236
|
+
issueProjectionRepository: sourced('issueProjectionRepository', (d) => new DrizzleIssueProjectionRepository(d)),
|
|
237
|
+
commitProjectionRepository: sourced('commitProjectionRepository', (d) => new DrizzleCommitProjectionRepository(d)),
|
|
238
|
+
checkRunProjectionRepository: sourced('checkRunProjectionRepository', (d) => new DrizzleCheckRunProjectionRepository(d)),
|
|
239
|
+
// Per-user PAT-reachable repo projection (picker expansion + redaction); Postgres-only,
|
|
240
|
+
// so absent in a no-DB mothership node (the picker keeps its App-only behaviour there).
|
|
241
|
+
userRepoAccessRepository: db ? new DrizzleUserRepoAccessRepository(db) : undefined,
|
|
242
|
+
webhookVerifier: new WebCryptoWebhookVerifier(config.github.webhookSecret),
|
|
243
|
+
// Bound the initial backfill to the commit retention horizon (0 = full).
|
|
244
|
+
commitBackfillHorizonMs: config.retention.commitMs || undefined,
|
|
245
|
+
...(appRegistry
|
|
246
|
+
? {
|
|
247
|
+
// Privileged App tier (ADR 0005): when configured, its client backs the
|
|
248
|
+
// create-repo endpoint; `canCreateRepos` flags a connection whose
|
|
249
|
+
// installation is owned by the privileged App. Absent → repo creation
|
|
250
|
+
// stays the manual flow (parity with the Worker's selectGitHubDeps).
|
|
251
|
+
repoProvisioningClient: config.github.privilegedApp
|
|
252
|
+
? new FetchGitHubProvisioningClient({
|
|
253
|
+
registry: appRegistry,
|
|
254
|
+
apiBase: config.github.apiBase,
|
|
255
|
+
})
|
|
256
|
+
: undefined,
|
|
257
|
+
canCreateRepos: (installation) => appRegistry.canCreateRepos(installation),
|
|
258
|
+
workflowsGranted: async (installation) => {
|
|
259
|
+
const perms = await appRegistry.installationPermissions(installation.installationId);
|
|
260
|
+
return perms.workflows === 'write';
|
|
261
|
+
},
|
|
262
|
+
}
|
|
263
|
+
: {}),
|
|
264
|
+
}
|
|
265
|
+
: {};
|
|
266
|
+
return {
|
|
267
|
+
githubClient,
|
|
268
|
+
tasks,
|
|
269
|
+
fileGitHubIssue,
|
|
270
|
+
issueWritebackProvider,
|
|
271
|
+
githubGateDeps,
|
|
272
|
+
githubModuleDeps,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=container-github-deps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-github-deps.js","sourceRoot":"","sources":["../src/container-github-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,2BAA2B,CAAA;AAkBlC,OAAO,EAIL,iBAAiB,EACjB,6BAA6B,EAC7B,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,uBAAuB,EACvB,+BA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a;wBACjD,CAAC,CAAC,IAAI,6BAA6B,CAAC;4BAChC,QAAQ,EAAE,WAAW;4BACrB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO;yBAC/B,CAAC;wBACJ,CAAC,CAAC,SAAS;oBACb,cAAc,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,YAAY,CAAC;oBAC1E,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;wBACvC,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,uBAAuB,CACrD,YAAY,CAAC,cAAc,CAC5B,CAAA;wBACD,OAAO,KAAK,CAAC,SAAS,KAAK,OAAO,CAAA;oBACpC,CAAC;iBACF;gBACH,CAAC,CAAC,EAAE,CAAC;SACR;QACH,CAAC,CAAC,EAAE,CAAA;IAER,OAAO;QACL,YAAY;QACZ,KAAK;QACL,eAAe;QACf,sBAAsB;QACtB,cAAc;QACd,gBAAgB;KACjB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AiAgentExecutor, type AgentKindRegistry } from '@cat-factory/agents';
|
|
2
|
+
import type { ApiKeyService, LocalModelEndpointService, UserSecretKindRegistry } from '@cat-factory/integrations';
|
|
3
|
+
import type { AppCaches, LocalModelEndpointRepository, ModelProviderResolver, PersonalSubscriptionRepository, ProviderApiKeyRepository, ProviderSubscriptionTokenRepository, ResolveUserGitHubToken, SubscriptionActivationRepository, WorkspaceRepository } from '@cat-factory/kernel';
|
|
4
|
+
import type { Clock, IdGenerator } from '@cat-factory/kernel';
|
|
5
|
+
import { type AppConfig } from '@cat-factory/server';
|
|
6
|
+
import type { ModelProviderResolverWrapDeps } from './container.js';
|
|
7
|
+
import type { DrizzleDb } from './db/client.js';
|
|
8
|
+
/** Inputs {@link buildNodeModelDeps} needs from the composition root. */
|
|
9
|
+
export interface NodeModelDepsInput {
|
|
10
|
+
env: NodeJS.ProcessEnv;
|
|
11
|
+
config: AppConfig;
|
|
12
|
+
db: DrizzleDb;
|
|
13
|
+
workspaceRepository: WorkspaceRepository;
|
|
14
|
+
idGenerator: IdGenerator;
|
|
15
|
+
clock: Clock;
|
|
16
|
+
agentKindRegistry: AgentKindRegistry;
|
|
17
|
+
userSecretKindRegistry: UserSecretKindRegistry;
|
|
18
|
+
resolveWorkspaceModelDefault: (workspaceId: string, agentKind: string, modelPresetId?: string) => Promise<string | undefined>;
|
|
19
|
+
providerApiKeyRepository?: ProviderApiKeyRepository;
|
|
20
|
+
localModelEndpointRepository?: LocalModelEndpointRepository;
|
|
21
|
+
providerSubscriptionTokenRepository?: ProviderSubscriptionTokenRepository;
|
|
22
|
+
personalSubscriptionRepository?: PersonalSubscriptionRepository;
|
|
23
|
+
subscriptionActivationRepository?: SubscriptionActivationRepository;
|
|
24
|
+
wrapModelProviderResolver?: (inner: ModelProviderResolver, deps: ModelProviderResolverWrapDeps) => ModelProviderResolver;
|
|
25
|
+
cloudflareModelsEnabled?: boolean;
|
|
26
|
+
caches?: AppCaches;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The credential/token stores + the model-provisioning stack of the Node composition root,
|
|
30
|
+
* lifted out of `buildNodeContainer` so that root stays within the file-size budget (the same
|
|
31
|
+
* reason `container-executor-deps.ts` exists). Builds the direct-provider API-key pool, the
|
|
32
|
+
* public-API + local-model-endpoint + user-secret + OpenRouter-catalog + subscription +
|
|
33
|
+
* personal-subscription stores, then the trace sink, the (optionally facade-wrapped +
|
|
34
|
+
* vendor-limited) model-provider resolver, and the inline agent executor.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildNodeModelDeps(input: NodeModelDepsInput): {
|
|
37
|
+
apiKeys: ApiKeyService | undefined;
|
|
38
|
+
publicApiKeys: import("@cat-factory/integrations").PublicApiKeyService | undefined;
|
|
39
|
+
localModelEndpoints: LocalModelEndpointService | undefined;
|
|
40
|
+
userSecrets: import("@cat-factory/integrations").UserSecretService | undefined;
|
|
41
|
+
resolveUserGitHubToken: ResolveUserGitHubToken | undefined;
|
|
42
|
+
openRouterCatalog: import("@cat-factory/integrations").OpenRouterCatalogService | undefined;
|
|
43
|
+
subscriptions: import("@cat-factory/integrations").ProviderSubscriptionService | undefined;
|
|
44
|
+
personalSubscriptions: import("@cat-factory/integrations").PersonalSubscriptionService | undefined;
|
|
45
|
+
traceSink: import("@cat-factory/kernel").LlmTraceSink | undefined;
|
|
46
|
+
modelProviderResolver: ModelProviderResolver;
|
|
47
|
+
cloudflareModelsEnabled: boolean;
|
|
48
|
+
inline: AiAgentExecutor;
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=container-model-deps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-model-deps.d.ts","sourceRoot":"","sources":["../src/container-model-deps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,KAAK,iBAAiB,EAGvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EACV,aAAa,EACb,yBAAyB,EACzB,sBAAsB,EACvB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,SAAS,EACT,4BAA4B,EAC5B,qBAAqB,EACrB,8BAA8B,EAC9B,wBAAwB,EACxB,mCAAmC,EACnC,sBAAsB,EACtB,gCAAgC,EAChC,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,qBAAqB,CAAA;AAE7E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAsC/C,yEAAyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;IACtB,MAAM,EAAE,SAAS,CAAA;IACjB,EAAE,EAAE,SAAS,CAAA;I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