@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.
Files changed (119) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +163 -0
  3. package/dist/index.d.ts +18 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +21 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/runtime/action-authorizer.d.ts +48 -0
  8. package/dist/runtime/action-authorizer.d.ts.map +1 -0
  9. package/dist/runtime/action-authorizer.js +231 -0
  10. package/dist/runtime/action-authorizer.js.map +1 -0
  11. package/dist/runtime/authority-engine.d.ts +68 -0
  12. package/dist/runtime/authority-engine.d.ts.map +1 -0
  13. package/dist/runtime/authority-engine.js +99 -0
  14. package/dist/runtime/authority-engine.js.map +1 -0
  15. package/dist/runtime/decision-helpers.d.ts +17 -0
  16. package/dist/runtime/decision-helpers.d.ts.map +1 -0
  17. package/dist/runtime/decision-helpers.js +23 -0
  18. package/dist/runtime/decision-helpers.js.map +1 -0
  19. package/dist/runtime/index.d.ts +9 -0
  20. package/dist/runtime/index.d.ts.map +1 -0
  21. package/dist/runtime/index.js +9 -0
  22. package/dist/runtime/index.js.map +1 -0
  23. package/dist/runtime/proposal-safety.d.ts +18 -0
  24. package/dist/runtime/proposal-safety.d.ts.map +1 -0
  25. package/dist/runtime/proposal-safety.js +76 -0
  26. package/dist/runtime/proposal-safety.js.map +1 -0
  27. package/dist/runtime/retrieval-router.d.ts +60 -0
  28. package/dist/runtime/retrieval-router.d.ts.map +1 -0
  29. package/dist/runtime/retrieval-router.js +223 -0
  30. package/dist/runtime/retrieval-router.js.map +1 -0
  31. package/dist/runtime/scope-helpers.d.ts +22 -0
  32. package/dist/runtime/scope-helpers.d.ts.map +1 -0
  33. package/dist/runtime/scope-helpers.js +29 -0
  34. package/dist/runtime/scope-helpers.js.map +1 -0
  35. package/dist/runtime/visibility-policy.d.ts +29 -0
  36. package/dist/runtime/visibility-policy.d.ts.map +1 -0
  37. package/dist/runtime/visibility-policy.js +23 -0
  38. package/dist/runtime/visibility-policy.js.map +1 -0
  39. package/dist/runtime/write-gate.d.ts +66 -0
  40. package/dist/runtime/write-gate.d.ts.map +1 -0
  41. package/dist/runtime/write-gate.js +293 -0
  42. package/dist/runtime/write-gate.js.map +1 -0
  43. package/dist/storage/conflict-registry.d.ts +61 -0
  44. package/dist/storage/conflict-registry.d.ts.map +1 -0
  45. package/dist/storage/conflict-registry.js +15 -0
  46. package/dist/storage/conflict-registry.js.map +1 -0
  47. package/dist/storage/event-ledger.d.ts +61 -0
  48. package/dist/storage/event-ledger.d.ts.map +1 -0
  49. package/dist/storage/event-ledger.js +14 -0
  50. package/dist/storage/event-ledger.js.map +1 -0
  51. package/dist/storage/index.d.ts +8 -0
  52. package/dist/storage/index.d.ts.map +1 -0
  53. package/dist/storage/index.js +8 -0
  54. package/dist/storage/index.js.map +1 -0
  55. package/dist/storage/memory-store.d.ts +94 -0
  56. package/dist/storage/memory-store.d.ts.map +1 -0
  57. package/dist/storage/memory-store.js +14 -0
  58. package/dist/storage/memory-store.js.map +1 -0
  59. package/dist/types/action.d.ts +211 -0
  60. package/dist/types/action.d.ts.map +1 -0
  61. package/dist/types/action.js +50 -0
  62. package/dist/types/action.js.map +1 -0
  63. package/dist/types/compressed-receipt.d.ts +117 -0
  64. package/dist/types/compressed-receipt.d.ts.map +1 -0
  65. package/dist/types/compressed-receipt.js +100 -0
  66. package/dist/types/compressed-receipt.js.map +1 -0
  67. package/dist/types/conflict.d.ts +159 -0
  68. package/dist/types/conflict.d.ts.map +1 -0
  69. package/dist/types/conflict.js +47 -0
  70. package/dist/types/conflict.js.map +1 -0
  71. package/dist/types/coverage.d.ts +52 -0
  72. package/dist/types/coverage.d.ts.map +1 -0
  73. package/dist/types/coverage.js +30 -0
  74. package/dist/types/coverage.js.map +1 -0
  75. package/dist/types/decision.d.ts +345 -0
  76. package/dist/types/decision.d.ts.map +1 -0
  77. package/dist/types/decision.js +88 -0
  78. package/dist/types/decision.js.map +1 -0
  79. package/dist/types/enums.d.ts +135 -0
  80. package/dist/types/enums.d.ts.map +1 -0
  81. package/dist/types/enums.js +146 -0
  82. package/dist/types/enums.js.map +1 -0
  83. package/dist/types/event.d.ts +187 -0
  84. package/dist/types/event.d.ts.map +1 -0
  85. package/dist/types/event.js +44 -0
  86. package/dist/types/event.js.map +1 -0
  87. package/dist/types/human-receipt.d.ts +108 -0
  88. package/dist/types/human-receipt.d.ts.map +1 -0
  89. package/dist/types/human-receipt.js +41 -0
  90. package/dist/types/human-receipt.js.map +1 -0
  91. package/dist/types/index.d.ts +25 -0
  92. package/dist/types/index.d.ts.map +1 -0
  93. package/dist/types/index.js +25 -0
  94. package/dist/types/index.js.map +1 -0
  95. package/dist/types/keys.d.ts +31 -0
  96. package/dist/types/keys.d.ts.map +1 -0
  97. package/dist/types/keys.js +53 -0
  98. package/dist/types/keys.js.map +1 -0
  99. package/dist/types/memory-atom.d.ts +291 -0
  100. package/dist/types/memory-atom.d.ts.map +1 -0
  101. package/dist/types/memory-atom.js +62 -0
  102. package/dist/types/memory-atom.js.map +1 -0
  103. package/dist/types/memory-proposal.d.ts +207 -0
  104. package/dist/types/memory-proposal.d.ts.map +1 -0
  105. package/dist/types/memory-proposal.js +34 -0
  106. package/dist/types/memory-proposal.js.map +1 -0
  107. package/dist/types/packet.d.ts +564 -0
  108. package/dist/types/packet.d.ts.map +1 -0
  109. package/dist/types/packet.js +43 -0
  110. package/dist/types/packet.js.map +1 -0
  111. package/dist/types/primitives.d.ts +39 -0
  112. package/dist/types/primitives.d.ts.map +1 -0
  113. package/dist/types/primitives.js +42 -0
  114. package/dist/types/primitives.js.map +1 -0
  115. package/dist/types/status-transitions.d.ts +23 -0
  116. package/dist/types/status-transitions.d.ts.map +1 -0
  117. package/dist/types/status-transitions.js +48 -0
  118. package/dist/types/status-transitions.js.map +1 -0
  119. package/package.json +57 -0
