@deepraxis/cli 0.1.0-dev.06cf3b8 → 0.1.0-dev.086e3bf

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/COMMANDS.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Generated by `bun run commands`. DO NOT EDIT.
4
4
 
5
- 363 HTTP operations; 365 commands including aliases.
5
+ 368 HTTP operations; 370 commands including aliases.
6
6
 
7
7
  Environment: `PRAXIS_ENV=develop|production` (dev package defaults to `develop`; stable package defaults to `production`). No `--env` option.
8
8
 
@@ -21,7 +21,7 @@ Handwritten commands: `login`, `logout`, `whoami`, `org list`, `org switch <orga
21
21
  | `praxis agent archive <agent_id>` | `agent.agents.archive` | POST `/agent/v1/agents/{agent_id}/archive` | |
22
22
  | `praxis agent computer archive <computer_id>` | `agent.computers.archive` | POST `/agent/v1/computers/{computer_id}/archive` | |
23
23
  | `praxis agent computer attachment create` | `agent.computers.attachments.create` | POST `/agent/v1/computers/{computer_id}/attachments` | `--computer`, `--name` |
24
- | `praxis agent computer connect <computer_id>` | `agent.computers.connect` | POST `/agent/v1/computers/{computer_id}/connect` | |
24
+ | `praxis agent computer connect <computer_id>` | `agent.computers.connect` | POST `/agent/v1/computers/{computer_id}/connect` | `--need` |
25
25
  | `praxis agent computer create` | `agent.computers.create` | POST `/agent/v1/computers` | `--name`, `--environment-id` |
26
26
  | `praxis agent computer delete <computer_id>` | `agent.computers.delete` | DELETE `/agent/v1/computers/{computer_id}` | |
27
27
  | `praxis agent computer file get-content` | `agent.computers.files.retrieveContent` | GET `/agent/v1/computers/{computer_id}/files/content` | `--computer`, `--path` |
@@ -31,7 +31,7 @@ Handwritten commands: `login`, `logout`, `whoami`, `org list`, `org switch <orga
31
31
  | `praxis agent computer lease renew create` | `agent.computers.leases.renew.create` | POST `/agent/v1/computers/{computer_id}/leases/{lease_id}/renew` | `--computer`, `--lease` |
32
32
  | `praxis agent computer list` | `agent.computers.list` | GET `/agent/v1/computers` | `--param-limit`, `--page` |
33
33
  | `praxis agent computer update <computer_id>` | `agent.computers.update` | POST `/agent/v1/computers/{computer_id}` | `--name` |
34
- | `praxis agent create` | `agent.agents.create` | POST `/agent/v1/agents` | `--name`, `--description`, `--system`, `--kind`, `--computer-id`, `--subagent-model` |
34
+ | `praxis agent create` | `agent.agents.create` | POST `/agent/v1/agents` | `--name`, `--description`, `--system`, `--kind`, `--computer-id`, `--subagent-model`, `--preset` |
35
35
  | `praxis agent deployment archive <deployment_id>` | `agent.deployments.archive` | POST `/agent/v1/deployments/{deployment_id}/archive` | |
36
36
  | `praxis agent deployment create` | `agent.deployments.create` | POST `/agent/v1/deployments` | `--environment-id`, `--name`, `--description`, `--vault-ids` |
37
37
  | `praxis agent deployment get <deployment_id>` | `agent.deployments.retrieve` | GET `/agent/v1/deployments/{deployment_id}` | |
