@tangle-network/agent-interface 1.5.0 → 1.7.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.
@@ -8407,6 +8407,7 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
8407
8407
  "agent-profile": "agent-profile";
8408
8408
  memory: "memory";
8409
8409
  knowledge: "knowledge";
8410
+ "rollout-policy": "rollout-policy";
8410
8411
  }>], z.ZodEnum<{
8411
8412
  prompt: "prompt";
8412
8413
  tools: "tools";
@@ -8418,6 +8419,7 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
8418
8419
  "agent-profile": "agent-profile";
8419
8420
  memory: "memory";
8420
8421
  knowledge: "knowledge";
8422
+ "rollout-policy": "rollout-policy";
8421
8423
  }>>;
8422
8424
  proposedAt: z.ZodISODateTime;
8423
8425
  findings: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodCustom<AgentCandidateJsonValue, AgentCandidateJsonValue>>>;
@@ -14120,6 +14122,7 @@ export declare const agentImprovementActivationSchema: z.ZodObject<{
14120
14122
  "agent-profile": "agent-profile";
14121
14123
  memory: "memory";
14122
14124
  knowledge: "knowledge";
14125
+ "rollout-policy": "rollout-policy";
14123
14126
  }>;
14124
14127
  identity: z.ZodString;
14125
14128
  expectedBaseDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
@@ -14135,6 +14138,7 @@ export declare const agentImprovementActivationSchema: z.ZodObject<{
14135
14138
  "agent-profile": "agent-profile";
14136
14139
  memory: "memory";
14137
14140
  knowledge: "knowledge";
14141
+ "rollout-policy": "rollout-policy";
14138
14142
  }>;
14139
14143
  identity: z.ZodString;
14140
14144
  expectedBaseDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
@@ -14165,6 +14169,7 @@ export declare const agentImprovementActivationResultSchema: z.ZodObject<{
14165
14169
  "agent-profile": "agent-profile";
14166
14170
  memory: "memory";
14167
14171
  knowledge: "knowledge";
14172
+ "rollout-policy": "rollout-policy";
14168
14173
  }>;
14169
14174
  identity: z.ZodString;
14170
14175
  beforeDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
@@ -14181,6 +14186,7 @@ export declare const agentImprovementActivationResultSchema: z.ZodObject<{
14181
14186
  "agent-profile": "agent-profile";
14182
14187
  memory: "memory";
14183
14188
  knowledge: "knowledge";
14189
+ "rollout-policy": "rollout-policy";
14184
14190
  }>;
14185
14191
  identity: z.ZodString;
14186
14192
  beforeDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
@@ -14200,6 +14206,7 @@ export declare const agentImprovementActivationResultSchema: z.ZodObject<{
14200
14206
  "agent-profile": "agent-profile";
14201
14207
  memory: "memory";
14202
14208
  knowledge: "knowledge";
14209
+ "rollout-policy": "rollout-policy";
14203
14210
  }>;
14204
14211
  identity: z.ZodString;
14205
14212
  currentDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
@@ -14215,6 +14222,7 @@ export declare const agentImprovementActivationResultSchema: z.ZodObject<{
14215
14222
  "agent-profile": "agent-profile";
14216
14223
  memory: "memory";
14217
14224
  knowledge: "knowledge";
14225
+ "rollout-policy": "rollout-policy";
14218
14226
  }>;
14219
14227
  identity: z.ZodString;
14220
14228
  currentDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
@@ -14233,6 +14241,7 @@ export declare const agentImprovementActivationResultSchema: z.ZodObject<{
14233
14241
  "agent-profile": "agent-profile";
14234
14242
  memory: "memory";
14235
14243
  knowledge: "knowledge";
14244
+ "rollout-policy": "rollout-policy";
14236
14245
  }>;
14237
14246
  identity: z.ZodString;
14238
14247
  currentDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
@@ -14248,6 +14257,7 @@ export declare const agentImprovementActivationResultSchema: z.ZodObject<{
14248
14257
  "agent-profile": "agent-profile";
14249
14258
  memory: "memory";
14250
14259
  knowledge: "knowledge";
14260
+ "rollout-policy": "rollout-policy";
14251
14261
  }>;
14252
14262
  identity: z.ZodString;
14253
14263
  currentDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { AGENT_IMPROVEMENT_SURFACES } from "./agent-candidate.js";
2
3
  import { agentCandidateBundleSchema } from "./agent-candidate-schema.js";
