@tangle-network/agent-interface 5.0.0 → 5.2.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.
package/README.md CHANGED
@@ -399,3 +399,19 @@ Rollback creates a new guarded revision; historical pins remain immutable.
399
399
  `qualification: 'fixture'` or `'native-binary'` honestly. A fixture is not proof
400
400
  of an external CLI binary or deployed volume. Complete native-binary and
401
401
  deployment qualification before advertising those stronger guarantees.
402
+
403
+
404
+ ### Pinned knowledge sources
405
+
406
+ `AgentProfile.resources.knowledge` carries up to `MAX_PROFILE_KNOWLEDGE_SOURCES`
407
+ immutable `{ sourceId, generation }` Hub references. A generation is an exact
408
+ `kg_` SHA-256 identity, never a mutable `latest` alias. A source may appear only
409
+ once. These references participate in snapshots, candidate identity, profile
410
+ merges/diffs and the `knowledge` materialization axis. An overlay can explicitly
411
+ repin a source; a diff can remove it by source ID.
412
+
413
+ References contain neither corpus content nor authorization. The execution host
414
+ must validate source ownership and active generation bindings for its own runtime
415
+ before admitting a knowledge tool. A profile copied to another owner does not
416
+ confer access. Hosts unable to resolve the saved pins must fail closed rather than
417
+ inline JSON into instructions, substitute a newer generation or silently omit them.
@@ -375,6 +375,10 @@ export declare const agentCandidateFileMountSchema: z.ZodObject<{
375
375
  executable: z.ZodOptional<z.ZodBoolean>;
376
376
  }, z.core.$strict>;
377
377
  export declare const agentCandidateResourcesSchema: z.ZodObject<{
378
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
379
+ sourceId: z.ZodString;
380
+ generation: z.ZodString;
381
+ }, z.core.$strict>>>;
378
382
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
379
383
  path: z.ZodString;
380
384
  resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import { agentProfileKnowledgeRefsSchema } from "./profile-knowledge.js";