@@ -69,6 +69,7 @@ Handwritten commands: `login`, `logout`, `whoami`, `org list`, `org switch <orga
69
69
  | `praxis agent session compact <session_id>` | `agent.sessions.compact` | POST `/agent/v1/sessions/{session_id}/compact` | `--instructions` |
70
70
  | `praxis agent session compaction list` | `agent.sessions.compactions.list` | GET `/agent/v1/sessions/{session_id}/compactions` | `--session` |
71
71
  | `praxis agent session create` | `agent.sessions.create` | POST `/agent/v1/sessions` | `--environment-id`, `--title`, `--vault-ids`, `--cwd`, `--computer-id`, `--time-zone`, `--model` |
72
+ | `praxis agent session delete <session_id>` | `agent.sessions.delete` | DELETE `/agent/v1/sessions/{session_id}` | |
72
73
  | `praxis agent session event list` | `agent.sessions.events.list` | GET `/agent/v1/sessions/{session_id}/events` | `--session`, `--created-at-gt`, `--created-at-gte`, `--created-at-lt`, `--created-at-lte`, `--order`, `--types`, `--param-limit`, `--page` |
73
74
  | `praxis agent session event send <session_id>` | `agent.sessions.events.send` | POST `/agent/v1/sessions/{session_id}/events` | |
74
75
  | `praxis agent session event stream` | `agent.sessions.events.stream` | GET `/agent/v1/sessions/{session_id}/events/stream` | `--session`, `--event-deltas` |
@@ -90,7 +91,8 @@ Handwritten commands: `login`, `logout`, `whoami`, `org list`, `org switch <orga
90
91
  | `praxis agent session thread stream <thread_id>` | `agent.sessions.threads.stream` | GET `/agent/v1/sessions/{session_id}/threads/{thread_id}/stream` | `--session`, `--query-session-id`, `--event-deltas` |
91
92
  | `praxis agent session update <session_id>` | `agent.sessions.update` | POST `/agent/v1/sessions/{session_id}` | `--title`, `--vault-ids`, `--model` |
92
93
  | `praxis agent toolset list` | `agent.toolsets.list` | GET `/agent/v1/toolsets` | |
93
- | `praxis agent update <agent_id>` | `agent.agents.update` | POST `/agent/v1/agents/{agent_id}` | `--description`, `--name`, `--system`, `--param-version`, `--kind`, `--computer-id`, `--subagent-model` |
94
+ | `praxis agent unarchive create` | `agent.agents.unarchive.create` | POST `/agent/v1/agents/{agent_id}/unarchive` | `--agent` |
95
+ | `praxis agent update <agent_id>` | `agent.agents.update` | POST `/agent/v1/agents/{agent_id}` | `--description`, `--name`, `--system`, `--param-version`, `--kind`, `--computer-id`, `--subagent-model`, `--preset` |
94
96
  | `praxis agent version list` | `agent.agents.versions.list` | GET `/agent/v1/agents/{agent_id}/versions` | `--agent`, `--param-limit`, `--page` |
95
97
  | `praxis application asset upload` | `application.assets.upload.create` | POST `/application/v1/assets/upload` | `--jwt` |
96
98
  | `praxis application subdomain get` | `application.subdomain.retrieve` | GET `/application/v1/subdomain` | |
@@ -113,6 +115,7 @@ Handwritten commands: `login`, `logout`, `whoami`, `org list`, `org switch <orga
113
115
  | `praxis application worker secret list` | `application.workers.secrets.list` | GET `/application/v1/workers/{worker_id}/secrets` | `--worker` |
114
116
  | `praxis application worker secret update <name>` | `application.workers.secrets.update` | PUT `/application/v1/workers/{worker_id}/secrets/{name}` | `--worker` |
115
117
  | `praxis application worker update <worker_id>` | `application.workers.update` | PATCH `/application/v1/workers/{worker_id}` | `--name`, `--tags` |
118
+ | `praxis application worker version asset get-manifest` | `application.workers.versions.assets.retrieveManifest` | GET `/application/v1/workers/{worker_id}/versions/{version_id}/assets/manifest` | `--worker`, `--param-version` |
116
119
  | `praxis application worker version create` | `application.workers.versions.create` | POST `/application/v1/workers/{worker_id}/versions` | `--worker`, `--deploy`, `--main-module`, `--compatibility-date`, `--compatibility-flags` |
117
120
  | `praxis application worker version get <version_id>` | `application.workers.versions.retrieve` | GET `/application/v1/workers/{worker_id}/versions/{version_id}` | `--worker` |
118
121
  | `praxis application worker version list` | `application.workers.versions.list` | GET `/application/v1/workers/{worker_id}/versions` | `--worker`, `--param-cursor`, `--param-limit` |
package/dist/praxis.js CHANGED
@@ -183,6 +183,17 @@ across all toolsets allowed.`
183
183
  type: "object",
184
184
  required: false,
185
185
  description: "Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable."
186
+ },
187
+ {
188
+ name: "preset",
189
+ type: "string",
190
+ enum: [
191
+ "minimal",
192
+ "data-editor",
193
+ "full"
194
+ ],
195
+ required: false,
196
+ description: "Optional tool preset. minimal enables read, glob, grep and ask_user_question; data-editor also enables write and edit; full uses the default toolset with always_allow. Explicit tools override matching preset entries. codemode requires bash and is absent from data-editor."
186
197
  }
