@sixb/core 0.1.4 → 0.1.5

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 (74) hide show
  1. package/dist/actions/index.d.ts +2 -2
  2. package/dist/actions/index.d.ts.map +1 -1
  3. package/dist/actions/index.js +4 -4
  4. package/dist/actions/read-facade.d.ts +10 -2
  5. package/dist/actions/read-facade.d.ts.map +1 -1
  6. package/dist/actions/types/context.d.ts +45 -2
  7. package/dist/actions/types/context.d.ts.map +1 -1
  8. package/dist/agents/index.js +9 -9
  9. package/dist/agents/types.d.ts +2 -0
  10. package/dist/agents/types.d.ts.map +1 -1
  11. package/dist/agents/validation.d.ts.map +1 -1
  12. package/dist/bootstrap/index.js +13 -13
  13. package/dist/{chunk-tek1qwgm.js → chunk-1q02e95s.js} +8 -3
  14. package/dist/{chunk-tek1qwgm.js.map → chunk-1q02e95s.js.map} +4 -3
  15. package/dist/{chunk-sxwk41qa.js → chunk-4h947jd8.js} +1 -1
  16. package/dist/{chunk-7gw7mepb.js → chunk-6d5xdj1q.js} +1 -1
  17. package/dist/{chunk-tycbzedm.js → chunk-78c6xvyr.js} +68 -3
  18. package/dist/chunk-78c6xvyr.js.map +15 -0
  19. package/dist/{chunk-c43qr6s0.js → chunk-84h6qhmp.js} +12 -8
  20. package/dist/{chunk-c43qr6s0.js.map → chunk-84h6qhmp.js.map} +4 -4
  21. package/dist/{chunk-s31d0qmq.js → chunk-am6eczah.js} +10 -10
  22. package/dist/{chunk-s31d0qmq.js.map → chunk-am6eczah.js.map} +1 -1
  23. package/dist/{chunk-rs1wbvy6.js → chunk-ea73pzk7.js} +1 -1
  24. package/dist/{chunk-hbeh8j9w.js → chunk-gadsm794.js} +2 -2
  25. package/dist/{chunk-1yz3x65y.js → chunk-h6h91mfy.js} +6 -8
  26. package/dist/{chunk-1yz3x65y.js.map → chunk-h6h91mfy.js.map} +2 -2
  27. package/dist/{chunk-cbkm2vam.js → chunk-r0rry8dn.js} +1 -1
  28. package/dist/{chunk-afjpa2hs.js → chunk-tbv03sx2.js} +1 -1
  29. package/dist/{chunk-1wk20wn3.js → chunk-v0egge8b.js} +14 -18
  30. package/dist/{chunk-1wk20wn3.js.map → chunk-v0egge8b.js.map} +3 -3
  31. package/dist/{chunk-pn8n8sba.js → chunk-z3ga9q5m.js} +7 -11
  32. package/dist/{chunk-pn8n8sba.js.map → chunk-z3ga9q5m.js.map} +3 -4
  33. package/dist/{chunk-g13869yf.js → chunk-zp2v2rv6.js} +1 -1
  34. package/dist/execution/agent.js +9 -9
  35. package/dist/execution/primitive.js +9 -9
  36. package/dist/execution/request.js +9 -9
  37. package/dist/index.d.ts +1 -1
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +17 -17
  40. package/dist/index.js.map +1 -1
  41. package/dist/materializer/index.js +2 -2
  42. package/dist/objects/index.js +5 -5
  43. package/dist/objects/query/index.js +2 -2
  44. package/dist/ontology/internal.d.ts +1 -1
  45. package/dist/ontology/internal.d.ts.map +1 -1
  46. package/dist/ontology/internal.js +14 -6
  47. package/dist/ontology/internal.js.map +3 -3
  48. package/dist/ontology/json-schema.d.ts +10 -0
  49. package/dist/ontology/json-schema.d.ts.map +1 -1
  50. package/dist/pipelines/index.js +3 -3
  51. package/dist/projections/internal.js +1 -1
  52. package/dist/storage/index.js +1 -1
  53. package/dist/syncs/index.js +3 -3
  54. package/dist/testing/index.js +14 -14
  55. package/dist/webhooks/internal.js +1 -1
  56. package/dist/workflows/index.js +10 -10
  57. package/package.json +1 -1
  58. package/src/actions/index.ts +10 -1
  59. package/src/actions/read-facade.ts +125 -3
  60. package/src/actions/types/context.ts +69 -2
  61. package/src/agents/types.ts +2 -0
  62. package/src/agents/validation.ts +4 -0
  63. package/src/index.ts +5 -0
  64. package/src/ontology/internal.ts +1 -1
  65. package/src/ontology/json-schema.ts +27 -5
  66. package/src/storage/timeseries/store.ts +6 -6
  67. package/dist/chunk-tycbzedm.js.map +0 -15
  68. /package/dist/{chunk-sxwk41qa.js.map → chunk-4h947jd8.js.map} +0 -0
  69. /package/dist/{chunk-7gw7mepb.js.map → chunk-6d5xdj1q.js.map} +0 -0
  70. /package/dist/{chunk-rs1wbvy6.js.map → chunk-ea73pzk7.js.map} +0 -0
  71. /package/dist/{chunk-hbeh8j9w.js.map → chunk-gadsm794.js.map} +0 -0
  72. /package/dist/{chunk-cbkm2vam.js.map → chunk-r0rry8dn.js.map} +0 -0
  73. /package/dist/{chunk-afjpa2hs.js.map → chunk-tbv03sx2.js.map} +0 -0
  74. /package/dist/{chunk-g13869yf.js.map → chunk-zp2v2rv6.js.map} +0 -0