3
4
  import { agentCandidateLineageSchema } from "./agent-candidate-lineage-schema.js";
4
5
  import { agentCandidateBenchmarkSuiteInputsSchema } from "./agent-candidate-task-schema.js";
@@ -7,18 +8,7 @@ import { refineAgentExecutionWithinLimits } from "./agent-execution-limits.js";
7
8
  import { agentCandidateMaterializationReceiptSchema, agentCandidateRunReceiptSchema, } from "./agent-candidate-receipt-schema.js";
8
9
  import { agentCandidateEvaluationPolicySchema, canonicalJsonObjectSchema, createMeasuredComparisonIdentityRegistry, measuredComparisonCommonShape, refineMeasuredComparisonSummary, } from "./agent-improvement-measurement-schema.js";
9
10
  import { agentProfileImprovementExecutionRefSchema, agentProfileImprovementMeasuredComparisonSchema, changedProfileImprovementSurfaces, } from "./agent-profile-improvement-schema.js";
10
- const improvementSurfaceSchema = z.enum([
11
- "prompt",
12
- "skills",
13
- "tools",
14
- "mcp",
15
- "hooks",
16
- "subagents",
17
- "agent-profile",
18
- "memory",
19
- "code",
20
- "knowledge",
21
- ]);
11
+ const improvementSurfaceSchema = z.enum(AGENT_IMPROVEMENT_SURFACES);
22
12
  export const agentCandidateExperimentSchema = z
