@tangle-network/agent-interface 2.20.1 → 3.0.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 (48) hide show
  1. package/README.md +1 -23
  2. package/dist/agent-candidate-artifact-schema.d.ts +0 -4
  3. package/dist/agent-candidate-artifact-schema.js +1 -1
  4. package/dist/agent-candidate-schema-common.d.ts +0 -5
  5. package/dist/agent-candidate-schema-common.js +0 -27
  6. package/dist/agent-execution-limits.d.ts +0 -18
  7. package/dist/agent-execution-limits.js +0 -21
  8. package/dist/agent-execution-preparation.d.ts +2 -22
  9. package/dist/agent-execution-preparation.js +1 -25
  10. package/dist/agent-improvement-measurement-schema.d.ts +0 -17
  11. package/dist/agent-improvement-measurement-schema.js +3 -3
  12. package/dist/agent-improvement-source.d.ts +0 -2
  13. package/dist/agent-workspace-lease.d.ts +0 -23
  14. package/dist/agent-workspace-lease.js +0 -4
  15. package/dist/contract-limits.d.ts +0 -3
  16. package/dist/contract-limits.js +0 -10
  17. package/dist/environment-interactive-start.d.ts +0 -2
  18. package/dist/environment-interactive-start.js +1 -1
  19. package/dist/environment-observation.d.ts +0 -17
  20. package/dist/environment-observation.js +0 -13
  21. package/dist/environment-provider.d.ts +2 -1
  22. package/dist/environment-provider.js +2 -1
  23. package/dist/environment-runtime.d.ts +2 -16
  24. package/dist/environment-runtime.js +1 -5
  25. package/dist/index.d.ts +1 -3
  26. package/dist/index.js +1 -3
  27. package/dist/interaction-fields.d.ts +0 -1
  28. package/dist/interaction-response-validation.d.ts +0 -5
  29. package/dist/interaction-response-validation.js +0 -12
  30. package/dist/parts.d.ts +0 -3
  31. package/dist/parts.js +0 -9
  32. package/dist/plan.d.ts +0 -8
  33. package/dist/plan.js +0 -6
  34. package/dist/profile-diff.d.ts +0 -1
  35. package/dist/profile-diff.js +0 -31
  36. package/dist/profile-kb/index.d.ts +1 -22
  37. package/dist/profile-kb/index.js +1 -23
  38. package/dist/runtime-control.d.ts +0 -61
  39. package/dist/runtime-control.js +0 -76
  40. package/dist/workspace-confidentiality.d.ts +0 -2
  41. package/dist/workspace-confidentiality.js +1 -1
  42. package/package.json +1 -11
  43. package/dist/agent-instance.d.ts +0 -98
  44. package/dist/agent-instance.js +0 -105
  45. package/dist/certified-context.d.ts +0 -118
  46. package/dist/certified-context.js +0 -220
  47. package/dist/environment-interactive.d.ts +0 -2
  48. package/dist/environment-interactive.js +0 -2
package/README.md CHANGED
@@ -19,27 +19,7 @@ materialization receipts. The function does not load resources or estimate token
19
19
  Its coverage explicitly leaves tokenization, materialization, and observed use unassessed.
20
20
  A capability declaration is not evidence that it was delivered, opened, or applied.
21
21
 
22
- ## Agent instances
23
-
24
- `AgentProfile` describes behavior. `AgentInstanceSpec` describes one optional managed Agent inside an existing execution environment. The environment remains the computer and security boundary, so it may host zero, one, or many Agent instances.
25
-
26
- ```ts
27
- import type { AgentInstanceSpec } from "@tangle-network/agent-interface/agent-instance";
28
-
29
- const planner = {
30
- id: "planner",
31
- profile: {
32
- name: "planner",
33
- harness: "opencode",
34
- prompt: { systemPrompt: "Plan before editing." },
35
- },
36
- workspace: { mode: "shared" },
37
- } satisfies AgentInstanceSpec;
38
- ```
39
-
40
- The portable contract owns only inline profile and harness selection, shared or isolated workspace intent, public lifecycle state, a provider-sanitized failure summary, and idempotent stop shapes. Credentials, HTTP routes, process identifiers, placement, billing, snapshots, local resource controls, grants, and fencing remain provider-private.
41
-
42
- `shared` means ordinary same-computer file visibility. It is not automatic merge behavior or tenant isolation. `isolated` asks the provider for a private writable view and explicit inspect or commit behavior. Providers must reject unsatisfied machine requirements rather than silently replacing or migrating a live environment.
22
+ ## Workspace paths
43
23
 
44
24
  `WorkspaceRequest.cwd` is an explicitly based path reference.
45
25
  Use `base: "repository"` for a portable repository-relative POSIX path.
@@ -52,8 +32,6 @@ To migrate a string cwd, wrap it in the base that owns its path.
52
32
  Use the repository base for Tangle and other portable workspace providers.
53
33
  Use the host base for CLI Bridge native process paths.
54
34
 
55
- The public `AgentInstanceRecord` contains a credential-free profile identity, not the full profile or provider request. Existing session APIs can implement this contract without a new service: one instance maps to one managed session, compatible sessions may reuse a backend process, and stop maps to idempotent session deletion or process release.
56
-
57
35
  ## Durable runs, interactions, and context
