@tangle-network/agent-app 0.46.41 → 0.46.43

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.
@@ -1,5 +1,6 @@
1
1
  // src/harness/index.ts
2
2
  import {
3
+ harnessProviders,
3
4
  harnessSupportsModel,
4
5
  harnessTypeSchema,
5
6
  modelProvider,
@@ -47,12 +48,18 @@ function snapHarnessToModel(harness, modelId) {
47
48
  }
48
49
  return snapped;
49
50
  }
50
- function assertHarnessModelCompatible(harness, modelId) {
51
- if (!isModelCompatibleWithHarness(harness, modelId)) {
52
- const provider = modelProvider(modelId);
51
+ function assertHarnessModelCompatible(harness, selection) {
52
+ const modelId = typeof selection === "string" ? selection : selection.model;
53
+ const transportProvider = typeof selection === "string" ? void 0 : selection.provider;
54
+ const providers = harnessProviders(harness);
55
+ const provider = modelProvider(modelId) ?? transportProvider ?? null;
56
+ const isDefaultSentinel = modelId.trim() === "" || modelId.trim() === "default";
57
+ const compatible = isDefaultSentinel || providers === null || provider !== null && providers.includes(provider);
58
+ if (!compatible) {
53
59
  const native = preferredHarnessForModel(modelId);
60
+ const providerDescription = provider ?? "unqualified";
54
61
  throw new Error(
55
- `Harness "${harness}" cannot run model "${modelId}" (provider "${provider}"). Use ${native ?? "a router-backed harness (opencode)"} or an allowed model.`
62
+ `Harness "${harness}" cannot run model "${modelId}" (provider "${providerDescription}"). Use ${native ?? "a router-backed harness (opencode)"} or an allowed model.`
56
63
  );
57
64
  }
58
65
  }
@@ -69,4 +76,4 @@ export {
69
76
  snapHarnessToModel,
70
77
  assertHarnessModelCompatible
71
78
  };
72
- //# sourceMappingURL=chunk-TH7L265V.js.map
79
+ //# sourceMappingURL=chunk-MCYJON3F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/harness/index.ts"],"sourcesContent":["/**\n * Coding-agent harness selection — taxonomy, coercion, and the session-lock invariant.\n *\n * A \"harness\" is the coding-agent CLI a sandbox drives (opencode / codex /\n * claude-code / …). The shell governs WHICH harness a chat session uses and\n * enforces that a session is LOCKED to the harness it started with — the model\n * may change mid-session, the harness may not (swapping it mid-session would\n * orphan the session's running agent state). Every product otherwise hand-rolls\n * this and hard-codes a single harness; this is the one place the rule lives.\n *\n * Substrate-free: the harness list is derived from `@tangle-network/agent-interface`'s canonical\n * harness enum and mirrors the sandbox SDK's `BackendType` (no sandbox dependency). The consumer\n * owns storage — which harness a workspace defaults to, which one a session locked — and maps the\n * resolved value onto the SDK's `backend.type`.\n *\n * Harness↔model COMPATIBILITY (which models a harness can run, snapping) is NOT defined here — it\n * comes from `@tangle-network/agent-interface`, the single source of truth shared with the\n * sandbox-ui pickers and the cli-bridge backends. This module owns the harness TAXONOMY + the\n * session lock, and its server assertion also checks resolved transport-provider evidence.\n */\n\nimport {\n harnessProviders,\n harnessSupportsModel,\n harnessTypeSchema,\n modelProvider,\n preferredHarnessForModel,\n snapHarnessToModel as aiSnapHarnessToModel,\n snapModelToHarness as aiSnapModelToHarness,\n type HarnessType,\n} from '@tangle-network/agent-interface'\n\n/**\n * Canonical harnesses that are NOT sandbox backends. Each value in `KNOWN_HARNESSES` is dispatched\n * as `backend.type`, so a harness the platform ships no provider adapter for must stay out —\n * offering it would resolve a session onto a runner that cannot start.\n */\nconst NON_BACKEND_HARNESSES = ['gemini'] as const satisfies readonly HarnessType[]\n\nconst nonBackendHarnesses = new Set<string>(NON_BACKEND_HARNESSES)\n\n/** A coding-agent backend this shell can dispatch a session onto. */\nexport type Harness = Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]>\n\n/**\n * The known coding-agent backends: the canonical harness set minus what has no provider adapter,\n * Derived from `harnessTypeSchema.options` so a harness added upstream reaches this shell without\n * an edit here, and kept structural so this module still needs no sandbox dependency.\n */\nexport const KNOWN_HARNESSES: readonly Harness[] = [\n ...harnessTypeSchema.options.filter(\n (harness): harness is Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]> =>\n !nonBackendHarnesses.has(harness),\n ),\n]\n\n/** Define the default harness to use for code execution and testing environments */\nexport const DEFAULT_HARNESS: Harness = 'opencode'\n\nconst HARNESS_SET: ReadonlySet<string> = new Set(KNOWN_HARNESSES)\n\n/** Determine if a value is a recognized harness string identifier */\nexport function isHarness(value: unknown): value is Harness {\n return typeof value === 'string' && HARNESS_SET.has(value)\n}\n\n/** Coerce an arbitrary value to a known harness, falling back (default `opencode`). */\nexport function coerceHarness(value: unknown, fallback: Harness = DEFAULT_HARNESS): Harness {\n return isHarness(value) ? value : fallback\n}\n\n/** Resolve input options to determine the appropriate session harness to use */\nexport interface ResolveSessionHarnessInput {\n /** The harness already locked to this session (recorded at its first turn). */\n sessionHarness?: unknown\n /** The harness requested now — a new session's choice, or a turn's attempt to switch. */\n requested?: unknown\n /** The workspace's default harness, used only when starting a fresh session. */\n workspaceDefault?: unknown\n /** Final fallback when nothing else resolves (default `opencode`). */\n fallback?: Harness\n}\n\n/** Represent resolved session state including harness, lock status, and swap attempt flag */\nexport interface ResolvedSessionHarness {\n /** The harness to actually run — the locked one when the session already has it. */\n harness: Harness\n /** True when the session already had a locked harness (this turn did not pick it). */\n locked: boolean\n /** True when `requested` differs from the locked harness — a forbidden mid-session\n * swap the caller should reject or warn on. The lock always wins regardless. */\n swapAttempted: boolean\n}\n\n/**\n * Resolve the harness for a turn, enforcing the session lock.\n *\n * - **Session already started** (`sessionHarness` is a known harness): that harness\n * wins (`locked: true`); a differing `requested` sets `swapAttempted` so the caller\n * can reject the swap. The model is a separate per-turn concern and is unaffected.\n * - **Fresh session**: pick `requested → workspaceDefault → fallback`. The caller\n * persists the result as the session's lock for every subsequent turn.\n */\nexport function resolveSessionHarness(input: ResolveSessionHarnessInput = {}): ResolvedSessionHarness {\n const fallback = input.fallback ?? DEFAULT_HARNESS\n if (isHarness(input.sessionHarness)) {\n const locked = input.sessionHarness\n const swapAttempted = isHarness(input.requested) && input.requested !== locked\n return { harness: locked, locked: true, swapAttempted }\n }\n const harness = coerceHarness(input.requested, coerceHarness(input.workspaceDefault, fallback))\n return { harness, locked: false, swapAttempted: false }\n}\n\n/**\n * Harness ↔ model compatibility + snapping — delegated to `@tangle-network/agent-interface`.\n *\n * `Harness` is the dispatchable subset of `HarnessType`: this shell drops only canonical harnesses\n * for which the platform has no backend. Compatibility therefore comes entirely from Interface;\n * this package keeps no second harness taxonomy.\n */\n\nexport { modelProvider }\n\n/** A resolved model and the transport provider that will execute it. */\nexport interface HarnessModelSelection {\n model: string\n provider?: string\n}\n\n/** Provider-less ids (sentinels like \"default\", or a session's own config) are\n * compatible everywhere — every harness honors its own configuration. */\nexport function isModelCompatibleWithHarness(harness: Harness, modelId: string): boolean {\n return harnessSupportsModel(harness, modelId)\n}\n\n/** Keep `modelId` when the harness can run it; else the harness's best compatible\n * catalog id (preferred patterns in order, highest version). When nothing in the\n * catalog fits, return the original so the caller sees the incompatibility. */\nexport function snapModelToHarness(harness: Harness, modelId: string, canonicalIds: readonly string[]): string {\n return aiSnapModelToHarness(harness, modelId, canonicalIds)\n}\n\n/** Keep the harness when it can run `modelId`; else the model's native harness\n * (anthropic → claude-code, openai → codex, moonshot → kimi-code), falling back to opencode. */\nexport function snapHarnessToModel(harness: Harness, modelId: string): Harness {\n const snapped = aiSnapHarnessToModel(harness, modelId)\n if (!isHarness(snapped)) {\n throw new Error(\n `Harness \"${harness}\" snapped to \"${snapped}\" for model \"${modelId}\", which this platform has no backend for.`,\n )\n }\n return snapped\n}\n\n/** Fail-loud server guard: throw when a harness is asked to run a model it can't.\n * A resolved model tuple supplies provider evidence when its id is unqualified.\n * Call before dispatching a sandbox turn so a bypassed UI cannot reach the\n * sidecar with an incompatible or unproven pair. */\nexport function assertHarnessModelCompatible(\n harness: Harness,\n selection: string | HarnessModelSelection,\n): void {\n const modelId = typeof selection === 'string' ? selection : selection.model\n const transportProvider = typeof selection === 'string' ? undefined : selection.provider\n const providers = harnessProviders(harness)\n const provider = modelProvider(modelId) ?? transportProvider ?? null\n // An omitted/default model is deliberately left to the harness. Once a\n // caller names a model, however, a vendor-locked harness must have provider\n // evidence. Treating a router provider as compatible with every native CLI\n // is how a bare Gemini model reached Claude Code and produced \"Not logged in\".\n const isDefaultSentinel = modelId.trim() === '' || modelId.trim() === 'default'\n const compatible = isDefaultSentinel\n || providers === null\n || (provider !== null && providers.includes(provider))\n if (!compatible) {\n const native = preferredHarnessForModel(modelId)\n const providerDescription = provider ?? 'unqualified'\n throw new Error(\n `Harness \"${harness}\" cannot run model \"${modelId}\" (provider \"${providerDescription}\"). ` +\n `Use ${native ?? 'a router-backed harness (opencode)'} or an allowed model.`,\n )\n }\n}\n"],"mappings":";AAqBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,OAEjB;AAOP,IAAM,wBAAwB,CAAC,QAAQ;AAEvC,IAAM,sBAAsB,IAAI,IAAY,qBAAqB;AAU1D,IAAM,kBAAsC;AAAA,EACjD,GAAG,kBAAkB,QAAQ;AAAA,IAC3B,CAAC,YACC,CAAC,oBAAoB,IAAI,OAAO;AAAA,EACpC;AACF;AAGO,IAAM,kBAA2B;AAExC,IAAM,cAAmC,IAAI,IAAI,eAAe;AAGzD,SAAS,UAAU,OAAkC;AAC1D,SAAO,OAAO,UAAU,YAAY,YAAY,IAAI,KAAK;AAC3D;AAGO,SAAS,cAAc,OAAgB,WAAoB,iBAA0B;AAC1F,SAAO,UAAU,KAAK,IAAI,QAAQ;AACpC;AAkCO,SAAS,sBAAsB,QAAoC,CAAC,GAA2B;AACpG,QAAM,WAAW,MAAM,YAAY;AACnC,MAAI,UAAU,MAAM,cAAc,GAAG;AACnC,UAAM,SAAS,MAAM;AACrB,UAAM,gBAAgB,UAAU,MAAM,SAAS,KAAK,MAAM,cAAc;AACxE,WAAO,EAAE,SAAS,QAAQ,QAAQ,MAAM,cAAc;AAAA,EACxD;AACA,QAAM,UAAU,cAAc,MAAM,WAAW,cAAc,MAAM,kBAAkB,QAAQ,CAAC;AAC9F,SAAO,EAAE,SAAS,QAAQ,OAAO,eAAe,MAAM;AACxD;AAoBO,SAAS,6BAA6B,SAAkB,SAA0B;AACvF,SAAO,qBAAqB,SAAS,OAAO;AAC9C;AAKO,SAAS,mBAAmB,SAAkB,SAAiB,cAAyC;AAC7G,SAAO,qBAAqB,SAAS,SAAS,YAAY;AAC5D;AAIO,SAAS,mBAAmB,SAAkB,SAA0B;AAC7E,QAAM,UAAU,qBAAqB,SAAS,OAAO;AACrD,MAAI,CAAC,UAAU,OAAO,GAAG;AACvB,UAAM,IAAI;AAAA,MACR,YAAY,OAAO,iBAAiB,OAAO,gBAAgB,OAAO;AAAA,IACpE;AAAA,EACF;AACA,SAAO;AACT;AAMO,SAAS,6BACd,SACA,WACM;AACN,QAAM,UAAU,OAAO,cAAc,WAAW,YAAY,UAAU;AACtE,QAAM,oBAAoB,OAAO,cAAc,WAAW,SAAY,UAAU;AAChF,QAAM,YAAY,iBAAiB,OAAO;AAC1C,QAAM,WAAW,cAAc,OAAO,KAAK,qBAAqB;AAKhE,QAAM,oBAAoB,QAAQ,KAAK,MAAM,MAAM,QAAQ,KAAK,MAAM;AACtE,QAAM,aAAa,qBACd,cAAc,QACb,aAAa,QAAQ,UAAU,SAAS,QAAQ;AACtD,MAAI,CAAC,YAAY;AACf,UAAM,SAAS,yBAAyB,OAAO;AAC/C,UAAM,sBAAsB,YAAY;AACxC,UAAM,IAAI;AAAA,MACR,YAAY,OAAO,uBAAuB,OAAO,gBAAgB,mBAAmB,WAC3E,UAAU,oCAAoC;AAAA,IACzD;AAAA,EACF;AACF;","names":[]}
@@ -30,7 +30,7 @@ import {
30
30
  import {
31
31
  snapHarnessToModel,
32
32
  snapModelToHarness
33
- } from "./chunk-TH7L265V.js";
33
+ } from "./chunk-MCYJON3F.js";
34
34
 
35
35
  // src/web-react/composer-file-accept.ts
36
36
  function isAcceptedFileType(file, accept) {
@@ -1852,4 +1852,4 @@ export {
1852
1852
  ComposerModeControls,
1853
1853
  EntryComposer
1854
1854
  };
1855
- //# sourceMappingURL=chunk-QK4IFP3E.js.map
1855
+ //# sourceMappingURL=chunk-ZWPRRMWP.js.map
@@ -16,7 +16,7 @@
16
16
  * Harness↔model COMPATIBILITY (which models a harness can run, snapping) is NOT defined here — it
17
17
  * comes from `@tangle-network/agent-interface`, the single source of truth shared with the
18
18
  * sandbox-ui pickers and the cli-bridge backends. This module owns the harness TAXONOMY + the
19
- * session lock.
19
+ * session lock, and its server assertion also checks resolved transport-provider evidence.
20
20
  */
21
21
  import { modelProvider, type HarnessType } from '@tangle-network/agent-interface';
22
22
  /**
@@ -78,6 +78,11 @@ export declare function resolveSessionHarness(input?: ResolveSessionHarnessInput
78
78
  * this package keeps no second harness taxonomy.
79
79
  */
80
80
  export { modelProvider };
81
+ /** A resolved model and the transport provider that will execute it. */
82
+ export interface HarnessModelSelection {
83
+ model: string;
84
+ provider?: string;
85
+ }
81
86
  /** Provider-less ids (sentinels like "default", or a session's own config) are
82
87
  * compatible everywhere — every harness honors its own configuration. */
83
88
  export declare function isModelCompatibleWithHarness(harness: Harness, modelId: string): boolean;
@@ -89,6 +94,7 @@ export declare function snapModelToHarness(harness: Harness, modelId: string, ca
89
94
  * (anthropic → claude-code, openai → codex, moonshot → kimi-code), falling back to opencode. */
90
95
  export declare function snapHarnessToModel(harness: Harness, modelId: string): Harness;
91
96
  /** Fail-loud server guard: throw when a harness is asked to run a model it can't.
92
- * Call before dispatching a sandbox turn so a bypassed UI can't reach the sidecar
93
- * with an incompatible pair. */
94
- export declare function assertHarnessModelCompatible(harness: Harness, modelId: string): void;
97
+ * A resolved model tuple supplies provider evidence when its id is unqualified.
98
+ * Call before dispatching a sandbox turn so a bypassed UI cannot reach the
99
+ * sidecar with an incompatible or unproven pair. */
100
+ export declare function assertHarnessModelCompatible(harness: Harness, selection: string | HarnessModelSelection): void;
@@ -9,7 +9,7 @@ import {
9
9
  resolveSessionHarness,
10
10
  snapHarnessToModel,
11
11
  snapModelToHarness
12
- } from "../chunk-TH7L265V.js";
12
+ } from "../chunk-MCYJON3F.js";
13
13
  export {
14
14
  DEFAULT_HARNESS,
15
15
  KNOWN_HARNESSES,
package/dist/run/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  KNOWN_HARNESSES
3
- } from "../chunk-TH7L265V.js";
3
+ } from "../chunk-MCYJON3F.js";
4
4
 
5
5
  // src/run/index.ts
6
6
  var ROUTER_HARNESS = "router";
@@ -98,8 +98,8 @@ import {
98
98
  workspaceSandboxRecoveryMessage,
99
99
  workspaceSandboxRecoveryRecommendedActions,
100
100
  writeProfileFilesToBox
101
- } from "../chunk-PZOTRGGQ.js";
102
- import "../chunk-TH7L265V.js";
101
+ } from "../chunk-2UEXYUW6.js";
102
+ import "../chunk-MCYJON3F.js";
103
103
  import "../chunk-LWSJK546.js";
104
104
  import "../chunk-P5PIAQVS.js";
105
105
  import "../chunk-KBJL6LIW.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "../chunk-M3UFMQ7D.js";
5
5
  import {
6
6
  KNOWN_HARNESSES
7
- } from "../chunk-TH7L265V.js";
7
+ } from "../chunk-MCYJON3F.js";
8
8
 
