@ekairos/dataset 1.22.40-beta.development.0 → 1.22.40

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 (175) hide show
  1. package/dist/agents.d.ts +8 -0
  2. package/dist/agents.js +8 -0
  3. package/dist/builder/agentMaterializers.d.ts +9 -0
  4. package/dist/builder/agentMaterializers.js +10 -0
  5. package/dist/builder/context.d.ts +15 -0
  6. package/dist/builder/context.js +251 -0
  7. package/dist/builder/instructions.d.ts +4 -5
  8. package/dist/builder/instructions.js +15 -21
  9. package/dist/builder/materialize.d.ts +77 -10
  10. package/dist/builder/materialize.js +495 -152
  11. package/dist/builder/materializeQuery.d.ts +12 -0
  12. package/dist/builder/materializeQuery.js +31 -0
  13. package/dist/builder/persistence.d.ts +10 -6
  14. package/dist/builder/persistence.js +107 -62
  15. package/dist/builder/{sourceRows.d.ts → rows.d.ts} +0 -1
  16. package/dist/builder/{sourceRows.js → rows.js} +3 -9
  17. package/dist/builder/schemaInference.d.ts +1 -2
  18. package/dist/builder/schemaInference.js +4 -12
  19. package/dist/builder/types.d.ts +41 -26
  20. package/dist/builder/types.js +1 -3
  21. package/dist/clearDataset.tool.d.ts +2 -3
  22. package/dist/clearDataset.tool.js +13 -17
  23. package/dist/completeDataset.steps.d.ts +117 -0
  24. package/dist/completeDataset.steps.js +537 -0
  25. package/dist/completeDataset.tool.d.ts +132 -7
  26. package/dist/completeDataset.tool.js +46 -192
  27. package/dist/contextResources.d.ts +31 -0
  28. package/dist/contextResources.js +151 -0
  29. package/dist/contextWorkspace.d.ts +79 -0
  30. package/dist/contextWorkspace.js +234 -0
  31. package/dist/dataset/steps.d.ts +39 -15
  32. package/dist/dataset/steps.js +96 -39
  33. package/dist/dataset.d.ts +2 -3
  34. package/dist/dataset.js +73 -51
  35. package/dist/datasetFiles.d.ts +5 -1
  36. package/dist/datasetFiles.js +29 -27
  37. package/dist/defineNotation.tool.d.ts +49 -0
  38. package/dist/defineNotation.tool.js +154 -0
  39. package/dist/domain.d.ts +1 -2
  40. package/dist/domain.js +1 -6
  41. package/dist/executeCommand.tool.d.ts +2 -30
  42. package/dist/executeCommand.tool.js +165 -39
  43. package/dist/file/file-dataset.agent.d.ts +19 -56
  44. package/dist/file/file-dataset.agent.js +182 -136
  45. package/dist/file/file-dataset.steps.d.ts +27 -0
  46. package/dist/file/file-dataset.steps.js +47 -0
  47. package/dist/file/file-dataset.types.d.ts +64 -0
  48. package/dist/file/file-dataset.types.js +1 -0
  49. package/dist/file/filepreview.d.ts +5 -35
  50. package/dist/file/filepreview.js +60 -107
  51. package/dist/file/filepreview.types.d.ts +31 -0
  52. package/dist/file/filepreview.types.js +1 -0
  53. package/dist/file/generateSchema.tool.d.ts +2 -3
  54. package/dist/file/generateSchema.tool.js +11 -15
  55. package/dist/file/index.d.ts +1 -2
  56. package/dist/file/index.js +1 -18
  57. package/dist/file/prompts.d.ts +2 -3
  58. package/dist/file/prompts.js +152 -32
  59. package/dist/file/scripts.generated.d.ts +1 -0
  60. package/dist/file/scripts.generated.js +11 -0
  61. package/dist/file/steps.d.ts +1 -2
  62. package/dist/file/steps.js +9 -7
  63. package/dist/id.d.ts +1 -0
  64. package/dist/id.js +10 -0
  65. package/dist/index.d.ts +9 -7
  66. package/dist/index.js +9 -23
  67. package/dist/materializeDataset.tool.d.ts +35 -28
  68. package/dist/materializeDataset.tool.js +74 -68
  69. package/dist/notation.d.ts +205 -0
  70. package/dist/notation.js +424 -0
  71. package/dist/query/index.d.ts +1 -2
  72. package/dist/query/index.js +1 -18
  73. package/dist/query/queryDomain.d.ts +3 -4
  74. package/dist/query/queryDomain.js +3 -40
  75. package/dist/query/queryDomain.step.d.ts +1 -1
  76. package/dist/query/queryDomain.step.js +24 -13
  77. package/dist/sandbox/steps.d.ts +23 -15
  78. package/dist/sandbox/steps.js +73 -76
  79. package/dist/sandbox.steps.d.ts +1 -2
  80. package/dist/sandbox.steps.js +1 -18
  81. package/dist/schema.d.ts +14 -3
  82. package/dist/schema.js +27 -26
  83. package/dist/service.d.ts +12 -5
  84. package/dist/service.js +88 -15
  85. package/dist/skill.d.ts +0 -1
  86. package/dist/skill.js +12 -17
  87. package/dist/transform/filepreview.d.ts +2 -3
  88. package/dist/transform/filepreview.js +9 -26
  89. package/dist/transform/index.d.ts +2 -3
  90. package/dist/transform/index.js +2 -8
  91. package/dist/transform/prompts.d.ts +1 -34
  92. package/dist/transform/prompts.js +66 -46
  93. package/dist/transform/transform-dataset.agent.d.ts +21 -46
  94. package/dist/transform/transform-dataset.agent.js +152 -93
  95. package/dist/transform/transform-dataset.steps.d.ts +30 -0
  96. package/dist/transform/transform-dataset.steps.js +61 -0
  97. package/dist/transform/transform-dataset.types.d.ts +96 -0
  98. package/dist/transform/transform-dataset.types.js +1 -0
  99. package/dist/transform/transformDataset.d.ts +3 -3
  100. package/dist/transform/transformDataset.js +15 -18
  101. package/dist/writeDatasetRows.tool.d.ts +188 -0
  102. package/dist/writeDatasetRows.tool.js +258 -0
  103. package/package.json +33 -8
  104. package/dist/builder/instructions.d.ts.map +0 -1
  105. package/dist/builder/instructions.js.map +0 -1
  106. package/dist/builder/materialize.d.ts.map +0 -1
  107. package/dist/builder/materialize.js.map +0 -1
  108. package/dist/builder/persistence.d.ts.map +0 -1
  109. package/dist/builder/persistence.js.map +0 -1
  110. package/dist/builder/schemaInference.d.ts.map +0 -1
  111. package/dist/builder/schemaInference.js.map +0 -1
  112. package/dist/builder/sourceRows.d.ts.map +0 -1
  113. package/dist/builder/sourceRows.js.map +0 -1
  114. package/dist/builder/types.d.ts.map +0 -1
  115. package/dist/builder/types.js.map +0 -1
  116. package/dist/clearDataset.tool.d.ts.map +0 -1
  117. package/dist/clearDataset.tool.js.map +0 -1
  118. package/dist/completeDataset.tool.d.ts.map +0 -1
  119. package/dist/completeDataset.tool.js.map +0 -1
  120. package/dist/dataset/steps.d.ts.map +0 -1
  121. package/dist/dataset/steps.js.map +0 -1
  122. package/dist/dataset.d.ts.map +0 -1
  123. package/dist/dataset.js.map +0 -1
  124. package/dist/datasetFiles.d.ts.map +0 -1
  125. package/dist/datasetFiles.js.map +0 -1
  126. package/dist/domain.d.ts.map +0 -1
  127. package/dist/domain.js.map +0 -1
  128. package/dist/eventsReactRuntime.d.ts +0 -22
  129. package/dist/eventsReactRuntime.d.ts.map +0 -1
  130. package/dist/eventsReactRuntime.js +0 -29
  131. package/dist/eventsReactRuntime.js.map +0 -1
  132. package/dist/executeCommand.tool.d.ts.map +0 -1
  133. package/dist/executeCommand.tool.js.map +0 -1
  134. package/dist/file/file-dataset.agent.d.ts.map +0 -1
  135. package/dist/file/file-dataset.agent.js.map +0 -1
  136. package/dist/file/filepreview.d.ts.map +0 -1
  137. package/dist/file/filepreview.js.map +0 -1
  138. package/dist/file/generateSchema.tool.d.ts.map +0 -1
  139. package/dist/file/generateSchema.tool.js.map +0 -1
  140. package/dist/file/index.d.ts.map +0 -1
  141. package/dist/file/index.js.map +0 -1
  142. package/dist/file/prompts.d.ts.map +0 -1
  143. package/dist/file/prompts.js.map +0 -1
  144. package/dist/file/steps.d.ts.map +0 -1
  145. package/dist/file/steps.js.map +0 -1
  146. package/dist/index.d.ts.map +0 -1
  147. package/dist/index.js.map +0 -1
  148. package/dist/materializeDataset.tool.d.ts.map +0 -1
  149. package/dist/materializeDataset.tool.js.map +0 -1
  150. package/dist/query/index.d.ts.map +0 -1
  151. package/dist/query/index.js.map +0 -1
  152. package/dist/query/queryDomain.d.ts.map +0 -1
  153. package/dist/query/queryDomain.js.map +0 -1
  154. package/dist/query/queryDomain.step.d.ts.map +0 -1
  155. package/dist/query/queryDomain.step.js.map +0 -1
  156. package/dist/sandbox/steps.d.ts.map +0 -1
  157. package/dist/sandbox/steps.js.map +0 -1
  158. package/dist/sandbox.steps.d.ts.map +0 -1
  159. package/dist/sandbox.steps.js.map +0 -1
  160. package/dist/schema.d.ts.map +0 -1
  161. package/dist/schema.js.map +0 -1
  162. package/dist/service.d.ts.map +0 -1
  163. package/dist/service.js.map +0 -1
  164. package/dist/skill.d.ts.map +0 -1
  165. package/dist/skill.js.map +0 -1
  166. package/dist/transform/filepreview.d.ts.map +0 -1
  167. package/dist/transform/filepreview.js.map +0 -1
  168. package/dist/transform/index.d.ts.map +0 -1
  169. package/dist/transform/index.js.map +0 -1
  170. package/dist/transform/prompts.d.ts.map +0 -1
  171. package/dist/transform/prompts.js.map +0 -1
  172. package/dist/transform/transform-dataset.agent.d.ts.map +0 -1
  173. package/dist/transform/transform-dataset.agent.js.map +0 -1
  174. package/dist/transform/transformDataset.d.ts.map +0 -1
  175. package/dist/transform/transformDataset.js.map +0 -1
