cinna-cli 0.6.0__tar.gz → 0.7.0__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.0 → cinna_cli-0.7.0}/PKG-INFO +33 -5
  2. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/README.md +32 -4
  3. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/README.md +5 -4
  4. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/account_workspace/account_workspace.md +17 -2
  5. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/account_workspace/account_workspace_acceptance.md +21 -0
  6. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/account_workspace/account_workspace_tech.md +6 -2
  7. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_api/agent_api.md +99 -4
  8. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_api/agent_api_acceptance.md +131 -2
  9. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_api/agent_api_tech.md +114 -1
  10. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/improvement_requests/improvement_requests.md +50 -8
  11. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/improvement_requests/improvement_requests_acceptance.md +122 -2
  12. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/improvement_requests/improvement_requests_tech.md +65 -12
  13. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/local_agent_import/local_agent_import.md +3 -1
  14. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/pyproject.toml +1 -1
  15. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/account.py +207 -51
  16. cinna_cli-0.7.0/src/cinna/agent_api_connections.py +436 -0
  17. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/client.py +133 -4
  18. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/improve.py +280 -30
  19. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/local_import.py +38 -15
  20. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/main.py +233 -20
  21. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/templates/ACCOUNT_CLAUDE.md.template +26 -10
  22. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/templates/CLAUDE.md.template +2 -0
  23. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_account.py +1 -0
  24. cinna_cli-0.7.0/tests/test_agent_api_connections.py +771 -0
  25. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_improve.py +246 -0
  26. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/uv.lock +1 -1
  27. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/.claude/commands/cinna-cli.feature.doc.md +0 -0
  28. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/.github/workflows/publish.yml +0 -0
  29. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/.gitignore +0 -0
  30. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/LICENSE.md +0 -0
  31. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_addons/agent_addons.md +0 -0
  32. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_addons/agent_addons_acceptance.md +0 -0
  33. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_addons/agent_addons_tech.md +0 -0
  34. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_management/agent_management.md +0 -0
  35. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_management/agent_management_acceptance.md +0 -0
  36. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_management/agent_management_tech.md +0 -0
  37. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_schedules/agent_schedules.md +0 -0
  38. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_schedules/agent_schedules_acceptance.md +0 -0
  39. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/agent_schedules/agent_schedules_tech.md +0 -0
  40. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/artifacts/artifacts.md +0 -0
  41. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/artifacts/artifacts_acceptance.md +0 -0
  42. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/artifacts/artifacts_tech.md +0 -0
  43. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/bootstrap_onboarding/bootstrap_onboarding.md +0 -0
  44. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/bootstrap_onboarding/bootstrap_onboarding_acceptance.md +0 -0
  45. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/bootstrap_onboarding/bootstrap_onboarding_tech.md +0 -0
  46. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/dashboards/dashboards.md +0 -0
  47. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/dashboards/dashboards_acceptance.md +0 -0
  48. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/dashboards/dashboards_tech.md +0 -0
  49. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/delegation/delegation.md +0 -0
  50. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/delegation/delegation_acceptance.md +0 -0
  51. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/delegation/delegation_tech.md +0 -0
  52. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/doctor/doctor.md +0 -0
  53. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/doctor/doctor_acceptance.md +0 -0
  54. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/doctor/doctor_tech.md +0 -0
  55. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/git_versioning/git_versioning.md +0 -0
  56. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/git_versioning/git_versioning_acceptance.md +0 -0
  57. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/git_versioning/git_versioning_tech.md +0 -0
  58. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/live_sync/live_sync.md +0 -0
  59. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/live_sync/live_sync_acceptance.md +0 -0
  60. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/live_sync/live_sync_tech.md +0 -0
  61. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/local_agent_import/local_agent_import_acceptance.md +0 -0
  62. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/local_agent_import/local_agent_import_tech.md +0 -0
  63. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/mcp_integration/mcp_integration.md +0 -0
  64. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/mcp_integration/mcp_integration_acceptance.md +0 -0
  65. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/mcp_integration/mcp_integration_tech.md +0 -0
  66. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/remote_chat/remote_chat.md +0 -0
  67. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/remote_chat/remote_chat_acceptance.md +0 -0
  68. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/remote_chat/remote_chat_tech.md +0 -0
  69. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/remote_exec/remote_exec.md +0 -0
  70. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/remote_exec/remote_exec_acceptance.md +0 -0
  71. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/remote_exec/remote_exec_tech.md +0 -0
  72. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/team_library/team_library.md +0 -0
  73. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/team_library/team_library_acceptance.md +0 -0
  74. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/features/team_library/team_library_tech.md +0 -0
  75. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/interface.md +0 -0
  76. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/docs/mutagen_capabilities.md +0 -0
  77. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/scripts/check_docs_references.py +0 -0
  78. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/__init__.py +0 -0
  79. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/artifacts.py +0 -0
  80. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/auth.py +0 -0
  81. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/bootstrap.py +0 -0
  82. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/chat.py +0 -0
  83. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/cli_version.py +0 -0
  84. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/config.py +0 -0
  85. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/console.py +0 -0
  86. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/context.py +0 -0
  87. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/dashboards.py +0 -0
  88. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/delegation.py +0 -0
  89. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/doctor.py +0 -0
  90. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/errors.py +0 -0
  91. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/git_versioning.py +0 -0
  92. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/kit_contract.py +0 -0
  93. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/library.py +0 -0
  94. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/logging.py +0 -0
  95. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/mcp_proxy.py +0 -0
  96. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/mutagen_runtime.py +0 -0
  97. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/scenarios.py +0 -0
  98. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/sync.py +0 -0
  99. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/sync_session.py +0 -0
  100. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/sync_ssh_shim.py +0 -0
  101. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/sync_tui.py +0 -0
  102. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/templates/CHAT_TESTING.md +0 -0
  103. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/templates/GIT_VERSIONING.md +0 -0
  104. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/src/cinna/templates/__init__.py +0 -0
  105. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/__init__.py +0 -0
  106. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/conftest.py +0 -0
  107. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_agent_api_access.py +0 -0
  108. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_artifacts.py +0 -0
  109. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_auth.py +0 -0
  110. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_bootstrap.py +0 -0
  111. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_chat.py +0 -0
  112. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_cli_version.py +0 -0
  113. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_client.py +0 -0
  114. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_config.py +0 -0
  115. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_console.py +0 -0
  116. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_context.py +0 -0
  117. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_dashboards.py +0 -0
  118. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_delegation.py +0 -0
  119. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_doctor.py +0 -0
  120. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_git_versioning.py +0 -0
  121. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_kit_contract.py +0 -0
  122. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_library.py +0 -0
  123. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_local_import.py +0 -0
  124. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_main.py +0 -0
  125. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_mutagen_runtime.py +0 -0
  126. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_onboarding.py +0 -0
  127. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_scenarios.py +0 -0
  128. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_sync.py +0 -0
  129. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/tests/test_sync_session.py +0 -0
  130. {cinna_cli-0.6.0 → cinna_cli-0.7.0}/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.0
