@tangle-network/agent-interface 5.5.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ import type { HarnessType } from "./harness.js";
7
7
  * 3. system-prompt intents (whether a harness can replace its own prompt, add to it, or neither).
8
8
  *
9
9
  * All are facets of the same question — "what can this (harness, model) pair actually do" — and
10
- * apply to BOTH harness-backed systems (vendor-locked CLIs like claude-code/codex/kimi) AND
10
+ * apply to BOTH harness-backed systems (CLIs that speak a vendor wire, like claude-code, codex and kimi-code) AND
11
11
  * router-backed systems (opencode, cli-base: any model the router serves). Lifted here so the
12
12
  * cli-bridge backends, the sandbox UI pickers, and the router all read one truth instead of each
13
13
  * hand-rolling a divergent copy.
@@ -91,7 +91,7 @@ export declare function harnessModelSupport(harness: HarnessType, modelId: strin
91
91
  * Whether a harness can run a model; {@link harnessModelSupport} gives the reason when it cannot.
92
92
  */
93
93
  export declare function harnessSupportsModel(harness: HarnessType, modelId: string, options?: HarnessModelSupportOptions): boolean;
94
- /** The harness to adopt for a model whose provider is vendor-locked (`anthropic` → `claude-code`,
94
+ /** The harness a vendor's model adopts when the caller names none (`anthropic` → `claude-code`,
95
95
  * `openai` → `codex`, `moonshot` → `kimi-code`); `null` when any router-backed harness will do. */
96
96
  export declare function preferredHarnessForModel(modelId: string): HarnessType | null;
97
97
  /**
@@ -104,8 +104,7 @@ export declare function preferredHarnessForModel(modelId: string): HarnessType |
104
104
  export declare function snapModelToHarness(harness: HarnessType, modelId: string, candidateIds: readonly string[]): string;
105
105
  /**
106
106
  * Keep the harness when it can run `modelId`; otherwise return the model's native harness
107
- * (anthropic → claude-code, openai → codex, moonshot → kimi-code), falling back to the router-backed
108
- * `opencode` for everything else.
107
+ * ({@link vendorHarness}), falling back to the router-backed `opencode` for everything else.
109
108
  */
110
109
  export declare function snapHarnessToModel(harness: HarnessType, modelId: string): HarnessType;
111
110
  /** The reasoning efforts a harness can express, independent of model — its explicit override set, or
@@ -6,7 +6,7 @@ import { REASONING_EFFORTS, } from "./agent-profile.js";
6
6
  * 3. system-prompt intents (whether a harness can replace its own prompt, add to it, or neither).
7
7
  *
8
8
  * All are facets of the same question — "what can this (harness, model) pair actually do" — and
9
- * apply to BOTH harness-backed systems (vendor-locked CLIs like claude-code/codex/kimi) AND
9
+ * apply to BOTH harness-backed systems (CLIs that speak a vendor wire, like claude-code, codex and kimi-code) AND
10
10
  * router-backed systems (opencode, cli-base: any model the router serves). Lifted here so the
11
11
  * cli-bridge backends, the sandbox UI pickers, and the router all read one truth instead of each
12
12
  * hand-rolling a divergent copy.
@@ -20,19 +20,36 @@ import { REASONING_EFFORTS, } from "./agent-profile.js";
20
20
  export const reasoningLadder = REASONING_EFFORTS;
21
21
  // ── Harness ↔ model compatibility ────────────────────────────────────────────
22
22
  /**
23
- * Provider prefixes a harness is vendor-locked to (canonical-id prefix, e.g. `anthropic`, `openai`).
24
- * A harness with no entry is router-backed: it runs any model, except the measured exclusions in
23
+ * Provider prefixes a harness is vendor-locked to (canonical-id prefix, e.g. `moonshot`). A harness
24
+ * with no entry is router-backed: it runs any model, except the measured exclusions in
25
25
  * {@link harnessModelExclusions}.
26
26
  *
27
+ * `claude-code` and `codex` are deliberately absent. Their CLIs speak a vendor wire (Anthropic
28
+ * Messages, OpenAI Responses), but the Tangle Router passes only that vendor's own models through
29
+ * natively and translates every other model on those wires to chat completions (text, images and
30
+ * function tools, streamed or not; hosted tools are dropped), so both run any router-served model.
31
+ * A caller's own vendor key or login still serves that vendor's models alone, which this table does
32
+ * not see. Which harness a vendor's model adopts when the caller names none is
33
+ * {@link vendorHarness}, a separate fact.
34
+ *
27
35
  * `nanoclaw` is deliberately absent despite the "claw" name: its runner routes every provider through
28
36
  * the Tangle router (canonical model id straight to the gateway), so it is router-backed like
29
37
  * `opencode` — not Anthropic-locked.
30
38
  */
31
39
  const harnessProviderLock = {
32
- "claude-code": ["anthropic"],
33
- codex: ["openai"],
34
40
  "kimi-code": ["moonshot"],
35
41
  };
42
+ /**
43
+ * The harness that natively speaks a vendor's models. A model of that vendor adopts it when the
44
+ * caller names no harness ({@link preferredHarnessForModel}), and a locked harness handed such a
45
+ * model switches to it ({@link snapHarnessToModel}). It is not a restriction: `claude-code` and
46
+ * `codex` also run other providers' models through the router.
47
+ */
48
+ const vendorHarness = {
49
+ anthropic: "claude-code",
50
+ openai: "codex",
51
+ moonshot: "kimi-code",
52
+ };
36
53
  /** Provider prefix of a canonical model id (`anthropic/claude-…` → `anthropic`), or null. */
37
54
  export function modelProvider(modelId) {
38
55
  const slash = modelId.indexOf("/");
@@ -169,17 +186,11 @@ export function harnessModelSupport(harness, modelId, options = {}) {
169
186
  export function harnessSupportsModel(harness, modelId, options) {
170
187
  return harnessModelSupport(harness, modelId, options).supported;
171
188
  }
172
- /** The harness to adopt for a model whose provider is vendor-locked (`anthropic` → `claude-code`,
189
+ /** The harness a vendor's model adopts when the caller names none (`anthropic` → `claude-code`,
173
190
  * `openai` → `codex`, `moonshot` → `kimi-code`); `null` when any router-backed harness will do. */
174
191
  export function preferredHarnessForModel(modelId) {
175
192
  const provider = resolveModelProvider(modelId);
176
- if (!provider)
177
- return null;
178
- for (const [harness, providers] of Object.entries(harnessProviderLock)) {
179
- if (providers?.includes(provider))
180
- return harness;
181
- }
182
- return null;
193
+ return provider ? (vendorHarness[provider] ?? null) : null;
183
194
  }
184
195
  // ── Harness ↔ model snapping (catalog-aware) ─────────────────────────────────
185
196
  /**
@@ -188,12 +199,6 @@ export function preferredHarnessForModel(modelId) {
188
199
  * harness never snaps (it runs the model as-is).
189
200
  */
190
201
  const harnessPreferredModelPatterns = {
191
- "claude-code": [
192
- /^anthropic\/claude-opus-[\d.-]+$/,
193
- /^anthropic\/claude-sonnet-[\d.-]+$/,
194
- /^anthropic\//,
195
- ],
196
- codex: [/^openai\/gpt-\d+(\.\d+)?$/, /^openai\/gpt/, /^openai\//],
197
202
  "kimi-code": [/^moonshot\//],
198
203
  };
199
204
  const numericDesc = new Intl.Collator(undefined, {
@@ -222,8 +227,7 @@ export function snapModelToHarness(harness, modelId, candidateIds) {
222
227
  }
223
228
  /**
224
229
  * Keep the harness when it can run `modelId`; otherwise return the model's native harness
225
- * (anthropic → claude-code, openai → codex, moonshot → kimi-code), falling back to the router-backed
226
- * `opencode` for everything else.
230
+ * ({@link vendorHarness}), falling back to the router-backed `opencode` for everything else.
227
231
  */
228
232
  export function snapHarnessToModel(harness, modelId) {
229
233
  if (harnessSupportsModel(harness, modelId))
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export * from "./host-services.js";
9
9
  export * from "./mcp.js";
10
10
  export * from "./provider-adapter.js";
11
11
  export type * from "./environment-provider.js";
12
- export { AgentEnvironmentCapabilitiesSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, createAgentEnvironmentWithIdempotency, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, ResourceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
12
+ export { AgentEnvironmentCapabilitiesSchema, AgentEnvironmentReadOnlyGetOptionsSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, createAgentEnvironmentWithIdempotency, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, ResourceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
13
13
  export * from "./plan.js";
14
14
  export * from "./runtime-control.js";
15
15
  export * from "./portable-context.js";
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ export * from "./provider-config.js";
8
8
  export * from "./host-services.js";
9
9
  export * from "./mcp.js";
10
10
  export * from "./provider-adapter.js";
11
- export { AgentEnvironmentCapabilitiesSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, createAgentEnvironmentWithIdempotency, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, ResourceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
11
+ export { AgentEnvironmentCapabilitiesSchema, AgentEnvironmentReadOnlyGetOptionsSchema, AgentRuntimeAttachmentsSchema, AgentNativeContextContinuationAdmissionSchema, AgentNativeContextContinuationResultSchema, AgentTurnInputSchema, AgentTurnResultSchema, agentEnvironmentCreateInputDigest, agentNativeContextContinuationAdmissionMatchesRequest, agentNativeContextContinuationResultMatchesRequest, AccountUsageSchema, AgentEnvironmentObservationSchema, AgentEnvironmentStatusSchema, ComputeBillingSchema, EnvironmentLifecycleSchema, ModelUsageSchema, ObservationProvenanceSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, createAgentEnvironmentWithIdempotency, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, ResourceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } from "./environment-provider.js";
12
12
  export * from "./plan.js";
13
13
  export * from "./runtime-control.js";
14
14
  export * from "./portable-context.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "5.5.0",
3
+ "version": "5.6.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",