Skip to content

feat(agents): an Admin's "Publish and send on its own" box on each agent - #1983

Merged
gkhngyk merged 18 commits into
ansvisor:mainfrom
cihan-gyk:feature/agents-go-live-box
Nov 2, 2026
Merged

gkhngyk merged 18 commits into
ansvisor:mainfrom
cihan-gyk:feature/agents-go-live-box

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

AUTONOMOUS-GO-LIVE PR 7: an Admin's "Publish and send on its own" box on each agent (§7.2). Stacked on #1982 (the precedence's step 4b, which reads this permission). No migration: chat_agent_go_live is #1967's (00443). Behind CHAT_AUTO_GO_LIVE: with the flag off, nothing shows and nothing extra is read. The owner approved the screens.

The box (agent form, step 3 "Mode & approvals", under the Approvals table)

  • An Admin lets the agent send pages to the CMS without a click, at most At most a day (1–20, default 5).
  • The box always shows while the flag is on; the owner chose that over showing it only in Full auto. Disabled, it says why:
    • "Needs Growth · you're on {current}";
    • "An Admin hasn't allowed agents to publish on their own in Settings › Chat";
    • "Pick Full auto first".
  • A Manager sees it read-only, with Ask your Admin.
  • Ticked:
    • the Approvals table's "Publish, push, send" row and the summary's Publishing row say "On its own · up to {n} a day" instead of "Needs your click";
    • a limit outside 1–20 stops the save on its step.
  • Editing shows "On · allowed by {name} on {date}", or "Off since the agent changed. An Admin can turn it on again."

