pacific-cli 0.1.0__tar.gz → 0.3.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 (135) hide show
  1. pacific_cli-0.3.0/PKG-INFO +391 -0
  2. pacific_cli-0.3.0/README.md +361 -0
  3. pacific_cli-0.3.0/RELEASING.md +102 -0
  4. pacific_cli-0.3.0/demos/agent_access/README.md +108 -0
  5. pacific_cli-0.3.0/demos/agent_access/agents/agent.yaml +32 -0
  6. pacific_cli-0.3.0/demos/agent_access/corpus/acquisition-plan.pdf +0 -0
  7. pacific_cli-0.3.0/demos/agent_access/corpus/board-minutes.pdf +0 -0
  8. pacific_cli-0.3.0/demos/agent_access/corpus/executive-compensation.pdf +88 -0
  9. pacific_cli-0.3.0/demos/agent_access/corpus/holiday-calendar.pdf +0 -0
  10. pacific_cli-0.3.0/demos/agent_access/corpus/make_pdfs.py +164 -0
  11. pacific_cli-0.3.0/demos/agent_access/corpus/manifest.yaml +71 -0
  12. pacific_cli-0.3.0/demos/agent_access/corpus/manifest_test.py +164 -0
  13. pacific_cli-0.3.0/demos/agent_access/corpus/office-relocation.pdf +90 -0
  14. pacific_cli-0.3.0/demos/agent_access/corpus/tern-sensor-faq.pdf +0 -0
  15. pacific_cli-0.3.0/demos/agent_access/corpus/travel-policy.pdf +87 -0
  16. pacific_cli-0.3.0/demos/agent_access/corpus/workforce-plan.pdf +92 -0
  17. pacific_cli-0.3.0/demos/agent_access/demo.sh +133 -0
  18. pacific_cli-0.3.0/demos/agent_access/demo_test.py +210 -0
  19. pacific_cli-0.3.0/demos/agent_access/policies/demo-access.general-only.yaml +31 -0
  20. pacific_cli-0.3.0/demos/agent_access/policies/demo-access.yaml +34 -0
  21. pacific_cli-0.3.0/openapi/public_api_openapi.json +11698 -0
  22. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/pyproject.toml +12 -6
  23. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/scripts/trim_openapi.py +40 -10
  24. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/__init__.py +2 -2
  25. pacific_cli-0.3.0/src/pacific_cli/admin/__init__.py +1 -0
  26. pacific_cli-0.3.0/src/pacific_cli/admin/commands.py +154 -0
  27. pacific_cli-0.3.0/src/pacific_cli/admin/commands_test.py +123 -0
  28. pacific_cli-0.3.0/src/pacific_cli/admin/config.py +36 -0
  29. pacific_cli-0.3.0/src/pacific_cli/admin/service.py +191 -0
  30. pacific_cli-0.3.0/src/pacific_cli/admin/service_test.py +346 -0
  31. pacific_cli-0.3.0/src/pacific_cli/admin/types.py +81 -0
  32. pacific_cli-0.3.0/src/pacific_cli/agents/__init__.py +1 -0
  33. pacific_cli-0.3.0/src/pacific_cli/agents/commands.py +53 -0
  34. pacific_cli-0.3.0/src/pacific_cli/aliases/__init__.py +1 -0
  35. pacific_cli-0.3.0/src/pacific_cli/aliases/commands.py +38 -0
  36. pacific_cli-0.3.0/src/pacific_cli/aliases/commands_test.py +63 -0
  37. pacific_cli-0.3.0/src/pacific_cli/aliases/config.py +22 -0
  38. pacific_cli-0.3.0/src/pacific_cli/aliases/types.py +18 -0
  39. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/client.py +73 -37
  40. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/client_test.py +59 -2
  41. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/commands.py +133 -34
  42. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/config.py +32 -15
  43. pacific_cli-0.3.0/src/pacific_cli/auth/login_pages.py +99 -0
  44. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/oauth.py +105 -30
  45. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/oauth_test.py +101 -2
  46. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/profiles.py +151 -35
  47. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/profiles_test.py +120 -7
  48. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/runtime.py +44 -0
  49. pacific_cli-0.3.0/src/pacific_cli/auth/sessions.py +90 -0
  50. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/types.py +67 -0
  51. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/config.py +6 -1
  52. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/contract_test.py +251 -3
  53. pacific_cli-0.3.0/src/pacific_cli/documents/__init__.py +1 -0
  54. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/documents/commands.py +66 -19
  55. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/documents/commands_test.py +143 -15
  56. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/documents/config.py +9 -1
  57. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/documents/service.py +70 -5
  58. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/documents/service_test.py +49 -2
  59. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/documents/types.py +22 -1
  60. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/keys/commands.py +16 -9
  61. pacific_cli-0.3.0/src/pacific_cli/main.py +103 -0
  62. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/main_test.py +89 -11
  63. pacific_cli-0.3.0/src/pacific_cli/mcp/__init__.py +1 -0
  64. pacific_cli-0.3.0/src/pacific_cli/mcp/client.py +211 -0
  65. pacific_cli-0.3.0/src/pacific_cli/mcp/client_test.py +111 -0
  66. pacific_cli-0.3.0/src/pacific_cli/mcp/commands.py +28 -0
  67. pacific_cli-0.3.0/src/pacific_cli/mcp/config.py +42 -0
  68. pacific_cli-0.3.0/src/pacific_cli/mcp/fake_server_test.py +310 -0
  69. pacific_cli-0.3.0/src/pacific_cli/mcp/service.py +180 -0
  70. pacific_cli-0.3.0/src/pacific_cli/mcp/service_test.py +170 -0
  71. pacific_cli-0.3.0/src/pacific_cli/mcp/types.py +158 -0
  72. pacific_cli-0.3.0/src/pacific_cli/monitors/__init__.py +1 -0
  73. pacific_cli-0.3.0/src/pacific_cli/monitors/commands.py +404 -0
  74. pacific_cli-0.3.0/src/pacific_cli/monitors/commands_test.py +180 -0
  75. pacific_cli-0.3.0/src/pacific_cli/monitors/config.py +22 -0
  76. pacific_cli-0.3.0/src/pacific_cli/monitors/service.py +179 -0
  77. pacific_cli-0.3.0/src/pacific_cli/monitors/service_test.py +366 -0
  78. pacific_cli-0.3.0/src/pacific_cli/monitors/types.py +298 -0
  79. pacific_cli-0.3.0/src/pacific_cli/policy/commands.py +610 -0
  80. pacific_cli-0.3.0/src/pacific_cli/policy/commands_test.py +310 -0
  81. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/policy/config.py +3 -0
  82. pacific_cli-0.3.0/src/pacific_cli/policy/recorded/policy_get_effective_access.json +206 -0
  83. pacific_cli-0.3.0/src/pacific_cli/policy/recorded/policy_list_calls.json +214 -0
  84. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/policy/service.py +89 -4
  85. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/policy/service_test.py +353 -1
  86. pacific_cli-0.3.0/src/pacific_cli/policy/types.py +564 -0
  87. pacific_cli-0.3.0/src/pacific_cli/refusals.py +41 -0
  88. pacific_cli-0.3.0/src/pacific_cli/samples/__init__.py +1 -0
  89. pacific_cli-0.3.0/src/pacific_cli/samples/commands.py +60 -0
  90. pacific_cli-0.3.0/src/pacific_cli/samples/commands_test.py +41 -0
  91. pacific_cli-0.3.0/src/pacific_cli/samples/config.py +35 -0
  92. pacific_cli-0.3.0/src/pacific_cli/samples/files/acme-vendor-agreement.pdf +93 -0
  93. pacific_cli-0.3.0/src/pacific_cli/samples/files/helios-ridge-q3-2026-compliance-certificate.pdf +80 -0
  94. pacific_cli-0.3.0/src/pacific_cli/samples/files/helios-ridge-q3-2026-update.pdf +80 -0
  95. pacific_cli-0.3.0/src/pacific_cli/samples/files/northwind-freight-q3-2026-update.pdf +80 -0
  96. pacific_cli-0.3.0/src/pacific_cli/samples/service.py +56 -0
  97. pacific_cli-0.3.0/src/pacific_cli/samples/service_test.py +61 -0
  98. pacific_cli-0.3.0/src/pacific_cli/samples/types.py +32 -0
  99. pacific_cli-0.3.0/src/pacific_cli/schemas/__init__.py +1 -0
  100. pacific_cli-0.3.0/src/pacific_cli/schemas/commands.py +188 -0
  101. pacific_cli-0.3.0/src/pacific_cli/schemas/commands_test.py +104 -0
  102. pacific_cli-0.3.0/src/pacific_cli/schemas/config.py +16 -0
  103. pacific_cli-0.3.0/src/pacific_cli/schemas/service.py +232 -0
  104. pacific_cli-0.3.0/src/pacific_cli/schemas/service_test.py +512 -0
  105. pacific_cli-0.3.0/src/pacific_cli/schemas/types.py +192 -0
  106. pacific_cli-0.3.0/src/pacific_cli/search/__init__.py +1 -0
  107. pacific_cli-0.3.0/src/pacific_cli/search/commands.py +93 -0
  108. pacific_cli-0.3.0/src/pacific_cli/search/commands_test.py +98 -0
  109. pacific_cli-0.3.0/src/pacific_cli/search/config.py +11 -0
  110. pacific_cli-0.3.0/src/pacific_cli/search/service.py +91 -0
  111. pacific_cli-0.3.0/src/pacific_cli/search/types.py +77 -0
  112. pacific_cli-0.3.0/src/pacific_cli/tryout/__init__.py +1 -0
  113. pacific_cli-0.3.0/src/pacific_cli/tryout/commands.py +57 -0
  114. pacific_cli-0.3.0/src/pacific_cli/tryout/config.py +7 -0
  115. pacific_cli-0.3.0/src/pacific_cli/tryout/service.py +66 -0
  116. pacific_cli-0.3.0/src/pacific_cli/tryout/service_test.py +198 -0
  117. pacific_cli-0.3.0/src/pacific_cli/tryout/types.py +29 -0
  118. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/uv.lock +12 -1
  119. pacific_cli-0.1.0/PKG-INFO +0 -185
  120. pacific_cli-0.1.0/README.md +0 -155
  121. pacific_cli-0.1.0/openapi/public_api_openapi.json +0 -4629
  122. pacific_cli-0.1.0/src/pacific_cli/documents/__init__.py +0 -1
  123. pacific_cli-0.1.0/src/pacific_cli/main.py +0 -58
  124. pacific_cli-0.1.0/src/pacific_cli/policy/commands.py +0 -263
  125. pacific_cli-0.1.0/src/pacific_cli/policy/types.py +0 -235
  126. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/.gitignore +0 -0
  127. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/LICENSE +0 -0
  128. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/__main__.py +0 -0
  129. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/auth/__init__.py +0 -0
  130. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/keys/__init__.py +0 -0
  131. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/keys/config.py +0 -0
  132. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/keys/service.py +0 -0
  133. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/keys/service_test.py +0 -0
  134. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/keys/types.py +0 -0
  135. {pacific_cli-0.1.0 → pacific_cli-0.3.0}/src/pacific_cli/policy/__init__.py +0 -0