58
36
 
59
37
  `AgentTurnInput.profile` carries the exact `AgentProfile` for a turn through its canonical schema.
@@ -144,10 +144,6 @@ export declare const agentCandidateWorkspaceSnapshotEvidenceSchema: z.ZodObject<
144
144
  byteLength: z.ZodNumber;
145
145
  }, z.core.$strict>]>;
146
146
  }, z.core.$strict>;
147
- export declare function validateEmbeddedArtifact(artifact: {
148
- content: string;
149
- byteLength: number;
150
- }, ctx: z.RefinementCtx): void;
151
147
  export declare const agentCandidateInlineResourceSchema: z.ZodObject<{
152
148
  kind: z.ZodLiteral<"inline">;
153
149
  name: z.ZodString;
@@ -158,7 +158,7 @@ export const agentCandidateWorkspaceSnapshotEvidenceSchema = z
158
158
  });
159
159
  }
160
160
  });
161
- export function validateEmbeddedArtifact(artifact, ctx) {
161
+ function validateEmbeddedArtifact(artifact, ctx) {
162
162
  if (!hasCanonicalBase64Padding(artifact.content)) {
163
163
  ctx.addIssue({
164
164
  code: "custom",
@@ -40,11 +40,6 @@ export declare const environmentConfigSchema: z.ZodRecord<z.ZodString, z.ZodObje
40
40
  kind: z.ZodLiteral<"public">;
41
41
  value: z.ZodString;
42
42
  }, z.core.$strict>>;
43
- export declare const headerConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
44
- kind: z.ZodLiteral<"public">;
45
- value: z.ZodString;
46
- }, z.core.$strict>>;
47
- export declare const candidateMetadataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
48
43
  export declare const agentCandidateGitHubRepositorySchema: z.ZodObject<{
49
44
  kind: z.ZodLiteral<"github">;
50
45
  owner: z.ZodString;
@@ -263,33 +263,6 @@ function configRecordSchema(keySchema) {
263
263
  });
264
264
  }
265
265
  export const environmentConfigSchema = configRecordSchema(environmentNameSchema);
266
- export const headerConfigSchema = configRecordSchema(headerNameSchema);
267
- export const candidateMetadataSchema = z
268
- .record(z.string(), z.unknown())
269
- .superRefine((metadata, ctx) => {
270
- if (hasSensitiveMetadataKey(metadata)) {
271
- ctx.addIssue({
272
- code: "custom",
273
- message: "metadata must not contain credential-bearing keys",
274
- });
275
- }
276
- });
277
- function hasSensitiveMetadataKey(value, ancestors = new Set()) {
278
- if (value === null || typeof value !== "object" || ancestors.has(value)) {
279
- return false;
280
- }
281
- const nextAncestors = new Set(ancestors).add(value);
282
- if (Array.isArray(value)) {
283
- return value.some((entry) => hasSensitiveMetadataKey(entry, nextAncestors));
284
- }
285
- for (const [key, entry] of Object.entries(value)) {
286
- if (secretNamePattern.test(key))
287
- return true;
288
- if (hasSensitiveMetadataKey(entry, nextAncestors))
289
- return true;
290
- }
291
- return false;
292
- }
293
266
  export const agentCandidateGitHubRepositorySchema = z
294
267
  .object({
295
268
  kind: z.literal("github"),
@@ -6,27 +6,9 @@ export interface AgentExecutionLimitObservation {
6
6
  steps: number;
7
7
  usage: AgentCandidateFixedSpend;
8
8
  }
9
- export declare const agentExecutionLimitObservationSchema: z.ZodObject<{
10
- durationMs: z.ZodNumber;
11
- steps: z.ZodNumber;
12
- usage: z.ZodObject<{
13
- inputTokens: z.ZodNumber;
14
- outputTokens: z.ZodNumber;
15
- cachedInputTokens: z.ZodNumber;
16
- reasoningTokens: z.ZodNumber;
17
- modelCalls: z.ZodNumber;
18
- costUsdNanos: z.ZodNumber;
19
- costProvenance: z.ZodEnum<{
20
- estimated: "estimated";
21
- observed: "observed";
22
- }>;
23
- }, z.core.$strict>;
24
- }, z.core.$strict>;
25
9
  export interface RefineAgentExecutionWithinLimitsOptions {
26
10
  pathPrefix?: (string | number)[];
27
11
  usagePath?: (string | number)[];
28
12
  }
29
- /** Reject an execution record that cannot satisfy every limit it claims to use. */
30
- export declare function assertAgentExecutionWithinLimits(limits: AgentCandidateExecutionLimits, observation: AgentExecutionLimitObservation): void;
31
13
  /** Add schema issues instead of throwing when a receipt is parsed by Zod. */
32
14
  export declare function refineAgentExecutionWithinLimits(limits: AgentCandidateExecutionLimits, observation: AgentExecutionLimitObservation, ctx: z.RefinementCtx, options?: RefineAgentExecutionWithinLimitsOptions): void;
@@ -1,24 +1,3 @@
1
- import { z } from "zod";
2
- import { agentCandidateExecutionLimitsSchema } from "./agent-candidate-execution-plan-schema.js";
3
- import { agentCandidateFixedSpendSchema } from "./agent-candidate-outcome-schema.js";
4
- export const agentExecutionLimitObservationSchema = z
5
- .object({
6
- durationMs: z.number().finite().nonnegative(),
7
- steps: z.number().int().nonnegative().safe(),
8
- usage: agentCandidateFixedSpendSchema,
9
- })
10
- .strict();
11
- /** Reject an execution record that cannot satisfy every limit it claims to use. */
12
- export function assertAgentExecutionWithinLimits(limits, observation) {
13
- const parsedLimits = agentCandidateExecutionLimitsSchema.parse(limits);
14
- const parsedObservation = agentExecutionLimitObservationSchema.parse(observation);
15
- const violations = executionLimitViolations(parsedLimits, parsedObservation);
16
- if (violations.length === 0)
17
- return;
18
- throw new Error(violations
19
- .map((violation) => `execution ${violation.label} ${violation.actual} exceeds frozen limit ${violation.maximum}`)
20
- .join("; "));
21
- }
22
1
  /** Add schema issues instead of throwing when a receipt is parsed by Zod. */
23
2
  export function refineAgentExecutionWithinLimits(limits, observation, ctx, options = {}) {
24
3
  const pathPrefix = options.pathPrefix ?? [];
@@ -4,7 +4,7 @@ import type { AgentProfileActivationEvidence } from "./agent-profile-activation.
4
4
  import { type AgentProfileMaterializationAxis } from "./agent-profile-materialization.js";
5
5
  import { type AgentExecutionPreparationAxisResult, type AgentExecutionPreparationMaterializer, type AgentExecutionPreparationReceipt, type AgentExecutionPreparationResolvedModel } from "./agent-execution-preparation-receipt.js";
6
6
  import type { HarnessType } from "./harness.js";
7
- import { type AgentWorkspaceExecutionBoundLeaseRecord, type AgentWorkspaceSealedLeaseRecord } from "./agent-workspace-lease.js";
7
+ import { type AgentWorkspaceSealedLeaseRecord } from "./agent-workspace-lease.js";
8
8
  export { agentExecutionPreparationAxisResultSchema, agentExecutionPreparationReasoningEffortSchema, agentExecutionPreparationReceiptSchema, type AgentExecutionPreparationAxisResult, type AgentExecutionPreparationDisposition, type AgentExecutionPreparationMaterializer, type AgentExecutionPreparationOwner, type AgentExecutionPreparationReasoningEffort, type AgentExecutionPreparationReceipt, type AgentExecutionPreparationResolvedModel, type AgentExecutionPreparationWorkspace, } from "./agent-execution-preparation-receipt.js";
9
9
  export interface BuildAgentExecutionPreparationReceiptInput {
10
10
  preparationId: string;
@@ -26,23 +26,7 @@ export interface BuildAgentExecutionPreparationReceiptInput {
26
26
  /** Clock used only to refuse already-expired preparations. */
27
27
  nowMs?: number;
28
28
  }
29
- export interface ValidateAgentExecutionPreparationReceiptOptions {
30
- receipt: unknown;
31
- requestDigest: Sha256Digest;
32
- authoredProfile: AgentProfile;
33
- effectiveProfile: AgentProfile;
34
- /** Expected public-plan identity; callers must not derive it from secret values. */
35
- executionPlanDigest: Sha256Digest;
36
- profileActivation: Pick<AgentProfileActivationEvidence, "digest">;
37
- /** Bound lease closes the receipt→workspace link before compute begins. */
38
- workspaceLease: AgentWorkspaceExecutionBoundLeaseRecord;
39
- nowMs?: number;
40
- preparationId?: string;
41
- backend?: string;
42
- harness?: HarnessType;
43
- harnessVersion?: string;
44
- }
45
- export type AgentExecutionPreparationValidationIssueCode = "invalid-receipt" | "invalid-profile" | "invalid-workspace-lease" | "workspace-not-execution-bound" | "execution-binding-mismatch" | "digest-mismatch" | "expectation-mismatch" | "expired" | "missing-coverage" | "ambiguous-coverage" | "duplicate-coverage" | "conflicting-coverage" | "unrequested-coverage" | "invalid-disposition" | "strict-unsupported" | "model-fidelity";
29
+ export type AgentExecutionPreparationValidationIssueCode = "invalid-receipt" | "invalid-profile" | "invalid-workspace-lease" | "workspace-not-execution-bound" | "digest-mismatch" | "expectation-mismatch" | "expired" | "missing-coverage" | "ambiguous-coverage" | "duplicate-coverage" | "conflicting-coverage" | "unrequested-coverage" | "invalid-disposition" | "strict-unsupported" | "model-fidelity";
46
30
  export interface AgentExecutionPreparationValidationIssue {
47
31
  code: AgentExecutionPreparationValidationIssueCode;
48
32
  message: string;
@@ -68,10 +52,6 @@ export type AgentExecutionPreparationValidationResult = {
68
52
  export declare function canonicalAgentProfileDigest(profile: AgentProfile): Sha256Digest;
69
53
  /** Build, self-hash, and cross-check one pre-compute executor acknowledgement. */
70
54
  export declare function buildAgentExecutionPreparationReceipt(input: BuildAgentExecutionPreparationReceiptInput): AgentExecutionPreparationReceipt;
71
- /** Validate structure, bindings, expiry, model fidelity, and exact path coverage. */
72
- export declare function validateAgentExecutionPreparationReceipt(options: ValidateAgentExecutionPreparationReceiptOptions): AgentExecutionPreparationValidationResult;
73
- /** Throw one structured error when a preparation acknowledgement is invalid. */
74
- export declare function assertAgentExecutionPreparationReceipt(options: ValidateAgentExecutionPreparationReceiptOptions): AgentExecutionPreparationReceipt;
75
55
  export declare class AgentExecutionPreparationValidationError extends Error {
76
56
  readonly issues: readonly AgentExecutionPreparationValidationIssue[];
77
57
  constructor(issues: readonly AgentExecutionPreparationValidationIssue[]);
@@ -74,19 +74,11 @@ export function buildAgentExecutionPreparationReceipt(input) {
74
74
  harness: input.harness,
75
75
  harnessVersion: input.harnessVersion,
76
76
  workspaceLease,
77
- requireExecutionBinding: false,
78
77
  });
79
78
  if (validation.ok)
80
79
  return validation.receipt;
81
80
  throw new AgentExecutionPreparationValidationError(validation.issues);
82
81
  }
83
- /** Validate structure, bindings, expiry, model fidelity, and exact path coverage. */
84
- export function validateAgentExecutionPreparationReceipt(options) {
85
- return validateAgentExecutionPreparationReceiptInternal({
86
- ...options,
87
- requireExecutionBinding: true,
88
- });
89
- }
90
82
  function validateAgentExecutionPreparationReceiptInternal(options) {
91
83
  const parsedReceipt = agentExecutionPreparationReceiptSchema.safeParse(options.receipt);
92
84
  if (!parsedReceipt.success) {
@@ -111,9 +103,7 @@ function validateAgentExecutionPreparationReceiptInternal(options) {
111
103
  };
112
104
  }
113
105
  const workspaceLease = workspaceLeaseResult.data;
114
- const expectedPhase = options.requireExecutionBinding
115
- ? "execution-bound"
116
- : "workspace-sealed";
106
+ const expectedPhase = "workspace-sealed";
117
107
  if (workspaceLease.phase !== expectedPhase) {
118
108
  return {
119
109
  ok: false,
@@ -166,13 +156,6 @@ function validateAgentExecutionPreparationReceiptInternal(options) {
166
156
  compareDigest(issues, "execution plan", receipt.executionPlanDigest, options.executionPlanDigest);
167
157
  compareDigest(issues, "profile activation", receipt.workspace.profileActivationDigest, options.profileActivation.digest);
168
158
  compareDigest(issues, "workspace profile activation", receipt.workspace.profileActivationDigest, workspaceLease.profileActivationDigest);
169
- if (workspaceLease.phase === "execution-bound" &&
170
- workspaceLease.executionPreparationDigest !== receipt.digest) {
171
- issues.push({
172
- code: "execution-binding-mismatch",
173
- message: "workspace execution binding does not name this preparation receipt",
174
- });
175
- }
176
159
  compareExpectation(issues, "preparation id", receipt.preparationId, options.preparationId);
177
160
  compareExpectation(issues, "backend", receipt.backend, options.backend);
178
161
  compareExpectation(issues, "harness", receipt.harness, options.harness);
@@ -218,13 +201,6 @@ function validateAgentExecutionPreparationReceiptInternal(options) {
218
201
  ? { ok: true, receipt, issues: [] }
219
202
  : { ok: false, issues };
220
203
  }
221
- /** Throw one structured error when a preparation acknowledgement is invalid. */
222
- export function assertAgentExecutionPreparationReceipt(options) {
223
- const validation = validateAgentExecutionPreparationReceipt(options);
224
- if (validation.ok)
225
- return validation.receipt;
226
- throw new AgentExecutionPreparationValidationError(validation.issues);
227
- }
228
204
  export class AgentExecutionPreparationValidationError extends Error {
229
205
  issues;
230
206
  constructor(issues) {
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import type { AgentCandidateCostProvenance, AgentCandidateEvaluationPolicy, AgentCandidateJsonValue, AgentImprovementMeasuredComparisonBase } from "./agent-candidate.js";
3
- export declare const canonicalJsonSchema: z.ZodCustom<AgentCandidateJsonValue, AgentCandidateJsonValue>;
4
3
  export declare const canonicalJsonObjectSchema: z.ZodRecord<z.ZodString, z.ZodCustom<AgentCandidateJsonValue, AgentCandidateJsonValue>>;
5
4
  export declare const agentCandidateEvaluationPolicySchema: z.ZodObject<{
6
5
  confidenceLevel: z.ZodNumber;
@@ -12,13 +11,6 @@ export declare const agentCandidateEvaluationPolicySchema: z.ZodObject<{
12
11
  criticalDimensions: z.ZodArray<z.ZodString>;
13
12
  regressionTolerance: z.ZodNumber;
14
13
  }, z.core.$strict>;
15
- export declare const agentImprovementCostSchema: z.ZodObject<{
16
- usd: z.ZodNumber;
17
- provenance: z.ZodEnum<{
18
- estimated: "estimated";
19
- observed: "observed";
20
- }>;
21
- }, z.core.$strict>;
22
14
  export declare const measuredComparisonCommonShape: {
23
15
  overall: z.ZodObject<{
24
16
  baseline: z.ZodNumber;
@@ -219,13 +211,4 @@ export declare function refineMeasuredComparisonSummary<TReceipt>(comparison: Me
219
211
  costProvenance(receipt: TReceipt): AgentCandidateCostProvenance;
220
212
  latency(receipt: TReceipt): number;
221
213
  }, ctx: z.RefinementCtx): void;
222
- export declare function refineEstimate(estimate: {
223
- baseline: number;
224
- candidate: number;
225
- delta: number;
226
- confidenceInterval: {
227
- lower: number;
228
- upper: number;
229
- };
230
- }, path: (string | number)[], ctx: z.RefinementCtx): void;
231
214
  export {};
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { isCanonicalJsonValue, sha256DigestSchema } from "./agent-candidate-schema-common.js";
3
3
  import { numbersApproximatelyEqual } from "./number-validation.js";
4
- export const canonicalJsonSchema = z.custom(isCanonicalJsonValue, "value must be finite, acyclic RFC 8785 JSON");
4
+ const canonicalJsonSchema = z.custom(isCanonicalJsonValue, "value must be finite, acyclic RFC 8785 JSON");
5
5
  export const canonicalJsonObjectSchema = z
6
6
  .record(z.string(), canonicalJsonSchema)
7
7
  .refine(isCanonicalJsonValue, "value must be finite, acyclic RFC 8785 JSON");
@@ -95,7 +95,7 @@ export const agentCandidateEvaluationPolicySchema = z
95
95
  });
96
96
  }
97
97
  });
98
- export const agentImprovementCostSchema = z
98
+ const agentImprovementCostSchema = z
99
99
  .object({
100
100
  usd: z.number().finite().nonnegative(),
101
101
  provenance: z.enum(["observed", "estimated"]),
@@ -357,7 +357,7 @@ export function refineMeasuredComparisonSummary(comparison, policy, expectedN, m
357
357
  }
358
358
  }
359
359
  }
360
- export function refineEstimate(estimate, path, ctx) {
360
+ function refineEstimate(estimate, path, ctx) {
361
361
  const expectedDelta = estimate.candidate - estimate.baseline;
362
362
  const tolerance = Number.EPSILON * Math.max(1, Math.abs(expectedDelta)) * 8;
363
363
  if (Math.abs(estimate.delta - expectedDelta) > tolerance) {
@@ -12,7 +12,6 @@ export declare const agentSourceLicenseSchema: z.ZodDiscriminatedUnion<[z.ZodObj
12
12
  reference: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
13
13
  termsDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
14
14
  }, z.core.$strict>], "kind">;
15
- export type AgentSourceLicense = z.infer<typeof agentSourceLicenseSchema>;
16
15
  /**
17
16
  * One content transition applied while importing a source.
18
17
  *
@@ -32,7 +31,6 @@ export declare const agentSourceTransformationSchema: z.ZodObject<{
32
31
  inputDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
33
32
  outputDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
34
33
  }, z.core.$strict>;
35
- export type AgentSourceTransformation = z.infer<typeof agentSourceTransformationSchema>;
36
34
  /**
37
35
  * Stable reference for the state from which an improvement candidate was made.
38
36
  * `sourceIdentity` identifies the provider object; `sourceDigest` is the exact
@@ -78,29 +78,8 @@ type WithDigest<Material> = Material extends unknown ? Material & {
78
78
  } : never;
79
79
  /** Self-hashed public projection. Private authorization and durable state stay out. */
80
80
  export type AgentWorkspaceLeaseRecord = WithDigest<AgentWorkspaceLeaseRecordMaterial>;
81
- export type AgentWorkspaceCopyReadyLeaseRecord = WithDigest<AgentWorkspaceCopyReadyLeaseRecordMaterial>;
82
81
  export type AgentWorkspaceSealedLeaseRecord = WithDigest<AgentWorkspaceSealedLeaseRecordMaterial>;
83
82
  export type AgentWorkspaceExecutionBoundLeaseRecord = WithDigest<AgentWorkspaceExecutionBoundLeaseRecordMaterial>;
84
- export type AgentWorkspaceDestroyingLeaseRecord = WithDigest<AgentWorkspaceDestroyingLeaseRecordMaterial>;
85
- export type AgentWorkspaceCleanupFailedLeaseRecord = WithDigest<AgentWorkspaceCleanupFailedLeaseRecordMaterial>;
86
- export type AgentWorkspaceDestroyedLeaseRecord = WithDigest<AgentWorkspaceDestroyedLeaseRecordMaterial>;
87
- /**
88
- * Request-only owner capability. Providers persist at most a one-way digest;
89
- * this value never belongs in a public lease or execution receipt.
90
- */
91
- export interface AgentWorkspaceLeaseAuthorization {
92
- leaseId: string;
93
- ownerToken: string;
94
- }
95
- export interface AgentWorkspaceSealRequest extends AgentWorkspaceLeaseAuthorization {
96
- profileActivationDigest: Sha256Digest;
97
- }
98
- export interface AgentWorkspaceExecutionBindingRequest extends AgentWorkspaceLeaseAuthorization {
99
- executionPreparationDigest: Sha256Digest;
100
- }
101
- export interface AgentWorkspaceLeaseRenewalRequest extends AgentWorkspaceLeaseAuthorization {
102
- expiresAtMs: number;
103
- }
104
83
  export declare const agentWorkspaceLeasePhaseSchema: z.ZodEnum<{
105
84
  "cleanup-failed": "cleanup-failed";
106
85
  "copy-ready": "copy-ready";
@@ -116,7 +95,5 @@ export declare const agentWorkspaceAllocationIdentitySchema: z.ZodObject<{
116
95
  }, z.core.$strict>;
117
96
  export declare const agentWorkspaceLeaseRecordMaterialSchema: z.ZodType<AgentWorkspaceLeaseRecordMaterial>;
118
97
  export declare const agentWorkspaceLeaseRecordSchema: z.ZodType<AgentWorkspaceLeaseRecord>;
119
- /** Canonical public identity; private token/state fields cannot enter its schema. */
120
- export declare function canonicalAgentWorkspaceLeaseRecordDigest(material: AgentWorkspaceLeaseRecordMaterial): Sha256Digest;
121
98
  /** Build and self-hash one phase-valid public workspace lease record. */
122
99
  export declare function buildAgentWorkspaceLeaseRecord<Material extends AgentWorkspaceLeaseRecordMaterial>(material: Material): WithDigest<Material>;
@@ -92,10 +92,6 @@ export const agentWorkspaceLeaseRecordSchema = z
92
92
  }
93
93
  })
94
94
  .transform((record) => record);
95
- /** Canonical public identity; private token/state fields cannot enter its schema. */
96
- export function canonicalAgentWorkspaceLeaseRecordDigest(material) {
97
- return canonicalCandidateDigest(agentWorkspaceLeaseRecordMaterialSchema.parse(material));
98
- }
99
95
  /** Build and self-hash one phase-valid public workspace lease record. */
100
96
  export function buildAgentWorkspaceLeaseRecord(material) {
101
97
  const parsed = agentWorkspaceLeaseRecordMaterialSchema.parse(material);
@@ -37,6 +37,3 @@ export declare const boundedEventContentRecordSchema: z.ZodCustom<Record<string,
37
37
  export declare const boundedEventContentStringSchema: z.ZodCustom<string, string>;
38
38
  export declare function assertBoundedJson(value: unknown): void;
39
39
  export declare function assertBoundedSerializedJson(value: string): void;
40
- /** Copy arbitrary metadata into a map that cannot inherit prototype keys. */
41
- export declare function nullPrototypeRecord<T>(value: Record<string, T>): Record<string, T>;
42
- export declare function hasOwn(value: object, key: PropertyKey): boolean;
@@ -331,13 +331,3 @@ export function assertBoundedSerializedJson(value) {
331
331
  throw new Error("serialized contract material exceeds its byte bound");
332
332
  }
333
333
  }
334
- /** Copy arbitrary metadata into a map that cannot inherit prototype keys. */
335
- export function nullPrototypeRecord(value) {
336
- const result = Object.create(null);
337
- for (const key of Object.keys(value))
338
- result[key] = value[key];
339
- return result;
340
- }
341
- export function hasOwn(value, key) {
342
- return Object.prototype.hasOwnProperty.call(value, key);
343
- }
@@ -228,8 +228,6 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
228
228
  }, z.core.$strict>;
229
229
  export type AgentInteractiveSessionStart = z.infer<typeof AgentInteractiveSessionStartSchema>;
230
230
  export type AgentInteractiveSessionStartInput = Omit<AgentInteractiveSessionStart, "run">;
231
- /** Digest the exact process-start request independently of its derived run id. */
232
- export declare function agentInteractiveSessionRequestDigest(coordinates: AgentInteractiveSessionRunCoordinates, input: AgentInteractiveSessionStartInput): `sha256:${string}`;
233
231
  /** Mint the one exact run reference a provider must acknowledge for this start. */
234
232
  export declare function agentInteractiveSessionRunRef(coordinates: AgentInteractiveSessionRunCoordinates, input: AgentInteractiveSessionStartInput): AgentExactRunControlRef;
235
233
  /** Parse a start request and prove its profile identity before provider work. */
@@ -31,7 +31,7 @@ export const AgentInteractiveSessionStartSchema = z.strictObject({
31
31
  rows: interactiveDimensionSchema.optional(),
32
32
  });
33
33
  /** Digest the exact process-start request independently of its derived run id. */
34
- export function agentInteractiveSessionRequestDigest(coordinates, input) {
34
+ function agentInteractiveSessionRequestDigest(coordinates, input) {
35
35
  const exactCoordinates = AgentInteractiveSessionRunCoordinatesSchema.parse(coordinates);
36
36
  const exactInput = AgentInteractiveSessionStartSchema.omit({ run: true }).parse(input);
37
37
  return canonicalCandidateDigest({
@@ -1,18 +1,4 @@
1
1
  import { z } from "zod";
2
- /**
3
- * Freshness discriminator for one observed value. A missing value never reads
4
- * as a measured zero: a value exists only on `known` and `stale`, so the
5
- * absence of a number is always visible as `unavailable`, `redacted`, or
6
- * `unknown`.
7
- */
8
- export type ObservationState = "known" | "stale" | "unavailable" | "redacted" | "unknown";
9
- export declare const ObservationStateSchema: z.ZodEnum<{
10
- known: "known";
11
- redacted: "redacted";
12
- stale: "stale";
13
- unavailable: "unavailable";
14
- unknown: "unknown";
15
- }>;
16
2
  /** How a known or stale value was obtained, and when. */
17
3
  export interface ObservationProvenance {
18
4
  origin: "measured" | "reported" | "estimated";
@@ -374,7 +360,6 @@ export declare const AccountUsageSchema: z.ZodObject<{
374
360
  state: z.ZodLiteral<"unknown">;
375
361
  }, z.core.$strict>], "state">>;
376
362
  }, z.core.$strict>;
377
- export type AccountUsage = z.infer<typeof AccountUsageSchema>;
378
363
  /**
379
364
  * Optional normalized observation of one execution environment.
380
365
  *
@@ -1072,5 +1057,3 @@ export declare function agentEnvironmentObservationIdentityMatches(live: AgentEn
1072
1057
  * tests use this to prove the observation surface never transports a secret.
1073
1058
  */
1074
1059
  export declare function observationContainsCredential(value: unknown): boolean;
1075
- /** Throw when an observation payload carries a credential. */
1076
- export declare function assertObservationCredentialFree(value: unknown): void;
@@ -1,12 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import { boundedIdentifierSchema, boundedStringSchema, } from "./contract-limits.js";
3
- export const ObservationStateSchema = z.enum([
4
- "known",
5
- "stale",
6
- "unavailable",
7
- "redacted",
8
- "unknown",
9
- ]);
10
3
  export const ObservationProvenanceSchema = z.strictObject({
11
4
  origin: z.enum(["measured", "reported", "estimated"]),
12
5
  observedAt: z.iso.datetime().max(64),
@@ -298,9 +291,3 @@ export function observationContainsCredential(value) {
298
291
  }
299
292
  return false;
300
293
  }
301
- /** Throw when an observation payload carries a credential. */
302
- export function assertObservationCredentialFree(value) {
303
- if (observationContainsCredential(value)) {
304
- throw new Error("observation payload must not carry a credential");
305
- }
306
- }
@@ -1,7 +1,8 @@
1
1
  export { AgentEnvironmentEgressPolicySchema } from "./environment-requests.js";
2
2
  export * from "./environment-requests.js";
3
3
  export * from "./environment-exact-process.js";
4
- export * from "./environment-interactive.js";
4
+ export * from "./environment-interactive-control.js";
5
+ export * from "./environment-interactive-start.js";
5
6
  export * from "./environment-observation.js";
6
7
  export * from "./environment-terminal.js";
7
8
  export * from "./environment-runtime.js";
@@ -1,7 +1,8 @@
1
1
  export { AgentEnvironmentEgressPolicySchema } from "./environment-requests.js";
2
2
  export * from "./environment-requests.js";
3
3
  export * from "./environment-exact-process.js";
4
- export * from "./environment-interactive.js";
4
+ export * from "./environment-interactive-control.js";
5
+ export * from "./environment-interactive-start.js";
5
6
  export * from "./environment-observation.js";
6
7
  export * from "./environment-terminal.js";
7
8
  export * from "./environment-runtime.js";
@@ -13,7 +13,8 @@ import type { AgentWorkspaceBranching, AgentWorkspaceBranchingProvider } from ".
13
13
  import type { AgentEnvironmentEgressMode, AgentEnvironmentEgressPolicy, AgentEnvironmentQuery, AgentEnvironmentStatus, AgentEnvironmentSummary, AgentProfileRef, AgentSessionStatus, CheckpointRef, CheckpointRequest, ExecRequest, ExecResult, ForkRequest, PlacementInfo, ResourceRequest, WorkspaceRequest } from "./environment-requests.js";
14
14
  import type { AgentExactProcessEgressMode, AgentExactProcessProvider } from "./environment-exact-process.js";
15
15
  import type { AgentEnvironmentObservation } from "./environment-observation.js";
16
- import type { AgentInteractiveSession, AgentInteractiveSessionRef, AgentInteractiveSessionStart } from "./environment-interactive.js";
16
+ import type { AgentInteractiveSession, AgentInteractiveSessionRef } from "./environment-interactive-control.js";
17
+ import type { AgentInteractiveSessionStart } from "./environment-interactive-start.js";
17
18
  import type { AgentTerminalSession, TerminalAttachRequest, TerminalAttachResult } from "./environment-terminal.js";
18
19
  export interface AgentTurnInput {
19
20
  /** Exact behavior for this turn, separate from bounded provider metadata. */
@@ -899,10 +900,6 @@ export interface AgentSession {
899
900
  * whose creation it cannot prove, because another caller can hold it.
900
901
  */
901
902
  export type AgentEnvironmentCreation = "created" | "replayed";
902
- export declare const AgentEnvironmentCreationSchema: z.ZodEnum<{
903
- created: "created";
904
- replayed: "replayed";
905
- }>;
906
903
  export interface AgentEnvironment {
907
904
  readonly id: string;
908
905
  readonly provider: string;
@@ -1330,17 +1327,6 @@ export interface AgentEnvironmentCreateIdempotencyRecord<T> {
1330
1327
  readonly pending: Promise<T>;
1331
1328
  environment?: T;
1332
1329
  }
1333
- /**
1334
- * Return the per-call view of an environment that a same-key create replayed.
1335
- *
1336
- * The view shares every member of the environment, so operations act on the
1337
- * one environment, and it states `creation: "replayed"` because this call
1338
- * provisioned nothing. The copy is shallow, so the environment must be a plain
1339
- * object whose members do not read `this`; a class instance loses its
1340
- * prototype members in a copy and is rejected.
1341
- * @internal
1342
- */
1343
- export declare function replayedAgentEnvironmentView<T extends object>(environment: T): T;
1344
1330
  /**
1345
1331
  * Apply the generic create contract to one provider adapter's keyed requests.
1346
1332
  *
@@ -158,10 +158,6 @@ export function agentNativeContextContinuationResultMatchesRequest(request, outc
158
158
  (exactOutcome.result.sessionId === undefined ||
159
159
  exactOutcome.result.sessionId === current.sessionId));
160
160
  }
161
- export const AgentEnvironmentCreationSchema = z.enum([
162
- "created",
163
- "replayed",
164
- ]);
165
161
  /** Strict runtime validator for provider capability negotiation. */
166
162
  export const AgentEnvironmentCapabilitiesSchema = z
167
163
  .strictObject({
@@ -451,7 +447,7 @@ export function agentEnvironmentCreateInputDigest(input) {
451
447
  * prototype members in a copy and is rejected.
452
448
  * @internal
453
449
  */
454
- export function replayedAgentEnvironmentView(environment) {
450
+ function replayedAgentEnvironmentView(environment) {
455
451
  const prototype = Object.getPrototypeOf(environment);
456
452
  if (prototype !== Object.prototype && prototype !== null) {
457
453
  throw new Error("a replayed agent environment view requires a plain object environment");
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, ObservationStateSchema, PlacementDescriptorSchema, ProviderIdentitySchema, ResourceProfileSchema, ResourceUseSampleSchema, SafeEndpointSchema, agentEnvironmentObservationIdentityMatches, assertObservationCredentialFree, observationContainsCredential, observationOf, AgentInteractiveSessionAttachSchema, AgentInteractiveSessionControlClaimAcknowledgementSchema, AgentInteractiveSessionControlClaimRequestSchema, AgentInteractiveSessionControlClaimSchema, AgentInteractiveSessionPromptAcknowledgementSchema, AgentInteractiveSessionPromptCommandSchema, AgentInteractiveSessionRefSchema, AgentInteractiveSessionStartSchema, AgentInteractiveSessionStopAcknowledgementSchema, AgentInteractiveSessionStopCommandSchema, AgentInteractiveSessionStatusSchema, agentInteractiveSessionControlClaimAcknowledgementMatchesRequest, agentInteractiveSessionControlClaimRequestDigest, agentInteractiveSessionControlClaimMatchesRef, agentInteractiveSessionControlClaimIsNewer, agentInteractiveSessionPromptAcknowledgementMatchesCommand, agentInteractiveSessionPromptRequestDigest, agentInteractiveSessionStopAcknowledgementMatchesCommand, agentInteractiveSessionStopRequestDigest, agentInteractiveSessionRequestDigest, agentInteractiveSessionRefMatchesStart, agentInteractiveSessionRunRef, agentInteractiveSessionStatusMatchesRef, exactAgentInteractiveSessionStart, AgentEnvironmentCreationSchema, createAgentEnvironmentWithIdempotency, replayedAgentEnvironmentView, canonicalWorkspaceCwd, MAX_WORKSPACE_CWD_LENGTH, workspaceCwdSchema, workspaceCwdPathForBase, WorkspaceRequestSchema, TerminalAttachRequestSchema, TerminalAttachResultSchema, TerminalDetachAckSchema, TerminalInputSchema, TerminalOutputEventSchema, TerminalReplayWindowSchema, TerminalResizeSchema, TerminalSessionRefSchema, terminalAttachResultMatchesRequest, terminalSessionUsable, } 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, 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";
@@ -27,14 +27,12 @@ export * from "./agent-profile-improvement.js";
27
27
  export * from "./agent-profile-improvement-schema.js";
28
28
  export * from "./agent-execution-limits.js";
29
29
  export * from "./agent-profile.js";
30
- export * from "./agent-instance.js";
31
30
  export * from "./agent-profile-snapshot.js";
32
31
  export * from "./agent-profile-activation.js";
33
32
  export * from "./agent-profile-materialization.js";
34
33
  export * from "./agent-profile-measurements.js";
35
34
  export * from "./agent-execution-preparation.js";
36
35
  export * from "./agent-workspace-lease.js";
37
- export * from "./certified-context.js";
38
36
  export * from "./deep-freeze.js";
39
37
  export * from "./profile-diff.js";
40
38
  export * from "./harness.js";