@deepraxis/sdk 0.1.1-dev.bf2443c → 0.1.1-dev.bfc900d

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.
package/METHODS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SDK methods
2
2
 
3
- Generated by `bun run generate`. 784 HTTP operations, plus product aliases. Version segments and path parameters are omitted from resource names. Inputs use typed `{ path, query, body, headers }` options. Collections form nested resource objects; POST actions retain their verb. Naming rules are documented in `scripts/resources.ts`; semantic exceptions and aliases with reasons are in `scripts/naming-overrides.ts`.
3
+ Generated by `bun run generate`. 845 HTTP operations, plus product aliases. Version segments and path parameters are omitted from resource names. Inputs use typed `{ path, query, body, headers }` options. Collections form nested resource objects; POST actions retain their verb. Naming rules are documented in `scripts/resources.ts`; semantic exceptions and aliases with reasons are in `scripts/naming-overrides.ts`.
4
4
 
5
5
  `always` returns an AsyncIterable; `optional` streams with `{ stream: true }`; `yes` pagination returns a Page. Only `{ data, next_cursor }` + `cursor` query contracts are automatically paginated.
6
6
 
@@ -80,6 +80,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
80
80
  | send | POST | `/agent/v1/agents/{agent_id}/events` | no | no |
81
81
  | stream | GET | `/agent/v1/agents/{agent_id}/events/stream` | always | no |
82
82
 
83
+ ### agent.agents.inbox.letters
84
+
85
+ | Method | HTTP | Path | Streaming | Pagination |
86
+ |---|---|---|---|---|
87
+ | list | GET | `/agent/v1/agents/{agent_id}/inbox/letters` | no | no |
88
+
83
89
  ### agent.agents.unarchive
84
90
 
85
91
  | Method | HTTP | Path | Streaming | Pagination |