3
+ Version: 0.7.0
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`
@@ -228,6 +231,7 @@ Work the **improvement requests** users shared with you about your agents. When
228
231
  ```bash
229
232
  cinna improve list --status new # unhandled first, then newest
230
233
  cinna improve list --agent crm-agent # narrow to one agent
234
+ cinna improve list --kind api # only API capability requests
231
235
  cinna improve show 3f2504e0 # the report + the runtime context block
232
236
  cinna improve download 3f2504e0 # → improvements/3f2504e0/
233
237
  cinna improve status 3f2504e0 in_progress # claim it
@@ -254,6 +258,8 @@ The archive deliberately contains **no** container logs, **no** uploaded file co
254
258
 
255
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`.
256
260
 
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".
262
+
257
263
  ### `cinna agent create <name> [--description TEXT]`
258
264
 
259
265
  Create a new agent on the platform from the account workspace — no UI interaction. Thin client: only the name (and optional description) is sent; the backend applies all defaults (default AI credentials, env template, environment creation) exactly as creating from the UI does. The agent is created in the account's [active user workspace](#cinna-account-user-workspace-list--activate-nameid--clear) (if one is set). Prints the created agent's ID and web UI link, plus a hint to attach a local workspace with `cinna agent sync <name>`. Requires the `agent-developer` role (403 otherwise). Template selection is not supported yet — agents always get the server default.
@@ -504,16 +510,38 @@ cinna agent-api access list orders-agent --all
504
510
  cinna agent-api access revoke orders-agent a1b2c3d4
505
511
  ```
