@ekairos/dataset 1.22.94-beta.development.0 → 1.22.95-beta.development.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.
@@ -1,6 +1,6 @@
1
1
  import { DatasetService } from "../service.js";
2
2
  import { datasetDomain } from "../schema.js";
3
- import { verifyDatasetNotation } from "../notation.js";
3
+ import { inferQueryNotation, verifyDatasetNotation, } from "../notation.js";
4
4
  import { datasetGetByIdStep, datasetPreviewRowsStep, datasetReadOneStep, datasetReadRowsStep, } from "../dataset/steps.js";
5
5
  import { inferDatasetSchema, validateRows } from "./schemaInference.js";
6
6
  import { rowsToJsonl } from "./rows.js";
@@ -78,20 +78,34 @@ export async function materializeRowsToDataset(runtime, params) {
78
78
  if (!statusResult.ok) {
79
79
  throw new Error(statusResult.error);
80
80
  }
81
- // verify the latest formal notation (if any was proposed) against the
82
- // materialized rows informative only, never blocks the build
81
+ // Formal notation, informative only (never blocks the build): a notation
82
+ // proposed during the build (agent iterations) is verified against the
83
+ // materialized rows; query-backed builds with no proposed notation get
84
+ // the deterministic one derived from query + schema + rows.
83
85
  try {
84
86
  const existing = await service.getDatasetById(params.datasetId);
85
- const notation = (existing.ok ? existing.data?.notation : null);
86
- if (notation && Array.isArray(notation.predicates) && notation.predicates.length > 0) {
87
+ const previous = (existing.ok ? existing.data?.notation : null);
88
+ const analysis = (params.analysis ?? {});
89
+ const queryNotation = analysis.query && typeof analysis.query === "object"
90
+ ? inferQueryNotation({
91
+ entityNames: Object.keys(analysis.query),
92
+ rowCount: params.rows.length,
93
+ schema: resolvedSchema,
94
+ explanation: typeof analysis.explanation === "string" ? analysis.explanation : undefined,
95
+ })
96
+ : null;
97
+ const candidate = previous && Array.isArray(previous.predicates) && previous.predicates.length > 0
98
+ ? previous
99
+ : queryNotation;
100
+ if (candidate) {
87
101
  await service.updateDatasetNotation({
88
102
  datasetId: params.datasetId,
89
- notation: verifyDatasetNotation(notation, params.rows),
103
+ notation: verifyDatasetNotation(candidate, params.rows),
90
104
  });
91
105
  }
92
106
  }
93
107
  catch {
94
- // notation verification must never affect the build result
108
+ // notation must never affect the build result
95
109
  }
96
110
  return params.datasetId;
97
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekairos/dataset",
3
- "version": "1.22.94-beta.development.0",
3
+ "version": "1.22.95-beta.development.0",
4
4
  "description": "Pulzar Dataset Tools",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -65,9 +65,9 @@
65
65
  "test:ai-sdk:instant": "vitest run -c vitest.codex.config.mts src/tests/materializeDataset.ai-sdk.instant.test.ts"
66
66
  },
67
67
  "dependencies": {
68
- "@ekairos/domain": "^1.22.94-beta.development.0",
69
- "@ekairos/events": "^1.22.94-beta.development.0",
70
- "@ekairos/sandbox": "^1.22.94-beta.development.0",
68
+ "@ekairos/domain": "^1.22.95-beta.development.0",
69
+ "@ekairos/events": "^1.22.95-beta.development.0",
70
+ "@ekairos/sandbox": "^1.22.95-beta.development.0",
71
71
  "@instantdb/admin": "0.22.158",
72
72
  "@instantdb/core": "0.22.142",
73
73
  "ai": "^5.0.44",