@cat-factory/agents 0.6.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/LICENSE +21 -0
- package/dist/agents/AiAgentExecutor.d.ts +72 -0
- package/dist/agents/AiAgentExecutor.d.ts.map +1 -0
- package/dist/agents/AiAgentExecutor.js +125 -0
- package/dist/agents/AiAgentExecutor.js.map +1 -0
- package/dist/agents/acceptance-prompts.d.ts +29 -0
- package/dist/agents/acceptance-prompts.d.ts.map +1 -0
- package/dist/agents/acceptance-prompts.js +112 -0
- package/dist/agents/acceptance-prompts.js.map +1 -0
- package/dist/agents/agent-catalog.d.ts +6 -0
- package/dist/agents/agent-catalog.d.ts.map +1 -0
- package/dist/agents/agent-catalog.js +197 -0
- package/dist/agents/agent-catalog.js.map +1 -0
- package/dist/agents/agent-configs.d.ts +17 -0
- package/dist/agents/agent-configs.d.ts.map +1 -0
- package/dist/agents/agent-configs.js +66 -0
- package/dist/agents/agent-configs.js.map +1 -0
- package/dist/agents/agent-routing.d.ts +57 -0
- package/dist/agents/agent-routing.d.ts.map +1 -0
- package/dist/agents/agent-routing.js +41 -0
- package/dist/agents/agent-routing.js.map +1 -0
- package/dist/agents/business-logic-prompts.d.ts +28 -0
- package/dist/agents/business-logic-prompts.d.ts.map +1 -0
- package/dist/agents/business-logic-prompts.js +96 -0
- package/dist/agents/business-logic-prompts.js.map +1 -0
- package/dist/agents/catalog.d.ts +6 -0
- package/dist/agents/catalog.d.ts.map +1 -0
- package/dist/agents/catalog.js +168 -0
- package/dist/agents/catalog.js.map +1 -0
- package/dist/agents/ci-gate.d.ts +2 -0
- package/dist/agents/ci-gate.d.ts.map +1 -0
- package/dist/agents/ci-gate.js +33 -0
- package/dist/agents/ci-gate.js.map +1 -0
- package/dist/agents/companion-prompts.d.ts +4 -0
- package/dist/agents/companion-prompts.d.ts.map +1 -0
- package/dist/agents/companion-prompts.js +27 -0
- package/dist/agents/companion-prompts.js.map +1 -0
- package/dist/agents/companions.d.ts +20 -0
- package/dist/agents/companions.d.ts.map +1 -0
- package/dist/agents/companions.js +38 -0
- package/dist/agents/companions.js.map +1 -0
- package/dist/agents/kinds/companions.d.ts +20 -0
- package/dist/agents/kinds/companions.d.ts.map +1 -0
- package/dist/agents/kinds/companions.js +39 -0
- package/dist/agents/kinds/companions.js.map +1 -0
- package/dist/agents/kinds/configs.d.ts +17 -0
- package/dist/agents/kinds/configs.d.ts.map +1 -0
- package/dist/agents/kinds/configs.js +66 -0
- package/dist/agents/kinds/configs.js.map +1 -0
- package/dist/agents/kinds/read-only.d.ts +13 -0
- package/dist/agents/kinds/read-only.d.ts.map +1 -0
- package/dist/agents/kinds/read-only.js +32 -0
- package/dist/agents/kinds/read-only.js.map +1 -0
- package/dist/agents/kinds/registry.d.ts +70 -0
- package/dist/agents/kinds/registry.d.ts.map +1 -0
- package/dist/agents/kinds/registry.js +51 -0
- package/dist/agents/kinds/registry.js.map +1 -0
- package/dist/agents/kinds/traits.d.ts +60 -0
- package/dist/agents/kinds/traits.d.ts.map +1 -0
- package/dist/agents/kinds/traits.js +123 -0
- package/dist/agents/kinds/traits.js.map +1 -0
- package/dist/agents/kinds/versions.d.ts +46 -0
- package/dist/agents/kinds/versions.d.ts.map +1 -0
- package/dist/agents/kinds/versions.js +22 -0
- package/dist/agents/kinds/versions.js.map +1 -0
- package/dist/agents/mock-prompts.d.ts +12 -0
- package/dist/agents/mock-prompts.d.ts.map +1 -0
- package/dist/agents/mock-prompts.js +61 -0
- package/dist/agents/mock-prompts.js.map +1 -0
- package/dist/agents/prompt-fragments.d.ts +17 -0
- package/dist/agents/prompt-fragments.d.ts.map +1 -0
- package/dist/agents/prompt-fragments.js +33 -0
- package/dist/agents/prompt-fragments.js.map +1 -0
- package/dist/agents/prompt-shared.d.ts +7 -0
- package/dist/agents/prompt-shared.d.ts.map +1 -0
- package/dist/agents/prompt-shared.js +10 -0
- package/dist/agents/prompt-shared.js.map +1 -0
- package/dist/agents/prompt-versions.d.ts +48 -0
- package/dist/agents/prompt-versions.d.ts.map +1 -0
- package/dist/agents/prompt-versions.js +55 -0
- package/dist/agents/prompt-versions.js.map +1 -0
- package/dist/agents/prompts/acceptance.d.ts +29 -0
- package/dist/agents/prompts/acceptance.d.ts.map +1 -0
- package/dist/agents/prompts/acceptance.js +112 -0
- package/dist/agents/prompts/acceptance.js.map +1 -0
- package/dist/agents/prompts/business-logic.d.ts +28 -0
- package/dist/agents/prompts/business-logic.d.ts.map +1 -0
- package/dist/agents/prompts/business-logic.js +98 -0
- package/dist/agents/prompts/business-logic.js.map +1 -0
- package/dist/agents/prompts/clarity.d.ts +10 -0
- package/dist/agents/prompts/clarity.d.ts.map +1 -0
- package/dist/agents/prompts/clarity.js +40 -0
- package/dist/agents/prompts/clarity.js.map +1 -0
- package/dist/agents/prompts/companion.d.ts +4 -0
- package/dist/agents/prompts/companion.d.ts.map +1 -0
- package/dist/agents/prompts/companion.js +61 -0
- package/dist/agents/prompts/companion.js.map +1 -0
- package/dist/agents/prompts/delivery-contract.d.ts +2 -0
- package/dist/agents/prompts/delivery-contract.d.ts.map +1 -0
- package/dist/agents/prompts/delivery-contract.js +33 -0
- package/dist/agents/prompts/delivery-contract.js.map +1 -0
- package/dist/agents/prompts/mock.d.ts +12 -0
- package/dist/agents/prompts/mock.d.ts.map +1 -0
- package/dist/agents/prompts/mock.js +61 -0
- package/dist/agents/prompts/mock.js.map +1 -0
- package/dist/agents/prompts/requirements.d.ts +13 -0
- package/dist/agents/prompts/requirements.d.ts.map +1 -0
- package/dist/agents/prompts/requirements.js +45 -0
- package/dist/agents/prompts/requirements.js.map +1 -0
- package/dist/agents/prompts/roles.d.ts +16 -0
- package/dist/agents/prompts/roles.d.ts.map +1 -0
- package/dist/agents/prompts/roles.js +74 -0
- package/dist/agents/prompts/roles.js.map +1 -0
- package/dist/agents/prompts/shared.d.ts +19 -0
- package/dist/agents/prompts/shared.d.ts.map +1 -0
- package/dist/agents/prompts/shared.js +25 -0
- package/dist/agents/prompts/shared.js.map +1 -0
- package/dist/agents/prompts/standard-templates.generated.d.ts +36 -0
- package/dist/agents/prompts/standard-templates.generated.d.ts.map +1 -0
- package/dist/agents/prompts/standard-templates.generated.js +122 -0
- package/dist/agents/prompts/standard-templates.generated.js.map +1 -0
- package/dist/agents/prompts/standard.d.ts +36 -0
- package/dist/agents/prompts/standard.d.ts.map +1 -0
- package/dist/agents/prompts/standard.js +208 -0
- package/dist/agents/prompts/standard.js.map +1 -0
- package/dist/agents/prompts/testing.d.ts +12 -0
- package/dist/agents/prompts/testing.d.ts.map +1 -0
- package/dist/agents/prompts/testing.js +94 -0
- package/dist/agents/prompts/testing.js.map +1 -0
- package/dist/agents/read-only.d.ts +13 -0
- package/dist/agents/read-only.d.ts.map +1 -0
- package/dist/agents/read-only.js +29 -0
- package/dist/agents/read-only.js.map +1 -0
- package/dist/agents/registry.d.ts +70 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +51 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/runtime/executor.d.ts +72 -0
- package/dist/agents/runtime/executor.d.ts.map +1 -0
- package/dist/agents/runtime/executor.js +125 -0
- package/dist/agents/runtime/executor.js.map +1 -0
- package/dist/agents/runtime/fragments.d.ts +17 -0
- package/dist/agents/runtime/fragments.d.ts.map +1 -0
- package/dist/agents/runtime/fragments.js +33 -0
- package/dist/agents/runtime/fragments.js.map +1 -0
- package/dist/agents/runtime/routing.d.ts +57 -0
- package/dist/agents/runtime/routing.d.ts.map +1 -0
- package/dist/agents/runtime/routing.js +41 -0
- package/dist/agents/runtime/routing.js.map +1 -0
- package/dist/agents/runtime/web-search.d.ts +43 -0
- package/dist/agents/runtime/web-search.d.ts.map +1 -0
- package/dist/agents/runtime/web-search.js +102 -0
- package/dist/agents/runtime/web-search.js.map +1 -0
- package/dist/agents/standard-prompt-templates.generated.d.ts +36 -0
- package/dist/agents/standard-prompt-templates.generated.d.ts.map +1 -0
- package/dist/agents/standard-prompt-templates.generated.js +122 -0
- package/dist/agents/standard-prompt-templates.generated.js.map +1 -0
- package/dist/agents/standard-prompts.d.ts +36 -0
- package/dist/agents/standard-prompts.d.ts.map +1 -0
- package/dist/agents/standard-prompts.js +202 -0
- package/dist/agents/standard-prompts.js.map +1 -0
- package/dist/agents/test-prompts.d.ts +12 -0
- package/dist/agents/test-prompts.d.ts.map +1 -0
- package/dist/agents/test-prompts.js +92 -0
- package/dist/agents/test-prompts.js.map +1 -0
- package/dist/agents/traits.d.ts +56 -0
- package/dist/agents/traits.d.ts.map +1 -0
- package/dist/agents/traits.js +100 -0
- package/dist/agents/traits.js.map +1 -0
- package/dist/agents/web-search.d.ts +43 -0
- package/dist/agents/web-search.d.ts.map +1 -0
- package/dist/agents/web-search.js +102 -0
- package/dist/agents/web-search.js.map +1 -0
- package/dist/fragmentLibrary/DeterministicFragmentSelector.d.ts +10 -0
- package/dist/fragmentLibrary/DeterministicFragmentSelector.d.ts.map +1 -0
- package/dist/fragmentLibrary/DeterministicFragmentSelector.js +12 -0
- package/dist/fragmentLibrary/DeterministicFragmentSelector.js.map +1 -0
- package/dist/fragmentLibrary/FragmentLibraryService.d.ts +55 -0
- package/dist/fragmentLibrary/FragmentLibraryService.d.ts.map +1 -0
- package/dist/fragmentLibrary/FragmentLibraryService.js +203 -0
- package/dist/fragmentLibrary/FragmentLibraryService.js.map +1 -0
- package/dist/fragmentLibrary/FragmentSourceService.d.ts +51 -0
- package/dist/fragmentLibrary/FragmentSourceService.d.ts.map +1 -0
- package/dist/fragmentLibrary/FragmentSourceService.js +181 -0
- package/dist/fragmentLibrary/FragmentSourceService.js.map +1 -0
- package/dist/fragmentLibrary/LlmFragmentSelector.d.ts +21 -0
- package/dist/fragmentLibrary/LlmFragmentSelector.d.ts.map +1 -0
- package/dist/fragmentLibrary/LlmFragmentSelector.js +87 -0
- package/dist/fragmentLibrary/LlmFragmentSelector.js.map +1 -0
- package/dist/fragmentLibrary/fragment-catalog.d.ts +43 -0
- package/dist/fragmentLibrary/fragment-catalog.d.ts.map +1 -0
- package/dist/fragmentLibrary/fragment-catalog.js +129 -0
- package/dist/fragmentLibrary/fragment-catalog.js.map +1 -0
- package/dist/fragmentLibrary/fragment-source.logic.d.ts +34 -0
- package/dist/fragmentLibrary/fragment-source.logic.d.ts.map +1 -0
- package/dist/fragmentLibrary/fragment-source.logic.js +172 -0
- package/dist/fragmentLibrary/fragment-source.logic.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/cache.d.ts +22 -0
- package/dist/providers/cache.d.ts.map +1 -0
- package/dist/providers/cache.js +64 -0
- package/dist/providers/cache.js.map +1 -0
- package/dist/providers/endpoints.d.ts +8 -0
- package/dist/providers/endpoints.d.ts.map +1 -0
- package/dist/providers/endpoints.js +23 -0
- package/dist/providers/endpoints.js.map +1 -0
- package/dist/providers/index.d.ts +6 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +6 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/instrumented.d.ts +28 -0
- package/dist/providers/instrumented.d.ts.map +1 -0
- package/dist/providers/instrumented.js +147 -0
- package/dist/providers/instrumented.js.map +1 -0
- package/dist/providers/registry.d.ts +26 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +32 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/resolvers.d.ts +58 -0
- package/dist/providers/resolvers.d.ts.map +1 -0
- package/dist/providers/resolvers.js +78 -0
- package/dist/providers/resolvers.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-configs.d.ts","sourceRoot":"","sources":["../../src/agents/agent-configs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAQ3E,yFAAyF;AACzF,eAAO,MAAM,4BAA4B,uBAAuB,CAAA;AAChE,6EAA6E;AAC7E,eAAO,MAAM,+BAA+B,yBAAyB,CAAA;AAqCrE;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,SAAS,GAAG,qBAAqB,EAAE,CAI/E;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,qBAAqB,EAAE,CAQ7F"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { registeredConfigContributions } from './registry.js';
|
|
2
|
+
// Built-in agent config contributions. An agent kind declares the task-level
|
|
3
|
+
// parameters it cares about here; the union over a pipeline's kinds is what the
|
|
4
|
+
// task-creation form and inspector render (and freeze once the owning step runs).
|
|
5
|
+
// Custom kinds contribute the same way via `registerAgentKind({ configContributions })`.
|
|
6
|
+
/** The Tester's environment choice: stand infra up locally, or use the ephemeral env. */
|
|
7
|
+
export const TESTER_ENVIRONMENT_CONFIG_ID = 'tester.environment';
|
|
8
|
+
/** The acceptance/e2e execution target: project CI, or the ephemeral env. */
|
|
9
|
+
export const PLAYWRIGHT_E2E_TARGET_CONFIG_ID = 'playwright.e2eTarget';
|
|
10
|
+
const BUILTIN_CONFIG_CONTRIBUTIONS = {
|
|
11
|
+
tester: [
|
|
12
|
+
{
|
|
13
|
+
id: TESTER_ENVIRONMENT_CONFIG_ID,
|
|
14
|
+
agentKind: 'tester',
|
|
15
|
+
label: 'Test environment',
|
|
16
|
+
description: "Where the Tester runs the suite: with the service's dependencies stood up locally via docker-compose, or against the provisioned ephemeral environment.",
|
|
17
|
+
type: 'select',
|
|
18
|
+
options: [
|
|
19
|
+
{ value: 'ephemeral', label: 'Ephemeral environment' },
|
|
20
|
+
{ value: 'local', label: 'Local (docker-compose infra)' },
|
|
21
|
+
],
|
|
22
|
+
// Ephemeral is the zero-config default; local is an opt-in that requires the
|
|
23
|
+
// service's test infra to be configured (a compose path or the no-infra flag).
|
|
24
|
+
default: 'ephemeral',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
playwright: [
|
|
28
|
+
{
|
|
29
|
+
id: PLAYWRIGHT_E2E_TARGET_CONFIG_ID,
|
|
30
|
+
agentKind: 'playwright',
|
|
31
|
+
label: 'E2E execution target',
|
|
32
|
+
description: 'Where the acceptance / end-to-end tests run: in the project CI (GitHub Actions), or against the provisioned ephemeral environment.',
|
|
33
|
+
type: 'select',
|
|
34
|
+
options: [
|
|
35
|
+
{ value: 'ci', label: 'Project CI (GitHub Actions)' },
|
|
36
|
+
{ value: 'ephemeral', label: 'Ephemeral environment' },
|
|
37
|
+
],
|
|
38
|
+
default: 'ci',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The config descriptors an agent kind contributes: the built-in ones plus any a
|
|
44
|
+
* deployment registered for the kind. Empty for kinds that contribute none.
|
|
45
|
+
*/
|
|
46
|
+
export function configContributionsFor(kind) {
|
|
47
|
+
const builtin = BUILTIN_CONFIG_CONTRIBUTIONS[kind] ?? [];
|
|
48
|
+
const registered = registeredConfigContributions(kind);
|
|
49
|
+
return registered.length ? [...builtin, ...registered] : builtin;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The deduplicated catalog of config descriptors contributed across a set of agent
|
|
53
|
+
* kinds (e.g. all the kinds used by a workspace's pipelines), keyed by descriptor
|
|
54
|
+
* id (first contribution wins). This is what the workspace snapshot carries.
|
|
55
|
+
*/
|
|
56
|
+
export function configContributionCatalog(kinds) {
|
|
57
|
+
const byId = new Map();
|
|
58
|
+
for (const kind of kinds) {
|
|
59
|
+
for (const descriptor of configContributionsFor(kind)) {
|
|
60
|
+
if (!byId.has(descriptor.id))
|
|
61
|
+
byId.set(descriptor.id, descriptor);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return [...byId.values()];
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=agent-configs.js.map
|
|
@@ -0,0 +1 @@
|
|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AC,CAAA;IACtD,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAA0B;IAClE,MAAM,IAAI,GAAG,IAAI,GAAG,EAAiC,CAAA;IACrD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,UAAU,IAAI,sBAAsB,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;gBAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,CAAA;QACnE,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { AgentKind } from '@cat-factory/kernel';
|
|
2
|
+
import type { ModelRef } from '@cat-factory/kernel';
|
|
3
|
+
export interface AgentModelConfig {
|
|
4
|
+
ref: ModelRef;
|
|
5
|
+
temperature?: number;
|
|
6
|
+
maxOutputTokens?: number;
|
|
7
|
+
/** Overrides the built-in role system prompt for this agent kind. */
|
|
8
|
+
system?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AgentRouting {
|
|
11
|
+
/** Used for any agent kind without a specific entry (incl. custom agents). */
|
|
12
|
+
default: AgentModelConfig;
|
|
13
|
+
byKind: Partial<Record<AgentKind, AgentModelConfig>>;
|
|
14
|
+
}
|
|
15
|
+
/** Resolve the effective config for an agent kind, falling back to the default. */
|
|
16
|
+
export declare function resolveAgentConfig(routing: AgentRouting, kind: AgentKind): AgentModelConfig;
|
|
17
|
+
/** The resolvers a caller supplies so a step's model is picked the same way everywhere. */
|
|
18
|
+
export interface StepModelResolvers {
|
|
19
|
+
agentRouting: AgentRouting;
|
|
20
|
+
/** Resolve a model catalog id to a concrete ref; unknown/absent ids return undefined. */
|
|
21
|
+
resolveBlockModel: (modelId: string | undefined) => ModelRef | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Resolve a workspace's per-agent-kind default model id, consulted when the block
|
|
24
|
+
* pins no usable model. Optional: absent → the env routing for the kind is used.
|
|
25
|
+
*/
|
|
26
|
+
resolveWorkspaceModelDefault?: (workspaceId: string, agentKind: string) => Promise<string | undefined>;
|
|
27
|
+
}
|
|
28
|
+
/** What a step needs to resolve its model: which kind, the block's pin, the workspace. */
|
|
29
|
+
export interface StepModelInputs {
|
|
30
|
+
agentKind: string;
|
|
31
|
+
/** The model catalog id pinned on the block, if any. */
|
|
32
|
+
blockModelId: string | undefined;
|
|
33
|
+
/** The workspace the step runs in; required to consult a per-kind default. */
|
|
34
|
+
workspaceId?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the concrete model ref for a pipeline step with the ONE canonical
|
|
38
|
+
* precedence used across every executor (the inline LLM executor, the container
|
|
39
|
+
* executor and the requirements reviewer): a block's pinned model wins, else the
|
|
40
|
+
* workspace's per-agent-kind default, else the env routing for the kind. Each
|
|
41
|
+
* candidate id is run through {@link StepModelResolvers.resolveBlockModel}, so an
|
|
42
|
+
* unresolvable pin (e.g. a stale id) falls through to the next source rather than
|
|
43
|
+
* silently skipping the workspace default.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveStepModelRef(resolvers: StepModelResolvers, inputs: StepModelInputs): Promise<ModelRef>;
|
|
46
|
+
/**
|
|
47
|
+
* Resolve the model ref for an INLINE LLM call (one that runs through the
|
|
48
|
+
* {@link ModelProvider}, not a container harness). Identical precedence to
|
|
49
|
+
* {@link resolveStepModelRef}, but a pinned subscription model — one whose ref
|
|
50
|
+
* carries a container-only `claude-code` / `codex` harness, for which no provider
|
|
51
|
+
* key exists — is degraded to the kind's env-routing default (a provider model the
|
|
52
|
+
* ModelProvider can serve). This is the single place every inline executor routes a
|
|
53
|
+
* block's model through, so a task pinned to a subscription model for its container
|
|
54
|
+
* steps still runs its inline steps instead of hard-failing. See {@link inlineModelRef}.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveInlineModelRef(resolvers: StepModelResolvers, inputs: StepModelInputs): Promise<ModelRef>;
|
|
57
|
+
//# sourceMappingURL=agent-routing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-routing.d.ts","sourceRoot":"","sources":["../../src/agents/agent-routing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AASnD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,QAAQ,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,OAAO,EAAE,gBAAgB,CAAA;IACzB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAA;CACrD;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,GAAG,gBAAgB,CAE3F;AAED,2FAA2F;AAC3F,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,YAAY,CAAA;IAC1B,yFAAyF;IACzF,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,KAAK,QAAQ,GAAG,SAAS,CAAA;IACxE;;;OAGG;IACH,4BAA4B,CAAC,EAAE,CAC7B,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CACjC;AAED,0FAA0F;AAC1F,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,wDAAwD;IACxD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,kBAAkB,EAC7B,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,QAAQ,CAAC,CAYnB;AAED;;;;;;;;;GASG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,kBAAkB,EAC7B,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,QAAQ,CAAC,CAGnB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { inlineModelRef } from '@cat-factory/kernel';
|
|
2
|
+
/** Resolve the effective config for an agent kind, falling back to the default. */
|
|
3
|
+
export function resolveAgentConfig(routing, kind) {
|
|
4
|
+
return routing.byKind[kind] ?? routing.default;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the concrete model ref for a pipeline step with the ONE canonical
|
|
8
|
+
* precedence used across every executor (the inline LLM executor, the container
|
|
9
|
+
* executor and the requirements reviewer): a block's pinned model wins, else the
|
|
10
|
+
* workspace's per-agent-kind default, else the env routing for the kind. Each
|
|
11
|
+
* candidate id is run through {@link StepModelResolvers.resolveBlockModel}, so an
|
|
12
|
+
* unresolvable pin (e.g. a stale id) falls through to the next source rather than
|
|
13
|
+
* silently skipping the workspace default.
|
|
14
|
+
*/
|
|
15
|
+
export async function resolveStepModelRef(resolvers, inputs) {
|
|
16
|
+
const fromBlock = resolvers.resolveBlockModel(inputs.blockModelId);
|
|
17
|
+
if (fromBlock)
|
|
18
|
+
return fromBlock;
|
|
19
|
+
if (resolvers.resolveWorkspaceModelDefault && inputs.workspaceId) {
|
|
20
|
+
const defaultId = await resolvers.resolveWorkspaceModelDefault(inputs.workspaceId, inputs.agentKind);
|
|
21
|
+
const fromDefault = resolvers.resolveBlockModel(defaultId);
|
|
22
|
+
if (fromDefault)
|
|
23
|
+
return fromDefault;
|
|
24
|
+
}
|
|
25
|
+
return resolveAgentConfig(resolvers.agentRouting, inputs.agentKind).ref;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the model ref for an INLINE LLM call (one that runs through the
|
|
29
|
+
* {@link ModelProvider}, not a container harness). Identical precedence to
|
|
30
|
+
* {@link resolveStepModelRef}, but a pinned subscription model — one whose ref
|
|
31
|
+
* carries a container-only `claude-code` / `codex` harness, for which no provider
|
|
32
|
+
* key exists — is degraded to the kind's env-routing default (a provider model the
|
|
33
|
+
* ModelProvider can serve). This is the single place every inline executor routes a
|
|
34
|
+
* block's model through, so a task pinned to a subscription model for its container
|
|
35
|
+
* steps still runs its inline steps instead of hard-failing. See {@link inlineModelRef}.
|
|
36
|
+
*/
|
|
37
|
+
export async function resolveInlineModelRef(resolvers, inputs) {
|
|
38
|
+
const ref = await resolveStepModelRef(resolvers, inputs);
|
|
39
|
+
return inlineModelRef(ref, resolveAgentConfig(resolvers.agentRouting, inputs.agentKind).ref);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=agent-routing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-routing.js","sourceRoot":"","sources":["../../src/agents/agent-routing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAsBpD,mFAAmF;AACnF,MAAM,UAAU,kBAAkB,CAAC,OAAqB,EAAE,IAAe;IACvE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,OAAO,CAAA;AAChD,CAAC;AA0BD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,SAA6B,EAC7B,MAAuB;IAEvB,MAAM,SAAS,GAAG,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;IAClE,IAAI,SAAS;QAAE,OAAO,SAAS,CAAA;IAC/B,IAAI,SAAS,CAAC,4BAA4B,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACjE,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,4BAA4B,CAC5D,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,SAAS,CACjB,CAAA;QACD,MAAM,WAAW,GAAG,SAAS,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAA;QAC1D,IAAI,WAAW;YAAE,OAAO,WAAW,CAAA;IACrC,CAAC;IACD,OAAO,kBAAkB,CAAC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAA;AACzE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,SAA6B,EAC7B,MAAuB;IAEvB,MAAM,GAAG,GAAG,MAAM,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IACxD,OAAO,cAAc,CAAC,GAAG,EAAE,kBAAkB,CAAC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAA;AAC9F,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AgentKind } from '@cat-factory/kernel';
|
|
2
|
+
/** The agent kinds that make up the business-logic / domain-rules track. */
|
|
3
|
+
export type BusinessLogicAgentKind = 'business-documenter' | 'business-reviewer';
|
|
4
|
+
export declare const BUSINESS_LOGIC_AGENT_KINDS: readonly BusinessLogicAgentKind[];
|
|
5
|
+
/**
|
|
6
|
+
* The kind that writes/updates the documentation. Repo-operating: the worker
|
|
7
|
+
* routes it to the container executor (see `CONTAINER_KINDS`) so it can read the
|
|
8
|
+
* checkout and commit the docs through a pull request.
|
|
9
|
+
*/
|
|
10
|
+
export declare const BUSINESS_DOCUMENTER_KIND: BusinessLogicAgentKind;
|
|
11
|
+
/** The kind that reviews a change against the documented rules. Inline. */
|
|
12
|
+
export declare const BUSINESS_REVIEWER_KIND: BusinessLogicAgentKind;
|
|
13
|
+
/**
|
|
14
|
+
* Canonical in-repo home for the documentation this track produces and reviews
|
|
15
|
+
* against. Both prompts reference it so the documenter writes where the reviewer
|
|
16
|
+
* later looks. An established location already present in the repo wins over this
|
|
17
|
+
* default — the prompts tell the agents to respect one if they find it.
|
|
18
|
+
*/
|
|
19
|
+
export declare const BUSINESS_LOGIC_DOCS_DIR = "docs/business-logic";
|
|
20
|
+
/** True when the agent kind is part of the business-logic / domain-rules track. */
|
|
21
|
+
export declare function isBusinessLogicKind(kind: AgentKind): kind is BusinessLogicAgentKind;
|
|
22
|
+
/**
|
|
23
|
+
* The built-out system (role) prompt for a business-logic agent kind, or
|
|
24
|
+
* `undefined` when the kind is not part of this track (so callers can fall
|
|
25
|
+
* through to the standard phases / acceptance track / mock builder / generic role).
|
|
26
|
+
*/
|
|
27
|
+
export declare function businessLogicSystemPrompt(kind: AgentKind): string | undefined;
|
|
28
|
+
//# sourceMappingURL=business-logic-prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-logic-prompts.d.ts","sourceRoot":"","sources":["../../src/agents/business-logic-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AA2BpD,4EAA4E;AAC5E,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,GAAG,mBAAmB,CAAA;AAEhF,eAAO,MAAM,0BAA0B,EAAE,SAAS,sBAAsB,EAGvE,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,sBAA8C,CAAA;AAErF,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,EAAE,sBAA4C,CAAA;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,wBAAwB,CAAA;AAkE5D,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,SAAS,GAAG,IAAI,IAAI,sBAAsB,CAEnF;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAE7E"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { PLATFORM_DELIVERY_CONTRACT } from './ci-gate.js';
|
|
2
|
+
import { STANDARDS_FOOTER } from './prompt-shared.js';
|
|
3
|
+
export const BUSINESS_LOGIC_AGENT_KINDS = [
|
|
4
|
+
'business-documenter',
|
|
5
|
+
'business-reviewer',
|
|
6
|
+
];
|
|
7
|
+
/**
|
|
8
|
+
* The kind that writes/updates the documentation. Repo-operating: the worker
|
|
9
|
+
* routes it to the container executor (see `CONTAINER_KINDS`) so it can read the
|
|
10
|
+
* checkout and commit the docs through a pull request.
|
|
11
|
+
*/
|
|
12
|
+
export const BUSINESS_DOCUMENTER_KIND = 'business-documenter';
|
|
13
|
+
/** The kind that reviews a change against the documented rules. Inline. */
|
|
14
|
+
export const BUSINESS_REVIEWER_KIND = 'business-reviewer';
|
|
15
|
+
/**
|
|
16
|
+
* Canonical in-repo home for the documentation this track produces and reviews
|
|
17
|
+
* against. Both prompts reference it so the documenter writes where the reviewer
|
|
18
|
+
* later looks. An established location already present in the repo wins over this
|
|
19
|
+
* default — the prompts tell the agents to respect one if they find it.
|
|
20
|
+
*/
|
|
21
|
+
export const BUSINESS_LOGIC_DOCS_DIR = 'docs/business-logic';
|
|
22
|
+
// The documenter commits docs through a pull request, but the push + PR are the
|
|
23
|
+
// platform's job — it has no push credentials. "Done" means the documentation is
|
|
24
|
+
// written, committed and consistent with the code it describes; the platform then
|
|
25
|
+
// pushes, opens the PR and drives CI per the shared PLATFORM_DELIVERY_CONTRACT.
|
|
26
|
+
const DOCS_DELIVERY_GATE = [
|
|
27
|
+
'Definition of done: the documentation is written, committed, and consistent with the code it describes.',
|
|
28
|
+
PLATFORM_DELIVERY_CONTRACT,
|
|
29
|
+
].join('\n');
|
|
30
|
+
const SYSTEM_PROMPTS = {
|
|
31
|
+
'business-documenter': [
|
|
32
|
+
'You are a domain analyst owning the BUSINESS-LOGIC & DOMAIN-RULES DOCUMENTATION for a building block / service.',
|
|
33
|
+
'Read the actual implementation and capture the business rules, domain constraints and invariants the code really enforces as durable Markdown documentation committed to the repository.',
|
|
34
|
+
'',
|
|
35
|
+
'Ground every rule in the code — never invent rules:',
|
|
36
|
+
'- Derive rules from the real implementation: domain services and models, input validation, the conditions that raise domain errors (validation / conflict / not-found), default constants and thresholds, state-machine transitions, authorization checks and guards, and the behaviour the tests pin down.',
|
|
37
|
+
'- Document the WHAT and WHY a rule must hold (the constraint / invariant), not the incidental HOW it happens to be coded. Distinguish a genuine domain rule from an implementation detail.',
|
|
38
|
+
'- Every documented rule must be traceable to a concrete source location (file + symbol). If you cannot point at the code, do not assert the rule.',
|
|
39
|
+
'',
|
|
40
|
+
'Use the linked context documents as authoritative intent:',
|
|
41
|
+
'- Treat the linked context documents (requirements / RFCs / PRDs and any extra context attached to the block) as the statement of intended behaviour, and cite them as a rule’s rationale where they agree with the code.',
|
|
42
|
+
'- Where a context document and the code DISAGREE, do not silently pick one: document the rule as actually implemented and add a clearly marked "Doc/code mismatch" note describing the discrepancy so a human can resolve it.',
|
|
43
|
+
'',
|
|
44
|
+
'Be incremental and additive:',
|
|
45
|
+
`- First discover what is already documented: read the existing business-logic docs in the repository (look under \`${BUSINESS_LOGIC_DOCS_DIR}/\`; if a different location is already established, respect and use that one instead of creating a second home).`,
|
|
46
|
+
'- Update existing rules in place and preserve their stable ids; do not renumber or rewrite wholesale. Add new rules with new ids.',
|
|
47
|
+
'- When a rule no longer exists in the code, mark it as removed (with the reason / date) rather than silently deleting it, so its disappearance stays auditable.',
|
|
48
|
+
'',
|
|
49
|
+
'Structure the docs so they are diff-friendly and reviewable:',
|
|
50
|
+
`- Organise one document per domain area, mirroring the code’s own module boundaries, with an index that lists every area and the external context sources it draws on. Keep \`${BUSINESS_LOGIC_DOCS_DIR}/\` (or the established docs home) as the single root.`,
|
|
51
|
+
'- Give every rule a stable, human-readable id (e.g. `AREA-01`) and a declarative, testable statement, plus its source location, rationale, related constraints/invariants and notable edge cases. One rule = one checkable assertion; split compound rules.',
|
|
52
|
+
'- These docs are the baseline the business-reviewer agent later checks changes against, so precision and stable ids matter more than prose.',
|
|
53
|
+
'',
|
|
54
|
+
'Output the documentation files to commit (created or updated), refresh the index and the linked-context-sources list, and give a short summary of which rules were added, updated, removed, and any doc/code mismatches you flagged.',
|
|
55
|
+
'',
|
|
56
|
+
DOCS_DELIVERY_GATE,
|
|
57
|
+
'',
|
|
58
|
+
STANDARDS_FOOTER,
|
|
59
|
+
].join('\n'),
|
|
60
|
+
'business-reviewer': [
|
|
61
|
+
'You are a domain-rules reviewer owning the BUSINESS-LOGIC REVIEW of a change.',
|
|
62
|
+
'Compare the proposed change against the previously written business-logic / domain-rules documentation and report where the change and the documented rules have diverged. Your report is the deliverable — produce it as your output so it is shown in the UI.',
|
|
63
|
+
'',
|
|
64
|
+
'What to review against what:',
|
|
65
|
+
`- The documented rules are the baseline: read them from the linked context documents and the prior steps’ output (the business-logic docs under \`${BUSINESS_LOGIC_DOCS_DIR}/\`, produced by the business-documenter). Map each documented rule to the part of the change it governs.`,
|
|
66
|
+
'- The change under review is the implementation / work described by the block intent and the earlier agents’ output in this run.',
|
|
67
|
+
'- If no business-logic documentation is available, say so plainly and recommend running the business-documenter first to establish a baseline; still flag the most likely rule changes, but mark that there is no baseline to check against.',
|
|
68
|
+
'',
|
|
69
|
+
'Classify every relevant change into exactly one bucket, and be conservative — do not invent violations:',
|
|
70
|
+
'- VIOLATION — the change contradicts a documented rule, constraint or invariant (e.g. removes a guard the docs say must hold, weakens a validation, changes a pinned default). Cite the rule id.',
|
|
71
|
+
'- UNDOCUMENTED CHANGE — new or altered business behaviour with no corresponding documented rule; the docs are now stale or incomplete. Note which rule area it belongs under.',
|
|
72
|
+
'- UNEXPECTED / SILENT DRIFT — a documented rule’s meaning changed while its surface looks the same (e.g. a comparison flipped from >= to >, an edge case handled differently, an error code changed). These are the dangerous ones: look specifically for semantic changes a casual read would miss. Cite the rule id.',
|
|
73
|
+
'- CONSISTENT — the change touches a documented rule but preserves it; report briefly as evidence of coverage.',
|
|
74
|
+
'- When you are unsure, mark it as drift with a confidence note and your reasoning rather than asserting a violation.',
|
|
75
|
+
'',
|
|
76
|
+
'Produce a structured Markdown report:',
|
|
77
|
+
'- Open with a one-line verdict (is the change safe to ship with respect to the documented rules?) and a summary count of findings per bucket.',
|
|
78
|
+
'- Then list the findings grouped by bucket, ordered violations first. For each: a short title, the documented rule it concerns (id + statement), what the change does, why it diverges, and a concrete suggested action (fix the change, or update the rule if the change is intended).',
|
|
79
|
+
'- Reference the specific code / rule each finding concerns; keep it actionable and free of invented problems. If the change is fully consistent, say so explicitly.',
|
|
80
|
+
'',
|
|
81
|
+
STANDARDS_FOOTER,
|
|
82
|
+
].join('\n'),
|
|
83
|
+
};
|
|
84
|
+
/** True when the agent kind is part of the business-logic / domain-rules track. */
|
|
85
|
+
export function isBusinessLogicKind(kind) {
|
|
86
|
+
return kind === 'business-documenter' || kind === 'business-reviewer';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The built-out system (role) prompt for a business-logic agent kind, or
|
|
90
|
+
* `undefined` when the kind is not part of this track (so callers can fall
|
|
91
|
+
* through to the standard phases / acceptance track / mock builder / generic role).
|
|
92
|
+
*/
|
|
93
|
+
export function businessLogicSystemPrompt(kind) {
|
|
94
|
+
return isBusinessLogicKind(kind) ? SYSTEM_PROMPTS[kind] : undefined;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=business-logic-prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-logic-prompts.js","sourceRoot":"","sources":["../../src/agents/business-logic-prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,gBAAgB,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,uCAAuC;QACvC,+IAA+I;QAC/I,yRAAyR;QACzR,qKAAqK;QACrK,EAAE;QACF,gBAAgB;KACjB,CAAC,IAAI,CAAC,IAAI,CAAC;CACb,CAAA;AAED,mFAAmF;AACnF,MAAM,UAAU,mBAAmB,CAAC,IAAe;IACjD,OAAO,IAAI,KAAK,qBAAqB,IAAI,IAAI,KAAK,mBAAmB,CAAA;AACvE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAe;IACvD,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AACrE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AgentKind } from '@cat-factory/kernel';
|
|
2
|
+
import type { AgentRunContext } from '@cat-factory/kernel';
|
|
3
|
+
export declare function systemPromptFor(kind: AgentKind): string;
|
|
4
|
+
/** Build the user prompt from the block context and the run so far. */
|
|
5
|
+
export declare function userPromptFor(context: AgentRunContext): string;
|
|
6
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/agents/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAgC1D,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAUvD;AAgED,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAE9D"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { acceptanceSystemPrompt, testApproachSection, e2eTargetSection, } from './prompts/acceptance.js';
|
|
2
|
+
import { companionSystemPrompt } from './prompts/companion.js';
|
|
3
|
+
import { companionTargets, isCompanionKind } from './kinds/companions.js';
|
|
4
|
+
import { READ_ONLY_GUARDRAIL, isReadOnlyAgentKind } from './kinds/read-only.js';
|
|
5
|
+
import { businessLogicSystemPrompt } from './prompts/business-logic.js';
|
|
6
|
+
import { mockSystemPrompt } from './prompts/mock.js';
|
|
7
|
+
import { testingSystemPrompt, testerEnvironmentSection } from './prompts/testing.js';
|
|
8
|
+
import { registeredSystemPrompt, registeredUserPrompt } from './kinds/registry.js';
|
|
9
|
+
import { traitGuidanceFor } from './kinds/traits.js';
|
|
10
|
+
import { roleSystemPrompt } from './prompts/roles.js';
|
|
11
|
+
import { environmentSection, linkedContextSection, phaseForKind, renderStandardUserPrompt, standardSystemPrompt, } from './prompts/standard.js';
|
|
12
|
+
// Prompt construction for the built-in agent kinds: turns an agent kind + block
|
|
13
|
+
// context into the system/user prompts handed to the LLM. This file is the
|
|
14
|
+
// DISPATCHER — `baseSystemPromptFor` picks which track owns a kind; the prompt TEXT
|
|
15
|
+
// for each track lives under ./prompts (the four standard phases design/build/review/
|
|
16
|
+
// test in ./prompts/standard, the acceptance track in ./prompts/acceptance, the mock
|
|
17
|
+
// builder in ./prompts/mock, the business-logic track in ./prompts/business-logic,
|
|
18
|
+
// the tester/fixer track in ./prompts/testing, the companions in ./prompts/companion,
|
|
19
|
+
// and the thin one-line roles + generic fallback in ./prompts/roles).
|
|
20
|
+
export function systemPromptFor(kind) {
|
|
21
|
+
const base = baseSystemPromptFor(kind);
|
|
22
|
+
// Read-only kinds (architect, analysis) explore a real checkout but must never edit
|
|
23
|
+
// it; append the shared guardrail so the harness `/explore` run stays edit-free.
|
|
24
|
+
const withGuardrail = isReadOnlyAgentKind(kind) ? `${base}\n\n${READ_ONLY_GUARDRAIL}` : base;
|
|
25
|
+
// Fold in any guidance contributed by the kind's traits (e.g. the spec-aware kinds get
|
|
26
|
+
// the in-repo-spec reading guidance). Marker traits like `code-aware` add nothing here —
|
|
27
|
+
// their effect (folding the service's fragments) is applied by the execution engine.
|
|
28
|
+
const guidance = traitGuidanceFor(kind);
|
|
29
|
+
return guidance.length ? `${withGuardrail}\n\n${guidance.join('\n\n')}` : withGuardrail;
|
|
30
|
+
}
|
|
31
|
+
function baseSystemPromptFor(kind) {
|
|
32
|
+
// Companion kinds (reviewer, architect-companion, spec-companion, …) win over every
|
|
33
|
+
// built-in track: they grade a prior step's output and return a JSON rating.
|
|
34
|
+
const companion = companionSystemPrompt(kind);
|
|
35
|
+
if (companion)
|
|
36
|
+
return companion;
|
|
37
|
+
const phase = phaseForKind(kind);
|
|
38
|
+
if (phase)
|
|
39
|
+
return standardSystemPrompt(phase);
|
|
40
|
+
// The Tester/Fixer track runs in a container and returns a structured report /
|
|
41
|
+
// pushes fixes; it owns its own prompts rather than the generic `test` phase.
|
|
42
|
+
const testing = testingSystemPrompt(kind);
|
|
43
|
+
if (testing)
|
|
44
|
+
return testing;
|
|
45
|
+
const acceptance = acceptanceSystemPrompt(kind);
|
|
46
|
+
if (acceptance)
|
|
47
|
+
return acceptance;
|
|
48
|
+
const mock = mockSystemPrompt(kind);
|
|
49
|
+
if (mock)
|
|
50
|
+
return mock;
|
|
51
|
+
const businessLogic = businessLogicSystemPrompt(kind);
|
|
52
|
+
if (businessLogic)
|
|
53
|
+
return businessLogic;
|
|
54
|
+
// Custom kinds registered by a deployment (e.g. a proprietary org package) win over
|
|
55
|
+
// the generic fallback below, but never shadow the built-in tracks above.
|
|
56
|
+
const registered = registeredSystemPrompt(kind);
|
|
57
|
+
if (registered !== undefined)
|
|
58
|
+
return registered;
|
|
59
|
+
return roleSystemPrompt(kind);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* When a human requested changes on this step's gated proposal, append their
|
|
63
|
+
* feedback and the previous proposal so the agent revises rather than restarts.
|
|
64
|
+
* Applied to every inline agent kind (standard-phase and generic alike).
|
|
65
|
+
*/
|
|
66
|
+
function withRevision(prompt, context) {
|
|
67
|
+
const revision = context.revision;
|
|
68
|
+
if (!revision)
|
|
69
|
+
return prompt;
|
|
70
|
+
const lines = [
|
|
71
|
+
prompt,
|
|
72
|
+
'',
|
|
73
|
+
'A human reviewed your previous proposal and requested changes. Revise that',
|
|
74
|
+
'proposal to address their feedback — keep what still holds, change what they',
|
|
75
|
+
'flagged. Do not start from scratch.',
|
|
76
|
+
'',
|
|
77
|
+
'Your previous proposal:',
|
|
78
|
+
revision.previousProposal || '(empty)',
|
|
79
|
+
'',
|
|
80
|
+
'Reviewer feedback:',
|
|
81
|
+
revision.feedback || '(none given)',
|
|
82
|
+
];
|
|
83
|
+
// Per-block comments the reviewer left on specific parts of the proposal. Each
|
|
84
|
+
// quotes the exact text it targets, so the agent can locate and revise it.
|
|
85
|
+
if (revision.comments?.length) {
|
|
86
|
+
lines.push('', 'Comments on specific parts of your proposal:');
|
|
87
|
+
for (const c of revision.comments) {
|
|
88
|
+
lines.push('', 'On this part:', c.quotedSource || '(empty)', 'Comment:', c.body || '(none given)');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return lines.join('\n');
|
|
92
|
+
}
|
|
93
|
+
/** Build the user prompt from the block context and the run so far. */
|
|
94
|
+
export function userPromptFor(context) {
|
|
95
|
+
return withRevision(buildBaseUserPrompt(context), context);
|
|
96
|
+
}
|
|
97
|
+
function buildBaseUserPrompt(context) {
|
|
98
|
+
// Standard phases get their built-out, templated user prompt.
|
|
99
|
+
const phase = phaseForKind(context.agentKind);
|
|
100
|
+
if (phase)
|
|
101
|
+
return renderStandardUserPrompt(phase, context);
|
|
102
|
+
// A registered custom kind may supply its own user prompt; otherwise it falls through
|
|
103
|
+
// to the generic block-context prompt below, like any other non-standard-phase kind.
|
|
104
|
+
const registered = registeredUserPrompt(context);
|
|
105
|
+
if (registered !== undefined)
|
|
106
|
+
return registered;
|
|
107
|
+
const { block, pipelineName, priorOutputs, decisions, resolvedDecision } = context;
|
|
108
|
+
const lines = [
|
|
109
|
+
`Pipeline: ${pipelineName}`,
|
|
110
|
+
`Block: ${block.title} (${block.type})`,
|
|
111
|
+
`Description: ${block.description || '(none provided)'}`,
|
|
112
|
+
];
|
|
113
|
+
// A companion grades a specific preceding producer; name it explicitly so the
|
|
114
|
+
// model rates the right output rather than guessing among the prior-agent sections.
|
|
115
|
+
const companionTarget = companionTargetSection(context);
|
|
116
|
+
if (companionTarget)
|
|
117
|
+
lines.push(companionTarget);
|
|
118
|
+
const linked = linkedContextSection(context);
|
|
119
|
+
if (linked)
|
|
120
|
+
lines.push(linked);
|
|
121
|
+
const envSection = environmentSection(context);
|
|
122
|
+
if (envSection)
|
|
123
|
+
lines.push(envSection);
|
|
124
|
+
const approachSection = testApproachSection(context);
|
|
125
|
+
if (approachSection)
|
|
126
|
+
lines.push(approachSection);
|
|
127
|
+
const targetSection = e2eTargetSection(context);
|
|
128
|
+
if (targetSection)
|
|
129
|
+
lines.push(targetSection);
|
|
130
|
+
const testerEnv = testerEnvironmentSection(context);
|
|
131
|
+
if (testerEnv)
|
|
132
|
+
lines.push(testerEnv);
|
|
133
|
+
const allDecisions = resolvedDecision ? [...decisions, resolvedDecision] : decisions;
|
|
134
|
+
if (allDecisions.length) {
|
|
135
|
+
lines.push('', 'Resolved decisions:');
|
|
136
|
+
for (const d of allDecisions)
|
|
137
|
+
lines.push(`- ${d.question} → ${d.chosen}`);
|
|
138
|
+
}
|
|
139
|
+
if (priorOutputs.length) {
|
|
140
|
+
lines.push('', 'Work from earlier agents in this pipeline:');
|
|
141
|
+
for (const p of priorOutputs) {
|
|
142
|
+
lines.push(`### ${p.agentKind}`, p.output);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
lines.push('', 'Produce your contribution. Be concise and concrete.');
|
|
146
|
+
return lines.join('\n');
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* For a companion step, name the specific producer output it must grade: the NEAREST
|
|
150
|
+
* preceding step whose kind is one of the companion's targets. Without this the model
|
|
151
|
+
* has to infer which "### <agentKind>" section is the one under review — fine when the
|
|
152
|
+
* producer is adjacent, ambiguous when other steps sit in between. Undefined for
|
|
153
|
+
* non-companion kinds or when no target output is present yet.
|
|
154
|
+
*/
|
|
155
|
+
function companionTargetSection(context) {
|
|
156
|
+
if (!isCompanionKind(context.agentKind))
|
|
157
|
+
return undefined;
|
|
158
|
+
const targets = companionTargets(context.agentKind);
|
|
159
|
+
for (let i = context.priorOutputs.length - 1; i >= 0; i--) {
|
|
160
|
+
const produced = context.priorOutputs[i];
|
|
161
|
+
if (targets.includes(produced.agentKind)) {
|
|
162
|
+
return (`You are grading the output of the \`${produced.agentKind}\` step (shown under ` +
|
|
163
|
+
`"### ${produced.agentKind}" below). Base your rating on THAT output.`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/agents/catalog.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AACpF,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EACL,kBAAkB,EAClB,oBAAo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D,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1D,MAAM,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAE,CAAA;QACzC,IAAI,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YACzC,OAAO,CACL,uCAAuC,QAAQ,CAAC,SAAS,uBAAuB;gBAChF,QAAQ,QAAQ,CAAC,SAAS,4CAA4C,CACvE,CAAA;QACH,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAA;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-gate.d.ts","sourceRoot":"","sources":["../../src/agents/ci-gate.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,0BAA0B,QAW3B,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// The shared delivery contract appended to every container coding-agent role that
|
|
2
|
+
// works on a real checkout and ships its result through a pull request — the build
|
|
3
|
+
// (standard-prompts), the runnable-tests / e2e (acceptance-prompts) and the docs
|
|
4
|
+
// (business-logic-prompts) gates.
|
|
5
|
+
//
|
|
6
|
+
// These agents run inside an ephemeral container with NO push credentials: the
|
|
7
|
+
// platform owns version control (push + PR) and the CI loop. Earlier prompts told
|
|
8
|
+
// the agent to "open or update the pull request, push the fix, and wait for CI" —
|
|
9
|
+
// but the agent cannot push (the GitHub token never enters its shell) and was never
|
|
10
|
+
// meant to. That instruction was actively harmful: a capable model took it
|
|
11
|
+
// literally, tried to `git push`, hit an auth wall, and then burned the ENTIRE run
|
|
12
|
+
// probing env vars, decoding tokens and poking at git remotes instead of doing the
|
|
13
|
+
// work (the run shipped zero changes and failed with "no file changes"); weaker
|
|
14
|
+
// models simply gave up. This contract makes the boundary explicit so the agent
|
|
15
|
+
// spends its whole budget on the change and never chases credentials.
|
|
16
|
+
//
|
|
17
|
+
// Commit ownership stays with the AGENT: only it knows which files are part of the
|
|
18
|
+
// solution versus scratch scripts / build artifacts it created while exploring, so
|
|
19
|
+
// it selects and commits its own work. The harness then pushes those commits and
|
|
20
|
+
// opens the PR — it does not blindly `git add -A` (that would commit garbage).
|
|
21
|
+
export const PLATFORM_DELIVERY_CONTRACT = [
|
|
22
|
+
'How your work ships — you commit, the platform delivers:',
|
|
23
|
+
'- Commit your changes yourself, with clear messages. YOU decide what belongs in each commit: stage only the files that are part of the solution, including any new source files you added. Do NOT commit build artifacts, dependencies, caches, logs, or the scratch/throwaway scripts you created while exploring. The platform will not add untracked files for you, so anything you leave uncommitted and untracked is lost.',
|
|
24
|
+
'- After you finish, the platform pushes your branch, opens or updates the pull request, runs CI, and — if a required check fails — dispatches a dedicated CI-fixer agent against this same branch. None of that is your job.',
|
|
25
|
+
'- Do NOT run `git push`, do NOT open or update pull requests, and do NOT use the `gh` CLI or call the GitHub API. You have no push credentials; attempting it only wastes the run.',
|
|
26
|
+
'- Spend your whole budget on the change itself. Do NOT probe the environment for credentials, tokens, git remotes or push access — that is never your task and never a problem you can fix.',
|
|
27
|
+
'Validate locally before you finish:',
|
|
28
|
+
'- Run the project build, the linters, and the tests relevant to your change, and get them passing locally for the code you touched.',
|
|
29
|
+
'Bound your effort — do not spin:',
|
|
30
|
+
'- This work MUST terminate; do not retry forever. Cap a fix → re-check cycle at a small number of attempts (about 5), and stop early if you have plainly used up the time or token budget for this phase.',
|
|
31
|
+
'- When you hit that bound still unresolved, STOP iterating — do not keep trying speculative fixes. Summarise what you changed, which problems remain, and the most likely root cause, then hand off for human review. A bounded, clearly-explained hand-off is an acceptable outcome; an endless loop that exhausts the budget is not.',
|
|
32
|
+
].join('\n');
|
|
33
|
+
//# sourceMappingURL=ci-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-gate.js","sourceRoot":"","sources":["../../src/agents/ci-gate.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,mFAAmF;AACnF,iFAAiF;AACjF,kCAAkC;AAClC,EAAE;AACF,+EAA+E;AAC/E,kFAAkF;AAClF,kFAAkF;AAClF,oFAAoF;AACpF,2EAA2E;AAC3E,mFAAmF;AACnF,mFAAmF;AACnF,gFAAgF;AAChF,gFAAgF;AAChF,sEAAsE;AACtE,EAAE;AACF,mFAAmF;AACnF,mFAAmF;AACnF,iFAAiF;AACjF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,0DAA0D;IAC1D,iaAAia;IACja,8NAA8N;IAC9N,oLAAoL;IACpL,6LAA6L;IAC7L,qCAAqC;IACrC,qIAAqI;IACrI,kCAAkC;IAClC,2MAA2M;IAC3M,wUAAwU;CACzU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentKind } from '@cat-factory/kernel';
|
|
2
|
+
/** The companion system prompt for `kind`, or undefined when `kind` is not a companion. */
|
|
3
|
+
export declare function companionSystemPrompt(kind: AgentKind): string | undefined;
|
|
4
|
+
//# sourceMappingURL=companion-prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companion-prompts.d.ts","sourceRoot":"","sources":["../../src/agents/companion-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAQpD,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAkBzE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { companionFor } from './companions.js';
|
|
2
|
+
// System prompt for a companion agent, parameterised by the producer kind it
|
|
3
|
+
// reviews. The companion returns a single overall quality rating (0..1) plus prose
|
|
4
|
+
// feedback and optional per-item challenges, all as JSON the engine validates with
|
|
5
|
+
// `companionAssessmentSchema`.
|
|
6
|
+
/** The companion system prompt for `kind`, or undefined when `kind` is not a companion. */
|
|
7
|
+
export function companionSystemPrompt(kind) {
|
|
8
|
+
const def = companionFor(kind);
|
|
9
|
+
if (!def)
|
|
10
|
+
return undefined;
|
|
11
|
+
return [
|
|
12
|
+
`You are a meticulous quality companion reviewing the ${def.reviews} produced by the`,
|
|
13
|
+
`preceding ${def.targets.join(' / ')} step. Challenge it hard for correctness, quality,`,
|
|
14
|
+
'completeness and risk: call out gaps, missing cases, weak or untestable points, and',
|
|
15
|
+
'anything that would block confident downstream work. Then give a SINGLE overall quality',
|
|
16
|
+
'rating between 0 and 1 (1 = excellent and complete, 0 = unusable). Be a fair but demanding',
|
|
17
|
+
'critic — do not rubber-stamp.',
|
|
18
|
+
'',
|
|
19
|
+
'Respond with ONLY a JSON object of shape',
|
|
20
|
+
'{"rating":0.0,"summary":"…","comments":[{"anchorId":"…","body":"…"}]}: `rating` is the',
|
|
21
|
+
'overall score, `summary` is your justification plus the concrete changes the step should',
|
|
22
|
+
'make, and `comments` (optional) anchors specific challenges to an item id when the',
|
|
23
|
+
'reviewed output is structured (e.g. a spec requirement / acceptance-criterion id). No',
|
|
24
|
+
'prose outside the JSON, no code fences.',
|
|
25
|
+
].join('\n');
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=companion-prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"companion-prompts.js","sourceRoot":"","sources":["../../src/agents/companion-prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,6EAA6E;AAC7E,mFAAmF;AACnF,mFAAmF;AACnF,+BAA+B;AAE/B,2FAA2F;AAC3F,MAAM,UAAU,qBAAqB,CAAC,IAAe;IACnD,MAAM,GAAG,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;IAC9B,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAA;IAC1B,OAAO;QACL,wDAAwD,GAAG,CAAC,OAAO,kBAAkB;QACrF,aAAa,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,oDAAoD;QACxF,qFAAqF;QACrF,yFAAyF;QACzF,4FAA4F;QAC5F,+BAA+B;QAC/B,EAAE;QACF,0CAA0C;QAC1C,wFAAwF;QACxF,0FAA0F;QAC1F,oFAAoF;QACpF,uFAAuF;QACvF,yCAAyC;KAC1C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACd,CAAC"}
|