@ekairos/dataset 1.22.39-beta.development.0 → 1.22.39
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/README.md +347 -0
- package/dist/agents.d.ts +8 -0
- package/dist/agents.js +8 -0
- package/dist/builder/agentMaterializers.d.ts +9 -0
- package/dist/builder/agentMaterializers.js +10 -0
- package/dist/builder/context.d.ts +15 -0
- package/dist/builder/context.js +251 -0
- package/dist/builder/instructions.d.ts +5 -0
- package/dist/builder/instructions.js +40 -0
- package/dist/builder/materialize.d.ts +83 -0
- package/dist/builder/materialize.js +548 -0
- package/dist/builder/materializeQuery.d.ts +12 -0
- package/dist/builder/materializeQuery.js +31 -0
- package/dist/builder/persistence.d.ts +22 -0
- package/dist/builder/persistence.js +192 -0
- package/dist/builder/rows.d.ts +7 -0
- package/dist/builder/rows.js +56 -0
- package/dist/builder/schemaInference.d.ts +3 -0
- package/dist/builder/schemaInference.js +61 -0
- package/dist/builder/types.d.ts +144 -0
- package/dist/builder/types.js +1 -0
- package/dist/clearDataset.tool.d.ts +2 -3
- package/dist/clearDataset.tool.js +13 -17
- package/dist/completeDataset.steps.d.ts +117 -0
- package/dist/completeDataset.steps.js +537 -0
- package/dist/completeDataset.tool.d.ts +132 -7
- package/dist/completeDataset.tool.js +46 -192
- package/dist/contextResources.d.ts +31 -0
- package/dist/contextResources.js +151 -0
- package/dist/contextWorkspace.d.ts +79 -0
- package/dist/contextWorkspace.js +234 -0
- package/dist/dataset/steps.d.ts +39 -15
- package/dist/dataset/steps.js +96 -39
- package/dist/dataset.d.ts +3 -67
- package/dist/dataset.js +129 -521
- package/dist/datasetFiles.d.ts +5 -1
- package/dist/datasetFiles.js +29 -27
- package/dist/defineNotation.tool.d.ts +49 -0
- package/dist/defineNotation.tool.js +154 -0
- package/dist/domain.d.ts +1 -2
- package/dist/domain.js +1 -6
- package/dist/executeCommand.tool.d.ts +2 -30
- package/dist/executeCommand.tool.js +165 -39
- package/dist/file/file-dataset.agent.d.ts +19 -56
- package/dist/file/file-dataset.agent.js +181 -134
- package/dist/file/file-dataset.steps.d.ts +27 -0
- package/dist/file/file-dataset.steps.js +47 -0
- package/dist/file/file-dataset.types.d.ts +64 -0
- package/dist/file/file-dataset.types.js +1 -0
- package/dist/file/filepreview.d.ts +5 -35
- package/dist/file/filepreview.js +60 -107
- package/dist/file/filepreview.types.d.ts +31 -0
- package/dist/file/filepreview.types.js +1 -0
- package/dist/file/generateSchema.tool.d.ts +2 -3
- package/dist/file/generateSchema.tool.js +11 -15
- package/dist/file/index.d.ts +1 -2
- package/dist/file/index.js +1 -18
- package/dist/file/prompts.d.ts +2 -3
- package/dist/file/prompts.js +152 -32
- package/dist/file/scripts.generated.d.ts +1 -0
- package/dist/file/scripts.generated.js +11 -0
- package/dist/file/steps.d.ts +1 -2
- package/dist/file/steps.js +9 -7
- package/dist/id.d.ts +1 -0
- package/dist/id.js +10 -0
- package/dist/index.d.ts +9 -7
- package/dist/index.js +9 -23
- package/dist/materializeDataset.tool.d.ts +51 -31
- package/dist/materializeDataset.tool.js +81 -65
- package/dist/notation.d.ts +205 -0
- package/dist/notation.js +424 -0
- package/dist/query/index.d.ts +1 -2
- package/dist/query/index.js +1 -18
- package/dist/query/queryDomain.d.ts +3 -4
- package/dist/query/queryDomain.js +3 -40
- package/dist/query/queryDomain.step.d.ts +1 -1
- package/dist/query/queryDomain.step.js +24 -13
- package/dist/sandbox/steps.d.ts +23 -15
- package/dist/sandbox/steps.js +73 -76
- package/dist/sandbox.steps.d.ts +1 -2
- package/dist/sandbox.steps.js +1 -18
- package/dist/schema.d.ts +15 -13
- package/dist/schema.js +27 -37
- package/dist/service.d.ts +12 -5
- package/dist/service.js +88 -15
- package/dist/skill.d.ts +0 -1
- package/dist/skill.js +12 -17
- package/dist/transform/filepreview.d.ts +2 -3
- package/dist/transform/filepreview.js +9 -26
- package/dist/transform/index.d.ts +2 -3
- package/dist/transform/index.js +2 -8
- package/dist/transform/prompts.d.ts +1 -34
- package/dist/transform/prompts.js +66 -46
- package/dist/transform/transform-dataset.agent.d.ts +20 -45
- package/dist/transform/transform-dataset.agent.js +151 -91
- package/dist/transform/transform-dataset.steps.d.ts +30 -0
- package/dist/transform/transform-dataset.steps.js +61 -0
- package/dist/transform/transform-dataset.types.d.ts +95 -0
- package/dist/transform/transform-dataset.types.js +1 -0
- package/dist/transform/transformDataset.d.ts +3 -3
- package/dist/transform/transformDataset.js +15 -18
- package/dist/writeDatasetRows.tool.d.ts +188 -0
- package/dist/writeDatasetRows.tool.js +258 -0
- package/package.json +33 -8
- package/dist/clearDataset.tool.d.ts.map +0 -1
- package/dist/clearDataset.tool.js.map +0 -1
- package/dist/completeDataset.tool.d.ts.map +0 -1
- package/dist/completeDataset.tool.js.map +0 -1
- package/dist/dataset/steps.d.ts.map +0 -1
- package/dist/dataset/steps.js.map +0 -1
- package/dist/dataset.d.ts.map +0 -1
- package/dist/dataset.js.map +0 -1
- package/dist/datasetFiles.d.ts.map +0 -1
- package/dist/datasetFiles.js.map +0 -1
- package/dist/domain.d.ts.map +0 -1
- package/dist/domain.js.map +0 -1
- package/dist/eventsReactRuntime.d.ts +0 -22
- package/dist/eventsReactRuntime.d.ts.map +0 -1
- package/dist/eventsReactRuntime.js +0 -29
- package/dist/eventsReactRuntime.js.map +0 -1
- package/dist/executeCommand.tool.d.ts.map +0 -1
- package/dist/executeCommand.tool.js.map +0 -1
- package/dist/file/file-dataset.agent.d.ts.map +0 -1
- package/dist/file/file-dataset.agent.js.map +0 -1
- package/dist/file/filepreview.d.ts.map +0 -1
- package/dist/file/filepreview.js.map +0 -1
- package/dist/file/generateSchema.tool.d.ts.map +0 -1
- package/dist/file/generateSchema.tool.js.map +0 -1
- package/dist/file/index.d.ts.map +0 -1
- package/dist/file/index.js.map +0 -1
- package/dist/file/prompts.d.ts.map +0 -1
- package/dist/file/prompts.js.map +0 -1
- package/dist/file/steps.d.ts.map +0 -1
- package/dist/file/steps.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/materializeDataset.tool.d.ts.map +0 -1
- package/dist/materializeDataset.tool.js.map +0 -1
- package/dist/query/index.d.ts.map +0 -1
- package/dist/query/index.js.map +0 -1
- package/dist/query/queryDomain.d.ts.map +0 -1
- package/dist/query/queryDomain.js.map +0 -1
- package/dist/query/queryDomain.step.d.ts.map +0 -1
- package/dist/query/queryDomain.step.js.map +0 -1
- package/dist/sandbox/steps.d.ts.map +0 -1
- package/dist/sandbox/steps.js.map +0 -1
- package/dist/sandbox.steps.d.ts.map +0 -1
- package/dist/sandbox.steps.js.map +0 -1
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js.map +0 -1
- package/dist/service.d.ts.map +0 -1
- package/dist/service.js.map +0 -1
- package/dist/skill.d.ts.map +0 -1
- package/dist/skill.js.map +0 -1
- package/dist/transform/filepreview.d.ts.map +0 -1
- package/dist/transform/filepreview.js.map +0 -1
- package/dist/transform/index.d.ts.map +0 -1
- package/dist/transform/index.js.map +0 -1
- package/dist/transform/prompts.d.ts.map +0 -1
- package/dist/transform/prompts.js.map +0 -1
- package/dist/transform/transform-dataset.agent.d.ts.map +0 -1
- package/dist/transform/transform-dataset.agent.js.map +0 -1
- package/dist/transform/transformDataset.d.ts.map +0 -1
- package/dist/transform/transformDataset.js.map +0 -1
|
@@ -1,88 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const fileSourceSchema = zod_1.z.object({
|
|
9
|
-
kind: zod_1.z.literal("file"),
|
|
10
|
-
fileId: zod_1.z.string(),
|
|
11
|
-
description: zod_1.z.string().optional(),
|
|
1
|
+
import { tool } from "ai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { dataset } from "./dataset.js";
|
|
4
|
+
const fileResourceSchema = z.object({
|
|
5
|
+
kind: z.literal("file"),
|
|
6
|
+
fileId: z.string(),
|
|
7
|
+
description: z.string().optional(),
|
|
12
8
|
});
|
|
13
|
-
const
|
|
14
|
-
kind:
|
|
15
|
-
text:
|
|
16
|
-
mimeType:
|
|
17
|
-
name:
|
|
18
|
-
description:
|
|
9
|
+
const textResourceSchema = z.object({
|
|
10
|
+
kind: z.literal("text"),
|
|
11
|
+
text: z.string(),
|
|
12
|
+
mimeType: z.string().optional(),
|
|
13
|
+
name: z.string().optional(),
|
|
14
|
+
description: z.string().optional(),
|
|
19
15
|
});
|
|
20
|
-
const
|
|
21
|
-
kind:
|
|
22
|
-
datasetId:
|
|
23
|
-
description:
|
|
16
|
+
const datasetResourceSchema = z.object({
|
|
17
|
+
kind: z.literal("dataset"),
|
|
18
|
+
datasetId: z.string(),
|
|
19
|
+
description: z.string().optional(),
|
|
24
20
|
});
|
|
25
|
-
const
|
|
26
|
-
kind:
|
|
27
|
-
query:
|
|
28
|
-
title:
|
|
29
|
-
explanation:
|
|
21
|
+
const queryResourceSchema = z.object({
|
|
22
|
+
kind: z.literal("query"),
|
|
23
|
+
query: z.record(z.string(), z.any()),
|
|
24
|
+
title: z.string().optional(),
|
|
25
|
+
explanation: z.string().optional(),
|
|
30
26
|
});
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
const contextInputSchema = z.union([
|
|
28
|
+
z.object({ id: z.string() }),
|
|
29
|
+
z.object({ key: z.string() }),
|
|
30
|
+
]);
|
|
31
|
+
const datasetSchemaSchema = z.object({
|
|
32
|
+
title: z.string().optional(),
|
|
33
|
+
description: z.string().optional(),
|
|
34
|
+
schema: z.any(),
|
|
35
35
|
});
|
|
36
|
-
const materializeDatasetToolInputSchema =
|
|
37
|
-
datasetId:
|
|
38
|
-
sandboxId:
|
|
39
|
-
title:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
const materializeDatasetToolInputSchema = z.object({
|
|
37
|
+
datasetId: z.string().optional(),
|
|
38
|
+
sandboxId: z.string().optional(),
|
|
39
|
+
title: z.string().optional(),
|
|
40
|
+
context: contextInputSchema.optional(),
|
|
41
|
+
files: z.array(fileResourceSchema.omit({ kind: true })).optional(),
|
|
42
|
+
texts: z.array(textResourceSchema.omit({ kind: true })).optional(),
|
|
43
|
+
datasets: z.array(datasetResourceSchema.omit({ kind: true })).optional(),
|
|
44
|
+
queries: z.array(queryResourceSchema.omit({ kind: true })).optional(),
|
|
45
|
+
instructions: z.string().optional(),
|
|
46
|
+
mode: z.enum(["auto", "schema"]).optional(),
|
|
47
|
+
output: z.enum(["rows", "object"]).optional(),
|
|
47
48
|
schema: datasetSchemaSchema.optional(),
|
|
48
|
-
first:
|
|
49
|
+
first: z.boolean().optional(),
|
|
49
50
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
description: "Materialize a dataset from declarative sources. Returns only the target datasetId. Query sources use the preconfigured runtime domain.",
|
|
51
|
+
export function createMaterializeDatasetTool(params) {
|
|
52
|
+
return tool({
|
|
53
|
+
description: "Materialize a dataset from declarative resources. Returns only the target datasetId. Query resources use the preconfigured runtime domain.",
|
|
54
54
|
inputSchema: materializeDatasetToolInputSchema,
|
|
55
55
|
execute: async (input) => {
|
|
56
|
-
let builder =
|
|
56
|
+
let builder = dataset(params.runtime);
|
|
57
57
|
if (input.title?.trim()) {
|
|
58
58
|
builder = builder.title(input.title);
|
|
59
59
|
}
|
|
60
60
|
if (input.sandboxId?.trim()) {
|
|
61
61
|
builder = builder.sandbox({ sandboxId: input.sandboxId });
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
const materialCount = (input.files?.length ?? 0) +
|
|
64
|
+
(input.texts?.length ?? 0) +
|
|
65
|
+
(input.datasets?.length ?? 0) +
|
|
66
|
+
(input.queries?.length ?? 0);
|
|
67
|
+
if (input.context && materialCount > 0) {
|
|
68
|
+
throw new Error("dataset_context_resource_is_exclusive");
|
|
69
|
+
}
|
|
70
|
+
if (!input.context && materialCount === 0) {
|
|
71
|
+
throw new Error("dataset_context_or_material_required");
|
|
72
|
+
}
|
|
73
|
+
if (input.context) {
|
|
74
|
+
builder = builder.fromContext(input.context);
|
|
75
|
+
}
|
|
76
|
+
for (const resource of input.files ?? []) {
|
|
77
|
+
builder = builder.fromFile(resource);
|
|
78
|
+
}
|
|
79
|
+
for (const resource of input.texts ?? []) {
|
|
80
|
+
builder = builder.fromText(resource);
|
|
81
|
+
}
|
|
82
|
+
for (const resource of input.datasets ?? []) {
|
|
83
|
+
builder = builder.fromDataset(resource);
|
|
84
|
+
}
|
|
85
|
+
for (const resource of input.queries ?? []) {
|
|
76
86
|
builder = builder.fromQuery(params.queryDomain, {
|
|
77
|
-
query:
|
|
78
|
-
title:
|
|
79
|
-
explanation:
|
|
87
|
+
query: resource.query,
|
|
88
|
+
title: resource.title,
|
|
89
|
+
explanation: resource.explanation,
|
|
80
90
|
});
|
|
81
91
|
}
|
|
92
|
+
if (input.output === "object") {
|
|
93
|
+
builder = builder.asObject();
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
builder = builder.asRows();
|
|
97
|
+
}
|
|
82
98
|
if (input.schema) {
|
|
83
99
|
builder = builder.schema(input.schema);
|
|
84
100
|
}
|
|
85
|
-
else {
|
|
101
|
+
else if (input.mode === "auto" || input.mode === undefined) {
|
|
86
102
|
builder = builder.inferSchema();
|
|
87
103
|
}
|
|
88
104
|
if (input.instructions?.trim()) {
|
|
@@ -99,4 +115,4 @@ function createMaterializeDatasetTool(params) {
|
|
|
99
115
|
},
|
|
100
116
|
});
|
|
101
117
|
}
|
|
102
|
-
|
|
118
|
+
export { materializeDatasetToolInputSchema };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formal notation for datasets — the dataset stated intensionally.
|
|
3
|
+
*
|
|
4
|
+
* A dataset has TWO CO-EQUAL FACES at the same level:
|
|
5
|
+
* - its formal DEFINITION (this notation: the proposition that defines the
|
|
6
|
+
* set, in LaTeX), and
|
|
7
|
+
* - its MATERIALIZATION (the rows + the code that produces them).
|
|
8
|
+
* The notation is not a comment about the data; it IS the dataset, written
|
|
9
|
+
* as a logical statement. The materialization is the same set written
|
|
10
|
+
* extensionally. Neither is subordinate to the other.
|
|
11
|
+
*
|
|
12
|
+
* The SAME notation plays two roles across the lifecycle: it is the PLAN
|
|
13
|
+
* (status "plan": stated first, the materialization is built to realize it)
|
|
14
|
+
* and, once finalized, the RESULT (status "result": it describes exactly
|
|
15
|
+
* what was produced). It is iterated in between — every revision keeps the
|
|
16
|
+
* prior version in `history`, so the discovery trail stays visible.
|
|
17
|
+
*
|
|
18
|
+
* The definition is a logical proposition, possibly DERIVED (a syllogism),
|
|
19
|
+
* so it is NOT, in general, mechanically verifiable: a predicate may be
|
|
20
|
+
* semantic ("x es una frase divertida") and the set is still well-formed.
|
|
21
|
+
* We TRUST the formality and the produced dataset — there is no verdict.
|
|
22
|
+
*
|
|
23
|
+
* SOME predicates happen to be arithmetic (a row count, a field type, a
|
|
24
|
+
* preserved total). For those, and only those, we attach OPTIONAL evidence
|
|
25
|
+
* computed over the rows. It is advisory: a contradiction is a hint, never
|
|
26
|
+
* a claim that the dataset is invalid. Predicates with no arithmetic form
|
|
27
|
+
* are "asserted" — trusted. Nothing here blocks or changes a build; the
|
|
28
|
+
* notation rides on dataset_datasets.notation.
|
|
29
|
+
*/
|
|
30
|
+
export type DatasetNotationSymbolKind = "set" | "variable" | "function" | "constant" | "predicate";
|
|
31
|
+
export type DatasetNotationSymbol = {
|
|
32
|
+
/** plain identifier, e.g. "D", "w", "Orders" */
|
|
33
|
+
name: string;
|
|
34
|
+
/** LaTeX for the symbol, e.g. "\\mathcal{D}" (defaults to the name) */
|
|
35
|
+
latex?: string;
|
|
36
|
+
kind: DatasetNotationSymbolKind;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
export type NotationCmpOp = "=" | "!=" | "<" | "<=" | ">" | ">=";
|
|
40
|
+
/**
|
|
41
|
+
* OPTIONAL arithmetic evidence for the subset of predicates that happen to
|
|
42
|
+
* be mechanical (counts, types, ranges, totals). Evaluated over the rows;
|
|
43
|
+
* field access supports dot-paths into nested records ("company.taxId").
|
|
44
|
+
* Leaf checks are dataset-level propositions; and/or/not/implies compose
|
|
45
|
+
* them propositionally. A predicate WITHOUT a check is a formal/semantic
|
|
46
|
+
* claim we trust — that is the normal case, not an exception.
|
|
47
|
+
*/
|
|
48
|
+
export type NotationCheck = {
|
|
49
|
+
kind: "row_count";
|
|
50
|
+
op: NotationCmpOp;
|
|
51
|
+
value: number;
|
|
52
|
+
} | {
|
|
53
|
+
kind: "field_type";
|
|
54
|
+
field: string;
|
|
55
|
+
type: "number" | "integer" | "string" | "boolean";
|
|
56
|
+
allowNull?: boolean;
|
|
57
|
+
} | {
|
|
58
|
+
kind: "field_range";
|
|
59
|
+
field: string;
|
|
60
|
+
min?: number;
|
|
61
|
+
max?: number;
|
|
62
|
+
} | {
|
|
63
|
+
kind: "field_in";
|
|
64
|
+
field: string;
|
|
65
|
+
values: Array<string | number | boolean>;
|
|
66
|
+
} | {
|
|
67
|
+
kind: "field_nonnull";
|
|
68
|
+
field: string;
|
|
69
|
+
} | {
|
|
70
|
+
kind: "field_matches";
|
|
71
|
+
field: string;
|
|
72
|
+
pattern: string;
|
|
73
|
+
} | {
|
|
74
|
+
kind: "unique";
|
|
75
|
+
fields: string[];
|
|
76
|
+
} | {
|
|
77
|
+
kind: "aggregate";
|
|
78
|
+
fn: "sum" | "count" | "min" | "max" | "avg";
|
|
79
|
+
/** omit for fn = "count" */
|
|
80
|
+
field?: string;
|
|
81
|
+
op: NotationCmpOp;
|
|
82
|
+
value: number;
|
|
83
|
+
/** absolute tolerance for float comparison (default 1e-9) */
|
|
84
|
+
tolerance?: number;
|
|
85
|
+
} | {
|
|
86
|
+
kind: "and";
|
|
87
|
+
checks: NotationCheck[];
|
|
88
|
+
} | {
|
|
89
|
+
kind: "or";
|
|
90
|
+
checks: NotationCheck[];
|
|
91
|
+
} | {
|
|
92
|
+
kind: "not";
|
|
93
|
+
check: NotationCheck;
|
|
94
|
+
} | {
|
|
95
|
+
kind: "implies";
|
|
96
|
+
if: NotationCheck;
|
|
97
|
+
then: NotationCheck;
|
|
98
|
+
};
|
|
99
|
+
export type DatasetNotationPredicate = {
|
|
100
|
+
/** stable id within the notation, e.g. "p1", "rowCount" */
|
|
101
|
+
id: string;
|
|
102
|
+
description: string;
|
|
103
|
+
/** the claim in LaTeX, e.g. "\\forall r \\in D:\\; r.amount > 0" */
|
|
104
|
+
latex: string;
|
|
105
|
+
/**
|
|
106
|
+
* OPTIONAL arithmetic form. Absent (the common case) = a formal/semantic
|
|
107
|
+
* claim we trust without mechanical checking.
|
|
108
|
+
*/
|
|
109
|
+
check?: NotationCheck;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Advisory evidence for one predicate. Never a verdict on the dataset:
|
|
113
|
+
* - "asserted" formal/semantic claim, trusted, no mechanical check
|
|
114
|
+
* - "supported" arithmetic evidence agrees with the stated claim
|
|
115
|
+
* - "contradicted" arithmetic evidence disagrees — a hint, not a failure
|
|
116
|
+
*/
|
|
117
|
+
export type DatasetNotationCheckResult = {
|
|
118
|
+
predicateId: string;
|
|
119
|
+
status: "asserted" | "supported" | "contradicted";
|
|
120
|
+
detail?: string;
|
|
121
|
+
};
|
|
122
|
+
export type DatasetNotationRevision = {
|
|
123
|
+
version: number;
|
|
124
|
+
latex: string;
|
|
125
|
+
/** why this revision happened — the discovery that triggered it */
|
|
126
|
+
reason: string;
|
|
127
|
+
at: number;
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* The role the notation currently plays — the two ends of its life:
|
|
131
|
+
* - "plan": stated before/while building; the materialization realizes it
|
|
132
|
+
* - "result": finalized; it describes the dataset that was produced
|
|
133
|
+
* There is intentionally NO "verified"/"violated" verdict — validity is
|
|
134
|
+
* trusted, not proven. Iteration is tracked by `version`/`history`; advisory
|
|
135
|
+
* arithmetic evidence lives in `checks`, separate from this role.
|
|
136
|
+
*/
|
|
137
|
+
export type DatasetNotationStatus = "plan" | "result";
|
|
138
|
+
export type DatasetNotation = {
|
|
139
|
+
version: number;
|
|
140
|
+
status: DatasetNotationStatus;
|
|
141
|
+
/** the main definition: the dataset as a set, in LaTeX */
|
|
142
|
+
latex: string;
|
|
143
|
+
symbols: DatasetNotationSymbol[];
|
|
144
|
+
predicates: DatasetNotationPredicate[];
|
|
145
|
+
/** advisory per-predicate evidence (asserted/supported/contradicted) */
|
|
146
|
+
checks?: DatasetNotationCheckResult[];
|
|
147
|
+
/** when the advisory evidence was last computed */
|
|
148
|
+
evidenceAt?: number;
|
|
149
|
+
history: DatasetNotationRevision[];
|
|
150
|
+
};
|
|
151
|
+
export type NotationRevisionInput = {
|
|
152
|
+
latex: string;
|
|
153
|
+
symbols?: DatasetNotationSymbol[];
|
|
154
|
+
predicates?: DatasetNotationPredicate[];
|
|
155
|
+
reason: string;
|
|
156
|
+
/** "final" marks the notation as describing the produced dataset */
|
|
157
|
+
final?: boolean;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Iterate the notation: every revision bumps the version and appends to
|
|
161
|
+
* history, so the discovery trail (sets/variables found along the way)
|
|
162
|
+
* stays visible.
|
|
163
|
+
*/
|
|
164
|
+
export declare function reviseDatasetNotation(previous: DatasetNotation | null | undefined, input: NotationRevisionInput): DatasetNotation;
|
|
165
|
+
/** escape an identifier for use inside \text{} */
|
|
166
|
+
export declare function latexIdentifier(name: string): string;
|
|
167
|
+
type JsonSchemaLike = {
|
|
168
|
+
title?: string;
|
|
169
|
+
schema?: Record<string, any>;
|
|
170
|
+
properties?: Record<string, any>;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* A query-backed dataset has a complete deterministic description: the
|
|
174
|
+
* dataset is the image of a known query over a known domain. No model is
|
|
175
|
+
* involved, so here the formal definition and its predicates derive
|
|
176
|
+
* mechanically from the query, the inferred schema and the row count — and
|
|
177
|
+
* those predicates DO carry arithmetic evidence (the special case where the
|
|
178
|
+
* formal claims happen to be fully mechanical).
|
|
179
|
+
*/
|
|
180
|
+
export declare function inferQueryNotation(params: {
|
|
181
|
+
entityNames: string[];
|
|
182
|
+
rowCount: number;
|
|
183
|
+
schema?: JsonSchemaLike | null;
|
|
184
|
+
explanation?: string;
|
|
185
|
+
}): DatasetNotation;
|
|
186
|
+
type CheckOutcome = {
|
|
187
|
+
ok: boolean;
|
|
188
|
+
detail: string;
|
|
189
|
+
};
|
|
190
|
+
export declare function evaluateNotationCheck(rows: any[], check: NotationCheck): CheckOutcome;
|
|
191
|
+
/**
|
|
192
|
+
* Annotate a notation with ADVISORY arithmetic evidence over the produced
|
|
193
|
+
* rows. Never throws, never blocks, and never changes the notation's
|
|
194
|
+
* lifecycle status — the dataset's validity is trusted, not proven here.
|
|
195
|
+
*
|
|
196
|
+
* Each predicate is reported as:
|
|
197
|
+
* - "asserted" no arithmetic form (formal/semantic claim, trusted)
|
|
198
|
+
* - "supported" arithmetic evidence agrees
|
|
199
|
+
* - "contradicted" arithmetic evidence disagrees (a hint to look, not a
|
|
200
|
+
* verdict that the dataset is wrong)
|
|
201
|
+
* A check that can't be evaluated stays "asserted" — we don't downgrade a
|
|
202
|
+
* trusted claim because of a malformed mechanical form.
|
|
203
|
+
*/
|
|
204
|
+
export declare function annotateNotationEvidence(notation: DatasetNotation, rows: any[]): DatasetNotation;
|
|
205
|
+
export {};
|