@executioncontrolprotocol/runtime 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engine/context-loader.d.ts +31 -0
- package/dist/engine/context-loader.d.ts.map +1 -0
- package/dist/engine/context-loader.js +90 -0
- package/dist/engine/context-loader.js.map +1 -0
- package/dist/engine/index.d.ts +6 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +6 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/runner.d.ts +92 -0
- package/dist/engine/runner.d.ts.map +1 -0
- package/dist/engine/runner.js +852 -0
- package/dist/engine/runner.js.map +1 -0
- package/dist/engine/schema-validator.d.ts +32 -0
- package/dist/engine/schema-validator.d.ts.map +1 -0
- package/dist/engine/schema-validator.js +69 -0
- package/dist/engine/schema-validator.js.map +1 -0
- package/dist/engine/system-config-loader.d.ts +39 -0
- package/dist/engine/system-config-loader.d.ts.map +1 -0
- package/dist/engine/system-config-loader.js +80 -0
- package/dist/engine/system-config-loader.js.map +1 -0
- package/dist/engine/types.d.ts +324 -0
- package/dist/engine/types.d.ts.map +1 -0
- package/dist/engine/types.js +10 -0
- package/dist/engine/types.js.map +1 -0
- package/dist/evals/index.d.ts +3 -0
- package/dist/evals/index.d.ts.map +1 -0
- package/dist/evals/index.js +3 -0
- package/dist/evals/index.js.map +1 -0
- package/dist/evals/scorer.d.ts +23 -0
- package/dist/evals/scorer.d.ts.map +1 -0
- package/dist/evals/scorer.js +133 -0
- package/dist/evals/scorer.js.map +1 -0
- package/dist/evals/types.d.ts +128 -0
- package/dist/evals/types.d.ts.map +1 -0
- package/dist/evals/types.js +11 -0
- package/dist/evals/types.js.map +1 -0
- package/dist/extensions/builtin.d.ts +44 -0
- package/dist/extensions/builtin.d.ts.map +1 -0
- package/dist/extensions/builtin.js +66 -0
- package/dist/extensions/builtin.js.map +1 -0
- package/dist/extensions/index.d.ts +4 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/index.js +4 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/extensions/progress-loggers/file-logger.d.ts +27 -0
- package/dist/extensions/progress-loggers/file-logger.d.ts.map +1 -0
- package/dist/extensions/progress-loggers/file-logger.js +54 -0
- package/dist/extensions/progress-loggers/file-logger.js.map +1 -0
- package/dist/extensions/registry.d.ts +74 -0
- package/dist/extensions/registry.d.ts.map +1 -0
- package/dist/extensions/registry.js +126 -0
- package/dist/extensions/registry.js.map +1 -0
- package/dist/extensions/types.d.ts +78 -0
- package/dist/extensions/types.d.ts.map +1 -0
- package/dist/extensions/types.js +7 -0
- package/dist/extensions/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/mounts/hydrator.d.ts +46 -0
- package/dist/mounts/hydrator.d.ts.map +1 -0
- package/dist/mounts/hydrator.js +142 -0
- package/dist/mounts/hydrator.js.map +1 -0
- package/dist/mounts/index.d.ts +4 -0
- package/dist/mounts/index.d.ts.map +1 -0
- package/dist/mounts/index.js +4 -0
- package/dist/mounts/index.js.map +1 -0
- package/dist/mounts/interpolation.d.ts +33 -0
- package/dist/mounts/interpolation.d.ts.map +1 -0
- package/dist/mounts/interpolation.js +59 -0
- package/dist/mounts/interpolation.js.map +1 -0
- package/dist/mounts/types.d.ts +80 -0
- package/dist/mounts/types.d.ts.map +1 -0
- package/dist/mounts/types.js +10 -0
- package/dist/mounts/types.js.map +1 -0
- package/dist/policies/enforcer.d.ts +23 -0
- package/dist/policies/enforcer.d.ts.map +1 -0
- package/dist/policies/enforcer.js +111 -0
- package/dist/policies/enforcer.js.map +1 -0
- package/dist/policies/index.d.ts +3 -0
- package/dist/policies/index.d.ts.map +1 -0
- package/dist/policies/index.js +3 -0
- package/dist/policies/index.js.map +1 -0
- package/dist/policies/types.d.ts +87 -0
- package/dist/policies/types.d.ts.map +1 -0
- package/dist/policies/types.js +11 -0
- package/dist/policies/types.js.map +1 -0
- package/dist/protocols/a2a/a2a-transport.d.ts +40 -0
- package/dist/protocols/a2a/a2a-transport.d.ts.map +1 -0
- package/dist/protocols/a2a/a2a-transport.js +212 -0
- package/dist/protocols/a2a/a2a-transport.js.map +1 -0
- package/dist/protocols/a2a/index.d.ts +3 -0
- package/dist/protocols/a2a/index.d.ts.map +1 -0
- package/dist/protocols/a2a/index.js +2 -0
- package/dist/protocols/a2a/index.js.map +1 -0
- package/dist/protocols/agent-transport.d.ts +101 -0
- package/dist/protocols/agent-transport.d.ts.map +1 -0
- package/dist/protocols/agent-transport.js +11 -0
- package/dist/protocols/agent-transport.js.map +1 -0
- package/dist/protocols/index.d.ts +5 -0
- package/dist/protocols/index.d.ts.map +1 -0
- package/dist/protocols/index.js +5 -0
- package/dist/protocols/index.js.map +1 -0
- package/dist/protocols/mcp/index.d.ts +2 -0
- package/dist/protocols/mcp/index.d.ts.map +1 -0
- package/dist/protocols/mcp/index.js +2 -0
- package/dist/protocols/mcp/index.js.map +1 -0
- package/dist/protocols/mcp/mcp-tool-invoker.d.ts +30 -0
- package/dist/protocols/mcp/mcp-tool-invoker.d.ts.map +1 -0
- package/dist/protocols/mcp/mcp-tool-invoker.js +121 -0
- package/dist/protocols/mcp/mcp-tool-invoker.js.map +1 -0
- package/dist/protocols/tool-invoker.d.ts +91 -0
- package/dist/protocols/tool-invoker.d.ts.map +1 -0
- package/dist/protocols/tool-invoker.js +11 -0
- package/dist/protocols/tool-invoker.js.map +1 -0
- package/dist/providers/index.d.ts +4 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +4 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/model-provider.d.ts +132 -0
- package/dist/providers/model-provider.d.ts.map +1 -0
- package/dist/providers/model-provider.js +10 -0
- package/dist/providers/model-provider.js.map +1 -0
- package/dist/providers/ollama/index.d.ts +3 -0
- package/dist/providers/ollama/index.d.ts.map +1 -0
- package/dist/providers/ollama/index.js +2 -0
- package/dist/providers/ollama/index.js.map +1 -0
- package/dist/providers/ollama/ollama-provider.d.ts +41 -0
- package/dist/providers/ollama/ollama-provider.d.ts.map +1 -0
- package/dist/providers/ollama/ollama-provider.js +113 -0
- package/dist/providers/ollama/ollama-provider.js.map +1 -0
- package/dist/providers/openai/index.d.ts +3 -0
- package/dist/providers/openai/index.d.ts.map +1 -0
- package/dist/providers/openai/index.js +2 -0
- package/dist/providers/openai/index.js.map +1 -0
- package/dist/providers/openai/openai-provider.d.ts +41 -0
- package/dist/providers/openai/openai-provider.d.ts.map +1 -0
- package/dist/providers/openai/openai-provider.js +150 -0
- package/dist/providers/openai/openai-provider.js.map +1 -0
- package/dist/testing/cassette.d.ts +88 -0
- package/dist/testing/cassette.d.ts.map +1 -0
- package/dist/testing/cassette.js +123 -0
- package/dist/testing/cassette.js.map +1 -0
- package/dist/testing/index.d.ts +5 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +5 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock-agent-transport.d.ts +49 -0
- package/dist/testing/mock-agent-transport.d.ts.map +1 -0
- package/dist/testing/mock-agent-transport.js +71 -0
- package/dist/testing/mock-agent-transport.js.map +1 -0
- package/dist/testing/mock-model-provider.d.ts +69 -0
- package/dist/testing/mock-model-provider.d.ts.map +1 -0
- package/dist/testing/mock-model-provider.js +92 -0
- package/dist/testing/mock-model-provider.js.map +1 -0
- package/dist/testing/mock-tool-invoker.d.ts +65 -0
- package/dist/testing/mock-tool-invoker.d.ts.map +1 -0
- package/dist/testing/mock-tool-invoker.js +85 -0
- package/dist/testing/mock-tool-invoker.js.map +1 -0
- package/dist/tracing/collector.d.ts +75 -0
- package/dist/tracing/collector.d.ts.map +1 -0
- package/dist/tracing/collector.js +106 -0
- package/dist/tracing/collector.js.map +1 -0
- package/dist/tracing/exporters/console.d.ts +17 -0
- package/dist/tracing/exporters/console.d.ts.map +1 -0
- package/dist/tracing/exporters/console.js +76 -0
- package/dist/tracing/exporters/console.js.map +1 -0
- package/dist/tracing/exporters/index.d.ts +4 -0
- package/dist/tracing/exporters/index.d.ts.map +1 -0
- package/dist/tracing/exporters/index.js +3 -0
- package/dist/tracing/exporters/index.js.map +1 -0
- package/dist/tracing/exporters/json-file.d.ts +30 -0
- package/dist/tracing/exporters/json-file.d.ts.map +1 -0
- package/dist/tracing/exporters/json-file.js +28 -0
- package/dist/tracing/exporters/json-file.js.map +1 -0
- package/dist/tracing/formatter.d.ts +16 -0
- package/dist/tracing/formatter.d.ts.map +1 -0
- package/dist/tracing/formatter.js +81 -0
- package/dist/tracing/formatter.js.map +1 -0
- package/dist/tracing/graph.d.ts +17 -0
- package/dist/tracing/graph.d.ts.map +1 -0
- package/dist/tracing/graph.js +116 -0
- package/dist/tracing/graph.js.map +1 -0
- package/dist/tracing/index.d.ts +6 -0
- package/dist/tracing/index.d.ts.map +1 -0
- package/dist/tracing/index.js +6 -0
- package/dist/tracing/index.js.map +1 -0
- package/dist/tracing/types.d.ts +124 -0
- package/dist/tracing/types.d.ts.map +1 -0
- package/dist/tracing/types.js +11 -0
- package/dist/tracing/types.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime extension registry for model providers, executors, and plugins.
|
|
3
|
+
*
|
|
4
|
+
* @category Extensions
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* In-memory registry of runtime extension factories.
|
|
8
|
+
*
|
|
9
|
+
* @category Extensions
|
|
10
|
+
*/
|
|
11
|
+
export class ExtensionRegistry {
|
|
12
|
+
modelProviders = new Map();
|
|
13
|
+
executors = new Map();
|
|
14
|
+
plugins = new Map();
|
|
15
|
+
progressLoggers = new Map();
|
|
16
|
+
locked = false;
|
|
17
|
+
/**
|
|
18
|
+
* Prevent further registration changes.
|
|
19
|
+
*/
|
|
20
|
+
lock() {
|
|
21
|
+
this.locked = true;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Register a model provider extension.
|
|
25
|
+
*/
|
|
26
|
+
registerModelProvider(registration) {
|
|
27
|
+
this.assertUnlocked();
|
|
28
|
+
this.assertNotRegistered(registration.id, "model-provider");
|
|
29
|
+
this.modelProviders.set(registration.id, registration);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Register an executor extension.
|
|
33
|
+
*/
|
|
34
|
+
registerExecutor(registration) {
|
|
35
|
+
this.assertUnlocked();
|
|
36
|
+
this.assertNotRegistered(registration.id, "executor");
|
|
37
|
+
this.executors.set(registration.id, registration);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Register a progress logger extension.
|
|
41
|
+
*/
|
|
42
|
+
registerProgressLogger(registration) {
|
|
43
|
+
this.assertUnlocked();
|
|
44
|
+
this.assertNotRegistered(registration.id, "progress-logger");
|
|
45
|
+
this.progressLoggers.set(registration.id, registration);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Register a plugin extension.
|
|
49
|
+
*/
|
|
50
|
+
registerPlugin(registration) {
|
|
51
|
+
this.assertUnlocked();
|
|
52
|
+
this.assertNotRegistered(registration.id, "plugin");
|
|
53
|
+
this.plugins.set(registration.id, registration);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Resolve and instantiate a model provider by ID.
|
|
57
|
+
*/
|
|
58
|
+
createModelProvider(id, config) {
|
|
59
|
+
const registration = this.modelProviders.get(id);
|
|
60
|
+
if (!registration) {
|
|
61
|
+
throw new Error(`Model provider extension "${id}" is not registered.`);
|
|
62
|
+
}
|
|
63
|
+
return registration.create(config);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Get a model provider registration by ID.
|
|
67
|
+
*/
|
|
68
|
+
getModelProviderRegistration(id) {
|
|
69
|
+
return this.modelProviders.get(id);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* List registered model provider extensions.
|
|
73
|
+
*/
|
|
74
|
+
listModelProviders() {
|
|
75
|
+
return [...this.modelProviders.values()];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* List registered executor extensions.
|
|
79
|
+
*/
|
|
80
|
+
listExecutors() {
|
|
81
|
+
return [...this.executors.values()];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* List registered plugin extensions.
|
|
85
|
+
*/
|
|
86
|
+
listPlugins() {
|
|
87
|
+
return [...this.plugins.values()];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Create a progress logger by ID.
|
|
91
|
+
*/
|
|
92
|
+
createProgressLogger(id, config) {
|
|
93
|
+
const registration = this.progressLoggers.get(id);
|
|
94
|
+
if (!registration) {
|
|
95
|
+
throw new Error(`Progress logger extension "${id}" is not registered.`);
|
|
96
|
+
}
|
|
97
|
+
return registration.create(config);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get a progress logger registration by ID.
|
|
101
|
+
*/
|
|
102
|
+
getProgressLoggerRegistration(id) {
|
|
103
|
+
return this.progressLoggers.get(id);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* List registered progress logger extensions.
|
|
107
|
+
*/
|
|
108
|
+
listProgressLoggers() {
|
|
109
|
+
return [...this.progressLoggers.values()];
|
|
110
|
+
}
|
|
111
|
+
assertUnlocked() {
|
|
112
|
+
if (this.locked) {
|
|
113
|
+
throw new Error("Extension registry is locked and cannot be modified.");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
assertNotRegistered(id, kind) {
|
|
117
|
+
const exists = this.modelProviders.has(id) ||
|
|
118
|
+
this.executors.has(id) ||
|
|
119
|
+
this.plugins.has(id) ||
|
|
120
|
+
this.progressLoggers.has(id);
|
|
121
|
+
if (exists) {
|
|
122
|
+
throw new Error(`Extension "${id}" is already registered; duplicate ${kind} registration denied.`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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ACH,6BAA6B,CAAC,EAAU;QACtC,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5C,CAAC;IAEO,cAAc;QACpB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;IACH,CAAC;IAEO,mBAAmB,CACzB,EAAU,EACV,IAAkE;QAElE,MAAM,MAAM,GACV,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YAC3B,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACpB,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC/B,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,cAAc,EAAE,sCAAsC,IAAI,uBAAuB,CAAC,CAAC;QACrG,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared extensibility interfaces for ECP runtime registration.
|
|
3
|
+
*
|
|
4
|
+
* @category Extensions
|
|
5
|
+
*/
|
|
6
|
+
import type { ExtensionSourceType } from "@executioncontrolprotocol/spec";
|
|
7
|
+
import type { ModelProvider } from "../providers/model-provider.js";
|
|
8
|
+
import type { ProgressCallback } from "../engine/types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Base metadata for all runtime extension registrations.
|
|
11
|
+
*
|
|
12
|
+
* @category Extensions
|
|
13
|
+
*/
|
|
14
|
+
export interface ExtensionRegistrationBase {
|
|
15
|
+
/** Stable extension ID (for example `"openai"`). */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Extension version string. */
|
|
18
|
+
version: string;
|
|
19
|
+
/** Source type used to load this extension. */
|
|
20
|
+
sourceType: ExtensionSourceType;
|
|
21
|
+
/** Optional human-readable summary. */
|
|
22
|
+
description?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Factory contract for model provider extensions.
|
|
26
|
+
*
|
|
27
|
+
* @category Extensions
|
|
28
|
+
*/
|
|
29
|
+
export interface ModelProviderRegistration extends ExtensionRegistrationBase {
|
|
30
|
+
/** Fixed kind discriminator for model provider extensions. */
|
|
31
|
+
kind: "model-provider";
|
|
32
|
+
/**
|
|
33
|
+
* Create a model provider instance from extension configuration.
|
|
34
|
+
*/
|
|
35
|
+
create(config?: Record<string, unknown>): ModelProvider;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Factory contract for executor extensions.
|
|
39
|
+
*
|
|
40
|
+
* @category Extensions
|
|
41
|
+
*/
|
|
42
|
+
export interface ExecutorRegistration extends ExtensionRegistrationBase {
|
|
43
|
+
/** Fixed kind discriminator for executor extensions. */
|
|
44
|
+
kind: "executor";
|
|
45
|
+
/**
|
|
46
|
+
* Create an executor extension instance from extension configuration.
|
|
47
|
+
*/
|
|
48
|
+
create(config?: Record<string, unknown>): unknown;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Factory contract for plugin extensions.
|
|
52
|
+
*
|
|
53
|
+
* @category Extensions
|
|
54
|
+
*/
|
|
55
|
+
export interface PluginRegistration extends ExtensionRegistrationBase {
|
|
56
|
+
/** Fixed kind discriminator for plugin extensions. */
|
|
57
|
+
kind: "plugin";
|
|
58
|
+
/**
|
|
59
|
+
* Create a plugin extension instance from extension configuration.
|
|
60
|
+
*/
|
|
61
|
+
create(config?: Record<string, unknown>): unknown;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Factory contract for progress logger extensions.
|
|
65
|
+
* Progress loggers receive execution progress events (phase, steps, reasoning).
|
|
66
|
+
*
|
|
67
|
+
* @category Extensions
|
|
68
|
+
*/
|
|
69
|
+
export interface ProgressLoggerRegistration extends ExtensionRegistrationBase {
|
|
70
|
+
/** Fixed kind discriminator for progress logger extensions. */
|
|
71
|
+
kind: "progress-logger";
|
|
72
|
+
/**
|
|
73
|
+
* Create a progress logger callback from extension configuration.
|
|
74
|
+
* The callback will be invoked for each progress event during a run.
|
|
75
|
+
*/
|
|
76
|
+
create(config?: Record<string, unknown>): ProgressCallback;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/extensions/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,oDAAoD;IACpD,EAAE,EAAE,MAAM,CAAC;IAEX,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAEhB,+CAA+C;IAC/C,UAAU,EAAE,mBAAmB,CAAC;IAEhC,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAA0B,SAAQ,yBAAyB;IAC1E,8DAA8D;IAC9D,IAAI,EAAE,gBAAgB,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa,CAAC;CACzD;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,yBAAyB;IACrE,wDAAwD;IACxD,IAAI,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CACnD;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACnE,sDAAsD;IACtD,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;CACnD;AAED;;;;;GAKG;AACH,MAAM,WAAW,0BAA2B,SAAQ,yBAAyB;IAC3E,+DAA+D;IAC/D,IAAI,EAAE,iBAAiB,CAAC;IAExB;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,gBAAgB,CAAC;CAC5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/extensions/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./engine/index.js";
|
|
2
|
+
export * from "./providers/index.js";
|
|
3
|
+
export * from "./extensions/index.js";
|
|
4
|
+
export * from "./protocols/index.js";
|
|
5
|
+
export * from "./mounts/index.js";
|
|
6
|
+
export * from "./policies/index.js";
|
|
7
|
+
export * from "./testing/index.js";
|
|
8
|
+
export * from "./evals/index.js";
|
|
9
|
+
export * from "./tracing/index.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./engine/index.js";
|
|
2
|
+
export * from "./providers/index.js";
|
|
3
|
+
export * from "./extensions/index.js";
|
|
4
|
+
export * from "./protocols/index.js";
|
|
5
|
+
export * from "./mounts/index.js";
|
|
6
|
+
export * from "./policies/index.js";
|
|
7
|
+
export * from "./testing/index.js";
|
|
8
|
+
export * from "./evals/index.js";
|
|
9
|
+
export * from "./tracing/index.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mount hydration service.
|
|
3
|
+
*
|
|
4
|
+
* Evaluates mounts by calling tool servers via the {@link ToolInvoker},
|
|
5
|
+
* respecting stage ordering, limits, and selectors.
|
|
6
|
+
*
|
|
7
|
+
* @category Mounts
|
|
8
|
+
*/
|
|
9
|
+
import type { Mount, MountStage } from "@executioncontrolprotocol/spec";
|
|
10
|
+
import type { ToolInvoker } from "../protocols/tool-invoker.js";
|
|
11
|
+
import type { MountOutput, ResolvedInputs } from "../engine/types.js";
|
|
12
|
+
import type { SelectorResult } from "./types.js";
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the selected IDs from a plan output for focus/deep mount expansion.
|
|
15
|
+
*
|
|
16
|
+
* @param selectorPath - Dot-path into the plan output (e.g. `"plan.selectedIssueIds"`).
|
|
17
|
+
* @param planOutput - The orchestrator's plan output.
|
|
18
|
+
* @param maxSelected - Maximum items to select.
|
|
19
|
+
* @returns The resolved selector result.
|
|
20
|
+
*
|
|
21
|
+
* @category Mounts
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveSelector(selectorPath: string, planOutput: Record<string, unknown>, maxSelected?: number): SelectorResult;
|
|
24
|
+
/**
|
|
25
|
+
* Default mount hydrator backed by a {@link ToolInvoker}.
|
|
26
|
+
*
|
|
27
|
+
* @category Mounts
|
|
28
|
+
*/
|
|
29
|
+
export declare class DefaultMountHydrator {
|
|
30
|
+
private readonly toolInvoker;
|
|
31
|
+
constructor(toolInvoker: ToolInvoker);
|
|
32
|
+
/**
|
|
33
|
+
* Hydrate a set of mounts for a specific stage.
|
|
34
|
+
*
|
|
35
|
+
* @param mounts - The mount definitions to hydrate.
|
|
36
|
+
* @param stage - The stage to hydrate (`"seed"`, `"focus"`, or `"deep"`).
|
|
37
|
+
* @param inputs - Resolved Context inputs for interpolation.
|
|
38
|
+
* @param planOutput - The orchestrator's plan output (for focus/deep selectors).
|
|
39
|
+
* @returns Hydrated mount outputs.
|
|
40
|
+
*/
|
|
41
|
+
hydrateStage(mounts: Mount[], stage: MountStage, inputs: ResolvedInputs, planOutput?: Record<string, unknown>): Promise<MountOutput[]>;
|
|
42
|
+
private hydrateMount;
|
|
43
|
+
private hydrateFocusDeepMount;
|
|
44
|
+
private enforceLimit;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=hydrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrator.d.ts","sourceRoot":"","sources":["../../src/mounts/hydrator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,YAAY,CAAC;AAGvE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACnC,WAAW,CAAC,EAAE,MAAM,GACnB,cAAc,CAwBhB;AAED;;;;GAIG;AACH,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAG3C;;;;;;;;OAQG;IACG,YAAY,CAChB,MAAM,EAAE,KAAK,EAAE,EACf,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,cAAc,EACtB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,WAAW,EAAE,CAAC;YAYX,YAAY;YAiDZ,qBAAqB;IAmDnC,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mount hydration service.
|
|
3
|
+
*
|
|
4
|
+
* Evaluates mounts by calling tool servers via the {@link ToolInvoker},
|
|
5
|
+
* respecting stage ordering, limits, and selectors.
|
|
6
|
+
*
|
|
7
|
+
* @category Mounts
|
|
8
|
+
*/
|
|
9
|
+
import { interpolateArgs } from "./interpolation.js";
|
|
10
|
+
/**
|
|
11
|
+
* Resolve the selected IDs from a plan output for focus/deep mount expansion.
|
|
12
|
+
*
|
|
13
|
+
* @param selectorPath - Dot-path into the plan output (e.g. `"plan.selectedIssueIds"`).
|
|
14
|
+
* @param planOutput - The orchestrator's plan output.
|
|
15
|
+
* @param maxSelected - Maximum items to select.
|
|
16
|
+
* @returns The resolved selector result.
|
|
17
|
+
*
|
|
18
|
+
* @category Mounts
|
|
19
|
+
*/
|
|
20
|
+
export function resolveSelector(selectorPath, planOutput, maxSelected) {
|
|
21
|
+
const parts = selectorPath.split(".");
|
|
22
|
+
let current = planOutput;
|
|
23
|
+
for (const part of parts) {
|
|
24
|
+
if (current === null || current === undefined || typeof current !== "object") {
|
|
25
|
+
return { ids: [], wasCapped: false, originalCount: 0 };
|
|
26
|
+
}
|
|
27
|
+
current = current[part];
|
|
28
|
+
}
|
|
29
|
+
if (!Array.isArray(current)) {
|
|
30
|
+
return { ids: [], wasCapped: false, originalCount: 0 };
|
|
31
|
+
}
|
|
32
|
+
const allIds = current.map(String);
|
|
33
|
+
const max = maxSelected ?? allIds.length;
|
|
34
|
+
const capped = allIds.length > max;
|
|
35
|
+
return {
|
|
36
|
+
ids: allIds.slice(0, max),
|
|
37
|
+
wasCapped: capped,
|
|
38
|
+
originalCount: allIds.length,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Default mount hydrator backed by a {@link ToolInvoker}.
|
|
43
|
+
*
|
|
44
|
+
* @category Mounts
|
|
45
|
+
*/
|
|
46
|
+
export class DefaultMountHydrator {
|
|
47
|
+
toolInvoker;
|
|
48
|
+
constructor(toolInvoker) {
|
|
49
|
+
this.toolInvoker = toolInvoker;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Hydrate a set of mounts for a specific stage.
|
|
53
|
+
*
|
|
54
|
+
* @param mounts - The mount definitions to hydrate.
|
|
55
|
+
* @param stage - The stage to hydrate (`"seed"`, `"focus"`, or `"deep"`).
|
|
56
|
+
* @param inputs - Resolved Context inputs for interpolation.
|
|
57
|
+
* @param planOutput - The orchestrator's plan output (for focus/deep selectors).
|
|
58
|
+
* @returns Hydrated mount outputs.
|
|
59
|
+
*/
|
|
60
|
+
async hydrateStage(mounts, stage, inputs, planOutput) {
|
|
61
|
+
const stageMounts = mounts.filter((m) => m.stage === stage);
|
|
62
|
+
const results = [];
|
|
63
|
+
for (const mount of stageMounts) {
|
|
64
|
+
const output = await this.hydrateMount(mount, inputs, planOutput);
|
|
65
|
+
results.push(output);
|
|
66
|
+
}
|
|
67
|
+
return results;
|
|
68
|
+
}
|
|
69
|
+
async hydrateMount(mount, inputs, planOutput) {
|
|
70
|
+
const { from } = mount;
|
|
71
|
+
if (mount.when?.selectorFrom && planOutput) {
|
|
72
|
+
return this.hydrateFocusDeepMount(mount, inputs, planOutput);
|
|
73
|
+
}
|
|
74
|
+
const ctx = { inputs };
|
|
75
|
+
const args = from.args ? interpolateArgs(from.args, ctx) : {};
|
|
76
|
+
try {
|
|
77
|
+
const result = await this.toolInvoker.callTool(from.server, from.tool, args);
|
|
78
|
+
if (result.isError) {
|
|
79
|
+
return {
|
|
80
|
+
mountName: mount.name,
|
|
81
|
+
stage: mount.stage,
|
|
82
|
+
data: [],
|
|
83
|
+
itemCount: 0,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const data = this.enforceLimit(result.content, mount.limits?.maxItems);
|
|
87
|
+
const itemCount = Array.isArray(data) ? data.length : 1;
|
|
88
|
+
return {
|
|
89
|
+
mountName: mount.name,
|
|
90
|
+
stage: mount.stage,
|
|
91
|
+
data,
|
|
92
|
+
itemCount,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return {
|
|
97
|
+
mountName: mount.name,
|
|
98
|
+
stage: mount.stage,
|
|
99
|
+
data: [],
|
|
100
|
+
itemCount: 0,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async hydrateFocusDeepMount(mount, inputs, planOutput) {
|
|
105
|
+
const selector = resolveSelector(mount.when.selectorFrom, planOutput, mount.when.maxSelected);
|
|
106
|
+
if (selector.ids.length === 0) {
|
|
107
|
+
return {
|
|
108
|
+
mountName: mount.name,
|
|
109
|
+
stage: mount.stage,
|
|
110
|
+
data: [],
|
|
111
|
+
itemCount: 0,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const allItems = [];
|
|
115
|
+
for (const id of selector.ids) {
|
|
116
|
+
const ctx = { inputs, item: id };
|
|
117
|
+
const args = mount.from.args ? interpolateArgs(mount.from.args, ctx) : {};
|
|
118
|
+
try {
|
|
119
|
+
const result = await this.toolInvoker.callTool(mount.from.server, mount.from.tool, args);
|
|
120
|
+
if (!result.isError) {
|
|
121
|
+
allItems.push(result.content);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// skip failed items
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const limited = this.enforceLimit(allItems, mount.limits?.maxItems);
|
|
129
|
+
return {
|
|
130
|
+
mountName: mount.name,
|
|
131
|
+
stage: mount.stage,
|
|
132
|
+
data: limited,
|
|
133
|
+
itemCount: limited.length,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
enforceLimit(data, maxItems) {
|
|
137
|
+
if (!maxItems || !Array.isArray(data))
|
|
138
|
+
return data;
|
|
139
|
+
return data.slice(0, maxItems);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=hydrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrator.js","sourceRoot":"","sources":["../../src/mounts/hydrator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,YAAoB,EACpB,UAAmC,EACnC,WAAoB;IAEpB,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,OAAO,GAAY,UAAU,CAAC;IAElC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC7E,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC;QACzD,CAAC;QACD,OAAO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G,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAc,CAAC;QAEjF,OAAO;YACL,SAAS,EAAE,KAAK,CAAC,IAAI;YACrB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,OAAO,CAAC,MAAM;SAC1B,CAAC;IACJ,CAAC;IAEO,YAAY,CAAC,IAAa,EAAE,QAAiB;QACnD,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACnD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mounts/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mounts/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template interpolation for mount arguments.
|
|
3
|
+
*
|
|
4
|
+
* Resolves `${inputs.foo}` and `${item}` expressions in mount arg values.
|
|
5
|
+
*
|
|
6
|
+
* @category Mounts
|
|
7
|
+
*/
|
|
8
|
+
import type { InterpolationContext } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Interpolate template expressions in a single string value.
|
|
11
|
+
*
|
|
12
|
+
* Supported expressions:
|
|
13
|
+
* - `${inputs.<name>}` — resolved from Context inputs
|
|
14
|
+
* - `${item}` — resolved from the current iteration item (focus/deep mounts)
|
|
15
|
+
*
|
|
16
|
+
* @param template - The string potentially containing `${...}` expressions.
|
|
17
|
+
* @param ctx - The interpolation context.
|
|
18
|
+
* @returns The interpolated string.
|
|
19
|
+
*
|
|
20
|
+
* @category Mounts
|
|
21
|
+
*/
|
|
22
|
+
export declare function interpolateString(template: string, ctx: InterpolationContext): string;
|
|
23
|
+
/**
|
|
24
|
+
* Deep-interpolate all string values in a mount arguments object.
|
|
25
|
+
*
|
|
26
|
+
* @param args - The raw args from the mount definition.
|
|
27
|
+
* @param ctx - The interpolation context.
|
|
28
|
+
* @returns A new object with all string values interpolated.
|
|
29
|
+
*
|
|
30
|
+
* @category Mounts
|
|
31
|
+
*/
|
|
32
|
+
export declare function interpolateArgs(args: Record<string, unknown>, ctx: InterpolationContext): Record<string, unknown>;
|
|
33
|
+
//# sourceMappingURL=interpolation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources":["../../src/mounts/interpolation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,oBAAoB,GACxB,MAAM,CAgBR;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,oBAAoB,GACxB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template interpolation for mount arguments.
|
|
3
|
+
*
|
|
4
|
+
* Resolves `${inputs.foo}` and `${item}` expressions in mount arg values.
|
|
5
|
+
*
|
|
6
|
+
* @category Mounts
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Interpolate template expressions in a single string value.
|
|
10
|
+
*
|
|
11
|
+
* Supported expressions:
|
|
12
|
+
* - `${inputs.<name>}` — resolved from Context inputs
|
|
13
|
+
* - `${item}` — resolved from the current iteration item (focus/deep mounts)
|
|
14
|
+
*
|
|
15
|
+
* @param template - The string potentially containing `${...}` expressions.
|
|
16
|
+
* @param ctx - The interpolation context.
|
|
17
|
+
* @returns The interpolated string.
|
|
18
|
+
*
|
|
19
|
+
* @category Mounts
|
|
20
|
+
*/
|
|
21
|
+
export function interpolateString(template, ctx) {
|
|
22
|
+
return template.replace(/\$\{([^}]+)\}/g, (_match, expr) => {
|
|
23
|
+
const trimmed = expr.trim();
|
|
24
|
+
if (trimmed === "item") {
|
|
25
|
+
return ctx.item ?? "";
|
|
26
|
+
}
|
|
27
|
+
if (trimmed.startsWith("inputs.")) {
|
|
28
|
+
const inputName = trimmed.slice("inputs.".length);
|
|
29
|
+
const value = ctx.inputs[inputName];
|
|
30
|
+
return value !== undefined ? String(value) : "";
|
|
31
|
+
}
|
|
32
|
+
return "";
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Deep-interpolate all string values in a mount arguments object.
|
|
37
|
+
*
|
|
38
|
+
* @param args - The raw args from the mount definition.
|
|
39
|
+
* @param ctx - The interpolation context.
|
|
40
|
+
* @returns A new object with all string values interpolated.
|
|
41
|
+
*
|
|
42
|
+
* @category Mounts
|
|
43
|
+
*/
|
|
44
|
+
export function interpolateArgs(args, ctx) {
|
|
45
|
+
const result = {};
|
|
46
|
+
for (const [key, value] of Object.entries(args)) {
|
|
47
|
+
if (typeof value === "string") {
|
|
48
|
+
result[key] = interpolateString(value, ctx);
|
|
49
|
+
}
|
|
50
|
+
else if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
51
|
+
result[key] = interpolateArgs(value, ctx);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
result[key] = value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=interpolation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolation.js","sourceRoot":"","sources":["../../src/mounts/interpolation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,GAAyB;IAEzB,OAAO,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,IAAY,EAAE,EAAE;QACjE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAE5B,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;YACvB,OAAO,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QACxB,CAAC;QAED,IAAI,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAClC,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;YAClD,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACpC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC7B,IAA6B,EAC7B,GAAyB;IAEzB,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,CAAC,GAAG,CAAC,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAChF,MAAM,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,KAAgC,EAAE,GAAG,CAAC,CAAC;QACvE,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the staged mount hydration system.
|
|
3
|
+
*
|
|
4
|
+
* Mounts retrieve data from external tool servers in three stages
|
|
5
|
+
* (seed → focus → deep) to avoid blowing up the context window.
|
|
6
|
+
*
|
|
7
|
+
* @category Mounts
|
|
8
|
+
*/
|
|
9
|
+
import type { Mount } from "@executioncontrolprotocol/spec";
|
|
10
|
+
import type { MountOutput, MountRef, ResolvedInputs } from "../engine/types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Interpolation context available when resolving mount arguments.
|
|
13
|
+
*
|
|
14
|
+
* @category Mounts
|
|
15
|
+
*/
|
|
16
|
+
export interface InterpolationContext {
|
|
17
|
+
/** Resolved Context inputs. */
|
|
18
|
+
inputs: ResolvedInputs;
|
|
19
|
+
/** The current item ID (for focus/deep mounts iterating over selectors). */
|
|
20
|
+
item?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A request to hydrate a single mount.
|
|
24
|
+
*
|
|
25
|
+
* @category Mounts
|
|
26
|
+
*/
|
|
27
|
+
export interface HydrationRequest {
|
|
28
|
+
/** The mount definition from the Context. */
|
|
29
|
+
mount: Mount;
|
|
30
|
+
/** Values for template interpolation in mount args. */
|
|
31
|
+
interpolation: InterpolationContext;
|
|
32
|
+
/**
|
|
33
|
+
* For focus/deep mounts: the selected item IDs to expand.
|
|
34
|
+
* Derived from the plan output via `mount.when.selectorFrom`.
|
|
35
|
+
*/
|
|
36
|
+
selectedIds?: string[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Result of selecting items from a plan output for focus/deep expansion.
|
|
40
|
+
*
|
|
41
|
+
* @category Mounts
|
|
42
|
+
*/
|
|
43
|
+
export interface SelectorResult {
|
|
44
|
+
/** The IDs extracted from the plan output. */
|
|
45
|
+
ids: string[];
|
|
46
|
+
/** Whether the selection was capped by `maxSelected`. */
|
|
47
|
+
wasCapped: boolean;
|
|
48
|
+
/** Original count before capping. */
|
|
49
|
+
originalCount: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Internal representation of mounted data within the engine.
|
|
53
|
+
*
|
|
54
|
+
* @category Mounts
|
|
55
|
+
*/
|
|
56
|
+
export type MountData = {
|
|
57
|
+
kind: "refs";
|
|
58
|
+
refs: MountRef[];
|
|
59
|
+
} | {
|
|
60
|
+
kind: "expanded";
|
|
61
|
+
items: unknown[];
|
|
62
|
+
} | {
|
|
63
|
+
kind: "error";
|
|
64
|
+
error: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Interface for the mount hydration service.
|
|
68
|
+
*
|
|
69
|
+
* @category Mounts
|
|
70
|
+
*/
|
|
71
|
+
export interface MountHydrator {
|
|
72
|
+
/**
|
|
73
|
+
* Hydrate all mounts for a given stage, respecting limits and selectors.
|
|
74
|
+
*
|
|
75
|
+
* @param requests - The mounts to hydrate.
|
|
76
|
+
* @returns The hydrated mount outputs.
|
|
77
|
+
*/
|
|
78
|
+
hydrate(requests: HydrationRequest[]): Promise<MountOutput[]>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mounts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAC5D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