cinna-cli 0.6.1__tar.gz → 0.7.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/PKG-INFO +31 -6
  2. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/README.md +30 -5
  3. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/README.md +3 -2
  4. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/account_workspace/account_workspace.md +23 -5
  5. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/account_workspace/account_workspace_acceptance.md +25 -1
  6. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/account_workspace/account_workspace_tech.md +24 -8
  7. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_api/agent_api.md +99 -4
  8. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_api/agent_api_acceptance.md +131 -2
  9. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_api/agent_api_tech.md +114 -1
  10. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/local_agent_import/local_agent_import.md +3 -1
  11. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/pyproject.toml +1 -1
  12. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/account.py +271 -61
  13. cinna_cli-0.7.1/src/cinna/agent_api_connections.py +436 -0
  14. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/client.py +133 -4
  15. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/local_import.py +38 -15
  16. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/main.py +210 -11
  17. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/templates/ACCOUNT_CLAUDE.md.template +20 -6
  18. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/templates/CLAUDE.md.template +2 -1
  19. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_account.py +1 -0
  20. cinna_cli-0.7.1/tests/test_agent_api_connections.py +771 -0
  21. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_onboarding.py +204 -9
  22. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/uv.lock +1 -1
  23. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/.claude/commands/cinna-cli.feature.doc.md +0 -0
  24. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/.github/workflows/publish.yml +0 -0
  25. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/.gitignore +0 -0
  26. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/LICENSE.md +0 -0
  27. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_addons/agent_addons.md +0 -0
  28. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_addons/agent_addons_acceptance.md +0 -0
  29. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_addons/agent_addons_tech.md +0 -0
  30. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_management/agent_management.md +0 -0
  31. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_management/agent_management_acceptance.md +0 -0
  32. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_management/agent_management_tech.md +0 -0
  33. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_schedules/agent_schedules.md +0 -0
  34. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_schedules/agent_schedules_acceptance.md +0 -0
  35. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/agent_schedules/agent_schedules_tech.md +0 -0
  36. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/artifacts/artifacts.md +0 -0
  37. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/artifacts/artifacts_acceptance.md +0 -0
  38. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/artifacts/artifacts_tech.md +0 -0
  39. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/bootstrap_onboarding/bootstrap_onboarding.md +0 -0
  40. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/bootstrap_onboarding/bootstrap_onboarding_acceptance.md +0 -0
  41. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/bootstrap_onboarding/bootstrap_onboarding_tech.md +0 -0
  42. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/dashboards/dashboards.md +0 -0
  43. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/dashboards/dashboards_acceptance.md +0 -0
  44. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/dashboards/dashboards_tech.md +0 -0
  45. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/delegation/delegation.md +0 -0
  46. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/delegation/delegation_acceptance.md +0 -0
  47. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/delegation/delegation_tech.md +0 -0
  48. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/doctor/doctor.md +0 -0
  49. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/doctor/doctor_acceptance.md +0 -0
  50. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/doctor/doctor_tech.md +0 -0
  51. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/git_versioning/git_versioning.md +0 -0
  52. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/git_versioning/git_versioning_acceptance.md +0 -0
  53. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/git_versioning/git_versioning_tech.md +0 -0
  54. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/improvement_requests/improvement_requests.md +0 -0
  55. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/improvement_requests/improvement_requests_acceptance.md +0 -0
  56. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/improvement_requests/improvement_requests_tech.md +0 -0
  57. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/live_sync/live_sync.md +0 -0
  58. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/live_sync/live_sync_acceptance.md +0 -0
  59. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/live_sync/live_sync_tech.md +0 -0
  60. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/local_agent_import/local_agent_import_acceptance.md +0 -0
  61. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/local_agent_import/local_agent_import_tech.md +0 -0
  62. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/mcp_integration/mcp_integration.md +0 -0
  63. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/mcp_integration/mcp_integration_acceptance.md +0 -0
  64. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/mcp_integration/mcp_integration_tech.md +0 -0
  65. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/remote_chat/remote_chat.md +0 -0
  66. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/remote_chat/remote_chat_acceptance.md +0 -0
  67. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/remote_chat/remote_chat_tech.md +0 -0
  68. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/remote_exec/remote_exec.md +0 -0
  69. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/remote_exec/remote_exec_acceptance.md +0 -0
  70. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/remote_exec/remote_exec_tech.md +0 -0
  71. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/team_library/team_library.md +0 -0
  72. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/team_library/team_library_acceptance.md +0 -0
  73. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/features/team_library/team_library_tech.md +0 -0
  74. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/interface.md +0 -0
  75. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/docs/mutagen_capabilities.md +0 -0
  76. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/scripts/check_docs_references.py +0 -0
  77. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/__init__.py +0 -0
  78. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/artifacts.py +0 -0
  79. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/auth.py +0 -0
  80. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/bootstrap.py +0 -0
  81. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/chat.py +0 -0
  82. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/cli_version.py +0 -0
  83. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/config.py +0 -0
  84. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/console.py +0 -0
  85. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/context.py +0 -0
  86. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/dashboards.py +0 -0
  87. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/delegation.py +0 -0
  88. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/doctor.py +0 -0
  89. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/errors.py +0 -0
  90. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/git_versioning.py +0 -0
  91. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/improve.py +0 -0
  92. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/kit_contract.py +0 -0
  93. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/library.py +0 -0
  94. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/logging.py +0 -0
  95. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/mcp_proxy.py +0 -0
  96. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/mutagen_runtime.py +0 -0
  97. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/scenarios.py +0 -0
  98. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/sync.py +0 -0
  99. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/sync_session.py +0 -0
  100. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/sync_ssh_shim.py +0 -0
  101. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/sync_tui.py +0 -0
  102. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/templates/CHAT_TESTING.md +0 -0
  103. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/templates/GIT_VERSIONING.md +0 -0
  104. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/src/cinna/templates/__init__.py +0 -0
  105. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/__init__.py +0 -0
  106. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/conftest.py +0 -0
  107. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_agent_api_access.py +0 -0
  108. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_artifacts.py +0 -0
  109. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_auth.py +0 -0
  110. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_bootstrap.py +0 -0
  111. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_chat.py +0 -0
  112. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_cli_version.py +0 -0
  113. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_client.py +0 -0
  114. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_config.py +0 -0
  115. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_console.py +0 -0
  116. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_context.py +0 -0
  117. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_dashboards.py +0 -0
  118. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_delegation.py +0 -0
  119. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_doctor.py +0 -0
  120. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_git_versioning.py +0 -0
  121. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_improve.py +0 -0
  122. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_kit_contract.py +0 -0
  123. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_library.py +0 -0
  124. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_local_import.py +0 -0
  125. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_main.py +0 -0
  126. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_mutagen_runtime.py +0 -0
  127. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_scenarios.py +0 -0
  128. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_sync.py +0 -0
  129. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_sync_session.py +0 -0
  130. {cinna_cli-0.6.1 → cinna_cli-0.7.1}/tests/test_sync_ssh_shim.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: cinna-cli
