pacific-cli 0.1.0__tar.gz → 0.2.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 (92) hide show
  1. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/PKG-INFO +104 -13
  2. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/README.md +103 -12
  3. pacific_cli-0.2.0/RELEASING.md +102 -0
  4. pacific_cli-0.2.0/demos/agent_access/README.md +108 -0
  5. pacific_cli-0.2.0/demos/agent_access/agents/agent.yaml +32 -0
  6. pacific_cli-0.2.0/demos/agent_access/corpus/acquisition-plan.pdf +0 -0
  7. pacific_cli-0.2.0/demos/agent_access/corpus/board-minutes.pdf +0 -0
  8. pacific_cli-0.2.0/demos/agent_access/corpus/executive-compensation.pdf +88 -0
  9. pacific_cli-0.2.0/demos/agent_access/corpus/holiday-calendar.pdf +0 -0
  10. pacific_cli-0.2.0/demos/agent_access/corpus/make_pdfs.py +164 -0
  11. pacific_cli-0.2.0/demos/agent_access/corpus/manifest.yaml +71 -0
  12. pacific_cli-0.2.0/demos/agent_access/corpus/manifest_test.py +164 -0
  13. pacific_cli-0.2.0/demos/agent_access/corpus/office-relocation.pdf +90 -0
  14. pacific_cli-0.2.0/demos/agent_access/corpus/tern-sensor-faq.pdf +0 -0
  15. pacific_cli-0.2.0/demos/agent_access/corpus/travel-policy.pdf +87 -0
  16. pacific_cli-0.2.0/demos/agent_access/corpus/workforce-plan.pdf +92 -0
  17. pacific_cli-0.2.0/demos/agent_access/demo.sh +133 -0
  18. pacific_cli-0.2.0/demos/agent_access/demo_test.py +210 -0
  19. pacific_cli-0.2.0/demos/agent_access/policies/demo-access.general-only.yaml +31 -0
  20. pacific_cli-0.2.0/demos/agent_access/policies/demo-access.yaml +34 -0
  21. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/openapi/public_api_openapi.json +5422 -2391
  22. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/pyproject.toml +12 -6
  23. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/scripts/trim_openapi.py +32 -10
  24. pacific_cli-0.2.0/src/pacific_cli/admin/__init__.py +1 -0
  25. pacific_cli-0.2.0/src/pacific_cli/admin/commands.py +148 -0
  26. pacific_cli-0.2.0/src/pacific_cli/admin/commands_test.py +123 -0
  27. pacific_cli-0.2.0/src/pacific_cli/admin/config.py +36 -0
  28. pacific_cli-0.2.0/src/pacific_cli/admin/service.py +191 -0
  29. pacific_cli-0.2.0/src/pacific_cli/admin/service_test.py +346 -0
  30. pacific_cli-0.2.0/src/pacific_cli/admin/types.py +81 -0
  31. pacific_cli-0.2.0/src/pacific_cli/agents/__init__.py +1 -0
  32. pacific_cli-0.2.0/src/pacific_cli/agents/commands.py +49 -0
  33. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/client.py +52 -35
  34. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/client_test.py +58 -1
  35. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/commands.py +74 -8
  36. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/config.py +11 -0
  37. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/oauth.py +98 -25
  38. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/oauth_test.py +73 -0
  39. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/profiles.py +96 -9
  40. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/profiles_test.py +38 -0
  41. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/runtime.py +44 -0
  42. pacific_cli-0.2.0/src/pacific_cli/auth/sessions.py +90 -0
  43. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/types.py +35 -0
  44. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/config.py +5 -0
  45. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/contract_test.py +160 -3
  46. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/documents/commands.py +33 -3
  47. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/documents/commands_test.py +124 -3
  48. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/documents/config.py +5 -0
  49. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/documents/service.py +65 -1
  50. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/documents/service_test.py +30 -0
  51. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/documents/types.py +22 -1
  52. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/main.py +6 -0
  53. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/main_test.py +10 -0
  54. pacific_cli-0.2.0/src/pacific_cli/mcp/__init__.py +1 -0
  55. pacific_cli-0.2.0/src/pacific_cli/mcp/client.py +211 -0
  56. pacific_cli-0.2.0/src/pacific_cli/mcp/client_test.py +111 -0
  57. pacific_cli-0.2.0/src/pacific_cli/mcp/commands.py +28 -0
  58. pacific_cli-0.2.0/src/pacific_cli/mcp/config.py +42 -0
  59. pacific_cli-0.2.0/src/pacific_cli/mcp/fake_server_test.py +310 -0
  60. pacific_cli-0.2.0/src/pacific_cli/mcp/service.py +180 -0
  61. pacific_cli-0.2.0/src/pacific_cli/mcp/service_test.py +170 -0
  62. pacific_cli-0.2.0/src/pacific_cli/mcp/types.py +158 -0
  63. pacific_cli-0.2.0/src/pacific_cli/policy/commands.py +552 -0
  64. pacific_cli-0.2.0/src/pacific_cli/policy/commands_test.py +318 -0
  65. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/policy/config.py +3 -0
  66. pacific_cli-0.2.0/src/pacific_cli/policy/recorded/policy_get_effective_access.json +206 -0
  67. pacific_cli-0.2.0/src/pacific_cli/policy/recorded/policy_list_calls.json +214 -0
  68. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/policy/service.py +88 -3
  69. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/policy/service_test.py +353 -1
  70. pacific_cli-0.2.0/src/pacific_cli/policy/types.py +551 -0
  71. pacific_cli-0.2.0/src/pacific_cli/search/__init__.py +1 -0
  72. pacific_cli-0.2.0/src/pacific_cli/search/commands.py +84 -0
  73. pacific_cli-0.2.0/src/pacific_cli/search/commands_test.py +79 -0
  74. pacific_cli-0.2.0/src/pacific_cli/search/config.py +11 -0
  75. pacific_cli-0.2.0/src/pacific_cli/search/service.py +91 -0
  76. pacific_cli-0.2.0/src/pacific_cli/search/types.py +77 -0
  77. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/uv.lock +12 -1
  78. pacific_cli-0.1.0/src/pacific_cli/policy/commands.py +0 -263
  79. pacific_cli-0.1.0/src/pacific_cli/policy/types.py +0 -235
  80. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/.gitignore +0 -0
  81. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/LICENSE +0 -0
  82. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/__init__.py +0 -0
  83. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/__main__.py +0 -0
  84. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/auth/__init__.py +0 -0
  85. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/documents/__init__.py +0 -0
  86. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/keys/__init__.py +0 -0
  87. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/keys/commands.py +0 -0
  88. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/keys/config.py +0 -0
  89. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/keys/service.py +0 -0
  90. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/keys/service_test.py +0 -0
  91. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/keys/types.py +0 -0
  92. {pacific_cli-0.1.0 → pacific_cli-0.2.0}/src/pacific_cli/policy/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pacific-cli
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: The pacific command: upload documents with policy metadata, and write, list and attach access policies, against a Pacific server's public API
5
5
  Project-URL: Homepage, https://pacific.app
