@cobol-ts/project-ai 0.0.0-stage → 0.0.57

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/README.md CHANGED
@@ -1,3 +1,60 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @cobol-ts/project-ai
2
+
3
+ Project-level configuration and composition of AI providers, models, agents, prompts, tools and runners. Translates named entries in `ai.yaml` into the reusable AI abstractions. Inspection is a separate capability from recorded experiment execution.
4
+
5
+ ## Configuration model
6
+
7
+ - Models select a provider and provider-specific model identifier. Agents refer to a model alias and a role prompt, optionally with an icon.
8
+ - Runners describe the control flow and participants. `active` identifies the default runner; a caller may select another by name.
9
+ - `experiments` configures the repository directory and optional `maxMessages` and `concurrency`. The former is the maximum agent-call budget used by the runner, not a token budget.
10
+ - Shared prompt paths and role prompts are composed centrally. Optional resolution and tool settings support the wider discovery workflow.
11
+
12
+ `parseAiConfiguration` validates the configuration shape and named selections. `readRunnerDefinition`, `prepareDeclarativeRunner` and `assertExperimentRunnerScope` handle configured runner definitions and scope compatibility. The deterministic runner engine remains in the AI runner packages.
13
+
14
+ ## Public API
15
+
16
+ | Export | Responsibility |
17
+ | --- | --- |
18
+ | `parseAiConfiguration`, `selectAiAgent`, `selectAiRunner`, `selectAiModel` | Interpret configuration and resolve named entries. |
19
+ | `createAiProviders`, `providerFactory` | Compose concrete providers through an injected registry. |
20
+ | `readRunnerDefinition`, `prepareDeclarativeRunner`, `assertExperimentRunnerScope` | Load and prepare runner definitions. |
21
+ | `systemPromptTemplate`, `inspectSystemPrompt`, `renderSystemPrompt` | Shared prompt composition and inspection. |
22
+ | `aiToolkit` | Inspect configured runners, agents, models and tools without invoking a model. |
23
+ | `debugAiClient`, `agentIcon` | Diagnostic wrapping and icon inspection. |
24
+ | `prepareAiAt`, `AiPreparationServices` | Prepare single-shot AI requests using injected read and provider services. |
25
+
26
+ ```ts
27
+ import {parseAiConfiguration, selectAiRunner} from '@cobol-ts/project-ai'
28
+
29
+ const config = parseAiConfiguration(parsedYaml)
30
+ const runner = selectAiRunner(config)
31
+ ```
32
+
33
+ Toolkit inspection requires only the runner registry when availability is to be resolved, not the experiment execution service. HTTP-specific inspection belongs to `cli-serve`; Commander registration and output formatting belong to [cli-ai](../cli-ai/README.md).
34
+
35
+ ## Provider boundary and security
36
+
37
+ `createAiProviders` uses injected HTTP dependencies and returns factories for `mock`, `openai` and `groq`. Mock responses come from a configured document. Real providers accept credential environment variable names (`apiKeyEnv`, default `OPENAI` or `GROQ` respectively); literal credential configuration and unexpected real-provider properties are rejected. Configuration and snapshot assets must not contain secrets. Debug mode can expose message content, so enable it only in a suitable environment.
38
+
39
+ ## CLI inspection
40
+
41
+ ```sh
42
+ yarn cobolts -d modules/examples/init ai runner list
43
+ yarn cobolts -d modules/examples/init ai runner show
44
+ ```
45
+
46
+ These commands inspect configuration without calling an AI provider. Recorded runs, lifecycle snapshots and deterministic validation adapters belong to [discovery-experiments](../discovery-experiments/README.md); derived output resolutions belong to [characteristic-resolutions](../characteristic-resolutions/README.md).
47
+
48
+ ## Source map and tests
49
+
50
+ - [ai.configuration.ts](src/ai.configuration.ts), [ai.configuration.spec.ts](src/ai.configuration.spec.ts): parsing and selection.
51
+ - [ai.providers.ts](../project-ai-local/src/ai.providers.ts), [ai.providers.credentials.spec.ts](../project-ai-local/src/ai.providers.credentials.spec.ts): provider composition and credential rules.
52
+ - [ai.runner.definition.ts](src/ai.runner.definition.ts), [ai.runner.definition.spec.ts](src/ai.runner.definition.spec.ts): runner definitions and decisions.
53
+ - [ai.system.prompt.ts](src/ai.system.prompt.ts), [ai.toolkit.ts](src/ai.toolkit.ts): prompt composition and toolkit inspection.
54
+ - [ai.debug.ts](src/ai.debug.ts), [ai.icon.ts](src/ai.icon.ts), [ai.icon.spec.ts](src/ai.icon.spec.ts): diagnostics and icon handling.
55
+ - [ai.ts](src/ai.ts): single-shot preparation and its service contract.
56
+
57
+ AI inspection accepts `ProjectAssets` for authorised icon, runner and prompt
58
+ access. The default local adapter lives in `project-file-access-node`, selected by `project-ai-local`, not the AI
59
+ configuration workflow. Parsing, runner validation and presentation remain in
60
+ this package and do not need native file operations.
@@ -0,0 +1,7 @@
1
+ export * from './src/ai.icon';
2
+ export * from './src/ai.configuration';
3
+ export * from './src/ai.toolkit';
4
+ export * from './src/ai.runner.definition';
5
+ export * from './src/ai.system.prompt';
6
+ export * from './src/ai.debug';
7
+ export * from './src/ai';
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./src/ai.icon"), exports);
18
+ __exportStar(require("./src/ai.configuration"), exports);
19
+ __exportStar(require("./src/ai.toolkit"), exports);
20
+ __exportStar(require("./src/ai.runner.definition"), exports);
21
+ __exportStar(require("./src/ai.system.prompt"), exports);
22
+ __exportStar(require("./src/ai.debug"), exports);
23
+ __exportStar(require("./src/ai"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,yDAAsC;AACtC,mDAAgC;AAChC,6DAA0C;AAC1C,yDAAsC;AACtC,iDAA8B;AAC9B,2CAAwB"}
@@ -0,0 +1,52 @@
1
+ import type { AiClient } from '@cobol-ts/ai';
2
+ export interface AiModelConfiguration extends Readonly<Record<string, unknown>> {
3
+ readonly provider: string;
4
+ readonly model: string;
5
+ }
6
+ export interface AiAgentConfiguration {
7
+ readonly model: string;
8
+ readonly prompt: string;
9
+ readonly icon?: string;
10
+ }
11
+ export interface AiRunnerConfiguration extends Readonly<Record<string, unknown>> {
12
+ readonly type: string;
13
+ }
14
+ export interface AiConfiguration {
15
+ readonly active: string;
16
+ readonly models: Readonly<Record<string, AiModelConfiguration>>;
17
+ readonly agents: Readonly<Record<string, AiAgentConfiguration>>;
18
+ readonly tools?: Readonly<Record<string, {
19
+ readonly icon?: string;
20
+ }>>;
21
+ readonly runners: Readonly<Record<string, AiRunnerConfiguration>>;
22
+ readonly experiments: {
23
+ readonly directory: string;
24
+ readonly maxMessages?: number;
25
+ readonly concurrency?: number;
26
+ };
27
+ readonly resolutions?: {
28
+ readonly directory: string;
29
+ };
30
+ readonly prompts: {
31
+ readonly inputs: string;
32
+ readonly target: string;
33
+ readonly graphTypes?: string;
34
+ readonly graphSemantics?: string;
35
+ readonly globalHints?: string;
36
+ readonly identification?: string;
37
+ };
38
+ }
39
+ export type AiProviderFactory = (config: AiModelConfiguration, read: (path: string) => Promise<string>, debug?: (message: string) => void) => Promise<AiClient>;
40
+ export type AiProviderRegistry = Readonly<Record<string, AiProviderFactory>>;
41
+ export declare function mapping(source: unknown, at: string): Record<string, unknown>;
42
+ export declare function nonEmpty(value: unknown, at: string): string;
43
+ export declare function parseAiConfiguration(document: unknown): AiConfiguration;
44
+ export declare function selectAiAgent(config: AiConfiguration, name: string): AiAgentConfiguration;
45
+ export declare function selectAiRunner(config: AiConfiguration, name?: string): AiRunnerConfiguration;
46
+ /** Adapter for the legacy one-call authoring commands. Recorded execution uses runner resolution. */
47
+ export declare function selectSingleShotAgent(config: AiConfiguration): {
48
+ name: string;
49
+ agent: AiAgentConfiguration;
50
+ };
51
+ export declare function selectAiModel(config: AiConfiguration, name?: string): AiModelConfiguration;
52
+ export declare function providerFactory(registry: AiProviderRegistry | undefined, provider: string): AiProviderFactory;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapping = mapping;
4
+ exports.nonEmpty = nonEmpty;
5
+ exports.parseAiConfiguration = parseAiConfiguration;
6
+ exports.selectAiAgent = selectAiAgent;
7
+ exports.selectAiRunner = selectAiRunner;
8
+ exports.selectSingleShotAgent = selectSingleShotAgent;
9
+ exports.selectAiModel = selectAiModel;
10
+ exports.providerFactory = providerFactory;
11
+ const ai_runner_1 = require("@cobol-ts/ai-runner");
12
+ function mapping(source, at) {
13
+ if (!source || typeof source !== 'object' || Array.isArray(source))
14
+ throw new Error(`${at}: expected a mapping`);
15
+ return source;
16
+ }
17
+ function nonEmpty(value, at) {
18
+ if (typeof value !== 'string' || !value.trim())
19
+ throw new Error(`${at}: expected a nonempty string`);
20
+ return value;
21
+ }
22
+ function named(entries, name, kind) {
23
+ if (!Object.prototype.hasOwnProperty.call(entries, name))
24
+ throw new Error(`Unknown AI ${kind} '${name}'`);
25
+ return entries[name];
26
+ }
27
+ function parseAiConfiguration(document) {
28
+ const config = mapping(document, 'ai.yaml');
29
+ const active = nonEmpty(config.active, 'ai.yaml.active');
30
+ const models = Object.fromEntries(Object.entries(mapping(config.models, 'ai.yaml.models')).map(([name, raw]) => {
31
+ const at = `ai.yaml.models.${name}`;
32
+ nonEmpty(name, at);
33
+ const entry = mapping(raw, at);
34
+ return [name, { ...entry, provider: nonEmpty(entry.provider, `${at}.provider`), model: nonEmpty(entry.model, `${at}.model`) }];
35
+ }));
36
+ const agents = Object.fromEntries(Object.entries(mapping(config.agents, 'ai.yaml.agents')).map(([name, raw]) => {
37
+ const at = `ai.yaml.agents.${name}`;
38
+ nonEmpty(name, at);
39
+ const entry = mapping(raw, at);
40
+ const model = nonEmpty(entry.model, `${at}.model`);
41
+ named(models, model, 'model');
42
+ return [name, { model, prompt: nonEmpty(entry.prompt, `${at}.prompt`),
43
+ ...(entry.icon === undefined ? {} : { icon: nonEmpty(entry.icon, `${at}.icon`) }) }];
44
+ }));
45
+ const runners = Object.fromEntries(Object.entries(mapping(config.runners, 'ai.yaml.runners')).map(([name, raw]) => {
46
+ const at = `ai.yaml.runners.${name}`;
47
+ nonEmpty(name, at);
48
+ const entry = mapping(raw, at);
49
+ return [name, { ...entry, type: nonEmpty(entry.type, `${at}.type`) }];
50
+ }));
51
+ const tools = config.tools === undefined ? undefined : Object.fromEntries(Object.entries(mapping(config.tools, 'ai.yaml.tools')).map(([name, raw]) => {
52
+ const at = `ai.yaml.tools.${name}`;
53
+ const entry = mapping(raw, at);
54
+ return [name, entry.icon === undefined ? {} : { icon: nonEmpty(entry.icon, `${at}.icon`) }];
55
+ }));
56
+ const prompts = mapping(config.prompts, 'ai.yaml.prompts');
57
+ const experiments = mapping(config.experiments, 'ai.yaml.experiments');
58
+ const maxMessages = experiments.maxMessages;
59
+ if (maxMessages !== undefined && (typeof maxMessages !== 'number' || !Number.isSafeInteger(maxMessages) || maxMessages < 1))
60
+ throw new Error('ai.yaml.experiments.maxMessages: expected a positive integer');
61
+ const concurrency = experiments.concurrency;
62
+ if (concurrency !== undefined && (typeof concurrency !== 'number' || !Number.isSafeInteger(concurrency) || concurrency < 1))
63
+ throw new Error('ai.yaml.experiments.concurrency: expected a positive integer');
64
+ const result = { active, models, agents, runners, ...(tools === undefined ? {} : { tools }),
65
+ experiments: { directory: nonEmpty(experiments.directory, 'ai.yaml.experiments.directory'), ...(typeof maxMessages === 'number' ? { maxMessages } : {}), ...(typeof concurrency === 'number' ? { concurrency } : {}) },
66
+ ...(config.resolutions === undefined ? {} : { resolutions: { directory: nonEmpty(mapping(config.resolutions, 'ai.yaml.resolutions').directory, 'ai.yaml.resolutions.directory') } }),
67
+ prompts: {
68
+ inputs: nonEmpty(prompts.inputs, 'ai.yaml.prompts.inputs'),
69
+ target: nonEmpty(prompts.target, 'ai.yaml.prompts.target'),
70
+ ...(prompts.graphTypes === undefined ? {} : { graphTypes: nonEmpty(prompts.graphTypes, 'ai.yaml.prompts.graphTypes') }),
71
+ ...(prompts.graphSemantics === undefined ? {} : { graphSemantics: nonEmpty(prompts.graphSemantics, 'ai.yaml.prompts.graphSemantics') }),
72
+ ...(prompts.globalHints === undefined ? {} : { globalHints: nonEmpty(prompts.globalHints, 'ai.yaml.prompts.globalHints') }),
73
+ ...(prompts.identification === undefined ? {} : { identification: nonEmpty(prompts.identification, 'ai.yaml.prompts.identification') })
74
+ } };
75
+ selectAiRunner(result);
76
+ return result;
77
+ }
78
+ function selectAiAgent(config, name) {
79
+ return named(config.agents, name, 'agent');
80
+ }
81
+ function selectAiRunner(config, name = config.active) {
82
+ return named(config.runners, name, 'runner');
83
+ }
84
+ /** Adapter for the legacy one-call authoring commands. Recorded execution uses runner resolution. */
85
+ function selectSingleShotAgent(config) {
86
+ const runner = selectAiRunner(config);
87
+ if (runner.type !== 'single-shot' && runner.type !== 'creator-validator')
88
+ throw new Error(`AI runner '${config.active}' is not single-shot or creator-validator; use experiment create and experiment run for iterative execution`);
89
+ const { name, validators } = (0, ai_runner_1.runnerAgentBinding)(runner, 'agent', 'validation');
90
+ // Legacy one-call commands only inspect/generate; recorded experiments run the full list.
91
+ if (typeof runner.agent === 'string' && validators[0]?.tool !== 'authoring-graph')
92
+ throw new Error(`AI runner '${config.active}': validation tool '${validators[0]?.tool}' is not available yet`);
93
+ return { name, agent: selectAiAgent(config, name) };
94
+ }
95
+ function selectAiModel(config, name = selectSingleShotAgent(config).agent.model) {
96
+ return named(config.models, name, 'model');
97
+ }
98
+ function providerFactory(registry, provider) {
99
+ if (!registry || !Object.prototype.hasOwnProperty.call(registry, provider))
100
+ throw new Error(`Unsupported AI provider '${provider}'`);
101
+ return registry[provider];
102
+ }
103
+ //# sourceMappingURL=ai.configuration.js.map
@@ -0,0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C,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,QAAQ,GAAG,CAAC,CAAA;IACpI,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC7B,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ai_configuration_1 = require("./ai.configuration");
4
+ const config = { active: 'quick', models: { a: { provider: 'mock', model: 'one' }, b: { provider: 'test', model: 'two' } },
5
+ agents: { creator: { model: 'a', prompt: 's' }, reviewer: { model: 'b', prompt: 'r' } },
6
+ runners: { quick: { type: 'single-shot', agent: 'creator', validation: 'authoring-graph' },
7
+ reviewed: { type: 'creator-reviewer', creator: 'creator', reviewer: 'reviewer', validation: 'authoring-graph' } },
8
+ experiments: { directory: 'experiments' }, prompts: { inputs: 'i', target: 't' } };
9
+ it('resolves the active runner and named agent/model, preserving the temporary explicit model override', () => {
10
+ const parsed = (0, ai_configuration_1.parseAiConfiguration)(config);
11
+ expect((0, ai_configuration_1.selectAiRunner)(parsed)).toEqual(config.runners.quick);
12
+ expect((0, ai_configuration_1.selectSingleShotAgent)(parsed)).toEqual({ name: 'creator', agent: config.agents.creator });
13
+ expect((0, ai_configuration_1.selectAiAgent)(parsed, 'reviewer')).toEqual(config.agents.reviewer);
14
+ expect((0, ai_configuration_1.selectAiModel)(parsed)).toEqual(config.models.a);
15
+ expect((0, ai_configuration_1.selectAiModel)(parsed, 'b')).toEqual(config.models.b);
16
+ expect(parsed.experiments.directory).toBe('experiments');
17
+ expect(() => (0, ai_configuration_1.selectAiModel)(parsed, 'constructor')).toThrow('Unknown AI model');
18
+ expect(() => (0, ai_configuration_1.selectAiAgent)(parsed, 'constructor')).toThrow('Unknown AI agent');
19
+ expect(() => (0, ai_configuration_1.selectAiRunner)(parsed, 'constructor')).toThrow('Unknown AI runner');
20
+ expect(() => (0, ai_configuration_1.parseAiConfiguration)({ ...config, active: 'missing' })).toThrow('Unknown AI runner');
21
+ });
22
+ it('rejects missing model references and missing prompt paths', () => {
23
+ expect(() => (0, ai_configuration_1.parseAiConfiguration)({ ...config, agents: { creator: { model: 'missing', prompt: 's' } } })).toThrow('Unknown AI model');
24
+ expect(() => (0, ai_configuration_1.parseAiConfiguration)({ ...config, agents: { creator: { model: 'a', prompt: '' } } })).toThrow('ai.yaml.agents.creator.prompt');
25
+ });
26
+ it('reports invalid single-shot configuration before a provider is invoked', () => {
27
+ const invalid = (0, ai_configuration_1.parseAiConfiguration)({ ...config, runners: { quick: { ...config.runners.quick, agent: 'missing' } } });
28
+ expect(() => (0, ai_configuration_1.selectSingleShotAgent)(invalid)).toThrow('Unknown AI agent');
29
+ const wrongTool = (0, ai_configuration_1.parseAiConfiguration)({ ...config, runners: { quick: { ...config.runners.quick, validation: 'missing' } } });
30
+ expect(() => (0, ai_configuration_1.selectSingleShotAgent)(wrongTool)).toThrow("validation tool 'missing' is not available yet");
31
+ expect(() => (0, ai_configuration_1.selectSingleShotAgent)((0, ai_configuration_1.parseAiConfiguration)({ ...config, active: 'reviewed' }))).toThrow('not single-shot');
32
+ });
33
+ it('selects an injected factory and rejects unknown providers', () => {
34
+ const factory = jest.fn();
35
+ expect((0, ai_configuration_1.providerFactory)({ test: factory }, 'test')).toBe(factory);
36
+ expect(() => (0, ai_configuration_1.providerFactory)({}, 'constructor')).toThrow('Unsupported AI provider');
37
+ });
38
+ it('accepts optional presentation-only tool icons', () => {
39
+ expect((0, ai_configuration_1.parseAiConfiguration)(config).tools).toBeUndefined();
40
+ expect((0, ai_configuration_1.parseAiConfiguration)({ ...config, tools: { validator: { icon: 'icons/validator.svg' } } }).tools).toEqual({ validator: { icon: 'icons/validator.svg' } });
41
+ expect(() => (0, ai_configuration_1.parseAiConfiguration)({ ...config, tools: { validator: { icon: 7 } } })).toThrow('ai.yaml.tools.validator.icon');
42
+ });
43
+ it('validates optional sweep concurrency without changing older configuration', () => {
44
+ expect((0, ai_configuration_1.parseAiConfiguration)(config).experiments.concurrency).toBeUndefined();
45
+ expect((0, ai_configuration_1.parseAiConfiguration)({ ...config, experiments: { ...config.experiments, concurrency: 4 } }).experiments.concurrency).toBe(4);
46
+ for (const concurrency of [0, -1, 1.5, '4', null, Infinity])
47
+ expect(() => (0, ai_configuration_1.parseAiConfiguration)({ ...config, experiments: { ...config.experiments, concurrency } })).toThrow('ai.yaml.experiments.concurrency');
48
+ });
49
+ it('accepts an optional global hints path and rejects invalid configured values', () => {
50
+ expect((0, ai_configuration_1.parseAiConfiguration)(config).prompts).not.toHaveProperty('globalHints');
51
+ expect((0, ai_configuration_1.parseAiConfiguration)({ ...config, prompts: { ...config.prompts, globalHints: 'prompts/global-hints.md' } }).prompts.globalHints).toBe('prompts/global-hints.md');
52
+ for (const globalHints of ['', ' ', null, 42, [], {}])
53
+ expect(() => (0, ai_configuration_1.parseAiConfiguration)({ ...config, prompts: { ...config.prompts, globalHints } })).toThrow('ai.yaml.prompts.globalHints: expected a nonempty string');
54
+ });
55
+ //# sourceMappingURL=ai.configuration.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.configuration.spec.js","sourceRoot":"","sources":["../../src/ai.configuration.spec.ts"],"names":[],"mappings":";;AAAA,yDAA6I;AAE7I,MAAM,MAAM,GAAG,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAC,CAAC,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAC,EAAE,CAAC,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAC,EAAC;IAC/G,MAAM,EAAE,EAAC,OAAO,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC,EAAE,QAAQ,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAC,EAAC;IACjF,OAAO,EAAE,EAAC,KAAK,EAAE,EAA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,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,aAAa,CAAC,CAAA;IAC9E,MAAM,CAAC,IAAA,uCAAoB,EAAC,EAAC,GAAG,MAAM,EAAE,OAAO,EAAE,EAAC,GAAG,MAAM,CAAC,OAAO,EAAE,WAAW,EAAE,yBAAyB,EAAC,EAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAA;IACnK,KAAK,MAAM,WAAW,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;QACjD,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,uCAAoB,EAAC,EAAC,GAAG,MAAM,EAAE,OAAO,EAAE,EAAC,GAAG,MAAM,CAAC,OAAO,EAAE,WAAW,EAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,yDAAyD,CAAC,CAAA;AACrK,CAAC,CAAC,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { loadCharacteristicCatalogues } from '@cobol-ts/characteristics-yaml';
2
+ import { type AiExperimentLoop } from '@cobol-ts/ai-experiments';
3
+ import type { YamlParser } from '@cobol-ts/yaml';
4
+ import type { Read } from '@cobol-ts/project-context';
5
+ import type { AiProviderRegistry } from './ai.configuration';
6
+ /** Initialise and inspect AI configuration without upward project discovery. */
7
+ export declare function prepareAiAtWith(services: AiPreparationServices, base: string, existingCatalogues?: Awaited<ReturnType<typeof loadCharacteristicCatalogues>>, characteristicsConfig?: string, modelName?: string, debug?: (message: string) => void): Promise<AiExperimentLoop>;
8
+ export interface AiPreparationServices {
9
+ readonly read: Read;
10
+ readonly yaml: YamlParser;
11
+ readonly aiProviders?: AiProviderRegistry;
12
+ }
@@ -0,0 +1,3 @@
1
+ import type { AiClient } from '@cobol-ts/ai';
2
+ /** Observe actual exchanges, never prompt inspection. No prompt, response content or credentials are logged. */
3
+ export declare function debugAiClient(client: AiClient, provider: string, alias: string, log: (message: string) => void): AiClient;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.debugAiClient = debugAiClient;
4
+ /** Observe actual exchanges, never prompt inspection. No prompt, response content or credentials are logged. */
5
+ function debugAiClient(client, provider, alias, log) {
6
+ return { chat: { completions: { async create(params) {
7
+ const start = performance.now();
8
+ log(`AI send provider=${provider} alias=${alias} model=${params.model} messages=${params.messages.length} characters=${params.messages.reduce((sum, message) => sum + message.content.length, 0)}`);
9
+ try {
10
+ const response = await client.chat.completions.create(params);
11
+ const usage = response.usage;
12
+ const tokens = ['prompt_tokens', 'completion_tokens', 'total_tokens']
13
+ .map(name => `${name}=${typeof usage?.[name] === 'number' ? usage[name] : 'unavailable'}`).join(' ');
14
+ log(`AI response id=${response.id} model=${response.model} finish=${response.choices.map(choice => choice.finish_reason).join(',')} elapsedMs=${Math.round(performance.now() - start)} ${tokens}`);
15
+ return response;
16
+ }
17
+ catch (error) {
18
+ log(`AI request failed provider=${provider} alias=${alias} elapsedMs=${Math.round(performance.now() - start)}`);
19
+ throw error;
20
+ }
21
+ } } } };
22
+ }
23
+ //# sourceMappingURL=ai.debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.debug.js","sourceRoot":"","sources":["../../src/ai.debug.ts"],"names":[],"mappings":";;AAGA,sCAgBC;AAjBD,gHAAgH;AAChH,SAAgB,aAAa,CAAC,MAAgB,EAAE,QAAgB,EAAE,KAAa,EAAE,GAA8B;IAC3G,OAAO,EAAC,IAAI,EAAE,EAAC,WAAW,EAAE,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM;oBAC5C,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,CAAA;oBAC/B,GAAG,CAAC,oBAAoB,QAAQ,UAAU,KAAK,UAAU,MAAM,CAAC,KAAK,aAAa,MAAM,CAAC,QAAQ,CAAC,MAAM,eAAe,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CA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import { type ProjectAssets } from '@cobol-ts/project-file-access';
3
+ import type { Read } from '@cobol-ts/project-context';
4
+ /** Only configured, project-relative SVG files can be exposed as participant icons. */
5
+ export declare function agentIconWith(yaml: YamlParser, assets: ProjectAssets, base: string, read: Read, name: string, kind?: 'agents' | 'tools'): Promise<string | undefined>;
6
+ export declare function readIconFileWith(assets: ProjectAssets, base: string, read: Read, icon: string): Promise<string | undefined>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.agentIconWith = agentIconWith;
4
+ exports.readIconFileWith = readIconFileWith;
5
+ const node_path_1 = require("node:path");
6
+ const ai_configuration_1 = require("./ai.configuration");
7
+ /** Only configured, project-relative SVG files can be exposed as participant icons. */
8
+ async function agentIconWith(yaml, assets, base, read, name, kind = 'agents') {
9
+ const parsed = yaml.parse(await read((0, node_path_1.resolve)(base, 'ai.yaml')));
10
+ if ('errors' in parsed)
11
+ throw new Error('Invalid AI configuration');
12
+ const config = (0, ai_configuration_1.parseAiConfiguration)(parsed.value);
13
+ const entries = config[kind] ?? {};
14
+ if (!Object.prototype.hasOwnProperty.call(entries, name))
15
+ return undefined;
16
+ const icon = entries[name].icon;
17
+ if (!icon)
18
+ return undefined;
19
+ return readIconFileWith(assets, base, read, icon);
20
+ }
21
+ async function readIconFileWith(assets, base, read, icon) {
22
+ return assets.icon(base, icon, read);
23
+ }
24
+ //# sourceMappingURL=ai.icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.icon.js","sourceRoot":"","sources":["../../src/ai.icon.ts"],"names":[],"mappings":";;AAOA,sCASC;AAED,4CAEC;AApBD,yCAAiC;AAEjC,yDAAuD;AAIvD,uFAAuF;AAChF,KAAK,UAAU,aAAa,CAAC,IAAe,EAAC,MAAoB,EAAC,IAAY,EAAE,IAAU,EAAE,IAAY,EAAE,OAA2B,QAAQ;IAChJ,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAA,mBAAO,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;IAC/D,IAAI,QAAQ,IAAI,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;IACnE,MAAM,MAAM,GAAG,IAAA,uCAAoB,EAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACjD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;IAClC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;QAAE,OAAO,SAAS,CAAA;IAC1E,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAA;IAC/B,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAA;IAC3B,OAAO,gBAAgB,CAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,CAAC,CAAA;AAClD,CAAC;AAEM,KAAK,UAAU,gBAAgB,CAAC,MAAoB,EAAC,IAAY,EAAE,IAAU,EAAE,IAAY;IAC9F,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAC,IAAI,EAAC,IAAI,CAAC,CAAA;AACtC,CAAC"}
package/dist/src/ai.js ADDED
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareAiAtWith = prepareAiAtWith;
4
+ const node_path_1 = require("node:path");
5
+ const characteristics_yaml_1 = require("@cobol-ts/characteristics-yaml");
6
+ const ai_experiments_1 = require("@cobol-ts/ai-experiments");
7
+ const ai_tool_cel_graph_1 = require("@cobol-ts/ai-tool-cel-graph");
8
+ const ai_debug_1 = require("./ai.debug");
9
+ const ai_system_prompt_1 = require("./ai.system.prompt");
10
+ const ai_configuration_1 = require("./ai.configuration");
11
+ function parsedYaml(yaml, content, filename) {
12
+ const result = yaml.parse(content);
13
+ if ('errors' in result)
14
+ throw new Error(`${filename}: ${result.errors.join('; ')}`);
15
+ return result.value;
16
+ }
17
+ /** Initialise and inspect AI configuration without upward project discovery. */
18
+ async function prepareAiAtWith(services, base, existingCatalogues, characteristicsConfig, modelName, debug) {
19
+ const read = async (relative) => {
20
+ const filename = (0, node_path_1.isAbsolute)(relative) ? relative : (0, node_path_1.resolve)(base, relative);
21
+ try {
22
+ return (0, ai_configuration_1.nonEmpty)(await services.read(filename), filename);
23
+ }
24
+ catch (cause) {
25
+ throw new Error(`Cannot read AI configuration asset ${relative}: ${filename}: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });
26
+ }
27
+ };
28
+ const config = (0, ai_configuration_1.parseAiConfiguration)(parsedYaml(services.yaml, await read('ai.yaml'), 'ai.yaml'));
29
+ const { name: agentName, agent } = (0, ai_configuration_1.selectSingleShotAgent)(config);
30
+ const modelAlias = modelName ?? agent.model;
31
+ const selected = (0, ai_configuration_1.selectAiModel)(config, modelAlias);
32
+ const factory = (0, ai_configuration_1.providerFactory)(services.aiProviders, selected.provider);
33
+ const [catalogues, system, inputs, target, client] = await Promise.all([
34
+ existingCatalogues ?? (0, characteristics_yaml_1.loadCharacteristicCatalogues)(base, services.read, services.yaml, characteristicsConfig),
35
+ (0, ai_system_prompt_1.systemPromptTemplate)(read, config.prompts, agent.prompt), read(config.prompts.inputs), read(config.prompts.target),
36
+ factory(selected, read, debug)
37
+ ]);
38
+ return (0, ai_experiments_1.createAiExperimentLoop)({
39
+ catalogues, agentName, modelAlias,
40
+ templates: { system, inputs, target },
41
+ client: debug ? (0, ai_debug_1.debugAiClient)(client, selected.provider, modelAlias, debug) : client, provider: selected.provider, model: selected.model,
42
+ validateGraph: source => (0, ai_tool_cel_graph_1.readAuthoringGraph)(source, services.yaml),
43
+ inspectGraph: graph => (0, ai_tool_cel_graph_1.inspectAuthoringGraph)(graph)
44
+ });
45
+ }
46
+ //# sourceMappingURL=ai.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.js","sourceRoot":"","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Q,EAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK;QACxI,aAAa,EAAE,MAAM,CAAC,EAAE,CAAC,IAAA,sCAAkB,EAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;QAClE,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,IAAA,yCAAqB,EAAC,KAAuB,CAAC;KACxE,CAAC,CAAA;AACN,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type CompileDecision, type RunnerDefinition, type RunnerDependencies } from '@cobol-ts/ai-runner';
2
+ import type { YamlParser } from '@cobol-ts/yaml';
3
+ import { type ProjectAssets } from '@cobol-ts/project-file-access';
4
+ import { type AiRunnerConfiguration } from './ai.configuration';
5
+ import type { Read } from '@cobol-ts/project-context';
6
+ export declare function readRunnerDefinitionWith(yaml: YamlParser, assets: ProjectAssets, base: string, read: Read, runner: AiRunnerConfiguration): Promise<RunnerDefinition | undefined>;
7
+ export declare const compileRunnerDecision: CompileDecision;
8
+ export declare function prepareDeclarativeRunnerWith(yaml: YamlParser, definition: RunnerDefinition, runner: AiRunnerConfiguration, dependencies: RunnerDependencies): Promise<import("@cobol-ts/ai-runner").Runner>;
9
+ /** The generic runner is reusable, but its candidate validator must match the experiment domain. */
10
+ export declare function assertExperimentRunnerScope(scope: string, runner: AiRunnerConfiguration, definition?: RunnerDefinition): void;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compileRunnerDecision = void 0;
4
+ exports.readRunnerDefinitionWith = readRunnerDefinitionWith;
5
+ exports.prepareDeclarativeRunnerWith = prepareDeclarativeRunnerWith;
6
+ exports.assertExperimentRunnerScope = assertExperimentRunnerScope;
7
+ const validation_policy_1 = require("@cobol-ts/validation-policy");
8
+ const validation_policy_2 = require("@cobol-ts/validation-policy");
9
+ const cel_1 = require("@bufbuild/cel");
10
+ const ai_runner_1 = require("@cobol-ts/ai-runner");
11
+ const ai_configuration_1 = require("./ai.configuration");
12
+ async function readRunnerDefinitionWith(yaml, assets, base, read, runner) {
13
+ if (runner.definition === undefined) {
14
+ if (runner.type === 'creator-validator' || runner.type === 'declarative')
15
+ throw new Error(`Runner ${runner.type} requires a definition`);
16
+ return undefined;
17
+ }
18
+ const path = (0, ai_configuration_1.nonEmpty)(runner.definition, 'Runner definition');
19
+ const parsed = yaml.parse(await assets.runner(base, path, read));
20
+ if ('errors' in parsed)
21
+ throw new Error(parsed.errors.join('; '));
22
+ const definition = (0, ai_runner_1.parseRunnerDefinition)(parsed.value);
23
+ const roles = (0, ai_runner_1.runnerRoles)(definition);
24
+ for (const { validators } of (0, ai_runner_1.runnerAgentBindings)(definition, runner))
25
+ for (const { tool, options } of validators) {
26
+ if (tool === 'graph-execution')
27
+ (0, validation_policy_1.graphExecutionLimit)(options, tool);
28
+ else if (tool === 'identification-execution')
29
+ (0, validation_policy_2.identificationExecutionPolicy)(options);
30
+ else if (['authoring-graph', 'identification-graph', 'review-response'].includes(tool) && Object.keys(options).length)
31
+ throw new Error(`AI tool '${tool}' does not accept options`);
32
+ }
33
+ for (const role of roles.finished)
34
+ (0, ai_configuration_1.nonEmpty)(Object.hasOwn(runner, role) ? runner[role] : undefined, `Runner binding ${role}`);
35
+ for (const step of Object.values(definition.steps))
36
+ if (step.type === 'decision')
37
+ (0, exports.compileRunnerDecision)(step.expression);
38
+ return definition;
39
+ }
40
+ // CEL maps rather than plain JavaScript objects; only parsed response values are exposed.
41
+ function celValue(value) {
42
+ if (value === null || typeof value === 'string' || typeof value === 'boolean' || typeof value === 'number')
43
+ return value;
44
+ if (Array.isArray(value))
45
+ return value.map(celValue);
46
+ if (value && typeof value === 'object')
47
+ return new Map(Object.entries(value).map(([key, item]) => [key, celValue(item)]));
48
+ throw new Error('Unsupported CEL decision value');
49
+ }
50
+ const compileRunnerDecision = expression => {
51
+ const evaluate = (0, cel_1.plan)((0, cel_1.celEnv)(), (0, cel_1.parse)(expression));
52
+ return values => {
53
+ const result = evaluate(Object.fromEntries(Object.entries(values).map(([id, value]) => [id, celValue(value)])));
54
+ if (typeof result !== 'boolean')
55
+ throw new Error(`Runner decision must return boolean: ${String(result)}`);
56
+ return result;
57
+ };
58
+ };
59
+ exports.compileRunnerDecision = compileRunnerDecision;
60
+ function prepareDeclarativeRunnerWith(yaml, definition, runner, dependencies) {
61
+ return (0, ai_runner_1.declarativeRunner)(definition, runner, dependencies, content => (0, ai_runner_1.structuredOutcome)(content, source => yaml.parse(source)), exports.compileRunnerDecision);
62
+ }
63
+ /** The generic runner is reusable, but its candidate validator must match the experiment domain. */
64
+ function assertExperimentRunnerScope(scope, runner, definition) {
65
+ const validators = definition ? (0, ai_runner_1.runnerAgentBindings)(definition, runner).flatMap(binding => binding.validators.map(item => item.tool)) : [runner.validation, runner.reviewValidation];
66
+ const identifies = validators.includes('identification-graph');
67
+ if (scope === 'identification' && (!identifies || validators.includes('authoring-graph') || validators.includes('graph-execution')))
68
+ throw new Error('Identification experiments require an identification-graph runner, without characteristic validators');
69
+ if (scope === 'characteristic' && (identifies || validators.includes('identification-execution')))
70
+ throw new Error('Identification runners cannot author characteristic experiments');
71
+ }
72
+ //# sourceMappingURL=ai.runner.definition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.runner.definition.js","sourceRoot":"","sources":["../../src/ai.runner.definition.ts"],"names":[],"mappings":";;;AASA,4DAkBC;AAiBD,oEAEC;AAGD,kEAMC;AAvDD,mEAA+D;AAC/D,mEAAyE;AACzE,uCAAgE;AAChE,mDAAuM;AAGvM,yDAAuE;AAGhE,KAAK,UAAU,wBAAwB,CAAC,IAAe,EAAC,MAAoB,EAAC,IAAY,EAAE,IAAU,EAAE,MAA6B;IACvI,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAClC,IAAI,MAAM,CAAC,IAAI,KAAK,mBAAmB,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa;YAAE,MAAM,IAAI,KAAK,CAAC,UAAU,MAA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AAC;QAC/H,MAAM,IAAI,KAAK,CAAC,sGAAsG,CAAC,CAAA;IAC3H,IAAI,KAAK,KAAK,gBAAgB,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAA;AACzL,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ai_runner_definition_1 = require("./ai.runner.definition");
4
+ test('CEL reads structured validated response maps and requires a boolean', () => {
5
+ const decide = (0, ai_runner_definition_1.compileRunnerDecision)('review.response.approved && review.response.score >= 0.9');
6
+ expect(decide({ review: { response: { approved: true, score: .95 } } })).toBe(true);
7
+ expect(decide({ review: { response: { approved: false, score: .95 } } })).toBe(false);
8
+ expect(() => (0, ai_runner_definition_1.compileRunnerDecision)('review.response.score')({ review: { response: { score: .95 } } })).toThrow('must return boolean');
9
+ expect(() => decide({})).toThrow('must return boolean');
10
+ });
11
+ //# sourceMappingURL=ai.runner.definition.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.runner.definition.spec.js","sourceRoot":"","sources":["../../src/ai.runner.definition.spec.ts"],"names":[],"mappings":";;AAAA,iEAA4D;AAE5D,IAAI,CAAC,qEAAqE,EAAE,GAAG,EAAE;IAC7E,MAAM,MAAM,GAAG,IAAA,4CAAqB,EAAC,0DAA0D,CAAC,CAAA;IAChG,MAAM,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAC,EAAC,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC7E,MAAM,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAC,EAAC,EAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC/E,MAAM,CAAC,GAAG,EAAE,CAAC,IAAA,4CAAqB,EAAC,uBAAuB,CAAC,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,EAAC,KAAK,EAAE,GAAG,EAAC,EAAC,EAAC,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAC/H,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAA;AAC3D,CAAC,CAAC,CAAA"}
@@ -0,0 +1,17 @@
1
+ import type { AiConfiguration } from './ai.configuration';
2
+ /** Shared technical and project knowledge templates are optional for older projects and snapshots. */
3
+ export declare function sharedSystemPromptPaths(prompts: AiConfiguration['prompts']): string[];
4
+ /** Read from the caller's project or experiment snapshot, never from a global location. */
5
+ export declare function systemPromptTemplate(read: (path: string) => Promise<string>, prompts: AiConfiguration['prompts'], rolePrompt: string): Promise<string>;
6
+ export declare function inspectSystemPrompt(read: (path: string) => Promise<string>, prompts: AiConfiguration['prompts'], rolePrompt: string): Promise<{
7
+ role: {
8
+ path: string;
9
+ content: string;
10
+ };
11
+ shared: {
12
+ path: string;
13
+ content: string;
14
+ }[];
15
+ template: string;
16
+ }>;
17
+ export declare function renderSystemPrompt(template: string): string;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sharedSystemPromptPaths = sharedSystemPromptPaths;
4
+ exports.systemPromptTemplate = systemPromptTemplate;
5
+ exports.inspectSystemPrompt = inspectSystemPrompt;
6
+ exports.renderSystemPrompt = renderSystemPrompt;
7
+ const template_1 = require("@cobol-ts/template");
8
+ /** Shared technical and project knowledge templates are optional for older projects and snapshots. */
9
+ function sharedSystemPromptPaths(prompts) {
10
+ return [prompts.graphTypes, prompts.graphSemantics, prompts.globalHints].filter((path) => path !== undefined);
11
+ }
12
+ /** Read from the caller's project or experiment snapshot, never from a global location. */
13
+ async function systemPromptTemplate(read, prompts, rolePrompt) {
14
+ return (await inspectSystemPrompt(read, prompts, rolePrompt)).template;
15
+ }
16
+ async function inspectSystemPrompt(read, prompts, rolePrompt) {
17
+ const shared = await Promise.all(sharedSystemPromptPaths(prompts).map(async (path) => ({ path, content: await read(path) })));
18
+ const role = { path: rolePrompt, content: await read(rolePrompt) };
19
+ return { role, shared, template: [...shared.map(source => source.content), role.content].join('\n\n') };
20
+ }
21
+ function renderSystemPrompt(template) {
22
+ return (0, template_1.dereference)('AI system prompt', {}, template, { variableDefn: template_1.dollarsBracesVarDefn, throwError: true });
23
+ }
24
+ //# sourceMappingURL=ai.system.prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.system.prompt.js","sourceRoot":"","sources":["../../src/ai.system.prompt.ts"],"names":[],"mappings":";;AAIA,0DAEC;AAGD,oDAEC;AAED,kDAIC;AAED,gDAEC;AArBD,iDAAoE;AAGpE,sGAAsG;AACtG,SAAgB,uBAAuB,CAAC,OAAmC;IACvE,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAA;AACjI,CAAC;AAED,2FAA2F;AACpF,KAAK,UAAU,oBAAoB,CAAC,IAAuC,EAAE,OAAmC,EAAE,UAAkB;IACvI,OAAO,CAAC,MAAM,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAA;AAC1E,CAAC;AAEM,KAAK,UAAU,mBAAmB,CAAC,IAAuC,EAAE,OAAmC,EAAE,UAAkB;IACtI,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,EAAC,IAAI,EAAC,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,EAAC,CAAC,CAAC,CAAC,CAAA;IACzH,MAAM,IAAI,GAAG,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC,UAAU,CAAC,EAAC,CAAA;IAChE,OAAO,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAC,CAAA;AACzG,CAAC;AAED,SAAgB,kBAAkB,CAAC,QAAgB;IAC/C,OAAO,IAAA,sBAAW,EAAC,kBAAkB,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAC,YAAY,EAAE,+BAAoB,EAAE,UAAU,EAAE,IAAI,EAAC,CAAC,CAAA;AAChH,CAAC"}
@@ -0,0 +1,153 @@
1
+ import { type RunnerDefinition } from '@cobol-ts/ai-runner';
2
+ import type { YamlParser } from '@cobol-ts/yaml';
3
+ import { type ProjectAssets } from '@cobol-ts/project-file-access';
4
+ import type { RunnerRegistry } from '@cobol-ts/ai-runner';
5
+ import type { Read } from '@cobol-ts/project-context';
6
+ /** Discovery only: never instantiate or invoke a provider. */
7
+ export declare function aiToolkitWith(yaml: YamlParser, assets: ProjectAssets, base: string, read: Read, execution: {
8
+ readonly runners: RunnerRegistry;
9
+ } | undefined, debugAi: boolean, characteristicsConfig?: string, nuke?: boolean): {
10
+ icon: (name: string, kind?: "agents" | "tools") => Promise<string | undefined>;
11
+ toolkit(): Promise<{
12
+ maxMessages: number;
13
+ runners: {
14
+ diagram?: import("@cobol-ts/ai-runner").RunnerDiagramModel | undefined;
15
+ definitionPath?: unknown;
16
+ name: string;
17
+ type: string;
18
+ available: boolean;
19
+ agents: {
20
+ icon?: boolean | undefined;
21
+ role: string;
22
+ name: string;
23
+ model: string;
24
+ modelId: string;
25
+ provider: string;
26
+ prompt: string;
27
+ }[];
28
+ tools: ({
29
+ icon?: true | undefined;
30
+ role: string;
31
+ name: string;
32
+ kind: "validator";
33
+ } | {
34
+ icon?: true | undefined;
35
+ role: string;
36
+ name: string;
37
+ kind: "finished";
38
+ })[];
39
+ }[];
40
+ agents: {
41
+ icon?: boolean | undefined;
42
+ role: string;
43
+ name: string;
44
+ model: string;
45
+ modelId: string;
46
+ provider: string;
47
+ prompt: string;
48
+ }[];
49
+ models: {
50
+ name: string;
51
+ provider: string;
52
+ model: string;
53
+ }[];
54
+ knowledge: string[];
55
+ nuke?: boolean | undefined;
56
+ active: string;
57
+ debugAi: boolean;
58
+ }>;
59
+ runnerDetails(name: string): Promise<{
60
+ diagram?: import("@cobol-ts/ai-runner").RunnerDiagramModel | undefined;
61
+ definitionPath?: unknown;
62
+ name: string;
63
+ type: string;
64
+ available: boolean;
65
+ agents: {
66
+ icon?: boolean | undefined;
67
+ role: string;
68
+ name: string;
69
+ model: string;
70
+ modelId: string;
71
+ provider: string;
72
+ prompt: string;
73
+ }[];
74
+ tools: ({
75
+ icon?: true | undefined;
76
+ role: string;
77
+ name: string;
78
+ kind: "validator";
79
+ } | {
80
+ icon?: true | undefined;
81
+ role: string;
82
+ name: string;
83
+ kind: "finished";
84
+ })[];
85
+ }>;
86
+ inspectRunner(name?: string): Promise<{
87
+ definition?: RunnerDefinition | undefined;
88
+ default: boolean;
89
+ maxMessages: number;
90
+ diagram?: import("@cobol-ts/ai-runner").RunnerDiagramModel | undefined;
91
+ definitionPath?: unknown;
92
+ name: string;
93
+ type: string;
94
+ available: boolean;
95
+ agents: {
96
+ icon?: boolean | undefined;
97
+ role: string;
98
+ name: string;
99
+ model: string;
100
+ modelId: string;
101
+ provider: string;
102
+ prompt: string;
103
+ }[];
104
+ tools: ({
105
+ icon?: true | undefined;
106
+ role: string;
107
+ name: string;
108
+ kind: "validator";
109
+ } | {
110
+ icon?: true | undefined;
111
+ role: string;
112
+ name: string;
113
+ kind: "finished";
114
+ })[];
115
+ }>;
116
+ agentDetails(name: string): Promise<{
117
+ role: {
118
+ path: string;
119
+ content: string;
120
+ };
121
+ shared: {
122
+ path: string;
123
+ content: string;
124
+ }[];
125
+ template: string;
126
+ composed: string;
127
+ }>;
128
+ preview(id: string, runnerName: string, agentName: string): Promise<{
129
+ provider: string;
130
+ inputCharacteristics: {
131
+ id: string;
132
+ metadata: unknown;
133
+ }[];
134
+ targetCharacteristic: {
135
+ id: string;
136
+ metadata: unknown;
137
+ };
138
+ templates: {
139
+ system: string;
140
+ inputs: string;
141
+ target: string;
142
+ };
143
+ files: {
144
+ system: string;
145
+ inputs: string;
146
+ target: string;
147
+ };
148
+ request: {
149
+ model: string;
150
+ messages: import("@cobol-ts/ai").ChatMessage[];
151
+ };
152
+ }>;
153
+ };
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.aiToolkitWith = aiToolkitWith;
4
+ const ai_icon_1 = require("./ai.icon");
5
+ const node_path_1 = require("node:path");
6
+ const ai_agent_1 = require("@cobol-ts/ai-agent");
7
+ const ai_runner_1 = require("@cobol-ts/ai-runner");
8
+ const ai_experiments_1 = require("@cobol-ts/ai-experiments");
9
+ const characteristics_yaml_1 = require("@cobol-ts/characteristics-yaml");
10
+ const ai_system_prompt_1 = require("./ai.system.prompt");
11
+ const ai_configuration_1 = require("./ai.configuration");
12
+ const ai_runner_definition_1 = require("./ai.runner.definition");
13
+ /** Discovery only: never instantiate or invoke a provider. */
14
+ function aiToolkitWith(yaml, assets, base, read, execution, debugAi, characteristicsConfig, nuke = false) {
15
+ const config = async () => {
16
+ const parsed = yaml.parse(await read((0, node_path_1.resolve)(base, 'ai.yaml')));
17
+ if ('errors' in parsed)
18
+ throw new Error(parsed.errors.join('; '));
19
+ return (0, ai_configuration_1.parseAiConfiguration)(parsed.value);
20
+ };
21
+ const safeRead = (path) => assets.prompt(base, path);
22
+ const describeAgent = (c, name, role) => {
23
+ const agent = (0, ai_configuration_1.selectAiAgent)(c, name), model = (0, ai_configuration_1.selectAiModel)(c, agent.model);
24
+ return { role, name, model: agent.model, modelId: model.model, provider: model.provider, prompt: (0, node_path_1.resolve)(base, agent.prompt), ...(agent.icon ? { icon: true } : {}) };
25
+ };
26
+ const describeRunner = (c, name, runner, definition) => {
27
+ const roles = definition ? (0, ai_runner_1.runnerRoles)(definition) : { agents: runner.type === 'single-shot' ? ['agent'] : runner.type === 'creator-reviewer' ? ['creator', 'reviewer'] : [],
28
+ validators: runner.type === 'creator-reviewer' ? ['validation', 'reviewValidation'] : ['validation'], finished: ['finished'] };
29
+ const bindings = definition ? (0, ai_runner_1.runnerAgentBindings)(definition, runner) : [];
30
+ const agents = roles.agents.map(role => describeAgent(c, bindings.find(b => b.role === role)?.name ?? (0, ai_configuration_1.nonEmpty)(runner[role], `Runner ${role}`), role));
31
+ const validators = definition ? [...new Map(bindings.map(binding => [binding.validatorRole, binding.validators])).entries()].flatMap(([role, list]) => list.map(({ tool, options }, index) => ({ role: index ? `${role}:${index}` : role, name: tool, kind: 'validator', ...(Object.keys(options).length ? { options } : {}) }))) :
32
+ roles.validators.map(role => ({ role, name: (0, ai_configuration_1.nonEmpty)(runner[role], `Runner ${role}`), kind: 'validator' }));
33
+ const tools = [...validators,
34
+ ...roles.finished.map(role => ({ role, name: (0, ai_configuration_1.nonEmpty)(runner[role] ?? 'experiment-finished', `Runner ${role}`), kind: 'finished' }))];
35
+ return { name, type: runner.type, available: !!execution && (!!definition || Object.prototype.hasOwnProperty.call(execution.runners, runner.type)), agents,
36
+ tools: tools.map(tool => ({ ...tool, ...(c.tools?.[tool.name]?.icon ? { icon: true } : {}) })),
37
+ ...(definition ? { diagram: (0, ai_runner_1.runnerDiagram)(definition, runner), definitionPath: runner.definition } : {}) };
38
+ };
39
+ const loadRunner = async (c, name, runner) => describeRunner(c, name, runner, await (0, ai_runner_definition_1.readRunnerDefinitionWith)(yaml, assets, base, read, runner));
40
+ const inspect = async (c, agentName) => {
41
+ const agent = (0, ai_configuration_1.selectAiAgent)(c, agentName);
42
+ const sources = await (0, ai_system_prompt_1.inspectSystemPrompt)(safeRead, c.prompts, agent.prompt);
43
+ return { role: sources.role, shared: sources.shared, template: sources.template, composed: (0, ai_system_prompt_1.renderSystemPrompt)(sources.template) };
44
+ };
45
+ return {
46
+ icon: (name, kind = 'agents') => (0, ai_icon_1.agentIconWith)(yaml, assets, base, read, name, kind),
47
+ async toolkit() {
48
+ const c = await config();
49
+ const runners = await Promise.all(Object.entries(c.runners).map(([name, runner]) => loadRunner(c, name, runner)));
50
+ return { active: c.active, debugAi, ...(nuke ? { nuke: true } : {}), maxMessages: c.experiments.maxMessages ?? 10, runners,
51
+ agents: Object.keys(c.agents).map(name => describeAgent(c, name, name)),
52
+ models: Object.entries(c.models).map(([name, model]) => ({ name, provider: model.provider, model: model.model })),
53
+ knowledge: (0, ai_system_prompt_1.sharedSystemPromptPaths)(c.prompts) };
54
+ },
55
+ async runnerDetails(name) {
56
+ const c = await config();
57
+ return loadRunner(c, name, (0, ai_configuration_1.selectAiRunner)(c, name));
58
+ },
59
+ async inspectRunner(name) {
60
+ const c = await config(), selected = name ?? c.active;
61
+ const runner = (0, ai_configuration_1.selectAiRunner)(c, selected);
62
+ const definition = await (0, ai_runner_definition_1.readRunnerDefinitionWith)(yaml, assets, base, read, runner);
63
+ return { ...describeRunner(c, selected, runner, definition), default: selected === c.active,
64
+ maxMessages: c.experiments.maxMessages ?? 10, ...(definition ? { definition } : {}) };
65
+ },
66
+ async agentDetails(name) { return inspect(await config(), name); },
67
+ async preview(id, runnerName, agentName) {
68
+ const c = await config(), runner = await loadRunner(c, runnerName, (0, ai_configuration_1.selectAiRunner)(c, runnerName));
69
+ if (!runner.agents.some(agent => agent.name === agentName))
70
+ throw new Error('Agent does not belong to selected runner');
71
+ const agent = (0, ai_configuration_1.selectAiAgent)(c, agentName), model = (0, ai_configuration_1.selectAiModel)(c, agent.model);
72
+ const files = { system: (0, node_path_1.resolve)(base, agent.prompt), inputs: (0, node_path_1.resolve)(base, c.prompts.inputs), target: (0, node_path_1.resolve)(base, c.prompts.target) };
73
+ const [system, inputs, target, catalogue] = await Promise.all([inspect(c, agentName), safeRead(c.prompts.inputs), safeRead(c.prompts.target), (0, characteristics_yaml_1.loadCharacteristicCatalogues)(base, read, yaml, characteristicsConfig)]);
74
+ const task = (0, ai_experiments_1.prepareCharacteristicTask)(catalogue, { inputs, target });
75
+ const { messages, targetCharacteristic } = task.task(id);
76
+ return { provider: model.provider, inputCharacteristics: task.inputCharacteristics, targetCharacteristic, templates: { system: system.template, inputs, target }, files,
77
+ request: { model: model.model, messages: (0, ai_agent_1.messagesForAgent)({ name: agentName, model: agent.model, modelId: model.model, systemPrompt: system.composed }, messages) } };
78
+ }
79
+ };
80
+ }
81
+ //# sourceMappingURL=ai.toolkit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.toolkit.js","sourceRoot":"","sources":["../../src/ai.toolkit.ts"],"names":[],"mappings":";;AAeA,sCAkEC;AAjFD,uCAAuC;AACvC,yCAAiC;AACjC,iDAAmD;AACnD,mDAA0G;AAC1G,6DAAkE;AAClE,yEAA2E;AAE3E,yDAAmG;AACnG,yDAAiK;AACjK,iEAA+D;AAK/D,8DAA8D;AAC9D,SAAgB,aAAa,CAAC,IAAe,EAAC,MAAoB,EAAC,IAAY,EAAE,IAAU,EAAE,SAAyD,EAAE,OAAgB,EAAE,qBAA8B,EAAE,IAAI,GAAG,KAAK;IAClN,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,IAAA,mBAAO,EAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;QAC/D,IAAI,QAAQ,IAAI,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,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
3
+ export * from './src/ai.toolkit'
4
+ export * from './src/ai.runner.definition'
5
+ export * from './src/ai.system.prompt'
6
+ export * from './src/ai.debug'
7
+ export * from './src/ai'
package/package.json CHANGED
@@ -1,6 +1,76 @@
1
1
  {
2
2
  "name": "@cobol-ts/project-ai",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "description": "AI configuration, providers, runner inspection",
4
+ "version": "0.0.57",
5
+ "main": "dist/index",
6
+ "types": "dist/index",
7
+ "browserslist": {
8
+ "development": [
9
+ "last 1 chrome version",
10
+ "last 1 firefox version",
11
+ "last 1 safari version"
12
+ ],
13
+ "production": [
14
+ ">0.2%",
15
+ "not dead",
16
+ "not op_mini all"
17
+ ]
18
+ },
19
+ "dependencies": {
20
+ "@bufbuild/cel": "^0.6.1",
21
+ "@bufbuild/protobuf": "^2",
22
+ "@cobol-ts/ai": "0.0.57",
23
+ "@cobol-ts/ai-agent": "0.0.57",
24
+ "@cobol-ts/ai-experiments": "0.0.57",
25
+ "@cobol-ts/ai-runner": "0.0.57",
26
+ "@cobol-ts/ai-tool-cel-graph": "0.0.57",
27
+ "@cobol-ts/cel-graph-runtime": "0.0.57",
28
+ "@cobol-ts/characteristics-yaml": "0.0.57",
29
+ "@cobol-ts/project-file-access": "0.0.57",
30
+ "@cobol-ts/template": "0.0.57",
31
+ "@cobol-ts/validation-policy": "0.0.57",
32
+ "@cobol-ts/project-context": "0.0.57",
33
+ "@cobol-ts/yaml": "0.0.57"
34
+ },
35
+ "devDependencies": {
36
+ "typescript": "^5.2.2",
37
+ "@testing-library/jest-dom": "^6.1.4",
38
+ "@types/jest": "^29.0.0",
39
+ "@types/node": "^20.0.0",
40
+ "jest": "^29.0.0",
41
+ "ts-jest": "^29.0.0"
42
+ },
43
+ "eslintConfig": {
44
+ "extends": [
45
+ "react-app",
46
+ "react-app/jest"
47
+ ],
48
+ "overrides": [
49
+ {
50
+ "files": [
51
+ "**/*.stories.*"
52
+ ],
53
+ "rules": {
54
+ "import/no-anonymous-default-export": "off"
55
+ }
56
+ }
57
+ ]
58
+ },
59
+ "files": [
60
+ "dist/index.js",
61
+ "dist/index.d.ts",
62
+ "dist/src/",
63
+ "dist/",
64
+ "dist/**/*"
65
+ ],
66
+ "keywords": [
67
+ "indexing"
68
+ ],
69
+ "license": "MIT",
70
+ "module": "./index.ts",
71
+ "repository": "git@github.com:intellimaintain/intellimaintain.git",
72
+ "scripts": {
73
+ "test": "jest --config jest.config.json --env node",
74
+ "test:watch": "npm run test -- --watch"
75
+ }
6
76
  }