@@ -1,49 +1,164 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createExecuteCommandTool = createExecuteCommandTool;
4
- const ai_1 = require("ai");
5
- const zod_1 = require("zod");
6
- const steps_1 = require("./sandbox/steps");
7
- const datasetFiles_1 = require("./datasetFiles");
8
- // To keep responses predictable for big data scenarios, we cap stdout/stderr.
9
- // The tool's return payload exposes stdout (capped) plus the on-disk script path.
1
+ import { defineAction } from "@ekairos/reactor/context";
2
+ import { z } from "zod";
3
+ import { materializeContextResourcesStep } from "./contextResources.js";
4
+ import { getDatasetScriptsDir, getDatasetStandardDirs } from "./datasetFiles.js";
5
+ import { getContextExecutionWorkspaceDirs } from "./contextWorkspace.js";
6
+ import { runDatasetSandboxCommandStep, writeDatasetSandboxTextFilesStep, } from "./sandbox/steps.js";
10
7
  const MAX_STDOUT_CHARS = 20000;
11
8
  const MAX_STDERR_CHARS = 5000;
12
- function createExecuteCommandTool({ datasetId, sandboxId, env }) {
13
- return (0, ai_1.tool)({
14
- description: "Execute Python scripts in the sandbox. Always saves script to a file before executing. The tool's output is EXACTLY the script's stdout and includes the script file path for traceability. CRITICAL: Print concise, human-readable summaries only; do NOT print raw large data. For big results, write artifacts to files in the workstation and print their file paths. Always include progress/result prints (e.g., 'Processing file X...', 'Found Y records', 'Generated output.csv').",
15
- inputSchema: zod_1.z.object({
16
- pythonCode: zod_1.z.string().describe("Python code to execute. Saved to a file before running. MANDATORY: Use print() to report progress and final results. Keep prints concise; avoid dumping rows/JSON. For large outputs, write to files in the workstation directory and print only file paths and brief summaries."),
17
- scriptName: zod_1.z.string().describe("Name for the script file in snake_case (e.g., 'inspect_file', 'parse_csv', 'generate_dataset'). A UUID will be appended automatically."),
18
- }),
19
- execute: async ({ pythonCode, scriptName }) => {
20
- const uuid = `${Date.now()}-${Math.random().toString(36).substring(2, 9)}`;
21
- const workstation = (0, datasetFiles_1.getDatasetWorkstation)(datasetId);
22
- const scriptFile = `${workstation}/${scriptName}-${uuid}.py`;
9
+ function normalizeScriptName(scriptName) {
10
+ const normalized = String(scriptName ?? "")
11
+ .trim()
12
+ .replace(/[^a-zA-Z0-9_.-]/g, "_")
13
+ .replace(/_+/g, "_")
14
+ .slice(0, 80);
15
+ return normalized || "script";
16
+ }
17
+ function stableScriptHash(value) {
18
+ let hash = 2166136261;
19
+ for (let index = 0; index < value.length; index++) {
20
+ hash ^= value.charCodeAt(index);
21
+ hash = Math.imul(hash, 16777619);
22
+ }
23
+ return (hash >>> 0).toString(36);
24
+ }
25
+ const executeCommandInputSchema = z.object({
26
+ commandDescription: z
27
+ .string()
28
+ .min(1)
29
+ .describe("Required pre-execution description of the command. Describe the inputs/resources it will use, the operation it will perform, the expected output, and why a command is the right tool instead of direct completion. Invalid descriptions include rereading resources whose descriptor/preview already contains the needed evidence, merely formatting JSON, constructing the final object, writing output.jsonl, or making completion easier."),
30
+ pythonCode: z
31
+ .string()
32
+ .describe("Python code to execute. Saved to a file before running. MANDATORY: Use print() to report progress and final results. Keep prints concise; avoid dumping rows/JSON. If context resources are materialized, read os.environ['EKAIROS_CONTEXT_RESOURCES_MANIFEST'] to discover files and metadata. Do not install packages, download dependencies, use pip/npm/apt/curl/wget, or access the network. For large outputs, write to files in the workstation directory and print only file paths and brief summaries."),
33
+ scriptName: z
34
+ .string()
35
+ .describe("Name for the script file in snake_case (e.g., 'inspect_file', 'parse_csv', 'generate_dataset'). A deterministic suffix will be appended automatically."),
36
+ resourceKeys: z
37
+ .array(z.string())
38
+ .optional()
39
+ .describe("Optional context resource keys to materialize before running the script. Omit to materialize every context resource."),
40
+ });
41
+ const materializedResourceSchema = z.object({
42
+ key: z.string(),
43
+ type: z.string(),
44
+ status: z.string(),
45
+ dir: z.string(),
46
+ files: z.array(z.object({
47
+ path: z.string(),
48
+ role: z.string(),
49
+ mediaType: z.string().optional(),
50
+ })),
51
+ reason: z.string().optional(),
52
+ });
53
+ const executeCommandOutputSchema = z
54
+ .object({
55
+ success: z.boolean(),
56
+ fatal: z.boolean().optional(),
57
+ status: z.string().optional(),
58
+ exitCode: z.number().optional(),
59
+ stdout: z.string(),
60
+ stderr: z.string(),
61
+ scriptPath: z.string(),
62
+ message: z.string().optional(),
63
+ error: z.string().optional(),
64
+ resourcesDir: z.string().optional(),
65
+ resourcesManifestPath: z.string().optional(),
66
+ materializedResources: z.array(materializedResourceSchema).optional(),
67
+ stdoutTruncated: z.boolean(),
68
+ stderrTruncated: z.boolean(),
69
+ stdoutOriginalLength: z.number(),
70
+ stderrOriginalLength: z.number(),
71
+ })
72
+ .passthrough();
73
+ export function createExecuteCommandTool({ datasetId, sandboxId, runtime }) {
74
+ return defineAction({
75
+ description: "Execute Python scripts in the sandbox only when command execution is necessary to inspect, parse, aggregate, join, or compute over context resources that are not sufficiently represented in the visible context, resource descriptors, or previews. This is a high-cost computation tool, not a completion tool. Do not use it merely to reread resources whose descriptor/preview already contains the needed evidence, format JSON, build the final object, write output.jsonl, or make completion easier when completeObject or replaceRows can return the result directly. Before the script runs, requested context resources are materialized into /tmp/ekairos/contexts/{contextId}/resources and a manifest.json is written there. The Python process receives EKAIROS_CONTEXT_RESOURCES_DIR and EKAIROS_CONTEXT_RESOURCES_MANIFEST environment variables when resources are available; manifest entries expose files as resources[].files[].path. Do not install packages, download dependencies, use pip/npm/apt/curl/wget, or access the network; use only the available runtime and standard library unless a dependency is already present. Print concise progress and results only; do not dump large data.",
76
+ input: executeCommandInputSchema,
77
+ output: executeCommandOutputSchema,
78
+ execute: async ({ input, context, contextId, executionId, }) => {
79
+ const { commandDescription, pythonCode, resourceKeys, scriptName } = input;
80
+ const normalizedScriptName = normalizeScriptName(scriptName);
81
+ const scriptHash = stableScriptHash(`${normalizedScriptName}\0${pythonCode}`);
82
+ const scriptsDir = contextId && executionId
83
+ ? getContextExecutionWorkspaceDirs({ contextId, executionId }).scriptsDir
84
+ : getDatasetScriptsDir(datasetId);
85
+ const scriptFile = `${scriptsDir}/${normalizedScriptName}-${scriptHash}.py`;
86
+ let resourcesManifest = null;
23
87
  console.log(`[Dataset ${datasetId}] ========================================`);
24
- console.log(`[Dataset ${datasetId}] Tool: executeCommand`);
25
- console.log(`[Dataset ${datasetId}] Script: ${scriptName}`);
88
+ console.log(`[Dataset ${datasetId}] Action: executeCommand`);
89
+ console.log(`[Dataset ${datasetId}] Description: ${commandDescription}`);
90
+ console.log(`[Dataset ${datasetId}] Script: ${normalizedScriptName}`);
26
91
  console.log(`[Dataset ${datasetId}] File: ${scriptFile}`);
27
92
  console.log(`[Dataset ${datasetId}] Code length: ${pythonCode.length} chars`);
28
93
  console.log(`[Dataset ${datasetId}] ========================================`);
29
94
  try {
30
- await (0, steps_1.writeDatasetSandboxFilesStep)({
31
- env,
95
+ if (contextId && Array.isArray(context?.resources) && context.resources.length > 0) {
96
+ resourcesManifest = await materializeContextResourcesStep({
97
+ runtime,
98
+ sandboxId,
99
+ contextId,
100
+ resources: context.resources,
101
+ resourceKeys,
102
+ });
103
+ console.log(`[Dataset ${datasetId}] Resources manifest: ${resourcesManifest.manifestPath}`);
104
+ }
105
+ await runDatasetSandboxCommandStep({
106
+ runtime,
107
+ sandboxId,
108
+ cmd: "mkdir",
109
+ args: ["-p", ...getDatasetStandardDirs(datasetId), scriptsDir],
110
+ });
111
+ await writeDatasetSandboxTextFilesStep({
112
+ runtime,
113
+ sandboxId,
114
+ files: [{ path: scriptFile, content: pythonCode }],
115
+ });
116
+ const written = await runDatasetSandboxCommandStep({
117
+ runtime,
32
118
  sandboxId,
33
- files: [
34
- {
35
- path: scriptFile,
36
- contentBase64: Buffer.from(pythonCode, "utf-8").toString("base64"),
37
- },
38
- ],
119
+ cmd: "test",
120
+ args: ["-f", scriptFile],
39
121
  });
122
+ if (written.exitCode !== 0) {
123
+ const error = `Script write verification failed: ${scriptFile}`;
124
+ console.error(`[Dataset ${datasetId}] ${error}`);
125
+ console.error(`[Dataset ${datasetId}] ========================================`);
126
+ return {
127
+ success: false,
128
+ fatal: true,
129
+ status: "script_write_failed",
130
+ error,
131
+ stdout: written.stdout || "",
132
+ stderr: written.stderr || "",
133
+ exitCode: written.exitCode,
134
+ scriptPath: scriptFile,
135
+ resourcesDir: resourcesManifest?.resourcesDir,
136
+ resourcesManifestPath: resourcesManifest?.manifestPath,
137
+ materializedResources: resourcesManifest?.resources,
138
+ stdoutTruncated: false,
139
+ stderrTruncated: false,
140
+ stdoutOriginalLength: 0,
141
+ stderrOriginalLength: 0,
142
+ };
143
+ }
144
+ const pythonArgs = resourcesManifest
145
+ ? [
146
+ "-c",
147
+ [
148
+ "import os, runpy",
149
+ `os.environ["EKAIROS_CONTEXT_RESOURCES_DIR"] = ${JSON.stringify(resourcesManifest.resourcesDir)}`,
150
+ `os.environ["EKAIROS_CONTEXT_RESOURCES_MANIFEST"] = ${JSON.stringify(resourcesManifest.manifestPath)}`,
151
+ `runpy.run_path(${JSON.stringify(scriptFile)}, run_name="__main__")`,
152
+ ].join("; "),
153
+ ]
154
+ : [scriptFile];
40
155
  console.log(`[Dataset ${datasetId}] Script written to: ${scriptFile}`);
41
- console.log(`[Dataset ${datasetId}] Executing: python ${scriptFile}`);
42
- const result = await (0, steps_1.runDatasetSandboxCommandStep)({
43
- env,
156
+ console.log(`[Dataset ${datasetId}] Executing: python ${resourcesManifest ? "<with context resources env>" : scriptFile}`);
157
+ const result = await runDatasetSandboxCommandStep({
158
+ runtime,
44
159
  sandboxId,
45
160
  cmd: "python",
46
- args: [scriptFile],
161
+ args: pythonArgs,
47
162
  });
48
163
  const stdout = result.stdout || "";
49
164
  const stderr = result.stderr || "";
@@ -53,7 +168,7 @@ function createExecuteCommandTool({ datasetId, sandboxId, env }) {
53
168
  const stdoutCapped = isStdoutTruncated ? stdout.slice(0, MAX_STDOUT_CHARS) : stdout;
54
169
  const stderrCapped = isStderrTruncated ? stderr.slice(0, MAX_STDERR_CHARS) : stderr;
55
170
  if (exitCode !== 0) {
56
- console.error(`[Dataset ${datasetId}] Command failed with exit code ${exitCode}`);
171
+ console.error(`[Dataset ${datasetId}] Command failed with exit code ${exitCode}`);
57
172
  console.error(`[Dataset ${datasetId}] Stderr:`, stderrCapped.substring(0, 500));
58
173
  console.error(`[Dataset ${datasetId}] ========================================`);
59
174
  return {
@@ -63,6 +178,9 @@ function createExecuteCommandTool({ datasetId, sandboxId, env }) {
63
178
  stderr: stderrCapped,
64
179
  scriptPath: scriptFile,
65
180
  error: `Command failed with exit code ${exitCode}`,
181
+ resourcesDir: resourcesManifest?.resourcesDir,
182
+ resourcesManifestPath: resourcesManifest?.manifestPath,
183
+ materializedResources: resourcesManifest?.resources,
66
184
  stdoutTruncated: isStdoutTruncated,
67
185
  stderrTruncated: isStderrTruncated,
68
186
  stdoutOriginalLength: stdout.length,
@@ -70,7 +188,7 @@ function createExecuteCommandTool({ datasetId, sandboxId, env }) {
70
188
  };
71
189
  }
72
190
  if (stderr && (stderr.includes("Traceback") || stderr.toLowerCase().includes("error"))) {
73
- console.error(`[Dataset ${datasetId}] Python error detected`);
191
+ console.error(`[Dataset ${datasetId}] Python error detected`);
74
192
  console.error(`[Dataset ${datasetId}] Stderr:`, stderrCapped.substring(0, 500));
75
193
  console.error(`[Dataset ${datasetId}] ========================================`);
76
194
  return {
@@ -80,17 +198,20 @@ function createExecuteCommandTool({ datasetId, sandboxId, env }) {
80
198
  stderr: stderrCapped,
81
199
  scriptPath: scriptFile,
82
200
  error: "Python error detected in stderr",
201
+ resourcesDir: resourcesManifest?.resourcesDir,
202
+ resourcesManifestPath: resourcesManifest?.manifestPath,
203
+ materializedResources: resourcesManifest?.resources,
83
204
  stdoutTruncated: isStdoutTruncated,
84
205
  stderrTruncated: isStderrTruncated,
85
206
  stdoutOriginalLength: stdout.length,
86
207
  stderrOriginalLength: stderr.length,
87
208
  };
88
209
  }
89
- console.log(`[Dataset ${datasetId}] Command executed successfully`);
210
+ console.log(`[Dataset ${datasetId}] Command executed successfully`);
90
211
  if (stdout) {
91
212
  console.log(`[Dataset ${datasetId}] Output length: ${stdout.length} chars`);
92
213
  if (isStdoutTruncated) {
93
- console.log(`[Dataset ${datasetId}] ⚠️ Stdout truncated to ${MAX_STDOUT_CHARS} chars`);
214
+ console.log(`[Dataset ${datasetId}] Stdout truncated to ${MAX_STDOUT_CHARS} chars`);
94
215
  }
95
216
  }
96
217
  console.log(`[Dataset ${datasetId}] ========================================`);
@@ -101,6 +222,9 @@ function createExecuteCommandTool({ datasetId, sandboxId, env }) {
101
222
  stderr: stderrCapped,
102
223
  scriptPath: scriptFile,
103
224
  message: "Command executed successfully",
225
+ resourcesDir: resourcesManifest?.resourcesDir,
226
+ resourcesManifestPath: resourcesManifest?.manifestPath,
227
+ materializedResources: resourcesManifest?.resources,
104
228
  stdoutTruncated: isStdoutTruncated,
105
229
  stderrTruncated: isStderrTruncated,
106
230
  stdoutOriginalLength: stdout.length,
@@ -118,6 +242,9 @@ function createExecuteCommandTool({ datasetId, sandboxId, env }) {
118
242
  stderr: "",
119
243
  exitCode: -1,
120
244
  scriptPath: scriptFile,
245
+ resourcesDir: resourcesManifest?.resourcesDir,
246
+ resourcesManifestPath: resourcesManifest?.manifestPath,
247
+ materializedResources: resourcesManifest?.resources,
121
248
  stdoutTruncated: false,
122
249
  stderrTruncated: false,
123
250
  stdoutOriginalLength: 0,
@@ -127,4 +254,3 @@ function createExecuteCommandTool({ datasetId, sandboxId, env }) {
127
254
  },
128
255
  });
129
256
  }
130
- //# sourceMappingURL=executeCommand.tool.js.map
@@ -1,56 +1,7 @@
1
- import { createContext, type ContextReactor } from "@ekairos/events";
2
- import { FilePreviewContext } from "./filepreview";
3
- export type FileParseStoryContext = {
4
- datasetId: string;
5
- fileId: string;
6
- instructions: string;
7
- sandboxConfig: {
8
- filePath: string;
9
- };
10
- analysis: any[];
11
- schema: any | null;
12
- plan: any | null;
13
- executionResult: any | null;
14
- errors: string[];
15
- iterationCount: number;
16
- filePreview?: FilePreviewContext;
17
- };
18
- export type FileParseStoryParams = {
19
- fileId: string;
20
- instructions?: string;
21
- sandboxId?: string;
22
- datasetId?: string;
23
- model?: string;
24
- reactor?: ContextReactor<any, any>;
25
- };
26
- export type FileParseStoryBuilder<Env extends {
27
- orgId: string;
28
- }> = {
29
- datasetId: string;
30
- story: ReturnType<ReturnType<typeof createContext<Env>>["context"]> extends any ? any : any;
31
- };
32
- export type DatasetResult = {
33
- id: string;
34
- status?: string;
35
- title?: string;
36
- schema?: any;
37
- analysis?: any;
38
- calculatedTotalRows?: number;
39
- actualGeneratedRowCount?: number;
40
- createdAt?: number;
41
- updatedAt?: number;
42
- };
43
- /**
44
- * Factory (DX-first):
45
- *
46
- * Usage:
47
- * const { datasetId } = await createFileParseStory(fileId, { instructions }).parse(env)
48
- *
49
- * - No `db` is accepted/stored (workflow-safe).
50
- * - All I/O happens in `"use step"` functions via Ekairos runtime (`getContextRuntime(env).db`).
51
- * - `parse()` is the entrypoint; it calls `story.react(...)` internally.
52
- */
53
- export declare function createFileParseStory<Env extends {
1
+ import { type ContextReactor } from "@ekairos/reactor/context";
2
+ import type { FileParseContext, FileParseRunOptions, SandboxState } from "./file-dataset.types.js";
3
+ export type { DatasetResult, FileParseContext, FileParseContextBuilder, FileParseContextParams, FileParseRunOptions, SandboxState, } from "./file-dataset.types.js";
4
+ export declare function createFileParseContext<Env extends {
54
5
  orgId: string;
55
6
  }>(fileId: string, opts?: {
56
7
  instructions?: string;
@@ -58,11 +9,23 @@ export declare function createFileParseStory<Env extends {
58
9
  datasetId?: string;
59
10
  model?: string;
60
11
  reactor?: ContextReactor<any, any>;
12
+ sandboxState?: SandboxState;
13
+ filePreview?: FileParseContext["filePreview"];
14
+ schema?: any | null;
15
+ filename?: string;
16
+ mediaType?: string;
61
17
  }): {
62
18
  datasetId: string;
63
- parse(env?: Env, prompt?: string): Promise<{
19
+ parse(runtime: {
20
+ env: Env;
21
+ }, options?: FileParseRunOptions): Promise<{
64
22
  datasetId: string;
65
23
  }>;
66
- story: any;
24
+ context: any;
67
25
  };
68
- //# sourceMappingURL=file-dataset.agent.d.ts.map
26
+ export declare function registerFileParseContext<Env extends {
27
+ orgId: string;
28
+ }>(opts?: {
29
+ model?: string;
30
+ reactor?: ContextReactor<any, any>;
31
+ }): void;