@tangle-network/agent-interface 2.12.0 → 2.13.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.
@@ -25,6 +25,12 @@ export declare function isSafeRelativePath(value: string, allowDot: boolean): bo
25
25
  export declare function isSafeExecutable(value: string): boolean;
26
26
  export declare function isObviouslyPrivateHostname(rawHostname: string): boolean;
27
27
  export declare function isCanonicalJsonValue(value: unknown, ancestors?: Set<object>): boolean;
28
+ /**
29
+ * Whether a string holds an obvious credential: a provider key (`sk-`, `gh*_`,
30
+ * `github_pat_`, `AKIA`), a PEM private key, a bearer token, or a URL with
31
+ * userinfo or a credential-named query parameter. The agent-eval redaction
32
+ * core calls it, so candidate validation and trace redaction agree.
33
+ */
28
34
  export declare function looksLikeCredential(value: string): boolean;
29
35
  export declare const agentCandidateConfigValueSchema: z.ZodObject<{
30
36
  kind: z.ZodLiteral<"public">;
@@ -225,6 +225,12 @@ function hasCredentialBearingUrl(value) {
225
225
  return false;
226
226
  }
227
227
  }
228
+ /**
229
+ * Whether a string holds an obvious credential: a provider key (`sk-`, `gh*_`,
230
+ * `github_pat_`, `AKIA`), a PEM private key, a bearer token, or a URL with
231
+ * userinfo or a credential-named query parameter. The agent-eval redaction
232
+ * core calls it, so candidate validation and trace redaction agree.
233
+ */
228
234
  export function looksLikeCredential(value) {
229
235
  return obviousSecretValuePattern.test(value) || hasCredentialBearingUrl(value);
230
236
  }
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import type { WorkspaceCwd } from "./workspace-cwd.js";
3
+ import { type WorkspaceCheckpointRef } from "./workspace-checkpoint.js";
3
4
  import type { AgentProfile } from "./agent-profile.js";
4
5
  /** Portable profile reference: inline profile or provider catalog id. */
5
6
  export type AgentProfileRef = AgentProfile | string;
@@ -50,6 +51,18 @@ export interface WorkspaceRequest {
50
51
  * Repository paths use `base: "repository"`; host paths use `base: "host"`.
51
52
  */
52
53
  cwd?: WorkspaceCwd;
54
+ /**
55
+ * Start the workspace from this durable checkpoint.
56
+ *
57
+ * The provider restores the checkpoint's files into the new environment before create returns,
58
+ * or fails the create; it never returns an environment without them. The checkpoint's source
59
+ * environment need not exist any more, which is how a caller continues work whose environment
60
+ * was lost. Environment variables, secrets, egress and runtime attachments come from this create,
61
+ * never from the source. A provider honors this field only when
62
+ * {@link AgentEnvironmentCapabilities.create} states `workspaceCheckpoint: true`, and refuses a
63
+ * checkpoint another provider took.
64
+ */
65
+ checkpoint?: WorkspaceCheckpointRef;
53
66
  /** Opaque provider-native workspace fields. */
54
67
  providerOptions?: Record<string, unknown>;
55
68
  }
@@ -66,6 +79,22 @@ export declare const WorkspaceRequestSchema: z.ZodObject<{
66
79
  base: z.ZodLiteral<"host">;
67
80
  path: z.ZodString;
68
81
  }, z.core.$strict>], "base">>;
82
+ checkpoint: z.ZodOptional<z.ZodObject<{
83
+ checkpointId: z.ZodString;
84
+ provider: z.ZodString;
85
+ source: z.ZodObject<{
86
+ runId: z.ZodString;
87
+ provider: z.ZodString;
88
+ environmentId: z.ZodString;
89
+ sessionId: z.ZodString;
90
+ executionId: z.ZodString;
91
+ requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
92
+ }, z.core.$strict>;
93
+ idempotencyKey: z.ZodString;
94
+ requestDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
95
+ createdAt: z.ZodISODateTime;
96
+ metadata: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
97
+ }, z.core.$strict>>;
69
98
  providerOptions: z.ZodOptional<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
70
99
  }, z.core.$strict>;