@@ -15,13 +15,20 @@ import"../chunk-y64skrwp.js";
15
15
 
16
16
  // src/ontology/json-schema.ts
17
17
  function schemaRecordToJsonSchema(input) {
18
+ return schemaFieldsToJsonSchema({
19
+ fields: Object.fromEntries(Object.entries(input.shape).map(([field, schema]) => [field, { schema, required: true }])),
20
+ valueTypesById: input.valueTypesById
21
+ });
22
+ }
23
+ function schemaFieldsToJsonSchema(input) {
24
+ const required = Object.entries(input.fields).filter(([, field]) => field.required === true).map(([field]) => field);
18
25
  return {
19
26
  type: "object",
20
- properties: Object.fromEntries(Object.entries(input.shape).map(([field, schema]) => [
21
- field,
22
- schemaOrRefJsonSchema(schema, input.valueTypesById, new Set)
23
- ])),
24
- required: Object.keys(input.shape),
27
+ properties: Object.fromEntries(Object.entries(input.fields).map(([fieldId, field]) => {
28
+ const fieldSchema = schemaOrRefJsonSchema(field.schema, input.valueTypesById, new Set);
29
+ return [fieldId, field.nullable ? { anyOf: [fieldSchema, { type: "null" }] } : fieldSchema];
30
+ })),
31
+ ...required.length > 0 ? { required } : {},
25
32
  additionalProperties: false
26
33
  };
27
34
  }
@@ -112,8 +119,9 @@ function schemaJsonSchema(schema, valueTypesById, resolving) {
112
119
  }
113
120
  export {
114
121
  schemaRecordToJsonSchema,
122
+ schemaFieldsToJsonSchema,
115
123
  createPropertyTokenMap,
116
124
  createLinkTokenMap
117
125
  };
118
126
 
