openmates 0.15.0-alpha.35 → 0.15.0-alpha.36

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.
@@ -5355,6 +5355,59 @@ var OpenMatesClient = class _OpenMatesClient {
5355
5355
  if (options.teamId !== void 0) return options.teamId;
5356
5356
  return this.getActiveTeamId();
5357
5357
  }
5358
+ async startAccountExport(options = {}) {
5359
+ this.requireSession();
5360
+ const response = await this.http.post("/v1/account-exports", {
5361
+ domains: options.domains,
5362
+ filters: options.filters ?? {},
5363
+ format: options.format ?? "zip",
5364
+ include_advanced_metadata: options.includeAdvancedMetadata === true
5365
+ }, this.getCliRequestHeaders());
5366
+ if (!response.ok) throw new Error(`Account export start failed with HTTP ${response.status}`);
5367
+ return response.data;
5368
+ }
5369
+ async getAccountExport(exportId) {
5370
+ this.requireSession();
5371
+ const response = await this.http.get(`/v1/account-exports/${encodeURIComponent(exportId)}`, this.getCliRequestHeaders());
5372
+ if (!response.ok) throw new Error(`Account export status failed with HTTP ${response.status}`);
5373
+ return response.data;
5374
+ }
5375
+ async getAccountExportManifest(exportId) {
5376
+ this.requireSession();
5377
+ const response = await this.http.get(`/v1/account-exports/${encodeURIComponent(exportId)}/manifest`, this.getCliRequestHeaders());
5378
+ if (!response.ok) throw new Error(`Account export manifest failed with HTTP ${response.status}`);
5379
+ return response.data;
5380
+ }
5381
+ async listAccountExportChunks(exportId) {
5382
+ this.requireSession();
5383
+ const response = await this.http.get(`/v1/account-exports/${encodeURIComponent(exportId)}/chunks`, this.getCliRequestHeaders());
5384
+ if (!response.ok) throw new Error(`Account export chunk list failed with HTTP ${response.status}`);
5385
+ return response.data;
5386
+ }
5387
+ async getAccountExportChunk(exportId, chunkId) {
5388
+ this.requireSession();
5389
+ const response = await this.http.get(`/v1/account-exports/${encodeURIComponent(exportId)}/chunks/${encodeURIComponent(chunkId)}`, this.getCliRequestHeaders());
5390
+ if (!response.ok || !response.data.chunk) throw new Error(`Account export chunk download failed with HTTP ${response.status}`);
5391
+ return response.data.chunk;
5392
+ }
5393
+ async completeAccountExport(exportId) {
5394
+ this.requireSession();
5395
+ const response = await this.http.post(`/v1/account-exports/${encodeURIComponent(exportId)}/complete`, {}, this.getCliRequestHeaders());
5396
+ if (!response.ok) throw new Error(`Account export complete failed with HTTP ${response.status}`);
5397
+ return response.data;
5398
+ }
5399
+ async acceptPartialAccountExport(exportId) {
5400
+ this.requireSession();
5401
+ const response = await this.http.post(`/v1/account-exports/${encodeURIComponent(exportId)}/accept-partial`, {}, this.getCliRequestHeaders());
5402
+ if (!response.ok) throw new Error(`Account export accept partial failed with HTTP ${response.status}`);
5403
+ return response.data;
5404
+ }
5405
+ async cancelAccountExport(exportId) {
5406
+ this.requireSession();
5407
+ const response = await this.http.post(`/v1/account-exports/${encodeURIComponent(exportId)}/cancel`, {}, this.getCliRequestHeaders());
5408
+ if (!response.ok) throw new Error(`Account export cancel failed with HTTP ${response.status}`);
5409
+ return response.data;
5410
+ }
5358
5411
  appendTeamQuery(path, options = {}) {
5359
5412
  const teamId = this.resolveTeamContext(options);
5360
5413
  if (!teamId) return path;
@@ -15869,6 +15922,53 @@ var OpenMatesAccount = class {
15869
15922
  async clearInterests() {
15870
15923
  return this.setInterests([]);
15871
15924
  }
15925
+ async startExport(options = {}) {
15926
+ return this.client.request("/v1/account-exports", {
15927
+ domains: options.domains,
15928
+ filters: options.filters ?? {},
15929
+ format: options.format ?? "zip",
15930
+ include_advanced_metadata: options.includeAdvancedMetadata === true
15931
+ });
15932
+ }
15933
+ async getExport(exportId) {
15934
+ return this.client.get(`/v1/account-exports/${encodeURIComponent(exportId)}`);
15935
+ }
15936
+ async exportJobManifest(exportId) {
15937
+ return this.client.get(`/v1/account-exports/${encodeURIComponent(exportId)}/manifest`);
15938
+ }
15939
+ async exportChunks(exportId) {
15940
+ return this.client.get(`/v1/account-exports/${encodeURIComponent(exportId)}/chunks`);
15941
+ }
15942
+ async exportChunk(exportId, chunkId) {
15943
+ const result = await this.client.get(`/v1/account-exports/${encodeURIComponent(exportId)}/chunks/${encodeURIComponent(chunkId)}`);
15944
+ return result.chunk ?? {};
15945
+ }
15946
+ async *iterExportChunks(exportId) {
15947
+ const listed = await this.exportChunks(exportId);
15948
+ for (const chunk of listed.chunks) {
15949
+ const chunkId = String(chunk.chunk_id ?? "");
15950
+ yield chunkId ? await this.exportChunk(exportId, chunkId) : chunk;
15951
+ }
15952
+ }
15953
+ async completeExport(exportId) {
15954
+ return this.client.request(`/v1/account-exports/${encodeURIComponent(exportId)}/complete`, {});
15955
+ }
15956
+ async acceptPartialExport(exportId) {
15957
+ return this.client.request(`/v1/account-exports/${encodeURIComponent(exportId)}/accept-partial`, {});
15958
+ }
15959
+ async cancelExport(exportId) {
15960
+ return this.client.request(`/v1/account-exports/${encodeURIComponent(exportId)}/cancel`, {});
15961
+ }
15962
+ async downloadExport(options = {}) {
15963
+ const started = await this.startExport(options);
15964
+ const exportId = String(started.export.export_id ?? "");
15965
+ const [manifest, chunks] = await Promise.all([
15966
+ this.exportJobManifest(exportId),
15967
+ this.exportChunks(exportId)
15968
+ ]);
15969
+ const completed = await this.completeExport(exportId);
15970
+ return { export: completed.export, manifest: manifest.manifest, chunks: chunks.chunks };
15971
+ }
15872
15972
  async exportManifest() {
15873
15973
  return this.client.get("/v1/sdk/account/export/manifest");
15874
15974
  }
@@ -59592,6 +59692,10 @@ async function main() {
59592
59692
  printSettingsHelp(client);
59593
59693
  return;
59594
59694
  }
59695
+ if (command === "account") {
59696
+ printSettingsHelp(client, ["account"]);
59697
+ return;
59698
+ }
59595
59699
  if (command === "workflows") {
59596
59700
  printWorkflowsHelp();
59597
59701
  return;
@@ -59754,6 +59858,10 @@ async function main() {
59754
59858
  await handleSettings(client, subcommand, rest, parsed.flags);
59755
59859
  return;
59756
59860
  }
59861
+ if (command === "account") {
59862
+ await handleSettings(client, "account", [subcommand, ...rest].filter((part) => typeof part === "string"), parsed.flags);
59863
+ return;
59864
+ }
59757
59865
  if (command === "workflows") {
59758
59866
  await handleWorkflows(client, subcommand, rest, parsed.flags);
59759
59867
  return;
@@ -62746,8 +62854,12 @@ var SETTINGS_EXECUTABLE_COMMANDS = [
62746
62854
  { path: ["account", "interests", "list"], description: "Show encrypted account topic interests", examples: ["openmates settings account interests list --json"] },
62747
62855
  { path: ["account", "interests", "set"], description: "Set encrypted account topic interests", examples: ["openmates settings account interests set software_development run_code privacy"] },
62748
62856
  { path: ["account", "interests", "clear"], description: "Clear encrypted account topic interests", examples: ["openmates settings account interests clear --yes"] },
62749
- { path: ["account", "export", "manifest"], description: "Show account export manifest", examples: ["openmates settings account export manifest --json"] },
62750
- { path: ["account", "export", "data"], description: "Fetch account export data", examples: ["openmates settings account export data --json"] },
62857
+ { path: ["account", "export"], description: "Start a complete Account Export V1 job", examples: ["openmates account export --output ./openmates-export.json", "openmates settings account export --domains chats,usage --json"] },
62858
+ { path: ["account", "export", "start"], description: "Start a complete Account Export V1 job", examples: ["openmates settings account export start --output ./openmates-export.json"] },
62859
+ { path: ["account", "export", "status"], description: "Show account export job status", examples: ["openmates settings account export status <export-id> --json"] },
62860
+ { path: ["account", "export", "manifest"], description: "Show account export manifest", examples: ["openmates settings account export manifest <export-id> --json"] },
62861
+ { path: ["account", "export", "chunks"], description: "List account export chunks", examples: ["openmates settings account export chunks <export-id> --json"] },
62862
+ { path: ["account", "export", "data"], description: "Fetch account export chunks", examples: ["openmates settings account export data <export-id> --json"] },
62751
62863
  { path: ["account", "import-chat"], description: "Import a CLI chat export file", examples: ["openmates settings account import-chat ./chat.yml", "openmates settings account import-chat ./payload.json"] },
62752
62864
  { path: ["account", "username", "set"], description: "Change account username", examples: ["openmates settings account username set alice_123"] },
62753
62865
  { path: ["account", "profile-picture", "set"], description: "Upload a profile picture", examples: ["openmates settings account profile-picture set ./avatar.jpg"] },
@@ -62838,6 +62950,47 @@ async function printSettingsResult(resultPromise, flags) {
62838
62950
  printGenericObject(result);
62839
62951
  }
62840
62952
  }
62953
+ function parseCsvFlag(value) {
62954
+ if (typeof value !== "string") return void 0;
62955
+ const items = value.split(",").map((item) => item.trim()).filter(Boolean);
62956
+ return items.length > 0 ? items : void 0;
62957
+ }
62958
+ async function runAccountExport(client, flags) {
62959
+ const filters = typeof flags.filters === "string" ? parseJsonFlag(flags.filters, "--filters") : {};
62960
+ const started = await client.startAccountExport({
62961
+ domains: parseCsvFlag(flags.domains),
62962
+ filters,
62963
+ format: flags.format === "directory" ? "directory" : "zip",
62964
+ includeAdvancedMetadata: flags["include-advanced-metadata"] === true
62965
+ });
62966
+ const exportRecord = started.export;
62967
+ const exportId = String(exportRecord.export_id ?? "");
62968
+ const [manifest, chunks] = await Promise.all([
62969
+ client.getAccountExportManifest(exportId),
62970
+ client.listAccountExportChunks(exportId)
62971
+ ]);
62972
+ const completed = await client.completeAccountExport(exportId);
62973
+ return {
62974
+ export: completed.export,
62975
+ manifest: manifest.manifest,
62976
+ chunks: chunks.chunks
62977
+ };
62978
+ }
62979
+ function printAccountExportBundle(bundle, flags) {
62980
+ if (typeof flags.output === "string") {
62981
+ writeFileSync7(flags.output, `${JSON.stringify(bundle, null, 2)}
62982
+ `, "utf-8");
62983
+ }
62984
+ if (flags.json === true) {
62985
+ printJson2(typeof flags.output === "string" ? { ...bundle, output: flags.output } : bundle);
62986
+ return;
62987
+ }
62988
+ const exportRecord = bundle.export && typeof bundle.export === "object" ? bundle.export : {};
62989
+ process.stdout.write(`Account export ${String(exportRecord.export_id ?? "")} ${String(exportRecord.status ?? "unknown")}
62990
+ `);
62991
+ if (typeof flags.output === "string") process.stdout.write(`Wrote ${flags.output}
62992
+ `);
62993
+ }
62841
62994
  function printApiKeyList(result, flags) {
62842
62995
  if (flags.json === true) {
62843
62996
  printJson2(result);
@@ -63548,12 +63701,38 @@ async function handleSettings(client, subcommand, rest, flags) {
63548
63701
  printTopicPreferences(preferences, flags, "Interests cleared");
63549
63702
  return;
63550
63703
  }
63704
+ if (matches(tokens, ["account", "export"]) || matches(tokens, ["account", "export", "start"])) {
63705
+ printAccountExportBundle(await runAccountExport(client, flags), flags);
63706
+ return;
63707
+ }
63708
+ if (matches(tokens, ["account", "export", "status"])) {
63709
+ const exportId = rest[2];
63710
+ if (!exportId) throw new Error("Missing export ID. Example: openmates settings account export status <export-id>");
63711
+ await printSettingsResult(client.getAccountExport(exportId), flags);
63712
+ return;
63713
+ }
63551
63714
  if (matches(tokens, ["account", "export", "manifest"])) {
63552
- await printSettingsResult(client.settingsGet("export-account-manifest"), flags);
63715
+ const exportId = rest[2];
63716
+ if (!exportId) {
63717
+ await printSettingsResult(client.settingsGet("export-account-manifest"), flags);
63718
+ return;
63719
+ }
63720
+ await printSettingsResult(client.getAccountExportManifest(exportId), flags);
63721
+ return;
63722
+ }
63723
+ if (matches(tokens, ["account", "export", "chunks"])) {
63724
+ const exportId = rest[2];
63725
+ if (!exportId) throw new Error("Missing export ID. Example: openmates settings account export chunks <export-id>");
63726
+ await printSettingsResult(client.listAccountExportChunks(exportId), flags);
63553
63727
  return;
63554
63728
  }
63555
63729
  if (matches(tokens, ["account", "export", "data"])) {
63556
- await printSettingsResult(client.settingsGet("export-account-data"), flags);
63730
+ const exportId = rest[2];
63731
+ if (!exportId) {
63732
+ await printSettingsResult(client.settingsGet("export-account-data"), flags);
63733
+ return;
63734
+ }
63735
+ await printSettingsResult(client.listAccountExportChunks(exportId), flags);
63557
63736
  return;
63558
63737
  }
63559
63738
  if (matches(tokens, ["account", "import-chat"])) {
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getExtForLang,
4
4
  serializeToYaml
5
- } from "./chunk-CQDCPDZQ.js";
5
+ } from "./chunk-BEKDFMUN.js";
6
6
  import "./chunk-AXNRPVLE.js";
7
7
  export {
8
8
  getExtForLang,
package/dist/index.d.ts CHANGED
@@ -478,6 +478,21 @@ interface TeamContextOptions {
478
478
  teamId?: string | null;
479
479
  personal?: boolean;
480
480
  }
481
+ interface AccountExportStartOptions$1 {
482
+ domains?: string[];
483
+ filters?: Record<string, unknown>;
484
+ format?: "zip" | "directory";
485
+ includeAdvancedMetadata?: boolean;
486
+ }
487
+ interface AccountExportResponse$1 {
488
+ export: Record<string, unknown>;
489
+ }
490
+ interface AccountExportManifestResponse$1 {
491
+ manifest: Record<string, unknown>;
492
+ }
493
+ interface AccountExportChunksResponse$1 {
494
+ chunks: Array<Record<string, unknown>>;
495
+ }
481
496
  interface TeamCreateInput {
482
497
  name?: string;
483
498
  description?: string | null;
@@ -1249,6 +1264,14 @@ declare class OpenMatesClient {
1249
1264
  getActiveTeamId(): string | null;
1250
1265
  setActiveTeamId(teamId: string | null): void;
1251
1266
  resolveTeamContext(options?: TeamContextOptions): string | null;
1267
+ startAccountExport(options?: AccountExportStartOptions$1): Promise<AccountExportResponse$1>;
1268
+ getAccountExport(exportId: string): Promise<AccountExportResponse$1>;
1269
+ getAccountExportManifest(exportId: string): Promise<AccountExportManifestResponse$1>;
1270
+ listAccountExportChunks(exportId: string): Promise<AccountExportChunksResponse$1>;
1271
+ getAccountExportChunk(exportId: string, chunkId: string): Promise<Record<string, unknown>>;
1272
+ completeAccountExport(exportId: string): Promise<AccountExportResponse$1>;
1273
+ acceptPartialAccountExport(exportId: string): Promise<AccountExportResponse$1>;
1274
+ cancelAccountExport(exportId: string): Promise<AccountExportResponse$1>;
1252
1275
  private appendTeamQuery;
1253
1276
  listTeams(): Promise<TeamRecord[]>;
1254
1277
  createTeam(input: TeamCreateInput): Promise<TeamRecord>;
@@ -5136,6 +5159,21 @@ interface ConfirmedMutationOptions {
5136
5159
  interface RequestOptions {
5137
5160
  query?: Record<string, string | number | boolean | undefined | null>;
5138
5161
  }
5162
+ interface AccountExportStartOptions {
5163
+ domains?: string[];
5164
+ filters?: Record<string, unknown>;
5165
+ format?: "zip" | "directory";
5166
+ includeAdvancedMetadata?: boolean;
5167
+ }
5168
+ interface AccountExportResponse {
5169
+ export: Record<string, unknown>;
5170
+ }
5171
+ interface AccountExportManifestResponse {
5172
+ manifest: Record<string, unknown>;
5173
+ }
5174
+ interface AccountExportChunksResponse {
5175
+ chunks: Array<Record<string, unknown>>;
5176
+ }
5139
5177
  interface ApiKeyCreateOptions {
5140
5178
  name: string;
5141
5179
  fullAccess?: boolean;
@@ -5387,6 +5425,16 @@ declare class OpenMatesAccount {
5387
5425
  listInterests(): Promise<Record<string, unknown>>;
5388
5426
  setInterests(selectedTagIds: string[]): Promise<Record<string, unknown>>;
5389
5427
  clearInterests(): Promise<Record<string, unknown>>;
5428
+ startExport(options?: AccountExportStartOptions): Promise<AccountExportResponse>;
5429
+ getExport(exportId: string): Promise<AccountExportResponse>;
5430
+ exportJobManifest(exportId: string): Promise<AccountExportManifestResponse>;
5431
+ exportChunks(exportId: string): Promise<AccountExportChunksResponse>;
5432
+ exportChunk(exportId: string, chunkId: string): Promise<Record<string, unknown>>;
5433
+ iterExportChunks(exportId: string): AsyncGenerator<Record<string, unknown>>;
5434
+ completeExport(exportId: string): Promise<AccountExportResponse>;
5435
+ acceptPartialExport(exportId: string): Promise<AccountExportResponse>;
5436
+ cancelExport(exportId: string): Promise<AccountExportResponse>;
5437
+ downloadExport(options?: AccountExportStartOptions): Promise<Record<string, unknown>>;
5390
5438
  exportManifest(): Promise<Record<string, unknown>>;
5391
5439
  exportData(): Promise<Record<string, unknown>>;
5392
5440
  setUsername(username: string): Promise<Record<string, unknown>>;
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  reconcileAuthoritativeChats,
19
19
  renderSupportInfo,
20
20
  serializeToYaml
21
- } from "./chunk-CQDCPDZQ.js";
21
+ } from "./chunk-BEKDFMUN.js";
22
22
  import "./chunk-AXNRPVLE.js";
23
23
  export {
24
24
  APP_SKILL_METADATA,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.15.0-alpha.35",
3
+ "version": "0.15.0-alpha.36",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",