@tangle-network/agent-provider-cli-bridge 0.7.6 → 0.7.7
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/index.js +23 -18
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createAgentEnvironmentWithIdempotency } from "@tangle-network/agent-interface/environment-provider";
|
|
1
2
|
import { harnessSystemPromptIntents, snapshotAgentProfile, } from "@tangle-network/agent-interface";
|
|
2
3
|
import { createCliBridgeEnvironment } from "./retained-environment.js";
|
|
3
4
|
import { assertCliBridgeProviderOptions, } from "./provider-options.js";
|
|
@@ -6,6 +7,7 @@ export { safeEndpointFromBaseUrl } from "./observation.js";
|
|
|
6
7
|
export function createCliBridgeProvider(options) {
|
|
7
8
|
assertCliBridgeProviderOptions(options);
|
|
8
9
|
const name = options.name ?? "cli-bridge";
|
|
10
|
+
const createRecords = new Map();
|
|
9
11
|
// The observation surfaces are declared as intent and narrowed to the
|
|
10
12
|
// sources this bridge can put a value on, so the environment offers the
|
|
11
13
|
// operation exactly where the document claims it.
|
|
@@ -18,27 +20,30 @@ export function createCliBridgeProvider(options) {
|
|
|
18
20
|
observation: narrowedCliBridgeObservation(declared.observation, options),
|
|
19
21
|
};
|
|
20
22
|
};
|
|
23
|
+
const createEnvironment = async (input) => {
|
|
24
|
+
if (typeof input.profile === "string") {
|
|
25
|
+
throw new Error(`createCliBridgeProvider requires an inline AgentProfile; named profile "${input.profile}" is unsupported`);
|
|
26
|
+
}
|
|
27
|
+
const environmentInput = {
|
|
28
|
+
...input,
|
|
29
|
+
profile: snapshotAgentProfile(input.profile),
|
|
30
|
+
};
|
|
31
|
+
const environmentId = input.idempotencyKey ?? crypto.randomUUID();
|
|
32
|
+
return createCliBridgeEnvironment({
|
|
33
|
+
options,
|
|
34
|
+
providerName: name,
|
|
35
|
+
environmentInput,
|
|
36
|
+
environmentId,
|
|
37
|
+
allowDispatch: true,
|
|
38
|
+
cancelRunsOnDestroy: true,
|
|
39
|
+
capabilities: resolveCapabilities(),
|
|
40
|
+
});
|
|
41
|
+
};
|
|
21
42
|
return {
|
|
22
43
|
name,
|
|
23
44
|
capabilities: resolveCapabilities,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
throw new Error(`createCliBridgeProvider requires an inline AgentProfile; named profile "${input.profile}" is unsupported`);
|
|
27
|
-
}
|
|
28
|
-
const environmentInput = {
|
|
29
|
-
...input,
|
|
30
|
-
profile: snapshotAgentProfile(input.profile),
|
|
31
|
-
};
|
|
32
|
-
const environmentId = input.idempotencyKey ?? crypto.randomUUID();
|
|
33
|
-
return createCliBridgeEnvironment({
|
|
34
|
-
options,
|
|
35
|
-
providerName: name,
|
|
36
|
-
environmentInput,
|
|
37
|
-
environmentId,
|
|
38
|
-
allowDispatch: true,
|
|
39
|
-
cancelRunsOnDestroy: true,
|
|
40
|
-
capabilities: resolveCapabilities(),
|
|
41
|
-
});
|
|
45
|
+
create(input) {
|
|
46
|
+
return createAgentEnvironmentWithIdempotency(createRecords, input, () => createEnvironment(input));
|
|
42
47
|
},
|
|
43
48
|
async get(id) {
|
|
44
49
|
if (id.length === 0 || id.trim() !== id) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-provider-cli-bridge",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"description": "AgentEnvironmentProvider adapter for cli-bridge /v1/chat/completions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"LICENSE"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@tangle-network/agent-interface": "^1.0.
|
|
52
|
+
"@tangle-network/agent-interface": "^1.0.1",
|
|
53
53
|
"undici": "7.29.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|