3
- Version: 0.6.1
3
+ Version: 0.7.1
4
4
  Summary: Local development CLI for Cinna Core agents
5
5
  Project-URL: Homepage, https://github.com/opencinna/cinna-cli
6
6
  Project-URL: Repository, https://github.com/opencinna/cinna-cli
@@ -211,14 +211,17 @@ cinna account credentials types # types + the
211
211
  cinna account credentials create --name "Stripe Key" --type api_token \
212
212
  --agent billing-agent # create a draft and attach it in one step
213
213
  # → prints required fields (e.g. api_token) + a link to fill them in
214
- cinna account credentials list # name, type, slot, status (complete / needs setup), id
215
- cinna account credentials list --json # the raw listing
214
+ cinna account credentials list # Your credentials + Shared with you (owner, via, access)
215
+ cinna account credentials list --shared # only what others shared with you (--owned: only yours)
216
+ cinna account credentials list --json # the raw listing (is_shared, owner_email, access_level, …)
216
217
  cinna account credentials update <cred_id> --service-uri some-token.com # give it the slot a skill declares
217
218
  cinna account credentials share-with-agent <cred_id> --agent crm-agent
218
219
  cinna account credentials update <cred_id> --name "Stripe (live)"
219
220
  cinna account credentials delete <cred_id> --yes
220
221
  ```
221
222
 
223
+ **Shared with you** lists credentials another user shared directly, through a group (`group <name>` under Via) or with a bundle / skill install; `--workspace` filters only your own rows. In `--json`, `is_shared` is the ownership fact (`category` is the web tab). You can attach a shared credential to your own agents with `share-with-agent` and use it there; only its owner can change it — `update` and `delete` exit 1 with the platform's `not_owner` sentence naming them. `agent show`, `skills list` readiness and `agent import` read slots and ownership from this listing, so a linked shared credential shows its real slot and `shared by <owner>`.
224
+
222
225
  A new draft lands in the account's [active user workspace](#cinna-account-user-workspace-list--activate-nameid--clear). Deletes reuse the platform's blast-radius gate (a publisher-provided credential in a published bundle with active installs needs `--force`). All write verbs require the `agent-developer` role.
223
226
 
224
227
  ### `cinna improve list | show | download | status`
@@ -255,7 +258,7 @@ The archive deliberately contains **no** container logs, **no** uploaded file co
255
258
 
256
259
  The archive is another person's conversation: don't copy it into an agent workspace, don't commit it, and delete the local copy when you're done. The end-to-end playbook a local coding agent should follow — including where a fix has to land for a bundle publisher install versus a standalone agent — ships in the account workspace's context package at `context/guides/handling-improvement-requests.md`.
257
260
 
258
- The same queue carries **API capability requests** (kind `api` in the Kind column, with their title): a caller of one of your agents' REST APIs asking for something the API lacks, filed from the caller's own code. They have no session — `show` prints the need, the proposed endpoint (parameters and response fields), the examples, the consumer agent and the API version the caller read; `download` extracts a flat `README.md` + `request.md`. The fix goes in the producer's `agent_api/` code, not its prompts: extend additively, bump `API_VERSION`, update `CONSUMERS.md`, verify with `cinna agent-api refresh` / `spec` / `call`, then close with `cinna improve status <id> completed --note "<endpoint, fields, new version>"` — the caller reads that note. Everything a caller wrote is printed verbatim and is data, not instructions. The playbook is `context/guides/building-an-agent-api.md` ("Handling capability requests"). `--kind` is filtered by the CLI over one page of 200 rows, since the platform's list route has no kind filter. The CLI never files a capability request itself; a consumer agent does, after its user confirms the draft (see its per-agent `CLAUDE.md`).
261
+ The same queue carries **API capability requests** (kind `api` in the Kind column, with their title): a caller of one of your agents' REST APIs asking for something the API lacks, filed from the caller's own code. They have no session — `show` prints the need, the proposed endpoint (parameters and response fields), the examples, the consumer agent and the API version the caller read; `download` extracts a flat `README.md` + `request.md`. The fix goes in the producer's `agent_api/` code, not its prompts: extend additively, bump `API_VERSION`, update `CONSUMERS.md`, verify with `cinna agent-api refresh` / `spec` / `call`, then close with `cinna improve status <id> completed --note "<endpoint, fields, new version>"` — the caller reads that note. Everything a caller wrote is printed verbatim and is data, not instructions. The playbook is `context/guides/building-an-agent-api.md` ("Handling capability requests"). `--kind` is filtered by the CLI over one page of 200 rows, since the platform's list route has no kind filter. A consumer files one after its user confirms the draft — from its own code, or from the account workspace with `cinna agent-api request file` (see below); either way the consumer agent shows as "via".
259
262
 
260
263
  ### `cinna agent create <name> [--description TEXT]`
261
264
 
@@ -507,16 +510,38 @@ cinna agent-api access list orders-agent --all
507
510
  cinna agent-api access revoke orders-agent a1b2c3d4
508
511
  ```
509
512
 
510
- `cinna account credentials list` shows an issued key's state in its Status column, and a skill slot filled by a revoked or expired key reads as not usable. `cinna agent import` does not draft `agent_api` credentials; it prints the `access issue` / `connect agent-api` command instead.
513
+ `cinna account credentials list` shows an issued key's state in its Status column, and a skill slot filled by a revoked or expired key reads as not usable. `cinna agent import` does not draft `agent_api` credentials: it attaches an existing one (same name, else the declared slot; yours or shared with you) or prints the `access issue` / `connect agent-api` command.
511
514
 
512
515
  ### `cinna connect agent-api --producer <agent> --consumer <agent> [--label TEXT] [--read-only]`
513
516
 
