@deepraxis/cli 0.1.0-dev.06cf3b8 → 0.1.0-dev.13103a0
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 +1 -1
- package/dist/praxis.js +205 -31
- package/package.json +1 -1
package/COMMANDS.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Generated by `bun run commands`. DO NOT EDIT.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
365 HTTP operations; 367 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
|
|
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",
|
|
@@ -1921,6 +1960,23 @@ offsets ("+08:00") and unknown names return 400. Never stored in
|
|
|
1921
1960
|
]
|
|
1922
1961
|
}
|
|
1923
1962
|
},
|
|
1963
|
+
{
|
|
1964
|
+
resource: "agent.sessions",
|
|
1965
|
+
method: "delete",
|
|
1966
|
+
summary: "Delete session",
|
|
1967
|
+
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.",
|
|
1968
|
+
http: "DELETE",
|
|
1969
|
+
path: "/agent/v1/sessions/{session_id}",
|
|
1970
|
+
streaming: "no",
|
|
1971
|
+
pagination: false,
|
|
1972
|
+
pathParams: [
|
|
1973
|
+
{
|
|
1974
|
+
name: "session_id",
|
|
1975
|
+
sdkName: "session_id"
|
|
1976
|
+
}
|
|
1977
|
+
],
|
|
1978
|
+
query: []
|
|
1979
|
+
},
|
|
1924
1980
|
{
|
|
1925
1981
|
resource: "agent.sessions",
|
|
1926
1982
|
method: "retrieve",
|
|
@@ -3435,6 +3491,27 @@ Own-face extension. Use a readable session and a run_id from its events. Each su
|
|
|
3435
3491
|
],
|
|
3436
3492
|
query: []
|
|
3437
3493
|
},
|
|
3494
|
+
{
|
|
3495
|
+
resource: "application.workers.versions.assets",
|
|
3496
|
+
method: "retrieveManifest",
|
|
3497
|
+
summary: "Get version asset manifest",
|
|
3498
|
+
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.",
|
|
3499
|
+
http: "GET",
|
|
3500
|
+
path: "/application/v1/workers/{worker_id}/versions/{version_id}/assets/manifest",
|
|
3501
|
+
streaming: "no",
|
|
3502
|
+
pagination: false,
|
|
3503
|
+
pathParams: [
|
|
3504
|
+
{
|
|
3505
|
+
name: "worker_id",
|
|
3506
|
+
sdkName: "worker_id"
|
|
3507
|
+
},
|
|
3508
|
+
{
|
|
3509
|
+
name: "version_id",
|
|
3510
|
+
sdkName: "version_id"
|
|
3511
|
+
}
|
|
3512
|
+
],
|
|
3513
|
+
query: []
|
|
3514
|
+
},
|
|
3438
3515
|
{
|
|
3439
3516
|
resource: "automation.actions",
|
|
3440
3517
|
method: "list",
|
|
@@ -15429,6 +15506,19 @@ var createClient = (config = {}) => {
|
|
|
15429
15506
|
var client = createClient(createConfig({ baseUrl: "https://api.deepraxis.com" }));
|
|
15430
15507
|
|
|
15431
15508
|
// ../../packages/sdk/typescript/src/generated/sdk.gen.ts
|
|
15509
|
+
var unarchiveAgent = (options) => (options.client ?? client).post({
|
|
15510
|
+
security: [{
|
|
15511
|
+
key: "BearerAuth",
|
|
15512
|
+
scheme: "bearer",
|
|
15513
|
+
type: "http"
|
|
15514
|
+
}, {
|
|
15515
|
+
key: "ApiKeyAuth",
|
|
15516
|
+
name: "X-API-Key",
|
|
15517
|
+
type: "apiKey"
|
|
15518
|
+
}],
|
|
15519
|
+
url: "/agent/v1/agents/{agent_id}/unarchive",
|
|
15520
|
+
...options
|
|
15521
|
+
});
|
|
15432
15522
|
var deleteRunFeedback = (options) => (options.client ?? client).delete({
|
|
15433
15523
|
security: [{
|
|
15434
15524
|
key: "BearerAuth",
|
|
@@ -17028,7 +17118,7 @@ var runSandboxCommand = (options) => (options.client ?? client).post({
|
|
|
17028
17118
|
...options.headers
|
|
17029
17119
|
}
|
|
17030
17120
|
});
|
|
17031
|
-
var
|
|
17121
|
+
var sessionsDelete = (options) => (options.client ?? client).delete({
|
|
17032
17122
|
security: [{
|
|
17033
17123
|
key: "BearerAuth",
|
|
17034
17124
|
scheme: "bearer",
|
|
@@ -17038,10 +17128,10 @@ var agentsList = (options) => (options?.client ?? client).get({
|
|
|
17038
17128
|
name: "X-API-Key",
|
|
17039
17129
|
type: "apiKey"
|
|
17040
17130
|
}],
|
|
17041
|
-
url: "/agent/v1/
|
|
17131
|
+
url: "/agent/v1/sessions/{session_id}",
|
|
17042
17132
|
...options
|
|
17043
17133
|
});
|
|
17044
|
-
var
|
|
17134
|
+
var sessionsRetrieve = (options) => (options.client ?? client).get({
|
|
17045
17135
|
security: [{
|
|
17046
17136
|
key: "BearerAuth",
|
|
17047
17137
|
scheme: "bearer",
|
|
@@ -17051,14 +17141,27 @@ var agentsCreate = (options) => (options.client ?? client).post({
|
|
|
17051
17141
|
name: "X-API-Key",
|
|
17052
17142
|
type: "apiKey"
|
|
17053
17143
|
}],
|
|
17054
|
-
url: "/agent/v1/
|
|
17144
|
+
url: "/agent/v1/sessions/{session_id}",
|
|
17145
|
+
...options
|
|
17146
|
+
});
|
|
17147
|
+
var sessionsUpdate = (options) => (options.client ?? client).post({
|
|
17148
|
+
security: [{
|
|
17149
|
+
key: "BearerAuth",
|
|
17150
|
+
scheme: "bearer",
|
|
17151
|
+
type: "http"
|
|
17152
|
+
}, {
|
|
17153
|
+
key: "ApiKeyAuth",
|
|
17154
|
+
name: "X-API-Key",
|
|
17155
|
+
type: "apiKey"
|
|
17156
|
+
}],
|
|
17157
|
+
url: "/agent/v1/sessions/{session_id}",
|
|
17055
17158
|
...options,
|
|
17056
17159
|
headers: {
|
|
17057
17160
|
"Content-Type": "application/json",
|
|
17058
17161
|
...options.headers
|
|
17059
17162
|
}
|
|
17060
17163
|
});
|
|
17061
|
-
var
|
|
17164
|
+
var agentsList = (options) => (options?.client ?? client).get({
|
|
17062
17165
|
security: [{
|
|
17063
17166
|
key: "BearerAuth",
|
|
17064
17167
|
scheme: "bearer",
|
|
@@ -17068,10 +17171,10 @@ var agentsRetrieve = (options) => (options.client ?? client).get({
|
|
|
17068
17171
|
name: "X-API-Key",
|
|
17069
17172
|
type: "apiKey"
|
|
17070
17173
|
}],
|
|
17071
|
-
url: "/agent/v1/agents
|
|
17174
|
+
url: "/agent/v1/agents",
|
|
17072
17175
|
...options
|
|
17073
17176
|
});
|
|
17074
|
-
var
|
|
17177
|
+
var agentsCreate = (options) => (options.client ?? client).post({
|
|
17075
17178
|
security: [{
|
|
17076
17179
|
key: "BearerAuth",
|
|
17077
17180
|
scheme: "bearer",
|
|
@@ -17081,14 +17184,14 @@ var agentsUpdate = (options) => (options.client ?? client).post({
|
|
|
17081
17184
|
name: "X-API-Key",
|
|
17082
17185
|
type: "apiKey"
|
|
17083
17186
|
}],
|
|
17084
|
-
url: "/agent/v1/agents
|
|
17187
|
+
url: "/agent/v1/agents",
|
|
17085
17188
|
...options,
|
|
17086
17189
|
headers: {
|
|
17087
17190
|
"Content-Type": "application/json",
|
|
17088
17191
|
...options.headers
|
|
17089
17192
|
}
|
|
17090
17193
|
});
|
|
17091
|
-
var
|
|
17194
|
+
var agentsRetrieve = (options) => (options.client ?? client).get({
|
|
17092
17195
|
security: [{
|
|
17093
17196
|
key: "BearerAuth",
|
|
17094
17197
|
scheme: "bearer",
|
|
@@ -17098,10 +17201,10 @@ var agentsArchive = (options) => (options.client ?? client).post({
|
|
|
17098
17201
|
name: "X-API-Key",
|
|
17099
17202
|
type: "apiKey"
|
|
17100
17203
|
}],
|
|
17101
|
-
url: "/agent/v1/agents/{agent_id}
|
|
17204
|
+
url: "/agent/v1/agents/{agent_id}",
|
|
17102
17205
|
...options
|
|
17103
17206
|
});
|
|
17104
|
-
var
|
|
17207
|
+
var agentsUpdate = (options) => (options.client ?? client).post({
|
|
17105
17208
|
security: [{
|
|
17106
17209
|
key: "BearerAuth",
|
|
17107
17210
|
scheme: "bearer",
|
|
@@ -17111,10 +17214,14 @@ var agentsVersionsList = (options) => (options.client ?? client).get({
|
|
|
17111
17214
|
name: "X-API-Key",
|
|
17112
17215
|
type: "apiKey"
|
|
17113
17216
|
}],
|
|
17114
|
-
url: "/agent/v1/agents/{agent_id}
|
|
17115
|
-
...options
|
|
17217
|
+
url: "/agent/v1/agents/{agent_id}",
|
|
17218
|
+
...options,
|
|
17219
|
+
headers: {
|
|
17220
|
+
"Content-Type": "application/json",
|
|
17221
|
+
...options.headers
|
|
17222
|
+
}
|
|
17116
17223
|
});
|
|
17117
|
-
var
|
|
17224
|
+
var agentsArchive = (options) => (options.client ?? client).post({
|
|
17118
17225
|
security: [{
|
|
17119
17226
|
key: "BearerAuth",
|
|
17120
17227
|
scheme: "bearer",
|
|
@@ -17124,10 +17231,10 @@ var sessionsList = (options) => (options?.client ?? client).get({
|
|
|
17124
17231
|
name: "X-API-Key",
|
|
17125
17232
|
type: "apiKey"
|
|
17126
17233
|
}],
|
|
17127
|
-
url: "/agent/v1/
|
|
17234
|
+
url: "/agent/v1/agents/{agent_id}/archive",
|
|
17128
17235
|
...options
|
|
17129
17236
|
});
|
|
17130
|
-
var
|
|
17237
|
+
var agentsVersionsList = (options) => (options.client ?? client).get({
|
|
17131
17238
|
security: [{
|
|
17132
17239
|
key: "BearerAuth",
|
|
17133
17240
|
scheme: "bearer",
|
|
@@ -17137,14 +17244,10 @@ var sessionsCreate = (options) => (options.client ?? client).post({
|
|
|
17137
17244
|
name: "X-API-Key",
|
|
17138
17245
|
type: "apiKey"
|
|
17139
17246
|
}],
|
|
17140
|
-
url: "/agent/v1/
|
|
17141
|
-
...options
|
|
17142
|
-
headers: {
|
|
17143
|
-
"Content-Type": "application/json",
|
|
17144
|
-
...options.headers
|
|
17145
|
-
}
|
|
17247
|
+
url: "/agent/v1/agents/{agent_id}/versions",
|
|
17248
|
+
...options
|
|
17146
17249
|
});
|
|
17147
|
-
var
|
|
17250
|
+
var sessionsList = (options) => (options?.client ?? client).get({
|
|
17148
17251
|
security: [{
|
|
17149
17252
|
key: "BearerAuth",
|
|
17150
17253
|
scheme: "bearer",
|
|
@@ -17154,10 +17257,10 @@ var sessionsRetrieve = (options) => (options.client ?? client).get({
|
|
|
17154
17257
|
name: "X-API-Key",
|
|
17155
17258
|
type: "apiKey"
|
|
17156
17259
|
}],
|
|
17157
|
-
url: "/agent/v1/sessions
|
|
17260
|
+
url: "/agent/v1/sessions",
|
|
17158
17261
|
...options
|
|
17159
17262
|
});
|
|
17160
|
-
var
|
|
17263
|
+
var sessionsCreate = (options) => (options.client ?? client).post({
|
|
17161
17264
|
security: [{
|
|
17162
17265
|
key: "BearerAuth",
|
|
17163
17266
|
scheme: "bearer",
|
|
@@ -17167,7 +17270,7 @@ var sessionsUpdate = (options) => (options.client ?? client).post({
|
|
|
17167
17270
|
name: "X-API-Key",
|
|
17168
17271
|
type: "apiKey"
|
|
17169
17272
|
}],
|
|
17170
|
-
url: "/agent/v1/sessions
|
|
17273
|
+
url: "/agent/v1/sessions",
|
|
17171
17274
|
...options,
|
|
17172
17275
|
headers: {
|
|
17173
17276
|
"Content-Type": "application/json",
|
|
@@ -17668,6 +17771,15 @@ var applicationCreateVersion = (options) => (options.client ?? client).post({
|
|
|
17668
17771
|
...options.headers
|
|
17669
17772
|
}
|
|
17670
17773
|
});
|
|
17774
|
+
var applicationGetVersionAssetManifest = (options) => (options.client ?? client).get({
|
|
17775
|
+
security: [{
|
|
17776
|
+
key: "application-bearerAuth",
|
|
17777
|
+
scheme: "bearer",
|
|
17778
|
+
type: "http"
|
|
17779
|
+
}],
|
|
17780
|
+
url: "/application/v1/workers/{worker_id}/versions/{version_id}/assets/manifest",
|
|
17781
|
+
...options
|
|
17782
|
+
});
|
|
17671
17783
|
var applicationGetVersion = (options) => (options.client ?? client).get({
|
|
17672
17784
|
security: [{
|
|
17673
17785
|
key: "application-bearerAuth",
|
|
@@ -20505,6 +20617,9 @@ function createAgent(transport) {
|
|
|
20505
20617
|
},
|
|
20506
20618
|
list: bind(transport, agentsList),
|
|
20507
20619
|
retrieve: bind(transport, agentsRetrieve),
|
|
20620
|
+
unarchive: {
|
|
20621
|
+
create: bind(transport, unarchiveAgent)
|
|
20622
|
+
},
|
|
20508
20623
|
update: bind(transport, agentsUpdate),
|
|
20509
20624
|
versions: {
|
|
20510
20625
|
list: bind(transport, agentsVersionsList)
|
|
@@ -20585,6 +20700,7 @@ function createAgent(transport) {
|
|
|
20585
20700
|
list: bind(transport, listSessionCompactions)
|
|
20586
20701
|
},
|
|
20587
20702
|
create: bind(transport, sessionsCreate),
|
|
20703
|
+
delete: bind(transport, sessionsDelete),
|
|
20588
20704
|
events: {
|
|
20589
20705
|
list: bind(transport, sessionsEventsList),
|
|
20590
20706
|
send: bind(transport, sessionsEventsSend),
|
|
@@ -20666,6 +20782,9 @@ function createApplication(transport) {
|
|
|
20666
20782
|
},
|
|
20667
20783
|
update: bind(transport, applicationUpdateWorker),
|
|
20668
20784
|
versions: {
|
|
20785
|
+
assets: {
|
|
20786
|
+
retrieveManifest: bind(transport, applicationGetVersionAssetManifest)
|
|
20787
|
+
},
|
|
20669
20788
|
create: bind(transport, applicationCreateVersion),
|
|
20670
20789
|
list: bindPage(transport, applicationListVersions),
|
|
20671
20790
|
retrieve: bind(transport, applicationGetVersion)
|
|
@@ -21616,6 +21735,10 @@ function base64(bytes) {
|
|
|
21616
21735
|
return btoa(chunks.join(""));
|
|
21617
21736
|
}
|
|
21618
21737
|
async function publish(client2, input) {
|
|
21738
|
+
const rolloutFields = ["gradual", "gradualRollout", "gradual_rollout", "canary", "rollout", "percentage", "percent", "traffic", "traffic_percentage", "strategy", "versions"];
|
|
21739
|
+
if (Object.keys(input).some((key) => rolloutFields.includes(key) || /percentage|percent|canary|gradual|rollout|灰度/i.test(key))) {
|
|
21740
|
+
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.' });
|
|
21741
|
+
}
|
|
21619
21742
|
const timeout = input.timeout_ms ?? 120000;
|
|
21620
21743
|
if (!Number.isFinite(timeout) || timeout < 0)
|
|
21621
21744
|
throw new RangeError("timeout_ms must be non-negative and finite");
|
|
@@ -21634,7 +21757,7 @@ async function publish(client2, input) {
|
|
|
21634
21757
|
const files = Object.entries(input.files);
|
|
21635
21758
|
if (files.length > 1e5)
|
|
21636
21759
|
throw new PraxisError({ code: "LIMIT_EXCEEDED", message: "At most 100000 asset paths can be published" });
|
|
21637
|
-
|
|
21760
|
+
let manifest = {};
|
|
21638
21761
|
const contents = new Map;
|
|
21639
21762
|
for (const [path2, content] of files) {
|
|
21640
21763
|
const normalized = path2.startsWith("/") ? path2 : `/${path2}`;
|
|
@@ -21643,8 +21766,8 @@ async function publish(client2, input) {
|
|
|
21643
21766
|
const bytes = typeof content === "string" ? new TextEncoder().encode(content) : new Uint8Array(content);
|
|
21644
21767
|
if (bytes.length > FILE_BYTES)
|
|
21645
21768
|
throw new PraxisError({ code: "LIMIT_EXCEEDED", message: `Asset ${normalized} exceeds 25 MiB` });
|
|
21646
|
-
const
|
|
21647
|
-
const hash = Array.from(
|
|
21769
|
+
const digest2 = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
|
|
21770
|
+
const hash = Array.from(digest2.subarray(0, 16), (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
21648
21771
|
manifest[normalized] = { hash, size: bytes.length };
|
|
21649
21772
|
contents.set(hash, bytes);
|
|
21650
21773
|
}
|
|
@@ -21657,9 +21780,60 @@ async function publish(client2, input) {
|
|
|
21657
21780
|
}
|
|
21658
21781
|
}
|
|
21659
21782
|
const created = !worker;
|
|
21783
|
+
if (!worker && input.dryRun)
|
|
21784
|
+
throw new PraxisError({ code: "NOT_FOUND", message: "请先创建应用 (create the application before dryRun)" });
|
|
21660
21785
|
worker ??= await workers.create({ body: { name: input.name, subdomain: { enabled: true } } });
|
|
21661
21786
|
const path = { worker_id: worker.id };
|
|
21787
|
+
let currentVersion;
|
|
21788
|
+
let currentDeployment;
|
|
21789
|
+
let previous = {};
|
|
21790
|
+
if (worker.praxis?.current_deployment_id) {
|
|
21791
|
+
currentDeployment = await workers.deployments.retrieve({ path: { ...path, deployment_id: worker.praxis.current_deployment_id } });
|
|
21792
|
+
const active = currentDeployment.versions[0];
|
|
21793
|
+
if (!active)
|
|
21794
|
+
throw new PraxisError({ code: "INVALID_RESPONSE", message: "Current deployment has no version" });
|
|
21795
|
+
currentVersion = await workers.versions.retrieve({ path: { ...path, version_id: active.version_id } });
|
|
21796
|
+
previous = (await workers.versions.assets.retrieveManifest({ path: { ...path, version_id: active.version_id } })).manifest;
|
|
21797
|
+
}
|
|
21798
|
+
manifest = {
|
|
21799
|
+
...Object.fromEntries(Object.entries(previous).filter(([key]) => input.keepExisting || Object.hasOwn(manifest, key))),
|
|
21800
|
+
...manifest
|
|
21801
|
+
};
|
|
21802
|
+
if (Object.keys(manifest).length > 1e5)
|
|
21803
|
+
throw new PraxisError({ code: "LIMIT_EXCEEDED", message: "At most 100000 asset paths can be published" });
|
|
21804
|
+
const added = Object.keys(manifest).filter((key) => !Object.hasOwn(previous, key));
|
|
21805
|
+
const changed = Object.keys(manifest).filter((key) => previous[key] && (previous[key].hash !== manifest[key].hash || previous[key].size !== manifest[key].size));
|
|
21806
|
+
const removed = Object.keys(previous).filter((key) => !Object.hasOwn(manifest, key));
|
|
21807
|
+
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(manifest))));
|
|
21808
|
+
const manifestHash = Array.from(digest, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
21809
|
+
const staticOnly = !["main", "bindings", "compatibility_date", "compatibility_flags", "assets_config"].some((key) => Object.hasOwn(input, key));
|
|
21810
|
+
const unchanged = staticOnly && !!currentVersion && manifestHash === currentVersion.praxis.assets_manifest?.manifest_hash;
|
|
21811
|
+
const hashes = new Set(Object.values(manifest).map((entry) => entry.hash));
|
|
21812
|
+
const currentResult = {
|
|
21813
|
+
url: worker.subdomain.url,
|
|
21814
|
+
worker_id: worker.id,
|
|
21815
|
+
version_id: currentVersion?.id ?? null,
|
|
21816
|
+
deployment_id: currentDeployment?.id ?? null,
|
|
21817
|
+
status: currentDeployment?.praxis.status ?? "draft",
|
|
21818
|
+
created,
|
|
21819
|
+
...currentVersion ? { version: currentVersion } : {},
|
|
21820
|
+
unchanged,
|
|
21821
|
+
uploaded: 0,
|
|
21822
|
+
reused: hashes.size
|
|
21823
|
+
};
|
|
21824
|
+
if (unchanged && !input.dryRun)
|
|
21825
|
+
return currentResult;
|
|
21662
21826
|
const session = await workers.assetsUploadSession.create({ path, body: { manifest } });
|
|
21827
|
+
if (input.dryRun) {
|
|
21828
|
+
const missing = new Set(session.buckets.flat());
|
|
21829
|
+
if ([...missing].some((hash) => !hashes.has(hash)))
|
|
21830
|
+
throw new PraxisError({ code: "INVALID_RESPONSE", message: "Upload session requested an unknown hash" });
|
|
21831
|
+
return {
|
|
21832
|
+
...currentResult,
|
|
21833
|
+
reused: hashes.size - missing.size,
|
|
21834
|
+
plan: { added, changed, removed, upload_hashes: missing.size, existing_hashes: hashes.size - missing.size }
|
|
21835
|
+
};
|
|
21836
|
+
}
|
|
21663
21837
|
let jwt = session.buckets.length ? null : session.jwt;
|
|
21664
21838
|
const uploaded = new Set;
|
|
21665
21839
|
for (const bucket of session.buckets) {
|
|
@@ -21730,7 +21904,7 @@ async function publish(client2, input) {
|
|
|
21730
21904
|
status: deployment.praxis.status,
|
|
21731
21905
|
created,
|
|
21732
21906
|
uploaded: uploaded.size,
|
|
21733
|
-
reused:
|
|
21907
|
+
reused: hashes.size - uploaded.size
|
|
21734
21908
|
};
|
|
21735
21909
|
}
|
|
21736
21910
|
|
|
@@ -23280,7 +23454,7 @@ function startProgress(ctx, write = (text) => writeOutput({ stderr: text })) {
|
|
|
23280
23454
|
}
|
|
23281
23455
|
|
|
23282
23456
|
// src/main.ts
|
|
23283
|
-
var version = "0.1.0-dev.
|
|
23457
|
+
var version = "0.1.0-dev.13103a0";
|
|
23284
23458
|
var commands = commandTree(operations);
|
|
23285
23459
|
var manual = [["login"], ["logout"], ["whoami"], ["org", "list"], ["org", "switch"], ["api"], ["skill"]];
|
|
23286
23460
|
function route(argv) {
|