oficina / equipo Public

Instance inventory confirmed by an owner

Task 3.1b (MCP plan Task 7): EQUIPO_INSTANCE_PREFIXES lists the network
the instance is on; the instance scans its own interfaces at start and
hourly; each change asks every owner once, on an instance_inventory
card that shows the prefixes and the addresses seen. Ready only once
every listed prefix is confirmed and every address seen is inside one;
Inside covers the prefixes and the addresses seen. Migration 0116.
Copy: services.inventory.question and .confirm, approved 2026-11-28,
with the lookups' activity and fallback lines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 50e55ad87ca7a00c459f2090535cfdc4b704cfff parent 3d86a82
15 files changed, +624 −3
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +4 −0
  • internal/equipo/app.go +19 −0
  • internal/equipo/chat/instance_inventory.go +395 −0
  • internal/equipo/chat/instance_inventory_test.go +149 −0
  • internal/equipo/chat/models.go +1 −1
  • internal/equipo/chat/projects.go +12 −0
  • internal/equipo/chat/store.go +5 −0
  • internal/equipo/chat_page.go +4 −0
  • internal/equipo/config.go +10 −0
  • internal/equipo/copy.go +8 −0
  • internal/equipo/migrations/0116_instance_inventory.sql +7 −0
  • internal/equipo/migrations/schema.sql +3 −0
  • internal/equipo/templates/chat.html +1 −1
  • internal/plan3test/plan3_release_test.go +1 −1
  • internal/wire/research_result.go +5 −0
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 30ec4c73..5f9dd2ee 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -4769,6 +4769,10 @@ All eight entries have individual `COPY REVIEW REQUIRED` markers. The API guide
| `assistant.job.detail.go_live_off` | Putting it live is turned off for you. %s can turn it on. | Assistant abilities: a ready job while putting live is off | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) |
| `chat.card.ability_off` | Building is turned off for you, so this can't start. You can still drop it. | Assistant abilities: a job card answered in Equipo while building is off | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) |
| `oficina.connect.ability_off` | Reading your Oficina apps is turned off for you. %s can turn it on. | Assistant abilities: connecting Oficina refused | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) |
+| `services.inventory.question` | Before your assistant can look things up on the web or reach other services, confirm the network this server is on. | Lookups: the owners' instance_inventory card, above the prefixes and addresses | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) |
+| `services.inventory.confirm` | Confirm | Lookups: the instance_inventory card's button | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) |
+| `assistant.activity.lookup` | Looking that up | Lookups: the reply's activity line while a lookup runs | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) |
+| `assistant.lookup.fallback_sources` | Sources: | Lookups: the sources line in the plain-text fallback for a client that can't draw answers | COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged) |
| `api.host_unverified` | Equipo is not set up to connect to this address. | Assistant abilities: PUT host's token not honoured by Base (Base reads it only); reuses `api.host_not_allowed`'s words | COPY APPROVED (Paul, 2026-11-13, copy-review jbltdd2mvwblrz4en6xfhv6d2y, unchanged) |
| `api.host_elsewhere` | Equipo is not set up to connect to this address. | Assistant abilities: the person's Base is another (Base reads it only); reuses `api.host_not_allowed`'s words | COPY APPROVED (Paul, 2026-11-13, copy-review jbltdd2mvwblrz4en6xfhv6d2y, unchanged) |
| `api.ability_off` | You cannot do that with your current access. | Assistant abilities: an ability the person needs is off; reuses `api.forbidden`'s words | COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/internal/equipo/app.go b/internal/equipo/app.go
index 991bb145..c33a854d 100644
--- a/internal/equipo/app.go
+++ b/internal/equipo/app.go
@@ -109,6 +109,22 @@ func (a *application) startBackground() *background.Group {
a.logger.Error(copyChatSweep, "err", err)
}
})
+ // The instance's own addresses, at start and hourly: the
+ // inventory the guarded client checks.
+ a.background.Go(func() {
+ ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
+ defer cancel()
+ if err := a.store.Chat().ScanInstanceAddresses(ctx); err != nil {
+ a.logger.Warn("instance inventory", "err", err)
+ }
+ })
+ a.background.Loop(context.Background(), time.Hour, func() {
+ ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
+ defer cancel()
+ if err := a.store.Chat().ScanInstanceAddresses(ctx); err != nil {
+ a.logger.Warn("instance inventory", "err", err)
+ }
+ })
// The board of everyone with work under way, when a minute old
// (spec 2026-11-26-assistant-abilities §5.3).
a.background.Loop(context.Background(), time.Minute, func() {
@@ -205,6 +221,9 @@ func RouterWithStore(d *db.DB, cfg Config, mailer mail.Sender, logger *slog.Logg
store.Chat().SetPush(cfg.Push != nil)
store.Chat().SetNotificationActions(cfg.NotificationActions)
store.Chat().SetFixed(cfg.Abilities)
+ if err := store.Chat().SetInstancePrefixes(cfg.InstancePrefixes); err != nil {
+ return nil, err
+ }
// What the Assistant's provider calls could not do, by call id only.
store.Chat().SetLogger(logger)
if cfg.OficinaConnectOrigin != "" {
diff --git a/internal/equipo/chat/instance_inventory.go b/internal/equipo/chat/instance_inventory.go
new file mode 100644
index 00000000..d0a65c6d
--- /dev/null
+++ b/internal/equipo/chat/instance_inventory.go
@@ -0,0 +1,395 @@
+package chat
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "net"
+ "net/netip"
+ "slices"
+ "strings"
+ "sync/atomic"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/websource/guard"
+ "amadan.net/oficina/equipo/internal/wire"
+ "gorm.io/gorm"
+ "gorm.io/gorm/clause"
+)
+
+// The instance inventory (spec 2026-11-26-assistant-abilities §4.3; MCP
+// plan Task 7): the network the instance itself is on, which no request
+// to the public web may reach. The operator lists its prefixes
+// (EQUIPO_INSTANCE_PREFIXES); the instance scans its own interfaces at
+// start and hourly; an Equipo owner confirms. Until every listed prefix
+// is confirmed and every address seen is inside one, the inventory isn't
+// ready, and nothing that needs it (lookups, services) runs; each change
+// asks every owner once, on an instance_inventory card.
+
+// instancePrefixRecord is a prefix an owner confirmed: who, when, on
+// which card. Never removed.
+type instancePrefixRecord struct {
+ Prefix string `gorm:"primaryKey"`
+ ConfirmedBy string
+ ConfirmedAt time.Time
+ CardID string
+}
+
+func (instancePrefixRecord) TableName() string { return "instance_prefixes" }
+
+// instanceAddressRecord is an address the latest scan saw on one of the
+// instance's interfaces.
+type instanceAddressRecord struct {
+ Address string `gorm:"primaryKey"`
+ SeenAt time.Time
+}
+
+func (instanceAddressRecord) TableName() string { return "instance_addresses" }
+
+// instanceInventoryCardRecord binds an instance_inventory card to what
+// it shows: the prefixes listed and the addresses seen (JSON, in order).
+// Confirm confirms exactly those prefixes.
+type instanceInventoryCardRecord struct {
+ CardID string `gorm:"primaryKey"`
+ Prefixes string
+ Addresses string
+ CreatedAt time.Time
+}
+
+func (instanceInventoryCardRecord) TableName() string { return "chat_instance_inventory" }
+
+// Audit kind of an owner's Confirm.
+const auditInstanceInventory = "services.inventory_confirmed"
+
+// inventorySnap is what Inside reads, kept in memory: the prefixes
+// listed and confirmed, and the addresses the latest scan saw.
+type inventorySnap struct {
+ prefixes []netip.Prefix
+ addrs []netip.Addr
+}
+
+// instanceNet is the store's inventory state outside the database.
+type instanceNet struct {
+ listed atomic.Pointer[[]netip.Prefix]
+ snap atomic.Pointer[inventorySnap]
+}
+
+// ParseInstancePrefixes reads EQUIPO_INSTANCE_PREFIXES: comma-separated
+// prefixes, as 203.0.113.0/24.
+func ParseInstancePrefixes(raw string) ([]netip.Prefix, error) {
+ var out []netip.Prefix
+ for _, f := range strings.Split(raw, ",") {
+ if f = strings.TrimSpace(f); f == "" {
+ continue
+ }
+ p, err := netip.ParsePrefix(f)
+ if err != nil {
+ return nil, errors.New("instance prefixes: " + f + " is not a prefix")
+ }
+ out = append(out, p.Masked())
+ }
+ return out, nil
+}
+
+// SetInstancePrefixes sets the operator's prefixes (ParseInstancePrefixes).
+// Empty, the inventory is never ready.
+func (s *Store) SetInstancePrefixes(raw string) error {
+ out, err := ParseInstancePrefixes(raw)
+ if err != nil {
+ return err
+ }
+ s.instance.listed.Store(&out)
+ return nil
+}
+
+func (s *Store) listedPrefixes() []netip.Prefix {
+ if p := s.instance.listed.Load(); p != nil {
+ return *p
+ }
+ return nil
+}
+
+// InstanceInventory is the inventory the guarded client checks.
+func (s *Store) InstanceInventory() guard.Inventory { return instanceInventory{s} }
+
+type instanceInventory struct{ s *Store }
+
+// Ready is nil once prefixes are listed, each is confirmed, and every
+// address the latest scan saw is inside a confirmed one.
+func (i instanceInventory) Ready(ctx context.Context) error {
+ listed := i.s.listedPrefixes()
+ if len(listed) == 0 {
+ return guard.ErrInventoryUnconfirmed
+ }
+ var ready bool
+ err := i.s.read(ctx, func(tx *gorm.DB) error {
+ var err error
+ ready, err = inventoryReady(tx, listed)
+ return err
+ })
+ if err != nil {
+ return err
+ }
+ if !ready {
+ return guard.ErrInventoryUnconfirmed
+ }
+ return nil
+}
+
+// Inside reports whether a is on the instance's network: in a prefix
+// listed or confirmed, or an address the latest scan saw.
+func (i instanceInventory) Inside(a netip.Addr) bool {
+ a = a.Unmap()
+ for _, p := range i.s.listedPrefixes() {
+ if p.Contains(a) {
+ return true
+ }
+ }
+ snap := i.s.instance.snap.Load()
+ if snap == nil {
+ return false
+ }
+ return slices.ContainsFunc(snap.prefixes, func(p netip.Prefix) bool { return p.Contains(a) }) || slices.Contains(snap.addrs, a)
+}
+
+// inventoryReady: every listed prefix confirmed, every address seen
+// inside a confirmed prefix.
+func inventoryReady(tx *gorm.DB, listed []netip.Prefix) (bool, error) {
+ confirmed, addrs, err := inventoryRows(tx)
+ if err != nil {
+ return false, err
+ }
+ for _, p := range listed {
+ if !slices.Contains(confirmed, p) {
+ return false, nil
+ }
+ }
+ for _, a := range addrs {
+ if !slices.ContainsFunc(confirmed, func(p netip.Prefix) bool { return p.Contains(a) }) {
+ return false, nil
+ }
+ }
+ return true, nil
+}
+
+// inventoryRows are the confirmed prefixes and the addresses seen.
+func inventoryRows(tx *gorm.DB) ([]netip.Prefix, []netip.Addr, error) {
+ var ps, as []string
+ if err := tx.Model(&instancePrefixRecord{}).Order("prefix").Pluck("prefix", &ps).Error; err != nil {
+ return nil, nil, err
+ }
+ if err := tx.Model(&instanceAddressRecord{}).Order("address").Pluck("address", &as).Error; err != nil {
+ return nil, nil, err
+ }
+ var prefixes []netip.Prefix
+ for _, s := range ps {
+ if p, err := netip.ParsePrefix(s); err == nil {
+ prefixes = append(prefixes, p)
+ }
+ }
+ var addrs []netip.Addr
+ for _, s := range as {
+ if a, err := netip.ParseAddr(s); err == nil {
+ addrs = append(addrs, a)
+ }
+ }
+ return prefixes, addrs, nil
+}
+
+// ScanInstanceAddresses records the global unicast addresses of the
+// instance's interfaces (at start and hourly) and, when the inventory
+// isn't ready with prefixes listed, asks every owner to confirm it: once
+// per change in what the card shows.
+func (s *Store) ScanInstanceAddresses(ctx context.Context) error {
+ list := s.ifaceAddrs
+ if list == nil {
+ list = net.InterfaceAddrs
+ }
+ raw, err := list()
+ if err != nil {
+ return err
+ }
+ var seen []netip.Addr
+ for _, a := range raw {
+ n, ok := a.(*net.IPNet)
+ if !ok {
+ continue
+ }
+ addr, ok := netip.AddrFromSlice(n.IP)
+ if !ok {
+ continue
+ }
+ if addr = addr.Unmap(); addr.IsGlobalUnicast() && !slices.Contains(seen, addr) {
+ seen = append(seen, addr)
+ }
+ }
+ slices.SortFunc(seen, func(a, b netip.Addr) int { return a.Compare(b) })
+ listed := s.listedPrefixes()
+ return s.tx(ctx, func(t *txn) error {
+ now := t.now()
+ if err := t.db.Where("1 = 1").Delete(&instanceAddressRecord{}).Error; err != nil {
+ return err
+ }
+ for _, a := range seen {
+ if err := t.db.Create(&instanceAddressRecord{Address: a.String(), SeenAt: now}).Error; err != nil {
+ return err
+ }
+ }
+ confirmed, _, err := inventoryRows(t.db)
+ if err != nil {
+ return err
+ }
+ s.instance.snap.Store(&inventorySnap{prefixes: confirmed, addrs: seen})
+ if len(listed) == 0 {
+ return nil
+ }
+ ready, err := inventoryReady(t.db, listed)
+ if err != nil || ready {
+ return err
+ }
+ return t.askInventory(listed, seen)
+ })
+}
+
+// askInventory asks every owner to confirm the listed prefixes and the
+// addresses seen, unless their open card shows exactly that already. A
+// card showing something else is withdrawn for the new one.
+func (t *txn) askInventory(listed []netip.Prefix, seen []netip.Addr) error {
+ ps := make([]string, len(listed))
+ for i, p := range listed {
+ ps[i] = p.String()
+ }
+ as := make([]string, len(seen))
+ for i, a := range seen {
+ as[i] = a.String()
+ }
+ prefixes, _ := json.Marshal(ps)
+ addrs, _ := json.Marshal(as)
+ var owners []string
+ if err := t.db.Raw("SELECT address FROM members WHERE active = 1 AND role = ? ORDER BY address", "owner").Scan(&owners).Error; err != nil {
+ return err
+ }
+ options, _ := json.Marshal([]string{wire.ChoiceConfirm})
+ for _, o := range owners {
+ if err := t.isOwner(o); errors.Is(err, ErrForbidden) {
+ continue
+ } else if err != nil {
+ return err
+ }
+ var open []cardRecord
+ if err := t.db.Where("person = ? AND kind = ? AND state = ?", o, wire.CardInstanceInventory, wire.CardOpen).Find(&open).Error; err != nil {
+ return err
+ }
+ same := false
+ for i := range open {
+ var rec instanceInventoryCardRecord
+ if err := t.db.Where("card_id = ?", open[i].ID).Limit(1).Find(&rec).Error; err != nil {
+ return err
+ }
+ if rec.Prefixes == string(prefixes) && rec.Addresses == string(addrs) {
+ same = true
+ continue
+ }
+ open[i].State = wire.CardResolved
+ if err := t.saveCard(&open[i]); err != nil {
+ return err
+ }
+ }
+ if same {
+ continue
+ }
+ now := t.now()
+ c := cardRecord{ID: newID("c_"), Person: o, Kind: wire.CardInstanceInventory, State: wire.CardOpen, Question: t.words("services.inventory.question"), Options: string(options), Revision: 1, CreatedAt: now, UpdatedAt: now}
+ if err := t.db.Create(&c).Error; err != nil {
+ return err
+ }
+ if err := t.db.Create(&instanceInventoryCardRecord{CardID: c.ID, Prefixes: string(prefixes), Addresses: string(addrs), CreatedAt: now}).Error; err != nil {
+ return err
+ }
+ if err := t.cardEvent(c); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// instanceInventoryView is what an instance_inventory card shows: the
+// prefixes listed, then the addresses seen.
+func (t *txn) instanceInventoryView(c cardRecord) (*wire.CardInventoryView, []string, error) {
+ var rec instanceInventoryCardRecord
+ if err := t.db.Where("card_id = ?", c.ID).First(&rec).Error; err != nil {
+ return nil, nil, err
+ }
+ var prefixes, addrs []string
+ if err := json.Unmarshal([]byte(rec.Prefixes), &prefixes); err != nil {
+ return nil, nil, err
+ }
+ if err := json.Unmarshal([]byte(rec.Addresses), &addrs); err != nil {
+ return nil, nil, err
+ }
+ return &wire.CardInventoryView{Addresses: append(append([]string{}, prefixes...), addrs...)}, prefixes, nil
+}
+
+// answerInstanceInventory is an owner's Confirm on an instance_inventory
+// card: only Confirm, open and at its revision, by the card's person, an
+// owner now. It records the prefixes the card shows with who and when,
+// audits it, and answers every owner's card showing the same.
+func (t *txn) answerInstanceInventory(person string, c cardRecord, in wire.AnswerCard) (wire.Card, wire.Card, error) {
+ v, err := t.cardView(c)
+ if err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ if in.Choice != wire.ChoiceConfirm {
+ return wire.Card{}, wire.Card{}, ErrInvalid
+ }
+ if c.State != wire.CardOpen || c.Revision != in.Revision {
+ return wire.Card{}, v, ErrCardConflict
+ }
+ if c.Person != person {
+ return wire.Card{}, wire.Card{}, ErrForbidden
+ }
+ if err := t.isOwner(person); err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ _, prefixes, err := t.instanceInventoryView(c)
+ if err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ now := t.now()
+ for _, p := range prefixes {
+ row := instancePrefixRecord{Prefix: p, ConfirmedBy: person, ConfirmedAt: now, CardID: c.ID}
+ if err := t.db.Clauses(clause.OnConflict{DoNothing: true}).Create(&row).Error; err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ }
+ if t.s.authority.Audit != nil {
+ if err := t.s.authority.Audit(t.db, person, auditInstanceInventory, strings.Join(prefixes, ",")); err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ }
+ var shown instanceInventoryCardRecord
+ if err := t.db.Where("card_id = ?", c.ID).First(&shown).Error; err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ var others []cardRecord
+ if err := t.db.Where("kind = ? AND state = ? AND id <> ? AND id IN (SELECT card_id FROM chat_instance_inventory WHERE prefixes = ? AND addresses = ?)", wire.CardInstanceInventory, wire.CardOpen, c.ID, shown.Prefixes, shown.Addresses).Find(&others).Error; err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ for i := range others {
+ others[i].State = wire.CardResolved
+ if err := t.saveCard(&others[i]); err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ }
+ c.State, c.Choice = wire.CardAnswered, in.Choice
+ if err := t.saveCard(&c); err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ confirmed, addrs, err := inventoryRows(t.db)
+ if err != nil {
+ return wire.Card{}, wire.Card{}, err
+ }
+ t.s.instance.snap.Store(&inventorySnap{prefixes: confirmed, addrs: addrs})
+ out, err := t.cardView(c)
+ return out, wire.Card{}, err
+}
diff --git a/internal/equipo/chat/instance_inventory_test.go b/internal/equipo/chat/instance_inventory_test.go
new file mode 100644
index 00000000..77ac6b1e
--- /dev/null
+++ b/internal/equipo/chat/instance_inventory_test.go
@@ -0,0 +1,149 @@
+package chat
+
+import (
+ "context"
+ "errors"
+ "net"
+ "net/netip"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/websource/guard"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// scanning has the store's next scans see addrs as its interfaces'.
+func scanning(h *abilitiesHarness, addrs ...string) {
+ h.s.ifaceAddrs = func() ([]net.Addr, error) {
+ var out []net.Addr
+ for _, a := range addrs {
+ out = append(out, &net.IPNet{IP: net.ParseIP(a), Mask: net.CIDRMask(24, 32)})
+ }
+ return out, nil
+ }
+}
+
+func scan(t *testing.T, h *abilitiesHarness) {
+ t.Helper()
+ if err := h.s.ScanInstanceAddresses(context.Background()); err != nil {
+ t.Fatal(err)
+ }
+}
+
+// openInventoryCards are the open instance_inventory cards, by person.
+func openInventoryCards(t *testing.T, h *abilitiesHarness) map[string]cardRecord {
+ t.Helper()
+ var cards []cardRecord
+ if err := h.s.db.G.Where("kind = ? AND state = ?", wire.CardInstanceInventory, wire.CardOpen).Find(&cards).Error; err != nil {
+ t.Fatal(err)
+ }
+ out := map[string]cardRecord{}
+ for _, c := range cards {
+ out[c.Person] = c
+ }
+ return out
+}
+
+// With no prefixes configured the inventory is never ready, and nobody
+// is asked.
+func TestInventoryNotReadyWithoutPrefixes(t *testing.T) {
+ h := newAbilitiesHarness(t)
+ scanning(h, "203.0.113.5")
+ scan(t, h)
+ if err := h.s.InstanceInventory().Ready(context.Background()); !errors.Is(err, guard.ErrInventoryUnconfirmed) {
+ t.Errorf("ready with no prefixes: %v", err)
+ }
+ if n := len(openInventoryCards(t, h)); n != 0 {
+ t.Errorf("%d cards", n)
+ }
+}
+
+// Prefixes configured: one card per owner, showing the prefixes and the
+// addresses seen. A member can't answer it (it isn't theirs to see); an owner's Confirm makes the
+// inventory ready, and a scan with nothing changed asks nothing more.
+func TestInventoryCardAndConfirm(t *testing.T) {
+ h := newAbilitiesHarness(t)
+ ctx := context.Background()
+ if err := h.s.SetInstancePrefixes("203.0.113.0/24"); err != nil {
+ t.Fatal(err)
+ }
+ scanning(h, "203.0.113.5")
+ scan(t, h)
+ if err := h.s.InstanceInventory().Ready(ctx); !errors.Is(err, guard.ErrInventoryUnconfirmed) {
+ t.Fatalf("ready before Confirm: %v", err)
+ }
+ cards := openInventoryCards(t, h)
+ c, ok := cards["owner@example.com"]
+ if len(cards) != 1 || !ok {
+ t.Fatalf("cards %+v", cards)
+ }
+ view, _, err := h.s.AnswerDevice(ctx, abPerson, "", c.ID, wire.AnswerCard{Choice: wire.ChoiceConfirm, Revision: c.Revision})
+ if !errors.Is(err, ErrForbidden) && !errors.Is(err, ErrNotFound) {
+ t.Errorf("a member's Confirm: %+v %v", view.Card, err)
+ }
+ var shown wire.Card
+ if err := h.s.tx(ctx, func(tx *txn) error {
+ var err error
+ shown, err = tx.cardView(c)
+ return err
+ }); err != nil {
+ t.Fatal(err)
+ }
+ if shown.Inventory == nil || len(shown.Inventory.Addresses) != 2 || shown.Inventory.Addresses[0] != "203.0.113.0/24" || shown.Inventory.Addresses[1] != "203.0.113.5" {
+ t.Errorf("the card shows %+v", shown.Inventory)
+ }
+ if _, _, err := h.s.AnswerDevice(ctx, "owner@example.com", "", c.ID, wire.AnswerCard{Choice: wire.ChoiceConfirm, Revision: c.Revision}); err != nil {
+ t.Fatal(err)
+ }
+ if err := h.s.InstanceInventory().Ready(ctx); err != nil {
+ t.Errorf("not ready after Confirm: %v", err)
+ }
+ scan(t, h)
+ if n := len(openInventoryCards(t, h)); n != 0 {
+ t.Errorf("%d cards after Confirm", n)
+ }
+}
+
+// An address seen outside the confirmed prefixes stops the inventory
+// being ready, and asks again.
+func TestInventoryDriftStopsRequests(t *testing.T) {
+ h := newAbilitiesHarness(t)
+ ctx := context.Background()
+ if err := h.s.SetInstancePrefixes("203.0.113.0/24"); err != nil {
+ t.Fatal(err)
+ }
+ scanning(h, "203.0.113.5")
+ scan(t, h)
+ c := openInventoryCards(t, h)["owner@example.com"]
+ if _, _, err := h.s.AnswerDevice(ctx, "owner@example.com", "", c.ID, wire.AnswerCard{Choice: wire.ChoiceConfirm, Revision: c.Revision}); err != nil {
+ t.Fatal(err)
+ }
+ scanning(h, "203.0.113.5", "198.51.100.7")
+ scan(t, h)
+ if err := h.s.InstanceInventory().Ready(ctx); !errors.Is(err, guard.ErrInventoryUnconfirmed) {
+ t.Errorf("ready with an address outside: %v", err)
+ }
+ again, ok := openInventoryCards(t, h)["owner@example.com"]
+ if !ok || again.ID == c.ID {
+ t.Errorf("no new card: %+v", again)
+ }
+}
+
+// Inside is the instance's own network: its prefixes and the addresses
+// it has seen.
+func TestInventoryInside(t *testing.T) {
+ h := newAbilitiesHarness(t)
+ if err := h.s.SetInstancePrefixes("203.0.113.0/24"); err != nil {
+ t.Fatal(err)
+ }
+ scanning(h, "198.51.100.7")
+ scan(t, h)
+ inv := h.s.InstanceInventory()
+ for addr, want := range map[string]bool{"203.0.113.9": true, "198.51.100.7": true, "93.184.216.34": false} {
+ if got := inv.Inside(netip.MustParseAddr(addr)); got != want {
+ t.Errorf("Inside(%s) = %v", addr, got)
+ }
+ }
+ if err := h.s.SetInstancePrefixes("not a prefix"); err == nil {
+ t.Error("a bad prefix was taken")
+ }
+}
diff --git a/internal/equipo/chat/models.go b/internal/equipo/chat/models.go
index 6539b478..cd38f24f 100644
--- a/internal/equipo/chat/models.go
+++ b/internal/equipo/chat/models.go
@@ -11,7 +11,7 @@ import (
)
// Models are the tables this package owns, for the migration check.
-var Models = append([]any{&changeDiffRecord{}, &notificationReceipt{}, &projectNameRecord{}, &cardVisibility{}, &cardThreadRecord{}, &copyAttemptRecord{}, &copyReviewRecord{}, &copyFeedbackRecord{}, &turnRecord{}, &messageRecord{}, &eventRecord{}, &commandRecord{}, &inboxRecord{}, &runnerSessionRecord{}, &projectRecord{}, &cardRecord{}, &toolCallRecord{}, &settingRecord{}, &coordinatorRecord{}, &notebookRecord{}, &taskRecord{}, &stepRecord{}, &entryRecord{}, &attachmentRecord{}, &starRecord{}, &questionRecord{}, &connectionRecord{}, &usageRecord{}, &distinctRecord{}, &hkRecord{}, &hkFailureRecord{}, &hkSettingsRecord{}, &fileRecord{}, &fileDataRecord{}, &transferRecord{}, &mergePolicyRecord{}, &mergeAuditRecord{}, &specialistRecord{}, &grantRecord{}, &specialistAuditRecord{}, &researchSourceRecord{}, &researchAddressRecord{}, &researchPrefixRecord{}, &researchInventoryRecord{}, &researchRecord{}, &researchFetchRecord{}, &taskFileRecord{}, &taskFileDataRecord{}, &releaseRecord{}, &adviceRecord{}, &assistantHostRecord{}, &abilitiesRecord{}, &handoffRecord{}, &handoffTurnRecord{}, &handoffTaskRecord{}, &handoffActionRecord{}, &connectTurnRecord{}, &carriedRecord{}, &zoneRecord{}, &placeRecord{}, &projectPlaceRecord{}}, push.Models...)
+var Models = append([]any{&changeDiffRecord{}, &notificationReceipt{}, &projectNameRecord{}, &cardVisibility{}, &cardThreadRecord{}, &copyAttemptRecord{}, &copyReviewRecord{}, &copyFeedbackRecord{}, &turnRecord{}, &messageRecord{}, &eventRecord{}, &commandRecord{}, &inboxRecord{}, &runnerSessionRecord{}, &projectRecord{}, &cardRecord{}, &toolCallRecord{}, &settingRecord{}, &coordinatorRecord{}, &notebookRecord{}, &taskRecord{}, &stepRecord{}, &entryRecord{}, &attachmentRecord{}, &starRecord{}, &questionRecord{}, &connectionRecord{}, &usageRecord{}, &distinctRecord{}, &hkRecord{}, &hkFailureRecord{}, &hkSettingsRecord{}, &fileRecord{}, &fileDataRecord{}, &transferRecord{}, &mergePolicyRecord{}, &mergeAuditRecord{}, &specialistRecord{}, &grantRecord{}, &specialistAuditRecord{}, &researchSourceRecord{}, &researchAddressRecord{}, &researchPrefixRecord{}, &researchInventoryRecord{}, &instancePrefixRecord{}, &instanceAddressRecord{}, &instanceInventoryCardRecord{}, &researchRecord{}, &researchFetchRecord{}, &taskFileRecord{}, &taskFileDataRecord{}, &releaseRecord{}, &adviceRecord{}, &assistantHostRecord{}, &abilitiesRecord{}, &handoffRecord{}, &handoffTurnRecord{}, &handoffTaskRecord{}, &handoffActionRecord{}, &connectTurnRecord{}, &carriedRecord{}, &zoneRecord{}, &placeRecord{}, &projectPlaceRecord{}}, push.Models...)
type turnRecord struct {
CreateRepo string
diff --git a/internal/equipo/chat/projects.go b/internal/equipo/chat/projects.go
index cfa65c6f..d7dcef90 100644
--- a/internal/equipo/chat/projects.go
+++ b/internal/equipo/chat/projects.go
@@ -363,6 +363,13 @@ func (t *txn) cardView(c cardRecord) (wire.Card, error) {
}
v.Inventory = iv
}
+ if c.Kind == wire.CardInstanceInventory {
+ iv, _, err := t.instanceInventoryView(c)
+ if err != nil {
+ return v, err
+ }
+ v.Inventory = iv
+ }
if c.Kind == wire.CardAdvice {
av, err := t.cardAdvice(c)
if err != nil {
@@ -761,6 +768,11 @@ func (s *Store) AnswerDevice(ctx context.Context, person, credential, id string,
out.Card, current = card, cur
return e
}
+ if c.Kind == wire.CardInstanceInventory {
+ card, cur, e := t.answerInstanceInventory(person, c, in)
+ out.Card, current = card, cur
+ return e
+ }
if c.Kind == wire.CardAdvice {
card, cur, e := t.answerAdvice(person, c, in)
out.Card, current = card, cur
diff --git a/internal/equipo/chat/store.go b/internal/equipo/chat/store.go
index 68329d7e..5d22c430 100644
--- a/internal/equipo/chat/store.go
+++ b/internal/equipo/chat/store.go
@@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"log/slog"
+ "net"
"slices"
"strconv"
"strings"
@@ -115,6 +116,10 @@ type Store struct {
// hops is how many proxies the runner stream trusts in
// X-Forwarded-For, when a test sets it (SetForwardedHops).
hops atomic.Pointer[int]
+ // instance is the instance inventory's listed prefixes and latest
+ // scan; ifaceAddrs replaces net.InterfaceAddrs in tests.
+ instance instanceNet
+ ifaceAddrs func() ([]net.Addr, error)
// ops is the Assistant's registry (SetOperations); remote wakes
// ServeRemoteCalls after a commit that stored a pending call.
ops atomic.Pointer[Operations]
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index a588a9a3..e3c2377b 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -256,6 +256,10 @@ func cardView(c wire.Card, choices []string, tasks map[string]wire.Task) chatCar
case c.State == wire.CardAnswered:
v.Note = copyText("chat.card.specialist_chose_" + c.Choice)
}
+ case wire.CardInstanceInventory:
+ // The network the instance is on: its prefixes and the
+ // addresses it saw, as text, for an owner to Confirm.
+ v.Line, v.Open = c.Question, c.State == wire.CardOpen
case wire.CardResearchSources, wire.CardResearchInventory:
// Research: the pages it may read (Allow or Skip), or the
// addresses it reads from (Confirm); every URL and address as text.
diff --git a/internal/equipo/config.go b/internal/equipo/config.go
index 6e684d70..202f070f 100644
--- a/internal/equipo/config.go
+++ b/internal/equipo/config.go
@@ -64,6 +64,10 @@ type Config struct {
// key=off or key=owners, comma-separated): they narrow for everyone
// on the instance (spec 2026-11-26-assistant-abilities §5.4).
Abilities chat.Fixed
+ // InstancePrefixes is the network this instance is on
+ // (EQUIPO_INSTANCE_PREFIXES, comma-separated prefixes), which no
+ // request to the public web may reach; an owner confirms it.
+ InstancePrefixes string
}
func LoadConfig(getenv func(string) string) (Config, error) {
@@ -104,6 +108,12 @@ func LoadConfig(getenv func(string) string) (Config, error) {
return Config{}, errors.New(copyInvalid)
}
cfg.Abilities = fixed
+ cfg.InstancePrefixes = strings.TrimSpace(getenv("EQUIPO_INSTANCE_PREFIXES"))
+ if _, err := chat.ParseInstancePrefixes(cfg.InstancePrefixes); err != nil {
+ slog.Default().Error("config", "err", err)
+ //lint:ignore ST1005 User-facing errors preserve the reviewed sentences in copy.go.
+ return Config{}, errors.New(copyInvalid)
+ }
if cfg.OficinaConnectOrigin = strings.TrimSpace(getenv("EQUIPO_OFICINA_CONNECT_ORIGIN")); cfg.OficinaConnectOrigin != "" {
cfg.OficinaConnectClientID = strings.TrimSpace(getenv("EQUIPO_OFICINA_CONNECT_CLIENT_ID"))
}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 4af54cb3..4160ad34 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -2517,6 +2517,14 @@ var pageCopy = map[string]string{
"assistant.job.detail.go_live_off": "Putting it live is turned off for you. %s can turn it on.", // COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)
"chat.card.ability_off": "Building is turned off for you, so this can't start. You can still drop it.", // COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)
"oficina.connect.ability_off": "Reading your Oficina apps is turned off for you. %s can turn it on.", // COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)
+ // Lookups (spec 2026-11-26-assistant-abilities §4): the owners' card
+ // confirming the network the instance is on, the reply's activity line
+ // while a lookup runs, and the fallback's sources line for a client
+ // that can't draw answers.
+ "services.inventory.question": "Before your assistant can look things up on the web or reach other services, confirm the network this server is on.", // COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)
+ "services.inventory.confirm": "Confirm", // COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)
+ "assistant.activity.lookup": "Looking that up", // COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)
+ "assistant.lookup.fallback_sources": "Sources:", // COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)
}
// pasteLabels are the paste box's words, for the shared renderer, and
diff --git a/internal/equipo/migrations/0116_instance_inventory.sql b/internal/equipo/migrations/0116_instance_inventory.sql
new file mode 100644
index 00000000..20da5e31
--- /dev/null
+++ b/internal/equipo/migrations/0116_instance_inventory.sql
@@ -0,0 +1,7 @@
+-- The instance inventory (spec 2026-11-26-assistant-abilities §4.3): the
+-- prefixes an Equipo owner confirmed for the network this instance is
+-- on, the addresses its latest scan of its own interfaces saw, and what
+-- each instance_inventory card showed (Confirm confirms exactly that).
+CREATE TABLE instance_prefixes (prefix text PRIMARY KEY, confirmed_by text, confirmed_at datetime, card_id text);
+CREATE TABLE instance_addresses (address text PRIMARY KEY, seen_at datetime);
+CREATE TABLE chat_instance_inventory (card_id text PRIMARY KEY, prefixes text, addresses text, created_at datetime);
diff --git a/internal/equipo/migrations/schema.sql b/internal/equipo/migrations/schema.sql
index 4db9931a..f539eb5e 100644
--- a/internal/equipo/migrations/schema.sql
+++ b/internal/equipo/migrations/schema.sql
@@ -659,6 +659,9 @@ CREATE TABLE chat_research_addresses (runner_id text, source text, address text,
CREATE TABLE chat_research_prefixes (runner_id text, prefix text, confirmed_by text, confirmed_at datetime, card_id text, PRIMARY KEY (runner_id, prefix));
CREATE TABLE chat_research_inventory (card_id text PRIMARY KEY, runner_id text, addresses text, created_at datetime, updated_at datetime);
CREATE INDEX chat_research_inventory_runner ON chat_research_inventory(runner_id);
+CREATE TABLE instance_prefixes (prefix text PRIMARY KEY, confirmed_by text, confirmed_at datetime, card_id text);
+CREATE TABLE instance_addresses (address text PRIMARY KEY, seen_at datetime);
+CREATE TABLE chat_instance_inventory (card_id text PRIMARY KEY, prefixes text, addresses text, created_at datetime);
CREATE TABLE chat_research (step_id text, attempt integer, task_id text, revision integer, findings text, created_at datetime, PRIMARY KEY (step_id, attempt));
CREATE INDEX chat_research_task ON chat_research(task_id);
CREATE TABLE chat_research_fetches (step_id text, attempt integer, idx integer, task_id text, source_id text, origin text, parent text, url text, hops text, address text, status integer, type text, bytes integer, sha256 text, millis integer, reason text, PRIMARY KEY (step_id, attempt, idx));
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html
index 4c76c6fb..6ec810a0 100644
--- a/internal/equipo/templates/chat.html
+++ b/internal/equipo/templates/chat.html
@@ -15,7 +15,7 @@
{{else if eq .Kind "direction"}}<p equipo-card-line>{{.Line}}</p>{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}{{if eq . "again"}}<button type="button" rst-btn data-thread-open>{{copy "chat.card.again"}}</button>{{else}}<button rst-btn="{{if eq . "build"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-direction-choice="{{.}}"{{if eq . "build"}} data-busy-label="{{copy "roster.building"}}"{{end}}>{{copy (printf "chat.card.%s" .)}}</button>{{end}}{{end}}</form><details equipo-subchat data-direction-thread><summary equipo-thread-open>{{copy "chat.card.again"}}</summary><div equipo-thread-list role="log" aria-live="polite"><div equipo-thread-turn><span equipo-thread-avatar>{{icon .AuthorIcon}}</span><div equipo-thread-bubble><div equipo-thread-who>{{.Author}}</div><div equipo-thread-text>{{copy "roster.change"}}</div></div></div></div><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-mini-composer><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="choice" value="again">{{template "card-job" .}}<div equipo-mini-pill><textarea name="note" required maxlength="1000" rows="1" aria-label="{{copy "roster.reply"}}" placeholder="{{copy "roster.reply"}}"></textarea><button type="submit" data-thread-send data-direction-choice="again" aria-label="{{copy "conversation.send_short"}}" data-busy-label="{{copy "roster.sending"}}">{{icon "arrow-up"}}</button></div></form></details>{{else}}{{with .Note}}<p equipo-card-done role="status">{{.}}</p>{{end}}{{if .Presentation.Thread}}<div equipo-subchat data-roster-step="{{.Presentation.StepID}}"><div equipo-thread-list role="log" aria-live="polite">{{template "roster-thread-turns" .}}</div></div>{{end}}{{end}}
{{else if eq .Kind "specialist"}}<p equipo-card-line>{{.Line}}</p>{{with .Specialist}}{{range .Capabilities}}<p equipo-card-note data-capability="{{.ID}}">{{.Words}}</p>{{end}}<p equipo-card-note data-specialist-brief>{{printf (copy "chat.card.specialist_brief") .Brief}}</p>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "add"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-specialist-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
{{else if eq .Kind "research_sources"}}<p equipo-card-line>{{.Line}}</p>{{with .Name}}<p equipo-card-note data-research-task>{{printf (copy "chat.card.research_for") .}}</p>{{end}}{{with .Research}}<p equipo-card-note data-research-question>{{printf (copy "chat.card.research_looks_for") .Question}}</p><ul equipo-card-list data-research-urls>{{range .URLs}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "allow"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-research-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
-{{else if eq .Kind "research_inventory"}}<p equipo-card-line>{{.Line}}</p>{{with .Inventory}}<ul equipo-card-list data-research-addresses>{{range .Addresses}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button rst-btn="primary" name="choice" value="confirm" type="submit" data-inventory-confirm>{{copy "chat.card.inventory_confirm"}}</button></form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
+{{else if eq .Kind "instance_inventory"}}<p equipo-card-line>{{.Line}}</p>{{with .Inventory}}<ul equipo-card-list data-instance-addresses>{{range .Addresses}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}"><button rst-btn="primary" name="choice" value="confirm" type="submit" data-instance-confirm>{{copy "services.inventory.confirm"}}</button></form>{{end}}{{else if eq .Kind "research_inventory"}}<p equipo-card-line>{{.Line}}</p>{{with .Inventory}}<ul equipo-card-list data-research-addresses>{{range .Addresses}}<li><code>{{.}}</code></li>{{end}}</ul>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}<button rst-btn="primary" name="choice" value="confirm" type="submit" data-inventory-confirm>{{copy "chat.card.inventory_confirm"}}</button></form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
{{else if eq .Kind "place"}}<p equipo-card-line>{{.Line}}</p>{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{range $i, $c := .PlaceChoices}}<button rst-btn="{{if eq $i 0}}primary{{end}}" name="choice" value="{{$c.ID}}" type="submit" data-place-choice="{{$c.ID}}">{{$c.Label}}</button>{{end}}<button rst-btn name="choice" value="not_now" type="submit" data-place-choice="not_now">{{copy "chat.card.not_now"}}</button></form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}{{else if eq .Kind "publish"}}<p equipo-card-line>{{.Line}}</p>{{with .Site}}{{if .URL}}<p equipo-card-note><a href="{{.URL}}" rel="noopener" target="_blank" data-site-link>{{copy "chat.card.site_link"}}</a></p>{{end}}{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "publish"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-publish-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
{{else if eq .Kind "merge"}}<p equipo-card-line>{{.Line}}</p>{{with .PreviewURL}}<p equipo-card-note><a href="{{.}}" rel="noopener" target="_blank" data-preview-link>{{copy "chat.card.preview_link"}}</a></p>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if eq . "merge"}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-merge-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
{{else if or (eq .Kind "merge_ships") (eq .Kind "merge_policy") (eq .Kind "merge_receipt")}}{{if eq .Kind "merge_receipt"}}<div equipo-card-line equipo-markdown data-merge-receipt>{{chatMarkdown .Line}}</div>{{else}}<p equipo-card-line>{{.Line}}</p>{{end}}{{if .Open}}<form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form equipo-actions><input type="hidden" name="revision" value="{{.Revision}}">{{template "card-job" .}}{{template "project-name-confirm" .}}{{range .Options}}<button rst-btn="{{if or (eq . "save") (eq . "not_ships")}}primary{{end}}" name="choice" value="{{.}}" type="submit" data-merge-choice="{{.}}">{{copy (printf "chat.card.%s" .)}}</button>{{end}}</form>{{else}}{{with .Note}}<p equipo-card-note>{{.}}</p>{{end}}{{end}}
diff --git a/internal/plan3test/plan3_release_test.go b/internal/plan3test/plan3_release_test.go
index 26dd89c5..a3dd1b6c 100644
--- a/internal/plan3test/plan3_release_test.go
+++ b/internal/plan3test/plan3_release_test.go
@@ -229,7 +229,7 @@ func plan3CopyInventory(t *testing.T) {
approvedPlaces := slices.Contains([]string{"chat.card.place_question", "chat.card.place_option", "chat.card.place_chose", "chat.card.place_chose_not_now", "chat.card.publish_place_question", "chat.card.publish_setup_note", "chat.card.publish_mint_note", "chat.card.publish_stale"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-26, copy-review iic5rwpyavu7rnhiuvx7cnedzm, unchanged)")
acceptedCopy := strings.TrimSuffix(cells[3], " |") == "COPY ACCEPTED BY DELEGATION (Copy, record-bound) sha256:"+copydesk.Hash(rows[key])
// Paul's own review of the Assistant abilities strings (2026-11-28).
- approvedAbilities := slices.Contains([]string{"assistant.ability.web.name", "assistant.ability.apps_read.name", "assistant.ability.apps_write.name", "assistant.ability.build.name", "assistant.ability.go_live.name", "assistant.ability.services.name", "assistant.ability.services_add.name", "assistant.job.detail.ability_off", "assistant.job.detail.ability_back", "assistant.job.detail.go_live_off", "chat.card.ability_off", "oficina.connect.ability_off"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)")
+ approvedAbilities := slices.Contains([]string{"assistant.ability.web.name", "assistant.ability.apps_read.name", "assistant.ability.apps_write.name", "assistant.ability.build.name", "assistant.ability.go_live.name", "assistant.ability.services.name", "assistant.ability.services_add.name", "assistant.job.detail.ability_off", "assistant.job.detail.ability_back", "assistant.job.detail.go_live_off", "chat.card.ability_off", "oficina.connect.ability_off", "services.inventory.question", "services.inventory.confirm", "assistant.activity.lookup", "assistant.lookup.fallback_sources"}, key) && strings.HasSuffix(strings.TrimSuffix(cells[3], " |"), "COPY APPROVED (Paul, 2026-11-28, copy-review mi3kgi7nubnsf7kxn235tqwrbu, unchanged)")
if !approvedAbilities && !acceptedGitHubApp && !acceptedGitHubSweep && !approvedPlaces && !acceptedPlaces && !acceptedAskFiles && !acceptedDBCheck && !acceptedPreview && !approvedNoAccess && !approvedMergeCredential && !approvedStuckTasks && !acceptedPaused && !acceptedNewTeamCard && !acceptedGitHubEgress && !acceptedForgeSeam && !acceptedAPIErrors && !acceptedNativeProjects && !acceptedInjection && !acceptedMail && !acceptedPush && !acceptedAgentAccess && !acceptedProjects && !acceptedCardNames && !acceptedAccess && !acceptedPlacementEdges && !acceptedPlacement && !acceptedReportActions && !acceptedRoster && !acceptedCopy && !strings.Contains(cells[3], "COPY REVIEW REQUIRED") && !acceptedAll && !acceptedGuide && !acceptedRound2 && !acceptedStarter && !acceptedDelegation && !approvedPublish && !approvedAssistant && !approvedJobs && !approvedOficina && !approvedFailedReplies && !approvedStopReasons {
t.Fatal("entry has no copy review status or applicable acceptance", key)
}
diff --git a/internal/wire/research_result.go b/internal/wire/research_result.go
index 7167b88c..33921bf6 100644
--- a/internal/wire/research_result.go
+++ b/internal/wire/research_result.go
@@ -20,6 +20,11 @@ import (
// address currently detected is inside a confirmed set.
const CardResearchInventory = "research_inventory"
+// CardInstanceInventory asks an owner to confirm the network the instance
+// itself is on (its prefixes and the addresses it saw), before anything
+// reaches the public web from it. Its view is Inventory, prefixes first.
+const CardInstanceInventory = "instance_inventory"
+
// Bounds of a Research result.
const (
MaxFindingsBytes = 8 << 10