@aletheia-labs/core 0.1.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/LICENSE +176 -0
- package/README.md +163 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime/action-authorizer.d.ts +48 -0
- package/dist/runtime/action-authorizer.d.ts.map +1 -0
- package/dist/runtime/action-authorizer.js +231 -0
- package/dist/runtime/action-authorizer.js.map +1 -0
- package/dist/runtime/authority-engine.d.ts +68 -0
- package/dist/runtime/authority-engine.d.ts.map +1 -0
- package/dist/runtime/authority-engine.js +99 -0
- package/dist/runtime/authority-engine.js.map +1 -0
- package/dist/runtime/decision-helpers.d.ts +17 -0
- package/dist/runtime/decision-helpers.d.ts.map +1 -0
- package/dist/runtime/decision-helpers.js +23 -0
- package/dist/runtime/decision-helpers.js.map +1 -0
- package/dist/runtime/index.d.ts +9 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +9 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/proposal-safety.d.ts +18 -0
- package/dist/runtime/proposal-safety.d.ts.map +1 -0
- package/dist/runtime/proposal-safety.js +76 -0
- package/dist/runtime/proposal-safety.js.map +1 -0
- package/dist/runtime/retrieval-router.d.ts +60 -0
- package/dist/runtime/retrieval-router.d.ts.map +1 -0
- package/dist/runtime/retrieval-router.js +223 -0
- package/dist/runtime/retrieval-router.js.map +1 -0
- package/dist/runtime/scope-helpers.d.ts +22 -0
- package/dist/runtime/scope-helpers.d.ts.map +1 -0
- package/dist/runtime/scope-helpers.js +29 -0
- package/dist/runtime/scope-helpers.js.map +1 -0
- package/dist/runtime/visibility-policy.d.ts +29 -0
- package/dist/runtime/visibility-policy.d.ts.map +1 -0
- package/dist/runtime/visibility-policy.js +23 -0
- package/dist/runtime/visibility-policy.js.map +1 -0
- package/dist/runtime/write-gate.d.ts +66 -0
- package/dist/runtime/write-gate.d.ts.map +1 -0
- package/dist/runtime/write-gate.js +293 -0
- package/dist/runtime/write-gate.js.map +1 -0
- package/dist/storage/conflict-registry.d.ts +61 -0
- package/dist/storage/conflict-registry.d.ts.map +1 -0
- package/dist/storage/conflict-registry.js +15 -0
- package/dist/storage/conflict-registry.js.map +1 -0
- package/dist/storage/event-ledger.d.ts +61 -0
- package/dist/storage/event-ledger.d.ts.map +1 -0
- package/dist/storage/event-ledger.js +14 -0
- package/dist/storage/event-ledger.js.map +1 -0
- package/dist/storage/index.d.ts +8 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +8 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/memory-store.d.ts +94 -0
- package/dist/storage/memory-store.d.ts.map +1 -0
- package/dist/storage/memory-store.js +14 -0
- package/dist/storage/memory-store.js.map +1 -0
- package/dist/types/action.d.ts +211 -0
- package/dist/types/action.d.ts.map +1 -0
- package/dist/types/action.js +50 -0
- package/dist/types/action.js.map +1 -0
- package/dist/types/compressed-receipt.d.ts +117 -0
- package/dist/types/compressed-receipt.d.ts.map +1 -0
- package/dist/types/compressed-receipt.js +100 -0
- package/dist/types/compressed-receipt.js.map +1 -0
- package/dist/types/conflict.d.ts +159 -0
- package/dist/types/conflict.d.ts.map +1 -0
- package/dist/types/conflict.js +47 -0
- package/dist/types/conflict.js.map +1 -0
- package/dist/types/coverage.d.ts +52 -0
- package/dist/types/coverage.d.ts.map +1 -0
- package/dist/types/coverage.js +30 -0
- package/dist/types/coverage.js.map +1 -0
- package/dist/types/decision.d.ts +345 -0
- package/dist/types/decision.d.ts.map +1 -0
- package/dist/types/decision.js +88 -0
- package/dist/types/decision.js.map +1 -0
- package/dist/types/enums.d.ts +135 -0
- package/dist/types/enums.d.ts.map +1 -0
- package/dist/types/enums.js +146 -0
- package/dist/types/enums.js.map +1 -0
- package/dist/types/event.d.ts +187 -0
- package/dist/types/event.d.ts.map +1 -0
- package/dist/types/event.js +44 -0
- package/dist/types/event.js.map +1 -0
- package/dist/types/human-receipt.d.ts +108 -0
- package/dist/types/human-receipt.d.ts.map +1 -0
- package/dist/types/human-receipt.js +41 -0
- package/dist/types/human-receipt.js.map +1 -0
- package/dist/types/index.d.ts +25 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +25 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/keys.d.ts +31 -0
- package/dist/types/keys.d.ts.map +1 -0
- package/dist/types/keys.js +53 -0
- package/dist/types/keys.js.map +1 -0
- package/dist/types/memory-atom.d.ts +291 -0
- package/dist/types/memory-atom.d.ts.map +1 -0
- package/dist/types/memory-atom.js +62 -0
- package/dist/types/memory-atom.js.map +1 -0
- package/dist/types/memory-proposal.d.ts +207 -0
- package/dist/types/memory-proposal.d.ts.map +1 -0
- package/dist/types/memory-proposal.js +34 -0
- package/dist/types/memory-proposal.js.map +1 -0
- package/dist/types/packet.d.ts +564 -0
- package/dist/types/packet.d.ts.map +1 -0
- package/dist/types/packet.js +43 -0
- package/dist/types/packet.js.map +1 -0
- package/dist/types/primitives.d.ts +39 -0
- package/dist/types/primitives.d.ts.map +1 -0
- package/dist/types/primitives.js +42 -0
- package/dist/types/primitives.js.map +1 -0
- package/dist/types/status-transitions.d.ts +23 -0
- package/dist/types/status-transitions.d.ts.map +1 -0
- package/dist/types/status-transitions.js +48 -0
- package/dist/types/status-transitions.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action types for the consumer API: what an agent proposes to DO, and the
|
|
3
|
+
* context in which it proposes to do it.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
/**
|
|
7
|
+
* What an agent wants to do. The verb is the receiver-classified `ACT` class;
|
|
8
|
+
* `target` and `params` are advisory metadata.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ProposedActionSchema: z.ZodObject<{
|
|
11
|
+
/** Receiver-side classification — never accept this from the sender. */
|
|
12
|
+
classifiedAction: z.ZodEnum<["local_documentation", "local_fixture", "local_diagnostic", "local_report", "external_send", "runtime_change", "config_change", "publication", "durable_memory_write", "delete", "canary", "enforcement", "production_action", "l2_plus", "unknown"]>;
|
|
13
|
+
/** What/where the action operates on. */
|
|
14
|
+
target: z.ZodString;
|
|
15
|
+
/** Free-form params (must round-trip JSON cleanly). */
|
|
16
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
target: string;
|
|
19
|
+
classifiedAction: "unknown" | "local_documentation" | "local_fixture" | "local_diagnostic" | "local_report" | "external_send" | "runtime_change" | "config_change" | "publication" | "durable_memory_write" | "delete" | "canary" | "enforcement" | "production_action" | "l2_plus";
|
|
20
|
+
params?: Record<string, unknown> | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
target: string;
|
|
23
|
+
classifiedAction: "unknown" | "local_documentation" | "local_fixture" | "local_diagnostic" | "local_report" | "external_send" | "runtime_change" | "config_change" | "publication" | "durable_memory_write" | "delete" | "canary" | "enforcement" | "production_action" | "l2_plus";
|
|
24
|
+
params?: Record<string, unknown> | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export type ProposedAction = z.infer<typeof ProposedActionSchema>;
|
|
27
|
+
/**
|
|
28
|
+
* Context an agent passes to tryAct(): who is acting, in what scope, with
|
|
29
|
+
* which memories cited.
|
|
30
|
+
*/
|
|
31
|
+
export declare const ActionContextSchema: z.ZodObject<{
|
|
32
|
+
agentId: z.ZodBranded<z.ZodString, "AgentId">;
|
|
33
|
+
scope: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
34
|
+
kind: z.ZodLiteral<"local">;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
kind: "local";
|
|
37
|
+
}, {
|
|
38
|
+
kind: "local";
|
|
39
|
+
}>, z.ZodObject<{
|
|
40
|
+
kind: z.ZodLiteral<"project">;
|
|
41
|
+
projectId: z.ZodString;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
kind: "project";
|
|
44
|
+
projectId: string;
|
|
45
|
+
}, {
|
|
46
|
+
kind: "project";
|
|
47
|
+
projectId: string;
|
|
48
|
+
}>, z.ZodObject<{
|
|
49
|
+
kind: z.ZodLiteral<"user">;
|
|
50
|
+
userId: z.ZodString;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
kind: "user";
|
|
53
|
+
userId: string;
|
|
54
|
+
}, {
|
|
55
|
+
kind: "user";
|
|
56
|
+
userId: string;
|
|
57
|
+
}>, z.ZodObject<{
|
|
58
|
+
kind: z.ZodLiteral<"team">;
|
|
59
|
+
teamId: z.ZodString;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
kind: "team";
|
|
62
|
+
teamId: string;
|
|
63
|
+
}, {
|
|
64
|
+
kind: "team";
|
|
65
|
+
teamId: string;
|
|
66
|
+
}>, z.ZodObject<{
|
|
67
|
+
kind: z.ZodLiteral<"global">;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
kind: "global";
|
|
70
|
+
}, {
|
|
71
|
+
kind: "global";
|
|
72
|
+
}>]>;
|
|
73
|
+
/** Memories the agent is citing as authority for this action. */
|
|
74
|
+
citedMemoryIds: z.ZodArray<z.ZodBranded<z.ZodString, "MemoryId">, "many">;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
agentId: string & z.BRAND<"AgentId">;
|
|
77
|
+
scope: {
|
|
78
|
+
kind: "local";
|
|
79
|
+
} | {
|
|
80
|
+
kind: "project";
|
|
81
|
+
projectId: string;
|
|
82
|
+
} | {
|
|
83
|
+
kind: "user";
|
|
84
|
+
userId: string;
|
|
85
|
+
} | {
|
|
86
|
+
kind: "team";
|
|
87
|
+
teamId: string;
|
|
88
|
+
} | {
|
|
89
|
+
kind: "global";
|
|
90
|
+
};
|
|
91
|
+
citedMemoryIds: (string & z.BRAND<"MemoryId">)[];
|
|
92
|
+
}, {
|
|
93
|
+
agentId: string;
|
|
94
|
+
scope: {
|
|
95
|
+
kind: "local";
|
|
96
|
+
} | {
|
|
97
|
+
kind: "project";
|
|
98
|
+
projectId: string;
|
|
99
|
+
} | {
|
|
100
|
+
kind: "user";
|
|
101
|
+
userId: string;
|
|
102
|
+
} | {
|
|
103
|
+
kind: "team";
|
|
104
|
+
teamId: string;
|
|
105
|
+
} | {
|
|
106
|
+
kind: "global";
|
|
107
|
+
};
|
|
108
|
+
citedMemoryIds: string[];
|
|
109
|
+
}>;
|
|
110
|
+
export type ActionContext = z.infer<typeof ActionContextSchema>;
|
|
111
|
+
/**
|
|
112
|
+
* RecallQuery — what an agent asks the RetrievalRouter for.
|
|
113
|
+
*
|
|
114
|
+
* No semantic similarity field. Recall is by status, scope, type, and an
|
|
115
|
+
* optional opaque tag — never by embedding distance.
|
|
116
|
+
*/
|
|
117
|
+
export declare const RecallQuerySchema: z.ZodObject<{
|
|
118
|
+
/** Caller identity, used for visibility filtering. */
|
|
119
|
+
agentId: z.ZodBranded<z.ZodString, "AgentId">;
|
|
120
|
+
/** Visibility/scope must permit retrieval. */
|
|
121
|
+
scope: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
122
|
+
kind: z.ZodLiteral<"local">;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
kind: "local";
|
|
125
|
+
}, {
|
|
126
|
+
kind: "local";
|
|
127
|
+
}>, z.ZodObject<{
|
|
128
|
+
kind: z.ZodLiteral<"project">;
|
|
129
|
+
projectId: z.ZodString;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
kind: "project";
|
|
132
|
+
projectId: string;
|
|
133
|
+
}, {
|
|
134
|
+
kind: "project";
|
|
135
|
+
projectId: string;
|
|
136
|
+
}>, z.ZodObject<{
|
|
137
|
+
kind: z.ZodLiteral<"user">;
|
|
138
|
+
userId: z.ZodString;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
kind: "user";
|
|
141
|
+
userId: string;
|
|
142
|
+
}, {
|
|
143
|
+
kind: "user";
|
|
144
|
+
userId: string;
|
|
145
|
+
}>, z.ZodObject<{
|
|
146
|
+
kind: z.ZodLiteral<"team">;
|
|
147
|
+
teamId: z.ZodString;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
kind: "team";
|
|
150
|
+
teamId: string;
|
|
151
|
+
}, {
|
|
152
|
+
kind: "team";
|
|
153
|
+
teamId: string;
|
|
154
|
+
}>, z.ZodObject<{
|
|
155
|
+
kind: z.ZodLiteral<"global">;
|
|
156
|
+
}, "strip", z.ZodTypeAny, {
|
|
157
|
+
kind: "global";
|
|
158
|
+
}, {
|
|
159
|
+
kind: "global";
|
|
160
|
+
}>]>;
|
|
161
|
+
/** Restrict to atoms of these statuses (default: ['verified', 'trusted']). */
|
|
162
|
+
requiredStatus: z.ZodOptional<z.ZodArray<z.ZodEnum<["candidate", "verified", "trusted", "deprecated", "rejected", "sealed", "human_required"]>, "many">>;
|
|
163
|
+
/** Restrict to these memory types. */
|
|
164
|
+
memoryTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["observation", "claim", "preference", "policy", "decision", "task_state", "warning", "skill"]>, "many">>;
|
|
165
|
+
/** Optional opaque topic tag — exact match only, not similarity. */
|
|
166
|
+
topic: z.ZodOptional<z.ZodString>;
|
|
167
|
+
/** Max atoms to return. */
|
|
168
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
agentId: string & z.BRAND<"AgentId">;
|
|
171
|
+
scope: {
|
|
172
|
+
kind: "local";
|
|
173
|
+
} | {
|
|
174
|
+
kind: "project";
|
|
175
|
+
projectId: string;
|
|
176
|
+
} | {
|
|
177
|
+
kind: "user";
|
|
178
|
+
userId: string;
|
|
179
|
+
} | {
|
|
180
|
+
kind: "team";
|
|
181
|
+
teamId: string;
|
|
182
|
+
} | {
|
|
183
|
+
kind: "global";
|
|
184
|
+
};
|
|
185
|
+
topic?: string | undefined;
|
|
186
|
+
requiredStatus?: ("candidate" | "verified" | "trusted" | "deprecated" | "rejected" | "sealed" | "human_required")[] | undefined;
|
|
187
|
+
memoryTypes?: ("observation" | "claim" | "preference" | "policy" | "decision" | "task_state" | "warning" | "skill")[] | undefined;
|
|
188
|
+
limit?: number | undefined;
|
|
189
|
+
}, {
|
|
190
|
+
agentId: string;
|
|
191
|
+
scope: {
|
|
192
|
+
kind: "local";
|
|
193
|
+
} | {
|
|
194
|
+
kind: "project";
|
|
195
|
+
projectId: string;
|
|
196
|
+
} | {
|
|
197
|
+
kind: "user";
|
|
198
|
+
userId: string;
|
|
199
|
+
} | {
|
|
200
|
+
kind: "team";
|
|
201
|
+
teamId: string;
|
|
202
|
+
} | {
|
|
203
|
+
kind: "global";
|
|
204
|
+
};
|
|
205
|
+
topic?: string | undefined;
|
|
206
|
+
requiredStatus?: ("candidate" | "verified" | "trusted" | "deprecated" | "rejected" | "sealed" | "human_required")[] | undefined;
|
|
207
|
+
memoryTypes?: ("observation" | "claim" | "preference" | "policy" | "decision" | "task_state" | "warning" | "skill")[] | undefined;
|
|
208
|
+
limit?: number | undefined;
|
|
209
|
+
}>;
|
|
210
|
+
export type RecallQuery = z.infer<typeof RecallQuerySchema>;
|
|
211
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../src/types/action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;GAGG;AACH,eAAO,MAAM,oBAAoB;IAC/B,wEAAwE;;IAExE,yCAAyC;;IAEzC,uDAAuD;;;;;;;;;;EAEvD,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAG9B,iEAAiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjE,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;IAC5B,sDAAsD;;IAEtD,8CAA8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE9C,8EAA8E;;IAE9E,sCAAsC;;IAEtC,oEAAoE;;IAEpE,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE3B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action types for the consumer API: what an agent proposes to DO, and the
|
|
3
|
+
* context in which it proposes to do it.
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ActionClassSchema, MemoryStatusSchema, MemoryTypeSchema, ScopeSchema } from './enums.js';
|
|
7
|
+
import { AgentIdSchema, MemoryIdSchema } from './primitives.js';
|
|
8
|
+
/**
|
|
9
|
+
* What an agent wants to do. The verb is the receiver-classified `ACT` class;
|
|
10
|
+
* `target` and `params` are advisory metadata.
|
|
11
|
+
*/
|
|
12
|
+
export const ProposedActionSchema = z.object({
|
|
13
|
+
/** Receiver-side classification — never accept this from the sender. */
|
|
14
|
+
classifiedAction: ActionClassSchema,
|
|
15
|
+
/** What/where the action operates on. */
|
|
16
|
+
target: z.string().min(1).max(512),
|
|
17
|
+
/** Free-form params (must round-trip JSON cleanly). */
|
|
18
|
+
params: z.record(z.unknown()).optional(),
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Context an agent passes to tryAct(): who is acting, in what scope, with
|
|
22
|
+
* which memories cited.
|
|
23
|
+
*/
|
|
24
|
+
export const ActionContextSchema = z.object({
|
|
25
|
+
agentId: AgentIdSchema,
|
|
26
|
+
scope: ScopeSchema,
|
|
27
|
+
/** Memories the agent is citing as authority for this action. */
|
|
28
|
+
citedMemoryIds: z.array(MemoryIdSchema),
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* RecallQuery — what an agent asks the RetrievalRouter for.
|
|
32
|
+
*
|
|
33
|
+
* No semantic similarity field. Recall is by status, scope, type, and an
|
|
34
|
+
* optional opaque tag — never by embedding distance.
|
|
35
|
+
*/
|
|
36
|
+
export const RecallQuerySchema = z.object({
|
|
37
|
+
/** Caller identity, used for visibility filtering. */
|
|
38
|
+
agentId: AgentIdSchema,
|
|
39
|
+
/** Visibility/scope must permit retrieval. */
|
|
40
|
+
scope: ScopeSchema,
|
|
41
|
+
/** Restrict to atoms of these statuses (default: ['verified', 'trusted']). */
|
|
42
|
+
requiredStatus: z.array(MemoryStatusSchema).optional(),
|
|
43
|
+
/** Restrict to these memory types. */
|
|
44
|
+
memoryTypes: z.array(MemoryTypeSchema).optional(),
|
|
45
|
+
/** Optional opaque topic tag — exact match only, not similarity. */
|
|
46
|
+
topic: z.string().min(1).max(256).optional(),
|
|
47
|
+
/** Max atoms to return. */
|
|
48
|
+
limit: z.number().int().positive().max(1000).optional(),
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.js","sourceRoot":"","sources":["../../src/types/action.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAClG,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,wEAAwE;IACxE,gBAAgB,EAAE,iBAAiB;IACnC,yCAAyC;IACzC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IAClC,uDAAuD;IACvD,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,WAAW;IAClB,iEAAiE;IACjE,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;CACxC,CAAC,CAAC;AAGH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,sDAAsD;IACtD,OAAO,EAAE,aAAa;IACtB,8CAA8C;IAC9C,KAAK,EAAE,WAAW;IAClB,8EAA8E;IAC9E,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,QAAQ,EAAE;IACtD,sCAAsC;IACtC,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE;IACjD,oEAAoE;IACpE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC5C,2BAA2B;IAC3B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;CACxD,CAAC,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compressed Temporal Receipt (specs/compressed-temporal-receipt-v0.md).
|
|
3
|
+
*
|
|
4
|
+
* The compact cross-source handoff tuple. 11 required authority fields,
|
|
5
|
+
* 5 optional audit fields. Every field has a fail-closed interpretation.
|
|
6
|
+
*
|
|
7
|
+
* Wire keys (deliberately short, from the spec):
|
|
8
|
+
* Required: SRC, SRCPATH, SRCDIGEST, PROD, FRESH, SCOPE, PB, NO, LRE, TOK, ACT
|
|
9
|
+
* Optional: CTRID, RB, CHAIN, CONF, PROSE
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
/**
|
|
13
|
+
* Internal representation of a Compressed Temporal Receipt.
|
|
14
|
+
*
|
|
15
|
+
* This is the parsed, validated form. The wire format (SRC=...; PROD=...; ...)
|
|
16
|
+
* is handled by codec functions in a separate module — never construct one of
|
|
17
|
+
* these by hand from untrusted input, always go through the parser.
|
|
18
|
+
*/
|
|
19
|
+
export declare const CompressedReceiptSchema: z.ZodObject<{
|
|
20
|
+
/** SRC — source artifact identity/lane. */
|
|
21
|
+
src: z.ZodBranded<z.ZodString, "SourceArtifactId">;
|
|
22
|
+
/** SRCPATH — source path or source lane binding. */
|
|
23
|
+
srcPath: z.ZodEffects<z.ZodString, string, string>;
|
|
24
|
+
/** SRCDIGEST — digest of the source artifact's content. */
|
|
25
|
+
srcDigest: z.ZodString;
|
|
26
|
+
/** PROD — produced-at timestamp (ISO-8601 UTC). */
|
|
27
|
+
producedAt: z.ZodString;
|
|
28
|
+
/** FRESH — receiver freshness assessment. */
|
|
29
|
+
freshness: z.ZodEnum<["current", "stale", "unknown"]>;
|
|
30
|
+
/** SCOPE — usable scope kind of the packet. */
|
|
31
|
+
scope: z.ZodEnum<["local", "project", "user", "team", "global"]>;
|
|
32
|
+
/** PB — promotion/use boundary. */
|
|
33
|
+
promotionBoundary: z.ZodEnum<["no_memory_write", "no_durable_promotion", "human_confirmation_required"]>;
|
|
34
|
+
/**
|
|
35
|
+
* NO — explicit forbidden effects.
|
|
36
|
+
*
|
|
37
|
+
* Spec rule: this is a *prohibition lane*, not a permission lane. The
|
|
38
|
+
* presence of words like "runtime" or "L2+" inside `NO` means "forbidden",
|
|
39
|
+
* NOT "granted". The receiver MUST NOT treat these as operational grants.
|
|
40
|
+
*
|
|
41
|
+
* Empty array fails closed (missing prohibitions → fetch_abstain).
|
|
42
|
+
*/
|
|
43
|
+
forbiddenEffects: z.ZodArray<z.ZodEnum<["local_only", "no_runtime_effect", "external_send_requires_human", "config_change_forbidden"]>, "many">;
|
|
44
|
+
/** LRE — later restrictive event status. Anything except `none` fails closed. */
|
|
45
|
+
laterRestrictiveEvent: z.ZodEnum<["none", "superseded", "tombstoned", "conflict_unresolved", "unknown"]>;
|
|
46
|
+
/**
|
|
47
|
+
* TOK — tuple completeness token. `true` means "all required fields are
|
|
48
|
+
* present and not truncated". `false` fails closed.
|
|
49
|
+
*/
|
|
50
|
+
tupleComplete: z.ZodLiteral<true>;
|
|
51
|
+
/** ACT — proposed action, to be independently classified by the receiver. */
|
|
52
|
+
proposedAction: z.ZodEnum<["local_documentation", "local_fixture", "local_diagnostic", "local_report", "external_send", "runtime_change", "config_change", "publication", "durable_memory_write", "delete", "canary", "enforcement", "production_action", "l2_plus", "unknown"]>;
|
|
53
|
+
/** CTRID — receipt identifier (audit only, never authority). */
|
|
54
|
+
receiptId: z.ZodOptional<z.ZodBranded<z.ZodString, "ReceiptId">>;
|
|
55
|
+
/** RB — receiver behavior hint (useful, not permission). */
|
|
56
|
+
receiverHint: z.ZodOptional<z.ZodString>;
|
|
57
|
+
/** CHAIN — lineage label (useful, not permission). */
|
|
58
|
+
chain: z.ZodOptional<z.ZodString>;
|
|
59
|
+
/**
|
|
60
|
+
* CONF — confidence value [0, 1]. NEVER authority by itself.
|
|
61
|
+
* Spec: "confidence cannot override weak evidence, stale freshness,
|
|
62
|
+
* wrong scope, or missing permission."
|
|
63
|
+
*/
|
|
64
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
/**
|
|
66
|
+
* PROSE — human-readable summary. NEVER authority by itself; the receiver
|
|
67
|
+
* must not infer permission from polished prose.
|
|
68
|
+
*/
|
|
69
|
+
prose: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
scope: "team" | "local" | "project" | "user" | "global";
|
|
72
|
+
src: string & z.BRAND<"SourceArtifactId">;
|
|
73
|
+
srcPath: string;
|
|
74
|
+
srcDigest: string;
|
|
75
|
+
producedAt: string;
|
|
76
|
+
freshness: "unknown" | "current" | "stale";
|
|
77
|
+
promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
|
|
78
|
+
forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
|
|
79
|
+
laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
|
|
80
|
+
tupleComplete: true;
|
|
81
|
+
proposedAction: "unknown" | "local_documentation" | "local_fixture" | "local_diagnostic" | "local_report" | "external_send" | "runtime_change" | "config_change" | "publication" | "durable_memory_write" | "delete" | "canary" | "enforcement" | "production_action" | "l2_plus";
|
|
82
|
+
receiptId?: (string & z.BRAND<"ReceiptId">) | undefined;
|
|
83
|
+
receiverHint?: string | undefined;
|
|
84
|
+
chain?: string | undefined;
|
|
85
|
+
confidence?: number | undefined;
|
|
86
|
+
prose?: string | undefined;
|
|
87
|
+
}, {
|
|
88
|
+
scope: "team" | "local" | "project" | "user" | "global";
|
|
89
|
+
src: string;
|
|
90
|
+
srcPath: string;
|
|
91
|
+
srcDigest: string;
|
|
92
|
+
producedAt: string;
|
|
93
|
+
freshness: "unknown" | "current" | "stale";
|
|
94
|
+
promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
|
|
95
|
+
forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
|
|
96
|
+
laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
|
|
97
|
+
tupleComplete: true;
|
|
98
|
+
proposedAction: "unknown" | "local_documentation" | "local_fixture" | "local_diagnostic" | "local_report" | "external_send" | "runtime_change" | "config_change" | "publication" | "durable_memory_write" | "delete" | "canary" | "enforcement" | "production_action" | "l2_plus";
|
|
99
|
+
receiptId?: string | undefined;
|
|
100
|
+
receiverHint?: string | undefined;
|
|
101
|
+
chain?: string | undefined;
|
|
102
|
+
confidence?: number | undefined;
|
|
103
|
+
prose?: string | undefined;
|
|
104
|
+
}>;
|
|
105
|
+
export type CompressedReceipt = z.infer<typeof CompressedReceiptSchema>;
|
|
106
|
+
/**
|
|
107
|
+
* The 11 authority-critical wire keys, in spec-defined order.
|
|
108
|
+
* Used by parsers and by `tupleComplete` checks.
|
|
109
|
+
*/
|
|
110
|
+
export declare const AUTHORITY_CRITICAL_KEYS: readonly ["SRC", "SRCPATH", "SRCDIGEST", "PROD", "FRESH", "SCOPE", "PB", "NO", "LRE", "TOK", "ACT"];
|
|
111
|
+
export type AuthorityCriticalKey = (typeof AUTHORITY_CRITICAL_KEYS)[number];
|
|
112
|
+
/**
|
|
113
|
+
* The 5 optional audit keys.
|
|
114
|
+
*/
|
|
115
|
+
export declare const OPTIONAL_AUDIT_KEYS: readonly ["CTRID", "RB", "CHAIN", "CONF", "PROSE"];
|
|
116
|
+
export type OptionalAuditKey = (typeof OPTIONAL_AUDIT_KEYS)[number];
|
|
117
|
+
//# sourceMappingURL=compressed-receipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compressed-receipt.d.ts","sourceRoot":"","sources":["../../src/types/compressed-receipt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;IAElC,2CAA2C;;IAE3C,oDAAoD;;IAEpD,2DAA2D;;IAE3D,mDAAmD;;IAEnD,6CAA6C;;IAE7C,+CAA+C;;IAE/C,mCAAmC;;IAEnC;;;;;;;;OAQG;;IAIH,iFAAiF;;IAEjF;;;OAGG;;IAIH,6EAA6E;;IAI7E,gEAAgE;;IAEhE,4DAA4D;;IAE5D,sDAAsD;;IAEtD;;;;OAIG;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEH,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,uBAAuB,qGAY1B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,mBAAmB,oDAAqD,CAAC;AACtF,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compressed Temporal Receipt (specs/compressed-temporal-receipt-v0.md).
|
|
3
|
+
*
|
|
4
|
+
* The compact cross-source handoff tuple. 11 required authority fields,
|
|
5
|
+
* 5 optional audit fields. Every field has a fail-closed interpretation.
|
|
6
|
+
*
|
|
7
|
+
* Wire keys (deliberately short, from the spec):
|
|
8
|
+
* Required: SRC, SRCPATH, SRCDIGEST, PROD, FRESH, SCOPE, PB, NO, LRE, TOK, ACT
|
|
9
|
+
* Optional: CTRID, RB, CHAIN, CONF, PROSE
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { ActionClassSchema, EffectBoundarySchema, FreshnessSchema, LaterRestrictiveEventSchema, PromotionBoundarySchema, ScopeKindSchema, } from './enums.js';
|
|
13
|
+
import { HashDigestSchema, IsoTimestampSchema, ReceiptIdSchema, SourceArtifactIdSchema, SourcePathSchema, } from './primitives.js';
|
|
14
|
+
/**
|
|
15
|
+
* Internal representation of a Compressed Temporal Receipt.
|
|
16
|
+
*
|
|
17
|
+
* This is the parsed, validated form. The wire format (SRC=...; PROD=...; ...)
|
|
18
|
+
* is handled by codec functions in a separate module — never construct one of
|
|
19
|
+
* these by hand from untrusted input, always go through the parser.
|
|
20
|
+
*/
|
|
21
|
+
export const CompressedReceiptSchema = z.object({
|
|
22
|
+
// -- Required authority-critical fields -----------------------------------
|
|
23
|
+
/** SRC — source artifact identity/lane. */
|
|
24
|
+
src: SourceArtifactIdSchema,
|
|
25
|
+
/** SRCPATH — source path or source lane binding. */
|
|
26
|
+
srcPath: SourcePathSchema,
|
|
27
|
+
/** SRCDIGEST — digest of the source artifact's content. */
|
|
28
|
+
srcDigest: HashDigestSchema,
|
|
29
|
+
/** PROD — produced-at timestamp (ISO-8601 UTC). */
|
|
30
|
+
producedAt: IsoTimestampSchema,
|
|
31
|
+
/** FRESH — receiver freshness assessment. */
|
|
32
|
+
freshness: FreshnessSchema,
|
|
33
|
+
/** SCOPE — usable scope kind of the packet. */
|
|
34
|
+
scope: ScopeKindSchema,
|
|
35
|
+
/** PB — promotion/use boundary. */
|
|
36
|
+
promotionBoundary: PromotionBoundarySchema,
|
|
37
|
+
/**
|
|
38
|
+
* NO — explicit forbidden effects.
|
|
39
|
+
*
|
|
40
|
+
* Spec rule: this is a *prohibition lane*, not a permission lane. The
|
|
41
|
+
* presence of words like "runtime" or "L2+" inside `NO` means "forbidden",
|
|
42
|
+
* NOT "granted". The receiver MUST NOT treat these as operational grants.
|
|
43
|
+
*
|
|
44
|
+
* Empty array fails closed (missing prohibitions → fetch_abstain).
|
|
45
|
+
*/
|
|
46
|
+
forbiddenEffects: z.array(EffectBoundarySchema).min(1, {
|
|
47
|
+
message: 'NO must list at least one forbidden effect — empty fails closed',
|
|
48
|
+
}),
|
|
49
|
+
/** LRE — later restrictive event status. Anything except `none` fails closed. */
|
|
50
|
+
laterRestrictiveEvent: LaterRestrictiveEventSchema,
|
|
51
|
+
/**
|
|
52
|
+
* TOK — tuple completeness token. `true` means "all required fields are
|
|
53
|
+
* present and not truncated". `false` fails closed.
|
|
54
|
+
*/
|
|
55
|
+
tupleComplete: z.literal(true, {
|
|
56
|
+
errorMap: () => ({ message: 'TOK must be true; incomplete tuples fail closed' }),
|
|
57
|
+
}),
|
|
58
|
+
/** ACT — proposed action, to be independently classified by the receiver. */
|
|
59
|
+
proposedAction: ActionClassSchema,
|
|
60
|
+
// -- Optional audit/readability fields ------------------------------------
|
|
61
|
+
/** CTRID — receipt identifier (audit only, never authority). */
|
|
62
|
+
receiptId: ReceiptIdSchema.optional(),
|
|
63
|
+
/** RB — receiver behavior hint (useful, not permission). */
|
|
64
|
+
receiverHint: z.string().max(512).optional(),
|
|
65
|
+
/** CHAIN — lineage label (useful, not permission). */
|
|
66
|
+
chain: z.string().max(512).optional(),
|
|
67
|
+
/**
|
|
68
|
+
* CONF — confidence value [0, 1]. NEVER authority by itself.
|
|
69
|
+
* Spec: "confidence cannot override weak evidence, stale freshness,
|
|
70
|
+
* wrong scope, or missing permission."
|
|
71
|
+
*/
|
|
72
|
+
confidence: z.number().min(0).max(1).optional(),
|
|
73
|
+
/**
|
|
74
|
+
* PROSE — human-readable summary. NEVER authority by itself; the receiver
|
|
75
|
+
* must not infer permission from polished prose.
|
|
76
|
+
*/
|
|
77
|
+
prose: z.string().max(8192).optional(),
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* The 11 authority-critical wire keys, in spec-defined order.
|
|
81
|
+
* Used by parsers and by `tupleComplete` checks.
|
|
82
|
+
*/
|
|
83
|
+
export const AUTHORITY_CRITICAL_KEYS = [
|
|
84
|
+
'SRC',
|
|
85
|
+
'SRCPATH',
|
|
86
|
+
'SRCDIGEST',
|
|
87
|
+
'PROD',
|
|
88
|
+
'FRESH',
|
|
89
|
+
'SCOPE',
|
|
90
|
+
'PB',
|
|
91
|
+
'NO',
|
|
92
|
+
'LRE',
|
|
93
|
+
'TOK',
|
|
94
|
+
'ACT',
|
|
95
|
+
];
|
|
96
|
+
/**
|
|
97
|
+
* The 5 optional audit keys.
|
|
98
|
+
*/
|
|
99
|
+
export const OPTIONAL_AUDIT_KEYS = ['CTRID', 'RB', 'CHAIN', 'CONF', 'PROSE'];
|
|
100
|
+
//# sourceMappingURL=compressed-receipt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compressed-receipt.js","sourceRoot":"","sources":["../../src/types/compressed-receipt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EACf,2BAA2B,EAC3B,uBAAuB,EACvB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,4EAA4E;IAC5E,2CAA2C;IAC3C,GAAG,EAAE,sBAAsB;IAC3B,oDAAoD;IACpD,OAAO,EAAE,gBAAgB;IACzB,2DAA2D;IAC3D,SAAS,EAAE,gBAAgB;IAC3B,mDAAmD;IACnD,UAAU,EAAE,kBAAkB;IAC9B,6CAA6C;IAC7C,SAAS,EAAE,eAAe;IAC1B,+CAA+C;IAC/C,KAAK,EAAE,eAAe;IACtB,mCAAmC;IACnC,iBAAiB,EAAE,uBAAuB;IAC1C;;;;;;;;OAQG;IACH,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE;QACrD,OAAO,EAAE,iEAAiE;KAC3E,CAAC;IACF,iFAAiF;IACjF,qBAAqB,EAAE,2BAA2B;IAClD;;;OAGG;IACH,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE;QAC7B,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,iDAAiD,EAAE,CAAC;KACjF,CAAC;IACF,6EAA6E;IAC7E,cAAc,EAAE,iBAAiB;IAEjC,4EAA4E;IAC5E,gEAAgE;IAChE,SAAS,EAAE,eAAe,CAAC,QAAQ,EAAE;IACrC,4DAA4D;IAC5D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IAC5C,sDAAsD;IACtD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACrC;;;;OAIG;IACH,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC/C;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAIH;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,KAAK;IACL,SAAS;IACT,WAAW;IACX,MAAM;IACN,OAAO;IACP,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;IACL,KAAK;CACG,CAAC;AAGX;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConflictRecord — first-class contradictions.
|
|
3
|
+
* Source: specs/aletheia-memory-authority-v0.md §6 "Conflict Registry".
|
|
4
|
+
*
|
|
5
|
+
* Rule: contradictions are NEVER overwritten by summaries. They remain
|
|
6
|
+
* queryable until explicitly resolved (or superseded by a later restrictive
|
|
7
|
+
* event).
|
|
8
|
+
*/
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
export declare const ConflictStatusSchema: z.ZodEnum<["unresolved", "resolved", "superseded", "requires_human"]>;
|
|
11
|
+
export type ConflictStatus = z.infer<typeof ConflictStatusSchema>;
|
|
12
|
+
export declare const ConflictDecisionPolicySchema: z.ZodEnum<["surface_conflict", "prefer_latest_authoritative", "ask_human", "abstain"]>;
|
|
13
|
+
export type ConflictDecisionPolicy = z.infer<typeof ConflictDecisionPolicySchema>;
|
|
14
|
+
/**
|
|
15
|
+
* One side of a conflict: which memory makes what claim, with what authority.
|
|
16
|
+
*/
|
|
17
|
+
export declare const ConflictClaimSchema: z.ZodObject<{
|
|
18
|
+
memoryId: z.ZodBranded<z.ZodString, "MemoryId">;
|
|
19
|
+
/** The value the claim asserts (string serialization of any type). */
|
|
20
|
+
value: z.ZodString;
|
|
21
|
+
/** Authority score of this claim at the time the conflict was recorded. */
|
|
22
|
+
authority: z.ZodNumber;
|
|
23
|
+
freshness: z.ZodEnum<["current", "stale", "unknown"]>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
value: string;
|
|
26
|
+
freshness: "unknown" | "current" | "stale";
|
|
27
|
+
authority: number;
|
|
28
|
+
memoryId: string & z.BRAND<"MemoryId">;
|
|
29
|
+
}, {
|
|
30
|
+
value: string;
|
|
31
|
+
freshness: "unknown" | "current" | "stale";
|
|
32
|
+
authority: number;
|
|
33
|
+
memoryId: string;
|
|
34
|
+
}>;
|
|
35
|
+
export type ConflictClaim = z.infer<typeof ConflictClaimSchema>;
|
|
36
|
+
export declare const ConflictRecordSchema: z.ZodObject<{
|
|
37
|
+
conflictId: z.ZodBranded<z.ZodString, "ConflictId">;
|
|
38
|
+
/** Topic of the conflict — what the claims disagree about. */
|
|
39
|
+
topic: z.ZodString;
|
|
40
|
+
scope: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
41
|
+
kind: z.ZodLiteral<"local">;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
kind: "local";
|
|
44
|
+
}, {
|
|
45
|
+
kind: "local";
|
|
46
|
+
}>, z.ZodObject<{
|
|
47
|
+
kind: z.ZodLiteral<"project">;
|
|
48
|
+
projectId: z.ZodString;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
kind: "project";
|
|
51
|
+
projectId: string;
|
|
52
|
+
}, {
|
|
53
|
+
kind: "project";
|
|
54
|
+
projectId: string;
|
|
55
|
+
}>, z.ZodObject<{
|
|
56
|
+
kind: z.ZodLiteral<"user">;
|
|
57
|
+
userId: z.ZodString;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
kind: "user";
|
|
60
|
+
userId: string;
|
|
61
|
+
}, {
|
|
62
|
+
kind: "user";
|
|
63
|
+
userId: string;
|
|
64
|
+
}>, z.ZodObject<{
|
|
65
|
+
kind: z.ZodLiteral<"team">;
|
|
66
|
+
teamId: z.ZodString;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
kind: "team";
|
|
69
|
+
teamId: string;
|
|
70
|
+
}, {
|
|
71
|
+
kind: "team";
|
|
72
|
+
teamId: string;
|
|
73
|
+
}>, z.ZodObject<{
|
|
74
|
+
kind: z.ZodLiteral<"global">;
|
|
75
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
|
+
kind: "global";
|
|
77
|
+
}, {
|
|
78
|
+
kind: "global";
|
|
79
|
+
}>]>;
|
|
80
|
+
/** All claims in conflict (typically 2, sometimes more). */
|
|
81
|
+
claims: z.ZodArray<z.ZodObject<{
|
|
82
|
+
memoryId: z.ZodBranded<z.ZodString, "MemoryId">;
|
|
83
|
+
/** The value the claim asserts (string serialization of any type). */
|
|
84
|
+
value: z.ZodString;
|
|
85
|
+
/** Authority score of this claim at the time the conflict was recorded. */
|
|
86
|
+
authority: z.ZodNumber;
|
|
87
|
+
freshness: z.ZodEnum<["current", "stale", "unknown"]>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
value: string;
|
|
90
|
+
freshness: "unknown" | "current" | "stale";
|
|
91
|
+
authority: number;
|
|
92
|
+
memoryId: string & z.BRAND<"MemoryId">;
|
|
93
|
+
}, {
|
|
94
|
+
value: string;
|
|
95
|
+
freshness: "unknown" | "current" | "stale";
|
|
96
|
+
authority: number;
|
|
97
|
+
memoryId: string;
|
|
98
|
+
}>, "many">;
|
|
99
|
+
status: z.ZodEnum<["unresolved", "resolved", "superseded", "requires_human"]>;
|
|
100
|
+
decisionPolicy: z.ZodEnum<["surface_conflict", "prefer_latest_authoritative", "ask_human", "abstain"]>;
|
|
101
|
+
recordedAt: z.ZodString;
|
|
102
|
+
resolvedAt: z.ZodNullable<z.ZodString>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
status: "requires_human" | "superseded" | "unresolved" | "resolved";
|
|
105
|
+
scope: {
|
|
106
|
+
kind: "local";
|
|
107
|
+
} | {
|
|
108
|
+
kind: "project";
|
|
109
|
+
projectId: string;
|
|
110
|
+
} | {
|
|
111
|
+
kind: "user";
|
|
112
|
+
userId: string;
|
|
113
|
+
} | {
|
|
114
|
+
kind: "team";
|
|
115
|
+
teamId: string;
|
|
116
|
+
} | {
|
|
117
|
+
kind: "global";
|
|
118
|
+
};
|
|
119
|
+
conflictId: string & z.BRAND<"ConflictId">;
|
|
120
|
+
topic: string;
|
|
121
|
+
claims: {
|
|
122
|
+
value: string;
|
|
123
|
+
freshness: "unknown" | "current" | "stale";
|
|
124
|
+
authority: number;
|
|
125
|
+
memoryId: string & z.BRAND<"MemoryId">;
|
|
126
|
+
}[];
|
|
127
|
+
decisionPolicy: "surface_conflict" | "prefer_latest_authoritative" | "ask_human" | "abstain";
|
|
128
|
+
recordedAt: string;
|
|
129
|
+
resolvedAt: string | null;
|
|
130
|
+
}, {
|
|
131
|
+
status: "requires_human" | "superseded" | "unresolved" | "resolved";
|
|
132
|
+
scope: {
|
|
133
|
+
kind: "local";
|
|
134
|
+
} | {
|
|
135
|
+
kind: "project";
|
|
136
|
+
projectId: string;
|
|
137
|
+
} | {
|
|
138
|
+
kind: "user";
|
|
139
|
+
userId: string;
|
|
140
|
+
} | {
|
|
141
|
+
kind: "team";
|
|
142
|
+
teamId: string;
|
|
143
|
+
} | {
|
|
144
|
+
kind: "global";
|
|
145
|
+
};
|
|
146
|
+
conflictId: string;
|
|
147
|
+
topic: string;
|
|
148
|
+
claims: {
|
|
149
|
+
value: string;
|
|
150
|
+
freshness: "unknown" | "current" | "stale";
|
|
151
|
+
authority: number;
|
|
152
|
+
memoryId: string;
|
|
153
|
+
}[];
|
|
154
|
+
decisionPolicy: "surface_conflict" | "prefer_latest_authoritative" | "ask_human" | "abstain";
|
|
155
|
+
recordedAt: string;
|
|
156
|
+
resolvedAt: string | null;
|
|
157
|
+
}>;
|
|
158
|
+
export type ConflictRecord = z.infer<typeof ConflictRecordSchema>;
|
|
159
|
+
//# sourceMappingURL=conflict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../src/types/conflict.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,oBAAoB,uEAK/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,4BAA4B,wFAKvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;IAE9B,sEAAsE;;IAEtE,2EAA2E;;;;;;;;;;;;;EAG3E,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,oBAAoB;;IAE/B,8DAA8D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAG9D,4DAA4D;;;QAb5D,sEAAsE;;QAEtE,2EAA2E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiB3E,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|