@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,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumerated value sets used across the receipt and atom protocols.
|
|
3
|
+
*
|
|
4
|
+
* Every union here is "fail-closed by default": adding a new variant requires
|
|
5
|
+
* a deliberate spec change. Unknown strings parsed into these schemas reject.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
export declare const MemoryStatusSchema: z.ZodEnum<["candidate", "verified", "trusted", "deprecated", "rejected", "sealed", "human_required"]>;
|
|
9
|
+
export type MemoryStatus = z.infer<typeof MemoryStatusSchema>;
|
|
10
|
+
export declare const MemoryTypeSchema: z.ZodEnum<["observation", "claim", "preference", "policy", "decision", "task_state", "warning", "skill"]>;
|
|
11
|
+
export type MemoryType = z.infer<typeof MemoryTypeSchema>;
|
|
12
|
+
/**
|
|
13
|
+
* Visibility is a discriminated union because `team:<name>` carries a payload
|
|
14
|
+
* the other variants don't have. Encoded compactly on the wire as a single string.
|
|
15
|
+
*/
|
|
16
|
+
export declare const VisibilitySchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"private:agent">;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
kind: "private:agent";
|
|
20
|
+
}, {
|
|
21
|
+
kind: "private:agent";
|
|
22
|
+
}>, z.ZodObject<{
|
|
23
|
+
kind: z.ZodLiteral<"private:user">;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
kind: "private:user";
|
|
26
|
+
}, {
|
|
27
|
+
kind: "private:user";
|
|
28
|
+
}>, z.ZodObject<{
|
|
29
|
+
kind: z.ZodLiteral<"team">;
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
kind: "team";
|
|
33
|
+
name: string;
|
|
34
|
+
}, {
|
|
35
|
+
kind: "team";
|
|
36
|
+
name: string;
|
|
37
|
+
}>, z.ZodObject<{
|
|
38
|
+
kind: z.ZodLiteral<"global:safe">;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
kind: "global:safe";
|
|
41
|
+
}, {
|
|
42
|
+
kind: "global:safe";
|
|
43
|
+
}>, z.ZodObject<{
|
|
44
|
+
kind: z.ZodLiteral<"sealed:sensitive">;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
kind: "sealed:sensitive";
|
|
47
|
+
}, {
|
|
48
|
+
kind: "sealed:sensitive";
|
|
49
|
+
}>, z.ZodObject<{
|
|
50
|
+
kind: z.ZodLiteral<"ephemeral">;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
kind: "ephemeral";
|
|
53
|
+
}, {
|
|
54
|
+
kind: "ephemeral";
|
|
55
|
+
}>]>;
|
|
56
|
+
export type Visibility = z.infer<typeof VisibilitySchema>;
|
|
57
|
+
export declare const ScopeKindSchema: z.ZodEnum<["local", "project", "user", "team", "global"]>;
|
|
58
|
+
export type ScopeKind = z.infer<typeof ScopeKindSchema>;
|
|
59
|
+
/**
|
|
60
|
+
* Scope can be bare (`local`, `global`) or carry an id (`project:foo`, `team:bar`).
|
|
61
|
+
*/
|
|
62
|
+
export declare const ScopeSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
63
|
+
kind: z.ZodLiteral<"local">;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
kind: "local";
|
|
66
|
+
}, {
|
|
67
|
+
kind: "local";
|
|
68
|
+
}>, z.ZodObject<{
|
|
69
|
+
kind: z.ZodLiteral<"project">;
|
|
70
|
+
projectId: z.ZodString;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
kind: "project";
|
|
73
|
+
projectId: string;
|
|
74
|
+
}, {
|
|
75
|
+
kind: "project";
|
|
76
|
+
projectId: string;
|
|
77
|
+
}>, z.ZodObject<{
|
|
78
|
+
kind: z.ZodLiteral<"user">;
|
|
79
|
+
userId: z.ZodString;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
kind: "user";
|
|
82
|
+
userId: string;
|
|
83
|
+
}, {
|
|
84
|
+
kind: "user";
|
|
85
|
+
userId: string;
|
|
86
|
+
}>, z.ZodObject<{
|
|
87
|
+
kind: z.ZodLiteral<"team">;
|
|
88
|
+
teamId: z.ZodString;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
kind: "team";
|
|
91
|
+
teamId: string;
|
|
92
|
+
}, {
|
|
93
|
+
kind: "team";
|
|
94
|
+
teamId: string;
|
|
95
|
+
}>, z.ZodObject<{
|
|
96
|
+
kind: z.ZodLiteral<"global">;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
kind: "global";
|
|
99
|
+
}, {
|
|
100
|
+
kind: "global";
|
|
101
|
+
}>]>;
|
|
102
|
+
export type Scope = z.infer<typeof ScopeSchema>;
|
|
103
|
+
export declare const FreshnessSchema: z.ZodEnum<["current", "stale", "unknown"]>;
|
|
104
|
+
export type Freshness = z.infer<typeof FreshnessSchema>;
|
|
105
|
+
export declare const RiskTierSchema: z.ZodEnum<["low_local", "medium_local", "sensitive"]>;
|
|
106
|
+
export type RiskTier = z.infer<typeof RiskTierSchema>;
|
|
107
|
+
export declare const EffectBoundarySchema: z.ZodEnum<["local_only", "no_runtime_effect", "external_send_requires_human", "config_change_forbidden"]>;
|
|
108
|
+
export type EffectBoundary = z.infer<typeof EffectBoundarySchema>;
|
|
109
|
+
export declare const PromotionBoundarySchema: z.ZodEnum<["no_memory_write", "no_durable_promotion", "human_confirmation_required"]>;
|
|
110
|
+
export type PromotionBoundary = z.infer<typeof PromotionBoundarySchema>;
|
|
111
|
+
export declare const ReadinessBoundarySchema: z.ZodEnum<["paper_only", "fixture_only", "research_ready_not_implementation_ready", "implementation_ready"]>;
|
|
112
|
+
export type ReadinessBoundary = z.infer<typeof ReadinessBoundarySchema>;
|
|
113
|
+
export declare const TargetStatusSchema: z.ZodEnum<["candidate", "partial", "experiment_ready", "pass_closed", "blocked", "requires_human"]>;
|
|
114
|
+
export type TargetStatus = z.infer<typeof TargetStatusSchema>;
|
|
115
|
+
export declare const LineageCompletenessSchema: z.ZodEnum<["complete", "partial", "unknown"]>;
|
|
116
|
+
export type LineageCompleteness = z.infer<typeof LineageCompletenessSchema>;
|
|
117
|
+
/**
|
|
118
|
+
* `LRE=none` is the only safe-to-act value. Anything else (a supersession,
|
|
119
|
+
* a tombstone, an unresolved conflict) fails closed.
|
|
120
|
+
*/
|
|
121
|
+
export declare const LaterRestrictiveEventSchema: z.ZodEnum<["none", "superseded", "tombstoned", "conflict_unresolved", "unknown"]>;
|
|
122
|
+
export type LaterRestrictiveEvent = z.infer<typeof LaterRestrictiveEventSchema>;
|
|
123
|
+
/**
|
|
124
|
+
* The `ACT` field of a compressed receipt and the proposed action of `tryAct`.
|
|
125
|
+
* Sensitive verbs always route to ask_human regardless of receipt validity.
|
|
126
|
+
*/
|
|
127
|
+
export declare const ActionClassSchema: 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"]>;
|
|
128
|
+
export type ActionClass = z.infer<typeof ActionClassSchema>;
|
|
129
|
+
/** Verbs that may proceed locally if every other check passes. */
|
|
130
|
+
export declare const SAFE_LOCAL_ACTIONS: ReadonlySet<ActionClass>;
|
|
131
|
+
/** Verbs that always require human approval regardless of receipt validity. */
|
|
132
|
+
export declare const SENSITIVE_ACTIONS: ReadonlySet<ActionClass>;
|
|
133
|
+
export declare const LinkRelationSchema: z.ZodEnum<["supports", "contradicts", "supersedes", "derived_from"]>;
|
|
134
|
+
export type LinkRelation = z.infer<typeof LinkRelationSchema>;
|
|
135
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,kBAAkB,uGAQ7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,eAAO,MAAM,gBAAgB,2GAS3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D;;;GAGG;AACH,eA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,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAI5E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,mFAMtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAIhF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,kQAgB5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,kEAAkE;AAClE,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,WAAW,CAKtD,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,WAAW,CAYrD,CAAC;AAIH,eAAO,MAAM,kBAAkB,sEAAoE,CAAC;AACpG,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enumerated value sets used across the receipt and atom protocols.
|
|
3
|
+
*
|
|
4
|
+
* Every union here is "fail-closed by default": adding a new variant requires
|
|
5
|
+
* a deliberate spec change. Unknown strings parsed into these schemas reject.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
// -- Memory atom status (specs/aletheia-memory-authority-v0.md §4) -----------
|
|
9
|
+
export const MemoryStatusSchema = z.enum([
|
|
10
|
+
'candidate',
|
|
11
|
+
'verified',
|
|
12
|
+
'trusted',
|
|
13
|
+
'deprecated',
|
|
14
|
+
'rejected',
|
|
15
|
+
'sealed',
|
|
16
|
+
'human_required',
|
|
17
|
+
]);
|
|
18
|
+
// -- Memory types (atom categories) ------------------------------------------
|
|
19
|
+
export const MemoryTypeSchema = z.enum([
|
|
20
|
+
'observation',
|
|
21
|
+
'claim',
|
|
22
|
+
'preference',
|
|
23
|
+
'policy',
|
|
24
|
+
'decision',
|
|
25
|
+
'task_state',
|
|
26
|
+
'warning',
|
|
27
|
+
'skill',
|
|
28
|
+
]);
|
|
29
|
+
// -- Visibility planes (specs §5) --------------------------------------------
|
|
30
|
+
/**
|
|
31
|
+
* Visibility is a discriminated union because `team:<name>` carries a payload
|
|
32
|
+
* the other variants don't have. Encoded compactly on the wire as a single string.
|
|
33
|
+
*/
|
|
34
|
+
export const VisibilitySchema = z.discriminatedUnion('kind', [
|
|
35
|
+
z.object({ kind: z.literal('private:agent') }),
|
|
36
|
+
z.object({ kind: z.literal('private:user') }),
|
|
37
|
+
z.object({ kind: z.literal('team'), name: z.string().min(1).max(128) }),
|
|
38
|
+
z.object({ kind: z.literal('global:safe') }),
|
|
39
|
+
z.object({ kind: z.literal('sealed:sensitive') }),
|
|
40
|
+
z.object({ kind: z.literal('ephemeral') }),
|
|
41
|
+
]);
|
|
42
|
+
// -- Scope (specs §4 and ACP) ------------------------------------------------
|
|
43
|
+
export const ScopeKindSchema = z.enum(['local', 'project', 'user', 'team', 'global']);
|
|
44
|
+
/**
|
|
45
|
+
* Scope can be bare (`local`, `global`) or carry an id (`project:foo`, `team:bar`).
|
|
46
|
+
*/
|
|
47
|
+
export const ScopeSchema = z.discriminatedUnion('kind', [
|
|
48
|
+
z.object({ kind: z.literal('local') }),
|
|
49
|
+
z.object({ kind: z.literal('project'), projectId: z.string().min(1) }),
|
|
50
|
+
z.object({ kind: z.literal('user'), userId: z.string().min(1) }),
|
|
51
|
+
z.object({ kind: z.literal('team'), teamId: z.string().min(1) }),
|
|
52
|
+
z.object({ kind: z.literal('global') }),
|
|
53
|
+
]);
|
|
54
|
+
// -- Freshness (receipt FRESH field) -----------------------------------------
|
|
55
|
+
export const FreshnessSchema = z.enum(['current', 'stale', 'unknown']);
|
|
56
|
+
// -- Risk tier ---------------------------------------------------------------
|
|
57
|
+
export const RiskTierSchema = z.enum(['low_local', 'medium_local', 'sensitive']);
|
|
58
|
+
// -- Effect boundary ---------------------------------------------------------
|
|
59
|
+
export const EffectBoundarySchema = z.enum([
|
|
60
|
+
'local_only',
|
|
61
|
+
'no_runtime_effect',
|
|
62
|
+
'external_send_requires_human',
|
|
63
|
+
'config_change_forbidden',
|
|
64
|
+
]);
|
|
65
|
+
// -- Promotion boundary ------------------------------------------------------
|
|
66
|
+
export const PromotionBoundarySchema = z.enum([
|
|
67
|
+
'no_memory_write',
|
|
68
|
+
'no_durable_promotion',
|
|
69
|
+
'human_confirmation_required',
|
|
70
|
+
]);
|
|
71
|
+
// -- Readiness boundary ------------------------------------------------------
|
|
72
|
+
export const ReadinessBoundarySchema = z.enum([
|
|
73
|
+
'paper_only',
|
|
74
|
+
'fixture_only',
|
|
75
|
+
'research_ready_not_implementation_ready',
|
|
76
|
+
'implementation_ready',
|
|
77
|
+
]);
|
|
78
|
+
// -- Target status (memory authority receipt) --------------------------------
|
|
79
|
+
export const TargetStatusSchema = z.enum([
|
|
80
|
+
'candidate',
|
|
81
|
+
'partial',
|
|
82
|
+
'experiment_ready',
|
|
83
|
+
'pass_closed',
|
|
84
|
+
'blocked',
|
|
85
|
+
'requires_human',
|
|
86
|
+
]);
|
|
87
|
+
// -- Lineage completeness ----------------------------------------------------
|
|
88
|
+
export const LineageCompletenessSchema = z.enum(['complete', 'partial', 'unknown']);
|
|
89
|
+
// -- Later restrictive event (LRE) -------------------------------------------
|
|
90
|
+
/**
|
|
91
|
+
* `LRE=none` is the only safe-to-act value. Anything else (a supersession,
|
|
92
|
+
* a tombstone, an unresolved conflict) fails closed.
|
|
93
|
+
*/
|
|
94
|
+
export const LaterRestrictiveEventSchema = z.enum([
|
|
95
|
+
'none',
|
|
96
|
+
'superseded',
|
|
97
|
+
'tombstoned',
|
|
98
|
+
'conflict_unresolved',
|
|
99
|
+
'unknown',
|
|
100
|
+
]);
|
|
101
|
+
// -- Action classification (proposed action verbs) ---------------------------
|
|
102
|
+
/**
|
|
103
|
+
* The `ACT` field of a compressed receipt and the proposed action of `tryAct`.
|
|
104
|
+
* Sensitive verbs always route to ask_human regardless of receipt validity.
|
|
105
|
+
*/
|
|
106
|
+
export const ActionClassSchema = z.enum([
|
|
107
|
+
'local_documentation',
|
|
108
|
+
'local_fixture',
|
|
109
|
+
'local_diagnostic',
|
|
110
|
+
'local_report',
|
|
111
|
+
'external_send',
|
|
112
|
+
'runtime_change',
|
|
113
|
+
'config_change',
|
|
114
|
+
'publication',
|
|
115
|
+
'durable_memory_write',
|
|
116
|
+
'delete',
|
|
117
|
+
'canary',
|
|
118
|
+
'enforcement',
|
|
119
|
+
'production_action',
|
|
120
|
+
'l2_plus',
|
|
121
|
+
'unknown',
|
|
122
|
+
]);
|
|
123
|
+
/** Verbs that may proceed locally if every other check passes. */
|
|
124
|
+
export const SAFE_LOCAL_ACTIONS = new Set([
|
|
125
|
+
'local_documentation',
|
|
126
|
+
'local_fixture',
|
|
127
|
+
'local_diagnostic',
|
|
128
|
+
'local_report',
|
|
129
|
+
]);
|
|
130
|
+
/** Verbs that always require human approval regardless of receipt validity. */
|
|
131
|
+
export const SENSITIVE_ACTIONS = new Set([
|
|
132
|
+
'external_send',
|
|
133
|
+
'runtime_change',
|
|
134
|
+
'config_change',
|
|
135
|
+
'publication',
|
|
136
|
+
'durable_memory_write',
|
|
137
|
+
'delete',
|
|
138
|
+
'canary',
|
|
139
|
+
'enforcement',
|
|
140
|
+
'production_action',
|
|
141
|
+
'l2_plus',
|
|
142
|
+
'unknown',
|
|
143
|
+
]);
|
|
144
|
+
// -- Memory link relations (atom-to-atom edges) ------------------------------
|
|
145
|
+
export const LinkRelationSchema = z.enum(['supports', 'contradicts', 'supersedes', 'derived_from']);
|
|
146
|
+
//# sourceMappingURL=enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/types/enums.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAE/E,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kB;IAClB,cAAc;CACf,CAAC,CAAC;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,iBAAiB,GAA6B,IAAI,GAAG,CAAc;IAC9E,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,aAAa;IACb,sBAAsB;IACtB,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,mBAAmB;IACnB,SAAS;IACT,SAAS;CACV,CAAC,CAAC;AAEH,+EAA+E;AAE/E,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event — the raw, append-only unit recorded in the EventLedger.
|
|
3
|
+
* Source: specs/aletheia-memory-authority-v0.md §1 "Event Ledger".
|
|
4
|
+
*
|
|
5
|
+
* Spec rules carried into the type:
|
|
6
|
+
* - events are evidence, not memory authority by themselves;
|
|
7
|
+
* - summaries never replace original events;
|
|
8
|
+
* - rollback/debug requires source events;
|
|
9
|
+
* - external/untrusted text is recorded as "source X claims Y", not as instruction.
|
|
10
|
+
*
|
|
11
|
+
* `payload` is intentionally JSON-shaped (not free text). External/untrusted
|
|
12
|
+
* material lands inside a `claim_of` wrapper so the EventLedger never stores
|
|
13
|
+
* raw instructions a downstream component might mistake for authority.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
export declare const EventKindSchema: z.ZodEnum<["conversation", "tool_output", "document", "observation", "decision", "artifact_change", "external_claim"]>;
|
|
17
|
+
export type EventKind = z.infer<typeof EventKindSchema>;
|
|
18
|
+
/**
|
|
19
|
+
* JSON-serializable payload. Restricted so the storage layer can persist it
|
|
20
|
+
* via JSON.stringify without information loss.
|
|
21
|
+
*/
|
|
22
|
+
declare const JsonScalarSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
|
|
23
|
+
type JsonScalar = z.infer<typeof JsonScalarSchema>;
|
|
24
|
+
export type JsonValue = JsonScalar | {
|
|
25
|
+
readonly [k: string]: JsonValue;
|
|
26
|
+
} | readonly JsonValue[];
|
|
27
|
+
export declare const JsonValueSchema: z.ZodType<JsonValue>;
|
|
28
|
+
export declare const EventSchema: z.ZodObject<{
|
|
29
|
+
eventId: z.ZodBranded<z.ZodString, "EventId">;
|
|
30
|
+
kind: z.ZodEnum<["conversation", "tool_output", "document", "observation", "decision", "artifact_change", "external_claim"]>;
|
|
31
|
+
/** Null when the event has no responsible agent (e.g. external document). */
|
|
32
|
+
agentId: z.ZodNullable<z.ZodBranded<z.ZodString, "AgentId">>;
|
|
33
|
+
occurredAt: z.ZodString;
|
|
34
|
+
/** Structured payload — no free-text "instruction-shaped" content. */
|
|
35
|
+
payload: z.ZodType<JsonValue, z.ZodTypeDef, JsonValue>;
|
|
36
|
+
scope: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
37
|
+
kind: z.ZodLiteral<"local">;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
kind: "local";
|
|
40
|
+
}, {
|
|
41
|
+
kind: "local";
|
|
42
|
+
}>, z.ZodObject<{
|
|
43
|
+
kind: z.ZodLiteral<"project">;
|
|
44
|
+
projectId: z.ZodString;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
kind: "project";
|
|
47
|
+
projectId: string;
|
|
48
|
+
}, {
|
|
49
|
+
kind: "project";
|
|
50
|
+
projectId: string;
|
|
51
|
+
}>, z.ZodObject<{
|
|
52
|
+
kind: z.ZodLiteral<"user">;
|
|
53
|
+
userId: z.ZodString;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
kind: "user";
|
|
56
|
+
userId: string;
|
|
57
|
+
}, {
|
|
58
|
+
kind: "user";
|
|
59
|
+
userId: string;
|
|
60
|
+
}>, z.ZodObject<{
|
|
61
|
+
kind: z.ZodLiteral<"team">;
|
|
62
|
+
teamId: z.ZodString;
|
|
63
|
+
}, "strip", z.ZodTypeAny, {
|
|
64
|
+
kind: "team";
|
|
65
|
+
teamId: string;
|
|
66
|
+
}, {
|
|
67
|
+
kind: "team";
|
|
68
|
+
teamId: string;
|
|
69
|
+
}>, z.ZodObject<{
|
|
70
|
+
kind: z.ZodLiteral<"global">;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
kind: "global";
|
|
73
|
+
}, {
|
|
74
|
+
kind: "global";
|
|
75
|
+
}>]>;
|
|
76
|
+
visibility: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
77
|
+
kind: z.ZodLiteral<"private:agent">;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
kind: "private:agent";
|
|
80
|
+
}, {
|
|
81
|
+
kind: "private:agent";
|
|
82
|
+
}>, z.ZodObject<{
|
|
83
|
+
kind: z.ZodLiteral<"private:user">;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
kind: "private:user";
|
|
86
|
+
}, {
|
|
87
|
+
kind: "private:user";
|
|
88
|
+
}>, z.ZodObject<{
|
|
89
|
+
kind: z.ZodLiteral<"team">;
|
|
90
|
+
name: z.ZodString;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
kind: "team";
|
|
93
|
+
name: string;
|
|
94
|
+
}, {
|
|
95
|
+
kind: "team";
|
|
96
|
+
name: string;
|
|
97
|
+
}>, z.ZodObject<{
|
|
98
|
+
kind: z.ZodLiteral<"global:safe">;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
kind: "global:safe";
|
|
101
|
+
}, {
|
|
102
|
+
kind: "global:safe";
|
|
103
|
+
}>, z.ZodObject<{
|
|
104
|
+
kind: z.ZodLiteral<"sealed:sensitive">;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
kind: "sealed:sensitive";
|
|
107
|
+
}, {
|
|
108
|
+
kind: "sealed:sensitive";
|
|
109
|
+
}>, z.ZodObject<{
|
|
110
|
+
kind: z.ZodLiteral<"ephemeral">;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
kind: "ephemeral";
|
|
113
|
+
}, {
|
|
114
|
+
kind: "ephemeral";
|
|
115
|
+
}>]>;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
kind: "observation" | "decision" | "conversation" | "tool_output" | "document" | "artifact_change" | "external_claim";
|
|
118
|
+
eventId: string & z.BRAND<"EventId">;
|
|
119
|
+
agentId: (string & z.BRAND<"AgentId">) | null;
|
|
120
|
+
occurredAt: string;
|
|
121
|
+
payload: JsonValue;
|
|
122
|
+
scope: {
|
|
123
|
+
kind: "local";
|
|
124
|
+
} | {
|
|
125
|
+
kind: "project";
|
|
126
|
+
projectId: string;
|
|
127
|
+
} | {
|
|
128
|
+
kind: "user";
|
|
129
|
+
userId: string;
|
|
130
|
+
} | {
|
|
131
|
+
kind: "team";
|
|
132
|
+
teamId: string;
|
|
133
|
+
} | {
|
|
134
|
+
kind: "global";
|
|
135
|
+
};
|
|
136
|
+
visibility: {
|
|
137
|
+
kind: "private:agent";
|
|
138
|
+
} | {
|
|
139
|
+
kind: "private:user";
|
|
140
|
+
} | {
|
|
141
|
+
kind: "team";
|
|
142
|
+
name: string;
|
|
143
|
+
} | {
|
|
144
|
+
kind: "global:safe";
|
|
145
|
+
} | {
|
|
146
|
+
kind: "sealed:sensitive";
|
|
147
|
+
} | {
|
|
148
|
+
kind: "ephemeral";
|
|
149
|
+
};
|
|
150
|
+
}, {
|
|
151
|
+
kind: "observation" | "decision" | "conversation" | "tool_output" | "document" | "artifact_change" | "external_claim";
|
|
152
|
+
eventId: string;
|
|
153
|
+
agentId: string | null;
|
|
154
|
+
occurredAt: string;
|
|
155
|
+
payload: JsonValue;
|
|
156
|
+
scope: {
|
|
157
|
+
kind: "local";
|
|
158
|
+
} | {
|
|
159
|
+
kind: "project";
|
|
160
|
+
projectId: string;
|
|
161
|
+
} | {
|
|
162
|
+
kind: "user";
|
|
163
|
+
userId: string;
|
|
164
|
+
} | {
|
|
165
|
+
kind: "team";
|
|
166
|
+
teamId: string;
|
|
167
|
+
} | {
|
|
168
|
+
kind: "global";
|
|
169
|
+
};
|
|
170
|
+
visibility: {
|
|
171
|
+
kind: "private:agent";
|
|
172
|
+
} | {
|
|
173
|
+
kind: "private:user";
|
|
174
|
+
} | {
|
|
175
|
+
kind: "team";
|
|
176
|
+
name: string;
|
|
177
|
+
} | {
|
|
178
|
+
kind: "global:safe";
|
|
179
|
+
} | {
|
|
180
|
+
kind: "sealed:sensitive";
|
|
181
|
+
} | {
|
|
182
|
+
kind: "ephemeral";
|
|
183
|
+
};
|
|
184
|
+
}>;
|
|
185
|
+
export type Event = z.infer<typeof EventSchema>;
|
|
186
|
+
export {};
|
|
187
|
+
//# sourceMappingURL=event.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/types/event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe,wHAQ1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;;GAGG;AACH,QAAA,MAAM,gBAAgB,iEAA2D,CAAC;AAClF,KAAK,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AACnD,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,SAAS,EAAE,CAAC;AAChG,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAEhD,CAAC;AAEF,eAAO,MAAM,WAAW;;;IAGtB,6EAA6E;;;IAG7E,sEAAsE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAItE,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event — the raw, append-only unit recorded in the EventLedger.
|
|
3
|
+
* Source: specs/aletheia-memory-authority-v0.md §1 "Event Ledger".
|
|
4
|
+
*
|
|
5
|
+
* Spec rules carried into the type:
|
|
6
|
+
* - events are evidence, not memory authority by themselves;
|
|
7
|
+
* - summaries never replace original events;
|
|
8
|
+
* - rollback/debug requires source events;
|
|
9
|
+
* - external/untrusted text is recorded as "source X claims Y", not as instruction.
|
|
10
|
+
*
|
|
11
|
+
* `payload` is intentionally JSON-shaped (not free text). External/untrusted
|
|
12
|
+
* material lands inside a `claim_of` wrapper so the EventLedger never stores
|
|
13
|
+
* raw instructions a downstream component might mistake for authority.
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import { ScopeSchema, VisibilitySchema } from './enums.js';
|
|
17
|
+
import { AgentIdSchema, EventIdSchema, IsoTimestampSchema } from './primitives.js';
|
|
18
|
+
export const EventKindSchema = z.enum([
|
|
19
|
+
'conversation',
|
|
20
|
+
'tool_output',
|
|
21
|
+
'document',
|
|
22
|
+
'observation',
|
|
23
|
+
'decision',
|
|
24
|
+
'artifact_change',
|
|
25
|
+
'external_claim',
|
|
26
|
+
]);
|
|
27
|
+
/**
|
|
28
|
+
* JSON-serializable payload. Restricted so the storage layer can persist it
|
|
29
|
+
* via JSON.stringify without information loss.
|
|
30
|
+
*/
|
|
31
|
+
const JsonScalarSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
32
|
+
export const JsonValueSchema = z.lazy(() => z.union([JsonScalarSchema, z.array(JsonValueSchema), z.record(JsonValueSchema)]));
|
|
33
|
+
export const EventSchema = z.object({
|
|
34
|
+
eventId: EventIdSchema,
|
|
35
|
+
kind: EventKindSchema,
|
|
36
|
+
/** Null when the event has no responsible agent (e.g. external document). */
|
|
37
|
+
agentId: AgentIdSchema.nullable(),
|
|
38
|
+
occurredAt: IsoTimestampSchema,
|
|
39
|
+
/** Structured payload — no free-text "instruction-shaped" content. */
|
|
40
|
+
payload: JsonValueSchema,
|
|
41
|
+
scope: ScopeSchema,
|
|
42
|
+
visibility: VisibilitySchema,
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../src/types/event.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEnF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,cAAc;IACd,aAAa;IACb,UAAU;IACV,aAAa;IACb,UAAU;IACV,iBAAiB;IACjB,gBAAgB;CACjB,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;AAGlF,MAAM,CAAC,MAAM,eAAe,GAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAC/D,CAAC,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CACjF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,eAAe;IACrB,6EAA6E;IAC7E,OAAO,EAAE,aAAa,CAAC,QAAQ,EAAE;IACjC,UAAU,EAAE,kBAAkB;IAC9B,sEAAsE;IACtE,OAAO,EAAE,eAAe;IACxB,KAAK,EAAE,WAAW;IAClB,UAAU,EAAE,gBAAgB;CAC7B,CAAC,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-readable receipt (specs/memory-authority-receipt-v0.md §"Canonical fields").
|
|
3
|
+
*
|
|
4
|
+
* The verbose YAML/Markdown form for audits and human handoffs. Less compact
|
|
5
|
+
* than CompressedReceipt but carries the same authority semantics.
|
|
6
|
+
*/
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
/**
|
|
9
|
+
* The "nextAllowedAction" sub-object of a human-readable receipt.
|
|
10
|
+
* Spec rule: must be exact; generic "continue" is not authority.
|
|
11
|
+
*/
|
|
12
|
+
export declare const NextAllowedActionSchema: z.ZodObject<{
|
|
13
|
+
/** Specific verb the receiver is allowed to take. */
|
|
14
|
+
action: 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"]>;
|
|
15
|
+
/** Exact next target (e.g. file path, fixture id). */
|
|
16
|
+
target: z.ZodString;
|
|
17
|
+
/** The source target this succeeds. */
|
|
18
|
+
successorOf: z.ZodString;
|
|
19
|
+
/** Whether re-running the action is allowed. */
|
|
20
|
+
redoAllowed: z.ZodBoolean;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
action: "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";
|
|
23
|
+
target: string;
|
|
24
|
+
successorOf: string;
|
|
25
|
+
redoAllowed: boolean;
|
|
26
|
+
}, {
|
|
27
|
+
action: "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";
|
|
28
|
+
target: string;
|
|
29
|
+
successorOf: string;
|
|
30
|
+
redoAllowed: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
export type NextAllowedAction = z.infer<typeof NextAllowedActionSchema>;
|
|
33
|
+
export declare const HumanReadableReceiptSchema: z.ZodObject<{
|
|
34
|
+
sourceArtifactId: z.ZodBranded<z.ZodString, "SourceArtifactId">;
|
|
35
|
+
sourceArtifactPath: z.ZodEffects<z.ZodString, string, string>;
|
|
36
|
+
producedAt: z.ZodString;
|
|
37
|
+
receiverFreshness: z.ZodEnum<["current", "stale", "unknown"]>;
|
|
38
|
+
targetStatus: z.ZodEnum<["candidate", "partial", "experiment_ready", "pass_closed", "blocked", "requires_human"]>;
|
|
39
|
+
readinessBoundary: z.ZodEnum<["paper_only", "fixture_only", "research_ready_not_implementation_ready", "implementation_ready"]>;
|
|
40
|
+
effectBoundary: z.ZodEnum<["local_only", "no_runtime_effect", "external_send_requires_human", "config_change_forbidden"]>;
|
|
41
|
+
promotionBoundary: z.ZodEnum<["no_memory_write", "no_durable_promotion", "human_confirmation_required"]>;
|
|
42
|
+
lineageCompleteness: z.ZodEnum<["complete", "partial", "unknown"]>;
|
|
43
|
+
riskTier: z.ZodEnum<["low_local", "medium_local", "sensitive"]>;
|
|
44
|
+
nextAllowedAction: z.ZodObject<{
|
|
45
|
+
/** Specific verb the receiver is allowed to take. */
|
|
46
|
+
action: 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"]>;
|
|
47
|
+
/** Exact next target (e.g. file path, fixture id). */
|
|
48
|
+
target: z.ZodString;
|
|
49
|
+
/** The source target this succeeds. */
|
|
50
|
+
successorOf: z.ZodString;
|
|
51
|
+
/** Whether re-running the action is allowed. */
|
|
52
|
+
redoAllowed: z.ZodBoolean;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
action: "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";
|
|
55
|
+
target: string;
|
|
56
|
+
successorOf: string;
|
|
57
|
+
redoAllowed: boolean;
|
|
58
|
+
}, {
|
|
59
|
+
action: "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";
|
|
60
|
+
target: string;
|
|
61
|
+
successorOf: string;
|
|
62
|
+
redoAllowed: boolean;
|
|
63
|
+
}>;
|
|
64
|
+
/** How the claim was checked (free text, audit only). */
|
|
65
|
+
validation: z.ZodString;
|
|
66
|
+
/** Local/shadow safety result string (audit only). */
|
|
67
|
+
safetyResult: z.ZodString;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
validation: string;
|
|
70
|
+
producedAt: string;
|
|
71
|
+
promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
|
|
72
|
+
sourceArtifactId: string & z.BRAND<"SourceArtifactId">;
|
|
73
|
+
sourceArtifactPath: string;
|
|
74
|
+
receiverFreshness: "unknown" | "current" | "stale";
|
|
75
|
+
targetStatus: "candidate" | "partial" | "experiment_ready" | "pass_closed" | "blocked" | "requires_human";
|
|
76
|
+
readinessBoundary: "paper_only" | "fixture_only" | "research_ready_not_implementation_ready" | "implementation_ready";
|
|
77
|
+
effectBoundary: "local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden";
|
|
78
|
+
lineageCompleteness: "unknown" | "partial" | "complete";
|
|
79
|
+
riskTier: "low_local" | "medium_local" | "sensitive";
|
|
80
|
+
nextAllowedAction: {
|
|
81
|
+
action: "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
|
+
target: string;
|
|
83
|
+
successorOf: string;
|
|
84
|
+
redoAllowed: boolean;
|
|
85
|
+
};
|
|
86
|
+
safetyResult: string;
|
|
87
|
+
}, {
|
|
88
|
+
validation: string;
|
|
89
|
+
producedAt: string;
|
|
90
|
+
promotionBoundary: "no_memory_write" | "no_durable_promotion" | "human_confirmation_required";
|
|
91
|
+
sourceArtifactId: string;
|
|
92
|
+
sourceArtifactPath: string;
|
|
93
|
+
receiverFreshness: "unknown" | "current" | "stale";
|
|
94
|
+
targetStatus: "candidate" | "partial" | "experiment_ready" | "pass_closed" | "blocked" | "requires_human";
|
|
95
|
+
readinessBoundary: "paper_only" | "fixture_only" | "research_ready_not_implementation_ready" | "implementation_ready";
|
|
96
|
+
effectBoundary: "local_only" | "no_runtime_effect" | "external_send_requires_human" | "config_change_forbidden";
|
|
97
|
+
lineageCompleteness: "unknown" | "partial" | "complete";
|
|
98
|
+
riskTier: "low_local" | "medium_local" | "sensitive";
|
|
99
|
+
nextAllowedAction: {
|
|
100
|
+
action: "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
|
+
target: string;
|
|
102
|
+
successorOf: string;
|
|
103
|
+
redoAllowed: boolean;
|
|
104
|
+
};
|
|
105
|
+
safetyResult: string;
|
|
106
|
+
}>;
|
|
107
|
+
export type HumanReadableReceipt = z.infer<typeof HumanReadableReceiptSchema>;
|
|
108
|
+
//# sourceMappingURL=human-receipt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"human-receipt.d.ts","sourceRoot":"","sources":["../../src/types/human-receipt.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IAClC,qDAAqD;;IAErD,sDAAsD;;IAEtD,uCAAuC;;IAEvC,gDAAgD;;;;;;;;;;;;EAEhD,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;QAXrC,qDAAqD;;QAErD,sDAAsD;;QAEtD,uCAAuC;;QAEvC,gDAAgD;;;;;;;;;;;;;IAiBhD,yDAAyD;;IAEzD,sDAAsD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEtD,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|