187
198
  ]
188
199
  }
@@ -348,6 +359,17 @@ current version; omit to apply the update unconditionally.`
348
359
  type: "object",
349
360
  required: false,
350
361
  description: "Praxis extension: switchable model ids on /agent/v1 only. The default model must be included. When omitted, only the default model is selectable."
362
+ },
363
+ {
364
+ name: "preset",
365
+ type: "string",
366
+ enum: [
367
+ "minimal",
368
+ "data-editor",
369
+ "full"
370
+ ],
371
+ required: false,
372
+ description: "Optional tool preset. minimal enables read, glob, grep and ask_user_question; data-editor also enables write and edit; full uses the default toolset with always_allow. Explicit tools override matching preset entries. codemode requires bash and is absent from data-editor."
351
373
  }
352
374
  ]
353
375
  }
@@ -552,6 +574,23 @@ Removes the user from the blocklist; previously revoked tokens stay revoked. Ide
552
574
  ],
553
575
  query: []
554
576
  },
577
+ {
578
+ resource: "agent.agents.unarchive",
579
+ method: "create",
580
+ summary: "Unarchive Agent",
581
+ description: "Restore an archived agent without creating a configuration version. Already active agents are unchanged. Missing or inaccessible agents return 404. Use the returned agent id to create new sessions.",
582
+ http: "POST",
583
+ path: "/agent/v1/agents/{agent_id}/unarchive",
584
+ streaming: "no",
585
+ pagination: false,
586
+ pathParams: [
587
+ {
588
+ name: "agent_id",
589
+ sdkName: "agent_id"
590
+ }
591
+ ],
592
+ query: []
593
+ },
555
594
  {
556
595
  resource: "agent.agents.versions",
557
596
  method: "list",
@@ -763,7 +802,9 @@ Own-face superset: Managed Agents has no persistent Computer attachment director
763
802
  summary: "Connect computer",
764
803
  description: `Resume the computer and issue a sandbox connection.
765
804
 
766
- Own-face extension: Managed Agents has no persistent Computer connection. Returns the public SDK sandbox_id, envd_access_token and template_id, plus the machine tier the computer is on now (light or heavy) and the lease that keeps it there (lease_id, lease_expires_at; lease_id is null when no lease exists). Keep the lease while the connection stays open: renew it about every 20 seconds (POST .../leases/{lease_id}/renew) and release it on close (DELETE .../leases/{lease_id}). An unrenewed lease simply expires, and the full machine is reclaimed only after that. Archived computers remain accessible; foreign or absent computers return 404. Never cache credentials.`,
805
+ Own-face extension: Managed Agents has no persistent Computer connection. Returns the public SDK sandbox_id, envd_access_token and template_id, plus the machine tier the computer is on now (light or heavy) and the lease that keeps it there (lease_id, lease_expires_at; lease_id is null when no lease exists). Keep the lease while the connection stays open: renew it about every 20 seconds (POST .../leases/{lease_id}/renew) and release it on close (DELETE .../leases/{lease_id}). An unrenewed lease simply expires, and the full machine is reclaimed only after that. Archived computers remain accessible; foreign or absent computers return 404. Never cache credentials.
806
+
807
+ Connect to a computer with a caller-held lease. Omit the body or send {} to request light: the lightweight shell, or the heavy instance while it is running. Send {"need":"heavy"} to request full Linux for interactive programs; files are synchronized before the heavy connection is returned with tier heavy. Heavy running time counts toward the daily budget in seconds. Renew the lease while using the connection and release it with DELETE when finished. If the daily budget is exhausted, 429 COMPUTER_BUDGET_EXHAUSTED allows you to continue with need light.`,
767
808
  http: "POST",
768
809
  path: "/agent/v1/computers/{computer_id}/connect",
769
810
  streaming: "no",
@@ -774,7 +815,22 @@ Own-face extension: Managed Agents has no persistent Computer connection. Return
774
815
  sdkName: "computer_id"
775
816
  }
776
817
  ],
