@tangle-network/agent-interface 0.29.0 → 0.31.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.
@@ -61,20 +61,7 @@ export declare const agentCandidateBundleSchema: z.ZodObject<{
61
61
  deny: "deny";
62
62
  }>>]>>>;
63
63
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
64
- mcp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
65
- transport: z.ZodOptional<z.ZodLiteral<"stdio">>;
66
- command: z.ZodOptional<z.ZodString>;
67
- args: z.ZodOptional<z.ZodArray<z.ZodObject<{
68
- kind: z.ZodLiteral<"public">;
69
- value: z.ZodString;
70
- }, z.core.$strict>>>;
71
- env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
72
- kind: z.ZodLiteral<"public">;
73
- value: z.ZodString;
74
- }, z.core.$strict>>>;
75
- cwd: z.ZodOptional<z.ZodString>;
76
- enabled: z.ZodOptional<z.ZodBoolean>;
77
- }, z.core.$strict>>>;
64
+ mcp: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./agent-candidate.js").AgentCandidateMcpServer, unknown, z.core.$ZodTypeInternals<import("./agent-candidate.js").AgentCandidateMcpServer, unknown>>>>;
78
65
  subagents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
79
66
  prompt: z.ZodOptional<z.ZodString>;
80
67
  permissions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodEnum<{
@@ -1,4 +1,4 @@
1
- import type { AgentProfile, AgentProfileFileMount, AgentProfileHookCommand, AgentProfileMcpServer, AgentProfileMode, AgentProfileModelHints, AgentProfileResources, AgentSubagentProfile, ReasoningEffort } from "./agent-profile.js";
1
+ import type { AgentProfile, AgentProfileFileMount, AgentProfileHookCommand, AgentProfileMode, AgentProfileModelHints, AgentProfileResources, AgentSubagentProfile, ReasoningEffort } from "./agent-profile.js";
2
2
  import type { HarnessType } from "./harness.js";
3
3
  /** Full SHA-256 digest with an explicit algorithm prefix. */
4
4
  export type Sha256Digest = `sha256:${string}`;
@@ -78,11 +78,23 @@ export interface AgentCandidateResources extends Omit<AgentProfileResources, "fi
78
78
  instructions?: string | AgentCandidateResourceRef;
79
79
  failOnError: true;
80
80
  }
81
- export interface AgentCandidateMcpServer extends Omit<AgentProfileMcpServer, "transport" | "args" | "env" | "headers" | "url" | "metadata"> {
81
+ interface AgentCandidateLocalMcpServer {
82
82
  transport?: "stdio";
83
+ command: string;
83
84
  args?: AgentCandidateConfigValue[];
84
85
  env?: Record<string, AgentCandidateConfigValue>;
85
- }
86
+ cwd?: string;
87
+ enabled?: true;
88
+ }
89
+ interface AgentCandidateDisabledMcpServer {
90
+ enabled: false;
91
+ transport?: never;
92
+ command?: never;
93
+ args?: never;
94
+ env?: never;
95
+ cwd?: never;
96
+ }
97
+ export type AgentCandidateMcpServer = AgentCandidateLocalMcpServer | AgentCandidateDisabledMcpServer;
86
98
  export type AgentCandidateModelHints = Omit<AgentProfileModelHints, "metadata">;
87
99
  export type AgentCandidateSubagentProfile = Omit<AgentSubagentProfile, "metadata">;
88
100
  export type AgentCandidateMode = Omit<AgentProfileMode, "metadata">;
@@ -297,6 +309,8 @@ export interface AgentCandidateProfilePlanMaterial {
297
309
  }>;
298
310
  env: Record<string, AgentCandidateConfigValue>;
299
311
  flags: AgentCandidateConfigValue[];
