@tangle-network/agent-interface 0.33.0 → 0.34.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.
Files changed (33) hide show
  1. package/dist/agent-candidate-code-schema.d.ts +0 -3
  2. package/dist/agent-candidate-execution-plan-schema.d.ts +11 -17
  3. package/dist/agent-candidate-lineage-schema.d.ts +2 -2
  4. package/dist/agent-candidate-outcome-schema.d.ts +4 -4
  5. package/dist/agent-candidate-profile-schema.d.ts +0 -3
  6. package/dist/agent-candidate-promotion-schema.d.ts +1411 -885
  7. package/dist/agent-candidate-promotion-schema.js +46 -346
  8. package/dist/agent-candidate-receipt-schema.d.ts +8 -11
  9. package/dist/agent-candidate-schema.d.ts +0 -6
  10. package/dist/agent-candidate-schema.js +1 -3
  11. package/dist/agent-candidate.d.ts +14 -7
  12. package/dist/agent-improvement-measurement-schema.d.ts +198 -0
  13. package/dist/agent-improvement-measurement-schema.js +349 -0
  14. package/dist/agent-improvement-source.d.ts +23 -0
  15. package/dist/agent-improvement-source.js +38 -0
  16. package/dist/agent-profile-improvement-schema.d.ts +1085 -0
  17. package/dist/agent-profile-improvement-schema.js +553 -0
  18. package/dist/agent-profile-improvement.d.ts +139 -0
  19. package/dist/agent-profile-improvement.js +1 -0
  20. package/dist/agent-profile.d.ts +2 -2
  21. package/dist/agent-profile.js +2 -2
  22. package/dist/harness-capabilities.d.ts +1 -1
  23. package/dist/harness-capabilities.js +9 -12
  24. package/dist/harness.d.ts +1 -10
  25. package/dist/harness.js +0 -13
  26. package/dist/index.d.ts +5 -1
  27. package/dist/index.js +4 -0
  28. package/dist/interaction.d.ts +0 -17
  29. package/dist/interaction.js +0 -23
  30. package/dist/number-validation.d.ts +1 -0
  31. package/dist/number-validation.js +4 -0
  32. package/dist/profile-schema.d.ts +0 -3
  33. package/package.json +1 -1
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * These model portable agent intent at the application boundary. Individual
5
5
  * backends translate this shape into their own native profile/configuration
6
- * formats internally. This is the canonical home; `@tangle-network/sandbox`
7
- * re-exports these symbols for backward compatibility.
6
+ * formats internally. This package is the canonical public home for these
7
+ * symbols.
8
8
  */
9
9
  import type { HarnessType } from "./harness.js";
10
10
  /**
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * These model portable agent intent at the application boundary. Individual
5
5
  * backends translate this shape into their own native profile/configuration
6
- * formats internally. This is the canonical home; `@tangle-network/sandbox`
7
- * re-exports these symbols for backward compatibility.
6
+ * formats internally. This package is the canonical public home for these
7
+ * symbols.
8
8
  */
9
9
  /**
10
10
  * Helper for creating typed inline resource refs.
@@ -1,5 +1,5 @@
1
1
  import type { ReasoningEffort } from "./agent-profile.js";
2
- import { type HarnessType } from "./harness.js";
2
+ import type { HarnessType } from "./harness.js";
3
3
  /**
4
4
  * The unified harness capability layer — the single source of truth for:
5
5
  * 1. harness ↔ model compatibility (which models a harness can run), and
@@ -1,4 +1,3 @@
1
- import { canonicalizeHarness } from "./harness.js";
2
1
  /**
3
2
  * The unified harness capability layer — the single source of truth for:
4
3
  * 1. harness ↔ model compatibility (which models a harness can run), and
@@ -28,8 +27,7 @@ export const reasoningLadder = [
28
27
  // ── Harness ↔ model compatibility ────────────────────────────────────────────
29
28
  /**
30
29
  * Provider prefixes a harness is vendor-locked to (canonical-id prefix, e.g. `anthropic`, `openai`).
31
- * A harness with no entry is router-backed: it runs any model. Keyed by the BASE runner — aliases
32
- * (`claude`/`claudish`/`kimi`) resolve through `canonicalizeHarness` first.
30
+ * A harness with no entry is router-backed: it runs any model.
33
31
  *
34
32
  * `nanoclaw` is deliberately absent despite the "claw" name: its runner routes every provider through
35
33
  * the Tangle router (canonical model id straight to the gateway), so it is router-backed like
@@ -47,7 +45,7 @@ export function modelProvider(modelId) {
47
45
  }
48
46
  /** The providers a harness is locked to, or `null` when it is router-backed (any model). */
