@parall/daemon 1.84.0 → 1.86.0

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.
@@ -8085,8 +8085,8 @@ var require_client_h2 = __commonJS({
8085
8085
  this.destroy(err);
8086
8086
  util.destroy(this[kSocket], err);
8087
8087
  }
8088
- function onHttp2SessionGoAway(errorCode) {
8089
- const err = this[kError] || new SocketError(`HTTP/2: "GOAWAY" frame received with code ${errorCode}`, util.getSocketInfo(this[kSocket]));
8088
+ function onHttp2SessionGoAway(errorCode2) {
8089
+ const err = this[kError] || new SocketError(`HTTP/2: "GOAWAY" frame received with code ${errorCode2}`, util.getSocketInfo(this[kSocket]));
8090
8090
  const client = this[kClient];
8091
8091
  client[kSocket] = null;
8092
8092
  client[kHTTPContext] = null;
@@ -26915,14 +26915,14 @@ var require_receiver2 = __commonJS({
26915
26915
  * @return {(Error|RangeError)} The error
26916
26916
  * @private
26917
26917
  */
26918
- createError(ErrorCtor, message, prefix, statusCode, errorCode) {
26918
+ createError(ErrorCtor, message, prefix, statusCode, errorCode2) {
26919
26919
  this._loop = false;
26920
26920
  this._errored = true;
26921
26921
  const err = new ErrorCtor(
26922
26922
  prefix ? `Invalid WebSocket frame: ${message}` : message
26923
26923
  );
26924
26924
  Error.captureStackTrace(err, this.createError);
26925
- err.code = errorCode;
26925
+ err.code = errorCode2;
26926
26926
  err[kStatusCode] = statusCode;
26927
26927
  return err;
26928
26928
  }
@@ -37904,19 +37904,19 @@ var require_dist_cjs29 = __commonJS({
37904
37904
  delete exception.Message;
37905
37905
  return exception;
37906
37906
  };
37907
- var throwDefaultError = ({ output, parsedBody, exceptionCtor, errorCode }) => {
37907
+ var throwDefaultError = ({ output, parsedBody, exceptionCtor, errorCode: errorCode2 }) => {
37908
37908
  const $metadata = deserializeMetadata(output);
37909
37909
  const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : void 0;
37910
37910
  const response = new exceptionCtor({
37911
- name: parsedBody?.code || parsedBody?.Code || errorCode || statusCode || "UnknownError",
37911
+ name: parsedBody?.code || parsedBody?.Code || errorCode2 || statusCode || "UnknownError",
37912
37912
  $fault: "client",
37913
37913
  $metadata
37914
37914
  });
37915
37915
  throw decorateServiceException2(response, parsedBody);
37916
37916
  };
37917
37917
  var withBaseException = (ExceptionCtor) => {
37918
- return ({ output, parsedBody, errorCode }) => {
37919
- throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode });
37918
+ return ({ output, parsedBody, errorCode: errorCode2 }) => {
37919
+ throwDefaultError({ output, parsedBody, exceptionCtor: ExceptionCtor, errorCode: errorCode2 });
37920
37920
  };
37921
37921
  };
37922
37922
  var deserializeMetadata = (output) => ({
@@ -64270,6 +64270,107 @@ function browserViewerRequestOptions(command, opts) {
64270
64270
  };
64271
64271
  }
64272
64272
 
64273
+ // ts/sdk/dist/wiki-upload.js
64274
+ function createWikiUploadFormData(params) {
64275
+ const form = new FormData();
64276
+ form.append("path", params.path);
64277
+ form.append("file", params.file);
64278
+ if (params.message)
64279
+ form.append("message", params.message);
64280
+ if (params.uploadId)
64281
+ form.append("upload_id", params.uploadId);
64282
+ if (params.conflict)
64283
+ form.append("conflict", params.conflict);
64284
+ if ("contentRoute" in params && params.contentRoute) {
64285
+ form.append("content_route", params.contentRoute);
64286
+ }
64287
+ return form;
64288
+ }
64289
+ function sendMultipartRequest(options) {
64290
+ if (options.onProgress && typeof XMLHttpRequest !== "undefined") {
64291
+ return multipartXHR(options, options.onProgress);
64292
+ }
64293
+ const timeoutSignal = AbortSignal.timeout(options.timeoutMs);
64294
+ const signal = options.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
64295
+ return fetch(options.url, {
64296
+ method: options.method,
64297
+ headers: options.headers,
64298
+ body: options.body,
64299
+ signal
64300
+ });
64301
+ }
64302
+ function multipartXHR(options, onProgress) {
64303
+ return new Promise((resolve2, reject) => {
64304
+ const xhr = new XMLHttpRequest();
64305
+ let settled = false;
64306
+ const finish = (fn) => {
64307
+ if (settled)
64308
+ return;
64309
+ settled = true;
64310
+ options.signal?.removeEventListener("abort", abortFromSignal);
64311
+ fn();
64312
+ };
64313
+ const abortFromSignal = () => xhr.abort();
64314
+ xhr.open(options.method, options.url, true);
64315
+ xhr.timeout = options.timeoutMs;
64316
+ for (const [name, value] of Object.entries(options.headers)) {
64317
+ xhr.setRequestHeader(name, value);
64318
+ }
64319
+ xhr.upload.onprogress = (event) => {
64320
+ try {
64321
+ onProgress(event.loaded, event.lengthComputable ? event.total : 0);
64322
+ } catch {
64323
+ }
64324
+ };
64325
+ xhr.onload = () => finish(() => {
64326
+ const responseHeaders = new Headers();
64327
+ for (const line of xhr.getAllResponseHeaders().trim().split(/[\r\n]+/)) {
64328
+ if (!line)
64329
+ continue;
64330
+ const separator = line.indexOf(":");
64331
+ if (separator > 0) {
64332
+ responseHeaders.append(line.slice(0, separator).trim(), line.slice(separator + 1).trim());
64333
+ }
64334
+ }
64335
+ const responseBody = xhr.status === 204 || xhr.responseText === "" ? null : xhr.responseText;
64336
+ resolve2(new Response(responseBody, {
64337
+ status: xhr.status,
64338
+ statusText: xhr.statusText,
64339
+ headers: responseHeaders
64340
+ }));
64341
+ });
64342
+ xhr.onerror = () => finish(() => reject(new TypeError("Network request failed")));
64343
+ xhr.ontimeout = () => finish(() => reject(new DOMException("Request timed out", "TimeoutError")));
64344
+ xhr.onabort = () => finish(() => reject(new DOMException("Request aborted", "AbortError")));
64345
+ if (options.signal?.aborted) {
64346
+ finish(() => reject(new DOMException("Request aborted", "AbortError")));
64347
+ return;
64348
+ }
64349
+ options.signal?.addEventListener("abort", abortFromSignal, { once: true });
64350
+ xhr.send(options.body);
64351
+ });
64352
+ }
64353
+
64354
+ // ts/sdk/dist/fetch-cause.js
64355
+ var GENERIC_FETCH_MESSAGES = /* @__PURE__ */ new Set(["Failed to fetch", "fetch failed"]);
64356
+ function describeFetchCause(err) {
64357
+ const inner = err?.cause;
64358
+ for (const candidate of [inner, err]) {
64359
+ if (!(candidate instanceof Error))
64360
+ continue;
64361
+ const code = candidate.code;
64362
+ const parts = [];
64363
+ if (typeof code === "string" && code && !candidate.message.includes(code))
64364
+ parts.push(code);
64365
+ if (candidate.message && !GENERIC_FETCH_MESSAGES.has(candidate.message)) {
64366
+ parts.push(candidate.message);
64367
+ }
64368
+ if (parts.length > 0)
64369
+ return parts.join(" ");
64370
+ }
64371
+ return void 0;
64372
+ }
64373
+
64273
64374
  // ts/sdk/dist/app-template-endpoints.js
64274
64375
  function appTemplateEndpoints(apiBase) {
64275
64376
  return {
@@ -64338,6 +64439,21 @@ function chatTeamGrantEndpoints(apiBase) {
64338
64439
  };
64339
64440
  }
64340
64441
 
64442
+ // ts/sdk/dist/team-invite-endpoints.js
64443
+ function teamInviteEndpoints(apiBase) {
64444
+ const seg = encodeURIComponent;
64445
+ return {
64446
+ TEMPLATE_INVITE_LINK: (orgId, templateId) => `${apiBase}/orgs/${seg(orgId)}/templates/${seg(templateId)}/invite-link`,
64447
+ TEMPLATE_INVITE_REQUESTS: (orgId, templateId) => `${apiBase}/orgs/${seg(orgId)}/templates/${seg(templateId)}/invite-link/requests`,
64448
+ TEMPLATE_INVITE_REQUEST_DECIDE: (orgId, templateId, requestId) => `${apiBase}/orgs/${seg(orgId)}/templates/${seg(templateId)}/invite-link/requests/${seg(requestId)}/decide`,
64449
+ TEAM_INVITE: (token) => `${apiBase}/team-invites/${seg(token)}`,
64450
+ TEAM_INVITE_REQUESTS: (token) => `${apiBase}/team-invites/${seg(token)}/requests`,
64451
+ TEAM_INVITE_REQUEST_MINE: (token) => `${apiBase}/team-invites/${seg(token)}/requests/mine`,
64452
+ TEAM_INVITE_REQUEST_CANCEL: (requestId) => `${apiBase}/team-invite-requests/${seg(requestId)}/cancel`,
64453
+ TEAM_INVITE_REQUEST_RETRY: (requestId) => `${apiBase}/team-invite-requests/${seg(requestId)}/retry`
64454
+ };
64455
+ }
64456
+
64341
64457
  // ts/sdk/dist/wechat-endpoints.js
64342
64458
  function wechatEndpoints(apiBase) {
64343
64459
  const agentBase = (orgId) => `${apiBase}/orgs/${orgId}/agents/me/wechat`;
@@ -64351,6 +64467,45 @@ function wechatEndpoints(apiBase) {
64351
64467
  };
64352
64468
  }
64353
64469
 
64470
+ // ts/sdk/dist/billing-endpoints.js
64471
+ function billingEndpoints(apiBase) {
64472
+ const billingBase = (orgId, accountId) => accountId ? `${apiBase}/orgs/${orgId}/billing/accounts/${accountId}` : `${apiBase}/orgs/${orgId}/billing`;
64473
+ return {
64474
+ // Billing & Credits (org-scoped). An account's endpoints live under
64475
+ // /billing/accounts/{accountId}; without an accountId they are the org's
64476
+ // own account's /billing routes.
64477
+ BILLING: (orgId, accountId) => billingBase(orgId, accountId),
64478
+ BILLING_TRANSACTIONS: (orgId, accountId) => `${billingBase(orgId, accountId)}/transactions`,
64479
+ BILLING_CHECKOUT: (orgId, accountId) => `${billingBase(orgId, accountId)}/checkout`,
64480
+ BILLING_AUTO_RELOAD: (orgId, accountId) => `${billingBase(orgId, accountId)}/auto-reload`,
64481
+ BILLING_SETUP_INTENT: (orgId, accountId) => `${billingBase(orgId, accountId)}/setup-intent`,
64482
+ BILLING_PORTAL_SESSION: (orgId, accountId) => `${billingBase(orgId, accountId)}/portal-session`,
64483
+ BILLING_USAGE_DAILY: (orgId, accountId) => `${billingBase(orgId, accountId)}/usage-daily`,
64484
+ BILLING_USAGE_HEATMAP: (orgId, accountId) => `${billingBase(orgId, accountId)}/usage-heatmap`,
64485
+ BILLING_ACCOUNTS: (orgId) => `${apiBase}/orgs/${orgId}/billing/accounts`,
64486
+ BILLING_ACCOUNT_CLOSE: (orgId, accountId) => `${apiBase}/orgs/${orgId}/billing/accounts/${accountId}/close`,
64487
+ BILLING_SETTINGS: (orgId) => `${apiBase}/orgs/${orgId}/billing/settings`,
64488
+ COMPUTE_PRICING: () => `${apiBase}/billing/compute-pricing`
64489
+ };
64490
+ }
64491
+
64492
+ // ts/sdk/dist/team-endpoints.js
64493
+ function teamEndpoints(apiBase) {
64494
+ return {
64495
+ TEAMS: (orgId) => `${apiBase}/orgs/${orgId}/teams`,
64496
+ /** The whole team tree in one read (team-chart-design.md §5). */
64497
+ TEAM_GRAPH: (orgId) => `${apiBase}/orgs/${orgId}/team-graph`,
64498
+ TEAM: (orgId, teamId) => `${apiBase}/orgs/${orgId}/teams/${teamId}`,
64499
+ TEAM_PARENT: (orgId, teamId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/parent`,
64500
+ /** What moving a team would change (team-chart-design.md §7). */
64501
+ TEAM_PARENT_PREVIEW: (orgId, teamId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/parent/preview`,
64502
+ TEAM_MEMBERS: (orgId, teamId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/members`,
64503
+ TEAM_MEMBER: (orgId, teamId, userId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/members/${userId}`,
64504
+ /** An agent's owning Team (agent-team-attribution-design.md §5.4). */
64505
+ AGENT_OWNING_TEAM: (orgId, agentId) => `${apiBase}/orgs/${orgId}/agents/${agentId}/owning-team`
64506
+ };
64507
+ }
64508
+
64354
64509
  // ts/sdk/dist/constants.js
64355
64510
  var API_BASE2 = "/api/v1";
64356
64511
  var WIKI_BASE = "/wiki/v1";
@@ -64383,11 +64538,7 @@ var ENDPOINTS = {
64383
64538
  ORG: (orgId) => `${API_BASE2}/orgs/${orgId}`,
64384
64539
  ORG_MEMBERS: (orgId) => `${API_BASE2}/orgs/${orgId}/members`,
64385
64540
  ORG_MEMBERS_FORMER: (orgId) => `${API_BASE2}/orgs/${orgId}/members/former`,
64386
- TEAMS: (orgId) => `${API_BASE2}/orgs/${orgId}/teams`,
64387
- TEAM: (orgId, teamId) => `${API_BASE2}/orgs/${orgId}/teams/${teamId}`,
64388
- TEAM_PARENT: (orgId, teamId) => `${API_BASE2}/orgs/${orgId}/teams/${teamId}/parent`,
64389
- TEAM_MEMBERS: (orgId, teamId) => `${API_BASE2}/orgs/${orgId}/teams/${teamId}/members`,
64390
- TEAM_MEMBER: (orgId, teamId, userId) => `${API_BASE2}/orgs/${orgId}/teams/${teamId}/members/${userId}`,
64541
+ ...teamEndpoints(API_BASE2),
64391
64542
  ORG_MEMBERS_ONLINE: (orgId) => `${API_BASE2}/orgs/${orgId}/members/online`,
64392
64543
  LLM_PROVIDERS: (orgId) => `${API_BASE2}/orgs/${orgId}/llm-providers`,
64393
64544
  LLM_PROVIDER: (orgId, providerId) => `${API_BASE2}/orgs/${orgId}/llm-providers/${providerId}`,
@@ -64845,19 +64996,12 @@ var ENDPOINTS = {
64845
64996
  TEMPLATE: (orgId, templateId) => `${API_BASE2}/orgs/${orgId}/templates/${templateId}`,
64846
64997
  TEMPLATE_DEPLOYMENTS: (orgId) => `${API_BASE2}/orgs/${orgId}/template-deployments`,
64847
64998
  TEMPLATE_DEPLOYMENT: (orgId, deploymentId) => `${API_BASE2}/orgs/${orgId}/template-deployments/${deploymentId}`,
64999
+ // Team launch / team invite links (public preview + signed-in requests)
65000
+ ...teamInviteEndpoints(API_BASE2),
64848
65001
  CLIP_DEPENDENCIES_CHECK: (orgId) => `${API_BASE2}/orgs/${orgId}/clip-dependencies/check`,
64849
65002
  // Onboarding wizard progress (org-scoped, self)
64850
65003
  ONBOARDING_PROGRESS: (orgId) => `${API_BASE2}/orgs/${orgId}/onboarding`,
64851
- // Billing & Credits (org-scoped)
64852
- BILLING: (orgId) => `${API_BASE2}/orgs/${orgId}/billing`,
64853
- BILLING_TRANSACTIONS: (orgId) => `${API_BASE2}/orgs/${orgId}/billing/transactions`,
64854
- BILLING_CHECKOUT: (orgId) => `${API_BASE2}/orgs/${orgId}/billing/checkout`,
64855
- BILLING_AUTO_RELOAD: (orgId) => `${API_BASE2}/orgs/${orgId}/billing/auto-reload`,
64856
- BILLING_SETUP_INTENT: (orgId) => `${API_BASE2}/orgs/${orgId}/billing/setup-intent`,
64857
- BILLING_PORTAL_SESSION: (orgId) => `${API_BASE2}/orgs/${orgId}/billing/portal-session`,
64858
- BILLING_USAGE_DAILY: (orgId) => `${API_BASE2}/orgs/${orgId}/billing/usage-daily`,
64859
- BILLING_USAGE_HEATMAP: (orgId) => `${API_BASE2}/orgs/${orgId}/billing/usage-heatmap`,
64860
- COMPUTE_PRICING: () => `${API_BASE2}/billing/compute-pricing`,
65004
+ ...billingEndpoints(API_BASE2),
64861
65005
  // Runtime capability table (public, no auth) — SSOT for the create/settings
64862
65006
  // interlock: per-runtime compute modes, native model family, cross-family
64863
65007
  // availability, and recommended model.
@@ -66015,105 +66159,222 @@ var AgentCallerScopeClient = class extends ChatTeamGrantClient {
66015
66159
  }
66016
66160
  };
66017
66161
 
66018
- // ts/sdk/dist/wiki-upload.js
66019
- function createWikiUploadFormData(params) {
66020
- const form = new FormData();
66021
- form.append("path", params.path);
66022
- form.append("file", params.file);
66023
- if (params.message)
66024
- form.append("message", params.message);
66025
- if (params.uploadId)
66026
- form.append("upload_id", params.uploadId);
66027
- if (params.conflict)
66028
- form.append("conflict", params.conflict);
66029
- if ("contentRoute" in params && params.contentRoute) {
66030
- form.append("content_route", params.contentRoute);
66162
+ // ts/sdk/dist/agent-owning-team-client.js
66163
+ var AgentOwningTeamClient = class extends AgentCallerScopeClient {
66164
+ /**
66165
+ * Moves the agent to another Team, or to the organization with `team_id`
66166
+ * null. Pass the Team you saw as `expected_team_id`: someone else's change
66167
+ * in between answers 409 OWNING_TEAM_CHANGED.
66168
+ */
66169
+ async setAgentOwningTeam(orgId, agentId, req) {
66170
+ return this.request("PUT", ENDPOINTS.AGENT_OWNING_TEAM(orgId, agentId), req);
66031
66171
  }
66032
- return form;
66033
- }
66034
- function sendMultipartRequest(options) {
66035
- if (options.onProgress && typeof XMLHttpRequest !== "undefined") {
66036
- return multipartXHR(options, options.onProgress);
66172
+ };
66173
+
66174
+ // ts/sdk/dist/team-graph-client.js
66175
+ var TeamGraphClient = class extends AgentOwningTeamClient {
66176
+ async getTeamGraph(orgId, opts) {
66177
+ const query = opts?.includeAccess ? "?include=access" : "";
66178
+ return this.request("GET", `${ENDPOINTS.TEAM_GRAPH(orgId)}${query}`);
66037
66179
  }
66038
- const timeoutSignal = AbortSignal.timeout(options.timeoutMs);
66039
- const signal = options.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
66040
- return fetch(options.url, {
66041
- method: options.method,
66042
- headers: options.headers,
66043
- body: options.body,
66044
- signal
66045
- });
66046
- }
66047
- function multipartXHR(options, onProgress) {
66048
- return new Promise((resolve2, reject) => {
66049
- const xhr = new XMLHttpRequest();
66050
- let settled = false;
66051
- const finish = (fn) => {
66052
- if (settled)
66053
- return;
66054
- settled = true;
66055
- options.signal?.removeEventListener("abort", abortFromSignal);
66056
- fn();
66057
- };
66058
- const abortFromSignal = () => xhr.abort();
66059
- xhr.open(options.method, options.url, true);
66060
- xhr.timeout = options.timeoutMs;
66061
- for (const [name, value] of Object.entries(options.headers)) {
66062
- xhr.setRequestHeader(name, value);
66063
- }
66064
- xhr.upload.onprogress = (event) => {
66065
- try {
66066
- onProgress(event.loaded, event.lengthComputable ? event.total : 0);
66067
- } catch {
66068
- }
66069
- };
66070
- xhr.onload = () => finish(() => {
66071
- const responseHeaders = new Headers();
66072
- for (const line of xhr.getAllResponseHeaders().trim().split(/[\r\n]+/)) {
66073
- if (!line)
66074
- continue;
66075
- const separator = line.indexOf(":");
66076
- if (separator > 0) {
66077
- responseHeaders.append(line.slice(0, separator).trim(), line.slice(separator + 1).trim());
66078
- }
66079
- }
66080
- const responseBody = xhr.status === 204 || xhr.responseText === "" ? null : xhr.responseText;
66081
- resolve2(new Response(responseBody, {
66082
- status: xhr.status,
66083
- statusText: xhr.statusText,
66084
- headers: responseHeaders
66085
- }));
66180
+ /**
66181
+ * Who would come to see more or less through teams if the team moved under
66182
+ * `parentTeamId`, or to the top level with null, without moving it
66183
+ * (team-chart-design.md §7). Org owners and admins only. Refuses what the move
66184
+ * would refuse, with the same codes. 503 when it cannot compute the whole answer
66185
+ * (`TEAM_MOVE_PREVIEW_WIKI_UNAVAILABLE`, `TEAM_MOVE_PREVIEW_TIMEOUT`,
66186
+ * `TEAM_MOVE_PREVIEW_TOO_LARGE`). Send `tree_revision` back on `setTeamParent`.
66187
+ */
66188
+ async previewTeamMove(orgId, teamId, parentTeamId) {
66189
+ return this.request("POST", ENDPOINTS.TEAM_PARENT_PREVIEW(orgId, teamId), {
66190
+ parent_team_id: parentTeamId
66086
66191
  });
66087
- xhr.onerror = () => finish(() => reject(new TypeError("Network request failed")));
66088
- xhr.ontimeout = () => finish(() => reject(new DOMException("Request timed out", "TimeoutError")));
66089
- xhr.onabort = () => finish(() => reject(new DOMException("Request aborted", "AbortError")));
66090
- if (options.signal?.aborted) {
66091
- finish(() => reject(new DOMException("Request aborted", "AbortError")));
66092
- return;
66093
- }
66094
- options.signal?.addEventListener("abort", abortFromSignal, { once: true });
66095
- xhr.send(options.body);
66096
- });
66097
- }
66192
+ }
66193
+ };
66098
66194
 
66099
- // ts/sdk/dist/fetch-cause.js
66100
- var GENERIC_FETCH_MESSAGES = /* @__PURE__ */ new Set(["Failed to fetch", "fetch failed"]);
66101
- function describeFetchCause(err) {
66102
- const inner = err?.cause;
66103
- for (const candidate of [inner, err]) {
66104
- if (!(candidate instanceof Error))
66105
- continue;
66106
- const code = candidate.code;
66107
- const parts = [];
66108
- if (typeof code === "string" && code && !candidate.message.includes(code))
66109
- parts.push(code);
66110
- if (candidate.message && !GENERIC_FETCH_MESSAGES.has(candidate.message)) {
66111
- parts.push(candidate.message);
66195
+ // ts/sdk/dist/billing-client.js
66196
+ var BillingClient = class extends TeamGraphClient {
66197
+ // ---- Billing & Credits (org-scoped) ----
66198
+ //
66199
+ // Every account method takes an optional trailing accountId: omitted, it
66200
+ // acts on the org's own account through the org's /billing routes; given,
66201
+ // on that account under /billing/accounts/{accountId}.
66202
+ async getBilling(orgId, accountId) {
66203
+ return this.request("GET", ENDPOINTS.BILLING(orgId, accountId));
66204
+ }
66205
+ async getUsageDaily(orgId, opts, accountId) {
66206
+ const params = new URLSearchParams();
66207
+ params.set("start_date", opts.start_date);
66208
+ params.set("end_date", opts.end_date);
66209
+ return this.request("GET", `${ENDPOINTS.BILLING_USAGE_DAILY(orgId, accountId)}?${params}`);
66210
+ }
66211
+ async getUsageHeatmap(orgId, opts, accountId) {
66212
+ const params = new URLSearchParams();
66213
+ params.set("start_time", opts.start_time);
66214
+ if (opts.limit != null)
66215
+ params.set("limit", String(opts.limit));
66216
+ if (opts.offset != null)
66217
+ params.set("offset", String(opts.offset));
66218
+ return this.request("GET", `${ENDPOINTS.BILLING_USAGE_HEATMAP(orgId, accountId)}?${params}`);
66219
+ }
66220
+ async listBillingTransactions(orgId, opts, accountId) {
66221
+ const params = new URLSearchParams();
66222
+ if (opts?.cursor)
66223
+ params.set("cursor", opts.cursor);
66224
+ if (opts?.limit)
66225
+ params.set("limit", String(opts.limit));
66226
+ if (opts?.types?.length)
66227
+ params.set("types", opts.types.join(","));
66228
+ if (opts?.user_id)
66229
+ params.set("user_id", opts.user_id);
66230
+ if (opts?.unresolved_actor)
66231
+ params.set("unresolved_actor", "true");
66232
+ if (opts?.machine_id)
66233
+ params.set("machine_id", opts.machine_id);
66234
+ if (opts?.unresolved_machine)
66235
+ params.set("unresolved_machine", "true");
66236
+ if (opts?.from)
66237
+ params.set("from", opts.from);
66238
+ if (opts?.to)
66239
+ params.set("to", opts.to);
66240
+ const qs = params.toString();
66241
+ return this.request("GET", `${ENDPOINTS.BILLING_TRANSACTIONS(orgId, accountId)}${qs ? `?${qs}` : ""}`);
66242
+ }
66243
+ async listBillingTransactionAgentGroups(orgId, opts, accountId) {
66244
+ const params = new URLSearchParams({ group_by: "agent" });
66245
+ if (opts?.from)
66246
+ params.set("from", opts.from);
66247
+ if (opts?.to)
66248
+ params.set("to", opts.to);
66249
+ return this.request("GET", `${ENDPOINTS.BILLING_TRANSACTIONS(orgId, accountId)}?${params}`);
66250
+ }
66251
+ async listBillingTransactionMachineGroups(orgId, opts, accountId) {
66252
+ const params = new URLSearchParams({ group_by: "machine" });
66253
+ if (opts?.from)
66254
+ params.set("from", opts.from);
66255
+ if (opts?.to)
66256
+ params.set("to", opts.to);
66257
+ return this.request("GET", `${ENDPOINTS.BILLING_TRANSACTIONS(orgId, accountId)}?${params}`);
66258
+ }
66259
+ async createCheckout(orgId, req, accountId) {
66260
+ return this.request("POST", ENDPOINTS.BILLING_CHECKOUT(orgId, accountId), req);
66261
+ }
66262
+ /**
66263
+ * Creates a Stripe-hosted card-collection session (Checkout in mode=setup)
66264
+ * and returns the redirect URL. The frontend navigates to `setup_url` and
66265
+ * Stripe handles the card form; the resulting payment_method is recorded
66266
+ * server-side via the `setup_intent.succeeded` webhook. Mirrors
66267
+ * `POST /billing/setup-intent`.
66268
+ */
66269
+ async createSetupIntent(orgId, req, accountId) {
66270
+ return this.request("POST", ENDPOINTS.BILLING_SETUP_INTENT(orgId, accountId), req);
66271
+ }
66272
+ /**
66273
+ * Returns a link to the Stripe-hosted customer portal for the account,
66274
+ * where its managers download invoices and edit the billing details
66275
+ * printed on them. Mirrors `POST /billing/portal-session`.
66276
+ */
66277
+ async createBillingPortalSession(orgId, accountId) {
66278
+ return this.request("POST", ENDPOINTS.BILLING_PORTAL_SESSION(orgId, accountId));
66279
+ }
66280
+ async getAutoReloadSettings(orgId, accountId) {
66281
+ return this.request("GET", ENDPOINTS.BILLING_AUTO_RELOAD(orgId, accountId));
66282
+ }
66283
+ async updateAutoReloadSettings(orgId, req, accountId) {
66284
+ return this.request("PUT", ENDPOINTS.BILLING_AUTO_RELOAD(orgId, accountId), req);
66285
+ }
66286
+ /** The org's billing accounts the caller may view, the org's own first. */
66287
+ async listBillingAccounts(orgId) {
66288
+ const res = await this.request("GET", ENDPOINTS.BILLING_ACCOUNTS(orgId));
66289
+ return res.data;
66290
+ }
66291
+ /** Opens a Team's account (org owners and admins, while Team accounts are
66292
+ * on). Reopening a closed account starts it at zero. */
66293
+ async openBillingAccount(orgId, teamId) {
66294
+ return this.request("POST", ENDPOINTS.BILLING_ACCOUNTS(orgId), { team_id: teamId });
66295
+ }
66296
+ /** Closes a Team account and moves its balance into the org's account. */
66297
+ async closeBillingAccount(orgId, accountId) {
66298
+ await this.request("POST", ENDPOINTS.BILLING_ACCOUNT_CLOSE(orgId, accountId));
66299
+ }
66300
+ async getBillingSettings(orgId) {
66301
+ return this.request("GET", ENDPOINTS.BILLING_SETTINGS(orgId));
66302
+ }
66303
+ /** Sets the org's rules for Team accounts (the org owner only). */
66304
+ async updateBillingSettings(orgId, req) {
66305
+ return this.request("PATCH", ENDPOINTS.BILLING_SETTINGS(orgId), req);
66306
+ }
66307
+ // The admin grant endpoints (POST/GET /internal/admin/orgs/
66308
+ // {id}/grants) intentionally do NOT live on this public client — they
66309
+ // are mounted on the unauthenticated `/internal/*` surface and reachable
66310
+ // only via internal network paths. The admin dashboard maintains its
66311
+ // own thin client (`ts/admin/lib/api.ts`) that hits these directly.
66312
+ async getComputePricing() {
66313
+ const resp = await this.request("GET", ENDPOINTS.COMPUTE_PRICING());
66314
+ return resp.data;
66315
+ }
66316
+ };
66317
+
66318
+ // ts/sdk/dist/team-invite-client.js
66319
+ var TeamInviteClient = class extends BillingClient {
66320
+ /** Org owner/admin: the template's current launch link, or null while it
66321
+ * has none (`TEAM_INVITE_LINK_NOT_FOUND`). Never creates one. */
66322
+ async getTemplateInviteLink(orgId, templateId) {
66323
+ try {
66324
+ return await this.request("GET", ENDPOINTS.TEMPLATE_INVITE_LINK(orgId, templateId));
66325
+ } catch (err) {
66326
+ if (errorCode(err) === "TEAM_INVITE_LINK_NOT_FOUND")
66327
+ return null;
66328
+ throw err;
66112
66329
  }
66113
- if (parts.length > 0)
66114
- return parts.join(" ");
66115
66330
  }
66116
- return void 0;
66331
+ /** Org owner/admin: a new launch link, replacing the template's previous
66332
+ * one, whose URL stops working. Every new team waits for an admin's
66333
+ * approval unless `requireApproval` is false (the server's default is
66334
+ * true). */
66335
+ async createTemplateInviteLink(orgId, templateId, options = {}) {
66336
+ return this.request("POST", ENDPOINTS.TEMPLATE_INVITE_LINK(orgId, templateId), options.requireApproval !== void 0 ? { require_approval: options.requireApproval } : {});
66337
+ }
66338
+ /** Org owner/admin: the requests waiting for approval on the template's
66339
+ * current link, oldest first. */
66340
+ async listTemplateInviteRequests(orgId, templateId) {
66341
+ const res = await this.request("GET", ENDPOINTS.TEMPLATE_INVITE_REQUESTS(orgId, templateId));
66342
+ return res.requests ?? [];
66343
+ }
66344
+ /** Org owner/admin: approve or decline a waiting request. Approving brings
66345
+ * a requester from outside the org in as a member and starts their team.
66346
+ * `ALREADY_DECIDED` (409) when someone decided first. */
66347
+ async decideTemplateInviteRequest(orgId, templateId, requestId, decision) {
66348
+ return this.request("POST", ENDPOINTS.TEMPLATE_INVITE_REQUEST_DECIDE(orgId, templateId, requestId), { decision });
66349
+ }
66350
+ /** Public, no login needed: what a link shows before anyone signs in.
66351
+ * `TEAM_INVITE_NOT_FOUND` (404) for an unknown, revoked or switched-off
66352
+ * link; `TEAM_INVITE_EXPIRED` (410) once it lapsed. */
66353
+ async getTeamInvite(token) {
66354
+ return this.request("GET", ENDPOINTS.TEAM_INVITE(token));
66355
+ }
66356
+ /** Ask for a new team through a link. Submitting again returns the
66357
+ * caller's open request instead of making another. */
66358
+ async createTeamInviteRequest(token, body) {
66359
+ return this.request("POST", ENDPOINTS.TEAM_INVITE_REQUESTS(token), body);
66360
+ }
66361
+ /** The caller's latest request through this link, with its derived phase.
66362
+ * `TEAM_INVITE_REQUEST_NOT_FOUND` (404) while they have none. */
66363
+ async getMyTeamInviteRequest(token) {
66364
+ return this.request("GET", ENDPOINTS.TEAM_INVITE_REQUEST_MINE(token));
66365
+ }
66366
+ /** The requester withdraws a request that is still waiting. */
66367
+ async cancelTeamInviteRequest(requestId) {
66368
+ return this.request("POST", ENDPOINTS.TEAM_INVITE_REQUEST_CANCEL(requestId));
66369
+ }
66370
+ /** The requester retries a failed launch; the server never makes a second
66371
+ * squad for the same request. */
66372
+ async retryTeamInviteRequest(requestId) {
66373
+ return this.request("POST", ENDPOINTS.TEAM_INVITE_REQUEST_RETRY(requestId));
66374
+ }
66375
+ };
66376
+ function errorCode(err) {
66377
+ return typeof err === "object" && err !== null ? err.code : void 0;
66117
66378
  }
66118
66379
 
66119
66380
  // ts/sdk/dist/wiki-changeset.js
@@ -66151,7 +66412,7 @@ function legacyHeartbeatFromReport(report) {
66151
66412
  detectedRuntimes
66152
66413
  };
66153
66414
  }
66154
- var ParallClient = class _ParallClient extends AgentCallerScopeClient {
66415
+ var ParallClient = class _ParallClient extends TeamInviteClient {
66155
66416
  baseUrl;
66156
66417
  wikiBaseUrl;
66157
66418
  token;
@@ -66552,10 +66813,16 @@ var ParallClient = class _ParallClient extends AgentCallerScopeClient {
66552
66813
  async deleteTeam(orgId, teamId) {
66553
66814
  return this.request("DELETE", ENDPOINTS.TEAM(orgId, teamId));
66554
66815
  }
66555
- /** Moves a team under `parentTeamId`, or to the top level with null. Org-admin action. */
66556
- async setTeamParent(orgId, teamId, parentTeamId) {
66816
+ /**
66817
+ * Moves a team under `parentTeamId`, or to the top level with null. Org-admin
66818
+ * action. `expectedTreeRevision` is the revision the move's preview returned: if
66819
+ * the org's team tree changed since, nothing moves and it answers 409
66820
+ * `TEAM_TREE_CHANGED`. Without it nothing is checked.
66821
+ */
66822
+ async setTeamParent(orgId, teamId, parentTeamId, opts) {
66557
66823
  return this.request("PUT", ENDPOINTS.TEAM_PARENT(orgId, teamId), {
66558
- parent_team_id: parentTeamId
66824
+ parent_team_id: parentTeamId,
66825
+ ...opts?.expectedTreeRevision ? { expected_tree_revision: opts.expectedTreeRevision } : {}
66559
66826
  });
66560
66827
  }
66561
66828
  /** Roster with display info, minus members who left the org; `includeSubteams` adds subteam rows. */
@@ -68219,100 +68486,6 @@ var ParallClient = class _ParallClient extends AgentCallerScopeClient {
68219
68486
  async updateOnboardingProgress(orgId, request) {
68220
68487
  return this.request("PATCH", ENDPOINTS.ONBOARDING_PROGRESS(orgId), request);
68221
68488
  }
68222
- // ---- Billing & Credits (org-scoped) ----
68223
- async getBilling(orgId) {
68224
- return this.request("GET", ENDPOINTS.BILLING(orgId));
68225
- }
68226
- async getUsageDaily(orgId, opts) {
68227
- const params = new URLSearchParams();
68228
- params.set("start_date", opts.start_date);
68229
- params.set("end_date", opts.end_date);
68230
- return this.request("GET", `${ENDPOINTS.BILLING_USAGE_DAILY(orgId)}?${params}`);
68231
- }
68232
- async getUsageHeatmap(orgId, opts) {
68233
- const params = new URLSearchParams();
68234
- params.set("start_time", opts.start_time);
68235
- if (opts.limit != null)
68236
- params.set("limit", String(opts.limit));
68237
- if (opts.offset != null)
68238
- params.set("offset", String(opts.offset));
68239
- return this.request("GET", `${ENDPOINTS.BILLING_USAGE_HEATMAP(orgId)}?${params}`);
68240
- }
68241
- async listBillingTransactions(orgId, opts) {
68242
- const params = new URLSearchParams();
68243
- if (opts?.cursor)
68244
- params.set("cursor", opts.cursor);
68245
- if (opts?.limit)
68246
- params.set("limit", String(opts.limit));
68247
- if (opts?.types?.length)
68248
- params.set("types", opts.types.join(","));
68249
- if (opts?.user_id)
68250
- params.set("user_id", opts.user_id);
68251
- if (opts?.unresolved_actor)
68252
- params.set("unresolved_actor", "true");
68253
- if (opts?.machine_id)
68254
- params.set("machine_id", opts.machine_id);
68255
- if (opts?.unresolved_machine)
68256
- params.set("unresolved_machine", "true");
68257
- if (opts?.from)
68258
- params.set("from", opts.from);
68259
- if (opts?.to)
68260
- params.set("to", opts.to);
68261
- const qs = params.toString();
68262
- return this.request("GET", `${ENDPOINTS.BILLING_TRANSACTIONS(orgId)}${qs ? `?${qs}` : ""}`);
68263
- }
68264
- async listBillingTransactionAgentGroups(orgId, opts) {
68265
- const params = new URLSearchParams({ group_by: "agent" });
68266
- if (opts?.from)
68267
- params.set("from", opts.from);
68268
- if (opts?.to)
68269
- params.set("to", opts.to);
68270
- return this.request("GET", `${ENDPOINTS.BILLING_TRANSACTIONS(orgId)}?${params}`);
68271
- }
68272
- async listBillingTransactionMachineGroups(orgId, opts) {
68273
- const params = new URLSearchParams({ group_by: "machine" });
68274
- if (opts?.from)
68275
- params.set("from", opts.from);
68276
- if (opts?.to)
68277
- params.set("to", opts.to);
68278
- return this.request("GET", `${ENDPOINTS.BILLING_TRANSACTIONS(orgId)}?${params}`);
68279
- }
68280
- async createCheckout(orgId, req) {
68281
- return this.request("POST", ENDPOINTS.BILLING_CHECKOUT(orgId), req);
68282
- }
68283
- /**
68284
- * Creates a Stripe-hosted card-collection session (Checkout in mode=setup)
68285
- * and returns the redirect URL. The frontend navigates to `setup_url` and
68286
- * Stripe handles the card form; the resulting payment_method is recorded
68287
- * server-side via the `setup_intent.succeeded` webhook. Mirrors
68288
- * `POST /billing/setup-intent`.
68289
- */
68290
- async createSetupIntent(orgId, req) {
68291
- return this.request("POST", ENDPOINTS.BILLING_SETUP_INTENT(orgId), req);
68292
- }
68293
- /**
68294
- * Returns a link to the Stripe-hosted customer portal for the org, where
68295
- * admins download invoices and edit the billing details printed on them.
68296
- * Mirrors `POST /billing/portal-session`.
68297
- */
68298
- async createBillingPortalSession(orgId) {
68299
- return this.request("POST", ENDPOINTS.BILLING_PORTAL_SESSION(orgId));
68300
- }
68301
- async getAutoReloadSettings(orgId) {
68302
- return this.request("GET", ENDPOINTS.BILLING_AUTO_RELOAD(orgId));
68303
- }
68304
- async updateAutoReloadSettings(orgId, req) {
68305
- return this.request("PUT", ENDPOINTS.BILLING_AUTO_RELOAD(orgId), req);
68306
- }
68307
- // The admin grant endpoints (POST/GET /internal/admin/orgs/
68308
- // {id}/grants) intentionally do NOT live on this public client — they
68309
- // are mounted on the unauthenticated `/internal/*` surface and reachable
68310
- // only via internal network paths. The admin dashboard maintains its
68311
- // own thin client (`ts/admin/lib/api.ts`) that hits these directly.
68312
- async getComputePricing() {
68313
- const resp = await this.request("GET", ENDPOINTS.COMPUTE_PRICING());
68314
- return resp.data;
68315
- }
68316
68489
  /** Runtime capability table (public) — SSOT for the create/settings interlock. */
68317
68490
  async getRuntimes() {
68318
68491
  const resp = await this.request("GET", ENDPOINTS.RUNTIMES());