@hraness/oh 0.2.3

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 (126) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +598 -0
  3. package/dist/canonical.d.ts +32 -0
  4. package/dist/canonical.d.ts.map +1 -0
  5. package/dist/cli.d.ts +4 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +3419 -0
  8. package/dist/contract.d.ts +33 -0
  9. package/dist/contract.d.ts.map +1 -0
  10. package/dist/graph.d.ts +67 -0
  11. package/dist/graph.d.ts.map +1 -0
  12. package/dist/index.d.ts +9 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +1988 -0
  15. package/dist/libsql.d.ts +57 -0
  16. package/dist/libsql.d.ts.map +1 -0
  17. package/dist/libsql.js +2662 -0
  18. package/dist/memory.d.ts +366 -0
  19. package/dist/memory.d.ts.map +1 -0
  20. package/dist/memory.js +3650 -0
  21. package/dist/ontology.d.ts +242 -0
  22. package/dist/ontology.d.ts.map +1 -0
  23. package/dist/operation.d.ts +24 -0
  24. package/dist/operation.d.ts.map +1 -0
  25. package/dist/projection-public.d.ts +59 -0
  26. package/dist/projection-public.d.ts.map +1 -0
  27. package/dist/projection-public.js +1682 -0
  28. package/dist/projection-suss.d.ts +17 -0
  29. package/dist/projection-suss.d.ts.map +1 -0
  30. package/dist/projection-suss.js +1721 -0
  31. package/dist/projection.d.ts +315 -0
  32. package/dist/projection.d.ts.map +1 -0
  33. package/dist/schema.d.ts +45 -0
  34. package/dist/schema.d.ts.map +1 -0
  35. package/dist/sdk.d.ts +51 -0
  36. package/dist/sdk.d.ts.map +1 -0
  37. package/dist/sdk.js +3072 -0
  38. package/dist/search.d.ts +34 -0
  39. package/dist/search.d.ts.map +1 -0
  40. package/dist/semantic.d.ts +83 -0
  41. package/dist/semantic.d.ts.map +1 -0
  42. package/dist/semantic.js +706 -0
  43. package/dist/sqlite/driver.d.ts +6 -0
  44. package/dist/sqlite/driver.d.ts.map +1 -0
  45. package/dist/sqlite/index.d.ts +5 -0
  46. package/dist/sqlite/index.d.ts.map +1 -0
  47. package/dist/sqlite/index.js +2840 -0
  48. package/dist/sqlite/migrations.d.ts +10 -0
  49. package/dist/sqlite/migrations.d.ts.map +1 -0
  50. package/dist/sqlite/port.d.ts +40 -0
  51. package/dist/sqlite/port.d.ts.map +1 -0
  52. package/dist/sqlite/runtime.d.ts +23 -0
  53. package/dist/sqlite/runtime.d.ts.map +1 -0
  54. package/dist/sqlite/store.d.ts +85 -0
  55. package/dist/sqlite/store.d.ts.map +1 -0
  56. package/dist/store.d.ts +236 -0
  57. package/dist/store.d.ts.map +1 -0
  58. package/dist/store.js +996 -0
  59. package/dist/sync.d.ts +57 -0
  60. package/dist/sync.d.ts.map +1 -0
  61. package/dist/sync.js +1328 -0
  62. package/package.json +121 -0
  63. package/skills/oh/SKILL.md +206 -0
  64. package/skills/oh/agents/openai.yaml +4 -0
  65. package/spec/README.md +74 -0
  66. package/spec/manifest.json +41 -0
  67. package/spec/v1/canonical-json.md +59 -0
  68. package/spec/v1/contract.json +28 -0
  69. package/spec/v1/contract.schema.json +58 -0
  70. package/spec/v1/embedding-profile.json +11 -0
  71. package/spec/v1/embedding.md +56 -0
  72. package/spec/v1/graph.md +87 -0
  73. package/spec/v1/memory.md +193 -0
  74. package/spec/v1/migration.md +92 -0
  75. package/spec/v1/ontology.json +55 -0
  76. package/spec/v1/ontology.md +80 -0
  77. package/spec/v1/operation.schema.json +138 -0
  78. package/spec/v1/projection-identity.schema.json +58 -0
  79. package/spec/v1/projection-query.schema.json +60 -0
  80. package/spec/v1/projection-result.schema.json +452 -0
  81. package/spec/v1/projection-rule-pack.schema.json +182 -0
  82. package/spec/v1/projection.md +165 -0
  83. package/spec/v1/record.schema.json +95 -0
  84. package/spec/v1/schema-evolution.md +51 -0
  85. package/spec/v1/schema-revision.schema.json +178 -0
  86. package/spec/v1/storage.md +88 -0
  87. package/spec/v1/store.md +131 -0
  88. package/spec/v1/sync-bundle.schema.json +51 -0
  89. package/spec/v1/sync.md +67 -0
  90. package/src/canonical.test.ts +46 -0
  91. package/src/canonical.ts +203 -0
  92. package/src/cli.test.ts +103 -0
  93. package/src/cli.ts +308 -0
  94. package/src/contract.ts +87 -0
  95. package/src/contracts.test.ts +147 -0
  96. package/src/graph.ts +248 -0
  97. package/src/index.ts +8 -0
  98. package/src/libsql.test.ts +657 -0
  99. package/src/libsql.ts +1687 -0
  100. package/src/memory.test.ts +783 -0
  101. package/src/memory.ts +1684 -0
  102. package/src/ontology.ts +573 -0
  103. package/src/operation.ts +80 -0
  104. package/src/projection-public.ts +53 -0
  105. package/src/projection-suss.ts +129 -0
  106. package/src/projection.test.ts +418 -0
  107. package/src/projection.ts +1457 -0
  108. package/src/schema.ts +156 -0
  109. package/src/sdk.ts +96 -0
  110. package/src/search.ts +66 -0
  111. package/src/semantic.test.ts +480 -0
  112. package/src/semantic.ts +333 -0
  113. package/src/sqlite/driver.ts +47 -0
  114. package/src/sqlite/index.ts +4 -0
  115. package/src/sqlite/migrations.test.ts +44 -0
  116. package/src/sqlite/migrations.ts +178 -0
  117. package/src/sqlite/port.test.ts +127 -0
  118. package/src/sqlite/port.ts +120 -0
  119. package/src/sqlite/runtime.test.ts +68 -0
  120. package/src/sqlite/runtime.ts +53 -0
  121. package/src/sqlite/store.test.ts +295 -0
  122. package/src/sqlite/store.ts +988 -0
  123. package/src/store.test.ts +121 -0
  124. package/src/store.ts +701 -0
  125. package/src/sync.test.ts +117 -0
  126. package/src/sync.ts +227 -0
