@cat-factory/node-server 0.107.6 → 0.107.8
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/container-executor-deps.d.ts +114 -0
- package/dist/container-executor-deps.d.ts.map +1 -0
- package/dist/container-executor-deps.js +405 -0
- package/dist/container-executor-deps.js.map +1 -0
- package/dist/container.d.ts +3 -22
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +10 -394
- package/dist/container.js.map +1 -1
- package/package.json +18 -18
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { AgentKindRegistry } from '@cat-factory/agents';
|
|
2
|
+
import { PersonalSubscriptionService, ProviderSubscriptionService } from '@cat-factory/integrations';
|
|
3
|
+
import type { EnvironmentBackendRegistry, ProvisioningLogRecorder, RunnerBackendRegistry } from '@cat-factory/integrations';
|
|
4
|
+
import type { AgentExecutor, Clock, GitHubClient, GitHubInstallationRepository, ProvisioningSubsystem, ResolveUserGitHubToken, RunnerPoolConnectionRepository, RunnerPoolProvider, SubscriptionQuotaTarget, TestSecretEntry, WebSearchAvailability } from '@cat-factory/kernel';
|
|
5
|
+
import { AgentContextObservabilityService, type CoreDependencies, type HarnessCallsRecordInput } from '@cat-factory/orchestration';
|
|
6
|
+
import { type AppConfig, type JobPackageRegistrySpec, type ResolveRepoOrigin, type ResolveRepoTarget, type ResolveRepoTargets, type ResolveRunnerTransport, ContainerEnvConfigRepairer, ContainerRepoBootstrapper, GitHubAppRegistry } from '@cat-factory/server';
|
|
7
|
+
export declare const RUNNERS_CIPHER_INFO = "cat-factory:runners";
|
|
8
|
+
/**
|
|
9
|
+
* Build the opt-in external trace sink(s) — Langfuse and/or OpenTelemetry — composed into
|
|
10
|
+
* the single sink slot; the observability service then fans every recorded LLM call out to
|
|
11
|
+
* whichever are wired. Memoised per config so both wiring sites share one instance.
|
|
12
|
+
*
|
|
13
|
+
* Langfuse uses the fetch-based sink (identical to the Worker). OpenTelemetry uses the
|
|
14
|
+
* OFFICIAL `@opentelemetry/*` SDK exporter (`createNodeOtelSink`) — the Node counterpart of
|
|
15
|
+
* the Worker's fetch OTLP exporter, kept conformant by the shared mapping layer + tests.
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildTraceSink(config: AppConfig): CoreDependencies['llmTraceSink'];
|
|
18
|
+
export declare function buildNodeResolveTransport(config: AppConfig, runnerPoolConnectionRepository: RunnerPoolConnectionRepository, workspaceRepository: CoreDependencies['workspaceRepository'], clock: Clock, runnerBackendRegistry: RunnerBackendRegistry, injectedPoolProvider?: RunnerPoolProvider): ResolveRunnerTransport | null;
|
|
19
|
+
/**
|
|
20
|
+
* Wrap a transport resolver so every dispatch/release/poll-failure appends a
|
|
21
|
+
* provisioning-log event. A no-op when there's no resolver. `subsystem` tags the
|
|
22
|
+
* rows (a self-hosted pool vs a per-run container) so the logs drawer can filter.
|
|
23
|
+
*/
|
|
24
|
+
export declare function withProvisioningLog(resolve: ResolveRunnerTransport | null, recorder: ProvisioningLogRecorder, subsystem: ProvisioningSubsystem): ResolveRunnerTransport | null;
|
|
25
|
+
/**
|
|
26
|
+
* Which of the container-executor prerequisites are missing, as the human labels the boot
|
|
27
|
+
* warning names. Empty ⇒ all three are present. `PUBLIC_URL` is this service's externally
|
|
28
|
+
* reachable base backing the LLM proxy, `AUTH_SESSION_SECRET` signs the harness↔proxy tokens,
|
|
29
|
+
* and a runner backend is what a dispatch is handed to. Pure so the "name exactly what's
|
|
30
|
+
* missing" logic is unit-tested (error-message coverage A5).
|
|
31
|
+
*/
|
|
32
|
+
export declare function missingContainerExecutorPrereqs(input: {
|
|
33
|
+
publicUrl: string | undefined;
|
|
34
|
+
sessionSecret: string | undefined;
|
|
35
|
+
hasRunnerBackend: boolean;
|
|
36
|
+
}): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Build the container agent executor (repo-operating steps: coder, mocker,
|
|
39
|
+
* playwright, blueprints, ci-fixer, conflict-resolver, merger) when its
|
|
40
|
+
* prerequisites are configured: a token source for the push/clone token, the public
|
|
41
|
+
* URL backing the LLM proxy, the session secret to sign proxy tokens, and a runner
|
|
42
|
+
* backend. Returns null when any is missing, so the composite fails those kinds
|
|
43
|
+
* loudly rather than running them as useless one-shot LLM calls.
|
|
44
|
+
*
|
|
45
|
+
* The token source is pluggable: a sibling facade may pass `mintInstallationToken`
|
|
46
|
+
* (e.g. a static PAT for local mode), otherwise it is minted via the GitHub App
|
|
47
|
+
* registry (which additionally requires the App private key + `github.enabled`).
|
|
48
|
+
*/
|
|
49
|
+
export declare function buildNodeContainerExecutor(env: NodeJS.ProcessEnv, config: AppConfig, appRegistry: GitHubAppRegistry | undefined, resolveRepoTarget: ResolveRepoTarget, resolveRepoTargets: ResolveRepoTargets, resolveTransport: ResolveRunnerTransport | null, resolveWorkspaceModelDefault: (workspaceId: string, agentKind: string, modelPresetId?: string) => Promise<string | undefined>, agentKindRegistry: AgentKindRegistry, mintInstallationTokenOverride?: (installationId: number) => Promise<string>, subscriptions?: ProviderSubscriptionService, personalSubscriptions?: PersonalSubscriptionService, resolveAccountId?: (workspaceId: string) => Promise<string | null | undefined>, resolveUserGitHubToken?: ResolveUserGitHubToken, agentContextObservability?: AgentContextObservabilityService, resolveWebSearchAvailability?: (workspaceId: string) => Promise<WebSearchAvailability>, resolveRepoOrigin?: ResolveRepoOrigin, resolvePackageRegistries?: (workspaceId: string) => Promise<JobPackageRegistrySpec[]>, resolveTestSecrets?: (workspaceId: string, blockId: string) => Promise<TestSecretEntry[]>, recordHarnessCalls?: (input: HarnessCallsRecordInput) => Promise<void>, recordSubscriptionQuotaUsage?: (target: SubscriptionQuotaTarget, usage: {
|
|
50
|
+
inputTokens: number;
|
|
51
|
+
outputTokens: number;
|
|
52
|
+
}) => Promise<void>): AgentExecutor | null;
|
|
53
|
+
/**
|
|
54
|
+
* Build the repo bootstrapper (the "bootstrap repo" container dispatch) when its
|
|
55
|
+
* prerequisites are configured — mirroring the Worker's `selectRepoBootstrapper` and
|
|
56
|
+
* the container-executor prerequisites: a resolvable runner transport, the public URL
|
|
57
|
+
* + session secret backing the LLM proxy, a token source, and a GitHub client.
|
|
58
|
+
* Returns undefined otherwise (the bootstrap module then has no runner and the service
|
|
59
|
+
* reports a clean dispatch failure). Bootstrap is an `architect`-kind run, so it
|
|
60
|
+
* follows that kind's routing. The promoted `ContainerRepoBootstrapper` dispatches
|
|
61
|
+
* through the same shared runner seam the container executor uses, so on Node it runs
|
|
62
|
+
* against the self-hosted pool and on local against the per-job Docker container.
|
|
63
|
+
*/
|
|
64
|
+
export declare function selectNodeRepoBootstrapper(deps: {
|
|
65
|
+
env: NodeJS.ProcessEnv;
|
|
66
|
+
config: AppConfig;
|
|
67
|
+
resolveTransport: ResolveRunnerTransport | null;
|
|
68
|
+
installationRepository: GitHubInstallationRepository;
|
|
69
|
+
bootstrapJobRepository: ConstructorParameters<typeof ContainerRepoBootstrapper>[0]['bootstrapJobRepository'];
|
|
70
|
+
repoRepository: ConstructorParameters<typeof ContainerRepoBootstrapper>[0]['repoRepository'];
|
|
71
|
+
repoProjectionCache?: ConstructorParameters<typeof ContainerRepoBootstrapper>[0]['repoProjectionCache'];
|
|
72
|
+
githubClient: GitHubClient | undefined;
|
|
73
|
+
mintInstallationToken: ((installationId: number) => Promise<string>) | undefined;
|
|
74
|
+
resolvePackageRegistries?: (workspaceId: string) => Promise<JobPackageRegistrySpec[]>;
|
|
75
|
+
}): ContainerRepoBootstrapper | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Build the live ENVIRONMENT-PROVIDER CONFIG REPAIR agent (PR #416 increment 2) when its
|
|
78
|
+
* prerequisites are met — the same container prerequisites as the bootstrapper PLUS a
|
|
79
|
+
* registered backend that supports agent repair (`describeRepairAgent`). The stock manifest
|
|
80
|
+
* provider has no repair support, so this stays undefined there; it wires only when a custom
|
|
81
|
+
* backend registered into the env-backend registry implements repair (so local inherits it
|
|
82
|
+
* too). NOT the repo bootstrapper: an ordinary clone→edit→push coding job, no history reset.
|
|
83
|
+
*/
|
|
84
|
+
export declare function selectNodeEnvConfigRepairer(deps: {
|
|
85
|
+
env: NodeJS.ProcessEnv;
|
|
86
|
+
config: AppConfig;
|
|
87
|
+
resolveTransport: ResolveRunnerTransport | null;
|
|
88
|
+
installationRepository: GitHubInstallationRepository;
|
|
89
|
+
mintInstallationToken: ((installationId: number) => Promise<string>) | undefined;
|
|
90
|
+
override: CoreDependencies['environmentProvider'];
|
|
91
|
+
environmentBackendRegistry: EnvironmentBackendRegistry;
|
|
92
|
+
}): ContainerEnvConfigRepairer | undefined;
|
|
93
|
+
/** Files a GitHub issue for a service frame, or null when none can be resolved. */
|
|
94
|
+
type GitHubIssueFiler = (request: {
|
|
95
|
+
workspaceId: string;
|
|
96
|
+
frameId: string;
|
|
97
|
+
title: string;
|
|
98
|
+
body: string;
|
|
99
|
+
}) => Promise<{
|
|
100
|
+
externalId: string;
|
|
101
|
+
url: string;
|
|
102
|
+
} | null>;
|
|
103
|
+
/**
|
|
104
|
+
* Build the GitHub-issue tracker filer for the tech-debt pipeline when the GitHub
|
|
105
|
+
* App is configured. It resolves the service's repo from the workspace's
|
|
106
|
+
* `github_repos` projection and mints a short-lived token from that workspace's OWN
|
|
107
|
+
* App installation (per-tenant) — the same infra the container executor uses — then
|
|
108
|
+
* files the issue via the token. Returns undefined when the App isn't configured (the
|
|
109
|
+
* GitHub tracker then passes through). A run whose service isn't linked to a repo
|
|
110
|
+
* resolves to null (a clean pass-through, not a run failure).
|
|
111
|
+
*/
|
|
112
|
+
export declare function buildNodeGitHubIssueFiler(config: AppConfig, registry: GitHubAppRegistry | undefined, resolveRepoTarget: ResolveRepoTarget): GitHubIssueFiler | undefined;
|
|
113
|
+
export {};
|
|
114
|
+
//# sourceMappingURL=container-executor-deps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-executor-deps.d.ts","sourceRoot":"","sources":["../src/container-executor-deps.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAA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AA;IACtB,MAAM,EAAE,SAAS,CAAA;IACjB,gBAAgB,EAAE,sBAAsB,GAAG,IAAI,CAAA;IAC/C,sBAAsB,EAAE,4BAA4B,CAAA;IACpD,qBAAqB,EAAE,CAAC,CAAC,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAA;IAChF,QAAQ,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAA;IACjD,0BAA0B,EAAE,0BAA0B,CAAA;CACvD,GAAG,0BAA0B,GAAG,SAAS,CAgDzC;AAED,mFAAmF;AACnF,KAAK,gBAAgB,GAAG,CAAC,OAAO,EAAE;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb,KAAK,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAAA;AAEzD;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,iBAAiB,GAAG,SAAS,EACvC,iBAAiB,EAAE,iBAAiB,GACnC,gBAAgB,GAAG,SAAS,CAwB9B"}
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
// Container-agent-executor wiring for the Node facade, extracted out of `container.ts` so the
|
|
2
|
+
// composition root stays within the file-size budget. These are the seams `buildNodeContainer`
|
|
3
|
+
// (and the local facade / tests) compose: the runner-pool transport resolver, the
|
|
4
|
+
// provisioning-log wrapper, the container agent executor + repo bootstrapper + env-config
|
|
5
|
+
// repairer, the GitHub-issue filer, and the shared external trace-sink builder. Pure functions
|
|
6
|
+
// over explicit deps — no shared mutable state beyond the per-config trace-sink memo.
|
|
7
|
+
import { resolveAgentConfig, isProxyableProvider } from '@cat-factory/agents';
|
|
8
|
+
import { HttpRunnerPoolProvider, RunnerPoolConnectionService, LoggingRunnerTransport, PersonalSubscriptionService, ProviderSubscriptionService, createGitHubIssueViaToken, } from '@cat-factory/integrations';
|
|
9
|
+
import { SUBSCRIPTION_VENDORS, composeTraceSinks, isAmbientNativeVendor } from '@cat-factory/kernel';
|
|
10
|
+
import { AgentContextObservabilityService, } from '@cat-factory/orchestration';
|
|
11
|
+
import { createLangfuseSink } from '@cat-factory/observability-langfuse';
|
|
12
|
+
import { createNodeOtelSink } from '@cat-factory/observability-otel/node';
|
|
13
|
+
import { ContainerAgentExecutor, ContainerEnvConfigRepairer, ContainerRepoBootstrapper, ContainerSessionService, GitHubAppRegistry, WebCryptoSecretCipher, DOCS, ENV_VARS_ANCHORS, ensureWorkBranchViaRest, logger, noRunnerBackendAvailableError, resolveUrlSafetyPolicy, } from '@cat-factory/server';
|
|
14
|
+
// HKDF domain tag separating runner-pool scheduler secrets from any other use of
|
|
15
|
+
// the same master key (mirrors the Worker's `cat-factory:runners`).
|
|
16
|
+
export const RUNNERS_CIPHER_INFO = 'cat-factory:runners';
|
|
17
|
+
// Memoised per config so both trace-sink wiring sites (the container executor here and the
|
|
18
|
+
// core/inline sinks in `buildNodeContainer`) share ONE instance — the OTel SDK sink owns
|
|
19
|
+
// batch processors/exporters, so it must be built once per config, not per wiring site.
|
|
20
|
+
const traceSinkCache = new WeakMap();
|
|
21
|
+
/**
|
|
22
|
+
* Build the opt-in external trace sink(s) — Langfuse and/or OpenTelemetry — composed into
|
|
23
|
+
* the single sink slot; the observability service then fans every recorded LLM call out to
|
|
24
|
+
* whichever are wired. Memoised per config so both wiring sites share one instance.
|
|
25
|
+
*
|
|
26
|
+
* Langfuse uses the fetch-based sink (identical to the Worker). OpenTelemetry uses the
|
|
27
|
+
* OFFICIAL `@opentelemetry/*` SDK exporter (`createNodeOtelSink`) — the Node counterpart of
|
|
28
|
+
* the Worker's fetch OTLP exporter, kept conformant by the shared mapping layer + tests.
|
|
29
|
+
*/
|
|
30
|
+
export function buildTraceSink(config) {
|
|
31
|
+
if (traceSinkCache.has(config))
|
|
32
|
+
return traceSinkCache.get(config);
|
|
33
|
+
const langfuse = !config.langfuse.enabled || !config.langfuse.publicKey || !config.langfuse.secretKey
|
|
34
|
+
? undefined
|
|
35
|
+
: createLangfuseSink({
|
|
36
|
+
publicKey: config.langfuse.publicKey,
|
|
37
|
+
secretKey: config.langfuse.secretKey,
|
|
38
|
+
baseUrl: config.langfuse.baseUrl,
|
|
39
|
+
logger,
|
|
40
|
+
});
|
|
41
|
+
const otel = !config.otel.enabled || !config.otel.endpoint
|
|
42
|
+
? undefined
|
|
43
|
+
: createNodeOtelSink({
|
|
44
|
+
endpoint: config.otel.endpoint,
|
|
45
|
+
headers: config.otel.headers,
|
|
46
|
+
serviceName: config.otel.serviceName,
|
|
47
|
+
logger,
|
|
48
|
+
});
|
|
49
|
+
const sink = composeTraceSinks([langfuse, otel]);
|
|
50
|
+
traceSinkCache.set(config, sink);
|
|
51
|
+
return sink;
|
|
52
|
+
}
|
|
53
|
+
export function buildNodeResolveTransport(config,
|
|
54
|
+
// The port, not the Drizzle concrete: in mothership mode the local facade passes a remote
|
|
55
|
+
// (RPC-backed) connection repo, and the service layer only ever uses the port methods.
|
|
56
|
+
runnerPoolConnectionRepository, workspaceRepository, clock,
|
|
57
|
+
// The app-owned runner-backend registry the service resolves a stored `kind` through.
|
|
58
|
+
runnerBackendRegistry,
|
|
59
|
+
// The shared HTTP provider the built-in `manifest` backend reuses when supplied (e.g.
|
|
60
|
+
// tests). NOT the custom-kind seam — a bespoke runner backend is registered by reference
|
|
61
|
+
// into `runnerBackendRegistry`. Absent → the generic manifest-driven HTTP provider.
|
|
62
|
+
injectedPoolProvider) {
|
|
63
|
+
if (!config.runners.enabled || !config.runners.encryptionKey)
|
|
64
|
+
return null;
|
|
65
|
+
const urlPolicy = resolveUrlSafetyPolicy(config.runners);
|
|
66
|
+
const runnerService = new RunnerPoolConnectionService({
|
|
67
|
+
runnerPoolConnectionRepository,
|
|
68
|
+
workspaceRepository,
|
|
69
|
+
secretCipher: new WebCryptoSecretCipher({
|
|
70
|
+
masterKeyBase64: config.runners.encryptionKey,
|
|
71
|
+
info: RUNNERS_CIPHER_INFO,
|
|
72
|
+
}),
|
|
73
|
+
clock,
|
|
74
|
+
runnerBackendRegistry,
|
|
75
|
+
...(urlPolicy ? { urlPolicy } : {}),
|
|
76
|
+
runnerPoolProvider: injectedPoolProvider ?? new HttpRunnerPoolProvider(urlPolicy ? { urlPolicy } : {}),
|
|
77
|
+
});
|
|
78
|
+
return async (workspaceId) => {
|
|
79
|
+
if (workspaceId) {
|
|
80
|
+
const resolved = await runnerService.resolve(workspaceId);
|
|
81
|
+
if (resolved)
|
|
82
|
+
return resolved.transport;
|
|
83
|
+
}
|
|
84
|
+
// The shared factory throws a ConflictError carrying the machine reason (see its doc): a clean
|
|
85
|
+
// 409 synchronously, and classifyDispatchFailure lifts the reason onto the run's AgentFailure on
|
|
86
|
+
// the async dispatch path (SPA shows "Agent backend not configured", not "container failed to
|
|
87
|
+
// start"). The Node facade has no per-run container backend, so the remedy points only at the
|
|
88
|
+
// self-hosted runner pool / Kubernetes.
|
|
89
|
+
throw noRunnerBackendAvailableError(workspaceId);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Wrap a transport resolver so every dispatch/release/poll-failure appends a
|
|
94
|
+
* provisioning-log event. A no-op when there's no resolver. `subsystem` tags the
|
|
95
|
+
* rows (a self-hosted pool vs a per-run container) so the logs drawer can filter.
|
|
96
|
+
*/
|
|
97
|
+
export function withProvisioningLog(resolve, recorder, subsystem) {
|
|
98
|
+
if (!resolve)
|
|
99
|
+
return null;
|
|
100
|
+
// Closure-owned so it survives each (per-resolution) wrapper: a terminal `failed`
|
|
101
|
+
// job re-polled by a replay/re-drive logs its poll-failure only once.
|
|
102
|
+
const loggedPollFailures = new Set();
|
|
103
|
+
return async (workspaceId) => {
|
|
104
|
+
const inner = await resolve(workspaceId);
|
|
105
|
+
return new LoggingRunnerTransport({
|
|
106
|
+
inner,
|
|
107
|
+
recorder,
|
|
108
|
+
workspaceId: workspaceId ?? '',
|
|
109
|
+
subsystem,
|
|
110
|
+
loggedPollFailures,
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Which of the container-executor prerequisites are missing, as the human labels the boot
|
|
116
|
+
* warning names. Empty ⇒ all three are present. `PUBLIC_URL` is this service's externally
|
|
117
|
+
* reachable base backing the LLM proxy, `AUTH_SESSION_SECRET` signs the harness↔proxy tokens,
|
|
118
|
+
* and a runner backend is what a dispatch is handed to. Pure so the "name exactly what's
|
|
119
|
+
* missing" logic is unit-tested (error-message coverage A5).
|
|
120
|
+
*/
|
|
121
|
+
export function missingContainerExecutorPrereqs(input) {
|
|
122
|
+
const missing = [];
|
|
123
|
+
if (!input.publicUrl)
|
|
124
|
+
missing.push('PUBLIC_URL');
|
|
125
|
+
if (!input.sessionSecret)
|
|
126
|
+
missing.push('AUTH_SESSION_SECRET (>= 32 chars)');
|
|
127
|
+
if (!input.hasRunnerBackend)
|
|
128
|
+
missing.push('a runner backend (self-hosted runner pool)');
|
|
129
|
+
return missing;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Build the container agent executor (repo-operating steps: coder, mocker,
|
|
133
|
+
* playwright, blueprints, ci-fixer, conflict-resolver, merger) when its
|
|
134
|
+
* prerequisites are configured: a token source for the push/clone token, the public
|
|
135
|
+
* URL backing the LLM proxy, the session secret to sign proxy tokens, and a runner
|
|
136
|
+
* backend. Returns null when any is missing, so the composite fails those kinds
|
|
137
|
+
* loudly rather than running them as useless one-shot LLM calls.
|
|
138
|
+
*
|
|
139
|
+
* The token source is pluggable: a sibling facade may pass `mintInstallationToken`
|
|
140
|
+
* (e.g. a static PAT for local mode), otherwise it is minted via the GitHub App
|
|
141
|
+
* registry (which additionally requires the App private key + `github.enabled`).
|
|
142
|
+
*/
|
|
143
|
+
export function buildNodeContainerExecutor(env, config, appRegistry, resolveRepoTarget, resolveRepoTargets, resolveTransport, resolveWorkspaceModelDefault, agentKindRegistry, mintInstallationTokenOverride, subscriptions, personalSubscriptions, resolveAccountId, resolveUserGitHubToken, agentContextObservability, resolveWebSearchAvailability, resolveRepoOrigin, resolvePackageRegistries, resolveTestSecrets, recordHarnessCalls, recordSubscriptionQuotaUsage) {
|
|
144
|
+
// The harness reaches models only through this service's LLM proxy; `PUBLIC_URL`
|
|
145
|
+
// is this service's externally reachable base (the runner pool / local container
|
|
146
|
+
// must be able to reach it). Pi posts to `${PUBLIC_URL}/v1/chat/completions`.
|
|
147
|
+
const publicUrl = env.PUBLIC_URL?.trim();
|
|
148
|
+
const sessionSecret = config.auth.sessionSecret;
|
|
149
|
+
if (!publicUrl || !sessionSecret || !resolveTransport) {
|
|
150
|
+
// The executor is disabled but the service still boots "healthy" — repo-operating steps
|
|
151
|
+
// (coder/mocker/tester/blueprints/ci-fixer/conflict-resolver/merger) then fail only at
|
|
152
|
+
// dispatch, deep in a request, with no boot signal. Emit a greppable line naming exactly
|
|
153
|
+
// which prerequisite is missing so the gap is visible up front (error-message coverage A5).
|
|
154
|
+
const missing = missingContainerExecutorPrereqs({
|
|
155
|
+
publicUrl,
|
|
156
|
+
sessionSecret,
|
|
157
|
+
hasRunnerBackend: !!resolveTransport,
|
|
158
|
+
});
|
|
159
|
+
logger.warn({ missing, docsUrl: DOCS.envVars(ENV_VARS_ANCHORS.coreServiceNetworking) }, `container agent steps are DISABLED: missing ${missing.join(', ')}. Repo-operating steps ` +
|
|
160
|
+
`(coder/mocker/tester/merger/…) will fail at dispatch until configured. See ` +
|
|
161
|
+
`${DOCS.envVars(ENV_VARS_ANCHORS.coreServiceNetworking)}.`);
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
// Token source: an explicit override (e.g. a static PAT in local mode) wins; else
|
|
165
|
+
// the GitHub App registry mints a per-installation token (when the App is configured).
|
|
166
|
+
const baseMint = mintInstallationTokenOverride ??
|
|
167
|
+
(appRegistry ? (id) => appRegistry.installationToken(id) : undefined);
|
|
168
|
+
if (!baseMint) {
|
|
169
|
+
// Every other prerequisite is set but there is no GitHub token source, so the harness
|
|
170
|
+
// could never clone/push. Name the fix (App creds) rather than disabling silently (A5).
|
|
171
|
+
logger.warn({ missing: ['GITHUB_APP_ID + GITHUB_APP_PRIVATE_KEY'], docsUrl: DOCS.githubOperations() }, `container agent steps are DISABLED: no GitHub token source — set GITHUB_APP_ID + ` +
|
|
172
|
+
`GITHUB_APP_PRIVATE_KEY so the harness can mint a push/clone token. Repo-operating steps ` +
|
|
173
|
+
`will fail at dispatch until configured. See ${DOCS.githubOperations()}.`);
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
// Prefer the run initiator's per-user PAT (when stored) over the App/env token, so
|
|
177
|
+
// pushes/PRs are attributed to them. Falls back to the base mint otherwise.
|
|
178
|
+
const mintInstallationToken = async (installationId, ctx) => {
|
|
179
|
+
if (resolveUserGitHubToken && ctx?.initiatedBy) {
|
|
180
|
+
const pat = await resolveUserGitHubToken(ctx.initiatedBy);
|
|
181
|
+
if (pat)
|
|
182
|
+
return pat;
|
|
183
|
+
}
|
|
184
|
+
return baseMint(installationId);
|
|
185
|
+
};
|
|
186
|
+
return new ContainerAgentExecutor({
|
|
187
|
+
resolveTransport,
|
|
188
|
+
agentRouting: config.agents.routing,
|
|
189
|
+
resolveBlockModel: config.agents.resolveBlockModel,
|
|
190
|
+
resolveWorkspaceModelDefault,
|
|
191
|
+
resolveRepoTarget,
|
|
192
|
+
// Multi-repo coding (service-connections phase 3): the implementer fans a cross-service
|
|
193
|
+
// change out across the task's own repo + each connected involved-service repo.
|
|
194
|
+
resolveRepoTargets,
|
|
195
|
+
...(resolveAccountId ? { resolveAccountId } : {}),
|
|
196
|
+
mintInstallationToken,
|
|
197
|
+
// Ensure the shared per-task work branch up front so every agent (including the
|
|
198
|
+
// read-only architect) operates on the same branch — idempotent, best-effort. Writers
|
|
199
|
+
// create it from base; read-only agents only probe (`options.create`).
|
|
200
|
+
ensureWorkBranch: async (repo, branch, options) => ensureWorkBranchViaRest({
|
|
201
|
+
...(config.github.apiBase ? { apiBase: config.github.apiBase } : {}),
|
|
202
|
+
token: await mintInstallationToken(repo.installationId),
|
|
203
|
+
owner: repo.owner,
|
|
204
|
+
name: repo.name,
|
|
205
|
+
baseBranch: repo.baseBranch,
|
|
206
|
+
branch,
|
|
207
|
+
create: options.create,
|
|
208
|
+
}),
|
|
209
|
+
sessionService: new ContainerSessionService({ secret: sessionSecret }),
|
|
210
|
+
// The subscription harnesses (Claude Code / Codex) lease a pooled token and
|
|
211
|
+
// attribute usage back for usage-aware rotation; absent ⇒ those harnesses are
|
|
212
|
+
// unavailable and a subscription-only model fails loudly at dispatch.
|
|
213
|
+
...(subscriptions
|
|
214
|
+
? {
|
|
215
|
+
leaseSubscriptionToken: (workspaceId, vendor) => subscriptions.leaseToken(workspaceId, vendor),
|
|
216
|
+
recordSubscriptionUsage: (workspaceId, tokenId, usage) => subscriptions.recordTokenUsage(workspaceId, tokenId, usage),
|
|
217
|
+
hasSubscriptionToken: (workspaceId, vendor) => subscriptions.hasToken(workspaceId, vendor),
|
|
218
|
+
}
|
|
219
|
+
: {}),
|
|
220
|
+
// Per-call telemetry for the subscription harnesses (proxy-bypassing), recorded
|
|
221
|
+
// into `llm_call_metrics` alongside the proxy-metered Pi rows.
|
|
222
|
+
...(recordHarnessCalls ? { recordHarnessCalls } : {}),
|
|
223
|
+
// Modeled subscription quota-cycle tracking (Part B): fold a finished subscription
|
|
224
|
+
// run's tokens into the rolling windows, for BOTH pooled and personal runs.
|
|
225
|
+
...(recordSubscriptionQuotaUsage ? { recordSubscriptionQuotaUsage } : {}),
|
|
226
|
+
// Individual-usage harnesses (Claude) lease the run-initiator's OWN activated
|
|
227
|
+
// personal credential; absent ⇒ such models fail loudly at dispatch.
|
|
228
|
+
...(personalSubscriptions
|
|
229
|
+
? {
|
|
230
|
+
leasePersonalSubscriptionToken: (executionId, userId, vendor) => personalSubscriptions.leaseForRun(executionId, userId, vendor),
|
|
231
|
+
// Route a dual-mode individual model (GLM) to the initiator's own subscription
|
|
232
|
+
// when they have one; otherwise dispatch keeps it on the Cloudflare base.
|
|
233
|
+
hasPersonalSubscription: (userId, vendor) => personalSubscriptions.has(userId, vendor),
|
|
234
|
+
}
|
|
235
|
+
: {}),
|
|
236
|
+
// Native local execution (local facade, opt-in): run subscription-harness agents with
|
|
237
|
+
// the developer's OWN installed CLI + ambient login instead of leasing a credential.
|
|
238
|
+
// Ambient auth applies ONLY when the resolved harness is in the allow-list AND the
|
|
239
|
+
// vendor is that CLI's NATIVE vendor (no Anthropic-compatible base URL of its own:
|
|
240
|
+
// `claude` / `codex`). A non-native vendor reusing the `claude-code` harness
|
|
241
|
+
// (GLM/Kimi/DeepSeek carries its own `baseUrl`) is leased normally — otherwise ambient
|
|
242
|
+
// auth would silently drop that base URL and run the step on the developer's own
|
|
243
|
+
// Anthropic login instead of the pinned vendor.
|
|
244
|
+
...(config.nativeAmbientAuth && config.nativeAmbientAuth.length > 0
|
|
245
|
+
? {
|
|
246
|
+
// The allow-list + no-`baseUrl` check is the shared `isAmbientNativeVendor`
|
|
247
|
+
// predicate (so this can't drift from the personal-credential gate); the extra
|
|
248
|
+
// `harness === h` guard ensures the RESOLVED harness matches the vendor's own.
|
|
249
|
+
nativeAmbientAuth: (h, vendor) => vendor !== undefined &&
|
|
250
|
+
SUBSCRIPTION_VENDORS[vendor].harness === h &&
|
|
251
|
+
isAmbientNativeVendor(config.nativeAmbientAuth, vendor),
|
|
252
|
+
}
|
|
253
|
+
: {}),
|
|
254
|
+
proxyBaseUrl: `${publicUrl.replace(/\/+$/, '')}/v1`,
|
|
255
|
+
// Point container agents' web search at the backend search proxy (no provider key in
|
|
256
|
+
// the sandbox), but only for a run whose account has keys (resolved per run — see the
|
|
257
|
+
// call site), so the tool is never advertised to a run where it would just fail.
|
|
258
|
+
...(resolveWebSearchAvailability ? { resolveWebSearchAvailability } : {}),
|
|
259
|
+
// Decrypt the workspace's private-registry entries onto the job body (rendered by
|
|
260
|
+
// the harness into ~/.npmrc), so private dependencies resolve on install.
|
|
261
|
+
...(resolvePackageRegistries ? { resolvePackageRegistries } : {}),
|
|
262
|
+
// Decrypt the service frame's SENSITIVE test credentials onto the tester job body (out of
|
|
263
|
+
// band — injected as container env vars by the harness, never in the prompt/telemetry).
|
|
264
|
+
...(resolveTestSecrets ? { resolveTestSecrets } : {}),
|
|
265
|
+
githubApiBase: config.github.apiBase,
|
|
266
|
+
// Resolve the clone URL + provider per repo. The local GitLab facade injects a GitLab
|
|
267
|
+
// origin so containers clone gitlab.com (or a self-managed host) and open MRs; absent ⇒
|
|
268
|
+
// the default github.com origin.
|
|
269
|
+
...(resolveRepoOrigin ? { resolveRepoOrigin } : {}),
|
|
270
|
+
// Forward container tool spans to the external trace sink(s) (Langfuse and/or OTLP)
|
|
271
|
+
// grouped under the run trace — the same sink the LLM proxy fans generations to.
|
|
272
|
+
// (Langfuse nests them as children; the OTLP exporter groups them by shared trace id.)
|
|
273
|
+
llmTraceSink: buildTraceSink(config),
|
|
274
|
+
// Record the complete provided context per dispatch (best-effort, gated in the sink).
|
|
275
|
+
...(agentContextObservability ? { agentContextObservability } : {}),
|
|
276
|
+
agentKindRegistry,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Build the repo bootstrapper (the "bootstrap repo" container dispatch) when its
|
|
281
|
+
* prerequisites are configured — mirroring the Worker's `selectRepoBootstrapper` and
|
|
282
|
+
* the container-executor prerequisites: a resolvable runner transport, the public URL
|
|
283
|
+
* + session secret backing the LLM proxy, a token source, and a GitHub client.
|
|
284
|
+
* Returns undefined otherwise (the bootstrap module then has no runner and the service
|
|
285
|
+
* reports a clean dispatch failure). Bootstrap is an `architect`-kind run, so it
|
|
286
|
+
* follows that kind's routing. The promoted `ContainerRepoBootstrapper` dispatches
|
|
287
|
+
* through the same shared runner seam the container executor uses, so on Node it runs
|
|
288
|
+
* against the self-hosted pool and on local against the per-job Docker container.
|
|
289
|
+
*/
|
|
290
|
+
export function selectNodeRepoBootstrapper(deps) {
|
|
291
|
+
const publicUrl = deps.env.PUBLIC_URL?.trim();
|
|
292
|
+
const sessionSecret = deps.config.auth.sessionSecret;
|
|
293
|
+
if (!deps.resolveTransport ||
|
|
294
|
+
!publicUrl ||
|
|
295
|
+
!sessionSecret ||
|
|
296
|
+
!deps.githubClient ||
|
|
297
|
+
!deps.mintInstallationToken) {
|
|
298
|
+
return undefined;
|
|
299
|
+
}
|
|
300
|
+
return new ContainerRepoBootstrapper({
|
|
301
|
+
resolveTransport: deps.resolveTransport,
|
|
302
|
+
installationRepository: deps.installationRepository,
|
|
303
|
+
bootstrapJobRepository: deps.bootstrapJobRepository,
|
|
304
|
+
repoRepository: deps.repoRepository,
|
|
305
|
+
...(deps.repoProjectionCache ? { repoProjectionCache: deps.repoProjectionCache } : {}),
|
|
306
|
+
githubClient: deps.githubClient,
|
|
307
|
+
mintInstallationToken: deps.mintInstallationToken,
|
|
308
|
+
sessionService: new ContainerSessionService({ secret: sessionSecret }),
|
|
309
|
+
model: resolveAgentConfig(deps.config.agents.routing, 'architect').ref,
|
|
310
|
+
proxyBaseUrl: `${publicUrl.replace(/\/+$/, '')}/v1`,
|
|
311
|
+
githubApiBase: deps.config.github.apiBase,
|
|
312
|
+
// The scaffolder installs dependencies too — forward the workspace's
|
|
313
|
+
// private-registry entries exactly as the implementation executor does.
|
|
314
|
+
...(deps.resolvePackageRegistries
|
|
315
|
+
? { resolvePackageRegistries: deps.resolvePackageRegistries }
|
|
316
|
+
: {}),
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Build the live ENVIRONMENT-PROVIDER CONFIG REPAIR agent (PR #416 increment 2) when its
|
|
321
|
+
* prerequisites are met — the same container prerequisites as the bootstrapper PLUS a
|
|
322
|
+
* registered backend that supports agent repair (`describeRepairAgent`). The stock manifest
|
|
323
|
+
* provider has no repair support, so this stays undefined there; it wires only when a custom
|
|
324
|
+
* backend registered into the env-backend registry implements repair (so local inherits it
|
|
325
|
+
* too). NOT the repo bootstrapper: an ordinary clone→edit→push coding job, no history reset.
|
|
326
|
+
*/
|
|
327
|
+
export function selectNodeEnvConfigRepairer(deps) {
|
|
328
|
+
const publicUrl = deps.env.PUBLIC_URL?.trim();
|
|
329
|
+
const sessionSecret = deps.config.auth.sessionSecret;
|
|
330
|
+
// Prefer the internal override (the conformance suite's fake repair provider), else scan
|
|
331
|
+
// the env-backend registry for the first repair-capable backend. Built-ins don't support
|
|
332
|
+
// repair, so this is undefined on a stock deployment; a third-party backend wires it.
|
|
333
|
+
const repairUrlPolicy = resolveUrlSafetyPolicy(deps.config.environments);
|
|
334
|
+
const environmentProvider = !deps.resolveTransport
|
|
335
|
+
? undefined
|
|
336
|
+
: (deps.override ??
|
|
337
|
+
deps.environmentBackendRegistry.findRepairCapable(repairUrlPolicy ? { urlPolicy: repairUrlPolicy } : {}));
|
|
338
|
+
if (!deps.resolveTransport ||
|
|
339
|
+
!publicUrl ||
|
|
340
|
+
!sessionSecret ||
|
|
341
|
+
!deps.mintInstallationToken ||
|
|
342
|
+
!environmentProvider ||
|
|
343
|
+
typeof environmentProvider.describeRepairAgent !== 'function') {
|
|
344
|
+
return undefined;
|
|
345
|
+
}
|
|
346
|
+
// A config fix is coding work, so it follows the `coder` kind's routing. The repair runs on
|
|
347
|
+
// the Pi harness over the LLM proxy, so the routed model MUST be proxyable. Surface a
|
|
348
|
+
// misconfiguration HERE (at wiring) rather than letting every repair dispatch throw deep in a
|
|
349
|
+
// request: if `coder` is routed to a non-proxyable model (e.g. an individual subscription
|
|
350
|
+
// vendor), leave the fallback unwired — bootstrap then returns the validation issues, exactly
|
|
351
|
+
// as it does when no provider supports repair.
|
|
352
|
+
const model = resolveAgentConfig(deps.config.agents.routing, 'coder').ref;
|
|
353
|
+
if (!isProxyableProvider(model.provider)) {
|
|
354
|
+
logger.warn({ provider: model.provider }, 'env-config repair: the coder routing model is not proxyable by the LLM proxy; ' +
|
|
355
|
+
'the agent config-repair fallback is disabled.');
|
|
356
|
+
return undefined;
|
|
357
|
+
}
|
|
358
|
+
return new ContainerEnvConfigRepairer({
|
|
359
|
+
resolveTransport: deps.resolveTransport,
|
|
360
|
+
installationRepository: deps.installationRepository,
|
|
361
|
+
mintInstallationToken: deps.mintInstallationToken,
|
|
362
|
+
sessionService: new ContainerSessionService({ secret: sessionSecret }),
|
|
363
|
+
environmentProvider,
|
|
364
|
+
model,
|
|
365
|
+
proxyBaseUrl: `${publicUrl.replace(/\/+$/, '')}/v1`,
|
|
366
|
+
githubApiBase: deps.config.github.apiBase,
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Build the GitHub-issue tracker filer for the tech-debt pipeline when the GitHub
|
|
371
|
+
* App is configured. It resolves the service's repo from the workspace's
|
|
372
|
+
* `github_repos` projection and mints a short-lived token from that workspace's OWN
|
|
373
|
+
* App installation (per-tenant) — the same infra the container executor uses — then
|
|
374
|
+
* files the issue via the token. Returns undefined when the App isn't configured (the
|
|
375
|
+
* GitHub tracker then passes through). A run whose service isn't linked to a repo
|
|
376
|
+
* resolves to null (a clean pass-through, not a run failure).
|
|
377
|
+
*/
|
|
378
|
+
export function buildNodeGitHubIssueFiler(config, registry, resolveRepoTarget) {
|
|
379
|
+
if (!registry)
|
|
380
|
+
return undefined;
|
|
381
|
+
return async (request) => {
|
|
382
|
+
let repo;
|
|
383
|
+
try {
|
|
384
|
+
repo = await resolveRepoTarget(request.workspaceId, request.frameId);
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
// The service isn't linked to a repo — nothing to file against; pass through.
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
390
|
+
if (!repo)
|
|
391
|
+
return null;
|
|
392
|
+
const token = await registry.installationToken(repo.installationId);
|
|
393
|
+
const issue = await createGitHubIssueViaToken({
|
|
394
|
+
fetchImpl: fetch,
|
|
395
|
+
token,
|
|
396
|
+
owner: repo.owner,
|
|
397
|
+
repo: repo.name,
|
|
398
|
+
title: request.title,
|
|
399
|
+
body: request.body,
|
|
400
|
+
apiBase: config.github.apiBase,
|
|
401
|
+
});
|
|
402
|
+
return { externalId: `${repo.owner}/${repo.name}#${issue.number}`, url: issue.url };
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
//# sourceMappingURL=container-executor-deps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container-executor-deps.js","sourceRoot":"","sources":["../src/container-executor-deps.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,+FAA+F;AAC/F,kFAAkF;AAClF,0FAA0F;AAC1F,+FAA+F;AAC/F,sFAAsF;AACtF,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAE7E,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,2BAA2B,CAAA;AAMlC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAcpG,OAAO,EACL,gCAAgC,GAGjC,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,EAQL,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,IAAI,EACJ,gBAAgB,EAChB,uBAAuB,EACvB,MAAM,EACN,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,qBAAqB,CAAA;AAE5B,iFAAiF;AACjF,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;AAExD,2FAA2F;AAC3F,yFAAyF;AAC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,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO;SAC/B,CAAC,CAAA;QACF,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAA;IACrF,CAAC,CAAA;AACH,CAAC"}
|
package/dist/container.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AgentKindRegistry } from '@cat-factory/agents';
|
|
2
|
-
import { type BackendRegistries, type
|
|
3
|
-
import { type
|
|
2
|
+
import { type BackendRegistries, type DeployJobClient } from '@cat-factory/integrations';
|
|
3
|
+
import { type DeployCloneTarget, type GitHubClient, type GitHubInstallationRepository, type LocalModelEndpointRepository, type ModelProviderResolver, type PersonalSubscriptionRepository, type SubscriptionVendor, type ProviderApiKeyRepository, type ProviderSubscriptionTokenRepository, type RunnerPoolProvider, type SubscriptionActivationRepository } from '@cat-factory/kernel';
|
|
4
4
|
import { type CoreDependencies, type GateRegistry, type StepResolverRegistry } from '@cat-factory/orchestration';
|
|
5
5
|
import { type AppConfig, type ResolveRepoOrigin, type ResolveRunnerTransport, type ServerContainer } from '@cat-factory/server';
|
|
6
6
|
import { type GateProviderOverrides } from '@cat-factory/gates';
|
|
@@ -10,6 +10,7 @@ import type { DrizzleDb } from './db/client.js';
|
|
|
10
10
|
import { type LocalEventSink } from './realtime.js';
|
|
11
11
|
import { createDrizzleRepositories } from './repositories/drizzle.js';
|
|
12
12
|
import type { ContentStorageBackend } from '@cat-factory/contracts';
|
|
13
|
+
export { buildNodeResolveTransport, missingContainerExecutorPrereqs, withProvisioningLog, } from './container-executor-deps.js';
|
|
13
14
|
/**
|
|
14
15
|
* Source one org/durable repository that a standard build constructs directly from the Drizzle
|
|
15
16
|
* `db`. In mothership mode (no Postgres) `remote` is the full-surface remote registry — a
|
|
@@ -336,25 +337,6 @@ export interface NodeContainerOptions {
|
|
|
336
337
|
* when runner pools are not enabled. Mirrors the Worker's `buildResolveTransport`,
|
|
337
338
|
* minus the Cloudflare-container path.
|
|
338
339
|
*/
|
|
339
|
-
export declare function buildNodeResolveTransport(config: AppConfig, runnerPoolConnectionRepository: RunnerPoolConnectionRepository, workspaceRepository: CoreDependencies['workspaceRepository'], clock: Clock, runnerBackendRegistry: RunnerBackendRegistry, injectedPoolProvider?: RunnerPoolProvider): ResolveRunnerTransport | null;
|
|
340
|
-
/**
|
|
341
|
-
* Wrap a transport resolver so every dispatch/release/poll-failure appends a
|
|
342
|
-
* provisioning-log event. A no-op when there's no resolver. `subsystem` tags the
|
|
343
|
-
* rows (a self-hosted pool vs a per-run container) so the logs drawer can filter.
|
|
344
|
-
*/
|
|
345
|
-
export declare function withProvisioningLog(resolve: ResolveRunnerTransport | null, recorder: ProvisioningLogRecorder, subsystem: ProvisioningSubsystem): ResolveRunnerTransport | null;
|
|
346
|
-
/**
|
|
347
|
-
* Which of the container-executor prerequisites are missing, as the human labels the boot
|
|
348
|
-
* warning names. Empty ⇒ all three are present. `PUBLIC_URL` is this service's externally
|
|
349
|
-
* reachable base backing the LLM proxy, `AUTH_SESSION_SECRET` signs the harness↔proxy tokens,
|
|
350
|
-
* and a runner backend is what a dispatch is handed to. Pure so the "name exactly what's
|
|
351
|
-
* missing" logic is unit-tested (error-message coverage A5).
|
|
352
|
-
*/
|
|
353
|
-
export declare function missingContainerExecutorPrereqs(input: {
|
|
354
|
-
publicUrl: string | undefined;
|
|
355
|
-
sessionSecret: string | undefined;
|
|
356
|
-
hasRunnerBackend: boolean;
|
|
357
|
-
}): string[];
|
|
358
340
|
/**
|
|
359
341
|
* The Node composition root: assemble the framework-agnostic domain `Core` with
|
|
360
342
|
* Drizzle/Postgres repositories + Node implementations of the runtime ports, then
|
|
@@ -369,5 +351,4 @@ export declare function missingContainerExecutorPrereqs(input: {
|
|
|
369
351
|
* composite still serves inline kinds but fails container kinds loudly.
|
|
370
352
|
*/
|
|
371
353
|
export declare function buildNodeContainer(options: NodeContainerOptions): ServerContainer;
|
|
372
|
-
export {};
|
|
373
354
|
//# sourceMappingURL=container.d.ts.map
|
package/dist/container.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../src/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EAKvB,MAAM,qBAAqB,CAAA;AAO5B,OAAO,EAUL,KAAK,iBAAiB,EAwBtB,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,EAE1B,KAAK,8BAA8B,EACnC,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,mCAAmC,EAIxC,KAAK,kBAAkB,EACvB,KAAK,gCAAgC,EAQtC,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAGL,KAAK,gBAAgB,EAGrB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAM1B,MAAM,4BAA4B,CAAA;AACnC,OAAO,EACL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EAuCrB,MAAM,qBAAqB,CAAA;AAI5B,OAAO,EACL,KAAK,qBAAqB,EAU3B,MAAM,oBAAoB,CAAA;AAO3B,OAAO,KAAK,EACV,SAAS,EACT,wBAAwB,EACxB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAEhB,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBA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