@tangle-network/agent-interface 2.5.0 → 2.6.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.
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ import type { AgentCandidateLineage } from "./agent-candidate.js";
2
3
  export declare const agentCandidateKnowledgeSchema: z.ZodObject<{
3
4
  candidate: z.ZodObject<{
4
5
  kind: z.ZodLiteral<"knowledge-improvement-candidate">;
@@ -124,9 +125,19 @@ export declare const agentCandidateMemoryPolicySchema: z.ZodDiscriminatedUnion<[
124
125
  byteLength: z.ZodNumber;
125
126
  }, z.core.$strict>>;
126
127
  }, z.core.$strict>], "mode">;
128
+ /**
129
+ * Sources whose candidate was PRODUCED from a parent rather than supplied whole.
130
+ *
131
+ * One list, read by the lineage schema and by every experiment schema that gates on it. Three
132
+ * call sites branched on `optimizer || compound` independently, so adding a fourth generated
133
+ * source silently exempted it from the "name your baseline" rule in two of them.
134
+ */
135
+ export declare const generatedCandidateSources: readonly ["optimizer", "compound", "frontier-author"];
136
+ export declare function isGeneratedCandidateSource(source: AgentCandidateLineage["source"]): boolean;
127
137
  export declare const agentCandidateLineageSchema: z.ZodObject<{
128
138
  source: z.ZodEnum<{
129
139
  compound: "compound";
140
+ "frontier-author": "frontier-author";
130
141
  human: "human";
131
142
  import: "import";
132
143
  optimizer: "optimizer";
@@ -39,9 +39,30 @@ export const agentCandidateMemoryPolicySchema = z.discriminatedUnion("mode", [
39
39
  })
40
40
  .strict(),
41
41
  ]);
42
+ /**
43
+ * Sources whose candidate was PRODUCED from a parent rather than supplied whole.
44
+ *
45
+ * One list, read by the lineage schema and by every experiment schema that gates on it. Three
46
+ * call sites branched on `optimizer || compound` independently, so adding a fourth generated
47
+ * source silently exempted it from the "name your baseline" rule in two of them.
48
+ */
49
+ export const generatedCandidateSources = [
50
+ "optimizer",
51
+ "compound",
52
+ "frontier-author",
53
+ ];
54
+ export function isGeneratedCandidateSource(source) {
55
+ return generatedCandidateSources.includes(source);
56
+ }
42
57
  export const agentCandidateLineageSchema = z
43
58
  .object({
44
- source: z.enum(["optimizer", "human", "import", "compound"]),
59
+ source: z.enum([
60
+ "optimizer",
61
+ "human",
62
+ "import",
63
+ "compound",
64
+ "frontier-author",
65
+ ]),
45
66
  parentDigests: z.array(sha256DigestSchema).optional(),
46
67
  runIds: z.array(z.string().min(1)).optional(),
47
68
  profileDiffIds: z.array(z.string().min(1)).optional(),
@@ -62,7 +83,9 @@ export const agentCandidateLineageSchema = z
62
83
  message: "compound candidates must name at least two distinct parents",
63
84
  });
64
85
  }
