@ekairos/dataset 1.22.3 → 1.22.4-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.
- package/dist/dataset/steps.d.ts.map +1 -1
- package/dist/dataset/steps.js +32 -38
- package/dist/dataset/steps.js.map +1 -1
- package/dist/dataset.d.ts +67 -0
- package/dist/dataset.d.ts.map +1 -0
- package/dist/dataset.js +577 -0
- package/dist/dataset.js.map +1 -0
- package/dist/datasetFiles.d.ts +1 -0
- package/dist/datasetFiles.d.ts.map +1 -1
- package/dist/datasetFiles.js +21 -1
- package/dist/datasetFiles.js.map +1 -1
- package/dist/file/file-dataset.agent.d.ts +5 -3
- package/dist/file/file-dataset.agent.d.ts.map +1 -1
- package/dist/file/file-dataset.agent.js +28 -20
- package/dist/file/file-dataset.agent.js.map +1 -1
- package/dist/file/filepreview.js +1 -1
- package/dist/file/filepreview.js.map +1 -1
- package/dist/file/prompts.d.ts.map +1 -1
- package/dist/file/prompts.js +29 -12
- package/dist/file/prompts.js.map +1 -1
- package/dist/file/steps.js +2 -2
- package/dist/file/steps.js.map +1 -1
- package/dist/index.d.ts +3 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -8
- package/dist/index.js.map +1 -1
- package/dist/materializeDataset.tool.d.ts +78 -0
- package/dist/materializeDataset.tool.d.ts.map +1 -0
- package/dist/materializeDataset.tool.js +102 -0
- package/dist/materializeDataset.tool.js.map +1 -0
- package/dist/query/queryDomain.step.js +3 -3
- package/dist/query/queryDomain.step.js.map +1 -1
- package/dist/sandbox/steps.d.ts.map +1 -1
- package/dist/sandbox/steps.js +95 -6
- package/dist/sandbox/steps.js.map +1 -1
- package/dist/schema.d.ts +4 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +4 -1
- package/dist/schema.js.map +1 -1
- package/dist/service.d.ts +14 -1
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +130 -10
- package/dist/service.js.map +1 -1
- package/dist/skill.d.ts +11 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +53 -0
- package/dist/skill.js.map +1 -0
- package/dist/transform/transform-dataset.agent.d.ts +3 -0
- package/dist/transform/transform-dataset.agent.d.ts.map +1 -1
- package/dist/transform/transform-dataset.agent.js +16 -12
- package/dist/transform/transform-dataset.agent.js.map +1 -1
- package/dist/transform/transformDataset.js +2 -2
- package/dist/transform/transformDataset.js.map +1 -1
- package/package.json +12 -16
- package/skill/SKILL.md +83 -0
- package/skill/code/_runtime.mjs +156 -0
- package/skill/code/complete_dataset.mjs +104 -0
- package/skill/code/dataset_source_to_jsonl.mjs +51 -0
- package/skill/code/query_to_jsonl.mjs +22 -0
- package/skill/skill.toml +13 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises"
|
|
2
|
+
import { dirname } from "node:path"
|
|
3
|
+
import { instantQuery, readJsonFile } from "./_runtime.mjs"
|
|
4
|
+
|
|
5
|
+
const inputPath = process.argv[2]
|
|
6
|
+
if (!inputPath) {
|
|
7
|
+
console.error("dataset_source_input_path_required")
|
|
8
|
+
process.exit(1)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const input = await readJsonFile(inputPath)
|
|
12
|
+
const datasetId = String(input.datasetId ?? "").trim()
|
|
13
|
+
const outputPath = String(input.outputPath ?? "").trim()
|
|
14
|
+
|
|
15
|
+
if (!datasetId) {
|
|
16
|
+
console.error("dataset_source_dataset_id_required")
|
|
17
|
+
process.exit(1)
|
|
18
|
+
}
|
|
19
|
+
if (!outputPath) {
|
|
20
|
+
console.error("dataset_source_output_path_required")
|
|
21
|
+
process.exit(1)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const result = await instantQuery(
|
|
25
|
+
{
|
|
26
|
+
dataset_datasets: {
|
|
27
|
+
$: { where: { datasetId }, limit: 1 },
|
|
28
|
+
dataFile: {},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
input.manifestPath,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
const row = Array.isArray(result?.dataset_datasets) ? result.dataset_datasets[0] : null
|
|
35
|
+
const linkedFile = Array.isArray(row?.dataFile) ? row.dataFile[0] : row?.dataFile
|
|
36
|
+
const url = String(linkedFile?.url ?? "").trim()
|
|
37
|
+
if (!url) {
|
|
38
|
+
console.error("dataset_source_file_url_missing")
|
|
39
|
+
process.exit(1)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const response = await fetch(url)
|
|
43
|
+
if (!response.ok) {
|
|
44
|
+
console.error(`dataset_source_download_failed:${response.status}`)
|
|
45
|
+
process.exit(1)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const text = await response.text()
|
|
49
|
+
await mkdir(dirname(outputPath), { recursive: true })
|
|
50
|
+
await writeFile(outputPath, text, "utf8")
|
|
51
|
+
process.stdout.write(JSON.stringify({ outputPath, bytes: text.length }))
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises"
|
|
2
|
+
import { dirname } from "node:path"
|
|
3
|
+
import { instantQuery, normalizeQueryRows, rowsToJsonl, readJsonFile } from "./_runtime.mjs"
|
|
4
|
+
|
|
5
|
+
const inputPath = process.argv[2]
|
|
6
|
+
if (!inputPath) {
|
|
7
|
+
console.error("query_input_path_required")
|
|
8
|
+
process.exit(1)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const input = await readJsonFile(inputPath)
|
|
12
|
+
const outputPath = String(input.outputPath ?? "").trim()
|
|
13
|
+
if (!outputPath) {
|
|
14
|
+
console.error("query_output_path_required")
|
|
15
|
+
process.exit(1)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const result = await instantQuery(input.query ?? {}, input.manifestPath)
|
|
19
|
+
const rows = normalizeQueryRows(result)
|
|
20
|
+
await mkdir(dirname(outputPath), { recursive: true })
|
|
21
|
+
await writeFile(outputPath, rowsToJsonl(rows), "utf8")
|
|
22
|
+
process.stdout.write(JSON.stringify({ outputPath, rowCount: rows.length }))
|
package/skill/skill.toml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
name = "dataset"
|
|
2
|
+
version = "0.1.0"
|
|
3
|
+
description = "Materialize and persist datasets using the Ekairos runtime manifest."
|
|
4
|
+
kind = "action"
|
|
5
|
+
namespace = "ekairos"
|
|
6
|
+
tags = ["dataset", "ekairos", "instantdb", "runtime"]
|
|
7
|
+
|
|
8
|
+
[runtime]
|
|
9
|
+
language = "javascript"
|
|
10
|
+
entrypoint = "code/complete_dataset.mjs"
|
|
11
|
+
|
|
12
|
+
[permissions]
|
|
13
|
+
network = ["https://api.instantdb.com", "https://storage.instantdb.com", "https://*"]
|