@flowriki/agent 0.1.0-beta.32 → 0.1.0-beta.33

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.
@@ -6,7 +6,7 @@ import os from "os";
6
6
  import path from "path";
7
7
  import { createRequire } from "module";
8
8
  import { spawnSync } from "child_process";
9
- var AGENT_VERSION = "0.1.0-beta.32";
9
+ var AGENT_VERSION = "0.1.0-beta.33";
10
10
  async function prepareBrowsers() {
11
11
  if (browsersReady()) {
12
12
  return { ok: true, already: true, message: "chromium is already installed" };
package/dist/cli.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  runtimeValue,
22
22
  start,
23
23
  status
24
- } from "./chunk-4EYN6N5Q.js";
24
+ } from "./chunk-3UUCI66O.js";
25
25
 
26
26
  // src/cli.ts
27
27
  import { parseArgs } from "util";
@@ -154,6 +154,20 @@ var ServiceClient = class {
154
154
  body: JSON.stringify({ steps, ...signIn ? { signIn } : {} })
155
155
  });
156
156
  }
157
+ /** This person's open branches that Claude wrote on this project. */
158
+ agentChanges(projectId) {
159
+ return this.call(
160
+ `/api/agent/changes?projectId=${encodeURIComponent(projectId)}`
161
+ );
162
+ }
163
+ /** Delete one — refused by the service unless it is all Claude's own,
164
+ * unedited, unpublished work. */
165
+ discardChange(projectId, changeId) {
166
+ return this.call(
167
+ `/api/agent/changes/${encodeURIComponent(changeId)}?projectId=${encodeURIComponent(projectId)}`,
168
+ { method: "DELETE" }
169
+ );
170
+ }
157
171
  saveFlow(projectId, title, flow) {
158
172
  return this.call(
159
173
  `/api/agent/flows?projectId=${encodeURIComponent(projectId)}`,
@@ -473,8 +487,11 @@ ${lines.join("\n")}`;
473
487
  ...draft.signIn ? { signIn: draft.signIn } : {}
474
488
  });
475
489
  const review = `${this.service.origin}/projects/${draft.projectId}/changes/${saved.changeId}`;
490
+ const others = await this.service.agentChanges(draft.projectId).then((r) => r.changes.filter((c) => c.id !== saved.changeId)).catch(() => []);
491
+ const note = others.length ? `
492
+ Claude also has ${others.length} other open branch${others.length === 1 ? "" : "es"} on this project \u2014 list_my_branches shows them, if one is now superseded.` : "";
476
493
  return `Saved "${draft.name}" on a new branch, ${saved.branch}. Nothing is published yet.
477
- Review and publish it here: ${review}`;
494
+ Review and publish it here: ${review}${note}`;
478
495
  }
479
496
  async close() {
480
497
  const run = this.run;
@@ -521,6 +538,10 @@ How to write a good Flowriki test:
521
538
  7. Before saving, call replay_flow to run the whole flow from the start. If a
522
539
  step fails there, fix it (remove_step, act again) and replay again.
523
540
  8. Save with save_flow and give the person the review link it returns.
541
+ 9. Redoing a flow? Each save is a new branch, so clear the superseded one with
542
+ list_my_branches and discard_branch \u2014 only after the person asks for it, or
543
+ agrees, because it deletes the branch. Only Claude's own unedited branches
544
+ can go this way; anything a person touched is theirs to delete.
524
545
  Test data you invent (a new user's email or password for a sign-up) is fine to
525
546
  type. For anything that must be NEW on every run \u2014 a sign-up's email or
526
547
  username \u2014 use {{unique}}: it is different on every run and the same within
@@ -766,6 +787,37 @@ ${page}`);
766
787
  inputSchema: { type: "object", properties: { title: { type: "string", description: "The branch's title \u2014 what this change adds." } }, additionalProperties: false },
767
788
  run: async (args) => text(await session.save(str(args["title"])))
768
789
  },
790
+ {
791
+ name: "list_my_branches",
792
+ title: "List Claude's open branches",
793
+ description: "The project's open, unpublished branches that Claude wrote for this person, newest first, with review links. Use it to find a superseded branch to discard.",
794
+ inputSchema: { type: "object", properties: { projectId: { type: "string", description: "Optional when you are on one project." } }, additionalProperties: false },
795
+ annotations: { readOnlyHint: true },
796
+ run: async (args) => {
797
+ const projectId = await projectFor(args["projectId"]);
798
+ const { changes } = await service.agentChanges(projectId);
799
+ if (!changes.length) return text("Claude has no open branches on this project.");
800
+ return text(changes.map((c) => `- ${c.id} \u2014 "${c.title}" (${new Date(c.createdAt).toISOString().slice(0, 16).replace("T", " ")}) ${service.origin}${c.path}`).join("\n"));
801
+ }
802
+ },
803
+ {
804
+ name: "discard_branch",
805
+ title: "Delete one of Claude's branches",
806
+ description: "Delete an open branch Claude wrote, with the flows on it \u2014 e.g. one a redo replaced. Only after the person asked for it or agreed. Refused for a branch a person started, edited, or published; those are deleted in the dashboard.",
807
+ inputSchema: {
808
+ type: "object",
809
+ properties: { changeId: { type: "string", description: "The branch's id from list_my_branches (chg_\u2026)." }, projectId: { type: "string" } },
810
+ required: ["changeId"],
811
+ additionalProperties: false
812
+ },
813
+ annotations: { destructiveHint: true },
814
+ run: async (args) => {
815
+ const projectId = await projectFor(args["projectId"]);
816
+ const changeId = str(args["changeId"]) ?? "";
817
+ const { deleted } = await service.discardChange(projectId, changeId);
818
+ return text(`Deleted ${changeId} and its branch ${deleted}.`);
819
+ }
820
+ },
769
821
  {
770
822
  name: "close_browser",
771
823
  title: "Close the browser",
package/dist/engine.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolveCheckouts,
10
10
  start,
11
11
  status
12
- } from "./chunk-4EYN6N5Q.js";
12
+ } from "./chunk-3UUCI66O.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.32",
3
+ "version": "0.1.0-beta.33",
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",