49
47
  export function harnessProviders(harness) {
50
- return harnessProviderLock[canonicalizeHarness(harness)] ?? null;
48
+ return harnessProviderLock[harness] ?? null;
51
49
  }
52
50
  /**
53
51
  * Whether a harness can run a model. Router-backed harnesses (no provider lock) accept anything;
@@ -76,7 +74,7 @@ export function preferredHarnessForModel(modelId) {
76
74
  /**
77
75
  * Per-harness ranking patterns for {@link snapModelToHarness}, best first; within one pattern the
78
76
  * highest version wins (numeric-aware). Only vendor-locked harnesses need an entry — a router-backed
79
- * harness never snaps (it runs the model as-is). Keyed by the BASE runner (aliases canonicalized).
77
+ * harness never snaps (it runs the model as-is).
80
78
  */
81
79
  const harnessPreferredModelPatterns = {
82
80
  "claude-code": [
@@ -101,7 +99,7 @@ const numericDesc = new Intl.Collator(undefined, {
101
99
  export function snapModelToHarness(harness, modelId, candidateIds) {
102
100
  if (harnessSupportsModel(harness, modelId))
103
101
  return modelId;
104
- const patterns = harnessPreferredModelPatterns[canonicalizeHarness(harness)] ?? [];
102
+ const patterns = harnessPreferredModelPatterns[harness] ?? [];
105
103
  for (const pattern of patterns) {
106
104
  const matches = candidateIds
107
105
  .filter((id) => pattern.test(id))
@@ -164,11 +162,10 @@ const harnessReasoningCeiling = {
164
162
  /** The reasoning efforts a harness can express, independent of model — its explicit override set, or
165
163
  * `none` up to its ceiling (default `ultracode` for router/model-driven harnesses). */
166
164
  export function harnessReasoningEfforts(harness) {
167
- const canonical = canonicalizeHarness(harness);
168
- const override = harnessReasoningEffortsOverride[canonical];
165
+ const override = harnessReasoningEffortsOverride[harness];
169
166
  if (override)
170
167
  return override;
171
- const ceiling = harnessReasoningCeiling[canonical] ?? "ultracode";
168
+ const ceiling = harnessReasoningCeiling[harness] ?? "ultracode";
172
169
  return reasoningLadder.slice(0, reasoningLadder.indexOf(ceiling) + 1);
173
170
  }
174
171
  /**
@@ -191,7 +188,7 @@ export function reasoningEffortsFor(harness, model) {
191
188
  /**
192
189
  * Harnesses whose runner DROPS a per-turn selector — grounded in the cli-bridge adapter audit, NOT a
193
190
  * guess. Most harnesses honor both selectors, so only the exceptions are listed; a harness absent from
194
- * a set honors that selector. Keyed by the BASE runner (aliases canonicalized).
191
+ * a set honors that selector.
195
192
  *
196
193
  * - model dropped: `amp` (own agent picks the model), `openclaw` (dispatcher routes by its own
197
194
  * config), `nanoclaw` (socket-bridge runner is config/env-driven).
@@ -215,11 +212,11 @@ const harnessIgnoresEffort = new Set([
215
212
  ]);
216
213
  /** Whether the harness's runner honors a per-turn MODEL override (vs. picking the model itself). */
217
214
  export function harnessHonorsModel(harness) {
218
- return !harnessIgnoresModel.has(canonicalizeHarness(harness));
215
+ return !harnessIgnoresModel.has(harness);
219
216
  }
220
217
  /** Whether the harness's runner honors a reasoning-EFFORT override (vs. dropping it). */
221
218
  export function harnessHonorsEffort(harness) {
222
- return !harnessIgnoresEffort.has(canonicalizeHarness(harness));
219
+ return !harnessIgnoresEffort.has(harness);
223
220
  }
224
221
  /** Whether the harness honors BOTH chat selectors — i.e. the model and effort pickers are live. */
225
222
  export function harnessHonorsSelectors(harness) {
package/dist/harness.d.ts CHANGED
@@ -14,20 +14,15 @@ import { z } from "zod";
14
14
  * a one-shot) with no full coding-agent harness. The rest are full agentic harnesses run in a
15
15
  * sandbox or locally via the CLI bridge.
16
16
  *
17
- * Some values are input aliases that collapse to a base runner (`claude`/`claudish` → `claude-code`,
18
- * `kimi` → `kimi-code`); normalize with {@link canonicalizeHarness} before keying per-runner config.
19
17
  */
20
- export type HarnessType = "claude-code" | "claude" | "claudish" | "nanoclaw" | "codex" | "opencode" | "kimi-code" | "kimi" | "pi" | "gemini" | "hermes" | "openclaw" | "amp" | "factory-droids" | "acp" | "cli-base";
18
+ export type HarnessType = "claude-code" | "nanoclaw" | "codex" | "opencode" | "kimi-code" | "pi" | "gemini" | "hermes" | "openclaw" | "amp" | "factory-droids" | "acp" | "cli-base";
21
19
  /** Runtime validator for {@link HarnessType}. Kept in lockstep with the type by the drift guard below. */
22
20
  export declare const harnessTypeSchema: z.ZodEnum<{
23
21
  "claude-code": "claude-code";
24
- claude: "claude";
25
- claudish: "claudish";
26
22
  nanoclaw: "nanoclaw";
27
23
  codex: "codex";
28
24
  opencode: "opencode";
29
25
  "kimi-code": "kimi-code";
30
- kimi: "kimi";
31
26
  pi: "pi";
32
27
  gemini: "gemini";
33
28
  hermes: "hermes";
@@ -37,7 +32,3 @@ export declare const harnessTypeSchema: z.ZodEnum<{
37
32
  acp: "acp";
38
33
  "cli-base": "cli-base";
39
34
  }>;
40
- /** Input alias → canonical base runner. Aliases accept legacy/shorthand harness names. */
41
- export declare const harnessAliases: Partial<Record<HarnessType, HarnessType>>;
42
- /** Collapse an alias to its base runner (idempotent on canonical values). */
43
- export declare function canonicalizeHarness(harness: HarnessType): HarnessType;
package/dist/harness.js CHANGED
@@ -2,13 +2,10 @@ import { z } from "zod";
2
2
  /** Runtime validator for {@link HarnessType}. Kept in lockstep with the type by the drift guard below. */
3
3
  export const harnessTypeSchema = z.enum([
4
4
  "claude-code",
5
- "claude",
6
- "claudish",
7
5
  "nanoclaw",
8
6
  "codex",
9
7
  "opencode",
10
8
  "kimi-code",
11
- "kimi",
12
9
  "pi",
13
10
  "gemini",
14
11
  "hermes",
@@ -18,15 +15,5 @@ export const harnessTypeSchema = z.enum([
18
15
  "acp",
19
16
  "cli-base",
20
17
  ]);
21
- /** Input alias → canonical base runner. Aliases accept legacy/shorthand harness names. */
22
- export const harnessAliases = {
23
- claude: "claude-code",
24
- claudish: "claude-code",
25
- kimi: "kimi-code",
26
- };
27
- /** Collapse an alias to its base runner (idempotent on canonical values). */
28
- export function canonicalizeHarness(harness) {
29
- return harnessAliases[harness] ?? harness;
30
- }
31
18
  const _harnessSchemaMatchesType = true;
32
19
  void _harnessSchemaMatchesType;
package/dist/index.d.ts CHANGED
@@ -157,7 +157,7 @@ export declare function normalizeInputParts(input: {
157
157
  export declare function renderInputPartsAsText(parts: InputPart[]): string;
158
158
  /**
159
159
  * The primary event for all part updates from OpenCode.
160
- * This is the canonical event - use this instead of legacy events.
160
+ * This is the canonical event for all part updates.
161
161
  */
162
162
  export type MessagePartUpdatedEvent = {
163
163
  type: "message.part.updated";
@@ -614,6 +614,10 @@ export * from "./interaction.js";
614
614
  export * from "./agent-candidate.js";
615
615
  export * from "./agent-candidate-schema.js";
616
616
  export * from "./agent-candidate-promotion-schema.js";
617
+ export { agentCandidateEvaluationPolicySchema } from "./agent-improvement-measurement-schema.js";
618
+ export * from "./agent-improvement-source.js";
619
+ export * from "./agent-profile-improvement.js";
620
+ export * from "./agent-profile-improvement-schema.js";
617
621
  export * from "./agent-profile.js";
618
622
  export * from "./certified-context.js";
619
623
  export * from "./profile-diff.js";
package/dist/index.js CHANGED
@@ -127,6 +127,10 @@ export * from "./interaction.js";
127
127
  export * from "./agent-candidate.js";
128
128
  export * from "./agent-candidate-schema.js";
129
129
  export * from "./agent-candidate-promotion-schema.js";
130
+ export { agentCandidateEvaluationPolicySchema } from "./agent-improvement-measurement-schema.js";
131
+ export * from "./agent-improvement-source.js";
132
+ export * from "./agent-profile-improvement.js";
133
+ export * from "./agent-profile-improvement-schema.js";
130
134
  export * from "./agent-profile.js";
131
135
  export * from "./certified-context.js";
132
136
  export * from "./profile-diff.js";
@@ -256,23 +256,6 @@ export type PermissionGrant = z.infer<typeof PermissionGrantSchema>;
256
256
  export declare function permissionAnswerSpec(opts?: {
257
257
  allowFeedback?: boolean;
258
258
  }): InteractionAnswerSpec;
259
- /** Shape of one legacy question (kept for the back-compat shim). */
260
- export type LegacyQuestion = {
261
- question: string;
262
- options?: Array<{
263
- label: string;
264
- description?: string;
265
- }>;
266
- multiSelect?: boolean;
267
- /** When true the select field accepts write-in answers beyond `options`. */
268
- allowCustom?: boolean;
269
- };
270
- /**
271
- * Build an answer spec from the legacy `question` event shape. Each question
272
- * becomes one select field (free text when it declares no options), so the old
273
- * question/answer path is expressible as a `question` interaction.
274
- */
275
- export declare function questionAnswerSpec(questions: LegacyQuestion[]): InteractionAnswerSpec;
276
259
  export type InteractionValidation = {
277
260
  ok: true;
278
261
  } | {
@@ -176,29 +176,6 @@ export function permissionAnswerSpec(opts) {
176
176
  }
177
177
  return { fields };
178
178
  }
179
- /**
180
- * Build an answer spec from the legacy `question` event shape. Each question
181
- * becomes one select field (free text when it declares no options), so the old
182
- * question/answer path is expressible as a `question` interaction.
183
- */
184
- export function questionAnswerSpec(questions) {
185
- const fields = questions.map((q, i) => {
186
- const name = `q${i}`;
187
- if (q.options && q.options.length > 0) {
188
- return {
189
- type: "select",
190
- name,
191
- label: q.question,
192
- required: true,
193
- multi: q.multiSelect === true,
194
- ...(q.allowCustom === true ? { allowCustom: true } : {}),
195
- options: q.options.map((o) => ({ value: o.label, label: o.label, description: o.description })),
196
- };
197
- }
198
- return { type: "text", name, label: q.question, required: true };
199
- });
200
- return { fields };
201
- }
202
179
  /**
203
180
  * Validate an accepted answer against its spec. Used by the broker before a
204
181
  * response reaches the adapter, so malformed answers are rejected centrally.
@@ -0,0 +1 @@
1
+ export declare function numbersApproximatelyEqual(left: number, right: number): boolean;
@@ -0,0 +1,4 @@
1
+ export function numbersApproximatelyEqual(left, right) {
2
+ const tolerance = Number.EPSILON * Math.max(1, Math.abs(left), Math.abs(right)) * 16;
3
+ return Math.abs(left - right) <= tolerance;
4
+ }
@@ -268,13 +268,10 @@ export declare const agentProfileSchema: z.ZodObject<{
268
268
  }, z.core.$strict>>;
269
269
  harness: z.ZodOptional<z.ZodEnum<{
270
270
  "claude-code": "claude-code";
271
- claude: "claude";
272
- claudish: "claudish";
273
271
  nanoclaw: "nanoclaw";
274
272
  codex: "codex";
275
273
  opencode: "opencode";
276
274
  "kimi-code": "kimi-code";
277
- kimi: "kimi";
278
275
  pi: "pi";
279
276
  gemini: "gemini";
280
277
  hermes: "hermes";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",