@flowriki/agent 0.1.0-beta.7 → 0.1.0-beta.8

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.
@@ -5838,11 +5838,25 @@ var DebugCoordinator = class {
5838
5838
  const steps = await session.finish();
5839
5839
  const flow = this.deps.store.getFlow(flowId);
5840
5840
  if (!flow) return { ok: false, error: "flow not found" };
5841
- this.deps.store.extractSecrets(flow.slug, steps);
5841
+ if (this.deps.commit.to === "caller") {
5842
+ const { scratch } = this.deps.commit;
5843
+ const before = scratch.readSecrets();
5844
+ scratch.extractSecrets(flow.slug, steps);
5845
+ const after = scratch.readSecrets();
5846
+ const captured = {};
5847
+ for (const [ref, value] of Object.entries(after)) {
5848
+ if (before[ref] !== value) captured[ref] = value;
5849
+ }
5850
+ const updated2 = { ...flow, steps, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
5851
+ this.deps.emit({ type: "debug.ended", flowId, committed: true });
5852
+ return { ok: true, committed: true, flow: updated2, secrets: captured };
5853
+ }
5854
+ const { store } = this.deps.commit;
5855
+ store.extractSecrets(flow.slug, steps);
5842
5856
  const updated = { ...flow, steps, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
5843
- this.deps.store.saveFlow(updated);
5857
+ store.saveFlow(updated);
5844
5858
  this.deps.emit({ type: "debug.ended", flowId, committed: true });
5845
- return { ok: true, committed: true, flow: { ...updated, path: this.deps.store.relPath(updated) } };
5859
+ return { ok: true, committed: true, flow: { ...updated, path: store.relPath(updated) } };
5846
5860
  } finally {
5847
5861
  this.deps.lease?.release("debug");
5848
5862
  }
@@ -6935,14 +6949,23 @@ function buildHandlers(deps) {
6935
6949
  // The browser opens on this machine and the panel lives inside that window,
6936
6950
  // so whoever is at the keyboard sees the same state the dashboard does.
6937
6951
  "debug.start": async (command, project) => {
6938
- if (!project.root) return NO_CHECKOUT;
6952
+ const carried = command.args["flow"];
6953
+ if (!carried && !project.root) return NO_CHECKOUT;
6939
6954
  if (!debugging) {
6940
6955
  return { ok: false, reason: "failed", detail: "this agent cannot debug \u2014 no browser is configured" };
6941
6956
  }
6942
6957
  try {
6943
6958
  const started = await debugging.start(String(command.args["flowId"] ?? ""), {
6944
6959
  ...command.args["breakpoints"] ? { breakpoints: command.args["breakpoints"] } : {},
6945
- ...command.args["watch"] === void 0 ? {} : { watch: Boolean(command.args["watch"]) }
6960
+ ...command.args["watch"] === void 0 ? {} : { watch: Boolean(command.args["watch"]) },
6961
+ ...carried ? {
6962
+ delivered: {
6963
+ flow: carried,
6964
+ secrets: command.args["secrets"] ?? {},
6965
+ config: command.args["config"] ?? {},
6966
+ scratchRoot: scratchRoot(project.id)
6967
+ }
6968
+ } : {}
6946
6969
  });
6947
6970
  onActivity?.({ kind: "debugging", projectId: project.id, detail: started.flowId });
6948
6971
  return { ok: true, result: started };
@@ -7253,8 +7276,10 @@ function createAgentRuntime(options) {
7253
7276
  const debuggerFor = (projectRoot) => {
7254
7277
  let existing = debuggers.get(projectRoot);
7255
7278
  if (!existing) {
7279
+ const store = new Store(projectRoot);
7256
7280
  existing = new DebugCoordinator({
7257
- store: new Store(projectRoot),
7281
+ store,
7282
+ commit: { to: "disk", store },
7258
7283
  emit: (event) => {
7259
7284
  journal?.append({ name: `debug.${event.type.replace(/^debug\./, "")}`, data: event });
7260
7285
  }
@@ -7263,10 +7288,24 @@ function createAgentRuntime(options) {
7263
7288
  }
7264
7289
  return existing;
7265
7290
  };
7291
+ const deliveredDebugger = (delivered) => new DebugCoordinator({
7292
+ store: deliveredRun({
7293
+ flow: delivered.flow,
7294
+ secrets: delivered.secrets,
7295
+ config: delivered.config
7296
+ }),
7297
+ // Handed back rather than written, and redacted on the way out through
7298
+ // a scratch store — somewhere for extraction to put a password typed
7299
+ // during the session, so it does not travel inside the document.
7300
+ commit: { to: "caller", scratch: new Store(delivered.scratchRoot) },
7301
+ emit: (event) => {
7302
+ journal?.append({ name: `debug.${event.type.replace(/^debug\./, "")}`, data: event });
7303
+ }
7304
+ });
7266
7305
  const debugControl = {
7267
7306
  start: async (flowId, opts) => {
7268
7307
  if (debuggingIn?.active()) throw new Error("a debug session is already running on this machine");
7269
- const coordinator = debuggerFor(options.projects[0].root);
7308
+ const coordinator = opts.delivered ? deliveredDebugger(opts.delivered) : debuggerFor(options.projects[0].root);
7270
7309
  const started = await coordinator.start(flowId, opts);
7271
7310
  debuggingIn = coordinator;
7272
7311
  return started;
@@ -7557,7 +7596,7 @@ function openBrowser(url, env = process.env) {
7557
7596
  }
7558
7597
 
7559
7598
  // src/engine.ts
7560
- var AGENT_VERSION = "0.1.0-beta.7";
7599
+ var AGENT_VERSION = "0.1.0-beta.8";
7561
7600
  async function connect(options = {}) {
7562
7601
  let service;
7563
7602
  try {
package/dist/cli.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  resolveCheckouts,
9
9
  start,
10
10
  status
11
- } from "./chunk-RNHUFS2Q.js";
11
+ } from "./chunk-VN4KB4YX.js";
12
12
 
13
13
  // src/cli.ts
14
14
  import { parseArgs } from "util";
package/dist/engine.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolveCheckouts,
10
10
  start,
11
11
  status
12
- } from "./chunk-RNHUFS2Q.js";
12
+ } from "./chunk-VN4KB4YX.js";
13
13
  export {
14
14
  AGENT_VERSION,
15
15
  browsersReady,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowriki/agent",
3
- "version": "0.1.0-beta.7",
3
+ "version": "0.1.0-beta.8",
4
4
  "description": "Run Flowriki UI tests on your own computer. Connects this machine to your Flowriki account.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",