119
- //# debugId=B0497B26F71F7BE164756E2164756E21
127
+ //# debugId=1F2F8E74CCDF230264756E2164756E21
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/ontology/json-schema.ts"],
4
4
  "sourcesContent": [
5
- "import { OntologyValidationError } from \"./errors\"\nimport { isObjectRefSchema, type SchemaOrRef } from \"./refs\"\nimport type { Schema, ValueType } from \"./types\"\n\nexport type SchemaJsonSchema = Readonly<Record<string, unknown>>\n\n/** Convert a record of Sixb schemas into the strict JSON object schema used by model outputs. */\nexport function schemaRecordToJsonSchema(input: {\n readonly shape: Readonly<Record<string, SchemaOrRef>>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n}): SchemaJsonSchema {\n return {\n type: \"object\",\n properties: Object.fromEntries(\n Object.entries(input.shape).map(([field, schema]) => [\n field,\n schemaOrRefJsonSchema(schema, input.valueTypesById, new Set()),\n ])\n ),\n required: Object.keys(input.shape),\n additionalProperties: false,\n }\n}\n\nfunction schemaOrRefJsonSchema(\n schema: SchemaOrRef,\n valueTypesById: ReadonlyMap<string, ValueType>,\n resolving: ReadonlySet<string>\n): SchemaJsonSchema {\n if (isObjectRefSchema(schema)) {\n return {\n type: \"object\",\n properties: {\n objectTypeId: { type: \"string\", const: schema.objectTypeId },\n primaryId: { type: \"string\" },\n },\n required: [\"objectTypeId\", \"primaryId\"],\n additionalProperties: false,\n }\n }\n return schemaJsonSchema(schema, valueTypesById, resolving)\n}\n\nfunction schemaJsonSchema(\n schema: Schema,\n valueTypesById: ReadonlyMap<string, ValueType>,\n resolving: ReadonlySet<string>\n): SchemaJsonSchema {\n if (typeof schema === \"string\") {\n switch (schema) {\n case \"string\":\n return { type: \"string\" }\n case \"integer\":\n return { type: \"integer\" }\n case \"double\":\n return { type: \"number\" }\n case \"decimal\":\n return { type: \"string\", pattern: \"^[+-]?\\\\d+(?:\\\\.\\\\d+)?$\" }\n case \"boolean\":\n return { type: \"boolean\" }\n case \"date\":\n return { type: \"string\", format: \"date\" }\n case \"timestamp\":\n return { type: \"string\", format: \"date-time\" }\n case \"uuid\":\n return { type: \"string\", format: \"uuid\" }\n case \"fileRef\":\n return {\n type: \"object\",\n properties: {\n blobId: { type: \"string\" },\n digest: { type: \"string\", pattern: \"^sha256:[a-fA-F0-9]{64}$\" },\n sizeBytes: { type: \"integer\", minimum: 0 },\n fileName: { type: \"string\" },\n mediaType: { type: \"string\" },\n logicalPath: { type: \"string\" },\n },\n required: [\"blobId\", \"digest\", \"sizeBytes\"],\n additionalProperties: false,\n }\n }\n }\n\n if (schema.type === \"enum\") return { enum: schema.values }\n if (schema.type === \"array\") {\n return { type: \"array\", items: schemaJsonSchema(schema.items, valueTypesById, resolving) }\n }\n if (schema.type === \"map\") {\n return {\n type: \"object\",\n additionalProperties: schemaJsonSchema(schema.valueSchema, valueTypesById, resolving),\n }\n }\n if (schema.type === \"object\") {\n const required: string[] = []\n const properties = Object.fromEntries(\n Object.entries(schema.properties).map(([fieldId, field]) => {\n if (field.required) required.push(fieldId)\n const fieldSchema = schemaJsonSchema(field.schema, valueTypesById, resolving)\n return [fieldId, field.nullable ? { anyOf: [fieldSchema, { type: \"null\" }] } : fieldSchema]\n })\n )\n return {\n type: \"object\",\n properties,\n ...(required.length > 0 ? { required } : {}),\n additionalProperties: false,\n }\n }\n\n const valueTypeId = schema.valueTypeId\n if (resolving.has(valueTypeId)) {\n throw new OntologyValidationError(\n `Structured output contains a recursive value type '${valueTypeId}'.`\n )\n }\n const resolved = schema._resolved ?? valueTypesById.get(valueTypeId)?.schema\n if (!resolved) {\n throw new OntologyValidationError(\n `Structured output references unknown value type '${valueTypeId}'.`\n )\n }\n return schemaJsonSchema(resolved, valueTypesById, new Set([...resolving, valueTypeId]))\n}\n"
5
+ "import { OntologyValidationError } from \"./errors\"\nimport { isObjectRefSchema, type SchemaOrRef } from \"./refs\"\nimport type { Schema, ValueType } from \"./types\"\n\nexport type SchemaJsonSchema = Readonly<Record<string, unknown>>\n\nexport interface SchemaJsonField {\n readonly schema: SchemaOrRef\n readonly required?: boolean\n readonly nullable?: boolean\n}\n\n/** Convert a record of Sixb schemas into the strict JSON object schema used by model outputs. */\nexport function schemaRecordToJsonSchema(input: {\n readonly shape: Readonly<Record<string, SchemaOrRef>>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n}): SchemaJsonSchema {\n return schemaFieldsToJsonSchema({\n fields: Object.fromEntries(\n Object.entries(input.shape).map(([field, schema]) => [field, { schema, required: true }])\n ),\n valueTypesById: input.valueTypesById,\n })\n}\n\n/** Convert configured fields into the strict JSON object schema accepted at runtime. */\nexport function schemaFieldsToJsonSchema(input: {\n readonly fields: Readonly<Record<string, SchemaJsonField>>\n readonly valueTypesById: ReadonlyMap<string, ValueType>\n}): SchemaJsonSchema {\n const required = Object.entries(input.fields)\n .filter(([, field]) => field.required === true)\n .map(([field]) => field)\n return {\n type: \"object\",\n properties: Object.fromEntries(\n Object.entries(input.fields).map(([fieldId, field]) => {\n const fieldSchema = schemaOrRefJsonSchema(field.schema, input.valueTypesById, new Set())\n return [fieldId, field.nullable ? { anyOf: [fieldSchema, { type: \"null\" }] } : fieldSchema]\n })\n ),\n ...(required.length > 0 ? { required } : {}),\n additionalProperties: false,\n }\n}\n\nfunction schemaOrRefJsonSchema(\n schema: SchemaOrRef,\n valueTypesById: ReadonlyMap<string, ValueType>,\n resolving: ReadonlySet<string>\n): SchemaJsonSchema {\n if (isObjectRefSchema(schema)) {\n return {\n type: \"object\",\n properties: {\n objectTypeId: { type: \"string\", const: schema.objectTypeId },\n primaryId: { type: \"string\" },\n },\n required: [\"objectTypeId\", \"primaryId\"],\n additionalProperties: false,\n }\n }\n return schemaJsonSchema(schema, valueTypesById, resolving)\n}\n\nfunction schemaJsonSchema(\n schema: Schema,\n valueTypesById: ReadonlyMap<string, ValueType>,\n resolving: ReadonlySet<string>\n): SchemaJsonSchema {\n if (typeof schema === \"string\") {\n switch (schema) {\n case \"string\":\n return { type: \"string\" }\n case \"integer\":\n return { type: \"integer\" }\n case \"double\":\n return { type: \"number\" }\n case \"decimal\":\n return { type: \"string\", pattern: \"^[+-]?\\\\d+(?:\\\\.\\\\d+)?$\" }\n case \"boolean\":\n return { type: \"boolean\" }\n case \"date\":\n return { type: \"string\", format: \"date\" }\n case \"timestamp\":\n return { type: \"string\", format: \"date-time\" }\n case \"uuid\":\n return { type: \"string\", format: \"uuid\" }\n case \"fileRef\":\n return {\n type: \"object\",\n properties: {\n blobId: { type: \"string\" },\n digest: { type: \"string\", pattern: \"^sha256:[a-fA-F0-9]{64}$\" },\n sizeBytes: { type: \"integer\", minimum: 0 },\n fileName: { type: \"string\" },\n mediaType: { type: \"string\" },\n logicalPath: { type: \"string\" },\n },\n required: [\"blobId\", \"digest\", \"sizeBytes\"],\n additionalProperties: false,\n }\n }\n }\n\n if (schema.type === \"enum\") return { enum: schema.values }\n if (schema.type === \"array\") {\n return { type: \"array\", items: schemaJsonSchema(schema.items, valueTypesById, resolving) }\n }\n if (schema.type === \"map\") {\n return {\n type: \"object\",\n additionalProperties: schemaJsonSchema(schema.valueSchema, valueTypesById, resolving),\n }\n }\n if (schema.type === \"object\") {\n const required: string[] = []\n const properties = Object.fromEntries(\n Object.entries(schema.properties).map(([fieldId, field]) => {\n if (field.required) required.push(fieldId)\n const fieldSchema = schemaJsonSchema(field.schema, valueTypesById, resolving)\n return [fieldId, field.nullable ? { anyOf: [fieldSchema, { type: \"null\" }] } : fieldSchema]\n })\n )\n return {\n type: \"object\",\n properties,\n ...(required.length > 0 ? { required } : {}),\n additionalProperties: false,\n }\n }\n\n const valueTypeId = schema.valueTypeId\n if (resolving.has(valueTypeId)) {\n throw new OntologyValidationError(\n `Structured output contains a recursive value type '${valueTypeId}'.`\n )\n }\n const resolved = schema._resolved ?? valueTypesById.get(valueTypeId)?.schema\n if (!resolved) {\n throw new OntologyValidationError(\n `Structured output references unknown value type '${valueTypeId}'.`\n )\n }\n return schemaJsonSchema(resolved, valueTypesById, new Set([...resolving, valueTyp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I,wBACR,sDAAsD,eACxD;AAAA,EACF;AAAA,EACA,MAAM,WAAW,OAAO,aAAa,eAAe,IAAI,WAAW,GAAG;AAAA,EACtE,IAAI,CAAC,UAAU;AAAA,IACb,MAAM,IAAI,wBACR,oDAAoD,eACtD;AAAA,EACF;AAAA,EACA,OAAO,iBAAiB,UAAU,gBAAgB,IAAI,IAAI,CAAC,GAAG,WAAW,WAAW,CAAC,CAAC;AAAA;",
8
+ "debugId": "1F2F8E74CCDF230264756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,9 +1,19 @@
1
1
  import { type SchemaOrRef } from "./refs";
2
2
  import type { ValueType } from "./types";
3
3
  export type SchemaJsonSchema = Readonly<Record<string, unknown>>;
4
+ export interface SchemaJsonField {
5
+ readonly schema: SchemaOrRef;
6
+ readonly required?: boolean;
7
+ readonly nullable?: boolean;
8
+ }
4
9
  /** Convert a record of Sixb schemas into the strict JSON object schema used by model outputs. */
5
10
  export declare function schemaRecordToJsonSchema(input: {
6
11
  readonly shape: Readonly<Record<string, SchemaOrRef>>;
7
12
  readonly valueTypesById: ReadonlyMap<string, ValueType>;
8
13
  }): SchemaJsonSchema;
14
+ /** Convert configured fields into the strict JSON object schema accepted at runtime. */
15
+ export declare function schemaFieldsToJsonSchema(input: {
16
+ readonly fields: Readonly<Record<string, SchemaJsonField>>;
17
+ readonly valueTypesById: ReadonlyMap<string, ValueType>;
18
+ }): SchemaJsonSchema;
9
19
  //# sourceMappingURL=json-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema.d.ts","sourceRoot":"","sources":["../../src/ontology/json-schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,KAAK,EAAU,SAAS,EAAE,MAAM,SAAS,CAAA;AAEhD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAEhE,iGAAi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
  definePipelineStep,
5
5
  isPipelineDefinition,
6
6
  isPipelineStepDefinition
7
- } from "../chunk-rs1wbvy6.js";
7
+ } from "../chunk-ea73pzk7.js";
8
8
  import"../chunk-5sz8ta9r.js";
