feat(addons): let the GitHub add-on write, under a per-connection write mode

A connection now has a write mode, chosen on the add-on page: off (the
default), propose (each change waits for the person to confirm) or auto
(a chat of the person makes it at once). The host enforces it for every
write tool of an add-on that holds a credential, before the add-on is
called, and holds the call to the repository list of the connection.

Host:
- Binding.WriteMode, stored in both stores and in the connector API
  (write_mode). Absent means off, so existing bindings stay read only.
- A credentialed add-on may declare write tools. They name the resource
  with the credential slot argument, never resourceId. A tool can set
  approval "always", a ceiling that keeps a proposal even in auto.
- The proposal broker fetches the credential for the preview and again
  for the apply, so it is never stored. A mode lowered between the
  proposal and the confirmation refuses the apply. A proposal that
  awaits a person cannot be confirmed by a chat turn.
- New capability name tools.write for the roles a connector kind
  declares.

Add-on, tools (kind write): comment-issue, comment-pr, create-issue,
edit-issue (title, close or reopen), add-labels, review-comment-pr.
They preview plain facts, refuse a stale target, cap and screen the
text for secrets, and keep a receipt journal plus a hidden marker in the
text, so a change whose answer was lost is not sent twice.

Assisted-by: Claude:claude-sonnet-5-5 go gofmt ginkgo node
This commit is contained in:
Ettore Di Giacinto committed 2026-11-03 14:53:20 +00:00
1 parent b06faab397
commit e790271c63
42 files changed
+2706 -74

No files matched your search

+4 -4
View File
@@ -2,8 +2,8 @@
// Command github is the executable of the GitHub add-on. It reads repositories
// for the chats and the agents with a token that the host keeps for the person
// and hands over with each call. The add-on stores no token and writes nothing
// to GitHub.
// and hands over with each call. The add-on stores no token. It changes GitHub
// only through its write tools, and only as far as the host allows.
package main
import (
@@ -28,8 +28,8 @@ func (r runtime) Connector(ctx context.Context, req contract.ConnectorRequest) (
}
func main() {
os.Exit(protocol.Run(os.Args, func(protocol.Startup) contract.Runtime {
os.Exit(protocol.Run(os.Args, func(st protocol.Startup) contract.Runtime {
api := ghapi.New()
return runtime{Runtime: tools.New(api), platform: platform.Platform{API: api}}
return runtime{Runtime: tools.New(api).WithDataDir(st.DataDir), platform: platform.Platform{API: api}}
}))
}