@@ -0,0 +1,564 @@
1
+ /**
2
+ * ActionContextPacket — the handoff packet given to an acting agent.
3
+ * Source: specs/aletheia-memory-authority-v0.md §8.
4
+ *
5
+ * Hard rule: this is NOT a permission token. The receiving agent must STILL
6
+ * classify the proposed action and run the receiver algorithm. The packet
7
+ * carries the data needed to do that, not the decision itself.
8
+ */
9
+ import { z } from 'zod';
10
+ /**
11
+ * Per-cited-memory bundle: the atom id + the receipt that justifies citing it.
12
+ */
13
+ export declare const CitedMemorySchema: z.ZodObject<{
14
+ memoryId: z.ZodBranded<z.ZodString, "MemoryId">;
15
+ receipt: z.ZodObject<{
16
+ src: z.ZodBranded<z.ZodString, "SourceArtifactId">;
17
+ srcPath: z.ZodEffects<z.ZodString, string, string>;
18
+ srcDigest: z.ZodString;
19
+ producedAt: z.ZodString;
20
+ freshness: z.ZodEnum<["current", "stale", "unknown"]>;
21
+ scope: z.ZodEnum<["local", "project", "user", "team", "global"]>;
22
+ promotionBoundary: z.ZodEnum<["no_memory_write", "no_durable_promotion", "human_confirmation_required"]>;
23
+ forbiddenEffects: z.ZodArray<z.ZodEnum<["local_only", "no_runtime_effect", "external_send_requires_human", "config_change_forbidden"]>, "many">;
24
+ laterRestrictiveEvent: z.ZodEnum<["none", "superseded", "tombstoned", "conflict_unresolved", "unknown"]>;
25
+ tupleComplete: z.ZodLiteral<true>;
26
+ 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"]>;
27
+ receiptId: z.ZodOptional<z.ZodBranded<z.ZodString, "ReceiptId">>;
28
+ receiverHint: z.ZodOptional<z.ZodString>;
29
+ chain: z.ZodOptional<z.ZodString>;
30
+ confidence: z.ZodOptional<z.ZodNumber>;
31
+ prose: z.ZodOptional<z.ZodString>;
32
+ }, "strip", z.ZodTypeAny, {
33
+ freshness: "unknown" | "current" | "stale";
34
+ scope: "team" | "local" | "project" | "user" | "global";
35
+ src: string & z.BRAND<"SourceArtifactId">;
36
+ srcPath: string;
37
+ srcDigest: string;
38
+ producedAt: string;
39
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
40
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
41
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
42
+ tupleComplete: true;
43
+ 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";
44
+ confidence?: number | undefined;
45
+ receiptId?: (string & z.BRAND<"ReceiptId">) | undefined;
46
+ receiverHint?: string | undefined;
47
+ chain?: string | undefined;
48
+ prose?: string | undefined;
49
+ }, {
50
+ freshness: "unknown" | "current" | "stale";
51
+ scope: "team" | "local" | "project" | "user" | "global";
52
+ src: string;
53
+ srcPath: string;
54
+ srcDigest: string;
55
+ producedAt: string;
56
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
57
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
58
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
59
+ tupleComplete: true;
60
+ 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";
61
+ confidence?: number | undefined;
62
+ receiptId?: string | undefined;
63
+ receiverHint?: string | undefined;
64
+ chain?: string | undefined;
65
+ prose?: string | undefined;
66
+ }>;
67
+ }, "strip", z.ZodTypeAny, {
68
+ memoryId: string & z.BRAND<"MemoryId">;
69
+ receipt: {
70
+ freshness: "unknown" | "current" | "stale";
71
+ scope: "team" | "local" | "project" | "user" | "global";
72
+ src: string & z.BRAND<"SourceArtifactId">;
73
+ srcPath: string;
74
+ srcDigest: string;
75
+ producedAt: string;
76
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
77
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
78
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
79
+ tupleComplete: true;
80
+ 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";
81
+ confidence?: number | undefined;
82
+ receiptId?: (string & z.BRAND<"ReceiptId">) | undefined;
83
+ receiverHint?: string | undefined;
84
+ chain?: string | undefined;
85
+ prose?: string | undefined;
86
+ };
87
+ }, {
88
+ memoryId: string;
89
+ receipt: {
90
+ freshness: "unknown" | "current" | "stale";
91
+ scope: "team" | "local" | "project" | "user" | "global";
92
+ src: string;
93
+ srcPath: string;
94
+ srcDigest: string;
95
+ producedAt: string;
96
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
97
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
98
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
99
+ tupleComplete: true;
100
+ 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";
101
+ confidence?: number | undefined;
102
+ receiptId?: string | undefined;
103
+ receiverHint?: string | undefined;
104
+ chain?: string | undefined;
105
+ prose?: string | undefined;
106
+ };
107
+ }>;
108
+ export type CitedMemory = z.infer<typeof CitedMemorySchema>;
109
+ export declare const ActionContextPacketSchema: z.ZodObject<{
110
+ /** Scope within which the receiver is being asked to act. */
111
+ scope: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
112
+ kind: z.ZodLiteral<"local">;
113
+ }, "strip", z.ZodTypeAny, {
114
+ kind: "local";
115
+ }, {
116
+ kind: "local";
117
+ }>, z.ZodObject<{
118
+ kind: z.ZodLiteral<"project">;
119
+ projectId: z.ZodString;
120
+ }, "strip", z.ZodTypeAny, {
121
+ kind: "project";
122
+ projectId: string;
123
+ }, {
124
+ kind: "project";
125
+ projectId: string;
126
+ }>, z.ZodObject<{
127
+ kind: z.ZodLiteral<"user">;
128
+ userId: z.ZodString;
129
+ }, "strip", z.ZodTypeAny, {
130
+ kind: "user";
131
+ userId: string;
132
+ }, {
133
+ kind: "user";
134
+ userId: string;
135
+ }>, z.ZodObject<{
136
+ kind: z.ZodLiteral<"team">;
137
+ teamId: z.ZodString;
138
+ }, "strip", z.ZodTypeAny, {
139
+ kind: "team";
140
+ teamId: string;
141
+ }, {
142
+ kind: "team";
143
+ teamId: string;
144
+ }>, z.ZodObject<{
145
+ kind: z.ZodLiteral<"global">;
146
+ }, "strip", z.ZodTypeAny, {
147
+ kind: "global";
148
+ }, {
149
+ kind: "global";
150
+ }>]>;
151
+ /** Memories the proposer cited as authority. */
152
+ citedMemories: z.ZodArray<z.ZodObject<{
153
+ memoryId: z.ZodBranded<z.ZodString, "MemoryId">;
154
+ receipt: z.ZodObject<{
155
+ src: z.ZodBranded<z.ZodString, "SourceArtifactId">;
156
+ srcPath: z.ZodEffects<z.ZodString, string, string>;
157
+ srcDigest: z.ZodString;
158
+ producedAt: z.ZodString;
159
+ freshness: z.ZodEnum<["current", "stale", "unknown"]>;
160
+ scope: z.ZodEnum<["local", "project", "user", "team", "global"]>;
161
+ promotionBoundary: z.ZodEnum<["no_memory_write", "no_durable_promotion", "human_confirmation_required"]>;
162
+ forbiddenEffects: z.ZodArray<z.ZodEnum<["local_only", "no_runtime_effect", "external_send_requires_human", "config_change_forbidden"]>, "many">;
163
+ laterRestrictiveEvent: z.ZodEnum<["none", "superseded", "tombstoned", "conflict_unresolved", "unknown"]>;
164
+ tupleComplete: z.ZodLiteral<true>;
165
+ 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"]>;
166
+ receiptId: z.ZodOptional<z.ZodBranded<z.ZodString, "ReceiptId">>;
167
+ receiverHint: z.ZodOptional<z.ZodString>;
168
+ chain: z.ZodOptional<z.ZodString>;
169
+ confidence: z.ZodOptional<z.ZodNumber>;
170
+ prose: z.ZodOptional<z.ZodString>;
171
+ }, "strip", z.ZodTypeAny, {
172
+ freshness: "unknown" | "current" | "stale";
173
+ scope: "team" | "local" | "project" | "user" | "global";
174
+ src: string & z.BRAND<"SourceArtifactId">;
175
+ srcPath: string;
176
+ srcDigest: string;
177
+ producedAt: string;
178
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
179
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
180
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
181
+ tupleComplete: true;
182
+ 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";
183
+ confidence?: number | undefined;
184
+ receiptId?: (string & z.BRAND<"ReceiptId">) | undefined;
185
+ receiverHint?: string | undefined;
186
+ chain?: string | undefined;
187
+ prose?: string | undefined;
188
+ }, {
189
+ freshness: "unknown" | "current" | "stale";
190
+ scope: "team" | "local" | "project" | "user" | "global";
191
+ src: string;
192
+ srcPath: string;
193
+ srcDigest: string;
194
+ producedAt: string;
195
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
196
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
197
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
198
+ tupleComplete: true;
199
+ 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";
200
+ confidence?: number | undefined;
201
+ receiptId?: string | undefined;
202
+ receiverHint?: string | undefined;
203
+ chain?: string | undefined;
204
+ prose?: string | undefined;
205
+ }>;
206
+ }, "strip", z.ZodTypeAny, {
207
+ memoryId: string & z.BRAND<"MemoryId">;
208
+ receipt: {
209
+ freshness: "unknown" | "current" | "stale";
210
+ scope: "team" | "local" | "project" | "user" | "global";
211
+ src: string & z.BRAND<"SourceArtifactId">;
212
+ srcPath: string;
213
+ srcDigest: string;
214
+ producedAt: string;
215
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
216
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
217
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
218
+ tupleComplete: true;
219
+ 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";
220
+ confidence?: number | undefined;
221
+ receiptId?: (string & z.BRAND<"ReceiptId">) | undefined;
222
+ receiverHint?: string | undefined;
223
+ chain?: string | undefined;
224
+ prose?: string | undefined;
225
+ };
226
+ }, {
227
+ memoryId: string;
228
+ receipt: {
229
+ freshness: "unknown" | "current" | "stale";
230
+ scope: "team" | "local" | "project" | "user" | "global";
231
+ src: string;
232
+ srcPath: string;
233
+ srcDigest: string;
234
+ producedAt: string;
235
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
236
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
237
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
238
+ tupleComplete: true;
239
+ 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";
240
+ confidence?: number | undefined;
241
+ receiptId?: string | undefined;
242
+ receiverHint?: string | undefined;
243
+ chain?: string | undefined;
244
+ prose?: string | undefined;
245
+ };
246
+ }>, "many">;
247
+ /** Coverage info: what should have been retrieved vs what was. */
248
+ coverage: z.ZodEffects<z.ZodEffects<z.ZodObject<{
249
+ highBoundaryTotal: z.ZodNumber;
250
+ retrievedHighBoundary: z.ZodNumber;
251
+ missingHighBoundaryDigests: z.ZodArray<z.ZodString, "many">;
252
+ coverageDecision: z.ZodEnum<["complete", "partial", "critical_gap", "absent"]>;
253
+ }, "strip", z.ZodTypeAny, {
254
+ highBoundaryTotal: number;
255
+ retrievedHighBoundary: number;
256
+ missingHighBoundaryDigests: string[];
257
+ coverageDecision: "partial" | "complete" | "critical_gap" | "absent";
258
+ }, {
259
+ highBoundaryTotal: number;
260
+ retrievedHighBoundary: number;
261
+ missingHighBoundaryDigests: string[];
262
+ coverageDecision: "partial" | "complete" | "critical_gap" | "absent";
263
+ }>, {
264
+ highBoundaryTotal: number;
265
+ retrievedHighBoundary: number;
266
+ missingHighBoundaryDigests: string[];
267
+ coverageDecision: "partial" | "complete" | "critical_gap" | "absent";
268
+ }, {
269
+ highBoundaryTotal: number;
270
+ retrievedHighBoundary: number;
271
+ missingHighBoundaryDigests: string[];
272
+ coverageDecision: "partial" | "complete" | "critical_gap" | "absent";
273
+ }>, {
274
+ highBoundaryTotal: number;
275
+ retrievedHighBoundary: number;
276
+ missingHighBoundaryDigests: string[];
277
+ coverageDecision: "partial" | "complete" | "critical_gap" | "absent";
278
+ }, {
279
+ highBoundaryTotal: number;
280
+ retrievedHighBoundary: number;
281
+ missingHighBoundaryDigests: string[];
282
+ coverageDecision: "partial" | "complete" | "critical_gap" | "absent";
283
+ }>;
284
+ /** Any conflicts touching these memories or this topic. */
285
+ relatedConflicts: z.ZodArray<z.ZodObject<{
286
+ conflictId: z.ZodBranded<z.ZodString, "ConflictId">;
287
+ topic: z.ZodString;
288
+ scope: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
289
+ kind: z.ZodLiteral<"local">;
290
+ }, "strip", z.ZodTypeAny, {
291
+ kind: "local";
292
+ }, {
293
+ kind: "local";
294
+ }>, z.ZodObject<{
295
+ kind: z.ZodLiteral<"project">;
296
+ projectId: z.ZodString;
297
+ }, "strip", z.ZodTypeAny, {
298
+ kind: "project";
299
+ projectId: string;
300
+ }, {
301
+ kind: "project";
302
+ projectId: string;
303
+ }>, z.ZodObject<{
304
+ kind: z.ZodLiteral<"user">;
305
+ userId: z.ZodString;
306
+ }, "strip", z.ZodTypeAny, {
307
+ kind: "user";
308
+ userId: string;
309
+ }, {
310
+ kind: "user";
311
+ userId: string;
312
+ }>, z.ZodObject<{
313
+ kind: z.ZodLiteral<"team">;
314
+ teamId: z.ZodString;
315
+ }, "strip", z.ZodTypeAny, {
316
+ kind: "team";
317
+ teamId: string;
318
+ }, {
319
+ kind: "team";
320
+ teamId: string;
321
+ }>, z.ZodObject<{
322
+ kind: z.ZodLiteral<"global">;
323
+ }, "strip", z.ZodTypeAny, {
324
+ kind: "global";
325
+ }, {
326
+ kind: "global";
327
+ }>]>;
328
+ claims: z.ZodArray<z.ZodObject<{
329
+ memoryId: z.ZodBranded<z.ZodString, "MemoryId">;
330
+ value: z.ZodString;
331
+ authority: z.ZodNumber;
332
+ freshness: z.ZodEnum<["current", "stale", "unknown"]>;
333
+ }, "strip", z.ZodTypeAny, {
334
+ value: string;
335
+ authority: number;
336
+ freshness: "unknown" | "current" | "stale";
337
+ memoryId: string & z.BRAND<"MemoryId">;
338
+ }, {
339
+ value: string;
340
+ authority: number;
341
+ freshness: "unknown" | "current" | "stale";
342
+ memoryId: string;
343
+ }>, "many">;
344
+ status: z.ZodEnum<["unresolved", "resolved", "superseded", "requires_human"]>;
345
+ decisionPolicy: z.ZodEnum<["surface_conflict", "prefer_latest_authoritative", "ask_human", "abstain"]>;
346
+ recordedAt: z.ZodString;
347
+ resolvedAt: z.ZodNullable<z.ZodString>;
348
+ }, "strip", z.ZodTypeAny, {
349
+ status: "requires_human" | "superseded" | "unresolved" | "resolved";
350
+ scope: {
351
+ kind: "local";
352
+ } | {
353
+ kind: "project";
354
+ projectId: string;
355
+ } | {
356
+ kind: "user";
357
+ userId: string;
358
+ } | {
359
+ kind: "team";
360
+ teamId: string;
361
+ } | {
362
+ kind: "global";
363
+ };
364
+ conflictId: string & z.BRAND<"ConflictId">;
365
+ topic: string;
366
+ claims: {
367
+ value: string;
368
+ authority: number;
369
+ freshness: "unknown" | "current" | "stale";
370
+ memoryId: string & z.BRAND<"MemoryId">;
371
+ }[];
372
+ decisionPolicy: "surface_conflict" | "prefer_latest_authoritative" | "ask_human" | "abstain";
373
+ recordedAt: string;
374
+ resolvedAt: string | null;
375
+ }, {
376
+ status: "requires_human" | "superseded" | "unresolved" | "resolved";
377
+ scope: {
378
+ kind: "local";
379
+ } | {
380
+ kind: "project";
381
+ projectId: string;
382
+ } | {
383
+ kind: "user";
384
+ userId: string;
385
+ } | {
386
+ kind: "team";
387
+ teamId: string;
388
+ } | {
389
+ kind: "global";
390
+ };
391
+ conflictId: string;
392
+ topic: string;
393
+ claims: {
394
+ value: string;
395
+ authority: number;
396
+ freshness: "unknown" | "current" | "stale";
397
+ memoryId: string;
398
+ }[];
399
+ decisionPolicy: "surface_conflict" | "prefer_latest_authoritative" | "ask_human" | "abstain";
400
+ recordedAt: string;
401
+ resolvedAt: string | null;
402
+ }>, "many">;
403
+ /** Explicit forbidden effects the receiver must honor. */
404
+ forbiddenEffects: z.ZodArray<z.ZodString, "many">;
405
+ /** Promotion boundary applicable to this packet. */
406
+ promotionBoundary: z.ZodString;
407
+ /**
408
+ * Instructions for the receiver. Must include the fail-closed rule:
409
+ * "verify everything before acting".
410
+ */
411
+ receiverInstructions: z.ZodString;
412
+ /** When the packet was assembled. */
413
+ assembledAt: z.ZodString;
414
+ }, "strip", z.ZodTypeAny, {
415
+ scope: {
416
+ kind: "local";
417
+ } | {
418
+ kind: "project";
419
+ projectId: string;
420
+ } | {
421
+ kind: "user";
422
+ userId: string;
423
+ } | {
424
+ kind: "team";
425
+ teamId: string;
426
+ } | {
427
+ kind: "global";
428
+ };
429
+ promotionBoundary: string;
430
+ forbiddenEffects: string[];
431
+ citedMemories: {
432
+ memoryId: string & z.BRAND<"MemoryId">;
433
+ receipt: {
434
+ freshness: "unknown" | "current" | "stale";
435
+ scope: "team" | "local" | "project" | "user" | "global";
436
+ src: string & z.BRAND<"SourceArtifactId">;
437
+ srcPath: string;
438
+ srcDigest: string;
439
+ producedAt: string;
440
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
441
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
442
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
443
+ tupleComplete: true;
444
+ 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";
445
+ confidence?: number | undefined;
446
+ receiptId?: (string & z.BRAND<"ReceiptId">) | undefined;
447
+ receiverHint?: string | undefined;
448
+ chain?: string | undefined;
449
+ prose?: string | undefined;
450
+ };
451
+ }[];
452
+ coverage: {
453
+ highBoundaryTotal: number;
454
+ retrievedHighBoundary: number;
455
+ missingHighBoundaryDigests: string[];
456
+ coverageDecision: "partial" | "complete" | "critical_gap" | "absent";
457
+ };
458
+ relatedConflicts: {
459
+ status: "requires_human" | "superseded" | "unresolved" | "resolved";
460
+ scope: {
461
+ kind: "local";
462
+ } | {
463
+ kind: "project";
464
+ projectId: string;
465
+ } | {
466
+ kind: "user";
467
+ userId: string;
468
+ } | {
469
+ kind: "team";
470
+ teamId: string;
471
+ } | {
472
+ kind: "global";
473
+ };
474
+ conflictId: string & z.BRAND<"ConflictId">;
475
+ topic: string;
476
+ claims: {
477
+ value: string;
478
+ authority: number;
479
+ freshness: "unknown" | "current" | "stale";
480
+ memoryId: string & z.BRAND<"MemoryId">;
481
+ }[];
482
+ decisionPolicy: "surface_conflict" | "prefer_latest_authoritative" | "ask_human" | "abstain";
483
+ recordedAt: string;
484
+ resolvedAt: string | null;
485
+ }[];
486
+ receiverInstructions: string;
487
+ assembledAt: string;
488
+ }, {
489
+ scope: {
490
+ kind: "local";
491
+ } | {
492
+ kind: "project";
493
+ projectId: string;
494
+ } | {
495
+ kind: "user";
496
+ userId: string;
497
+ } | {
498
+ kind: "team";
499
+ teamId: string;
500
+ } | {
501
+ kind: "global";
502
+ };
503
+ promotionBoundary: string;
504
+ forbiddenEffects: string[];
505
+ citedMemories: {
506
+ memoryId: string;
507
+ receipt: {
508
+ freshness: "unknown" | "current" | "stale";
509
+ scope: "team" | "local" | "project" | "user" | "global";
510
+ src: string;
511
+ srcPath: string;
512
+ srcDigest: string;
513
+ producedAt: string;
514
+ promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
515
+ forbiddenEffects: ("local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden")[];
516
+ laterRestrictiveEvent: "unknown" | "none" | "superseded" | "tombstoned" | "conflict_unresolved";
517
+ tupleComplete: true;
518
+ 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";
519
+ confidence?: number | undefined;
520
+ receiptId?: string | undefined;
521
+ receiverHint?: string | undefined;
522
+ chain?: string | undefined;
523
+ prose?: string | undefined;
524
+ };
525
+ }[];
526
+ coverage: {
527
+ highBoundaryTotal: number;
528
+ retrievedHighBoundary: number;
529
+ missingHighBoundaryDigests: string[];
530
+ coverageDecision: "partial" | "complete" | "critical_gap" | "absent";
531
+ };
532
+ relatedConflicts: {
533
+ status: "requires_human" | "superseded" | "unresolved" | "resolved";
534
+ scope: {
535
+ kind: "local";
536
+ } | {
537
+ kind: "project";
538
+ projectId: string;
539
+ } | {
540
+ kind: "user";
541
+ userId: string;
542
+ } | {
543
+ kind: "team";
544
+ teamId: string;
545
+ } | {
546
+ kind: "global";
547
+ };
548
+ conflictId: string;
549
+ topic: string;
550
+ claims: {
551
+ value: string;
552
+ authority: number;
553
+ freshness: "unknown" | "current" | "stale";
554
+ memoryId: string;
555
+ }[];
556
+ decisionPolicy: "surface_conflict" | "prefer_latest_authoritative" | "ask_human" | "abstain";
557
+ recordedAt: string;
558
+ resolvedAt: string | null;
559
+ }[];
560
+ receiverInstructions: string;
561
+ assembledAt: string;
562
+ }>;
563
+ export type ActionContextPacket = z.infer<typeof ActionContextPacketSchema>;
564
+ //# sourceMappingURL=packet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packet.d.ts","sourceRoot":"","sources":["../../src/types/packet.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,yBAAyB;IACpC,6DAA6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE7D,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEhD,kEAAkE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAElE,2DAA2D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAE3D,0DAA0D;;IAE1D,oDAAoD;;IAEpD;;;OAGG;;IAEH,qCAAqC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAErC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * ActionContextPacket — the handoff packet given to an acting agent.
3
+ * Source: specs/aletheia-memory-authority-v0.md §8.
4
+ *
5
+ * Hard rule: this is NOT a permission token. The receiving agent must STILL
6
+ * classify the proposed action and run the receiver algorithm. The packet
7
+ * carries the data needed to do that, not the decision itself.
8
+ */
9
+ import { z } from 'zod';
10
+ import { CompressedReceiptSchema } from './compressed-receipt.js';
11
+ import { ConflictRecordSchema } from './conflict.js';
12
+ import { CoverageReceiptSchema } from './coverage.js';
13
+ import { ScopeSchema } from './enums.js';
14
+ import { IsoTimestampSchema, MemoryIdSchema } from './primitives.js';
15
+ /**
16
+ * Per-cited-memory bundle: the atom id + the receipt that justifies citing it.
17
+ */
18
+ export const CitedMemorySchema = z.object({
19
+ memoryId: MemoryIdSchema,
20
+ receipt: CompressedReceiptSchema,
21
+ });
22
+ export const ActionContextPacketSchema = z.object({
23
+ /** Scope within which the receiver is being asked to act. */
24
+ scope: ScopeSchema,
25
+ /** Memories the proposer cited as authority. */
26
+ citedMemories: z.array(CitedMemorySchema),
27
+ /** Coverage info: what should have been retrieved vs what was. */
28
+ coverage: CoverageReceiptSchema,
29
+ /** Any conflicts touching these memories or this topic. */
30
+ relatedConflicts: z.array(ConflictRecordSchema),
31
+ /** Explicit forbidden effects the receiver must honor. */
32
+ forbiddenEffects: z.array(z.string().min(1)),
33
+ /** Promotion boundary applicable to this packet. */
34
+ promotionBoundary: z.string().min(1),
35
+ /**
36
+ * Instructions for the receiver. Must include the fail-closed rule:
37
+ * "verify everything before acting".
38
+ */
39
+ receiverInstructions: z.string().min(1).max(8192),
40
+ /** When the packet was assembled. */
41
+ assembledAt: IsoTimestampSchema,
42
+ });
43
+ //# sourceMappingURL=packet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packet.js","sourceRoot":"","sources":["../../src/types/packet.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,QAAQ,EAAE,cAAc;IACxB,OAAO,EAAE,uBAAuB;CACjC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,6DAA6D;IAC7D,KAAK,EAAE,WAAW;IAClB,gDAAgD;IAChD,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;IACzC,kEAAkE;IAClE,QAAQ,EAAE,qBAAqB;IAC/B,2DAA2D;IAC3D,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC;IAC/C,0DAA0D;IAC1D,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5C,oDAAoD;IACpD,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC;;;OAGG;IACH,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACjD,qCAAqC;IACrC,WAAW,EAAE,kBAAkB;CAChC,CAAC,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Primitive value objects shared across all domain types.
3
+ *
4
+ * All identifiers are zod-branded strings: at runtime a `MemoryId` and an
5
+ * `EventId` are both strings; TypeScript enforces nominal separation so they
6
+ * cannot be mixed. The single source of truth is the zod schema — types are
7
+ * derived from it via `z.infer`.
8
+ */
9
+ import { z } from 'zod';
10
+ export declare const MemoryIdSchema: z.ZodBranded<z.ZodString, "MemoryId">;
11
+ export type MemoryId = z.infer<typeof MemoryIdSchema>;
12
+ export declare const EventIdSchema: z.ZodBranded<z.ZodString, "EventId">;
13
+ export type EventId = z.infer<typeof EventIdSchema>;
14
+ export declare const ProposalIdSchema: z.ZodBranded<z.ZodString, "ProposalId">;
15
+ export type ProposalId = z.infer<typeof ProposalIdSchema>;
16
+ export declare const ConflictIdSchema: z.ZodBranded<z.ZodString, "ConflictId">;
17
+ export type ConflictId = z.infer<typeof ConflictIdSchema>;
18
+ export declare const AgentIdSchema: z.ZodBranded<z.ZodString, "AgentId">;
19
+ export type AgentId = z.infer<typeof AgentIdSchema>;
20
+ export declare const SourceArtifactIdSchema: z.ZodBranded<z.ZodString, "SourceArtifactId">;
21
+ export type SourceArtifactId = z.infer<typeof SourceArtifactIdSchema>;
22
+ export declare const ReceiptIdSchema: z.ZodBranded<z.ZodString, "ReceiptId">;
23
+ export type ReceiptId = z.infer<typeof ReceiptIdSchema>;
24
+ /** ISO-8601 UTC timestamp. We never accept partial dates or local timezones. */
25
+ export declare const IsoTimestampSchema: z.ZodString;
26
+ export type IsoTimestamp = z.infer<typeof IsoTimestampSchema>;
27
+ /**
28
+ * Content digest of a source artifact. We accept any well-formed hex hash
29
+ * (sha256, blake3, etc.) — the algorithm is implicit in the lane that produced it.
30
+ */
31
+ export declare const HashDigestSchema: z.ZodString;
32
+ export type HashDigest = z.infer<typeof HashDigestSchema>;
33
+ /**
34
+ * Path or registry lane to the source artifact. NOT prose: must be resolvable
35
+ * to a real artifact by the source-lane resolver.
36
+ */
37
+ export declare const SourcePathSchema: z.ZodEffects<z.ZodString, string, string>;
38
+ export type SourcePath = z.infer<typeof SourcePathSchema>;
39
+ //# sourceMappingURL=primitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../../src/types/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,cAAc,uCAA8B,CAAC;AAC1D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,aAAa,sCAA6B,CAAC;AACxD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,gBAAgB,yCAAgC,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,gBAAgB,yCAAgC,CAAC;AAC9D,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,aAAa,sCAA6B,CAAC;AACxD,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAEpD,eAAO,MAAM,sBAAsB,+CAAsC,CAAC;AAC1E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,eAAe,wCAA+B,CAAC;AAC5D,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAIxD,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,aAE+D,CAAC;AAC/F,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,aAEmD,CAAC;AACjF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D;;;GAGG;AACH,eAAO,MAAM,gBAAgB,2CAI6C,CAAC;AAC3E,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}