2
3
  import { agentCandidateGitHubRepositorySchema, gitObjectSchema, isSafeRelativePath, isWellFormedUnicode, looksLikeCredential, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
3
4
  import { agentImprovementSourceSchema } from "./agent-improvement-source.js";
4
5
  const base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -234,6 +235,7 @@ export const agentCandidateFileMountSchema = z
234
235
  .strict();
235
236
  export const agentCandidateResourcesSchema = z
236
237
  .object({
238
+ knowledge: agentProfileKnowledgeRefsSchema.optional(),
237
239
  files: z.array(agentCandidateFileMountSchema).optional(),
238
240
  tools: z.array(agentCandidateResourceRefSchema).optional(),
239
241
  skills: z.array(agentCandidateResourceRefSchema).optional(),
@@ -76,6 +76,10 @@ export declare const agentCandidateProfileSchema: z.ZodObject<{
76
76
  maxSteps: z.ZodOptional<z.ZodNumber>;
77
77
  }, z.core.$strict>>>;
78
78
  resources: z.ZodOptional<z.ZodObject<{
79
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
80
+ sourceId: z.ZodString;
81
+ generation: z.ZodString;
82
+ }, z.core.$strict>>>;
79
83
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
80
84
  path: z.ZodString;
81
85
  resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -67,6 +67,10 @@ export declare const agentCandidateExperimentSchema: z.ZodObject<{
67
67
  maxSteps: z.ZodOptional<z.ZodNumber>;
68
68
  }, z.core.$strict>>>;
69
69
  resources: z.ZodOptional<z.ZodObject<{
70
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
71
+ sourceId: z.ZodString;
72
+ generation: z.ZodString;
73
+ }, z.core.$strict>>>;
70
74
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
71
75
  path: z.ZodString;
72
76
  resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -932,6 +936,10 @@ export declare const agentCandidateExperimentSchema: z.ZodObject<{
932
936
  maxSteps: z.ZodOptional<z.ZodNumber>;
933
937
  }, z.core.$strict>>>;
934
938
  resources: z.ZodOptional<z.ZodObject<{
939
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
940
+ sourceId: z.ZodString;
941
+ generation: z.ZodString;
942
+ }, z.core.$strict>>>;
935
943
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
936
944
  path: z.ZodString;
937
945
  resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -3897,6 +3905,10 @@ export declare const agentImprovementMeasuredComparisonSchema: z.ZodObject<{
3897
3905
  maxSteps: z.ZodOptional<z.ZodNumber>;
3898
3906
  }, z.core.$strict>>>;
3899
3907
  resources: z.ZodOptional<z.ZodObject<{
3908
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
3909
+ sourceId: z.ZodString;
3910
+ generation: z.ZodString;
3911
+ }, z.core.$strict>>>;
3900
3912
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
3901
3913
  path: z.ZodString;
3902
3914
  resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -4762,6 +4774,10 @@ export declare const agentImprovementMeasuredComparisonSchema: z.ZodObject<{
4762
4774
  maxSteps: z.ZodOptional<z.ZodNumber>;
4763
4775
  }, z.core.$strict>>>;
4764
4776
  resources: z.ZodOptional<z.ZodObject<{
4777
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
4778
+ sourceId: z.ZodString;
4779
+ generation: z.ZodString;
4780
+ }, z.core.$strict>>>;
4765
4781
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
4766
4782
  path: z.ZodString;
4767
4783
  resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -9301,6 +9317,10 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
9301
9317
  maxSteps: z.ZodOptional<z.ZodNumber>;
9302
9318
  }, z.core.$strict>>>;
9303
9319
  resources: z.ZodOptional<z.ZodObject<{
9320
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
9321
+ sourceId: z.ZodString;
9322
+ generation: z.ZodString;
9323
+ }, z.core.$strict>>>;
9304
9324
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
9305
9325
  path: z.ZodString;
9306
9326
  resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -10166,6 +10186,10 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
10166
10186
  maxSteps: z.ZodOptional<z.ZodNumber>;
10167
10187
  }, z.core.$strict>>>;
10168
10188
  resources: z.ZodOptional<z.ZodObject<{
10189
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
10190
+ sourceId: z.ZodString;
10191
+ generation: z.ZodString;
10192
+ }, z.core.$strict>>>;
10169
10193
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
10170
10194
  path: z.ZodString;
10171
10195
  resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -71,6 +71,10 @@ export declare const agentCandidateBundleSchema: z.ZodObject<{
71
71
  maxSteps: z.ZodOptional<z.ZodNumber>;
72
72
  }, z.core.$strict>>>;
73
73
  resources: z.ZodOptional<z.ZodObject<{
74
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
75
+ sourceId: z.ZodString;
76
+ generation: z.ZodString;
77
+ }, z.core.$strict>>>;
74
78
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
75
79
  path: z.ZodString;
76
80
  resource: z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -37,6 +37,18 @@ export interface AgentCandidateArtifactRef {
37
37
  sha256: Sha256Digest;
38
38
  byteLength: number;
39
39
  }
40
+ /** Reads one content-addressed object through an authorized closed-locator resolver. */
41
+ export interface AgentCandidateArtifactPort {
42
+ read(ref: AgentCandidateArtifactRef): Promise<Uint8Array>;
43
+ /** Stream an artifact without materializing its complete contents. */
44
+ readStream?(ref: AgentCandidateArtifactRef, options?: {
45
+ signal?: AbortSignal;
46
+ }): AsyncIterable<Uint8Array>;
47
+ /** Find an already stored object by its exact content digest and length. */
48
+ locate?(object: Pick<AgentCandidateArtifactRef, "sha256" | "byteLength">, options?: {
49
+ signal?: AbortSignal;
50
+ }): Promise<AgentCandidateArtifactRef | undefined>;
51
+ }
40
52
  /** Bytes embedded directly in a candidate manifest. */
41
53
  export interface AgentCandidateEmbeddedArtifact {
42
54
  encoding: "base64";
@@ -108,6 +108,7 @@ export declare const agentExecutionPreparationAxisResultSchema: z.ZodObject<{
108
108
  harness: "harness";
109
109
  hooks: "hooks";
110
110
  instructions: "instructions";
111
+ knowledge: "knowledge";
111
112
  mcp: "mcp";
112
113
  metadata: "metadata";
113
114
  modelDefault: "modelDefault";
@@ -260,6 +261,7 @@ export declare const agentExecutionPreparationReceiptSchema: z.ZodObject<{
260
261
  harness: "harness";
261
262
  hooks: "hooks";
262
263
  instructions: "instructions";
264
+ knowledge: "knowledge";
263
265
  mcp: "mcp";
264
266
  metadata: "metadata";
265
267
  modelDefault: "modelDefault";
@@ -9,7 +9,7 @@ import type { AgentProfile } from "./agent-profile.js";
9
9
  * can only add text must report the requested replacement as unsatisfied rather
10
10
  * than acknowledge it.
11
11
  */
12
- export declare const AGENT_PROFILE_MATERIALIZATION_AXES: readonly ["name", "description", "version", "tags", "systemPrompt", "appendSystemPrompt", "instructions", "modelDefault", "modelSmall", "modelProvider", "modelReasoningEffort", "modelMaxVisibleOutputTokens", "modelMaxReasoningTokens", "modelMaxTotalOutputTokens", "modelMetadata", "harness", "seats", "permissions", "tools", "mcp", "connections", "subagents", "files", "resourceTools", "skills", "resourceAgents", "commands", "resourceInstructions", "resourceFailOnError", "hooks", "modes", "confidential", "metadata", "extensions"];
12
+ export declare const AGENT_PROFILE_MATERIALIZATION_AXES: readonly ["name", "description", "version", "tags", "systemPrompt", "appendSystemPrompt", "instructions", "modelDefault", "modelSmall", "modelProvider", "modelReasoningEffort", "modelMaxVisibleOutputTokens", "modelMaxReasoningTokens", "modelMaxTotalOutputTokens", "modelMetadata", "harness", "seats", "permissions", "tools", "mcp", "connections", "subagents", "files", "resourceTools", "skills", "resourceAgents", "commands", "knowledge", "resourceInstructions", "resourceFailOnError", "hooks", "modes", "confidential", "metadata", "extensions"];
13
13
  /** One exact leaf of the public AgentProfile contract. */
14
14
  export type AgentProfileMaterializationAxis = (typeof AGENT_PROFILE_MATERIALIZATION_AXES)[number];
15
15
  /** Compatibility name used by runtimes that distinguish canonical axes. */
@@ -36,6 +36,7 @@ export const AGENT_PROFILE_MATERIALIZATION_AXES = [
36
36
  "skills",
37
37
  "resourceAgents",
38
38
  "commands",
39
+ "knowledge",
39
40
  "resourceInstructions",
40
41
  "resourceFailOnError",
41
42
  "hooks",
@@ -146,6 +147,11 @@ const AXIS_DESCRIPTORS = [
146
147
  rootPath: "/resources/commands",
147
148
  value: (profile) => profile.resources?.commands,
148
149
  },
150
+ {
151
+ axis: "knowledge",
152
+ rootPath: "/resources/knowledge",
153
+ value: (profile) => profile.resources?.knowledge,
154
+ },
149
155
  {
150
156
  axis: "resourceInstructions",
151
157
  rootPath: "/resources/instructions",
@@ -59,7 +59,16 @@ export interface AgentProfileFileMount {
59
59
  /**
60
60
  * Provider-neutral resource bundle.
61
61
  */
62
+ export declare const MAX_PROFILE_KNOWLEDGE_SOURCES = 16;
63
+ /** Immutable Hub source generation. This is public identity, never retrieval authority. */
64
+ export interface AgentProfileKnowledgeRef {
65
+ sourceId: string;
66
+ generation: string;
67
+ }
62
68
  export interface AgentProfileResources {
69
+ /** Owner-authorized source generations resolved by the execution host before admission.
70
+ * Source content and credentials must never be inlined into a profile or prompt. */
71
+ knowledge?: AgentProfileKnowledgeRef[];
63
72
  /**
64
73
  * Generic files to materialize into the agent workspace before execution.
65
74
  */
@@ -31,6 +31,10 @@ export function defineGitHubResource(path, options = {}) {
31
31
  ...(options.name === undefined ? {} : { name: options.name }),
32
32
  };
33
33
  }
34
+ /**
35
+ * Provider-neutral resource bundle.
36
+ */
37
+ export const MAX_PROFILE_KNOWLEDGE_SOURCES = 16;
34
38
  /**
35
39
  * Portable reasoning/thinking effort. Backends map it to their native control at materialization:
36
40
  * codex `model_reasoning_effort`, kimi `--thinking`/`--no-thinking`, claude thinking budget.
@@ -126,6 +130,16 @@ function mergeOptionalArrays(base, overlay) {
126
130
  return undefined;
127
131
  return [...(base ?? []), ...(overlay ?? [])];
128
132
  }
133
+ /** A source has one effective immutable generation; an overlay explicitly repins it. */
134
+ function mergeKnowledgeRefs(base, overlay) {
135
+ if (!base && !overlay)
136
+ return undefined;
137
+ const refs = new Map();
138
+ for (const ref of [...(base ?? []), ...(overlay ?? [])]) {
139
+ refs.set(ref.sourceId, { ...ref });
140
+ }
141
+ return [...refs.values()];
142
+ }
129
143
  /**
130
144
  * Merge two public AgentProfile values.
131
145
  *
@@ -151,6 +165,7 @@ export function mergeAgentProfiles(base, overlay) {
151
165
  : undefined;
152
166
  const mergedResources = base?.resources || overlay?.resources
153
167
  ? assignDefined(base?.resources, overlay?.resources, {
168
+ knowledge: mergeKnowledgeRefs(base?.resources?.knowledge, overlay?.resources?.knowledge),
154
169
  files: mergeOptionalArrays(base?.resources?.files, overlay?.resources?.files),
155
170
  tools: mergeOptionalArrays(base?.resources?.tools, overlay?.resources?.tools),
156
171
  skills: mergeOptionalArrays(base?.resources?.skills, overlay?.resources?.skills),
@@ -102,6 +102,7 @@ export declare const AgentInteractiveSessionRefSchema: z.ZodObject<{
102
102
  harness: "harness";
103
103
  hooks: "hooks";
104
104
  instructions: "instructions";
105
+ knowledge: "knowledge";
105
106
  mcp: "mcp";
106
107
  metadata: "metadata";
107
108
  modelDefault: "modelDefault";
@@ -278,6 +279,7 @@ export declare const AgentInteractiveSessionControlClaimRequestSchema: z.ZodObje
278
279
  harness: "harness";
279
280
  hooks: "hooks";
280
281
  instructions: "instructions";
282
+ knowledge: "knowledge";
281
283
  mcp: "mcp";
282
284
  metadata: "metadata";
283
285
  modelDefault: "modelDefault";
@@ -447,6 +449,7 @@ export declare const AgentInteractiveSessionControlClaimAcknowledgementSchema: z
447
449
  harness: "harness";
448
450
  hooks: "hooks";
449
451
  instructions: "instructions";
452
+ knowledge: "knowledge";
450
453
  mcp: "mcp";
451
454
  metadata: "metadata";
452
455
  modelDefault: "modelDefault";
@@ -637,6 +640,7 @@ export declare const AgentInteractiveSessionStatusSchema: z.ZodDiscriminatedUnio
637
640
  harness: "harness";
638
641
  hooks: "hooks";
639
642
  instructions: "instructions";
643
+ knowledge: "knowledge";
640
644
  mcp: "mcp";
641
645
  metadata: "metadata";
642
646
  modelDefault: "modelDefault";
@@ -786,6 +790,7 @@ export declare const AgentInteractiveSessionStatusSchema: z.ZodDiscriminatedUnio
786
790
  harness: "harness";
787
791
  hooks: "hooks";
788
792
  instructions: "instructions";
793
+ knowledge: "knowledge";
789
794
  mcp: "mcp";
790
795
  metadata: "metadata";
791
796
  modelDefault: "modelDefault";
@@ -943,6 +948,7 @@ export declare const AgentInteractiveSessionStatusSchema: z.ZodDiscriminatedUnio
943
948
  harness: "harness";
944
949
  hooks: "hooks";
945
950
  instructions: "instructions";
951
+ knowledge: "knowledge";
946
952
  mcp: "mcp";
947
953
  metadata: "metadata";
948
954
  modelDefault: "modelDefault";
@@ -1105,6 +1111,7 @@ export declare const AgentInteractiveSessionStopCommandSchema: z.ZodObject<{
1105
1111
  harness: "harness";
1106
1112
  hooks: "hooks";
1107
1113
  instructions: "instructions";
1114
+ knowledge: "knowledge";
1108
1115
  mcp: "mcp";
1109
1116
  metadata: "metadata";
1110
1117
  modelDefault: "modelDefault";
@@ -1276,6 +1283,7 @@ export declare const AgentInteractiveSessionStopAcknowledgementSchema: z.ZodObje
1276
1283
  harness: "harness";
1277
1284
  hooks: "hooks";
1278
1285
  instructions: "instructions";
1286
+ knowledge: "knowledge";
1279
1287
  mcp: "mcp";
1280
1288
  metadata: "metadata";
1281
1289
  modelDefault: "modelDefault";
@@ -1463,6 +1471,7 @@ export declare const AgentInteractiveSessionPromptCommandSchema: z.ZodObject<{
1463
1471
  harness: "harness";
1464
1472
  hooks: "hooks";
1465
1473
  instructions: "instructions";
1474
+ knowledge: "knowledge";
1466
1475
  mcp: "mcp";
1467
1476
  metadata: "metadata";
1468
1477
  modelDefault: "modelDefault";
@@ -1633,6 +1642,7 @@ export declare const AgentInteractiveSessionPromptAcknowledgementSchema: z.ZodOb
1633
1642
  harness: "harness";
1634
1643
  hooks: "hooks";
1635
1644
  instructions: "instructions";
1645
+ knowledge: "knowledge";
1636
1646
  mcp: "mcp";
1637
1647
  metadata: "metadata";
1638
1648
  modelDefault: "modelDefault";
@@ -126,6 +126,10 @@ export declare const AgentInteractiveSessionStartSchema: z.ZodObject<{
126
126
  metadata?: Record<string, unknown> | undefined;
127
127
  }>, unknown>>>;
128
128
  resources: z.ZodOptional<z.ZodObject<{
129
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
130
+ sourceId: z.ZodString;
131
+ generation: z.ZodString;
132
+ }, z.core.$strict>>>;
129
133
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
130
134
  path: z.ZodString;
131
135
  resource: z.ZodUnion<readonly [z.ZodObject<{
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import type { AgentRuntimeAttachments } from "./runtime-attachments.js";
3
3
  export { AgentRuntimeAttachmentsSchema, type AgentRuntimeAttachments } from "./runtime-attachments.js";
4
- import type { Sha256Digest } from "./agent-candidate.js";
4
+ import type { AgentCandidateArtifactPort, Sha256Digest } from "./agent-candidate.js";
5
5
  import type { AgentProfile, AgentProfileCapabilities, AgentProfileValidationResult } from "./agent-profile.js";
6
6
  import type { InputPart } from "./parts.js";
7
7
  import type { StreamEvent } from "./stream-events.js";
@@ -149,6 +149,10 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
149
149
  metadata?: Record<string, unknown> | undefined;
150
150
  }>, unknown>>>;
151
151
  resources: z.ZodOptional<z.ZodObject<{
152
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
153
+ sourceId: z.ZodString;
154
+ generation: z.ZodString;
155
+ }, z.core.$strict>>>;
152
156
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
153
157
  path: z.ZodString;
154
158
  resource: z.ZodUnion<readonly [z.ZodObject<{
@@ -516,6 +520,10 @@ export declare const AgentTurnInputSchema: z.ZodObject<{
516
520
  metadata?: Record<string, unknown> | undefined;
517
521
  }>, unknown>>>;
518
522
  resources: z.ZodOptional<z.ZodObject<{
523
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
524
+ sourceId: z.ZodString;
525
+ generation: z.ZodString;
526
+ }, z.core.$strict>>>;
519
527
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
520
528
  path: z.ZodString;
521
529
  resource: z.ZodUnion<readonly [z.ZodObject<{
@@ -1358,13 +1366,15 @@ export interface AgentEnvironmentCapabilities {
1358
1366
  /** The provider exposes the exact continued run before terminal output. */
1359
1367
  admissionControl?: boolean;
1360
1368
  };
1361
- /** Present only when fresh-session portable context transfer is durable. */
1369
+ /** Durable portable-context lookup and independently qualified fresh-session admission. */
1362
1370
  contextTransfer?: {
1363
1371
  freshSession: boolean;
1364
1372
  requestIdempotency: boolean;
1365
1373
  lookup: boolean;
1366
1374
  /** get(id, { contextTransfer }) verifies the durable receipt and enables only its first turn. */
1367
1375
  attach?: boolean;
1376
+ /** Restores accepted snapshot refs before native admission. Absent or false means unsupported. */
1377
+ workspaceSnapshot?: boolean;
1368
1378
  };
1369
1379
  /** Absent when the provider cannot originate or answer interactions. */
1370
1380
  interactions?: InteractionCapabilities;
@@ -1521,6 +1531,7 @@ export declare const AgentEnvironmentCapabilitiesSchema: z.ZodObject<{
1521
1531
  requestIdempotency: z.ZodBoolean;
1522
1532
  lookup: z.ZodBoolean;
1523
1533
  attach: z.ZodOptional<z.ZodBoolean>;
1534
+ workspaceSnapshot: z.ZodOptional<z.ZodBoolean>;
1524
1535
  }, z.core.$strict>>;
1525
1536
  interactions: z.ZodOptional<z.ZodObject<{
1526
1537
  kinds: z.ZodArray<z.ZodString>;
@@ -1925,6 +1936,10 @@ export declare const AgentEnvironmentGetOptionsSchema: z.ZodObject<{
1925
1936
  metadata?: Record<string, unknown> | undefined;
1926
1937
  }>, unknown>>>;
1927
1938
  resources: z.ZodOptional<z.ZodObject<{
1939
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
1940
+ sourceId: z.ZodString;
1941
+ generation: z.ZodString;
1942
+ }, z.core.$strict>>>;
1928
1943
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
1929
1944
  path: z.ZodString;
1930
1945
  resource: z.ZodUnion<readonly [z.ZodObject<{
@@ -2185,6 +2200,8 @@ export interface AgentEnvironmentProvider {
2185
2200
  export interface AgentContextTransferProvider {
2186
2201
  transfer(request: ContextTransferRequest, options?: {
2187
2202
  signal?: AbortSignal;
2203
+ /** Authorized source artifacts for this attempt; never part of the accepted wire request. */
2204
+ artifacts?: AgentCandidateArtifactPort;
2188
2205
  }): Promise<ContextTransferResult>;
2189
2206
  lookup(request: ContextTransferRequest, options?: {
2190
2207
  signal?: AbortSignal;
@@ -199,6 +199,7 @@ export const AgentEnvironmentCapabilitiesSchema = z
199
199
  requestIdempotency: z.boolean(),
200
200
  lookup: z.boolean(),
201
201
  attach: z.boolean().optional(),
202
+ workspaceSnapshot: z.boolean().optional(),
202
203
  })
203
204
  .optional(),
204
205
  interactions: InteractionCapabilitiesSchema.optional(),
@@ -318,14 +319,16 @@ export const AgentEnvironmentCapabilitiesSchema = z
318
319
  message: "native continuation requires retained control for early admission",
319
320
  });
320
321
  }
321
- if (capabilities.contextTransfer !== undefined &&
322
- (!capabilities.contextTransfer.freshSession ||
323
- !capabilities.contextTransfer.requestIdempotency ||
324
- !capabilities.contextTransfer.lookup)) {
322
+ const contextTransfer = capabilities.contextTransfer;
323
+ if (contextTransfer !== undefined &&
324
+ (!contextTransfer.lookup ||
325
+ (contextTransfer.freshSession && !contextTransfer.requestIdempotency) ||
326
+ ((contextTransfer.attach === true || contextTransfer.workspaceSnapshot === true) &&
327
+ (!contextTransfer.freshSession || !contextTransfer.requestIdempotency)))) {
325
328
  refinement.addIssue({
326
329
  code: "custom",
327
330
  path: ["contextTransfer"],
328
- message: "context transfer requires fresh-session admission, request idempotency, and lookup together",
331
+ message: "context transfer requires durable lookup; fresh admission, attachment, and snapshot transfer require fresh-session admission and request idempotency together",
329
332
  });
330
333
  }
331
334
  const durableBranching = [
@@ -236,6 +236,10 @@ export declare const ContextTransferRequestSchema: z.ZodObject<{
236
236
  metadata?: Record<string, unknown> | undefined;
237
237
  }>, unknown>>>;
238
238
  resources: z.ZodOptional<z.ZodObject<{
239
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
240
+ sourceId: z.ZodString;
241
+ generation: z.ZodString;
242
+ }, z.core.$strict>>>;
239
243
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
240
244
  path: z.ZodString;
241
245
  resource: z.ZodUnion<readonly [z.ZodObject<{
@@ -8,6 +8,7 @@ export interface AgentProfilePromptRemoval {
8
8
  instructions?: AgentProfileRemoveList;
9
9
  }
10
10
  export interface AgentProfileResourceRemoval {
11
+ knowledge?: AgentProfileRemoveList;
11
12
  files?: AgentProfileRemoveList;
12
13
  tools?: AgentProfileRemoveList;
13
14
  skills?: AgentProfileRemoveList;
@@ -30,6 +30,7 @@ const agentProfilePromptDiffPropertyAxes = [
30
30
  const _agentProfilePromptDiffPropertyAxesAreExhaustive = true;
31
31
  void _agentProfilePromptDiffPropertyAxesAreExhaustive;
32
32
  const agentProfileResourceDiffPropertyAxes = [
33
+ "knowledge",
33
34
  "files",
34
35
  "tools",
35
36
  "skills",
@@ -178,6 +179,12 @@ function removeResources(resources, removal) {
178
179
  if (removal === true)
179
180
  return undefined;
180
181
  const next = { ...resources };
182
+ if (removal.knowledge === true)
183
+ delete next.knowledge;
184
+ else if (removal.knowledge !== undefined) {
185
+ const removeSet = new Set(removal.knowledge);
186
+ setOrDelete(next, "knowledge", next.knowledge?.filter((ref) => !removeSet.has(ref.sourceId)));
187
+ }
181
188
  if (removal.files !== undefined) {
182
189
  if (removal.files === true) {
183
190
  delete next.files;
@@ -199,6 +206,7 @@ function removeResources(resources, removal) {
199
206
  if (removal.failOnError)
200
207
  delete next.failOnError;
201
208
  for (const key of [
209
+ "knowledge",
202
210
  "files",
203
211
  "tools",
204
212
  "skills",
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ /** Immutable Hub generation identities, never aliases such as latest or a caller's scope. */
3
+ export declare const agentProfileKnowledgeRefSchema: z.ZodObject<{
4
+ sourceId: z.ZodString;
5
+ generation: z.ZodString;
6
+ }, z.core.$strict>;
7
+ export declare const agentProfileKnowledgeRefsSchema: z.ZodArray<z.ZodObject<{
8
+ sourceId: z.ZodString;
9
+ generation: z.ZodString;
10
+ }, z.core.$strict>>;
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ import { MAX_PROFILE_KNOWLEDGE_SOURCES, } from "./agent-profile.js";
3
+ /** Immutable Hub generation identities, never aliases such as latest or a caller's scope. */
4
+ export const agentProfileKnowledgeRefSchema = z.strictObject({
5
+ sourceId: z.string().regex(/^[A-Za-z0-9_-]{1,128}$/),
6
+ generation: z.string().regex(/^kg_[a-f0-9]{64}$/),
7
+ });
8
+ export const agentProfileKnowledgeRefsSchema = z
9
+ .array(agentProfileKnowledgeRefSchema)
10
+ .max(MAX_PROFILE_KNOWLEDGE_SOURCES)
11
+ .superRefine((refs, context) => {
12
+ const seen = new Set();
13
+ refs.forEach((ref, index) => {
14
+ if (seen.has(ref.sourceId))
15
+ context.addIssue({
16
+ code: "custom",
17
+ path: [index, "sourceId"],
18
+ message: "A profile must pin exactly one generation per knowledge source",
19
+ });
20
+ seen.add(ref.sourceId);
21
+ });
22
+ });
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ export { agentProfileKnowledgeRefSchema, agentProfileKnowledgeRefsSchema, } from "./profile-knowledge.js";
2
3
  import { type AgentProfile, type AgentProfileMetadata, type AgentTrainingTask, type AgentProfileMcpServer } from "./agent-profile.js";
3
4
  import type { AgentProfileDiff } from "./profile-diff.js";
4
5
  import { type SandboxSizePreset } from "./sandbox-size.js";
@@ -39,6 +40,10 @@ export declare const agentProfileFileMountSchema: z.ZodObject<{
39
40
  executable: z.ZodOptional<z.ZodBoolean>;
40
41
  }, z.core.$strict>;
41
42
  export declare const agentProfileResourcesSchema: z.ZodObject<{
43
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
+ sourceId: z.ZodString;
45
+ generation: z.ZodString;
46
+ }, z.core.$strict>>>;
42
47
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
43
48
  path: z.ZodString;
44
49
  resource: z.ZodUnion<readonly [z.ZodObject<{
@@ -319,6 +324,7 @@ export declare const agentProfilePromptRemovalSchema: z.ZodObject<{
319
324
  instructions: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
320
325
  }, z.core.$strict>;
321
326
  export declare const agentProfileResourceRemovalSchema: z.ZodObject<{
327
+ knowledge: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
322
328
  files: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
323
329
  tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
324
330
  skills: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
@@ -344,6 +350,7 @@ export declare const agentProfileDiffRemovalSchema: z.ZodObject<{
344
350
  connections: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
345
351
  subagents: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
346
352
  resources: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodObject<{
353
+ knowledge: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
347
354
  files: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
348
355
  tools: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
349
356
  skills: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<true>, z.ZodArray<z.ZodString>]>>;
@@ -575,6 +582,10 @@ export declare const agentProfileSchema: z.ZodObject<{
575
582
  metadata?: Record<string, unknown> | undefined;
576
583
  }>, unknown>>>;
577
584
  resources: z.ZodOptional<z.ZodObject<{
585
+ knowledge: z.ZodOptional<z.ZodArray<z.ZodObject<{
586
+ sourceId: z.ZodString;
587
+ generation: z.ZodString;
588
+ }, z.core.$strict>>>;
578
589
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
579
590
  path: z.ZodString;
580
591
  resource: z.ZodUnion<readonly [z.ZodObject<{
@@ -1,4 +1,6 @@
1
1
  import { z } from "zod";
2
+ import { agentProfileKnowledgeRefsSchema } from "./profile-knowledge.js";
3
+ export { agentProfileKnowledgeRefSchema, agentProfileKnowledgeRefsSchema, } from "./profile-knowledge.js";
2
4
  import { REASONING_EFFORTS, TRAINED_MODEL_PREFIX, trainedModelIdForArtifact, } from "./agent-profile.js";
3
5
  import { canonicalCandidateDigest, sha256DigestSchema, environmentNameSchema, headerNameSchema, isSafeExecutable, isSafeRelativePath, isWellFormedUnicode, looksLikeCredential, } from "./agent-candidate-schema-common.js";
4
6
  import { harnessTypeSchema } from "./harness.js";
@@ -82,6 +84,7 @@ export const agentProfileFileMountSchema = z.strictObject({
82
84
  executable: z.boolean().optional(),
83
85
  });
84
86
  export const agentProfileResourcesSchema = z.strictObject({
87
+ knowledge: agentProfileKnowledgeRefsSchema.optional(),
85
88
  files: z.array(agentProfileFileMountSchema).optional(),
86
89
  tools: z.array(agentProfileResourceRefSchema).optional(),
87
90
  skills: z.array(agentProfileResourceRefSchema).optional(),
@@ -306,6 +309,7 @@ export const agentProfilePromptRemovalSchema = z.strictObject({
306
309
  instructions: removeListSchema.optional(),
307
310
  });
308
311
  export const agentProfileResourceRemovalSchema = z.strictObject({
312
+ knowledge: removeListSchema.optional(),
309
313
  files: removeListSchema.optional(),
310
314
  tools: removeListSchema.optional(),
311
315
  skills: removeListSchema.optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "5.0.0",
3
+ "version": "5.2.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",