Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Merge pull request #7378 from Afloat16/fix/rename-workflow-prompt-inputs
milind-soni913b8427c4de
diff --cc shared/skill-burger/draft-view.test.tsindex cc8bdebd47,19ac799a53..ff1e5e6910--- a/shared/skill-burger/draft-view.test.ts+++ b/shared/skill-burger/draft-view.test.ts@@@ -54,24 -54,26 +54,46 @@@ describe("the person's choices", () =>expect(applyChoices(workflow, { inputs: { url: { name: "page" } } })).toEqual({ error: "There is already an input named page." });expect(applyChoices(workflow, { inputs: { url: { name: "9x" } } })).toMatchObject({ error: expect.stringContaining("can't be an input's name") });});++ const boundedFields = [+ { field: "AI prompt", limit: 4_000, token: "{a}", renamed: "{website}", step: (text: string) => ({ kind: "ai", deterministic: false, prompt: text }) },+ { field: "decision prompt", limit: 2_000, token: "{a}", renamed: "{website}", step: (text: string) => ({ kind: "decide", cases: ["yes"], prompt: text }) },+ { field: "check text", limit: 1_000, token: "{a}", renamed: "{website}", step: (text: string) => ({ kind: "shell", run: "echo ok", check: { says: text } }) },+ { field: "shell command", limit: 20_000, token: "$OMB_ARG_A", renamed: "$OMB_ARG_WEBSITE", step: (text: string) => ({ kind: "shell", run: text }) },+ ];++ it.each(boundedFields)("explains a rename that exceeds the $field limit", ({ limit, token, step }) => {+ const original = wf([{ id: "s1", label: "Work", ...step("x".repeat(limit - token.length) + token) }], { a: { default: "value" } });+ const snapshot = structuredClone(original);+ const chosen = applyChoices(original, { inputs: { a: { name: "website" } } });+ expect(chosen).toEqual({ error: `Renaming input names ("a" to "website") makes "Work" exceed its ${limit}-character limit.` });+ expect(original).toEqual(snapshot);+ });++ it.each(boundedFields)("accepts a rename that exactly reaches the $field limit", ({ limit, token, renamed, step }) => {+ const original = wf([{ id: "s1", label: "Work", ...step("x".repeat(limit - renamed.length) + token) }], { a: { default: "value" } });+ const chosen = applyChoices(original, { inputs: { a: { name: "website" } } });+ expect(workflowSchema.safeParse(chosen).success).toBe(true);+ expect(JSON.stringify(chosen)).toContain(renamed);+ });});++describe("dependencies inside app record IDs", () => {+ const workflow = wf([+ { id: "s1", kind: "app", app: "airtable", tool: "AIRTABLE_LIST_RECORDS", label: "Find records", args: {} },+ { id: "s2", kind: "app", app: "airtable", tool: "AIRTABLE_UPDATE_MULTIPLE_RECORDS", label: "Update records", args: { records: [{ id: { $step: "s1", path: "records.0.id" }, fields: { Reviewed: true } }] } },+ { id: "s3", kind: "file", label: "Write receipt", path: "receipt.txt", content: { $step: "s2" } },+ { id: "s4", kind: "file", label: "Keep notes", path: "notes.txt", content: "Notes" },+ ], {});++ it("connects the card's dependent steps through a reference under id", () => {+ const view = draftView(workflow, [], []);+ expect(view.steps[1]!.needs).toEqual(["s1"]);+ expect(dependents(view.steps, "s1")).toEqual(["s2", "s3"]);+ });++ it("refuses an update without its lookup, and allows leaving the entire dependent chain out", () => {+ expect(applyChoices(workflow, { skip: ["s1"] })).toEqual({ error: '"Update records" uses what "Find records" returns; leave both out or keep both.' });+ expect(applyChoices(workflow, { skip: ["s1", "s2", "s3"] })).toMatchObject({ steps: [{ id: "s4" }] });+ });+});