@agent-receipts/schema 0.3.3 → 0.5.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 +1 -1
- package/dist/index.d.mts +352 -2
- package/dist/index.d.ts +352 -2
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/receipt.schema.json +57 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @agent-receipts/schema
|
|
2
2
|
|
|
3
|
-
Zod schemas and TypeScript types for the
|
|
3
|
+
Zod schemas and TypeScript types for the Agent Receipts protocol — receipts, memory entities, observations, relationships, bundles, constraints, and judgments. Single source of truth for all data shapes.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
package/dist/index.d.mts
CHANGED
|
@@ -55,10 +55,55 @@ declare const SignablePayload: z.ZodObject<{
|
|
|
55
55
|
environment: "development" | "production" | "staging" | "test";
|
|
56
56
|
}>;
|
|
57
57
|
type SignablePayload = z.infer<typeof SignablePayload>;
|
|
58
|
+
/**
|
|
59
|
+
* One file touched by a job, recorded by the harness (never by the agent).
|
|
60
|
+
*/
|
|
61
|
+
declare const FileManifestEntry: z.ZodObject<{
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
sha256: z.ZodString;
|
|
64
|
+
bytes: z.ZodNumber;
|
|
65
|
+
role: z.ZodEnum<["input", "output"]>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
name: string;
|
|
68
|
+
sha256: string;
|
|
69
|
+
bytes: number;
|
|
70
|
+
role: "input" | "output";
|
|
71
|
+
}, {
|
|
72
|
+
name: string;
|
|
73
|
+
sha256: string;
|
|
74
|
+
bytes: number;
|
|
75
|
+
role: "input" | "output";
|
|
76
|
+
}>;
|
|
77
|
+
type FileManifestEntry = z.infer<typeof FileManifestEntry>;
|
|
58
78
|
/**
|
|
59
79
|
* The complete receipt object as returned by the API.
|
|
80
|
+
*
|
|
81
|
+
* Signature versions:
|
|
82
|
+
* - v1 (sig_version absent): only the 12 SignablePayload fields are signed.
|
|
83
|
+
* - v2 (sig_version = 2): every field except `signature` and `verify_url` is
|
|
84
|
+
* signed, using deep canonical JSON. Summary, cost, model, metadata, files
|
|
85
|
+
* and the chain link are all covered.
|
|
60
86
|
*/
|
|
61
87
|
declare const ActionReceipt: z.ZodObject<{
|
|
88
|
+
sig_version: z.ZodOptional<z.ZodLiteral<2>>;
|
|
89
|
+
key_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
+
prev_receipt_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
files: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
sha256: z.ZodString;
|
|
94
|
+
bytes: z.ZodNumber;
|
|
95
|
+
role: z.ZodEnum<["input", "output"]>;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
name: string;
|
|
98
|
+
sha256: string;
|
|
99
|
+
bytes: number;
|
|
100
|
+
role: "input" | "output";
|
|
101
|
+
}, {
|
|
102
|
+
name: string;
|
|
103
|
+
sha256: string;
|
|
104
|
+
bytes: number;
|
|
105
|
+
role: "input" | "output";
|
|
106
|
+
}>, "many">>>;
|
|
62
107
|
receipt_id: z.ZodString;
|
|
63
108
|
parent_receipt_id: z.ZodNullable<z.ZodString>;
|
|
64
109
|
chain_id: z.ZodString;
|
|
@@ -118,6 +163,15 @@ declare const ActionReceipt: z.ZodObject<{
|
|
|
118
163
|
callback_verified: boolean | null;
|
|
119
164
|
confidence: number | null;
|
|
120
165
|
metadata: Record<string, unknown>;
|
|
166
|
+
sig_version?: 2 | undefined;
|
|
167
|
+
key_id?: string | null | undefined;
|
|
168
|
+
prev_receipt_hash?: string | null | undefined;
|
|
169
|
+
files?: {
|
|
170
|
+
name: string;
|
|
171
|
+
sha256: string;
|
|
172
|
+
bytes: number;
|
|
173
|
+
role: "input" | "output";
|
|
174
|
+
}[] | null | undefined;
|
|
121
175
|
}, {
|
|
122
176
|
status: "pending" | "completed" | "failed" | "timeout";
|
|
123
177
|
action: string;
|
|
@@ -148,6 +202,15 @@ declare const ActionReceipt: z.ZodObject<{
|
|
|
148
202
|
callback_verified: boolean | null;
|
|
149
203
|
confidence: number | null;
|
|
150
204
|
metadata: Record<string, unknown>;
|
|
205
|
+
sig_version?: 2 | undefined;
|
|
206
|
+
key_id?: string | null | undefined;
|
|
207
|
+
prev_receipt_hash?: string | null | undefined;
|
|
208
|
+
files?: {
|
|
209
|
+
name: string;
|
|
210
|
+
sha256: string;
|
|
211
|
+
bytes: number;
|
|
212
|
+
role: "input" | "output";
|
|
213
|
+
}[] | null | undefined;
|
|
151
214
|
}>;
|
|
152
215
|
type ActionReceipt = z.infer<typeof ActionReceipt>;
|
|
153
216
|
|
|
@@ -828,8 +891,8 @@ declare const Entity: z.ZodObject<{
|
|
|
828
891
|
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
829
892
|
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
830
893
|
}, "strip", z.ZodTypeAny, {
|
|
831
|
-
metadata: Record<string, unknown>;
|
|
832
894
|
name: string;
|
|
895
|
+
metadata: Record<string, unknown>;
|
|
833
896
|
entity_id: string;
|
|
834
897
|
forgotten_at: string | null;
|
|
835
898
|
created_at: string;
|
|
@@ -919,6 +982,293 @@ declare const MemoryQuery: z.ZodObject<{
|
|
|
919
982
|
include_forgotten?: boolean | undefined;
|
|
920
983
|
}>;
|
|
921
984
|
type MemoryQuery = z.infer<typeof MemoryQuery>;
|
|
985
|
+
declare const MemoryBundle: z.ZodObject<{
|
|
986
|
+
bundle_id: z.ZodString;
|
|
987
|
+
bundle_version: z.ZodLiteral<"1.0">;
|
|
988
|
+
created_at: z.ZodString;
|
|
989
|
+
created_by_agent: z.ZodString;
|
|
990
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
991
|
+
public_key: z.ZodString;
|
|
992
|
+
entities: z.ZodArray<z.ZodObject<{
|
|
993
|
+
entity_id: z.ZodString;
|
|
994
|
+
entity_type: z.ZodEnum<["person", "project", "organization", "preference", "fact", "context", "tool", "custom"]>;
|
|
995
|
+
name: z.ZodString;
|
|
996
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
997
|
+
scope: z.ZodDefault<z.ZodEnum<["agent", "user", "team", "global"]>>;
|
|
998
|
+
created_at: z.ZodString;
|
|
999
|
+
created_by_agent: z.ZodString;
|
|
1000
|
+
created_by_receipt: z.ZodString;
|
|
1001
|
+
forgotten_at: z.ZodNullable<z.ZodString>;
|
|
1002
|
+
merged_into: z.ZodNullable<z.ZodString>;
|
|
1003
|
+
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1004
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1005
|
+
}, "strip", z.ZodTypeAny, {
|
|
1006
|
+
name: string;
|
|
1007
|
+
metadata: Record<string, unknown>;
|
|
1008
|
+
entity_id: string;
|
|
1009
|
+
forgotten_at: string | null;
|
|
1010
|
+
created_at: string;
|
|
1011
|
+
entity_type: "custom" | "person" | "project" | "organization" | "preference" | "fact" | "context" | "tool";
|
|
1012
|
+
aliases: string[];
|
|
1013
|
+
scope: "agent" | "user" | "team" | "global";
|
|
1014
|
+
created_by_agent: string;
|
|
1015
|
+
created_by_receipt: string;
|
|
1016
|
+
merged_into: string | null;
|
|
1017
|
+
attributes: Record<string, unknown>;
|
|
1018
|
+
}, {
|
|
1019
|
+
name: string;
|
|
1020
|
+
entity_id: string;
|
|
1021
|
+
forgotten_at: string | null;
|
|
1022
|
+
created_at: string;
|
|
1023
|
+
entity_type: "custom" | "person" | "project" | "organization" | "preference" | "fact" | "context" | "tool";
|
|
1024
|
+
created_by_agent: string;
|
|
1025
|
+
created_by_receipt: string;
|
|
1026
|
+
merged_into: string | null;
|
|
1027
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1028
|
+
aliases?: string[] | undefined;
|
|
1029
|
+
scope?: "agent" | "user" | "team" | "global" | undefined;
|
|
1030
|
+
attributes?: Record<string, unknown> | undefined;
|
|
1031
|
+
}>, "many">;
|
|
1032
|
+
observations: z.ZodArray<z.ZodObject<{
|
|
1033
|
+
observation_id: z.ZodString;
|
|
1034
|
+
entity_id: z.ZodString;
|
|
1035
|
+
content: z.ZodString;
|
|
1036
|
+
confidence: z.ZodDefault<z.ZodEnum<["certain", "high", "medium", "low", "deprecated"]>>;
|
|
1037
|
+
source_receipt_id: z.ZodString;
|
|
1038
|
+
source_agent_id: z.ZodString;
|
|
1039
|
+
source_context: z.ZodNullable<z.ZodString>;
|
|
1040
|
+
observed_at: z.ZodString;
|
|
1041
|
+
forgotten_at: z.ZodNullable<z.ZodString>;
|
|
1042
|
+
forgotten_by: z.ZodNullable<z.ZodString>;
|
|
1043
|
+
superseded_by: z.ZodNullable<z.ZodString>;
|
|
1044
|
+
expires_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1045
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1046
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1047
|
+
}, "strip", z.ZodTypeAny, {
|
|
1048
|
+
tags: string[];
|
|
1049
|
+
confidence: "certain" | "high" | "medium" | "low" | "deprecated";
|
|
1050
|
+
metadata: Record<string, unknown>;
|
|
1051
|
+
observation_id: string;
|
|
1052
|
+
entity_id: string;
|
|
1053
|
+
content: string;
|
|
1054
|
+
source_receipt_id: string;
|
|
1055
|
+
source_agent_id: string;
|
|
1056
|
+
source_context: string | null;
|
|
1057
|
+
observed_at: string;
|
|
1058
|
+
forgotten_at: string | null;
|
|
1059
|
+
forgotten_by: string | null;
|
|
1060
|
+
superseded_by: string | null;
|
|
1061
|
+
expires_at: string | null;
|
|
1062
|
+
}, {
|
|
1063
|
+
observation_id: string;
|
|
1064
|
+
entity_id: string;
|
|
1065
|
+
content: string;
|
|
1066
|
+
source_receipt_id: string;
|
|
1067
|
+
source_agent_id: string;
|
|
1068
|
+
source_context: string | null;
|
|
1069
|
+
observed_at: string;
|
|
1070
|
+
forgotten_at: string | null;
|
|
1071
|
+
forgotten_by: string | null;
|
|
1072
|
+
superseded_by: string | null;
|
|
1073
|
+
tags?: string[] | undefined;
|
|
1074
|
+
confidence?: "certain" | "high" | "medium" | "low" | "deprecated" | undefined;
|
|
1075
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1076
|
+
expires_at?: string | null | undefined;
|
|
1077
|
+
}>, "many">;
|
|
1078
|
+
relationships: z.ZodArray<z.ZodObject<{
|
|
1079
|
+
relationship_id: z.ZodString;
|
|
1080
|
+
from_entity_id: z.ZodString;
|
|
1081
|
+
to_entity_id: z.ZodString;
|
|
1082
|
+
relationship_type: z.ZodString;
|
|
1083
|
+
strength: z.ZodDefault<z.ZodEnum<["certain", "high", "medium", "low", "deprecated"]>>;
|
|
1084
|
+
source_receipt_id: z.ZodString;
|
|
1085
|
+
created_at: z.ZodString;
|
|
1086
|
+
forgotten_at: z.ZodNullable<z.ZodString>;
|
|
1087
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1088
|
+
}, "strip", z.ZodTypeAny, {
|
|
1089
|
+
metadata: Record<string, unknown>;
|
|
1090
|
+
source_receipt_id: string;
|
|
1091
|
+
forgotten_at: string | null;
|
|
1092
|
+
relationship_id: string;
|
|
1093
|
+
from_entity_id: string;
|
|
1094
|
+
to_entity_id: string;
|
|
1095
|
+
relationship_type: string;
|
|
1096
|
+
strength: "certain" | "high" | "medium" | "low" | "deprecated";
|
|
1097
|
+
created_at: string;
|
|
1098
|
+
}, {
|
|
1099
|
+
source_receipt_id: string;
|
|
1100
|
+
forgotten_at: string | null;
|
|
1101
|
+
relationship_id: string;
|
|
1102
|
+
from_entity_id: string;
|
|
1103
|
+
to_entity_id: string;
|
|
1104
|
+
relationship_type: string;
|
|
1105
|
+
created_at: string;
|
|
1106
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1107
|
+
strength?: "certain" | "high" | "medium" | "low" | "deprecated" | undefined;
|
|
1108
|
+
}>, "many">;
|
|
1109
|
+
receipts: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
1110
|
+
checksum: z.ZodString;
|
|
1111
|
+
stats: z.ZodObject<{
|
|
1112
|
+
entity_count: z.ZodNumber;
|
|
1113
|
+
observation_count: z.ZodNumber;
|
|
1114
|
+
relationship_count: z.ZodNumber;
|
|
1115
|
+
receipt_count: z.ZodNumber;
|
|
1116
|
+
agents: z.ZodArray<z.ZodString, "many">;
|
|
1117
|
+
date_range: z.ZodObject<{
|
|
1118
|
+
earliest: z.ZodString;
|
|
1119
|
+
latest: z.ZodString;
|
|
1120
|
+
}, "strip", z.ZodTypeAny, {
|
|
1121
|
+
earliest: string;
|
|
1122
|
+
latest: string;
|
|
1123
|
+
}, {
|
|
1124
|
+
earliest: string;
|
|
1125
|
+
latest: string;
|
|
1126
|
+
}>;
|
|
1127
|
+
}, "strip", z.ZodTypeAny, {
|
|
1128
|
+
entity_count: number;
|
|
1129
|
+
observation_count: number;
|
|
1130
|
+
relationship_count: number;
|
|
1131
|
+
receipt_count: number;
|
|
1132
|
+
agents: string[];
|
|
1133
|
+
date_range: {
|
|
1134
|
+
earliest: string;
|
|
1135
|
+
latest: string;
|
|
1136
|
+
};
|
|
1137
|
+
}, {
|
|
1138
|
+
entity_count: number;
|
|
1139
|
+
observation_count: number;
|
|
1140
|
+
relationship_count: number;
|
|
1141
|
+
receipt_count: number;
|
|
1142
|
+
agents: string[];
|
|
1143
|
+
date_range: {
|
|
1144
|
+
earliest: string;
|
|
1145
|
+
latest: string;
|
|
1146
|
+
};
|
|
1147
|
+
}>;
|
|
1148
|
+
}, "strip", z.ZodTypeAny, {
|
|
1149
|
+
description: string | null;
|
|
1150
|
+
created_at: string;
|
|
1151
|
+
created_by_agent: string;
|
|
1152
|
+
bundle_id: string;
|
|
1153
|
+
bundle_version: "1.0";
|
|
1154
|
+
public_key: string;
|
|
1155
|
+
entities: {
|
|
1156
|
+
name: string;
|
|
1157
|
+
metadata: Record<string, unknown>;
|
|
1158
|
+
entity_id: string;
|
|
1159
|
+
forgotten_at: string | null;
|
|
1160
|
+
created_at: string;
|
|
1161
|
+
entity_type: "custom" | "person" | "project" | "organization" | "preference" | "fact" | "context" | "tool";
|
|
1162
|
+
aliases: string[];
|
|
1163
|
+
scope: "agent" | "user" | "team" | "global";
|
|
1164
|
+
created_by_agent: string;
|
|
1165
|
+
created_by_receipt: string;
|
|
1166
|
+
merged_into: string | null;
|
|
1167
|
+
attributes: Record<string, unknown>;
|
|
1168
|
+
}[];
|
|
1169
|
+
observations: {
|
|
1170
|
+
tags: string[];
|
|
1171
|
+
confidence: "certain" | "high" | "medium" | "low" | "deprecated";
|
|
1172
|
+
metadata: Record<string, unknown>;
|
|
1173
|
+
observation_id: string;
|
|
1174
|
+
entity_id: string;
|
|
1175
|
+
content: string;
|
|
1176
|
+
source_receipt_id: string;
|
|
1177
|
+
source_agent_id: string;
|
|
1178
|
+
source_context: string | null;
|
|
1179
|
+
observed_at: string;
|
|
1180
|
+
forgotten_at: string | null;
|
|
1181
|
+
forgotten_by: string | null;
|
|
1182
|
+
superseded_by: string | null;
|
|
1183
|
+
expires_at: string | null;
|
|
1184
|
+
}[];
|
|
1185
|
+
relationships: {
|
|
1186
|
+
metadata: Record<string, unknown>;
|
|
1187
|
+
source_receipt_id: string;
|
|
1188
|
+
forgotten_at: string | null;
|
|
1189
|
+
relationship_id: string;
|
|
1190
|
+
from_entity_id: string;
|
|
1191
|
+
to_entity_id: string;
|
|
1192
|
+
relationship_type: string;
|
|
1193
|
+
strength: "certain" | "high" | "medium" | "low" | "deprecated";
|
|
1194
|
+
created_at: string;
|
|
1195
|
+
}[];
|
|
1196
|
+
receipts: Record<string, unknown>[];
|
|
1197
|
+
checksum: string;
|
|
1198
|
+
stats: {
|
|
1199
|
+
entity_count: number;
|
|
1200
|
+
observation_count: number;
|
|
1201
|
+
relationship_count: number;
|
|
1202
|
+
receipt_count: number;
|
|
1203
|
+
agents: string[];
|
|
1204
|
+
date_range: {
|
|
1205
|
+
earliest: string;
|
|
1206
|
+
latest: string;
|
|
1207
|
+
};
|
|
1208
|
+
};
|
|
1209
|
+
}, {
|
|
1210
|
+
created_at: string;
|
|
1211
|
+
created_by_agent: string;
|
|
1212
|
+
bundle_id: string;
|
|
1213
|
+
bundle_version: "1.0";
|
|
1214
|
+
public_key: string;
|
|
1215
|
+
entities: {
|
|
1216
|
+
name: string;
|
|
1217
|
+
entity_id: string;
|
|
1218
|
+
forgotten_at: string | null;
|
|
1219
|
+
created_at: string;
|
|
1220
|
+
entity_type: "custom" | "person" | "project" | "organization" | "preference" | "fact" | "context" | "tool";
|
|
1221
|
+
created_by_agent: string;
|
|
1222
|
+
created_by_receipt: string;
|
|
1223
|
+
merged_into: string | null;
|
|
1224
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1225
|
+
aliases?: string[] | undefined;
|
|
1226
|
+
scope?: "agent" | "user" | "team" | "global" | undefined;
|
|
1227
|
+
attributes?: Record<string, unknown> | undefined;
|
|
1228
|
+
}[];
|
|
1229
|
+
observations: {
|
|
1230
|
+
observation_id: string;
|
|
1231
|
+
entity_id: string;
|
|
1232
|
+
content: string;
|
|
1233
|
+
source_receipt_id: string;
|
|
1234
|
+
source_agent_id: string;
|
|
1235
|
+
source_context: string | null;
|
|
1236
|
+
observed_at: string;
|
|
1237
|
+
forgotten_at: string | null;
|
|
1238
|
+
forgotten_by: string | null;
|
|
1239
|
+
superseded_by: string | null;
|
|
1240
|
+
tags?: string[] | undefined;
|
|
1241
|
+
confidence?: "certain" | "high" | "medium" | "low" | "deprecated" | undefined;
|
|
1242
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1243
|
+
expires_at?: string | null | undefined;
|
|
1244
|
+
}[];
|
|
1245
|
+
relationships: {
|
|
1246
|
+
source_receipt_id: string;
|
|
1247
|
+
forgotten_at: string | null;
|
|
1248
|
+
relationship_id: string;
|
|
1249
|
+
from_entity_id: string;
|
|
1250
|
+
to_entity_id: string;
|
|
1251
|
+
relationship_type: string;
|
|
1252
|
+
created_at: string;
|
|
1253
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1254
|
+
strength?: "certain" | "high" | "medium" | "low" | "deprecated" | undefined;
|
|
1255
|
+
}[];
|
|
1256
|
+
receipts: Record<string, unknown>[];
|
|
1257
|
+
checksum: string;
|
|
1258
|
+
stats: {
|
|
1259
|
+
entity_count: number;
|
|
1260
|
+
observation_count: number;
|
|
1261
|
+
relationship_count: number;
|
|
1262
|
+
receipt_count: number;
|
|
1263
|
+
agents: string[];
|
|
1264
|
+
date_range: {
|
|
1265
|
+
earliest: string;
|
|
1266
|
+
latest: string;
|
|
1267
|
+
};
|
|
1268
|
+
};
|
|
1269
|
+
description?: string | null | undefined;
|
|
1270
|
+
}>;
|
|
1271
|
+
type MemoryBundle = z.infer<typeof MemoryBundle>;
|
|
922
1272
|
|
|
923
1273
|
/**
|
|
924
1274
|
* Validate data against a Zod schema.
|
|
@@ -940,4 +1290,4 @@ declare function formatZodError(error: z.ZodError): string;
|
|
|
940
1290
|
*/
|
|
941
1291
|
declare function createErrorResponse(code: string, message: string, status: number): ErrorResponse;
|
|
942
1292
|
|
|
943
|
-
export { ActionReceipt, CompleteReceiptInput, ConfidenceLevel, ConstraintDefinition, ConstraintDefinitions, ConstraintResult, CreateReceiptInput, CriterionResult, Entity, EntityType, Environment, Environment as EnvironmentType, ErrorCode, ErrorCode as ErrorCodeType, ErrorResponse, JudgmentResult, ListReceiptsQuery, MemoryOperation, MemoryQuery, MemoryReceiptPayload, MemoryScope, Observation, PaginationMeta, ReceiptStatus, ReceiptStatus as ReceiptStatusType, ReceiptType, ReceiptType as ReceiptTypeType, Relationship, Rubric, RubricCriterion, SignablePayload, SingleConstraintResult, VerifyResponse, createErrorResponse, formatZodError, validate };
|
|
1293
|
+
export { ActionReceipt, CompleteReceiptInput, ConfidenceLevel, ConstraintDefinition, ConstraintDefinitions, ConstraintResult, CreateReceiptInput, CriterionResult, Entity, EntityType, Environment, Environment as EnvironmentType, ErrorCode, ErrorCode as ErrorCodeType, ErrorResponse, FileManifestEntry, JudgmentResult, ListReceiptsQuery, MemoryBundle, MemoryOperation, MemoryQuery, MemoryReceiptPayload, MemoryScope, Observation, PaginationMeta, ReceiptStatus, ReceiptStatus as ReceiptStatusType, ReceiptType, ReceiptType as ReceiptTypeType, Relationship, Rubric, RubricCriterion, SignablePayload, SingleConstraintResult, VerifyResponse, createErrorResponse, formatZodError, validate };
|
package/dist/index.d.ts
CHANGED
|
@@ -55,10 +55,55 @@ declare const SignablePayload: z.ZodObject<{
|
|
|
55
55
|
environment: "development" | "production" | "staging" | "test";
|
|
56
56
|
}>;
|
|
57
57
|
type SignablePayload = z.infer<typeof SignablePayload>;
|
|
58
|
+
/**
|
|
59
|
+
* One file touched by a job, recorded by the harness (never by the agent).
|
|
60
|
+
*/
|
|
61
|
+
declare const FileManifestEntry: z.ZodObject<{
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
sha256: z.ZodString;
|
|
64
|
+
bytes: z.ZodNumber;
|
|
65
|
+
role: z.ZodEnum<["input", "output"]>;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
name: string;
|
|
68
|
+
sha256: string;
|
|
69
|
+
bytes: number;
|
|
70
|
+
role: "input" | "output";
|
|
71
|
+
}, {
|
|
72
|
+
name: string;
|
|
73
|
+
sha256: string;
|
|
74
|
+
bytes: number;
|
|
75
|
+
role: "input" | "output";
|
|
76
|
+
}>;
|
|
77
|
+
type FileManifestEntry = z.infer<typeof FileManifestEntry>;
|
|
58
78
|
/**
|
|
59
79
|
* The complete receipt object as returned by the API.
|
|
80
|
+
*
|
|
81
|
+
* Signature versions:
|
|
82
|
+
* - v1 (sig_version absent): only the 12 SignablePayload fields are signed.
|
|
83
|
+
* - v2 (sig_version = 2): every field except `signature` and `verify_url` is
|
|
84
|
+
* signed, using deep canonical JSON. Summary, cost, model, metadata, files
|
|
85
|
+
* and the chain link are all covered.
|
|
60
86
|
*/
|
|
61
87
|
declare const ActionReceipt: z.ZodObject<{
|
|
88
|
+
sig_version: z.ZodOptional<z.ZodLiteral<2>>;
|
|
89
|
+
key_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
90
|
+
prev_receipt_hash: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
91
|
+
files: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
92
|
+
name: z.ZodString;
|
|
93
|
+
sha256: z.ZodString;
|
|
94
|
+
bytes: z.ZodNumber;
|
|
95
|
+
role: z.ZodEnum<["input", "output"]>;
|
|
96
|
+
}, "strip", z.ZodTypeAny, {
|
|
97
|
+
name: string;
|
|
98
|
+
sha256: string;
|
|
99
|
+
bytes: number;
|
|
100
|
+
role: "input" | "output";
|
|
101
|
+
}, {
|
|
102
|
+
name: string;
|
|
103
|
+
sha256: string;
|
|
104
|
+
bytes: number;
|
|
105
|
+
role: "input" | "output";
|
|
106
|
+
}>, "many">>>;
|
|
62
107
|
receipt_id: z.ZodString;
|
|
63
108
|
parent_receipt_id: z.ZodNullable<z.ZodString>;
|
|
64
109
|
chain_id: z.ZodString;
|
|
@@ -118,6 +163,15 @@ declare const ActionReceipt: z.ZodObject<{
|
|
|
118
163
|
callback_verified: boolean | null;
|
|
119
164
|
confidence: number | null;
|
|
120
165
|
metadata: Record<string, unknown>;
|
|
166
|
+
sig_version?: 2 | undefined;
|
|
167
|
+
key_id?: string | null | undefined;
|
|
168
|
+
prev_receipt_hash?: string | null | undefined;
|
|
169
|
+
files?: {
|
|
170
|
+
name: string;
|
|
171
|
+
sha256: string;
|
|
172
|
+
bytes: number;
|
|
173
|
+
role: "input" | "output";
|
|
174
|
+
}[] | null | undefined;
|
|
121
175
|
}, {
|
|
122
176
|
status: "pending" | "completed" | "failed" | "timeout";
|
|
123
177
|
action: string;
|
|
@@ -148,6 +202,15 @@ declare const ActionReceipt: z.ZodObject<{
|
|
|
148
202
|
callback_verified: boolean | null;
|
|
149
203
|
confidence: number | null;
|
|
150
204
|
metadata: Record<string, unknown>;
|
|
205
|
+
sig_version?: 2 | undefined;
|
|
206
|
+
key_id?: string | null | undefined;
|
|
207
|
+
prev_receipt_hash?: string | null | undefined;
|
|
208
|
+
files?: {
|
|
209
|
+
name: string;
|
|
210
|
+
sha256: string;
|
|
211
|
+
bytes: number;
|
|
212
|
+
role: "input" | "output";
|
|
213
|
+
}[] | null | undefined;
|
|
151
214
|
}>;
|
|
152
215
|
type ActionReceipt = z.infer<typeof ActionReceipt>;
|
|
153
216
|
|
|
@@ -828,8 +891,8 @@ declare const Entity: z.ZodObject<{
|
|
|
828
891
|
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
829
892
|
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
830
893
|
}, "strip", z.ZodTypeAny, {
|
|
831
|
-
metadata: Record<string, unknown>;
|
|
832
894
|
name: string;
|
|
895
|
+
metadata: Record<string, unknown>;
|
|
833
896
|
entity_id: string;
|
|
834
897
|
forgotten_at: string | null;
|
|
835
898
|
created_at: string;
|
|
@@ -919,6 +982,293 @@ declare const MemoryQuery: z.ZodObject<{
|
|
|
919
982
|
include_forgotten?: boolean | undefined;
|
|
920
983
|
}>;
|
|
921
984
|
type MemoryQuery = z.infer<typeof MemoryQuery>;
|
|
985
|
+
declare const MemoryBundle: z.ZodObject<{
|
|
986
|
+
bundle_id: z.ZodString;
|
|
987
|
+
bundle_version: z.ZodLiteral<"1.0">;
|
|
988
|
+
created_at: z.ZodString;
|
|
989
|
+
created_by_agent: z.ZodString;
|
|
990
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
991
|
+
public_key: z.ZodString;
|
|
992
|
+
entities: z.ZodArray<z.ZodObject<{
|
|
993
|
+
entity_id: z.ZodString;
|
|
994
|
+
entity_type: z.ZodEnum<["person", "project", "organization", "preference", "fact", "context", "tool", "custom"]>;
|
|
995
|
+
name: z.ZodString;
|
|
996
|
+
aliases: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
997
|
+
scope: z.ZodDefault<z.ZodEnum<["agent", "user", "team", "global"]>>;
|
|
998
|
+
created_at: z.ZodString;
|
|
999
|
+
created_by_agent: z.ZodString;
|
|
1000
|
+
created_by_receipt: z.ZodString;
|
|
1001
|
+
forgotten_at: z.ZodNullable<z.ZodString>;
|
|
1002
|
+
merged_into: z.ZodNullable<z.ZodString>;
|
|
1003
|
+
attributes: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1004
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1005
|
+
}, "strip", z.ZodTypeAny, {
|
|
1006
|
+
name: string;
|
|
1007
|
+
metadata: Record<string, unknown>;
|
|
1008
|
+
entity_id: string;
|
|
1009
|
+
forgotten_at: string | null;
|
|
1010
|
+
created_at: string;
|
|
1011
|
+
entity_type: "custom" | "person" | "project" | "organization" | "preference" | "fact" | "context" | "tool";
|
|
1012
|
+
aliases: string[];
|
|
1013
|
+
scope: "agent" | "user" | "team" | "global";
|
|
1014
|
+
created_by_agent: string;
|
|
1015
|
+
created_by_receipt: string;
|
|
1016
|
+
merged_into: string | null;
|
|
1017
|
+
attributes: Record<string, unknown>;
|
|
1018
|
+
}, {
|
|
1019
|
+
name: string;
|
|
1020
|
+
entity_id: string;
|
|
1021
|
+
forgotten_at: string | null;
|
|
1022
|
+
created_at: string;
|
|
1023
|
+
entity_type: "custom" | "person" | "project" | "organization" | "preference" | "fact" | "context" | "tool";
|
|
1024
|
+
created_by_agent: string;
|
|
1025
|
+
created_by_receipt: string;
|
|
1026
|
+
merged_into: string | null;
|
|
1027
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1028
|
+
aliases?: string[] | undefined;
|
|
1029
|
+
scope?: "agent" | "user" | "team" | "global" | undefined;
|
|
1030
|
+
attributes?: Record<string, unknown> | undefined;
|
|
1031
|
+
}>, "many">;
|
|
1032
|
+
observations: z.ZodArray<z.ZodObject<{
|
|
1033
|
+
observation_id: z.ZodString;
|
|
1034
|
+
entity_id: z.ZodString;
|
|
1035
|
+
content: z.ZodString;
|
|
1036
|
+
confidence: z.ZodDefault<z.ZodEnum<["certain", "high", "medium", "low", "deprecated"]>>;
|
|
1037
|
+
source_receipt_id: z.ZodString;
|
|
1038
|
+
source_agent_id: z.ZodString;
|
|
1039
|
+
source_context: z.ZodNullable<z.ZodString>;
|
|
1040
|
+
observed_at: z.ZodString;
|
|
1041
|
+
forgotten_at: z.ZodNullable<z.ZodString>;
|
|
1042
|
+
forgotten_by: z.ZodNullable<z.ZodString>;
|
|
1043
|
+
superseded_by: z.ZodNullable<z.ZodString>;
|
|
1044
|
+
expires_at: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
1045
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
1046
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1047
|
+
}, "strip", z.ZodTypeAny, {
|
|
1048
|
+
tags: string[];
|
|
1049
|
+
confidence: "certain" | "high" | "medium" | "low" | "deprecated";
|
|
1050
|
+
metadata: Record<string, unknown>;
|
|
1051
|
+
observation_id: string;
|
|
1052
|
+
entity_id: string;
|
|
1053
|
+
content: string;
|
|
1054
|
+
source_receipt_id: string;
|
|
1055
|
+
source_agent_id: string;
|
|
1056
|
+
source_context: string | null;
|
|
1057
|
+
observed_at: string;
|
|
1058
|
+
forgotten_at: string | null;
|
|
1059
|
+
forgotten_by: string | null;
|
|
1060
|
+
superseded_by: string | null;
|
|
1061
|
+
expires_at: string | null;
|
|
1062
|
+
}, {
|
|
1063
|
+
observation_id: string;
|
|
1064
|
+
entity_id: string;
|
|
1065
|
+
content: string;
|
|
1066
|
+
source_receipt_id: string;
|
|
1067
|
+
source_agent_id: string;
|
|
1068
|
+
source_context: string | null;
|
|
1069
|
+
observed_at: string;
|
|
1070
|
+
forgotten_at: string | null;
|
|
1071
|
+
forgotten_by: string | null;
|
|
1072
|
+
superseded_by: string | null;
|
|
1073
|
+
tags?: string[] | undefined;
|
|
1074
|
+
confidence?: "certain" | "high" | "medium" | "low" | "deprecated" | undefined;
|
|
1075
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1076
|
+
expires_at?: string | null | undefined;
|
|
1077
|
+
}>, "many">;
|
|
1078
|
+
relationships: z.ZodArray<z.ZodObject<{
|
|
1079
|
+
relationship_id: z.ZodString;
|
|
1080
|
+
from_entity_id: z.ZodString;
|
|
1081
|
+
to_entity_id: z.ZodString;
|
|
1082
|
+
relationship_type: z.ZodString;
|
|
1083
|
+
strength: z.ZodDefault<z.ZodEnum<["certain", "high", "medium", "low", "deprecated"]>>;
|
|
1084
|
+
source_receipt_id: z.ZodString;
|
|
1085
|
+
created_at: z.ZodString;
|
|
1086
|
+
forgotten_at: z.ZodNullable<z.ZodString>;
|
|
1087
|
+
metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1088
|
+
}, "strip", z.ZodTypeAny, {
|
|
1089
|
+
metadata: Record<string, unknown>;
|
|
1090
|
+
source_receipt_id: string;
|
|
1091
|
+
forgotten_at: string | null;
|
|
1092
|
+
relationship_id: string;
|
|
1093
|
+
from_entity_id: string;
|
|
1094
|
+
to_entity_id: string;
|
|
1095
|
+
relationship_type: string;
|
|
1096
|
+
strength: "certain" | "high" | "medium" | "low" | "deprecated";
|
|
1097
|
+
created_at: string;
|
|
1098
|
+
}, {
|
|
1099
|
+
source_receipt_id: string;
|
|
1100
|
+
forgotten_at: string | null;
|
|
1101
|
+
relationship_id: string;
|
|
1102
|
+
from_entity_id: string;
|
|
1103
|
+
to_entity_id: string;
|
|
1104
|
+
relationship_type: string;
|
|
1105
|
+
created_at: string;
|
|
1106
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1107
|
+
strength?: "certain" | "high" | "medium" | "low" | "deprecated" | undefined;
|
|
1108
|
+
}>, "many">;
|
|
1109
|
+
receipts: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">;
|
|
1110
|
+
checksum: z.ZodString;
|
|
1111
|
+
stats: z.ZodObject<{
|
|
1112
|
+
entity_count: z.ZodNumber;
|
|
1113
|
+
observation_count: z.ZodNumber;
|
|
1114
|
+
relationship_count: z.ZodNumber;
|
|
1115
|
+
receipt_count: z.ZodNumber;
|
|
1116
|
+
agents: z.ZodArray<z.ZodString, "many">;
|
|
1117
|
+
date_range: z.ZodObject<{
|
|
1118
|
+
earliest: z.ZodString;
|
|
1119
|
+
latest: z.ZodString;
|
|
1120
|
+
}, "strip", z.ZodTypeAny, {
|
|
1121
|
+
earliest: string;
|
|
1122
|
+
latest: string;
|
|
1123
|
+
}, {
|
|
1124
|
+
earliest: string;
|
|
1125
|
+
latest: string;
|
|
1126
|
+
}>;
|
|
1127
|
+
}, "strip", z.ZodTypeAny, {
|
|
1128
|
+
entity_count: number;
|
|
1129
|
+
observation_count: number;
|
|
1130
|
+
relationship_count: number;
|
|
1131
|
+
receipt_count: number;
|
|
1132
|
+
agents: string[];
|
|
1133
|
+
date_range: {
|
|
1134
|
+
earliest: string;
|
|
1135
|
+
latest: string;
|
|
1136
|
+
};
|
|
1137
|
+
}, {
|
|
1138
|
+
entity_count: number;
|
|
1139
|
+
observation_count: number;
|
|
1140
|
+
relationship_count: number;
|
|
1141
|
+
receipt_count: number;
|
|
1142
|
+
agents: string[];
|
|
1143
|
+
date_range: {
|
|
1144
|
+
earliest: string;
|
|
1145
|
+
latest: string;
|
|
1146
|
+
};
|
|
1147
|
+
}>;
|
|
1148
|
+
}, "strip", z.ZodTypeAny, {
|
|
1149
|
+
description: string | null;
|
|
1150
|
+
created_at: string;
|
|
1151
|
+
created_by_agent: string;
|
|
1152
|
+
bundle_id: string;
|
|
1153
|
+
bundle_version: "1.0";
|
|
1154
|
+
public_key: string;
|
|
1155
|
+
entities: {
|
|
1156
|
+
name: string;
|
|
1157
|
+
metadata: Record<string, unknown>;
|
|
1158
|
+
entity_id: string;
|
|
1159
|
+
forgotten_at: string | null;
|
|
1160
|
+
created_at: string;
|
|
1161
|
+
entity_type: "custom" | "person" | "project" | "organization" | "preference" | "fact" | "context" | "tool";
|
|
1162
|
+
aliases: string[];
|
|
1163
|
+
scope: "agent" | "user" | "team" | "global";
|
|
1164
|
+
created_by_agent: string;
|
|
1165
|
+
created_by_receipt: string;
|
|
1166
|
+
merged_into: string | null;
|
|
1167
|
+
attributes: Record<string, unknown>;
|
|
1168
|
+
}[];
|
|
1169
|
+
observations: {
|
|
1170
|
+
tags: string[];
|
|
1171
|
+
confidence: "certain" | "high" | "medium" | "low" | "deprecated";
|
|
1172
|
+
metadata: Record<string, unknown>;
|
|
1173
|
+
observation_id: string;
|
|
1174
|
+
entity_id: string;
|
|
1175
|
+
content: string;
|
|
1176
|
+
source_receipt_id: string;
|
|
1177
|
+
source_agent_id: string;
|
|
1178
|
+
source_context: string | null;
|
|
1179
|
+
observed_at: string;
|
|
1180
|
+
forgotten_at: string | null;
|
|
1181
|
+
forgotten_by: string | null;
|
|
1182
|
+
superseded_by: string | null;
|
|
1183
|
+
expires_at: string | null;
|
|
1184
|
+
}[];
|
|
1185
|
+
relationships: {
|
|
1186
|
+
metadata: Record<string, unknown>;
|
|
1187
|
+
source_receipt_id: string;
|
|
1188
|
+
forgotten_at: string | null;
|
|
1189
|
+
relationship_id: string;
|
|
1190
|
+
from_entity_id: string;
|
|
1191
|
+
to_entity_id: string;
|
|
1192
|
+
relationship_type: string;
|
|
1193
|
+
strength: "certain" | "high" | "medium" | "low" | "deprecated";
|
|
1194
|
+
created_at: string;
|
|
1195
|
+
}[];
|
|
1196
|
+
receipts: Record<string, unknown>[];
|
|
1197
|
+
checksum: string;
|
|
1198
|
+
stats: {
|
|
1199
|
+
entity_count: number;
|
|
1200
|
+
observation_count: number;
|
|
1201
|
+
relationship_count: number;
|
|
1202
|
+
receipt_count: number;
|
|
1203
|
+
agents: string[];
|
|
1204
|
+
date_range: {
|
|
1205
|
+
earliest: string;
|
|
1206
|
+
latest: string;
|
|
1207
|
+
};
|
|
1208
|
+
};
|
|
1209
|
+
}, {
|
|
1210
|
+
created_at: string;
|
|
1211
|
+
created_by_agent: string;
|
|
1212
|
+
bundle_id: string;
|
|
1213
|
+
bundle_version: "1.0";
|
|
1214
|
+
public_key: string;
|
|
1215
|
+
entities: {
|
|
1216
|
+
name: string;
|
|
1217
|
+
entity_id: string;
|
|
1218
|
+
forgotten_at: string | null;
|
|
1219
|
+
created_at: string;
|
|
1220
|
+
entity_type: "custom" | "person" | "project" | "organization" | "preference" | "fact" | "context" | "tool";
|
|
1221
|
+
created_by_agent: string;
|
|
1222
|
+
created_by_receipt: string;
|
|
1223
|
+
merged_into: string | null;
|
|
1224
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1225
|
+
aliases?: string[] | undefined;
|
|
1226
|
+
scope?: "agent" | "user" | "team" | "global" | undefined;
|
|
1227
|
+
attributes?: Record<string, unknown> | undefined;
|
|
1228
|
+
}[];
|
|
1229
|
+
observations: {
|
|
1230
|
+
observation_id: string;
|
|
1231
|
+
entity_id: string;
|
|
1232
|
+
content: string;
|
|
1233
|
+
source_receipt_id: string;
|
|
1234
|
+
source_agent_id: string;
|
|
1235
|
+
source_context: string | null;
|
|
1236
|
+
observed_at: string;
|
|
1237
|
+
forgotten_at: string | null;
|
|
1238
|
+
forgotten_by: string | null;
|
|
1239
|
+
superseded_by: string | null;
|
|
1240
|
+
tags?: string[] | undefined;
|
|
1241
|
+
confidence?: "certain" | "high" | "medium" | "low" | "deprecated" | undefined;
|
|
1242
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1243
|
+
expires_at?: string | null | undefined;
|
|
1244
|
+
}[];
|
|
1245
|
+
relationships: {
|
|
1246
|
+
source_receipt_id: string;
|
|
1247
|
+
forgotten_at: string | null;
|
|
1248
|
+
relationship_id: string;
|
|
1249
|
+
from_entity_id: string;
|
|
1250
|
+
to_entity_id: string;
|
|
1251
|
+
relationship_type: string;
|
|
1252
|
+
created_at: string;
|
|
1253
|
+
metadata?: Record<string, unknown> | undefined;
|
|
1254
|
+
strength?: "certain" | "high" | "medium" | "low" | "deprecated" | undefined;
|
|
1255
|
+
}[];
|
|
1256
|
+
receipts: Record<string, unknown>[];
|
|
1257
|
+
checksum: string;
|
|
1258
|
+
stats: {
|
|
1259
|
+
entity_count: number;
|
|
1260
|
+
observation_count: number;
|
|
1261
|
+
relationship_count: number;
|
|
1262
|
+
receipt_count: number;
|
|
1263
|
+
agents: string[];
|
|
1264
|
+
date_range: {
|
|
1265
|
+
earliest: string;
|
|
1266
|
+
latest: string;
|
|
1267
|
+
};
|
|
1268
|
+
};
|
|
1269
|
+
description?: string | null | undefined;
|
|
1270
|
+
}>;
|
|
1271
|
+
type MemoryBundle = z.infer<typeof MemoryBundle>;
|
|
922
1272
|
|
|
923
1273
|
/**
|
|
924
1274
|
* Validate data against a Zod schema.
|
|
@@ -940,4 +1290,4 @@ declare function formatZodError(error: z.ZodError): string;
|
|
|
940
1290
|
*/
|
|
941
1291
|
declare function createErrorResponse(code: string, message: string, status: number): ErrorResponse;
|
|
942
1292
|
|
|
943
|
-
export { ActionReceipt, CompleteReceiptInput, ConfidenceLevel, ConstraintDefinition, ConstraintDefinitions, ConstraintResult, CreateReceiptInput, CriterionResult, Entity, EntityType, Environment, Environment as EnvironmentType, ErrorCode, ErrorCode as ErrorCodeType, ErrorResponse, JudgmentResult, ListReceiptsQuery, MemoryOperation, MemoryQuery, MemoryReceiptPayload, MemoryScope, Observation, PaginationMeta, ReceiptStatus, ReceiptStatus as ReceiptStatusType, ReceiptType, ReceiptType as ReceiptTypeType, Relationship, Rubric, RubricCriterion, SignablePayload, SingleConstraintResult, VerifyResponse, createErrorResponse, formatZodError, validate };
|
|
1293
|
+
export { ActionReceipt, CompleteReceiptInput, ConfidenceLevel, ConstraintDefinition, ConstraintDefinitions, ConstraintResult, CreateReceiptInput, CriterionResult, Entity, EntityType, Environment, Environment as EnvironmentType, ErrorCode, ErrorCode as ErrorCodeType, ErrorResponse, FileManifestEntry, JudgmentResult, ListReceiptsQuery, MemoryBundle, MemoryOperation, MemoryQuery, MemoryReceiptPayload, MemoryScope, Observation, PaginationMeta, ReceiptStatus, ReceiptStatus as ReceiptStatusType, ReceiptType, ReceiptType as ReceiptTypeType, Relationship, Rubric, RubricCriterion, SignablePayload, SingleConstraintResult, VerifyResponse, createErrorResponse, formatZodError, validate };
|
package/dist/index.js
CHANGED
|
@@ -33,8 +33,10 @@ __export(index_exports, {
|
|
|
33
33
|
Environment: () => Environment,
|
|
34
34
|
ErrorCode: () => ErrorCode,
|
|
35
35
|
ErrorResponse: () => ErrorResponse,
|
|
36
|
+
FileManifestEntry: () => FileManifestEntry,
|
|
36
37
|
JudgmentResult: () => JudgmentResult,
|
|
37
38
|
ListReceiptsQuery: () => ListReceiptsQuery,
|
|
39
|
+
MemoryBundle: () => MemoryBundle,
|
|
38
40
|
MemoryOperation: () => MemoryOperation,
|
|
39
41
|
MemoryQuery: () => MemoryQuery,
|
|
40
42
|
MemoryReceiptPayload: () => MemoryReceiptPayload,
|
|
@@ -90,7 +92,21 @@ var SignablePayload = import_zod2.z.object({
|
|
|
90
92
|
completed_at: import_zod2.z.string().datetime().nullable(),
|
|
91
93
|
environment: Environment
|
|
92
94
|
});
|
|
95
|
+
var FileManifestEntry = import_zod2.z.object({
|
|
96
|
+
name: import_zod2.z.string().min(1),
|
|
97
|
+
sha256: import_zod2.z.string().regex(/^sha256:[0-9a-f]{64}$/),
|
|
98
|
+
bytes: import_zod2.z.number().int().nonnegative(),
|
|
99
|
+
role: import_zod2.z.enum(["input", "output"])
|
|
100
|
+
});
|
|
93
101
|
var ActionReceipt = import_zod2.z.object({
|
|
102
|
+
// Signature format (absent = legacy v1)
|
|
103
|
+
sig_version: import_zod2.z.literal(2).optional(),
|
|
104
|
+
// First 16 hex chars of sha256(public key) — names the key that signed it
|
|
105
|
+
key_id: import_zod2.z.string().nullable().optional(),
|
|
106
|
+
// sha256 of the previous finalized receipt in the same chain (null = first)
|
|
107
|
+
prev_receipt_hash: import_zod2.z.string().nullable().optional(),
|
|
108
|
+
// Files the harness hashed for this action
|
|
109
|
+
files: import_zod2.z.array(FileManifestEntry).nullable().optional(),
|
|
94
110
|
// Identity
|
|
95
111
|
receipt_id: import_zod2.z.string(),
|
|
96
112
|
parent_receipt_id: import_zod2.z.string().nullable(),
|
|
@@ -376,6 +392,30 @@ var MemoryQuery = import_zod6.z.object({
|
|
|
376
392
|
limit: import_zod6.z.number().int().min(1).max(100).default(20),
|
|
377
393
|
page: import_zod6.z.number().int().min(1).default(1)
|
|
378
394
|
});
|
|
395
|
+
var MemoryBundle = import_zod6.z.object({
|
|
396
|
+
bundle_id: import_zod6.z.string(),
|
|
397
|
+
bundle_version: import_zod6.z.literal("1.0"),
|
|
398
|
+
created_at: import_zod6.z.string().datetime(),
|
|
399
|
+
created_by_agent: import_zod6.z.string(),
|
|
400
|
+
description: import_zod6.z.string().nullable().default(null),
|
|
401
|
+
public_key: import_zod6.z.string(),
|
|
402
|
+
entities: import_zod6.z.array(Entity),
|
|
403
|
+
observations: import_zod6.z.array(Observation),
|
|
404
|
+
relationships: import_zod6.z.array(Relationship),
|
|
405
|
+
receipts: import_zod6.z.array(import_zod6.z.record(import_zod6.z.unknown())),
|
|
406
|
+
checksum: import_zod6.z.string(),
|
|
407
|
+
stats: import_zod6.z.object({
|
|
408
|
+
entity_count: import_zod6.z.number().int(),
|
|
409
|
+
observation_count: import_zod6.z.number().int(),
|
|
410
|
+
relationship_count: import_zod6.z.number().int(),
|
|
411
|
+
receipt_count: import_zod6.z.number().int(),
|
|
412
|
+
agents: import_zod6.z.array(import_zod6.z.string()),
|
|
413
|
+
date_range: import_zod6.z.object({
|
|
414
|
+
earliest: import_zod6.z.string().datetime(),
|
|
415
|
+
latest: import_zod6.z.string().datetime()
|
|
416
|
+
})
|
|
417
|
+
})
|
|
418
|
+
});
|
|
379
419
|
|
|
380
420
|
// src/validation.ts
|
|
381
421
|
function validate(schema, data) {
|
|
@@ -422,8 +462,10 @@ function createErrorResponse(code, message, status) {
|
|
|
422
462
|
Environment,
|
|
423
463
|
ErrorCode,
|
|
424
464
|
ErrorResponse,
|
|
465
|
+
FileManifestEntry,
|
|
425
466
|
JudgmentResult,
|
|
426
467
|
ListReceiptsQuery,
|
|
468
|
+
MemoryBundle,
|
|
427
469
|
MemoryOperation,
|
|
428
470
|
MemoryQuery,
|
|
429
471
|
MemoryReceiptPayload,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/enums.ts","../src/receipt.ts","../src/constraints.ts","../src/rubric.ts","../src/api.ts","../src/memory.ts","../src/validation.ts"],"sourcesContent":["// Enums\nexport { ReceiptStatus, ReceiptType, Environment, ErrorCode } from './enums'\n\n// Receipt schemas + types\nexport { SignablePayload, ActionReceipt } from './receipt'\n\n// Constraint schemas + types\nexport {\n ConstraintDefinition,\n SingleConstraintResult,\n ConstraintResult,\n ConstraintDefinitions,\n} from './constraints'\n\n// Rubric schemas + types\nexport {\n RubricCriterion,\n Rubric,\n CriterionResult,\n JudgmentResult,\n} from './rubric'\n\n// API schemas + types\nexport {\n CreateReceiptInput,\n CompleteReceiptInput,\n VerifyResponse,\n ListReceiptsQuery,\n PaginationMeta,\n ErrorResponse,\n} from './api'\n\n// Memory schemas + types\nexport {\n EntityType,\n MemoryOperation,\n MemoryScope,\n ConfidenceLevel,\n Observation,\n Relationship,\n Entity,\n MemoryReceiptPayload,\n MemoryQuery,\n} from './memory'\n\n// Validation utilities\nexport { validate, formatZodError, createErrorResponse } from './validation'\n\n// Re-export types explicitly for consumers who import types only\nexport type {\n ReceiptStatus as ReceiptStatusType,\n ReceiptType as ReceiptTypeType,\n Environment as EnvironmentType,\n ErrorCode as ErrorCodeType,\n} from './enums'\n","import { z } from 'zod'\n\nexport const ReceiptStatus = z.enum(['pending', 'completed', 'failed', 'timeout'])\nexport type ReceiptStatus = z.infer<typeof ReceiptStatus>\n\nexport const ReceiptType = z.enum(['action', 'verification', 'judgment', 'arbitration', 'memory'])\nexport type ReceiptType = z.infer<typeof ReceiptType>\n\nexport const Environment = z.enum(['development', 'production', 'staging', 'test'])\nexport type Environment = z.infer<typeof Environment>\n\nexport const ErrorCode = z.enum([\n 'UNAUTHORIZED',\n 'KEY_REVOKED',\n 'FORBIDDEN',\n 'RECEIPT_NOT_FOUND',\n 'CHAIN_NOT_FOUND',\n 'AGENT_NOT_FOUND',\n 'RECEIPT_NOT_PENDING',\n 'RECEIPT_IMMUTABLE',\n 'RATE_LIMIT_EXCEEDED',\n 'VALIDATION_ERROR',\n 'INTERNAL_ERROR',\n])\nexport type ErrorCode = z.infer<typeof ErrorCode>\n","import { z } from 'zod'\nimport { ReceiptStatus, ReceiptType, Environment } from './enums'\n\n/**\n * The 12 fields that are cryptographically signed.\n * These fields are extracted from a receipt and serialized as canonical JSON\n * before signing with Ed25519.\n */\nexport const SignablePayload = z.object({\n receipt_id: z.string(),\n chain_id: z.string(),\n receipt_type: ReceiptType,\n agent_id: z.string(),\n org_id: z.string(),\n action: z.string(),\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n status: ReceiptStatus,\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n environment: Environment,\n})\nexport type SignablePayload = z.infer<typeof SignablePayload>\n\n/**\n * The complete receipt object as returned by the API.\n */\nexport const ActionReceipt = z.object({\n // Identity\n receipt_id: z.string(),\n parent_receipt_id: z.string().nullable(),\n chain_id: z.string(),\n\n // Type\n receipt_type: ReceiptType,\n\n // Who\n agent_id: z.string(),\n org_id: z.string(),\n\n // What\n action: z.string(),\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n output_summary: z.string().nullable(),\n\n // How (all nullable — may not be known at creation)\n model: z.string().nullable(),\n tokens_in: z.number().int().nonnegative().nullable(),\n tokens_out: z.number().int().nonnegative().nullable(),\n cost_usd: z.number().nonnegative().nullable(),\n latency_ms: z.number().int().nonnegative().nullable(),\n tool_calls: z.array(z.string()).nullable(),\n\n // When\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n\n // Status\n status: ReceiptStatus,\n error: z.record(z.unknown()).nullable(),\n\n // Context\n environment: Environment,\n tags: z.array(z.string()).nullable(),\n\n // Verification (Tier 2 — Phase 6)\n constraints: z.record(z.unknown()).nullable(),\n constraint_result: z.record(z.unknown()).nullable(),\n\n // Trust\n signature: z.string(),\n verify_url: z.string().url(),\n\n // Optional\n callback_verified: z.boolean().nullable(),\n confidence: z.number().min(0).max(1).nullable(),\n metadata: z.record(z.unknown()),\n})\nexport type ActionReceipt = z.infer<typeof ActionReceipt>\n","import { z } from 'zod'\n\n/**\n * A single constraint definition that specifies a rule to evaluate.\n */\nexport const ConstraintDefinition = z.object({\n type: z.string().min(1),\n value: z.unknown(),\n message: z.string().optional(),\n})\nexport type ConstraintDefinition = z.infer<typeof ConstraintDefinition>\n\n/**\n * Result of evaluating a single constraint.\n */\nexport const SingleConstraintResult = z.object({\n type: z.string(),\n passed: z.boolean(),\n expected: z.unknown(),\n actual: z.unknown(),\n message: z.string().optional(),\n})\nexport type SingleConstraintResult = z.infer<typeof SingleConstraintResult>\n\n/**\n * Aggregate result of evaluating all constraints on a receipt.\n */\nexport const ConstraintResult = z.object({\n passed: z.boolean(),\n results: z.array(SingleConstraintResult),\n evaluated_at: z.string().datetime(),\n})\nexport type ConstraintResult = z.infer<typeof ConstraintResult>\n\n/**\n * Array of constraint definitions.\n */\nexport const ConstraintDefinitions = z.array(ConstraintDefinition)\nexport type ConstraintDefinitions = z.infer<typeof ConstraintDefinitions>\n","import { z } from 'zod'\n\nexport const RubricCriterion = z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n weight: z.number().min(0).max(1),\n passing_threshold: z.number().min(0).max(1).optional(),\n examples: z.object({\n good: z.array(z.string()).optional(),\n bad: z.array(z.string()).optional(),\n }).optional(),\n})\nexport type RubricCriterion = z.infer<typeof RubricCriterion>\n\nexport const Rubric = z.object({\n version: z.string().default('1.0'),\n criteria: z.array(RubricCriterion).min(1),\n passing_threshold: z.number().min(0).max(1).default(0.7),\n require_all: z.boolean().default(false),\n})\nexport type Rubric = z.infer<typeof Rubric>\n\nexport const CriterionResult = z.object({\n criterion: z.string(),\n score: z.number().min(0).max(1),\n passed: z.boolean(),\n reasoning: z.string(),\n})\nexport type CriterionResult = z.infer<typeof CriterionResult>\n\nexport const JudgmentResult = z.object({\n verdict: z.enum(['pass', 'fail', 'partial']),\n score: z.number().min(0).max(1),\n criteria_results: z.array(CriterionResult),\n overall_reasoning: z.string(),\n rubric_version: z.string(),\n})\nexport type JudgmentResult = z.infer<typeof JudgmentResult>\n","import { z } from 'zod'\nimport { ReceiptStatus, ReceiptType, Environment, ErrorCode } from './enums'\n\n/**\n * What the client sends to POST /api/v1/receipts.\n */\nexport const CreateReceiptInput = z.object({\n // Required\n agent_id: z.string().min(1),\n action: z.string().min(1),\n input_hash: z.string().min(1),\n\n // Optional with defaults\n receipt_type: ReceiptType.default('action'),\n status: ReceiptStatus.default('pending'),\n environment: Environment.default('production'),\n\n // Optional\n parent_receipt_id: z.string().nullable().optional(),\n output_hash: z.string().nullable().optional(),\n output_summary: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n tokens_in: z.number().int().nonnegative().nullable().optional(),\n tokens_out: z.number().int().nonnegative().nullable().optional(),\n cost_usd: z.number().nonnegative().nullable().optional(),\n latency_ms: z.number().int().nonnegative().nullable().optional(),\n tool_calls: z.array(z.string()).nullable().optional(),\n tags: z.array(z.string()).nullable().optional(),\n confidence: z.number().min(0).max(1).nullable().optional(),\n callback_verified: z.boolean().nullable().optional(),\n metadata: z.record(z.unknown()).optional(),\n})\nexport type CreateReceiptInput = z.infer<typeof CreateReceiptInput>\n\n/**\n * What the client sends to PATCH /api/v1/receipts/:id/complete.\n */\nexport const CompleteReceiptInput = z.object({\n // Required — must transition from pending\n status: z.enum(['completed', 'failed', 'timeout']),\n\n // Execution results (all optional — set what you know)\n output_hash: z.string().nullable().optional(),\n output_summary: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n tokens_in: z.number().int().nonnegative().nullable().optional(),\n tokens_out: z.number().int().nonnegative().nullable().optional(),\n cost_usd: z.number().nonnegative().nullable().optional(),\n latency_ms: z.number().int().nonnegative().nullable().optional(),\n tool_calls: z.array(z.string()).nullable().optional(),\n confidence: z.number().min(0).max(1).nullable().optional(),\n callback_verified: z.boolean().nullable().optional(),\n error: z.record(z.unknown()).nullable().optional(),\n})\nexport type CompleteReceiptInput = z.infer<typeof CompleteReceiptInput>\n\n/**\n * What GET /api/v1/verify/:id returns.\n * Note: Does NOT include org_id, metadata, tags, or output_summary (org-private).\n */\nexport const VerifyResponse = z.object({\n verified: z.boolean(),\n receipt: z.object({\n receipt_id: z.string(),\n chain_id: z.string(),\n receipt_type: ReceiptType,\n agent_id: z.string(),\n action: z.string(),\n status: ReceiptStatus,\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n signature: z.string(),\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n environment: Environment,\n latency_ms: z.number().int().nonnegative().nullable(),\n }),\n signature_valid: z.boolean(),\n chain_length: z.number().int().nonnegative(),\n public_key_url: z.string().url(),\n})\nexport type VerifyResponse = z.infer<typeof VerifyResponse>\n\n/**\n * Query parameters for GET /api/v1/receipts.\n */\nexport const ListReceiptsQuery = z.object({\n page: z.coerce.number().int().positive().default(1),\n limit: z.coerce.number().int().positive().max(100).default(50),\n agent_id: z.string().optional(),\n action: z.string().optional(),\n status: ReceiptStatus.optional(),\n environment: Environment.optional(),\n receipt_type: ReceiptType.optional(),\n chain_id: z.string().optional(),\n tag: z.string().optional(),\n from: z.string().datetime().optional(),\n to: z.string().datetime().optional(),\n sort: z.string().regex(/^(created_at|completed_at|latency_ms|cost_usd):(asc|desc)$/).default('created_at:desc'),\n})\nexport type ListReceiptsQuery = z.infer<typeof ListReceiptsQuery>\n\n/**\n * Pagination metadata included in list responses.\n */\nexport const PaginationMeta = z.object({\n page: z.number().int().positive(),\n limit: z.number().int().positive(),\n total: z.number().int().nonnegative(),\n total_pages: z.number().int().nonnegative(),\n has_next: z.boolean(),\n has_prev: z.boolean(),\n})\nexport type PaginationMeta = z.infer<typeof PaginationMeta>\n\n/**\n * Standard error response format.\n */\nexport const ErrorResponse = z.object({\n error: z.object({\n code: ErrorCode,\n message: z.string(),\n status: z.number().int(),\n }),\n})\nexport type ErrorResponse = z.infer<typeof ErrorResponse>\n","import { z } from 'zod'\n\n// --- Enums ---\n\nexport const EntityType = z.enum([\n 'person',\n 'project',\n 'organization',\n 'preference',\n 'fact',\n 'context',\n 'tool',\n 'custom',\n])\nexport type EntityType = z.infer<typeof EntityType>\n\nexport const MemoryOperation = z.enum([\n 'observe',\n 'create',\n 'merge',\n 'forget',\n 'forget_entity',\n 'recall',\n 'update',\n])\nexport type MemoryOperation = z.infer<typeof MemoryOperation>\n\nexport const MemoryScope = z.enum([\n 'agent',\n 'user',\n 'team',\n 'global',\n])\nexport type MemoryScope = z.infer<typeof MemoryScope>\n\nexport const ConfidenceLevel = z.enum([\n 'certain',\n 'high',\n 'medium',\n 'low',\n 'deprecated',\n])\nexport type ConfidenceLevel = z.infer<typeof ConfidenceLevel>\n\n// --- Core Types ---\n\nexport const Observation = z.object({\n observation_id: z.string(),\n entity_id: z.string(),\n content: z.string(),\n confidence: ConfidenceLevel.default('medium'),\n source_receipt_id: z.string(),\n source_agent_id: z.string(),\n source_context: z.string().nullable(),\n observed_at: z.string().datetime(),\n forgotten_at: z.string().datetime().nullable(),\n forgotten_by: z.string().nullable(),\n superseded_by: z.string().nullable(),\n expires_at: z.string().datetime().nullable().default(null),\n tags: z.array(z.string()).default([]),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Observation = z.infer<typeof Observation>\n\nexport const Relationship = z.object({\n relationship_id: z.string(),\n from_entity_id: z.string(),\n to_entity_id: z.string(),\n relationship_type: z.string(),\n strength: ConfidenceLevel.default('medium'),\n source_receipt_id: z.string(),\n created_at: z.string().datetime(),\n forgotten_at: z.string().datetime().nullable(),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Relationship = z.infer<typeof Relationship>\n\nexport const Entity = z.object({\n entity_id: z.string(),\n entity_type: EntityType,\n name: z.string(),\n aliases: z.array(z.string()).default([]),\n scope: MemoryScope.default('agent'),\n created_at: z.string().datetime(),\n created_by_agent: z.string(),\n created_by_receipt: z.string(),\n forgotten_at: z.string().datetime().nullable(),\n merged_into: z.string().nullable(),\n attributes: z.record(z.unknown()).default({}),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Entity = z.infer<typeof Entity>\n\n// --- Memory Receipt Extension ---\n\nexport const MemoryReceiptPayload = z.object({\n memory_operation: MemoryOperation,\n entity_id: z.string().nullable(),\n observation_id: z.string().nullable(),\n relationship_id: z.string().nullable(),\n scope: MemoryScope,\n query: z.string().nullable(),\n results_count: z.number().int().nullable(),\n confidence: ConfidenceLevel.nullable(),\n})\nexport type MemoryReceiptPayload = z.infer<typeof MemoryReceiptPayload>\n\n// --- Query Types ---\n\nexport const MemoryQuery = z.object({\n query: z.string().optional(),\n entity_type: EntityType.optional(),\n entity_id: z.string().optional(),\n scope: MemoryScope.optional(),\n agent_id: z.string().optional(),\n confidence_min: ConfidenceLevel.optional(),\n include_forgotten: z.boolean().default(false),\n tags: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(100).default(20),\n page: z.number().int().min(1).default(1),\n})\nexport type MemoryQuery = z.infer<typeof MemoryQuery>\n","import { z } from 'zod'\nimport type { ErrorResponse } from './api'\n\n/**\n * Validate data against a Zod schema.\n * Returns { success: true, data } or { success: false, error: ErrorResponse }\n */\nexport function validate<T extends z.ZodSchema>(\n schema: T,\n data: unknown\n): { success: true; data: z.infer<T> } | { success: false; error: ErrorResponse } {\n const result = schema.safeParse(data)\n if (result.success) {\n return { success: true, data: result.data }\n }\n return {\n success: false,\n error: createErrorResponse(\n 'VALIDATION_ERROR',\n formatZodError(result.error),\n 400\n ),\n }\n}\n\n/**\n * Format Zod errors into a human-readable message.\n */\nexport function formatZodError(error: z.ZodError): string {\n return error.issues\n .map((issue) => {\n const path = issue.path.length > 0 ? `${issue.path.join('.')}: ` : ''\n return `${path}${issue.message}`\n })\n .join('; ')\n}\n\n/**\n * Create a standard error response object.\n */\nexport function createErrorResponse(\n code: string,\n message: string,\n status: number\n): ErrorResponse {\n return {\n error: {\n code: code as ErrorResponse['error']['code'],\n message,\n status,\n },\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAEX,IAAM,gBAAgB,aAAE,KAAK,CAAC,WAAW,aAAa,UAAU,SAAS,CAAC;AAG1E,IAAM,cAAc,aAAE,KAAK,CAAC,UAAU,gBAAgB,YAAY,eAAe,QAAQ,CAAC;AAG1F,IAAM,cAAc,aAAE,KAAK,CAAC,eAAe,cAAc,WAAW,MAAM,CAAC;AAG3E,IAAM,YAAY,aAAE,KAAK;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;;;ACvBD,IAAAA,cAAkB;AAQX,IAAM,kBAAkB,cAAE,OAAO;AAAA,EAC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AAU;AACd,UAAM,OAAO,MAAM,KAAK,SAAS,IAAI,GAAG,MAAM,KAAK,KAAK,GAAG,CAAC,OAAO;AACnE,WAAO,GAAG,IAAI,GAAG,MAAM,OAAO;AAAA,EAChC,CAAC,EACA,KAAK,IAAI;AACd;AAKO,SAAS,oBACd,MACA,SACA,QACe;AACf,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":["import_zod","import_zod","import_zod","import_zod","import_zod"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/enums.ts","../src/receipt.ts","../src/constraints.ts","../src/rubric.ts","../src/api.ts","../src/memory.ts","../src/validation.ts"],"sourcesContent":["// Enums\nexport { ReceiptStatus, ReceiptType, Environment, ErrorCode } from './enums'\n\n// Receipt schemas + types\nexport { SignablePayload, ActionReceipt, FileManifestEntry } from './receipt'\n\n// Constraint schemas + types\nexport {\n ConstraintDefinition,\n SingleConstraintResult,\n ConstraintResult,\n ConstraintDefinitions,\n} from './constraints'\n\n// Rubric schemas + types\nexport {\n RubricCriterion,\n Rubric,\n CriterionResult,\n JudgmentResult,\n} from './rubric'\n\n// API schemas + types\nexport {\n CreateReceiptInput,\n CompleteReceiptInput,\n VerifyResponse,\n ListReceiptsQuery,\n PaginationMeta,\n ErrorResponse,\n} from './api'\n\n// Memory schemas + types\nexport {\n EntityType,\n MemoryOperation,\n MemoryScope,\n ConfidenceLevel,\n Observation,\n Relationship,\n Entity,\n MemoryReceiptPayload,\n MemoryQuery,\n MemoryBundle,\n} from './memory'\n\n// Validation utilities\nexport { validate, formatZodError, createErrorResponse } from './validation'\n\n// Re-export types explicitly for consumers who import types only\nexport type {\n ReceiptStatus as ReceiptStatusType,\n ReceiptType as ReceiptTypeType,\n Environment as EnvironmentType,\n ErrorCode as ErrorCodeType,\n} from './enums'\n","import { z } from 'zod'\n\nexport const ReceiptStatus = z.enum(['pending', 'completed', 'failed', 'timeout'])\nexport type ReceiptStatus = z.infer<typeof ReceiptStatus>\n\nexport const ReceiptType = z.enum(['action', 'verification', 'judgment', 'arbitration', 'memory'])\nexport type ReceiptType = z.infer<typeof ReceiptType>\n\nexport const Environment = z.enum(['development', 'production', 'staging', 'test'])\nexport type Environment = z.infer<typeof Environment>\n\nexport const ErrorCode = z.enum([\n 'UNAUTHORIZED',\n 'KEY_REVOKED',\n 'FORBIDDEN',\n 'RECEIPT_NOT_FOUND',\n 'CHAIN_NOT_FOUND',\n 'AGENT_NOT_FOUND',\n 'RECEIPT_NOT_PENDING',\n 'RECEIPT_IMMUTABLE',\n 'RATE_LIMIT_EXCEEDED',\n 'VALIDATION_ERROR',\n 'INTERNAL_ERROR',\n])\nexport type ErrorCode = z.infer<typeof ErrorCode>\n","import { z } from 'zod'\nimport { ReceiptStatus, ReceiptType, Environment } from './enums'\n\n/**\n * The 12 fields that are cryptographically signed.\n * These fields are extracted from a receipt and serialized as canonical JSON\n * before signing with Ed25519.\n */\nexport const SignablePayload = z.object({\n receipt_id: z.string(),\n chain_id: z.string(),\n receipt_type: ReceiptType,\n agent_id: z.string(),\n org_id: z.string(),\n action: z.string(),\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n status: ReceiptStatus,\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n environment: Environment,\n})\nexport type SignablePayload = z.infer<typeof SignablePayload>\n\n/**\n * One file touched by a job, recorded by the harness (never by the agent).\n */\nexport const FileManifestEntry = z.object({\n name: z.string().min(1),\n sha256: z.string().regex(/^sha256:[0-9a-f]{64}$/),\n bytes: z.number().int().nonnegative(),\n role: z.enum(['input', 'output']),\n})\nexport type FileManifestEntry = z.infer<typeof FileManifestEntry>\n\n/**\n * The complete receipt object as returned by the API.\n *\n * Signature versions:\n * - v1 (sig_version absent): only the 12 SignablePayload fields are signed.\n * - v2 (sig_version = 2): every field except `signature` and `verify_url` is\n * signed, using deep canonical JSON. Summary, cost, model, metadata, files\n * and the chain link are all covered.\n */\nexport const ActionReceipt = z.object({\n // Signature format (absent = legacy v1)\n sig_version: z.literal(2).optional(),\n // First 16 hex chars of sha256(public key) — names the key that signed it\n key_id: z.string().nullable().optional(),\n // sha256 of the previous finalized receipt in the same chain (null = first)\n prev_receipt_hash: z.string().nullable().optional(),\n // Files the harness hashed for this action\n files: z.array(FileManifestEntry).nullable().optional(),\n\n // Identity\n receipt_id: z.string(),\n parent_receipt_id: z.string().nullable(),\n chain_id: z.string(),\n\n // Type\n receipt_type: ReceiptType,\n\n // Who\n agent_id: z.string(),\n org_id: z.string(),\n\n // What\n action: z.string(),\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n output_summary: z.string().nullable(),\n\n // How (all nullable — may not be known at creation)\n model: z.string().nullable(),\n tokens_in: z.number().int().nonnegative().nullable(),\n tokens_out: z.number().int().nonnegative().nullable(),\n cost_usd: z.number().nonnegative().nullable(),\n latency_ms: z.number().int().nonnegative().nullable(),\n tool_calls: z.array(z.string()).nullable(),\n\n // When\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n\n // Status\n status: ReceiptStatus,\n error: z.record(z.unknown()).nullable(),\n\n // Context\n environment: Environment,\n tags: z.array(z.string()).nullable(),\n\n // Verification (Tier 2 — Phase 6)\n constraints: z.record(z.unknown()).nullable(),\n constraint_result: z.record(z.unknown()).nullable(),\n\n // Trust\n signature: z.string(),\n verify_url: z.string().url(),\n\n // Optional\n callback_verified: z.boolean().nullable(),\n confidence: z.number().min(0).max(1).nullable(),\n metadata: z.record(z.unknown()),\n})\nexport type ActionReceipt = z.infer<typeof ActionReceipt>\n","import { z } from 'zod'\n\n/**\n * A single constraint definition that specifies a rule to evaluate.\n */\nexport const ConstraintDefinition = z.object({\n type: z.string().min(1),\n value: z.unknown(),\n message: z.string().optional(),\n})\nexport type ConstraintDefinition = z.infer<typeof ConstraintDefinition>\n\n/**\n * Result of evaluating a single constraint.\n */\nexport const SingleConstraintResult = z.object({\n type: z.string(),\n passed: z.boolean(),\n expected: z.unknown(),\n actual: z.unknown(),\n message: z.string().optional(),\n})\nexport type SingleConstraintResult = z.infer<typeof SingleConstraintResult>\n\n/**\n * Aggregate result of evaluating all constraints on a receipt.\n */\nexport const ConstraintResult = z.object({\n passed: z.boolean(),\n results: z.array(SingleConstraintResult),\n evaluated_at: z.string().datetime(),\n})\nexport type ConstraintResult = z.infer<typeof ConstraintResult>\n\n/**\n * Array of constraint definitions.\n */\nexport const ConstraintDefinitions = z.array(ConstraintDefinition)\nexport type ConstraintDefinitions = z.infer<typeof ConstraintDefinitions>\n","import { z } from 'zod'\n\nexport const RubricCriterion = z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n weight: z.number().min(0).max(1),\n passing_threshold: z.number().min(0).max(1).optional(),\n examples: z.object({\n good: z.array(z.string()).optional(),\n bad: z.array(z.string()).optional(),\n }).optional(),\n})\nexport type RubricCriterion = z.infer<typeof RubricCriterion>\n\nexport const Rubric = z.object({\n version: z.string().default('1.0'),\n criteria: z.array(RubricCriterion).min(1),\n passing_threshold: z.number().min(0).max(1).default(0.7),\n require_all: z.boolean().default(false),\n})\nexport type Rubric = z.infer<typeof Rubric>\n\nexport const CriterionResult = z.object({\n criterion: z.string(),\n score: z.number().min(0).max(1),\n passed: z.boolean(),\n reasoning: z.string(),\n})\nexport type CriterionResult = z.infer<typeof CriterionResult>\n\nexport const JudgmentResult = z.object({\n verdict: z.enum(['pass', 'fail', 'partial']),\n score: z.number().min(0).max(1),\n criteria_results: z.array(CriterionResult),\n overall_reasoning: z.string(),\n rubric_version: z.string(),\n})\nexport type JudgmentResult = z.infer<typeof JudgmentResult>\n","import { z } from 'zod'\nimport { ReceiptStatus, ReceiptType, Environment, ErrorCode } from './enums'\n\n/**\n * What the client sends to POST /api/v1/receipts.\n */\nexport const CreateReceiptInput = z.object({\n // Required\n agent_id: z.string().min(1),\n action: z.string().min(1),\n input_hash: z.string().min(1),\n\n // Optional with defaults\n receipt_type: ReceiptType.default('action'),\n status: ReceiptStatus.default('pending'),\n environment: Environment.default('production'),\n\n // Optional\n parent_receipt_id: z.string().nullable().optional(),\n output_hash: z.string().nullable().optional(),\n output_summary: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n tokens_in: z.number().int().nonnegative().nullable().optional(),\n tokens_out: z.number().int().nonnegative().nullable().optional(),\n cost_usd: z.number().nonnegative().nullable().optional(),\n latency_ms: z.number().int().nonnegative().nullable().optional(),\n tool_calls: z.array(z.string()).nullable().optional(),\n tags: z.array(z.string()).nullable().optional(),\n confidence: z.number().min(0).max(1).nullable().optional(),\n callback_verified: z.boolean().nullable().optional(),\n metadata: z.record(z.unknown()).optional(),\n})\nexport type CreateReceiptInput = z.infer<typeof CreateReceiptInput>\n\n/**\n * What the client sends to PATCH /api/v1/receipts/:id/complete.\n */\nexport const CompleteReceiptInput = z.object({\n // Required — must transition from pending\n status: z.enum(['completed', 'failed', 'timeout']),\n\n // Execution results (all optional — set what you know)\n output_hash: z.string().nullable().optional(),\n output_summary: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n tokens_in: z.number().int().nonnegative().nullable().optional(),\n tokens_out: z.number().int().nonnegative().nullable().optional(),\n cost_usd: z.number().nonnegative().nullable().optional(),\n latency_ms: z.number().int().nonnegative().nullable().optional(),\n tool_calls: z.array(z.string()).nullable().optional(),\n confidence: z.number().min(0).max(1).nullable().optional(),\n callback_verified: z.boolean().nullable().optional(),\n error: z.record(z.unknown()).nullable().optional(),\n})\nexport type CompleteReceiptInput = z.infer<typeof CompleteReceiptInput>\n\n/**\n * What GET /api/v1/verify/:id returns.\n * Note: Does NOT include org_id, metadata, tags, or output_summary (org-private).\n */\nexport const VerifyResponse = z.object({\n verified: z.boolean(),\n receipt: z.object({\n receipt_id: z.string(),\n chain_id: z.string(),\n receipt_type: ReceiptType,\n agent_id: z.string(),\n action: z.string(),\n status: ReceiptStatus,\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n signature: z.string(),\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n environment: Environment,\n latency_ms: z.number().int().nonnegative().nullable(),\n }),\n signature_valid: z.boolean(),\n chain_length: z.number().int().nonnegative(),\n public_key_url: z.string().url(),\n})\nexport type VerifyResponse = z.infer<typeof VerifyResponse>\n\n/**\n * Query parameters for GET /api/v1/receipts.\n */\nexport const ListReceiptsQuery = z.object({\n page: z.coerce.number().int().positive().default(1),\n limit: z.coerce.number().int().positive().max(100).default(50),\n agent_id: z.string().optional(),\n action: z.string().optional(),\n status: ReceiptStatus.optional(),\n environment: Environment.optional(),\n receipt_type: ReceiptType.optional(),\n chain_id: z.string().optional(),\n tag: z.string().optional(),\n from: z.string().datetime().optional(),\n to: z.string().datetime().optional(),\n sort: z.string().regex(/^(created_at|completed_at|latency_ms|cost_usd):(asc|desc)$/).default('created_at:desc'),\n})\nexport type ListReceiptsQuery = z.infer<typeof ListReceiptsQuery>\n\n/**\n * Pagination metadata included in list responses.\n */\nexport const PaginationMeta = z.object({\n page: z.number().int().positive(),\n limit: z.number().int().positive(),\n total: z.number().int().nonnegative(),\n total_pages: z.number().int().nonnegative(),\n has_next: z.boolean(),\n has_prev: z.boolean(),\n})\nexport type PaginationMeta = z.infer<typeof PaginationMeta>\n\n/**\n * Standard error response format.\n */\nexport const ErrorResponse = z.object({\n error: z.object({\n code: ErrorCode,\n message: z.string(),\n status: z.number().int(),\n }),\n})\nexport type ErrorResponse = z.infer<typeof ErrorResponse>\n","import { z } from 'zod'\n\n// --- Enums ---\n\nexport const EntityType = z.enum([\n 'person',\n 'project',\n 'organization',\n 'preference',\n 'fact',\n 'context',\n 'tool',\n 'custom',\n])\nexport type EntityType = z.infer<typeof EntityType>\n\nexport const MemoryOperation = z.enum([\n 'observe',\n 'create',\n 'merge',\n 'forget',\n 'forget_entity',\n 'recall',\n 'update',\n])\nexport type MemoryOperation = z.infer<typeof MemoryOperation>\n\nexport const MemoryScope = z.enum([\n 'agent',\n 'user',\n 'team',\n 'global',\n])\nexport type MemoryScope = z.infer<typeof MemoryScope>\n\nexport const ConfidenceLevel = z.enum([\n 'certain',\n 'high',\n 'medium',\n 'low',\n 'deprecated',\n])\nexport type ConfidenceLevel = z.infer<typeof ConfidenceLevel>\n\n// --- Core Types ---\n\nexport const Observation = z.object({\n observation_id: z.string(),\n entity_id: z.string(),\n content: z.string(),\n confidence: ConfidenceLevel.default('medium'),\n source_receipt_id: z.string(),\n source_agent_id: z.string(),\n source_context: z.string().nullable(),\n observed_at: z.string().datetime(),\n forgotten_at: z.string().datetime().nullable(),\n forgotten_by: z.string().nullable(),\n superseded_by: z.string().nullable(),\n expires_at: z.string().datetime().nullable().default(null),\n tags: z.array(z.string()).default([]),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Observation = z.infer<typeof Observation>\n\nexport const Relationship = z.object({\n relationship_id: z.string(),\n from_entity_id: z.string(),\n to_entity_id: z.string(),\n relationship_type: z.string(),\n strength: ConfidenceLevel.default('medium'),\n source_receipt_id: z.string(),\n created_at: z.string().datetime(),\n forgotten_at: z.string().datetime().nullable(),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Relationship = z.infer<typeof Relationship>\n\nexport const Entity = z.object({\n entity_id: z.string(),\n entity_type: EntityType,\n name: z.string(),\n aliases: z.array(z.string()).default([]),\n scope: MemoryScope.default('agent'),\n created_at: z.string().datetime(),\n created_by_agent: z.string(),\n created_by_receipt: z.string(),\n forgotten_at: z.string().datetime().nullable(),\n merged_into: z.string().nullable(),\n attributes: z.record(z.unknown()).default({}),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Entity = z.infer<typeof Entity>\n\n// --- Memory Receipt Extension ---\n\nexport const MemoryReceiptPayload = z.object({\n memory_operation: MemoryOperation,\n entity_id: z.string().nullable(),\n observation_id: z.string().nullable(),\n relationship_id: z.string().nullable(),\n scope: MemoryScope,\n query: z.string().nullable(),\n results_count: z.number().int().nullable(),\n confidence: ConfidenceLevel.nullable(),\n})\nexport type MemoryReceiptPayload = z.infer<typeof MemoryReceiptPayload>\n\n// --- Query Types ---\n\nexport const MemoryQuery = z.object({\n query: z.string().optional(),\n entity_type: EntityType.optional(),\n entity_id: z.string().optional(),\n scope: MemoryScope.optional(),\n agent_id: z.string().optional(),\n confidence_min: ConfidenceLevel.optional(),\n include_forgotten: z.boolean().default(false),\n tags: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(100).default(20),\n page: z.number().int().min(1).default(1),\n})\nexport type MemoryQuery = z.infer<typeof MemoryQuery>\n\n// --- Bundle Types ---\n\nexport const MemoryBundle = z.object({\n bundle_id: z.string(),\n bundle_version: z.literal('1.0'),\n created_at: z.string().datetime(),\n created_by_agent: z.string(),\n description: z.string().nullable().default(null),\n public_key: z.string(),\n entities: z.array(Entity),\n observations: z.array(Observation),\n relationships: z.array(Relationship),\n receipts: z.array(z.record(z.unknown())),\n checksum: z.string(),\n stats: z.object({\n entity_count: z.number().int(),\n observation_count: z.number().int(),\n relationship_count: z.number().int(),\n receipt_count: z.number().int(),\n agents: z.array(z.string()),\n date_range: z.object({\n earliest: z.string().datetime(),\n latest: z.string().datetime(),\n }),\n }),\n})\nexport type MemoryBundle = z.infer<typeof MemoryBundle>\n","import { z } from 'zod'\nimport type { ErrorResponse } from './api'\n\n/**\n * Validate data against a Zod schema.\n * Returns { success: true, data } or { success: false, error: ErrorResponse }\n */\nexport function validate<T extends z.ZodSchema>(\n schema: T,\n data: unknown\n): { success: true; data: z.infer<T> } | { success: false; error: ErrorResponse } {\n const result = schema.safeParse(data)\n if (result.success) {\n return { success: true, data: result.data }\n }\n return {\n success: false,\n error: createErrorResponse(\n 'VALIDATION_ERROR',\n formatZodError(result.error),\n 400\n ),\n }\n}\n\n/**\n * Format Zod errors into a human-readable message.\n */\nexport function formatZodError(error: z.ZodError): string {\n return error.issues\n .map((issue) => {\n const path = issue.path.length > 0 ? `${issue.path.join('.')}: ` : ''\n return `${path}${issue.message}`\n })\n .join('; ')\n}\n\n/**\n * Create a standard error response object.\n */\nexport function createErrorResponse(\n code: string,\n message: string,\n status: number\n): ErrorResponse {\n return {\n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_zod","import_zod","import_zod","import_zod","import_zod"]}
|
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,21 @@ var SignablePayload = z2.object({
|
|
|
33
33
|
completed_at: z2.string().datetime().nullable(),
|
|
34
34
|
environment: Environment
|
|
35
35
|
});
|
|
36
|
+
var FileManifestEntry = z2.object({
|
|
37
|
+
name: z2.string().min(1),
|
|
38
|
+
sha256: z2.string().regex(/^sha256:[0-9a-f]{64}$/),
|
|
39
|
+
bytes: z2.number().int().nonnegative(),
|
|
40
|
+
role: z2.enum(["input", "output"])
|
|
41
|
+
});
|
|
36
42
|
var ActionReceipt = z2.object({
|
|
43
|
+
// Signature format (absent = legacy v1)
|
|
44
|
+
sig_version: z2.literal(2).optional(),
|
|
45
|
+
// First 16 hex chars of sha256(public key) — names the key that signed it
|
|
46
|
+
key_id: z2.string().nullable().optional(),
|
|
47
|
+
// sha256 of the previous finalized receipt in the same chain (null = first)
|
|
48
|
+
prev_receipt_hash: z2.string().nullable().optional(),
|
|
49
|
+
// Files the harness hashed for this action
|
|
50
|
+
files: z2.array(FileManifestEntry).nullable().optional(),
|
|
37
51
|
// Identity
|
|
38
52
|
receipt_id: z2.string(),
|
|
39
53
|
parent_receipt_id: z2.string().nullable(),
|
|
@@ -319,6 +333,30 @@ var MemoryQuery = z6.object({
|
|
|
319
333
|
limit: z6.number().int().min(1).max(100).default(20),
|
|
320
334
|
page: z6.number().int().min(1).default(1)
|
|
321
335
|
});
|
|
336
|
+
var MemoryBundle = z6.object({
|
|
337
|
+
bundle_id: z6.string(),
|
|
338
|
+
bundle_version: z6.literal("1.0"),
|
|
339
|
+
created_at: z6.string().datetime(),
|
|
340
|
+
created_by_agent: z6.string(),
|
|
341
|
+
description: z6.string().nullable().default(null),
|
|
342
|
+
public_key: z6.string(),
|
|
343
|
+
entities: z6.array(Entity),
|
|
344
|
+
observations: z6.array(Observation),
|
|
345
|
+
relationships: z6.array(Relationship),
|
|
346
|
+
receipts: z6.array(z6.record(z6.unknown())),
|
|
347
|
+
checksum: z6.string(),
|
|
348
|
+
stats: z6.object({
|
|
349
|
+
entity_count: z6.number().int(),
|
|
350
|
+
observation_count: z6.number().int(),
|
|
351
|
+
relationship_count: z6.number().int(),
|
|
352
|
+
receipt_count: z6.number().int(),
|
|
353
|
+
agents: z6.array(z6.string()),
|
|
354
|
+
date_range: z6.object({
|
|
355
|
+
earliest: z6.string().datetime(),
|
|
356
|
+
latest: z6.string().datetime()
|
|
357
|
+
})
|
|
358
|
+
})
|
|
359
|
+
});
|
|
322
360
|
|
|
323
361
|
// src/validation.ts
|
|
324
362
|
function validate(schema, data) {
|
|
@@ -364,8 +402,10 @@ export {
|
|
|
364
402
|
Environment,
|
|
365
403
|
ErrorCode,
|
|
366
404
|
ErrorResponse,
|
|
405
|
+
FileManifestEntry,
|
|
367
406
|
JudgmentResult,
|
|
368
407
|
ListReceiptsQuery,
|
|
408
|
+
MemoryBundle,
|
|
369
409
|
MemoryOperation,
|
|
370
410
|
MemoryQuery,
|
|
371
411
|
MemoryReceiptPayload,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/enums.ts","../src/receipt.ts","../src/constraints.ts","../src/rubric.ts","../src/api.ts","../src/memory.ts","../src/validation.ts"],"sourcesContent":["import { z } from 'zod'\n\nexport const ReceiptStatus = z.enum(['pending', 'completed', 'failed', 'timeout'])\nexport type ReceiptStatus = z.infer<typeof ReceiptStatus>\n\nexport const ReceiptType = z.enum(['action', 'verification', 'judgment', 'arbitration', 'memory'])\nexport type ReceiptType = z.infer<typeof ReceiptType>\n\nexport const Environment = z.enum(['development', 'production', 'staging', 'test'])\nexport type Environment = z.infer<typeof Environment>\n\nexport const ErrorCode = z.enum([\n 'UNAUTHORIZED',\n 'KEY_REVOKED',\n 'FORBIDDEN',\n 'RECEIPT_NOT_FOUND',\n 'CHAIN_NOT_FOUND',\n 'AGENT_NOT_FOUND',\n 'RECEIPT_NOT_PENDING',\n 'RECEIPT_IMMUTABLE',\n 'RATE_LIMIT_EXCEEDED',\n 'VALIDATION_ERROR',\n 'INTERNAL_ERROR',\n])\nexport type ErrorCode = z.infer<typeof ErrorCode>\n","import { z } from 'zod'\nimport { ReceiptStatus, ReceiptType, Environment } from './enums'\n\n/**\n * The 12 fields that are cryptographically signed.\n * These fields are extracted from a receipt and serialized as canonical JSON\n * before signing with Ed25519.\n */\nexport const SignablePayload = z.object({\n receipt_id: z.string(),\n chain_id: z.string(),\n receipt_type: ReceiptType,\n agent_id: z.string(),\n org_id: z.string(),\n action: z.string(),\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n status: ReceiptStatus,\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n environment: Environment,\n})\nexport type SignablePayload = z.infer<typeof SignablePayload>\n\n/**\n * The complete receipt object as returned by the API.\n */\nexport const ActionReceipt = z.object({\n // Identity\n receipt_id: z.string(),\n parent_receipt_id: z.string().nullable(),\n chain_id: z.string(),\n\n // Type\n receipt_type: ReceiptType,\n\n // Who\n agent_id: z.string(),\n org_id: z.string(),\n\n // What\n action: z.string(),\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n output_summary: z.string().nullable(),\n\n // How (all nullable — may not be known at creation)\n model: z.string().nullable(),\n tokens_in: z.number().int().nonnegative().nullable(),\n tokens_out: z.number().int().nonnegative().nullable(),\n cost_usd: z.number().nonnegative().nullable(),\n latency_ms: z.number().int().nonnegative().nullable(),\n tool_calls: z.array(z.string()).nullable(),\n\n // When\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n\n // Status\n status: ReceiptStatus,\n error: z.record(z.unknown()).nullable(),\n\n // Context\n environment: Environment,\n tags: z.array(z.string()).nullable(),\n\n // Verification (Tier 2 — Phase 6)\n constraints: z.record(z.unknown()).nullable(),\n constraint_result: z.record(z.unknown()).nullable(),\n\n // Trust\n signature: z.string(),\n verify_url: z.string().url(),\n\n // Optional\n callback_verified: z.boolean().nullable(),\n confidence: z.number().min(0).max(1).nullable(),\n metadata: z.record(z.unknown()),\n})\nexport type ActionReceipt = z.infer<typeof ActionReceipt>\n","import { z } from 'zod'\n\n/**\n * A single constraint definition that specifies a rule to evaluate.\n */\nexport const ConstraintDefinition = z.object({\n type: z.string().min(1),\n value: z.unknown(),\n message: z.string().optional(),\n})\nexport type ConstraintDefinition = z.infer<typeof ConstraintDefinition>\n\n/**\n * Result of evaluating a single constraint.\n */\nexport const SingleConstraintResult = z.object({\n type: z.string(),\n passed: z.boolean(),\n expected: z.unknown(),\n actual: z.unknown(),\n message: z.string().optional(),\n})\nexport type SingleConstraintResult = z.infer<typeof SingleConstraintResult>\n\n/**\n * Aggregate result of evaluating all constraints on a receipt.\n */\nexport const ConstraintResult = z.object({\n passed: z.boolean(),\n results: z.array(SingleConstraintResult),\n evaluated_at: z.string().datetime(),\n})\nexport type ConstraintResult = z.infer<typeof ConstraintResult>\n\n/**\n * Array of constraint definitions.\n */\nexport const ConstraintDefinitions = z.array(ConstraintDefinition)\nexport type ConstraintDefinitions = z.infer<typeof ConstraintDefinitions>\n","import { z } from 'zod'\n\nexport const RubricCriterion = z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n weight: z.number().min(0).max(1),\n passing_threshold: z.number().min(0).max(1).optional(),\n examples: z.object({\n good: z.array(z.string()).optional(),\n bad: z.array(z.string()).optional(),\n }).optional(),\n})\nexport type RubricCriterion = z.infer<typeof RubricCriterion>\n\nexport const Rubric = z.object({\n version: z.string().default('1.0'),\n criteria: z.array(RubricCriterion).min(1),\n passing_threshold: z.number().min(0).max(1).default(0.7),\n require_all: z.boolean().default(false),\n})\nexport type Rubric = z.infer<typeof Rubric>\n\nexport const CriterionResult = z.object({\n criterion: z.string(),\n score: z.number().min(0).max(1),\n passed: z.boolean(),\n reasoning: z.string(),\n})\nexport type CriterionResult = z.infer<typeof CriterionResult>\n\nexport const JudgmentResult = z.object({\n verdict: z.enum(['pass', 'fail', 'partial']),\n score: z.number().min(0).max(1),\n criteria_results: z.array(CriterionResult),\n overall_reasoning: z.string(),\n rubric_version: z.string(),\n})\nexport type JudgmentResult = z.infer<typeof JudgmentResult>\n","import { z } from 'zod'\nimport { ReceiptStatus, ReceiptType, Environment, ErrorCode } from './enums'\n\n/**\n * What the client sends to POST /api/v1/receipts.\n */\nexport const CreateReceiptInput = z.object({\n // Required\n agent_id: z.string().min(1),\n action: z.string().min(1),\n input_hash: z.string().min(1),\n\n // Optional with defaults\n receipt_type: ReceiptType.default('action'),\n status: ReceiptStatus.default('pending'),\n environment: Environment.default('production'),\n\n // Optional\n parent_receipt_id: z.string().nullable().optional(),\n output_hash: z.string().nullable().optional(),\n output_summary: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n tokens_in: z.number().int().nonnegative().nullable().optional(),\n tokens_out: z.number().int().nonnegative().nullable().optional(),\n cost_usd: z.number().nonnegative().nullable().optional(),\n latency_ms: z.number().int().nonnegative().nullable().optional(),\n tool_calls: z.array(z.string()).nullable().optional(),\n tags: z.array(z.string()).nullable().optional(),\n confidence: z.number().min(0).max(1).nullable().optional(),\n callback_verified: z.boolean().nullable().optional(),\n metadata: z.record(z.unknown()).optional(),\n})\nexport type CreateReceiptInput = z.infer<typeof CreateReceiptInput>\n\n/**\n * What the client sends to PATCH /api/v1/receipts/:id/complete.\n */\nexport const CompleteReceiptInput = z.object({\n // Required — must transition from pending\n status: z.enum(['completed', 'failed', 'timeout']),\n\n // Execution results (all optional — set what you know)\n output_hash: z.string().nullable().optional(),\n output_summary: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n tokens_in: z.number().int().nonnegative().nullable().optional(),\n tokens_out: z.number().int().nonnegative().nullable().optional(),\n cost_usd: z.number().nonnegative().nullable().optional(),\n latency_ms: z.number().int().nonnegative().nullable().optional(),\n tool_calls: z.array(z.string()).nullable().optional(),\n confidence: z.number().min(0).max(1).nullable().optional(),\n callback_verified: z.boolean().nullable().optional(),\n error: z.record(z.unknown()).nullable().optional(),\n})\nexport type CompleteReceiptInput = z.infer<typeof CompleteReceiptInput>\n\n/**\n * What GET /api/v1/verify/:id returns.\n * Note: Does NOT include org_id, metadata, tags, or output_summary (org-private).\n */\nexport const VerifyResponse = z.object({\n verified: z.boolean(),\n receipt: z.object({\n receipt_id: z.string(),\n chain_id: z.string(),\n receipt_type: ReceiptType,\n agent_id: z.string(),\n action: z.string(),\n status: ReceiptStatus,\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n signature: z.string(),\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n environment: Environment,\n latency_ms: z.number().int().nonnegative().nullable(),\n }),\n signature_valid: z.boolean(),\n chain_length: z.number().int().nonnegative(),\n public_key_url: z.string().url(),\n})\nexport type VerifyResponse = z.infer<typeof VerifyResponse>\n\n/**\n * Query parameters for GET /api/v1/receipts.\n */\nexport const ListReceiptsQuery = z.object({\n page: z.coerce.number().int().positive().default(1),\n limit: z.coerce.number().int().positive().max(100).default(50),\n agent_id: z.string().optional(),\n action: z.string().optional(),\n status: ReceiptStatus.optional(),\n environment: Environment.optional(),\n receipt_type: ReceiptType.optional(),\n chain_id: z.string().optional(),\n tag: z.string().optional(),\n from: z.string().datetime().optional(),\n to: z.string().datetime().optional(),\n sort: z.string().regex(/^(created_at|completed_at|latency_ms|cost_usd):(asc|desc)$/).default('created_at:desc'),\n})\nexport type ListReceiptsQuery = z.infer<typeof ListReceiptsQuery>\n\n/**\n * Pagination metadata included in list responses.\n */\nexport const PaginationMeta = z.object({\n page: z.number().int().positive(),\n limit: z.number().int().positive(),\n total: z.number().int().nonnegative(),\n total_pages: z.number().int().nonnegative(),\n has_next: z.boolean(),\n has_prev: z.boolean(),\n})\nexport type PaginationMeta = z.infer<typeof PaginationMeta>\n\n/**\n * Standard error response format.\n */\nexport const ErrorResponse = z.object({\n error: z.object({\n code: ErrorCode,\n message: z.string(),\n status: z.number().int(),\n }),\n})\nexport type ErrorResponse = z.infer<typeof ErrorResponse>\n","import { z } from 'zod'\n\n// --- Enums ---\n\nexport const EntityType = z.enum([\n 'person',\n 'project',\n 'organization',\n 'preference',\n 'fact',\n 'context',\n 'tool',\n 'custom',\n])\nexport type EntityType = z.infer<typeof EntityType>\n\nexport const MemoryOperation = z.enum([\n 'observe',\n 'create',\n 'merge',\n 'forget',\n 'forget_entity',\n 'recall',\n 'update',\n])\nexport type MemoryOperation = z.infer<typeof MemoryOperation>\n\nexport const MemoryScope = z.enum([\n 'agent',\n 'user',\n 'team',\n 'global',\n])\nexport type MemoryScope = z.infer<typeof MemoryScope>\n\nexport const ConfidenceLevel = z.enum([\n 'certain',\n 'high',\n 'medium',\n 'low',\n 'deprecated',\n])\nexport type ConfidenceLevel = z.infer<typeof ConfidenceLevel>\n\n// --- Core Types ---\n\nexport const Observation = z.object({\n observation_id: z.string(),\n entity_id: z.string(),\n content: z.string(),\n confidence: ConfidenceLevel.default('medium'),\n source_receipt_id: z.string(),\n source_agent_id: z.string(),\n source_context: z.string().nullable(),\n observed_at: z.string().datetime(),\n forgotten_at: z.string().datetime().nullable(),\n forgotten_by: z.string().nullable(),\n superseded_by: z.string().nullable(),\n expires_at: z.string().datetime().nullable().default(null),\n tags: z.array(z.string()).default([]),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Observation = z.infer<typeof Observation>\n\nexport const Relationship = z.object({\n relationship_id: z.string(),\n from_entity_id: z.string(),\n to_entity_id: z.string(),\n relationship_type: z.string(),\n strength: ConfidenceLevel.default('medium'),\n source_receipt_id: z.string(),\n created_at: z.string().datetime(),\n forgotten_at: z.string().datetime().nullable(),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Relationship = z.infer<typeof Relationship>\n\nexport const Entity = z.object({\n entity_id: z.string(),\n entity_type: EntityType,\n name: z.string(),\n aliases: z.array(z.string()).default([]),\n scope: MemoryScope.default('agent'),\n created_at: z.string().datetime(),\n created_by_agent: z.string(),\n created_by_receipt: z.string(),\n forgotten_at: z.string().datetime().nullable(),\n merged_into: z.string().nullable(),\n attributes: z.record(z.unknown()).default({}),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Entity = z.infer<typeof Entity>\n\n// --- Memory Receipt Extension ---\n\nexport const MemoryReceiptPayload = z.object({\n memory_operation: MemoryOperation,\n entity_id: z.string().nullable(),\n observation_id: z.string().nullable(),\n relationship_id: z.string().nullable(),\n scope: MemoryScope,\n query: z.string().nullable(),\n results_count: z.number().int().nullable(),\n confidence: ConfidenceLevel.nullable(),\n})\nexport type MemoryReceiptPayload = z.infer<typeof MemoryReceiptPayload>\n\n// --- Query Types ---\n\nexport const MemoryQuery = z.object({\n query: z.string().optional(),\n entity_type: EntityType.optional(),\n entity_id: z.string().optional(),\n scope: MemoryScope.optional(),\n agent_id: z.string().optional(),\n confidence_min: ConfidenceLevel.optional(),\n include_forgotten: z.boolean().default(false),\n tags: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(100).default(20),\n page: z.number().int().min(1).default(1),\n})\nexport type MemoryQuery = z.infer<typeof MemoryQuery>\n","import { z } from 'zod'\nimport type { ErrorResponse } from './api'\n\n/**\n * Validate data against a Zod schema.\n * Returns { success: true, data } or { success: false, error: ErrorResponse }\n */\nexport function validate<T extends z.ZodSchema>(\n schema: T,\n data: unknown\n): { success: true; data: z.infer<T> } | { success: false; error: ErrorResponse } {\n const result = schema.safeParse(data)\n if (result.success) {\n return { success: true, data: result.data }\n }\n return {\n success: false,\n error: createErrorResponse(\n 'VALIDATION_ERROR',\n formatZodError(result.error),\n 400\n ),\n }\n}\n\n/**\n * Format Zod errors into a human-readable message.\n */\nexport function formatZodError(error: z.ZodError): string {\n return error.issues\n .map((issue) => {\n const path = issue.path.length > 0 ? `${issue.path.join('.')}: ` : ''\n return `${path}${issue.message}`\n })\n .join('; ')\n}\n\n/**\n * Create a standard error response object.\n */\nexport function createErrorResponse(\n code: string,\n message: string,\n status: number\n): ErrorResponse {\n return {\n error: {\n code: code as ErrorResponse['error']['code'],\n message,\n status,\n },\n }\n}\n"],"mappings":";AAAA,SAAS,SAAS;AAEX,IAAM,gBAAgB,E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B,gBAAgB,gBAAgB,SAAS;AAAA,EACzC,mBAAmBA,GAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EAC5C,MAAMA,GAAE,MAAMA,GAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACnC,OAAOA,GAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,QAAQ,EAAE;AAAA,EAClD,MAAMA,GAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC;AACzC,CAAC;;;ACjHM,SAAS,SACd,QACA,MACgF;AAChF,QAAM,SAAS,OAAO,UAAU,IAAI;AACpC,MAAI,OAAO,SAAS;AAClB,WAAO,EAAE,SAAS,MAAM,MAAM,OAAO,KAAK;AAAA,EAC5C;AACA,SAAO;AAAA,IACL,SAAS;AAAA,IACT,OAAO;AAAA,MACL;AAAA,MACA,eAAe,OAAO,KAAK;AAAA,MAC3B;AAAA,IACF;AAAA,EACF;AACF;AAKO,SAAS,eAAe,OAA2B;AACxD,SAAO,MAAM,OACV,IAAI,CAAC,UAAU;AACd,UAAM,OAAO,MAAM,KAAK,SAAS,IAAI,GAAG,MAAM,KAAK,KAAK,GAAG,CAAC,OAAO;AACnE,WAAO,GAAG,IAAI,GAAG,MAAM,OAAO;AAAA,EAChC,CAAC,EACA,KAAK,IAAI;AACd;AAKO,SAAS,oBACd,MACA,SACA,QACe;AACf,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":["z","z","z","z","z","z","z"]}
|
|
1
|
+
{"version":3,"sources":["../src/enums.ts","../src/receipt.ts","../src/constraints.ts","../src/rubric.ts","../src/api.ts","../src/memory.ts","../src/validation.ts"],"sourcesContent":["import { z } from 'zod'\n\nexport const ReceiptStatus = z.enum(['pending', 'completed', 'failed', 'timeout'])\nexport type ReceiptStatus = z.infer<typeof ReceiptStatus>\n\nexport const ReceiptType = z.enum(['action', 'verification', 'judgment', 'arbitration', 'memory'])\nexport type ReceiptType = z.infer<typeof ReceiptType>\n\nexport const Environment = z.enum(['development', 'production', 'staging', 'test'])\nexport type Environment = z.infer<typeof Environment>\n\nexport const ErrorCode = z.enum([\n 'UNAUTHORIZED',\n 'KEY_REVOKED',\n 'FORBIDDEN',\n 'RECEIPT_NOT_FOUND',\n 'CHAIN_NOT_FOUND',\n 'AGENT_NOT_FOUND',\n 'RECEIPT_NOT_PENDING',\n 'RECEIPT_IMMUTABLE',\n 'RATE_LIMIT_EXCEEDED',\n 'VALIDATION_ERROR',\n 'INTERNAL_ERROR',\n])\nexport type ErrorCode = z.infer<typeof ErrorCode>\n","import { z } from 'zod'\nimport { ReceiptStatus, ReceiptType, Environment } from './enums'\n\n/**\n * The 12 fields that are cryptographically signed.\n * These fields are extracted from a receipt and serialized as canonical JSON\n * before signing with Ed25519.\n */\nexport const SignablePayload = z.object({\n receipt_id: z.string(),\n chain_id: z.string(),\n receipt_type: ReceiptType,\n agent_id: z.string(),\n org_id: z.string(),\n action: z.string(),\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n status: ReceiptStatus,\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n environment: Environment,\n})\nexport type SignablePayload = z.infer<typeof SignablePayload>\n\n/**\n * One file touched by a job, recorded by the harness (never by the agent).\n */\nexport const FileManifestEntry = z.object({\n name: z.string().min(1),\n sha256: z.string().regex(/^sha256:[0-9a-f]{64}$/),\n bytes: z.number().int().nonnegative(),\n role: z.enum(['input', 'output']),\n})\nexport type FileManifestEntry = z.infer<typeof FileManifestEntry>\n\n/**\n * The complete receipt object as returned by the API.\n *\n * Signature versions:\n * - v1 (sig_version absent): only the 12 SignablePayload fields are signed.\n * - v2 (sig_version = 2): every field except `signature` and `verify_url` is\n * signed, using deep canonical JSON. Summary, cost, model, metadata, files\n * and the chain link are all covered.\n */\nexport const ActionReceipt = z.object({\n // Signature format (absent = legacy v1)\n sig_version: z.literal(2).optional(),\n // First 16 hex chars of sha256(public key) — names the key that signed it\n key_id: z.string().nullable().optional(),\n // sha256 of the previous finalized receipt in the same chain (null = first)\n prev_receipt_hash: z.string().nullable().optional(),\n // Files the harness hashed for this action\n files: z.array(FileManifestEntry).nullable().optional(),\n\n // Identity\n receipt_id: z.string(),\n parent_receipt_id: z.string().nullable(),\n chain_id: z.string(),\n\n // Type\n receipt_type: ReceiptType,\n\n // Who\n agent_id: z.string(),\n org_id: z.string(),\n\n // What\n action: z.string(),\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n output_summary: z.string().nullable(),\n\n // How (all nullable — may not be known at creation)\n model: z.string().nullable(),\n tokens_in: z.number().int().nonnegative().nullable(),\n tokens_out: z.number().int().nonnegative().nullable(),\n cost_usd: z.number().nonnegative().nullable(),\n latency_ms: z.number().int().nonnegative().nullable(),\n tool_calls: z.array(z.string()).nullable(),\n\n // When\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n\n // Status\n status: ReceiptStatus,\n error: z.record(z.unknown()).nullable(),\n\n // Context\n environment: Environment,\n tags: z.array(z.string()).nullable(),\n\n // Verification (Tier 2 — Phase 6)\n constraints: z.record(z.unknown()).nullable(),\n constraint_result: z.record(z.unknown()).nullable(),\n\n // Trust\n signature: z.string(),\n verify_url: z.string().url(),\n\n // Optional\n callback_verified: z.boolean().nullable(),\n confidence: z.number().min(0).max(1).nullable(),\n metadata: z.record(z.unknown()),\n})\nexport type ActionReceipt = z.infer<typeof ActionReceipt>\n","import { z } from 'zod'\n\n/**\n * A single constraint definition that specifies a rule to evaluate.\n */\nexport const ConstraintDefinition = z.object({\n type: z.string().min(1),\n value: z.unknown(),\n message: z.string().optional(),\n})\nexport type ConstraintDefinition = z.infer<typeof ConstraintDefinition>\n\n/**\n * Result of evaluating a single constraint.\n */\nexport const SingleConstraintResult = z.object({\n type: z.string(),\n passed: z.boolean(),\n expected: z.unknown(),\n actual: z.unknown(),\n message: z.string().optional(),\n})\nexport type SingleConstraintResult = z.infer<typeof SingleConstraintResult>\n\n/**\n * Aggregate result of evaluating all constraints on a receipt.\n */\nexport const ConstraintResult = z.object({\n passed: z.boolean(),\n results: z.array(SingleConstraintResult),\n evaluated_at: z.string().datetime(),\n})\nexport type ConstraintResult = z.infer<typeof ConstraintResult>\n\n/**\n * Array of constraint definitions.\n */\nexport const ConstraintDefinitions = z.array(ConstraintDefinition)\nexport type ConstraintDefinitions = z.infer<typeof ConstraintDefinitions>\n","import { z } from 'zod'\n\nexport const RubricCriterion = z.object({\n name: z.string().min(1),\n description: z.string().min(1),\n weight: z.number().min(0).max(1),\n passing_threshold: z.number().min(0).max(1).optional(),\n examples: z.object({\n good: z.array(z.string()).optional(),\n bad: z.array(z.string()).optional(),\n }).optional(),\n})\nexport type RubricCriterion = z.infer<typeof RubricCriterion>\n\nexport const Rubric = z.object({\n version: z.string().default('1.0'),\n criteria: z.array(RubricCriterion).min(1),\n passing_threshold: z.number().min(0).max(1).default(0.7),\n require_all: z.boolean().default(false),\n})\nexport type Rubric = z.infer<typeof Rubric>\n\nexport const CriterionResult = z.object({\n criterion: z.string(),\n score: z.number().min(0).max(1),\n passed: z.boolean(),\n reasoning: z.string(),\n})\nexport type CriterionResult = z.infer<typeof CriterionResult>\n\nexport const JudgmentResult = z.object({\n verdict: z.enum(['pass', 'fail', 'partial']),\n score: z.number().min(0).max(1),\n criteria_results: z.array(CriterionResult),\n overall_reasoning: z.string(),\n rubric_version: z.string(),\n})\nexport type JudgmentResult = z.infer<typeof JudgmentResult>\n","import { z } from 'zod'\nimport { ReceiptStatus, ReceiptType, Environment, ErrorCode } from './enums'\n\n/**\n * What the client sends to POST /api/v1/receipts.\n */\nexport const CreateReceiptInput = z.object({\n // Required\n agent_id: z.string().min(1),\n action: z.string().min(1),\n input_hash: z.string().min(1),\n\n // Optional with defaults\n receipt_type: ReceiptType.default('action'),\n status: ReceiptStatus.default('pending'),\n environment: Environment.default('production'),\n\n // Optional\n parent_receipt_id: z.string().nullable().optional(),\n output_hash: z.string().nullable().optional(),\n output_summary: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n tokens_in: z.number().int().nonnegative().nullable().optional(),\n tokens_out: z.number().int().nonnegative().nullable().optional(),\n cost_usd: z.number().nonnegative().nullable().optional(),\n latency_ms: z.number().int().nonnegative().nullable().optional(),\n tool_calls: z.array(z.string()).nullable().optional(),\n tags: z.array(z.string()).nullable().optional(),\n confidence: z.number().min(0).max(1).nullable().optional(),\n callback_verified: z.boolean().nullable().optional(),\n metadata: z.record(z.unknown()).optional(),\n})\nexport type CreateReceiptInput = z.infer<typeof CreateReceiptInput>\n\n/**\n * What the client sends to PATCH /api/v1/receipts/:id/complete.\n */\nexport const CompleteReceiptInput = z.object({\n // Required — must transition from pending\n status: z.enum(['completed', 'failed', 'timeout']),\n\n // Execution results (all optional — set what you know)\n output_hash: z.string().nullable().optional(),\n output_summary: z.string().nullable().optional(),\n model: z.string().nullable().optional(),\n tokens_in: z.number().int().nonnegative().nullable().optional(),\n tokens_out: z.number().int().nonnegative().nullable().optional(),\n cost_usd: z.number().nonnegative().nullable().optional(),\n latency_ms: z.number().int().nonnegative().nullable().optional(),\n tool_calls: z.array(z.string()).nullable().optional(),\n confidence: z.number().min(0).max(1).nullable().optional(),\n callback_verified: z.boolean().nullable().optional(),\n error: z.record(z.unknown()).nullable().optional(),\n})\nexport type CompleteReceiptInput = z.infer<typeof CompleteReceiptInput>\n\n/**\n * What GET /api/v1/verify/:id returns.\n * Note: Does NOT include org_id, metadata, tags, or output_summary (org-private).\n */\nexport const VerifyResponse = z.object({\n verified: z.boolean(),\n receipt: z.object({\n receipt_id: z.string(),\n chain_id: z.string(),\n receipt_type: ReceiptType,\n agent_id: z.string(),\n action: z.string(),\n status: ReceiptStatus,\n input_hash: z.string(),\n output_hash: z.string().nullable(),\n signature: z.string(),\n timestamp: z.string().datetime(),\n completed_at: z.string().datetime().nullable(),\n environment: Environment,\n latency_ms: z.number().int().nonnegative().nullable(),\n }),\n signature_valid: z.boolean(),\n chain_length: z.number().int().nonnegative(),\n public_key_url: z.string().url(),\n})\nexport type VerifyResponse = z.infer<typeof VerifyResponse>\n\n/**\n * Query parameters for GET /api/v1/receipts.\n */\nexport const ListReceiptsQuery = z.object({\n page: z.coerce.number().int().positive().default(1),\n limit: z.coerce.number().int().positive().max(100).default(50),\n agent_id: z.string().optional(),\n action: z.string().optional(),\n status: ReceiptStatus.optional(),\n environment: Environment.optional(),\n receipt_type: ReceiptType.optional(),\n chain_id: z.string().optional(),\n tag: z.string().optional(),\n from: z.string().datetime().optional(),\n to: z.string().datetime().optional(),\n sort: z.string().regex(/^(created_at|completed_at|latency_ms|cost_usd):(asc|desc)$/).default('created_at:desc'),\n})\nexport type ListReceiptsQuery = z.infer<typeof ListReceiptsQuery>\n\n/**\n * Pagination metadata included in list responses.\n */\nexport const PaginationMeta = z.object({\n page: z.number().int().positive(),\n limit: z.number().int().positive(),\n total: z.number().int().nonnegative(),\n total_pages: z.number().int().nonnegative(),\n has_next: z.boolean(),\n has_prev: z.boolean(),\n})\nexport type PaginationMeta = z.infer<typeof PaginationMeta>\n\n/**\n * Standard error response format.\n */\nexport const ErrorResponse = z.object({\n error: z.object({\n code: ErrorCode,\n message: z.string(),\n status: z.number().int(),\n }),\n})\nexport type ErrorResponse = z.infer<typeof ErrorResponse>\n","import { z } from 'zod'\n\n// --- Enums ---\n\nexport const EntityType = z.enum([\n 'person',\n 'project',\n 'organization',\n 'preference',\n 'fact',\n 'context',\n 'tool',\n 'custom',\n])\nexport type EntityType = z.infer<typeof EntityType>\n\nexport const MemoryOperation = z.enum([\n 'observe',\n 'create',\n 'merge',\n 'forget',\n 'forget_entity',\n 'recall',\n 'update',\n])\nexport type MemoryOperation = z.infer<typeof MemoryOperation>\n\nexport const MemoryScope = z.enum([\n 'agent',\n 'user',\n 'team',\n 'global',\n])\nexport type MemoryScope = z.infer<typeof MemoryScope>\n\nexport const ConfidenceLevel = z.enum([\n 'certain',\n 'high',\n 'medium',\n 'low',\n 'deprecated',\n])\nexport type ConfidenceLevel = z.infer<typeof ConfidenceLevel>\n\n// --- Core Types ---\n\nexport const Observation = z.object({\n observation_id: z.string(),\n entity_id: z.string(),\n content: z.string(),\n confidence: ConfidenceLevel.default('medium'),\n source_receipt_id: z.string(),\n source_agent_id: z.string(),\n source_context: z.string().nullable(),\n observed_at: z.string().datetime(),\n forgotten_at: z.string().datetime().nullable(),\n forgotten_by: z.string().nullable(),\n superseded_by: z.string().nullable(),\n expires_at: z.string().datetime().nullable().default(null),\n tags: z.array(z.string()).default([]),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Observation = z.infer<typeof Observation>\n\nexport const Relationship = z.object({\n relationship_id: z.string(),\n from_entity_id: z.string(),\n to_entity_id: z.string(),\n relationship_type: z.string(),\n strength: ConfidenceLevel.default('medium'),\n source_receipt_id: z.string(),\n created_at: z.string().datetime(),\n forgotten_at: z.string().datetime().nullable(),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Relationship = z.infer<typeof Relationship>\n\nexport const Entity = z.object({\n entity_id: z.string(),\n entity_type: EntityType,\n name: z.string(),\n aliases: z.array(z.string()).default([]),\n scope: MemoryScope.default('agent'),\n created_at: z.string().datetime(),\n created_by_agent: z.string(),\n created_by_receipt: z.string(),\n forgotten_at: z.string().datetime().nullable(),\n merged_into: z.string().nullable(),\n attributes: z.record(z.unknown()).default({}),\n metadata: z.record(z.unknown()).default({}),\n})\nexport type Entity = z.infer<typeof Entity>\n\n// --- Memory Receipt Extension ---\n\nexport const MemoryReceiptPayload = z.object({\n memory_operation: MemoryOperation,\n entity_id: z.string().nullable(),\n observation_id: z.string().nullable(),\n relationship_id: z.string().nullable(),\n scope: MemoryScope,\n query: z.string().nullable(),\n results_count: z.number().int().nullable(),\n confidence: ConfidenceLevel.nullable(),\n})\nexport type MemoryReceiptPayload = z.infer<typeof MemoryReceiptPayload>\n\n// --- Query Types ---\n\nexport const MemoryQuery = z.object({\n query: z.string().optional(),\n entity_type: EntityType.optional(),\n entity_id: z.string().optional(),\n scope: MemoryScope.optional(),\n agent_id: z.string().optional(),\n confidence_min: ConfidenceLevel.optional(),\n include_forgotten: z.boolean().default(false),\n tags: z.array(z.string()).optional(),\n limit: z.number().int().min(1).max(100).default(20),\n page: z.number().int().min(1).default(1),\n})\nexport type MemoryQuery = z.infer<typeof MemoryQuery>\n\n// --- Bundle Types ---\n\nexport const MemoryBundle = z.object({\n bundle_id: z.string(),\n bundle_version: z.literal('1.0'),\n created_at: z.string().datetime(),\n created_by_agent: z.string(),\n description: z.string().nullable().default(null),\n public_key: z.string(),\n entities: z.array(Entity),\n observations: z.array(Observation),\n relationships: z.array(Relationship),\n receipts: z.array(z.record(z.unknown())),\n checksum: z.string(),\n stats: z.object({\n entity_count: z.number().int(),\n observation_count: z.number().int(),\n relationship_count: z.number().int(),\n receipt_count: z.number().int(),\n agents: z.array(z.string()),\n date_range: z.object({\n earliest: z.string().datetime(),\n latest: z.string().datetime(),\n }),\n }),\n})\nexport type MemoryBundle = z.infer<typeof MemoryBundle>\n","import { z } from 'zod'\nimport type { ErrorResponse } from './api'\n\n/**\n * Validate data against a Zod schema.\n * Returns { success: true, data } or { success: false, error: ErrorResponse }\n */\nexport function validate<T extends z.ZodSchema>(\n schema: T,\n data: unknown\n): { success: true; data: z.infer<T> } | { success: false; error: ErrorResponse } {\n const result = schema.safeParse(data)\n if (result.success) {\n return { success: true, data: result.data }\n }\n return {\n success: false,\n error: createErrorResponse(\n 'VALIDATION_ERROR',\n formatZodError(result.error),\n 400\n ),\n }\n}\n\n/**\n * Format Zod errors into a human-readable message.\n */\nexport function formatZodError(error: z.ZodError): string {\n return error.issues\n .map((issue) => {\n const path = issue.path.length > 0 ? `${issue.path.join('.')}: ` : ''\n return `${path}${issue.message}`\n })\n .join('; ')\n}\n\n/**\n * Create a standard error response object.\n */\nexport function createErrorResponse(\n code: string,\n message: string,\n status: number\n): ErrorResponse {\n return {\n error: {\n code: code as ErrorResponse['error']['code'],\n message,\n status,\n },\n }\n}\n"],"m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
|
package/package.json
CHANGED
package/receipt.schema.json
CHANGED
|
@@ -4,6 +4,63 @@
|
|
|
4
4
|
"ActionReceipt": {
|
|
5
5
|
"type": "object",
|
|
6
6
|
"properties": {
|
|
7
|
+
"sig_version": {
|
|
8
|
+
"type": "number",
|
|
9
|
+
"const": 2
|
|
10
|
+
},
|
|
11
|
+
"key_id": {
|
|
12
|
+
"type": [
|
|
13
|
+
"string",
|
|
14
|
+
"null"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"prev_receipt_hash": {
|
|
18
|
+
"type": [
|
|
19
|
+
"string",
|
|
20
|
+
"null"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"files": {
|
|
24
|
+
"anyOf": [
|
|
25
|
+
{
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"name": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"minLength": 1
|
|
33
|
+
},
|
|
34
|
+
"sha256": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"pattern": "^sha256:[0-9a-f]{64}$"
|
|
37
|
+
},
|
|
38
|
+
"bytes": {
|
|
39
|
+
"type": "integer",
|
|
40
|
+
"minimum": 0
|
|
41
|
+
},
|
|
42
|
+
"role": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"enum": [
|
|
45
|
+
"input",
|
|
46
|
+
"output"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"required": [
|
|
51
|
+
"name",
|
|
52
|
+
"sha256",
|
|
53
|
+
"bytes",
|
|
54
|
+
"role"
|
|
55
|
+
],
|
|
56
|
+
"additionalProperties": false
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"type": "null"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
7
64
|
"receipt_id": {
|
|
8
65
|
"type": "string"
|
|
9
66
|
},
|