312
+ /** Exact system-prompt replacement supplied to the harness, when supported. */
313
+ systemPrompt?: AgentCandidateConfigValue;
300
314
  unsupported: Array<{
301
315
  dimension: string;
302
316
  reason: string;
@@ -792,6 +806,7 @@ export interface AgentImprovementActivationTarget {
792
806
  /** Current target state that activation is allowed to replace. */
793
807
  expectedBaseDigest: Sha256Digest;
794
808
  }
809
+ export type AgentImprovementActivationIntent = "activate-candidate" | "restore-baseline";
795
810
  /** Authority receipt permitting activation of one already-measured candidate. */
796
811
  export interface AgentImprovementActivation {
797
812
  kind: "agent-improvement-activation";
@@ -799,10 +814,56 @@ export interface AgentImprovementActivation {
799
814
  reviewDigest: Sha256Digest;
800
815
  experimentDigest: Sha256Digest;
801
816
  candidateBundleDigest: Sha256Digest;
817
+ intent: AgentImprovementActivationIntent;
802
818
  targets: [AgentImprovementActivationTarget, ...AgentImprovementActivationTarget[]];
803
819
  fundingOwner: string;
804
820
  authorizedBy: string;
805
821
  authorizedAt: string;
822
+ expiresAt: string;
823
+ digest: Sha256Digest;
824
+ }
825
+ export interface AgentImprovementActivationTargetTransition {
826
+ surface: AgentImprovementSurface;
827
+ identity: string;
828
+ beforeDigest: Sha256Digest;
829
+ afterDigest: Sha256Digest;
830
+ }
831
+ export interface AgentImprovementActivationTargetState {
832
+ surface: AgentImprovementSurface;
833
+ identity: string;
834
+ currentDigest: Sha256Digest;
835
+ }
836
+ export type AgentImprovementActivationOutcome = {
837
+ /** Every target changed atomically from the authorized state to the requested bundle. */
838
+ status: "applied";
839
+ transactionId: string;
840
+ targets: [
841
+ AgentImprovementActivationTargetTransition,
842
+ ...AgentImprovementActivationTargetTransition[]
843
+ ];
844
+ } | {
845
+ /** No write occurred; targets are already desired or no longer match the authorized base. */
846
+ status: "already-applied" | "conflict";
847
+ targets: [
848
+ AgentImprovementActivationTargetState,
849
+ ...AgentImprovementActivationTargetState[]
850
+ ];
851
+ } | {
852
+ status: "expired";
853
+ } | {
854
+ /** `failed` proves no write; `indeterminate` means commit state must be reconciled. */
855
+ status: "unsupported" | "failed" | "indeterminate";
856
+ code: string;
857
+ message: string;
858
+ };
859
+ /** Immutable outcome of one idempotent, transaction-wide activation attempt. */
860
+ export interface AgentImprovementActivationResult {
861
+ kind: "agent-improvement-activation-result";
862
+ /** The activation digest is also its stable retry key. */
863
+ idempotencyKey: Sha256Digest;
864
+ attemptedAt: string;
865
+ completedAt: string;
866
+ outcome: AgentImprovementActivationOutcome;
806
867
  digest: Sha256Digest;
807
868
  }
808
869
  /** Complete execution of one exact experiment attempt. */
@@ -909,3 +970,4 @@ export interface AgentCandidateBenchmarkResultEvidence {
909
970
  }
910
971
  /** Declare a candidate bundle while retaining literal inference. */
911
972
  export declare function defineAgentCandidateBundle<T extends AgentCandidateBundle>(bundle: T): T;
973
+ export {};
@@ -92,9 +92,9 @@ export interface AgentProfileResources {
92
92
  * - `none` — extended thinking OFF (no reasoning budget at all)
93
93
  * - `minimal` — thinking ON, the lowest budget (distinct from `none`)
94
94
  * - `low` / `medium` / `high` / `xhigh`
95
- * - `ultracode` — maximum (claude-code's "ultracode" run mode; codex's `max` reconciles here).
96
- * A backend without a matching native tier clamps to its nearest (e.g. codex maps `ultracode` → `xhigh`
97
- * on models that support it).
95
+ * - `ultracode` — maximum (Claude Code's `max` and Codex's `ultra` reconcile here).
96
+ * A backend without a matching native tier may clamp down to its strongest supported level, but it
97
+ * must never turn reasoning on for `none` or silently increase a requested effort.
98
98
  */
99
99
  export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "ultracode";
100
100
  /**
@@ -191,17 +191,40 @@ export interface AgentProfileConfidential {
191
191
  /**
192
192
  * Generic MCP server configuration.
193
193
  */
194
- export interface AgentProfileMcpServer {
195
- transport?: "stdio" | "sse" | "http";
196
- command?: string;
194
+ interface AgentProfileMcpServerBase {
195
+ metadata?: Record<string, unknown>;
196
+ }
197
+ interface AgentProfileLocalMcpServer extends AgentProfileMcpServerBase {
198
+ enabled?: true;
199
+ transport?: "stdio";
200
+ command: string;
197
201
  args?: string[];
198
202
  env?: Record<string, string>;
199
203
  cwd?: string;
200
- url?: string;
204
+ url?: never;
205
+ headers?: never;
206
+ }
207
+ interface AgentProfileRemoteMcpServer extends AgentProfileMcpServerBase {
208
+ enabled?: true;
209
+ transport?: "sse" | "http";
210
+ command?: never;
211
+ args?: never;
212
+ env?: never;
213
+ cwd?: never;
214
+ url: string;
201
215
  headers?: Record<string, string>;
202
- enabled?: boolean;
203
- metadata?: Record<string, unknown>;
204
216
  }
217
+ interface AgentProfileDisabledMcpServer extends AgentProfileMcpServerBase {
218
+ enabled: false;
219
+ transport?: never;
220
+ command?: never;
221
+ args?: never;
222
+ env?: never;
223
+ cwd?: never;
224
+ url?: never;
225
+ headers?: never;
226
+ }
227
+ export type AgentProfileMcpServer = AgentProfileLocalMcpServer | AgentProfileRemoteMcpServer | AgentProfileDisabledMcpServer;
205
228
  /**
206
229
  * Hub-managed integration grant. The sandbox runtime resolves each declared
207
230
  * connection/capability pair into an MCP tool backed by Tangle Hub policy.
@@ -317,3 +340,4 @@ export interface AgentProfileValidationResult {
317
340
  * Overlay fields win on conflicts. Array-like instruction sets are appended.
318
341
  */
319
342
  export declare function mergeAgentProfiles(base: AgentProfile | undefined, overlay: AgentProfile | undefined): AgentProfile | undefined;
343
+ export {};
@@ -11,8 +11,8 @@ import { type HarnessType } from "./harness.js";
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.
13
13
  *
14
- * Grounded in cli-bridge's real backend clamps (codex is `low..xhigh` for current models, kimi is
15
- * binary on/off, claude carries the full range, cli-base has no agent) — NOT a guessed matrix. The
14
+ * Grounded in the native CLI controls (Codex is `minimal..ultra`, Kimi is binary on/off, Claude is
15
+ * `low..max`, cli-base has no agent) — NOT a guessed matrix. The
16
16
  * per-MODEL reasoning capability (does this specific model reason at all) is dynamic catalog data the
17
17
  * caller supplies.
18
18
  */
@@ -10,8 +10,8 @@ import { canonicalizeHarness } from "./harness.js";
10
10
  * cli-bridge backends, the sandbox UI pickers, and the router all read one truth instead of each
11
11
  * hand-rolling a divergent copy.
12
12
  *
13
- * Grounded in cli-bridge's real backend clamps (codex is `low..xhigh` for current models, kimi is
14
- * binary on/off, claude carries the full range, cli-base has no agent) — NOT a guessed matrix. The
13
+ * Grounded in the native CLI controls (Codex is `minimal..ultra`, Kimi is binary on/off, Claude is
14
+ * `low..max`, cli-base has no agent) — NOT a guessed matrix. The
15
15
  * per-MODEL reasoning capability (does this specific model reason at all) is dynamic catalog data the
16
16
  * caller supplies.
17
17
  */
@@ -125,21 +125,30 @@ export function snapHarnessToModel(harness, modelId) {
125
125
  /**
126
126
  * The explicit reasoning-effort set a harness's runtime accepts when it ISN'T a plain `none…ceiling`
127
127
  * slice — grounded in the cli-bridge adapters (NOT the canonical ladder):
128
- * - codex: current models advertise `low|medium|high|xhigh`; `none` is omitted (use `auto`) and
129
- * legacy `minimal` requests clamp up to `low`.
130
- * - claude-code: `--effort` accepts `low|medium|high|xhigh|max`. `ultracode` is the ladder's stand-in
131
- * for claude's `max` (clamped at runtime); `minimal`→`low` and `none`/`auto`→no flag, so both are
132
- * dropped as redundant.
133
- * - pi / openclaw: `--thinking` accepts `minimalxhigh` (max/ultracode clamp to `xhigh`; no `none`).
134
- * - kimi-code: `--thinking` is BINARY (off/on) `minimal` is the only value that emits
135
- * `--no-thinking`, `high` is "thinking on". So two levels, not five.
128
+ * - codex: `model_reasoning_effort` accepts `minimal|low|medium|high|xhigh|max|ultra`; canonical
129
+ * `ultracode` maps to native `ultra`. Per-model catalog data narrows this list.
130
+ * - claude-code: `--effort` accepts `low|medium|high|xhigh|max`; canonical `ultracode` maps to
131
+ * native `max`. It cannot express `none` or `minimal`.
132
+ * - pi: `--thinking` accepts `off|minimal|low|medium|high|xhigh`; canonical `none` maps to `off`.
133
+ * - openclaw: `--thinking` accepts `off|minimal|low|medium|high|xhigh|max`; canonical `none` maps
134
+ * to `off` and `ultracode` maps to `max`.
135
+ * - kimi-code: `--thinking` is binary. Canonical `none` emits `--no-thinking`; any non-none level
136
+ * emits `--thinking`, represented here by `high`.
136
137
  */
137
138
  const harnessReasoningEffortsOverride = {
138
- codex: ["low", "medium", "high", "xhigh"],
139
+ codex: ["minimal", "low", "medium", "high", "xhigh", "ultracode"],
139
140
  "claude-code": ["low", "medium", "high", "xhigh", "ultracode"],
140
- pi: ["minimal", "low", "medium", "high", "xhigh"],
141
- openclaw: ["minimal", "low", "medium", "high", "xhigh"],
142
- "kimi-code": ["minimal", "high"],
141
+ pi: ["none", "minimal", "low", "medium", "high", "xhigh"],
142
+ openclaw: [
143
+ "none",
144
+ "minimal",
145
+ "low",
146
+ "medium",
147
+ "high",
148
+ "xhigh",
149
+ "ultracode",
150
+ ],
151
+ "kimi-code": ["none", "high"],
143
152
  };
144
153
  /**
145
154
  * The ceiling for harnesses whose set IS a plain `none…ceiling` slice. Only the no-thinking runners