Repository navigation
Add portable BotMRR Markdown playbooks #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d565c2d
Add portable BotMRR package installs
milind-soni 7269382
Keep package link tests out of Vitest discovery
milind-soni e4759b1
Add universal BotMRR Markdown imports
milind-soni c446c91
Merge remote-tracking branch 'origin/main' into codex/botmrr-packages
milind-soni dfc3c26
Merge remote-tracking branch 'origin/main' into codex/botmrr-packages
milind-soni 06a0531
Merge remote-tracking branch 'origin/main' into codex/botmrr-packages
milind-soni 6550da6
Document portable team playbooks
milind-soni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| const ALLOWED_PACKAGE_HOSTS = new Set(["github.com", "www.github.com", "raw.githubusercontent.com"]); | ||
|
|
||
| export function packageUrlFromDeepLink(rawValue) { | ||
| let link; | ||
| try { | ||
| link = new URL(String(rawValue)); | ||
| } catch { | ||
| return null; | ||
| } | ||
| if (link.protocol !== "openmausbot:" || link.hostname !== "install") return null; | ||
| const rawPackage = link.searchParams.get("url"); | ||
| if (!rawPackage) return null; | ||
| let packageUrl; | ||
| try { | ||
| packageUrl = new URL(rawPackage); | ||
| } catch { | ||
| return null; | ||
| } | ||
| if ( | ||
| packageUrl.protocol !== "https:" || | ||
| packageUrl.username || | ||
| packageUrl.password || | ||
| packageUrl.port || | ||
| !ALLOWED_PACKAGE_HOSTS.has(packageUrl.hostname) || | ||
| !packageUrl.pathname.endsWith(".json") | ||
| ) return null; | ||
| return packageUrl.toString(); | ||
| } | ||
|
|
||
| export function packageUrlFromCommandLine(argv) { | ||
| for (const value of argv) { | ||
| const parsed = packageUrlFromDeepLink(value); | ||
| if (parsed) return parsed; | ||
| } | ||
| return null; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import assert from "node:assert/strict"; | ||
| import { describe, it } from "node:test"; | ||
|
|
||
| import { packageUrlFromCommandLine, packageUrlFromDeepLink } from "./package-link.mjs"; | ||
|
|
||
| describe("BotMRR package deep links", () => { | ||
| it("accepts a public GitHub package URL", () => { | ||
| const target = "https://raw.githubusercontent.com/acme/bots/main/package.mauspack.json"; | ||
| assert.equal(packageUrlFromDeepLink(`openmausbot://install?url=${encodeURIComponent(target)}`), target); | ||
| assert.equal(packageUrlFromCommandLine(["OpenMausBot", "--flag", `openmausbot://install?url=${encodeURIComponent(target)}`]), target); | ||
| }); | ||
|
|
||
| it("rejects other commands, hosts, protocols, credentials, and non-JSON files", () => { | ||
| assert.equal(packageUrlFromDeepLink("openmausbot://settings"), null); | ||
| assert.equal(packageUrlFromDeepLink("openmausbot://install?url=https://evil.example/bot.json"), null); | ||
| assert.equal(packageUrlFromDeepLink("openmausbot://install?url=http://raw.githubusercontent.com/a/b/main/bot.json"), null); | ||
| assert.equal(packageUrlFromDeepLink("openmausbot://install?url=https://user@example.com/bot.json"), null); | ||
| assert.equal(packageUrlFromDeepLink("openmausbot://install?url=https://github.com/acme/bot/run.sh"), null); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| import { packageAgentAsMember, parseBotPackage } from "./bot-package.ts"; | ||
|
|
||
| const validPackage: any = { | ||
| format: "openmaus.package", | ||
| version: 1, | ||
| package: { | ||
| id: "research-desk", | ||
| release: "1.0.0", | ||
| name: "Research Desk", | ||
| tagline: "Turn a question into a sourced brief.", | ||
| summary: "A small research team.", | ||
| category: "Research", | ||
| author: { name: "OpenMausBot" }, | ||
| license: "MIT", | ||
| outcomes: ["Produce a sourced brief."], | ||
| setupMinutes: 3, | ||
| requirements: { apps: [], capabilities: [] }, | ||
| agents: [ | ||
| { | ||
| key: "lead", | ||
| name: "Ada", | ||
| title: "Research Lead", | ||
| description: "Own the brief.", | ||
| appearance: { color: "purple" }, | ||
| playbooks: ["source-check"], | ||
| autoApprove: true, | ||
| }, | ||
| ], | ||
| chiefOfStaff: "lead", | ||
| rooms: [ | ||
| { | ||
| key: "desk", | ||
| name: "Research Desk", | ||
| members: ["lead"], | ||
| bulletin: "Cite sources.", | ||
| defaultResponder: { kind: "agent", agent: "lead" }, | ||
| }, | ||
| ], | ||
| playbooks: [ | ||
| { | ||
| key: "source-check", | ||
| name: "Source Check", | ||
| summary: "Verify sources.", | ||
| triggers: ["research brief"], | ||
| instructions: "Separate facts from inference.", | ||
| }, | ||
| ], | ||
| }, | ||
| }; | ||
|
|
||
| describe("bot packages", () => { | ||
| it("parses the complete portable structure and strips authority fields", () => { | ||
| const parsed = parseBotPackage(validPackage); | ||
| expect(parsed.package.rooms![0]?.defaultResponder).toEqual({ kind: "agent", agent: "lead" }); | ||
| expect(parsed.package.agents[0]).not.toHaveProperty("autoApprove"); | ||
| expect(packageAgentAsMember(parsed.package.agents[0]!)).toEqual({ | ||
| key: "lead", | ||
| name: "Ada", | ||
| title: "Research Lead", | ||
| description: "Own the brief.", | ||
| appearance: { color: "purple" }, | ||
| }); | ||
| }); | ||
|
|
||
| it("rejects dangling agent, room, playbook, chief, and routine references", () => { | ||
| expect(() => parseBotPackage({ | ||
| ...validPackage, | ||
| package: { ...validPackage.package, chiefOfStaff: "missing" }, | ||
| })).toThrow("Unknown Chief of Staff"); | ||
| expect(() => parseBotPackage({ | ||
| ...validPackage, | ||
| package: { | ||
| ...validPackage.package, | ||
| agents: [{ ...validPackage.package.agents[0], playbooks: ["missing"] }], | ||
| }, | ||
| })).toThrow("unknown playbook"); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve every pending package installation URL.
Both processes store only one pending URL. If two valid deep links arrive before
did-finish-loador before the Sidebar callback registers, the later URL overwrites the earlier URL. The first installation request is then lost.Use FIFO queues in the main process and preload bridge. Drain URLs in order after the renderer and callback are ready. Remove each URL after delivery. Add coverage for two startup or second-instance links.
electron/main.mjs#L43-L43: Initialize a pending URL queue.electron/main.mjs#L56-L69: Deliver all queued URLs in order.electron/main.mjs#L78-L83: Append second-instance URLs instead of replacing a queued URL.electron/main.mjs#L582-L582: Flush the complete queue after page load.electron/preload.cjs#L5-L11: Buffer all IPC URLs until a listener exists.electron/preload.cjs#L111-L115: Drain buffered URLs once and prevent stale replay to later subscribers.📍 Affects 2 files
electron/main.mjs#L43-L43(this comment)electron/main.mjs#L56-L69electron/main.mjs#L78-L83electron/main.mjs#L582-L582electron/preload.cjs#L5-L11electron/preload.cjs#L111-L115🤖 Prompt for AI Agents