9
9
  import"../chunk-979ww6b3.js";
10
10
  import"../chunk-a31h57d5.js";
@@ -14,11 +14,11 @@ import {
14
14
  PipelineError,
15
15
  PipelineRunDispatcher,
16
16
  requestPipelineRun
17
- } from "../chunk-cbkm2vam.js";
17
+ } from "../chunk-r0rry8dn.js";
18
18
  import"../chunk-8b55ygje.js";
19
19
  import"../chunk-51fjndv0.js";
20
20
  import"../chunk-f6erf2vv.js";
21
- import"../chunk-1wk20wn3.js";
21
+ import"../chunk-v0egge8b.js";
22
22
  import"../chunk-72q2y8hn.js";
23
23
  import"../chunk-xc7hq65b.js";
24
24
  import"../chunk-cy0n5dms.js";
@@ -12,7 +12,7 @@ import {
12
12
  parseDatasetTimestamp
13
13
  } from "../chunk-96swp2wd.js";
14
14
  import"../chunk-f6erf2vv.js";
15
- import"../chunk-1wk20wn3.js";
15
+ import"../chunk-v0egge8b.js";
16
16
  import"../chunk-72q2y8hn.js";
17
17
  import"../chunk-xc7hq65b.js";
18
18
  import"../chunk-cy0n5dms.js";
@@ -52,7 +52,7 @@ import {
52
52
  runMigrationSet,
53
53
  step,
54
54
  throwNestedStorageTransaction
55
- } from "../chunk-1wk20wn3.js";
55
+ } from "../chunk-v0egge8b.js";
56
56
  import"../chunk-72q2y8hn.js";
57
57
  import"../chunk-xc7hq65b.js";
58
58
  import {
@@ -3,7 +3,7 @@ import {
3
3
  defineSync,
4
4
  isSyncDefinition,
5
5
  resolveSyncConnectorSources
6
- } from "../chunk-sxwk41qa.js";
6
+ } from "../chunk-4h947jd8.js";
7
7
  import"../chunk-5sz8ta9r.js";
8
8
  import"../chunk-979ww6b3.js";
9
9
  import"../chunk-a31h57d5.js";
@@ -13,12 +13,12 @@ import {
13
13
  SyncRunDispatcher,
14
14
  SyncValidationError,
15
15
  requestSyncRun
16
- } from "../chunk-g13869yf.js";
16
+ } from "../chunk-zp2v2rv6.js";
17
17
  import"../chunk-8b55ygje.js";
18
18
  import"../chunk-51fjndv0.js";
19
19
  import"../chunk-8m5ejdpn.js";
20
20
  import"../chunk-f6erf2vv.js";
21
- import"../chunk-1wk20wn3.js";
21
+ import"../chunk-v0egge8b.js";
22
22
  import"../chunk-72q2y8hn.js";