777
- query: []
818
+ query: [],
819
+ body: {
820
+ required: false,
821
+ fields: [
822
+ {
823
+ name: "need",
824
+ type: "string",
825
+ enum: [
826
+ "light",
827
+ "heavy"
828
+ ],
829
+ required: false,
830
+ description: "Defaults to light. light uses the lightweight shell, or the heavy instance while it is running. heavy requests a full Linux computer for interactive programs; heavy running time counts toward the daily budget in seconds."
831
+ }
832
+ ]
833
+ }
778
834
  },
779
835
  {
780
836
  resource: "agent.computers.files",
@@ -1921,6 +1977,23 @@ offsets ("+08:00") and unknown names return 400. Never stored in
1921
1977
  ]
1922
1978
  }
1923
1979
  },
1980
+ {
1981
+ resource: "agent.sessions",
1982
+ method: "delete",
1983
+ summary: "Delete session",
1984
+ description: "Delete an idle or terminated session and its event history after saving a deletion snapshot. Supply the session id from creation or listing. Running sessions return 409 INVALID_STATE: interrupt first or wait until idle or terminated. Afterwards retrieval and event listing return 404 and lists omit the session. Example: DELETE /agent/v1/sessions/sesn_example.",
1985
+ http: "DELETE",
1986
+ path: "/agent/v1/sessions/{session_id}",
1987
+ streaming: "no",
1988
+ pagination: false,
1989
+ pathParams: [
1990
+ {
1991
+ name: "session_id",
1992
+ sdkName: "session_id"
1993
+ }
1994
+ ],
1995
+ query: []
1996
+ },
1924
1997
  {
1925
1998
  resource: "agent.sessions",
1926
1999
  method: "retrieve",
@@ -3435,6 +3508,27 @@ Own-face extension. Use a readable session and a run_id from its events. Each su
3435
3508
  ],
3436
3509
  query: []
3437
3510
  },