6
6
  Project-URL: Documentation, https://docs.pacific.app
@@ -46,7 +46,7 @@ Python 3.12 or later (`uv tool` and `pipx` fetch one if you need it).
46
46
 
47
47
  ```bash
48
48
  pacific profile add local --base-url http://localhost:5001 --use
49
- pacific profile add prod --base-url https://api.pacific.app
49
+ pacific profile add prod --base-url https://api.pacific.app --mcp-url https://mcp.pacific.app
50
50
  pacific -p prod auth set-key # paste an API key from the app
51
51
  pacific profile list # * marks the current profile
52
52
  pacific profile show # what this command would run as, and why
@@ -63,7 +63,8 @@ servers and `credentials.json` (mode 0600) the keys and sessions.
63
63
 
64
64
  - **API key** — `pacific auth set-key` (or `--stdin`). A key carries the scopes
65
65
  it was minted with (`documents:write` to upload, `tools:read`/`tools:write`
66
- for policy), so it is how to give a profile less than your full access.
66
+ for policy, `admin:read`/`admin:write` for dummy users), so it is how to give
67
+ a profile less than your full access.
67
68
  - **Browser** — `pacific auth login` opens the server's sign-in page and waits
68
69
  on a loopback port, as Claude Code does (RFC 8252: discovery, a client
69
70
  registered for that one redirect, PKCE S256, the token bound to the public
@@ -86,7 +87,7 @@ servers and `credentials.json` (mode 0600) the keys and sessions.
86
87
  pacific auth status # who the server says you are, your scopes
87
88
  # (asks with documents:read)
88
89
  curl -H "Authorization: Bearer $(pacific auth token)" "$URL/public/v1/documents"
89
- pacific auth logout # revokes a browser session at the server
90
+ pacific auth logout # revokes the browser sessions (API and MCP)
90
91
  ```
91
92
 
92
93
  ## Uploading with policy metadata
@@ -96,11 +97,18 @@ pacific documents upload deck.pdf memo.docx \
96
97
  -l board -l refcode:r100 \
97
98
  -a deal_stage=diligence -a region=emea -a region=us \
98
99
  --wait # until each is searchable; prints its id
99
- pacific documents list # newest 50, with the labels policies match
100
+ pacific documents upload *.pdf -l demo --skip-existing --wait # safe to rerun
101
+ pacific documents list # oldest 50, with the labels policies match
100
102
  pacific documents list --limit 200 # or --all, printed a page at a time
101
103
  pacific documents job JOB_ID
102
104
  ```
103
105
 
106
+ `--skip-existing` reads the documents you can read once, skips a file already
107
+ uploaded with the same name and labels, and stops before sending anything when
108
+ a file's name is there with other labels (uploading would make a second copy).
109
+ Attributes are not compared: the documents list does not return them. Skipped
110
+ files are reported on stderr, so `--json` stays the jobs this run started.
111
+
104
112
  Labels are matched lower-cased as `resource.metadata.labels`; each `--attr`
105
113
  key as `resource.metadata.<key>` (a key given twice keeps both values). One
106
114
  file goes to `/ingest`; more go to `/ingest/bulk` in batches of
@@ -119,8 +127,23 @@ pacific policy attach board-readers group "Investment Committee"
119
127
  pacific policy attached user alice@acme.com
120
128
  pacific policy detach board-readers user alice@acme.com
121
129
  pacific policy me
130
+ pacific policy simulate --as alice@acme.com # what she can search now
131
+ pacific policy simulate --as alice@acme.com --candidate restrict.yaml # and after a change
132
+ pacific policy access agent research_bot # each connector's tools, and what the policies answer
133
+ pacific policy access user alice@acme.com # --json for the server's answer
134
+ pacific policy calls --agent-id research_bot --outcome blocked # call history, newest first
135
+ pacific policy calls --user-id alice@acme.com --since 2026-11-25T10:00:00Z
122
136
  ```
