@withone/cli 1.47.1 → 1.47.2
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.
|
@@ -1279,7 +1279,7 @@ async function executeSubflowStep(step, context, api, permissions, allowedAction
|
|
|
1279
1279
|
if (flowStack.includes(resolvedKey)) {
|
|
1280
1280
|
throw new Error(`Circular flow detected: ${[...flowStack, resolvedKey].join(" \u2192 ")}`);
|
|
1281
1281
|
}
|
|
1282
|
-
const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-
|
|
1282
|
+
const { loadFlowWithMeta: loadFlowWithMeta2 } = await import("./flow-runner-V5FALC6N.js");
|
|
1283
1283
|
const { flow: subFlow, rootDir: subRootDir } = loadFlowWithMeta2(resolvedKey);
|
|
1284
1284
|
const subContext = await executeFlow(
|
|
1285
1285
|
subFlow,
|
|
@@ -2563,6 +2563,9 @@ function ensureDir(dir) {
|
|
|
2563
2563
|
function generateRunId() {
|
|
2564
2564
|
return crypto.randomBytes(6).toString("hex");
|
|
2565
2565
|
}
|
|
2566
|
+
function stripStepsAlias(key, value) {
|
|
2567
|
+
return key === "_steps" ? void 0 : value;
|
|
2568
|
+
}
|
|
2566
2569
|
var FlowRunner = class _FlowRunner {
|
|
2567
2570
|
runId;
|
|
2568
2571
|
flowKey;
|
|
@@ -2620,7 +2623,7 @@ var FlowRunner = class _FlowRunner {
|
|
|
2620
2623
|
fs3.appendFileSync(this.logPath, JSON.stringify(entry) + "\n");
|
|
2621
2624
|
}
|
|
2622
2625
|
saveState() {
|
|
2623
|
-
fs3.writeFileSync(this.statePath, JSON.stringify(this.state,
|
|
2626
|
+
fs3.writeFileSync(this.statePath, JSON.stringify(this.state, stripStepsAlias, 2));
|
|
2624
2627
|
}
|
|
2625
2628
|
createEventHandler(externalHandler) {
|
|
2626
2629
|
return (event) => {
|
|
@@ -2946,6 +2949,7 @@ export {
|
|
|
2946
2949
|
getStepTypeDescriptor,
|
|
2947
2950
|
getNestedStepsKeys,
|
|
2948
2951
|
generateFlowGuide,
|
|
2952
|
+
stripStepsAlias,
|
|
2949
2953
|
FlowRunner,
|
|
2950
2954
|
resolveFlowPath,
|
|
2951
2955
|
getFlowRootDir,
|
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
loadFlowWithMeta,
|
|
10
10
|
resolveFlowPath,
|
|
11
11
|
saveFlow,
|
|
12
|
+
stripStepsAlias,
|
|
12
13
|
summarizeFlowInputs,
|
|
13
14
|
walkSteps
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-DMLYQFMV.js";
|
|
15
16
|
import "./chunk-44CV5IMX.js";
|
|
16
17
|
import "./chunk-K6MWE2ZH.js";
|
|
17
18
|
export {
|
|
@@ -25,6 +26,7 @@ export {
|
|
|
25
26
|
loadFlowWithMeta,
|
|
26
27
|
resolveFlowPath,
|
|
27
28
|
saveFlow,
|
|
29
|
+
stripStepsAlias,
|
|
28
30
|
summarizeFlowInputs,
|
|
29
31
|
walkSteps
|
|
30
32
|
};
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
searchCachePath,
|
|
31
31
|
validateActionInput,
|
|
32
32
|
writeCache
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-DMLYQFMV.js";
|
|
34
34
|
import {
|
|
35
35
|
memSqlCommand
|
|
36
36
|
} from "./chunk-QV3Y5N5G.js";
|
|
@@ -8961,40 +8961,45 @@ ${pc10.dim(line)}`);
|
|
|
8961
8961
|
|
|
8962
8962
|
// src/commands/mem/export.ts
|
|
8963
8963
|
import fs11 from "fs";
|
|
8964
|
+
import { once } from "events";
|
|
8965
|
+
async function writeLine(stream, line) {
|
|
8966
|
+
if (!stream.write(line)) {
|
|
8967
|
+
await once(stream, "drain");
|
|
8968
|
+
}
|
|
8969
|
+
}
|
|
8964
8970
|
async function memExportCommand(outfile) {
|
|
8965
8971
|
requireMemoryInit();
|
|
8966
8972
|
const backend = await getBackend();
|
|
8967
8973
|
const stats = await backend.stats();
|
|
8974
|
+
const toFile = !!outfile && outfile !== "-";
|
|
8975
|
+
const stream = toFile ? fs11.createWriteStream(outfile, "utf-8") : process.stdout;
|
|
8968
8976
|
const all = await listAllTypes(backend);
|
|
8969
|
-
const
|
|
8977
|
+
const pageSize = 500;
|
|
8978
|
+
let written = 0;
|
|
8970
8979
|
for (const type of all) {
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
records.push(...page);
|
|
8983
|
-
if (page.length < pageSize) break;
|
|
8984
|
-
offset += pageSize;
|
|
8985
|
-
}
|
|
8986
|
-
}
|
|
8987
|
-
const lines = records.map((r) => JSON.stringify(r)).join("\n") + "\n";
|
|
8988
|
-
if (!outfile || outfile === "-") {
|
|
8989
|
-
process.stdout.write(lines);
|
|
8990
|
-
if (!isAgentMode()) {
|
|
8991
|
-
process.stderr.write(`Exported ${records.length} records (${stats.recordCount} total in store).
|
|
8992
|
-
`);
|
|
8980
|
+
for (const status of ["active", "archived"]) {
|
|
8981
|
+
let offset = 0;
|
|
8982
|
+
while (true) {
|
|
8983
|
+
const page = await backend.list(type, { limit: pageSize, offset, status });
|
|
8984
|
+
for (const r of page) {
|
|
8985
|
+
await writeLine(stream, JSON.stringify(r) + "\n");
|
|
8986
|
+
written++;
|
|
8987
|
+
}
|
|
8988
|
+
if (page.length < pageSize) break;
|
|
8989
|
+
offset += pageSize;
|
|
8990
|
+
}
|
|
8993
8991
|
}
|
|
8992
|
+
}
|
|
8993
|
+
if (toFile) {
|
|
8994
|
+
stream.end();
|
|
8995
|
+
await once(stream, "finish");
|
|
8996
|
+
okJson({ status: "ok", file: outfile, recordsWritten: written, storeTotal: stats.recordCount });
|
|
8994
8997
|
return;
|
|
8995
8998
|
}
|
|
8996
|
-
|
|
8997
|
-
|
|
8999
|
+
if (!isAgentMode()) {
|
|
9000
|
+
process.stderr.write(`Exported ${written} records (${stats.recordCount} total in store).
|
|
9001
|
+
`);
|
|
9002
|
+
}
|
|
8998
9003
|
}
|
|
8999
9004
|
async function memImportCommand(file) {
|
|
9000
9005
|
requireMemoryInit();
|
|
@@ -9873,7 +9878,8 @@ one --agent mem reindex # re-embed records under current model
|
|
|
9873
9878
|
## Admin
|
|
9874
9879
|
|
|
9875
9880
|
\`\`\`bash
|
|
9876
|
-
one --agent mem export records.jsonl
|
|
9881
|
+
one --agent mem export records.jsonl # streamed JSONL \u2014 memory-safe on large stores
|
|
9882
|
+
one --agent mem export - # stream to stdout
|
|
9877
9883
|
one --agent mem import records.jsonl # idempotent via keys[]
|
|
9878
9884
|
one --agent mem migrate --dry-run # preview legacy .db \u2192 memory
|
|
9879
9885
|
one --agent mem migrate --cleanup -y # migrate + delete .db files
|