65
- if (lineage.source === "optimizer" || lineage.source === "compound") {
86
+ // Every generated lineage names what it came from and the run that produced
87
+ // it, whoever generated it.
88
+ if (isGeneratedCandidateSource(lineage.source)) {
66
89
  if ((lineage.parentDigests?.length ?? 0) === 0) {
67
90
  ctx.addIssue({
68
91
  code: "custom",
@@ -77,6 +100,13 @@ export const agentCandidateLineageSchema = z
77
100
  message: "generated candidates must name their producing run",
78
101
  });
79
102
  }
103
+ }
104
+ // A development split exists only when an offline search produced the
105
+ // candidate. An agent that authors a profile inside a run has no held-out
106
+ // set to pin, so requiring one would force a fabricated digest into the
107
+ // evidence record. This branch is deliberately NOT the generated-source
108
+ // list above.
109
+ if (lineage.source === "optimizer" || lineage.source === "compound") {
80
110
  if (lineage.developmentSplitDigest === undefined) {
81
111
  ctx.addIssue({
82
112
  code: "custom",
@@ -1680,6 +1680,7 @@ export declare const agentCandidateExperimentSchema: z.ZodObject<{
1680
1680
  candidateLineage: z.ZodObject<{
1681
1681
  source: z.ZodEnum<{
1682
1682
  compound: "compound";
1683
+ "frontier-author": "frontier-author";
1683
1684
  human: "human";
1684
1685
  import: "import";
1685
1686
  optimizer: "optimizer";
@@ -5277,6 +5278,7 @@ export declare const agentImprovementMeasuredComparisonSchema: z.ZodObject<{
5277
5278
  candidateLineage: z.ZodObject<{
5278
5279
  source: z.ZodEnum<{
5279
5280
  compound: "compound";
5281
+ "frontier-author": "frontier-author";
5280
5282
  human: "human";
5281
5283
  import: "import";
5282
5284
  optimizer: "optimizer";
@@ -10304,6 +10306,7 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
10304
10306
  candidateLineage: z.ZodObject<{
10305
10307
  source: z.ZodEnum<{
10306
10308
  compound: "compound";
10309
+ "frontier-author": "frontier-author";
10307
10310
  human: "human";
10308
10311
  import: "import";
10309
10312
  optimizer: "optimizer";
@@ -13666,6 +13669,7 @@ export declare const agentImprovementProposalSchema: z.ZodObject<{
13666
13669
  candidateLineage: z.ZodObject<{
13667
13670
  source: z.ZodEnum<{
13668
13671
  compound: "compound";
13672
+ "frontier-author": "frontier-author";
13669
13673
  human: "human";
13670
13674
  import: "import";
13671
13675
  optimizer: "optimizer";
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { AGENT_IMPROVEMENT_SURFACES } from "./agent-candidate.js";
3
3
  import { agentCandidateBundleSchema } from "./agent-candidate-schema.js";
4
- import { agentCandidateLineageSchema } from "./agent-candidate-lineage-schema.js";
4
+ import { agentCandidateLineageSchema, isGeneratedCandidateSource, } from "./agent-candidate-lineage-schema.js";
5
5
  import { agentCandidateBenchmarkSuiteInputsSchema } from "./agent-candidate-task-schema.js";
6
6
  import { canonicalCandidateDigest, isCanonicalJsonValue, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
7
7
  import { refineAgentExecutionWithinLimits } from "./agent-execution-limits.js";
@@ -23,7 +23,7 @@ export const agentCandidateExperimentSchema = z
23
23
  .strict()
24
24
  .superRefine((experiment, ctx) => {
25
25
  const source = experiment.candidateLineage.source;
26
- if ((source === "optimizer" || source === "compound") &&
26
+ if (isGeneratedCandidateSource(source) &&
27
27
  !experiment.candidateLineage.parentDigests?.includes(experiment.baseline.digest)) {
28
28
  ctx.addIssue({
29
29
  code: "custom",
@@ -288,7 +288,20 @@ export interface AgentCandidateFixedSpend {
288
288
  }
289
289
  /** Evidence and ancestry that produced the immutable candidate. */
290
290
  export interface AgentCandidateLineage {
291
- source: "optimizer" | "human" | "import" | "compound";
291
+ /**
292
+ * Who produced this candidate.
293
+ *
294
+ * `frontier-author` is an agent that wrote another agent's profile — the same
295
+ * member {@link AgentProfileDiff}`.source.kind` already carries, so the two
296
+ * enums name one actor with one word. It covers a supervising agent authoring
297
+ * a child's full `AgentProfile` from inside a run, which `spawn_worker`
298
+ * exposes and a `driver` role promotes to a sub-supervisor.
299
+ *
300
+ * It carries `optimizer`'s parent and run requirements and not its
301
+ * `developmentSplitDigest`: there is no held-out split and no offline search
302
+ * behind a profile an agent wrote while working.
303
+ */
304
+ source: "optimizer" | "human" | "import" | "compound" | "frontier-author";
292
305
  parentDigests?: Sha256Digest[];
293
306
  runIds?: string[];
294
307
  profileDiffIds?: string[];
@@ -236,6 +236,7 @@ export declare const agentProfileImprovementExperimentSchema: z.ZodObject<{
236
236
  candidateLineage: z.ZodObject<{
237
237
  source: z.ZodEnum<{
238
238
  compound: "compound";
239
+ "frontier-author": "frontier-author";
239
240
  human: "human";
240
241
  import: "import";
241
242
  optimizer: "optimizer";
@@ -768,6 +769,7 @@ export declare const agentProfileImprovementMeasuredComparisonSchema: z.ZodObjec
768
769
  candidateLineage: z.ZodObject<{
769
770
  source: z.ZodEnum<{
770
771
  compound: "compound";
772
+ "frontier-author": "frontier-author";
771
773
  human: "human";
772
774
  import: "import";
773
775
  optimizer: "optimizer";
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { changedAgentProfileAxes } from "./profile-diff.js";
3
- import { agentCandidateLineageSchema } from "./agent-candidate-lineage-schema.js";
3
+ import { agentCandidateLineageSchema, isGeneratedCandidateSource, } from "./agent-candidate-lineage-schema.js";
4
4
  import { canonicalCandidateDigest, isCanonicalJsonValue, omitTopLevelDigest, sha256DigestSchema, } from "./agent-candidate-schema-common.js";
5
5
  import { refineAgentExecutionWithinLimits } from "./agent-execution-limits.js";
6
6
  import { agentCandidateBenchmarkGraderIdentitySchema, agentCandidateExecutionLimitsSchema, agentCandidateResolvedModelSchema, } from "./agent-candidate-execution-plan-schema.js";
@@ -189,7 +189,7 @@ export const agentProfileImprovementExperimentSchema = z
189
189
  });
190
190
  }
191
191
  const source = experiment.candidateLineage.source;
192
- if ((source === "optimizer" || source === "compound") &&
192
+ if (isGeneratedCandidateSource(source) &&
193
193
  !experiment.candidateLineage.parentDigests?.includes(experiment.baseline.stateDigest)) {
194
194
  ctx.addIssue({
195
195
  code: "custom",
@@ -49,6 +49,11 @@ export interface AgentProfileDiff {
49
49
  description?: string;
50
50
  rationale?: string;
51
51
  source?: {
52
+ /**
53
+ * Who produced this change. `frontier-author` is an agent that wrote it —
54
+ * the same member {@link AgentCandidateLineage}`.source` carries, so the two
55
+ * enums name one actor with one word.
56
+ */
52
57
  kind: "trace" | "frontier-author" | "human" | "optimizer" | "compound";
53
58
  artifacts?: readonly string[];
54
59
  notes?: readonly string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-interface",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "license": "MIT",