9
9
  // src/skills-placement/index.ts
10
10
  import { skillDirForHarness } from "@tangle-network/agent-profile-materialize";
@@ -169,7 +169,7 @@ import {
169
169
  renamePastedImages,
170
170
  useComposerAttachments,
171
171
  useDictation
172
- } from "../chunk-QK4IFP3E.js";
172
+ } from "../chunk-ZWPRRMWP.js";
173
173
  import "../chunk-L7MB2LLM.js";
174
174
  import {
175
175
  DEFAULT_EFFORT_LEVELS,
@@ -248,7 +248,7 @@ import {
248
248
  stampInteractionAnswers
249
249
  } from "../chunk-M3K2HVQD.js";
250
250
  import "../chunk-YJMCRXQQ.js";
251
- import "../chunk-TH7L265V.js";
251
+ import "../chunk-MCYJON3F.js";
252
252
  export {
253
253
  ATTACHMENT_ACCEPT,
254
254
  AgentActivityPanel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-app",
3
- "version": "0.46.41",
3
+ "version": "0.46.43",
4
4
  "packageManager": "pnpm@11.24.0",
5
5
  "description": "Build agent applications with typed chat, tools, sandboxes, integrations, billing, and evaluation.",
6
6
  "keywords": [
@@ -529,12 +529,12 @@
529
529
  "@tangle-network/agent-integrations": "0.53.55",
530
530
  "@tangle-network/agent-interface": "2.2.0",
531
531
  "@tangle-network/agent-knowledge": "13.0.0",
532
- "@tangle-network/agent-profile-materialize": "0.18.1",
533
- "@tangle-network/agent-runtime": "0.188.1",
532
+ "@tangle-network/agent-profile-materialize": "0.19.0",
533
+ "@tangle-network/agent-runtime": "0.189.0",
534
534
  "@tangle-network/brand": "1.5.0",
535
- "@tangle-network/sandbox": "0.36.3",
536
- "@tangle-network/sandbox-ui": "0.111.2",
537
- "@tangle-network/ui": "^11.6.0",
535
+ "@tangle-network/sandbox": "0.36.4",
536
+ "@tangle-network/sandbox-ui": "0.113.1",
537
+ "@tangle-network/ui": "^11.8.0",
538
538
  "@testing-library/dom": "^10.4.1",
539
539
  "@testing-library/react": "^16.3.3",
540
540
  "@testing-library/user-event": "^14.6.6",
@@ -588,11 +588,11 @@
588
588
  "@tangle-network/agent-integrations": ">=0.53.55 <0.54.0",
589
589
  "@tangle-network/agent-interface": "^2.2.0",
590
590
  "@tangle-network/agent-knowledge": "^13.0.0",
591
- "@tangle-network/agent-profile-materialize": ">=0.18.1 <0.19.0",
592
- "@tangle-network/agent-runtime": ">=0.188.1 <0.189.0",
591
+ "@tangle-network/agent-profile-materialize": ">=0.18.1 <0.20.0",
592
+ "@tangle-network/agent-runtime": ">=0.188.1 <0.190.0",
593
593
  "@tangle-network/brand": ">=1.5.0",
594
594
  "@tangle-network/sandbox": ">=0.36.3 <0.37.0",
595
- "@tangle-network/sandbox-ui": ">=0.111.2 <0.112.0",
595
+ "@tangle-network/sandbox-ui": ">=0.111.2 <0.114.0",
596
596
  "@tangle-network/ui": ">=11.6.0 <12.0.0",
597
597
  "@tiptap/core": ">=3.28.0 <4.0.0",
598
598
  "@tiptap/extension-mention": ">=3.28.0 <4.0.0",