Its own request: GET / PUT / DELETE /api/chat/agents/{id}/go-live

  • Never part of the agent's save, so a Manager's edit can't carry it. The form sends it after the create or patch, for the version that save left the agent on.

  • PUT { dailyLimit }, Admins only. It needs:

    • the workspace switch on (go_live_off);
    • Full auto open to agents (the precedence's denial, asked: goLive);
    • the agent in Full auto (go_live_mode);
    • the agent not archived.

    It upserts chat_agent_go_live for the agent's current version: skill_checksums {}, granted_by/granted_at.

  • DELETE takes it away, even while the switch is off.

  • Both are logged as agentGoLiveOn / agentGoLiveOff.

  • GET is for whoever may see the agent.

  • 402 read-only first; refusals as values (fix(prompts): show suggestions' load failures plainly and retry once, instead of React #441 #1777).

  • An edit leaves the permission behind. A new version no longer matches the row's version, so step 4b and the server don't lift anything for it. The row is kept rather than deleted, so the page can say "Off since the agent changed" and who allowed it. An Admin's own edit with the box still ticked gives it again for the new version.

The agent's page and card

  • Badge "Publishes on its own · {n} a day": next to the mode on the page, under the chips on the card. Only while the switch is on and the permission fits the version.

  • Side card "Publishing on its own":

    • status: on with the limit, "Off in Settings › Chat", or off since the agent changed;
    • "Allowed by {name} · {date}" ("A former member" once they've left);
    • the last 24 hours' go-lives (title → CMS, time, "Taken down").

    Take down itself is PR 10.

  • lib/chat/agent-go-live.ts has the reads (switch, permission, recent, the list's limits). agent-go-live-permission.ts has the write; the split avoids an import cycle with agents.ts.

  • Before 00443 (42P01, PGRST205, 42703, PGRST204) the switch reads as hidden.

Words and Help

  • en.json: chatAgents.form.goLive.*, chatAgents.detail.goLive.*, the refusals, asked.goLive, and the Activity summaries.
  • The Ready to Publish preset's description no longer says "Going live stays your click".
  • help/chat/agents.md gets a new section, "Let an agent publish on its own".
  • help/chat/skills.md: a skill "doesn't publish by itself: only an agent an Admin allows may send pages on its own".
  • The box's "covers" line names what v1 covers: CMS drafts to Webflow, WordPress, Framer or Wix. Publishing and webhook sends join it in PRs 9 and 11.

Not here: the notice to the Admin and owner when an edit turns it off needs chat_notices' agent_go_live_off kind (00446). It moves to PR 8 with the other notices.

Related issue

None. AUTONOMOUS-GO-LIVE spec, PR 7.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

Unit tests:

  • agent-form.test.tsx (8 new):
    • no box with the flag off;
    • each disabled reason;
    • ticked: the Approvals row and summary, then POST followed by PUT { dailyLimit: 7 };
    • a bad limit stops the save on step 3;
    • the server's refusal shows on the step, with the draft kept;
    • edit: opens ticked, unticking sends DELETE alone, and a box with the switch off is left as it is;
    • "Off since the agent changed", re-ticked, sends PUT;
    • a Manager gets the read-only box with Ask your Admin.
  • agent-detail.test.tsx (3 new): the badge, the card's states, the recent list, no card when never allowed or with the flag off.
  • agents-list.test.tsx: the card's badge.
  • agent-go-live.test.ts (9):
    • the switch, including hidden before 00443;
    • giving it for the version, the limit, the log, the detail and list;
    • an edit leaves it behind;
    • taking it away;
    • a Manager gets forbidden_role;
    • the switch, Full auto for agents and the agent's mode each refuse it;
    • the last 24 hours, newest first, done and taken down only.
  • route.test.ts: limits 1–20 only (400 otherwise), 404 for a bad id, 402 first, refusals as values, GET.
  • agent-form.test.ts: where a go-live refusal shows.

Manually (CHAT_AGENTIC=true, CHAT_AUTO_GO_LIVE=true, as an Admin):

  1. In Settings › Chat, turn on Agents that publish on their own.
  2. Click New agent → Ready to publish → Mode & approvals → Full auto, tick Publish and send on its own, set 7, then Save as draft.
  3. The agent's page shows the badge and the card. Agent Center's card shows the badge.
  4. Edit it to Auto and save. The page says "Off since the agent changed".

Screenshots (light and dark, 1024 px): attached to the owner's approval.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • yarn lint passes
  • yarn typecheck passes
  • yarn format:check passes
  • Changes are focused — one concern per PR
  • Help article updated under help/ (or no user-visible change)

CI passed on this branch (40a7e68), run on the fork (https://github.com/cihan-gyk/ansvisor/actions/runs/41395031130): schema is up to date; web format:check, lint, typecheck, all tests and yarn build pass; server lint, format:check and all tests pass.

🤖 Generated with Claude Code

cihan-gyk and others added 17 commits November 1, 2026 23:56
…permission

AUTONOMOUS-GO-LIVE PR 1 (migration 00443), with nothing reading it yet:
chat_settings gains the workspace switch (auto_go_live_groups, who turned
it on, when, under which terms); chat_agent_go_live keeps an agent's
permission for the version it was given on, with its daily limit (1-20,
5 unless set); chat_agent_go_live_events keeps each step an agent takes
live on its own, read by brand access. reserve_agent_go_live and
finish_agent_go_live (service role) hold the daily limit under a lock per
agent, once per (draft, target); a failed step frees its slot. Types,
schema.sql, and the brand-access and demo coverage lists follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AUTONOMOUS-GO-LIVE PR 3 (owner's Q1 answer B): pure checks on the page as
it would go out, for a later PR's go-live step. go-live-checks.ts holds a
page with text aimed at AI (in its text or its structured data), hidden
text, 30 words in a row copied from an untrusted read of the run, or a
link to a site that isn't the brand's, a source the draft lists, or a page
a read listed (page-sites linksToSites, sitesOfPages). An agent run now
keeps its untrusted reads as 64-bit hashes of 12-word runs in its
progress, 32 KB at most; past that the check holds the page. A person's
own chat keeps none. Nothing calls the checks yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er session

AUTONOMOUS-GO-LIVE PR 4 (migration 00444). POST
/api/internal/chat/go-live/send (CRON_SECRET) is how the web's engine will
send an agent's page on its own: it checks everything again from the
database (Chat on, Full auto's plan, the Admins' switch, the run running
as the person, the agent's permission for the run's version, the person's
role and the Managers' publishing switch, brand access, not the demo
brand, and the step's own reservation), then sends as a person's Send to
CMS does, with the agent run kept on the delivery
(content_draft_deliveries.agent_run_id). The step is finished done, or
failed with why, which frees its slot; a refusal frees only this step's
own slot. Never retried. v1 takes CMS drafts only. Nothing calls it yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… test's model steps out of a hook-named helper

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…function

AUTONOMOUS-GO-LIVE PR 2a. lib/content/quality-inputs.ts qualityState()
computes E-E-A-T, Trust and Readability and what the editor shows beside
them from the reads the editor holds, so PR 2b's server gate for an agent
going live on its own computes them exactly as the editor does. The
editor's two dozen memos become one call after its reads; nothing on
screen changes. quality-inputs.test.ts keeps the editor's code from before
the move and shows both give the same values for four page types in each
phase, for every read still pending, and with Quality off.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ate, on the run's budget

AUTONOMOUS-GO-LIVE PR 2b-1 (the owner's 2026-11-02 decision). POST
/api/internal/chat/go-live/quality-reads (CRON_SECRET) reads the draft as
saved for the web's gate: its links, and with Quality's phase 2 its
claims, its page read and the kinds of the sites the gate's rules can't
place. A kept read costs nothing; a new one is the agent run's own step
(chat-budget agentRunReserve: feature agent, within the run's cap and the
month's budget), not the workspace's Quality budget. Each read answers on
its own (run_cap, ai_budget, off, failed), so the gate can hold the page
on the one it lacks. The three reads take an optional meter; the page
read's brand context moves to content-page-context.js for both callers.
Nothing calls the endpoint yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AUTONOMOUS-GO-LIVE PR 6. Settings › Chat gets "Agents that publish on
their own", under what Managers may take live: an Admin's switch, off by
default, locked below Growth and while Content Quality is off, read-only
for everyone else. Turning it on asks the Admin to accept the
responsibility text first (its version kept with who and when, 00443);
turning it off needs no dialog. Hidden unless staff turn on
CHAT_AUTO_GO_LIVE for the workspace (autoGoLiveEnabled). Where it shows,
the page's "EXECUTE needs a click" lines say an Admin may let an agent go
live on its own. Help: a new Settings › Chat article, and the "nothing is
published without your click" lines name the exception.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…trust with the draft's reads

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…efore an agent takes it live

AUTONOMOUS-GO-LIVE PR 2b-2. lib/content/go-live-gate.ts goLiveGate()
gathers, with no one's session, every read the Content Editor's scores
take (the draft, its authors, inputs, sources, rules, confirmations, own
images and catalog product; its links, claims, page read, sources' kinds,
brand facts and site trust from the server's go-live reads, made on the
agent run's budget when none is kept) and scores the page with the
editor's own qualityState. It holds the page for a click, with why: with
Content Quality off, placeholders or fields a CMS won't take, suggestions
waiting, a read that couldn't be made, a fact that differs from an
approved one or one stated with none approved, a score under 60 or an
average under 75. A score with nothing to judge is left out, as the
editor's average leaves it.

To read the page as the editor does on the server: the catalog match takes
a client (catalog-match.ts), the editor's StarterKit options and the HTML
block's node schema move to lib (the editor uses the same), and textRanges
and openSpotPlaces move to lib/content/doc-text.ts with pageDoc(), which
parses a page into the editor's document. Nothing calls the gate yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…check the plan themselves

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AUTONOMOUS-GO-LIVE PR 5. Step 4b of the precedence: for an agent run in
Full auto whose agent an Admin allowed for the run's version, on a
workspace whose Admins let agents take publishing live, on Growth and up
and behind CHAT_AUTO_GO_LIVE, the Send to CMS click is lifted once the
guards pass (injection and untrusted start, the page as Send to CMS makes
it, its text and links, a live page, the quality gate, the daily limit).
The engine reserves the agent's slot, sends the checked page through the
API's internal route as the run's person, and logs it as go_live (00445).
A guard that fails, a full limit or a failed send keeps the click card and
says why. Interactive Chat and MCP keep the click; nothing can turn it on
until the Settings switch and the agent's box ship.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AUTONOMOUS-GO-LIVE PR 7. Under the agent form's Approvals table, an Admin
lets the agent send pages to the CMS without a click, at most its daily
limit (1-20, 5 by default), in Full auto, while the workspace's switch is on
in Settings > Chat. The box says why it can't be ticked (the plan, the
switch, the mode); a Manager reads it with Ask your Admin. It is saved as
its own request (GET/PUT/DELETE /api/chat/agents/{id}/go-live, Admins only,
logged), for the version the agent is on, so an edit leaves it behind and
the page says "Off since the agent changed". The Approvals row and the
summary say "On its own · up to {n} a day"; the agent's card and page carry
the badge, and the page lists who allowed it and its last day's go-lives.
Help: agents.md gains the section, skills.md and the Ready to Publish
preset no longer say going live is always a click.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Nov 2, 2026
gkhngyk
gkhngyk previously approved these changes Nov 2, 2026

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

# Conflicts:
#	help/chat/agents.md
#	server/src/lib/brand-access-policies.test.js
#	server/src/middleware/demo-brand.test.js
#	supabase/schema.sql
#	web/messages/en.json
#	web/src/app/[locale]/(dashboard)/dashboard/content/editor/[draftId]/_draft-editor.tsx
#	web/src/lib/chat/agents.ts
#	web/src/lib/chat/engine.test.ts
#	web/src/lib/chat/engine.ts
#	web/src/lib/chat/go-live.ts
#	web/src/lib/chat/precedence-context.ts
#	web/src/lib/chat/precedence.ts
#	web/src/lib/chat/registry/define-tool.ts
#	web/src/lib/chat/write.ts
#	web/src/lib/content/quality-inputs.test.ts
#	web/src/lib/content/quality-inputs.ts
#	web/src/types/supabase.ts
@github-actions github-actions Bot removed the needs-migration Adds or edits a migration — apply it to the hosted database label Nov 2, 2026

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gkhngyk
gkhngyk merged commit aa4cfc6 into ansvisor:main Nov 2, 2026
5 checks passed
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.

2 participants