@r-33/opencode 0.4.7-rc.26 → 0.4.7-rc.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1813,16 +1813,25 @@ var HostStorageSecretStore = class {
1813
1813
  /** Reads and parses the scoped gateway credential.
1814
1814
  * @returns The persisted credential, when present.
1815
1815
  */
1816
+ /** Reads the scoped gateway credential out of the box envelope the
1817
+ * host's reactive storage uses, so the TUI part reads what the
1818
+ * server part wrote at the same plugin key.
1819
+ * @returns The persisted credential, when present.
1820
+ */
1816
1821
  async get() {
1817
1822
  const value = await this.#storage.get(this.#key);
1818
- return value === void 0 ? void 0 : parseGatewayKey(value);
1823
+ if (typeof value === "object" && value !== null && "value" in value && typeof value.value === "string") {
1824
+ return parseGatewayKey(value.value);
1825
+ }
1826
+ return typeof value === "string" ? parseGatewayKey(value) : void 0;
1819
1827
  }
1820
- /** Writes the scoped gateway credential only through host-owned storage.
1828
+ /** Writes the scoped gateway credential into the box envelope, through
1829
+ * host-owned storage only.
1821
1830
  * @param key - The credential to persist, or undefined to remove it.
1822
1831
  * @returns A promise that settles after the host write or removal.
1823
1832
  */
1824
1833
  set(key) {
1825
- return key === void 0 ? this.#storage.remove(this.#key) : this.#storage.set(this.#key, key.value);
1834
+ return key === void 0 ? this.#storage.remove(this.#key) : this.#storage.set(this.#key, { value: key.value });
1826
1835
  }
1827
1836
  };
1828
1837
 
@@ -1836,8 +1845,10 @@ var KeyLeaseError = class extends Error {
1836
1845
  );
1837
1846
  this.code = code;
1838
1847
  this.name = "KeyLeaseError";
1848
+ this.statusCode = options?.statusCode;
1839
1849
  }
1840
1850
  code;
1851
+ statusCode;
1841
1852
  };
1842
1853
 
1843
1854
  // src/key-lease/is-management-unauthorized/is-management-unauthorized.ts
@@ -1975,6 +1986,7 @@ var buildMintInput = (deps) => {
1975
1986
  managementSubject: deps.managementSubject
1976
1987
  });