71
100
  export interface ResourceRequest {
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { boundedIdentifierSchema, boundedJsonRecordSchema, boundedStringSchema, CONTRACT_MAX_ARRAY_LENGTH, } from "./contract-limits.js";
3
3
  import { workspaceCwdSchema } from "./workspace-cwd.js";
4
+ import { WorkspaceCheckpointRefSchema } from "./workspace-checkpoint.js";
4
5
  /**
5
6
  * One allowed destination host.
6
7
  *
@@ -36,9 +37,17 @@ export const WorkspaceRequestSchema = z
36
37
  repoUrl: boundedStringSchema.min(1).optional(),
37
38
  gitRef: boundedIdentifierSchema.optional(),
38
39
  cwd: workspaceCwdSchema.optional(),
40
+ checkpoint: WorkspaceCheckpointRefSchema.optional(),
39
41
  providerOptions: boundedJsonRecordSchema.optional(),
40
42
  })
41
43
  .superRefine((workspace, refinement) => {
44
+ if (workspace.checkpoint !== undefined && workspace.repoUrl !== undefined) {
45
+ refinement.addIssue({
46
+ code: "custom",
47
+ path: ["checkpoint"],
48
+ message: "workspace cannot start from both a checkpoint and a repository",
49
+ });
50
+ }
42
51
  if (workspace.environment !== undefined && workspace.image !== undefined) {
43
52
  refinement.addIssue({
44
53
  code: "custom",
@@ -883,6 +883,11 @@ export interface AgentEnvironmentCapabilities {
883
883
  runtimeAttachments?: {
884
884
  mcp: true;
885
885
  };
886
+ /**
887
+ * True when create restores {@link WorkspaceRequest.checkpoint} into the new environment,
888
+ * including a checkpoint whose source environment is gone. Absent means create refuses one.
889
+ */
890
+ workspaceCheckpoint?: boolean;
886
891
  };
887
892
  /** Per-surface flags for the normalized environment observation. */
888
893
  observation?: {
@@ -1029,6 +1034,7 @@ export declare const AgentEnvironmentCapabilitiesSchema: z.ZodObject<{
1029
1034
  runtimeAttachments: z.ZodOptional<z.ZodObject<{
1030
1035
  mcp: z.ZodLiteral<true>;
1031
1036
  }, z.core.$strict>>;
1037
+ workspaceCheckpoint: z.ZodOptional<z.ZodBoolean>;
1032
1038
  }, z.core.$strict>>;
1033
1039
  observation: z.ZodOptional<z.ZodObject<{
1034
1040
  identity: z.ZodBoolean;
@@ -240,6 +240,7 @@ export const AgentEnvironmentCapabilitiesSchema = z
240
240
  .optional(),
241
241
  billingOwner: z.boolean().optional(),
242
242
  runtimeAttachments: z.strictObject({ mcp: z.literal(true) }).optional(),
243
+ workspaceCheckpoint: z.boolean().optional(),
243
244
  })
244
245
  .optional(),
245
246
  observation: z
@@ -346,7 +347,10 @@ export const AgentEnvironmentCapabilitiesSchema = z
346
347
  }
347
348
  const create = capabilities.create;
348
349
  if (create !== undefined) {
349
- if (create.egress === undefined && create.billingOwner === undefined && create.runtimeAttachments === undefined) {
350
+ if (create.egress === undefined &&
351
+ create.billingOwner === undefined &&
352
+ create.runtimeAttachments === undefined &&
353
+ create.workspaceCheckpoint === undefined) {
350
354
  refinement.addIssue({
351
355
  code: "custom",
352
356
  path: ["create"],
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ export * from "./interaction.js";
18
18
  export * from "./agent-candidate.js";
19
19
  export * from "./agent-candidate-schema.js";
20
20
  export type { Sha256Digest } from "./agent-candidate.js";
21
- export { canonicalCandidateBytes, canonicalCandidateDigest, canonicalCandidateJson, sha256Bytes, sha256DigestSchema, sha256Utf8, } from "./agent-candidate-schema-common.js";
21
+ export { canonicalCandidateBytes, canonicalCandidateDigest, canonicalCandidateJson, looksLikeCredential, sha256Bytes, sha256DigestSchema, sha256Utf8, } from "./agent-candidate-schema-common.js";
22
22
  export { numbersApproximatelyEqual } from "./number-validation.js";
23
23
  export * from "./agent-candidate-promotion-schema.js";
24
24
  export { agentCandidateEvaluationPolicySchema } from "./agent-improvement-measurement-schema.js";
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ export * from "./workspace-branching.js";
16
16
  export * from "./interaction.js";
17
17
  export * from "./agent-candidate.js";
18
18
  export * from "./agent-candidate-schema.js";
19
- export { canonicalCandidateBytes, canonicalCandidateDigest, canonicalCandidateJson, sha256Bytes, sha256DigestSchema, sha256Utf8, } from "./agent-candidate-schema-common.js";
19
+ export { canonicalCandidateBytes, canonicalCandidateDigest, canonicalCandidateJson, looksLikeCredential, sha256Bytes, sha256DigestSchema, sha256Utf8, } from "./agent-candidate-schema-common.js";
20
20
  export { numbersApproximatelyEqual } from "./number-validation.js";
21
21
  export * from "./agent-candidate-promotion-schema.js";
22
22
  export { agentCandidateEvaluationPolicySchema } from "./agent-improvement-measurement-schema.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",