@@ -0,0 +1,58 @@
1
+ {
2
+ "$defs": {
3
+ "sha256": {
4
+ "pattern": "^[a-f0-9]{64}$",
5
+ "type": "string"
6
+ }
7
+ },
8
+ "$id": "https://oh.computer/spec/v1/projection-identity.schema.json",
9
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
10
+ "$comment": "Runtime conformance requires the exact public contract digest and recomputes projectionSha256 over every identity field other than projectionSha256 itself.",
11
+ "additionalProperties": false,
12
+ "properties": {
13
+ "contractSha256": {
14
+ "const": "e53ae573c2af417082be9f554d0f6f3e317f054daf745181f462608e3f622594"
15
+ },
16
+ "datasetSha256": {
17
+ "$ref": "#/$defs/sha256"
18
+ },
19
+ "engineSha256": {
20
+ "$ref": "#/$defs/sha256"
21
+ },
22
+ "evaluationSha256": {
23
+ "$ref": "#/$defs/sha256"
24
+ },
25
+ "projectionSha256": {
26
+ "$ref": "#/$defs/sha256"
27
+ },
28
+ "querySha256": {
29
+ "$ref": "#/$defs/sha256"
30
+ },
31
+ "rulePackSha256": {
32
+ "$ref": "#/$defs/sha256"
33
+ },
34
+ "semantics": {
35
+ "const": "oh.projection.positive-datalog.v1"
36
+ },
37
+ "snapshotSha256": {
38
+ "$ref": "#/$defs/sha256"
39
+ },
40
+ "v": {
41
+ "const": 1
42
+ }
43
+ },
44
+ "required": [
45
+ "contractSha256",
46
+ "datasetSha256",
47
+ "engineSha256",
48
+ "evaluationSha256",
49
+ "projectionSha256",
50
+ "querySha256",
51
+ "rulePackSha256",
52
+ "semantics",
53
+ "snapshotSha256",
54
+ "v"
55
+ ],
56
+ "title": "Oh projection identity V1",
57
+ "type": "object"
58
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "$defs": {
3
+ "safeCode": {
4
+ "maxLength": 128,
5
+ "pattern": "^[a-z][a-z0-9]*(?:[._:/-][a-z0-9]+)*$",
6
+ "type": "string"
7
+ },
8
+ "sha256": {
9
+ "pattern": "^[a-f0-9]{64}$",
10
+ "type": "string"
11
+ }
12
+ },
13
+ "$id": "https://oh.computer/spec/v1/projection-query.schema.json",
14
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
15
+ "$comment": "Runtime conformance additionally requires unique projected variables, binds every projected variable in the body, enforces the 256-variable aggregate ceiling, and recomputes querySha256.",
16
+ "additionalProperties": false,
17
+ "properties": {
18
+ "find": {
19
+ "items": {
20
+ "$ref": "#/$defs/safeCode"
21
+ },
22
+ "maxItems": 32,
23
+ "minItems": 1,
24
+ "type": "array",
25
+ "uniqueItems": true
26
+ },
27
+ "limit": {
28
+ "maximum": 65536,
29
+ "minimum": 1,
30
+ "type": "integer"
31
+ },
32
+ "queryId": {
33
+ "$ref": "#/$defs/safeCode"
34
+ },
35
+ "querySha256": {
36
+ "$ref": "#/$defs/sha256"
37
+ },
38
+ "v": {
39
+ "const": 1
40
+ },
41
+ "where": {
42
+ "items": {
43
+ "$ref": "./projection-rule-pack.schema.json#/$defs/literal"
44
+ },
45
+ "maxItems": 64,
46
+ "minItems": 1,
47
+ "type": "array"
48
+ }
49
+ },
50
+ "required": [
51
+ "find",
52
+ "limit",
53
+ "queryId",
54
+ "querySha256",
55
+ "where",
56
+ "v"
57
+ ],
58
+ "title": "Oh projection query V1",
59
+ "type": "object"
60
+ }
@@ -0,0 +1,452 @@
1
+ {
2
+ "$defs": {
3
+ "atom": {
4
+ "oneOf": [
5
+ {
6
+ "type": "boolean"
7
+ },
8
+ {
9
+ "type": "null"
10
+ },
11
+ {
12
+ "type": "number"
13
+ },
14
+ {
15
+ "maxLength": 16382,
16
+ "type": "string"
17
+ }
18
+ ]
19
+ },
20
+ "derivedProof": {
21
+ "additionalProperties": false,
22
+ "allOf": [
23
+ {
24
+ "if": {
25
+ "properties": {
26
+ "premisesTruncated": {
27
+ "const": false
28
+ }
29
+ },
30
+ "required": [
31
+ "premisesTruncated"
32
+ ]
33
+ },
34
+ "then": {
35
+ "properties": {
36
+ "premises": {
37
+ "minItems": 1
38
+ }
39
+ }
40
+ }
41
+ },
42
+ {
43
+ "if": {
44
+ "properties": {
45
+ "premisesTruncated": {
46
+ "const": true
47
+ }
48
+ },
49
+ "required": [
50
+ "premisesTruncated"
51
+ ]
52
+ },
53
+ "then": {
54
+ "properties": {
55
+ "premises": {
56
+ "maxItems": 63
57
+ }
58
+ }
59
+ }
60
+ }
61
+ ],
62
+ "properties": {
63
+ "kind": {
64
+ "const": "derived"
65
+ },
66
+ "premises": {
67
+ "items": {
68
+ "$ref": "#/$defs/proof"
69
+ },
70
+ "maxItems": 64,
71
+ "type": "array"
72
+ },
73
+ "premisesTruncated": {
74
+ "type": "boolean"
75
+ },
76
+ "relation": {
77
+ "$ref": "#/$defs/safeCode"
78
+ },
79
+ "ruleId": {
80
+ "$ref": "#/$defs/safeCode"
81
+ },
82
+ "ruleSha256": {
83
+ "$ref": "#/$defs/sha256"
84
+ },
85
+ "tuple": {
86
+ "$ref": "#/$defs/tuple"
87
+ },
88
+ "v": {
89
+ "const": 1
90
+ }
91
+ },
92
+ "required": [
93
+ "kind",
94
+ "premises",
95
+ "premisesTruncated",
96
+ "relation",
97
+ "ruleId",
98
+ "ruleSha256",
99
+ "tuple",
100
+ "v"
101
+ ],
102
+ "type": "object"
103
+ },
104
+ "evaluation": {
105
+ "additionalProperties": false,
106
+ "properties": {
107
+ "maximumDerivedTuples": {
108
+ "maximum": 262144,
109
+ "minimum": 1,
110
+ "type": "integer"
111
+ },
112
+ "maximumProofDepth": {
113
+ "maximum": 128,
114
+ "minimum": 1,
115
+ "type": "integer"
116
+ },
117
+ "maximumProofNodes": {
118
+ "maximum": 4096,
119
+ "minimum": 1,
120
+ "type": "integer"
121
+ },
122
+ "maximumResultBytes": {
123
+ "maximum": 16777216,
124
+ "minimum": 65536,
125
+ "type": "integer"
126
+ },
127
+ "maximumRounds": {
128
+ "maximum": 1024,
129
+ "minimum": 1,
130
+ "type": "integer"
131
+ },
132
+ "maximumTotalProofNodes": {
133
+ "maximum": 65536,
134
+ "minimum": 1,
135
+ "type": "integer"
136
+ },
137
+ "maximumWorkUnits": {
138
+ "maximum": 16777216,
139
+ "minimum": 1,
140
+ "type": "integer"
141
+ },
142
+ "v": {
143
+ "const": 1
144
+ }
145
+ },
146
+ "required": [
147
+ "maximumDerivedTuples",
148
+ "maximumProofDepth",
149
+ "maximumProofNodes",
150
+ "maximumResultBytes",
151
+ "maximumRounds",
152
+ "maximumTotalProofNodes",
153
+ "maximumWorkUnits",
154
+ "v"
155
+ ],
156
+ "type": "object"
157
+ },
158
+ "engineCode": {
159
+ "maxLength": 256,
160
+ "pattern": "^[a-z][a-z0-9]*(?:[._:/-][a-z0-9]+)*$",
161
+ "type": "string"
162
+ },
163
+ "factProof": {
164
+ "additionalProperties": false,
165
+ "properties": {
166
+ "kind": {
167
+ "const": "fact"
168
+ },
169
+ "relation": {
170
+ "$ref": "#/$defs/safeCode"
171
+ },
172
+ "sources": {
173
+ "items": {
174
+ "$ref": "#/$defs/source"
175
+ },
176
+ "maxItems": 64,
177
+ "minItems": 1,
178
+ "type": "array"
179
+ },
180
+ "tuple": {
181
+ "$ref": "#/$defs/tuple"
182
+ },
183
+ "v": {
184
+ "const": 1
185
+ }
186
+ },
187
+ "required": [
188
+ "kind",
189
+ "relation",
190
+ "sources",
191
+ "tuple",
192
+ "v"
193
+ ],
194
+ "type": "object"
195
+ },
196
+ "proof": {
197
+ "oneOf": [
198
+ {
199
+ "$ref": "#/$defs/factProof"
200
+ },
201
+ {
202
+ "$ref": "#/$defs/derivedProof"
203
+ },
204
+ {
205
+ "$ref": "#/$defs/truncatedProof"
206
+ }
207
+ ]
208
+ },
209
+ "row": {
210
+ "additionalProperties": false,
211
+ "properties": {
212
+ "proofs": {
213
+ "items": {
214
+ "$ref": "#/$defs/proof"
215
+ },
216
+ "maxItems": 64,
217
+ "type": "array"
218
+ },
219
+ "proofsTruncated": {
220
+ "type": "boolean"
221
+ },
222
+ "supportCount": {
223
+ "maximum": 262144,
224
+ "minimum": 1,
225
+ "type": "integer"
226
+ },
227
+ "values": {
228
+ "$ref": "#/$defs/tuple"
229
+ },
230
+ "v": {
231
+ "const": 1
232
+ }
233
+ },
234
+ "required": [
235
+ "proofs",
236
+ "proofsTruncated",
237
+ "supportCount",
238
+ "values",
239
+ "v"
240
+ ],
241
+ "type": "object"
242
+ },
243
+ "safeCode": {
244
+ "maxLength": 128,
245
+ "pattern": "^[a-z][a-z0-9]*(?:[._:/-][a-z0-9]+)*$",
246
+ "type": "string"
247
+ },
248
+ "sha256": {
249
+ "pattern": "^[a-f0-9]{64}$",
250
+ "type": "string"
251
+ },
252
+ "source": {
253
+ "additionalProperties": false,
254
+ "properties": {
255
+ "key": {
256
+ "maxLength": 512,
257
+ "pattern": "^[a-z][a-z0-9]*(?:[._:/-][a-z0-9]+)*$",
258
+ "type": "string"
259
+ },
260
+ "recordSha256": {
261
+ "$ref": "#/$defs/sha256"
262
+ },
263
+ "v": {
264
+ "const": 1
265
+ }
266
+ },
267
+ "required": [
268
+ "key",
269
+ "recordSha256",
270
+ "v"
271
+ ],
272
+ "type": "object"
273
+ },
274
+ "stats": {
275
+ "additionalProperties": false,
276
+ "properties": {
277
+ "baseFacts": {
278
+ "maximum": 262144,
279
+ "minimum": 0,
280
+ "type": "integer"
281
+ },
282
+ "derivedFacts": {
283
+ "maximum": 262144,
284
+ "minimum": 0,
285
+ "type": "integer"
286
+ },
287
+ "proofNodes": {
288
+ "maximum": 65536,
289
+ "minimum": 0,
290
+ "type": "integer"
291
+ },
292
+ "proofsTruncated": {
293
+ "type": "boolean"
294
+ },
295
+ "queryMatches": {
296
+ "maximum": 262144,
297
+ "minimum": 0,
298
+ "type": "integer"
299
+ },
300
+ "relations": {
301
+ "maximum": 4096,
302
+ "minimum": 0,
303
+ "type": "integer"
304
+ },
305
+ "rounds": {
306
+ "maximum": 1024,
307
+ "minimum": 0,
308
+ "type": "integer"
309
+ },
310
+ "truncated": {
311
+ "type": "boolean"
312
+ },
313
+ "truncationReasons": {
314
+ "items": {
315
+ "enum": [
316
+ "query-limit",
317
+ "result-bytes"
318
+ ]
319
+ },
320
+ "maxItems": 2,
321
+ "type": "array",
322
+ "uniqueItems": true
323
+ },
324
+ "v": {
325
+ "const": 1
326
+ },
327
+ "workUnits": {
328
+ "maximum": 16777216,
329
+ "minimum": 0,
330
+ "type": "integer"
331
+ }
332
+ },
333
+ "required": [
334
+ "baseFacts",
335
+ "derivedFacts",
336
+ "proofNodes",
337
+ "proofsTruncated",
338
+ "queryMatches",
339
+ "relations",
340
+ "rounds",
341
+ "truncated",
342
+ "truncationReasons",
343
+ "v",
344
+ "workUnits"
345
+ ],
346
+ "type": "object"
347
+ },
348
+ "truncatedProof": {
349
+ "additionalProperties": false,
350
+ "properties": {
351
+ "kind": {
352
+ "const": "truncated"
353
+ },
354
+ "reason": {
355
+ "enum": [
356
+ "cycle",
357
+ "depth",
358
+ "nodes"
359
+ ]
360
+ },
361
+ "relation": {
362
+ "$ref": "#/$defs/safeCode"
363
+ },
364
+ "tuple": {
365
+ "$ref": "#/$defs/tuple"
366
+ },
367
+ "v": {
368
+ "const": 1
369
+ }
370
+ },
371
+ "required": [
372
+ "kind",
373
+ "reason",
374
+ "relation",
375
+ "tuple",
376
+ "v"
377
+ ],
378
+ "type": "object"
379
+ },
380
+ "tuple": {
381
+ "items": {
382
+ "$ref": "#/$defs/atom"
383
+ },
384
+ "maxItems": 32,
385
+ "minItems": 1,
386
+ "type": "array"
387
+ }
388
+ },
389
+ "$id": "https://oh.computer/spec/v1/projection-result.schema.json",
390
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
391
+ "$comment": "Runtime conformance additionally checks canonical row and source order, atom byte limits, declared aggregate limits, proof depth and node totals, truncation consistency, engineSha256, evaluationSha256, projectionSha256, and resultSha256.",
392
+ "additionalProperties": false,
393
+ "properties": {
394
+ "authority": {
395
+ "const": "derived"
396
+ },
397
+ "cache": {
398
+ "additionalProperties": false,
399
+ "properties": {
400
+ "strategy": {
401
+ "const": "full-rebuild"
402
+ },
403
+ "v": {
404
+ "const": 1
405
+ }
406
+ },
407
+ "required": [
408
+ "strategy",
409
+ "v"
410
+ ],
411
+ "type": "object"
412
+ },
413
+ "engine": {
414
+ "$ref": "#/$defs/engineCode"
415
+ },
416
+ "evaluation": {
417
+ "$ref": "#/$defs/evaluation"
418
+ },
419
+ "identity": {
420
+ "$ref": "./projection-identity.schema.json"
421
+ },
422
+ "resultSha256": {
423
+ "$ref": "#/$defs/sha256"
424
+ },
425
+ "rows": {
426
+ "items": {
427
+ "$ref": "#/$defs/row"
428
+ },
429
+ "maxItems": 65536,
430
+ "type": "array"
431
+ },
432
+ "stats": {
433
+ "$ref": "#/$defs/stats"
434
+ },
435
+ "v": {
436
+ "const": 1
437
+ }
438
+ },
439
+ "required": [
440
+ "authority",
441
+ "cache",
442
+ "engine",
443
+ "evaluation",
444
+ "identity",
445
+ "resultSha256",
446
+ "rows",
447
+ "stats",
448
+ "v"
449
+ ],
450
+ "title": "Oh projection result V1",
451
+ "type": "object"
452
+ }