@diafunc/cli 0.31.1 → 0.32.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.
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  package_default
3
- } from "./chunk-L4XSFORF.js";
3
+ } from "./chunk-QALKS4CY.js";
4
4
 
5
5
  // src/index.ts
6
- import chalk41 from "chalk";
6
+ import chalk42 from "chalk";
7
7
 
8
8
  // src/commands/auth/login.ts
9
9
  import chalk4 from "chalk";
@@ -245,8 +245,15 @@ function profileSidecarFile(profileName, suffix) {
245
245
  const digest = crypto2.createHash("sha256").update(profileName).digest("hex").slice(0, 8);
246
246
  return `${CONFIG_FILE}.${safe}-${digest}.${suffix}`;
247
247
  }
248
+ var selectedProfile;
249
+ function selectProfile(name) {
250
+ selectedProfile = name;
251
+ }
252
+ function getActiveProfileName(config) {
253
+ return selectedProfile ?? config.currentProfile;
254
+ }
248
255
  function resolveEndpoint(config, profileOverride) {
249
- const name = profileOverride ?? config.currentProfile;
256
+ const name = profileOverride ?? getActiveProfileName(config);
250
257
  const profile = config.profiles[name];
251
258
  if (!profile) {
252
259
  throw new Error(`Profile "${name}" not found.`);
@@ -566,7 +573,7 @@ function getAuthHeader(auth) {
566
573
  return void 0;
567
574
  }
568
575
  async function ensureValidAuth(config, profileOverride) {
569
- const profileName = profileOverride ?? config.currentProfile;
576
+ const profileName = profileOverride ?? getActiveProfileName(config);
570
577
  const profile = config.profiles[profileName];
571
578
  if (!profile?.auth) return void 0;
572
579
  if (profile.auth.type === "device-code" && isTokenExpired(profile.auth)) {
@@ -1439,9 +1446,9 @@ function registerLoginCommand(parent) {
1439
1446
  parent.command("login").description("Authenticate with the Diafunc platform").option("--token <token>", "API token (dfat_...) for non-interactive token-based auth").option("--endpoint <url>", "Override the endpoint URL for this login").action(async (options) => {
1440
1447
  try {
1441
1448
  const config = loadConfig();
1442
- const profile = config.profiles[config.currentProfile];
1449
+ const profile = config.profiles[getActiveProfileName(config)];
1443
1450
  if (!profile) {
1444
- failure(`Profile "${config.currentProfile}" not found. Run 'diafunc config profile add' first.`);
1451
+ failure(`Profile "${getActiveProfileName(config)}" not found. Run 'diafunc config profile add' first.`);
1445
1452
  process.exit(1);
1446
1453
  }
1447
1454
  if (options.endpoint) {
@@ -1449,14 +1456,14 @@ function registerLoginCommand(parent) {
1449
1456
  }
1450
1457
  if (options.token) {
1451
1458
  profile.auth = { type: "api-token", token: options.token };
1452
- await storeSignIn(config.currentProfile, profile);
1459
+ await storeSignIn(getActiveProfileName(config), profile);
1453
1460
  const client = createHttpClient();
1454
1461
  const admin = createAdminService(client);
1455
1462
  const user = await admin.getMyUser();
1456
1463
  success("Signed in.");
1457
1464
  console.log(` User: ${chalk4.bold(user.name)}`);
1458
1465
  console.log(` Email: ${user.email}`);
1459
- console.log(` Profile: ${config.currentProfile}`);
1466
+ console.log(` Profile: ${getActiveProfileName(config)}`);
1460
1467
  console.log(` Endpoint: ${profile.endpoint}`);
1461
1468
  return;
1462
1469
  }
@@ -1515,14 +1522,14 @@ async function deviceCodeLogin(config, profile) {
1515
1522
  refreshToken: tokens.refresh_token,
1516
1523
  accessTokenExpiry: Date.now() + (tokens.expires_in || ACCESS_TOKEN_LIFETIME_SECONDS) * 1e3
1517
1524
  };
1518
- await storeSignIn(config.currentProfile, profile);
1525
+ await storeSignIn(getActiveProfileName(config), profile);
1519
1526
  const client = createHttpClient();
1520
1527
  const admin = createAdminService(client);
1521
1528
  const user = await admin.getMyUser();
1522
1529
  success("Signed in.");
1523
1530
  console.log(` User: ${chalk4.bold(user.name)}`);
1524
1531
  console.log(` Email: ${user.email}`);
1525
- console.log(` Profile: ${config.currentProfile}`);
1532
+ console.log(` Profile: ${getActiveProfileName(config)}`);
1526
1533
  console.log(` Endpoint: ${profile.endpoint}`);
1527
1534
  return;
1528
1535
  }
@@ -1562,9 +1569,9 @@ function deriveAuthUrl3(endpoint) {
1562
1569
  function registerLogoutCommand(parent) {
1563
1570
  parent.command("logout").description("Remove stored credentials for the active profile and revoke refresh token if possible").action(async () => {
1564
1571
  const config = loadConfig();
1565
- const profile = config.profiles[config.currentProfile];
1572
+ const profile = config.profiles[getActiveProfileName(config)];
1566
1573
  if (!profile) {
1567
- failure(`Profile "${config.currentProfile}" not found.`);
1574
+ failure(`Profile "${getActiveProfileName(config)}" not found.`);
1568
1575
  process.exit(1);
1569
1576
  }
1570
1577
  if (!profile.auth) {
@@ -1586,10 +1593,10 @@ function registerLogoutCommand(parent) {
1586
1593
  } catch {
1587
1594
  }
1588
1595
  }
1589
- await updateStoredProfile(config.currentProfile, (stored) => {
1596
+ await updateStoredProfile(getActiveProfileName(config), (stored) => {
1590
1597
  delete stored.auth;
1591
1598
  });
1592
- success(`Logged out from profile "${config.currentProfile}".`);
1599
+ success(`Logged out from profile "${getActiveProfileName(config)}".`);
1593
1600
  });
1594
1601
  }
1595
1602
 
@@ -1621,8 +1628,8 @@ var ACRONYMS = /* @__PURE__ */ new Map([
1621
1628
  ["mcp", "MCP"]
1622
1629
  ]);
1623
1630
  function recordLabel(key) {
1624
- const words = humanizeKey(key).split(" ").filter((w) => w.length > 0).map((w) => ACRONYMS.get(w) ?? w);
1625
- const sentence = words.join(" ");
1631
+ const words2 = humanizeKey(key).split(" ").filter((w) => w.length > 0).map((w) => ACRONYMS.get(w) ?? w);
1632
+ const sentence = words2.join(" ");
1626
1633
  return sentence.charAt(0).toUpperCase() + sentence.slice(1);
1627
1634
  }
1628
1635
  function headerOf(spec) {
@@ -2014,13 +2021,13 @@ function registerStatusCommand(parent) {
2014
2021
  const config = loadConfig();
2015
2022
  const globalOpts = cmd.optsWithGlobals();
2016
2023
  const outputFormat = globalOpts.output ?? config.defaults.output ?? "human";
2017
- const profile = config.profiles[config.currentProfile];
2024
+ const profile = config.profiles[getActiveProfileName(config)];
2018
2025
  if (!profile?.auth) {
2019
2026
  if (outputFormat === "json") {
2020
- console.log(JSON.stringify({ authenticated: false, profile: config.currentProfile }));
2027
+ console.log(JSON.stringify({ authenticated: false, profile: getActiveProfileName(config) }));
2021
2028
  } else {
2022
2029
  console.log(chalk7.yellow("Not authenticated."), `Run 'diafunc auth login' to configure credentials.`);
2023
- console.log(` Profile: ${config.currentProfile}`);
2030
+ console.log(` Profile: ${getActiveProfileName(config)}`);
2024
2031
  console.log(` Endpoint: ${profile?.endpoint ?? "not configured"}`);
2025
2032
  }
2026
2033
  return;
@@ -2030,7 +2037,7 @@ function registerStatusCommand(parent) {
2030
2037
  const user = await admin.getMyUser();
2031
2038
  const data = {
2032
2039
  authenticated: true,
2033
- profile: config.currentProfile,
2040
+ profile: getActiveProfileName(config),
2034
2041
  endpoint: profile.endpoint,
2035
2042
  authType: profile.auth.type,
2036
2043
  userId: user.id,
@@ -2088,12 +2095,12 @@ function createAnalysisService(client) {
2088
2095
  path: "/last"
2089
2096
  });
2090
2097
  },
2091
- async getRecent(count = 20) {
2098
+ async getRecent(count2 = 20) {
2092
2099
  return client.request({
2093
2100
  method: "GET",
2094
2101
  service: SERVICE2,
2095
2102
  path: "/recent",
2096
- query: { count }
2103
+ query: { count: count2 }
2097
2104
  });
2098
2105
  },
2099
2106
  async get(analysisId) {
@@ -2439,12 +2446,12 @@ function createAnalysisService(client) {
2439
2446
  path: `/${encodeURIComponent(analysisId)}/runs`
2440
2447
  });
2441
2448
  },
2442
- async getRunsForAnalysis(analysisId, count = 20) {
2449
+ async getRunsForAnalysis(analysisId, count2 = 20) {
2443
2450
  return client.request({
2444
2451
  method: "GET",
2445
2452
  service: SERVICE2,
2446
2453
  path: `/${encodeURIComponent(analysisId)}/runs`,
2447
- query: { count }
2454
+ query: { count: count2 }
2448
2455
  });
2449
2456
  },
2450
2457
  async getRun(runId) {
@@ -2532,13 +2539,85 @@ function createAnalysisService(client) {
2532
2539
  };
2533
2540
  }
2534
2541
 
2535
- // src/client/services/storage.ts
2536
- var SERVICE3 = "storage";
2542
+ // src/client/services/deployments.ts
2543
+ var SERVICE3 = "deployments";
2537
2544
  function enc(s) {
2538
2545
  return encodeURIComponent(s);
2539
2546
  }
2547
+ function createDeploymentsService(client) {
2548
+ return {
2549
+ async list() {
2550
+ return client.request({ method: "GET", service: SERVICE3, path: "/" });
2551
+ },
2552
+ async get(deploymentId) {
2553
+ return client.request({ method: "GET", service: SERVICE3, path: `/${enc(deploymentId)}` });
2554
+ },
2555
+ async create(request) {
2556
+ return client.request({ method: "POST", service: SERVICE3, path: "/", body: request });
2557
+ },
2558
+ async delete(deploymentId) {
2559
+ return client.request({ method: "DELETE", service: SERVICE3, path: `/${enc(deploymentId)}` });
2560
+ },
2561
+ async update(deploymentId, request) {
2562
+ return client.request({
2563
+ method: "PATCH",
2564
+ service: SERVICE3,
2565
+ path: `/${enc(deploymentId)}`,
2566
+ body: request
2567
+ });
2568
+ },
2569
+ async predict(deploymentId, request) {
2570
+ return client.request({
2571
+ method: "POST",
2572
+ service: SERVICE3,
2573
+ path: `/${enc(deploymentId)}/predict`,
2574
+ body: request
2575
+ });
2576
+ },
2577
+ async predictBatch(deploymentId, request) {
2578
+ return client.request({
2579
+ method: "POST",
2580
+ service: SERVICE3,
2581
+ path: `/${enc(deploymentId)}/predict/batch`,
2582
+ body: request
2583
+ });
2584
+ },
2585
+ async recordOutcomes(deploymentId, request) {
2586
+ return client.request({
2587
+ method: "POST",
2588
+ service: SERVICE3,
2589
+ path: `/${enc(deploymentId)}/outcomes`,
2590
+ body: request
2591
+ });
2592
+ },
2593
+ async deletePrediction(deploymentId, predictionId) {
2594
+ return client.request({
2595
+ method: "DELETE",
2596
+ service: SERVICE3,
2597
+ path: `/${enc(deploymentId)}/predictions/${enc(predictionId)}`
2598
+ });
2599
+ },
2600
+ async monitoring(deploymentId, window) {
2601
+ return client.request({
2602
+ method: "GET",
2603
+ service: SERVICE3,
2604
+ path: `/${enc(deploymentId)}/monitoring`,
2605
+ query: { window }
2606
+ });
2607
+ },
2608
+ async serveNewestModel(deploymentId) {
2609
+ return client.request({ method: "POST", service: SERVICE3, path: `/${enc(deploymentId)}/model` });
2610
+ }
2611
+ };
2612
+ }
2613
+
2614
+ // src/client/services/storage.ts
2615
+ var SERVICE4 = "storage";
2616
+ function enc2(s) {
2617
+ return encodeURIComponent(s);
2618
+ }
2540
2619
  function entityPath(ref) {
2541
- return `/${enc(ref.projectId)}/${enc(ref.projectBranch)}/${enc(ref.entityId)}/${enc(ref.entityBranch)}`;
2620
+ return `/${enc2(ref.projectId)}/${enc2(ref.projectBranch)}/${enc2(ref.entityId)}/${enc2(ref.entityBranch)}`;
2542
2621
  }
2543
2622
  function exportTableQuery(options) {
2544
2623
  const query = {};
@@ -2560,14 +2639,14 @@ function createStorageService(client) {
2560
2639
  async entityExists(ref) {
2561
2640
  return client.request({
2562
2641
  method: "GET",
2563
- service: SERVICE3,
2642
+ service: SERVICE4,
2564
2643
  path: `/entities/exists${entityPath(ref)}`
2565
2644
  });
2566
2645
  },
2567
2646
  async getEntity(ref, content = false) {
2568
2647
  return client.request({
2569
2648
  method: "GET",
2570
- service: SERVICE3,
2649
+ service: SERVICE4,
2571
2650
  path: `/entities/actual${entityPath(ref)}`,
2572
2651
  query: content ? { content: true } : void 0
2573
2652
  });
@@ -2575,14 +2654,14 @@ function createStorageService(client) {
2575
2654
  async getEntityContent(ref) {
2576
2655
  return client.requestRaw({
2577
2656
  method: "GET",
2578
- service: SERVICE3,
2657
+ service: SERVICE4,
2579
2658
  path: `/entities/contents/actual${entityPath(ref)}`
2580
2659
  });
2581
2660
  },
2582
2661
  async saveEntities(entities) {
2583
2662
  return client.request({
2584
2663
  method: "PUT",
2585
- service: SERVICE3,
2664
+ service: SERVICE4,
2586
2665
  path: "/entities/actual",
2587
2666
  body: entities
2588
2667
  });
@@ -2590,14 +2669,14 @@ function createStorageService(client) {
2590
2669
  async deleteEntity(ref) {
2591
2670
  return client.request({
2592
2671
  method: "DELETE",
2593
- service: SERVICE3,
2672
+ service: SERVICE4,
2594
2673
  path: `/entities/actual${entityPath(ref)}`
2595
2674
  });
2596
2675
  },
2597
2676
  async saveEntityContentBase64(ref, base64Content) {
2598
2677
  return client.request({
2599
2678
  method: "PUT",
2600
- service: SERVICE3,
2679
+ service: SERVICE4,
2601
2680
  path: `/entities/contents/actual${entityPath(ref)}`,
2602
2681
  rawBody: base64Content,
2603
2682
  contentType: "text/plain"
@@ -2606,7 +2685,7 @@ function createStorageService(client) {
2606
2685
  async uploadEntityContent(ref, formData) {
2607
2686
  return client.request({
2608
2687
  method: "PUT",
2609
- service: SERVICE3,
2688
+ service: SERVICE4,
2610
2689
  path: `/entities/contents/actual${entityPath(ref)}`,
2611
2690
  rawBody: formData
2612
2691
  });
@@ -2614,35 +2693,35 @@ function createStorageService(client) {
2614
2693
  async deleteEntityContent(ref) {
2615
2694
  return client.request({
2616
2695
  method: "DELETE",
2617
- service: SERVICE3,
2696
+ service: SERVICE4,
2618
2697
  path: `/entities/contents/actual${entityPath(ref)}`
2619
2698
  });
2620
2699
  },
2621
2700
  async getEntityHistory(ref, version) {
2622
2701
  return client.request({
2623
2702
  method: "GET",
2624
- service: SERVICE3,
2703
+ service: SERVICE4,
2625
2704
  path: `/entities/history${entityPath(ref)}/${version}`
2626
2705
  });
2627
2706
  },
2628
2707
  async getEntityHistoryRange(ref, fromVersion, toVersion) {
2629
2708
  return client.request({
2630
2709
  method: "GET",
2631
- service: SERVICE3,
2710
+ service: SERVICE4,
2632
2711
  path: `/entities/history${entityPath(ref)}/${fromVersion}/${toVersion}`
2633
2712
  });
2634
2713
  },
2635
2714
  async renameEntity(ref, newEntityId) {
2636
2715
  return client.request({
2637
2716
  method: "PUT",
2638
- service: SERVICE3,
2639
- path: `/entities/ids${entityPath(ref)}/${enc(newEntityId)}`
2717
+ service: SERVICE4,
2718
+ path: `/entities/ids${entityPath(ref)}/${enc2(newEntityId)}`
2640
2719
  });
2641
2720
  },
2642
2721
  async revertEntity(ref, version) {
2643
2722
  return client.request({
2644
2723
  method: "PUT",
2645
- service: SERVICE3,
2724
+ service: SERVICE4,
2646
2725
  path: `/entities/revert${entityPath(ref)}/${version}`
2647
2726
  });
2648
2727
  },
@@ -2668,7 +2747,7 @@ function createStorageService(client) {
2668
2747
  };
2669
2748
  return client.request({
2670
2749
  method: "POST",
2671
- service: SERVICE3,
2750
+ service: SERVICE4,
2672
2751
  path: "/transactions/",
2673
2752
  body: transaction
2674
2753
  });
@@ -2677,25 +2756,25 @@ function createStorageService(client) {
2677
2756
  async searchEntityIds(projectId, projectBranch, body) {
2678
2757
  return client.request({
2679
2758
  method: "POST",
2680
- service: SERVICE3,
2759
+ service: SERVICE4,
2681
2760
  path: "/entity-ids/search",
2682
2761
  body
2683
2762
  });
2684
2763
  },
2685
2764
  // --- Linked Entities ---
2686
2765
  async getLinkedEntities(direction, ref, linkId) {
2687
- const byLink = linkId ? `/${enc(linkId)}` : "";
2766
+ const byLink = linkId ? `/${enc2(linkId)}` : "";
2688
2767
  return client.request({
2689
2768
  method: "GET",
2690
- service: SERVICE3,
2691
- path: `/linked-entities/${enc(direction)}${entityPath(ref)}${byLink}`
2769
+ service: SERVICE4,
2770
+ path: `/linked-entities/${enc2(direction)}${entityPath(ref)}${byLink}`
2692
2771
  });
2693
2772
  },
2694
2773
  async saveLinkedEntities(ref, linkId, entities) {
2695
2774
  return client.request({
2696
2775
  method: "PUT",
2697
- service: SERVICE3,
2698
- path: `/linked-entities/${enc(ref.projectId)}/${enc(ref.projectBranch)}/${enc(ref.entityId)}/${enc(ref.entityBranch)}/${enc(linkId)}`,
2776
+ service: SERVICE4,
2777
+ path: `/linked-entities/${enc2(ref.projectId)}/${enc2(ref.projectBranch)}/${enc2(ref.entityId)}/${enc2(ref.entityBranch)}/${enc2(linkId)}`,
2699
2778
  body: entities
2700
2779
  });
2701
2780
  },
@@ -2703,33 +2782,33 @@ function createStorageService(client) {
2703
2782
  async getLinks(direction, ref) {
2704
2783
  return client.request({
2705
2784
  method: "GET",
2706
- service: SERVICE3,
2707
- path: `/links/actual/${enc(direction)}${entityPath(ref)}`
2785
+ service: SERVICE4,
2786
+ path: `/links/actual/${enc2(direction)}${entityPath(ref)}`
2708
2787
  });
2709
2788
  },
2710
2789
  async getLinkIds(direction, ref) {
2711
2790
  return client.request({
2712
2791
  method: "GET",
2713
- service: SERVICE3,
2714
- path: `/links/ids/actual/${enc(direction)}${entityPath(ref)}`
2792
+ service: SERVICE4,
2793
+ path: `/links/ids/actual/${enc2(direction)}${entityPath(ref)}`
2715
2794
  });
2716
2795
  },
2717
2796
  async createLink(projectId, projectBranch, sourceEntityId, sourceEntityBranch, linkId, targetEntityId, targetEntityBranch, link) {
2718
2797
  return client.request({
2719
2798
  method: "POST",
2720
- service: SERVICE3,
2721
- path: `/links/actual/${enc(projectId)}/${enc(projectBranch)}/${enc(sourceEntityId)}/${enc(sourceEntityBranch)}/${enc(linkId)}/${enc(targetEntityId)}/${enc(targetEntityBranch)}`,
2799
+ service: SERVICE4,
2800
+ path: `/links/actual/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(sourceEntityId)}/${enc2(sourceEntityBranch)}/${enc2(linkId)}/${enc2(targetEntityId)}/${enc2(targetEntityBranch)}`,
2722
2801
  body: link
2723
2802
  });
2724
2803
  },
2725
2804
  async deleteLink(projectId, projectBranch, sourceEntityId, sourceEntityBranch, linkId, targetEntityId, targetEntityBranch) {
2726
- let path13 = `/links/actual/${enc(projectId)}/${enc(projectBranch)}/${enc(sourceEntityId)}/${enc(sourceEntityBranch)}/${enc(linkId)}`;
2805
+ let path13 = `/links/actual/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(sourceEntityId)}/${enc2(sourceEntityBranch)}/${enc2(linkId)}`;
2727
2806
  if (targetEntityId && targetEntityBranch) {
2728
- path13 += `/${enc(targetEntityId)}/${enc(targetEntityBranch)}`;
2807
+ path13 += `/${enc2(targetEntityId)}/${enc2(targetEntityBranch)}`;
2729
2808
  }
2730
2809
  return client.request({
2731
2810
  method: "DELETE",
2732
- service: SERVICE3,
2811
+ service: SERVICE4,
2733
2812
  path: path13
2734
2813
  });
2735
2814
  },
@@ -2737,21 +2816,21 @@ function createStorageService(client) {
2737
2816
  async getEvents(ref) {
2738
2817
  return client.request({
2739
2818
  method: "GET",
2740
- service: SERVICE3,
2819
+ service: SERVICE4,
2741
2820
  path: `/events/actual${entityPath(ref)}`
2742
2821
  });
2743
2822
  },
2744
2823
  async getEvent(ref, eventId, occurrenceId) {
2745
2824
  return client.request({
2746
2825
  method: "GET",
2747
- service: SERVICE3,
2748
- path: `/events/actual${entityPath(ref)}/${enc(eventId)}/${enc(occurrenceId)}`
2826
+ service: SERVICE4,
2827
+ path: `/events/actual${entityPath(ref)}/${enc2(eventId)}/${enc2(occurrenceId)}`
2749
2828
  });
2750
2829
  },
2751
2830
  async createEvents(events) {
2752
2831
  return client.request({
2753
2832
  method: "POST",
2754
- service: SERVICE3,
2833
+ service: SERVICE4,
2755
2834
  path: "/events/",
2756
2835
  body: events
2757
2836
  });
@@ -2759,7 +2838,7 @@ function createStorageService(client) {
2759
2838
  async consumeEvents(body) {
2760
2839
  return client.request({
2761
2840
  method: "POST",
2762
- service: SERVICE3,
2841
+ service: SERVICE4,
2763
2842
  path: "/events/consume",
2764
2843
  body
2765
2844
  });
@@ -2767,15 +2846,15 @@ function createStorageService(client) {
2767
2846
  async deleteEvent(ref, eventId, occurrenceId) {
2768
2847
  return client.request({
2769
2848
  method: "DELETE",
2770
- service: SERVICE3,
2771
- path: `/events/actual${entityPath(ref)}/${enc(eventId)}/${enc(occurrenceId)}`
2849
+ service: SERVICE4,
2850
+ path: `/events/actual${entityPath(ref)}/${enc2(eventId)}/${enc2(occurrenceId)}`
2772
2851
  });
2773
2852
  },
2774
2853
  // --- Tables ---
2775
2854
  async getTableSnapshot(ref, request) {
2776
2855
  return client.request({
2777
2856
  method: "POST",
2778
- service: SERVICE3,
2857
+ service: SERVICE4,
2779
2858
  path: `/tables${entityPath(ref)}/snapshots`,
2780
2859
  body: request ?? {}
2781
2860
  });
@@ -2783,78 +2862,78 @@ function createStorageService(client) {
2783
2862
  async appendRow(ref) {
2784
2863
  return client.request({
2785
2864
  method: "POST",
2786
- service: SERVICE3,
2865
+ service: SERVICE4,
2787
2866
  path: `/tables${entityPath(ref)}/rows`
2788
2867
  });
2789
2868
  },
2790
2869
  async insertRow(ref, rowIndex) {
2791
2870
  return client.request({
2792
2871
  method: "POST",
2793
- service: SERVICE3,
2872
+ service: SERVICE4,
2794
2873
  path: `/tables${entityPath(ref)}/rows/${rowIndex}/insert`
2795
2874
  });
2796
2875
  },
2797
2876
  async removeRow(ref, rowIndex) {
2798
2877
  return client.request({
2799
2878
  method: "DELETE",
2800
- service: SERVICE3,
2879
+ service: SERVICE4,
2801
2880
  path: `/tables${entityPath(ref)}/rows/${rowIndex}`
2802
2881
  });
2803
2882
  },
2804
2883
  async deleteRow(ref, rowIndex) {
2805
2884
  return client.request({
2806
2885
  method: "POST",
2807
- service: SERVICE3,
2886
+ service: SERVICE4,
2808
2887
  path: `/tables${entityPath(ref)}/rows/${rowIndex}/delete`
2809
2888
  });
2810
2889
  },
2811
2890
  async appendColumn(ref) {
2812
2891
  return client.request({
2813
2892
  method: "POST",
2814
- service: SERVICE3,
2893
+ service: SERVICE4,
2815
2894
  path: `/tables${entityPath(ref)}/columns`
2816
2895
  });
2817
2896
  },
2818
- async insertColumn(ref, columnIndex) {
2897
+ async insertColumn(ref, columnIndex2) {
2819
2898
  return client.request({
2820
2899
  method: "POST",
2821
- service: SERVICE3,
2822
- path: `/tables${entityPath(ref)}/columns/${columnIndex}/insert`
2900
+ service: SERVICE4,
2901
+ path: `/tables${entityPath(ref)}/columns/${columnIndex2}/insert`
2823
2902
  });
2824
2903
  },
2825
- async removeColumn(ref, columnIndex) {
2904
+ async removeColumn(ref, columnIndex2) {
2826
2905
  return client.request({
2827
2906
  method: "DELETE",
2828
- service: SERVICE3,
2829
- path: `/tables${entityPath(ref)}/columns/${columnIndex}`
2907
+ service: SERVICE4,
2908
+ path: `/tables${entityPath(ref)}/columns/${columnIndex2}`
2830
2909
  });
2831
2910
  },
2832
- async deleteColumn(ref, columnIndex) {
2911
+ async deleteColumn(ref, columnIndex2) {
2833
2912
  return client.request({
2834
2913
  method: "POST",
2835
- service: SERVICE3,
2836
- path: `/tables${entityPath(ref)}/columns/${columnIndex}/delete`
2914
+ service: SERVICE4,
2915
+ path: `/tables${entityPath(ref)}/columns/${columnIndex2}/delete`
2837
2916
  });
2838
2917
  },
2839
2918
  async mergeCells(ref, cells) {
2840
2919
  return client.request({
2841
2920
  method: "PUT",
2842
- service: SERVICE3,
2921
+ service: SERVICE4,
2843
2922
  path: `/tables${entityPath(ref)}/cells`,
2844
2923
  body: cells
2845
2924
  });
2846
2925
  },
2847
- async removeCell(ref, rowIndex, columnIndex) {
2926
+ async removeCell(ref, rowIndex, columnIndex2) {
2848
2927
  return client.request({
2849
2928
  method: "DELETE",
2850
- service: SERVICE3,
2851
- path: `/tables${entityPath(ref)}/cells/${rowIndex}/${columnIndex}`
2929
+ service: SERVICE4,
2930
+ path: `/tables${entityPath(ref)}/cells/${rowIndex}/${columnIndex2}`
2852
2931
  });
2853
2932
  },
2854
2933
  async clearTable(ref) {
2855
2934
  return client.request({
2856
2935
  method: "POST",
2857
- service: SERVICE3,
2936
+ service: SERVICE4,
2858
2937
  path: `/tables${entityPath(ref)}/clear`
2859
2938
  });
2860
2939
  },
@@ -2864,7 +2943,7 @@ function createStorageService(client) {
2864
2943
  if (selection) query.selection = selection;
2865
2944
  return client.request({
2866
2945
  method: "PUT",
2867
- service: SERVICE3,
2946
+ service: SERVICE4,
2868
2947
  path: `/table-imports${entityPath(ref)}`,
2869
2948
  query: Object.keys(query).length > 0 ? query : void 0,
2870
2949
  rawBody: formData
@@ -2873,15 +2952,15 @@ function createStorageService(client) {
2873
2952
  async getSupportedImportFormats() {
2874
2953
  return client.request({
2875
2954
  method: "GET",
2876
- service: SERVICE3,
2955
+ service: SERVICE4,
2877
2956
  path: `/table-imports/supported-formats`
2878
2957
  });
2879
2958
  },
2880
2959
  async getImport(ref, importId) {
2881
2960
  return client.request({
2882
2961
  method: "GET",
2883
- service: SERVICE3,
2884
- path: `/imports${entityPath(ref)}/${enc(importId)}`
2962
+ service: SERVICE4,
2963
+ path: `/imports${entityPath(ref)}/${enc2(importId)}`
2885
2964
  });
2886
2965
  },
2887
2966
  /**
@@ -2893,8 +2972,8 @@ function createStorageService(client) {
2893
2972
  const query = exportTableQuery(options);
2894
2973
  return client.request({
2895
2974
  method: "POST",
2896
- service: SERVICE3,
2897
- path: `/table-exports${entityPath(ref)}/${enc(format2)}`,
2975
+ service: SERVICE4,
2976
+ path: `/table-exports${entityPath(ref)}/${enc2(format2)}`,
2898
2977
  query: Object.keys(query).length > 0 ? query : void 0
2899
2978
  });
2900
2979
  },
@@ -2909,8 +2988,8 @@ function createStorageService(client) {
2909
2988
  const query = exportTableQuery(options);
2910
2989
  return client.requestRaw({
2911
2990
  method: "POST",
2912
- service: SERVICE3,
2913
- path: `/table-exports${entityPath(ref)}/${enc(format2)}/stream`,
2991
+ service: SERVICE4,
2992
+ path: `/table-exports${entityPath(ref)}/${enc2(format2)}/stream`,
2914
2993
  query: Object.keys(query).length > 0 ? query : void 0
2915
2994
  });
2916
2995
  },
@@ -2923,7 +3002,7 @@ function createStorageService(client) {
2923
3002
  async getSupportedExportFormats() {
2924
3003
  return client.request({
2925
3004
  method: "GET",
2926
- service: SERVICE3,
3005
+ service: SERVICE4,
2927
3006
  path: `/table-exports/supported-formats`
2928
3007
  });
2929
3008
  },
@@ -2931,7 +3010,7 @@ function createStorageService(client) {
2931
3010
  async listExports(ref) {
2932
3011
  return client.request({
2933
3012
  method: "GET",
2934
- service: SERVICE3,
3013
+ service: SERVICE4,
2935
3014
  path: `/exports${entityPath(ref)}`
2936
3015
  });
2937
3016
  },
@@ -2944,22 +3023,22 @@ function createStorageService(client) {
2944
3023
  async downloadExport(ref, exportId, filename) {
2945
3024
  return client.requestRaw({
2946
3025
  method: "GET",
2947
- service: SERVICE3,
2948
- path: `/exports${entityPath(ref)}/${enc(exportId)}/${enc(filename)}`
3026
+ service: SERVICE4,
3027
+ path: `/exports${entityPath(ref)}/${enc2(exportId)}/${enc2(filename)}`
2949
3028
  });
2950
3029
  },
2951
3030
  // --- Branches ---
2952
3031
  async getProjectBranches(projectId) {
2953
3032
  return client.request({
2954
3033
  method: "GET",
2955
- service: SERVICE3,
2956
- path: `/project-branches/${enc(projectId)}`
3034
+ service: SERVICE4,
3035
+ path: `/project-branches/${enc2(projectId)}`
2957
3036
  });
2958
3037
  },
2959
3038
  async createProjectBranch(request) {
2960
3039
  return client.request({
2961
3040
  method: "POST",
2962
- service: SERVICE3,
3041
+ service: SERVICE4,
2963
3042
  path: "/project-branches/",
2964
3043
  body: request
2965
3044
  });
@@ -2967,21 +3046,21 @@ function createStorageService(client) {
2967
3046
  async deleteProjectBranch(projectId, projectBranch) {
2968
3047
  return client.request({
2969
3048
  method: "DELETE",
2970
- service: SERVICE3,
2971
- path: `/project-branches/${enc(projectId)}/${enc(projectBranch)}`
3049
+ service: SERVICE4,
3050
+ path: `/project-branches/${enc2(projectId)}/${enc2(projectBranch)}`
2972
3051
  });
2973
3052
  },
2974
3053
  async getEntityBranches(projectId, projectBranch, entityId) {
2975
3054
  return client.request({
2976
3055
  method: "GET",
2977
- service: SERVICE3,
2978
- path: `/entity-branches/${enc(projectId)}/${enc(projectBranch)}/${enc(entityId)}`
3056
+ service: SERVICE4,
3057
+ path: `/entity-branches/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(entityId)}`
2979
3058
  });
2980
3059
  },
2981
3060
  async createEntityBranch(request) {
2982
3061
  return client.request({
2983
3062
  method: "POST",
2984
- service: SERVICE3,
3063
+ service: SERVICE4,
2985
3064
  path: "/entity-branches/",
2986
3065
  body: request
2987
3066
  });
@@ -2990,7 +3069,7 @@ function createStorageService(client) {
2990
3069
  async merge(request) {
2991
3070
  return client.request({
2992
3071
  method: "POST",
2993
- service: SERVICE3,
3072
+ service: SERVICE4,
2994
3073
  path: "/merge/",
2995
3074
  body: request
2996
3075
  });
@@ -2998,7 +3077,7 @@ function createStorageService(client) {
2998
3077
  async fork(request) {
2999
3078
  return client.request({
3000
3079
  method: "POST",
3001
- service: SERVICE3,
3080
+ service: SERVICE4,
3002
3081
  path: "/fork/",
3003
3082
  body: request
3004
3083
  });
@@ -3007,8 +3086,8 @@ function createStorageService(client) {
3007
3086
  async searchProject(projectId, projectBranch, body) {
3008
3087
  return client.request({
3009
3088
  method: "POST",
3010
- service: SERVICE3,
3011
- path: `/project-searches/${enc(projectId)}/${enc(projectBranch)}`,
3089
+ service: SERVICE4,
3090
+ path: `/project-searches/${enc2(projectId)}/${enc2(projectBranch)}`,
3012
3091
  body
3013
3092
  });
3014
3093
  },
@@ -3016,21 +3095,21 @@ function createStorageService(client) {
3016
3095
  async createShortTermProjectBackup() {
3017
3096
  return client.request({
3018
3097
  method: "POST",
3019
- service: SERVICE3,
3098
+ service: SERVICE4,
3020
3099
  path: "/backups/project/short-term/create"
3021
3100
  });
3022
3101
  },
3023
3102
  async createLongTermProjectBackup() {
3024
3103
  return client.request({
3025
3104
  method: "POST",
3026
- service: SERVICE3,
3105
+ service: SERVICE4,
3027
3106
  path: "/backups/project/long-term/create"
3028
3107
  });
3029
3108
  },
3030
3109
  async restoreProjectBackup(request) {
3031
3110
  return client.request({
3032
3111
  method: "POST",
3033
- service: SERVICE3,
3112
+ service: SERVICE4,
3034
3113
  path: "/backups/project/restore",
3035
3114
  body: request
3036
3115
  });
@@ -3038,21 +3117,21 @@ function createStorageService(client) {
3038
3117
  async createShortTermFullBackup() {
3039
3118
  return client.request({
3040
3119
  method: "POST",
3041
- service: SERVICE3,
3120
+ service: SERVICE4,
3042
3121
  path: "/backups/full/short-term/create"
3043
3122
  });
3044
3123
  },
3045
3124
  async createLongTermFullBackup() {
3046
3125
  return client.request({
3047
3126
  method: "POST",
3048
- service: SERVICE3,
3127
+ service: SERVICE4,
3049
3128
  path: "/backups/full/long-term/create"
3050
3129
  });
3051
3130
  },
3052
3131
  async restoreFullBackup(request) {
3053
3132
  return client.request({
3054
3133
  method: "POST",
3055
- service: SERVICE3,
3134
+ service: SERVICE4,
3056
3135
  path: "/backups/full/restore",
3057
3136
  body: request
3058
3137
  });
@@ -3063,14 +3142,14 @@ function createStorageService(client) {
3063
3142
  async listUserDefinedExporters() {
3064
3143
  return client.request({
3065
3144
  method: "GET",
3066
- service: SERVICE3,
3145
+ service: SERVICE4,
3067
3146
  path: `/table-exporters`
3068
3147
  });
3069
3148
  },
3070
3149
  async registerUserDefinedExporter(request) {
3071
3150
  return client.request({
3072
3151
  method: "POST",
3073
- service: SERVICE3,
3152
+ service: SERVICE4,
3074
3153
  path: `/table-exporters`,
3075
3154
  body: request
3076
3155
  });
@@ -3078,15 +3157,15 @@ function createStorageService(client) {
3078
3157
  async deleteUserDefinedExporter(id) {
3079
3158
  await client.request({
3080
3159
  method: "DELETE",
3081
- service: SERVICE3,
3082
- path: `/table-exporters/${enc(id)}`
3160
+ service: SERVICE4,
3161
+ path: `/table-exporters/${enc2(id)}`
3083
3162
  });
3084
3163
  },
3085
3164
  // --- Data sources ---
3086
3165
  async createDataSource(request) {
3087
3166
  return client.request({
3088
3167
  method: "POST",
3089
- service: SERVICE3,
3168
+ service: SERVICE4,
3090
3169
  path: `/data-sources`,
3091
3170
  body: request
3092
3171
  });
@@ -3094,7 +3173,7 @@ function createStorageService(client) {
3094
3173
  async listDataSources(projectId) {
3095
3174
  return client.request({
3096
3175
  method: "GET",
3097
- service: SERVICE3,
3176
+ service: SERVICE4,
3098
3177
  path: `/data-sources`,
3099
3178
  query: projectId ? { projectId } : void 0
3100
3179
  });
@@ -3102,7 +3181,7 @@ function createStorageService(client) {
3102
3181
  async getDataSourceDashboard(projectId) {
3103
3182
  return client.request({
3104
3183
  method: "GET",
3105
- service: SERVICE3,
3184
+ service: SERVICE4,
3106
3185
  path: `/data-sources/dashboard`,
3107
3186
  query: { projectId }
3108
3187
  });
@@ -3110,51 +3189,51 @@ function createStorageService(client) {
3110
3189
  async getDataSource(id) {
3111
3190
  return client.request({
3112
3191
  method: "GET",
3113
- service: SERVICE3,
3114
- path: `/data-sources/${enc(id)}`
3192
+ service: SERVICE4,
3193
+ path: `/data-sources/${enc2(id)}`
3115
3194
  });
3116
3195
  },
3117
3196
  async updateDataSource(id, request) {
3118
3197
  return client.request({
3119
3198
  method: "PUT",
3120
- service: SERVICE3,
3121
- path: `/data-sources/${enc(id)}`,
3199
+ service: SERVICE4,
3200
+ path: `/data-sources/${enc2(id)}`,
3122
3201
  body: request
3123
3202
  });
3124
3203
  },
3125
3204
  async deleteDataSource(id) {
3126
3205
  await client.request({
3127
3206
  method: "DELETE",
3128
- service: SERVICE3,
3129
- path: `/data-sources/${enc(id)}`
3207
+ service: SERVICE4,
3208
+ path: `/data-sources/${enc2(id)}`
3130
3209
  });
3131
3210
  },
3132
3211
  async refreshDataSource(id) {
3133
3212
  return client.request({
3134
3213
  method: "POST",
3135
- service: SERVICE3,
3136
- path: `/data-sources/${enc(id)}/refresh`
3214
+ service: SERVICE4,
3215
+ path: `/data-sources/${enc2(id)}/refresh`
3137
3216
  });
3138
3217
  },
3139
3218
  async listDataSourceRuns(id, limit) {
3140
3219
  return client.request({
3141
3220
  method: "GET",
3142
- service: SERVICE3,
3143
- path: `/data-sources/${enc(id)}/runs`,
3221
+ service: SERVICE4,
3222
+ path: `/data-sources/${enc2(id)}/runs`,
3144
3223
  query: limit !== void 0 ? { limit } : void 0
3145
3224
  });
3146
3225
  },
3147
3226
  async getDataSourceRun(id, runId) {
3148
3227
  return client.request({
3149
3228
  method: "GET",
3150
- service: SERVICE3,
3151
- path: `/data-sources/${enc(id)}/runs/${enc(runId)}`
3229
+ service: SERVICE4,
3230
+ path: `/data-sources/${enc2(id)}/runs/${enc2(runId)}`
3152
3231
  });
3153
3232
  },
3154
3233
  async listDataSourceConnectorTypes() {
3155
3234
  return client.request({
3156
3235
  method: "GET",
3157
- service: SERVICE3,
3236
+ service: SERVICE4,
3158
3237
  path: `/data-sources/types`
3159
3238
  });
3160
3239
  },
@@ -3162,7 +3241,7 @@ function createStorageService(client) {
3162
3241
  async createSkeleton(request) {
3163
3242
  return client.request({
3164
3243
  method: "POST",
3165
- service: SERVICE3,
3244
+ service: SERVICE4,
3166
3245
  path: `/skeletons`,
3167
3246
  body: request
3168
3247
  });
@@ -3170,7 +3249,7 @@ function createStorageService(client) {
3170
3249
  async listSkeletons(projectId) {
3171
3250
  return client.request({
3172
3251
  method: "GET",
3173
- service: SERVICE3,
3252
+ service: SERVICE4,
3174
3253
  path: `/skeletons`,
3175
3254
  query: { projectId }
3176
3255
  });
@@ -3178,23 +3257,23 @@ function createStorageService(client) {
3178
3257
  async getSkeleton(id) {
3179
3258
  return client.request({
3180
3259
  method: "GET",
3181
- service: SERVICE3,
3182
- path: `/skeletons/${enc(id)}`
3260
+ service: SERVICE4,
3261
+ path: `/skeletons/${enc2(id)}`
3183
3262
  });
3184
3263
  },
3185
3264
  async updateSkeleton(id, request) {
3186
3265
  return client.request({
3187
3266
  method: "PUT",
3188
- service: SERVICE3,
3189
- path: `/skeletons/${enc(id)}`,
3267
+ service: SERVICE4,
3268
+ path: `/skeletons/${enc2(id)}`,
3190
3269
  body: request
3191
3270
  });
3192
3271
  },
3193
3272
  async deleteSkeleton(id) {
3194
3273
  await client.request({
3195
3274
  method: "DELETE",
3196
- service: SERVICE3,
3197
- path: `/skeletons/${enc(id)}`
3275
+ service: SERVICE4,
3276
+ path: `/skeletons/${enc2(id)}`
3198
3277
  });
3199
3278
  },
3200
3279
  // --- Notebook bundles ---
@@ -3202,8 +3281,8 @@ function createStorageService(client) {
3202
3281
  async exportBundle(projectId, projectBranch, request) {
3203
3282
  return client.request({
3204
3283
  method: "POST",
3205
- service: SERVICE3,
3206
- path: `/notebook-bundles/${enc(projectId)}/${enc(projectBranch)}/export`,
3284
+ service: SERVICE4,
3285
+ path: `/notebook-bundles/${enc2(projectId)}/${enc2(projectBranch)}/export`,
3207
3286
  body: request
3208
3287
  });
3209
3288
  },
@@ -3211,8 +3290,8 @@ function createStorageService(client) {
3211
3290
  async streamBundle(projectId, projectBranch, request) {
3212
3291
  return client.requestRaw({
3213
3292
  method: "POST",
3214
- service: SERVICE3,
3215
- path: `/notebook-bundles/${enc(projectId)}/${enc(projectBranch)}/export/stream`,
3293
+ service: SERVICE4,
3294
+ path: `/notebook-bundles/${enc2(projectId)}/${enc2(projectBranch)}/export/stream`,
3216
3295
  body: request
3217
3296
  });
3218
3297
  },
@@ -3220,16 +3299,16 @@ function createStorageService(client) {
3220
3299
  async exportProjectBundle(projectId, projectBranch) {
3221
3300
  return client.request({
3222
3301
  method: "POST",
3223
- service: SERVICE3,
3224
- path: `/project-bundles/${enc(projectId)}/${enc(projectBranch)}/export`
3302
+ service: SERVICE4,
3303
+ path: `/project-bundles/${enc2(projectId)}/${enc2(projectBranch)}/export`
3225
3304
  });
3226
3305
  },
3227
3306
  /** Queue an async entity-subset (.dfset) export; returns the bundleId for polling. */
3228
3307
  async exportEntitySubset(projectId, projectBranch, request) {
3229
3308
  return client.request({
3230
3309
  method: "POST",
3231
- service: SERVICE3,
3232
- path: `/entity-subset-bundles/${enc(projectId)}/${enc(projectBranch)}/export`,
3310
+ service: SERVICE4,
3311
+ path: `/entity-subset-bundles/${enc2(projectId)}/${enc2(projectBranch)}/export`,
3233
3312
  body: request
3234
3313
  });
3235
3314
  },
@@ -3237,39 +3316,39 @@ function createStorageService(client) {
3237
3316
  async streamEntitySubset(projectId, projectBranch, request) {
3238
3317
  return client.requestRaw({
3239
3318
  method: "POST",
3240
- service: SERVICE3,
3241
- path: `/entity-subset-bundles/${enc(projectId)}/${enc(projectBranch)}/export/stream`,
3319
+ service: SERVICE4,
3320
+ path: `/entity-subset-bundles/${enc2(projectId)}/${enc2(projectBranch)}/export/stream`,
3242
3321
  body: request
3243
3322
  });
3244
3323
  },
3245
3324
  async getBundles(projectId, projectBranch) {
3246
3325
  return client.request({
3247
3326
  method: "GET",
3248
- service: SERVICE3,
3249
- path: `/bundles/${enc(projectId)}/${enc(projectBranch)}`
3327
+ service: SERVICE4,
3328
+ path: `/bundles/${enc2(projectId)}/${enc2(projectBranch)}`
3250
3329
  });
3251
3330
  },
3252
3331
  /** Download a finished bundle's bytes. */
3253
3332
  async getBundleContent(projectId, projectBranch, bundleId, filename) {
3254
3333
  return client.requestRaw({
3255
3334
  method: "GET",
3256
- service: SERVICE3,
3257
- path: `/bundles/${enc(projectId)}/${enc(projectBranch)}/${enc(bundleId)}/${enc(filename)}`
3335
+ service: SERVICE4,
3336
+ path: `/bundles/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(bundleId)}/${enc2(filename)}`
3258
3337
  });
3259
3338
  },
3260
3339
  async stopBundle(projectId, projectBranch, bundleId, filename) {
3261
3340
  await client.request({
3262
3341
  method: "DELETE",
3263
- service: SERVICE3,
3264
- path: `/bundles/${enc(projectId)}/${enc(projectBranch)}/${enc(bundleId)}/${enc(filename)}`
3342
+ service: SERVICE4,
3343
+ path: `/bundles/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(bundleId)}/${enc2(filename)}`
3265
3344
  });
3266
3345
  },
3267
3346
  /** Non-committing inventory of an uploaded bundle. */
3268
3347
  async previewBundleImport(projectId, projectBranch, formData) {
3269
3348
  return client.request({
3270
3349
  method: "POST",
3271
- service: SERVICE3,
3272
- path: `/notebook-bundle-imports/${enc(projectId)}/${enc(projectBranch)}/preview`,
3350
+ service: SERVICE4,
3351
+ path: `/notebook-bundle-imports/${enc2(projectId)}/${enc2(projectBranch)}/preview`,
3273
3352
  rawBody: formData
3274
3353
  });
3275
3354
  },
@@ -3277,8 +3356,8 @@ function createStorageService(client) {
3277
3356
  async importBundle(projectId, projectBranch, formData, onConflict = "copy") {
3278
3357
  return client.request({
3279
3358
  method: "POST",
3280
- service: SERVICE3,
3281
- path: `/notebook-bundle-imports/${enc(projectId)}/${enc(projectBranch)}/import`,
3359
+ service: SERVICE4,
3360
+ path: `/notebook-bundle-imports/${enc2(projectId)}/${enc2(projectBranch)}/import`,
3282
3361
  query: { onConflict },
3283
3362
  rawBody: formData
3284
3363
  });
@@ -3287,8 +3366,8 @@ function createStorageService(client) {
3287
3366
  }
3288
3367
 
3289
3368
  // src/client/services/evaluation.ts
3290
- var SERVICE4 = "evaluation";
3291
- function enc2(s) {
3369
+ var SERVICE5 = "evaluation";
3370
+ function enc3(s) {
3292
3371
  return encodeURIComponent(s);
3293
3372
  }
3294
3373
  function createEvaluationService(client) {
@@ -3297,25 +3376,25 @@ function createEvaluationService(client) {
3297
3376
  async call(request, async = false) {
3298
3377
  return client.request({
3299
3378
  method: "POST",
3300
- service: SERVICE4,
3379
+ service: SERVICE5,
3301
3380
  path: "/calls/",
3302
3381
  body: request,
3303
3382
  query: async ? { async: true } : void 0
3304
3383
  });
3305
3384
  },
3306
3385
  // Evaluations
3307
- async getEvaluations(projectId, projectBranch, functionId, functionBranch, year, month, day, hour) {
3386
+ async getEvaluations(projectId, projectBranch, functionId, functionBranch, year, month, day2, hour) {
3308
3387
  return client.request({
3309
3388
  method: "GET",
3310
- service: SERVICE4,
3311
- path: `/evaluations/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(functionId)}/${enc2(functionBranch)}/${year}/${month}/${day}/${hour}`
3389
+ service: SERVICE5,
3390
+ path: `/evaluations/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}/${year}/${month}/${day2}/${hour}`
3312
3391
  });
3313
3392
  },
3314
- async getEvaluation(projectId, projectBranch, functionId, functionBranch, year, month, day, hour, evaluationId, result = false) {
3393
+ async getEvaluation(projectId, projectBranch, functionId, functionBranch, year, month, day2, hour, evaluationId, result = false) {
3315
3394
  return client.request({
3316
3395
  method: "GET",
3317
- service: SERVICE4,
3318
- path: `/evaluations/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(functionId)}/${enc2(functionBranch)}/${year}/${month}/${day}/${hour}/${enc2(evaluationId)}`,
3396
+ service: SERVICE5,
3397
+ path: `/evaluations/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}/${year}/${month}/${day2}/${hour}/${enc3(evaluationId)}`,
3319
3398
  query: result ? { result: true } : void 0
3320
3399
  });
3321
3400
  },
@@ -3323,61 +3402,61 @@ function createEvaluationService(client) {
3323
3402
  async getLastEvaluation(projectId, projectBranch, functionId, functionBranch) {
3324
3403
  return client.request({
3325
3404
  method: "GET",
3326
- service: SERVICE4,
3327
- path: `/last-evaluation/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(functionId)}/${enc2(functionBranch)}`
3405
+ service: SERVICE5,
3406
+ path: `/last-evaluation/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}`
3328
3407
  });
3329
3408
  },
3330
3409
  // Outputs
3331
3410
  async getOutputs(projectId, evaluationId) {
3332
3411
  return client.request({
3333
3412
  method: "GET",
3334
- service: SERVICE4,
3335
- path: `/output/${enc2(projectId)}/${enc2(evaluationId)}`
3413
+ service: SERVICE5,
3414
+ path: `/output/${enc3(projectId)}/${enc3(evaluationId)}`
3336
3415
  });
3337
3416
  },
3338
3417
  // Logs
3339
- async getLogs(projectId, projectBranch, functionId, functionBranch, year, month, day, hour) {
3418
+ async getLogs(projectId, projectBranch, functionId, functionBranch, year, month, day2, hour) {
3340
3419
  return client.request({
3341
3420
  method: "GET",
3342
- service: SERVICE4,
3343
- path: `/log/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(functionId)}/${enc2(functionBranch)}/${year}/${month}/${day}/${hour}`
3421
+ service: SERVICE5,
3422
+ path: `/log/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}/${year}/${month}/${day2}/${hour}`
3344
3423
  });
3345
3424
  },
3346
3425
  // Source Code
3347
3426
  async getSourceCode(projectId, projectBranch, functionId, functionBranch, sourceCodeHash, sourceCodeId) {
3348
3427
  return client.request({
3349
3428
  method: "GET",
3350
- service: SERVICE4,
3351
- path: `/sourcecodes/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(functionId)}/${enc2(functionBranch)}/${enc2(sourceCodeHash)}/${enc2(sourceCodeId)}`
3429
+ service: SERVICE5,
3430
+ path: `/sourcecodes/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}/${enc3(sourceCodeHash)}/${enc3(sourceCodeId)}`
3352
3431
  });
3353
3432
  },
3354
3433
  // Stop
3355
- async stopEvaluation(projectId, projectBranch, functionId, functionBranch, year, month, day, hour, evaluationId) {
3434
+ async stopEvaluation(projectId, projectBranch, functionId, functionBranch, year, month, day2, hour, evaluationId) {
3356
3435
  return client.request({
3357
3436
  method: "POST",
3358
- service: SERVICE4,
3359
- path: `/stop/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(functionId)}/${enc2(functionBranch)}/${year}/${month}/${day}/${hour}/${enc2(evaluationId)}`
3437
+ service: SERVICE5,
3438
+ path: `/stop/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}/${year}/${month}/${day2}/${hour}/${enc3(evaluationId)}`
3360
3439
  });
3361
3440
  },
3362
3441
  // Triggers
3363
3442
  async getTriggers(projectId, projectBranch, functionId, functionBranch) {
3364
3443
  return client.request({
3365
3444
  method: "GET",
3366
- service: SERVICE4,
3367
- path: `/triggers/actual/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(functionId)}/${enc2(functionBranch)}`
3445
+ service: SERVICE5,
3446
+ path: `/triggers/actual/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}`
3368
3447
  });
3369
3448
  },
3370
3449
  async getTrigger(projectId, projectBranch, functionId, functionBranch, triggerId) {
3371
3450
  return client.request({
3372
3451
  method: "GET",
3373
- service: SERVICE4,
3374
- path: `/triggers/actual/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(functionId)}/${enc2(functionBranch)}/${enc2(triggerId)}`
3452
+ service: SERVICE5,
3453
+ path: `/triggers/actual/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}/${enc3(triggerId)}`
3375
3454
  });
3376
3455
  },
3377
3456
  async saveTrigger(trigger) {
3378
3457
  return client.request({
3379
3458
  method: "PUT",
3380
- service: SERVICE4,
3459
+ service: SERVICE5,
3381
3460
  path: "/triggers/",
3382
3461
  body: trigger
3383
3462
  });
@@ -3385,16 +3464,16 @@ function createEvaluationService(client) {
3385
3464
  async deleteTrigger(projectId, projectBranch, functionId, functionBranch, triggerId) {
3386
3465
  return client.request({
3387
3466
  method: "DELETE",
3388
- service: SERVICE4,
3389
- path: `/triggers/${enc2(projectId)}/${enc2(projectBranch)}/${enc2(functionId)}/${enc2(functionBranch)}/${enc2(triggerId)}`
3467
+ service: SERVICE5,
3468
+ path: `/triggers/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}/${enc3(triggerId)}`
3390
3469
  });
3391
3470
  }
3392
3471
  };
3393
3472
  }
3394
3473
 
3395
3474
  // src/client/services/scheduler.ts
3396
- var SERVICE5 = "scheduler";
3397
- function enc3(s) {
3475
+ var SERVICE6 = "scheduler";
3476
+ function enc4(s) {
3398
3477
  return encodeURIComponent(s);
3399
3478
  }
3400
3479
  function createSchedulerService(client) {
@@ -3402,24 +3481,24 @@ function createSchedulerService(client) {
3402
3481
  async scheduleCall(request) {
3403
3482
  return client.request({
3404
3483
  method: "POST",
3405
- service: SERVICE5,
3484
+ service: SERVICE6,
3406
3485
  path: "/calls/",
3407
3486
  body: request
3408
3487
  });
3409
3488
  },
3410
- async stopScheduled(projectId, projectBranch, functionId, functionBranch, year, month, day, hour, evaluationId) {
3489
+ async stopScheduled(projectId, projectBranch, functionId, functionBranch, year, month, day2, hour, evaluationId) {
3411
3490
  return client.request({
3412
3491
  method: "POST",
3413
- service: SERVICE5,
3414
- path: `/stop/${enc3(projectId)}/${enc3(projectBranch)}/${enc3(functionId)}/${enc3(functionBranch)}/${year}/${month}/${day}/${hour}/${enc3(evaluationId)}`
3492
+ service: SERVICE6,
3493
+ path: `/stop/${enc4(projectId)}/${enc4(projectBranch)}/${enc4(functionId)}/${enc4(functionBranch)}/${year}/${month}/${day2}/${hour}/${enc4(evaluationId)}`
3415
3494
  });
3416
3495
  }
3417
3496
  };
3418
3497
  }
3419
3498
 
3420
3499
  // src/client/services/language.ts
3421
- var SERVICE6 = "language";
3422
- function enc4(s) {
3500
+ var SERVICE7 = "language";
3501
+ function enc5(s) {
3423
3502
  return encodeURIComponent(s);
3424
3503
  }
3425
3504
  function createLanguageService(client) {
@@ -3428,7 +3507,7 @@ function createLanguageService(client) {
3428
3507
  async chat(request) {
3429
3508
  return client.request({
3430
3509
  method: "POST",
3431
- service: SERVICE6,
3510
+ service: SERVICE7,
3432
3511
  path: "/chat/",
3433
3512
  body: request
3434
3513
  });
@@ -3437,7 +3516,7 @@ function createLanguageService(client) {
3437
3516
  async chatStream(request) {
3438
3517
  return client.requestRaw({
3439
3518
  method: "POST",
3440
- service: SERVICE6,
3519
+ service: SERVICE7,
3441
3520
  path: "/chat/stream",
3442
3521
  body: request
3443
3522
  });
@@ -3446,7 +3525,7 @@ function createLanguageService(client) {
3446
3525
  async upload(formData) {
3447
3526
  return client.request({
3448
3527
  method: "POST",
3449
- service: SERVICE6,
3528
+ service: SERVICE7,
3450
3529
  path: "/upload/",
3451
3530
  rawBody: formData
3452
3531
  });
@@ -3455,7 +3534,7 @@ function createLanguageService(client) {
3455
3534
  async getUsage() {
3456
3535
  return client.request({
3457
3536
  method: "GET",
3458
- service: SERVICE6,
3537
+ service: SERVICE7,
3459
3538
  path: "/usage/"
3460
3539
  });
3461
3540
  },
@@ -3463,36 +3542,36 @@ function createLanguageService(client) {
3463
3542
  async getSessions() {
3464
3543
  return client.request({
3465
3544
  method: "GET",
3466
- service: SERVICE6,
3545
+ service: SERVICE7,
3467
3546
  path: "/sessions/"
3468
3547
  });
3469
3548
  },
3470
3549
  async getSession(sessionId) {
3471
3550
  return client.request({
3472
3551
  method: "GET",
3473
- service: SERVICE6,
3474
- path: `/sessions/${enc4(sessionId)}`
3552
+ service: SERVICE7,
3553
+ path: `/sessions/${enc5(sessionId)}`
3475
3554
  });
3476
3555
  },
3477
3556
  async deleteSession(sessionId) {
3478
3557
  return client.request({
3479
3558
  method: "DELETE",
3480
- service: SERVICE6,
3481
- path: `/sessions/${enc4(sessionId)}`
3559
+ service: SERVICE7,
3560
+ path: `/sessions/${enc5(sessionId)}`
3482
3561
  });
3483
3562
  },
3484
3563
  async getSessionMessages(sessionId) {
3485
3564
  return client.request({
3486
3565
  method: "GET",
3487
- service: SERVICE6,
3488
- path: `/sessions/${enc4(sessionId)}/messages`
3566
+ service: SERVICE7,
3567
+ path: `/sessions/${enc5(sessionId)}/messages`
3489
3568
  });
3490
3569
  },
3491
3570
  async renameSession(sessionId, title) {
3492
3571
  return client.request({
3493
3572
  method: "PUT",
3494
- service: SERVICE6,
3495
- path: `/sessions/${enc4(sessionId)}/title`,
3573
+ service: SERVICE7,
3574
+ path: `/sessions/${enc5(sessionId)}/title`,
3496
3575
  rawBody: title,
3497
3576
  contentType: "text/plain"
3498
3577
  });
@@ -3501,8 +3580,8 @@ function createLanguageService(client) {
3501
3580
  }
3502
3581
 
3503
3582
  // src/client/services/index-search.ts
3504
- var SERVICE7 = "index";
3505
- function enc5(s) {
3583
+ var SERVICE8 = "index";
3584
+ function enc6(s) {
3506
3585
  return encodeURIComponent(s);
3507
3586
  }
3508
3587
  function createIndexService(client) {
@@ -3514,7 +3593,7 @@ function createIndexService(client) {
3514
3593
  async searchPage(query) {
3515
3594
  return client.request({
3516
3595
  method: "GET",
3517
- service: SERVICE7,
3596
+ service: SERVICE8,
3518
3597
  path: "/search/page",
3519
3598
  query: {
3520
3599
  query: query.query,
@@ -3534,7 +3613,7 @@ function createIndexService(client) {
3534
3613
  async getCuratedTags(counts = false) {
3535
3614
  return client.request({
3536
3615
  method: "GET",
3537
- service: SERVICE7,
3616
+ service: SERVICE8,
3538
3617
  path: "/tags/curated",
3539
3618
  query: counts ? { counts: true } : void 0
3540
3619
  });
@@ -3543,7 +3622,7 @@ function createIndexService(client) {
3543
3622
  async createCuratedTag(request) {
3544
3623
  return client.request({
3545
3624
  method: "POST",
3546
- service: SERVICE7,
3625
+ service: SERVICE8,
3547
3626
  path: "/admin/curated-tags",
3548
3627
  body: request
3549
3628
  });
@@ -3552,8 +3631,8 @@ function createIndexService(client) {
3552
3631
  async updateCuratedTag(tag, request) {
3553
3632
  return client.request({
3554
3633
  method: "PUT",
3555
- service: SERVICE7,
3556
- path: `/admin/curated-tags/${enc5(tag)}`,
3634
+ service: SERVICE8,
3635
+ path: `/admin/curated-tags/${enc6(tag)}`,
3557
3636
  body: request
3558
3637
  });
3559
3638
  },
@@ -3561,22 +3640,22 @@ function createIndexService(client) {
3561
3640
  async deleteCuratedTag(tag) {
3562
3641
  return client.request({
3563
3642
  method: "DELETE",
3564
- service: SERVICE7,
3565
- path: `/admin/curated-tags/${enc5(tag)}`
3643
+ service: SERVICE8,
3644
+ path: `/admin/curated-tags/${enc6(tag)}`
3566
3645
  });
3567
3646
  },
3568
3647
  async rebuildAll() {
3569
3648
  return client.request({
3570
3649
  method: "POST",
3571
- service: SERVICE7,
3650
+ service: SERVICE8,
3572
3651
  path: "/indexes/rebuild"
3573
3652
  });
3574
3653
  },
3575
3654
  async rebuildProject(projectId) {
3576
3655
  return client.request({
3577
3656
  method: "POST",
3578
- service: SERVICE7,
3579
- path: `/indexes/rebuild/${enc5(projectId)}`
3657
+ service: SERVICE8,
3658
+ path: `/indexes/rebuild/${enc6(projectId)}`
3580
3659
  });
3581
3660
  }
3582
3661
  };
@@ -3589,6 +3668,7 @@ function createApiClient(options = {}) {
3589
3668
  http,
3590
3669
  admin: createAdminService(http),
3591
3670
  analysis: createAnalysisService(http),
3671
+ deployments: createDeploymentsService(http),
3592
3672
  storage: createStorageService(http),
3593
3673
  evaluation: createEvaluationService(http),
3594
3674
  scheduler: createSchedulerService(http),
@@ -4137,8 +4217,8 @@ function printImportPreview(preview) {
4137
4217
  for (const e of preview.entities ?? []) {
4138
4218
  counts.set(e.type, (counts.get(e.type) ?? 0) + 1);
4139
4219
  }
4140
- for (const [type, count] of [...counts.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
4141
- console.log(` ${type}: ${count}`);
4220
+ for (const [type, count2] of [...counts.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
4221
+ console.log(` ${type}: ${count2}`);
4142
4222
  }
4143
4223
  if (preview.hasAnalysis) {
4144
4224
  console.log(" analysis recipe: included");
@@ -5064,11 +5144,11 @@ function parseInterval(value) {
5064
5144
  return interval;
5065
5145
  }
5066
5146
  function parseCount(value, label) {
5067
- const count = Number(value);
5068
- if (!Number.isInteger(count) || count < 0) {
5147
+ const count2 = Number(value);
5148
+ if (!Number.isInteger(count2) || count2 < 0) {
5069
5149
  throw new Error(`Invalid ${label} "${value}". Expected a non-negative whole number.`);
5070
5150
  }
5071
- return count;
5151
+ return count2;
5072
5152
  }
5073
5153
  function formatMoney(cents, currency) {
5074
5154
  const sign = cents < 0 ? "-" : "";
@@ -5323,20 +5403,20 @@ function registerInvitationCommands(team) {
5323
5403
  }
5324
5404
  function registerSeatCommands(team) {
5325
5405
  const seats = team.command("seats").description("Change a team's seat count");
5326
- seats.command("preview").description("Preview the invoice for a seat-count change without applying it").argument("<teamId>", "Team ID").argument("<count>", "New seat count").action(async (teamId, count, _options, cmd) => {
5406
+ seats.command("preview").description("Preview the invoice for a seat-count change without applying it").argument("<teamId>", "Team ID").argument("<count>", "New seat count").action(async (teamId, count2, _options, cmd) => {
5327
5407
  try {
5328
5408
  const api = createApiClient();
5329
5409
  printInvoicePreview(
5330
- await api.admin.previewTeamSeatCount(teamId, parseCount(count, "seat count")),
5410
+ await api.admin.previewTeamSeatCount(teamId, parseCount(count2, "seat count")),
5331
5411
  getOutputFormat4(cmd)
5332
5412
  );
5333
5413
  } catch (error) {
5334
5414
  handleError(error);
5335
5415
  }
5336
5416
  });
5337
- seats.command("set").description("Change the seat count and bill the difference").argument("<teamId>", "Team ID").argument("<count>", "New seat count").option("-y, --yes", "Skip the confirmation prompt").action(async (teamId, count, options, cmd) => {
5417
+ seats.command("set").description("Change the seat count and bill the difference").argument("<teamId>", "Team ID").argument("<count>", "New seat count").option("-y, --yes", "Skip the confirmation prompt").action(async (teamId, count2, options, cmd) => {
5338
5418
  try {
5339
- const seatCount = parseCount(count, "seat count");
5419
+ const seatCount = parseCount(count2, "seat count");
5340
5420
  await confirmDestructive(
5341
5421
  `This will change the seat count of team "${teamId}" to ${seatCount} and adjust billing.`,
5342
5422
  { yes: options.yes, resourceId: teamId }
@@ -5353,20 +5433,20 @@ function registerSeatCommands(team) {
5353
5433
  }
5354
5434
  function registerPackCommands(team) {
5355
5435
  const packs = team.command("packs").description("Change a team's credit extension packs");
5356
- packs.command("preview").description("Preview the invoice for a pack-count change without applying it").argument("<teamId>", "Team ID").argument("<count>", "New pack count").action(async (teamId, count, _options, cmd) => {
5436
+ packs.command("preview").description("Preview the invoice for a pack-count change without applying it").argument("<teamId>", "Team ID").argument("<count>", "New pack count").action(async (teamId, count2, _options, cmd) => {
5357
5437
  try {
5358
5438
  const api = createApiClient();
5359
5439
  printInvoicePreview(
5360
- await api.admin.previewTeamPackCount(teamId, parseCount(count, "pack count")),
5440
+ await api.admin.previewTeamPackCount(teamId, parseCount(count2, "pack count")),
5361
5441
  getOutputFormat4(cmd)
5362
5442
  );
5363
5443
  } catch (error) {
5364
5444
  handleError(error);
5365
5445
  }
5366
5446
  });
5367
- packs.command("set").description("Change the pack count and bill the difference").argument("<teamId>", "Team ID").argument("<count>", "New pack count").option("-y, --yes", "Skip the confirmation prompt").action(async (teamId, count, options, cmd) => {
5447
+ packs.command("set").description("Change the pack count and bill the difference").argument("<teamId>", "Team ID").argument("<count>", "New pack count").option("-y, --yes", "Skip the confirmation prompt").action(async (teamId, count2, options, cmd) => {
5368
5448
  try {
5369
- const packCount = parseCount(count, "pack count");
5449
+ const packCount = parseCount(count2, "pack count");
5370
5450
  await confirmDestructive(
5371
5451
  `This will change the extension packs of team "${teamId}" to ${packCount} and adjust billing.`,
5372
5452
  { yes: options.yes, resourceId: teamId }
@@ -5805,8 +5885,8 @@ function registerEventCommands(program) {
5805
5885
  });
5806
5886
  event.command("create").description("Create one or more events (body from JSON file or stdin)").argument("[file]", "JSON file containing a BareEvent array; defaults to stdin").action(async (file) => {
5807
5887
  try {
5808
- const fs19 = await import("fs");
5809
- const body = file ? fs19.readFileSync(file, "utf-8") : await new Promise((resolve2, reject) => {
5888
+ const fs20 = await import("fs");
5889
+ const body = file ? fs20.readFileSync(file, "utf-8") : await new Promise((resolve2, reject) => {
5810
5890
  let data = "";
5811
5891
  process.stdin.setEncoding("utf-8");
5812
5892
  process.stdin.on("data", (chunk) => {
@@ -6685,8 +6765,8 @@ Examples:
6685
6765
  for (const e of preview.entities ?? []) {
6686
6766
  counts.set(e.type, (counts.get(e.type) ?? 0) + 1);
6687
6767
  }
6688
- for (const [type, count] of [...counts.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
6689
- console.log(` ${type}: ${count}`);
6768
+ for (const [type, count2] of [...counts.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
6769
+ console.log(` ${type}: ${count2}`);
6690
6770
  }
6691
6771
  if (preview.lossinessNotes && preview.lossinessNotes.length > 0) {
6692
6772
  console.log(chalk17.yellow("Lossiness:"));
@@ -6968,7 +7048,7 @@ Examples:
6968
7048
  const resolved = parseEntityReference(ref, overrides);
6969
7049
  const api = createApiClient();
6970
7050
  const parts = options.date.split("-").map(Number);
6971
- const [year, month, day, hour] = parts;
7051
+ const [year, month, day2, hour] = parts;
6972
7052
  const evaluations = await api.evaluation.getEvaluations(
6973
7053
  resolved.projectId,
6974
7054
  resolved.projectBranch,
@@ -6976,7 +7056,7 @@ Examples:
6976
7056
  resolved.entityBranch,
6977
7057
  year,
6978
7058
  month,
6979
- day,
7059
+ day2,
6980
7060
  hour
6981
7061
  );
6982
7062
  const summary = evaluations.map((e) => ({
@@ -7029,7 +7109,7 @@ Examples:
7029
7109
  const resolved = parseEntityReference(ref, overrides);
7030
7110
  const api = createApiClient();
7031
7111
  const parts = options.date.split("-").map(Number);
7032
- const [year, month, day, hour] = parts;
7112
+ const [year, month, day2, hour] = parts;
7033
7113
  const logs = await api.evaluation.getLogs(
7034
7114
  resolved.projectId,
7035
7115
  resolved.projectBranch,
@@ -7037,7 +7117,7 @@ Examples:
7037
7117
  resolved.entityBranch,
7038
7118
  year,
7039
7119
  month,
7040
- day,
7120
+ day2,
7041
7121
  hour
7042
7122
  );
7043
7123
  format(logs, { format: outputFormat });
@@ -7051,7 +7131,7 @@ Examples:
7051
7131
  const resolved = parseEntityReference(ref, overrides);
7052
7132
  const api = createApiClient();
7053
7133
  const parts = options.date.split("-").map(Number);
7054
- const [year, month, day, hour] = parts;
7134
+ const [year, month, day2, hour] = parts;
7055
7135
  await api.evaluation.stopEvaluation(
7056
7136
  resolved.projectId,
7057
7137
  resolved.projectBranch,
@@ -7059,7 +7139,7 @@ Examples:
7059
7139
  resolved.entityBranch,
7060
7140
  year,
7061
7141
  month,
7062
- day,
7142
+ day2,
7063
7143
  hour,
7064
7144
  evaluationId
7065
7145
  );
@@ -7897,6 +7977,8 @@ var BY_COMMAND = {
7897
7977
  "project members invite": { "<userId>": TEXT, "<role>": { kind: "choice", choices: PROJECT_ROLES } },
7898
7978
  "project members join": { "<userId>": TEXT },
7899
7979
  "license create": { "<licenseId>": TEXT, "--name": TEXT, "--flags": TEXT },
7980
+ "deployment create": { "--analysis": { kind: "analysis" }, "--target": TEXT },
7981
+ "deployment delete-prediction": { "<predictionId>": TEXT },
7900
7982
  "trigger create": { "--type": { kind: "choice", choices: TRIGGER_TYPES } },
7901
7983
  "analyze triggers create": { "--kind": { kind: "choice", choices: ANALYSIS_TRIGGER_KINDS } },
7902
7984
  "function outputs": { "<evaluationId>": TEXT },
@@ -7913,6 +7995,7 @@ var BY_NAME = {
7913
7995
  invitationId: { kind: "teamInvitation" },
7914
7996
  analysisId: { kind: "analysis" },
7915
7997
  licenseId: { kind: "license" },
7998
+ deploymentId: { kind: "deployment" },
7916
7999
  sessionId: { kind: "chatSession" },
7917
8000
  tokenId: { kind: "apiToken" },
7918
8001
  resource: { kind: "tokenResource" },
@@ -8126,8 +8209,8 @@ Examples:
8126
8209
  if (!TRIGGER_TYPES.includes(type)) {
8127
8210
  throw new Error(`Unknown trigger type "${options.type}": use one of ${TRIGGER_TYPES.join(", ")}.`);
8128
8211
  }
8129
- const count = Number(options.count);
8130
- if (!Number.isInteger(count) || count < 1) {
8212
+ const count2 = Number(options.count);
8213
+ if (!Number.isInteger(count2) || count2 < 1) {
8131
8214
  throw new Error(`--count must be a whole number of at least 1, not "${options.count}".`);
8132
8215
  }
8133
8216
  const api = createApiClient();
@@ -8156,7 +8239,7 @@ Examples:
8156
8239
  originEntityId,
8157
8240
  originEntityBranch,
8158
8241
  active: !options.inactive,
8159
- quantity: count,
8242
+ quantity: count2,
8160
8243
  fired: 0,
8161
8244
  maximum: options.max ? parseInt(options.max, 10) || null : null,
8162
8245
  evaluationIds: null,
@@ -8240,7 +8323,7 @@ function registerScheduleCommands(program) {
8240
8323
  const overrides = getOverrides10(cmd);
8241
8324
  const resolved = parseEntityReference(ref, overrides);
8242
8325
  const api = createApiClient();
8243
- const [year, month, day, hour] = options.date.split("-").map(Number);
8326
+ const [year, month, day2, hour] = options.date.split("-").map(Number);
8244
8327
  await api.scheduler.stopScheduled(
8245
8328
  resolved.projectId,
8246
8329
  resolved.projectBranch,
@@ -8248,7 +8331,7 @@ function registerScheduleCommands(program) {
8248
8331
  resolved.entityBranch,
8249
8332
  year,
8250
8333
  month,
8251
- day,
8334
+ day2,
8252
8335
  hour,
8253
8336
  evaluationId
8254
8337
  );
@@ -8472,7 +8555,7 @@ var HELP = [
8472
8555
  ];
8473
8556
  async function runChatRepl(options) {
8474
8557
  const { input: promptInput } = await import("@inquirer/prompts");
8475
- const { getUpdateNotice } = await import("./update-check-2GW2RLWY.js");
8558
+ const { getUpdateNotice } = await import("./update-check-R7B2D7VX.js");
8476
8559
  let sessionId = options.session;
8477
8560
  let lastReportedSession;
8478
8561
  console.log(chalk21.bold("Diafunc chat") + chalk21.dim(" \xB7 /help for commands, /quit to exit"));
@@ -10299,8 +10382,8 @@ function licenseText(analysis) {
10299
10382
  return analysis.visibility === "PUBLIC" ? "none chosen" : null;
10300
10383
  }
10301
10384
  function sentenceCase(token) {
10302
- const words = token.toLowerCase().replace(/_/g, " ");
10303
- return words.charAt(0).toUpperCase() + words.slice(1);
10385
+ const words2 = token.toLowerCase().replace(/_/g, " ");
10386
+ return words2.charAt(0).toUpperCase() + words2.slice(1);
10304
10387
  }
10305
10388
  function hoursText(hours) {
10306
10389
  if (hours == null || hours === "") return null;
@@ -11224,7 +11307,7 @@ async function reportTerminalRun(api, config, run, analysisId, runId, outputForm
11224
11307
  async function printNotebookLink(api, config, analysisId) {
11225
11308
  try {
11226
11309
  const nav = await api.analysis.getNavigation(analysisId);
11227
- const endpoint = config.profiles[config.currentProfile]?.endpoint ?? "https://diafunc.com";
11310
+ const endpoint = config.profiles[getActiveProfileName(config)]?.endpoint ?? "https://diafunc.com";
11228
11311
  detail(`${endpoint}${nav.labUrl}`);
11229
11312
  } catch {
11230
11313
  }
@@ -11277,7 +11360,7 @@ async function getAnalysisDetails(analysisId, options, cmd) {
11277
11360
  intent: abbreviate(result.analysis.intent ?? null)
11278
11361
  };
11279
11362
  const config = loadConfig();
11280
- const endpoint = config.profiles[config.currentProfile]?.endpoint ?? "https://diafunc.com";
11363
+ const endpoint = config.profiles[getActiveProfileName(config)]?.endpoint ?? "https://diafunc.com";
11281
11364
  const details = analysisDetails(analysis, endpoint, await resultVerdict(api, result.analysis));
11282
11365
  format(details.data, { format: outputFormat, columns: details.columns });
11283
11366
  if (!options.full && isLong(result.analysis.introduction)) {
@@ -11394,7 +11477,7 @@ async function openAnalysis(analysisId) {
11394
11477
  return;
11395
11478
  }
11396
11479
  const config = loadConfig();
11397
- const endpoint = config.profiles[config.currentProfile]?.endpoint ?? "https://diafunc.com";
11480
+ const endpoint = config.profiles[getActiveProfileName(config)]?.endpoint ?? "https://diafunc.com";
11398
11481
  try {
11399
11482
  const nav = await api.analysis.getNavigation(result.analysis.analysisId);
11400
11483
  const url = `${endpoint}${nav.labUrl}`;
@@ -11816,10 +11899,10 @@ async function listColumns(analysisId, cmd) {
11816
11899
  }
11817
11900
  format(columns, { format: outputFormat, columns: ["name", "valueType"] });
11818
11901
  }
11819
- async function listRuns(analysisId, count, cmd) {
11902
+ async function listRuns(analysisId, count2, cmd) {
11820
11903
  const outputFormat = getOutputFormat19(cmd);
11821
11904
  const api = createApiClient();
11822
- const runs = await api.analysis.getRunsForAnalysis(analysisId, count);
11905
+ const runs = await api.analysis.getRunsForAnalysis(analysisId, count2);
11823
11906
  format(runs.map((r) => ({
11824
11907
  runId: r.runId,
11825
11908
  state: r.state,
@@ -12384,10 +12467,896 @@ Examples:
12384
12467
  });
12385
12468
  }
12386
12469
 
12470
+ // src/commands/deployment/index.ts
12471
+ import * as fs13 from "fs";
12472
+ import chalk30 from "chalk";
12473
+
12474
+ // src/util/csv.ts
12475
+ function detectDelimiter(firstLine) {
12476
+ if (firstLine.includes(",")) return ",";
12477
+ if (firstLine.includes(" ")) return " ";
12478
+ if (firstLine.includes(";")) return ";";
12479
+ return ",";
12480
+ }
12481
+ function records(text2, delimiter) {
12482
+ const out = [];
12483
+ let fields = [];
12484
+ let field = "";
12485
+ let quoted = false;
12486
+ let line = 1;
12487
+ let startLine = 1;
12488
+ let i = 0;
12489
+ const finishRecord = () => {
12490
+ fields.push(field);
12491
+ if (!(fields.length === 1 && fields[0].trim() === "")) out.push({ fields, line: startLine });
12492
+ fields = [];
12493
+ field = "";
12494
+ };
12495
+ while (i < text2.length) {
12496
+ const c = text2[i];
12497
+ if (quoted) {
12498
+ if (c === '"') {
12499
+ if (text2[i + 1] === '"') {
12500
+ field += '"';
12501
+ i += 2;
12502
+ continue;
12503
+ }
12504
+ quoted = false;
12505
+ } else {
12506
+ if (c === "\n") line++;
12507
+ field += c;
12508
+ }
12509
+ i++;
12510
+ continue;
12511
+ }
12512
+ if (c === '"' && field === "") {
12513
+ quoted = true;
12514
+ } else if (c === delimiter) {
12515
+ fields.push(field);
12516
+ field = "";
12517
+ } else if (c === "\r" && text2[i + 1] === "\n") {
12518
+ } else if (c === "\n") {
12519
+ finishRecord();
12520
+ line++;
12521
+ startLine = line;
12522
+ } else {
12523
+ field += c;
12524
+ }
12525
+ i++;
12526
+ }
12527
+ if (field !== "" || fields.length > 0) finishRecord();
12528
+ return out;
12529
+ }
12530
+ function parseCsv(text2) {
12531
+ const body = text2.charCodeAt(0) === 65279 ? text2.slice(1) : text2;
12532
+ const firstLine = body.split(/\r?\n/, 1)[0] ?? "";
12533
+ const all = records(body, detectDelimiter(firstLine));
12534
+ if (all.length === 0) return { header: [], rows: [], lines: [] };
12535
+ const header = all[0].fields.map((h) => h.trim());
12536
+ const rows = all.slice(1).map((r) => header.map((_, index) => r.fields[index] ?? ""));
12537
+ return { header, rows, lines: all.slice(1).map((r) => r.line) };
12538
+ }
12539
+ function csvLine(fields) {
12540
+ return fields.map((value) => {
12541
+ const text2 = value === null || value === void 0 ? "" : String(value);
12542
+ return /[",\r\n]/.test(text2) ? `"${text2.replace(/"/g, '""')}"` : text2;
12543
+ }).join(",");
12544
+ }
12545
+ function chunks(items, size) {
12546
+ if (size < 1) throw new Error("chunk size must be at least 1");
12547
+ const out = [];
12548
+ for (let i = 0; i < items.length; i += size) out.push(items.slice(i, i + size));
12549
+ return out;
12550
+ }
12551
+
12552
+ // src/prompting/command.ts
12553
+ import { Command as Command2 } from "commander";
12554
+ var commanderOriginal = Command2.prototype;
12555
+ var DiafuncCommand = class _DiafuncCommand extends Command2 {
12556
+ /** Gaps recorded during the current parse, in the order commander found them. */
12557
+ pendingInputs = [];
12558
+ /** Set on the program only; every command reads it from there. */
12559
+ promptEnvironment = {};
12560
+ createCommand(name) {
12561
+ return new _DiafuncCommand(name);
12562
+ }
12563
+ missingArgument(name) {
12564
+ if (!this.mayPrompt()) {
12565
+ commanderOriginal.missingArgument.call(this, name);
12566
+ return;
12567
+ }
12568
+ const index = this.registeredArguments.findIndex((a) => a.name() === name);
12569
+ const argument = this.registeredArguments[index];
12570
+ this.pendingInputs.push({
12571
+ kind: "argument",
12572
+ name,
12573
+ index,
12574
+ description: argument?.description ?? "",
12575
+ variadic: Boolean(argument?.variadic)
12576
+ });
12577
+ }
12578
+ missingMandatoryOptionValue(option) {
12579
+ if (!this.mayPrompt()) {
12580
+ commanderOriginal.missingMandatoryOptionValue.call(this, option);
12581
+ return;
12582
+ }
12583
+ this.pendingInputs.push({
12584
+ kind: "option",
12585
+ name: option.attributeName(),
12586
+ flag: option.long ?? option.flags,
12587
+ description: option.description ?? "",
12588
+ variadic: Boolean(option.variadic)
12589
+ });
12590
+ }
12591
+ /** The environment set on the program. */
12592
+ environment() {
12593
+ let root = this;
12594
+ while (root.parent) root = root.parent;
12595
+ return root instanceof _DiafuncCommand ? root.promptEnvironment : {};
12596
+ }
12597
+ mayPrompt() {
12598
+ const forced = this.environment().interactive;
12599
+ if (forced !== void 0) return forced;
12600
+ const globals = this.optsWithGlobals();
12601
+ const output = globals.output ?? loadConfig().defaults.output ?? "human";
12602
+ return canPrompt(output, globals.interactive === false);
12603
+ }
12604
+ };
12605
+
12606
+ // src/commands/deployment/index.ts
12607
+ var MAX_ROWS_PER_CALL = 1e3;
12608
+ var RETENTION_DAYS = [30, 90, 180];
12609
+ var WINDOWS = ["7d", "30d"];
12610
+ var NOT_ENOUGH_CREDITS = "Not enough credits. Each prediction costs credits.";
12611
+ var CREDITS_HINT = `See your credits with 'diafunc utilization'.`;
12612
+ function getOutputFormat20(cmd) {
12613
+ const config = loadConfig();
12614
+ const globalOpts = cmd.optsWithGlobals();
12615
+ return globalOpts.output ?? config.defaults.output ?? "human";
12616
+ }
12617
+ function prompterFor(cmd) {
12618
+ const env = cmd instanceof DiafuncCommand ? cmd.environment() : {};
12619
+ const globals = cmd.optsWithGlobals();
12620
+ const interactive = env.interactive ?? canPrompt(getOutputFormat20(cmd), globals.interactive === false);
12621
+ return interactive ? env.prompter ?? createInquirerPrompter() : null;
12622
+ }
12623
+ async function confirmStep(cmd, question2, yes, refusal) {
12624
+ if (yes || isDryRun()) return true;
12625
+ const prompter = prompterFor(cmd);
12626
+ if (!prompter) throw new CliError(refusal, { exitCode: EXIT_USAGE, hint: "Add --yes to go ahead without being asked." });
12627
+ return prompter.confirm({ message: question2, default: false });
12628
+ }
12629
+ function words(code) {
12630
+ return code ? code.replace(/_/g, " ") : null;
12631
+ }
12632
+ function num(value) {
12633
+ if (value === null || value === void 0 || !Number.isFinite(value)) return ABSENT;
12634
+ if (Number.isInteger(value)) return value.toLocaleString("en-US");
12635
+ const abs = Math.abs(value);
12636
+ if (abs >= 1e3) return Math.round(value).toLocaleString("en-US");
12637
+ if (abs >= 1e-3) return String(Number(value.toPrecision(4)));
12638
+ return value.toPrecision(3);
12639
+ }
12640
+ function percent2(share) {
12641
+ if (share === null || share === void 0 || !Number.isFinite(share)) return ABSENT;
12642
+ const p = share * 100;
12643
+ return `${p >= 10 || Number.isInteger(p) ? Math.round(p) : p.toFixed(1)}%`;
12644
+ }
12645
+ function day(value) {
12646
+ if (value === null || value === void 0 || value === "") return null;
12647
+ const date = new Date(typeof value === "number" && value < 1e11 ? value * 1e3 : value);
12648
+ return Number.isNaN(date.getTime()) ? null : date.toISOString().slice(0, 10);
12649
+ }
12650
+ function shortRun(id) {
12651
+ return id.length > 8 ? `${id.slice(0, 8)}\u2026` : id;
12652
+ }
12653
+ function modelWords(version, at) {
12654
+ const when2 = day(at);
12655
+ if (when2 && version) return `the model of the run of ${when2} (run ${shortRun(version)})`;
12656
+ if (when2) return `the model of the run of ${when2}`;
12657
+ if (version) return `the model of run ${shortRun(version)}`;
12658
+ return null;
12659
+ }
12660
+ function count(n) {
12661
+ return n.toLocaleString("en-US");
12662
+ }
12663
+ function onOff(value) {
12664
+ return value ? "on" : "off";
12665
+ }
12666
+ function parseOnOff(flag, value) {
12667
+ if (value === void 0) return void 0;
12668
+ const v = value.trim().toLowerCase();
12669
+ if (v === "on" || v === "true") return true;
12670
+ if (v === "off" || v === "false") return false;
12671
+ throw new CliError(`${flag} takes on or off, not "${value}".`, { exitCode: EXIT_USAGE });
12672
+ }
12673
+ function parseRetention(value) {
12674
+ if (value === void 0) return void 0;
12675
+ const days = Number(value.trim());
12676
+ if (!RETENTION_DAYS.includes(days)) {
12677
+ throw new CliError(`--retention takes ${RETENTION_DAYS.join(", ")} (days), not "${value}".`, { exitCode: EXIT_USAGE });
12678
+ }
12679
+ return days;
12680
+ }
12681
+ function parseWindow(value) {
12682
+ const w = (value ?? "7d").trim().toLowerCase();
12683
+ if (!WINDOWS.includes(w)) {
12684
+ throw new CliError(`--window takes 7d or 30d, not "${value}".`, { exitCode: EXIT_USAGE });
12685
+ }
12686
+ return w;
12687
+ }
12688
+ function settingsFrom(options) {
12689
+ const request = {};
12690
+ if (options.name !== void 0) {
12691
+ if (options.name.trim() === "") throw new CliError("--name cannot be empty.", { exitCode: EXIT_USAGE });
12692
+ request.name = options.name;
12693
+ }
12694
+ const logInputs = parseOnOff("--log-inputs", options.logInputs);
12695
+ if (logInputs !== void 0) request.logInputs = logInputs;
12696
+ const retention = parseRetention(options.retention);
12697
+ if (retention !== void 0) request.retentionDays = retention;
12698
+ const mailAlerts = parseOnOff("--mail-alerts", options.mailAlerts);
12699
+ if (mailAlerts !== void 0) request.mailAlerts = mailAlerts;
12700
+ if (Object.keys(request).length === 0) {
12701
+ throw new CliError("Nothing to change.", {
12702
+ exitCode: EXIT_USAGE,
12703
+ hint: "Give at least one of --name, --log-inputs on|off, --retention 30|90|180, --mail-alerts on|off."
12704
+ });
12705
+ }
12706
+ return request;
12707
+ }
12708
+ function parseInputs(pairs) {
12709
+ const inputs = {};
12710
+ for (const pair of pairs) {
12711
+ const at = pair.indexOf("=");
12712
+ const key = at < 0 ? "" : pair.slice(0, at).trim();
12713
+ if (at < 0 || key === "") {
12714
+ throw new CliError(`--input takes name=value, not "${pair}".`, { exitCode: EXIT_USAGE });
12715
+ }
12716
+ if (Object.prototype.hasOwnProperty.call(inputs, key)) {
12717
+ throw new CliError(`Input ${key} is given twice.`, { exitCode: EXIT_USAGE });
12718
+ }
12719
+ inputs[key] = pair.slice(at + 1).trim();
12720
+ }
12721
+ return inputs;
12722
+ }
12723
+ function predictRequestsFrom(table, inputKeys, options = {}) {
12724
+ if (table.rows.length === 0) throw new CliError("The file has no rows to predict.");
12725
+ const referenceIndex = options.referenceColumn === void 0 ? -1 : table.header.indexOf(options.referenceColumn);
12726
+ if (options.referenceColumn !== void 0 && referenceIndex < 0) {
12727
+ throw new CliError(`The file has no column ${options.referenceColumn} for --reference.`, {
12728
+ hint: `Its columns are: ${table.header.join(", ")}.`
12729
+ });
12730
+ }
12731
+ const keys = inputKeys && inputKeys.length > 0 ? inputKeys : table.header.filter((_, i) => i !== referenceIndex);
12732
+ const missing = keys.filter((k) => !table.header.includes(k));
12733
+ if (missing.length > 0) {
12734
+ throw new CliError(`The file has no column for the input${missing.length > 1 ? "s" : ""} ${missing.join(", ")}.`, {
12735
+ hint: `The deployment reads ${keys.join(", ")}.`
12736
+ });
12737
+ }
12738
+ const indexOf = new Map(keys.map((k) => [k, table.header.indexOf(k)]));
12739
+ return table.rows.map((row) => {
12740
+ const inputs = {};
12741
+ for (const [key, index] of indexOf) {
12742
+ const value = row[index].trim();
12743
+ if (value !== "") inputs[key] = value;
12744
+ }
12745
+ const request = { inputs };
12746
+ if (referenceIndex >= 0 && row[referenceIndex].trim() !== "") request.reference = row[referenceIndex].trim();
12747
+ if (options.store === false) request.store = false;
12748
+ return request;
12749
+ });
12750
+ }
12751
+ var RESULT_HEADER = ["row", "reference", "prediction", "lower", "upper", "outOfRange", "predictionId", "error"];
12752
+ function resultFields(row, answer) {
12753
+ const outOfRange = (answer?.checks?.inputs ?? []).map((c) => c.input).join(";");
12754
+ return [
12755
+ row,
12756
+ answer?.reference ?? null,
12757
+ answer?.prediction ?? answer?.classLabel ?? null,
12758
+ answer?.confidence?.lower ?? null,
12759
+ answer?.confidence?.upper ?? null,
12760
+ outOfRange,
12761
+ answer?.predictionId ?? null,
12762
+ answer === void 0 ? "no answer for this row" : answer.error ?? null
12763
+ ];
12764
+ }
12765
+ function columnIndex(header, name) {
12766
+ const norm = (s) => s.toLowerCase().replace(/[_\s-]/g, "");
12767
+ return header.findIndex((h) => norm(h) === norm(name));
12768
+ }
12769
+ function parseOutcomeValue(value, where) {
12770
+ const text2 = value.trim();
12771
+ if (text2 === "") throw new CliError(`${where}: the outcome is empty.`, { exitCode: EXIT_USAGE });
12772
+ const number = Number(text2);
12773
+ return Number.isFinite(number) ? number : text2;
12774
+ }
12775
+ function outcomesFrom(table) {
12776
+ const actualIndex = columnIndex(table.header, "actual");
12777
+ const idIndex = columnIndex(table.header, "predictionId");
12778
+ const referenceIndex = columnIndex(table.header, "reference");
12779
+ if (actualIndex < 0 || idIndex < 0 && referenceIndex < 0) {
12780
+ throw new CliError("The file needs an actual column and a predictionId or reference column.", {
12781
+ hint: `Its columns are: ${table.header.join(", ") || "none"}.`
12782
+ });
12783
+ }
12784
+ const outcomes = [];
12785
+ let skipped = 0;
12786
+ table.rows.forEach((row, i) => {
12787
+ const line = `Line ${table.lines[i] ?? i + 2}`;
12788
+ if (row[actualIndex].trim() === "") {
12789
+ skipped++;
12790
+ return;
12791
+ }
12792
+ const actual = parseOutcomeValue(row[actualIndex], line);
12793
+ const predictionId = idIndex >= 0 ? row[idIndex].trim() : "";
12794
+ const reference = referenceIndex >= 0 ? row[referenceIndex].trim() : "";
12795
+ if (predictionId !== "") outcomes.push({ predictionId, actual });
12796
+ else if (reference !== "") outcomes.push({ reference, actual });
12797
+ else throw new CliError(`${line}: no prediction id and no reference.`, { exitCode: EXIT_USAGE });
12798
+ });
12799
+ if (outcomes.length === 0) throw new CliError("The file has no rows with an outcome in its actual column.");
12800
+ return { outcomes, skipped };
12801
+ }
12802
+ function readTable(file) {
12803
+ let text2;
12804
+ try {
12805
+ text2 = fs13.readFileSync(file, "utf8");
12806
+ } catch (error) {
12807
+ throw new CliError(`Could not read ${file}: ${error.message}`);
12808
+ }
12809
+ return parseCsv(text2);
12810
+ }
12811
+ function deploymentNotFound(error, deploymentId, predictionId) {
12812
+ if (!(error instanceof ApiError) || error.status !== 404) return error;
12813
+ if (predictionId !== void 0) {
12814
+ return new CliError(`No prediction ${predictionId} in deployment ${deploymentId}, or no such deployment.`, {
12815
+ hint: `List your deployments with 'diafunc deployment list'.`
12816
+ });
12817
+ }
12818
+ return new CliError(`No deployment ${deploymentId} in your account.`, {
12819
+ hint: `List your deployments with 'diafunc deployment list'.`
12820
+ });
12821
+ }
12822
+ function isNotEnoughCredits(error) {
12823
+ return error instanceof ApiError && error.status === 402;
12824
+ }
12825
+ function checkWords(check) {
12826
+ const range = check.observedMin !== null && check.observedMin !== void 0 && check.observedMax !== null && check.observedMax !== void 0 ? ` (observed ${num(check.observedMin)} to ${num(check.observedMax)})` : "";
12827
+ const value = check.value === null || check.value === void 0 ? "" : ` = ${String(check.value)}`;
12828
+ switch (check.kind) {
12829
+ case "below_range":
12830
+ return `${check.input}${value}, below the observed range${range}`;
12831
+ case "above_range":
12832
+ return `${check.input}${value}, above the observed range${range}`;
12833
+ case "unseen_level":
12834
+ return `${check.input}${value}, a level the model was not found on`;
12835
+ case "missing":
12836
+ return `${check.input}, not sent or not readable`;
12837
+ default:
12838
+ return `${check.input}${value}, ${words(check.kind)}`;
12839
+ }
12840
+ }
12841
+ function predictionLines(deploymentId, answer) {
12842
+ const lines = [];
12843
+ const value = answer.prediction ?? answer.classLabel;
12844
+ const target = answer.target ? `${answer.target}: ` : "";
12845
+ lines.push(`${target}${value === null || value === void 0 ? ABSENT : typeof value === "number" ? num(value) : value}`);
12846
+ const c = answer.confidence;
12847
+ if (c && c.lower !== null && c.lower !== void 0 && c.upper !== null && c.upper !== void 0) {
12848
+ const level = c.level ? `${percent2(c.level)} ` : "";
12849
+ const expected = c.expectedCoverage ? `, expected to hold ${percent2(c.expectedCoverage)} of new rows` : "";
12850
+ lines.push(`${level}interval ${num(c.lower)} to ${num(c.upper)}${expected}`);
12851
+ }
12852
+ const checks = answer.checks;
12853
+ if (checks && !checks.withinRange) {
12854
+ for (const check of checks.inputs ?? []) lines.push(`Outside what the model was found on: ${checkWords(check)}`);
12855
+ }
12856
+ if (checks?.distance !== null && checks?.distance !== void 0 && checks.distanceLine !== null && checks.distanceLine !== void 0 && checks.distance > checks.distanceLine) {
12857
+ lines.push("The row lies farther from the training rows than 99 of 100 training rows do.");
12858
+ }
12859
+ if (answer.predictionId) {
12860
+ lines.push(`Prediction id ${answer.predictionId}`);
12861
+ lines.push(`Record its outcome with 'diafunc deployment outcomes ${deploymentId} --prediction ${answer.predictionId} --actual <value>'.`);
12862
+ }
12863
+ return lines;
12864
+ }
12865
+ function inputRow(i) {
12866
+ return {
12867
+ input: i.input === "@prediction" ? "(predictions)" : i.input,
12868
+ state: words(i.state),
12869
+ psi: i.psi === null || i.psi === void 0 ? null : num(i.psi),
12870
+ outOfRange: i.outOfRange > 0 ? `${count(i.outOfRange)} (${percent2(i.outOfRangeShare)})` : "0",
12871
+ missing: i.missing,
12872
+ counted: i.counted
12873
+ };
12874
+ }
12875
+ function monitoringSummary(deploymentId, report) {
12876
+ const verdict = report.health ? [report.health.title, ...report.health.reasons ?? []] : ["No verdict yet: the first daily check has not run."];
12877
+ const outside = report.outOfRangeShare === null || report.outOfRangeShare === void 0 ? "" : `, ${percent2(report.outOfRangeShare)} with an input outside the observed range`;
12878
+ const traffic = `${count(report.predictions)} predictions, ${count(report.failed)} failed${outside}.`;
12879
+ const quality = [];
12880
+ const q = report.quality;
12881
+ if (!q || q.scored === 0) {
12882
+ quality.push(`No outcomes recorded in this window. Record them with 'diafunc deployment outcomes ${deploymentId}'.`);
12883
+ } else {
12884
+ const reportRange = q.reportQualityLow !== null && q.reportQualityLow !== void 0 && q.reportQualityHigh !== null && q.reportQualityHigh !== void 0 ? `, from ${num(q.reportQualityLow)} to ${num(q.reportQualityHigh)}` : "";
12885
+ if (q.classification && q.accuracy !== null && q.accuracy !== void 0) {
12886
+ quality.push(`Accuracy ${percent2(q.accuracy)} on ${count(q.scored)} predictions with an outcome: the share whose recorded label matches the predicted one.`);
12887
+ }
12888
+ if (!q.classification || q.quality !== null && q.quality !== void 0) {
12889
+ quality.push(`Quality ${num(q.quality)} on ${count(q.scored)} predictions with an outcome; the report has ${num(q.reportQuality)}${reportRange}.`);
12890
+ }
12891
+ if (q.error !== null && q.error !== void 0) {
12892
+ quality.push(`Error ${num(q.error)} (report ${num(q.reportError)}), mean absolute error ${num(q.mae)}.`);
12893
+ }
12894
+ if (!q.graded) quality.push("Not graded yet: grading starts at 30 predictions with an outcome.");
12895
+ if (q.withInterval > 0) {
12896
+ quality.push(`${count(q.inInterval)} of ${count(q.withInterval)} outcomes lay inside their prediction's interval (${percent2(q.coverage)}); the report expects ${percent2(q.expectedCoverage)}.`);
12897
+ }
12898
+ }
12899
+ const model = [];
12900
+ const m = report.model;
12901
+ if (m) {
12902
+ const served = modelWords(m.servedVersion, m.servedAt) ?? "the model it was made with";
12903
+ model.push(`Serves ${served}${m.servedQuality !== null && m.servedQuality !== void 0 ? `, quality ${num(m.servedQuality)} in its report` : ""}.`);
12904
+ if (m.newerAvailable) {
12905
+ const newer = modelWords(m.newerVersion, m.newerAt) ?? "the model of a newer run";
12906
+ model.push(`The analysis has a newer model: ${newer}${m.newerQuality !== null && m.newerQuality !== void 0 ? `, quality ${num(m.newerQuality)} in its report` : ""}.`);
12907
+ model.push(`Serve it with 'diafunc deployment serve-newest ${deploymentId}'.`);
12908
+ }
12909
+ }
12910
+ const u = report.usage;
12911
+ const usage = u ? `${count(u.predictions)} predictions this month, ${num(u.credits)} credits (${num(u.creditsPerPrediction)} per prediction).` : null;
12912
+ const s = report.settings;
12913
+ const settings = s ? `Input storage ${onOff(s.logInputs)}${s.logInputs && s.retentionDays ? ` (kept ${s.retentionDays} days)` : ""}, mail alerts ${onOff(s.mailAlerts)}.` : null;
12914
+ return { verdict, traffic, quality, model, usage, settings };
12915
+ }
12916
+ async function listDeployments(cmd) {
12917
+ const outputFormat = getOutputFormat20(cmd);
12918
+ const deployments = await createApiClient().deployments.list();
12919
+ if (outputFormat === "json") {
12920
+ format(deployments, { format: outputFormat });
12921
+ return;
12922
+ }
12923
+ if (deployments.length === 0 && outputFormat === "human") {
12924
+ empty("deployments");
12925
+ hint(`Deploy a finished analysis with 'diafunc deployment create --analysis <id> --target <column>'.`);
12926
+ return;
12927
+ }
12928
+ format(deployments.map((d) => ({
12929
+ deploymentId: d.deploymentId,
12930
+ name: d.name,
12931
+ target: d.target,
12932
+ health: words(d.health),
12933
+ status: d.status ? d.status.toLowerCase() : null,
12934
+ createdAt: d.createdAt
12935
+ })), {
12936
+ format: outputFormat,
12937
+ columns: [
12938
+ { key: "deploymentId", header: "id", kind: "id" },
12939
+ { key: "name" },
12940
+ { key: "target" },
12941
+ { key: "health" },
12942
+ { key: "status", kind: "state" },
12943
+ { key: "createdAt", header: "created", kind: "date" }
12944
+ ]
12945
+ });
12946
+ }
12947
+ function printDeployment(deployment, outputFormat) {
12948
+ if (outputFormat === "json") {
12949
+ format(deployment, { format: outputFormat });
12950
+ return;
12951
+ }
12952
+ format({
12953
+ deploymentId: deployment.deploymentId,
12954
+ name: deployment.name,
12955
+ target: deployment.target,
12956
+ analysisId: deployment.analysisId,
12957
+ formula: deployment.formula,
12958
+ inputs: (deployment.inputKeys ?? []).join(", "),
12959
+ status: deployment.status ? deployment.status.toLowerCase() : null,
12960
+ health: words(deployment.health),
12961
+ model: modelWords(deployment.modelVersion, deployment.modelVersionAt),
12962
+ logInputs: onOff(deployment.logInputs) + (deployment.logInputs && deployment.retentionDays ? `, kept ${deployment.retentionDays} days` : ""),
12963
+ mailAlerts: onOff(deployment.mailAlerts),
12964
+ createdAt: deployment.createdAt
12965
+ }, {
12966
+ format: outputFormat,
12967
+ columns: [
12968
+ { key: "deploymentId", header: "ID", kind: "id" },
12969
+ { key: "name", header: "Name" },
12970
+ { key: "target", header: "Target" },
12971
+ { key: "analysisId", header: "Analysis", kind: "id" },
12972
+ { key: "formula", header: "Formula" },
12973
+ { key: "inputs", header: "Inputs" },
12974
+ { key: "status", header: "Status", kind: "state" },
12975
+ { key: "health", header: "Health" },
12976
+ { key: "model", header: "Model" },
12977
+ { key: "logInputs", header: "Input storage" },
12978
+ { key: "mailAlerts", header: "Mail alerts" },
12979
+ { key: "createdAt", header: "Created", kind: "date" }
12980
+ ]
12981
+ });
12982
+ if (outputFormat === "human" && (deployment.inputRanges ?? []).length > 0) {
12983
+ heading("Inputs on the rows the model was found on");
12984
+ for (const r of deployment.inputRanges ?? []) {
12985
+ detail(r.kind === "categorical" ? `${r.input}: ${(r.levels ?? []).join(", ") || ABSENT}` : `${r.input}: ${num(r.min)} to ${num(r.max)}, median ${num(r.median)}`);
12986
+ }
12987
+ }
12988
+ }
12989
+ async function predictOne(deploymentId, options, cmd) {
12990
+ const outputFormat = getOutputFormat20(cmd);
12991
+ const request = { inputs: parseInputs(options.input ?? []) };
12992
+ if (options.reference !== void 0) request.reference = options.reference;
12993
+ if (options.store === false) request.store = false;
12994
+ let answer;
12995
+ try {
12996
+ answer = await createApiClient().deployments.predict(deploymentId, request);
12997
+ } catch (error) {
12998
+ if (isNotEnoughCredits(error)) throw new CliError(NOT_ENOUGH_CREDITS, { hint: CREDITS_HINT });
12999
+ throw error;
13000
+ }
13001
+ if (isDryRun()) return;
13002
+ if (outputFormat !== "human") {
13003
+ format(answer, { format: outputFormat });
13004
+ return;
13005
+ }
13006
+ const [first, ...rest] = predictionLines(deploymentId, answer);
13007
+ console.log(first);
13008
+ for (const line of rest) {
13009
+ if (line.startsWith("Outside") || line.startsWith("The row lies")) warn(line);
13010
+ else detail(line);
13011
+ }
13012
+ }
13013
+ function resultSink(out) {
13014
+ if (out) {
13015
+ fs13.writeFileSync(out, "");
13016
+ return (line) => fs13.appendFileSync(out, `${line}
13017
+ `);
13018
+ }
13019
+ return (line) => {
13020
+ process.stdout.write(`${line}
13021
+ `);
13022
+ };
13023
+ }
13024
+ async function predictFile(deploymentId, options, cmd) {
13025
+ const outputFormat = getOutputFormat20(cmd);
13026
+ const api = createApiClient();
13027
+ const deployment = await api.deployments.get(deploymentId);
13028
+ const table = readTable(options.file);
13029
+ const requests = predictRequestsFrom(table, deployment.inputKeys, {
13030
+ referenceColumn: options.reference,
13031
+ store: options.store
13032
+ });
13033
+ const rows = requests.length;
13034
+ const note = (line) => console.error(chalk30.dim(line));
13035
+ note(`${options.file}: ${count(rows)} row${rows === 1 ? "" : "s"} for ${deployment.name}. Each prediction costs credits; rows that cannot be predicted are not charged.`);
13036
+ if (!options.yes && !isDryRun() && prompterFor(cmd)) {
13037
+ try {
13038
+ const usage = (await api.deployments.monitoring(deploymentId, "7d")).usage;
13039
+ if (usage) note(`One prediction costs ${num(usage.creditsPerPrediction)} credits; ${count(rows)} cost ${num(usage.creditsPerPrediction * rows)}.`);
13040
+ } catch (error) {
13041
+ if (!(error instanceof ApiError)) throw error;
13042
+ }
13043
+ }
13044
+ const go = await confirmStep(
13045
+ cmd,
13046
+ `Predict ${count(rows)} rows?`,
13047
+ options.yes,
13048
+ `${count(rows)} predictions cost credits, so this run needs a confirmation.`
13049
+ );
13050
+ if (!go) {
13051
+ warn("Nothing was sent.");
13052
+ return;
13053
+ }
13054
+ const json = outputFormat === "json";
13055
+ const collected = [];
13056
+ const write2 = json ? null : resultSink(options.out);
13057
+ write2?.(csvLine([...RESULT_HEADER]));
13058
+ let sent = 0;
13059
+ let predicted = 0;
13060
+ let failed = 0;
13061
+ const pieces = chunks(requests, MAX_ROWS_PER_CALL);
13062
+ for (const piece of pieces) {
13063
+ let response;
13064
+ try {
13065
+ response = await api.deployments.predictBatch(deploymentId, { rows: piece });
13066
+ } catch (error) {
13067
+ if (json) formatJson(collected);
13068
+ if (sent > 0) {
13069
+ warn(`${count(sent)} of ${count(rows)} rows were sent before this; their results are written. The other ${count(rows - sent)} were not sent.`);
13070
+ }
13071
+ if (isNotEnoughCredits(error)) throw new CliError(NOT_ENOUGH_CREDITS, { hint: CREDITS_HINT });
13072
+ throw error;
13073
+ }
13074
+ if (isDryRun()) {
13075
+ sent += piece.length;
13076
+ continue;
13077
+ }
13078
+ const answers = response.predictions ?? [];
13079
+ piece.forEach((_, i) => {
13080
+ const row = sent + i + 1;
13081
+ const answer = answers[i];
13082
+ if (json) collected.push({ row, ...answer ?? { error: "no answer for this row" } });
13083
+ else write2(csvLine(resultFields(row, answer)));
13084
+ });
13085
+ predicted += response.predicted ?? answers.filter((a) => !a.error).length;
13086
+ failed += response.failed ?? answers.filter((a) => a.error).length;
13087
+ sent += piece.length;
13088
+ if (pieces.length > 1) note(`Sent ${count(sent)} of ${count(rows)} rows.`);
13089
+ }
13090
+ if (isDryRun()) return;
13091
+ if (json) formatJson(collected);
13092
+ const where = options.out ? ` Results are in ${options.out}.` : "";
13093
+ const failures = failed > 0 ? ` ${count(failed)} ${failed === 1 ? "row" : "rows"} could not be predicted and ${failed === 1 ? "was" : "were"} not charged; the error column says why.` : "";
13094
+ console.error(`${chalk30.green("\u2713")} Predicted ${count(predicted)} of ${count(rows)} rows.${failures}${where}`);
13095
+ }
13096
+ async function recordOutcomes(deploymentId, options, cmd) {
13097
+ const outputFormat = getOutputFormat20(cmd);
13098
+ let outcomes;
13099
+ let skipped = 0;
13100
+ if (options.file !== void 0) {
13101
+ if (options.prediction !== void 0 || options.reference !== void 0 || options.actual !== void 0) {
13102
+ throw new CliError("--file goes alone; --prediction, --reference and --actual are for one outcome.", { exitCode: EXIT_USAGE });
13103
+ }
13104
+ ({ outcomes, skipped } = outcomesFrom(readTable(options.file)));
13105
+ } else {
13106
+ if (options.actual === void 0 || options.prediction === void 0 === (options.reference === void 0)) {
13107
+ throw new CliError("Name one prediction and its outcome.", {
13108
+ exitCode: EXIT_USAGE,
13109
+ hint: "Use --prediction <predictionId> (or --reference <reference>) with --actual <value>, or --file outcomes.csv."
13110
+ });
13111
+ }
13112
+ const actual = parseOutcomeValue(options.actual, "--actual");
13113
+ outcomes = [options.prediction !== void 0 ? { predictionId: options.prediction, actual } : { reference: options.reference, actual }];
13114
+ }
13115
+ const api = createApiClient();
13116
+ let recorded = 0;
13117
+ const notFound = [];
13118
+ for (const piece of chunks(outcomes, MAX_ROWS_PER_CALL)) {
13119
+ const response = await api.deployments.recordOutcomes(deploymentId, { outcomes: piece });
13120
+ if (isDryRun()) continue;
13121
+ recorded += response.recorded ?? 0;
13122
+ notFound.push(...response.notFound ?? []);
13123
+ }
13124
+ if (isDryRun()) return;
13125
+ if (outputFormat !== "human") {
13126
+ format({ recorded, notFound, skipped }, { format: outputFormat });
13127
+ return;
13128
+ }
13129
+ success(`Recorded ${count(recorded)} outcome${recorded === 1 ? "" : "s"}.`);
13130
+ if (skipped > 0) detail(`${count(skipped)} row${skipped === 1 ? " with an empty actual column was" : "s with an empty actual column were"} skipped.`);
13131
+ if (notFound.length > 0) {
13132
+ warn(`${count(notFound.length)} named no prediction of this deployment:`);
13133
+ for (const name of notFound.slice(0, 20)) detail(name);
13134
+ if (notFound.length > 20) detail(`and ${count(notFound.length - 20)} more (see them all with --output json).`);
13135
+ }
13136
+ }
13137
+ async function monitor(deploymentId, options, cmd) {
13138
+ const outputFormat = getOutputFormat20(cmd);
13139
+ const window = parseWindow(options.window);
13140
+ const report = await createApiClient().deployments.monitoring(deploymentId, window);
13141
+ if (outputFormat === "json") {
13142
+ format(report, { format: outputFormat });
13143
+ return;
13144
+ }
13145
+ const inputs = [...report.inputs ?? [], ...report.prediction ? [report.prediction] : []];
13146
+ const columns = [
13147
+ { key: "input" },
13148
+ { key: "state" },
13149
+ { key: "psi", header: "PSI" },
13150
+ { key: "outOfRange", header: "outside range" },
13151
+ { key: "missing", kind: "number" },
13152
+ { key: "counted", kind: "number" }
13153
+ ];
13154
+ if (outputFormat === "table") {
13155
+ format(inputs.map(inputRow), { format: outputFormat, columns });
13156
+ return;
13157
+ }
13158
+ const summary = monitoringSummary(deploymentId, report);
13159
+ console.log(chalk30.bold(`${report.name}`) + chalk30.dim(` (target ${report.target}), last ${report.windowDays} days`));
13160
+ heading("Verdict");
13161
+ const [title, ...reasons] = summary.verdict;
13162
+ console.log(` ${title}`);
13163
+ for (const reason2 of reasons) detail(reason2);
13164
+ heading("Traffic");
13165
+ console.log(` ${summary.traffic}`);
13166
+ if (inputs.length > 0) {
13167
+ heading("Inputs against the training rows");
13168
+ format(inputs.map(inputRow), { format: "human", columns });
13169
+ }
13170
+ heading("Quality on outcomes");
13171
+ for (const line of summary.quality) console.log(` ${line}`);
13172
+ if (summary.model.length > 0) {
13173
+ heading("Model");
13174
+ for (const line of summary.model) console.log(` ${line}`);
13175
+ }
13176
+ if (summary.usage) {
13177
+ heading("Usage");
13178
+ console.log(` ${summary.usage}`);
13179
+ }
13180
+ if (summary.settings) {
13181
+ heading("Settings");
13182
+ console.log(` ${summary.settings}`);
13183
+ }
13184
+ }
13185
+ async function serveNewest(deploymentId, options, cmd) {
13186
+ const outputFormat = getOutputFormat20(cmd);
13187
+ const api = createApiClient();
13188
+ const model = (await api.deployments.monitoring(deploymentId, "7d")).model;
13189
+ if (model && !model.newerAvailable) {
13190
+ const served = modelWords(model.servedVersion, model.servedAt);
13191
+ success(
13192
+ `The deployment already serves the newest model${served ? `, ${served}` : ""}.`,
13193
+ { format: outputFormat === "json" ? "json" : void 0 }
13194
+ );
13195
+ return;
13196
+ }
13197
+ if (model && outputFormat === "human") {
13198
+ detail(`Serves ${modelWords(model.servedVersion, model.servedAt) ?? "the model it was made with"}, quality ${num(model.servedQuality)} in its report.`);
13199
+ detail(`Newest: ${modelWords(model.newerVersion, model.newerAt) ?? "the model of a newer run"}, quality ${num(model.newerQuality)} in its report.`);
13200
+ }
13201
+ const go = await confirmStep(
13202
+ cmd,
13203
+ "Serve the newest model? Every prediction from now on uses it.",
13204
+ options.yes,
13205
+ "Serving the newest model changes what every prediction uses, so it needs a confirmation."
13206
+ );
13207
+ if (!go) {
13208
+ warn("Nothing changed; the deployment serves the same model.");
13209
+ return;
13210
+ }
13211
+ const updated = await api.deployments.serveNewestModel(deploymentId);
13212
+ if (isDryRun()) return;
13213
+ if (outputFormat !== "human") {
13214
+ format(updated, { format: outputFormat });
13215
+ return;
13216
+ }
13217
+ success(`Now serving ${modelWords(updated.modelVersion, updated.modelVersionAt) ?? "the newest model"}.`);
13218
+ }
13219
+ function registerDeploymentCommands(program) {
13220
+ const deployment = program.command("deployment").description("Serve a finished analysis's model as a predict endpoint, predict with it, record outcomes and follow its monitoring").addHelpText("after", `
13221
+ Every prediction costs 0.001 credits, monitoring included. Recording outcomes costs nothing.
13222
+
13223
+ Examples:
13224
+ $ diafunc deployment create --analysis <analysisId> --target price
13225
+ $ diafunc deployment predict <deploymentId> --input size=120 --input rooms=4
13226
+ $ diafunc deployment predict <deploymentId> --file rows.csv --reference id --out results.csv
13227
+ $ diafunc deployment outcomes <deploymentId> --file results-with-outcomes.csv
13228
+ $ diafunc deployment monitor <deploymentId> --window 30d
13229
+ $ diafunc deployment set <deploymentId> --log-inputs on --retention 90
13230
+ `);
13231
+ deployment.command("list").description("List your deployments, newest first, with the verdict of each one's latest daily check").action(async (_options, cmd) => {
13232
+ try {
13233
+ await listDeployments(cmd);
13234
+ } catch (error) {
13235
+ handleError(error);
13236
+ }
13237
+ });
13238
+ deployment.command("get").description("Show a deployment: its formula, the inputs it reads and their ranges on the training rows, and its settings").argument("<deploymentId>", "Deployment ID").action(async (deploymentId, _options, cmd) => {
13239
+ try {
13240
+ printDeployment(await createApiClient().deployments.get(deploymentId), getOutputFormat20(cmd));
13241
+ } catch (error) {
13242
+ handleError(deploymentNotFound(error, deploymentId));
13243
+ }
13244
+ });
13245
+ deployment.command("create").description("Deploy the model a finished analysis found for one target").requiredOption("--analysis <analysisId>", "The analysis").requiredOption("--target <column>", "The target column whose model is served").option("--name <name>", "Name of the deployment (default: the analysis name and the target)").action(async (options, cmd) => {
13246
+ try {
13247
+ const created = await createApiClient().deployments.create({
13248
+ analysisId: options.analysis,
13249
+ target: options.target,
13250
+ ...options.name !== void 0 ? { name: options.name } : {}
13251
+ });
13252
+ if (isDryRun()) return;
13253
+ const outputFormat = getOutputFormat20(cmd);
13254
+ if (outputFormat !== "human") {
13255
+ format(created, { format: outputFormat });
13256
+ return;
13257
+ }
13258
+ success(`Deployment ${created.name} created (${created.deploymentId}).`);
13259
+ if ((created.inputKeys ?? []).length > 0) detail(`It reads ${created.inputKeys.join(", ")}.`);
13260
+ hint(`Predict with 'diafunc deployment predict ${created.deploymentId} --input <name>=<value> ...'; each prediction costs credits.`);
13261
+ } catch (error) {
13262
+ handleError(error);
13263
+ }
13264
+ });
13265
+ deployment.command("delete").description("Delete a deployment; its endpoint stops answering").argument("<deploymentId>", "Deployment ID").option("-y, --yes", "Skip confirmation prompt (for CI / scripted use)").action(async (deploymentId, options, cmd) => {
13266
+ try {
13267
+ await confirmDestructive(
13268
+ `This will permanently delete deployment "${deploymentId}"; its endpoint stops answering.`,
13269
+ { yes: options.yes, resourceId: deploymentId }
13270
+ );
13271
+ await createApiClient().deployments.delete(deploymentId);
13272
+ success(`Deployment ${deploymentId} deleted.`, { format: getOutputFormat20(cmd) === "json" ? "json" : void 0 });
13273
+ } catch (error) {
13274
+ handleError(deploymentNotFound(error, deploymentId));
13275
+ }
13276
+ });
13277
+ deployment.command("predict").description("Predict with a deployment, one row from --input or every row of a CSV file. Each prediction costs 0.001 credits").argument("<deploymentId>", "Deployment ID").option(
13278
+ "--input <name=value>",
13279
+ "An input value; repeat for every input (see them with 'deployment get')",
13280
+ (value, previous = []) => previous.concat([value])
13281
+ ).option("--file <path>", "A CSV file with a header row and one row per prediction, sent in calls of 1,000 rows").option("--reference <text>", "Your own reference, to record the outcome by it later. With --file: the column that holds each row's reference").option("--no-store", "Keep the input values of these predictions out of storage, even when the deployment stores inputs").option("--out <file>", "With --file: write the results here instead of to standard output").option("-y, --yes", "With --file: predict without asking first (for CI / scripted use)").addHelpText("after", `
13282
+ Each prediction costs 0.001 credits, monitoring included. A --file run prints the number of rows and asks before
13283
+ sending them; rows the platform cannot predict are not charged. The result is CSV, one line
13284
+ per input row: ${RESULT_HEADER.join(", ")}.
13285
+ Add an actual column with the values that came true and send it back with
13286
+ 'diafunc deployment outcomes <id> --file'.
13287
+ `).action(async (deploymentId, options, cmd) => {
13288
+ try {
13289
+ const hasInputs = (options.input ?? []).length > 0;
13290
+ if (hasInputs === (options.file !== void 0)) {
13291
+ throw new CliError("Give the inputs with --input name=value, or a CSV file with --file, not both.", {
13292
+ exitCode: EXIT_USAGE,
13293
+ hint: `See the inputs the deployment reads with 'diafunc deployment get ${deploymentId}'.`
13294
+ });
13295
+ }
13296
+ if (options.out !== void 0 && options.file === void 0) {
13297
+ throw new CliError("--out goes with --file.", { exitCode: EXIT_USAGE });
13298
+ }
13299
+ if (options.file !== void 0) await predictFile(deploymentId, options, cmd);
13300
+ else await predictOne(deploymentId, options, cmd);
13301
+ } catch (error) {
13302
+ handleError(deploymentNotFound(error, deploymentId));
13303
+ }
13304
+ });
13305
+ deployment.command("outcomes").description("Record outcomes, the values that came true, for earlier predictions, by prediction id or by your reference. Recording costs nothing").argument("<deploymentId>", "Deployment ID").option("--prediction <predictionId>", "The prediction the outcome belongs to").option("--reference <reference>", "Instead of --prediction: the reference you sent with the prediction").option("--actual <value>", "The value that came true: a number, or a class label for a classification deployment").option("--file <path>", "A CSV file with an actual column and a predictionId or reference column, sent in calls of 1,000 rows").action(async (deploymentId, options, cmd) => {
13306
+ try {
13307
+ await recordOutcomes(deploymentId, options, cmd);
13308
+ } catch (error) {
13309
+ handleError(deploymentNotFound(error, deploymentId));
13310
+ }
13311
+ });
13312
+ deployment.command("monitor").description("How a deployment is doing: verdict and reasons, traffic, drift and range per input, quality on outcomes, interval coverage, newer model, usage").argument("<deploymentId>", "Deployment ID").option("--window <window>", "The period the figures cover: 7d or 30d", "7d").action(async (deploymentId, options, cmd) => {
13313
+ try {
13314
+ await monitor(deploymentId, options, cmd);
13315
+ } catch (error) {
13316
+ handleError(deploymentNotFound(error, deploymentId));
13317
+ }
13318
+ });
13319
+ deployment.command("set").description("Change a deployment's name, input storage or mail alerts; what is not given stays as it is").argument("<deploymentId>", "Deployment ID").option("--name <name>", "New name").option("--log-inputs <on|off>", "Store the input values of each prediction").option("--retention <days>", "How long stored input values are kept: 30, 90 or 180 days").option("--mail-alerts <on|off>", "Also send a change of health by mail (the notice in the app is always sent)").action(async (deploymentId, options, cmd) => {
13320
+ try {
13321
+ const request = settingsFrom(options);
13322
+ const updated = await createApiClient().deployments.update(deploymentId, request);
13323
+ if (isDryRun()) return;
13324
+ const outputFormat = getOutputFormat20(cmd);
13325
+ if (outputFormat !== "human") {
13326
+ format(updated, { format: outputFormat });
13327
+ return;
13328
+ }
13329
+ success(`Deployment ${updated.name} updated.`);
13330
+ detail(`Input storage ${onOff(updated.logInputs)}${updated.logInputs && updated.retentionDays ? ` (kept ${updated.retentionDays} days)` : ""}, mail alerts ${onOff(updated.mailAlerts)}.`);
13331
+ } catch (error) {
13332
+ handleError(deploymentNotFound(error, deploymentId));
13333
+ }
13334
+ });
13335
+ deployment.command("serve-newest").description("Serve the newest model the analysis has for the target. Until then a deployment keeps the model it was made with").argument("<deploymentId>", "Deployment ID").option("-y, --yes", "Switch without asking first (for CI / scripted use)").action(async (deploymentId, options, cmd) => {
13336
+ try {
13337
+ await serveNewest(deploymentId, options, cmd);
13338
+ } catch (error) {
13339
+ handleError(deploymentNotFound(error, deploymentId));
13340
+ }
13341
+ });
13342
+ deployment.command("delete-prediction").description("Delete one prediction with its stored input values and its outcome").argument("<deploymentId>", "Deployment ID").argument("<predictionId>", "Prediction ID").option("-y, --yes", "Skip confirmation prompt (for CI / scripted use)").action(async (deploymentId, predictionId, options, cmd) => {
13343
+ try {
13344
+ await confirmDestructive(
13345
+ `This will permanently delete prediction "${predictionId}" with its stored inputs and outcome.`,
13346
+ { yes: options.yes, resourceId: predictionId }
13347
+ );
13348
+ await createApiClient().deployments.deletePrediction(deploymentId, predictionId);
13349
+ success(`Prediction ${predictionId} deleted.`, { format: getOutputFormat20(cmd) === "json" ? "json" : void 0 });
13350
+ } catch (error) {
13351
+ handleError(deploymentNotFound(error, deploymentId, predictionId));
13352
+ }
13353
+ });
13354
+ }
13355
+
12387
13356
  // src/commands/public/index.ts
12388
13357
  var MIN_LIMIT = 1;
12389
13358
  var MAX_LIMIT = 500;
12390
- function getOutputFormat20(cmd) {
13359
+ function getOutputFormat21(cmd) {
12391
13360
  const config = loadConfig();
12392
13361
  const globalOpts = cmd.optsWithGlobals();
12393
13362
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -12439,7 +13408,7 @@ async function readPublicAnalyses(analysis, options) {
12439
13408
  }
12440
13409
  }
12441
13410
  async function listPublicAnalyses(options, cmd) {
12442
- const outputFormat = getOutputFormat20(cmd);
13411
+ const outputFormat = getOutputFormat21(cmd);
12443
13412
  const limit = parseLimit(options.limit);
12444
13413
  const changedSince = options.changedSince === void 0 ? void 0 : parseChangedSince(options.changedSince);
12445
13414
  const api = createApiClient();
@@ -12482,7 +13451,7 @@ function newestRunRecord(run) {
12482
13451
  };
12483
13452
  }
12484
13453
  async function showPublicAnalysis(analysisId, cmd) {
12485
- const outputFormat = getOutputFormat20(cmd);
13454
+ const outputFormat = getOutputFormat21(cmd);
12486
13455
  const api = createApiClient();
12487
13456
  const result = await api.analysis.get(analysisId);
12488
13457
  if (!result?.analysis) {
@@ -12551,8 +13520,8 @@ Examples:
12551
13520
  }
12552
13521
 
12553
13522
  // src/commands/license/index.ts
12554
- import chalk30 from "chalk";
12555
- function getOutputFormat21(cmd) {
13523
+ import chalk31 from "chalk";
13524
+ function getOutputFormat22(cmd) {
12556
13525
  const config = loadConfig();
12557
13526
  const globalOpts = cmd.optsWithGlobals();
12558
13527
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -12613,7 +13582,7 @@ async function catalogEntry(licenseId) {
12613
13582
  return entry;
12614
13583
  }
12615
13584
  function printLicense(license, cmd, verb) {
12616
- const outputFormat = getOutputFormat21(cmd);
13585
+ const outputFormat = getOutputFormat22(cmd);
12617
13586
  if (outputFormat !== "human") {
12618
13587
  format(license, { format: outputFormat });
12619
13588
  return;
@@ -12621,7 +13590,7 @@ function printLicense(license, cmd, verb) {
12621
13590
  success(`License "${license.licenceId}" ${verb} (${stateWord(license.state)}, flags ${licenseMarks(license) ?? "none"}).`);
12622
13591
  }
12623
13592
  async function listCatalog(cmd) {
12624
- const outputFormat = getOutputFormat21(cmd);
13593
+ const outputFormat = getOutputFormat22(cmd);
12625
13594
  const entries = await createApiClient().admin.listLicenseCatalog();
12626
13595
  if (outputFormat === "json") {
12627
13596
  format(entries, { format: outputFormat });
@@ -12653,7 +13622,7 @@ async function listCatalog(cmd) {
12653
13622
  });
12654
13623
  }
12655
13624
  async function listLicenses(cmd) {
12656
- const outputFormat = getOutputFormat21(cmd);
13625
+ const outputFormat = getOutputFormat22(cmd);
12657
13626
  const api = createApiClient();
12658
13627
  const licenses = await api.admin.listLicenses();
12659
13628
  if (outputFormat === "json") {
@@ -12681,14 +13650,14 @@ async function listLicenses(cmd) {
12681
13650
  ]
12682
13651
  });
12683
13652
  if (outputFormat === "human") {
12684
- console.error(chalk30.dim(
13653
+ console.error(chalk31.dim(
12685
13654
  `
12686
13655
  Flags: ${LICENSE_MARKS.map(({ mark, meaning }) => `${mark} ${meaning}`).join(", ")}. A deprecated license stays on the projects that carry it and cannot be chosen.`
12687
13656
  ));
12688
13657
  }
12689
13658
  }
12690
13659
  async function showLicense(licenseId, cmd) {
12691
- const outputFormat = getOutputFormat21(cmd);
13660
+ const outputFormat = getOutputFormat22(cmd);
12692
13661
  const api = createApiClient();
12693
13662
  let license;
12694
13663
  try {
@@ -12848,8 +13817,8 @@ Examples:
12848
13817
  }
12849
13818
 
12850
13819
  // src/commands/data-sources/index.ts
12851
- import chalk31 from "chalk";
12852
- function getOutputFormat22(cmd) {
13820
+ import chalk32 from "chalk";
13821
+ function getOutputFormat23(cmd) {
12853
13822
  const config = loadConfig();
12854
13823
  const globalOpts = cmd.optsWithGlobals();
12855
13824
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -12949,7 +13918,7 @@ function resolveProjectId(cmd) {
12949
13918
  return resolved;
12950
13919
  }
12951
13920
  async function listDataSources(projectId, cmd) {
12952
- const outputFormat = getOutputFormat22(cmd);
13921
+ const outputFormat = getOutputFormat23(cmd);
12953
13922
  const api = createApiClient();
12954
13923
  const sources = await api.storage.listDataSources(projectId);
12955
13924
  if (outputFormat === "human" && sources.length === 0) {
@@ -12970,13 +13939,13 @@ async function listDataSources(projectId, cmd) {
12970
13939
  });
12971
13940
  }
12972
13941
  async function getDataSource(id, cmd) {
12973
- const outputFormat = getOutputFormat22(cmd);
13942
+ const outputFormat = getOutputFormat23(cmd);
12974
13943
  const api = createApiClient();
12975
13944
  const ds = await api.storage.getDataSource(id);
12976
13945
  format(ds, { format: outputFormat });
12977
13946
  }
12978
13947
  async function showDashboard(projectId, cmd) {
12979
- const outputFormat = getOutputFormat22(cmd);
13948
+ const outputFormat = getOutputFormat23(cmd);
12980
13949
  const api = createApiClient();
12981
13950
  const dashboard = await api.storage.getDataSourceDashboard(projectId);
12982
13951
  if (outputFormat !== "human") {
@@ -12984,7 +13953,7 @@ async function showDashboard(projectId, cmd) {
12984
13953
  return;
12985
13954
  }
12986
13955
  const r = dashboard.rollup;
12987
- let line = chalk31.bold(`DataSources in ${projectId}: `) + `${r.totalSources} total, ${r.scheduledSources} scheduled, ${r.sourcesWithRecentFailure} failing recently`;
13956
+ let line = chalk32.bold(`DataSources in ${projectId}: `) + `${r.totalSources} total, ${r.scheduledSources} scheduled, ${r.sourcesWithRecentFailure} failing recently`;
12988
13957
  if (r.lastActivityAt) line += `, last activity ${r.lastActivityAt}`;
12989
13958
  console.log(line);
12990
13959
  if (dashboard.sources.length === 0) {
@@ -13045,14 +14014,14 @@ async function createForAnalysis(api, options, human) {
13045
14014
  if (human) {
13046
14015
  success(`Added ${source.fileName} to analysis ${analysisId} from data source ${source.dataSourceId ?? ""}`.trimEnd());
13047
14016
  for (const line of planLines(build.plan)) {
13048
- console.log(line.caution ? chalk31.yellow(` ${line.text}`) : chalk31.dim(` ${line.text}`));
14017
+ console.log(line.caution ? chalk32.yellow(` ${line.text}`) : chalk32.dim(` ${line.text}`));
13049
14018
  }
13050
- console.log(chalk31.dim(options.scheduleCron ? ` Refreshes ${humanizeCron(options.scheduleCron)}; each refresh replaces the file and builds the data again.` : " No schedule of its own: refresh it with `data-sources refresh`, or let a trigger fetch it before a run (`analyze triggers create --refresh-first`)."));
14019
+ console.log(chalk32.dim(options.scheduleCron ? ` Refreshes ${humanizeCron(options.scheduleCron)}; each refresh replaces the file and builds the data again.` : " No schedule of its own: refresh it with `data-sources refresh`, or let a trigger fetch it before a run (`analyze triggers create --refresh-first`)."));
13051
14020
  }
13052
14021
  return { source, build };
13053
14022
  }
13054
14023
  async function createDataSource(options, cmd) {
13055
- const outputFormat = getOutputFormat22(cmd);
14024
+ const outputFormat = getOutputFormat23(cmd);
13056
14025
  const target = createTarget(options);
13057
14026
  const api = createApiClient();
13058
14027
  if (target === "analysis") {
@@ -13075,14 +14044,14 @@ async function createDataSource(options, cmd) {
13075
14044
  const ds = await api.storage.createDataSource(request);
13076
14045
  if (outputFormat === "human") {
13077
14046
  success(`Created data source ${ds.id}`);
13078
- console.log(chalk31.dim(` Last run: ${ds.lastRunStatus ?? "\u2014"}`));
13079
- if (ds.lastRunError) console.log(chalk31.dim(` Error: ${ds.lastRunError}`));
14047
+ console.log(chalk32.dim(` Last run: ${ds.lastRunStatus ?? "\u2014"}`));
14048
+ if (ds.lastRunError) console.log(chalk32.dim(` Error: ${ds.lastRunError}`));
13080
14049
  } else {
13081
14050
  format(ds, { format: outputFormat });
13082
14051
  }
13083
14052
  }
13084
14053
  async function updateDataSource(id, options, cmd) {
13085
- const outputFormat = getOutputFormat22(cmd);
14054
+ const outputFormat = getOutputFormat23(cmd);
13086
14055
  if (options.name === void 0 && options.type === void 0 && (!options.config || options.config.length === 0) && options.scheduleCron === void 0 && !options.clearSchedule) {
13087
14056
  throw new Error("Provide at least one of --name, --type, --config, --schedule-cron, or --clear-schedule.");
13088
14057
  }
@@ -13117,18 +14086,18 @@ async function deleteDataSource(id) {
13117
14086
  success(`Deleted data source ${id}`);
13118
14087
  }
13119
14088
  async function refreshDataSource(id, cmd) {
13120
- const outputFormat = getOutputFormat22(cmd);
14089
+ const outputFormat = getOutputFormat23(cmd);
13121
14090
  const api = createApiClient();
13122
14091
  const run = await api.storage.refreshDataSource(id);
13123
14092
  if (outputFormat === "human") {
13124
14093
  success(`Refresh queued: run ${run.runId}, status ${run.status}.`);
13125
- if (run.errorMessage) console.log(chalk31.red(` Error: ${run.errorMessage}`));
14094
+ if (run.errorMessage) console.log(chalk32.red(` Error: ${run.errorMessage}`));
13126
14095
  } else {
13127
14096
  format(run, { format: outputFormat });
13128
14097
  }
13129
14098
  }
13130
14099
  async function listRuns2(id, limit, cmd) {
13131
- const outputFormat = getOutputFormat22(cmd);
14100
+ const outputFormat = getOutputFormat23(cmd);
13132
14101
  const api = createApiClient();
13133
14102
  const runs = await api.storage.listDataSourceRuns(id, limit);
13134
14103
  if (outputFormat === "human" && runs.length === 0) {
@@ -13150,13 +14119,13 @@ async function listRuns2(id, limit, cmd) {
13150
14119
  });
13151
14120
  }
13152
14121
  async function getRun(id, runId, cmd) {
13153
- const outputFormat = getOutputFormat22(cmd);
14122
+ const outputFormat = getOutputFormat23(cmd);
13154
14123
  const api = createApiClient();
13155
14124
  const run = await api.storage.getDataSourceRun(id, runId);
13156
14125
  format(run, { format: outputFormat });
13157
14126
  }
13158
14127
  async function listConnectorTypes(cmd) {
13159
- const outputFormat = getOutputFormat22(cmd);
14128
+ const outputFormat = getOutputFormat23(cmd);
13160
14129
  const api = createApiClient();
13161
14130
  const types = await api.storage.listDataSourceConnectorTypes();
13162
14131
  if (outputFormat === "human") {
@@ -13249,8 +14218,8 @@ Examples:
13249
14218
  }
13250
14219
 
13251
14220
  // src/commands/table-exporters/index.ts
13252
- import chalk32 from "chalk";
13253
- function getOutputFormat23(cmd) {
14221
+ import chalk33 from "chalk";
14222
+ function getOutputFormat24(cmd) {
13254
14223
  const config = loadConfig();
13255
14224
  const globalOpts = cmd.optsWithGlobals();
13256
14225
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -13259,7 +14228,7 @@ function registerTableExportersCommands(program) {
13259
14228
  const exporters = program.command("table-exporters").description("Manage user-defined exporters (UDE); admin only");
13260
14229
  exporters.command("list").description("List all registered user-defined exporters").action(async (_options, cmd) => {
13261
14230
  try {
13262
- const outputFormat = getOutputFormat23(cmd);
14231
+ const outputFormat = getOutputFormat24(cmd);
13263
14232
  const api = createApiClient();
13264
14233
  const list = await api.storage.listUserDefinedExporters();
13265
14234
  if (outputFormat === "json") {
@@ -13280,14 +14249,14 @@ function registerTableExportersCommands(program) {
13280
14249
  format: outputFormat,
13281
14250
  columns: ["id", "name", "format", "extension", "mimeType", "priority", "function", "createdBy"]
13282
14251
  });
13283
- console.log(chalk32.dim(`${list.length} exporter(s)`));
14252
+ console.log(chalk33.dim(`${list.length} exporter(s)`));
13284
14253
  } catch (error) {
13285
14254
  handleError(error);
13286
14255
  }
13287
14256
  });
13288
14257
  exporters.command("get").description("Show a single user-defined exporter by id").argument("<id>", "Exporter id").action(async (id, _options, cmd) => {
13289
14258
  try {
13290
- const outputFormat = getOutputFormat23(cmd);
14259
+ const outputFormat = getOutputFormat24(cmd);
13291
14260
  const api = createApiClient();
13292
14261
  const list = await api.storage.listUserDefinedExporters();
13293
14262
  const exporter = list.find((e) => e.id === id);
@@ -13302,7 +14271,7 @@ function registerTableExportersCommands(program) {
13302
14271
  });
13303
14272
  exporters.command("create").description("Register a new user-defined exporter").requiredOption("--name <name>", 'Display name (e.g. "Acme machine instrument export")').requiredOption("--format <token>", 'Format token used in the dispatch URL (e.g. "acme")').requiredOption("--function-project <id>", "Function entity's project id").requiredOption("--function-entity <id>", "Function entity id").option("--description <text>", "Free-form description").option("--extension <ext>", 'Filename extension (must start with ".")').option("--mime-type <mime>", "MIME type the function produces").option("--function-project-branch <branch>", "Function project branch", "main").option("--function-entity-branch <branch>", "Function entity branch", "main").option("--priority <n>", "Dispatch priority (default 50; > 200 overrides built-ins)", "50").action(async (options, cmd) => {
13304
14273
  try {
13305
- const outputFormat = getOutputFormat23(cmd);
14274
+ const outputFormat = getOutputFormat24(cmd);
13306
14275
  const api = createApiClient();
13307
14276
  const payload = {
13308
14277
  name: options.name,
@@ -13338,9 +14307,9 @@ function registerTableExportersCommands(program) {
13338
14307
  }
13339
14308
 
13340
14309
  // src/commands/skeleton/index.ts
13341
- import chalk33 from "chalk";
13342
- import * as fs13 from "fs";
13343
- function getOutputFormat24(cmd) {
14310
+ import chalk34 from "chalk";
14311
+ import * as fs14 from "fs";
14312
+ function getOutputFormat25(cmd) {
13344
14313
  const config = loadConfig();
13345
14314
  const globalOpts = cmd.optsWithGlobals();
13346
14315
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -13363,10 +14332,10 @@ function resolveTemplate(raw) {
13363
14332
  if (!file) {
13364
14333
  throw new Error("--template @ requires a filename after the @, e.g. --template @template.txt");
13365
14334
  }
13366
- if (!fs13.existsSync(file)) {
14335
+ if (!fs14.existsSync(file)) {
13367
14336
  throw new Error(`Template file not found: ${file}`);
13368
14337
  }
13369
- return fs13.readFileSync(file, "utf-8").trim();
14338
+ return fs14.readFileSync(file, "utf-8").trim();
13370
14339
  }
13371
14340
  return raw;
13372
14341
  }
@@ -13389,7 +14358,7 @@ function skeletonTableRow(s) {
13389
14358
  };
13390
14359
  }
13391
14360
  async function createSkeleton(options, cmd) {
13392
- const outputFormat = getOutputFormat24(cmd);
14361
+ const outputFormat = getOutputFormat25(cmd);
13393
14362
  const projectId = resolveProjectId2(cmd);
13394
14363
  const template = resolveTemplate(options.template);
13395
14364
  const weight = parseWeight(options.weight);
@@ -13405,16 +14374,16 @@ async function createSkeleton(options, cmd) {
13405
14374
  const skeleton = await api.storage.createSkeleton(request);
13406
14375
  if (outputFormat === "human") {
13407
14376
  success(`Created skeleton ${skeleton.id}`);
13408
- console.log(chalk33.dim(` name: ${skeleton.name}`));
13409
- console.log(chalk33.dim(` template: ${skeleton.template}`));
13410
- console.log(chalk33.dim(` paramCount: ${skeleton.paramCount}`));
13411
- console.log(chalk33.dim(` weight: ${skeleton.weight}`));
14377
+ console.log(chalk34.dim(` name: ${skeleton.name}`));
14378
+ console.log(chalk34.dim(` template: ${skeleton.template}`));
14379
+ console.log(chalk34.dim(` paramCount: ${skeleton.paramCount}`));
14380
+ console.log(chalk34.dim(` weight: ${skeleton.weight}`));
13412
14381
  } else {
13413
14382
  format(skeleton, { format: outputFormat });
13414
14383
  }
13415
14384
  }
13416
14385
  async function listSkeletons(cmd) {
13417
- const outputFormat = getOutputFormat24(cmd);
14386
+ const outputFormat = getOutputFormat25(cmd);
13418
14387
  const projectId = resolveProjectId2(cmd);
13419
14388
  const api = createApiClient();
13420
14389
  const skeletons = await api.storage.listSkeletons(projectId);
@@ -13428,13 +14397,13 @@ async function listSkeletons(cmd) {
13428
14397
  });
13429
14398
  }
13430
14399
  async function getSkeleton(id, cmd) {
13431
- const outputFormat = getOutputFormat24(cmd);
14400
+ const outputFormat = getOutputFormat25(cmd);
13432
14401
  const api = createApiClient();
13433
14402
  const skeleton = await api.storage.getSkeleton(id);
13434
14403
  format(skeleton, { format: outputFormat });
13435
14404
  }
13436
14405
  async function updateSkeleton(id, options, cmd) {
13437
- const outputFormat = getOutputFormat24(cmd);
14406
+ const outputFormat = getOutputFormat25(cmd);
13438
14407
  if (options.name === void 0 && options.template === void 0 && options.weight === void 0) {
13439
14408
  throw new Error("Provide at least one of --name, --template, --weight.");
13440
14409
  }
@@ -13447,10 +14416,10 @@ async function updateSkeleton(id, options, cmd) {
13447
14416
  const skeleton = await api.storage.updateSkeleton(id, request);
13448
14417
  if (outputFormat === "human") {
13449
14418
  success(`Updated skeleton ${skeleton.id}`);
13450
- console.log(chalk33.dim(` name: ${skeleton.name}`));
13451
- console.log(chalk33.dim(` template: ${skeleton.template}`));
13452
- console.log(chalk33.dim(` paramCount: ${skeleton.paramCount}`));
13453
- console.log(chalk33.dim(` weight: ${skeleton.weight}`));
14419
+ console.log(chalk34.dim(` name: ${skeleton.name}`));
14420
+ console.log(chalk34.dim(` template: ${skeleton.template}`));
14421
+ console.log(chalk34.dim(` paramCount: ${skeleton.paramCount}`));
14422
+ console.log(chalk34.dim(` weight: ${skeleton.weight}`));
13454
14423
  } else {
13455
14424
  format(skeleton, { format: outputFormat });
13456
14425
  }
@@ -13775,7 +14744,7 @@ function registerCompletionCommand(program) {
13775
14744
  }
13776
14745
 
13777
14746
  // src/commands/whoami/index.ts
13778
- import chalk34 from "chalk";
14747
+ import chalk35 from "chalk";
13779
14748
  function registerWhoamiCommand(program) {
13780
14749
  program.command("whoami").description("Show the currently authenticated user").action(async (_options, cmd) => {
13781
14750
  try {
@@ -13785,8 +14754,8 @@ function registerWhoamiCommand(program) {
13785
14754
  const api = createApiClient();
13786
14755
  const user = await api.admin.getMyUser();
13787
14756
  if (outputFormat === "human") {
13788
- console.log(chalk34.bold(user.name) + chalk34.dim(` <${user.email}>`));
13789
- console.log(chalk34.dim(` Role: ${user.role} \xB7 Remaining credits: ${user.remainingCredits} \xB7 Profile: ${config.currentProfile}`));
14757
+ console.log(chalk35.bold(user.name) + chalk35.dim(` <${user.email}>`));
14758
+ console.log(chalk35.dim(` Role: ${user.role} \xB7 Remaining credits: ${user.remainingCredits} \xB7 Profile: ${getActiveProfileName(config)}`));
13790
14759
  } else {
13791
14760
  format(user, { format: outputFormat });
13792
14761
  }
@@ -13797,8 +14766,8 @@ function registerWhoamiCommand(program) {
13797
14766
  }
13798
14767
 
13799
14768
  // src/commands/utilization/index.ts
13800
- import chalk35 from "chalk";
13801
- function getOutputFormat25(cmd) {
14769
+ import chalk36 from "chalk";
14770
+ function getOutputFormat26(cmd) {
13802
14771
  const config = loadConfig();
13803
14772
  const globalOpts = cmd.optsWithGlobals();
13804
14773
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -13814,19 +14783,19 @@ function windowLabel(u) {
13814
14783
  }
13815
14784
  function printUtilizationHuman(u, label) {
13816
14785
  const when2 = windowLabel(u);
13817
- console.log(label ? chalk35.bold(label) + " " + chalk35.dim(when2) : chalk35.bold(when2));
14786
+ console.log(label ? chalk36.bold(label) + " " + chalk36.dim(when2) : chalk36.bold(when2));
13818
14787
  if (u.types.length === 0) {
13819
- console.log(chalk35.dim(" (no usage)"));
14788
+ console.log(chalk36.dim(" (no usage)"));
13820
14789
  return;
13821
14790
  }
13822
14791
  const types = [...u.types].sort((a, b) => b.credits - a.credits);
13823
14792
  const width = Math.max(...types.map((t) => t.type.length));
13824
14793
  for (const t of types) {
13825
- const line = ` ${t.type.padEnd(width)} ${formatNumber(t.quantity).padStart(12)} ${chalk35.dim("credits")} ${t.credits.toFixed(2).padStart(10)}`;
13826
- console.log(t.credits === 0 ? chalk35.dim(line) : line);
14794
+ const line = ` ${t.type.padEnd(width)} ${formatNumber(t.quantity).padStart(12)} ${chalk36.dim("credits")} ${t.credits.toFixed(2).padStart(10)}`;
14795
+ console.log(t.credits === 0 ? chalk36.dim(line) : line);
13827
14796
  }
13828
14797
  const total = u.totalCredits ?? u.types.reduce((s, t) => s + t.credits, 0);
13829
- console.log(chalk35.bold(` ${"Total".padEnd(width)} ${" ".repeat(12)} ${chalk35.dim("credits")} ${total.toFixed(2).padStart(10)}`));
14798
+ console.log(chalk36.bold(` ${"Total".padEnd(width)} ${" ".repeat(12)} ${chalk36.dim("credits")} ${total.toFixed(2).padStart(10)}`));
13830
14799
  }
13831
14800
  function formatDailyHistory(history) {
13832
14801
  const spentOn = (u) => u.dailyCredits ?? u.types.reduce((sum, t) => sum + (t.dailyCredits ?? 0), 0);
@@ -13843,14 +14812,14 @@ function formatDailyHistory(history) {
13843
14812
  for (const u of history) {
13844
14813
  const spent = spentOn(u);
13845
14814
  total += spent;
13846
- const line = `${windowLabel(u).padEnd(width)} ${amount(spent)} ${chalk35.dim("credits")}`;
13847
- lines.push(spent > 0 ? chalk35.bold(line) : chalk35.dim(line));
14815
+ const line = `${windowLabel(u).padEnd(width)} ${amount(spent)} ${chalk36.dim("credits")}`;
14816
+ lines.push(spent > 0 ? chalk36.bold(line) : chalk36.dim(line));
13848
14817
  for (const t of costly(u)) {
13849
14818
  lines.push(` ${t.type.padEnd(width - 2)} ${amount(t.dailyCredits ?? 0)}`);
13850
14819
  }
13851
14820
  }
13852
14821
  lines.push("");
13853
- lines.push(chalk35.bold(`${totalLabel.padEnd(width)} ${amount(total)} ${chalk35.dim("credits")}`));
14822
+ lines.push(chalk36.bold(`${totalLabel.padEnd(width)} ${amount(total)} ${chalk36.dim("credits")}`));
13854
14823
  return lines;
13855
14824
  }
13856
14825
  function registerUtilizationCommand(program) {
@@ -13863,7 +14832,7 @@ Examples:
13863
14832
  `);
13864
14833
  util.command("actual", { isDefault: true }).description("Show current utilization (default subcommand)").action(async (_options, cmd) => {
13865
14834
  try {
13866
- const outputFormat = getOutputFormat25(cmd);
14835
+ const outputFormat = getOutputFormat26(cmd);
13867
14836
  const api = createApiClient();
13868
14837
  const utilization = await api.admin.getActualUtilization();
13869
14838
  if (outputFormat === "human") {
@@ -13877,7 +14846,7 @@ Examples:
13877
14846
  });
13878
14847
  util.command("history").description("Show what each day of the billing cycle cost").action(async (_options, cmd) => {
13879
14848
  try {
13880
- const outputFormat = getOutputFormat25(cmd);
14849
+ const outputFormat = getOutputFormat26(cmd);
13881
14850
  const api = createApiClient();
13882
14851
  const history = await api.admin.getUtilizationHistory();
13883
14852
  if (outputFormat === "human") {
@@ -13898,7 +14867,7 @@ Examples:
13898
14867
  }
13899
14868
 
13900
14869
  // src/commands/entity-branch/index.ts
13901
- function getOutputFormat26(cmd) {
14870
+ function getOutputFormat27(cmd) {
13902
14871
  const config = loadConfig();
13903
14872
  const globalOpts = cmd.optsWithGlobals();
13904
14873
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -13911,7 +14880,7 @@ function registerEntityBranchCommands(program) {
13911
14880
  const eb = program.command("entity-branch").description("Manage entity branches (parallel versions of a single entity)");
13912
14881
  eb.command("list").description("List branches of an entity").argument("<ref>", "Entity reference (projectId/branch/entityId)").action(async (ref, _options, cmd) => {
13913
14882
  try {
13914
- const outputFormat = getOutputFormat26(cmd);
14883
+ const outputFormat = getOutputFormat27(cmd);
13915
14884
  const overrides = getOverrides11(cmd);
13916
14885
  const resolved = parseEntityReference(ref, overrides);
13917
14886
  const api = createApiClient();
@@ -13963,7 +14932,7 @@ function forReader(subscription) {
13963
14932
  Object.entries(subscription).filter(([key]) => !BILLING_INTERNALS.has(key))
13964
14933
  );
13965
14934
  }
13966
- function getOutputFormat27(cmd) {
14935
+ function getOutputFormat28(cmd) {
13967
14936
  const config = loadConfig();
13968
14937
  const globalOpts = cmd.optsWithGlobals();
13969
14938
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -13977,7 +14946,7 @@ Examples:
13977
14946
  sub.command("current", { isDefault: true }).description("Show the current subscription").action(async (_options, cmd) => {
13978
14947
  try {
13979
14948
  const api = createApiClient();
13980
- const outputFormat = getOutputFormat27(cmd);
14949
+ const outputFormat = getOutputFormat28(cmd);
13981
14950
  const s = await api.admin.getCurrentSubscription();
13982
14951
  format(outputFormat === "human" ? forReader(s) : s, { format: outputFormat });
13983
14952
  } catch (error) {
@@ -13987,7 +14956,7 @@ Examples:
13987
14956
  sub.command("next").description("Show the next (upcoming) subscription").action(async (_options, cmd) => {
13988
14957
  try {
13989
14958
  const api = createApiClient();
13990
- const outputFormat = getOutputFormat27(cmd);
14959
+ const outputFormat = getOutputFormat28(cmd);
13991
14960
  const s = await api.admin.getNextSubscription();
13992
14961
  format(outputFormat === "human" ? forReader(s) : s, { format: outputFormat });
13993
14962
  } catch (error) {
@@ -13998,7 +14967,7 @@ Examples:
13998
14967
  try {
13999
14968
  const api = createApiClient();
14000
14969
  const plans = await api.admin.getSubscriptionPlans(subscriptionToken);
14001
- format(plans, { format: getOutputFormat27(cmd) });
14970
+ format(plans, { format: getOutputFormat28(cmd) });
14002
14971
  } catch (error) {
14003
14972
  handleError(error);
14004
14973
  }
@@ -14006,8 +14975,8 @@ Examples:
14006
14975
  }
14007
14976
 
14008
14977
  // src/commands/invoice/index.ts
14009
- import * as fs14 from "fs";
14010
- function getOutputFormat28(cmd) {
14978
+ import * as fs15 from "fs";
14979
+ function getOutputFormat29(cmd) {
14011
14980
  const config = loadConfig();
14012
14981
  const globalOpts = cmd.optsWithGlobals();
14013
14982
  return globalOpts.output ?? config.defaults.output ?? "human";
@@ -14024,7 +14993,7 @@ Examples:
14024
14993
  const api = createApiClient();
14025
14994
  const invoices = await api.admin.getInvoices();
14026
14995
  format(invoices, {
14027
- format: getOutputFormat28(cmd),
14996
+ format: getOutputFormat29(cmd),
14028
14997
  columns: [
14029
14998
  { key: "invoiceNumber", header: "number" },
14030
14999
  { key: "issued", kind: "date" },
@@ -14044,7 +15013,7 @@ Examples:
14044
15013
  const response = await api.admin.downloadInvoice(invoiceNumber, fileName);
14045
15014
  const buffer = Buffer.from(await response.arrayBuffer());
14046
15015
  const outPath = options.out ?? fileName;
14047
- fs14.writeFileSync(outPath, buffer);
15016
+ fs15.writeFileSync(outPath, buffer);
14048
15017
  success(`Invoice saved to ${outPath}`);
14049
15018
  } catch (error) {
14050
15019
  handleError(error);
@@ -14053,8 +15022,8 @@ Examples:
14053
15022
  }
14054
15023
 
14055
15024
  // src/commands/shell/index.ts
14056
- import chalk36 from "chalk";
14057
- import * as fs15 from "fs";
15025
+ import chalk37 from "chalk";
15026
+ import * as fs16 from "fs";
14058
15027
  import * as os4 from "os";
14059
15028
  import * as path10 from "path";
14060
15029
  import { spawn as spawn3 } from "child_process";
@@ -14070,15 +15039,15 @@ function extensionFor2(language) {
14070
15039
  }
14071
15040
  async function openInEditor(initial, ext) {
14072
15041
  const tmpFile = path10.join(os4.tmpdir(), `diafunc-shell-${randomUUID4()}.${ext}`);
14073
- fs15.writeFileSync(tmpFile, initial);
15042
+ fs16.writeFileSync(tmpFile, initial);
14074
15043
  const editor = process.env.VISUAL ?? process.env.EDITOR ?? "vi";
14075
15044
  await new Promise((resolve2, reject) => {
14076
15045
  const child = spawn3(editor, [tmpFile], { stdio: "inherit" });
14077
15046
  child.on("exit", (code) => code === 0 ? resolve2() : reject(new Error(`Editor exited with ${code}`)));
14078
15047
  child.on("error", reject);
14079
15048
  });
14080
- const content = fs15.readFileSync(tmpFile, "utf-8");
14081
- fs15.unlinkSync(tmpFile);
15049
+ const content = fs16.readFileSync(tmpFile, "utf-8");
15050
+ fs16.unlinkSync(tmpFile);
14082
15051
  return content;
14083
15052
  }
14084
15053
  function utcNowParts() {
@@ -14119,21 +15088,21 @@ async function evaluate(api, fnRef, language, sourceCode) {
14119
15088
  }, false);
14120
15089
  if (result.outputs?.length) {
14121
15090
  for (const out of result.outputs) {
14122
- console.log(chalk36.dim(` [${out.type}]`) + " " + out.output);
15091
+ console.log(chalk37.dim(` [${out.type}]`) + " " + out.output);
14123
15092
  }
14124
15093
  }
14125
15094
  if (result.successful) {
14126
15095
  if (result.result) {
14127
- console.log(chalk36.green("=>") + " " + resultText(result.result, result.resultEncoding));
15096
+ console.log(chalk37.green("=>") + " " + resultText(result.result, result.resultEncoding));
14128
15097
  } else {
14129
- console.log(chalk36.dim("=> (no value)"));
15098
+ console.log(chalk37.dim("=> (no value)"));
14130
15099
  }
14131
15100
  const duration = result.completed - result.started;
14132
- console.log(chalk36.dim(` [${duration}ms \xB7 ${evaluationId}]`));
15101
+ console.log(chalk37.dim(` [${duration}ms \xB7 ${evaluationId}]`));
14133
15102
  } else {
14134
- console.log(chalk36.red("error: ") + result.error);
15103
+ console.log(chalk37.red("error: ") + result.error);
14135
15104
  if (result.lineNumber > 0) {
14136
- console.log(chalk36.dim(` at line ${result.lineNumber}, col ${result.columnNumber}`));
15105
+ console.log(chalk37.dim(` at line ${result.lineNumber}, col ${result.columnNumber}`));
14137
15106
  }
14138
15107
  }
14139
15108
  }
@@ -14154,19 +15123,19 @@ function registerShellCommand(program) {
14154
15123
  });
14155
15124
  const api = createApiClient();
14156
15125
  const { input: promptInput } = await import("@inquirer/prompts");
14157
- const { getUpdateNotice } = await import("./update-check-2GW2RLWY.js");
15126
+ const { getUpdateNotice } = await import("./update-check-R7B2D7VX.js");
14158
15127
  const resolvedLanguage = await resolveLanguage(api, fnRef.projectId, options.language);
14159
- console.log(chalk36.bold("Diafunc shell") + chalk36.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
14160
- console.log(chalk36.dim(`Endpoint: ${config.profiles[config.currentProfile]?.endpoint}`));
14161
- console.log(chalk36.dim("Commands: /edit (multi-line in $EDITOR), /lang <name>, /file <path>, /help, /quit"));
15128
+ console.log(chalk37.bold("Diafunc shell") + chalk37.dim(` \xB7 function ${fnRef.entityId} \xB7 ${resolvedLanguage}`));
15129
+ console.log(chalk37.dim(`Endpoint: ${config.profiles[getActiveProfileName(config)]?.endpoint}`));
15130
+ console.log(chalk37.dim("Commands: /edit (multi-line in $EDITOR), /lang <name>, /file <path>, /help, /quit"));
14162
15131
  const notice = await getUpdateNotice();
14163
- if (notice) console.log(chalk36.dim(notice));
15132
+ if (notice) console.log(chalk37.dim(notice));
14164
15133
  console.log();
14165
15134
  let language = resolvedLanguage;
14166
15135
  for (; ; ) {
14167
15136
  let line;
14168
15137
  try {
14169
- line = await promptInput({ message: chalk36.cyan.bold(`${language} >`) });
15138
+ line = await promptInput({ message: chalk37.cyan.bold(`${language} >`) });
14170
15139
  } catch {
14171
15140
  console.log();
14172
15141
  return;
@@ -14184,54 +15153,54 @@ function registerShellCommand(program) {
14184
15153
  case "help":
14185
15154
  case "h":
14186
15155
  case "?":
14187
- console.log(chalk36.dim(" /edit open $EDITOR for multi-line code"));
14188
- console.log(chalk36.dim(" /file <path> evaluate the contents of a file"));
14189
- console.log(chalk36.dim(" /lang <name> switch language (Java, JavaScript, Kotlin, Python, Scala)"));
14190
- console.log(chalk36.dim(" /quit exit the shell"));
15156
+ console.log(chalk37.dim(" /edit open $EDITOR for multi-line code"));
15157
+ console.log(chalk37.dim(" /file <path> evaluate the contents of a file"));
15158
+ console.log(chalk37.dim(" /lang <name> switch language (Java, JavaScript, Kotlin, Python, Scala)"));
15159
+ console.log(chalk37.dim(" /quit exit the shell"));
14191
15160
  continue;
14192
15161
  case "lang":
14193
15162
  if (arg) language = arg;
14194
- console.log(chalk36.dim(`Language: ${language}`));
15163
+ console.log(chalk37.dim(`Language: ${language}`));
14195
15164
  continue;
14196
15165
  case "edit": {
14197
15166
  const sourceCode = await openInEditor("", extensionFor2(language));
14198
15167
  if (!sourceCode.trim()) {
14199
- console.log(chalk36.dim("(empty; not evaluated)"));
15168
+ console.log(chalk37.dim("(empty; not evaluated)"));
14200
15169
  continue;
14201
15170
  }
14202
15171
  try {
14203
15172
  await evaluate(api, fnRef, language, sourceCode);
14204
15173
  } catch (e) {
14205
- console.error(chalk36.red(e.message));
15174
+ console.error(chalk37.red(e.message));
14206
15175
  }
14207
15176
  continue;
14208
15177
  }
14209
15178
  case "file": {
14210
15179
  if (!arg) {
14211
- console.log(chalk36.dim("usage: /file <path>"));
15180
+ console.log(chalk37.dim("usage: /file <path>"));
14212
15181
  continue;
14213
15182
  }
14214
- if (!fs15.existsSync(arg)) {
14215
- console.log(chalk36.red(`file not found: ${arg}`));
15183
+ if (!fs16.existsSync(arg)) {
15184
+ console.log(chalk37.red(`file not found: ${arg}`));
14216
15185
  continue;
14217
15186
  }
14218
- const sourceCode = fs15.readFileSync(arg, "utf-8");
15187
+ const sourceCode = fs16.readFileSync(arg, "utf-8");
14219
15188
  try {
14220
15189
  await evaluate(api, fnRef, language, sourceCode);
14221
15190
  } catch (e) {
14222
- console.error(chalk36.red(e.message));
15191
+ console.error(chalk37.red(e.message));
14223
15192
  }
14224
15193
  continue;
14225
15194
  }
14226
15195
  default:
14227
- console.log(chalk36.dim(`Unknown command: /${cmd2}. Try /help.`));
15196
+ console.log(chalk37.dim(`Unknown command: /${cmd2}. Try /help.`));
14228
15197
  continue;
14229
15198
  }
14230
15199
  }
14231
15200
  try {
14232
15201
  await evaluate(api, fnRef, language, trimmed);
14233
15202
  } catch (e) {
14234
- console.error(chalk36.red(e.message));
15203
+ console.error(chalk37.red(e.message));
14235
15204
  }
14236
15205
  }
14237
15206
  } catch (error) {
@@ -14241,19 +15210,19 @@ function registerShellCommand(program) {
14241
15210
  }
14242
15211
 
14243
15212
  // src/commands/update/index.ts
14244
- import chalk37 from "chalk";
15213
+ import chalk38 from "chalk";
14245
15214
  import * as path11 from "path";
14246
15215
  import { spawn as spawn4 } from "child_process";
14247
15216
 
14248
15217
  // src/util/install-method.ts
14249
- import * as fs16 from "fs";
15218
+ import * as fs17 from "fs";
14250
15219
  function detectInstall() {
14251
15220
  const exec = process.execPath;
14252
15221
  const exe = exec.replace(/\\/g, "/").toLowerCase();
14253
15222
  const isNode = exe.endsWith("/node") || exe.endsWith("/node.exe");
14254
15223
  return {
14255
15224
  method: isNode ? "npm" : "binary",
14256
- binaryPath: isNode ? exec : fs16.realpathSync(exec)
15225
+ binaryPath: isNode ? exec : fs17.realpathSync(exec)
14257
15226
  };
14258
15227
  }
14259
15228
 
@@ -14287,14 +15256,14 @@ function registerUpdateCommand(program) {
14287
15256
  const install = detectInstall();
14288
15257
  const latest = await fetchLatestVersion();
14289
15258
  if (latest === package_default.version) {
14290
- console.log(chalk37.dim(`diafunc is already at the latest version (${package_default.version}).`));
15259
+ console.log(chalk38.dim(`diafunc is already at the latest version (${package_default.version}).`));
14291
15260
  return;
14292
15261
  }
14293
- console.log(chalk37.dim(`Current: ${package_default.version} \u2192 Available: ${latest}`));
15262
+ console.log(chalk38.dim(`Current: ${package_default.version} \u2192 Available: ${latest}`));
14294
15263
  if (install.method === "npm") {
14295
15264
  console.log();
14296
15265
  console.log("Installed via npm. Upgrade with:");
14297
- console.log(chalk37.bold(` npm install -g @diafunc/cli@${latest}`));
15266
+ console.log(chalk38.bold(` npm install -g @diafunc/cli@${latest}`));
14298
15267
  return;
14299
15268
  }
14300
15269
  const installDir = path11.dirname(install.binaryPath);
@@ -14308,9 +15277,9 @@ function registerUpdateCommand(program) {
14308
15277
  }
14309
15278
 
14310
15279
  // src/commands/uninstall/index.ts
14311
- import chalk38 from "chalk";
15280
+ import chalk39 from "chalk";
14312
15281
  import { spawn as spawn5 } from "child_process";
14313
- import * as fs17 from "fs";
15282
+ import * as fs18 from "fs";
14314
15283
  import * as os5 from "os";
14315
15284
  import * as path12 from "path";
14316
15285
  function registerUninstallCommand(program) {
@@ -14320,11 +15289,11 @@ function registerUninstallCommand(program) {
14320
15289
  const configDir = path12.join(os5.homedir(), ".diafunc");
14321
15290
  if (install.method === "npm") {
14322
15291
  console.log("Installed via npm. Remove with:");
14323
- console.log(chalk38.bold(" npm uninstall -g @diafunc/cli"));
14324
- if (fs17.existsSync(configDir)) {
15292
+ console.log(chalk39.bold(" npm uninstall -g @diafunc/cli"));
15293
+ if (fs18.existsSync(configDir)) {
14325
15294
  console.log();
14326
15295
  console.log(`Config and credentials live at ${configDir}. Remove them manually with:`);
14327
- console.log(chalk38.bold(` rm -rf ${configDir}`));
15296
+ console.log(chalk39.bold(` rm -rf ${configDir}`));
14328
15297
  }
14329
15298
  return;
14330
15299
  }
@@ -14334,19 +15303,19 @@ function registerUninstallCommand(program) {
14334
15303
  default: false
14335
15304
  });
14336
15305
  if (!removeBinary) {
14337
- console.log(chalk38.dim("Aborted."));
15306
+ console.log(chalk39.dim("Aborted."));
14338
15307
  return;
14339
15308
  }
14340
15309
  let removeConfig = options.purge ?? false;
14341
- if (!options.purge && !options.yes && fs17.existsSync(configDir)) {
15310
+ if (!options.purge && !options.yes && fs18.existsSync(configDir)) {
14342
15311
  removeConfig = await confirm({
14343
15312
  message: `Also remove ${configDir} (config + credentials)?`,
14344
15313
  default: false
14345
15314
  });
14346
15315
  }
14347
- if (removeConfig && fs17.existsSync(configDir)) {
14348
- fs17.rmSync(configDir, { recursive: true, force: true });
14349
- console.log(chalk38.dim(`Removed ${configDir}`));
15316
+ if (removeConfig && fs18.existsSync(configDir)) {
15317
+ fs18.rmSync(configDir, { recursive: true, force: true });
15318
+ console.log(chalk39.dim(`Removed ${configDir}`));
14350
15319
  }
14351
15320
  if (process.platform === "win32") {
14352
15321
  const cmd = `timeout /t 2 /nobreak >nul & del /f /q "${install.binaryPath}"`;
@@ -14356,13 +15325,13 @@ function registerUninstallCommand(program) {
14356
15325
  windowsHide: true
14357
15326
  });
14358
15327
  child.unref();
14359
- console.log(chalk38.dim(`Removing ${install.binaryPath} on exit...`));
15328
+ console.log(chalk39.dim(`Removing ${install.binaryPath} on exit...`));
14360
15329
  console.log();
14361
15330
  console.log("diafunc uninstalled.");
14362
15331
  return;
14363
15332
  }
14364
- fs17.rmSync(install.binaryPath, { force: true });
14365
- console.log(chalk38.dim(`Removed ${install.binaryPath}`));
15333
+ fs18.rmSync(install.binaryPath, { force: true });
15334
+ console.log(chalk39.dim(`Removed ${install.binaryPath}`));
14366
15335
  console.log();
14367
15336
  console.log("diafunc uninstalled.");
14368
15337
  } catch (error) {
@@ -14371,66 +15340,12 @@ function registerUninstallCommand(program) {
14371
15340
  });
14372
15341
  }
14373
15342
 
14374
- // src/prompting/command.ts
14375
- import { Command as Command2 } from "commander";
14376
- var commanderOriginal = Command2.prototype;
14377
- var DiafuncCommand = class _DiafuncCommand extends Command2 {
14378
- /** Gaps recorded during the current parse, in the order commander found them. */
14379
- pendingInputs = [];
14380
- /** Set on the program only; every command reads it from there. */
14381
- promptEnvironment = {};
14382
- createCommand(name) {
14383
- return new _DiafuncCommand(name);
14384
- }
14385
- missingArgument(name) {
14386
- if (!this.mayPrompt()) {
14387
- commanderOriginal.missingArgument.call(this, name);
14388
- return;
14389
- }
14390
- const index = this.registeredArguments.findIndex((a) => a.name() === name);
14391
- const argument = this.registeredArguments[index];
14392
- this.pendingInputs.push({
14393
- kind: "argument",
14394
- name,
14395
- index,
14396
- description: argument?.description ?? "",
14397
- variadic: Boolean(argument?.variadic)
14398
- });
14399
- }
14400
- missingMandatoryOptionValue(option) {
14401
- if (!this.mayPrompt()) {
14402
- commanderOriginal.missingMandatoryOptionValue.call(this, option);
14403
- return;
14404
- }
14405
- this.pendingInputs.push({
14406
- kind: "option",
14407
- name: option.attributeName(),
14408
- flag: option.long ?? option.flags,
14409
- description: option.description ?? "",
14410
- variadic: Boolean(option.variadic)
14411
- });
14412
- }
14413
- /** The environment set on the program. */
14414
- environment() {
14415
- let root = this;
14416
- while (root.parent) root = root.parent;
14417
- return root instanceof _DiafuncCommand ? root.promptEnvironment : {};
14418
- }
14419
- mayPrompt() {
14420
- const forced = this.environment().interactive;
14421
- if (forced !== void 0) return forced;
14422
- const globals = this.optsWithGlobals();
14423
- const output = globals.output ?? loadConfig().defaults.output ?? "human";
14424
- return canPrompt(output, globals.interactive === false);
14425
- }
14426
- };
14427
-
14428
15343
  // src/prompting/fill.ts
14429
- import chalk40 from "chalk";
15344
+ import chalk41 from "chalk";
14430
15345
 
14431
15346
  // src/prompting/pickers.ts
14432
- import * as fs18 from "fs";
14433
- import chalk39 from "chalk";
15347
+ import * as fs19 from "fs";
15348
+ import chalk40 from "chalk";
14434
15349
  var SEARCH_THRESHOLD = 10;
14435
15350
  var TYPE_IT = "\0type-it";
14436
15351
  async function askFor(spec, input, ctx) {
@@ -14552,6 +15467,8 @@ async function askFor(spec, input, ctx) {
14552
15467
  return listed(ctx, "profiles", messageFor(input, "Profile"), async () => Object.keys(loadConfig().profiles).map((p) => ({ label: p, value: p })));
14553
15468
  case "statusComponent":
14554
15469
  return listed(ctx, "components", messageFor(input, "Component"), async () => (await createStatusService().getComponents()).map((c) => ({ label: c.id, value: c.id, hint: `${c.state} \xB7 ${c.domainId}` })));
15470
+ case "deployment":
15471
+ return listed(ctx, "deployments", messageFor(input, "Deployment"), async () => (await ctx.api().deployments.list()).map((d) => ({ label: d.name, value: d.deploymentId, hint: `${d.target} \xB7 ${d.deploymentId}` })));
14555
15472
  case "license":
14556
15473
  return listed(ctx, "licenses", messageFor(input, "License"), async () => (await ctx.api().admin.listLicenses()).map((l) => ({ label: l.name, value: l.licenceId, hint: `${l.state.toLowerCase()} \xB7 ${l.licenceId}` })));
14557
15474
  case "choice":
@@ -14566,7 +15483,7 @@ async function askFor(spec, input, ctx) {
14566
15483
  }
14567
15484
  case "file":
14568
15485
  return typed(ctx, question(input), {
14569
- validate: (value) => fs18.existsSync(value.trim()) || `No file at ${value.trim()}.`
15486
+ validate: (value) => fs19.existsSync(value.trim()) || `No file at ${value.trim()}.`
14570
15487
  });
14571
15488
  case "number":
14572
15489
  return typed(ctx, question(input), { validate: numberRule(spec) });
@@ -14780,7 +15697,7 @@ function typedValue(ctx, message) {
14780
15697
  return typed(ctx, message);
14781
15698
  }
14782
15699
  function typeItChoice() {
14783
- return { name: chalk39.dim("Type it instead"), value: TYPE_IT };
15700
+ return { name: chalk40.dim("Type it instead"), value: TYPE_IT };
14784
15701
  }
14785
15702
  function text(ctx, name) {
14786
15703
  const value = ctx.known.get(name);
@@ -14810,7 +15727,7 @@ function capitalize(value) {
14810
15727
  return value.charAt(0).toUpperCase() + value.slice(1);
14811
15728
  }
14812
15729
  function labelled(label, hint2) {
14813
- return hint2 && hint2 !== label ? `${label} ${chalk39.dim(hint2)}` : label;
15730
+ return hint2 && hint2 !== label ? `${label} ${chalk40.dim(hint2)}` : label;
14814
15731
  }
14815
15732
  function numberRule(spec) {
14816
15733
  return (raw) => {
@@ -14856,7 +15773,7 @@ async function fillPendingInputs(actionCommand) {
14856
15773
  known: knownValues(actionCommand),
14857
15774
  globals: actionCommand.optsWithGlobals(),
14858
15775
  prefill: /* @__PURE__ */ new Map(),
14859
- note: (line) => process.stderr.write(chalk40.dim(` ${line}
15776
+ note: (line) => process.stderr.write(chalk41.dim(` ${line}
14860
15777
  `))
14861
15778
  };
14862
15779
  for (const item of orderByDependencies(pending)) {
@@ -14865,7 +15782,7 @@ async function fillPendingInputs(actionCommand) {
14865
15782
  ctx.known.set(item.input.name, value);
14866
15783
  }
14867
15784
  const log = env.log ?? ((line) => console.log(line));
14868
- log(chalk40.dim(` Equivalent: ${equivalentCommand(actionCommand)}`));
15785
+ log(chalk41.dim(` Equivalent: ${equivalentCommand(actionCommand)}`));
14869
15786
  }
14870
15787
  function commandChain(cmd) {
14871
15788
  const chain = [];
@@ -14968,9 +15885,10 @@ function createProgram(environment = {}) {
14968
15885
  writeErr: (str) => process.stderr.write(str)
14969
15886
  }).hook("preAction", (thisCommand) => {
14970
15887
  const opts = thisCommand.optsWithGlobals();
15888
+ selectProfile(opts.profile);
14971
15889
  if (opts.dryRun) setDryRun(true);
14972
15890
  if (opts.verbose) setVerbose(true);
14973
- if (opts.color === false) chalk41.level = 0;
15891
+ if (opts.color === false) chalk42.level = 0;
14974
15892
  }).hook("preAction", (_thisCommand, actionCommand) => fillPendingInputs(actionCommand));
14975
15893
  program.addHelpText("after", HELP_EPILOGUE);
14976
15894
  registerAuthCommands(program);
@@ -14991,6 +15909,7 @@ function createProgram(environment = {}) {
14991
15909
  registerAdminCommands(program);
14992
15910
  registerStatusCommands(program);
14993
15911
  registerAnalyzeCommand(program);
15912
+ registerDeploymentCommands(program);
14994
15913
  registerPublicCommands(program);
14995
15914
  registerLicenseCommands(program);
14996
15915
  registerDataSourcesCommands(program);
@@ -15015,4 +15934,4 @@ export {
15015
15934
  PromptCanceled,
15016
15935
  createProgram
15017
15936
  };
15018
- //# sourceMappingURL=chunk-QBPGK5OC.js.map
15937
+ //# sourceMappingURL=chunk-MRKZZ4XD.js.map