@wayai/cli 0.3.84 → 0.3.85

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/index.js CHANGED
@@ -756,6 +756,35 @@ var init_api_client = __esm({
756
756
  `/api/admin/data-explorer/debug/archive/${encodeURIComponent(hubId)}/conversations/${encodeURIComponent(conversationId)}${qs}`
757
757
  );
758
758
  }
759
+ /**
760
+ * Download the harness sandbox FILESYSTEM archive (harness-agents PR 2.12) as
761
+ * raw zip bytes. Distinct from the JSON `request<T>` path — the response is a
762
+ * binary `application/zip`, so this reads `arrayBuffer()`. Single-refresh-on-401
763
+ * like `request`, but no transient-retry loop (a large binary GET is idempotent
764
+ * but not worth re-streaming on a cold-start body probe). 404 ⇒ ApiError (no
765
+ * sandbox for this conversation, or the blob was purged).
766
+ */
767
+ async downloadArchiveSandboxFs(hubId, conversationId) {
768
+ const path25 = `/api/archive/${encodeURIComponent(hubId)}/conversations/${encodeURIComponent(conversationId)}/sandbox`;
769
+ addApiBreadcrumb("GET", path25);
770
+ const url = `${this.apiUrl}${path25}`;
771
+ let response = await this.send(url, "GET");
772
+ if (response.status === 401 && this.onUnauthorized) {
773
+ let refreshed;
774
+ try {
775
+ refreshed = await this.onUnauthorized();
776
+ } catch {
777
+ }
778
+ if (refreshed) {
779
+ this.accessToken = refreshed;
780
+ response = await this.send(url, "GET");
781
+ }
782
+ }
783
+ if (!response.ok) {
784
+ throw new ApiError("GET", path25, response.status, await response.text());
785
+ }
786
+ return new Uint8Array(await response.arrayBuffer());
787
+ }
759
788
  /** List per-message observability metadata summaries for a conversation (hub-scoped auth). */
