Name a personal agent's boss in me

JE
9d ago
+151-6

Problem

basecamp me on an agent profile names the agent's person and nothing else. A caller that needs to know "this profile is an agent, and it works for me" has no way to get there from the CLI:

  • me drops personable_type, so it can't tell an agent from a person who was signed into the same profile slot.
  • Neither me nor people show me carries boss. bc3 renders it for a personal agent in /my/profile.json and in the person JSON (#13514), but the SDK's Person has no field for it, so the CLI throws it away. connect setup already reads it, through its own plain GET in readAgentOwner.

The agent sandbox needs exactly this check at install and launch: the profile it brokers into the box must be an agent, and its boss must be the person running the install. Today it compares people show me ids across two profiles, which needs a human CLI login on the host just to answer the question.

Change

On an agent profile, me reads /my/profile.json with the account client's plain GET (the one request it already made, and the same path basecamp api get and readAgentOwner take). It reports:

"person": {"id": 777, "name": "Jane Doe (agent)", "email": "", "personable_type": "Agent",
           "boss": {"id": 42, "name": "Jane Doe"}}
  • The summary reads Jane Doe (agent) - agent in Basecamp account 555, working for Jane Doe.
  • A shared agent has no boss, so none is reported. A boss with no id is left out rather than reported as person 0, and a boss with a blank name shows in the summary as person <id>.
  • The person-login path is unchanged.
  • The connect skill's identity step says what an agent credential's me shows. Before, it only named identity, which an agent never has.

Tests

  • TestMeOnAPersonalAgentNamesItsBoss
  • TestMeOnAnAgentWithNoBossReportsNone, with three cases: no key, null, and a boss with no id
  • TestMeOnAnAgentWhoseBossHasNoNameSaysWhichPerson

All three fail with people.go reverted. TestMeOnAnAgentProfileReadsTheAgentsPerson still passes, and still asserts a single request. bin/ci is green on linux.

Not in this PR

people show <id> still drops boss, because it goes through the SDK Person. Adding the field to the SDK is the durable fix for that. me is the command callers use to ask who a profile is, so it's the one this changes.


Summary by cubic

me on an agent profile now names the agent's personable_type and, for a personal agent, its boss — the person it works for — so callers can check "this profile is an agent, and it's mine" from one command instead of a second lookup.

  • Reads /my/profile.json through the account client's plain GET in the one request me already makes, since the SDK's Person has no boss field.
  • A shared agent reports no boss; a boss without an id is omitted, and a blank boss name appears in the summary as person <id>.
  • The person-login path is unchanged.
  • The connect skill's identity step now describes what an agent credential's me shows.