@@ -191,6 +197,18 @@ Multipart request bodies expand plain objects into bracketed fields (for example
191
197
  | retrieveContext | GET | `/agent/v1/sessions/{session_id}/context` | no | no |
192
198
  | update | POST | `/agent/v1/sessions/{session_id}` | no | no |
193
199
 
200
+ ### agent.sessions.artifacts
201
+
202
+ | Method | HTTP | Path | Streaming | Pagination |
203
+ |---|---|---|---|---|
204
+ | list | GET | `/agent/v1/sessions/{session_id}/artifacts` | no | no |
205
+
206
+ ### agent.sessions.artifacts.contentUrl
207
+
208
+ | Method | HTTP | Path | Streaming | Pagination |
209
+ |---|---|---|---|---|
210
+ | create | POST | `/agent/v1/sessions/{session_id}/artifacts/{artifact_id}/content_url` | no | no |
211
+
194
212
  ### agent.sessions.backgroundTasks
195
213
 
196
214
  | Method | HTTP | Path | Streaming | Pagination |
@@ -213,6 +231,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
213
231
  | send | POST | `/agent/v1/sessions/{session_id}/events` | no | no |
214
232
  | stream | GET | `/agent/v1/sessions/{session_id}/events/stream` | always | no |
215
233
 
234
+ ### agent.sessions.requests
235
+
236
+ | Method | HTTP | Path | Streaming | Pagination |
237
+ |---|---|---|---|---|
238
+ | list | GET | `/agent/v1/sessions/{session_id}/requests` | no | no |
239
+
216
240
  ### agent.sessions.resources
217
241
 
218
242
  | Method | HTTP | Path | Streaming | Pagination |
@@ -274,6 +298,18 @@ Multipart request bodies expand plain objects into bracketed fields (for example
274
298
  |---|---|---|---|---|
275
299
  | list | GET | `/agent/v1/toolsets` | no | no |
276
300
 
301
+ ### agent.uploads
302
+
303
+ | Method | HTTP | Path | Streaming | Pagination |
304
+ |---|---|---|---|---|
305
+ | create | POST | `/agent/v1/uploads` | no | no |
306
+
307
+ ### agent.uploads.contentUrl
308
+
309
+ | Method | HTTP | Path | Streaming | Pagination |
310
+ |---|---|---|---|---|
311
+ | create | POST | `/agent/v1/uploads/{file_id}/content_url` | no | no |
312
+
277
313
  ## application
278
314
 
279
315
  ### application.assets.upload
@@ -666,6 +702,33 @@ Multipart request bodies expand plain objects into bracketed fields (for example
666
702
  | retrieve | GET | `/canvas/v1/collections/{collection_id}` | no | no |
667
703
  | update | PATCH | `/canvas/v1/collections/{collection_id}` | no | no |
668
704
 
705
+ ## content
706
+
707
+ ### content.contents
708
+
709
+ | Method | HTTP | Path | Streaming | Pagination |
710
+ |---|---|---|---|---|
711
+ | archive | POST | `/content/v1/contents/{content_id}/archive` | no | no |
712
+ | create | POST | `/content/v1/contents` | no | no |
713
+ | list | GET | `/content/v1/contents` | no | no |
714
+ | publish | POST | `/content/v1/contents/{content_id}/publish` | no | no |
715
+ | retrieve | GET | `/content/v1/contents/{content_id}` | no | no |
716
+ | unpublish | POST | `/content/v1/contents/{content_id}/unpublish` | no | no |
717
+ | update | PATCH | `/content/v1/contents/{content_id}` | no | no |
718
+
719
+ ### content.playbackSessions
720
+
721
+ | Method | HTTP | Path | Streaming | Pagination |
722
+ |---|---|---|---|---|
723
+ | create | POST | `/content/v1/playback/sessions` | no | no |
724
+
725
+ ### content.versions
726
+
727
+ | Method | HTTP | Path | Streaming | Pagination |
728
+ |---|---|---|---|---|
729
+ | list | GET | `/content/v1/contents/{content_id}/versions` | no | no |
730
+ | retrieve | GET | `/content/v1/contents/{content_id}/versions/{version}` | no | no |
731
+
669
732
  ## crm
670
733
 
671
734
  ### crm.associations
@@ -759,6 +822,47 @@ Multipart request bodies expand plain objects into bracketed fields (for example
759
822
  | create | POST | `/crm/v1/schemas` | no | no |
760
823
  | list | GET | `/crm/v1/schemas` | no | no |
761
824
 
825
+ ## customer
826
+
827
+ ### customer.accessTokens
828
+
829
+ | Method | HTTP | Path | Streaming | Pagination |
830
+ |---|---|---|---|---|
831
+ | create | POST | `/customer/v1/access_tokens` | no | no |
832
+ | renew | POST | `/customer/v1/access_tokens/renew` | no | no |
833
+ | revoke | DELETE | `/customer/v1/access_tokens/current` | no | no |
834
+
835
+ ### customer.customers
836
+
837
+ | Method | HTTP | Path | Streaming | Pagination |
838
+ |---|---|---|---|---|
839
+ | block | POST | `/customer/v1/customers/{customer_id}/block` | no | no |
840
+ | delete | DELETE | `/customer/v1/customers/{customer_id}` | no | no |
841
+ | list | GET | `/customer/v1/customers` | no | no |
842
+ | retrieve | GET | `/customer/v1/customers/{customer_id}` | no | no |
843
+ | revokeTokens | POST | `/customer/v1/customers/{customer_id}/revoke_tokens` | no | no |
844
+ | unblock | POST | `/customer/v1/customers/{customer_id}/unblock` | no | no |
845
+
846
+ ### customer.grantCodes
847
+
848
+ | Method | HTTP | Path | Streaming | Pagination |
849
+ |---|---|---|---|---|
850
+ | create | POST | `/customer/v1/grant_codes` | no | no |
851
+
852
+ ### customer.publishableKeys
853
+
854
+ | Method | HTTP | Path | Streaming | Pagination |
855
+ |---|---|---|---|---|
856
+ | create | POST | `/customer/v1/publishable_keys` | no | no |
857
+ | delete | DELETE | `/customer/v1/publishable_keys/{key_id}` | no | no |
858
+ | list | GET | `/customer/v1/publishable_keys` | no | no |
859
+
860
+ ### customer.usage
861
+
862
+ | Method | HTTP | Path | Streaming | Pagination |
863
+ |---|---|---|---|---|
864
+ | retrieve | GET | `/customer/v1/customers/{customer_id}/usage` | no | no |
865
+
762
866
  ## cut
763
867
 
764
868
  ### cut.exports
@@ -901,6 +1005,7 @@ Multipart request bodies expand plain objects into bracketed fields (for example
901
1005
  |---|---|---|---|---|
902
1006
  | abandon | POST | `/devops/v1/changes/{id}:abandon` | no | no |
903
1007
  | markLastSlice | POST | `/devops/v1/changes/{id}:markLastSlice` | no | no |
1008
+ | openPullRequest | POST | `/devops/v1/changes/{id}:openPullRequest` | no | no |
904
1009
  | retrieve | GET | `/devops/v1/changes/{id}` | no | no |
905
1010
 
906
1011
  ### devops.connections
@@ -963,6 +1068,7 @@ Multipart request bodies expand plain objects into bracketed fields (for example
963
1068
  | list | GET | `/devops/v1/projects` | no | no |
964
1069
  | retrieve | GET | `/devops/v1/projects/{id}` | no | no |
965
1070
  | retrieveTestCatalog | GET | `/devops/v1/projects/{project}/test-catalog` | no | no |
1071
+ | retrieveTestPlan | GET | `/devops/v1/projects/{project}/test-plan` | no | no |
966
1072
  | update | PATCH | `/devops/v1/projects/{id}` | no | no |
967
1073
 
968
1074
  ### devops.projects.changes
@@ -1004,6 +1110,7 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1004
1110
  |---|---|---|---|---|
1005
1111
  | create | POST | `/devops/v1/projects/{project}/flags` | no | no |
1006
1112
  | list | GET | `/devops/v1/projects/{project}/flags` | no | no |
1113
+ | reportCodeRefs | POST | `/devops/v1/projects/{project}/flags/code-refs` | no | no |
1007
1114
 
1008
1115
  ### devops.projects.promotions
1009
1116
 
@@ -1345,12 +1452,25 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1345
1452
  | retrieve | GET | `/media/v1/libraries/{library_id}/assets/{asset_id}` | no | no |
1346
1453
  | update | PATCH | `/media/v1/libraries/{library_id}/assets/{asset_id}` | no | no |
1347
1454
 
1455
+ ### media.libraries.assets.align
1456
+
1457
+ | Method | HTTP | Path | Streaming | Pagination |
1458
+ |---|---|---|---|---|
1459
+ | create | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/align` | no | no |
1460
+
1348
1461
  ### media.libraries.assets.frames
1349
1462
 
1350
1463
  | Method | HTTP | Path | Streaming | Pagination |
1351
1464
  |---|---|---|---|---|
1352
1465
  | create | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/frames` | no | no |
1353
1466
 
1467
+ ### media.libraries.assets.hls
1468
+
1469
+ | Method | HTTP | Path | Streaming | Pagination |
1470
+ |---|---|---|---|---|
1471
+ | create | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/hls` | no | no |
1472
+ | list | GET | `/media/v1/libraries/{library_id}/assets/{asset_id}/hls` | no | no |
1473
+
1354
1474
  ### media.libraries.assets.import
1355
1475
 
1356
1476
  | Method | HTTP | Path | Streaming | Pagination |
@@ -1556,6 +1676,12 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1556
1676
  | countTokens | POST | `/model/v1/messages/count_tokens` | no | no |
1557
1677
  | create | POST | `/model/v1/messages` | optional | no |
1558
1678
 
1679
+ ### model.modelAccess
1680
+
1681
+ | Method | HTTP | Path | Streaming | Pagination |
1682
+ |---|---|---|---|---|
1683
+ | list | GET | `/model/v1/model-access` | no | no |
1684
+
1559
1685
  ### model.models
1560
1686
 
1561
1687
  | Method | HTTP | Path | Streaming | Pagination |
@@ -1563,6 +1689,13 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1563
1689
  | list | GET | `/model/v1/models` | no | no |
1564
1690
  | retrieve | GET | `/model/v1/models/{model}` | no | no |
1565
1691
 
1692
+ ### model.models.access
1693
+
1694
+ | Method | HTTP | Path | Streaming | Pagination |
1695
+ |---|---|---|---|---|
1696
+ | delete | DELETE | `/model/v1/models/{model}/access` | no | no |
1697
+ | update | PUT | `/model/v1/models/{model}/access` | no | no |
1698
+
1566
1699
  ### model.ocr
1567
1700
 
1568
1701
  | Method | HTTP | Path | Streaming | Pagination |
@@ -1883,6 +2016,66 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1883
2016
  |---|---|---|---|---|
1884
2017
  | list | GET | `/organization/v1/usage` | no | no |
1885
2018
 
2019
+ ## registry
2020
+
2021
+ ### registry.installations
2022
+
2023
+ | Method | HTTP | Path | Streaming | Pagination |
2024
+ |---|---|---|---|---|
2025
+ | delete | DELETE | `/registry/v1/installations/{installation_id}` | no | no |
2026
+ | update | POST | `/registry/v1/installations/{installation_id}:update` | no | no |
2027
+
2028
+ ### registry.packages
2029
+
2030
+ | Method | HTTP | Path | Streaming | Pagination |
2031
+ |---|---|---|---|---|
2032
+ | retrieve | GET | `/registry/v1/packages/{package_id}` | no | no |
2033
+
2034
+ ### registry.packages.installations
2035
+
2036
+ | Method | HTTP | Path | Streaming | Pagination |
2037
+ |---|---|---|---|---|
2038
+ | create | POST | `/registry/v1/packages/{package_id}/installations` | no | no |
2039
+ | list | GET | `/registry/v1/packages/{package_id}/installations` | no | no |
2040
+
2041
+ ### registry.packages.versions
2042
+
2043
+ | Method | HTTP | Path | Streaming | Pagination |
2044
+ |---|---|---|---|---|
2045
+ | create | POST | `/registry/v1/packages/{package_id}/versions` | no | no |
2046
+ | list | GET | `/registry/v1/packages/{package_id}/versions` | no | yes |
2047
+ | retrieveArchive | GET | `/registry/v1/packages/{package_id}/versions/{version}/archive` | no | no |
2048
+ | withdraw | POST | `/registry/v1/packages/{package_id}/versions/{version}:withdraw` | no | no |
2049
+
2050
+ ### registry.packages.versions.contents
2051
+
2052
+ | Method | HTTP | Path | Streaming | Pagination |
2053
+ |---|---|---|---|---|
2054
+ | list | GET | `/registry/v1/packages/{package_id}/versions/{version}/contents` | no | no |
2055
+
2056
+ ### registry.packages.versions.files
2057
+
2058
+ | Method | HTTP | Path | Streaming | Pagination |
2059
+ |---|---|---|---|---|
2060
+ | retrieve | GET | `/registry/v1/packages/{package_id}/versions/{version}/files/{path}` | no | no |
2061
+
2062
+ ### registry.repositories
2063
+
2064
+ | Method | HTTP | Path | Streaming | Pagination |
2065
+ |---|---|---|---|---|
2066
+ | create | POST | `/registry/v1/repositories` | no | no |
2067
+ | delete | DELETE | `/registry/v1/repositories/{repository_id}` | no | no |
2068
+ | list | GET | `/registry/v1/repositories` | no | yes |
2069
+ | retrieve | GET | `/registry/v1/repositories/{repository_id}` | no | no |
2070
+ | update | PATCH | `/registry/v1/repositories/{repository_id}` | no | no |
2071
+
2072
+ ### registry.repositories.packages
2073
+
2074
+ | Method | HTTP | Path | Streaming | Pagination |
2075
+ |---|---|---|---|---|
2076
+ | create | POST | `/registry/v1/repositories/{repository_id}/packages` | no | no |
2077
+ | list | GET | `/registry/v1/repositories/{repository_id}/packages` | no | yes |
2078
+
1886
2079
  ## sandbox
1887
2080
 
1888
2081
  ### sandbox.events.sandboxes
@@ -2038,6 +2231,17 @@ Multipart request bodies expand plain objects into bracketed fields (for example
2038
2231
  |---|---|---|---|---|
2039
2232
  | create | POST | `/search/v1/search` | no | no |
2040
2233
 
2234
+ ## share
2235
+
2236
+ ### share.permissions
2237
+
2238
+ | Method | HTTP | Path | Streaming | Pagination |
2239
+ |---|---|---|---|---|
2240
+ | create | POST | `/share/v1/permissions` | no | no |
2241
+ | delete | DELETE | `/share/v1/permissions/{id}` | no | no |
2242
+ | list | GET | `/share/v1/permissions` | no | no |
2243
+ | retrieve | GET | `/share/v1/permissions/{id}` | no | no |
2244
+
2041
2245
  ## studio
2042
2246
 
2043
2247
  ### studio.codexes
@@ -2435,6 +2639,10 @@ Multipart request bodies expand plain objects into bracketed fields (for example
2435
2639
  | automation.workflows.distTags.set | Workflow dist-tags use the same npm-style assignment vocabulary as script dist-tags. |
2436
2640
  | automation.workflows.vaults.set | Assign a whole vault to a definition alias, independently of published versions. |
2437
2641
  | automation.workflows.versions.create / publish | Creating a workflow version publishes it; publish is a product alias of versions.create. |
2642
+ | content.contents.unpublish | unpublish is the product act that takes a content offline; the generic action table does not carry it, and the path-derived name would read as creating an unpublish sub-resource (services/content's content.contents.unpublish). |
2643
+ | content.versions.list | A content's versions are the immutable snapshot resource of their own (services/content's content.versions.list); nesting them under contents would derive content.contents.versions.list for a read that returns the version history. |
2644
+ | content.versions.retrieve | One version is read by its number from the same versions resource (services/content's content.versions.get); nesting under contents would derive a doubled content.contents.versions.retrieve. |
2645
+ | content.playbackSessions.create | Opening one playback is the playbackSessions operation (services/content's content.playbackSessions.create); the URL's playback group is a mount, not a resource level of its own. |
2438
2646
  | crm.objects.list | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
2439
2647
  | crm.objects.create | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
2440
2648
  | crm.objects.batch.create | The terminal batch segment is the requested operation, not another collection; retain its read/create/update/upsert/archive verb. |
@@ -2454,7 +2662,14 @@ Multipart request bodies expand plain objects into bracketed fields (for example
2454
2662
  | crm.properties.list | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
2455
2663
  | crm.properties.create | CRM objectType selects a collection, not an entity; preserve list/create separately from retrieve/update on an identified resource. |
2456
2664
  | crm.properties.archive | CRM DELETE archives the resource rather than permanently deleting it; expose the archive product verb. |
2665
+ | customer.accessTokens.revoke | Logout revokes the caller's own sign-in and its tokens (services/customer's customer.accessTokens.revoke); current is a reference to the caller's token, not a revokeCurrent sub-resource. |
2666
+ | customer.accessTokens.renew | renewal acts on the sign-in's access token (services/customer's customer.accessTokens.renew); renew is not in the generic action table, so the path alone would derive customer.accessTokens.renew.create. |
2667
+ | customer.customers.block | block is the administrative act on the customer (services/customer's customer.customers.block); it is not in the generic action table, so the path alone would derive customer.customers.block.create. |
2668
+ | customer.customers.revokeTokens | Revoking every token of one customer is an act on the customer (services/customer's customer.customers.revokeTokens); the path alone would derive customer.customers.revoke_tokens.create. |
2669
+ | customer.customers.unblock | unblock lifts the same block fact on the customer (services/customer's customer.customers.unblock); the path alone would derive customer.customers.unblock.create. |
2670
+ | customer.usage.retrieve | One customer's usage is the usage read (services/customer's customer.usage.get); usage is a projection of the customer read into billing, not a sub-resource of the customer. |
2457
2671
  | database.databases.rest.create | The final parameter identifies a table collection; POST inserts rows rather than updating the table. |
2672
+ | devops.projects.flags.reportCodeRefs | ADR-125 §4 / #1881: a checkout reports where code names each flag key, so the write is an operation on the project's flags (devops.flags.reportCodeRefs) and returns counts, not a code-refs resource; the path alone would derive a nested codeRefs collection create. |
2458
2673
  | file.uploads.createSigned | Signed upload creation returns a one-time local PUT URL; ADR-039 names this operation uploads.createSigned. |
2459
2674
  | media.libraries.retrieveDefault | ADR-094 §9 names the default-library read libraries.retrieveDefault; the URL names a reference rather than an id, so the path-derived name would otherwise read as retrieving a library called default. |
2460
2675
  | media.libraries.setDefault | ADR-094 §9 names the default-library write libraries.setDefault; the URL has no library id because the organization owns one default library, so the path alone cannot say which. |
@@ -1,9 +1,12 @@
1
1
  /**
2
- * Default credential chain for code running on a Praxis computer (ticket-5367, ADR-098 §2):
3
- * the PRAXIS_API_TOKEN environment variable, then the login file of the environment,
4
- * `~/.praxis/cli/<env>.json` — the one file `praxis login` writes for a person and the platform writes
5
- * for a managed login. Resolved at call time so a token the platform renewed in the file is picked up
6
- * by an already-running process.
2
+ * Default credential chain (ticket-5367, ADR-098 §2, ADR-157), the same rule as the `praxis` CLI:
3
+ * 1. the PRAXIS_API_TOKEN environment variable;
4
+ * 2. PRAXIS_CWD set: `$PRAXIS_CWD/.praxis/credentials/<env>.json` and nothing else — no file there means no token,
5
+ * never the home's login and never a parent directory's;
6
+ * 3. otherwise the home: `~/.praxis/credentials/<env>.json`, and while that file is absent the legacy
7
+ * `~/.praxis/cli/<env>.json` that `praxis login` wrote before ADR-157 and the platform still writes for a
8
+ * managed login.
9
+ * Resolved at call time so a token the platform renewed in the file is picked up by an already-running process.
7
10
  */
8
11
  export interface ResolvedCredentials {
9
12
  token?: string;
@@ -17,7 +20,14 @@ type ReadFile = (path: string) => string | null;
17
20
  * applies. A PRAXIS_ENV that is not a plain name is no environment at all and is ignored. Pure.
18
21
  */
19
22
  export declare function credentialsEnv(env: Env): string;
20
- /** The one login file, the same path the CLI reads for this environment. Null without a home directory. Pure. */
23
+ /** The credential file of one directory: `<dir>/.praxis/credentials/<env>.json`. Pure. */
24
+ export declare function credentialsFileIn(dir: string, env: Env): string;
25
+ /**
26
+ * The credential files this process reads, in order (ADR-157): a PRAXIS_CWD directory is the only one when named;
27
+ * otherwise the home's file and then its legacy login file. Empty without a home directory. Pure.
28
+ */
29
+ export declare function credentialsPaths(env: Env): string[];
30
+ /** The first file this process would read (the one `praxis login` writes). Null without a home directory. Pure. */
21
31
  export declare function credentialsPath(env: Env): string | null;
22
32
  export declare function resolveDefaultCredentials(env?: Env, readFile?: ReadFile): ResolvedCredentials;
23
33
  export {};
@@ -27,18 +27,37 @@ export function credentialsEnv(env) {
27
27
  }
28
28
  return 'production';
29
29
  }
30
- /** The one login file, the same path the CLI reads for this environment. Null without a home directory. Pure. */
31
- export function credentialsPath(env) {
30
+ const trimSlashes = (path) => path.replace(/[/\\]+$/, '') || path;
31
+ /** The credential file of one directory: `<dir>/.praxis/credentials/<env>.json`. Pure. */
32
+ export function credentialsFileIn(dir, env) {
33
+ return `${trimSlashes(dir)}/.praxis/credentials/${credentialsEnv(env)}.json`;
34
+ }
35
+ /**
36
+ * The credential files this process reads, in order (ADR-157): a PRAXIS_CWD directory is the only one when named;
37
+ * otherwise the home's file and then its legacy login file. Empty without a home directory. Pure.
38
+ */
39
+ export function credentialsPaths(env) {
40
+ const named = nonEmpty(env.PRAXIS_CWD);
41
+ if (named)
42
+ return [credentialsFileIn(named, env)];
32
43
  const home = nonEmpty(env.HOME) ?? nonEmpty(env.USERPROFILE);
33
- return home ? `${home.replace(/[/\\]+$/, '')}/.praxis/cli/${credentialsEnv(env)}.json` : null;
44
+ return home ? [credentialsFileIn(home, env), `${trimSlashes(home)}/.praxis/cli/${credentialsEnv(env)}.json`] : [];
45
+ }
46
+ /** The first file this process would read (the one `praxis login` writes). Null without a home directory. Pure. */
47
+ export function credentialsPath(env) {
48
+ return credentialsPaths(env)[0] ?? null;
34
49
  }
35
50
  export function resolveDefaultCredentials(env = globalThis.process?.env ?? {}, readFile = defaultReadFile) {
36
51
  const envToken = nonEmpty(env.PRAXIS_API_TOKEN);
37
52
  const envUrl = nonEmpty(env.PRAXIS_API_URL);
38
53
  if (envToken)
39
54
  return { token: envToken, ...(envUrl ? { apiUrl: envUrl } : {}) };
40
- const path = credentialsPath(env);
41
- const text = path ? readFile(path) : null;
55
+ let text = null;
56
+ for (const path of credentialsPaths(env)) {
57
+ text = readFile(path);
58
+ if (text)
59
+ break;
60
+ }
42
61
  if (!text)
43
62
  return envUrl ? { apiUrl: envUrl } : {};
44
63
  try {