@lucern/contracts 1.0.55 → 1.0.57
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/CHANGELOG.md +3 -0
- package/dist/component-boundary.contract.js +1 -0
- package/dist/events-types.contract.js +4 -0
- package/dist/events.contract.d.ts +1 -1
- package/dist/events.contract.js +4 -0
- package/dist/evidence-taxonomy-target-scope.contract.js +9 -0
- package/dist/function-registry/beliefs.js +70 -0
- package/dist/function-registry/coding.js +71 -1
- package/dist/function-registry/context.js +71 -0
- package/dist/function-registry/contracts.js +70 -0
- package/dist/function-registry/coordination.js +70 -0
- package/dist/function-registry/edges.js +100 -2
- package/dist/function-registry/embeddings.js +70 -0
- package/dist/function-registry/evidence.js +59 -14
- package/dist/function-registry/graph.js +70 -0
- package/dist/function-registry/helpers.d.ts +1 -0
- package/dist/function-registry/helpers.js +95 -1
- package/dist/function-registry/hybrid.js +70 -0
- package/dist/function-registry/identity.js +70 -0
- package/dist/function-registry/index.js +95 -1
- package/dist/function-registry/judgments.js +70 -0
- package/dist/function-registry/legacy.js +70 -0
- package/dist/function-registry/lenses.js +70 -0
- package/dist/function-registry/nodes.js +70 -0
- package/dist/function-registry/ontologies.js +70 -0
- package/dist/function-registry/pipeline.js +70 -0
- package/dist/function-registry/policy.js +70 -0
- package/dist/function-registry/questions.js +70 -0
- package/dist/function-registry/tasks.js +70 -0
- package/dist/function-registry/topics.js +70 -0
- package/dist/function-registry/worktrees.js +70 -0
- package/dist/generated/convexSchemas.d.ts +100 -0
- package/dist/generated/convexSchemas.js +2 -1
- package/dist/generated/schema-manifest.json +27 -3
- package/dist/generated/tableOwnership.d.ts +2 -1
- package/dist/generated/tableOwnership.js +2 -0
- package/dist/generated/tier-expectations.json +6 -3
- package/dist/index.js +52 -0
- package/dist/manifests/__tests__/sc3-operation-manifest-census-derivability.test.d.ts +1 -0
- package/dist/manifests/operation-manifest.d.ts +650 -0
- package/dist/manifests/operation-manifest.js +306 -0
- package/dist/projections/check-convex-args-shape.js +9 -0
- package/dist/projections/create-evidence.projection.js +9 -0
- package/dist/projections/index.js +9 -0
- package/dist/proof-attestation.json +1 -1
- package/dist/schema-helpers/evidenceAdmission.d.ts +8 -0
- package/dist/schema-helpers/evidenceAdmission.js +167 -0
- package/dist/schemas/index.js +40 -0
- package/dist/schemas/manifest.d.ts +40 -0
- package/dist/schemas/manifest.js +40 -0
- package/dist/schemas/tables/kernel/events.d.ts +22 -0
- package/dist/schemas/tables/kernel/events.js +31 -1
- package/dist/schemas/tables/kernel/spine.js +9 -0
- package/dist/schemas.values.js +40 -0
- package/dist/tenant-bootstrap-seed.contract.d.ts +12 -0
- package/dist/tenant-bootstrap-seed.contract.js +7 -0
- package/dist/types/evidence-taxonomy-target-scope.d.ts +3 -0
- package/dist/types/evidence-taxonomy-target-scope.js +10 -1
- package/package.json +1 -1
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// src/manifests/operation-manifest.ts
|
|
4
|
+
var OPERATION_VERBS = [
|
|
5
|
+
// read plane
|
|
6
|
+
"get",
|
|
7
|
+
"list",
|
|
8
|
+
"search",
|
|
9
|
+
"traverse",
|
|
10
|
+
"compile",
|
|
11
|
+
"diff",
|
|
12
|
+
"replay",
|
|
13
|
+
// write plane
|
|
14
|
+
"create",
|
|
15
|
+
"refine",
|
|
16
|
+
"append",
|
|
17
|
+
"fork",
|
|
18
|
+
"transition",
|
|
19
|
+
"evaluate",
|
|
20
|
+
"graduate",
|
|
21
|
+
// governance plane
|
|
22
|
+
"declare",
|
|
23
|
+
"bind",
|
|
24
|
+
"grant"
|
|
25
|
+
];
|
|
26
|
+
var OPERATION_KINDS = [
|
|
27
|
+
"node",
|
|
28
|
+
"edge",
|
|
29
|
+
"container",
|
|
30
|
+
"slice",
|
|
31
|
+
"record",
|
|
32
|
+
"policy",
|
|
33
|
+
"unresolved"
|
|
34
|
+
];
|
|
35
|
+
var OPERATION_AXES = [
|
|
36
|
+
"scope",
|
|
37
|
+
"horizon",
|
|
38
|
+
"lens",
|
|
39
|
+
"policy",
|
|
40
|
+
"strategy",
|
|
41
|
+
"carrier"
|
|
42
|
+
];
|
|
43
|
+
var PROJECTION_CLASSES = [
|
|
44
|
+
"canonical_public",
|
|
45
|
+
"internal_backing",
|
|
46
|
+
"extension",
|
|
47
|
+
"compat",
|
|
48
|
+
"client_local"
|
|
49
|
+
];
|
|
50
|
+
var SURFACE_EXPOSURE = ["public", "internal", "absent"];
|
|
51
|
+
var OPERATION_SOURCES = [
|
|
52
|
+
"registry",
|
|
53
|
+
"kernelApi",
|
|
54
|
+
"mcp_extension",
|
|
55
|
+
"cli_bespoke"
|
|
56
|
+
];
|
|
57
|
+
var operationRowSchema = z.object({
|
|
58
|
+
/** Canonical operation identity. Snake_case for graph operations; dotted
|
|
59
|
+
* `domain.method` for kernelApi host bindings; `domain subcommand` for CLI
|
|
60
|
+
* bespoke handlers. Unique across the manifest. */
|
|
61
|
+
name: z.string().min(1),
|
|
62
|
+
/** SC.2 verb. */
|
|
63
|
+
verb: z.enum(OPERATION_VERBS),
|
|
64
|
+
/** SC.2 target: the kind, and an optional type that narrows it. */
|
|
65
|
+
target: z.object({
|
|
66
|
+
kind: z.enum(OPERATION_KINDS),
|
|
67
|
+
type: z.string().min(1).optional()
|
|
68
|
+
}),
|
|
69
|
+
/** SC.2 axes this operation accepts. */
|
|
70
|
+
axes: z.array(z.enum(OPERATION_AXES)).readonly(),
|
|
71
|
+
/** Projection class (design doc): where in the surface taxonomy this row
|
|
72
|
+
* lives. `internal_backing` is a class, not a second language. */
|
|
73
|
+
projection: z.object({
|
|
74
|
+
class: z.enum(PROJECTION_CLASSES),
|
|
75
|
+
/** Per-surface exposure. `kernelApi` is present so the shadow surface is
|
|
76
|
+
* expressible; the four public surfaces mirror the registry map. */
|
|
77
|
+
surfaces: z.object({
|
|
78
|
+
sdk: z.enum(SURFACE_EXPOSURE),
|
|
79
|
+
rest: z.enum(SURFACE_EXPOSURE),
|
|
80
|
+
mcp: z.enum(SURFACE_EXPOSURE),
|
|
81
|
+
cli: z.enum(SURFACE_EXPOSURE),
|
|
82
|
+
host: z.enum(SURFACE_EXPOSURE),
|
|
83
|
+
kernelApi: z.enum(SURFACE_EXPOSURE)
|
|
84
|
+
}),
|
|
85
|
+
/** Compat rows carry an alias + exit-criteria doc pointer. */
|
|
86
|
+
compat: z.object({ aliasOf: z.string(), exitCriteria: z.string() }).optional()
|
|
87
|
+
}),
|
|
88
|
+
/** Where this row was expressed from (census population). */
|
|
89
|
+
source: z.enum(OPERATION_SOURCES),
|
|
90
|
+
/** Concrete source binding: the code location this row projects. For registry
|
|
91
|
+
* rows, the registry entry name; for kernelApi rows, the `api.*` ref path and
|
|
92
|
+
* its `components.lucern.*` component path; for extension/bespoke rows, the
|
|
93
|
+
* wiring symbol / command path. */
|
|
94
|
+
binding: z.object({
|
|
95
|
+
/** The primary source identifier (registry name, api ref path, tool name,
|
|
96
|
+
* or CLI command path). */
|
|
97
|
+
ref: z.string().min(1),
|
|
98
|
+
/** kernelApi component path (`components.lucern.*`) when source=kernelApi. */
|
|
99
|
+
componentPath: z.string().optional(),
|
|
100
|
+
/** For extension/bespoke rows that back a registry op, the registry op name
|
|
101
|
+
* they are a projection of (so census facts about registry ops are
|
|
102
|
+
* expressed on the row, not double-counted as phantom operations). */
|
|
103
|
+
backsRegistryOp: z.string().optional()
|
|
104
|
+
}),
|
|
105
|
+
/** Lifecycle status. `active` for served operations; `compat` for legacy
|
|
106
|
+
* aliases awaiting deletion criteria. */
|
|
107
|
+
status: z.enum(["active", "compat"]),
|
|
108
|
+
/** M2-derivation pointers, named-but-null in M1 (see file header). */
|
|
109
|
+
derivation: z.object({
|
|
110
|
+
/** Arg/returns schema derived in M2. Null in M1. */
|
|
111
|
+
schema: z.null(),
|
|
112
|
+
/** Legality-matrix row derived in M2. Null in M1. */
|
|
113
|
+
legality: z.null(),
|
|
114
|
+
/** Receipt shape derived in M2. Null in M1. */
|
|
115
|
+
receipt: z.null()
|
|
116
|
+
}),
|
|
117
|
+
/** Human-readable provenance from the census/registry. */
|
|
118
|
+
rationale: z.string()
|
|
119
|
+
});
|
|
120
|
+
var operationManifestSchema = z.object({
|
|
121
|
+
schemaVersion: z.literal("operation_manifest.m1.v1"),
|
|
122
|
+
generatedAt: z.string(),
|
|
123
|
+
/** Census reconciliation block: the counts this manifest expresses, keyed by
|
|
124
|
+
* the SC.1 disposition dimensions, so the derivability test can assert them
|
|
125
|
+
* against the disposition doc and surface any point-in-time delta. */
|
|
126
|
+
census: z.object({
|
|
127
|
+
total: z.number(),
|
|
128
|
+
bySource: z.object({
|
|
129
|
+
registry: z.number(),
|
|
130
|
+
kernelApi: z.number(),
|
|
131
|
+
mcp_extension: z.number(),
|
|
132
|
+
cli_bespoke: z.number()
|
|
133
|
+
}),
|
|
134
|
+
byProjectionClass: z.object({
|
|
135
|
+
canonical_public: z.number(),
|
|
136
|
+
internal_backing: z.number(),
|
|
137
|
+
extension: z.number(),
|
|
138
|
+
compat: z.number(),
|
|
139
|
+
client_local: z.number()
|
|
140
|
+
}),
|
|
141
|
+
registryBySurfaceClass: z.record(z.string(), z.number())
|
|
142
|
+
}),
|
|
143
|
+
operations: z.array(operationRowSchema)
|
|
144
|
+
});
|
|
145
|
+
var SC1_CENSUS_TARGETS = {
|
|
146
|
+
/** 190 function-registry contracts (surface-manifest.json). Exact. */
|
|
147
|
+
registryContracts: 190,
|
|
148
|
+
/** Registry class split (161 canonical public + 25 internal + 4 compat). */
|
|
149
|
+
registryCanonicalPublic: 161,
|
|
150
|
+
registryPlatformInternal: 25,
|
|
151
|
+
registryLegacyCompat: 4,
|
|
152
|
+
/** kernelApi allowlist refs. Census recorded 124 post-#1651; the live
|
|
153
|
+
* allowlist is the authority and the check tolerates a documented delta. */
|
|
154
|
+
kernelApiRefsCensus: 124,
|
|
155
|
+
/** MCP extension wirings the server hand-registers beyond the generated
|
|
156
|
+
* build (census: 159 MCP tools − 144 generated = 15). Every extension tool
|
|
157
|
+
* is *also* a registry contract, so these are expressed as projection facts
|
|
158
|
+
* (mcp_extension source rows that `backsRegistryOp`), not new operations. */
|
|
159
|
+
mcpExtensions: 15,
|
|
160
|
+
/** CLI bespoke handlers (census: 19). Gateway-hitting bespoke verbs +
|
|
161
|
+
* client-local tooling. Expressed as cli_bespoke rows; the gateway-hitting
|
|
162
|
+
* subset backs a registry op or is a promotion candidate. */
|
|
163
|
+
cliBespoke: 19
|
|
164
|
+
};
|
|
165
|
+
var MCP_EXTENSION_WIRINGS = [
|
|
166
|
+
// bootstrap group (BOOTSTRAP_MCP_TOOLS)
|
|
167
|
+
"generate_session_handoff",
|
|
168
|
+
"begin_build_session",
|
|
169
|
+
// coordination group (COORDINATION_MCP_TOOLS) — the SC.1 session-runtime family
|
|
170
|
+
"register_session",
|
|
171
|
+
"heartbeat_session",
|
|
172
|
+
"end_session",
|
|
173
|
+
"list_active_sessions",
|
|
174
|
+
"send_agent_message",
|
|
175
|
+
"broadcast_message",
|
|
176
|
+
"get_agent_inbox",
|
|
177
|
+
"claim_files",
|
|
178
|
+
// epistemic-contract group (EPISTEMIC_CONTRACT_MCP_TOOLS)
|
|
179
|
+
"create_epistemic_contract",
|
|
180
|
+
"evaluate_contract",
|
|
181
|
+
"get_contract_status",
|
|
182
|
+
// MCP-only internal contract evaluators (manifest.ts MCP_ONLY_INTERNAL_OPERATION_NAMES)
|
|
183
|
+
"evaluate_engineering_contract",
|
|
184
|
+
"evaluate_research_contract"
|
|
185
|
+
];
|
|
186
|
+
var CLI_BESPOKE_HANDLERS = [
|
|
187
|
+
// gateway-hitting bespoke verbs (SC.1: the 5 promotion candidates + the
|
|
188
|
+
// reconciliation/capture verbs that also carry bespoke handlers)
|
|
189
|
+
{
|
|
190
|
+
command: "checkpoint",
|
|
191
|
+
gatewayHitting: true,
|
|
192
|
+
backsRegistryOp: null,
|
|
193
|
+
promotionCandidate: true
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
command: "evidence record-ci",
|
|
197
|
+
gatewayHitting: true,
|
|
198
|
+
backsRegistryOp: "create_evidence",
|
|
199
|
+
promotionCandidate: true
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
command: "dispatch record",
|
|
203
|
+
gatewayHitting: true,
|
|
204
|
+
backsRegistryOp: null,
|
|
205
|
+
promotionCandidate: true
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
command: "pivot record",
|
|
209
|
+
gatewayHitting: true,
|
|
210
|
+
backsRegistryOp: null,
|
|
211
|
+
promotionCandidate: true
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
command: "contradiction declare",
|
|
215
|
+
gatewayHitting: true,
|
|
216
|
+
backsRegistryOp: "flag_contradiction",
|
|
217
|
+
promotionCandidate: true
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
command: "campaign closeout",
|
|
221
|
+
gatewayHitting: true,
|
|
222
|
+
backsRegistryOp: null,
|
|
223
|
+
promotionCandidate: false
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
command: "worktrees context",
|
|
227
|
+
gatewayHitting: true,
|
|
228
|
+
backsRegistryOp: "get_worktree",
|
|
229
|
+
promotionCandidate: false
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
command: "worktrees reconcile-gate",
|
|
233
|
+
gatewayHitting: true,
|
|
234
|
+
backsRegistryOp: null,
|
|
235
|
+
promotionCandidate: false
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
command: "embeddings",
|
|
239
|
+
gatewayHitting: true,
|
|
240
|
+
backsRegistryOp: null,
|
|
241
|
+
promotionCandidate: false
|
|
242
|
+
},
|
|
243
|
+
// client-local handlers (SC.1 §"Client-local ~10") — no server operation
|
|
244
|
+
{
|
|
245
|
+
command: "auth",
|
|
246
|
+
gatewayHitting: false,
|
|
247
|
+
backsRegistryOp: null,
|
|
248
|
+
promotionCandidate: false
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
command: "profile",
|
|
252
|
+
gatewayHitting: false,
|
|
253
|
+
backsRegistryOp: null,
|
|
254
|
+
promotionCandidate: false
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
command: "scope",
|
|
258
|
+
gatewayHitting: false,
|
|
259
|
+
backsRegistryOp: null,
|
|
260
|
+
promotionCandidate: false
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
command: "doctor",
|
|
264
|
+
gatewayHitting: false,
|
|
265
|
+
backsRegistryOp: null,
|
|
266
|
+
promotionCandidate: false
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
command: "completions",
|
|
270
|
+
gatewayHitting: false,
|
|
271
|
+
backsRegistryOp: null,
|
|
272
|
+
promotionCandidate: false
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
command: "login",
|
|
276
|
+
gatewayHitting: false,
|
|
277
|
+
backsRegistryOp: null,
|
|
278
|
+
promotionCandidate: false
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
command: "version",
|
|
282
|
+
gatewayHitting: false,
|
|
283
|
+
backsRegistryOp: null,
|
|
284
|
+
promotionCandidate: false
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
command: "functions",
|
|
288
|
+
gatewayHitting: false,
|
|
289
|
+
backsRegistryOp: null,
|
|
290
|
+
promotionCandidate: false
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
command: "replay",
|
|
294
|
+
gatewayHitting: false,
|
|
295
|
+
backsRegistryOp: null,
|
|
296
|
+
promotionCandidate: false
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
command: "local-workflow",
|
|
300
|
+
gatewayHitting: false,
|
|
301
|
+
backsRegistryOp: null,
|
|
302
|
+
promotionCandidate: false
|
|
303
|
+
}
|
|
304
|
+
];
|
|
305
|
+
|
|
306
|
+
export { CLI_BESPOKE_HANDLERS, MCP_EXTENSION_WIRINGS, OPERATION_AXES, OPERATION_KINDS, OPERATION_SOURCES, OPERATION_VERBS, PROJECTION_CLASSES, SC1_CENSUS_TARGETS, SURFACE_EXPOSURE, operationManifestSchema, operationRowSchema };
|
|
@@ -6043,6 +6043,14 @@ DATA_MODEL_MANIFEST_SKELETON.surfaces.map(
|
|
|
6043
6043
|
(surface) => surface.compositionEmitted
|
|
6044
6044
|
);
|
|
6045
6045
|
var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
|
|
6046
|
+
var EVIDENCE_KIND_VALUES = [
|
|
6047
|
+
"fact",
|
|
6048
|
+
"observation",
|
|
6049
|
+
"claim",
|
|
6050
|
+
"quote",
|
|
6051
|
+
"statistic",
|
|
6052
|
+
"signal"
|
|
6053
|
+
];
|
|
6046
6054
|
var EVIDENCE_METHODOLOGY_VALUES = [
|
|
6047
6055
|
"primary_research",
|
|
6048
6056
|
"expert_interview",
|
|
@@ -6096,6 +6104,7 @@ var EVIDENCE_TAXONOMY_REFUSAL_IDS = [
|
|
|
6096
6104
|
"metadata_scoring_plan_refused"
|
|
6097
6105
|
];
|
|
6098
6106
|
z.enum(EVIDENCE_RELATION_VALUES);
|
|
6107
|
+
z.enum(EVIDENCE_KIND_VALUES);
|
|
6099
6108
|
z.enum(EVIDENCE_METHODOLOGY_VALUES);
|
|
6100
6109
|
z.enum(
|
|
6101
6110
|
EVIDENCE_INFORMATION_ASYMMETRY_VALUES
|
|
@@ -5900,6 +5900,14 @@ DATA_MODEL_MANIFEST_SKELETON.surfaces.map(
|
|
|
5900
5900
|
(surface) => surface.compositionEmitted
|
|
5901
5901
|
);
|
|
5902
5902
|
var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
|
|
5903
|
+
var EVIDENCE_KIND_VALUES = [
|
|
5904
|
+
"fact",
|
|
5905
|
+
"observation",
|
|
5906
|
+
"claim",
|
|
5907
|
+
"quote",
|
|
5908
|
+
"statistic",
|
|
5909
|
+
"signal"
|
|
5910
|
+
];
|
|
5903
5911
|
var EVIDENCE_METHODOLOGY_VALUES = [
|
|
5904
5912
|
"primary_research",
|
|
5905
5913
|
"expert_interview",
|
|
@@ -5953,6 +5961,7 @@ var EVIDENCE_TAXONOMY_REFUSAL_IDS = [
|
|
|
5953
5961
|
"metadata_scoring_plan_refused"
|
|
5954
5962
|
];
|
|
5955
5963
|
z.enum(EVIDENCE_RELATION_VALUES);
|
|
5964
|
+
z.enum(EVIDENCE_KIND_VALUES);
|
|
5956
5965
|
z.enum(EVIDENCE_METHODOLOGY_VALUES);
|
|
5957
5966
|
z.enum(
|
|
5958
5967
|
EVIDENCE_INFORMATION_ASYMMETRY_VALUES
|
|
@@ -6043,6 +6043,14 @@ DATA_MODEL_MANIFEST_SKELETON.surfaces.map(
|
|
|
6043
6043
|
(surface) => surface.compositionEmitted
|
|
6044
6044
|
);
|
|
6045
6045
|
var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
|
|
6046
|
+
var EVIDENCE_KIND_VALUES = [
|
|
6047
|
+
"fact",
|
|
6048
|
+
"observation",
|
|
6049
|
+
"claim",
|
|
6050
|
+
"quote",
|
|
6051
|
+
"statistic",
|
|
6052
|
+
"signal"
|
|
6053
|
+
];
|
|
6046
6054
|
var EVIDENCE_METHODOLOGY_VALUES = [
|
|
6047
6055
|
"primary_research",
|
|
6048
6056
|
"expert_interview",
|
|
@@ -6096,6 +6104,7 @@ var EVIDENCE_TAXONOMY_REFUSAL_IDS = [
|
|
|
6096
6104
|
"metadata_scoring_plan_refused"
|
|
6097
6105
|
];
|
|
6098
6106
|
z.enum(EVIDENCE_RELATION_VALUES);
|
|
6107
|
+
z.enum(EVIDENCE_KIND_VALUES);
|
|
6099
6108
|
z.enum(EVIDENCE_METHODOLOGY_VALUES);
|
|
6100
6109
|
z.enum(
|
|
6101
6110
|
EVIDENCE_INFORMATION_ASYMMETRY_VALUES
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type EvidenceKind, type EvidenceRelation, type EvidenceSourceType } from "../types/evidence-taxonomy-target-scope.js";
|
|
2
|
+
export { EVIDENCE_KIND_VALUES, EVIDENCE_RELATION_VALUES, EVIDENCE_SOURCE_TYPE_VALUES, type EvidenceKind, type EvidenceRelation, type EvidenceSourceType, } from "../types/evidence-taxonomy-target-scope.js";
|
|
3
|
+
export declare function assertEvidenceSignedWeight(value: unknown, context: string): number;
|
|
4
|
+
export declare function evidenceRelationFromSignedWeight(weight: number): EvidenceRelation;
|
|
5
|
+
export declare function assertEvidenceRelationMatchesSignedWeight(relation: EvidenceRelation, weight: number, context: string): void;
|
|
6
|
+
export declare function normalizeEvidenceRelationForSignedWeight(relation: unknown, weight: number, context?: string): EvidenceRelation;
|
|
7
|
+
export declare function normalizeEvidenceKind(kind: string | undefined, context?: string): EvidenceKind;
|
|
8
|
+
export declare function normalizeEvidenceSourceType(sourceType: string | undefined, context?: string): EvidenceSourceType;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ConvexError } from 'convex/values';
|
|
3
|
+
|
|
4
|
+
// src/types/evidence-taxonomy-target-scope.ts
|
|
5
|
+
var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
|
|
6
|
+
var EVIDENCE_KIND_VALUES = [
|
|
7
|
+
"fact",
|
|
8
|
+
"observation",
|
|
9
|
+
"claim",
|
|
10
|
+
"quote",
|
|
11
|
+
"statistic",
|
|
12
|
+
"signal"
|
|
13
|
+
];
|
|
14
|
+
var EVIDENCE_METHODOLOGY_VALUES = [
|
|
15
|
+
"primary_research",
|
|
16
|
+
"expert_interview",
|
|
17
|
+
"customer_interview",
|
|
18
|
+
"field_observation",
|
|
19
|
+
"proprietary_data",
|
|
20
|
+
"desk_research",
|
|
21
|
+
"regulatory_filing",
|
|
22
|
+
"news_article",
|
|
23
|
+
"academic_paper",
|
|
24
|
+
"ai_synthesis",
|
|
25
|
+
"ai_extraction"
|
|
26
|
+
];
|
|
27
|
+
var EVIDENCE_INFORMATION_ASYMMETRY_VALUES = [
|
|
28
|
+
"proprietary",
|
|
29
|
+
"early",
|
|
30
|
+
"common"
|
|
31
|
+
];
|
|
32
|
+
var EVIDENCE_SOURCE_QUALITY_VALUES = [
|
|
33
|
+
"primary",
|
|
34
|
+
"analyzed",
|
|
35
|
+
"secondary",
|
|
36
|
+
"tertiary",
|
|
37
|
+
"unknown"
|
|
38
|
+
];
|
|
39
|
+
var EVIDENCE_SOURCE_TYPE_VALUES = [
|
|
40
|
+
"human",
|
|
41
|
+
"ai_extracted",
|
|
42
|
+
"ai_generated",
|
|
43
|
+
"imported",
|
|
44
|
+
"system",
|
|
45
|
+
"verified",
|
|
46
|
+
"proprietary"
|
|
47
|
+
];
|
|
48
|
+
var EVIDENCE_SCORING_DIMENSIONS = [
|
|
49
|
+
"signedImpact",
|
|
50
|
+
"evidenceRelation",
|
|
51
|
+
"sourceQuality",
|
|
52
|
+
"methodology",
|
|
53
|
+
"informationAsymmetry",
|
|
54
|
+
"sourceRef",
|
|
55
|
+
"targetBeliefId",
|
|
56
|
+
"verificationStatus"
|
|
57
|
+
];
|
|
58
|
+
z.enum(EVIDENCE_RELATION_VALUES);
|
|
59
|
+
z.enum(EVIDENCE_KIND_VALUES);
|
|
60
|
+
z.enum(EVIDENCE_METHODOLOGY_VALUES);
|
|
61
|
+
z.enum(
|
|
62
|
+
EVIDENCE_INFORMATION_ASYMMETRY_VALUES
|
|
63
|
+
);
|
|
64
|
+
z.enum(
|
|
65
|
+
EVIDENCE_SOURCE_QUALITY_VALUES
|
|
66
|
+
);
|
|
67
|
+
z.enum(EVIDENCE_SOURCE_TYPE_VALUES);
|
|
68
|
+
z.enum(
|
|
69
|
+
EVIDENCE_SCORING_DIMENSIONS
|
|
70
|
+
);
|
|
71
|
+
function throwStructuredMutationError(args) {
|
|
72
|
+
const data = {
|
|
73
|
+
structuredMutationError: true,
|
|
74
|
+
message: args.message,
|
|
75
|
+
status: args.status,
|
|
76
|
+
code: args.code,
|
|
77
|
+
invariantCode: args.invariantCode,
|
|
78
|
+
suggestion: args.suggestion,
|
|
79
|
+
details: args.details
|
|
80
|
+
};
|
|
81
|
+
const error = new ConvexError(
|
|
82
|
+
data
|
|
83
|
+
);
|
|
84
|
+
error.status = args.status;
|
|
85
|
+
error.code = args.code;
|
|
86
|
+
error.invariantCode = args.invariantCode;
|
|
87
|
+
error.suggestion = args.suggestion;
|
|
88
|
+
error.details = args.details;
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/schema-helpers/evidenceAdmission.ts
|
|
93
|
+
var EVIDENCE_KIND_SET = new Set(EVIDENCE_KIND_VALUES);
|
|
94
|
+
var EVIDENCE_SOURCE_TYPE_SET = new Set(EVIDENCE_SOURCE_TYPE_VALUES);
|
|
95
|
+
function assertEvidenceSignedWeight(value, context) {
|
|
96
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value === 0 || value < -1 || value > 1) {
|
|
97
|
+
throw new Error(`${context} requires explicit nonzero weight in [-1, 1]`);
|
|
98
|
+
}
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
function evidenceRelationFromSignedWeight(weight) {
|
|
102
|
+
return weight < 0 ? "contradicts" : "supports";
|
|
103
|
+
}
|
|
104
|
+
function assertEvidenceRelationMatchesSignedWeight(relation, weight, context) {
|
|
105
|
+
if (relation === "supports" && weight < 0) {
|
|
106
|
+
throw new Error(`${context} relation supports requires positive weight`);
|
|
107
|
+
}
|
|
108
|
+
if (relation === "contradicts" && weight > 0) {
|
|
109
|
+
throw new Error(`${context} relation contradicts requires negative weight`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function normalizeEvidenceRelationForSignedWeight(relation, weight, context = "Evidence relation") {
|
|
113
|
+
if (relation === "supports" || relation === "contradicts") {
|
|
114
|
+
assertEvidenceRelationMatchesSignedWeight(relation, weight, context);
|
|
115
|
+
return relation;
|
|
116
|
+
}
|
|
117
|
+
return evidenceRelationFromSignedWeight(weight);
|
|
118
|
+
}
|
|
119
|
+
function normalizeEvidenceEnumText(value) {
|
|
120
|
+
return value.trim().toLowerCase();
|
|
121
|
+
}
|
|
122
|
+
function throwEvidenceTaxonomyEnumRefusal(args) {
|
|
123
|
+
throwStructuredMutationError({
|
|
124
|
+
status: 400,
|
|
125
|
+
code: "INVALID_INPUT",
|
|
126
|
+
message: `[${args.context}] Invalid evidence ${args.field} "${args.value}".`,
|
|
127
|
+
invariantCode: "evidence.taxonomy_enum",
|
|
128
|
+
suggestion: `Valid evidence ${args.field} values: ${args.allowed.join(", ")}.`,
|
|
129
|
+
details: {
|
|
130
|
+
field: args.field,
|
|
131
|
+
value: args.value,
|
|
132
|
+
allowed: args.allowed
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function normalizeEvidenceKind(kind, context = "evidence.kind") {
|
|
137
|
+
if (typeof kind !== "string" || kind.trim().length === 0) {
|
|
138
|
+
return "observation";
|
|
139
|
+
}
|
|
140
|
+
const normalized = normalizeEvidenceEnumText(kind);
|
|
141
|
+
if (EVIDENCE_KIND_SET.has(normalized)) {
|
|
142
|
+
return normalized;
|
|
143
|
+
}
|
|
144
|
+
throwEvidenceTaxonomyEnumRefusal({
|
|
145
|
+
field: "kind",
|
|
146
|
+
value: normalized,
|
|
147
|
+
allowed: EVIDENCE_KIND_VALUES,
|
|
148
|
+
context
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function normalizeEvidenceSourceType(sourceType, context = "evidence.sourceType") {
|
|
152
|
+
if (typeof sourceType !== "string" || sourceType.trim().length === 0) {
|
|
153
|
+
return "ai_generated";
|
|
154
|
+
}
|
|
155
|
+
const normalized = normalizeEvidenceEnumText(sourceType);
|
|
156
|
+
if (EVIDENCE_SOURCE_TYPE_SET.has(normalized)) {
|
|
157
|
+
return normalized;
|
|
158
|
+
}
|
|
159
|
+
throwEvidenceTaxonomyEnumRefusal({
|
|
160
|
+
field: "sourceType",
|
|
161
|
+
value: normalized,
|
|
162
|
+
allowed: EVIDENCE_SOURCE_TYPE_VALUES,
|
|
163
|
+
context
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { EVIDENCE_KIND_VALUES, EVIDENCE_RELATION_VALUES, EVIDENCE_SOURCE_TYPE_VALUES, assertEvidenceRelationMatchesSignedWeight, assertEvidenceSignedWeight, evidenceRelationFromSignedWeight, normalizeEvidenceKind, normalizeEvidenceRelationForSignedWeight, normalizeEvidenceSourceType };
|
package/dist/schemas/index.js
CHANGED
|
@@ -2975,9 +2975,39 @@ var domainEvents = defineTable({
|
|
|
2975
2975
|
name: "by_resource",
|
|
2976
2976
|
columns: ["resourceType", "resourceId", "timestamp"]
|
|
2977
2977
|
},
|
|
2978
|
+
// OB.2: global chronological order for the Axiom forwarding scan. The
|
|
2979
|
+
// forwarder pages events strictly by (timestamp, eventId) after its
|
|
2980
|
+
// checkpoint cursor, so it needs a total time order independent of topic /
|
|
2981
|
+
// type / tenant. The forwarder additionally tie-breaks on eventId in
|
|
2982
|
+
// application code for events sharing a millisecond timestamp.
|
|
2983
|
+
{ kind: "index", name: "by_timestamp", columns: ["timestamp"] },
|
|
2978
2984
|
{ kind: "index", name: "by_expiresAt", columns: ["expiresAt"] }
|
|
2979
2985
|
]
|
|
2980
2986
|
});
|
|
2987
|
+
var domainEventForwardCheckpoints = defineTable({
|
|
2988
|
+
name: "domainEventForwardCheckpoints",
|
|
2989
|
+
component: "kernel",
|
|
2990
|
+
category: "events",
|
|
2991
|
+
shape: z.object({
|
|
2992
|
+
// Logical sink name. One checkpoint row per forwarding destination so a
|
|
2993
|
+
// second sink (e.g. a future OTel path) never contends on this cursor.
|
|
2994
|
+
sink: z.string(),
|
|
2995
|
+
// Cursor: the timestamp of the last successfully forwarded event (ms epoch).
|
|
2996
|
+
lastForwardedTimestamp: z.number(),
|
|
2997
|
+
// Cursor tie-breaker: the eventId of the last successfully forwarded event.
|
|
2998
|
+
lastForwardedEventId: z.string(),
|
|
2999
|
+
// Running count of events forwarded through this sink (observability of the
|
|
3000
|
+
// observer — lets an operator confirm the pump is moving without Axiom).
|
|
3001
|
+
forwardedCount: z.number(),
|
|
3002
|
+
// When this checkpoint row was last advanced (ms epoch).
|
|
3003
|
+
updatedAt: z.number(),
|
|
3004
|
+
// Last tick outcome, for at-a-glance health without querying Axiom.
|
|
3005
|
+
lastStatus: z.enum(["ok", "empty", "export_failed"]).optional(),
|
|
3006
|
+
// Redacted last-error summary when lastStatus is export_failed.
|
|
3007
|
+
lastError: z.string().optional()
|
|
3008
|
+
}),
|
|
3009
|
+
indices: [{ kind: "index", name: "by_sink", columns: ["sink"] }]
|
|
3010
|
+
});
|
|
2981
3011
|
var idempotencyTokens = defineTable({
|
|
2982
3012
|
name: "idempotencyTokens",
|
|
2983
3013
|
component: "kernel",
|
|
@@ -9985,6 +10015,14 @@ DATA_MODEL_MANIFEST_SKELETON.surfaces.map(
|
|
|
9985
10015
|
(surface) => surface.compositionEmitted
|
|
9986
10016
|
);
|
|
9987
10017
|
var EVIDENCE_RELATION_VALUES = ["supports", "contradicts"];
|
|
10018
|
+
var EVIDENCE_KIND_VALUES = [
|
|
10019
|
+
"fact",
|
|
10020
|
+
"observation",
|
|
10021
|
+
"claim",
|
|
10022
|
+
"quote",
|
|
10023
|
+
"statistic",
|
|
10024
|
+
"signal"
|
|
10025
|
+
];
|
|
9988
10026
|
var EVIDENCE_METHODOLOGY_VALUES = [
|
|
9989
10027
|
"primary_research",
|
|
9990
10028
|
"expert_interview",
|
|
@@ -10038,6 +10076,7 @@ var EVIDENCE_TAXONOMY_REFUSAL_IDS = [
|
|
|
10038
10076
|
"metadata_scoring_plan_refused"
|
|
10039
10077
|
];
|
|
10040
10078
|
z.enum(EVIDENCE_RELATION_VALUES);
|
|
10079
|
+
z.enum(EVIDENCE_KIND_VALUES);
|
|
10041
10080
|
z.enum(EVIDENCE_METHODOLOGY_VALUES);
|
|
10042
10081
|
z.enum(
|
|
10043
10082
|
EVIDENCE_INFORMATION_ASYMMETRY_VALUES
|
|
@@ -13496,6 +13535,7 @@ var KERNEL_TABLE_CONTRACTS = [
|
|
|
13496
13535
|
decisionRiskLedger,
|
|
13497
13536
|
decisionSnapshots,
|
|
13498
13537
|
domainEvents,
|
|
13538
|
+
domainEventForwardCheckpoints,
|
|
13499
13539
|
deliberationContributions,
|
|
13500
13540
|
deliberationSessions,
|
|
13501
13541
|
stakeholderGroups,
|