@cat-factory/kernel 0.214.1 → 0.216.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/domain/binary-generator-registry.d.ts +66 -0
- package/dist/domain/binary-generator-registry.d.ts.map +1 -0
- package/dist/domain/binary-generator-registry.js +89 -0
- package/dist/domain/binary-generator-registry.js.map +1 -0
- package/dist/domain/binary-generators.d.ts +97 -0
- package/dist/domain/binary-generators.d.ts.map +1 -0
- package/dist/domain/binary-generators.js +212 -0
- package/dist/domain/binary-generators.js.map +1 -0
- package/dist/domain/binary-output-paths.d.ts +25 -0
- package/dist/domain/binary-output-paths.d.ts.map +1 -0
- package/dist/domain/binary-output-paths.js +47 -0
- package/dist/domain/binary-output-paths.js.map +1 -0
- package/dist/domain/binary-outputs.d.ts +37 -18
- package/dist/domain/binary-outputs.d.ts.map +1 -1
- package/dist/domain/binary-outputs.js +97 -45
- package/dist/domain/binary-outputs.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/ports/agent-executor.d.ts +13 -0
- package/dist/ports/agent-executor.d.ts.map +1 -1
- package/dist/ports/agent-executor.js.map +1 -1
- package/dist/ports/agent-runs.d.ts +22 -0
- package/dist/ports/agent-runs.d.ts.map +1 -1
- package/dist/ports/agent-tools.d.ts +36 -13
- package/dist/ports/agent-tools.d.ts.map +1 -1
- package/dist/ports/binary-generators.d.ts +49 -0
- package/dist/ports/binary-generators.d.ts.map +1 -0
- package/dist/ports/binary-generators.js +45 -0
- package/dist/ports/binary-generators.js.map +1 -0
- package/dist/ports/index.d.ts +3 -2
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +1 -0
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/llm-trace-sink.d.ts +26 -5
- package/dist/ports/llm-trace-sink.d.ts.map +1 -1
- package/dist/ports/llm-trace-sink.js +52 -56
- package/dist/ports/llm-trace-sink.js.map +1 -1
- package/dist/ports/operational-metrics.d.ts +87 -0
- package/dist/ports/operational-metrics.d.ts.map +1 -0
- package/dist/ports/operational-metrics.js +67 -0
- package/dist/ports/operational-metrics.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ApiContractDocument, ApiContractSummary, BinaryGeneratorCredential, BinaryGeneratorDefinition, BinaryModality } from '@cat-factory/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* The wire definition verbatim, re-exported so a deployment registering an integration imports
|
|
4
|
+
* one name from the layer it is already wiring against (the same courtesy
|
|
5
|
+
* `FoundationalServiceDefinition` does for the estate registry).
|
|
6
|
+
*/
|
|
7
|
+
export type { BinaryGeneratorDefinition };
|
|
8
|
+
/**
|
|
9
|
+
* A registered integration as the ENGINE reads it: identity, what it produces, how to reach it,
|
|
10
|
+
* and its contracts SUMMARISED (operation names, sizes) — never the document bodies, which the
|
|
11
|
+
* brief renderer fetches separately for exactly the ids a step selected.
|
|
12
|
+
*
|
|
13
|
+
* The credential appears here as its DECLARATION only (a key name and how to present it). The
|
|
14
|
+
* value is resolved per dispatch, on the container executor's side of the seam, and travels on
|
|
15
|
+
* the job body alone.
|
|
16
|
+
*/
|
|
17
|
+
export interface BinaryGeneratorView {
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
summary: string;
|
|
21
|
+
description: string;
|
|
22
|
+
modalities: BinaryModality[];
|
|
23
|
+
mediaTypes: string[];
|
|
24
|
+
endpoint?: string;
|
|
25
|
+
guidance?: string;
|
|
26
|
+
credential?: BinaryGeneratorCredential;
|
|
27
|
+
contracts: ApiContractSummary[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* App-owned registry of the deployment's generative binary integrations. The composition root
|
|
31
|
+
* news ONE instance and a deployment registers its integrations on it by reference; the engine
|
|
32
|
+
* resolves a step's selection against it at admission and at every dispatch.
|
|
33
|
+
*/
|
|
34
|
+
export declare class BinaryGeneratorRegistry {
|
|
35
|
+
private readonly definitions;
|
|
36
|
+
/**
|
|
37
|
+
* Memoised projection, for the same reason the foundational registry memoises its own:
|
|
38
|
+
* building it parses every registered contract document, and a step's brief is resolved per
|
|
39
|
+
* dispatch (on the Worker, per isolate). Views and documents are built TOGETHER from one
|
|
40
|
+
* summary per contract, so an agent can never be handed a document whose operation list
|
|
41
|
+
* disagrees with the one its step was validated against.
|
|
42
|
+
*/
|
|
43
|
+
private projection;
|
|
44
|
+
/** Register an integration. A registration whose id matches an earlier one replaces it. */
|
|
45
|
+
register(definition: BinaryGeneratorDefinition): void;
|
|
46
|
+
/** Register several integrations at once. */
|
|
47
|
+
registerAll(definitions: Iterable<BinaryGeneratorDefinition>): void;
|
|
48
|
+
/** The registered definitions, contract bodies included (registration order). */
|
|
49
|
+
all(): BinaryGeneratorDefinition[];
|
|
50
|
+
/** Every registered id — what a step's selection and a settled step's declaration resolve against. */
|
|
51
|
+
ids(): string[];
|
|
52
|
+
/** The engine-facing projection of every registered integration (no document bodies). */
|
|
53
|
+
views(): BinaryGeneratorView[];
|
|
54
|
+
/** The full contract documents of one registered integration, for its injected context file. */
|
|
55
|
+
documentsFor(id: string): ApiContractDocument[];
|
|
56
|
+
private build;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A fresh, EMPTY generator registry. Each facade news one and a deployment registers its
|
|
60
|
+
* integrations on it; the platform ships none (there is no image generator every organisation
|
|
61
|
+
* runs, and every one of them is metered), so the default selection set stays empty and a step
|
|
62
|
+
* that selects an id on such a deployment is refused at admission rather than dispatching an
|
|
63
|
+
* agent that cannot generate.
|
|
64
|
+
*/
|
|
65
|
+
export declare function defaultBinaryGeneratorRegistry(): BinaryGeneratorRegistry;
|
|
66
|
+
//# sourceMappingURL=binary-generator-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-generator-registry.d.ts","sourceRoot":"","sources":["../../src/domain/binary-generator-registry.ts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
import { summarizeContract } from './foundational-services.js';
|
|
2
|
+
/**
|
|
3
|
+
* App-owned registry of the deployment's generative binary integrations. The composition root
|
|
4
|
+
* news ONE instance and a deployment registers its integrations on it by reference; the engine
|
|
5
|
+
* resolves a step's selection against it at admission and at every dispatch.
|
|
6
|
+
*/
|
|
7
|
+
export class BinaryGeneratorRegistry {
|
|
8
|
+
definitions = new Map();
|
|
9
|
+
/**
|
|
10
|
+
* Memoised projection, for the same reason the foundational registry memoises its own:
|
|
11
|
+
* building it parses every registered contract document, and a step's brief is resolved per
|
|
12
|
+
* dispatch (on the Worker, per isolate). Views and documents are built TOGETHER from one
|
|
13
|
+
* summary per contract, so an agent can never be handed a document whose operation list
|
|
14
|
+
* disagrees with the one its step was validated against.
|
|
15
|
+
*/
|
|
16
|
+
projection = null;
|
|
17
|
+
/** Register an integration. A registration whose id matches an earlier one replaces it. */
|
|
18
|
+
register(definition) {
|
|
19
|
+
this.definitions.set(definition.id, definition);
|
|
20
|
+
this.projection = null;
|
|
21
|
+
}
|
|
22
|
+
/** Register several integrations at once. */
|
|
23
|
+
registerAll(definitions) {
|
|
24
|
+
for (const definition of definitions)
|
|
25
|
+
this.register(definition);
|
|
26
|
+
}
|
|
27
|
+
/** The registered definitions, contract bodies included (registration order). */
|
|
28
|
+
all() {
|
|
29
|
+
return [...this.definitions.values()];
|
|
30
|
+
}
|
|
31
|
+
/** Every registered id — what a step's selection and a settled step's declaration resolve against. */
|
|
32
|
+
ids() {
|
|
33
|
+
return [...this.definitions.keys()];
|
|
34
|
+
}
|
|
35
|
+
/** The engine-facing projection of every registered integration (no document bodies). */
|
|
36
|
+
views() {
|
|
37
|
+
return this.build().views;
|
|
38
|
+
}
|
|
39
|
+
/** The full contract documents of one registered integration, for its injected context file. */
|
|
40
|
+
documentsFor(id) {
|
|
41
|
+
return this.build().documents.get(id) ?? [];
|
|
42
|
+
}
|
|
43
|
+
build() {
|
|
44
|
+
if (this.projection)
|
|
45
|
+
return this.projection;
|
|
46
|
+
const views = [];
|
|
47
|
+
const documents = new Map();
|
|
48
|
+
for (const definition of this.definitions.values()) {
|
|
49
|
+
const summarized = (definition.contracts ?? []).map((contract) => ({
|
|
50
|
+
summary: summarizeContract({
|
|
51
|
+
contractId: contract.contractId,
|
|
52
|
+
format: contract.format,
|
|
53
|
+
title: contract.title,
|
|
54
|
+
// A registered definition has no repo provenance: its source of truth is the
|
|
55
|
+
// deployment's own code, which no path of ours can name.
|
|
56
|
+
path: null,
|
|
57
|
+
body: contract.body,
|
|
58
|
+
}),
|
|
59
|
+
body: contract.body,
|
|
60
|
+
}));
|
|
61
|
+
views.push({
|
|
62
|
+
id: definition.id,
|
|
63
|
+
name: definition.name,
|
|
64
|
+
summary: definition.summary,
|
|
65
|
+
description: definition.description,
|
|
66
|
+
modalities: [...definition.modalities],
|
|
67
|
+
mediaTypes: [...(definition.mediaTypes ?? [])],
|
|
68
|
+
...(definition.endpoint ? { endpoint: definition.endpoint } : {}),
|
|
69
|
+
...(definition.guidance ? { guidance: definition.guidance } : {}),
|
|
70
|
+
...(definition.credential ? { credential: definition.credential } : {}),
|
|
71
|
+
contracts: summarized.map((c) => c.summary),
|
|
72
|
+
});
|
|
73
|
+
documents.set(definition.id, summarized.map((c) => ({ ...c.summary, body: c.body })));
|
|
74
|
+
}
|
|
75
|
+
this.projection = { views, documents };
|
|
76
|
+
return this.projection;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A fresh, EMPTY generator registry. Each facade news one and a deployment registers its
|
|
81
|
+
* integrations on it; the platform ships none (there is no image generator every organisation
|
|
82
|
+
* runs, and every one of them is metered), so the default selection set stays empty and a step
|
|
83
|
+
* that selects an id on such a deployment is refused at admission rather than dispatching an
|
|
84
|
+
* agent that cannot generate.
|
|
85
|
+
*/
|
|
86
|
+
export function defaultBinaryGeneratorRegistry() {
|
|
87
|
+
return new BinaryGeneratorRegistry();
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=binary-generator-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-generator-registry.js","sourceRoot":"","sources":["../../src/domain/binary-generator-registry.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAkD9D;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IACjB,WAAW,GAAG,IAAI,GAAG,EAAqC,CAAA;IAC3E;;;;;;OAMG;IACK,UAAU,GAGP,IAAI,CAAA;IAEf,2FAA2F;IAC3F,QAAQ,CAAC,UAAqC;QAC5C,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,CAAA;QAC/C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IACxB,CAAC;IAED,6CAA6C;IAC7C,WAAW,CAAC,WAAgD;QAC1D,KAAK,MAAM,UAAU,IAAI,WAAW;YAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IACjE,CAAC;IAED,iFAAiF;IACjF,GAAG;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAA;IACvC,CAAC;IAED,sGAAsG;IACtG,GAAG;QACD,OAAO,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAA;IACrC,CAAC;IAED,yFAAyF;IACzF,KAAK;QACH,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAA;IAC3B,CAAC;IAED,gGAAgG;IAChG,YAAY,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,CAAA;IAC7C,CAAC;IAEO,KAAK;QAIX,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO,IAAI,CAAC,UAAU,CAAA;QAC3C,MAAM,KAAK,GAA0B,EAAE,CAAA;QACvC,MAAM,SAAS,GAAG,IAAI,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EAAE,CAAC;gBACvE,SAAS,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;aAC5C,CAAC,CAAA;YACF,SAAS,CAAC,GAAG,CACX,UAAU,CAAC,EAAE,EACb,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CACxD,CAAA;QACH,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,CAAA;QACtC,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B;IAC5C,OAAO,IAAI,uBAAuB,EAAE,CAAA;AACtC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { BinaryModality, BinaryOutputConfig } from '@cat-factory/contracts';
|
|
2
|
+
import type { BinaryGeneratorView } from './binary-generator-registry.js';
|
|
3
|
+
import { BINARY_GENERATOR_CONTEXT_DIR, binaryGeneratorContextFileFor } from './binary-output-paths.js';
|
|
4
|
+
export { BINARY_GENERATOR_CONTEXT_DIR, binaryGeneratorContextFileFor };
|
|
5
|
+
/**
|
|
6
|
+
* One selected integration as a DISPATCH sees it — the projection the engine puts on
|
|
7
|
+
* `AgentRunContext`, so the container executor can resolve the credential without needing the
|
|
8
|
+
* registry or the step (it has neither: it rebuilds a dispatch from the context alone).
|
|
9
|
+
*
|
|
10
|
+
* Non-secret by construction, exactly like `ResolvedToolServer`: the credential's KEY NAME is
|
|
11
|
+
* here because the agent must be told which variable to read, and the VALUE travels on the job
|
|
12
|
+
* body's dedicated field, which the agent-context telemetry snapshot omits.
|
|
13
|
+
*/
|
|
14
|
+
export interface ResolvedBinaryGenerator {
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
modalities: BinaryModality[];
|
|
18
|
+
/** The environment variable the credential is delivered as; absent ⇒ none is declared. */
|
|
19
|
+
credentialKey?: string;
|
|
20
|
+
/** Whether a missing credential means the integration must not be called (defaults true). */
|
|
21
|
+
credentialRequired?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/** Project a resolved selection into what the dispatch carries. Unresolved ids contribute
|
|
24
|
+
* nothing — the BRIEF is where they are stated, because only prose can say what to do about
|
|
25
|
+
* one, and a half-built entry here would look to the executor like something to authenticate. */
|
|
26
|
+
export declare function dispatchBinaryGenerators(selection: ResolvedBinaryGeneratorSelection): ResolvedBinaryGenerator[];
|
|
27
|
+
/** One way a step's generative-integration selection fails against the registry. */
|
|
28
|
+
export type BinaryGeneratorSelectionIssue =
|
|
29
|
+
/** A selected id no registered integration answers to. */
|
|
30
|
+
{
|
|
31
|
+
problem: 'unknown_generator';
|
|
32
|
+
generatorId: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A content type the step declares it must deliver that NO selected integration produces.
|
|
36
|
+
* About a requirement rather than an id, which is why it names no generator: the fix is to
|
|
37
|
+
* select one that makes this kind of thing (or to stop claiming the step delivers it).
|
|
38
|
+
*/
|
|
39
|
+
| {
|
|
40
|
+
problem: 'modality_uncovered';
|
|
41
|
+
modality: BinaryModality;
|
|
42
|
+
};
|
|
43
|
+
/** A step's selection, resolved against the registry's views. */
|
|
44
|
+
export interface ResolvedBinaryGeneratorSelection {
|
|
45
|
+
/** The integrations that resolved, in selection order. */
|
|
46
|
+
selected: BinaryGeneratorView[];
|
|
47
|
+
/** Selected ids the registry does not answer to, in selection order. */
|
|
48
|
+
unresolvedIds: string[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resolve a step's `generatorIds` against the registry's views. Pure and shared by admission and
|
|
52
|
+
* the brief, so the two can never disagree about which integrations a step has — the brief runs
|
|
53
|
+
* per dispatch and would otherwise re-derive a set admission already judged.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveBinaryGeneratorSelection(config: BinaryOutputConfig | undefined, generators: readonly BinaryGeneratorView[]): ResolvedBinaryGeneratorSelection;
|
|
56
|
+
/**
|
|
57
|
+
* Validate a step's generative selection against the RESOLVED registry: every selected id must
|
|
58
|
+
* be registered, and every content type the step declares it delivers must be produced by at
|
|
59
|
+
* least one of them.
|
|
60
|
+
*
|
|
61
|
+
* The coverage rule is the one worth having. A step that must deliver a theme song and selected
|
|
62
|
+
* only an image generator is broken in a way nothing downstream can detect — the agent will
|
|
63
|
+
* generate what it can, store it, and report the rest as an omission at the end of a paid run,
|
|
64
|
+
* which reads as a model failure rather than as the configuration error it is.
|
|
65
|
+
*
|
|
66
|
+
* Returns EVERY issue rather than the first, like its storage-side sibling, so one edit clears a
|
|
67
|
+
* step that lost three integrations instead of three refuse-fix-restart rounds.
|
|
68
|
+
*/
|
|
69
|
+
export declare function binaryGeneratorSelectionIssues(config: BinaryOutputConfig | undefined, generators: readonly BinaryGeneratorView[]): BinaryGeneratorSelectionIssue[];
|
|
70
|
+
/** The content type in words, for a message a human reads. */
|
|
71
|
+
export declare function describeModality(modality: BinaryModality): string;
|
|
72
|
+
/**
|
|
73
|
+
* The operator-facing message for a refused generative selection, naming EVERY issue.
|
|
74
|
+
*
|
|
75
|
+
* Prose, not localized copy: the SPA keys its translated toast off the envelope's
|
|
76
|
+
* `details.reason` / `details.issues` and reveals this text under "Show details" (the standing
|
|
77
|
+
* split — the backend does not localize, and the operator remedy it writes must still be
|
|
78
|
+
* reachable).
|
|
79
|
+
*/
|
|
80
|
+
export declare function describeBinaryGeneratorSelectionIssues(agentKind: string, issues: readonly BinaryGeneratorSelectionIssue[]): string;
|
|
81
|
+
/**
|
|
82
|
+
* The brief's GENERATION section: which integrations this step may call, what each produces, how
|
|
83
|
+
* to authenticate, and every gap.
|
|
84
|
+
*
|
|
85
|
+
* Every rule here exists because the alternative is an agent guessing. It names the content types
|
|
86
|
+
* per integration so a step holding both an image and a music generator cannot ask one for the
|
|
87
|
+
* other's output; it names the credential's ENVIRONMENT VARIABLE and says what an unset one means
|
|
88
|
+
* (the platform could not provide it — do not call, report), because the agent is the only party
|
|
89
|
+
* that can see whether the value arrived; and it states an unresolved id rather than dropping it,
|
|
90
|
+
* because a selection that silently shrinks reads as a step nobody configured.
|
|
91
|
+
*/
|
|
92
|
+
export declare function renderBinaryGeneratorSection(input: {
|
|
93
|
+
selection: ResolvedBinaryGeneratorSelection;
|
|
94
|
+
/** The content types the step declares it must deliver (`stepOptions.binaryOutput.modalities`). */
|
|
95
|
+
requestedModalities: BinaryModality[];
|
|
96
|
+
}): string[];
|
|
97
|
+
//# sourceMappingURL=binary-generators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-generators.d.ts","sourceRoot":"","sources":["../../src/domain/binary-generators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,0BAA0B,CAAA;AAsBjC,OAAO,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,CAAA;AAEtE;;;;;;;;GAQG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,0FAA0F;IAC1F,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,6FAA6F;IAC7F,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAED;;kGAEkG;AAClG,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,gCAAgC,GAC1C,uBAAuB,EAAE,CAQ3B;AAED,oFAAoF;AACpF,MAAM,MAAM,6BAA6B;AACvC,0DAA0D;AACxD;IAAE,OAAO,EAAE,mBAAmB,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE;AACvD;;;;GAIG;GACD;IAAE,OAAO,EAAE,oBAAoB,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAA;CAAE,CAAA;AAE/D,iEAAiE;AACjE,MAAM,WAAW,gCAAgC;IAC/C,0DAA0D;IAC1D,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,wEAAwE;IACxE,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,UAAU,EAAE,SAAS,mBAAmB,EAAE,GACzC,gCAAgC,CAUlC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,kBAAkB,GAAG,SAAS,EACtC,UAAU,EAAE,SAAS,mBAAmB,EAAE,GACzC,6BAA6B,EAAE,CAWjC;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAajE;AAED;;;;;;;GAOG;AACH,wBAAgB,sCAAsC,CACpD,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,SAAS,6BAA6B,EAAE,GAC/C,MAAM,CAYR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,SAAS,EAAE,gCAAgC,CAAA;IAC3C,mGAAmG;IACnG,mBAAmB,EAAE,cAAc,EAAE,CAAA;CACtC,GAAG,MAAM,EAAE,CAoDX"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { BINARY_GENERATOR_CONTEXT_DIR, binaryGeneratorContextFileFor, } from './binary-output-paths.js';
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Pure logic for the GENERATIVE half of a binary-output step: resolving a step's selected
|
|
4
|
+
// integrations against the deployment's `BinaryGeneratorRegistry`, refusing a selection that
|
|
5
|
+
// cannot do the step's job, and rendering what the agent is told about them.
|
|
6
|
+
//
|
|
7
|
+
// Deliberately a sibling of `binary-outputs.ts` rather than more of it, because the two halves
|
|
8
|
+
// resolve against DIFFERENT registries and their failures need different fixes: an unresolved
|
|
9
|
+
// storage id is a workspace-catalog problem (register the service, or fix the step), while an
|
|
10
|
+
// unknown generator id is a DEPLOYMENT CODE problem (nobody registered that integration in this
|
|
11
|
+
// build). Collapsing them into one refusal would send whoever reads it to the wrong place.
|
|
12
|
+
//
|
|
13
|
+
// No I/O and no registry access — every rule here is a function of a selection and a list of
|
|
14
|
+
// views, so run admission and the dispatch-time brief apply identical rules and both facades get
|
|
15
|
+
// identical behaviour by construction.
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// The `.cat-context/` path vocabulary lives in a LEAF module (`binary-output-paths.ts`) that this
|
|
18
|
+
// file and its `binary-outputs.ts` sibling both import: the two import each other, so a constant
|
|
19
|
+
// derived across that cycle is a module-init TDZ crash in the assembled backend. Re-exported here
|
|
20
|
+
// so every consumer keeps importing the name from where it always did.
|
|
21
|
+
export { BINARY_GENERATOR_CONTEXT_DIR, binaryGeneratorContextFileFor };
|
|
22
|
+
/** Project a resolved selection into what the dispatch carries. Unresolved ids contribute
|
|
23
|
+
* nothing — the BRIEF is where they are stated, because only prose can say what to do about
|
|
24
|
+
* one, and a half-built entry here would look to the executor like something to authenticate. */
|
|
25
|
+
export function dispatchBinaryGenerators(selection) {
|
|
26
|
+
return selection.selected.map((generator) => ({
|
|
27
|
+
id: generator.id,
|
|
28
|
+
label: generator.name,
|
|
29
|
+
modalities: [...generator.modalities],
|
|
30
|
+
...(generator.credential ? { credentialKey: generator.credential.key } : {}),
|
|
31
|
+
...(generator.credential?.required === false ? { credentialRequired: false } : {}),
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve a step's `generatorIds` against the registry's views. Pure and shared by admission and
|
|
36
|
+
* the brief, so the two can never disagree about which integrations a step has — the brief runs
|
|
37
|
+
* per dispatch and would otherwise re-derive a set admission already judged.
|
|
38
|
+
*/
|
|
39
|
+
export function resolveBinaryGeneratorSelection(config, generators) {
|
|
40
|
+
const byId = new Map(generators.map((generator) => [generator.id, generator]));
|
|
41
|
+
const selected = [];
|
|
42
|
+
const unresolvedIds = [];
|
|
43
|
+
for (const id of config?.generatorIds ?? []) {
|
|
44
|
+
const generator = byId.get(id);
|
|
45
|
+
if (generator)
|
|
46
|
+
selected.push(generator);
|
|
47
|
+
else
|
|
48
|
+
unresolvedIds.push(id);
|
|
49
|
+
}
|
|
50
|
+
return { selected, unresolvedIds };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Validate a step's generative selection against the RESOLVED registry: every selected id must
|
|
54
|
+
* be registered, and every content type the step declares it delivers must be produced by at
|
|
55
|
+
* least one of them.
|
|
56
|
+
*
|
|
57
|
+
* The coverage rule is the one worth having. A step that must deliver a theme song and selected
|
|
58
|
+
* only an image generator is broken in a way nothing downstream can detect — the agent will
|
|
59
|
+
* generate what it can, store it, and report the rest as an omission at the end of a paid run,
|
|
60
|
+
* which reads as a model failure rather than as the configuration error it is.
|
|
61
|
+
*
|
|
62
|
+
* Returns EVERY issue rather than the first, like its storage-side sibling, so one edit clears a
|
|
63
|
+
* step that lost three integrations instead of three refuse-fix-restart rounds.
|
|
64
|
+
*/
|
|
65
|
+
export function binaryGeneratorSelectionIssues(config, generators) {
|
|
66
|
+
const { selected, unresolvedIds } = resolveBinaryGeneratorSelection(config, generators);
|
|
67
|
+
const issues = unresolvedIds.map((generatorId) => ({
|
|
68
|
+
problem: 'unknown_generator',
|
|
69
|
+
generatorId,
|
|
70
|
+
}));
|
|
71
|
+
const covered = new Set(selected.flatMap((generator) => generator.modalities));
|
|
72
|
+
for (const modality of config?.modalities ?? []) {
|
|
73
|
+
if (!covered.has(modality))
|
|
74
|
+
issues.push({ problem: 'modality_uncovered', modality });
|
|
75
|
+
}
|
|
76
|
+
return issues;
|
|
77
|
+
}
|
|
78
|
+
/** The content type in words, for a message a human reads. */
|
|
79
|
+
export function describeModality(modality) {
|
|
80
|
+
switch (modality) {
|
|
81
|
+
case 'image':
|
|
82
|
+
return 'images';
|
|
83
|
+
case 'audio':
|
|
84
|
+
return 'audio (music, speech or sound)';
|
|
85
|
+
case 'video':
|
|
86
|
+
return 'video';
|
|
87
|
+
case '3d':
|
|
88
|
+
return '3D models';
|
|
89
|
+
case 'document':
|
|
90
|
+
return 'documents';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The operator-facing message for a refused generative selection, naming EVERY issue.
|
|
95
|
+
*
|
|
96
|
+
* Prose, not localized copy: the SPA keys its translated toast off the envelope's
|
|
97
|
+
* `details.reason` / `details.issues` and reveals this text under "Show details" (the standing
|
|
98
|
+
* split — the backend does not localize, and the operator remedy it writes must still be
|
|
99
|
+
* reachable).
|
|
100
|
+
*/
|
|
101
|
+
export function describeBinaryGeneratorSelectionIssues(agentKind, issues) {
|
|
102
|
+
const clauses = issues.map((issue) => issue.problem === 'unknown_generator'
|
|
103
|
+
? `'${issue.generatorId}' is not a generative integration this deployment registers`
|
|
104
|
+
: `no selected integration produces ${describeModality(issue.modality)}, which this step declares it delivers`);
|
|
105
|
+
const problems = clauses.length === 1 ? clauses[0] : clauses.map((c) => `\n - ${c}`).join('');
|
|
106
|
+
return (`Step '${agentKind}' generates binary outputs, but its generative selection does not resolve: ${problems}` +
|
|
107
|
+
'\nGenerative integrations are registered in the deployment’s code (BinaryGeneratorRegistry), ' +
|
|
108
|
+
"not in the workspace catalog: register the integration, or fix the step's selection, then start again.");
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The brief's GENERATION section: which integrations this step may call, what each produces, how
|
|
112
|
+
* to authenticate, and every gap.
|
|
113
|
+
*
|
|
114
|
+
* Every rule here exists because the alternative is an agent guessing. It names the content types
|
|
115
|
+
* per integration so a step holding both an image and a music generator cannot ask one for the
|
|
116
|
+
* other's output; it names the credential's ENVIRONMENT VARIABLE and says what an unset one means
|
|
117
|
+
* (the platform could not provide it — do not call, report), because the agent is the only party
|
|
118
|
+
* that can see whether the value arrived; and it states an unresolved id rather than dropping it,
|
|
119
|
+
* because a selection that silently shrinks reads as a step nobody configured.
|
|
120
|
+
*/
|
|
121
|
+
export function renderBinaryGeneratorSection(input) {
|
|
122
|
+
const { selected, unresolvedIds } = input.selection;
|
|
123
|
+
const lines = ['## Generation', ''];
|
|
124
|
+
if (selected.length === 0 && unresolvedIds.length === 0) {
|
|
125
|
+
return [
|
|
126
|
+
...lines,
|
|
127
|
+
'No generative integration is configured for this step: generate through the capabilities you already have (your own model, or a tool server you were given). Do not call an outside generation API you were not given credentials for; if the work needs one, report that instead of improvising.',
|
|
128
|
+
'',
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
if (selected.length > 0) {
|
|
132
|
+
lines.push('Generate every artifact through these integrations, and only these. Each is limited to the content types listed — never ask one for a kind of output it does not produce.', '');
|
|
133
|
+
for (const generator of selected) {
|
|
134
|
+
lines.push(`### \`${generator.id}\` — ${generator.name}`, '');
|
|
135
|
+
lines.push(`- Produces: ${generator.modalities.map(describeModality).join(', ')}.`);
|
|
136
|
+
if (generator.mediaTypes.length > 0) {
|
|
137
|
+
lines.push(`- Formats: ${generator.mediaTypes.join(', ')}.`);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
lines.push('- Formats: not declared — read them off its API contract rather than assuming one.');
|
|
141
|
+
}
|
|
142
|
+
if (generator.endpoint)
|
|
143
|
+
lines.push(`- Endpoint: ${generator.endpoint}`);
|
|
144
|
+
lines.push(`- ${generator.summary}`);
|
|
145
|
+
if (generator.description.trim())
|
|
146
|
+
lines.push('', generator.description.trim());
|
|
147
|
+
if (generator.guidance?.trim())
|
|
148
|
+
lines.push('', generator.guidance.trim());
|
|
149
|
+
lines.push('', ...credentialLines(generator), ...contractLines(generator), '');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (unresolvedIds.length > 0) {
|
|
153
|
+
lines.push(`This step also selects ${unresolvedIds.map((id) => `\`${id}\``).join(', ')}, which this deployment does not register — no endpoint and no contract are available for ${unresolvedIds.length === 1 ? 'it' : 'them'}. Do not guess at ${unresolvedIds.length === 1 ? 'its' : 'their'} API; report the gap and deliver what the remaining integrations can produce.`, '');
|
|
154
|
+
}
|
|
155
|
+
const covered = new Set(selected.flatMap((generator) => generator.modalities));
|
|
156
|
+
const uncovered = input.requestedModalities.filter((modality) => !covered.has(modality));
|
|
157
|
+
if (input.requestedModalities.length > 0) {
|
|
158
|
+
lines.push(`This step is expected to deliver: ${input.requestedModalities.map(describeModality).join(', ')}.`);
|
|
159
|
+
if (uncovered.length > 0) {
|
|
160
|
+
lines.push(`No available integration produces ${uncovered.map(describeModality).join(', ')}. Do not attempt to produce ${uncovered.length === 1 ? 'it' : 'them'} another way — deliver the rest and report this gap by name.`);
|
|
161
|
+
}
|
|
162
|
+
lines.push('');
|
|
163
|
+
}
|
|
164
|
+
return lines;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* What the agent is told about an integration's credential — including that it may not be there.
|
|
168
|
+
*
|
|
169
|
+
* THREE cases, not two, because `required` is a real declaration and collapsing it changes what
|
|
170
|
+
* the agent does. A REQUIRED credential that did not arrive means the integration must not be
|
|
171
|
+
* called; an OPTIONAL one (declared for an endpoint that genuinely works unauthenticated) means
|
|
172
|
+
* exactly the opposite — call it anyway. Telling an optional integration's agent "do not call it
|
|
173
|
+
* at all" would strand a working endpoint on the most ordinary misconfiguration there is, which
|
|
174
|
+
* is the failure `required: false` exists to prevent.
|
|
175
|
+
*/
|
|
176
|
+
function credentialLines(generator) {
|
|
177
|
+
const credential = generator.credential;
|
|
178
|
+
if (!credential) {
|
|
179
|
+
return [
|
|
180
|
+
`No credential is configured for \`${generator.id}\`: call it unauthenticated as its contract describes, and report a rejection rather than inventing a key.`,
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
const usage = credential.usage
|
|
184
|
+
? ` Send it as ${credential.usage}.`
|
|
185
|
+
: ' Its API contract states how to present it.';
|
|
186
|
+
const provided = `The credential for \`${generator.id}\` is provided to your process as the environment variable \`${credential.key}\`.${usage} Read it from the environment — never echo it, log it, commit it, or put it in your reply.`;
|
|
187
|
+
// `required` defaults to TRUE: an integration whose declaration says nothing is authenticated,
|
|
188
|
+
// which is the safe reading — being wrong that way costs a reported gap, while being wrong the
|
|
189
|
+
// other way burns the run on a call that 401s.
|
|
190
|
+
if (credential.required === false) {
|
|
191
|
+
return [
|
|
192
|
+
provided,
|
|
193
|
+
`\`${credential.key}\` is OPTIONAL for \`${generator.id}\`: if it is unset or empty, still call the integration, unauthenticated as its contract describes. Report a rejection rather than inventing a key.`,
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
return [
|
|
197
|
+
provided,
|
|
198
|
+
`If \`${credential.key}\` is unset or empty, the platform could NOT provide the credential: do not call \`${generator.id}\` at all, and report that its credential was unavailable. An empty variable is not an empty key.`,
|
|
199
|
+
];
|
|
200
|
+
}
|
|
201
|
+
/** Where an integration's API contract was injected, or the explicit statement that none exists. */
|
|
202
|
+
function contractLines(generator) {
|
|
203
|
+
if (generator.contracts.length === 0) {
|
|
204
|
+
return [
|
|
205
|
+
`No API contract is registered for \`${generator.id}\`. Its endpoint and the notes above are all the interface you have; do not invent operations or fields, and report what you needed from it instead.`,
|
|
206
|
+
];
|
|
207
|
+
}
|
|
208
|
+
return [
|
|
209
|
+
`Its API contract is provided at \`.cat-context/${binaryGeneratorContextFileFor(generator.id)}\` — treat it as the authoritative interface and do not invent endpoints or fields.`,
|
|
210
|
+
];
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=binary-generators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-generators.js","sourceRoot":"","sources":["../../src/domain/binary-generators.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,0BAA0B,CAAA;AAEjC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;;;;;;GASG;AACH,SAAS,eAAe,CAAC,SAA8B;IACrD,MAAM,UAAU,GAAG,SAAS,CAAC,UAAU,CAAA;IACvC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO;YACL,qCAAqC,SAAS,CAAC,EAAE,4GAA4G;SAC9J,CAAA;IACH,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK;QAC5B,CAAC,CAAC,eAAe,UAAU,CAAC,KAAK,GAAG;QACpC,CAAC,CAAC,6CAA6C,CAAA;IACjD,MAAM,QAAQ,GAAG,wBAAwB,SAAS,CAAC,EAAE,gEAAgE,UAAU,CAAC,GAAG,MAAM,KAAK,4FAA4F,CAAA;IAC1O,+FAA+F;IAC/F,+FAA+F;IAC/F,+CAA+C;IAC/C,IAAI,UAAU,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;QAClC,OAAO;YACL,QAAQ;YACR,KAAK,UAAU,CAAC,GAAG,wBAAwB,SAAS,CAAC,EAAE,qJAAqJ;SAC7M,CAAA;IACH,CAAC;IACD,OAAO;QACL,QAAQ;QACR,QAAQ,UAAU,CAAC,GAAG,sFAAsF,SAAS,CAAC,EAAE,mGAAmG;KAC5N,CAAA;AACH,CAAC;AAED,oGAAoG;AACpG,SAAS,aAAa,CAAC,SAA8B;IACnD,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO;YACL,uCAAuC,SAAS,CAAC,EAAE,sJAAsJ;SAC1M,CAAA;IACH,CAAC;IACD,OAAO;QACL,kDAAkD,6BAA6B,CAAC,SAAS,CAAC,EAAE,CAAC,qFAAqF;KACnL,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** The `.cat-context/` directory the binary-output brief and contract documents live under. */
|
|
2
|
+
export declare const BINARY_OUTPUT_CONTEXT_DIR = "binary-output";
|
|
3
|
+
/**
|
|
4
|
+
* The brief a binary-generating kind starts from: which integrations to generate with, which
|
|
5
|
+
* service to store through, which to consult for scope, and what could NOT be resolved. The trait
|
|
6
|
+
* guidance names this one stable path, and also names its ABSENCE as meaningful (the platform
|
|
7
|
+
* could not provide storage — do not attempt uploads; report instead), so a resolution failure
|
|
8
|
+
* degrades loudly rather than into a prompt pointing at a file that does not exist.
|
|
9
|
+
*/
|
|
10
|
+
export declare const BINARY_OUTPUT_BRIEF_FILE = "binary-output/brief.md";
|
|
11
|
+
/**
|
|
12
|
+
* The sub-directory a selected generative integration's contract documents are injected under.
|
|
13
|
+
*
|
|
14
|
+
* Its OWN directory rather than a `generator-` filename prefix, because the two halves of a
|
|
15
|
+
* step's selection are named from different registries with the identical slug grammar: a catalog
|
|
16
|
+
* service legitimately called `generator-sprites` would land on exactly the path a generative
|
|
17
|
+
* integration called `sprites` writes, and one would silently overwrite the other. A slug cannot
|
|
18
|
+
* contain `/`, so a directory makes the collision structurally impossible rather than unlikely.
|
|
19
|
+
*/
|
|
20
|
+
export declare const BINARY_GENERATOR_CONTEXT_DIR = "binary-output/generators";
|
|
21
|
+
/** The `.cat-context/` path one selected foundational SERVICE's contract documents live at. */
|
|
22
|
+
export declare function binaryContextFileFor(serviceId: string): string;
|
|
23
|
+
/** The `.cat-context/` path one selected generative INTEGRATION's contract documents live at. */
|
|
24
|
+
export declare function binaryGeneratorContextFileFor(generatorId: string): string;
|
|
25
|
+
//# sourceMappingURL=binary-output-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-output-paths.d.ts","sourceRoot":"","sources":["../../src/domain/binary-output-paths.ts"],"names":[],"mappings":"AAmBA,+FAA+F;AAC/F,eAAO,MAAM,yBAAyB,kBAAkB,CAAA;AAExD;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,2BAA0C,CAAA;AAE/E;;;;;;;;GAQG;AACH,eAAO,MAAM,4BAA4B,6BAA4C,CAAA;AAErF,+FAA+F;AAC/F,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,iGAAiG;AACjG,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzE"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// The `.cat-context/binary-output/` PATH vocabulary — where a binary-generating step's brief and
|
|
3
|
+
// each half of its selection's contract documents are injected.
|
|
4
|
+
//
|
|
5
|
+
// Its own LEAF module (no imports at all) because both halves of the feature need it and they
|
|
6
|
+
// import each other: `binary-outputs.ts` renders the generator section, and `binary-generators.ts`
|
|
7
|
+
// answers with paths under the same directory. That cycle is fine for FUNCTIONS, which resolve
|
|
8
|
+
// lazily, and fatal for a CONSTANT: a module-level `` `${BINARY_OUTPUT_CONTEXT_DIR}/generators` ``
|
|
9
|
+
// evaluated at import time throws `Cannot access 'BINARY_OUTPUT_CONTEXT_DIR' before
|
|
10
|
+
// initialization` whenever the cycle is entered from the other side — which is to say, in the
|
|
11
|
+
// assembled backend but not in a unit test that imports one module directly. Nothing typechecks
|
|
12
|
+
// differently and no build fails; the process just dies on boot.
|
|
13
|
+
//
|
|
14
|
+
// So the shared VALUES live here, where neither module's evaluation order can matter. It is the
|
|
15
|
+
// same remedy, for the same reason, that `@cat-factory/contracts`' `binary-modalities.ts` already
|
|
16
|
+
// applies to the content-type vocabulary. Both modules re-export from here, so every consumer
|
|
17
|
+
// (and the kernel barrel) keeps importing the name from where it always did.
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
/** The `.cat-context/` directory the binary-output brief and contract documents live under. */
|
|
20
|
+
export const BINARY_OUTPUT_CONTEXT_DIR = 'binary-output';
|
|
21
|
+
/**
|
|
22
|
+
* The brief a binary-generating kind starts from: which integrations to generate with, which
|
|
23
|
+
* service to store through, which to consult for scope, and what could NOT be resolved. The trait
|
|
24
|
+
* guidance names this one stable path, and also names its ABSENCE as meaningful (the platform
|
|
25
|
+
* could not provide storage — do not attempt uploads; report instead), so a resolution failure
|
|
26
|
+
* degrades loudly rather than into a prompt pointing at a file that does not exist.
|
|
27
|
+
*/
|
|
28
|
+
export const BINARY_OUTPUT_BRIEF_FILE = `${BINARY_OUTPUT_CONTEXT_DIR}/brief.md`;
|
|
29
|
+
/**
|
|
30
|
+
* The sub-directory a selected generative integration's contract documents are injected under.
|
|
31
|
+
*
|
|
32
|
+
* Its OWN directory rather than a `generator-` filename prefix, because the two halves of a
|
|
33
|
+
* step's selection are named from different registries with the identical slug grammar: a catalog
|
|
34
|
+
* service legitimately called `generator-sprites` would land on exactly the path a generative
|
|
35
|
+
* integration called `sprites` writes, and one would silently overwrite the other. A slug cannot
|
|
36
|
+
* contain `/`, so a directory makes the collision structurally impossible rather than unlikely.
|
|
37
|
+
*/
|
|
38
|
+
export const BINARY_GENERATOR_CONTEXT_DIR = `${BINARY_OUTPUT_CONTEXT_DIR}/generators`;
|
|
39
|
+
/** The `.cat-context/` path one selected foundational SERVICE's contract documents live at. */
|
|
40
|
+
export function binaryContextFileFor(serviceId) {
|
|
41
|
+
return `${BINARY_OUTPUT_CONTEXT_DIR}/${serviceId}.md`;
|
|
42
|
+
}
|
|
43
|
+
/** The `.cat-context/` path one selected generative INTEGRATION's contract documents live at. */
|
|
44
|
+
export function binaryGeneratorContextFileFor(generatorId) {
|
|
45
|
+
return `${BINARY_GENERATOR_CONTEXT_DIR}/${generatorId}.md`;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=binary-output-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary-output-paths.js","sourceRoot":"","sources":["../../src/domain/binary-output-paths.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,iGAAiG;AACjG,gEAAgE;AAChE,EAAE;AACF,8FAA8F;AAC9F,mGAAmG;AACnG,+FAA+F;AAC/F,mGAAmG;AACnG,oFAAoF;AACpF,8FAA8F;AAC9F,gGAAgG;AAChG,iEAAiE;AACjE,EAAE;AACF,gGAAgG;AAChG,kGAAkG;AAClG,8FAA8F;AAC9F,6EAA6E;AAC7E,8EAA8E;AAE9E,+FAA+F;AAC/F,MAAM,CAAC,MAAM,yBAAyB,GAAG,eAAe,CAAA;AAExD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,yBAAyB,WAAW,CAAA;AAE/E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAG,yBAAyB,aAAa,CAAA;AAErF,+FAA+F;AAC/F,MAAM,UAAU,oBAAoB,CAAC,SAAiB;IACpD,OAAO,GAAG,yBAAyB,IAAI,SAAS,KAAK,CAAA;AACvD,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,6BAA6B,CAAC,WAAmB;IAC/D,OAAO,GAAG,4BAA4B,IAAI,WAAW,KAAK,CAAA;AAC5D,CAAC"}
|