123
137
 
138
+ `simulate` judges documents for a person without writing anything: a sample of
139
+ what you can read (or the ones named with `--document PRN`), each allowed or
140
+ denied under the active policies and, with `--candidate`, under those plus
141
+ PermissionPolicy files you have not applied yet, with the statements that
142
+ decided it. `--action` picks the action judged (`document:Search` by default).
143
+ It needs an organization administrator and `tools:read`, and refuses agent keys.
144
+ Documents are shown by PRN: the documents list does not carry one, so the CLI
145
+ cannot put file names beside them.
146
+
124
147
  A policy file is sent as written; the server validates it. A write whose
125
148
  `metadata.version` is not the latest is refused with the latest version;
126
149
  `--overwrite` writes on top of it instead. Writing needs an organization
@@ -129,6 +152,80 @@ administrator, `tools:write`, and the organization's Policy API switched on
129
152
  organization's documents mode is `enforce`; `attach` and `attached` say which
130
153
  surfaces apply now.
131
154
 
155
+ `access` shows, for each connector, its tools by what they declare (read,
156
+ write, destructive, undeclared), whether a call is allowed now, needs approval
157
+ or is refused, and the statements that decided. A member asks about themselves
158
+ and the agents they may act as; an administrator about anyone. When the
159
+ organization does not enforce tool-call policies yet, it says so and each
160
+ decision is what the policies would answer.
161
+
162
+ `calls` prints the organization's recent tool calls and API calls, newest
163
+ first, one per line: when, how it ended, who, what was called, and what decided
164
+ it. Filter with `--agent-id`, `--user-id` (an id or an email), `--tool`,
165
+ `--outcome` and `--since`; `--internal-tools hidden` leaves out the tools
166
+ Pacific's own AI uses to run itself. A page with more after it prints the
167
+ cursor to pass back with `--cursor`. `--json` prints the server's reply.
168
+
169
+ ## Searching, and acting as an agent
170
+
171
+ ```bash
172
+ pacific search "board deck budget" # as you
173
+ pacific auth login --mcp # once: sign in to the MCP endpoint
174
+ pacific agents list # who you may act as
175
+ pacific search "board deck budget" --as-agent demo_reader
176
+ pacific search "board deck budget" --as-agent demo_reader --json # files, best first
177
+ ```
178
+
179
+ As you, `search` calls the public API's `/search/content` with the profile's
180
+ key or browser session. As an agent, it calls the same search as the MCP tool
181
+ `search_content`, through a separate sign-in to the profile's MCP endpoint
182
+ (`--mcp-url`; `https://mcp.pacific.app` for Pacific's cloud), and the agent's
183
+ rules decide what it finds. Approving that sign-in accepts the server's MCP
184
+ terms of service, as connecting any MCP client does.
185
+
186
+ A person's session acts as an agent one call at a time: each call names the
187
+ agent in `pacific__acting_as`, and a call that names none runs as you. The CLI
188
+ adds it to every call it makes with `--as-agent`, so none can leave it out.
189
+ The first search as an agent (and the first after an approval lapses) prints
190
+ an approval link and opens it; the CLI waits until you approve, up to
191
+ `$PACIFIC_CLI_AGENT_APPROVAL_TIMEOUT` (ten minutes), then runs the search.
192
+ Approvals are kept per MCP client: approving an agent for the CLI does not
193
+ approve it for Claude Code. An agent is created with `pacific policy apply` on
194
+ an `Agent` file; `--json` from `search` names the files that answered, best
195
+ match first, which is what a script checks.
196
+
197
+ ## Dummy users
198
+
199
+ Test members to try policies on, for an organization administrator: create
200
+ one, attach policies to it or grant it what a real member would get, test
201
+ through an agent that acts as it, then remove it.
202
+
203
+ ```bash
204
+ pacific admin dummy-users create "Test Analyst" # test-analyst-<suffix>@your-domain
205
+ pacific admin dummy-users create "Test Banker" --email banker --json
206
+ pacific admin dummy-users list
207
+ pacific policy attach board-readers user "Test Analyst"
208
+ pacific admin dummy-users remove "Test Analyst" # an id, email or name
209
+ pacific admin dummy-users remove --all
210
+ ```
211
+
212
+ A dummy user is a member with no access of its own and no way to sign in,
213
+ listed only to administrators. Its address is the `--email` local part (by
214
+ default the name, lower-cased with dashes), a random suffix and your
215
+ organization's domain. Creating one again with the same name and local part
216
+ returns the same dummy user, so a setup script can rerun; an organization holds
217
+ at most 50.
218
+
219
+ The server checks that you are a current administrator on every call and
220
+ refuses agent keys. Listing needs `admin:read`, and creating and removing
221
+ `admin:write` (which includes `admin:read`). A full-access browser sign-in
222
+ holds both; a key or a scoped sign-in holds them only if it named them:
223
+
224
+ ```bash
225
+ pacific auth login --scope admin:write --scope tools:write
226
+ pacific keys create -s admin:write -s tools:write --name "policy tests" --expires 7d
227
+ ```
228
+
132
229
  ## API keys
133
230
 
134
231
  ```bash
@@ -175,11 +272,5 @@ then fails it.
175
272
 
176
273
  ## Releasing
177
274
 
178
- Bump `version` in `pyproject.toml`, merge, then push a tag that matches it:
179
-
180
- ```bash
181
- git tag v0.1.1 && git push origin v0.1.1
182
- ```
183
-
184
- The `release` workflow builds the package, checks the tag against the version,
185
- and publishes to PyPI.
275
+ Push a `vX.Y.Z` tag matching `pyproject.toml`'s version and the `release`
276
+ workflow publishes it to PyPI. [RELEASING.md](RELEASING.md) has the steps.
@@ -16,7 +16,7 @@ Python 3.12 or later (`uv tool` and `pipx` fetch one if you need it).
16
16
 
17
17
  ```bash
18
18
  pacific profile add local --base-url http://localhost:5001 --use
19
- pacific profile add prod --base-url https://api.pacific.app
19
+ pacific profile add prod --base-url https://api.pacific.app --mcp-url https://mcp.pacific.app
20
20
  pacific -p prod auth set-key # paste an API key from the app
21
21
  pacific profile list # * marks the current profile
22
22
  pacific profile show # what this command would run as, and why
@@ -33,7 +33,8 @@ servers and `credentials.json` (mode 0600) the keys and sessions.
33
33
 
34
34
  - **API key** — `pacific auth set-key` (or `--stdin`). A key carries the scopes
35
35
  it was minted with (`documents:write` to upload, `tools:read`/`tools:write`
36
- for policy), so it is how to give a profile less than your full access.
36
+ for policy, `admin:read`/`admin:write` for dummy users), so it is how to give
37
+ a profile less than your full access.
37
38
  - **Browser** — `pacific auth login` opens the server's sign-in page and waits
