Skip to content

Let users request a new source type from the New inbox form - #66

Merged
mcwhittemore merged 3 commits into
mainfrom
worktree-issue-53-request-source
Oct 9, 2026
Merged

mcwhittemore merged 3 commits into
mainfrom
worktree-issue-53-request-source

Conversation

@loopway-bot

@loopway-bot loopway-bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #53

Adds a way to ask for a source type loopway doesn't have yet. It uses the loopway source from #54: the server posts the request to a craftmill loopway inbox through its webhook, with that inbox's token.

What changed

  • POST /sources/requests {description} (signed-in users). Posts {type: "source.requested", id: <new uuid>, data: {description, user: {id}}} to the inbox set by SOURCE_REQUEST_URL and SOURCE_REQUEST_TOKEN. It answers 202, 404 if the deployment doesn't set them, and 502 if the inbox refuses the message.
  • GET /sources now also returns can_request, so the frontend knows whether this deployment takes requests. Only craftmill's deployment sets the env vars, so self-hosted copies never show the option. The server does the posting, so the inbox token never reaches the browser.
  • New inbox form: when can_request is true, the Source list ends with "Something else…". Picking it swaps the form for a "Which webhook do you want?" field and a "Request it" button.
  • docs/api.md, docs/developing.md and .env.example document the endpoint and env vars.

Defaults I picked where the questions on #53 weren't answered:

  • Each request gets its own message id, so each one is its own thread.
  • The message carries only the requester's user id, not their name or email. The id is enough to look them up if the process ever needs to.
  • This PR doesn't open GitHub issues. That's the job of a bot reading the inbox (see below).

Deploy steps

  1. I created the inbox on loopway.craftmill.dev under matthew@craftmill.dev: source-requests (01a11e88-c5c0-7146-9f9c-cba5a4e488ca). It's a loopway source that accepts only source.requested, with a schema requiring data.description and data.user.id.
  2. In Vercel, set:
    • SOURCE_REQUEST_URL=https://loopway.craftmill.dev/webhooks/01a11e88-c5c0-7146-9f9c-cba5a4e488ca
    • SOURCE_REQUEST_TOKEN=<the inbox token>: run loopway inbox show source-requests. I've left it out of this PR on purpose.
  3. To turn requests into issues, attach a bot to the inbox, e.g. loopway bots update loopway-dev --inbox craftmill/loopway,source-requests. Today's github-threads kind routes by owner/repo#N, so each request would start a new session with thread.md, which isn't written for this. A dedicated bot kind or prompt would be a follow-up.

No migrations.

Testing

  • npm run typecheck, npm run lint and npm run format:check pass. Web tests pass (49).
  • New API tests: a request lands in a loopway inbox as a source.requested CloudEvent; the feature is off without config (can_request: false, 404); a refused post gives 502.
  • CLI tests (untouched by this PR) are flaky: 2 of 5 runs had one failure each, a different timing test each time (events list, threads --max), and the other three runs passed.

🤖 Generated with Claude Code

Where SOURCE_REQUEST_URL and SOURCE_REQUEST_TOKEN are set, the Source list
ends with "Something else…". Submitting it calls POST /sources/requests,
which posts a source.requested message to that loopway inbox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
loopway Ready Ready Preview Oct 9, 2026 2:55am UTC

Request Review

Comment thread packages/web/src/api.ts Resolved
@mcwhittemore

Copy link
Copy Markdown
Collaborator

readme conflict needs to be resolved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@loopway-bot

Copy link
Copy Markdown
Contributor Author

Resolved: I merged main in. #65 split the README, so the source-request docs now live in docs/api.md (the GET /sources and POST /sources/requests rows) and docs/developing.md (the env vars and the dashboard). Typecheck, lint and the web tests pass.

@mcwhittemore
mcwhittemore merged commit 39a3102 into main Oct 9, 2026
3 checks passed
@mcwhittemore
mcwhittemore deleted the worktree-issue-53-request-source branch October 9, 2026 03:02
@mcwhittemore

Copy link
Copy Markdown
Collaborator
image

@mcwhittemore

Copy link
Copy Markdown
Collaborator

finish clean up

This branch was previously deployed

1 inactive deployment
Preview — 53243f00 Deployed Oct 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add a request webhook type to the new inbox page

2 participants