@tangle-network/agent-interface 0.35.0 → 0.37.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 +2 -2
- package/dist/agent-candidate-artifact-schema.d.ts +504 -0
- package/dist/agent-candidate-artifact-schema.js +16 -1
- package/dist/agent-candidate-outcome-schema.d.ts +26 -0
- package/dist/agent-candidate-outcome-schema.js +8 -1
- package/dist/agent-candidate-profile-schema.d.ts +336 -0
- package/dist/agent-candidate-promotion-schema.d.ts +2199 -20
- package/dist/agent-candidate-promotion-schema.js +24 -1
- package/dist/agent-candidate-receipt-schema.d.ts +6 -0
- package/dist/agent-candidate-schema-common.js +1 -1
- package/dist/agent-candidate-schema.d.ts +336 -0
- package/dist/agent-candidate.d.ts +40 -11
- package/dist/agent-execution-limits.d.ts +4 -0
- package/dist/agent-improvement-measurement-schema.d.ts +40 -7
- package/dist/agent-improvement-measurement-schema.js +55 -14
- package/dist/agent-improvement-source.d.ts +61 -3
- package/dist/agent-improvement-source.js +122 -8
- package/dist/agent-profile-improvement-schema.d.ts +133 -10
- package/dist/agent-profile-improvement-schema.js +33 -1
- package/dist/agent-profile-improvement.d.ts +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +3 -1
|
@@ -178,6 +178,11 @@ export declare const agentProfileImprovementSuiteInputsSchema: z.ZodObject<{
|
|
|
178
178
|
export declare const agentProfileImprovementArmSchema: z.ZodObject<{
|
|
179
179
|
stateDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
180
180
|
}, z.core.$strict>;
|
|
181
|
+
export declare const agentProfileImprovementExecutionRefSchema: z.ZodObject<{
|
|
182
|
+
identity: z.ZodString;
|
|
183
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
184
|
+
kind: z.ZodLiteral<"agent-profile-improvement-execution-ref">;
|
|
185
|
+
}, z.core.$strict>;
|
|
181
186
|
/**
|
|
182
187
|
* The first product path changes only prompt and skills, but it uses the
|
|
183
188
|
* shared profile-diff language so execution and activation apply identical
|
|
@@ -190,9 +195,36 @@ export declare const agentProfileImprovementExperimentSchema: z.ZodObject<{
|
|
|
190
195
|
digestAlgorithm: z.ZodLiteral<"rfc8785-sha256">;
|
|
191
196
|
source: z.ZodObject<{
|
|
192
197
|
kind: z.ZodString;
|
|
193
|
-
sourceIdentity: z.ZodString
|
|
198
|
+
sourceIdentity: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
194
199
|
sourceDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
195
|
-
sourceRevision: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
200
|
+
sourceRevision: z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodNumber]>;
|
|
201
|
+
license: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
202
|
+
kind: z.ZodLiteral<"spdx">;
|
|
203
|
+
expression: z.ZodString;
|
|
204
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
205
|
+
kind: z.ZodLiteral<"custom">;
|
|
206
|
+
name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
207
|
+
reference: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
208
|
+
termsDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
209
|
+
}, z.core.$strict>], "kind">>;
|
|
210
|
+
attribution: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
211
|
+
notices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
212
|
+
transformations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
213
|
+
kind: z.ZodEnum<{
|
|
214
|
+
normalization: "normalization";
|
|
215
|
+
transformation: "transformation";
|
|
216
|
+
}>;
|
|
217
|
+
identity: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
218
|
+
revision: z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodNumber]>;
|
|
219
|
+
procedureDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
220
|
+
inputDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
221
|
+
outputDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
222
|
+
}, z.core.$strict>>>;
|
|
223
|
+
}, z.core.$strict>;
|
|
224
|
+
executionRef: z.ZodObject<{
|
|
225
|
+
identity: z.ZodString;
|
|
226
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
227
|
+
kind: z.ZodLiteral<"agent-profile-improvement-execution-ref">;
|
|
196
228
|
}, z.core.$strict>;
|
|
197
229
|
baseline: z.ZodObject<{
|
|
198
230
|
stateDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
@@ -360,6 +392,11 @@ export declare const agentProfileImprovementRunReceiptSchema: z.ZodObject<{
|
|
|
360
392
|
kind: z.ZodLiteral<"agent-profile-improvement-run">;
|
|
361
393
|
digestAlgorithm: z.ZodLiteral<"rfc8785-sha256">;
|
|
362
394
|
executionId: z.ZodString;
|
|
395
|
+
executionRef: z.ZodObject<{
|
|
396
|
+
identity: z.ZodString;
|
|
397
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
398
|
+
kind: z.ZodLiteral<"agent-profile-improvement-execution-ref">;
|
|
399
|
+
}, z.core.$strict>;
|
|
363
400
|
runCell: z.ZodObject<{
|
|
364
401
|
kind: z.ZodLiteral<"agent-profile-improvement-run-cell">;
|
|
365
402
|
experimentDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
@@ -426,6 +463,10 @@ export declare const agentProfileImprovementRunReceiptSchema: z.ZodObject<{
|
|
|
426
463
|
reasoningTokens: z.ZodNumber;
|
|
427
464
|
modelCalls: z.ZodNumber;
|
|
428
465
|
costUsdNanos: z.ZodNumber;
|
|
466
|
+
costProvenance: z.ZodEnum<{
|
|
467
|
+
observed: "observed";
|
|
468
|
+
estimated: "estimated";
|
|
469
|
+
}>;
|
|
429
470
|
}, z.core.$strict>;
|
|
430
471
|
trace: z.ZodObject<{
|
|
431
472
|
evidence: z.ZodObject<{
|
|
@@ -485,6 +526,10 @@ export declare const agentProfileImprovementRunReceiptSchema: z.ZodObject<{
|
|
|
485
526
|
reasoningTokens: z.ZodNumber;
|
|
486
527
|
modelCalls: z.ZodNumber;
|
|
487
528
|
costUsdNanos: z.ZodNumber;
|
|
529
|
+
costProvenance: z.ZodEnum<{
|
|
530
|
+
observed: "observed";
|
|
531
|
+
estimated: "estimated";
|
|
532
|
+
}>;
|
|
488
533
|
}, z.core.$strict>;
|
|
489
534
|
score: z.ZodNumber;
|
|
490
535
|
passed: z.ZodBoolean;
|
|
@@ -640,12 +685,37 @@ export declare const agentProfileImprovementMeasuredComparisonSchema: z.ZodObjec
|
|
|
640
685
|
diff: z.ZodString;
|
|
641
686
|
evaluation: z.ZodObject<{
|
|
642
687
|
generationsExplored: z.ZodNumber;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
688
|
+
preparation: z.ZodObject<{
|
|
689
|
+
wallDurationMs: z.ZodNumber;
|
|
690
|
+
cost: z.ZodObject<{
|
|
691
|
+
usd: z.ZodNumber;
|
|
692
|
+
provenance: z.ZodEnum<{
|
|
693
|
+
observed: "observed";
|
|
694
|
+
estimated: "estimated";
|
|
695
|
+
}>;
|
|
696
|
+
}, z.core.$strict>;
|
|
697
|
+
}, z.core.$strict>;
|
|
698
|
+
measurement: z.ZodObject<{
|
|
699
|
+
wallDurationMs: z.ZodNumber;
|
|
700
|
+
workDurationMs: z.ZodNumber;
|
|
701
|
+
cost: z.ZodObject<{
|
|
702
|
+
usd: z.ZodNumber;
|
|
703
|
+
provenance: z.ZodEnum<{
|
|
704
|
+
observed: "observed";
|
|
705
|
+
estimated: "estimated";
|
|
706
|
+
}>;
|
|
707
|
+
}, z.core.$strict>;
|
|
708
|
+
}, z.core.$strict>;
|
|
709
|
+
total: z.ZodObject<{
|
|
710
|
+
wallDurationMs: z.ZodNumber;
|
|
711
|
+
cost: z.ZodObject<{
|
|
712
|
+
usd: z.ZodNumber;
|
|
713
|
+
provenance: z.ZodEnum<{
|
|
714
|
+
observed: "observed";
|
|
715
|
+
estimated: "estimated";
|
|
716
|
+
}>;
|
|
717
|
+
}, z.core.$strict>;
|
|
718
|
+
}, z.core.$strict>;
|
|
649
719
|
}, z.core.$strict>;
|
|
650
720
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodCustom<import("./agent-candidate.js").AgentCandidateJsonValue, import("./agent-candidate.js").AgentCandidateJsonValue>>>;
|
|
651
721
|
kind: z.ZodLiteral<"agent-profile-improvement-measured-comparison">;
|
|
@@ -654,9 +724,36 @@ export declare const agentProfileImprovementMeasuredComparisonSchema: z.ZodObjec
|
|
|
654
724
|
digestAlgorithm: z.ZodLiteral<"rfc8785-sha256">;
|
|
655
725
|
source: z.ZodObject<{
|
|
656
726
|
kind: z.ZodString;
|
|
657
|
-
sourceIdentity: z.ZodString
|
|
727
|
+
sourceIdentity: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
658
728
|
sourceDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
659
|
-
sourceRevision: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
729
|
+
sourceRevision: z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodNumber]>;
|
|
730
|
+
license: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
731
|
+
kind: z.ZodLiteral<"spdx">;
|
|
732
|
+
expression: z.ZodString;
|
|
733
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
734
|
+
kind: z.ZodLiteral<"custom">;
|
|
735
|
+
name: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
736
|
+
reference: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
737
|
+
termsDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
738
|
+
}, z.core.$strict>], "kind">>;
|
|
739
|
+
attribution: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
740
|
+
notices: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
741
|
+
transformations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
742
|
+
kind: z.ZodEnum<{
|
|
743
|
+
normalization: "normalization";
|
|
744
|
+
transformation: "transformation";
|
|
745
|
+
}>;
|
|
746
|
+
identity: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>;
|
|
747
|
+
revision: z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>, z.ZodNumber]>;
|
|
748
|
+
procedureDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
749
|
+
inputDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
750
|
+
outputDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
751
|
+
}, z.core.$strict>>>;
|
|
752
|
+
}, z.core.$strict>;
|
|
753
|
+
executionRef: z.ZodObject<{
|
|
754
|
+
identity: z.ZodString;
|
|
755
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
756
|
+
kind: z.ZodLiteral<"agent-profile-improvement-execution-ref">;
|
|
660
757
|
}, z.core.$strict>;
|
|
661
758
|
baseline: z.ZodObject<{
|
|
662
759
|
stateDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
@@ -809,6 +906,11 @@ export declare const agentProfileImprovementMeasuredComparisonSchema: z.ZodObjec
|
|
|
809
906
|
kind: z.ZodLiteral<"agent-profile-improvement-run">;
|
|
810
907
|
digestAlgorithm: z.ZodLiteral<"rfc8785-sha256">;
|
|
811
908
|
executionId: z.ZodString;
|
|
909
|
+
executionRef: z.ZodObject<{
|
|
910
|
+
identity: z.ZodString;
|
|
911
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
912
|
+
kind: z.ZodLiteral<"agent-profile-improvement-execution-ref">;
|
|
913
|
+
}, z.core.$strict>;
|
|
812
914
|
runCell: z.ZodObject<{
|
|
813
915
|
kind: z.ZodLiteral<"agent-profile-improvement-run-cell">;
|
|
814
916
|
experimentDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
@@ -875,6 +977,10 @@ export declare const agentProfileImprovementMeasuredComparisonSchema: z.ZodObjec
|
|
|
875
977
|
reasoningTokens: z.ZodNumber;
|
|
876
978
|
modelCalls: z.ZodNumber;
|
|
877
979
|
costUsdNanos: z.ZodNumber;
|
|
980
|
+
costProvenance: z.ZodEnum<{
|
|
981
|
+
observed: "observed";
|
|
982
|
+
estimated: "estimated";
|
|
983
|
+
}>;
|
|
878
984
|
}, z.core.$strict>;
|
|
879
985
|
trace: z.ZodObject<{
|
|
880
986
|
evidence: z.ZodObject<{
|
|
@@ -934,6 +1040,10 @@ export declare const agentProfileImprovementMeasuredComparisonSchema: z.ZodObjec
|
|
|
934
1040
|
reasoningTokens: z.ZodNumber;
|
|
935
1041
|
modelCalls: z.ZodNumber;
|
|
936
1042
|
costUsdNanos: z.ZodNumber;
|
|
1043
|
+
costProvenance: z.ZodEnum<{
|
|
1044
|
+
observed: "observed";
|
|
1045
|
+
estimated: "estimated";
|
|
1046
|
+
}>;
|
|
937
1047
|
}, z.core.$strict>;
|
|
938
1048
|
score: z.ZodNumber;
|
|
939
1049
|
passed: z.ZodBoolean;
|
|
@@ -948,6 +1058,11 @@ export declare const agentProfileImprovementMeasuredComparisonSchema: z.ZodObjec
|
|
|
948
1058
|
kind: z.ZodLiteral<"agent-profile-improvement-run">;
|
|
949
1059
|
digestAlgorithm: z.ZodLiteral<"rfc8785-sha256">;
|
|
950
1060
|
executionId: z.ZodString;
|
|
1061
|
+
executionRef: z.ZodObject<{
|
|
1062
|
+
identity: z.ZodString;
|
|
1063
|
+
digest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
1064
|
+
kind: z.ZodLiteral<"agent-profile-improvement-execution-ref">;
|
|
1065
|
+
}, z.core.$strict>;
|
|
951
1066
|
runCell: z.ZodObject<{
|
|
952
1067
|
kind: z.ZodLiteral<"agent-profile-improvement-run-cell">;
|
|
953
1068
|
experimentDigest: z.ZodType<`sha256:${string}`, unknown, z.core.$ZodTypeInternals<`sha256:${string}`, unknown>>;
|
|
@@ -1014,6 +1129,10 @@ export declare const agentProfileImprovementMeasuredComparisonSchema: z.ZodObjec
|
|
|
1014
1129
|
reasoningTokens: z.ZodNumber;
|
|
1015
1130
|
modelCalls: z.ZodNumber;
|
|
1016
1131
|
costUsdNanos: z.ZodNumber;
|
|
1132
|
+
costProvenance: z.ZodEnum<{
|
|
1133
|
+
observed: "observed";
|
|
1134
|
+
estimated: "estimated";
|
|
1135
|
+
}>;
|
|
1017
1136
|
}, z.core.$strict>;
|
|
1018
1137
|
trace: z.ZodObject<{
|
|
1019
1138
|
evidence: z.ZodObject<{
|
|
@@ -1073,6 +1192,10 @@ export declare const agentProfileImprovementMeasuredComparisonSchema: z.ZodObjec
|
|
|
1073
1192
|
reasoningTokens: z.ZodNumber;
|
|
1074
1193
|
modelCalls: z.ZodNumber;
|
|
1075
1194
|
costUsdNanos: z.ZodNumber;
|
|
1195
|
+
costProvenance: z.ZodEnum<{
|
|
1196
|
+
observed: "observed";
|
|
1197
|
+
estimated: "estimated";
|
|
1198
|
+
}>;
|
|
1076
1199
|
}, z.core.$strict>;
|
|
1077
1200
|
score: z.ZodNumber;
|
|
1078
1201
|
passed: z.ZodBoolean;
|
|
@@ -98,6 +98,11 @@ export const agentProfileImprovementArmSchema = z
|
|
|
98
98
|
stateDigest: sha256DigestSchema,
|
|
99
99
|
})
|
|
100
100
|
.strict();
|
|
101
|
+
export const agentProfileImprovementExecutionRefSchema = profileImprovementEvidenceSchema
|
|
102
|
+
.extend({
|
|
103
|
+
kind: z.literal("agent-profile-improvement-execution-ref"),
|
|
104
|
+
})
|
|
105
|
+
.strict();
|
|
101
106
|
/**
|
|
102
107
|
* The first product path changes only prompt and skills, but it uses the
|
|
103
108
|
* shared profile-diff language so execution and activation apply identical
|
|
@@ -176,6 +181,7 @@ export const agentProfileImprovementExperimentSchema = z
|
|
|
176
181
|
kind: z.literal("agent-profile-improvement-experiment"),
|
|
177
182
|
digestAlgorithm: z.literal("rfc8785-sha256"),
|
|
178
183
|
source: agentImprovementSourceSchema,
|
|
184
|
+
executionRef: agentProfileImprovementExecutionRefSchema,
|
|
179
185
|
baseline: agentProfileImprovementArmSchema,
|
|
180
186
|
candidate: agentProfileImprovementArmSchema,
|
|
181
187
|
change: agentProfileImprovementChangeSchema,
|
|
@@ -305,6 +311,7 @@ export const agentProfileImprovementRunReceiptSchema = z
|
|
|
305
311
|
kind: z.literal("agent-profile-improvement-run"),
|
|
306
312
|
digestAlgorithm: z.literal("rfc8785-sha256"),
|
|
307
313
|
executionId: z.string().min(1).max(500),
|
|
314
|
+
executionRef: agentProfileImprovementExecutionRefSchema,
|
|
308
315
|
runCell: agentProfileImprovementRunCellSchema,
|
|
309
316
|
runRecord: profileImprovementEvidenceSchema,
|
|
310
317
|
billing: z
|
|
@@ -362,7 +369,7 @@ export const agentProfileImprovementRunReceiptSchema = z
|
|
|
362
369
|
refineAgentExecutionWithinLimits(receipt.limits, {
|
|
363
370
|
durationMs: receipt.timing.durationMs,
|
|
364
371
|
steps: receipt.steps,
|
|
365
|
-
usage: receipt.usage,
|
|
372
|
+
usage: combinedProfileUsage(receipt.usage, receipt.grading.usage),
|
|
366
373
|
}, ctx);
|
|
367
374
|
const billing = receipt.billing.map(evidenceKey);
|
|
368
375
|
if (new Set(billing).size !== billing.length) {
|
|
@@ -380,6 +387,19 @@ export const agentProfileImprovementRunReceiptSchema = z
|
|
|
380
387
|
});
|
|
381
388
|
}
|
|
382
389
|
});
|
|
390
|
+
function combinedProfileUsage(execution, grading) {
|
|
391
|
+
return {
|
|
392
|
+
inputTokens: execution.inputTokens + grading.inputTokens,
|
|
393
|
+
outputTokens: execution.outputTokens + grading.outputTokens,
|
|
394
|
+
cachedInputTokens: execution.cachedInputTokens + grading.cachedInputTokens,
|
|
395
|
+
reasoningTokens: execution.reasoningTokens + grading.reasoningTokens,
|
|
396
|
+
modelCalls: execution.modelCalls + grading.modelCalls,
|
|
397
|
+
costUsdNanos: execution.costUsdNanos + grading.costUsdNanos,
|
|
398
|
+
costProvenance: execution.costProvenance === "observed" && grading.costProvenance === "observed"
|
|
399
|
+
? "observed"
|
|
400
|
+
: "estimated",
|
|
401
|
+
};
|
|
402
|
+
}
|
|
383
403
|
const agentProfileImprovementMeasurementSchema = z
|
|
384
404
|
.object({
|
|
385
405
|
baseline: agentProfileImprovementRunReceiptSchema,
|
|
@@ -455,6 +475,11 @@ function refineProfileImprovementComparison(comparison, ctx) {
|
|
|
455
475
|
[...armPath, "runCell", "experimentDigest"],
|
|
456
476
|
"profile run receipt must bind the measured experiment",
|
|
457
477
|
],
|
|
478
|
+
[
|
|
479
|
+
JSON.stringify(receipt.executionRef) === JSON.stringify(comparison.experiment.executionRef),
|
|
480
|
+
[...armPath, "executionRef"],
|
|
481
|
+
"profile run receipt must bind the measured executor",
|
|
482
|
+
],
|
|
458
483
|
[
|
|
459
484
|
cell.arm === arm,
|
|
460
485
|
[...armPath, "runCell", "arm"],
|
|
@@ -537,6 +562,7 @@ function refineProfileImprovementComparison(comparison, ctx) {
|
|
|
537
562
|
score: (receipt) => receipt.grading.score,
|
|
538
563
|
dimension: (receipt, name) => receipt.grading.dimensions.find((dimension) => dimension.name === name)?.score,
|
|
539
564
|
cost: profileImprovementExecutionCostUsd,
|
|
565
|
+
costProvenance: profileImprovementExecutionCostProvenance,
|
|
540
566
|
latency: profileImprovementExecutionLatencyMs,
|
|
541
567
|
}, ctx);
|
|
542
568
|
if (!isCanonicalJsonValue(comparison)) {
|
|
@@ -555,6 +581,12 @@ function evidenceKey(evidence) {
|
|
|
555
581
|
function profileImprovementExecutionCostUsd(receipt) {
|
|
556
582
|
return (receipt.usage.costUsdNanos + receipt.grading.usage.costUsdNanos) / 1_000_000_000;
|
|
557
583
|
}
|
|
584
|
+
function profileImprovementExecutionCostProvenance(receipt) {
|
|
585
|
+
return receipt.usage.costProvenance === "observed" &&
|
|
586
|
+
receipt.grading.usage.costProvenance === "observed"
|
|
587
|
+
? "observed"
|
|
588
|
+
: "estimated";
|
|
589
|
+
}
|
|
558
590
|
function profileImprovementExecutionLatencyMs(receipt) {
|
|
559
591
|
return receipt.timing.durationMs + receipt.grading.timing.durationMs;
|
|
560
592
|
}
|
|
@@ -44,6 +44,10 @@ export interface AgentProfileImprovementSuiteInputs {
|
|
|
44
44
|
export interface AgentProfileImprovementArm {
|
|
45
45
|
stateDigest: Sha256Digest;
|
|
46
46
|
}
|
|
47
|
+
/** Exact non-secret identity of the runner that measured and can activate a profile change. */
|
|
48
|
+
export interface AgentProfileImprovementExecutionRef extends AgentProfileImprovementEvidence {
|
|
49
|
+
kind: "agent-profile-improvement-execution-ref";
|
|
50
|
+
}
|
|
47
51
|
/**
|
|
48
52
|
* Ordered portable profile patches retained for review and activation.
|
|
49
53
|
*
|
|
@@ -58,6 +62,7 @@ export interface AgentProfileImprovementExperimentMaterial {
|
|
|
58
62
|
kind: "agent-profile-improvement-experiment";
|
|
59
63
|
digestAlgorithm: AgentCandidateDigestAlgorithm;
|
|
60
64
|
source: AgentImprovementSource;
|
|
65
|
+
executionRef: AgentProfileImprovementExecutionRef;
|
|
61
66
|
baseline: AgentProfileImprovementArm;
|
|
62
67
|
candidate: AgentProfileImprovementArm;
|
|
63
68
|
change: AgentProfileImprovementChange;
|
|
@@ -89,6 +94,7 @@ export interface AgentProfileImprovementRunReceipt {
|
|
|
89
94
|
kind: "agent-profile-improvement-run";
|
|
90
95
|
digestAlgorithm: AgentCandidateDigestAlgorithm;
|
|
91
96
|
executionId: string;
|
|
97
|
+
executionRef: AgentProfileImprovementExecutionRef;
|
|
92
98
|
runCell: AgentProfileImprovementRunCell;
|
|
93
99
|
runRecord: AgentProfileImprovementEvidence;
|
|
94
100
|
billing: [AgentProfileImprovementEvidence, ...AgentProfileImprovementEvidence[]];
|
package/dist/index.d.ts
CHANGED
|
@@ -615,6 +615,7 @@ export * from "./agent-candidate.js";
|
|
|
615
615
|
export * from "./agent-candidate-schema.js";
|
|
616
616
|
export type { Sha256Digest } from "./agent-candidate.js";
|
|
617
617
|
export { canonicalCandidateBytes, canonicalCandidateDigest, canonicalCandidateJson, sha256Bytes, sha256DigestSchema, sha256Utf8, } from "./agent-candidate-schema-common.js";
|
|
618
|
+
export { numbersApproximatelyEqual } from "./number-validation.js";
|
|
618
619
|
export * from "./agent-candidate-promotion-schema.js";
|
|
619
620
|
export { agentCandidateEvaluationPolicySchema } from "./agent-improvement-measurement-schema.js";
|
|
620
621
|
export * from "./agent-improvement-source.js";
|
package/dist/index.js
CHANGED
|
@@ -127,6 +127,7 @@ export * from "./interaction.js";
|
|
|
127
127
|
export * from "./agent-candidate.js";
|
|
128
128
|
export * from "./agent-candidate-schema.js";
|
|
129
129
|
export { canonicalCandidateBytes, canonicalCandidateDigest, canonicalCandidateJson, sha256Bytes, sha256DigestSchema, sha256Utf8, } from "./agent-candidate-schema-common.js";
|
|
130
|
+
export { numbersApproximatelyEqual } from "./number-validation.js";
|
|
130
131
|
export * from "./agent-candidate-promotion-schema.js";
|
|
131
132
|
export { agentCandidateEvaluationPolicySchema } from "./agent-improvement-measurement-schema.js";
|
|
132
133
|
export * from "./agent-improvement-source.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-interface",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,10 +34,12 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@noble/hashes": "1.8.0",
|
|
37
|
+
"spdx-expression-parse": "5.0.0",
|
|
37
38
|
"zod": "4.4.3"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@types/node": "25.6.0",
|
|
42
|
+
"@types/spdx-expression-parse": "4.0.0",
|
|
41
43
|
"typescript": "^6.0.3",
|
|
42
44
|
"vitest": "^4.1.5"
|
|
43
45
|
},
|