@deepraxis/sdk 0.1.1-dev.936276d → 0.1.1-dev.93cc895

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`. 628 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`. 664 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
 
@@ -878,12 +878,78 @@ Multipart request bodies expand plain objects into bracketed fields (for example
878
878
 
879
879
  ## devops
880
880
 
881
+ ### devops.environments.checkpoints
882
+
883
+ | Method | HTTP | Path | Streaming | Pagination |
884
+ |---|---|---|---|---|
885
+ | list | GET | `/devops/v1/environments/{id}/checkpoints` | no | no |
886
+
887
+ ### devops.flags
888
+
889
+ | Method | HTTP | Path | Streaming | Pagination |
890
+ |---|---|---|---|---|
891
+ | archive | POST | `/devops/v1/flags/{id}:archive` | no | no |
892
+ | conclude | POST | `/devops/v1/flags/{id}:conclude` | no | no |
893
+ | retrieve | GET | `/devops/v1/flags/{id}` | no | no |
894
+ | update | PATCH | `/devops/v1/flags/{id}` | no | no |
895
+
896
+ ### devops.flags.environments
897
+
898
+ | Method | HTTP | Path | Streaming | Pagination |
899
+ |---|---|---|---|---|
900
+ | update | PATCH | `/devops/v1/flags/{id}/environments/{environment}` | no | no |
901
+
902
+ ### devops.progressiveRollouts
903
+
904
+ | Method | HTTP | Path | Streaming | Pagination |
905
+ |---|---|---|---|---|
906
+ | create | POST | `/devops/v1/progressive-rollouts` | no | no |
907
+ | pause | POST | `/devops/v1/progressive-rollouts/{id}:pause` | no | no |
908
+ | resume | POST | `/devops/v1/progressive-rollouts/{id}:resume` | no | no |
909
+ | retrieve | GET | `/devops/v1/progressive-rollouts/{id}` | no | no |
910
+ | rollback | POST | `/devops/v1/progressive-rollouts/{id}:rollback` | no | no |
911
+
881
912
  ### devops.projects
882
913
 
883
914
  | Method | HTTP | Path | Streaming | Pagination |
884
915
  |---|---|---|---|---|
916
+ | list | GET | `/devops/v1/projects` | no | no |
917
+ | retrieve | GET | `/devops/v1/projects/{id}` | no | no |
885
918
  | retrieveTestCatalog | GET | `/devops/v1/projects/{project}/test-catalog` | no | no |
886
919
 
920
+ ### devops.projects.environments
921
+
922
+ | Method | HTTP | Path | Streaming | Pagination |
923
+ |---|---|---|---|---|
924
+ | list | GET | `/devops/v1/projects/{project}/environments` | no | no |
925
+
926
+ ### devops.projects.flags
927
+
928
+ | Method | HTTP | Path | Streaming | Pagination |
929
+ |---|---|---|---|---|
930
+ | create | POST | `/devops/v1/projects/{project}/flags` | no | no |
931
+ | list | GET | `/devops/v1/projects/{project}/flags` | no | no |
932
+
933
+ ### devops.projects.promotions
934
+
935
+ | Method | HTTP | Path | Streaming | Pagination |
936
+ |---|---|---|---|---|
937
+ | list | GET | `/devops/v1/projects/{project}/promotions` | no | no |
938
+
939
+ ### devops.projects.releases
940
+
941
+ | Method | HTTP | Path | Streaming | Pagination |
942
+ |---|---|---|---|---|
943
+ | create | POST | `/devops/v1/projects/{project}/releases` | no | no |
944
+ | list | GET | `/devops/v1/projects/{project}/releases` | no | no |
945
+
946
+ ### devops.projects.targets
947
+
948
+ | Method | HTTP | Path | Streaming | Pagination |
949
+ |---|---|---|---|---|
950
+ | list | GET | `/devops/v1/projects/{project}/targets` | no | no |
951
+ | refresh | POST | `/devops/v1/projects/{project}/targets:refresh` | no | no |
952
+
887
953
  ### devops.projects.testCases
888
954
 
889
955
  | Method | HTTP | Path | Streaming | Pagination |
@@ -916,6 +982,36 @@ Multipart request bodies expand plain objects into bracketed fields (for example
916
982
  |---|---|---|---|---|
917
983
  | list | GET | `/devops/v1/projects/{project}/test-suites` | no | no |
918
984
 
985
+ ### devops.promotions
986
+
987
+ | Method | HTTP | Path | Streaming | Pagination |
988
+ |---|---|---|---|---|
989
+ | approve | POST | `/devops/v1/promotions/{id}:approve` | no | no |
990
+ | cancel | POST | `/devops/v1/promotions/{id}:cancel` | no | no |
991
+ | conclude | POST | `/devops/v1/promotions/{id}:conclude` | no | no |
992
+ | create | POST | `/devops/v1/promotions` | no | no |
993
+ | retrieve | GET | `/devops/v1/promotions/{id}` | no | no |
994
+ | retry | POST | `/devops/v1/promotions/{id}:retry` | no | no |
995
+
996
+ ### devops.promotions.rollouts
997
+
998
+ | Method | HTTP | Path | Streaming | Pagination |
999
+ |---|---|---|---|---|
1000
+ | list | GET | `/devops/v1/promotions/{promotion}/rollouts` | no | no |
1001
+
1002
+ ### devops.releases
1003
+
1004
+ | Method | HTTP | Path | Streaming | Pagination |
1005
+ |---|---|---|---|---|
1006
+ | abandon | POST | `/devops/v1/releases/{id}:abandon` | no | no |
1007
+ | retrieve | GET | `/devops/v1/releases/{id}` | no | no |
1008
+
1009
+ ### devops.rollouts
1010
+
1011
+ | Method | HTTP | Path | Streaming | Pagination |
1012
+ |---|---|---|---|---|
1013
+ | retrieve | GET | `/devops/v1/rollouts/{id}` | no | no |
1014
+
919
1015
  ### devops.testCases
920
1016
 
921
1017
  | Method | HTTP | Path | Streaming | Pagination |
@@ -1068,12 +1164,25 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1068
1164
 
1069
1165
  ## media
1070
1166
 
1167
+ ### media.assets
1168
+
1169
+ | Method | HTTP | Path | Streaming | Pagination |
1170
+ |---|---|---|---|---|
1171
+ | edit | POST | `/media/v1/libraries/{library_id}/assets/{asset_id}/edits` | no | no |
1172
+ | lineage | GET | `/media/v1/libraries/{library_id}/assets/{asset_id}/lineage` | no | no |
1173
+
1071
1174
  ### media.generation.capabilities
1072
1175
 
1073
1176
  | Method | HTTP | Path | Streaming | Pagination |
1074
1177
  |---|---|---|---|---|
1075
1178
  | list | GET | `/media/v1/generation/capabilities` | no | no |
1076
1179
 
1180
+ ### media.images
1181
+
1182
+ | Method | HTTP | Path | Streaming | Pagination |
1183
+ |---|---|---|---|---|
1184
+ | generate | POST | `/media/v1/libraries/{library_id}/images/generations` | no | no |
1185
+
1077
1186
  ### media.libraries
1078
1187
 
1079
1188
  | Method | HTTP | Path | Streaming | Pagination |
@@ -1083,6 +1192,8 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1083
1192
  | list | GET | `/media/v1/libraries` | no | yes |
1084
1193
  | restore | POST | `/media/v1/libraries/{library_id}/restore` | no | no |
1085
1194
  | retrieve | GET | `/media/v1/libraries/{library_id}` | no | no |
1195
+ | retrieveDefault | GET | `/media/v1/libraries/default` | no | no |
1196
+ | setDefault | PUT | `/media/v1/libraries/default` | no | no |
1086
1197
  | update | PATCH | `/media/v1/libraries/{library_id}` | no | no |
1087
1198
 
1088
1199
  ### media.libraries.assets
@@ -1145,12 +1256,6 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1145
1256
  |---|---|---|---|---|
1146
1257
  | list | GET | `/media/v1/libraries/{library_id}/folders` | no | no |
1147
1258
 
1148
- ### media.libraries.generations
1149
-
1150
- | Method | HTTP | Path | Streaming | Pagination |
1151
- |---|---|---|---|---|
1152
- | create | POST | `/media/v1/libraries/{library_id}/generations` | no | no |
1153
-
1154
1259
  ### media.libraries.jobs
1155
1260
 
1156
1261
  | Method | HTTP | Path | Streaming | Pagination |
@@ -1159,12 +1264,6 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1159
1264
  | list | GET | `/media/v1/libraries/{library_id}/jobs` | no | yes |
1160
1265
  | retrieve | GET | `/media/v1/libraries/{library_id}/jobs/{job_id}` | no | no |
1161
1266
 
1162
- ### media.libraries.jobs.outputs.save
1163
-
1164
- | Method | HTTP | Path | Streaming | Pagination |
1165
- |---|---|---|---|---|
1166
- | create | POST | `/media/v1/libraries/{library_id}/jobs/{job_id}/outputs/{index}/save` | no | no |
1167
-
1168
1267
  ### media.libraries.purge
1169
1268
 
1170
1269
  | Method | HTTP | Path | Streaming | Pagination |
@@ -1202,6 +1301,18 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1202
1301
  | list | GET | `/media/v1/libraries/{library_id}/understandings` | no | yes |
1203
1302
  | retrieveFailureSummary | GET | `/media/v1/libraries/{library_id}/understandings/failure_summary` | no | no |
1204
1303
 
1304
+ ### media.speech
1305
+
1306
+ | Method | HTTP | Path | Streaming | Pagination |
1307
+ |---|---|---|---|---|
1308
+ | create | POST | `/media/v1/libraries/{library_id}/audio/speech` | no | no |
1309
+
1310
+ ### media.videos
1311
+
1312
+ | Method | HTTP | Path | Streaming | Pagination |
1313
+ |---|---|---|---|---|
1314
+ | generate | POST | `/media/v1/libraries/{library_id}/videos/generations` | no | no |
1315
+
1205
1316
  ## meta
1206
1317
 
1207
1318
  ### meta.docs
@@ -1974,6 +2085,13 @@ Multipart request bodies expand plain objects into bracketed fields (for example
1974
2085
  | crm.properties.archive | CRM DELETE archives the resource rather than permanently deleting it; expose the archive product verb. |
1975
2086
  | database.databases.rest.create | The final parameter identifies a table collection; POST inserts rows rather than updating the table. |
1976
2087
  | file.uploads.createSigned | Signed upload creation returns a one-time local PUT URL; ADR-039 names this operation uploads.createSigned. |
2088
+ | 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. |
2089
+ | 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. |
2090
+ | media.assets.edit | ADR-094 §9 names the edit write assets.edit; an edit acts on the addressed asset and returns a Job, so the URL nesting under a library is a mount rather than an SDK resource level. |
2091
+ | media.assets.lineage | ADR-094 §9 names the edit-tree read assets.lineage; lineage is the product verb and the URL nesting under a library is a mount, not an SDK resource level. |
2092
+ | media.speech.create | ADR-094 §1/§9 names speech synthesis speech.create; the URL says audio/speech because that is the artifact the caller gets back, and the path alone would derive a speech collection create under an audio level that is not an SDK resource. |
2093
+ | media.images.generate | ADR-094 §9 names image generation images.generate; the URL mounts it under a library, but generation is an operation on images and the path alone would derive a generations collection create. |
2094
+ | media.videos.generate | ADR-094 §2/§9 names video generation videos.generate beside images.generate; the URL mounts it under a library, but generation is an operation on videos and the path alone would derive a generations collection create. The unqualified videos resource is the video lane, distinct from the batch and legacy job resources. |
1977
2095
  | meta.docs.search | Documentation keyword search is an operation on docs, not a nested collection. |
1978
2096
  | sandbox.sandboxes.commands.run | Sandbox data operations use the E2B SDK verb while preserving URL resource nesting. |
1979
2097
  | sandbox.sandboxes.files.remove | Sandbox data operations use the E2B SDK verb while preserving URL resource nesting. |
@@ -1,7 +1,9 @@
1
1
  /**
2
- * Default credential chain for code running on a Praxis computer (ticket-5367):
3
- * PRAXIS_API_TOKEN environment variable, then ~/.praxis/credentials. Resolved at call time so a
4
- * token the platform renewed in the file is picked up by an already-running process.
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.
5
7
  */
6
8
  export interface ResolvedCredentials {
7
9
  token?: string;
@@ -9,6 +11,13 @@ export interface ResolvedCredentials {
9
11
  }
10
12
  type Env = Record<string, string | undefined>;
11
13
  type ReadFile = (path: string) => string | null;
14
+ /**
15
+ * Which environment's login file applies: PRAXIS_ENV when it names one, otherwise a `-develop.` host in
16
+ * PRAXIS_API_URL means develop and any other host production — the rule apps/cli/src/config/env.ts
17
+ * applies. A PRAXIS_ENV that is not a plain name is no environment at all and is ignored. Pure.
18
+ */
19
+ 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. */
12
21
  export declare function credentialsPath(env: Env): string | null;
13
22
  export declare function resolveDefaultCredentials(env?: Env, readFile?: ReadFile): ResolvedCredentials;
14
23
  export {};
@@ -8,9 +8,29 @@ function defaultReadFile(path) {
8
8
  return null;
9
9
  }
10
10
  }
11
+ /**
12
+ * Which environment's login file applies: PRAXIS_ENV when it names one, otherwise a `-develop.` host in
13
+ * PRAXIS_API_URL means develop and any other host production — the rule apps/cli/src/config/env.ts
14
+ * applies. A PRAXIS_ENV that is not a plain name is no environment at all and is ignored. Pure.
15
+ */
16
+ export function credentialsEnv(env) {
17
+ const declared = nonEmpty(env.PRAXIS_ENV);
18
+ if (declared && /^[A-Za-z0-9_-]+$/.test(declared))
19
+ return declared;
20
+ const apiUrl = nonEmpty(env.PRAXIS_API_URL);
21
+ if (apiUrl) {
22
+ try {
23
+ if (new URL(apiUrl).hostname.includes('-develop.'))
24
+ return 'develop';
25
+ }
26
+ catch { /* a malformed URL is not evidence of develop */ }
27
+ }
28
+ return 'production';
29
+ }
30
+ /** The one login file, the same path the CLI reads for this environment. Null without a home directory. Pure. */
11
31
  export function credentialsPath(env) {
12
32
  const home = nonEmpty(env.HOME) ?? nonEmpty(env.USERPROFILE);
13
- return home ? `${home.replace(/\/$/, '')}/.praxis/credentials` : null;
33
+ return home ? `${home.replace(/[/\\]+$/, '')}/.praxis/cli/${credentialsEnv(env)}.json` : null;
14
34
  }
15
35
  export function resolveDefaultCredentials(env = globalThis.process?.env ?? {}, readFile = defaultReadFile) {
16
36
  const envToken = nonEmpty(env.PRAXIS_API_TOKEN);
@@ -23,7 +43,7 @@ export function resolveDefaultCredentials(env = globalThis.process?.env ?? {}, r
23
43
  return envUrl ? { apiUrl: envUrl } : {};
24
44
  try {
25
45
  const file = JSON.parse(text);
26
- const token = nonEmpty(file.token);
46
+ const token = nonEmpty(file.access_token);
27
47
  const apiUrl = envUrl ?? nonEmpty(file.api_url);
28
48
  return { ...(token ? { token } : {}), ...(apiUrl ? { apiUrl } : {}) };
29
49
  }
@@ -1,6 +1,6 @@
1
1
  import { type SSEEvent } from './sse.js';
2
2
  export interface PraxisOptions {
3
- /** Explicit key. Omitted on a Praxis computer: PRAXIS_API_TOKEN, then ~/.praxis/credentials, are used. */
3
+ /** Explicit key. Omitted on a Praxis computer: PRAXIS_API_TOKEN, then the login file `~/.praxis/cli/<env>.json`, are used. */
4
4
  apiKey?: string;
5
5
  baseUrl?: string;
6
6
  timeoutMs?: number;