506
512
 
507
- `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.
508
514
 
509
515
  ### `cinna connect agent-api --producer <agent> --consumer <agent> [--label TEXT] [--read-only]`
510
516
 
511
- 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.
512
518
 
513
519
  ```bash
514
520
  cinna connect agent-api --producer crm-agent --consumer hr-manager-agent --read-only
515
521
  ```
516
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
+
517
545
  ### `cinna connect mcp --producer <agent> --consumer <agent> [--label TEXT] [--conversation-only|--building-only]`
518
546
 
519
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`
@@ -191,6 +194,7 @@ Work the **improvement requests** users shared with you about your agents. When
191
194
  ```bash
192
195
  cinna improve list --status new # unhandled first, then newest
193
196
  cinna improve list --agent crm-agent # narrow to one agent
197
+ cinna improve list --kind api # only API capability requests
194
198
  cinna improve show 3f2504e0 # the report + the runtime context block
195
199
  cinna improve download 3f2504e0 # → improvements/3f2504e0/
196
200
  cinna improve status 3f2504e0 in_progress # claim it
@@ -217,6 +221,8 @@ The archive deliberately contains **no** container logs, **no** uploaded file co
217
221
 
218
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`.
219
223
 
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".
225
+
220
226
  ### `cinna agent create <name> [--description TEXT]`
221
227
 
222
228
  Create a new agent on the platform from the account workspace — no UI interaction. Thin client: only the name (and optional description) is sent; the backend applies all defaults (default AI credentials, env template, environment creation) exactly as creating from the UI does. The agent is created in the account's [active user workspace](#cinna-account-user-workspace-list--activate-nameid--clear) (if one is set). Prints the created agent's ID and web UI link, plus a hint to attach a local workspace with `cinna agent sync <name>`. Requires the `agent-developer` role (403 otherwise). Template selection is not supported yet — agents always get the server default.
@@ -467,16 +473,38 @@ cinna agent-api access list orders-agent --all
467
473
  cinna agent-api access revoke orders-agent a1b2c3d4
468
474
  ```
469
475
 
470
- `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.
471
477
 
472
478
  ### `cinna connect agent-api --producer <agent> --consumer <agent> [--label TEXT] [--read-only]`
473
479
 
474
- 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.
475
481
 
476
482
  ```bash
477
483
  cinna connect agent-api --producer crm-agent --consumer hr-manager-agent --read-only
478
484
  ```
479
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
+
480
508
  ### `cinna connect mcp --producer <agent> --consumer <agent> [--label TEXT] [--conversation-only|--building-only]`
481
509
 
482
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.
@@ -207,7 +207,7 @@ main.py (CLI commands — Click)
207
207
  ├── doctor.py — `cinna doctor`: reconcile registry ↔ Mutagen, delete stalled / terminate active sessions, refresh tokens
208
208
  ├── chat.py — `cinna chat`: session-backed conversation testing (poll + NDJSON) over the api-proxy
209
209
  ├── scenarios.py — `cinna agent scenarios`: parse docs/test_scenarios Say | Expect tables, replay each row via chat.py
