@ekairos/dataset 1.22.77-beta.development.0 → 1.22.78-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,4 +1,5 @@
1
1
  import type { AnyDatasetRuntime, DatasetBuilderState, InternalSource } from "./types.js";
2
+ export declare function resolveDatasetAgentDurable(requestedDurable?: boolean): Promise<boolean>;
2
3
  export declare function materializeSingleFileLikeSource<Runtime extends AnyDatasetRuntime>(state: DatasetBuilderState<Runtime>, source: Extract<InternalSource, {
3
4
  kind: "file" | "text";
4
5
  }>, targetDatasetId: string): Promise<string>;
@@ -82,6 +82,20 @@ async function resolveDatasetSandboxId(state, targetDatasetId) {
82
82
  });
83
83
  return created.sandboxId;
84
84
  }
85
+ export async function resolveDatasetAgentDurable(requestedDurable) {
86
+ if (!requestedDurable)
87
+ return false;
88
+ try {
89
+ const { getWorkflowMetadata } = await import("workflow");
90
+ const workflowRunId = getWorkflowMetadata?.()?.workflowRunId;
91
+ if (workflowRunId)
92
+ return false;
93
+ }
94
+ catch {
95
+ // Outside Workflow runtime there is no active metadata, so honor the caller.
96
+ }
97
+ return true;
98
+ }
85
99
  export async function materializeSingleFileLikeSource(state, source, targetDatasetId) {
86
100
  if (!state.reactor) {
87
101
  throw new Error("dataset_reactor_required");
@@ -115,7 +129,9 @@ export async function materializeSingleFileLikeSource(state, source, targetDatas
115
129
  reactor: state.reactor,
116
130
  sandboxId,
117
131
  });
118
- await parseContext.parse(state.runtime, { durable: state.durable });
132
+ await parseContext.parse(state.runtime, {
133
+ durable: await resolveDatasetAgentDurable(state.durable),
134
+ });
119
135
  if (!state.outputSchema) {
120
136
  await datasetInferAndUpdateSchemaStep({
121
137
  runtime: state.runtime,
@@ -207,7 +223,9 @@ export async function materializeDerivedDataset(state, targetDatasetId) {
207
223
  reactor: stateWithSandbox.reactor,
208
224
  sandboxId,
209
225
  });
210
- await transformContext.transform(stateWithSandbox.runtime, { durable: stateWithSandbox.durable });
226
+ await transformContext.transform(stateWithSandbox.runtime, {
227
+ durable: await resolveDatasetAgentDurable(stateWithSandbox.durable),
228
+ });
211
229
  if (!stateWithSandbox.outputSchema) {
212
230
  await datasetInferAndUpdateSchemaStep({
213
231
  runtime: stateWithSandbox.runtime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekairos/dataset",
3
- "version": "1.22.77-beta.development.0",
3
+ "version": "1.22.78-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.77-beta.development.0",
69
- "@ekairos/events": "^1.22.77-beta.development.0",
70
- "@ekairos/sandbox": "^1.22.77-beta.development.0",
68
+ "@ekairos/domain": "^1.22.78-beta.development.0",
69
+ "@ekairos/events": "^1.22.78-beta.development.0",
70
+ "@ekairos/sandbox": "^1.22.78-beta.development.0",
71
71
  "@instantdb/admin": "0.22.158",
72
72
  "@instantdb/core": "0.22.142",
73
73
  "ai": "^5.0.44",