perstack 0.0.92 → 0.0.93

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.
@@ -1577,7 +1577,6 @@ const expertNameRegex$1 = /^(@[a-z0-9][a-z0-9_-]*\/)?[a-z0-9][a-z0-9_-]*$/;
1577
1577
  const expertVersionRegex$1 = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\w.-]+)?(?:\+[\w.-]+)?$/;
1578
1578
  const tagNameRegex$1 = /^[a-z0-9][a-z0-9_-]*$/;
1579
1579
  const maxExpertNameLength$1 = 255;
1580
- const defaultMaxSteps = 100;
1581
1580
  const defaultMaxRetries = 5;
1582
1581
  const defaultTimeout = 5 * 1e3 * 60;
1583
1582
  const maxSkillNameLength$1 = 255;
@@ -6246,6 +6245,26 @@ function preprocess(fn, schema) {
6246
6245
  return pipe(transform(fn), schema);
6247
6246
  }
6248
6247
 
6248
+ //#endregion
6249
+ //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/compat.js
6250
+ /** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
6251
+ const ZodIssueCode = {
6252
+ invalid_type: "invalid_type",
6253
+ too_big: "too_big",
6254
+ too_small: "too_small",
6255
+ invalid_format: "invalid_format",
6256
+ not_multiple_of: "not_multiple_of",
6257
+ unrecognized_keys: "unrecognized_keys",
6258
+ invalid_union: "invalid_union",
6259
+ invalid_key: "invalid_key",
6260
+ invalid_element: "invalid_element",
6261
+ invalid_value: "invalid_value",
6262
+ custom: "custom"
6263
+ };
6264
+ /** @deprecated Do not use. Stub definition, only included for zod-to-json-schema compatibility. */
6265
+ var ZodFirstPartyTypeKind;
6266
+ (function(ZodFirstPartyTypeKind) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
6267
+
6249
6268
  //#endregion
6250
6269
  //#region ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/coerce.js
6251
6270
  function number(params) {
@@ -6296,7 +6315,7 @@ const toolCallPartSchema = basePartSchema.extend({
6296
6315
  type: literal("toolCallPart"),
6297
6316
  toolCallId: string(),
6298
6317
  toolName: string(),
6299
- args: unknown()
6318
+ args: record(string(), unknown())
6300
6319
  });
6301
6320
  const thinkingPartSchema = basePartSchema.extend({
6302
6321
  type: literal("thinkingPart"),
@@ -6593,7 +6612,6 @@ const checkpointStatusSchema = _enum([
6593
6612
  "completed",
6594
6613
  "stoppedByInteractiveTool",
6595
6614
  "stoppedByDelegate",
6596
- "stoppedByExceededMaxSteps",
6597
6615
  "stoppedByError",
6598
6616
  "stoppedByCancellation"
6599
6617
  ]);
@@ -6646,6 +6664,61 @@ const checkpointSchema = object({
6646
6664
  retryCount: number$1().optional()
6647
6665
  });
6648
6666
 
6667
+ //#endregion
6668
+ //#region ../../packages/core/src/utils/expert-type.ts
6669
+ function getExpertType(expertName) {
6670
+ return expertName.startsWith("@") ? "delegate" : "coordinator";
6671
+ }
6672
+ function isCoordinatorExpert(expertName) {
6673
+ return getExpertType(expertName) === "coordinator";
6674
+ }
6675
+ function isDelegateExpert(expertName) {
6676
+ return getExpertType(expertName) === "delegate";
6677
+ }
6678
+ /**
6679
+ * Returns the scope of an expert.
6680
+ * - Coordinator "game-producer" -> "game-producer"
6681
+ * - Delegate "@game-producer/designer" -> "game-producer"
6682
+ */
6683
+ function getExpertScope(expertName) {
6684
+ if (isDelegateExpert(expertName)) {
6685
+ const withoutAt = expertName.slice(1);
6686
+ const slashIndex = withoutAt.indexOf("/");
6687
+ return slashIndex === -1 ? withoutAt : withoutAt.slice(0, slashIndex);
6688
+ }
6689
+ return expertName;
6690
+ }
6691
+ /**
6692
+ * Validates whether a delegation from source to target is allowed.
6693
+ * Returns null if valid, an error message string if invalid.
6694
+ *
6695
+ * Rules:
6696
+ * - No self-delegation
6697
+ * - If target is a delegate (@scope/name), source must be in the same scope
6698
+ * - A delegate cannot delegate to its own coordinator
6699
+ */
6700
+ function validateDelegation(source, target) {
6701
+ if (source === target) return `Expert "${source}" cannot delegate to itself`;
6702
+ const sourceScope = getExpertScope(source);
6703
+ if (isDelegateExpert(target)) {
6704
+ if (sourceScope !== getExpertScope(target)) return `Expert "${source}" cannot delegate to out-of-scope delegate "${target}"`;
6705
+ }
6706
+ if (isDelegateExpert(source) && isCoordinatorExpert(target) && target === sourceScope) return `Delegate "${source}" cannot delegate to its own coordinator "${target}"`;
6707
+ return null;
6708
+ }
6709
+ /**
6710
+ * Validates all delegations for an expert.
6711
+ * Returns an array of error messages (empty if all valid).
6712
+ */
6713
+ function validateAllDelegations(expertName, delegates) {
6714
+ const errors = [];
6715
+ for (const delegate of delegates) {
6716
+ const error = validateDelegation(expertName, delegate);
6717
+ if (error) errors.push(error);
6718
+ }
6719
+ return errors;
6720
+ }
6721
+
6649
6722
  //#endregion
6650
6723
  //#region ../../packages/core/src/schemas/provider-tools.ts
6651
6724
  const anthropicProviderToolNameSchema = _enum([
@@ -6791,7 +6864,11 @@ const skillSchema$1 = discriminatedUnion("type", [
6791
6864
 
6792
6865
  //#endregion
6793
6866
  //#region ../../packages/core/src/schemas/expert.ts
6794
- const expertSchema$1 = object({
6867
+ /**
6868
+ * Base object schema for Expert. Use this for `.omit()` / `.pick()` operations.
6869
+ * For parsing with delegation validation, use `expertSchema` instead.
6870
+ */
6871
+ const expertBaseSchema = object({
6795
6872
  key: string().regex(expertKeyRegex$1).min(1),
6796
6873
  name: string().regex(expertNameRegex$1).min(1).max(maxExpertNameLength$1),
6797
6874
  version: string().regex(expertVersionRegex$1),
@@ -6826,13 +6903,24 @@ const expertSchema$1 = object({
6826
6903
  providerSkills: array(anthropicProviderSkillSchema).optional(),
6827
6904
  providerToolOptions: providerToolOptionsSchema
6828
6905
  });
6906
+ /**
6907
+ * Expert schema with delegation rule validation.
6908
+ * Rejects self-delegation, out-of-scope delegates, and delegate-to-own-coordinator.
6909
+ */
6910
+ const expertSchema$1 = expertBaseSchema.superRefine((data, ctx) => {
6911
+ const errors = validateAllDelegations(data.key, data.delegates);
6912
+ for (const error of errors) ctx.addIssue({
6913
+ code: ZodIssueCode.custom,
6914
+ message: error,
6915
+ path: ["delegates"]
6916
+ });
6917
+ });
6829
6918
 
6830
6919
  //#endregion
6831
6920
  //#region ../../packages/core/src/schemas/job.ts
6832
6921
  const jobStatusSchema$1 = _enum([
6833
6922
  "running",
6834
6923
  "completed",
6835
- "stoppedByMaxSteps",
6836
6924
  "stoppedByInteractiveTool",
6837
6925
  "stoppedByError",
6838
6926
  "stoppedByCancellation"
@@ -6843,7 +6931,6 @@ const jobSchema$1 = object({
6843
6931
  coordinatorExpertKey: string(),
6844
6932
  runtimeVersion: runtimeVersionSchema$1,
6845
6933
  totalSteps: number$1(),
6846
- maxSteps: number$1().optional(),
6847
6934
  usage: usageSchema,
6848
6935
  startedAt: number$1(),
6849
6936
  finishedAt: number$1().optional()
@@ -7054,7 +7141,6 @@ const perstackConfigSchema = object({
7054
7141
  provider: providerTableSchema.optional(),
7055
7142
  model: string().optional(),
7056
7143
  reasoningBudget: reasoningBudgetSchema$1.optional(),
7057
- maxSteps: number$1().optional(),
7058
7144
  maxRetries: number$1().optional(),
7059
7145
  timeout: number$1().optional(),
7060
7146
  experts: record(string(), object({
@@ -7124,12 +7210,6 @@ const commandOptionsSchema = object({
7124
7210
  if (Number.isNaN(parsedValue)) return void 0;
7125
7211
  return parsedValue;
7126
7212
  }).pipe(reasoningBudgetSchema$1.optional()),
7127
- maxSteps: string().optional().transform((value) => {
7128
- if (value === void 0) return void 0;
7129
- const parsedValue = Number.parseInt(value, 10);
7130
- if (Number.isNaN(parsedValue)) return void 0;
7131
- return parsedValue;
7132
- }),
7133
7213
  maxRetries: string().optional().transform((value) => {
7134
7214
  if (value === void 0) return void 0;
7135
7215
  const parsedValue = Number.parseInt(value, 10);
@@ -7168,6 +7248,19 @@ const startCommandInputSchema = object({
7168
7248
 
7169
7249
  //#endregion
7170
7250
  //#region ../../packages/core/src/schemas/runtime.ts
7251
+ /** Parse an expert key into its components */
7252
+ function parseExpertKey(expertKey) {
7253
+ const match = expertKey.match(expertKeyRegex$1);
7254
+ if (!match) throw new PerstackError(`Invalid expert key format: ${expertKey}`);
7255
+ const [key, name, version, tag] = match;
7256
+ if (!name) throw new PerstackError(`Invalid expert key format: ${expertKey}`);
7257
+ return {
7258
+ key,
7259
+ name,
7260
+ version,
7261
+ tag
7262
+ };
7263
+ }
7171
7264
  const runSettingSchema = object({
7172
7265
  model: string(),
7173
7266
  providerConfig: providerConfigSchema,
@@ -7185,7 +7278,6 @@ const runSettingSchema = object({
7185
7278
  }),
7186
7279
  experts: record(string(), expertSchema$1),
7187
7280
  reasoningBudget: reasoningBudgetSchema$1.default(defaultReasoningBudget),
7188
- maxSteps: number$1().min(1).optional().default(defaultMaxSteps),
7189
7281
  maxRetries: number$1().min(0),
7190
7282
  timeout: number$1().min(0),
7191
7283
  startedAt: number$1(),
@@ -7213,12 +7305,11 @@ const runParamsSchema = object({
7213
7305
  text: string()
7214
7306
  }).optional()
7215
7307
  }),
7216
- experts: record(string().min(1).regex(expertKeyRegex$1), expertSchema$1.omit({ key: true })).optional().default({}).transform((experts) => Object.fromEntries(Object.entries(experts).map(([key, expertWithoutKey]) => [key, expertSchema$1.parse({
7308
+ experts: record(string().min(1).regex(expertKeyRegex$1), expertBaseSchema.omit({ key: true })).optional().default({}).transform((experts) => Object.fromEntries(Object.entries(experts).map(([key, expertWithoutKey]) => [key, expertSchema$1.parse({
7217
7309
  ...expertWithoutKey,
7218
7310
  key
7219
7311
  })]))),
7220
7312
  reasoningBudget: reasoningBudgetSchema$1.optional().default(defaultReasoningBudget),
7221
- maxSteps: number$1().min(1).optional().default(defaultMaxSteps),
7222
7313
  maxRetries: number$1().min(0).optional().default(defaultMaxRetries),
7223
7314
  timeout: number$1().min(0).optional().default(defaultTimeout),
7224
7315
  startedAt: number$1().optional().default(Date.now()),
@@ -7269,13 +7360,11 @@ const callTools = createEvent("callTools");
7269
7360
  const finishMcpTools = createEvent("finishMcpTools");
7270
7361
  const skipDelegates = createEvent("skipDelegates");
7271
7362
  const resolveToolResults = createEvent("resolveToolResults");
7272
- const attemptCompletion = createEvent("attemptCompletion");
7273
7363
  const finishToolCall = createEvent("finishToolCall");
7274
7364
  const resumeToolCalls = createEvent("resumeToolCalls");
7275
7365
  const completeRun = createEvent("completeRun");
7276
7366
  const stopRunByInteractiveTool = createEvent("stopRunByInteractiveTool");
7277
7367
  const stopRunByDelegate = createEvent("stopRunByDelegate");
7278
- const stopRunByExceededMaxSteps = createEvent("stopRunByExceededMaxSteps");
7279
7368
  const stopRunByError = createEvent("stopRunByError");
7280
7369
  const continueToNextStep = createEvent("continueToNextStep");
7281
7370
  /** Factory function to create runtime events */
@@ -7302,13 +7391,11 @@ const EXPERT_STATE_EVENT_TYPES = new Set([
7302
7391
  "finishMcpTools",
7303
7392
  "skipDelegates",
7304
7393
  "resolveToolResults",
7305
- "attemptCompletion",
7306
7394
  "finishToolCall",
7307
7395
  "resumeToolCalls",
7308
7396
  "continueToNextStep",
7309
7397
  "stopRunByInteractiveTool",
7310
7398
  "stopRunByDelegate",
7311
- "stopRunByExceededMaxSteps",
7312
7399
  "stopRunByError",
7313
7400
  "completeRun"
7314
7401
  ]);
@@ -7649,34 +7736,37 @@ function parseWithFriendlyError(schema, data, context) {
7649
7736
  }
7650
7737
 
7651
7738
  //#endregion
7652
- //#region ../../node_modules/.pnpm/@perstack+api-client@0.0.55_@perstack+core@packages+core_zod@4.3.6/node_modules/@perstack/api-client/dist/index.mjs
7739
+ //#region ../../node_modules/.pnpm/@perstack+api-client@0.0.56_@perstack+core@packages+core_zod@4.3.6/node_modules/@perstack/api-client/dist/index.mjs
7653
7740
  function createValidationError(error) {
7654
7741
  return {
7655
- errorType: "validation",
7656
- code: 400,
7742
+ type: "validation",
7657
7743
  message: `Validation failed: ${error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; ")}`,
7658
7744
  reason: error.issues
7659
7745
  };
7660
7746
  }
7747
+ function validationErrorResult(error) {
7748
+ return {
7749
+ ok: false,
7750
+ status: 0,
7751
+ headers: new Headers(),
7752
+ error: createValidationError(error)
7753
+ };
7754
+ }
7661
7755
  function createAbortError() {
7662
7756
  return {
7663
- errorType: "abort",
7664
- code: 0,
7665
- message: "Request aborted",
7666
- aborted: true
7757
+ type: "abort",
7758
+ message: "Request aborted"
7667
7759
  };
7668
7760
  }
7669
7761
  function createTimeoutError() {
7670
7762
  return {
7671
- errorType: "timeout",
7672
- code: 0,
7763
+ type: "timeout",
7673
7764
  message: "Request timed out"
7674
7765
  };
7675
7766
  }
7676
7767
  function createNetworkError(error) {
7677
7768
  return {
7678
- errorType: "network",
7679
- code: 0,
7769
+ type: "network",
7680
7770
  message: error instanceof Error ? error.message : "Network error",
7681
7771
  reason: error,
7682
7772
  cause: error instanceof Error ? error : void 0
@@ -7691,38 +7781,37 @@ async function handleHttpError(response) {
7691
7781
  }
7692
7782
  return {
7693
7783
  ok: false,
7694
- error: createHttpError(response.status, response.statusText, errorBody)
7784
+ status: response.status,
7785
+ headers: response.headers,
7786
+ error: createHttpError(response.statusText, errorBody)
7695
7787
  };
7696
7788
  }
7697
- function createHttpError(status, statusText, body) {
7789
+ function createHttpError(statusText, body) {
7698
7790
  if (typeof body === "object" && body !== null) {
7699
7791
  const hasReason = "reason" in body;
7700
7792
  if ("error" in body && typeof body.error === "string") return {
7701
- errorType: "http",
7702
- code: status,
7793
+ type: "http",
7703
7794
  message: body.error,
7704
7795
  reason: hasReason ? body.reason : void 0
7705
7796
  };
7706
7797
  if (hasReason) return {
7707
- errorType: "http",
7708
- code: status,
7798
+ type: "http",
7709
7799
  message: statusText,
7710
7800
  reason: body.reason
7711
7801
  };
7712
7802
  }
7713
7803
  return {
7714
- errorType: "http",
7715
- code: status,
7804
+ type: "http",
7716
7805
  message: statusText
7717
7806
  };
7718
7807
  }
7719
7808
  const DEFAULT_BASE_URL = "https://api.perstack.ai";
7720
- const DEFAULT_TIMEOUT = 3e4;
7809
+ const DEFAULT_TIMEOUT = 6e4;
7721
7810
  function createFetcher(config) {
7722
7811
  const baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
7723
7812
  const timeout = config.timeout ?? DEFAULT_TIMEOUT;
7724
- const useCredentials = "credentials" in config && config.credentials === "include";
7725
- const apiKey = "apiKey" in config ? config.apiKey : void 0;
7813
+ const useCredentials = config.credentials === "include";
7814
+ const apiKey = config.apiKey;
7726
7815
  function buildUrl(path) {
7727
7816
  return `${baseUrl}${path}`;
7728
7817
  }
@@ -7818,23 +7907,32 @@ function createFetcher(config) {
7818
7907
  credentials: getCredentials()
7819
7908
  });
7820
7909
  if (!response.ok) return handleHttpError(response);
7910
+ const json = await response.json();
7821
7911
  return {
7822
7912
  ok: true,
7823
- data: await response.json()
7913
+ status: response.status,
7914
+ headers: response.headers,
7915
+ data: json
7824
7916
  };
7825
7917
  } catch (error) {
7826
7918
  if (error instanceof Error && error.name === "AbortError") {
7827
7919
  if (isTimeout()) return {
7828
7920
  ok: false,
7921
+ status: 0,
7922
+ headers: new Headers(),
7829
7923
  error: createTimeoutError()
7830
7924
  };
7831
7925
  return {
7832
7926
  ok: false,
7927
+ status: 0,
7928
+ headers: new Headers(),
7833
7929
  error: createAbortError()
7834
7930
  };
7835
7931
  }
7836
7932
  return {
7837
7933
  ok: false,
7934
+ status: 0,
7935
+ headers: new Headers(),
7838
7936
  error: createNetworkError(error)
7839
7937
  };
7840
7938
  } finally {
@@ -7851,23 +7949,32 @@ function createFetcher(config) {
7851
7949
  credentials: getCredentials()
7852
7950
  });
7853
7951
  if (!response.ok) return handleHttpError(response);
7952
+ const blob = await response.blob();
7854
7953
  return {
7855
7954
  ok: true,
7856
- data: await response.blob()
7955
+ status: response.status,
7956
+ headers: response.headers,
7957
+ data: blob
7857
7958
  };
7858
7959
  } catch (error) {
7859
7960
  if (error instanceof Error && error.name === "AbortError") {
7860
7961
  if (isTimeout()) return {
7861
7962
  ok: false,
7963
+ status: 0,
7964
+ headers: new Headers(),
7862
7965
  error: createTimeoutError()
7863
7966
  };
7864
7967
  return {
7865
7968
  ok: false,
7969
+ status: 0,
7970
+ headers: new Headers(),
7866
7971
  error: createAbortError()
7867
7972
  };
7868
7973
  }
7869
7974
  return {
7870
7975
  ok: false,
7976
+ status: 0,
7977
+ headers: new Headers(),
7871
7978
  error: createNetworkError(error)
7872
7979
  };
7873
7980
  } finally {
@@ -7891,29 +7998,40 @@ function createFetcher(config) {
7891
7998
  cleanup();
7892
7999
  return {
7893
8000
  ok: false,
8001
+ status: response.status,
8002
+ headers: response.headers,
7894
8003
  error: createNetworkError(/* @__PURE__ */ new Error("Response body is null"))
7895
8004
  };
7896
8005
  }
7897
8006
  cleanup();
7898
8007
  const idleTimeout = options?.streamIdleTimeout ?? timeout;
8008
+ const wrappedStream = wrapStreamWithIdleTimeout(response.body, idleTimeout, options?.signal);
7899
8009
  return {
7900
8010
  ok: true,
7901
- data: wrapStreamWithIdleTimeout(response.body, idleTimeout, options?.signal)
8011
+ status: response.status,
8012
+ headers: response.headers,
8013
+ data: wrappedStream
7902
8014
  };
7903
8015
  } catch (error) {
7904
8016
  cleanup();
7905
8017
  if (error instanceof Error && error.name === "AbortError") {
7906
8018
  if (isTimeout()) return {
7907
8019
  ok: false,
8020
+ status: 0,
8021
+ headers: new Headers(),
7908
8022
  error: createTimeoutError()
7909
8023
  };
7910
8024
  return {
7911
8025
  ok: false,
8026
+ status: 0,
8027
+ headers: new Headers(),
7912
8028
  error: createAbortError()
7913
8029
  };
7914
8030
  }
7915
8031
  return {
7916
8032
  ok: false,
8033
+ status: 0,
8034
+ headers: new Headers(),
7917
8035
  error: createNetworkError(error)
7918
8036
  };
7919
8037
  }
@@ -7930,21 +8048,29 @@ function createFetcher(config) {
7930
8048
  if (!response.ok) return handleHttpError(response);
7931
8049
  return {
7932
8050
  ok: true,
8051
+ status: response.status,
8052
+ headers: response.headers,
7933
8053
  data: void 0
7934
8054
  };
7935
8055
  } catch (error) {
7936
8056
  if (error instanceof Error && error.name === "AbortError") {
7937
8057
  if (isTimeout()) return {
7938
8058
  ok: false,
8059
+ status: 0,
8060
+ headers: new Headers(),
7939
8061
  error: createTimeoutError()
7940
8062
  };
7941
8063
  return {
7942
8064
  ok: false,
8065
+ status: 0,
8066
+ headers: new Headers(),
7943
8067
  error: createAbortError()
7944
8068
  };
7945
8069
  }
7946
8070
  return {
7947
8071
  ok: false,
8072
+ status: 0,
8073
+ headers: new Headers(),
7948
8074
  error: createNetworkError(error)
7949
8075
  };
7950
8076
  } finally {
@@ -8194,12 +8320,12 @@ const applicationSchema = object({
8194
8320
  totalJobs: number$1().describe("Total number of jobs executed for this application").optional(),
8195
8321
  lastJobExecutionAt: string().datetime({ offset: true }).nullable().describe("Timestamp of the most recent job execution").optional()
8196
8322
  });
8197
- const request$17 = { body: object({
8323
+ const request$21 = { body: object({
8198
8324
  name: applicationNameSchema,
8199
8325
  applicationGroupId: cuidSchema.optional()
8200
8326
  }) };
8201
8327
  object({ data: object({ application: applicationSchema }) });
8202
- const request$16 = { query: object({
8328
+ const request$20 = { query: object({
8203
8329
  name: preprocess((val) => Array.isArray(val) ? val.join(",") : val, string().optional()),
8204
8330
  sort: _enum([
8205
8331
  "name",
@@ -8214,7 +8340,7 @@ object({
8214
8340
  data: object({ applications: array(applicationSchema) }),
8215
8341
  meta: paginationMeta
8216
8342
  });
8217
- const request$15 = {
8343
+ const request$19 = {
8218
8344
  params: object({ applicationId: cuidSchema }),
8219
8345
  body: object({
8220
8346
  name: applicationNameSchema.optional(),
@@ -8237,15 +8363,25 @@ object({
8237
8363
  createdAt: datetimeSchema,
8238
8364
  updatedAt: datetimeSchema
8239
8365
  });
8240
- const request$14 = { body: object({
8366
+ const request$18 = { body: object({
8241
8367
  applicationId: cuidSchema,
8242
8368
  name: secretNameSchema,
8243
8369
  value: secretValueSchema
8244
8370
  }) };
8245
8371
  object({ data: object({ secret: secretMetadataSchema }) });
8246
- const request$13 = { query: object({ applicationId: cuidSchema.optional() }) };
8372
+ const request$17 = {
8373
+ params: object({ name: string().min(1) }),
8374
+ query: object({ applicationId: cuidSchema })
8375
+ };
8376
+ _null();
8377
+ const request$16 = {
8378
+ params: object({ name: string().min(1) }),
8379
+ query: object({ applicationId: cuidSchema })
8380
+ };
8381
+ object({ data: object({ secret: secretMetadataSchema }) });
8382
+ const request$15 = { query: object({ applicationId: cuidSchema.optional() }) };
8247
8383
  object({ data: object({ secrets: array(secretMetadataSchema) }) });
8248
- const request$12 = {
8384
+ const request$14 = {
8249
8385
  params: object({ name: string().min(1) }),
8250
8386
  body: object({
8251
8387
  applicationId: cuidSchema,
@@ -8270,12 +8406,22 @@ const variableResponseSchema = object({
8270
8406
  createdAt: datetimeSchema,
8271
8407
  updatedAt: datetimeSchema
8272
8408
  });
8273
- const request$11 = { body: object({
8409
+ const request$13 = { body: object({
8274
8410
  applicationId: cuidSchema,
8275
8411
  name: variableNameSchema,
8276
8412
  value: variableValueSchema
8277
8413
  }) };
8278
8414
  object({ data: object({ variable: variableResponseSchema }) });
8415
+ const request$12 = {
8416
+ params: object({ name: string().min(1) }),
8417
+ query: object({ applicationId: cuidSchema })
8418
+ };
8419
+ _null();
8420
+ const request$11 = {
8421
+ params: object({ name: string().min(1) }),
8422
+ query: object({ applicationId: cuidSchema })
8423
+ };
8424
+ object({ data: object({ variable: variableResponseSchema }) });
8279
8425
  const request$10 = { query: object({ applicationId: cuidSchema }) };
8280
8426
  object({ data: object({ variables: array(variableResponseSchema) }) });
8281
8427
  const request$9 = {
@@ -8394,7 +8540,7 @@ const expertSchema = object({
8394
8540
  skills: record(skillNameSchema, skillSchema).optional().default({}),
8395
8541
  delegates: array(expertKeyFieldSchema).min(0).max(maxExpertDelegateItems).optional().default([]),
8396
8542
  tags: array(expertTagFieldSchema).min(0).max(maxExpertTagItems).optional().default([]),
8397
- minRuntimeVersion: runtimeVersionSchema.optional()
8543
+ minRuntimeVersion: runtimeVersionSchema.optional().default("v1.0")
8398
8544
  });
8399
8545
  object({
8400
8546
  scope: expertScopeSchema,
@@ -8406,14 +8552,7 @@ const expertWithMetadataSchema = expertSchema.extend({
8406
8552
  });
8407
8553
  const request$8 = { query: object({
8408
8554
  filter: string().describe("Filter by scope name (partial match)").optional(),
8409
- category: _enum([
8410
- "general",
8411
- "coding",
8412
- "research",
8413
- "writing",
8414
- "data",
8415
- "automation"
8416
- ]).describe("Filter by category").optional(),
8555
+ category: expertCategoryFieldSchema.describe("Filter by category").optional(),
8417
8556
  includeDrafts: boolean().default(false).describe("Include unpublished scopes (owner only)").optional(),
8418
8557
  take: number().min(1).max(100).default(20),
8419
8558
  skip: number().min(0).default(0)
@@ -8423,6 +8562,12 @@ object({
8423
8562
  meta: paginationMeta
8424
8563
  });
8425
8564
  const anthropicSupportModels = [
8565
+ {
8566
+ modelId: "claude-opus-4-6",
8567
+ default: false,
8568
+ provider: "anthropic",
8569
+ contextWindow: 2e5
8570
+ },
8426
8571
  {
8427
8572
  modelId: "claude-opus-4-5",
8428
8573
  default: false,
@@ -8496,6 +8641,12 @@ const googleSupportModels = [
8496
8641
  default: false,
8497
8642
  provider: "google",
8498
8643
  contextWindow: 1e6
8644
+ },
8645
+ {
8646
+ modelId: "gemini-3-flash-preview",
8647
+ default: false,
8648
+ provider: "google",
8649
+ contextWindow: 1e6
8499
8650
  }
8500
8651
  ];
8501
8652
  const openAiSupportModels = [
@@ -8546,6 +8697,24 @@ const openAiSupportModels = [
8546
8697
  default: false,
8547
8698
  provider: "openai",
8548
8699
  contextWindow: 1e6
8700
+ },
8701
+ {
8702
+ modelId: "gpt-5.1",
8703
+ default: false,
8704
+ provider: "openai",
8705
+ contextWindow: 4e5
8706
+ },
8707
+ {
8708
+ modelId: "gpt-5.2",
8709
+ default: false,
8710
+ provider: "openai",
8711
+ contextWindow: 4e5
8712
+ },
8713
+ {
8714
+ modelId: "gpt-5.2-pro",
8715
+ default: false,
8716
+ provider: "openai",
8717
+ contextWindow: 4e5
8549
8718
  }
8550
8719
  ];
8551
8720
  const deepseekSupportModels = [{
@@ -8601,6 +8770,7 @@ const jobBaseSchema = object({
8601
8770
  updatedAt: datetimeSchema,
8602
8771
  status: jobStatusSchema,
8603
8772
  currentExecutionId: cuidSchema.optional(),
8773
+ machineId: cuidSchema.nullable(),
8604
8774
  coordinatorExpertKey: expertKeyFieldSchema,
8605
8775
  query: string().min(1).max(maxExpertJobQueryLength).optional(),
8606
8776
  expert: expertWithMetadataSchema,
@@ -8662,7 +8832,7 @@ const request$5 = { query: object({
8662
8832
  expertScopeId: cuidSchema.optional(),
8663
8833
  expertDraftScopeId: cuidSchema.optional(),
8664
8834
  applicationId: cuidSchema.optional(),
8665
- statuses: preprocess((val) => typeof val === "string" ? val.split(",") : val, array(jobStatusSchema).optional()),
8835
+ statuses: preprocess((val) => typeof val === "string" ? val.split(",") : val, array(jobStatusSchema)).optional(),
8666
8836
  expertKeyFilter: string().max(100).optional()
8667
8837
  }) };
8668
8838
  object({
@@ -8697,7 +8867,8 @@ const apiCheckpointSchema = object({
8697
8867
  "stoppedByInteractiveTool",
8698
8868
  "stoppedByDelegate",
8699
8869
  "stoppedByExceededMaxSteps",
8700
- "stoppedByError"
8870
+ "stoppedByError",
8871
+ "stoppedByCancellation"
8701
8872
  ]),
8702
8873
  expert: expertSchema,
8703
8874
  delegateTo: array(delegationTargetSchema).optional(),
@@ -8749,16 +8920,7 @@ object({
8749
8920
  data: object({ checkpoints: array(apiCheckpointSchema) }),
8750
8921
  meta: paginationMeta
8751
8922
  });
8752
- const runStatusSchema = _enum([
8753
- "queued",
8754
- "processing",
8755
- "completed",
8756
- "stoppedByInteractiveTool",
8757
- "stoppedByDelegate",
8758
- "stoppedByExceededMaxSteps",
8759
- "stoppedByError"
8760
- ]);
8761
- const runSchema = object({
8923
+ const runTreeNodeSchema = object({
8762
8924
  type: literal("run"),
8763
8925
  id: cuidSchema,
8764
8926
  jobId: cuidSchema,
@@ -8767,11 +8929,14 @@ const runSchema = object({
8767
8929
  organizationId: cuidSchema,
8768
8930
  createdAt: datetimeSchema,
8769
8931
  updatedAt: datetimeSchema,
8770
- status: runStatusSchema,
8771
8932
  expertKey: expertKeyFieldSchema,
8772
8933
  expert: expertWithMetadataSchema,
8773
8934
  stepNumber: number$1().int().min(0),
8774
8935
  usage: usageSchema
8936
+ }).extend({
8937
+ lastCheckpointId: cuidSchema.nullable(),
8938
+ checkpointIds: array(cuidSchema),
8939
+ childRuns: lazy(() => array(runTreeNodeSchema))
8775
8940
  });
8776
8941
  const request$3 = {
8777
8942
  params: object({ jobId: cuidSchema }),
@@ -8779,11 +8944,12 @@ const request$3 = {
8779
8944
  sort: _enum(["createdAt", "updatedAt"]).optional(),
8780
8945
  order: _enum(["asc", "desc"]).optional(),
8781
8946
  take: number().min(1).max(100).default(20),
8782
- skip: number().min(0).default(0)
8947
+ skip: number().min(0).default(0),
8948
+ depth: number().int().min(0).max(10).default(0)
8783
8949
  })
8784
8950
  };
8785
8951
  object({
8786
- data: object({ runs: array(runSchema) }),
8952
+ data: object({ runs: array(runTreeNodeSchema) }),
8787
8953
  meta: paginationMeta
8788
8954
  });
8789
8955
  const baseUrlSchema = string().url().max(maxProviderBaseUrlLength).optional();
@@ -8888,10 +9054,7 @@ function createRunCheckpointsApi(fetcher, basePath) {
8888
9054
  async list(jobId, runId, params, options) {
8889
9055
  if (params) {
8890
9056
  const result = request$4.query.safeParse(params);
8891
- if (!result.success) return {
8892
- ok: false,
8893
- error: createValidationError(result.error)
8894
- };
9057
+ if (!result.success) return validationErrorResult(result.error);
8895
9058
  }
8896
9059
  const queryString = buildQueryString(params);
8897
9060
  return fetcher.get(`${basePath}/${jobId}/runs/${runId}/checkpoints${queryString}`, options);
@@ -8901,26 +9064,26 @@ function createRunCheckpointsApi(fetcher, basePath) {
8901
9064
  }
8902
9065
  };
8903
9066
  }
9067
+ function createListFn(fetcher, basePath) {
9068
+ return async function list(jobId, params, options) {
9069
+ if (params) {
9070
+ const result = request$3.query.safeParse(params);
9071
+ if (!result.success) return validationErrorResult(result.error);
9072
+ }
9073
+ const queryString = buildQueryString(params);
9074
+ return fetcher.get(`${basePath}/${jobId}/runs${queryString}`, options);
9075
+ };
9076
+ }
8904
9077
  function createRunsApi(fetcher, basePath) {
8905
9078
  return {
8906
- async list(jobId, params, options) {
8907
- if (params) {
8908
- const result = request$3.query.safeParse(params);
8909
- if (!result.success) return {
8910
- ok: false,
8911
- error: createValidationError(result.error)
8912
- };
8913
- }
8914
- const queryString = buildQueryString(params);
8915
- return fetcher.get(`${basePath}/${jobId}/runs${queryString}`, options);
8916
- },
9079
+ list: createListFn(fetcher, basePath),
8917
9080
  async get(jobId, runId, options) {
8918
9081
  return fetcher.get(`${basePath}/${jobId}/runs/${runId}`, options);
8919
9082
  },
8920
9083
  checkpoints: createRunCheckpointsApi(fetcher, basePath)
8921
9084
  };
8922
9085
  }
8923
- const BASE_PATH$5 = "/api/v1/jobs";
9086
+ const BASE_PATH$6 = "/api/v1/jobs";
8924
9087
  /**
8925
9088
  * Error thrown when stream ends abnormally.
8926
9089
  */
@@ -8952,168 +9115,152 @@ function createJobsApi(fetcher) {
8952
9115
  async list(params, options) {
8953
9116
  if (params) {
8954
9117
  const result = request$5.query.safeParse(params);
8955
- if (!result.success) return {
8956
- ok: false,
8957
- error: createValidationError(result.error)
8958
- };
9118
+ if (!result.success) return validationErrorResult(result.error);
8959
9119
  }
8960
9120
  const queryString = buildQueryString(params);
8961
- return fetcher.get(`${BASE_PATH$5}${queryString}`, options);
9121
+ return fetcher.get(`${BASE_PATH$6}${queryString}`, options);
8962
9122
  },
8963
9123
  async get(id, options) {
8964
- return fetcher.get(`${BASE_PATH$5}/${id}`, options);
9124
+ return fetcher.get(`${BASE_PATH$6}/${id}`, options);
8965
9125
  },
8966
9126
  async start(input, options) {
8967
9127
  const result = request$6.body.safeParse(input);
8968
- if (!result.success) return {
8969
- ok: false,
8970
- error: createValidationError(result.error)
8971
- };
8972
- return fetcher.post(BASE_PATH$5, input, options);
9128
+ if (!result.success) return validationErrorResult(result.error);
9129
+ return fetcher.post(BASE_PATH$6, input, options);
8973
9130
  },
8974
9131
  async continue(id, input, options) {
8975
9132
  const result = request$7.body.safeParse(input);
8976
- if (!result.success) return {
8977
- ok: false,
8978
- error: createValidationError(result.error)
8979
- };
8980
- return fetcher.post(`${BASE_PATH$5}/${id}/continue`, input, options);
9133
+ if (!result.success) return validationErrorResult(result.error);
9134
+ return fetcher.post(`${BASE_PATH$6}/${id}/continue`, input, options);
8981
9135
  },
8982
9136
  async cancel(id, options) {
8983
- return fetcher.post(`${BASE_PATH$5}/${id}/cancel`, {}, options);
9137
+ return fetcher.post(`${BASE_PATH$6}/${id}/cancel`, {}, options);
8984
9138
  },
8985
- async *stream(id, options) {
8986
- const result = await fetcher.getStream(`${BASE_PATH$5}/${id}/stream`, options);
8987
- if (!result.ok) throw new StreamConnectionError(result.error.message);
8988
- const reader = result.data.getReader();
8989
- try {
8990
- for await (const sseEvent of parseSSEEvents(reader)) if (sseEvent.event === "message") yield sseEvent.data;
8991
- else if (sseEvent.event === "error" && isErrorEventData(sseEvent.data)) throw new StreamError(sseEvent.data.type, sseEvent.data.jobId, sseEvent.data.message);
8992
- else if (sseEvent.event === "complete" && isCompleteEventData(sseEvent.data)) return;
8993
- } catch (error) {
8994
- if (error instanceof StreamError || error instanceof StreamConnectionError) throw error;
8995
- if (error instanceof DOMException && error.name === "AbortError") throw error;
8996
- throw new StreamConnectionError(error instanceof Error ? error.message : "Stream read error");
9139
+ async stream(id, options) {
9140
+ const result = await fetcher.getStream(`${BASE_PATH$6}/${id}/stream`, options);
9141
+ if (!result.ok) return result;
9142
+ async function* createEventGenerator(reader) {
9143
+ try {
9144
+ for await (const sseEvent of parseSSEEvents(reader)) if (sseEvent.event === "message") yield sseEvent.data;
9145
+ else if (sseEvent.event === "error" && isErrorEventData(sseEvent.data)) throw new StreamError(sseEvent.data.type, sseEvent.data.jobId, sseEvent.data.message);
9146
+ else if (sseEvent.event === "complete" && isCompleteEventData(sseEvent.data)) return;
9147
+ } catch (error) {
9148
+ if (error instanceof StreamError || error instanceof StreamConnectionError) throw error;
9149
+ if (error instanceof DOMException && error.name === "AbortError") throw error;
9150
+ throw new StreamConnectionError(error instanceof Error ? error.message : "Stream read error");
9151
+ }
8997
9152
  }
9153
+ const reader = result.data.getReader();
9154
+ return {
9155
+ ok: true,
9156
+ status: result.status,
9157
+ headers: result.headers,
9158
+ data: { events: createEventGenerator(reader) }
9159
+ };
8998
9160
  },
8999
- runs: createRunsApi(fetcher, BASE_PATH$5)
9161
+ runs: createRunsApi(fetcher, BASE_PATH$6)
9000
9162
  };
9001
9163
  }
9002
- const BASE_PATH$4 = "/api/v1/applications";
9164
+ const BASE_PATH$5 = "/api/v1/applications";
9003
9165
  function createApplicationsApi(fetcher) {
9004
9166
  return {
9005
9167
  async list(params, options) {
9006
9168
  if (params) {
9007
- const result = request$16.query.safeParse(params);
9008
- if (!result.success) return {
9009
- ok: false,
9010
- error: createValidationError(result.error)
9011
- };
9169
+ const result = request$20.query.safeParse(params);
9170
+ if (!result.success) return validationErrorResult(result.error);
9012
9171
  }
9013
9172
  const queryString = buildQueryString(params);
9014
- return fetcher.get(`${BASE_PATH$4}${queryString}`, options);
9173
+ return fetcher.get(`${BASE_PATH$5}${queryString}`, options);
9015
9174
  },
9016
9175
  async get(id, options) {
9017
- return fetcher.get(`${BASE_PATH$4}/${id}`, options);
9176
+ return fetcher.get(`${BASE_PATH$5}/${id}`, options);
9018
9177
  },
9019
9178
  async create(input, options) {
9020
- const result = request$17.body.safeParse(input);
9021
- if (!result.success) return {
9022
- ok: false,
9023
- error: createValidationError(result.error)
9024
- };
9025
- return fetcher.post(BASE_PATH$4, input, options);
9179
+ const result = request$21.body.safeParse(input);
9180
+ if (!result.success) return validationErrorResult(result.error);
9181
+ return fetcher.post(BASE_PATH$5, input, options);
9026
9182
  },
9027
9183
  async update(id, input, options) {
9028
- const result = request$15.body.safeParse(input);
9029
- if (!result.success) return {
9030
- ok: false,
9031
- error: createValidationError(result.error)
9032
- };
9033
- return fetcher.post(`${BASE_PATH$4}/${id}`, input, options);
9184
+ const result = request$19.body.safeParse(input);
9185
+ if (!result.success) return validationErrorResult(result.error);
9186
+ return fetcher.post(`${BASE_PATH$5}/${id}`, input, options);
9034
9187
  },
9035
9188
  async delete(id, options) {
9036
- return fetcher.delete(`${BASE_PATH$4}/${id}`, options);
9189
+ return fetcher.delete(`${BASE_PATH$5}/${id}`, options);
9037
9190
  }
9038
9191
  };
9039
9192
  }
9040
- const BASE_PATH$3 = "/api/v1/env/secrets";
9193
+ const BASE_PATH$4 = "/api/v1/env/secrets";
9041
9194
  function createSecretsApi(fetcher) {
9042
9195
  return {
9043
9196
  async list(params, options) {
9044
9197
  if (params) {
9045
- const result = request$13.query.safeParse(params);
9046
- if (!result.success) return {
9047
- ok: false,
9048
- error: createValidationError(result.error)
9049
- };
9198
+ const result = request$15.query.safeParse(params);
9199
+ if (!result.success) return validationErrorResult(result.error);
9050
9200
  }
9051
9201
  const queryString = buildQueryString(params);
9052
- return fetcher.get(`${BASE_PATH$3}${queryString}`, options);
9202
+ return fetcher.get(`${BASE_PATH$4}${queryString}`, options);
9053
9203
  },
9054
- async get(name, options) {
9204
+ async get(name, params, options) {
9205
+ const result = request$16.query.safeParse(params);
9206
+ if (!result.success) return validationErrorResult(result.error);
9055
9207
  const encodedName = encodeURIComponent(name);
9056
- return fetcher.get(`${BASE_PATH$3}/${encodedName}`, options);
9208
+ const queryString = buildQueryString(params);
9209
+ return fetcher.get(`${BASE_PATH$4}/${encodedName}${queryString}`, options);
9057
9210
  },
9058
9211
  async create(input, options) {
9059
- const result = request$14.body.safeParse(input);
9060
- if (!result.success) return {
9061
- ok: false,
9062
- error: createValidationError(result.error)
9063
- };
9064
- return fetcher.post(BASE_PATH$3, input, options);
9212
+ const result = request$18.body.safeParse(input);
9213
+ if (!result.success) return validationErrorResult(result.error);
9214
+ return fetcher.post(BASE_PATH$4, input, options);
9065
9215
  },
9066
9216
  async update(name, input, options) {
9067
- const result = request$12.body.safeParse(input);
9068
- if (!result.success) return {
9069
- ok: false,
9070
- error: createValidationError(result.error)
9071
- };
9217
+ const result = request$14.body.safeParse(input);
9218
+ if (!result.success) return validationErrorResult(result.error);
9072
9219
  const encodedName = encodeURIComponent(name);
9073
- return fetcher.put(`${BASE_PATH$3}/${encodedName}`, input, options);
9220
+ return fetcher.post(`${BASE_PATH$4}/${encodedName}`, input, options);
9074
9221
  },
9075
- async delete(name, options) {
9222
+ async delete(name, params, options) {
9223
+ const result = request$17.query.safeParse(params);
9224
+ if (!result.success) return validationErrorResult(result.error);
9076
9225
  const encodedName = encodeURIComponent(name);
9077
- return fetcher.deleteNoContent(`${BASE_PATH$3}/${encodedName}`, options);
9226
+ const queryString = buildQueryString(params);
9227
+ return fetcher.deleteNoContent(`${BASE_PATH$4}/${encodedName}${queryString}`, options);
9078
9228
  }
9079
9229
  };
9080
9230
  }
9081
- const BASE_PATH$2 = "/api/v1/env/variables";
9231
+ const BASE_PATH$3 = "/api/v1/env/variables";
9082
9232
  function createVariablesApi(fetcher) {
9083
9233
  return {
9084
9234
  async list(params, options) {
9085
9235
  const result = request$10.query.safeParse(params);
9086
- if (!result.success) return {
9087
- ok: false,
9088
- error: createValidationError(result.error)
9089
- };
9236
+ if (!result.success) return validationErrorResult(result.error);
9090
9237
  const queryString = buildQueryString(params);
9091
- return fetcher.get(`${BASE_PATH$2}${queryString}`, options);
9238
+ return fetcher.get(`${BASE_PATH$3}${queryString}`, options);
9092
9239
  },
9093
- async get(name, options) {
9240
+ async get(name, params, options) {
9241
+ const result = request$11.query.safeParse(params);
9242
+ if (!result.success) return validationErrorResult(result.error);
9094
9243
  const encodedName = encodeURIComponent(name);
9095
- return fetcher.get(`${BASE_PATH$2}/${encodedName}`, options);
9244
+ const queryString = buildQueryString(params);
9245
+ return fetcher.get(`${BASE_PATH$3}/${encodedName}${queryString}`, options);
9096
9246
  },
9097
9247
  async create(input, options) {
9098
- const result = request$11.body.safeParse(input);
9099
- if (!result.success) return {
9100
- ok: false,
9101
- error: createValidationError(result.error)
9102
- };
9103
- return fetcher.post(BASE_PATH$2, input, options);
9248
+ const result = request$13.body.safeParse(input);
9249
+ if (!result.success) return validationErrorResult(result.error);
9250
+ return fetcher.post(BASE_PATH$3, input, options);
9104
9251
  },
9105
9252
  async update(name, input, options) {
9106
9253
  const result = request$9.body.safeParse(input);
9107
- if (!result.success) return {
9108
- ok: false,
9109
- error: createValidationError(result.error)
9110
- };
9254
+ if (!result.success) return validationErrorResult(result.error);
9111
9255
  const encodedName = encodeURIComponent(name);
9112
- return fetcher.put(`${BASE_PATH$2}/${encodedName}`, input, options);
9256
+ return fetcher.post(`${BASE_PATH$3}/${encodedName}`, input, options);
9113
9257
  },
9114
- async delete(name, options) {
9258
+ async delete(name, params, options) {
9259
+ const result = request$12.query.safeParse(params);
9260
+ if (!result.success) return validationErrorResult(result.error);
9115
9261
  const encodedName = encodeURIComponent(name);
9116
- return fetcher.deleteNoContent(`${BASE_PATH$2}/${encodedName}`, options);
9262
+ const queryString = buildQueryString(params);
9263
+ return fetcher.deleteNoContent(`${BASE_PATH$3}/${encodedName}${queryString}`, options);
9117
9264
  }
9118
9265
  };
9119
9266
  }
@@ -9129,46 +9276,49 @@ function createVersionsApi(fetcher, basePath) {
9129
9276
  return fetcher.get(`${basePath}/${encodedScopeName}/versions`, options);
9130
9277
  } };
9131
9278
  }
9132
- const BASE_PATH$1 = "/api/v1/experts";
9279
+ const BASE_PATH$2 = "/api/v1/experts";
9133
9280
  function createExpertsApi(fetcher) {
9134
9281
  return {
9135
9282
  async list(params, options) {
9136
9283
  if (params) {
9137
9284
  const result = request$8.query.safeParse(params);
9138
- if (!result.success) return {
9139
- ok: false,
9140
- error: createValidationError(result.error)
9141
- };
9285
+ if (!result.success) return validationErrorResult(result.error);
9142
9286
  }
9143
9287
  const queryString = buildQueryString(params);
9144
- return fetcher.get(`${BASE_PATH$1}${queryString}`, options);
9288
+ return fetcher.get(`${BASE_PATH$2}${queryString}`, options);
9145
9289
  },
9146
9290
  async get(key, options) {
9147
9291
  const encodedKey = encodeURIComponent(key);
9148
- return fetcher.get(`${BASE_PATH$1}/${encodedKey}`, options);
9292
+ return fetcher.get(`${BASE_PATH$2}/${encodedKey}`, options);
9149
9293
  },
9150
9294
  async getFeatured(options) {
9151
- return fetcher.get(`${BASE_PATH$1}/featured`, options);
9295
+ return fetcher.get(`${BASE_PATH$2}/featured`, options);
9152
9296
  },
9153
9297
  async getMeta(key, options) {
9154
9298
  const encodedKey = encodeURIComponent(key);
9155
- return fetcher.get(`${BASE_PATH$1}/${encodedKey}/meta`, options);
9299
+ return fetcher.get(`${BASE_PATH$2}/${encodedKey}/meta`, options);
9156
9300
  },
9157
9301
  async publish(scopeName, options) {
9158
9302
  const encodedScopeName = encodeURIComponent(scopeName);
9159
- return fetcher.post(`${BASE_PATH$1}/${encodedScopeName}/publish`, {}, options);
9303
+ return fetcher.post(`${BASE_PATH$2}/${encodedScopeName}/publish`, {}, options);
9160
9304
  },
9161
9305
  async unpublish(scopeName, options) {
9162
9306
  const encodedScopeName = encodeURIComponent(scopeName);
9163
- return fetcher.post(`${BASE_PATH$1}/${encodedScopeName}/unpublish`, {}, options);
9307
+ return fetcher.post(`${BASE_PATH$2}/${encodedScopeName}/unpublish`, {}, options);
9164
9308
  },
9165
9309
  async yank(key, options) {
9166
9310
  const encodedKey = encodeURIComponent(key);
9167
- return fetcher.delete(`${BASE_PATH$1}/${encodedKey}`, options);
9311
+ return fetcher.delete(`${BASE_PATH$2}/${encodedKey}`, options);
9168
9312
  },
9169
- versions: createVersionsApi(fetcher, BASE_PATH$1)
9313
+ versions: createVersionsApi(fetcher, BASE_PATH$2)
9170
9314
  };
9171
9315
  }
9316
+ const BASE_PATH$1 = "/api/v1/organizations";
9317
+ function createOrganizationsApi(fetcher) {
9318
+ return { async getCurrent(options) {
9319
+ return fetcher.get(`${BASE_PATH$1}/current`, options);
9320
+ } };
9321
+ }
9172
9322
  const BASE_PATH = "/api/v1/applications";
9173
9323
  function createProviderSettingsApi(fetcher) {
9174
9324
  return {
@@ -9181,18 +9331,12 @@ function createProviderSettingsApi(fetcher) {
9181
9331
  },
9182
9332
  async create(applicationId, input, options) {
9183
9333
  const result = request$1.body.safeParse(input);
9184
- if (!result.success) return {
9185
- ok: false,
9186
- error: createValidationError(result.error)
9187
- };
9334
+ if (!result.success) return validationErrorResult(result.error);
9188
9335
  return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings`, input, options);
9189
9336
  },
9190
9337
  async update(applicationId, provider, input, options) {
9191
9338
  const result = request.body.safeParse(input);
9192
- if (!result.success) return {
9193
- ok: false,
9194
- error: createValidationError(result.error)
9195
- };
9339
+ if (!result.success) return validationErrorResult(result.error);
9196
9340
  const encodedProvider = encodeURIComponent(provider);
9197
9341
  return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}`, input, options);
9198
9342
  },
@@ -9206,10 +9350,7 @@ function createProviderSettingsApi(fetcher) {
9206
9350
  },
9207
9351
  async createApiKey(applicationId, provider, input, options) {
9208
9352
  const result = request$2.body.safeParse(input);
9209
- if (!result.success) return {
9210
- ok: false,
9211
- error: createValidationError(result.error)
9212
- };
9353
+ if (!result.success) return validationErrorResult(result.error);
9213
9354
  const encodedProvider = encodeURIComponent(provider);
9214
9355
  return fetcher.post(`${BASE_PATH}/${applicationId}/provider_settings/${encodedProvider}/api_keys`, input, options);
9215
9356
  },
@@ -9227,10 +9368,11 @@ function createApiClient(config) {
9227
9368
  env: createEnvApi(fetcher),
9228
9369
  jobs: createJobsApi(fetcher),
9229
9370
  experts: createExpertsApi(fetcher),
9371
+ organizations: createOrganizationsApi(fetcher),
9230
9372
  providerSettings: createProviderSettingsApi(fetcher)
9231
9373
  };
9232
9374
  }
9233
9375
 
9234
9376
  //#endregion
9235
- export { object as $, runCommandInputSchema as A, createId as At, _instanceof as B, skipDelegates as C, $constructor as Ct, stopRunByError as D, defaultMaxRetries as Dt, stopRunByDelegate as E, PerstackError as Et, expertSchema$1 as F, custom as G, any as H, checkpointSchema as I, lazy as J, discriminatedUnion as K, number as L, perstackConfigSchema as M, lockfileSchema as N, stopRunByExceededMaxSteps as O, defaultPerstackApiBaseUrl as Ot, jobSchema$1 as P, number$1 as Q, ZodOptional as R, runSettingSchema as S, normalizeParams as St, startRun as T, knownModels as Tt, array as U, _null as V, boolean$1 as W, looseObject as X, literal as Y, never as Z, proceedToInteractiveTools as _, parseAsync$1 as _t, getFilteredEnv as a, tuple as at, retry as b, clone as bt, createGeneralToolActivity as c, url as ct, completeRun as d, toJSONSchema as dt, optional as et, continueToNextStep as f, describe$1 as ft, finishToolCall as g, parse$1 as gt, finishMcpTools as h, $ZodType as ht, validateEventFilter as i, string as it, startCommandInputSchema as j, stopRunByInteractiveTool as k, defaultTimeout as kt, attemptCompletion as l, safeParseAsync as lt, createStreamingEvent as m, $ZodObject as mt, parseWithFriendlyError as n, record as nt, BASE_SKILL_PREFIX as o, union as ot, createRuntimeEvent as p, meta$1 as pt, intersection as q, createFilteredEventListener as r, strictObject as rt, createBaseToolActivity as s, unknown as st, createApiClient as t, preprocess as tt, callTools as u, datetime as ut, resolveToolResults as v, safeParse$1 as vt, startGeneration as w, NEVER as wt, runParamsSchema as x, defineLazy as xt, resumeFromStop as y, safeParseAsync$1 as yt, _enum as z };
9236
- //# sourceMappingURL=dist-V21w4o7U.js.map
9377
+ export { never as $, startCommandInputSchema as A, defaultPerstackApiBaseUrl as At, ZodOptional as B, skipDelegates as C, defineLazy as Ct, stopRunByError as D, knownModels as Dt, stopRunByDelegate as E, NEVER as Et, isCoordinatorExpert as F, array as G, _instanceof as H, validateDelegation as I, discriminatedUnion as J, boolean$1 as K, checkpointSchema as L, lockfileSchema as M, createId as Mt, jobSchema$1 as N, stopRunByInteractiveTool as O, PerstackError as Ot, expertSchema$1 as P, looseObject as Q, number as R, runSettingSchema as S, clone as St, startRun as T, $constructor as Tt, _null as U, _enum as V, any as W, lazy as X, intersection as Y, literal as Z, proceedToInteractiveTools as _, $ZodType as _t, getFilteredEnv as a, strictObject as at, retry as b, safeParse$1 as bt, createGeneralToolActivity as c, union as ct, continueToNextStep as d, safeParseAsync as dt, number$1 as et, createRuntimeEvent as f, datetime as ft, parseExpertKey as g, $ZodObject as gt, finishToolCall as h, meta$1 as ht, validateEventFilter as i, record as it, perstackConfigSchema as j, defaultTimeout as jt, runCommandInputSchema as k, defaultMaxRetries as kt, callTools as l, unknown as lt, finishMcpTools as m, describe$1 as mt, parseWithFriendlyError as n, optional as nt, BASE_SKILL_PREFIX as o, string as ot, createStreamingEvent as p, toJSONSchema as pt, custom as q, createFilteredEventListener as r, preprocess as rt, createBaseToolActivity as s, tuple as st, createApiClient as t, object as tt, completeRun as u, url as ut, resolveToolResults as v, parse$1 as vt, startGeneration as w, normalizeParams as wt, runParamsSchema as x, safeParseAsync$1 as xt, resumeFromStop as y, parseAsync$1 as yt, ZodIssueCode as z };
9378
+ //# sourceMappingURL=dist-BTAd9SVm.js.map