1977
1988
  return {
1989
+ ...deps.attribution.orgId === void 0 ? {} : { activeOrgId: deps.attribution.orgId },
1978
1990
  allowedModels: deps.extras?.allowedModels,
1979
1991
  description: deps.extras?.description,
1980
1992
  expiresAt: new Date(
@@ -2077,6 +2089,21 @@ var rejectLease = async (options) => {
2077
2089
  }
2078
2090
  };
2079
2091
 
2092
+ // src/management/management-error/management-error.ts
2093
+ var ManagementError = class extends Error {
2094
+ constructor(code, options) {
2095
+ super(
2096
+ "Route 33 management request failed",
2097
+ options?.cause === void 0 ? void 0 : { cause: "Route 33 management dependency failed" }
2098
+ );
2099
+ this.code = code;
2100
+ this.name = "ManagementError";
2101
+ this.statusCode = options?.statusCode;
2102
+ }
2103
+ code;
2104
+ statusCode;
2105
+ };
2106
+
2080
2107
  // src/key-lease/mint-key/mint-key.ts
2081
2108
  var mintKey = async (options) => {
2082
2109
  const now = options.clock();
@@ -2110,7 +2137,10 @@ var mintKey = async (options) => {
2110
2137
  if (isManagementUnauthorized(cause)) {
2111
2138
  throw new KeyLeaseError("KEY_LEASE_UNAUTHORIZED", { cause });
2112
2139
  }
2113
- throw new KeyLeaseError("KEY_LEASE_MINT_FAILED", { cause });
2140
+ throw new KeyLeaseError("KEY_LEASE_MINT_FAILED", {
2141
+ cause,
2142
+ ...cause instanceof ManagementError && cause.statusCode !== void 0 ? { statusCode: cause.statusCode } : {}
2143
+ });
2114
2144
  }
2115
2145
  return {
2116
2146
  key: material.key,
@@ -2429,16 +2459,33 @@ var readLegacyKey = (worktree) => {
2429
2459
  }
2430
2460
  };
2431
2461
 
2462
+ // src/attribution/parse-attribution/read-org-id/read-org-id.ts
2463
+ var readOrgId = (value) => {
2464
+ const orgId = value["orgId"];
2465
+ if (orgId === void 0) {
2466
+ return void 0;
2467
+ }
2468
+ if (typeof orgId !== "string") {
2469
+ throw new ContractParseError("invalid attribution");
2470
+ }
2471
+ return orgId;
2472
+ };
2473
+
2432
2474
  // src/attribution/parse-attribution/parse-attribution.ts
2433
2475
  var parseAttribution = (value) => {
2434
2476
  if (!isRecord(value)) {
2435
2477
  throw new ContractParseError("invalid attribution");
2436
2478
  }
2479
+ const orgId = readOrgId(value);
2437
2480
  if (value["kind"] === "personal") {
2438
- return { kind: "personal" };
2481
+ return { kind: "personal", ...orgId === void 0 ? {} : { orgId } };
2439
2482
  }
2440
2483
  if (value["kind"] === "project" && typeof value["projectId"] === "string") {
2441
- return { kind: "project", projectId: value["projectId"] };
2484
+ return {
2485
+ kind: "project",
2486
+ ...orgId === void 0 ? {} : { orgId },
2487
+ projectId: value["projectId"]
2488
+ };
2442
2489
  }
2443
2490
  throw new ContractParseError("invalid attribution");
2444
2491
  };
@@ -2666,38 +2713,89 @@ var rotateNow = async (options) => {
2666
2713
  return rotated.lease;
2667
2714
  };
2668
2715
 
2716
+ // src/ux/attribution-prompt/org-selection-prefix/org-selection-prefix.ts
2717
+ var orgSelectionPrefix = (orgId) => `org:${orgId}:`;
2718
+
2719
+ // src/ux/attribution-prompt/personal-budgeted/personal-budgeted.ts
2720
+ var personalBudgeted = (org) => {
2721
+ const cap = org.personalBudget?.cap;
2722
+ return cap === void 0 || cap !== null && cap > 0;
2723
+ };
2724
+
2669
2725
  // src/ux/attribution-prompt/attribution-prompt.ts
2670
2726
  var PERSONAL_KEY_ACTIVE_MARKER = "machine key active";
2727
+ var PROMPT_TITLE = "Choose where Route 33 should manage this key";
2671
2728
  var createAttributionPrompt = (projects, options = {}) => {
2672
- const choicesBySelection = {
2673
- personal: { kind: "personal" }
2729
+ const personalLabel = (orgName) => {
2730
+ const marker = options.personalKeyActive === true ? ` (${PERSONAL_KEY_ACTIVE_MARKER})` : "";
2731
+ const orgSuffix = orgName === void 0 ? "" : ` \u2014 ${orgName}`;
2732
+ return `Personal \u2014 your own key${marker}${orgSuffix}`;
2674
2733
  };
2675
- const projectOptions = projects.map((project) => {
2676
- const selection = `project:${project.id}`;
2677
- choicesBySelection[selection] = {
2678
- kind: "project",
2679
- projectId: project.id
2680
- };
2734
+ const budgetAllowance = (project) => {
2681
2735
  const budget = project.effective_budget ?? project.max_budget;
2682
- const allowance = budget === null ? "no cap set" : `cap ${budget.amount} ${budget.currency}`;
2736
+ return budget === null ? "no cap set" : `cap ${budget.amount} ${budget.currency}`;
2737
+ };
2738
+ const choicesBySelection = {};
2739
+ if (options.orgs === void 0) {
2740
+ choicesBySelection.personal = { kind: "personal" };
2741
+ const projectOptions = projects.map((project) => {
2742
+ const selection = `project:${project.id}`;
2743
+ choicesBySelection[selection] = {
2744
+ kind: "project",
2745
+ projectId: project.id
2746
+ };
2747
+ return {
2748
+ label: `${project.organisation.name} \xB7 ${project.name} \u2014 ${budgetAllowance(project)}`,
2749
+ selection
2750
+ };
2751
+ });
2683
2752
  return {
2684
- label: `${project.organisation.name} \xB7 ${project.name} \u2014 ${allowance}`,
2685
- selection
2753
+ choicesBySelection,
2754
+ options: [
2755
+ { label: personalLabel(), selection: "personal" },
2756
+ ...projectOptions
2757
+ ],
2758
+ title: PROMPT_TITLE
2686
2759
  };
2687
- });
2760
+ }
2761
+ const promptOptions = [];
2762
+ for (const org of options.orgs) {
2763
+ const personal = `${orgSelectionPrefix(org.id)}personal`;
2764
+ if (personalBudgeted(org)) {
2765
+ choicesBySelection[personal] = { kind: "personal", orgId: org.id };
2766
+ promptOptions.push({
2767
+ label: personalLabel(options.orgs.length > 1 ? org.name : void 0),
2768
+ selection: personal
2769
+ });
2770
+ }
2771
+ for (const project of projects) {
2772
+ if (project.organisation.id !== org.id) {
2773
+ continue;
2774
+ }
2775
+ const selection = `${orgSelectionPrefix(org.id)}project:${project.id}`;
2776
+ choicesBySelection[selection] = {
2777
+ kind: "project",
2778
+ orgId: org.id,
2779
+ projectId: project.id
2780
+ };
2781
+ promptOptions.push({
2782
+ label: `${project.organisation.name} \xB7 ${project.name} \u2014 ${budgetAllowance(project)}`,
2783
+ selection
2784
+ });
2785
+ }
2786
+ }
2688
2787
  return {
2689
2788
  choicesBySelection,
2690
- options: [
2691
- {
2692
- label: options.personalKeyActive === true ? `Personal \u2014 your own key (${PERSONAL_KEY_ACTIVE_MARKER})` : "Personal \u2014 your own key",
2693
- selection: "personal"
2694
- },
2695
- ...projectOptions
2696
- ],
2697
- title: "Choose where Route 33 should manage this key"
2789
+ options: promptOptions,
2790
+ orgs: options.orgs,
2791
+ title: PROMPT_TITLE
2698
2792
  };
2699
2793
  };
2700
2794
 
2795
+ // src/ux/attribution-prompt/is-personal-selection/is-personal-selection.ts
2796
+ var PERSONAL_SELECTION_SUFFIX = ":personal";
2797
+ var isPersonalSelection = (selection) => selection === "personal" || selection.endsWith(PERSONAL_SELECTION_SUFFIX);
2798
+
2701
2799
  // src/ux/attribution-prompt-error/attribution-prompt-error.ts
2702
2800
  var MESSAGES = {
2703
2801
  ATTRIBUTION_PRESENTER_UNAVAILABLE: "Route 33 needs OpenCode v2 to assign a budget for this folder. Update to OpenCode v2, run /connect, choose Route 33, and follow the steps.",
@@ -2755,7 +2853,7 @@ import {
2755
2853
  } from "@r-33/auth-browser";
2756
2854
 
2757
2855
  // src/requested-scopes/requested-scopes.ts
2758
- var REQUESTED_OAUTH_SCOPES = "openid offline_access orgs:read projects:read users:read keys:read keys:write";
2856
+ var REQUESTED_OAUTH_SCOPES = "openid offline_access orgs:read profile projects:read users:read keys:read keys:write";
2759
2857
 
2760
2858
  // src/route33-login/route33-login.ts
2761
2859
  var route33Login = async (options) => {
@@ -2904,9 +3002,8 @@ var Route33Runtime = class {
2904
3002
  * Lists exactly the projects the current management login can mint keys
2905
3003
  * on: the login's per-user budget rows intersected with the
2906
3004
  * member-visible project listing, organisation names stitched from the
2907
- * login's own memberships. Orgs the login merely administers carry no
2908
- * budget row and drop out — the picker never offers a project whose
2909
- * keys the login cannot create. A `allowBrowser: false` policy makes
3005
+ * login's own memberships. Zero-cap rows drop out — a project whose
3006
+ * budget cannot spend never mints. A `allowBrowser: false` policy makes
2910
3007
  * the call non-blocking: a dead session rejects instead of opening a
2911
3008
  * browser, so the picker's form registration never stalls a boot.
2912
3009
  * @param policy - Whether a dead session may open a browser login.
@@ -2920,21 +3017,69 @@ var Route33Runtime = class {
2920
3017
  client.listProjectBudgets(credential, subject),
2921
3018
  client.listMemberships(credential, subject)
2922
3019
  ]);
2923
- const organisationNames = new Map(
2924
- memberships.org_memberships.map(({ org_id, org_name }) => [
2925
- org_id,
2926
- org_name
2927
- ])
3020
+ return this.#budgetedProjects(
3021
+ credential,
3022
+ client,
3023
+ budgets,
3024
+ new Map(
3025
+ memberships.org_memberships.map(({ org_id, org_name }) => [
3026
+ org_id,
3027
+ org_name
3028
+ ])
3029
+ )
3030
+ );
3031
+ }
3032
+ /**
3033
+ * Lists one organisation per membership with that organisation's
3034
+ * mintable projects and effective personal budget — the wizard's org
3035
+ * picker data. Budgets resolve per organisation (the active-org
3036
+ * header), so rows never mix orgs; zero-cap rows drop out, and an
3037
+ * unreadable organisation degrades to its empty picker — or an unknown
3038
+ * personal budget — instead of failing the whole list.
3039
+ * @param policy - Whether a dead session may open a browser login.
3040
+ * @returns One mintable-projects entry per organisation membership.
3041
+ */
3042
+ async listMintableOrgs(policy = {}) {
3043
+ const credential = await this.#session.credential(policy);
3044
+ const subject = this.#subject(credential);
3045
+ const client = this.#client();
3046
+ const memberships = await client.listMemberships(credential, subject);
3047
+ return Promise.all(
3048
+ memberships.org_memberships.map(async ({ org_id, org_name }) => ({
3049
+ id: org_id,
3050
+ name: org_name,
3051
+ personalBudget: await client.listBudgetPolicy(credential, subject, org_id).then((budget) => ({ cap: budget.cap })).catch(() => void 0),
3052
+ projects: await client.listProjectBudgets(credential, subject, org_id).then(
3053
+ (budgets) => this.#budgetedProjects(
3054
+ credential,
3055
+ client,
3056
+ budgets,
3057
+ /* @__PURE__ */ new Map([[org_id, org_name]])
3058
+ )
3059
+ ).catch(() => [])
3060
+ }))
2928
3061
  );
3062
+ }
3063
+ /**
3064
+ * Joins cap-bearing budget rows with their listed projects; zero caps
3065
+ * never mint.
3066
+ * @param credential - The management bearer token for project listings.
3067
+ * @param client - The management contract implementation.
3068
+ * @param budgets - The login's per-user budget rows.
3069
+ * @param organisationNames - The login's org names by org id.
3070
+ * @returns The mintable projects carrying organisation context.
3071
+ */
3072
+ async #budgetedProjects(credential, client, budgets, organisationNames) {
3073
+ const rows = budgets.data.filter((row) => row.cap > 0);
2929
3074
  const listings = await Promise.all(
2930
- [...new Set(budgets.data.map(({ org_id }) => org_id))].map(
3075
+ [...new Set(rows.map(({ org_id }) => org_id))].map(
2931
3076
  (orgId) => client.listProjects(credential, orgId)
2932
3077
  )
2933
3078
  );
2934
3079
  const projectsById = new Map(
2935
3080
  listings.flatMap(({ data }) => data).map((project) => [project.id, project])
2936
3081
  );
2937
- return budgets.data.flatMap(({ org_id, project_id }) => {
3082
+ return rows.flatMap(({ org_id, project_id }) => {
2938
3083
  const project = projectsById.get(project_id);
2939
3084
  if (project === void 0) {
2940
3085
  return [];
@@ -3369,21 +3514,6 @@ var drainPages = async (fetchPage) => {
3369
3514
  return { data, page: { ...page, has_more: false, next_cursor: null } };
3370
3515
  };
3371
3516
 
3372
- // src/management/management-error/management-error.ts
3373
- var ManagementError = class extends Error {
3374
- constructor(code, options) {
3375
- super(
3376
- "Route 33 management request failed",
3377
- options?.cause === void 0 ? void 0 : { cause: "Route 33 management dependency failed" }
3378
- );
3379
- this.code = code;
3380
- this.name = "ManagementError";
3381
- this.statusCode = options?.statusCode;
3382
- }
3383
- code;
3384
- statusCode;
3385
- };
3386
-
3387
3517
  // src/management/sdk-management-keys/sdk-management-keys.ts
3388
3518
  import {
3389
3519
  createRoute33Client,
@@ -3421,6 +3551,26 @@ var parseApiKey = (value) => {
3421
3551
  };
3422
3552
  };
3423
3553
 
3554
+ // src/contract/management-keys/parse-budget-policy/parse-budget-policy.ts
3555
+ var parseBudgetPolicy = (value) => {
3556
+ if (!isRecord(value)) {
3557
+ throw new ContractParseError("invalid budget policy");
3558
+ }
3559
+ const cap = value["cap"];
3560
+ if (typeof cap !== "number" && cap !== null) {
3561
+ throw new ContractParseError("invalid budget policy");
3562
+ }
3563
+ const orgId = value["org_id"];
3564
+ if (typeof orgId !== "string") {
3565
+ throw new ContractParseError("invalid budget policy");
3566
+ }
3567
+ const source = value["source"];
3568
+ if (source !== "own_cap" && source !== "project_default" && source !== "org_default" && source !== "tenant_default" && source !== "platform_default") {
3569
+ throw new ContractParseError("invalid budget policy");
3570
+ }
3571
+ return { cap, org_id: orgId, source };
3572
+ };
3573
+
3424
3574
  // src/contract/management-keys/parse-collection/parse-collection.ts
3425
3575
  var parseCollection = (value, parseItem) => {
3426
3576
  if (!isRecord(value)) {
@@ -3630,28 +3780,46 @@ var parseUserMemberships = (value) => {
3630
3780
  };
3631
3781
  };
3632
3782
 
3783
+ // src/management/sdk-management-keys/mint-request-body/mint-request-body.ts
3784
+ var buildMintRequestBody = (input) => ({
3785
+ ...input.allowedModels === void 0 ? {} : { allowed_models: [...input.allowedModels] },
3786
+ budget_currency: "EUR",
3787
+ ...input.description === void 0 ? {} : { description: input.description },
3788
+ expires_at: input.expiresAt,
3789
+ ...input.maxBudgetAmount === void 0 ? {} : { max_budget_amount: input.maxBudgetAmount },
3790
+ name: input.name,
3791
+ ...input.ownerId === null ? {} : { owner_user_id: input.ownerId },
3792
+ owner_type: input.ownerType,
3793
+ ...input.projectId === null ? {} : { project_id: input.projectId }
3794
+ });
3795
+
3633
3796
  // src/management/sdk-management-keys/sdk-management-keys.ts
3634
3797
  var API_PREFIX_PATTERN = /\/api\/v1\/?$/;
3798
+ var ACTIVE_ORG_HEADER = "X-Active-Org-Id";
3635
3799
  var sdkManagementKeys = (options) => {
3636
3800
  const baseUrl = options.apiBaseUrl.replace(API_PREFIX_PATTERN, "");
3637
3801
  const timeoutMs = options.timeoutMs ?? 1e4;
3638
3802
  const fetchImpl = options.fetchImpl;
3639
- const observingFetch = (status) => fetchImpl === void 0 ? void 0 : async (input, init) => {
3640
- const response = await fetchImpl(input, init);
3641
- status.code = response.status;
3642
- return response;
3803
+ const activeOrgFetch = (activeOrgId) => activeOrgId === void 0 ? void 0 : (input, init) => {
3804
+ if (input instanceof Request) {
3805
+ input.headers.set(ACTIVE_ORG_HEADER, activeOrgId);
3806
+ }
3807
+ if (init?.headers instanceof Headers) {
3808
+ init.headers.set(ACTIVE_ORG_HEADER, activeOrgId);
3809
+ }
3810
+ return (fetchImpl ?? globalThis.fetch)(input, init);
3643
3811
  };
3644
- const callClient = (accessToken, status) => {
3812
+ const callClient = (accessToken, activeOrgId) => {
3645
3813
  const provider = {
3646
3814
  getToken: () => Promise.resolve(accessToken.value),
3647
3815
  onUnauthorized: () => Promise.resolve(accessToken.value)
3648
3816
  };
3649
- const observedFetch = observingFetch(status);
3817
+ const fetch2 = activeOrgFetch(activeOrgId) ?? fetchImpl;
3650
3818
  return createRoute33Client({
3651
3819
  baseUrl,
3652
3820
  provider,
3653
3821
  timeoutMs,
3654
- ...observedFetch === void 0 ? {} : { fetch: observedFetch }
3822
+ ...fetch2 === void 0 ? {} : { fetch: fetch2 }
3655
3823
  });
3656
3824
  };
3657
3825
  const mapFailure = (cause) => {
@@ -3667,11 +3835,10 @@ var sdkManagementKeys = (options) => {
3667
3835
  }
3668
3836
  return new ManagementError("MANAGEMENT_NETWORK_ERROR", { cause });
3669
3837
  };
3670
- const call = async (accessToken, run) => {
3671
- const status = { code: void 0 };
3838
+ const call = async (accessToken, activeOrgId, run) => {
3672
3839
  try {
3673
- const outcome = await run(callClient(accessToken, status));
3674
- const code = status.code;
3840
+ const outcome = await run(callClient(accessToken, activeOrgId));
3841
+ const code = outcome.response?.status;
3675
3842
  if (code === void 0 || code < 200 || code >= 300) {
3676
3843
  throw new ManagementError(
3677
3844
  code === 401 ? "MANAGEMENT_UNAUTHORIZED" : "MANAGEMENT_HTTP_ERROR",
@@ -3687,24 +3854,16 @@ var sdkManagementKeys = (options) => {
3687
3854
  create: async (accessToken, input) => parseKeyMaterial(
3688
3855
  await call(
3689
3856
  accessToken,
3857
+ input.activeOrgId,
3690
3858
  (client) => client.POST("/api/v1/api-keys", {
3691
- body: {
3692
- ...input.allowedModels === void 0 ? {} : { allowed_models: [...input.allowedModels] },
3693
- budget_currency: "EUR",
3694
- ...input.description === void 0 ? {} : { description: input.description },
3695
- expires_at: input.expiresAt,
3696
- ...input.maxBudgetAmount === void 0 ? {} : { max_budget_amount: input.maxBudgetAmount },
3697
- name: input.name,
3698
- ...input.ownerId === null ? {} : { owner_user_id: input.ownerId },
3699
- owner_type: input.ownerType,
3700
- ...input.projectId === null ? {} : { project_id: input.projectId }
3701
- }
3859
+ body: buildMintRequestBody(input)
3702
3860
  })
3703
3861
  )
3704
3862
  ),
3705
3863
  delete: async (accessToken, id) => {
3706
3864
  await call(
3707
3865
  accessToken,
3866
+ void 0,
3708
3867
  (client) => client.DELETE("/api/v1/api-keys/{api_key_id}", {
3709
3868
  params: { path: { api_key_id: id } }
3710
3869
  })
@@ -3713,30 +3872,50 @@ var sdkManagementKeys = (options) => {
3713
3872
  get: async (accessToken, id) => parseApiKey(
3714
3873
  await call(
3715
3874
  accessToken,
3875
+ void 0,
3716
3876
  (client) => client.GET("/api/v1/api-keys/{api_key_id}", {
3717
3877
  params: { path: { api_key_id: id } }
3718
3878
  })
3719
3879
  )
3720
3880
  ),
3721
3881
  list: async (accessToken) => parseCollection(
3722
- await call(accessToken, (client) => client.GET("/api/v1/api-keys", {})),
3882
+ await call(
3883
+ accessToken,
3884
+ void 0,
3885
+ (client) => client.GET("/api/v1/api-keys", {})
3886
+ ),
3723
3887
  parseApiKey
3724
3888
  ),
3725
3889
  listOrganizations: async (accessToken) => parseCollection(
3726
- await call(accessToken, (client) => client.GET("/api/v1/orgs", {})),
3890
+ await call(
3891
+ accessToken,
3892
+ void 0,
3893
+ (client) => client.GET("/api/v1/orgs", {})
3894
+ ),
3727
3895
  parseOrganization
3728
3896
  ),
3729
3897
  listMemberships: async (accessToken, userId) => parseUserMemberships(
3730
3898
  await call(
3731
3899
  accessToken,
3900
+ void 0,
3732
3901
  (client) => client.GET("/api/v1/users/{user_id}/memberships", {
3733
3902
  params: { path: { user_id: userId } }
3734
3903
  })
3735
3904
  )
3736
3905
  ),
3737
- listProjectBudgets: async (accessToken, userId) => parseCollection(
3906
+ listBudgetPolicy: async (accessToken, userId, activeOrgId) => parseBudgetPolicy(
3907
+ await call(
3908
+ accessToken,
3909
+ activeOrgId,
3910
+ (client) => client.GET("/api/v1/users/{user_id}/budget-policy", {
3911
+ params: { path: { user_id: userId } }
3912
+ })
3913
+ )
3914
+ ),
3915
+ listProjectBudgets: async (accessToken, userId, activeOrgId) => parseCollection(
3738
3916
  await call(
3739
3917
  accessToken,
3918
+ activeOrgId,
3740
3919
  (client) => client.GET("/api/v1/users/{user_id}/project-budgets", {
3741
3920
  params: { path: { user_id: userId } }
3742
3921
  })
@@ -3755,6 +3934,7 @@ var sdkManagementKeys = (options) => {
3755
3934
  };
3756
3935
  const fetchPage = (cursor) => call(
3757
3936
  accessToken,
3937
+ void 0,
3758
3938
  (client) => client.GET("/api/v1/projects", {
3759
3939
  params: {
3760
3940
  query: cursor === "" ? query : { ...query, cursor }
@@ -3766,6 +3946,7 @@ var sdkManagementKeys = (options) => {
3766
3946
  regenerate: async (accessToken, id, expiresAt) => parseKeyMaterial(
3767
3947
  await call(
3768
3948
  accessToken,
3949
+ void 0,
3769
3950
  (client) => client.POST("/api/v1/api-keys/{api_key_id}/secrets", {
3770
3951
  body: expiresAt === void 0 ? {} : { expires_at: expiresAt },
3771
3952
  params: { path: { api_key_id: id } }
@@ -3775,6 +3956,7 @@ var sdkManagementKeys = (options) => {
3775
3956
  update: async (accessToken, id, input) => parseApiKey(
3776
3957
  await call(
3777
3958
  accessToken,
3959
+ void 0,
3778
3960
  (client) => client.PATCH("/api/v1/api-keys/{api_key_id}", {
3779
3961
  body: {
3780
3962
  budget_currency: "EUR",
@@ -4108,6 +4290,7 @@ export {
4108
4290
  ManagementError,
4109
4291
  ManagementJwt,
4110
4292
  PERSONAL_KEY_ACTIVE_MARKER,
4293
+ PERSONAL_SELECTION_SUFFIX,
4111
4294
  REQUESTED_OAUTH_SCOPES,
4112
4295
  Route33Plugin,
4113
4296
  Route33Runtime,
@@ -4124,10 +4307,13 @@ export {
4124
4307
  drainPages,
4125
4308
  fixtureToWire,
4126
4309
  inspectSession,
4310
+ isPersonalSelection,
4127
4311
  leaseForAttribution,
4128
4312
  mintKey,
4313
+ orgSelectionPrefix,
4129
4314
  parseApiKey,
4130
4315
  parseAttribution,
4316
+ parseBudgetPolicy,
4131
4317
  parseCatalogResult,
4132
4318
  parseCollection,
4133
4319
  parseContractFixtures,