@cat-factory/orchestration 0.277.1 → 0.279.0
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/dependencies.d.ts +2 -6
- package/dist/container/dependencies.d.ts.map +1 -1
- package/dist/container.d.ts +10 -1
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +1 -0
- package/dist/container.js.map +1 -1
- package/dist/modules/execution/AgentContextBuilder.d.ts.map +1 -1
- package/dist/modules/execution/AgentContextBuilder.js +3 -0
- package/dist/modules/execution/AgentContextBuilder.js.map +1 -1
- package/dist/modules/execution/RunAdmission.d.ts +9 -0
- package/dist/modules/execution/RunAdmission.d.ts.map +1 -1
- package/dist/modules/execution/RunAdmission.js +26 -5
- package/dist/modules/execution/RunAdmission.js.map +1 -1
- package/dist/modules/execution/run-catalog-context.d.ts +20 -11
- package/dist/modules/execution/run-catalog-context.d.ts.map +1 -1
- package/dist/modules/execution/run-catalog-context.js +19 -17
- package/dist/modules/execution/run-catalog-context.js.map +1 -1
- package/dist/modules/execution/run-foundational-credentials.d.ts +32 -0
- package/dist/modules/execution/run-foundational-credentials.d.ts.map +1 -0
- package/dist/modules/execution/run-foundational-credentials.js +58 -0
- package/dist/modules/execution/run-foundational-credentials.js.map +1 -0
- package/dist/modules/execution/run-foundational-services.d.ts +13 -1
- package/dist/modules/execution/run-foundational-services.d.ts.map +1 -1
- package/dist/modules/execution/run-foundational-services.js.map +1 -1
- package/dist/modules/sandbox/SandboxRunService.d.ts +6 -1
- package/dist/modules/sandbox/SandboxRunService.d.ts.map +1 -1
- package/dist/modules/sandbox/SandboxRunService.js +34 -27
- package/dist/modules/sandbox/SandboxRunService.js.map +1 -1
- package/dist/modules/sandbox/SandboxService.d.ts +26 -3
- package/dist/modules/sandbox/SandboxService.d.ts.map +1 -1
- package/dist/modules/sandbox/SandboxService.js +81 -19
- package/dist/modules/sandbox/SandboxService.js.map +1 -1
- package/dist/modules/sandbox/sandbox-input.d.ts +16 -0
- package/dist/modules/sandbox/sandbox-input.d.ts.map +1 -0
- package/dist/modules/sandbox/sandbox-input.js +274 -0
- package/dist/modules/sandbox/sandbox-input.js.map +1 -0
- package/dist/modules/sandbox/sandbox.logic.d.ts +0 -8
- package/dist/modules/sandbox/sandbox.logic.d.ts.map +1 -1
- package/dist/modules/sandbox/sandbox.logic.js +4 -48
- package/dist/modules/sandbox/sandbox.logic.js.map +1 -1
- package/dist/modules/sandbox/sandboxAdmission.d.ts +36 -0
- package/dist/modules/sandbox/sandboxAdmission.d.ts.map +1 -0
- package/dist/modules/sandbox/sandboxAdmission.js +83 -0
- package/dist/modules/sandbox/sandboxAdmission.js.map +1 -0
- package/dist/validation/validateBinaryGenerators.d.ts +11 -6
- package/dist/validation/validateBinaryGenerators.d.ts.map +1 -1
- package/dist/validation/validateBinaryGenerators.js +13 -13
- package/dist/validation/validateBinaryGenerators.js.map +1 -1
- package/dist/validation/validateRegistrations.d.ts.map +1 -1
- package/dist/validation/validateRegistrations.js +100 -1
- package/dist/validation/validateRegistrations.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentKindRegistry } from '@cat-factory/agents';
|
|
2
2
|
import type { PipelineStep } from '@cat-factory/contracts';
|
|
3
|
-
import type { BinaryGeneratorSource, ExecutionInstance, InjectedContextFile, Logger, ResolvedBinaryGenerator } from '@cat-factory/kernel';
|
|
3
|
+
import type { BinaryGeneratorSource, ExecutionInstance, InjectedContextFile, Logger, ResolvedBinaryGenerator, ResolvedServiceCredentials } from '@cat-factory/kernel';
|
|
4
4
|
import { type FoundationalServiceResolver } from './run-foundational-services.js';
|
|
5
5
|
/**
|
|
6
6
|
* Everything one dispatch takes from the CATALOG side, as {@link CatalogRunContext.sliceFor}
|
|
@@ -11,6 +11,12 @@ export interface CatalogRunSlice {
|
|
|
11
11
|
foundationalContextFiles: InjectedContextFile[];
|
|
12
12
|
binaryOutputContextFiles: InjectedContextFile[];
|
|
13
13
|
binaryGenerators: ResolvedBinaryGenerator[];
|
|
14
|
+
/**
|
|
15
|
+
* The credential DECLARATIONS of every catalog service this dispatch was briefed on: the key
|
|
16
|
+
* names the container executor resolves values for onto the job body. Empty when nothing this
|
|
17
|
+
* dispatch reads or writes through needs authenticating, which is the ordinary case.
|
|
18
|
+
*/
|
|
19
|
+
foundationalCredentials: ResolvedServiceCredentials[];
|
|
14
20
|
/**
|
|
15
21
|
* The catalog service this dispatch stores through, when it was briefed to store anything.
|
|
16
22
|
* Pure (no I/O) and derived from the same trait gate as the two reads above, so it rides the
|
|
@@ -41,25 +47,28 @@ export declare class CatalogRunContext {
|
|
|
41
47
|
private readonly recordBinaryOutput;
|
|
42
48
|
constructor(deps: CatalogRunContextDeps);
|
|
43
49
|
/**
|
|
44
|
-
* ALL
|
|
45
|
-
* context read wave takes, so the builder holds a single wave slot rather than
|
|
50
|
+
* ALL FOUR catalog-backed reads of one dispatch, resolved concurrently — the ONE entry the
|
|
51
|
+
* context read wave takes, so the builder holds a single wave slot rather than four:
|
|
46
52
|
*
|
|
47
53
|
* - the FOUNDATIONAL SERVICES files (the catalog for a design kind, the declared services' API
|
|
48
54
|
* contracts for a consumer kind, nothing for anything else), read only from the steps BEFORE
|
|
49
55
|
* the one being dispatched so a re-dispatched design cannot read its own prior round;
|
|
50
56
|
* - the BINARY-OUTPUT brief for a kind carrying the trait, off the step's own selection;
|
|
51
57
|
* - the GENERATIVE INTEGRATIONS that selection names — the non-secret projection the container
|
|
52
|
-
* executor turns into credentials on the job body
|
|
58
|
+
* executor turns into credentials on the job body;
|
|
59
|
+
* - the CREDENTIAL declarations of every catalog service this dispatch was briefed on, which is
|
|
60
|
+
* the same projection one layer over: what authenticates the storage and context services,
|
|
61
|
+
* where the integrations' half authenticates what MAKES the artifact.
|
|
53
62
|
*
|
|
54
|
-
* They belong together rather than merely being adjacent: all
|
|
55
|
-
* collaborator, all
|
|
63
|
+
* They belong together rather than merely being adjacent: all four go through this
|
|
64
|
+
* collaborator, all four are BEST-EFFORT inside (each gap has a stated rendering — an
|
|
56
65
|
* `unavailable` catalog file, an absent brief the trait guidance already defines as "do not
|
|
57
|
-
* attempt any upload", no integrations to hand credentials for
|
|
58
|
-
*
|
|
59
|
-
* the
|
|
60
|
-
* others for nothing.
|
|
66
|
+
* attempt any upload", no integrations to hand credentials for, an unset variable the briefs
|
|
67
|
+
* define as "the platform could not provide it"), and on a mothership-mode node all four can
|
|
68
|
+
* cross the machine API. That last point is why the generative half belongs in the wave at all
|
|
69
|
+
* rather than after it, where it would serialise a round trip behind the others for nothing.
|
|
61
70
|
*
|
|
62
|
-
* Exposed as the WHOLE slice rather than
|
|
71
|
+
* Exposed as the WHOLE slice rather than four per-read methods, because the sharing below is
|
|
63
72
|
* only correct within one dispatch: a caller that could take the halves separately could take
|
|
64
73
|
* them at different times, which is the drift this collaborator exists to prevent.
|
|
65
74
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-catalog-context.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-catalog-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACN,uBAAuB,
|
|
1
|
+
{"version":3,"file":"run-catalog-context.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-catalog-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EACV,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACN,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,qBAAqB,CAAA;AAE5B,OAAO,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,CAEf;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { memoizeBinaryGeneratorViews } from '@cat-factory/kernel';
|
|
2
2
|
import { createFoundationalDeclarationRecorder, resolveFoundationalContext, } from './run-foundational-services.js';
|
|
3
|
+
import { dispatchFoundationalCredentialsFor } from './run-foundational-credentials.js';
|
|
3
4
|
import { createBinaryOutputDeclarationRecorder, dispatchBinaryGeneratorsFor, dispatchBinaryStorageFor, resolveBinaryOutputContext, } from './run-binary-output.js';
|
|
4
5
|
export class CatalogRunContext {
|
|
5
6
|
deps;
|
|
@@ -16,25 +17,28 @@ export class CatalogRunContext {
|
|
|
16
17
|
this.recordBinaryOutput = createBinaryOutputDeclarationRecorder(deps);
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
|
-
* ALL
|
|
20
|
-
* context read wave takes, so the builder holds a single wave slot rather than
|
|
20
|
+
* ALL FOUR catalog-backed reads of one dispatch, resolved concurrently — the ONE entry the
|
|
21
|
+
* context read wave takes, so the builder holds a single wave slot rather than four:
|
|
21
22
|
*
|
|
22
23
|
* - the FOUNDATIONAL SERVICES files (the catalog for a design kind, the declared services' API
|
|
23
24
|
* contracts for a consumer kind, nothing for anything else), read only from the steps BEFORE
|
|
24
25
|
* the one being dispatched so a re-dispatched design cannot read its own prior round;
|
|
25
26
|
* - the BINARY-OUTPUT brief for a kind carrying the trait, off the step's own selection;
|
|
26
27
|
* - the GENERATIVE INTEGRATIONS that selection names — the non-secret projection the container
|
|
27
|
-
* executor turns into credentials on the job body
|
|
28
|
+
* executor turns into credentials on the job body;
|
|
29
|
+
* - the CREDENTIAL declarations of every catalog service this dispatch was briefed on, which is
|
|
30
|
+
* the same projection one layer over: what authenticates the storage and context services,
|
|
31
|
+
* where the integrations' half authenticates what MAKES the artifact.
|
|
28
32
|
*
|
|
29
|
-
* They belong together rather than merely being adjacent: all
|
|
30
|
-
* collaborator, all
|
|
33
|
+
* They belong together rather than merely being adjacent: all four go through this
|
|
34
|
+
* collaborator, all four are BEST-EFFORT inside (each gap has a stated rendering — an
|
|
31
35
|
* `unavailable` catalog file, an absent brief the trait guidance already defines as "do not
|
|
32
|
-
* attempt any upload", no integrations to hand credentials for
|
|
33
|
-
*
|
|
34
|
-
* the
|
|
35
|
-
* others for nothing.
|
|
36
|
+
* attempt any upload", no integrations to hand credentials for, an unset variable the briefs
|
|
37
|
+
* define as "the platform could not provide it"), and on a mothership-mode node all four can
|
|
38
|
+
* cross the machine API. That last point is why the generative half belongs in the wave at all
|
|
39
|
+
* rather than after it, where it would serialise a round trip behind the others for nothing.
|
|
36
40
|
*
|
|
37
|
-
* Exposed as the WHOLE slice rather than
|
|
41
|
+
* Exposed as the WHOLE slice rather than four per-read methods, because the sharing below is
|
|
38
42
|
* only correct within one dispatch: a caller that could take the halves separately could take
|
|
39
43
|
* them at different times, which is the drift this collaborator exists to prevent.
|
|
40
44
|
*
|
|
@@ -53,21 +57,19 @@ export class CatalogRunContext {
|
|
|
53
57
|
binaryGeneratorSource: memoizeBinaryGeneratorViews(this.deps.binaryGeneratorSource),
|
|
54
58
|
}
|
|
55
59
|
: this.deps;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
workspaceId,
|
|
60
|
-
agentKind,
|
|
61
|
-
priorSteps: instance.steps.slice(0, instance.currentStep),
|
|
62
|
-
}),
|
|
60
|
+
const priorSteps = instance.steps.slice(0, instance.currentStep);
|
|
61
|
+
const [foundationalContextFiles, binaryOutputContextFiles, binaryGenerators, foundationalCredentials,] = await Promise.all([
|
|
62
|
+
resolveFoundationalContext({ ...deps, workspaceId, agentKind, priorSteps }),
|
|
63
63
|
resolveBinaryOutputContext({ ...deps, workspaceId, agentKind, step }),
|
|
64
64
|
dispatchBinaryGeneratorsFor({ ...deps, agentKind, step }),
|
|
65
|
+
dispatchFoundationalCredentialsFor({ ...deps, workspaceId, agentKind, step, priorSteps }),
|
|
65
66
|
]);
|
|
66
67
|
const binaryStorageServiceId = dispatchBinaryStorageFor({ ...deps, agentKind, step });
|
|
67
68
|
return {
|
|
68
69
|
foundationalContextFiles,
|
|
69
70
|
binaryOutputContextFiles,
|
|
70
71
|
binaryGenerators,
|
|
72
|
+
foundationalCredentials,
|
|
71
73
|
...(binaryStorageServiceId ? { binaryStorageServiceId } : {}),
|
|
72
74
|
};
|
|
73
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-catalog-context.js","sourceRoot":"","sources":["../../../src/modules/execution/run-catalog-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-catalog-context.js","sourceRoot":"","sources":["../../../src/modules/execution/run-catalog-context.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,EAGL,qCAAqC,EACrC,0BAA0B,GAC3B,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,kCAAkC,EAAE,MAAM,mCAAmC,CAAA;AACtF,OAAO,EAEL,qCAAqC,EACrC,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAA;AAgD/B,MAAM,OAAO,iBAAiB;IASC,IAAI;IARjC;;;;OAIG;IACc,kBAAkB,CAAiC;IACnD,kBAAkB,CAAiC;IAEpE,YAA6B,IAA2B;oBAA3B,IAAI;QAC/B,IAAI,CAAC,kBAAkB,GAAG,qCAAqC,CAAC,IAAI,CAAC,CAAA;QACrE,IAAI,CAAC,kBAAkB,GAAG,qCAAqC,CAAC,IAAI,CAAC,CAAA;IACvE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,KAAK,CAAC,QAAQ,CACZ,WAAmB,EACnB,SAAiB,EACjB,IAAkB,EAClB,QAA2B;QAE3B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAqB;YAC1C,CAAC,CAAC;gBACE,GAAG,IAAI,CAAC,IAAI;gBACZ,qBAAqB,EAAE,2BAA2B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,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,CAAA;IAC3D,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AgentKindRegistry } from '@cat-factory/agents';
|
|
2
|
+
import type { PipelineStep } from '@cat-factory/contracts';
|
|
3
|
+
import type { AgentKind, Logger, ResolvedServiceCredentials } from '@cat-factory/kernel';
|
|
4
|
+
import { type FoundationalServiceResolver } from './run-foundational-services.js';
|
|
5
|
+
export interface DispatchFoundationalCredentialsInput {
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
/** The EFFECTIVE dispatched kind (a gate helper dispatches its own kind, not the step's). */
|
|
8
|
+
agentKind: AgentKind;
|
|
9
|
+
agentKindRegistry: AgentKindRegistry;
|
|
10
|
+
/** The step being dispatched: its `stepOptions.binaryOutput` is the generating selection. */
|
|
11
|
+
step: PipelineStep;
|
|
12
|
+
/** The run's steps BEFORE this one, newest-last, where a design step's declaration lives. */
|
|
13
|
+
priorSteps: PipelineStep[];
|
|
14
|
+
foundationalServiceResolver?: FoundationalServiceResolver;
|
|
15
|
+
logger?: Logger;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The foundational services this dispatch was BRIEFED on, so it may be given their credentials.
|
|
19
|
+
*
|
|
20
|
+
* Gated on the same traits as the two injected-file reads, and that pairing is the whole safety
|
|
21
|
+
* property: a credential is delivered only for a service whose contract the agent was also handed.
|
|
22
|
+
* The alternative in either direction is a defect. Credentials with no brief put a live secret in
|
|
23
|
+
* a process that was never told the service exists; a brief with no credentials is the state this
|
|
24
|
+
* function was added to end.
|
|
25
|
+
*
|
|
26
|
+
* The two id sets are unioned rather than chosen between, because one kind can carry both traits:
|
|
27
|
+
* a generating step that also consumes a prior design's declared services reads two catalogs'
|
|
28
|
+
* worth of contracts in one dispatch, and dropping either half would leave one of them
|
|
29
|
+
* unauthenticated for a reason no layer states.
|
|
30
|
+
*/
|
|
31
|
+
export declare function dispatchFoundationalCredentialsFor(input: DispatchFoundationalCredentialsInput): Promise<ResolvedServiceCredentials[]>;
|
|
32
|
+
//# sourceMappingURL=run-foundational-credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-foundational-credentials.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAExF,OAAO,EAAqB,KAAK,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAmBpG,MAAM,WAAW,oCAAoC;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,6FAA6F;IAC7F,SAAS,EAAE,SAAS,CAAA;IACpB,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,6FAA6F;IAC7F,IAAI,EAAE,YAAY,CAAA;IAClB,6FAA6F;IAC7F,UAAU,EAAE,YAAY,EAAE,CAAA;IAC1B,2BAA2B,CAAC,EAAE,2BAA2B,CAAA;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kCAAkC,CACtD,KAAK,EAAE,oCAAoC,GAC1C,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAiBvC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { BINARY_OUTPUT_TRAIT, FOUNDATIONAL_CONTRACTS_TRAIT, hasTrait } from '@cat-factory/agents';
|
|
2
|
+
import { noopLogger, runBestEffort } from '@cat-factory/kernel';
|
|
3
|
+
import { declaredSelection } from './run-foundational-services.js';
|
|
4
|
+
/**
|
|
5
|
+
* The foundational services this dispatch was BRIEFED on, so it may be given their credentials.
|
|
6
|
+
*
|
|
7
|
+
* Gated on the same traits as the two injected-file reads, and that pairing is the whole safety
|
|
8
|
+
* property: a credential is delivered only for a service whose contract the agent was also handed.
|
|
9
|
+
* The alternative in either direction is a defect. Credentials with no brief put a live secret in
|
|
10
|
+
* a process that was never told the service exists; a brief with no credentials is the state this
|
|
11
|
+
* function was added to end.
|
|
12
|
+
*
|
|
13
|
+
* The two id sets are unioned rather than chosen between, because one kind can carry both traits:
|
|
14
|
+
* a generating step that also consumes a prior design's declared services reads two catalogs'
|
|
15
|
+
* worth of contracts in one dispatch, and dropping either half would leave one of them
|
|
16
|
+
* unauthenticated for a reason no layer states.
|
|
17
|
+
*/
|
|
18
|
+
export async function dispatchFoundationalCredentialsFor(input) {
|
|
19
|
+
const resolver = input.foundationalServiceResolver;
|
|
20
|
+
if (!resolver)
|
|
21
|
+
return [];
|
|
22
|
+
const ids = briefedServiceIds(input);
|
|
23
|
+
if (ids.length === 0)
|
|
24
|
+
return [];
|
|
25
|
+
// BEST-EFFORT, and the degraded state is one the agent already understands: an unresolved
|
|
26
|
+
// credential is an unset variable, which every brief on this seam defines as "the platform
|
|
27
|
+
// could not provide it — report the gap rather than calling the service". Failing the dispatch
|
|
28
|
+
// instead would turn an unreachable catalog into a run that produces nothing and explains
|
|
29
|
+
// nothing, where one that runs and NAMES what it could not reach is strictly more useful.
|
|
30
|
+
const resolved = await runBestEffort(input.logger ?? noopLogger, 'foundationalServices.credentials', () => resolver.credentialsFor(input.workspaceId, ids), { workspaceId: input.workspaceId, agentKind: input.agentKind });
|
|
31
|
+
return resolved ?? [];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every catalog service id this dispatch has been told about, deduped and in a stable order.
|
|
35
|
+
*
|
|
36
|
+
* Order is stable because the job body is persisted with the dispatch and read back on the poll
|
|
37
|
+
* path: a set that reshuffled per resolve would make two identical dispatches differ on the wire
|
|
38
|
+
* for no reason anyone could act on.
|
|
39
|
+
*/
|
|
40
|
+
function briefedServiceIds(input) {
|
|
41
|
+
const { agentKind, agentKindRegistry } = input;
|
|
42
|
+
const ids = new Set();
|
|
43
|
+
if (hasTrait(agentKind, BINARY_OUTPUT_TRAIT, agentKindRegistry)) {
|
|
44
|
+
const selection = input.step.stepOptions?.binaryOutput;
|
|
45
|
+
if (selection?.storageServiceId)
|
|
46
|
+
ids.add(selection.storageServiceId);
|
|
47
|
+
for (const id of selection?.contextServiceIds ?? [])
|
|
48
|
+
ids.add(id);
|
|
49
|
+
}
|
|
50
|
+
if (hasTrait(agentKind, FOUNDATIONAL_CONTRACTS_TRAIT, agentKindRegistry)) {
|
|
51
|
+
// The DECLARED half only, never `unknown`: an id the catalog does not contain resolves to no
|
|
52
|
+
// service, so there is nothing to authenticate to and the index file already states the gap.
|
|
53
|
+
for (const id of declaredSelection(input.priorSteps)?.declared ?? [])
|
|
54
|
+
ids.add(id);
|
|
55
|
+
}
|
|
56
|
+
return [...ids];
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=run-foundational-credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-foundational-credentials.js","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-credentials.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,4BAA4B,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAGjG,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAoC,MAAM,gCAAgC,CAAA;AAgCpG;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,KAA2C;IAE3C,MAAM,QAAQ,GAAG,KAAK,CAAC,2BAA2B,CAAA;IAClD,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAA;IACxB,MAAM,GAAG,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACpC,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAC/B,0FAA0F;IAC1F,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 -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentKindRegistry } from '@cat-factory/agents';
|
|
2
2
|
import type { BinaryCandidateStepState, BinaryOutputConfig, FoundationalServiceSelection, PipelineStep } from '@cat-factory/contracts';
|
|
3
|
-
import type { AgentKind, BinaryGeneratorSource, FoundationalCatalogView, InjectedContextFile, Logger } from '@cat-factory/kernel';
|
|
3
|
+
import type { AgentKind, BinaryGeneratorSource, FoundationalCatalogView, InjectedContextFile, Logger, ResolvedServiceCredentials } from '@cat-factory/kernel';
|
|
4
4
|
/**
|
|
5
5
|
* The engine-facing seam over the catalog, implemented by
|
|
6
6
|
* `FoundationalServiceRunResolver` (`@cat-factory/agents`) and wired only when the catalog is
|
|
@@ -16,6 +16,18 @@ export interface FoundationalServiceResolver {
|
|
|
16
16
|
*/
|
|
17
17
|
catalogIdsFor(workspaceId: string): Promise<string[]>;
|
|
18
18
|
contextFilesFor(workspaceId: string, selection: FoundationalServiceSelection | undefined): Promise<InjectedContextFile[]>;
|
|
19
|
+
/**
|
|
20
|
+
* The credential DECLARATIONS (key names, never values) of the services named by `serviceIds`,
|
|
21
|
+
* for the container executor to resolve values for onto the job body. Ids the catalog does not
|
|
22
|
+
* resolve, and services declaring no credential, are simply absent from the answer.
|
|
23
|
+
*
|
|
24
|
+
* On this interface for the reason `binaryOutputContextFilesFor` is: it is the same catalog
|
|
25
|
+
* behind the same tier merge and cache, and the brief that tells an agent which variable to
|
|
26
|
+
* read must be built from the same read as the projection that puts a value in it. THROWS on a
|
|
27
|
+
* mothership-mode node whose mothership is unreachable, which the caller's best-effort wrapper
|
|
28
|
+
* turns into no credentials and therefore unset variables, the state every brief defines.
|
|
29
|
+
*/
|
|
30
|
+
credentialsFor(workspaceId: string, serviceIds: readonly string[]): Promise<ResolvedServiceCredentials[]>;
|
|
19
31
|
/**
|
|
20
32
|
* The BINARY-OUTPUT read (`run-binary-output.ts`): the brief + contract files for a
|
|
21
33
|
* generating step's own selection (`stepOptions.binaryOutput`). On this interface rather
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-foundational-services.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAM5D,OAAO,KAAK,EACV,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACb,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"run-foundational-services.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAM5D,OAAO,KAAK,EACV,wBAAwB,EACxB,kBAAkB,EAClB,4BAA4B,EAC5B,YAAY,EACb,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EACV,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,MAAM,EACN,0BAA0B,EAC3B,MAAM,qBAAqB,CAAA;AAwB5B;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAA;IACnE;;;;;OAKG;IACH,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IACrD,eAAe,CACb,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,4BAA4B,GAAG,SAAS,GAClD,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;IACjC;;;;;;;;;;OAUG;IACH,cAAc,CACZ,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC5B,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAAA;IACxC;;;;;;;;;;;;OAYG;IACH,2BAA2B,CACzB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,eAAe,CAAC,EAAE,qBAAqB;IACvC;qFACiF;IACjF,UAAU,CAAC,EAAE,wBAAwB,GAAG,IAAI,GAC3C,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAA;CAClC;AAED,MAAM,WAAW,+BAA+B;IAC9C,WAAW,EAAE,MAAM,CAAA;IACnB,6FAA6F;IAC7F,SAAS,EAAE,SAAS,CAAA;IACpB,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,oEAAoE;IACpE,UAAU,EAAE,YAAY,EAAE,CAAA;IAC1B,2BAA2B,CAAC,EAAE,2BAA2B,CAAA;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAwDhC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,YAAY,EAAE,GACzB,4BAA4B,GAAG,SAAS,CAM1C;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,+BAA+B,GAAG,CAC5C,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,YAAY;AAClB;sEACsE;AACtE,MAAM,EAAE,MAAM,GAAG,SAAS,KACvB,OAAO,CAAC,IAAI,CAAC,CAAA;AAElB;;;;GAIG;AACH,wBAAgB,qCAAqC,CAAC,IAAI,EAAE;IAC1D,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,2BAA2B,CAAC,EAAE,2BAA2B,CAAA;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,GAAG,+BAA+B,CAelC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-foundational-services.js","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-services.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,QAAQ,GACT,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"run-foundational-services.js","sourceRoot":"","sources":["../../../src/modules/execution/run-foundational-services.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,QAAQ,GACT,MAAM,qBAAqB,CAAA;AAe5B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,UAAU,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,uBAAuB,EACvB,aAAa,GACd,MAAM,qBAAqB,CAAA;AAkF5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,KAAsC;IAEtC,MAAM,QAAQ,GAAG,KAAK,CAAC,2BAA2B,CAAA;IAClD,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAA;IACxB,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAA;IAC9C,IAAI,QAAQ,CAAC,SAAS,EAAE,0BAA0B,EAAE,iBAAiB,CAAC,EAAE,CAAC;QACvE,MAAM,KAAK,GAAG,MAAM,aAAa,CAC/B,KAAK,CAAC,MAAM,IAAI,UAAU,EAC1B,8BAA8B,EAC9B,KAAK,IAAI,EAAE;YACT,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAA;YAC5D,mFAAmF;YACnF,sFAAsF;YACtF,kFAAkF;YAClF,kDAAkD;YAClD,OAAO;gBACL;oBACE,IAAI,EAAE,yBAAyB;oBAC/B,OAAO,EAAE,yBAAyB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;iBAC9E;aACF,CAAA;QACH,CAAC,EACD,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,SAAS,EAAE,CAC9C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Q,GAAG,IAAI,CAAC,2BAA2B,CAAA;IACjD,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,IAAI,EAAE,GAAE,CAAC,CAAA;IACpC,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,EAAE,IAAI,CAAC,iBAAiB,CAAC;YAAE,OAAM;QACzF,MAAM,aAAa,CACjB,IAAI,CAAC,MAAM,IAAI,UAAU,EACzB,wCAAwC,EACxC,KAAK,IAAI,EAAE;YACT,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAA;YACvD,IAAI,CAAC,oBAAoB,GAAG,4BAA4B,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACzE,CAAC,EACD,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAC3C,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -45,7 +45,12 @@ export declare class SandboxRunService {
|
|
|
45
45
|
private failRun;
|
|
46
46
|
/** Resolve every prompt version referenced by the matrix to its system text + label. */
|
|
47
47
|
private resolvePrompts;
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Resolve every fixture referenced by the matrix (stored, else builtin), refusing one the driver
|
|
50
|
+
* cannot run and RENDERING each one's task input. Every refusal this method can raise therefore
|
|
51
|
+
* happens before the run is claimed, so a bad matrix is a 4xx with no grid rather than a
|
|
52
|
+
* half-finished experiment.
|
|
53
|
+
*/
|
|
49
54
|
private resolveFixtures;
|
|
50
55
|
/** The model provider for a workspace's scope (per-scope DB pool, else the static one). */
|
|
51
56
|
private providerFor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxRunService.d.ts","sourceRoot":"","sources":["../../../src/modules/sandbox/SandboxRunService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV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AAe,CAAC,EAAE,QAAQ,CAAA;IAC1B;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,OAAO,CAAA;CACxC;AAsBD;;;;;;;;;;;GAWG;AACH,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAjC,YAA6B,IAAI,EAAE,6BAA6B,EAAI;IAE9D,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA6MxF;YAIa,OAAO;IASrB,wFAAwF;YAC1E,cAAc;IAuB5B;;;;;OAKG;YACW,eAAe;IAqB7B,2FAA2F;YAC7E,WAAW;IASzB,oGAAoG;IACpG,OAAO,CAAC,MAAM;IAUd,OAAO,CAAC,MAAM;CAGf"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { assertFound, ConflictError, getErrorMessage, inlineModelRef, requireWorkspace, resolveScopedModelProvider, ValidationError, } from '@cat-factory/kernel';
|
|
2
|
-
import { catFactoryObservability,
|
|
3
|
-
import {
|
|
4
|
-
import { expandMatrix, listBaselines, listBuiltinFixtures, rubricFor, sandboxKindMeta, versionLabel, weightedTotal, } from '@cat-factory/sandbox';
|
|
2
|
+
import { catFactoryObservability, composedSystemPromptFor } from '@cat-factory/agents';
|
|
3
|
+
import { expandMatrix, listBaselines, listBuiltinFixtures, rubricFor, versionLabel, weightedTotal, } from '@cat-factory/sandbox';
|
|
5
4
|
import { generateText } from 'ai';
|
|
5
|
+
import { assertSandboxFixtureMatchesKind, assertSandboxRunnable, assertSandboxRunnableFixture, } from './sandboxAdmission.js';
|
|
6
6
|
import { composeExperimentDetail } from './SandboxService.js';
|
|
7
|
-
import {
|
|
7
|
+
import { renderFixtureInput } from './sandbox-input.js';
|
|
8
|
+
import { buildJudgePrompt, coerceJudgeScores, extractJson, gradedDimensionCount, JUDGE_SYSTEM_PROMPT, objectiveFor, parseModelCatalogId, } from './sandbox.logic.js';
|
|
8
9
|
/**
|
|
9
10
|
* The Sandbox run-driver + judge. {@link launch} expands a draft experiment's matrix
|
|
10
11
|
* into cells, runs each inline candidate (one LLM call against the prompt-version's
|
|
@@ -28,22 +29,20 @@ export class SandboxRunService {
|
|
|
28
29
|
if (experiment.status === 'running') {
|
|
29
30
|
throw new ConflictError('This experiment is already running.');
|
|
30
31
|
}
|
|
31
|
-
const meta =
|
|
32
|
-
if (!meta)
|
|
33
|
-
throw new ValidationError(`"${experiment.agentKind}" is not a Sandbox-testable kind`);
|
|
34
|
-
if (meta.bucket === 'container') {
|
|
35
|
-
throw new ValidationError(`The "${experiment.agentKind}" agent runs in a container; container experiments are not yet supported in the Sandbox.`);
|
|
36
|
-
}
|
|
32
|
+
const meta = assertSandboxRunnable(experiment.agentKind);
|
|
37
33
|
const provider = await this.providerFor(workspaceId);
|
|
38
34
|
const prompts = await this.resolvePrompts(workspaceId, experiment);
|
|
39
|
-
const fixtures = await this.resolveFixtures(workspaceId, experiment);
|
|
35
|
+
const fixtures = await this.resolveFixtures(workspaceId, experiment, meta);
|
|
40
36
|
const rubric = rubricFor(meta.rubric);
|
|
41
37
|
// Atomically claim the run BEFORE touching the grid: the conditional transition to
|
|
42
38
|
// `running` lets exactly one concurrent launch win, so two simultaneous launches can't
|
|
43
39
|
// both clear + re-expand the grid (duplicating cells) or race the grid-clearing deletes.
|
|
44
40
|
// The fast-path read above is just a friendly early error; THIS is the authoritative gate.
|
|
45
|
-
// Validation/resolution runs first,
|
|
46
|
-
//
|
|
41
|
+
// Validation/resolution runs first, RENDERING each fixture's task input as it goes, so every
|
|
42
|
+
// refusal a bad matrix can raise lands here rather than mid-grid: a fixture whose payload the
|
|
43
|
+
// builder cannot read is a 4xx with nothing persisted, never a run that spends tokens on the
|
|
44
|
+
// cells before it and leaves the rest `queued` with no error to explain them. The `finally`
|
|
45
|
+
// below settles the terminal status from here on.
|
|
47
46
|
if (!(await this.deps.sandboxExperimentRepository.claimForRun(workspaceId, experimentId))) {
|
|
48
47
|
throw new ConflictError('This experiment is already running.');
|
|
49
48
|
}
|
|
@@ -85,14 +84,14 @@ export class SandboxRunService {
|
|
|
85
84
|
// candidate output inspectable with the error, so the cell is `done` but not counted graded.
|
|
86
85
|
const runCell = async (run) => {
|
|
87
86
|
const prompt = prompts.get(run.promptVersionId);
|
|
88
|
-
const
|
|
89
|
-
if (!prompt || !
|
|
87
|
+
const resolved = fixtures.get(run.fixtureId);
|
|
88
|
+
if (!prompt || !resolved) {
|
|
90
89
|
await this.failRun(workspaceId, run, prompt
|
|
91
90
|
? `Unknown fixture "${run.fixtureId}"`
|
|
92
91
|
: `Unknown prompt version "${run.promptVersionId}"`);
|
|
93
92
|
return { tokensSpent: 0, graded: false };
|
|
94
93
|
}
|
|
95
|
-
const taskInput =
|
|
94
|
+
const { fixture, taskInput } = resolved;
|
|
96
95
|
let cellSpent = 0;
|
|
97
96
|
// Phase 1 — run the candidate. A failure here means the cell produced nothing,
|
|
98
97
|
// so the whole cell is `failed`.
|
|
@@ -103,11 +102,12 @@ export class SandboxRunService {
|
|
|
103
102
|
const candidate = await generateText({
|
|
104
103
|
model: provider.resolve(candidateRef),
|
|
105
104
|
// Composed exactly as production dispatch composes a workspace prompt override: the
|
|
106
|
-
// stored text is the BASE
|
|
107
|
-
// directives and trait guidance
|
|
108
|
-
// is never sent
|
|
109
|
-
// to the live prompt, since the promoted
|
|
110
|
-
|
|
105
|
+
// stored text is the shipped BASE prompt, and `composedSystemPromptFor` puts the rest
|
|
106
|
+
// back (surface directives and trait guidance, or a bespoke kind's directives half).
|
|
107
|
+
// Grading the bare base would measure text that is never sent, which matters most at the
|
|
108
|
+
// moment a well-graded candidate is promoted to the live prompt, since the promoted
|
|
109
|
+
// prompt would then behave unlike the graded one.
|
|
110
|
+
system: composedSystemPromptFor(experiment.agentKind, this.deps.agentKindRegistry, prompt.systemText),
|
|
111
111
|
prompt: taskInput,
|
|
112
112
|
temperature: 0.2,
|
|
113
113
|
maxOutputTokens: 4000,
|
|
@@ -228,18 +228,25 @@ export class SandboxRunService {
|
|
|
228
228
|
}
|
|
229
229
|
return map;
|
|
230
230
|
}
|
|
231
|
-
/**
|
|
232
|
-
|
|
231
|
+
/**
|
|
232
|
+
* Resolve every fixture referenced by the matrix (stored, else builtin), refusing one the driver
|
|
233
|
+
* cannot run and RENDERING each one's task input. Every refusal this method can raise therefore
|
|
234
|
+
* happens before the run is claimed, so a bad matrix is a 4xx with no grid rather than a
|
|
235
|
+
* half-finished experiment.
|
|
236
|
+
*/
|
|
237
|
+
async resolveFixtures(workspaceId, experiment, meta) {
|
|
233
238
|
const builtins = new Map(listBuiltinFixtures(this.deps.clock.now()).map((f) => [f.id, f]));
|
|
234
239
|
const map = new Map();
|
|
235
240
|
for (const id of new Set(experiment.matrix.fixtureIds)) {
|
|
236
241
|
const fixture = (await this.deps.sandboxFixtureRepository.get(workspaceId, id)) ?? builtins.get(id);
|
|
237
242
|
if (!fixture)
|
|
238
243
|
throw new ValidationError(`Unknown fixture "${id}"`);
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
244
|
+
assertSandboxRunnableFixture(fixture);
|
|
245
|
+
assertSandboxFixtureMatchesKind(fixture, meta);
|
|
246
|
+
map.set(id, {
|
|
247
|
+
fixture,
|
|
248
|
+
taskInput: renderFixtureInput(fixture, meta, this.deps.agentKindRegistry),
|
|
249
|
+
});
|
|
243
250
|
}
|
|
244
251
|
return map;
|
|
245
252
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxRunService.js","sourceRoot":"","sources":["../../../src/modules/sandbox/SandboxRunService.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,WAAW,EACX,aAAa,EACb,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"SandboxRunService.js","sourceR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AAe,IAAI,QAAQ,EACrC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CACjC,CAAA;IACH,CAAC;IAEO,MAAM,CAAC,WAAmB,EAAE,YAAoB;QACtD,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;IACtE,CAAC;CACF;AAED,SAAS,cAAc,CAAC,OAAuB;IAC7C,OAAO,OAAO,CAAC,SAAS,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAA;AACrF,CAAC"}
|
|
@@ -98,7 +98,7 @@ export declare class SandboxService {
|
|
|
98
98
|
setLabels(workspaceId: string, id: string, input: SetSandboxLabelsInput): Promise<SandboxPromptVersion>;
|
|
99
99
|
/** Soft-archive a candidate version (hidden from the default listing). */
|
|
100
100
|
archivePrompt(workspaceId: string, id: string): Promise<void>;
|
|
101
|
-
/** The fixture library,
|
|
101
|
+
/** The fixture library, reconciled against the shipped builtin catalog first. */
|
|
102
102
|
listFixtures(workspaceId: string): Promise<SandboxFixture[]>;
|
|
103
103
|
/** Create a workspace-authored fixture. */
|
|
104
104
|
createFixture(workspaceId: string, input: CreateSandboxFixtureInput): Promise<SandboxFixture>;
|
|
@@ -109,10 +109,33 @@ export declare class SandboxService {
|
|
|
109
109
|
getExperiment(workspaceId: string, id: string): Promise<SandboxExperimentDetail>;
|
|
110
110
|
/** Create a draft experiment. Launching it (the run-driver) expands + grades the matrix. */
|
|
111
111
|
createExperiment(workspaceId: string, input: CreateSandboxExperimentInput): Promise<SandboxExperiment>;
|
|
112
|
+
/**
|
|
113
|
+
* Refuse a matrix naming a fixture the run-driver cannot run (a repository seed) or one the
|
|
114
|
+
* chosen agent kind is not exercised against.
|
|
115
|
+
*
|
|
116
|
+
* An unknown id is deliberately NOT refused here: the run-driver resolves fixtures against the
|
|
117
|
+
* workspace store AND the builtins at launch, and a fixture can legitimately be authored between
|
|
118
|
+
* create and launch. Refusing an absent id would only move that failure earlier while adding a way
|
|
119
|
+
* for a valid draft to be rejected.
|
|
120
|
+
*/
|
|
121
|
+
private assertRunnableFixtures;
|
|
112
122
|
/** Resolve the shipped baseline a clone derives from (by base-prompt id, else by kind). */
|
|
113
123
|
private resolveBaseline;
|
|
114
|
-
/**
|
|
115
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Bring the workspace's builtin fixture rows up to date with the shipped catalog, leaving
|
|
126
|
+
* workspace-authored ones untouched. Idempotent, and a no-op write-wise once they agree.
|
|
127
|
+
*
|
|
128
|
+
* Reconciled against the CATALOG rather than seeded once, for the same reason built-in pipelines
|
|
129
|
+
* are: a "seed only when the workspace has none" gate makes every LATER release invisible to
|
|
130
|
+
* every workspace that has already opened the surface. This shipped two new agent kinds, and on
|
|
131
|
+
* such a workspace their fixture lists came back empty, so the kind was offered in the builder
|
|
132
|
+
* with a permanently disabled Run button and nothing on screen saying why.
|
|
133
|
+
*
|
|
134
|
+
* Compared field by field (rather than upserting all of them every time) because this runs on
|
|
135
|
+
* every overview load: a workspace whose builtins already match pays reads only. `createdAt` is
|
|
136
|
+
* taken from the stored row, so an unchanged fixture is byte-identical and no row churns.
|
|
137
|
+
*/
|
|
138
|
+
private reconcileBuiltinFixtures;
|
|
116
139
|
/**
|
|
117
140
|
* The judge model to use when the caller didn't pick one: the deployment's routing
|
|
118
141
|
* default. We do NOT guess a provider — if no default is configured (e.g. a minimal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SandboxService.d.ts","sourceRoot":"","sources":["../../../src/modules/sandbox/SandboxService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,2BAA2B,EAC3B,cAAc,EACd,wBAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,8BAA8B,EAC9B,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAQL,KAAK,oBAAoB,EAK1B,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"SandboxService.d.ts","sourceRoot":"","sources":["../../../src/modules/sandbox/SandboxService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,KAAK,EACL,WAAW,EACX,QAAQ,EACR,iBAAiB,EACjB,2BAA2B,EAC3B,cAAc,EACd,wBAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,8BAA8B,EAC9B,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACpB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAC5D,OAAO,KAAK,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAQL,KAAK,oBAAoB,EAK1B,MAAM,sBAAsB,CAAA;AAO7B,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,0FAA0F;AAC1F,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,iBAAiB,CAAA;IAC7B,IAAI,EAAE,UAAU,EAAE,CAAA;IAClB,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB;AAED,mFAAmF;AACnF,MAAM,WAAW,yBAAyB;IACxC,2BAA2B,EAAE,2BAA2B,CAAA;IACxD,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,sBAAsB,EAAE,sBAAsB,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