@tcb-sandbox/cli 0.4.0 → 0.4.1
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/dist/bundled-docs.js +5 -36
- package/dist/cli.js +16 -50
- package/dist/trw-embedded.js +1206 -1292
- package/dist/trw-version.json +1 -1
- package/package.json +2 -2
package/dist/bundled-docs.js
CHANGED
|
@@ -486,46 +486,15 @@ export const BUNDLED_API_DOCS = {
|
|
|
486
486
|
notes: ["Bundled fallback docs snapshot."],
|
|
487
487
|
},
|
|
488
488
|
{
|
|
489
|
-
name: "
|
|
490
|
-
description: "
|
|
491
|
-
endpoint: "POST /api/tools/
|
|
489
|
+
name: "workspace_persist",
|
|
490
|
+
description: "Immediately persist workspace to COS via rsync. Returns elapsed time in ms.",
|
|
491
|
+
endpoint: "POST /api/tools/workspace_persist",
|
|
492
492
|
input_schema: {
|
|
493
493
|
type: "object",
|
|
494
|
-
properties: {
|
|
495
|
-
exclude: { type: "array", items: { type: "string" } },
|
|
496
|
-
include_all: { type: "boolean" },
|
|
497
|
-
},
|
|
498
|
-
},
|
|
499
|
-
limits: { max_concurrent: 2 },
|
|
500
|
-
notes: ["Bundled fallback docs snapshot."],
|
|
501
|
-
},
|
|
502
|
-
{
|
|
503
|
-
name: "workspace_snapshot_status",
|
|
504
|
-
description: "Check snapshot task status by snapshot_id or list all session tasks.",
|
|
505
|
-
endpoint: "POST /api/tools/workspace_snapshot_status",
|
|
506
|
-
input_schema: {
|
|
507
|
-
type: "object",
|
|
508
|
-
properties: {
|
|
509
|
-
snapshot_id: { type: "string" },
|
|
510
|
-
},
|
|
494
|
+
properties: {},
|
|
511
495
|
},
|
|
512
496
|
limits: {},
|
|
513
|
-
notes: ["Bundled fallback docs
|
|
514
|
-
},
|
|
515
|
-
{
|
|
516
|
-
name: "workspace_restore",
|
|
517
|
-
description: 'Restore workspace from snapshot. mode="merge" overlays, mode="replace" cleans first.',
|
|
518
|
-
endpoint: "POST /api/tools/workspace_restore",
|
|
519
|
-
input_schema: {
|
|
520
|
-
type: "object",
|
|
521
|
-
required: ["snapshot_id"],
|
|
522
|
-
properties: {
|
|
523
|
-
snapshot_id: { type: "string" },
|
|
524
|
-
mode: { type: "string", enum: ["merge", "replace"] },
|
|
525
|
-
},
|
|
526
|
-
},
|
|
527
|
-
limits: {},
|
|
528
|
-
notes: ["Bundled fallback docs snapshot."],
|
|
497
|
+
notes: ["Bundled fallback docs."],
|
|
529
498
|
},
|
|
530
499
|
],
|
|
531
500
|
};
|
package/dist/cli.js
CHANGED
|
@@ -725,61 +725,27 @@ Error Handling
|
|
|
725
725
|
return printJson(result);
|
|
726
726
|
printPretty("Capability Invoke", result);
|
|
727
727
|
});
|
|
728
|
-
|
|
729
|
-
.command("
|
|
730
|
-
.description("
|
|
731
|
-
|
|
732
|
-
.command("create")
|
|
733
|
-
.description("Create async workspace snapshot and upload to S3")
|
|
734
|
-
.option("--exclude <patterns...>", "Additional exclude patterns")
|
|
735
|
-
.option("--include-all", "Skip default excludes (only sensitive files still excluded)")
|
|
736
|
-
.action(async function (options) {
|
|
737
|
-
const ctx = buildContext(this);
|
|
738
|
-
ensureSessionId(ctx);
|
|
739
|
-
const client = createSdkClientFromContext(ctx);
|
|
740
|
-
logMessage(ctx, "info", "POST /api/tools/workspace_snapshot");
|
|
741
|
-
const response = await client.other.workspaceSnapshot({
|
|
742
|
-
exclude: options.exclude,
|
|
743
|
-
include_all: options.includeAll,
|
|
744
|
-
});
|
|
745
|
-
const result = "data" in response ? response.data : response;
|
|
746
|
-
if (ctx.output === "json")
|
|
747
|
-
return printJson(result);
|
|
748
|
-
printPretty("Snapshot Create", result);
|
|
749
|
-
});
|
|
750
|
-
snapshot
|
|
751
|
-
.command("status [snapshotId]")
|
|
752
|
-
.description("Check snapshot status (single or all session tasks)")
|
|
753
|
-
.action(async function (snapshotId) {
|
|
754
|
-
const ctx = buildContext(this);
|
|
755
|
-
ensureSessionId(ctx);
|
|
756
|
-
const client = createSdkClientFromContext(ctx);
|
|
757
|
-
logMessage(ctx, "info", "POST /api/tools/workspace_snapshot_status");
|
|
758
|
-
const response = await client.other.workspaceSnapshotStatus({
|
|
759
|
-
snapshot_id: snapshotId,
|
|
760
|
-
});
|
|
761
|
-
const result = "data" in response ? response.data : response;
|
|
762
|
-
if (ctx.output === "json")
|
|
763
|
-
return printJson(result);
|
|
764
|
-
printPretty("Snapshot Status", result);
|
|
765
|
-
});
|
|
766
|
-
snapshot
|
|
767
|
-
.command("restore <snapshotId>")
|
|
768
|
-
.description("Restore workspace from snapshot (supports cross-session)")
|
|
769
|
-
.option("--mode <mode>", 'Restore mode: "merge" (default) or "replace"', "merge")
|
|
770
|
-
.action(async function (snapshotId, options) {
|
|
728
|
+
program
|
|
729
|
+
.command("persist")
|
|
730
|
+
.description("Persist workspace to COS storage immediately (rsync)")
|
|
731
|
+
.action(async function () {
|
|
771
732
|
const ctx = buildContext(this);
|
|
772
733
|
ensureSessionId(ctx);
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
const response = await
|
|
776
|
-
|
|
777
|
-
|
|
734
|
+
logMessage(ctx, "info", "POST /api/tools/workspace_persist");
|
|
735
|
+
const url = `${ctx.endpoint}/api/tools/workspace_persist`;
|
|
736
|
+
const response = await fetch(url, {
|
|
737
|
+
method: "POST",
|
|
738
|
+
headers: {
|
|
739
|
+
"Content-Type": "application/json",
|
|
740
|
+
...ctx.headers,
|
|
741
|
+
},
|
|
742
|
+
body: JSON.stringify({}),
|
|
743
|
+
signal: AbortSignal.timeout(ctx.timeout),
|
|
778
744
|
});
|
|
779
|
-
const result =
|
|
745
|
+
const result = await response.json();
|
|
780
746
|
if (ctx.output === "json")
|
|
781
747
|
return printJson(result);
|
|
782
|
-
printPretty("
|
|
748
|
+
printPretty("Persist", result);
|
|
783
749
|
});
|
|
784
750
|
const secrets = program.command("secrets").description("Secrets helpers (session-scoped)");
|
|
785
751
|
secrets
|