210
- ├── improve.py — `cinna improve`: improvement requests users shared about your agents (list/show/download/status)
210
+ ├── improve.py — `cinna improve`: improvement requests users shared about your agents, and API callers' capability requests (list/show/download/status)
211
211
  ├── local_import.py — `cinna agent import`: the Local Agent Kit go-cloud step
212
212
  ├── kit_contract.py — the Local Agent Kit contract as data (`.cinna-kit/layout.json`):
213
213
  │ exclude patterns, secret-file rules, export walk, content_hash,
@@ -291,20 +291,20 @@ 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) |
304
304
  | **Durable delegation** | `cinna delegation` (create — idempotent per target + `--id`, status, report — owner side with a task id or from inside a cloud task, reply), gated on the backend capability version | [business](features/delegation/delegation.md) · [tech](features/delegation/delegation_tech.md) · [acceptance](features/delegation/delegation_acceptance.md) |
305
305
  | **Artifacts** | `cinna artifacts` (publish — republishes a remembered path, `--new` / `--update`; list, show, open, download, share and link create — person-only, refused without a TTY; link revoke, delete), gated on the server's artifacts capability | [business](features/artifacts/artifacts.md) · [tech](features/artifacts/artifacts_tech.md) · [acceptance](features/artifacts/artifacts_acceptance.md) |
306
306
  | **Dashboards** | `cinna dashboards` (list, show, check `[--run]`, run, ref `[--check]` — an agent's components as its environment sees them; boards, board create, add, tiles, tile data / refresh / params / call / edit / remove — tiles on the owner's web dashboards, desktop dashboards read-only) · `cinna chat --board [--focus] [--context] [--new-chat]` (dashboard chat with the tile tools); gated on the server's dashboards capability | [business](features/dashboards/dashboards.md) · [tech](features/dashboards/dashboards_tech.md) · [acceptance](features/dashboards/dashboards_acceptance.md) |
307
- | **Improvement requests** | `cinna improve` (list, show, download, status) | [business](features/improvement_requests/improvement_requests.md) · [tech](features/improvement_requests/improvement_requests_tech.md) · [acceptance](features/improvement_requests/improvement_requests_acceptance.md) |
307
+ | **Improvement requests** | `cinna improve` (list, show, download, status) — session shares and API capability requests (`--kind session\|api`) | [business](features/improvement_requests/improvement_requests.md) · [tech](features/improvement_requests/improvement_requests_tech.md) · [acceptance](features/improvement_requests/improvement_requests_acceptance.md) |
308
308
  | **Local agent import** | `cinna agent import` (Local Agent Kit → cloud agent), incl. the versioned folder contract (`.cinna-kit/layout.json`), `publications.json` and `content_hash` | [business](features/local_agent_import/local_agent_import.md) · [tech](features/local_agent_import/local_agent_import_tech.md) · [acceptance](features/local_agent_import/local_agent_import_acceptance.md) |
309
309
  | **Team library** | `cinna library` (list, get, share, update, status, grants, suggest) — kit folders in `Local/<slug>/` shared through cinna-core-hosted git with the account token; `cinna agent import --from-library` | [business](features/team_library/team_library.md) · [tech](features/team_library/team_library_tech.md) · [acceptance](features/team_library/team_library_acceptance.md) |
310
310
 
@@ -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
 
@@ -166,10 +166,25 @@ each with its own token, registry entry, and Mutagen session.
166
166
  it is the column that answers "which credential fills this skill's slot". The
167
167
  hint under the table names `cinna account credentials update <id> --service-uri
168
168
  <slot>`. `--json` prints the raw listing.