23
13
  .object({
24
14
  kind: z.literal("agent-candidate-experiment"),
@@ -709,7 +709,16 @@ export interface AgentCandidateRunReceipt {
709
709
  benchmarkResult: AgentCandidateBenchmarkResultEvidence;
710
710
  digest: Sha256Digest;
711
711
  }
712
- export type AgentImprovementSurface = "prompt" | "skills" | "tools" | "mcp" | "hooks" | "subagents" | "agent-profile" | "memory" | "code" | "knowledge";
712
+ /**
713
+ * Every surface an improvement proposal can name. One owner: the validator
714
+ * ({@link agentCandidatePromotionSchema}'s surface enum) and every producer read this
715
+ * list, so a new surface cannot be proposable in one place and unnameable in another.
716
+ *
717
+ * `rollout-policy` is the inference-time structural-rollout dials
718
+ * (`profile.extensions['structural-rollout']`); `knowledge` is the corpus lane.
719
+ */
720
+ export declare const AGENT_IMPROVEMENT_SURFACES: readonly ["prompt", "skills", "tools", "mcp", "hooks", "subagents", "agent-profile", "memory", "code", "knowledge", "rollout-policy"];
721
+ export type AgentImprovementSurface = (typeof AGENT_IMPROVEMENT_SURFACES)[number];
713
722
  /** One paired Runtime execution from the exact signed experiment. */
714
723
  export interface AgentCandidateExperimentMeasurement {
715
724
  baseline: CandidateExecutionEvidence;
@@ -1,3 +1,24 @@
1
+ /**
2
+ * Every surface an improvement proposal can name. One owner: the validator
3
+ * ({@link agentCandidatePromotionSchema}'s surface enum) and every producer read this
4
+ * list, so a new surface cannot be proposable in one place and unnameable in another.
5
+ *
6
+ * `rollout-policy` is the inference-time structural-rollout dials
7
+ * (`profile.extensions['structural-rollout']`); `knowledge` is the corpus lane.
8
+ */
9
+ export const AGENT_IMPROVEMENT_SURFACES = Object.freeze([
10
+ "prompt",
11
+ "skills",
12
+ "tools",
13
+ "mcp",
14
+ "hooks",
15
+ "subagents",
16
+ "agent-profile",
17
+ "memory",
18
+ "code",
19
+ "knowledge",
20
+ "rollout-policy",
21
+ ]);
1
22
  /** Declare a candidate bundle while retaining literal inference. */
2
23
  export function defineAgentCandidateBundle(bundle) {
3
24
  return bundle;
@@ -7,7 +7,7 @@ import type { TokenUsage } from "./execution-types.js";
7
7
  import { type InteractionAcknowledgement, type InteractionCapabilities, type InteractionResponseCommand, type RequestedInteractions } from "./interaction.js";
8
8
  import { type ContextTransferReceipt, type ContextTransferRequest, type NativeContextBoundaryProof, type NativeContextContinuationRequest, type NativeContextContinuationTurn } from "./portable-context.js";
9
9
  import { type AgentRunCancellationAcknowledgement, type AgentRunCancellationRequest, type AgentRunControlRef } from "./runtime-control.js";
10
- import type { AgentWorkspaceBranching } from "./workspace-branching.js";
10
+ import type { AgentWorkspaceBranching, AgentWorkspaceBranchingProvider } from "./workspace-branching.js";
11
11
  import type { AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSessionStatus, CheckpointRef, CheckpointRequest, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from "./environment-requests.js";
12
12
  import type { AgentExactProcessEgressMode, AgentExactProcessProvider } from "./environment-exact-process.js";
13
13
  import type { AgentEnvironmentObservation } from "./environment-observation.js";
@@ -997,6 +997,15 @@ export declare function createAgentEnvironmentWithIdempotency<T extends object>(
997
997
  export interface AgentEnvironmentProvider {
998
998
  readonly name: string;
999
999
  readonly exactProcess?: AgentExactProcessProvider;
1000
+ /**
1001
+ * Reconstruct a source-scoped branching handle after a coordinator restart.
1002
+ *
1003
+ * This surface is intentionally separate from an environment-owned handle:
1004
+ * lookup and cleanup requests identify operations, not their source. The
1005
+ * provider owns source resolution and the underlying platform calls. A
1006
+ * returned handle is bound to that source and must reject other scopes.
1007
+ */
1008
+ readonly workspaceBranching?: AgentWorkspaceBranchingProvider;
1000
1009
  capabilities(): AgentEnvironmentCapabilities | Promise<AgentEnvironmentCapabilities>;
1001
1010
  validateProfile?(profile: AgentProfileRef): AgentProfileValidationResult | Promise<AgentProfileValidationResult>;
1002
1011
  /**
@@ -61,6 +61,15 @@ export interface ModelReasoningCapability {
61
61
  * lower ceiling caps the list there. Pass `model` from your catalog; omit it for the harness-only set.
62
62
  */
63
63
  export declare function reasoningEffortsFor(harness: HarnessType, model?: ModelReasoningCapability | null): readonly ReasoningEffort[];
64
+ /**
65
+ * The native control token a harness applies for one canonical effort, or `null` when it applies
66
+ * none. `effort: null` (nothing requested) is always `null`.
67
+ *
68
+ * One owner for both sides of the check: the adapter that builds the harness argv and the caller
69
+ * that verifies the receipt read this function, so a CLI that renames a rung moves both at once
70
+ * instead of turning into a refused run.
71
+ */
72
+ export declare function nativeReasoningControl(harness: HarnessType, effort: ReasoningEffort | null): string | null;
64
73
  /** Whether the harness's runner honors a per-turn MODEL override (vs. picking the model itself). */
65
74
  export declare function harnessHonorsModel(harness: HarnessType): boolean;
66
75
  /** Whether the harness's runner honors a reasoning-EFFORT override (vs. dropping it). */
@@ -123,8 +123,8 @@ export function snapHarnessToModel(harness, modelId) {
123
123
  * - claude-code: `--effort` accepts `low|medium|high|xhigh|max`; canonical `ultracode` maps to
124
124
  * native `max`. It cannot express `none` or `minimal`, and an unsupported value is warned about
125
125
  * and silently replaced with the default rather than rejected — so the set must not overstate.
126
- * - pi: `--thinking` accepts `off|minimal|low|medium|high|xhigh|max`; canonical `none` maps to
127
- * `off` and `ultracode` to `max`.
126
+ * - pi: `--thinking` accepts `off|minimal|low|medium|high|xhigh`; canonical `none` maps to
127
+ * `off` and `ultracode` clamps to `xhigh`, its top rung.
128
128
  * - prime: the prime fork of the pi line accepts the same `--thinking` set
129
129
  * (`off|minimal|low|medium|high|xhigh|max`); canonical `none` maps to `off` and `ultracode` to
130
130
  * `max`.
@@ -186,6 +186,70 @@ export function reasoningEffortsFor(harness, model) {
186
186
  }
187
187
  return efforts;
188
188
  }
189
+ // ── Native reasoning control (the exact token the harness process receives) ───
190
+ /**
191
+ * Canonical effort → the harness's OWN control token, or `null` when the harness applies no
192
+ * native reasoning control for that request. This is the value a materialization receipt carries
193
+ * as `reasoningEffort.applied`, so a caller can check that the effort it asked for reached the
194
+ * process instead of trusting an echo of its own request.
195
+ *
196
+ * Read from the argv builders that actually spawn each CLI, not from help text:
197
+ * - claude-code — `--effort <value>`; it cannot express `none` or `minimal`, so both clamp to
198
+ * `low`, and `ultracode` becomes its ceiling `max`.
199
+ * - codex — `-c model_reasoning_effort="<value>"`; it takes the canonical rungs directly and
200
+ * names its ceiling `ultra`.
201
+ * - pi — `--thinking <value>`; `none` becomes `off` and `ultracode` clamps to `xhigh`, the
202
+ * highest rung the pi line accepts.
203
+ * - prime — `--thinking <value>`; the fork carries `max` above `xhigh`, so `ultracode` reaches
204
+ * `max`. This is the one rung where prime and pi differ.
205
+ * - kimi-code — the control is the FLAG itself, `--thinking` or `--no-thinking`, because kimi's
206
+ * thinking switch is binary. `medium` is its default and passes no flag at all.
207
+ * - opencode — the router-backed variant name is the canonical rung unchanged.
208
+ *
209
+ * A harness with no entry applies NO native control: either it derives thinking from the model
210
+ * (gemini's `--thinking-budget`) or it plumbs no thinking flag at all (see
211
+ * {@link harnessHonorsEffort}). Both answer `null`, which is what their receipts carry — so an
212
+ * unknown harness is never asserted to have applied a control it cannot apply.
213
+ */
214
+ const harnessNativeReasoningControl = {
215
+ "claude-code": (effort) => {
216
+ if (effort === "none" || effort === "minimal")
217
+ return "low";
218
+ return effort === "ultracode" ? "max" : effort;
219
+ },
220
+ codex: (effort) => (effort === "ultracode" ? "ultra" : effort),
221
+ pi: (effort) => {
222
+ if (effort === "none")
223
+ return "off";
224
+ return effort === "ultracode" ? "xhigh" : effort;
225
+ },
226
+ prime: (effort) => {
227
+ if (effort === "none")
228
+ return "off";
229
+ return effort === "ultracode" ? "max" : effort;
230
+ },
231
+ "kimi-code": (effort) => {
232
+ if (effort === "medium")
233
+ return null;
234
+ return effort === "none" || effort === "minimal" || effort === "low"
235
+ ? "--no-thinking"
236
+ : "--thinking";
237
+ },
238
+ opencode: (effort) => effort,
239
+ };
240
+ /**
241
+ * The native control token a harness applies for one canonical effort, or `null` when it applies
242
+ * none. `effort: null` (nothing requested) is always `null`.
243
+ *
244
+ * One owner for both sides of the check: the adapter that builds the harness argv and the caller
245
+ * that verifies the receipt read this function, so a CLI that renames a rung moves both at once
246
+ * instead of turning into a refused run.
247
+ */
248
+ export function nativeReasoningControl(harness, effort) {
249
+ if (effort === null)
250
+ return null;
251
+ return harnessNativeReasoningControl[harness]?.(effort) ?? null;
252
+ }
189
253
  // ── Per-turn selector support (does the harness honor the chat pickers?) ──────
190
254
  /**
191
255
  * Harnesses whose runner DROPS a per-turn selector — grounded in the cli-bridge adapter audit, NOT a
@@ -81,5 +81,20 @@ export interface AgentWorkspaceBranching {
81
81
  signal?: AbortSignal;
82
82
  }): Promise<WorkspaceCleanupAcknowledgement>;
83
83
  }
84
+ /**
85
+ * Provider-level entry point for reconstructing branch operations by source.
86
+ *
87
+ * Environment handles are process-local views. A coordinator that restarts
88
+ * must obtain a fresh source-scoped handle before it looks up or cleans a
89
+ * checkpoint or fork. The returned handle must reject a resource that does
90
+ * not belong to its source scope. Providers return null when the source is
91
+ * absent, the resolved environment id does not match, or the deployment
92
+ * cannot prove the complete branching surface.
93
+ */
94
+ export interface AgentWorkspaceBranchingProvider {
95
+ forEnvironment(sourceEnvironmentId: string, options?: {
96
+ signal?: AbortSignal;
97
+ }): Promise<AgentWorkspaceBranching | null>;
98
+ }
84
99
  /** Bind cleanup confirmation to the exact provider resource and operation. */
85
100
  export declare function workspaceCleanupAcknowledgementMatches(request: WorkspaceCleanupRequest, acknowledgement: WorkspaceCleanupAcknowledgement): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",