@runtypelabs/sdk 4.19.1 → 4.20.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.
package/dist/index.cjs CHANGED
@@ -64,11 +64,14 @@ __export(index_exports, {
64
64
  PromptsEndpoint: () => PromptsEndpoint,
65
65
  PromptsNamespace: () => PromptsNamespace,
66
66
  ProviderKeysEndpoint: () => ProviderKeysEndpoint,
67
+ RUNTYPE_CLIENT_KIND: () => RUNTYPE_CLIENT_KIND,
67
68
  RecordsEndpoint: () => RecordsEndpoint,
68
69
  Runtype: () => Runtype,
69
70
  RuntypeApiError: () => RuntypeApiError,
70
71
  RuntypeClient: () => RuntypeClient2,
71
72
  RuntypeFlowBuilder: () => RuntypeFlowBuilder,
73
+ SDK_USER_AGENT: () => SDK_USER_AGENT,
74
+ SDK_VERSION: () => SDK_VERSION,
72
75
  STEP_FIELD_REGISTRY: () => STEP_FIELD_REGISTRY,
73
76
  STEP_TYPE_TO_METHOD: () => STEP_TYPE_TO_METHOD,
74
77
  SchedulesEndpoint: () => SchedulesEndpoint,
@@ -140,6 +143,7 @@ __export(index_exports, {
140
143
  parseOffloadedOutputId: () => parseOffloadedOutputId,
141
144
  parseSSEChunk: () => parseSSEChunk,
142
145
  processStream: () => processStream,
146
+ pullFpo: () => pullFpo,
143
147
  registerWorkflowHook: () => registerWorkflowHook,
144
148
  resolveStallStopAfter: () => resolveStallStopAfter,
145
149
  resolveWorkflowHook: () => resolveWorkflowHook,
@@ -4423,13 +4427,17 @@ function defineFpo(fpo) {
4423
4427
  return fpo;
4424
4428
  }
4425
4429
  async function ensureFpo(client, fpo, options = {}) {
4426
- const { dryRun, onConflict } = options;
4430
+ const { dryRun, onConflict, prune } = options;
4427
4431
  return client.post("/products/ensure-fpo", {
4428
4432
  fpo,
4429
4433
  ...dryRun ? { dryRun: true } : {},
4430
- ...onConflict ? { onConflict } : {}
4434
+ ...onConflict ? { onConflict } : {},
4435
+ ...prune ? { prune: true } : {}
4431
4436
  });
4432
4437
  }
4438
+ async function pullFpo(client, name) {
4439
+ return client.get("/products/pull-fpo", { name });
4440
+ }
4433
4441
 
4434
4442
  // src/products-namespace.ts
4435
4443
  var ProductsNamespace = class {
@@ -4487,6 +4495,24 @@ var ProductsNamespace = class {
4487
4495
  async ensureFpo(fpo, options = {}) {
4488
4496
  return ensureFpo(this.getClient(), fpo, options);
4489
4497
  }
4498
+ /**
4499
+ * Reconstruct a self-contained Full Product Object from the live product graph
4500
+ * (resolved by name) — the absorb-drift direction of `ensureFpo`. Feeding the
4501
+ * returned `fpo` back into `ensureFpo` converges to `unchanged`.
4502
+ *
4503
+ * records/schedules/secrets are not reconstructed and `tools` is emitted empty
4504
+ * (tool refs are portable `tool:<name>`); inspect `result.warnings` for
4505
+ * per-pull caveats.
4506
+ *
4507
+ * @example
4508
+ * ```typescript
4509
+ * const { fpo } = await Runtype.products.pullFpo('Support Copilot')
4510
+ * await Runtype.products.ensureFpo(fpo, { dryRun: true }) // → result: 'unchanged'
4511
+ * ```
4512
+ */
4513
+ async pullFpo(name) {
4514
+ return pullFpo(this.getClient(), name);
4515
+ }
4490
4516
  };
4491
4517
 
4492
4518
  // src/surfaces-ensure.ts
@@ -5223,6 +5249,12 @@ var Runtype = class {
5223
5249
  }
5224
5250
  };
5225
5251
 
5252
+ // src/version.ts
5253
+ var FALLBACK_VERSION = "0.0.0";
5254
+ var SDK_VERSION = "4.20.0".length > 0 ? "4.20.0" : FALLBACK_VERSION;
5255
+ var RUNTYPE_CLIENT_KIND = "sdk";
5256
+ var SDK_USER_AGENT = `runtype-sdk/${SDK_VERSION} (typescript)`;
5257
+
5226
5258
  // src/generated-tool-gate.ts
5227
5259
  var TOOL_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_]{1,63}$/;
5228
5260
  var DEFAULT_MAX_CODE_LENGTH = 12e3;
@@ -11609,6 +11641,14 @@ var RuntypeClient2 = class {
11609
11641
  this.timeout = config.timeout === void 0 ? 3e4 : config.timeout;
11610
11642
  this.headers = {
11611
11643
  "Content-Type": "application/json",
11644
+ // Advertise client identity + version so the API can attribute SDK traffic
11645
+ // (see detectActorSource in apps/api/src/lib/audit-log.ts). Defaults come
11646
+ // first so callers that wrap this client with their own attribution — the
11647
+ // CLI sends `X-Runtype-Client: cli` + `runtype-cli/<v>` — override them.
11648
+ // `User-Agent` is a forbidden header in browsers and is silently dropped
11649
+ // there; `X-Runtype-Client` is the reliable cross-environment signal.
11650
+ "X-Runtype-Client": RUNTYPE_CLIENT_KIND,
11651
+ "User-Agent": SDK_USER_AGENT,
11612
11652
  ...config.headers || {}
11613
11653
  };
11614
11654
  if (config.apiKey) {
@@ -11690,7 +11730,8 @@ var RuntypeClient2 = class {
11690
11730
  description: entry.description,
11691
11731
  parametersSchema: entry.parametersSchema,
11692
11732
  ...entry.origin ? { origin: entry.origin } : {},
11693
- ...entry.pageOrigin ? { pageOrigin: entry.pageOrigin } : {}
11733
+ ...entry.pageOrigin ? { pageOrigin: entry.pageOrigin } : {},
11734
+ ...entry.untrustedContentHint ? { untrustedContentHint: true } : {}
11694
11735
  })) : [];
11695
11736
  const modifiedRequest = {
11696
11737
  ...request6,
@@ -12878,11 +12919,14 @@ var STEP_TYPE_TO_METHOD = {
12878
12919
  PromptsEndpoint,
12879
12920
  PromptsNamespace,
12880
12921
  ProviderKeysEndpoint,
12922
+ RUNTYPE_CLIENT_KIND,
12881
12923
  RecordsEndpoint,
12882
12924
  Runtype,
12883
12925
  RuntypeApiError,
12884
12926
  RuntypeClient,
12885
12927
  RuntypeFlowBuilder,
12928
+ SDK_USER_AGENT,
12929
+ SDK_VERSION,
12886
12930
  STEP_FIELD_REGISTRY,
12887
12931
  STEP_TYPE_TO_METHOD,
12888
12932
  SchedulesEndpoint,
@@ -12954,6 +12998,7 @@ var STEP_TYPE_TO_METHOD = {
12954
12998
  parseOffloadedOutputId,
12955
12999
  parseSSEChunk,
12956
13000
  processStream,
13001
+ pullFpo,
12957
13002
  registerWorkflowHook,
12958
13003
  resolveStallStopAfter,
12959
13004
  resolveWorkflowHook,