169
+ - The listing has two sections: **Your credentials**, and **Shared with you** —
170
+ credentials another user shared directly, through a group, or with a bundle /
171
+ skill install — with Owner (their email), Via (`direct`, the install kind,
172
+ `group <name>`) and Access (the share's level). `--owned` / `--shared` show one
173
+ section; `--workspace` filters only your own rows (a shared one belongs to no
174
+ workspace of yours). In `--json` every row carries `is_shared` — the ownership
175
+ fact; `category` is the web tab — plus `owner_email`, `access_level`,
176
+ `share_source`, `via_groups` and `allow_bundle_reuse_effective`.
169
177
  - `cinna account credentials update <id>` edits metadata (name/notes/service-uri/
170
178
  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).
179
+ --agent <ref>` attaches an existing credential — yours or one shared with you.
180
+ `cinna account credentials delete <id>` removes it (and unlinks it from
181
+ agents). A shared credential is the owner's: `update` and `delete` refuse it
182
+ with the platform's `not_owner` sentence naming the owner.
183
+ - `agent show`, `skills list` readiness and `agent import` read slots, status
184
+ and ownership from this same listing, so a shared credential linked to an
185
+ agent shows its real slot and `shared by <owner>` instead of an unknown slot.
186
+ An `agent_api` credential linked to an agent is an *agent API connection*:
187
+ see the consumer side in [agent_api](../agent_api/agent_api.md).
173
188
 
174
189
  ### Keep context fresh
175
190
  - `cinna account status` shows the account root, platform/frontend URLs, machine
@@ -414,3 +414,24 @@ the silent-secret and scope-drift bugs live.
414
414
  - Verify `~/.cinna/agents.json` has no leftover entries for the test children —
415
415
  especially if any helper ran **outside** pytest's global-state isolation (it
416
416
  would write the real registry).
417
+
418
+ ### 19. Credentials shared with you (needs core 512aa258)
419
+
420
+ - **Goal:** a credential another user shared shows up, is attachable, and is
421
+ read-only.
422
+ - **Setup:** user A shares a credential with user B (web: credential → Share).
423
+ Run as B.
424
+ - **Steps:**
425
+ ```
426
+ cinna account credentials list
427
+ cinna account credentials list --shared --json
428
+ cinna account credentials update <shared-id> --service-uri x; echo "exit=$?"
429
+ ```
430
+ - **Expected:** a *Shared with you* section with Owner = A's email, Via
431
+ (`direct` / `group <name>`), Access; `--json` rows `is_shared: true`;
432
+ `update` exits 1 with `This credential is shared with you by <A>; only the
433
+ owner can change it.` Full consumer-side scenarios (attach, connections,
434
+ capability requests): `docs/features/agent_api/agent_api_acceptance.md`
435
+ scenarios 18–26.
436
+ - **Watch for:** "No credentials on this account." for B; a shared row in
437
+ `--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()`
@@ -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).
@@ -301,6 +301,131 @@ for** failure modes.
301
301
  applies to any method on `agents/*/agent-api/keys…`, `environments/*/workspace/download` and `view-file`, `dashboards/*/blocks/*/env-file`, and POST on token-minting routes (A2A access-tokens, MCP/ACP connector tokens, webhook create/regenerate-token), including percent-encoded spellings.
302
302
  - **Watch for:** exit 1 instead of 2; a key created by the call.
303
303
 
304
+ ### Consumer side: shared connections and capability requests (needs core 512aa258)
305
+
306
+ Two accounts: the **owner** (owns a producer, e.g. "BTC Rate API", and has made
307
+ one of its `agent_api` connections shareable and shared it with the
308
+ recipient), and the **recipient** (agent-developer role, its own account
309
+ workspace). The recipient needs an agent of its own for 21 and 24, so its
310
+ account needs an AI credential (`cinna agent create` refuses without one).
311
+
312
+ ### 18. The recipient sees the shared connection
313
+ - **Goal:** "what was shared with me" works from the CLI.
314
+ - **Steps (recipient):**
315
+ ```bash
316
+ cinna account credentials list
317
+ cinna account credentials list --shared --json | grep -E '"is_shared"|"owner_email"|"access_level"'
318
+ ```
319
+ - **Expected:** a *Shared with you* table with the connection, Owner = the
320
+ owner's email, Via `direct` (or `group <name>`), Access `read`; `--json` rows
321
+ carry `is_shared: true` and the owner's email. With no own credentials the
322
+ first section is a dim "You own no credentials."
323
+ - **Watch for:** "No credentials on this account." (the pre-512aa258 bug).
324
+
325
+ ### 19. Owned rows are unchanged
326
+ - **Steps (owner):** `cinna account credentials list --json | grep -c '"is_shared": false'`
327
+ and `cinna account credentials list --shared`.
328
+ - **Expected:** every own row has `is_shared: false`, `owner_email: null`;
329
+ "Nothing is shared with you." when nothing is.
330
+
331
+ ### 20. A shared row is read-only
332
+ - **Steps (recipient):**
333
+ ```bash
334
+ cinna account credentials update <shared-id> --service-uri x; echo "exit=$?"
335
+ cinna account credentials delete <shared-id> --yes; echo "exit=$?"
336
+ ```
337
+ - **Expected:** both print `Error: This credential is shared with you by
338
+ <owner>; only the owner can change it.` and exit 1; nothing changed.
339
+
340
+ ### 21. Attach the shared connection to the recipient's agent
341
+ - **Steps (recipient):**
342
+ ```bash
343
+ cinna agent create "Rate Consumer"
344
+ cinna account credentials share-with-agent <shared-id> --agent "Rate Consumer"
345
+ cinna agent show "Rate Consumer"
346
+ ```
347
+ - **Expected:** *Connected credentials* lists it with its slot (or `no
348
+ slot`), never `slot: unknown`, and `shared by <owner>`; *Agent API
349
+ connections (1)* names the producer, the SDK lookup and the key status.
350
+
351
+ ### 22. List an agent's connections, no token anywhere
352
+ - **Steps:**
353
+ ```bash
354
+ cinna agent-api connections "Hello Testing Agent" > /tmp/conn.txt
355
+ cinna agent-api connections "Hello Testing Agent" --json >> /tmp/conn.txt
356
+ grep -ciE 'cak_|bearer|"token"' /tmp/conn.txt
357
+ ```
358
+ - **Expected:** producer, status, scopes, SDK lookup, From (`yours` /
359
+ `shared by …`), then `base_url`, `spec_url`, `improvement_requests_url`
360
+ labelled as environment URLs (locally `http://backend:8000/…`); the grep
361
+ prints `0`.
362
+ - **Watch for:** a URL the CLI tried to call; a token prefix in `--json`.
363
+
364
+ ### 23. Read the producer's spec through a connection
365
+ - **Steps:** `cinna agent-api connections spec "Hello Testing Agent" <id-prefix|slot|name> -o /tmp/spec.json`
366
+ - **Expected:** `Spec written`, plus the API version to pass as
367
+ `--spec-version`; the file is the producer's OpenAPI document. A name shared
368
+ by several connections refuses with `ambiguous_connection` and the ids;
369
+ `env_unavailable` (exit 12) means the producer is waking — retry.
370
+
371
+ ### 24. File and list a capability request; the owner sees it
372
+ - **Steps (consumer side; recipient on its own agent, or the owner on its own):**
373
+ ```bash
374
+ cinna agent-api request file "<Consumer>" <connection> \
375
+ --title "[test] Historical BTC rate by date" \
376
+ --need "A report needs the BTC rate on a past date." --spec-version 1.2.0
377
+ cinna agent-api request list "<Consumer>" <connection>
378
+ ```
379
+ then, as the producer's owner: `cinna improve list --kind api`.
380
+ - **Expected:** `Capability request filed with <producer>`, status `new`;
381
+ the list shows it with the title verbatim (brackets included); the owner's
382
+ list has an *API request* row with the title and `via <Consumer>`.
383
+ - **Watch for:** the title losing `[test]` (read as markup); a request
384
+ attributed to the wrong agent.
385
+
386
+ ### 25. A bad body explains the expected shape
387
+ - **Steps:**
388
+ ```bash
389
+ echo '{"title":"x","need":"y","colour":"red"}' | cinna agent-api request file "<Consumer>" <connection> --body-json -
390
+ echo '{"title":"x"}' | cinna agent-api request file "<Consumer>" <connection> --body-json - --json
391
+ ```
392
+ - **Expected:** exit 1; `Errors:` (`title: String should have at least 3
393
+ characters`, `colour: Extra inputs are not permitted`) and `Expected
394
+ fields:` (title, need, proposed_endpoint, example_request,
395
+ example_response, spec_version_seen). The `--json` line has
396
+ `code: invalid_capability_request`, `errors` and `expected`.
397
+
398
+ ### 26. The building agent is told about all of it
399
+ - **Steps:** `cinna account refresh-context`, then grep the account
400
+ `CLAUDE.md` for `Shared with you` and `agent-api connections <agent>`, and an
401
+ agent workspace's `CLAUDE.md` for `cinna agent-api connections "<Agent>"` and
402
+ `cinna agent-api request file "<Agent>"`.
403
+ - **Expected:** all present; the per-agent file embeds no connection URL.
404
+
405
+ ### 27. A connection carries scopes (needs core f3d33e13)
406
+ - **Goal:** a recipient of a shared connection can call scoped endpoints once
407
+ the owner puts the scope on the connection.
408
+ - **Steps:**
409
+ ```bash
410
+ # recipient
411
+ cinna agent-api connections "Repro Consumer" # Scopes: btc.read (connection)
412
+ cinna agent-api connections "Repro Consumer" --json | grep -A2 connection_scopes
413
+ # owner
414
+ cinna agent-api connections scopes "BTC Rate API" <connection-id> --set nope; echo "exit=$?"
415
+ cinna agent-api connections scopes "BTC Rate API" <connection-id> --set btc.read
416
+ cinna connect agent-api --producer "BTC Rate API" --consumer "Hello Testing Agent" --scopes nope; echo "exit=$?"
417
+ ```
418
+ - **Expected:** the recipient's Scopes cell reads `btc.read (connection)` and
419
+ `--json` has `connection_scopes: ["btc.read"]`; `--set nope` and `connect
420
+ --scopes nope` exit 1 with `Unknown scope(s) for BTC Rate API: nope.
421
+ Declared: btc.read` and create or change nothing (compare `cinna account
422
+ credentials list --json` counts); `--set btc.read` prints the connection's
423
+ scopes. With `--clear`, a recipient call to a scoped endpoint answers 403
424
+ "This endpoint requires the 'btc.read' scope" again. Set it back with `--set btc.read` afterwards.
425
+ - **Watch for:** a connection created despite `unknown_scope`; the recipient
426
+ able to change the scopes; the `(connection)` mark on a scope that comes
427
+ only from the caller's own grant.
428
+
304
429
  ## Cross-cutting invariants (must hold across all scenarios)
305
430
 
306
431
  - **Resolve-before-mutate.** A bad agent ref fails before any enable / refresh /
@@ -316,8 +441,10 @@ for** failure modes.
316
441
  marker header — never conflated with an inner 4xx.
317
442
  - **No key value in any access output.** Not in the table, not in `--json`,
318
443
  not on self-issue; reveal and rotate are web-only.
319
- - **Spec is pipeable.** `cinna agent-api spec` emits plain JSON to stdout (or the
320
- `-o` file), never Rich-decorated.
444
+ - **Spec is pipeable.** `cinna agent-api spec` and `connections spec` emit
445
+ plain JSON to stdout (or the `-o` file), never Rich-decorated.
446
+ - **Shared means usable, never changeable.** A recipient attaches, lists and
447
+ files through a shared connection; `update` / `delete` refuse `not_owner`.
321
448
 
322
449
  ## Cleanup
323
450
 
@@ -333,3 +460,5 @@ for** failure modes.
333
460
  --clear`), delete the revoked credentials in the web, and set external access
334
461
  back to its prior state.
335
462
  - Delete scratch files written by `cinna agent-api spec -o spec.json`.
463
+ - Close test capability requests as the producer's owner:
464
+ `cinna improve status <id> declined --note "test"`.