@tangle-network/agent-provider-cli-bridge 2.0.12 → 2.0.13

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.
@@ -159,6 +159,9 @@ export function narrowCliBridgeCapabilities(adapter, reported, selectedBackend,
159
159
  placement: adapter.placement && reported.placement,
160
160
  usage: adapter.usage && reported.usage,
161
161
  confidential: adapter.confidential && reported.confidential,
162
+ // Bridge discovery documents carry no create block, so they cannot deny
163
+ // the create inputs this adapter forwards (wire.ts runtime_attachments).
164
+ ...(adapter.create === undefined ? {} : { create: adapter.create }),
162
165
  // Observation is measured by this adapter, not by the remote backend document.
163
166
  ...(observation === undefined ? {} : { observation }),
164
167
  };
@@ -1,4 +1,4 @@
1
- import type { Sha256Digest } from "@tangle-network/agent-interface";
1
+ import { type Sha256Digest } from "@tangle-network/agent-interface";
2
2
  export interface CliBridgeEnvironmentRoute {
3
3
  readonly backend?: string;
4
4
  readonly model?: string;
@@ -1,6 +1,6 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
+ import { CONTRACT_MAX_IDENTIFIER_LENGTH } from "@tangle-network/agent-interface";
2
3
  const CLI_BRIDGE_ENVIRONMENT_ID_PREFIX = "cb1.";
3
- const MAX_ENVIRONMENT_ID_LENGTH = 512;
4
4
  /**
5
5
  * Keep the exact route and create digest inside the provider-owned id.
6
6
  * The nonce hides a caller idempotency key while repeated creates stay stable.
@@ -17,8 +17,8 @@ export function cliBridgeEnvironmentId(route, createDigest, idempotencyKey) {
17
17
  nonce,
18
18
  ]);
19
19
  const id = `${CLI_BRIDGE_ENVIRONMENT_ID_PREFIX}${Buffer.from(payload).toString("base64url")}`;
20
- if (id.length > MAX_ENVIRONMENT_ID_LENGTH) {
21
- throw new Error("cli-bridge route is too long to retain in an environment id");
20
+ if (id.length > CONTRACT_MAX_IDENTIFIER_LENGTH) {
21
+ throw new Error(`cli-bridge route is too long to retain in an environment id of at most ${CONTRACT_MAX_IDENTIFIER_LENGTH} characters`);
22
22
  }
23
23
  return id;
24
24
  }
@@ -27,7 +27,7 @@ export function cliBridgeEnvironmentRoute(id) {
27
27
  if (!id.startsWith(CLI_BRIDGE_ENVIRONMENT_ID_PREFIX)) {
28
28
  throw new Error("cli-bridge environment id is not a provider-owned retained identity");
29
29
  }
30
- if (id.length > MAX_ENVIRONMENT_ID_LENGTH) {
30
+ if (id.length > CONTRACT_MAX_IDENTIFIER_LENGTH) {
31
31
  throw new Error("cli-bridge environment id has invalid retained route data");
32
32
  }
33
33
  const encoded = id.slice(CLI_BRIDGE_ENVIRONMENT_ID_PREFIX.length);
@@ -72,7 +72,7 @@ function optionalRouteValue(value) {
72
72
  function routeValue(value) {
73
73
  return (typeof value === "string" &&
74
74
  value.length > 0 &&
75
- value.length <= MAX_ENVIRONMENT_ID_LENGTH &&
75
+ value.length <= CONTRACT_MAX_IDENTIFIER_LENGTH &&
76
76
  value.trim() === value);
77
77
  }
78
78
  function sha256Digest(value) {
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { agentEnvironmentCreateInputDigest, createAgentEnvironmentWithIdempotency, AgentEnvironmentGetOptionsSchema, } from "@tangle-network/agent-interface/environment-provider";
2
- import { harnessTypeSchema, harnessSystemPromptIntents, snapshotAgentProfile, deepFreeze, ContextTransferReceiptSchema, WorkspaceRequestSchema, workspaceCwdPathForBase, } from "@tangle-network/agent-interface";
2
+ import { CONTRACT_MAX_IDENTIFIER_LENGTH, harnessTypeSchema, harnessSystemPromptIntents, snapshotAgentProfile, deepFreeze, ContextTransferReceiptSchema, WorkspaceRequestSchema, workspaceCwdPathForBase, } from "@tangle-network/agent-interface";
3
3
  import { createCliBridgeEnvironment, } from "./retained-environment.js";
4
4
  import { lookupExactCliBridgeRun, } from "./retained-control.js";
5
5
  import { cachedCliBridgeCapabilityDiscovery, narrowCliBridgeCapabilities, } from "./capability-discovery.js";
@@ -199,9 +199,9 @@ function selectedBackendFromRoute(route) {
199
199
  }
200
200
  function assertRequestedEnvironmentId(value) {
201
201
  if (value.length === 0 ||
202
- value.length > 256 ||
202
+ value.length > CONTRACT_MAX_IDENTIFIER_LENGTH ||
203
203
  !/^[A-Za-z0-9][A-Za-z0-9._:-]*$/u.test(value)) {
204
- throw new Error("cli-bridge requested environment id must be 1-256 URL-safe characters");
204
+ throw new Error(`cli-bridge requested environment id must be 1-${CONTRACT_MAX_IDENTIFIER_LENGTH} URL-safe characters`);
205
205
  }
206
206
  }
207
207
  /** Bridge capabilities. The adapter forwards an AgentProfile and does not own harness prompt controls. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-provider-cli-bridge",
3
- "version": "2.0.12",
3
+ "version": "2.0.13",
4
4
  "description": "AgentEnvironmentProvider adapter for cli-bridge retained sessions and one-shot turns",
5
5
  "type": "module",
6
6
  "license": "MIT",