23
23
  import"../chunk-xc7hq65b.js";
24
24
  import"../chunk-cy0n5dms.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "../chunk-x2yw73hy.js";
5
5
  import {
6
6
  SixbHost
7
- } from "../chunk-s31d0qmq.js";
7
+ } from "../chunk-am6eczah.js";
8
8
  import"../chunk-9t8f5xfx.js";
9
9
  import"../chunk-819wnjz8.js";
10
10
  import {
@@ -20,10 +20,10 @@ import"../chunk-ghteq96b.js";
20
20
  import"../chunk-z3zp0bj1.js";
21
21
  import"../chunk-zqqz8052.js";
22
22
  import"../chunk-f2rt4vkh.js";
23
- import"../chunk-1yz3x65y.js";
24
- import"../chunk-sxwk41qa.js";
25
- import"../chunk-hbeh8j9w.js";
26
- import"../chunk-rs1wbvy6.js";
23
+ import"../chunk-h6h91mfy.js";
24
+ import"../chunk-4h947jd8.js";
25
+ import"../chunk-gadsm794.js";
26
+ import"../chunk-ea73pzk7.js";
27
27
  import"../chunk-5sz8ta9r.js";
28
28
  import"../chunk-979ww6b3.js";
29
29
  import"../chunk-2ab72m2h.js";
@@ -39,10 +39,10 @@ import {
39
39
  } from "../chunk-wtmzkcht.js";
40
40
  import {
41
41
  isBoundSixb
42
- } from "../chunk-c43qr6s0.js";
43
- import"../chunk-g13869yf.js";
44
- import"../chunk-cbkm2vam.js";
45
- import"../chunk-pn8n8sba.js";
42
+ } from "../chunk-84h6qhmp.js";
43
+ import"../chunk-zp2v2rv6.js";
44
+ import"../chunk-r0rry8dn.js";
45
+ import"../chunk-z3ga9q5m.js";
46
46
  import"../chunk-4rh2m6zg.js";
47
47
  import"../chunk-xhy826cz.js";
48
48
  import {
@@ -53,7 +53,7 @@ import {
53
53
  existsObjects,
54
54
  facetObjects,
55
55
  validateObjectQuery
56
- } from "../chunk-7gw7mepb.js";
56
+ } from "../chunk-6d5xdj1q.js";
57
57
  import {
58
58
  ObjectQueryPlanningError,
59
59
  normalizeObjectQuery
@@ -65,12 +65,12 @@ import {
65
65
  import"../chunk-51fjndv0.js";
66
66
  import"../chunk-8m5ejdpn.js";
67
67
  import"../chunk-nf4r78r4.js";
68
- import"../chunk-tycbzedm.js";
69
- import"../chunk-tek1qwgm.js";
68
+ import"../chunk-78c6xvyr.js";
69
+ import"../chunk-1q02e95s.js";
70
70
  import {
71
71
  ProjectionRegistry,
72
72
  createOntologyMaterializer
73
- } from "../chunk-afjpa2hs.js";
73
+ } from "../chunk-tbv03sx2.js";
74
74
  import"../chunk-96swp2wd.js";
75
75
  import {
76
76
  restoreTrustedPrimitiveExecutionScope
@@ -81,7 +81,7 @@ import {
81
81
  linkBatchKey,
82
82
  objectBatchKey,
83
83
  objectLinkCursor
84
- } from "../chunk-1wk20wn3.js";
84
+ } from "../chunk-v0egge8b.js";
85
85
  import {
86
86
  createEventId
87
87
  } from "../chunk-72q2y8hn.js";
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  canRetryWebhookRun,
7
7
  isStorageSerializationFailure
8
- } from "../chunk-1wk20wn3.js";
8
+ } from "../chunk-v0egge8b.js";
9
9
  import"../chunk-72q2y8hn.js";
10
10
  import"../chunk-xc7hq65b.js";
11
11
  import"../chunk-cy0n5dms.js";
@@ -7,7 +7,7 @@ import {
7
7
  defineWorkflowStep,
8
8
  interventionField,
9
9
  unwrapWorkflowNodeFailure
10
- } from "../chunk-hbeh8j9w.js";
10
+ } from "../chunk-gadsm794.js";
11
11
  import"../chunk-5sz8ta9r.js";
12
12
  import"../chunk-979ww6b3.js";
13
13
  import"../chunk-74drx9gd.js";
@@ -40,25 +40,25 @@ import {
40
40
  validateWorkflowStepInput,
41
41
  validateWorkflowStepOutput,
42
42
  validateWorkflowsAtStartup
43
- } from "../chunk-c43qr6s0.js";
44
- import"../chunk-g13869yf.js";
45
- import"../chunk-cbkm2vam.js";
46
- import"../chunk-pn8n8sba.js";
43
+ } from "../chunk-84h6qhmp.js";
44
+ import"../chunk-zp2v2rv6.js";
45
+ import"../chunk-r0rry8dn.js";
46
+ import"../chunk-z3ga9q5m.js";
47
47
  import"../chunk-4rh2m6zg.js";
48
48
  import"../chunk-xhy826cz.js";
49
- import"../chunk-7gw7mepb.js";
49
+ import"../chunk-6d5xdj1q.js";
50
50
  import"../chunk-rte5sm3z.js";
51
51
  import"../chunk-qewtks41.js";
52
52
  import"../chunk-8b55ygje.js";
53
53
  import"../chunk-51fjndv0.js";
54
54
  import"../chunk-8m5ejdpn.js";
55
55
  import"../chunk-nf4r78r4.js";