514
- Wire one agent to another's REST API from the account workspace. Resolves both agents (name, slug, or ID), mints a producer API token, and attaches it to the consumer as a credential — which rides the consumer's normal credential sync into its remote environment, so no key ever touches your machine. Prints the credential ID, token prefix, base URL, and spec URL. `--read-only` restricts the consumer to read-only access; `--label` names the credential. Backend errors surface verbatim: 400 if the producer's REST API is disabled, 403/404 for ownership violations.
517
+ Wire one agent to another's REST API from the account workspace. Resolves both agents (name, slug, or ID), mints a producer API token, and attaches it to the consumer as a credential — which rides the consumer's normal credential sync into its remote environment, so no key ever touches your machine. Prints the credential ID, token prefix, base URL, and spec URL. `--read-only` restricts the consumer to read-only access; `--label` names the credential; `--scopes a,b` sets the scopes the connection carries (an unknown one is refused with the producer's declared list). Backend errors surface verbatim: 400 if the producer's REST API is disabled, 403/404 for ownership violations.
515
518
 
516
519
  ```bash
517
520
  cinna connect agent-api --producer crm-agent --consumer hr-manager-agent --read-only
518
521
  ```
519
522
 
523
+ ### `cinna agent-api connections | request` (consumer side)
524
+
525
+ What one of your agents can call, and asking a producer for more. An agent's *connections* are the `agent_api` credentials linked to it — wired with `connect agent-api`, issued to you, or shared with you by their owner and attached with `share-with-agent`.
526
+
527
+ ```bash
528
+ cinna agent-api connections crm-agent # producer, key status, scopes, SDK lookup, from; then base/spec/improvement-requests URLs
529
+ cinna agent-api connections crm-agent --json
530
+ cinna agent-api connections spec crm-agent btc-rate -o spec.json # the producer's spec through that connection
531
+ cinna agent-api request file crm-agent btc-rate --title "Historical rate by date" \
532
+ --need "The monthly report needs the rate on a past date" --spec-version 1.2.0
533
+ cinna agent-api request file crm-agent btc-rate --body-json draft.json # or the whole body as JSON (- = stdin)
534
+ cinna agent-api request list crm-agent btc-rate # your requests on that producer: status and the owner's note
535
+ cinna agent-api connections scopes btc-rate-api <connection-id> --set btc.read # producer owner: scopes the connection carries (--clear)
536
+ ```
537
+
538
+ - `<connection>` is the credential id (or a unique prefix), its slot, or its exact name; several connections with one name refuse with `ambiguous_connection`.
539
+ - **Scopes** are what calls through the connection get: your own grant plus the scopes the connection carries (marked `(connection)`; `connection_scopes` in `--json`). Only the producer's owner sets a connection's scopes (`connections scopes`, or `cinna connect agent-api … --scopes a,b` at creation); values must be scopes the producer declares (`unknown_scope` lists them), and they apply from the next call to everyone using the connection. A call answered 403 "This endpoint requires the '<scope>' scope" lacks it: ask the producer's owner to add it to the connection or grant it to you.
540
+ - **SDK lookup** is what a script passes to `credentials.agent_api_session(...)`: the slot when only one connection carries it, else the credential id. `request list` also works on a connection that is not usable (e.g. a revoked key), so earlier requests stay readable.
541
+ - The URLs are what the agent's **environment** calls (locally `http://backend:8000/…`): the CLI never calls them. No token is ever printed, in tables or `--json`.
542
+ - `request file` sends the strict body core expects (`title`, `need`, optional `proposed_endpoint` from `--proposed-endpoint-json FILE|-`, `example_request`, `example_response`, `spec_version_seen`). Core files it with the connection on the server, attributed to you and the consumer agent; the producer's owner sees it in `cinna improve list --kind api`. A bad body exits 1 with each error and the expected shape of every field (`--json`: `code: invalid_capability_request`, `errors`, `expected`); `rate_limited` carries `retry_after_s`. Filing needs the `agent-developer` role. Show the user the draft before filing.
543
+ - `agent show <agent>` prints a one-line-per-connection summary.
544
+
520
545
  ### `cinna connect mcp --producer <agent> --consumer <agent> [--label TEXT] [--conversation-only|--building-only]`
521
546
 
522
547
  Wire one agent to another's agent2agent MCP connector. The consumer is resolved from your agents; the producer is resolved against the platform's discoverable-connectors listing (it must expose an agent2agent MCP connector your account is allowed to consume — the error lists the discoverable options otherwise). By default the connection is enabled in both conversation and building modes; scope it with `--conversation-only` / `--building-only`. Prints the credential ID, endpoint, transport, and status — plus an authorize URL to open if the connector requires OAuth.
@@ -174,14 +174,17 @@ cinna account credentials types # types + the
174
174
  cinna account credentials create --name "Stripe Key" --type api_token \
175
175
  --agent billing-agent # create a draft and attach it in one step
176
176
  # → prints required fields (e.g. api_token) + a link to fill them in
177
- cinna account credentials list # name, type, slot, status (complete / needs setup), id
178
- cinna account credentials list --json # the raw listing
177
+ cinna account credentials list # Your credentials + Shared with you (owner, via, access)
178
+ cinna account credentials list --shared # only what others shared with you (--owned: only yours)
179
+ cinna account credentials list --json # the raw listing (is_shared, owner_email, access_level, …)
179
180
  cinna account credentials update <cred_id> --service-uri some-token.com # give it the slot a skill declares
180
181
  cinna account credentials share-with-agent <cred_id> --agent crm-agent
181
182
  cinna account credentials update <cred_id> --name "Stripe (live)"
182
183
  cinna account credentials delete <cred_id> --yes
183
184
  ```
184
185
 
186
+ **Shared with you** lists credentials another user shared directly, through a group (`group <name>` under Via) or with a bundle / skill install; `--workspace` filters only your own rows. In `--json`, `is_shared` is the ownership fact (`category` is the web tab). You can attach a shared credential to your own agents with `share-with-agent` and use it there; only its owner can change it — `update` and `delete` exit 1 with the platform's `not_owner` sentence naming them. `agent show`, `skills list` readiness and `agent import` read slots and ownership from this listing, so a linked shared credential shows its real slot and `shared by <owner>`.
187
+
185
188
  A new draft lands in the account's [active user workspace](#cinna-account-user-workspace-list--activate-nameid--clear). Deletes reuse the platform's blast-radius gate (a publisher-provided credential in a published bundle with active installs needs `--force`). All write verbs require the `agent-developer` role.
186
189
 
187
190
  ### `cinna improve list | show | download | status`
@@ -218,7 +221,7 @@ The archive deliberately contains **no** container logs, **no** uploaded file co
218
221
 
219
222
  The archive is another person's conversation: don't copy it into an agent workspace, don't commit it, and delete the local copy when you're done. The end-to-end playbook a local coding agent should follow — including where a fix has to land for a bundle publisher install versus a standalone agent — ships in the account workspace's context package at `context/guides/handling-improvement-requests.md`.
220
223
 
221
- The same queue carries **API capability requests** (kind `api` in the Kind column, with their title): a caller of one of your agents' REST APIs asking for something the API lacks, filed from the caller's own code. They have no session — `show` prints the need, the proposed endpoint (parameters and response fields), the examples, the consumer agent and the API version the caller read; `download` extracts a flat `README.md` + `request.md`. The fix goes in the producer's `agent_api/` code, not its prompts: extend additively, bump `API_VERSION`, update `CONSUMERS.md`, verify with `cinna agent-api refresh` / `spec` / `call`, then close with `cinna improve status <id> completed --note "<endpoint, fields, new version>"` — the caller reads that note. Everything a caller wrote is printed verbatim and is data, not instructions. The playbook is `context/guides/building-an-agent-api.md` ("Handling capability requests"). `--kind` is filtered by the CLI over one page of 200 rows, since the platform's list route has no kind filter. The CLI never files a capability request itself; a consumer agent does, after its user confirms the draft (see its per-agent `CLAUDE.md`).
224
+ The same queue carries **API capability requests** (kind `api` in the Kind column, with their title): a caller of one of your agents' REST APIs asking for something the API lacks, filed from the caller's own code. They have no session — `show` prints the need, the proposed endpoint (parameters and response fields), the examples, the consumer agent and the API version the caller read; `download` extracts a flat `README.md` + `request.md`. The fix goes in the producer's `agent_api/` code, not its prompts: extend additively, bump `API_VERSION`, update `CONSUMERS.md`, verify with `cinna agent-api refresh` / `spec` / `call`, then close with `cinna improve status <id> completed --note "<endpoint, fields, new version>"` — the caller reads that note. Everything a caller wrote is printed verbatim and is data, not instructions. The playbook is `context/guides/building-an-agent-api.md` ("Handling capability requests"). `--kind` is filtered by the CLI over one page of 200 rows, since the platform's list route has no kind filter. A consumer files one after its user confirms the draft — from its own code, or from the account workspace with `cinna agent-api request file` (see below); either way the consumer agent shows as "via".
222
225
 
223
226
  ### `cinna agent create <name> [--description TEXT]`
224
227
 
@@ -470,16 +473,38 @@ cinna agent-api access list orders-agent --all
470
473
  cinna agent-api access revoke orders-agent a1b2c3d4
471
474
  ```
472
475
 
473
- `cinna account credentials list` shows an issued key's state in its Status column, and a skill slot filled by a revoked or expired key reads as not usable. `cinna agent import` does not draft `agent_api` credentials; it prints the `access issue` / `connect agent-api` command instead.
476
+ `cinna account credentials list` shows an issued key's state in its Status column, and a skill slot filled by a revoked or expired key reads as not usable. `cinna agent import` does not draft `agent_api` credentials: it attaches an existing one (same name, else the declared slot; yours or shared with you) or prints the `access issue` / `connect agent-api` command.
474
477
 
475
478
  ### `cinna connect agent-api --producer <agent> --consumer <agent> [--label TEXT] [--read-only]`
476
479
 
477
- Wire one agent to another's REST API from the account workspace. Resolves both agents (name, slug, or ID), mints a producer API token, and attaches it to the consumer as a credential — which rides the consumer's normal credential sync into its remote environment, so no key ever touches your machine. Prints the credential ID, token prefix, base URL, and spec URL. `--read-only` restricts the consumer to read-only access; `--label` names the credential. Backend errors surface verbatim: 400 if the producer's REST API is disabled, 403/404 for ownership violations.
480
+ Wire one agent to another's REST API from the account workspace. Resolves both agents (name, slug, or ID), mints a producer API token, and attaches it to the consumer as a credential — which rides the consumer's normal credential sync into its remote environment, so no key ever touches your machine. Prints the credential ID, token prefix, base URL, and spec URL. `--read-only` restricts the consumer to read-only access; `--label` names the credential; `--scopes a,b` sets the scopes the connection carries (an unknown one is refused with the producer's declared list). Backend errors surface verbatim: 400 if the producer's REST API is disabled, 403/404 for ownership violations.
478
481
 
479
482
  ```bash
480
483
  cinna connect agent-api --producer crm-agent --consumer hr-manager-agent --read-only
481
484
  ```
482
485
 
486
+ ### `cinna agent-api connections | request` (consumer side)
487
+
488
+ What one of your agents can call, and asking a producer for more. An agent's *connections* are the `agent_api` credentials linked to it — wired with `connect agent-api`, issued to you, or shared with you by their owner and attached with `share-with-agent`.
489
+
490
+ ```bash
491
+ cinna agent-api connections crm-agent # producer, key status, scopes, SDK lookup, from; then base/spec/improvement-requests URLs
492
+ cinna agent-api connections crm-agent --json
493
+ cinna agent-api connections spec crm-agent btc-rate -o spec.json # the producer's spec through that connection
494
+ cinna agent-api request file crm-agent btc-rate --title "Historical rate by date" \
495
+ --need "The monthly report needs the rate on a past date" --spec-version 1.2.0
496
+ cinna agent-api request file crm-agent btc-rate --body-json draft.json # or the whole body as JSON (- = stdin)
497
+ cinna agent-api request list crm-agent btc-rate # your requests on that producer: status and the owner's note
498
+ cinna agent-api connections scopes btc-rate-api <connection-id> --set btc.read # producer owner: scopes the connection carries (--clear)
499
+ ```
500
+
501
+ - `<connection>` is the credential id (or a unique prefix), its slot, or its exact name; several connections with one name refuse with `ambiguous_connection`.
502
+ - **Scopes** are what calls through the connection get: your own grant plus the scopes the connection carries (marked `(connection)`; `connection_scopes` in `--json`). Only the producer's owner sets a connection's scopes (`connections scopes`, or `cinna connect agent-api … --scopes a,b` at creation); values must be scopes the producer declares (`unknown_scope` lists them), and they apply from the next call to everyone using the connection. A call answered 403 "This endpoint requires the '<scope>' scope" lacks it: ask the producer's owner to add it to the connection or grant it to you.
503
+ - **SDK lookup** is what a script passes to `credentials.agent_api_session(...)`: the slot when only one connection carries it, else the credential id. `request list` also works on a connection that is not usable (e.g. a revoked key), so earlier requests stay readable.
504
+ - The URLs are what the agent's **environment** calls (locally `http://backend:8000/…`): the CLI never calls them. No token is ever printed, in tables or `--json`.
505
+ - `request file` sends the strict body core expects (`title`, `need`, optional `proposed_endpoint` from `--proposed-endpoint-json FILE|-`, `example_request`, `example_response`, `spec_version_seen`). Core files it with the connection on the server, attributed to you and the consumer agent; the producer's owner sees it in `cinna improve list --kind api`. A bad body exits 1 with each error and the expected shape of every field (`--json`: `code: invalid_capability_request`, `errors`, `expected`); `rate_limited` carries `retry_after_s`. Filing needs the `agent-developer` role. Show the user the draft before filing.
506
+ - `agent show <agent>` prints a one-line-per-connection summary.
507
+
483
508
  ### `cinna connect mcp --producer <agent> --consumer <agent> [--label TEXT] [--conversation-only|--building-only]`
484
509
 
485
510
  Wire one agent to another's agent2agent MCP connector. The consumer is resolved from your agents; the producer is resolved against the platform's discoverable-connectors listing (it must expose an agent2agent MCP connector your account is allowed to consume — the error lists the discoverable options otherwise). By default the connection is enabled in both conversation and building modes; scope it with `--conversation-only` / `--building-only`. Prints the credential ID, endpoint, transport, and status — plus an authorize URL to open if the connector requires OAuth.
@@ -291,13 +291,13 @@ authoring convention.
291
291
  | Feature | Command surface | Docs |
292
292
  |---|---|---|
293
293
  | **Bootstrap & onboarding** | `cinna setup` / `set-token` / `login` / `list` / `status` / `disconnect[-all]` / `completion` / `dev` / `redev`; the no-TTY contract (`--no-input`, `--json`, exit codes, `CINNA_MUTAGEN_BIN`) | [business](features/bootstrap_onboarding/bootstrap_onboarding.md) · [tech](features/bootstrap_onboarding/bootstrap_onboarding_tech.md) · [acceptance](features/bootstrap_onboarding/bootstrap_onboarding_acceptance.md) |
294
- | **Account workspace** | `cinna account` (setup, set-token, agents, status, refresh-context, user-workspace, credentials — `list` shows each credential's slot, `--json`); desktop-managed workspaces | [business](features/account_workspace/account_workspace.md) · [tech](features/account_workspace/account_workspace_tech.md) · [acceptance](features/account_workspace/account_workspace_acceptance.md) |
294
+ | **Account workspace** | `cinna account` (setup, set-token, agents, status, refresh-context, user-workspace, credentials — `list` shows each credential's slot and a *Shared with you* section, `--owned/--shared`, `--json`; `not_owner` on a shared row); desktop-managed workspaces | [business](features/account_workspace/account_workspace.md) · [tech](features/account_workspace/account_workspace_tech.md) · [acceptance](features/account_workspace/account_workspace_acceptance.md) |
295
295
  | **Agent management** | `cinna agent` (sync — which also starts the sync session, unsync, create, restart-env, rebuild-env — which waits for the health check, show — with each credential's slot, prompts pull / diff / push, model show / set — the model per mode, merged client-side and applied by a rebuild, status) | [business](features/agent_management/agent_management.md) · [tech](features/agent_management/agent_management_tech.md) · [acceptance](features/agent_management/agent_management_acceptance.md) |
296
296
  | **Agent schedules** | `cinna agent schedule` (list, generate, create, update, run, logs, delete) | [business](features/agent_schedules/agent_schedules.md) · [tech](features/agent_schedules/agent_schedules_tech.md) · [acceptance](features/agent_schedules/agent_schedules_acceptance.md) |
297
297
  | **Live sync** | `cinna sync` (status, conflicts `[--diff]`, push, pull, resolve) + Mutagen transport; the session is started by `cinna agent sync` so the first push has a baseline | [business](features/live_sync/live_sync.md) · [tech](features/live_sync/live_sync_tech.md) · [acceptance](features/live_sync/live_sync_acceptance.md) |
298
298
  | **Remote exec** | `cinna exec` | [business](features/remote_exec/remote_exec.md) · [tech](features/remote_exec/remote_exec_tech.md) · [acceptance](features/remote_exec/remote_exec_acceptance.md) |
299
299
  | **Remote chat** | `cinna chat` (incl. `--attach` / `--show` to recover or read an existing session; poll failures retried within `--timeout`) · `cinna agent scenarios list / run` (replay `docs/test_scenarios/` Say rows, one session per row) | <!-- nocheck: agent-workspace path --> [business](features/remote_chat/remote_chat.md) · [tech](features/remote_chat/remote_chat_tech.md) · [acceptance](features/remote_chat/remote_chat_acceptance.md) |
300
- | **Agent API** | `cinna agent-api` (enable, refresh, spec, call, access list/issue/revoke/scopes) · `cinna api` · `cinna connect agent-api` | [business](features/agent_api/agent_api.md) · [tech](features/agent_api/agent_api_tech.md) · [acceptance](features/agent_api/agent_api_acceptance.md) |
300
+ | **Agent API** | `cinna agent-api` (enable, refresh, spec, call, access list/issue/revoke/scopes; consumer side: connections [spec, scopes], request file/list) · `connect agent-api --scopes` · `cinna api` · `cinna connect agent-api` | [business](features/agent_api/agent_api.md) · [tech](features/agent_api/agent_api_tech.md) · [acceptance](features/agent_api/agent_api_acceptance.md) |
301
301
  | **Agent addons** | `cinna skills` (list — with each declared credential slot's readiness, publish, install, uninstall, update, toggle, refresh, catalog, show, revisions, files, grants, grant, revoke, visibility, delist, relist) — the whole skills lifecycle: what an agent carries, publishing one of its `skills/<name>/` folders to the catalog, installing a package on another agent and keeping it current, and sharing after the fact | [business](features/agent_addons/agent_addons.md) · [tech](features/agent_addons/agent_addons_tech.md) · [acceptance](features/agent_addons/agent_addons_acceptance.md) |
302
302
  | **MCP integration** | `cinna connect mcp` · `cinna mcp-proxy` (knowledge stdio server) | [business](features/mcp_integration/mcp_integration.md) · [tech](features/mcp_integration/mcp_integration_tech.md) · [acceptance](features/mcp_integration/mcp_integration_acceptance.md) |
303
303
  | **Git versioning** | `cinna git` (link, status, commit, push, pull, log, checkout, unlink) — external remotes with your own credentials, `cinna` remotes with the CLI token | [business](features/git_versioning/git_versioning.md) · [tech](features/git_versioning/git_versioning_tech.md) · [acceptance](features/git_versioning/git_versioning_acceptance.md) |
@@ -636,6 +636,7 @@ When a CLI token expires (or is revoked) the normal remedy is `cinna set-token <
636
636
  | POST | `/api/v1/cli/account/files/upload` | Account token | Multipart upload for `cinna chat --file` (the proxy can't carry multipart) |
637
637
  | (proxy) | `dashboards/capabilities`, `agents/{id}/dashboards/…`, `dashboards/…`, `dashboards/{id}/blocks/{block}/component/…`, `dashboards/{id}/chat`, `dashboards/component-refs/resolve` | Account token | `cinna dashboards` and `cinna chat --board`, all through the api-proxy; never the `…/frame` routes (core's proxy refuses them) |
638
638
  | GET/PATCH | `/api/v1/cli/account/improvement-requests[/{id}[/archive]]` | Account token | Improvement requests received on the agents the account owns (`cinna improve`); the `/archive` route returns a binary ZIP the JSON-only proxy can't carry |
639
+ | GET/POST | `/api/v1/cli/account/agents/{id}/agent-api-connections[/{cred}/spec\|/{cred}/capability-requests]` | Account token | An agent's connections to other agents' REST APIs (metadata, env-origin URLs, never a token), the producer's spec through one, and capability requests filed through one (`cinna agent-api connections` / `request`) |
639
640
 
640
641
  `cinna chat` reaches the conversation API **through** the api-proxy (so these are inner routes, not CLI routes): `POST /sessions/`, `GET /sessions/{id}`, `GET /sessions/{id}/messages`, `POST /sessions/{id}/messages/stream`, `GET /sessions/{id}/messages/streaming-status`, `POST /sessions/{id}/messages/interrupt`, and `GET /files/{id}/download`.
641
642
 
@@ -102,7 +102,9 @@ each with its own token, registry entry, and Mutagen session.
102
102
  `cinna login` gives, minus the browser. A bare token reuses the stored
103
103
  platform URL.
104
104
  3. The new token must be for the **same account**: a different platform origin,
105
- or a different `sub` on the token, is refused (exit 11) and nothing is written.
105
+ or a different `owner_id` on the token, is refused (exit 11) and nothing is
106
+ written. The token's `sub` is not compared: the platform mints a new token
107
+ row, and so a new `sub`, on every exchange.
106
108
  4. Child tokens are not touched; `cinna doctor` re-mints expired ones as usual.
107
109
 
108
110
  ### Driven by Cinna Desktop (no terminal)
@@ -126,8 +128,9 @@ each with its own token, registry entry, and Mutagen session.
126
128
  `not_an_account_workspace`, …) · `2` bad invocation.
127
129
  5. Later the desktop runs `cinna account set-token "<setup_command>" --no-input
128
130
  --json` to refresh silently, and `cinna account status --json` to read token
129
- validity, synced agents, context-package freshness and whether the installed
130
- cinna-cli matches the version the platform pins.
131
+ validity, the owning account (`account.id`, read from the token even when it
132
+ has expired), synced agents, context-package freshness and whether the
133
+ installed cinna-cli matches the version the platform pins.
131
134
 
132
135
  ### Discover and attach agents
133
136
  1. `cinna account agents` lists the agents the account can access — name + id,
@@ -166,10 +169,25 @@ each with its own token, registry entry, and Mutagen session.
166
169
  it is the column that answers "which credential fills this skill's slot". The
167
170
  hint under the table names `cinna account credentials update <id> --service-uri
168
171
  <slot>`. `--json` prints the raw listing.
172
+ - The listing has two sections: **Your credentials**, and **Shared with you** —
173
+ credentials another user shared directly, through a group, or with a bundle /
174
+ skill install — with Owner (their email), Via (`direct`, the install kind,
175
+ `group <name>`) and Access (the share's level). `--owned` / `--shared` show one
176
+ section; `--workspace` filters only your own rows (a shared one belongs to no
177
+ workspace of yours). In `--json` every row carries `is_shared` — the ownership
178
+ fact; `category` is the web tab — plus `owner_email`, `access_level`,
179
+ `share_source`, `via_groups` and `allow_bundle_reuse_effective`.
169
180
  - `cinna account credentials update <id>` edits metadata (name/notes/service-uri/
170
181
  sharing), never a secret. `cinna account credentials share-with-agent <id>
171
- --agent <ref>` attaches an existing credential. `cinna account credentials
172
- delete <id>` removes it (and unlinks it from agents).
182
+ --agent <ref>` attaches an existing credential — yours or one shared with you.
183
+ `cinna account credentials delete <id>` removes it (and unlinks it from
184
+ agents). A shared credential is the owner's: `update` and `delete` refuse it
185
+ with the platform's `not_owner` sentence naming the owner.
186
+ - `agent show`, `skills list` readiness and `agent import` read slots, status
187
+ and ownership from this same listing, so a shared credential linked to an
188
+ agent shows its real slot and `shared by <owner>` instead of an unknown slot.
189
+ An `agent_api` credential linked to an agent is an *agent API connection*:
190
+ see the consumer side in [agent_api](../agent_api/agent_api.md).
173
191
 
174
192
  ### Keep context fresh
175
193
  - `cinna account status` shows the account root, platform/frontend URLs, machine
@@ -357,7 +357,10 @@ the silent-secret and scope-drift bugs live.
357
357
  cinna doctor --dry-run
358
358
  ```
359
359
  - **Expected:** exactly one JSON line with `result`, `workspace`,
360
- `platform_url`, `frontend_url`, `machine_name`, `active_workspace`
360
+ `platform_url`, `frontend_url`, `machine_name`, `account` (`{id}` — the
361
+ token's `owner_id`, present even with an expired token or the platform down;
362
+ `email` only if the platform returns one; the key is absent, not `null`, for a
363
+ token without `owner_id`), `active_workspace`
361
364
  (`{id,name}` or `null`), `token` (`valid|expired|unreachable`),
362
365
  `synced_agents`, `agents[]`, `context_package{local,remote,state}` and
363
366
  `cli{installed,required,state}`. When the platform publishes
@@ -414,3 +417,24 @@ the silent-secret and scope-drift bugs live.
414
417
  - Verify `~/.cinna/agents.json` has no leftover entries for the test children —
415
418
  especially if any helper ran **outside** pytest's global-state isolation (it
416
419
  would write the real registry).
420
+
421
+ ### 19. Credentials shared with you (needs core 512aa258)
422
+
423
+ - **Goal:** a credential another user shared shows up, is attachable, and is
424
+ read-only.
425
+ - **Setup:** user A shares a credential with user B (web: credential → Share).
426
+ Run as B.
427
+ - **Steps:**
428
+ ```
429
+ cinna account credentials list
430
+ cinna account credentials list --shared --json
431
+ cinna account credentials update <shared-id> --service-uri x; echo "exit=$?"
432
+ ```
433
+ - **Expected:** a *Shared with you* section with Owner = A's email, Via
434
+ (`direct` / `group <name>`), Access; `--json` rows `is_shared: true`;
435
+ `update` exits 1 with `This credential is shared with you by <A>; only the
436
+ owner can change it.` Full consumer-side scenarios (attach, connections,
437
+ capability requests): `docs/features/agent_api/agent_api_acceptance.md`
438
+ scenarios 18–26.
439
+ - **Watch for:** "No credentials on this account." for B; a shared row in
440
+ `--owned`.
@@ -73,9 +73,13 @@ Each verb → its handler in `src/cinna/main.py` → the body in
73
73
  - `cinna account user-workspace clear` →
74
74
  `src/cinna/main.py:account_user_workspace_clear()` →
75
75
  `src/cinna/account.py:run_user_workspace_clear()`
76
- - `cinna account credentials list` →
76
+ - `cinna account credentials list [--owned|--shared]` →
77
77
  `src/cinna/main.py:account_credentials_list()` →
78
- `src/cinna/account.py:run_credentials_list()`
78
+ `src/cinna/account.py:run_credentials_list()` (sections split on
79
+ `is_shared`; `src/cinna/account.py:_credential_via_cell()` renders Via;
80
+ update/delete refusals on shared rows arrive as `CodedRefusal` `not_owner`
81
+ because `update_credential` / `delete_credential` read coded bodies; tests
82
+ in `tests/test_agent_api_connections.py`)
79
83
  - `cinna account credentials types` →
80
84
  `src/cinna/main.py:account_credentials_types()` →
81
85
  `src/cinna/account.py:run_credentials_types()`
@@ -136,12 +140,15 @@ Related (documented here as integration points): `cinna agent sync` →
136
140
  - `src/cinna/account.py:run_account_set_token()` — `find_account_root()` →
137
141
  `parse_account_setup_input(…, fallback_platform_url=<stored>/api)` →
138
142
  exchange under the **stored** `machine_name` → `_same_origin()` check on
139
- `platform_url` and `_jwt_claims()` `sub` comparison (both raise
143
+ `platform_url` and `_token_owner_id()` `owner_id` comparison, skipped when
144
+ either token lacks one (both raise
140
145
  `AccountMismatchError`, 11, before any write) → rewrite `account_token` +
141
146
  refreshed `platform_url` / `frontend_url` → `save_account_config()`.
142
147
  `user_workspace_*`, `machine_name`, `context/`, children untouched.
143
148
  - `src/cinna/account.py:_jwt_claims()` — unverified base64 decode of a JWT
144
- payload, only to compare `sub`; opaque tokens yield `None` (no comparison).
149
+ payload, only to read `owner_id` (`_token_owner_id()`); opaque tokens yield
150
+ `None` (no comparison, no account id). Never `sub`: core's `create_cli_jwt`
151
+ puts the CLI token row id there, a fresh uuid per mint.
145
152
  - `src/cinna/account.py:_account_result_fields()` — the shared `--json` final
146
153
  line of setup / set-token (`workspace`, `platform_url`, `frontend_url`,
147
154
  `machine_name`, `context_package: ok|failed|skipped`).
@@ -161,7 +168,8 @@ Related (documented here as integration points): `cinna agent sync` →
161
168
  row with the local checkout from `list_child_workspaces()`.
162
169
  - `src/cinna/account.py:run_account_status()` — `probe_account_token()` +
163
170
  `context_package_status()` + `cli_version_status()`; in JSON mode emits the
164
- single `result` line (`token`, `active_workspace`, `synced_agents`, `agents[]`,
171
+ single `result` line (`account{id,email?}`, `token`, `active_workspace`,
172
+ `synced_agents`, `agents[]`,
165
173
  `context_package{local,remote,state}`, `cli{installed,required,state}`) and
166
174
  returns; otherwise the Rich table + `_synced_agents_table()` +
167
175
  `_print_token_reauth_hint()` (which now names `cinna account set-token` next
@@ -274,7 +282,7 @@ All consumed by `src/cinna/client.py:AccountClient` with the account token
274
282
  `platform_url`, `frontend_url`, `machine_name`. Used by both `account setup`
275
283
  and `account set-token`; the CLI relies on the response being identical for a
276
284
  first and a repeat exchange (no `user`/owner field is required — the
277
- same-account check works from the origin and the token's own `sub`).
285
+ same-account check works from the origin and the token's own `owner_id`).
278
286
  - `GET /.well-known/cinna-desktop` (unauthenticated, platform origin) — the
279
287
  desktop discovery document; `local_dev.cinna_cli_version` is the cinna-cli
280
288
  pin (`src/cinna/cli_version.py:fetch_required_cli_version()`). Absent block,
@@ -319,10 +327,18 @@ All consumed by `src/cinna/client.py:AccountClient` with the account token
319
327
  - **Absolute `--dir` is used as is, parents created** — `resolve_account_dir()`;
320
328
  the `workspace` reported in JSON is the path the caller passed.
321
329
  (`tests/test_onboarding.py:test_setup_absolute_dir_used_as_is_and_parents_created`)
322
- - **`set-token` never rebinds** — the origin / `sub` checks precede the write;
330
+ - **`set-token` never rebinds** — the origin / `owner_id` checks precede the write;
323
331
  on mismatch `account.json` is byte-identical afterwards.
324
332
  (`tests/test_onboarding.py:test_account_set_token_platform_mismatch_exits_11`,
325
- `test_account_set_token_subject_mismatch_exits_11`)
333
+ `test_account_set_token_owner_mismatch_exits_11`; a same-owner refresh with a
334
+ new `sub` passes, `test_account_set_token_same_owner_new_sub_succeeds`)
335
+ - **`account status --json` names the account** — `_account_identity()`:
336
+ `account.id` is the token's `owner_id` claim, a local read present for valid,
337
+ expired and unreachable tokens; `account.email` only when the probe's 2xx body
338
+ carries `account.email` (core's `GET /cli/account/agents` does not today, so it
339
+ is normally absent); no `account` key, never `null`, without an `owner_id`.
340
+ (`tests/test_onboarding.py:test_status_json_account_id_*`,
341
+ `test_status_json_no_account_key_without_owner_id`)
326
342
  - **`set-token` preserves everything but the token** — active user workspace,
327
343
  machine name and child configs survive.
328
344
  (`tests/test_onboarding.py:test_account_set_token_swaps_token_in_place`)
@@ -10,6 +10,11 @@ loop to build, verify, and wire those connections from the account workspace:
10
10
  **one-click wiring** of a consumer to it; and `cinna api` is a separate
11
11
  **escape hatch** for calling the platform's *own* control-plane API directly.
12
12
 
13
+ On the **consumer** side, `cinna agent-api connections` shows what one agent
14
+ can call (its linked connections, yours or shared with you by their owner) and
15
+ reads a producer's spec through one, and `cinna agent-api request` files and
16
+ reads **capability requests** — "this API lacks what I need" — through it.
17
+
13
18
  These three command surfaces live in the same area but solve different
14
19
  problems — keep them apart in your head (see "Three things named 'api'" below).
15
20
 
@@ -92,12 +97,59 @@ to test a producer endpoint — use `cinna agent-api call`.
92
97
  ### Wire a consumer to it
93
98
  - `cinna connect agent-api --producer <A> --consumer <B>` mints A's producer
94
99
  token and attaches it to B as a credential. `--label` names the credential;
95
- `--read-only` restricts the consumer to read-only API access.
100
+ `--read-only` restricts the consumer to read-only API access; `--scopes a,b`
101
+ sets the scopes the connection carries (see "Connection scopes").
96
102
  - The output reports the credential id, token prefix, and base/spec URLs, and
97
103
  reminds you the credential rides B's normal credential sync into its env (it
98
104
  appears read-only under `workspace/credentials/` in a synced workspace) —
99
105
  no manual key handling.
100
106
 
107
+ ### Use a connection from the consumer side
108
+ 1. `cinna agent-api connections <consumer>` lists every `agent_api` credential
109
+ linked to the consumer: name, producer, key status (and, when the
110
+ environment would get no working key, `not usable: <reason>` with the fix),
111
+ scopes, **SDK lookup** — what a script passes to
112
+ `credentials.agent_api_session(...)`: the slot when only one connection carries it, else the credential id — and
113
+ who it is from (yours, or shared by its owner's email). Below the table,
114
+ each connection's `base_url`, `spec_url` and `improvement_requests_url`,
115
+ labelled as what the agent's **environment** calls. `--json` is core's
116
+ listing.
117
+ 2. `cinna agent-api connections spec <consumer> <connection>` prints the
118
+ producer's OpenAPI spec as this consumer sees it (the document the
119
+ environment gets from `spec_url`); `-o FILE` saves it and names the API
120
+ version to quote.
121
+ 3. The consumer needs something the API lacks: draft a capability request
122
+ (title, need, optionally a proposed endpoint and example request/response,
123
+ the spec version read), **show the user, file only after they confirm**:
124
+ `cinna agent-api request file <consumer> <connection> --title … --need …`
125
+ (or `--body-json FILE|-`). Core files it with the connection on the server;
126
+ the producer's owner sees it in `cinna improve list --kind api` with the
127
+ consumer as "via".
128
+ 4. `cinna agent-api request list <consumer> <connection>` shows the user's own
129
+ requests on that producer, newest first, with status and the owner's note
130
+ (it works on an unusable connection too);
131
+ a `completed` one means the API changed — re-read the spec.
132
+ - `<connection>` is the credential id (or a unique prefix of at least 6
133
+ characters), its slot, or its exact name among the consumer's connections.
134
+
135
+ ### Connection scopes
136
+ - A connection carries scopes its producer's owner chose. A call through it
137
+ gets the caller's own grant **plus** the connection's scopes — never fewer
138
+ than the grant alone, and a connection without scopes behaves as before.
139
+ This is what lets a recipient of a shared connection call scoped endpoints.
140
+ - `cinna agent-api connections <consumer>` shows that effective set and marks
141
+ the scopes the connection contributes as `(connection)`; an unusable
142
+ connection has no effective scopes but still names what it carries.
143
+ - The producer's owner sets them at creation (`connect agent-api --scopes`)
144
+ or later: `cinna agent-api connections scopes <producer> <connection-id>
145
+ --set a,b` / `--clear`. Values must be scopes the producer's policy declares
146
+ (`unknown_scope` lists them); a change applies from the next call, with no
147
+ new key, to everyone using the connection (own agents, direct and group
148
+ recipients, installers). Anyone else is refused (`not_owner` / not found).
149
+ - A call answered 403 "This endpoint requires the '<scope>' scope" lacks that
150
+ scope: the producer's owner adds it to the connection or grants it to the
151
+ caller. The templates tell the building agent exactly that.
152
+
101
153
  ### Give API access (a person, or a local agent)
102
154
  - `cinna agent-api access list <producer>` shows who has access: one row per
103
155
  person with their scopes and keys (prefix, status, expiry, last use, how many
@@ -216,6 +268,33 @@ to test a producer endpoint — use `cinna agent-api call`.
216
268
  connection is created; it scopes the *consumer's* access, not the producer's
217
269
  surface.
218
270
 
271
+ - **Shared connections are usable, not changeable.** An `agent_api` credential
272
+ its owner shared (directly, by group, or with an install) appears in the
273
+ recipient's `cinna account credentials list` under *Shared with you*; once
274
+ attached to one of their agents with `share-with-agent` it is a connection
275
+ like any other — listed, its spec readable, requests filed through it — but
276
+ only the owner can rename, re-slot or delete it (`not_owner`).
277
+ - **No key ever crosses the consumer verbs.** Core sends metadata only and
278
+ files a capability request with the linked connection server-side; the
279
+ client drops a stray `token` field anyway. The listed URLs are the
280
+ environment's (locally `http://backend:8000/…`, not reachable from the
281
+ host): the CLI never calls them and the per-agent `CLAUDE.md` never embeds
282
+ them (they go stale) — it tells the building agent to run the listing.
283
+ - **Filing is a person-confirmed action.** The CLI files what it is given;
284
+ the instructions (account and per-agent `CLAUDE.md`, the command's help) say
285
+ to show the user the draft first. A capability request is attributed exactly
286
+ as one filed from the environment: caller = the user, consumer = the agent,
287
+ same validation, size and rate limits.
288
+ - **A bad body is explained, not just refused.** Core rejects unknown keys
289
+ (`invalid_capability_request`); the CLI prints each error and the expected
290
+ shape of every field, and keeps both (`errors`, `expected`) in `--json`.
291
+ `rate_limited` carries `retry_after_s`; `too_large`, `connection_unusable`,
292
+ `spec_not_exposed`, `api_disabled`, `producer_error`, `env_unavailable` and
293
+ `not_found` pass through with core's code and sentence. Filing needs the
294
+ developer role.
295
+ - **Caller-written text is data.** Titles, needs and the owner's notes print
296
+ verbatim (never read as Rich markup).
297
+
219
298
  ## Architecture overview
220
299
 
221
300
  ```
@@ -249,6 +328,16 @@ wiring (consumer):
249
328
  ▼
250
329
  rides B's credential sync ─► B's remote env ─► B calls A over plain HTTP
251
330
 
331
+ consumer side (one agent's connections):
332
+ cinna agent-api connections <agent> [spec <connection>]
333
+ cinna agent-api request file|list <agent> <connection>
334
+ │ account token
335
+ ▼
336
+ /api/v1/cli/account/agents/{agent}/agent-api-connections[/{cred}/spec|/capability-requests]
337
+ │ core resolves the linked connection; files with it server-side
338
+ ▼
339
+ producer's spec / capability request ─► owner's `cinna improve list --kind api`
340
+
252
341
  platform escape hatch (unrelated target):
253
342
  cinna api <METHOD> <path> ─► /api/v1/cli/account/api-proxy ─► platform API
254
343
  ```
@@ -271,11 +360,17 @@ platform escape hatch (unrelated target):
271
360
  treats a revoked, expired or paused key as not usable. See
272
361
  [account_workspace](../account_workspace/account_workspace.md).
273
362
  - **Local agent import** — `cinna agent import` never drafts an `agent_api`
274
- credential (it could never be used); it attaches an existing same-name one or
275
- prints the `access issue` / `connect agent-api` command. See
363
+ credential (it could never be used); it attaches an existing one — same name,
364
+ else one carrying the declared slot, owned before shared — or prints the
365
+ `access issue` / `connect agent-api` command. See
276
366
  [local_agent_import](../local_agent_import/local_agent_import.md).
277
367
  - **`cinna agent show`** — surfaces a producer's live `agent_api_status`
278
- alongside its prompts and credentials, reusing the same status renderer.
368
+ alongside its prompts and credentials, reusing the same status renderer, and
369
+ a short *Agent API connections* section (one line per connection: producer,
370
+ SDK lookup, key status, owner when shared).
371
+ - **Improvement requests** — a capability request filed here is what the
372
+ producer's owner works in `cinna improve` (kind `api`). See
373
+ [improvement_requests](../improvement_requests/improvement_requests.md).
279
374
 
280
375
  Implementation: see [agent_api_tech.md](agent_api_tech.md). Real-usage e2e test
281
376
  scenarios: see [agent_api_acceptance.md](agent_api_acceptance.md).