3511
+ {
3512
+ resource: "application.workers.versions.assets",
3513
+ method: "retrieveManifest",
3514
+ summary: "Get version asset manifest",
3515
+ description: "Read the retained asset paths, content hashes and byte sizes of a version for publication planning. This read creates no session or version. A version without assets returns an empty manifest; unavailable artifacts and foreign resources return 404.",
3516
+ http: "GET",
3517
+ path: "/application/v1/workers/{worker_id}/versions/{version_id}/assets/manifest",
3518
+ streaming: "no",
3519
+ pagination: false,
3520
+ pathParams: [
3521
+ {
3522
+ name: "worker_id",
3523
+ sdkName: "worker_id"
3524
+ },
3525
+ {
3526
+ name: "version_id",
3527
+ sdkName: "version_id"
3528
+ }
3529
+ ],
3530
+ query: []
3531
+ },
3438
3532
  {
3439
3533
  resource: "automation.actions",
3440
3534
  method: "list",
@@ -15429,6 +15523,19 @@ var createClient = (config = {}) => {
15429
15523
  var client = createClient(createConfig({ baseUrl: "https://api.deepraxis.com" }));
15430
15524
 
15431
15525
  // ../../packages/sdk/typescript/src/generated/sdk.gen.ts
15526
+ var unarchiveAgent = (options) => (options.client ?? client).post({
15527
+ security: [{
15528
+ key: "BearerAuth",
15529
+ scheme: "bearer",
15530
+ type: "http"
15531
+ }, {
15532
+ key: "ApiKeyAuth",
15533
+ name: "X-API-Key",
15534
+ type: "apiKey"
15535
+ }],
15536
+ url: "/agent/v1/agents/{agent_id}/unarchive",
15537
+ ...options
15538
+ });
15432
15539
  var deleteRunFeedback = (options) => (options.client ?? client).delete({
15433
15540
  security: [{
15434
15541
  key: "BearerAuth",
@@ -15750,7 +15857,11 @@ var connectComputer = (options) => (options.client ?? client).post({
15750
15857
  type: "apiKey"
15751
15858
  }],
15752
15859
  url: "/agent/v1/computers/{computer_id}/connect",
15753
- ...options
15860
+ ...options,
15861
+ headers: {
15862
+ "Content-Type": "application/json",
15863
+ ...options.headers
15864
+ }
15754
15865
  });
15755
15866
  var renewComputerLease = (options) => (options.client ?? client).post({
15756
15867
  security: [{
@@ -17028,7 +17139,7 @@ var runSandboxCommand = (options) => (options.client ?? client).post({
17028
17139
  ...options.headers
17029
17140
  }
17030
17141
  });
17031
- var agentsList = (options) => (options?.client ?? client).get({
17142
+ var sessionsDelete = (options) => (options.client ?? client).delete({
17032
17143
  security: [{
17033
17144
  key: "BearerAuth",
17034
17145
  scheme: "bearer",
@@ -17038,10 +17149,10 @@ var agentsList = (options) => (options?.client ?? client).get({
17038
17149
  name: "X-API-Key",
17039
17150
  type: "apiKey"
17040
17151
  }],
17041
- url: "/agent/v1/agents",
17152
+ url: "/agent/v1/sessions/{session_id}",
17042
17153
  ...options
17043
17154
  });
17044
- var agentsCreate = (options) => (options.client ?? client).post({
17155
+ var sessionsRetrieve = (options) => (options.client ?? client).get({
17045
17156
  security: [{
17046
17157
  key: "BearerAuth",
17047
17158
  scheme: "bearer",
@@ -17051,14 +17162,27 @@ var agentsCreate = (options) => (options.client ?? client).post({
17051
17162
  name: "X-API-Key",
17052
17163
  type: "apiKey"
17053
17164
  }],
17054
- url: "/agent/v1/agents",
17165
+ url: "/agent/v1/sessions/{session_id}",
17166
+ ...options
17167
+ });
17168
+ var sessionsUpdate = (options) => (options.client ?? client).post({
17169
+ security: [{
17170
+ key: "BearerAuth",
17171
+ scheme: "bearer",
17172
+ type: "http"
17173
+ }, {
17174
+ key: "ApiKeyAuth",
17175
+ name: "X-API-Key",
17176
+ type: "apiKey"
17177
+ }],
17178
+ url: "/agent/v1/sessions/{session_id}",
17055
17179
  ...options,
17056
17180
  headers: {
17057
17181
  "Content-Type": "application/json",
17058
17182
  ...options.headers
17059
17183
  }
17060
17184
  });
17061
- var agentsRetrieve = (options) => (options.client ?? client).get({
17185
+ var agentsList = (options) => (options?.client ?? client).get({
17062
17186
  security: [{
17063
17187
  key: "BearerAuth",
17064
17188
  scheme: "bearer",
@@ -17068,10 +17192,10 @@ var agentsRetrieve = (options) => (options.client ?? client).get({
17068
17192
  name: "X-API-Key",
17069
17193
  type: "apiKey"
17070
17194
  }],
17071
- url: "/agent/v1/agents/{agent_id}",
17195
+ url: "/agent/v1/agents",
17072
17196
  ...options
17073
17197
  });
17074
- var agentsUpdate = (options) => (options.client ?? client).post({
17198
+ var agentsCreate = (options) => (options.client ?? client).post({
17075
17199
  security: [{
17076
17200
  key: "BearerAuth",
17077
17201
  scheme: "bearer",
@@ -17081,14 +17205,14 @@ var agentsUpdate = (options) => (options.client ?? client).post({
17081
17205
  name: "X-API-Key",
17082
17206
  type: "apiKey"
17083
17207
  }],
17084
- url: "/agent/v1/agents/{agent_id}",
17208
+ url: "/agent/v1/agents",
17085
17209
  ...options,
17086
17210
  headers: {
17087
17211
  "Content-Type": "application/json",
17088
17212
  ...options.headers
17089
17213
  }
17090
17214
  });
17091
- var agentsArchive = (options) => (options.client ?? client).post({
17215
+ var agentsRetrieve = (options) => (options.client ?? client).get({
17092
17216
  security: [{
17093
17217
  key: "BearerAuth",
17094
17218
  scheme: "bearer",
@@ -17098,10 +17222,10 @@ var agentsArchive = (options) => (options.client ?? client).post({
17098
17222
  name: "X-API-Key",
17099
17223
  type: "apiKey"
17100
17224
  }],
17101
- url: "/agent/v1/agents/{agent_id}/archive",
17225
+ url: "/agent/v1/agents/{agent_id}",
17102
17226
  ...options
17103
17227
  });
17104
- var agentsVersionsList = (options) => (options.client ?? client).get({
17228
+ var agentsUpdate = (options) => (options.client ?? client).post({
17105
17229
  security: [{
17106
17230
  key: "BearerAuth",
17107
17231
  scheme: "bearer",
@@ -17111,10 +17235,14 @@ var agentsVersionsList = (options) => (options.client ?? client).get({
17111
17235
  name: "X-API-Key",
17112
17236
  type: "apiKey"
17113
17237
  }],
17114
- url: "/agent/v1/agents/{agent_id}/versions",
17115
- ...options
17238
+ url: "/agent/v1/agents/{agent_id}",
17239
+ ...options,
17240
+ headers: {
17241
+ "Content-Type": "application/json",
17242
+ ...options.headers
17243
+ }
17116
17244
  });
17117
- var sessionsList = (options) => (options?.client ?? client).get({
17245
+ var agentsArchive = (options) => (options.client ?? client).post({
17118
17246
  security: [{
17119
17247
  key: "BearerAuth",
17120
17248
  scheme: "bearer",
@@ -17124,10 +17252,10 @@ var sessionsList = (options) => (options?.client ?? client).get({
17124
17252
  name: "X-API-Key",
17125
17253
  type: "apiKey"
17126
17254
  }],
17127
- url: "/agent/v1/sessions",
17255
+ url: "/agent/v1/agents/{agent_id}/archive",
17128
17256
  ...options
17129
17257
  });
17130
- var sessionsCreate = (options) => (options.client ?? client).post({
17258
+ var agentsVersionsList = (options) => (options.client ?? client).get({
17131
17259
  security: [{
17132
17260
  key: "BearerAuth",
17133
17261
  scheme: "bearer",
@@ -17137,14 +17265,10 @@ var sessionsCreate = (options) => (options.client ?? client).post({
17137
17265
  name: "X-API-Key",
17138
17266
  type: "apiKey"
17139
17267
  }],
17140
- url: "/agent/v1/sessions",
17141
- ...options,
17142
- headers: {
17143
- "Content-Type": "application/json",
17144
- ...options.headers
17145
- }
17268
+ url: "/agent/v1/agents/{agent_id}/versions",
17269
+ ...options
17146
17270
  });
17147
- var sessionsRetrieve = (options) => (options.client ?? client).get({
17271
+ var sessionsList = (options) => (options?.client ?? client).get({
17148
17272
  security: [{
17149
17273
  key: "BearerAuth",
17150
17274
  scheme: "bearer",
@@ -17154,10 +17278,10 @@ var sessionsRetrieve = (options) => (options.client ?? client).get({
17154
17278
  name: "X-API-Key",
17155
17279
  type: "apiKey"
17156
17280
  }],
17157
- url: "/agent/v1/sessions/{session_id}",
17281
+ url: "/agent/v1/sessions",
17158
17282
  ...options
17159
17283
  });
17160
- var sessionsUpdate = (options) => (options.client ?? client).post({
17284
+ var sessionsCreate = (options) => (options.client ?? client).post({
17161
17285
  security: [{
17162
17286
  key: "BearerAuth",
17163
17287
  scheme: "bearer",
@@ -17167,7 +17291,7 @@ var sessionsUpdate = (options) => (options.client ?? client).post({
17167
17291
  name: "X-API-Key",
17168
17292
  type: "apiKey"
17169
17293
  }],
17170
- url: "/agent/v1/sessions/{session_id}",
17294
+ url: "/agent/v1/sessions",
17171
17295
  ...options,
17172
17296
  headers: {
17173
17297
  "Content-Type": "application/json",
@@ -17668,6 +17792,15 @@ var applicationCreateVersion = (options) => (options.client ?? client).post({
17668
17792
  ...options.headers
17669
17793
  }
17670
17794
  });
17795
+ var applicationGetVersionAssetManifest = (options) => (options.client ?? client).get({
17796
+ security: [{
17797
+ key: "application-bearerAuth",
17798
+ scheme: "bearer",
17799
+ type: "http"
17800
+ }],
17801
+ url: "/application/v1/workers/{worker_id}/versions/{version_id}/assets/manifest",
17802
+ ...options
17803
+ });
17671
17804
  var applicationGetVersion = (options) => (options.client ?? client).get({
17672
17805
  security: [{
17673
17806
  key: "application-bearerAuth",
@@ -20505,6 +20638,9 @@ function createAgent(transport) {
20505
20638
  },
20506
20639
  list: bind(transport, agentsList),
20507
20640
  retrieve: bind(transport, agentsRetrieve),
20641
+ unarchive: {
20642
+ create: bind(transport, unarchiveAgent)
20643
+ },
20508
20644
  update: bind(transport, agentsUpdate),
20509
20645
  versions: {
20510
20646
  list: bind(transport, agentsVersionsList)
@@ -20585,6 +20721,7 @@ function createAgent(transport) {
20585
20721
  list: bind(transport, listSessionCompactions)
20586
20722
  },
20587
20723
  create: bind(transport, sessionsCreate),
20724
+ delete: bind(transport, sessionsDelete),
20588
20725
  events: {
20589
20726
  list: bind(transport, sessionsEventsList),
20590
20727
  send: bind(transport, sessionsEventsSend),
@@ -20666,6 +20803,9 @@ function createApplication(transport) {
20666
20803
  },
20667
20804
  update: bind(transport, applicationUpdateWorker),
20668
20805
  versions: {
20806
+ assets: {
20807
+ retrieveManifest: bind(transport, applicationGetVersionAssetManifest)
20808
+ },
20669
20809
  create: bind(transport, applicationCreateVersion),
20670
20810
  list: bindPage(transport, applicationListVersions),
20671
20811
  retrieve: bind(transport, applicationGetVersion)
@@ -21616,6 +21756,10 @@ function base64(bytes) {
21616
21756
  return btoa(chunks.join(""));
21617
21757
  }
21618
21758
  async function publish(client2, input) {
21759
+ const rolloutFields = ["gradual", "gradualRollout", "gradual_rollout", "canary", "rollout", "percentage", "percent", "traffic", "traffic_percentage", "strategy", "versions"];
21760
+ if (Object.keys(input).some((key) => rolloutFields.includes(key) || /percentage|percent|canary|gradual|rollout|灰度/i.test(key))) {
21761
+ throw new PraxisError({ code: "INVALID_PARAMS", message: '平台不支持灰度 (gradual rollout is not supported). Roll back with praxis.application.workers.deployments.create({ path: { worker_id }, body: { strategy: "percentage", versions: [{ version_id: previousVersionId, percentage: 100 }] } }); the previous version artifacts must still be retained.' });
21762
+ }
21619
21763
  const timeout = input.timeout_ms ?? 120000;
21620
21764
  if (!Number.isFinite(timeout) || timeout < 0)
21621
21765
  throw new RangeError("timeout_ms must be non-negative and finite");
@@ -21634,7 +21778,7 @@ async function publish(client2, input) {
21634
21778
  const files = Object.entries(input.files);
21635
21779
  if (files.length > 1e5)
21636
21780
  throw new PraxisError({ code: "LIMIT_EXCEEDED", message: "At most 100000 asset paths can be published" });
21637
- const manifest = {};
21781
+ let manifest = {};
21638
21782
  const contents = new Map;
21639
21783
  for (const [path2, content] of files) {
21640
21784
  const normalized = path2.startsWith("/") ? path2 : `/${path2}`;
@@ -21643,8 +21787,8 @@ async function publish(client2, input) {
21643
21787
  const bytes = typeof content === "string" ? new TextEncoder().encode(content) : new Uint8Array(content);
21644
21788
  if (bytes.length > FILE_BYTES)
21645
21789
  throw new PraxisError({ code: "LIMIT_EXCEEDED", message: `Asset ${normalized} exceeds 25 MiB` });
21646
- const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
21647
- const hash = Array.from(digest.subarray(0, 16), (byte) => byte.toString(16).padStart(2, "0")).join("");
21790
+ const digest2 = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
21791
+ const hash = Array.from(digest2.subarray(0, 16), (byte) => byte.toString(16).padStart(2, "0")).join("");
21648
21792
  manifest[normalized] = { hash, size: bytes.length };
21649
21793
  contents.set(hash, bytes);
21650
21794
  }
@@ -21657,9 +21801,60 @@ async function publish(client2, input) {
21657
21801
  }
21658
21802
  }
21659
21803
  const created = !worker;
21804
+ if (!worker && input.dryRun)
21805
+ throw new PraxisError({ code: "NOT_FOUND", message: "请先创建应用 (create the application before dryRun)" });
21660
21806
  worker ??= await workers.create({ body: { name: input.name, subdomain: { enabled: true } } });
21661
21807
  const path = { worker_id: worker.id };
21808
+ let currentVersion;
21809
+ let currentDeployment;
21810
+ let previous = {};
21811
+ if (worker.praxis?.current_deployment_id) {
21812
+ currentDeployment = await workers.deployments.retrieve({ path: { ...path, deployment_id: worker.praxis.current_deployment_id } });
21813
+ const active = currentDeployment.versions[0];
21814
+ if (!active)
21815
+ throw new PraxisError({ code: "INVALID_RESPONSE", message: "Current deployment has no version" });
21816
+ currentVersion = await workers.versions.retrieve({ path: { ...path, version_id: active.version_id } });
21817
+ previous = (await workers.versions.assets.retrieveManifest({ path: { ...path, version_id: active.version_id } })).manifest;
21818
+ }
21819
+ manifest = {
21820
+ ...Object.fromEntries(Object.entries(previous).filter(([key]) => input.keepExisting || Object.hasOwn(manifest, key))),
21821
+ ...manifest
21822
+ };
21823
+ if (Object.keys(manifest).length > 1e5)
21824
+ throw new PraxisError({ code: "LIMIT_EXCEEDED", message: "At most 100000 asset paths can be published" });
21825
+ const added = Object.keys(manifest).filter((key) => !Object.hasOwn(previous, key));
21826
+ const changed = Object.keys(manifest).filter((key) => previous[key] && (previous[key].hash !== manifest[key].hash || previous[key].size !== manifest[key].size));
21827
+ const removed = Object.keys(previous).filter((key) => !Object.hasOwn(manifest, key));
21828
+ const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(manifest))));
21829
+ const manifestHash = Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join("");
21830
+ const staticOnly = !["main", "bindings", "compatibility_date", "compatibility_flags", "assets_config"].some((key) => Object.hasOwn(input, key));
21831
+ const unchanged = staticOnly && !!currentVersion && manifestHash === currentVersion.praxis.assets_manifest?.manifest_hash;
21832
+ const hashes = new Set(Object.values(manifest).map((entry) => entry.hash));
21833
+ const currentResult = {
21834
+ url: worker.subdomain.url,
21835
+ worker_id: worker.id,
21836
+ version_id: currentVersion?.id ?? null,
21837
+ deployment_id: currentDeployment?.id ?? null,
21838
+ status: currentDeployment?.praxis.status ?? "draft",
21839
+ created,
21840
+ ...currentVersion ? { version: currentVersion } : {},
21841
+ unchanged,
21842
+ uploaded: 0,
21843
+ reused: hashes.size
21844
+ };
21845
+ if (unchanged && !input.dryRun)
21846
+ return currentResult;
21662
21847
  const session = await workers.assetsUploadSession.create({ path, body: { manifest } });
21848
+ if (input.dryRun) {
21849
+ const missing = new Set(session.buckets.flat());
21850
+ if ([...missing].some((hash) => !hashes.has(hash)))
21851
+ throw new PraxisError({ code: "INVALID_RESPONSE", message: "Upload session requested an unknown hash" });
21852
+ return {
21853
+ ...currentResult,
21854
+ reused: hashes.size - missing.size,
21855
+ plan: { added, changed, removed, upload_hashes: missing.size, existing_hashes: hashes.size - missing.size }
21856
+ };
21857
+ }
21663
21858
  let jwt = session.buckets.length ? null : session.jwt;
21664
21859
  const uploaded = new Set;
21665
21860
  for (const bucket of session.buckets) {
@@ -21730,7 +21925,7 @@ async function publish(client2, input) {
21730
21925
  status: deployment.praxis.status,
21731
21926
  created,
21732
21927
  uploaded: uploaded.size,
21733
- reused: contents.size - uploaded.size
21928
+ reused: hashes.size - uploaded.size
21734
21929
  };
21735
21930
  }
21736
21931
 
@@ -23280,7 +23475,7 @@ function startProgress(ctx, write = (text) => writeOutput({ stderr: text })) {
23280
23475
  }
23281
23476
 
23282
23477
  // src/main.ts
23283
- var version = "0.1.0-dev.06cf3b8";
23478
+ var version = "0.1.0-dev.086e3bf";
23284
23479
  var commands = commandTree(operations);
23285
23480
  var manual = [["login"], ["logout"], ["whoami"], ["org", "list"], ["org", "switch"], ["api"], ["skill"]];
23286
23481
  function route(argv) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepraxis/cli",
3
- "version": "0.1.0-dev.06cf3b8",
3
+ "version": "0.1.0-dev.086e3bf",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "praxis": "dist/praxis.js"