@@ -0,0 +1,391 @@
1
+ Metadata-Version: 2.5
2
+ Name: pacific-cli
3
+ Version: 0.3.0
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
+ Project-URL: Homepage, https://pacific.app
6
+ Project-URL: Documentation, https://docs.pacific.app
7
+ Project-URL: Source, https://github.com/pacific-ai-team/pacific-cli
8
+ Project-URL: Issues, https://github.com/pacific-ai-team/pacific-cli/issues
9
+ Author: Pacific
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: access policies,cli,documents,pacific
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Requires-Python: >=3.12
22
+ Requires-Dist: click>=8.2.1
23
+ Requires-Dist: filelock>=3.16
24
+ Requires-Dist: httpx>=0.28.1
25
+ Requires-Dist: pydantic-settings>=2.9
26
+ Requires-Dist: pydantic>=2.11
27
+ Requires-Dist: pyyaml>=6.0.1
28
+ Requires-Dist: rich>=13.4.1
29
+ Description-Content-Type: text/markdown
30
+
31
+ # pacific — the command line for Pacific
32
+
33
+ Upload documents, write access policies, and attach them to people and agents
34
+ on Pacific, over its public API (`/public/v1`).
35
+
36
+ ```bash
37
+ uv tool install pacific-cli # or: pipx install pacific-cli
38
+ pacific login # sign in to Pacific's cloud in the browser
39
+ pacific try # upload the sample documents and search them
40
+ ```
41
+
42
+ The package is `pacific-cli`; the command it installs is `pacific`. It needs
43
+ Python 3.12 or later (`uv tool` and `pipx` fetch one if you need it).
44
+
45
+ ## Profiles: which server, as whom
46
+
47
+ Out of the box the CLI talks to Pacific's cloud through a built-in `prod`
48
+ profile (`https://api.pacific.app`, MCP `https://mcp.pacific.app`), so
49
+ `pacific login` works straight after install.
50
+
51
+ ```bash
52
+ pacific login # signs in to prod, the built-in default
53
+ pacific profile add local --base-url http://localhost:5001 --use # a local server
54
+ pacific profile use prod # back to Pacific's cloud
55
+ pacific profile ls # * marks the current profile
56
+ pacific profile show # what this command would run as, and why
57
+ ```
58
+
59
+ A command runs as `--profile`, then `$PACIFIC_PROFILE`, then the current
60
+ profile. `$PACIFIC_API_KEY` replaces that profile's credential, and
61
+ `$PACIFIC_BASE_URL` stands in for a profile when none is selected, so a CI job
62
+ needs no config file. With none of these, it runs as the built-in `prod`
63
+ profile; adding a profile named `prod` replaces it. Profiles live in `$PACIFIC_CLI_CONFIG_DIR`, else
64
+ `$XDG_CONFIG_HOME/pacific`, else `~/.config/pacific`: `config.json` holds the
65
+ servers and `credentials.json` (mode 0600) the keys and sessions.
66
+
67
+ ## Signing in
68
+
69
+ - **API key** — `pacific auth set-key` (or `--stdin`). A key carries the scopes
70
+ it was minted with (`documents:write` to upload, `tools:read`/`tools:write`
71
+ for policy, `admin:read`/`admin:write` for dummy users), so it is how to give
72
+ a profile less than your full access.
73
+ - **Browser** — `pacific login` opens the server's sign-in page and waits
74
+ on a loopback port, as Claude Code does (RFC 8252: discovery, a client
75
+ registered for that one redirect, PKCE S256, the token bound to the public
76
+ API). The session refreshes itself. `--no-browser` prints the link instead.
77
+
78
+ `--scope` (repeatable) limits the session to those API scopes, as a key's
79
+ scopes limit it; with none it acts with your full access:
80
+
81
+ ```bash
82
+ pacific login --scope documents:write --scope tools:read
83
+ ```
84
+
85
+ The server refuses a scope it does not define before you sign in. A server
86
+ whose public API does not take browser sessions (its
87
+ `MCP_BROKER_PUBLIC_API_TOKENS_ENABLED` is off, or it predates broker tokens on
88
+ cloud) answers the CLI's check with a 401; `login` then revokes the session
89
+ and says to use a key.
90
+
91
+ ```bash
92
+ pacific whoami # who the server says you are, your scopes
93
+ # (asks with documents:read)
94
+ curl -H "Authorization: Bearer $(pacific auth token)" "$URL/public/v1/documents"
95
+ pacific logout # revokes the browser sessions (API and MCP)
96
+ ```
97
+
98
+ ## Trying it, and the sample documents
99
+
100
+ `pacific try` is the quickstart in one command: it copies the sample documents
101
+ into `./pacific-samples` (or `try DIR`), uploads them and waits until they are
102
+ searchable, searches them, and prints what to do next. It is safe to rerun:
103
+ samples already on disk are reused, and ones already uploaded (same name, no
104
+ labels) are skipped, so a rerun only searches again. Only hits in the samples
105
+ are shown; when there are none yet, it prints the search to retry once
106
+ indexing catches up.
107
+
108
+ The CLI ships the sample documents docs.pacific.app uses, so the quickstart
109
+ needs no files of your own. No sign-in is needed to copy them.
110
+
111
+ ```bash
112
+ pacific samples list # each file and what it is
113
+ pacific samples copy # into ./pacific-samples (or: copy DIR)
114
+ pacific upload pacific-samples/*.pdf --wait
115
+ ```
116
+
117
+ `copy` refuses before writing anything when a sample file is already there;
118
+ `--overwrite` replaces it.
119
+
120
+ ## Uploading with policy metadata
121
+
122
+ ```bash
123
+ pacific upload deck.pdf memo.docx \
124
+ -l board -l refcode:r100 \
125
+ -a deal_stage=diligence -a region=emea -a region=us \
126
+ --wait # until each is searchable; prints its id
127
+ pacific upload *.pdf -l demo --skip-existing --wait # safe to rerun
128
+ pacific ls # oldest 50, with their labels
129
+ pacific ls --limit 200 # or --all, printed a page at a time
130
+ pacific job JOB_ID
131
+ ```
132
+
133
+ `--skip-existing` reads the documents you can read once, skips a file already
134
+ uploaded with the same name and labels, and stops before sending anything when
135
+ a file's name is there with other labels (uploading would make a second copy).
136
+ Attributes are not compared: the documents list does not return them. Skipped
137
+ files are reported on stderr, so `--json` stays the jobs this run started.
138
+
139
+ Labels are matched lower-cased as `resource.metadata.labels`; each `--attr`
140
+ key as `resource.metadata.<key>` (a key given twice keeps both values). One
141
+ file goes to `/ingest`; more go to `/ingest/bulk` in batches of
142
+ `$PACIFIC_CLI_UPLOAD_BATCH_SIZE` (100, the server's default cap).
143
+
144
+ ## Policies
145
+
146
+ ```bash
147
+ pacific policy apply -f board-readers.yaml --dry-run # the server's verdict, nothing written
148
+ pacific policy apply -f board-readers.yaml # create, or write the next version
149
+ pacific policy ls # --kind agents|services|resource-sets
150
+ pacific policy get board-readers > board-readers.json # edit, then apply it back
151
+ pacific principals user --query alice
152
+ pacific policy attach board-readers user alice@acme.com
153
+ pacific policy attach board-readers group "Investment Committee"
154
+ pacific policy attached user alice@acme.com
155
+ pacific policy detach board-readers user alice@acme.com
156
+ pacific policy me
157
+ pacific policy simulate --as alice@acme.com # what she can search now
158
+ pacific policy simulate --as alice@acme.com --candidate restrict.yaml # and after a change
159
+ pacific access agent research_bot # each connector's tools, and what the policies answer
160
+ pacific access user alice@acme.com # --json for the server's answer
161
+ pacific activity --agent-id research_bot --outcome blocked # call history, newest first
162
+ pacific activity --user-id alice@acme.com --since 2026-11-25T10:00:00Z
163
+ ```
164
+
165
+ `simulate` judges documents for a person without writing anything: a sample of
166
+ what you can read (or the ones named with `--document PRN`), each allowed or
167
+ denied under the active policies and, with `--candidate`, under those plus
168
+ PermissionPolicy files you have not applied yet, with the statements that
169
+ decided it. `--action` picks the action judged (`document:Search` by default).
170
+ It needs an organization administrator and `tools:read`, and refuses agent keys.
171
+ Documents are shown by PRN: the documents list does not carry one, so the CLI
172
+ cannot put file names beside them.
173
+
174
+ A policy file is sent as written; the server validates it. A write whose
175
+ `metadata.version` is not the latest is refused with the latest version;
176
+ `--overwrite` writes on top of it instead. Writing needs an organization
177
+ administrator, `tools:write`, and the organization's Policy API switched on
178
+ (`access_policy_api_enabled`). Document statements apply to reads only once the
179
+ organization's documents mode is `enforce`; `attach` and `attached` say which
180
+ surfaces apply now.
181
+
182
+ `access` shows, for each connector, its tools by what they declare (read,
183
+ write, destructive, undeclared), whether a call is allowed now, needs approval
184
+ or is refused, and the statements that decided. A member asks about themselves
185
+ and the agents they may act as; an administrator about anyone. When the
186
+ organization does not enforce tool-call policies yet, it says so and each
187
+ decision is what the policies would answer.
188
+
189
+ `activity` prints the organization's recent tool calls and API calls, newest
190
+ first, one per line: when, how it ended, who, what was called, and what decided
191
+ it. Filter with `--agent-id`, `--user-id` (an id or an email), `--tool`,
192
+ `--outcome` and `--since`; `--internal-tools hidden` leaves out the tools
193
+ Pacific's own AI uses to run itself. A page with more after it prints the
194
+ cursor to pass back with `--cursor`. `--json` prints the server's reply.
195
+
196
+ ## Schemas
197
+
198
+ An entity schema is a type Pacific extracts from your documents (a company, a
199
+ fund, a loan) and the attributes to read for it. Write one as a file:
200
+
201
+ ```yaml
202
+ # company.yaml
203
+ entity_type: Company
204
+ description: A company we lend to or invest in
205
+ attributes:
206
+ - display_name: Net Leverage
207
+ description: Net debt divided by EBITDA, as a multiple
208
+ value_type: multiple
209
+ - display_name: Sector
210
+ description: The industry the company operates in
211
+ value_type: text
212
+ ```
213
+
214
+ ```bash
215
+ pacific schemas apply -f company.yaml # create Company, or edit it if it exists
216
+ pacific schemas list
217
+ pacific schemas get Company # an id or the entity type's name
218
+ pacific schemas get Company --draft # an attribute edit no FindAll has run yet
219
+ pacific schemas history Company # every saved edit, newest first
220
+ ```
221
+
222
+ `apply` creates the type when no schema has that `entity_type`, and otherwise
223
+ replaces its description and attributes with the file's. An attribute keeps its
224
+ id, and the values already extracted for it, by keeping its `display_name` (in
225
+ any case); an attribute the file leaves out is removed, and the server refuses
226
+ to remove one a monitor watches. A write starts no extraction: a new type is
227
+ inert, and an attribute edit is a draft until a FindAll runs it. A description
228
+ edit applies at once. There is no delete; remove a type in the schema editor.
229
+ `value_type` is one of the editor's types (`text`, `number`, `multiple`,
230
+ `currency`, `percentage`, `date`, `year`, `list`, ...); the server validates the
231
+ file. A condition's unit must fit it: "exceeds 6x" needs a `multiple`.
232
+
233
+ Reading needs `entities:read` and writing `entities:write`. A full-access
234
+ browser sign-in holds both. Every command takes `--json` for the server's reply.
235
+
236
+ ## Monitors
237
+
238
+ A monitor watches an entity type's extracted values for a condition you write
239
+ in plain language, and emails its subscribers when a document makes it true.
240
+
241
+ ```bash
242
+ pacific monitors preview "Alert when a company's net leverage exceeds 6x" # nothing is stored
243
+ pacific monitors create "Alert when a company's net leverage exceeds 6x" \
244
+ --name "Leverage over 6x" --subscriber analyst@example.com --severity HIGH
245
+ pacific monitors list
246
+ pacific monitors get MONITOR_ID
247
+ pacific monitors events MONITOR_ID --since 2026-12-01 # the times it fired, newest first
248
+ pacific monitors subscribe MONITOR_ID --subscriber pm@example.com
249
+ pacific monitors delete MONITOR_ID
250
+ ```
251
+
252
+ The server compiles the condition into typed conditions on an entity type, and
253
+ adds an attribute to the type when the condition names one it lacks; `preview`
254
+ shows the type, conditions and attributes a create would use, without writing.
255
+ To pin what it chose, pass the preview's ids to `create` with
256
+ `--entity-schema-id` and `--entity-id`, or watch a FindAll's entities with
257
+ `--findall-id`. `--disabled` creates it switched off.
258
+
259
+ Reading needs `monitors:read`, and `preview` needs `entities:read` as well,
260
+ because it reads the entity types and entities a create would use. `create` and
261
+ `delete` need `monitors:write` and `entities:write`, because a monitor can add an
262
+ attribute to its type; `subscribe` needs `monitors:write`. Each write scope
263
+ includes its read, so this covers every monitor command:
264
+
265
+ ```bash
266
+ pacific login --scope monitors:write --scope entities:write
267
+ pacific keys create -s monitors:write -s entities:write --name "demo" --expires 7d
268
+ ```
269
+
270
+ ## Searching, and acting as an agent
271
+
272
+ ```bash
273
+ pacific search "board deck budget" # as you
274
+ pacific login --mcp # once: sign in to the MCP endpoint
275
+ pacific agents list # who you may act as
276
+ pacific search "board deck budget" --as demo_reader
277
+ pacific search "board deck budget" --as demo_reader --json # files, best first
278
+ ```
279
+
280
+ As you, `search` calls the public API's `/search/content` with the profile's
281
+ key or browser session. As an agent, it calls the same search as the MCP tool
282
+ `search_content`, through a separate sign-in to the profile's MCP endpoint
283
+ (`--mcp-url`; the built-in `prod` profile has `https://mcp.pacific.app`), and the agent's
284
+ rules decide what it finds. Approving that sign-in accepts the server's MCP
285
+ terms of service, as connecting any MCP client does.
286
+
287
+ A person's session acts as an agent one call at a time: each call names the
288
+ agent in `pacific__acting_as`, and a call that names none runs as you. The CLI
289
+ adds it to every call it makes with `--as`, so none can leave it out.
290
+ The first search as an agent (and the first after an approval lapses) prints
291
+ an approval link and opens it; the CLI waits until you approve, up to
292
+ `$PACIFIC_CLI_AGENT_APPROVAL_TIMEOUT` (ten minutes), then runs the search.
293
+ Approvals are kept per MCP client: approving an agent for the CLI does not
294
+ approve it for Claude Code. An agent is created with `pacific policy apply` on
295
+ an `Agent` file; `--json` from `search` names the files that answered, best
296
+ match first, which is what a script checks.
297
+
298
+ ## Dummy users
299
+
300
+ Test members to try policies on, for an organization administrator: create
301
+ one, attach policies to it or grant it what a real member would get, test
302
+ through an agent that acts as it, then remove it.
303
+
304
+ ```bash
305
+ pacific admin dummy-users create "Test Analyst" # test-analyst-<suffix>@your-domain
306
+ pacific admin dummy-users create "Test Banker" --email banker --json
307
+ pacific admin dummy-users list
308
+ pacific policy attach board-readers user "Test Analyst"
309
+ pacific admin dummy-users remove "Test Analyst" # an id, email or name
310
+ pacific admin dummy-users remove --all
311
+ ```
312
+
313
+ A dummy user is a member with no access of its own and no way to sign in,
314
+ listed only to administrators. Its address is the `--email` local part (by
315
+ default the name, lower-cased with dashes), a random suffix and your
316
+ organization's domain. Creating one again with the same name and local part
317
+ returns the same dummy user, so a setup script can rerun; an organization holds
318
+ at most 50.
319
+
320
+ The server checks that you are a current administrator on every call and
321
+ refuses agent keys. Listing needs `admin:read`, and creating and removing
322
+ `admin:write` (which includes `admin:read`). A full-access browser sign-in
323
+ holds both; a key or a scoped sign-in holds them only if it named them:
324
+
325
+ ```bash
326
+ pacific login --scope admin:write --scope tools:write
327
+ pacific keys create -s admin:write -s tools:write --name "policy tests" --expires 7d
328
+ ```
329
+
330
+ ## API keys
331
+
332
+ ```bash
333
+ pacific keys create -s documents:write -s tools:read --name "CI deploy" --expires 90d
334
+ pacific keys ls # without their values
335
+ pacific keys revoke api_key_...
336
+ ```
337
+
338
+ `create` prints the key's value once, on stdout, so it can be piped straight
339
+ into another profile (`... | pacific -p ci auth set-key --stdin`). A key's
340
+ scopes must be within the session that creates it, and lifetimes are a fixed
341
+ menu: `30m`, `7d`, `30d`, `90d`, `1y`, `never`.
342
+
343
+ Keys are managed only from a browser sign-in that asked for `keys:manage`:
344
+ never with a key (so a leaked key cannot mint its own replacements), never
345
+ with a session that did not ask, and `create` and `rotate` only within the
346
+ server's fresh-sign-in window (five minutes by default). Full access does not
347
+ include `keys:manage`, but a sign-in asking for `keys:manage` alone has full
348
+ access besides. Each command tries the
349
+ profile's own browser session first; when the server refuses it for one of
350
+ those reasons, or the profile holds an API key, the command signs you in once
351
+ asking for `keys:manage` alone, makes the request, and revokes that sign-in.
352
+ To keep a session that may list and revoke without signing in each time:
353
+
354
+ ```bash
355
+ pacific login --scope keys:manage
356
+ ```
357
+
358
+ ## Old command names
359
+
360
+ Commands renamed to short top-level verbs keep their old names as hidden
361
+ aliases: they run the same command but are left out of `--help`.
362
+
363
+ | Old | New |
364
+ |---|---|
365
+ | `auth login`, `auth logout`, `auth status` | `login`, `logout`, `whoami` |
366
+ | `documents upload`, `documents list`, `documents job` | `upload`, `ls`, `job` |
367
+ | `policy access`, `policy calls`, `policy principals` | `access`, `activity`, `principals` |
368
+ | `policy list`, `policy delete` | `policy ls`, `policy rm` |
369
+ | `keys list`, `profile list`, `profile remove` | `keys ls`, `profile ls`, `profile rm` |
370
+ | `search --as-agent` | `search --as` |
371
+
372
+ ## Developing
373
+
374
+ ```bash
375
+ uv sync
376
+ uv run pytest # tests sit beside the code as *_test.py
377
+ uv run ruff format src && uv run ruff check src
378
+ uv run pyrefly check
379
+ ```
380
+
381
+ `src/pacific_cli/contract_test.py` holds every model the CLI parses a response
382
+ with to that route's schema in `openapi/public_api_openapi.json`: the part of
383
+ the server's published public API document this CLI calls. Refresh it from the
384
+ full document with `python scripts/trim_openapi.py <public_api_openapi.json>`.
385
+ A server change that renames a field, adds an enum member or wraps a response
386
+ then fails it.
387
+
388
+ ## Releasing
389
+
390
+ Push a `vX.Y.Z` tag matching `pyproject.toml`'s version and the `release`
391
+ workflow publishes it to PyPI. [RELEASING.md](RELEASING.md) has the steps.