760
789
  async listConversationObservability(conversationId) {
761
790
  return this.request(
@@ -5880,7 +5909,11 @@ var init_dist = __esm({
5880
5909
  // so `language`/`access_approval_role` can't reach the DB with an invalid value.
5881
5910
  language: external_exports.enum(["en", "pt", "es"]).optional(),
5882
5911
  access_request_message: external_exports.string().max(1e3).nullable().optional(),
5883
- access_approval_role: external_exports.enum(["admin", "team"]).optional()
5912
+ access_approval_role: external_exports.enum(["admin", "team"]).optional(),
5913
+ // Native-completion fallback connection for a degraded harness turn (PR 2.10b).
5914
+ // A NATIVE LLM connection id on this hub; validated at fallback time in the turn
5915
+ // seam (a stale/missing id simply no-ops the fallback). Nullable to clear it.
5916
+ fallback_connection_id: uuidSchema.nullable().optional()
5884
5917
  }).passthrough().superRefine(refineLaneReferences);
5885
5918
  addHubAdminBody = external_exports.object({
5886
5919
  user_email: external_exports.string().email("valid email is required")
@@ -12488,7 +12521,11 @@ var init_contracts = __esm({
12488
12521
  // so `language`/`access_approval_role` can't reach the DB with an invalid value.
12489
12522
  language: external_exports.enum(["en", "pt", "es"]).optional(),
12490
12523
  access_request_message: external_exports.string().max(1e3).nullable().optional(),
12491
- access_approval_role: external_exports.enum(["admin", "team"]).optional()
12524
+ access_approval_role: external_exports.enum(["admin", "team"]).optional(),
12525
+ // Native-completion fallback connection for a degraded harness turn (PR 2.10b).
12526
+ // A NATIVE LLM connection id on this hub; validated at fallback time in the turn
12527
+ // seam (a stale/missing id simply no-ops the fallback). Nullable to clear it.
12528
+ fallback_connection_id: uuidSchema2.nullable().optional()
12492
12529
  }).passthrough().superRefine(refineLaneReferences2);
12493
12530
  addHubAdminBody2 = external_exports.object({
12494
12531
  user_email: external_exports.string().email("valid email is required")
@@ -18711,14 +18748,31 @@ async function runAnalyticsRead(positional, flagArgs) {
18711
18748
  }
18712
18749
  async function runArchiveRead(positional, flagArgs) {
18713
18750
  if (positional.length < 2) {
18714
- console.error("wayai admin archive <hub_id> <conversation_id> [--message-id X] [--json]");
18751
+ console.error("wayai admin archive <hub_id> <conversation_id> [--message-id X] [--sandbox [--out <path>]] [--json]");
18715
18752
  process.exit(1);
18716
18753
  }
18717
18754
  const hubId = positional[0];
18718
18755
  const conversationId = positional[1];
18719
- const flags = parseFlags2(flagArgs, ["--json", "--message-id"]);
18756
+ const flags = parseFlags2(flagArgs, ["--json", "--message-id", "--sandbox", "--out"]);
18720
18757
  const { config, accessToken } = await requireAuth();
18721
18758
  const client = new ApiClient({ apiUrl: config.api_url, accessToken });
18759
+ if (flags.sandbox) {
18760
+ const outPath = flags.out || `${conversationId}-sandbox.zip`;
18761
+ let zip;
18762
+ try {
18763
+ zip = await client.downloadArchiveSandboxFs(hubId, conversationId);
18764
+ } catch (err) {
18765
+ if (err instanceof ApiError && err.status === 404) {
18766
+ console.error("Sandbox archive not found. This conversation had no harness sandbox, or the R2 blob was purged.");
18767
+ process.exit(1);
18768
+ }
18769
+ exitOnApiError(err);
18770
+ throw err;
18771
+ }
18772
+ fs18.writeFileSync(outPath, zip);
18773
+ console.log(`Wrote ${zip.byteLength} bytes to ${outPath}`);
18774
+ return;
18775
+ }
18722
18776
  let response;
18723
18777
  try {
18724
18778
  response = await client.debugReadArchive(hubId, conversationId, {
@@ -18807,12 +18861,18 @@ function parseFlags2(flagArgs, allowed) {
18807
18861
  out.jsonOutput = true;
18808
18862
  continue;
18809
18863
  }
18864
+ if (arg === "--sandbox") {
18865
+ out.sandbox = true;
18866
+ continue;
18867
+ }
18810
18868
  const v = flagArgs[++i];
18811
18869
  if (!v) {
18812
18870
  console.error(`${arg} requires a value`);
18813
18871
  process.exit(1);
18814
18872
  }
18815
- if (arg === "--limit") {
18873
+ if (arg === "--out") {
18874
+ out.out = v;
18875
+ } else if (arg === "--limit") {
18816
18876
  const n = Number.parseInt(v, 10);
18817
18877
  if (!Number.isFinite(n)) {
18818
18878
  console.error("--limit must be an integer");
@@ -19813,7 +19873,7 @@ Usage:
19813
19873
  wayai admin analytics tables
19814
19874
  wayai admin analytics read <table> [--conversation-id X] [--hub-id Y] [--message-id Z] [--limit N] [--json]
19815
19875
 
19816
- wayai admin archive <hub_id> <conversation_id> [--message-id X] [--json]
19876
+ wayai admin archive <hub_id> <conversation_id> [--message-id X] [--sandbox [--out <path>]] [--json]
19817
19877
 
19818
19878
  wayai admin observability <hub_id> <conversation_id> [--message-id X] [--json]
19819
19879
 
@@ -19907,6 +19967,7 @@ Examples:
19907
19967
  wayai admin analytics read conversation --conversation-id <conv-id>
19908
19968
  wayai admin archive <hub-id> <conv-id>
19909
19969
  wayai admin archive <hub-id> <conv-id> --message-id <msg-id> --json
19970
+ wayai admin archive <hub-id> <conv-id> --sandbox --out session.zip
19910
19971
  wayai admin observability <hub-id> <conv-id>
19911
19972
  wayai admin observability <hub-id> <conv-id> --message-id <msg-id> --json
19912
19973
  wayai admin sandbox exec "echo hi" --hub <hub-id> --connection <conn-id>