38
39
  on a loopback port, as Claude Code does (RFC 8252: discovery, a client
39
40
  registered for that one redirect, PKCE S256, the token bound to the public
@@ -56,7 +57,7 @@ servers and `credentials.json` (mode 0600) the keys and sessions.
56
57
  pacific auth status # who the server says you are, your scopes
57
58
  # (asks with documents:read)
58
59
  curl -H "Authorization: Bearer $(pacific auth token)" "$URL/public/v1/documents"
59
- pacific auth logout # revokes a browser session at the server
60
+ pacific auth logout # revokes the browser sessions (API and MCP)
60
61
  ```
61
62
 
62
63
  ## Uploading with policy metadata
@@ -66,11 +67,18 @@ pacific documents upload deck.pdf memo.docx \
66
67
  -l board -l refcode:r100 \
67
68
  -a deal_stage=diligence -a region=emea -a region=us \
68
69
  --wait # until each is searchable; prints its id
69
- pacific documents list # newest 50, with the labels policies match
70
+ pacific documents upload *.pdf -l demo --skip-existing --wait # safe to rerun
71
+ pacific documents list # oldest 50, with the labels policies match
70
72
  pacific documents list --limit 200 # or --all, printed a page at a time
71
73
  pacific documents job JOB_ID
72
74
  ```
73
75
 
76
+ `--skip-existing` reads the documents you can read once, skips a file already
77
+ uploaded with the same name and labels, and stops before sending anything when
78
+ a file's name is there with other labels (uploading would make a second copy).
79
+ Attributes are not compared: the documents list does not return them. Skipped
80
+ files are reported on stderr, so `--json` stays the jobs this run started.
81
+
74
82
  Labels are matched lower-cased as `resource.metadata.labels`; each `--attr`
75
83
  key as `resource.metadata.<key>` (a key given twice keeps both values). One
76
84
  file goes to `/ingest`; more go to `/ingest/bulk` in batches of
@@ -89,8 +97,23 @@ pacific policy attach board-readers group "Investment Committee"
89
97
  pacific policy attached user alice@acme.com
90
98
  pacific policy detach board-readers user alice@acme.com
91
99
  pacific policy me
100
+ pacific policy simulate --as alice@acme.com # what she can search now
101
+ pacific policy simulate --as alice@acme.com --candidate restrict.yaml # and after a change
102
+ pacific policy access agent research_bot # each connector's tools, and what the policies answer
103
+ pacific policy access user alice@acme.com # --json for the server's answer
104
+ pacific policy calls --agent-id research_bot --outcome blocked # call history, newest first
105
+ pacific policy calls --user-id alice@acme.com --since 2026-11-25T10:00:00Z
92
106
  ```
93
107
 
108
+ `simulate` judges documents for a person without writing anything: a sample of
109
+ what you can read (or the ones named with `--document PRN`), each allowed or
110
+ denied under the active policies and, with `--candidate`, under those plus
111
+ PermissionPolicy files you have not applied yet, with the statements that
112
+ decided it. `--action` picks the action judged (`document:Search` by default).
113
+ It needs an organization administrator and `tools:read`, and refuses agent keys.
114
+ Documents are shown by PRN: the documents list does not carry one, so the CLI
115
+ cannot put file names beside them.
116
+
94
117
  A policy file is sent as written; the server validates it. A write whose
95
118
  `metadata.version` is not the latest is refused with the latest version;
96
119
  `--overwrite` writes on top of it instead. Writing needs an organization
@@ -99,6 +122,80 @@ administrator, `tools:write`, and the organization's Policy API switched on
99
122
  organization's documents mode is `enforce`; `attach` and `attached` say which
100
123
  surfaces apply now.
101
124
 
125
+ `access` shows, for each connector, its tools by what they declare (read,
126
+ write, destructive, undeclared), whether a call is allowed now, needs approval
127
+ or is refused, and the statements that decided. A member asks about themselves
128
+ and the agents they may act as; an administrator about anyone. When the
129
+ organization does not enforce tool-call policies yet, it says so and each
130
+ decision is what the policies would answer.
131
+
132
+ `calls` prints the organization's recent tool calls and API calls, newest
133
+ first, one per line: when, how it ended, who, what was called, and what decided
134
+ it. Filter with `--agent-id`, `--user-id` (an id or an email), `--tool`,
135
+ `--outcome` and `--since`; `--internal-tools hidden` leaves out the tools
136
+ Pacific's own AI uses to run itself. A page with more after it prints the
137
+ cursor to pass back with `--cursor`. `--json` prints the server's reply.
138
+
139
+ ## Searching, and acting as an agent
140
+
141
+ ```bash
142
+ pacific search "board deck budget" # as you
143
+ pacific auth login --mcp # once: sign in to the MCP endpoint
144
+ pacific agents list # who you may act as
145
+ pacific search "board deck budget" --as-agent demo_reader
146
+ pacific search "board deck budget" --as-agent demo_reader --json # files, best first
147
+ ```
148
+
149
+ As you, `search` calls the public API's `/search/content` with the profile's
150
+ key or browser session. As an agent, it calls the same search as the MCP tool
151
+ `search_content`, through a separate sign-in to the profile's MCP endpoint
152
+ (`--mcp-url`; `https://mcp.pacific.app` for Pacific's cloud), and the agent's
153
+ rules decide what it finds. Approving that sign-in accepts the server's MCP
154
+ terms of service, as connecting any MCP client does.
155
+
156
+ A person's session acts as an agent one call at a time: each call names the
157
+ agent in `pacific__acting_as`, and a call that names none runs as you. The CLI
158
+ adds it to every call it makes with `--as-agent`, so none can leave it out.
159
+ The first search as an agent (and the first after an approval lapses) prints
160
+ an approval link and opens it; the CLI waits until you approve, up to
161
+ `$PACIFIC_CLI_AGENT_APPROVAL_TIMEOUT` (ten minutes), then runs the search.
162
+ Approvals are kept per MCP client: approving an agent for the CLI does not
163
+ approve it for Claude Code. An agent is created with `pacific policy apply` on
164
+ an `Agent` file; `--json` from `search` names the files that answered, best
165
+ match first, which is what a script checks.
166
+
167
+ ## Dummy users
168
+
169
+ Test members to try policies on, for an organization administrator: create
170
+ one, attach policies to it or grant it what a real member would get, test
171
+ through an agent that acts as it, then remove it.
172
+
173
+ ```bash
174
+ pacific admin dummy-users create "Test Analyst" # test-analyst-<suffix>@your-domain
175
+ pacific admin dummy-users create "Test Banker" --email banker --json
176
+ pacific admin dummy-users list
177
+ pacific policy attach board-readers user "Test Analyst"
178
+ pacific admin dummy-users remove "Test Analyst" # an id, email or name
179
+ pacific admin dummy-users remove --all
180
+ ```
181
+
182
+ A dummy user is a member with no access of its own and no way to sign in,
183
+ listed only to administrators. Its address is the `--email` local part (by
184
+ default the name, lower-cased with dashes), a random suffix and your
185
+ organization's domain. Creating one again with the same name and local part
186
+ returns the same dummy user, so a setup script can rerun; an organization holds
187
+ at most 50.
188
+
189
+ The server checks that you are a current administrator on every call and
190
+ refuses agent keys. Listing needs `admin:read`, and creating and removing
191
+ `admin:write` (which includes `admin:read`). A full-access browser sign-in
192
+ holds both; a key or a scoped sign-in holds them only if it named them:
193
+
194
+ ```bash
195
+ pacific auth login --scope admin:write --scope tools:write
196
+ pacific keys create -s admin:write -s tools:write --name "policy tests" --expires 7d
197
+ ```
198
+
102
199
  ## API keys
103
200
 
104
201
  ```bash
@@ -145,11 +242,5 @@ then fails it.
145
242
 
146
243
  ## Releasing
147
244
 
148
- Bump `version` in `pyproject.toml`, merge, then push a tag that matches it:
149
-
150
- ```bash
151
- git tag v0.1.1 && git push origin v0.1.1
152
- ```
153
-
154
- The `release` workflow builds the package, checks the tag against the version,
155
- and publishes to PyPI.
245
+ Push a `vX.Y.Z` tag matching `pyproject.toml`'s version and the `release`
246
+ workflow publishes it to PyPI. [RELEASING.md](RELEASING.md) has the steps.
@@ -0,0 +1,102 @@
1
+ # Releasing pacific-cli
2
+
3
+ A release is a version tag. Pushing `vX.Y.Z` runs the `release` workflow
4
+ (`.github/workflows/release.yml`), which tests, builds and publishes
5
+ `pacific-cli` to [PyPI](https://pypi.org/project/pacific-cli/). PyPI trusts
6
+ that workflow directly (trusted publishing), so no API token is stored
7
+ anywhere.
8
+
9
+ ## Cut a release
10
+
11
+ 1. **Pick the version.** Semantic versioning, while the CLI is `0.x`:
12
+ - a fix: bump the patch (`0.1.0` → `0.1.1`);
13
+ - a new command or option, or a change to an existing one: bump the minor
14
+ (`0.1.1` → `0.2.0`).
15
+
16
+ PyPI never accepts a version twice, even after it is deleted, so a version
17
+ number is spent once a tag for it is pushed.
18
+
19
+ 2. **Bump it** in `pyproject.toml`, refresh the lock, and open a pull request:
20
+
21
+ ```bash
22
+ uv version 0.1.1 # writes pyproject.toml
23
+ uv lock
24
+ git switch -c release-0.1.1
25
+ git commit -am "Release 0.1.1"
26
+ git push -u origin release-0.1.1
27
+ ```
28
+
29
+ 3. **Merge it once CI is green** (tests on Linux and macOS, Python 3.12 and
30
+ 3.13, plus lint, types and a build check).
31
+
32
+ 4. **Tag the merged commit on `main` and push the tag:**
33
+
34
+ ```bash
35
+ git switch main && git pull
36
+ git tag -a v0.1.1 -m "pacific-cli 0.1.1"
37
+ git push origin v0.1.1
38
+ ```
39
+
40
+ Or on GitHub: **Releases → Draft a new release**, type `v0.1.1` under
41
+ *Choose a tag* ("Create new tag on publish"), target `main`, and
42
+ **Publish release**. Either way starts the workflow.
43
+
44
+ 5. **Approve the publish** if the `pypi` environment has required reviewers:
45
+ open the run under **Actions → release** and click **Review deployments**.
46
+
47
+ 6. **Check it landed:**
48
+
49
+ ```bash
50
+ uv tool install --refresh pacific-cli==0.1.1
51
+ pacific --help
52
+ ```
53
+
54
+ and that <https://pypi.org/project/pacific-cli/> shows the new version.
55
+
56
+ The workflow refuses a tag that does not match `pyproject.toml`'s version, and
57
+ publishes nothing if the tests or the build fail. A refused tag spends no
58
+ version: delete it (`git push origin :refs/tags/v0.1.1`), fix, and tag again.
59
+
60
+ ## Before a release that follows a server API change
61
+
62
+ The contract tests hold the CLI's models to `openapi/public_api_openapi.json`,
63
+ the part of the server's public API document the CLI calls. When the server's
64
+ public API has changed, refresh it from the server's
65
+ `docs/api/public_api_openapi.json` and run the tests:
66
+
67
+ ```bash
68
+ python scripts/trim_openapi.py path/to/public_api_openapi.json
69
+ uv run pytest
70
+ ```
71
+
72
+ A failing contract test names the field, enum member or response shape the
73
+ CLI no longer agrees with; fix the model, then release.
74
+
75
+ ## A bad release
76
+
77
+ PyPI does not let a version be replaced. To steer people off one:
78
+
79
+ 1. **Yank it** on PyPI: *Manage project → Releases → the version → Options →
80
+ Yank*. Installs that do not pin it skip it; pinned installs still work.
81
+ 2. **Release the fix** as the next patch version.
82
+
83
+ ## How publishing is set up
84
+
85
+ Only needed if it has to be rebuilt, such as for a new repository or a moved
86
+ project.
87
+
88
+ - **PyPI**, under the project's *Manage → Publishing* (or *Account →
89
+ Publishing* for a project not created yet), a GitHub trusted publisher:
90
+
91
+ | Field | Value |
92
+ | --- | --- |
93
+ | Owner | `pacific-ai-team` |
94
+ | Repository name | `pacific-cli` |
95
+ | Workflow name | `release.yml` |
96
+ | Environment name | `pypi` |
97
+
98
+ - **GitHub**, under *Settings → Environments*, an environment named `pypi`.
99
+ Add required reviewers there to make every publish wait for approval.
100
+
101
+ The workflow file's name, the environment's name and the repository must
102
+ match the PyPI entry exactly, or PyPI refuses the upload.
@@ -0,0 +1,108 @@
1
+ # Agent access demo
2
+
3
+ An admin uploads eight PDFs in two categories, labelled `general` and
4
+ `restricted`, and creates an agent, `demo_reader`, with one policy,
5
+ `demo-access`, that lets it search every one of them. The agent finds all
6
+ eight. Then the admin edits the policy to allow only the `general` category,
7
+ and the agent finds only those four: the restricted facts are gone from its
8
+ searches and its answers, while the admin can still read everything.
9
+
10
+ Every path below uses the same PDFs, the same agent and the same policy. They
11
+ differ only in how the questions get asked: by hand with the CLI, by a
12
+ reference script, or by an LLM in a harness you already use.
13
+
14
+ ## The corpus
15
+
16
+ [`corpus/`](corpus/) holds the PDFs, for a fictional company, Brindlecove
17
+ Instruments. Each holds one fact no other document mentions.
18
+ [`corpus/manifest.yaml`](corpus/manifest.yaml) lists each file's labels and
19
+ attributes, the question it answers, the expected answer and the keywords a
20
+ correct answer contains, and a search that should find it.
21
+ `uv run demos/agent_access/corpus/make_pdfs.py` regenerates the PDFs; the
22
+ output is the same every time.
23
+
24
+ | File | Category | Question |
25
+ |---|---|---|
26
+ | `office-relocation.pdf` | general | Where is Brindlecove moving its headquarters? |
27
+ | `holiday-calendar.pdf` | general | What leave code do I use to book a floating holiday? |
28
+ | `tern-sensor-faq.pdf` | general | How long does the Tern sensor's battery last on a full charge? |
29
+ | `travel-policy.pdf` | general | What is the nightly hotel cap for business travel in major cities? |
30
+ | `board-minutes.pdf` | restricted | How much capital did the board approve for Project Gannetfall? |
31
+ | `executive-compensation.pdf` | restricted | What is the CEO's target annual bonus? |
32
+ | `acquisition-plan.pdf` | restricted | Which company is Brindlecove planning to acquire? |
33
+ | `workforce-plan.pdf` | restricted | How many roles does the workforce reduction plan cut? |
34
+
35
+ ## The agent and the policy
36
+
37
+ - [`agents/agent.yaml`](agents/agent.yaml) creates `demo_reader`. It acts as
38
+ the admin running the demo, only that admin may use it (after approving it
39
+ themselves, for a day), and it holds no access of its own: an agent reaches
40
+ only what an allowlist grants it.
41
+ - [`policies/demo-access.yaml`](policies/demo-access.yaml) is that allowlist,
42
+ attached to the agent: search and read every document labelled
43
+ `agent-demo`, both categories.
44
+ - [`policies/demo-access.general-only.yaml`](policies/demo-access.general-only.yaml)
45
+ is the edit: the same policy with one more condition, the `general` label.
46
+ Applying it writes the policy's next version, so `pacific policy get
47
+ demo-access` and its version history show the change.
48
+
49
+ Each PDF is uploaded with two labels, `agent-demo` and its category, because
50
+ labels are what `pacific documents list` shows and what the policy matches.
51
+ The agent file holds the placeholder `{{ADMIN}}` where the admin's Pacific
52
+ user id goes; the server takes a user id there, not an email. `demo.sh`
53
+ replaces it with the id `pacific auth status` prints.
54
+
55
+ ## Before you start
56
+
57
+ - A Pacific organization with the Policy API switched on and its documents
58
+ mode set to `enforce`. Without `enforce`, document statements do not apply
59
+ to reads, and the restriction changes nothing. `enforce` applies to everyone
60
+ in the organization, so use one made for the demo.
61
+ - You are an administrator of that organization.
62
+ - The `pacific` CLI, with a profile for the organization's server and its MCP
63
+ endpoint, signed in to both:
64
+
65
+ ```bash
66
+ pacific profile add demo --base-url https://api.pacific.app --mcp-url https://mcp.pacific.app --use
67
+ pacific auth login # uploads and policy: the API
68
+ pacific auth login --mcp # acting as the agent: MCP
69
+ ```
70
+
71
+ ## The shared steps
72
+
73
+ Every path sets up and edits the policy with [`demo.sh`](demo.sh), which
74
+ prints each `pacific` command before running it:
75
+
76
+ ```bash
77
+ demos/agent_access/demo.sh check # signed in to the API and to MCP?
78
+ demos/agent_access/demo.sh generate # rebuild the 8 PDFs (already in the repo)
79
+ demos/agent_access/demo.sh setup # upload them, create demo_reader and demo-access
80
+ demos/agent_access/demo.sh list # the documents you can read, with their labels
81
+ demos/agent_access/demo.sh restrict # edit demo-access: general documents only
82
+ demos/agent_access/demo.sh unrestrict # edit it back: both categories
83
+ demos/agent_access/demo.sh teardown # remove the policy and the agent (the PDFs stay)
84
+ ```
85
+
86
+ `setup` uploads each category with `--skip-existing`, because the public API
87
+ deletes no documents: a rerun skips what is already there. `restrict` and
88
+ `unrestrict` write the policy's next version with `--overwrite`, and warn when
89
+ the organization's documents mode is not `enforce`. The first time you act as
90
+ `demo_reader` (and again after a day), Pacific asks you to approve it in the
91
+ browser; approvals are kept per client, so the CLI and Claude Code each ask
92
+ once.
93
+
94
+ ## Path A — CLI only
95
+
96
+ _To be written._
97
+
98
+ ## Path B — reference script
99
+
100
+ _To be written._
101
+
102
+ ## Path C — Claude Code
103
+
104
+ _To be written._
105
+
106
+ ## Path D — other MCP clients
107
+
108
+ _To be written._
@@ -0,0 +1,32 @@
1
+ # demo_reader: an agent that acts as the admin running the demo, which only
2
+ # that admin may use, after approving it themselves, for a day.
3
+ #
4
+ # It holds no access of its own: an agent reaches only what an allowlist
5
+ # grants it, and the demo-access policy (policies/) is that allowlist,
6
+ # attached to it by demo.sh. Editing that policy is what changes what the
7
+ # agent finds; this file does not change.
8
+ #
9
+ # {{ADMIN}} stands for that admin's Pacific user id (a UUID), which the server
10
+ # requires here: `prn:user:<email>` is refused as unresolved. demo.sh replaces
11
+ # every {{ADMIN}} with the id `pacific auth status` prints as `user` before it
12
+ # applies this file. Creating an agent accepts the Pacific MCP terms, so it is
13
+ # applied with --accept-mcp-terms.
14
+ api_version: policy.pacific.app/v1alpha1
15
+ kind: Agent
16
+ metadata:
17
+ name: demo_reader
18
+ description: Agent access demo - searches the demo documents for the admin who runs it
19
+ change_note: Create demo_reader; what it may read comes from the demo-access policy
20
+ spec:
21
+ credential_mode: delegated
22
+ acts_as: "prn:user:{{ADMIN}}"
23
+ trust:
24
+ statements:
25
+ - sid: DemoAdmin
26
+ description: The admin running the demo, once they approve it themselves, for a day
27
+ effect: allow
28
+ principals: ["prn:user:{{ADMIN}}"]
29
+ actions: ["agent:Assume"]
30
+ require:
31
+ step: self_approval
32
+ ttl_seconds: 86400
@@ -0,0 +1,87 @@
1
+ %PDF-1.3
2
+ %���
3
+ 1 0 obj
4
+ <<
5
+ /Count 1
6
+ /Kids [3 0 R]
7
+ /MediaBox [0 0 612 792]
8
+ /Type /Pages
9
+ >>
10
+ endobj
11
+ 2 0 obj
12
+ <<
13
+ /OpenAction [3 0 R /FitH null]
14
+ /PageLayout /OneColumn
15
+ /Pages 1 0 R
16
+ /Type /Catalog
17
+ >>
18
+ endobj
19
+ 3 0 obj
20
+ <<
21
+ /Contents 4 0 R
22
+ /Parent 1 0 R
23
+ /Resources 7 0 R
24
+ /Type /Page
25
+ >>
26
+ endobj
27
+ 4 0 obj
28
+ <<
29
+ /Filter /FlateDecode
30
+ /Length 344
31
+ >>
32
+ stream
33
+ x�m��N�0��y��ƈ��
34
+ �*�H���e;@u�F�1H|xO .ۓ|���t��^$��7�0XĈ#E�V�g�J��� 㑈G�
35
+ ��V�����^���x|�ڬt�G�J<��u�x@�yC�鍌T&"M��=�ל0����S^�mU){����_����ip��cd��������<|o41�\���+��2�e�emZ��ܡ^�����c(�L�K嘬J.��FԲ$pl��90�@C�Ն��Z�N��L��D�����h��]-�\�የ �"o����;�������UaQ�.Y�x;;MA&���:����t��kUD^����=�+
36
+ endstream
37
+ endobj
38
+ 5 0 obj
39
+ <<
40
+ /BaseFont /Helvetica
41
+ /Encoding /WinAnsiEncoding
42
+ /Subtype /Type1
43
+ /Type /Font
44
+ >>
45
+ endobj
46
+ 6 0 obj
47
+ <<
48
+ /BaseFont /Helvetica-Bold
49
+ /Encoding /WinAnsiEncoding
50
+ /Subtype /Type1
51
+ /Type /Font
52
+ >>
53
+ endobj
54
+ 7 0 obj
55
+ <<
56
+ /Font <</F1 5 0 R
57
+ /F2 6 0 R>>
58
+ /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]
59
+ >>
60
+ endobj
61
+ 8 0 obj
62
+ <<
63
+ /Author (Brindlecove Instruments)
64
+ /CreationDate (D:20260101000000Z)
65
+ /Title (Executive Compensation Summary)
66
+ >>
67
+ endobj
68
+ xref
69
+ 0 9
70
+ 0000000000 65535 f
71
+ 0000000015 00000 n
72
+ 0000000096 00000 n
73
+ 0000000199 00000 n
74
+ 0000000279 00000 n
75
+ 0000000695 00000 n
76
+ 0000000792 00000 n
77
+ 0000000894 00000 n
78
+ 0000000991 00000 n
79
+ trailer
80
+ <<
81
+ /Size 9
82
+ /Root 2 0 R
83
+ /Info 8 0 R
84
+ /ID [<424FA9A6B327156585E3C062A6209112><424FA9A6B327156585E3C062A6209112>]
85
+ >>
86
+ startxref
87
+ 1120
88
+ %%EOF