56
- import"../chunk-tycbzedm.js";
57
- import"../chunk-tek1qwgm.js";
58
- import"../chunk-afjpa2hs.js";
56
+ import"../chunk-78c6xvyr.js";
57
+ import"../chunk-1q02e95s.js";
58
+ import"../chunk-tbv03sx2.js";
59
59
  import"../chunk-96swp2wd.js";
60
60
  import"../chunk-f6erf2vv.js";
61
- import"../chunk-1wk20wn3.js";
61
+ import"../chunk-v0egge8b.js";
62
62
  import"../chunk-72q2y8hn.js";
63
63
  import"../chunk-xc7hq65b.js";
64
64
  import"../chunk-cy0n5dms.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sixb/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "The ontology-first runtime for Sixb — objects, links, telemetry, actions, and provider contracts",
5
5
  "keywords": [
6
6
  "sixb",
@@ -7,7 +7,11 @@ export type {
7
7
  } from "./commit-edits"
8
8
  export { commitActionEdits, findActionEditCommit } from "./commit-edits"
9
9
  export { ActionDefinitionError, ActionEditCommitError } from "./errors"
10
- export type { ActionReadFacadeOptions, ActionReadObjectSetSource } from "./read-facade"
10
+ export type {
11
+ ActionReadFacadeOptions,
12
+ ActionReadObjectSetSource,
13
+ ActionTelemetryReadSource,
14
+ } from "./read-facade"
11
15
  export { ActionReadRecorder, createActionReadFacade } from "./read-facade"
12
16
  export type { ActionDefinitionCatalog, ActionRegistryOptions } from "./registry"
13
17
  export { ActionRegistry } from "./registry"
@@ -40,7 +44,12 @@ export type {
40
44
  ActionRuntimeFacade,
41
45
  ActionSubject,
42
46
  ActionTargetObject,
47
+ ActionTelemetryHistoryBatchInput,
48
+ ActionTelemetryHistoryBatchResult,
49
+ ActionTelemetryHistorySeriesInput,
43
50
  ActionTelemetryObjectSet,
51
+ ActionTelemetryPropertyToken,
52
+ ActionTelemetryReadFacade,
44
53
  ActionValidationContext,
45
54
  ActionValidator,
46
55
  ActionWritebackContext,
@@ -8,12 +8,28 @@ import type {
8
8
  OntologyObjectRef,
9
9
  } from "../materializer"
10
10
  import { createLinkScopeFingerprint } from "../materializer"
11
+ import { OntologyValidationError } from "../ontology/errors"
11
12
  import type { ObjectTypeWithPropertyTokens } from "../ontology/tokens"
12
13
  import type { ValueType } from "../ontology/types"
14
+ import {
15
+ assertPropertyTokenBelongsToObjectType,
16
+ assertTelemetryProperty,
17
+ } from "../ontology/validation"
18
+ import { RuntimeError } from "../runtime/errors"
13
19
  import type { ObjectSetListInput } from "../runtime/types"
14
- import type { ObjectLinkRow, ObjectRow } from "../storage"
20
+ import type {
21
+ ObjectLinkRow,
22
+ ObjectRow,
23
+ TimeseriesHistoryBatchInput,
24
+ TimeseriesHistoryBatchResult,
25
+ } from "../storage"
15
26
  import type { ActionReadDependencies } from "./commit-edits"
16
- import type { ActionReadFacade, ActionReadObjectSet } from "./types"
27
+ import type {
28
+ ActionReadFacade,
29
+ ActionReadObjectSet,
30
+ ActionTelemetryHistorySeriesInput,
31
+ ActionTelemetryReadFacade,
32
+ } from "./types"
17
33
 
18
34
  export type ActionReadObjectSetSource = {
19
35
  get(id: string): Promise<unknown>
@@ -25,13 +41,22 @@ export type ActionReadObjectSetSource = {
25
41
  }
26
42
  }
27
43
 
44
+ /** Runtime leaves used by the Action telemetry read adapter. */
45
+ export interface ActionTelemetryReadSource {
46
+ readonly resolveObjectType: (objectTypeId: string) => ObjectTypeWithPropertyTokens
47
+ readonly getHistoryBatch: (
48
+ input: Omit<TimeseriesHistoryBatchInput, "projectId">
49
+ ) => Promise<readonly TimeseriesHistoryBatchResult[]>
50
+ }
51
+
28
52
  /**
29
53
  * Records the exact state an Action handler observed while reading.
30
54
  *
31
55
  * A handler that reads one dependency twice keeps the first observation: the commit must fail when
32
56
  * current state no longer matches what the decision was made against, and the later read may already
33
57
  * reflect the handler's own intent. Arbitrary query phantoms stay out of this release — `query()` and
34
- * `list()` results are not turned into dependencies.
58
+ * `list()` results are not turned into dependencies. Telemetry history is also a call-level snapshot,
59
+ * not an edit dependency.
35
60
  */
36
61
  export class ActionReadRecorder {
37
62
  private readonly objects = new Map<string, ExpectedObjectRevision>()
@@ -130,6 +155,8 @@ export interface ActionReadFacadeOptions {
130
155
  * recorded scopes.
131
156
  */
132
157
  readonly resolveLinkIds: (objectTypeId: string) => readonly string[]
158
+ /** Canonical authorized telemetry history leaf. Omitted only by isolated facade consumers. */
159
+ readonly telemetry?: ActionTelemetryReadSource
133
160
  }
134
161
 
135
162
  export function createActionReadFacade(
@@ -139,6 +166,7 @@ export function createActionReadFacade(
139
166
  options?: ActionReadFacadeOptions
140
167
  ): ActionReadFacade {
141
168
  const facade = {
169
+ telemetry: createActionTelemetryReadFacade(options?.telemetry),
142
170
  objects<const TObjectType extends ObjectTypeWithPropertyTokens>(objectType: TObjectType) {
143
171
  return createActionReadObjectSetAdapter<TObjectType>(
144
172
  objectType,
@@ -151,6 +179,100 @@ export function createActionReadFacade(
151
179
  return facade as ActionReadFacade
152
180
  }
153
181
 
182
+ function createActionTelemetryReadFacade(
183
+ source: ActionTelemetryReadSource | undefined
184
+ ): ActionTelemetryReadFacade<readonly ValueType[]> {
185
+ const facade = {
186
+ async historyBatch(input: {
187
+ readonly series: readonly ActionTelemetryHistorySeriesInput[]
188
+ readonly from?: Date
189
+ readonly to?: Date
190
+ readonly limitPerSeries?: number
191
+ readonly order?: "asc" | "desc"
192
+ }) {
193
+ if (!source) {
194
+ throw new RuntimeError(
195
+ "[Sixb] Action telemetry history requires a configured telemetry read source."
196
+ )
197
+ }
198
+ if (input.series.length === 0) {
199
+ return []
200
+ }
201
+
202
+ const requestedSeries = input.series.map((entry) => {
203
+ const objectType = source.resolveObjectType(entry.property.objectTypeId)
204
+ assertPropertyTokenBelongsToObjectType(objectType, entry.property)
205
+ const registeredProperty = objectType.properties.find(
206
+ (property) => property.id === entry.property.id
207
+ )
208
+ if (!registeredProperty) {
209
+ throw new OntologyValidationError(
210
+ `[Sixb] Unknown property '${entry.property.id}' for object type '${objectType.id}'`
211
+ )
212
+ }
213
+ assertTelemetryProperty(registeredProperty)
214
+ return {
215
+ objectTypeId: objectType.id,
216
+ objectId: entry.objectId,
217
+ propertyId: registeredProperty.id,
218
+ }
219
+ })
220
+
221
+ const results = await source.getHistoryBatch({
222
+ series: requestedSeries,
223
+ ...(input.from !== undefined ? { from: input.from } : {}),
224
+ ...(input.to !== undefined ? { to: input.to } : {}),
225
+ ...(input.limitPerSeries !== undefined ? { limitPerSeries: input.limitPerSeries } : {}),
226
+ ...(input.order !== undefined ? { order: input.order } : {}),
227
+ })
228
+ assertTelemetryBatchResultMatchesRequest(requestedSeries, results)
229
+
230
+ return input.series.map((entry, index) => ({
231
+ objectId: entry.objectId,
232
+ property: entry.property,
233
+ points: results[index].points.map((point) => ({
234
+ value: point.value,
235
+ at: point.at,
236
+ ...(point.unit !== undefined ? { unit: point.unit } : {}),
237
+ })),
238
+ }))
239
+ },
240
+ }
241
+
242
+ // Cast needed at the generic token boundary: the implementation deliberately manipulates raw
243
+ // provider values while the public facade maps every tuple position back to its property token.
244
+ return facade as unknown as ActionTelemetryReadFacade<readonly ValueType[]>
245
+ }
246
+
247
+ function assertTelemetryBatchResultMatchesRequest(
248
+ requested: readonly {
249
+ readonly objectTypeId: string
250
+ readonly objectId: string
251
+ readonly propertyId: string
252
+ }[],
253
+ results: readonly TimeseriesHistoryBatchResult[]
254
+ ): void {
255
+ if (results.length !== requested.length) {
256
+ throw new RuntimeError(
257
+ `[Sixb] Telemetry history provider returned ${results.length} batch results for ${requested.length} requested series.`
258
+ )
259
+ }
260
+
261
+ for (let index = 0; index < requested.length; index += 1) {
262
+ const expected = requested[index]
263
+ const actual = results[index]
264
+ if (
265
+ actual.objectTypeId !== expected.objectTypeId ||
266
+ actual.objectId !== expected.objectId ||
267
+ actual.propertyId !== expected.propertyId
268
+ ) {
269
+ throw new RuntimeError(
270
+ `[Sixb] Telemetry history provider returned an unexpected series at batch index ${index}.`
271
+ )
272
+ }
273
+ }
274
+ }
275
+
154
276
  function createActionReadObjectSetAdapter<TObjectType extends ObjectTypeWithPropertyTokens>(
155
277
  objectType: TObjectType,
156
278
  objectSet: ActionReadObjectSetSource,
@@ -7,8 +7,9 @@ import type {
7
7
  EffectiveObjectChange,
8
8
  OntologyOperationOutcome,
9
9
  } from "../../materializer"
10
- import type { ObjectType, ValueType } from "../../ontology"
11
- import type { LinkToken, ObjectTypeWithPropertyTokens } from "../../ontology/tokens"
10
+ import type { ObjectType, Property, ValueType } from "../../ontology"
11
+ import type { InferPropertyUnit, InferPropertyValue } from "../../ontology/inference"
12
+ import type { LinkToken, ObjectTypeWithPropertyTokens, PropertyToken } from "../../ontology/tokens"
12
13
  import type {
13
14
  ListResult,
14
15
  ObjectQueryBuilder,
@@ -103,7 +104,73 @@ export interface ActionReadObjectSet<
103
104
  byId(id: string): ActionReadObjectByIdHandle<TObjectType, TValueTypes>
104
105
  }
105
106
 
107
+ /** A telemetry-mode ontology property accepted by Action history reads. */
108
+ export type ActionTelemetryPropertyToken = PropertyToken<
109
+ string,
110
+ string,
111
+ Property & { readonly mode: "telemetry" }
112
+ >
113
+
114
+ export type ActionTelemetryHistorySeriesInput<
115
+ TProperty extends ActionTelemetryPropertyToken = ActionTelemetryPropertyToken,
116
+ > = {
117
+ readonly objectId: string
118
+ readonly property: TProperty
119
+ }
120
+
121
+ export interface ActionTelemetryHistoryBatchInput<
122
+ TSeries extends
123
+ readonly ActionTelemetryHistorySeriesInput[] = readonly ActionTelemetryHistorySeriesInput[],
124
+ > {
125
+ /** Series are returned in this exact order, including duplicate entries. */
126
+ readonly series: TSeries
127
+ readonly from?: Date
128
+ readonly to?: Date
129
+ /** Optional cap applied independently to every requested series. */
130
+ readonly limitPerSeries?: number
131
+ /** Points are oldest first by default. */
132
+ readonly order?: "asc" | "desc"
133
+ }
134
+
135
+ /**
136
+ * One batch result per requested series, preserving tuple positions and property-specific types.
137
+ */
138
+ export type ActionTelemetryHistoryBatchResult<
139
+ TSeries extends
140
+ readonly ActionTelemetryHistorySeriesInput[] = readonly ActionTelemetryHistorySeriesInput[],
141
+ TValueTypes extends readonly ValueType[] = readonly ValueType[],
142
+ > = {
143
+ readonly [TIndex in keyof TSeries]: TSeries[TIndex] extends ActionTelemetryHistorySeriesInput<
144
+ infer TProperty
145
+ >
146
+ ? {
147
+ readonly objectId: TSeries[TIndex]["objectId"]
148
+ readonly property: TProperty
149
+ readonly points: readonly {
150
+ readonly value: InferPropertyValue<TProperty["property"], TValueTypes>
151
+ readonly at: Date
152
+ readonly unit?: InferPropertyUnit<TProperty["property"], TValueTypes>
153
+ }[]
154
+ }
155
+ : never
156
+ }
157
+
158
+ export type ActionTelemetryReadFacade<
159
+ TValueTypes extends readonly ValueType[] = readonly ValueType[],
160
+ > = {
161
+ /**
162
+ * Read several telemetry series in one provider call.
163
+ *
164
+ * This is a snapshot read for the call. It is intentionally not added to the Action edit
165
+ * dependency fence; use a fixed `to` cutoff to keep the report window stable across retries.
166
+ */
167
+ historyBatch<const TSeries extends readonly ActionTelemetryHistorySeriesInput[]>(
168
+ input: ActionTelemetryHistoryBatchInput<TSeries>
169
+ ): Promise<ActionTelemetryHistoryBatchResult<TSeries, TValueTypes>>
170
+ }
171
+
106
172
  export interface ActionReadFacade<TValueTypes extends readonly ValueType[] = readonly ValueType[]> {
173
+ readonly telemetry: ActionTelemetryReadFacade<TValueTypes>
107
174
  objects<const TObjectType extends ObjectTypeWithPropertyTokens>(
108
175
  objectType: TObjectType
109
176
  ): ActionReadObjectSet<TObjectType, TValueTypes, ObjectTypeWithPropertyTokens>
@@ -45,6 +45,8 @@ export interface AgentLoopConfig {
45
45
  readonly maxSteps?: number
46
46
  }
47
47
  readonly context?: AgentContextConfig
48
+ /** Automatic provider prompt caching. Defaults to `auto`; use `off` to opt out. */
49
+ readonly caching?: "auto" | "off"
48
50
  }
49
51
 
50
52
  type Simplify<T> = { [K in keyof T]: T[K] } & {}
@@ -171,6 +171,9 @@ export function resolveAgentLoopConfig(
171
171
  "[Sixb] Agent loop.stopWhen.maxSteps must be a positive safe integer."
172
172
  )
173
173
  }
174
+ if (loop.caching !== undefined && loop.caching !== "auto" && loop.caching !== "off") {
175
+ throw new AgentDefinitionError("[Sixb] Agent loop.caching must be 'auto' or 'off'.")
176
+ }
174
177
 
175
178
  const context = loop.context ? snapshotAgentContextConfig(loop.context) : undefined
176
179
  return Object.freeze({
@@ -178,6 +181,7 @@ export function resolveAgentLoopConfig(
178
181
  ? {}
179
182
  : { stopWhen: Object.freeze({ ...(maxSteps === undefined ? {} : { maxSteps }) }) }),
180
183
  ...(context === undefined ? {} : { context }),
184
+ ...(loop.caching === undefined ? {} : { caching: loop.caching }),
181
185
  })
182
186
  }
183
187
 
package/src/index.ts CHANGED
@@ -77,7 +77,12 @@ export type {
77
77
  ActionRuntimeFacade,
78
78
  ActionSubject,
79
79
  ActionTargetObject,
80
+ ActionTelemetryHistoryBatchInput,
81
+ ActionTelemetryHistoryBatchResult,
82
+ ActionTelemetryHistorySeriesInput,
80
83
  ActionTelemetryObjectSet,
84
+ ActionTelemetryPropertyToken,
85
+ ActionTelemetryReadFacade,
81
86
  ActionValidationContext,
82
87
  ActionValidator,
83
88
  ActionWritebackContext,
@@ -1,3 +1,3 @@
1
1
  export type { SchemaJsonSchema } from "./json-schema"
2
- export { schemaRecordToJsonSchema } from "./json-schema"
2
+ export { schemaFieldsToJsonSchema, schemaRecordToJsonSchema } from "./json-schema"
3
3
  export { createLinkTokenMap, createPropertyTokenMap } from "./tokens"