deepline 0.2.73 → 0.3.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.
Files changed (28) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +75 -4
  2. package/dist/bundling-sources/sdk/src/compat.ts +4 -0
  3. package/dist/bundling-sources/sdk/src/play.ts +9 -0
  4. package/dist/bundling-sources/sdk/src/release.ts +12 -1
  5. package/dist/bundling-sources/sdk/src/types.ts +7 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +159 -32
  7. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +3 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/secret-capability.ts +32 -7
  10. package/dist/bundling-sources/shared_libs/play-runtime/tool-response-contract.ts +89 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +29 -3
  12. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +203 -16
  13. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +3 -0
  14. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +6 -3
  15. package/dist/bundling-sources/shared_libs/plays/contracts.ts +14 -0
  16. package/dist/cli/index.js +83 -9
  17. package/dist/cli/index.mjs +83 -9
  18. package/dist/{compiler-manifest-DFBtSjB2.d.mts → compiler-manifest-BX85pKXW.d.mts} +11 -4
  19. package/dist/{compiler-manifest-DFBtSjB2.d.ts → compiler-manifest-BX85pKXW.d.ts} +11 -4
  20. package/dist/index.d.mts +14 -3
  21. package/dist/index.d.ts +14 -3
  22. package/dist/index.js +85 -4
  23. package/dist/index.mjs +85 -4
  24. package/dist/install-integrity.json +3 -2
  25. package/dist/plays/bundle-play-file.d.mts +12 -2
  26. package/dist/plays/bundle-play-file.d.ts +12 -2
  27. package/dist/plays/bundle-play-file.mjs +7 -2
  28. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -780,7 +780,11 @@ var SDK_RELEASE = {
780
780
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
781
781
  // exposed storage-dependent synchronous access. This deliberate minor
782
782
  // release keeps lazy paging semantics independent of row residency.
783
- version: "0.2.73",
783
+ // 0.3.0 introduces raw-v2: complete scrubbed provider responses are
784
+ // available at toolResponse.rawV2 while toolResponse.raw and all declared
785
+ // getters keep their established compatibility behavior.
786
+ version: "0.3.0",
787
+ updateSummary: "New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.",
784
788
  contracts: {
785
789
  api: {
786
790
  name: "sdk-http-api",
@@ -3495,12 +3499,33 @@ function normalizePlayRuntimeEnvironment(value) {
3495
3499
  return typeof value === "string" && PLAY_RUNTIME_ENVIRONMENTS.includes(value) ? value : null;
3496
3500
  }
3497
3501
 
3502
+ // ../shared_libs/play-runtime/tool-response-contract.ts
3503
+ var RAW_V2_TOOL_RESPONSE_CONTRACT = "raw-v2";
3504
+ function legacyRawFromToolResponseRawV2(rawV2, view, responseMeta) {
3505
+ const legacyRaw = view === "data" && rawV2 && typeof rawV2 === "object" && !Array.isArray(rawV2) ? rawV2.data : rawV2;
3506
+ const deeplineBilling = responseMeta?.deepline_billing;
3507
+ if (view === "rawV2" && deeplineBilling !== void 0 && legacyRaw && typeof legacyRaw === "object" && !Array.isArray(legacyRaw)) {
3508
+ return {
3509
+ ...legacyRaw,
3510
+ deepline_billing: deeplineBilling
3511
+ };
3512
+ }
3513
+ return legacyRaw;
3514
+ }
3515
+ function providerMetaFromToolResponseRawV2(rawV2, view) {
3516
+ if (view !== "data" || !rawV2 || typeof rawV2 !== "object" || Array.isArray(rawV2)) {
3517
+ return void 0;
3518
+ }
3519
+ const meta = rawV2.meta;
3520
+ return meta && typeof meta === "object" && !Array.isArray(meta) ? meta : void 0;
3521
+ }
3522
+
3498
3523
  // src/client.ts
3499
3524
  var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
3500
3525
  var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
3501
3526
  var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
3502
3527
  var EXECUTE_RESPONSE_INTENT_HEADER = "x-deepline-execute-response-intent";
3503
- var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-response";
3528
+ var RAW_V2_EXECUTE_RESPONSE_CONTRACT = RAW_V2_TOOL_RESPONSE_CONTRACT;
3504
3529
  var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
3505
3530
  var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
3506
3531
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
@@ -3715,6 +3740,50 @@ function requireTargetBillingIdempotencyKey(value) {
3715
3740
  function isRecord7(value) {
3716
3741
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
3717
3742
  }
3743
+ function materializeToolExecutionResponse(response) {
3744
+ const toolResponse = response.toolResponse;
3745
+ if (!toolResponse && isRecord7(response.result)) {
3746
+ const legacyResult = response.result;
3747
+ if (Object.prototype.hasOwnProperty.call(legacyResult, "data")) {
3748
+ const legacyMeta = isRecord7(legacyResult.meta) ? legacyResult.meta : void 0;
3749
+ return {
3750
+ ...response,
3751
+ toolResponse: {
3752
+ raw: legacyResult.data,
3753
+ ...legacyMeta ? { meta: legacyMeta } : {}
3754
+ }
3755
+ };
3756
+ }
3757
+ }
3758
+ if (!toolResponse || Object.prototype.hasOwnProperty.call(toolResponse, "raw")) {
3759
+ return response;
3760
+ }
3761
+ const rawV2 = toolResponse.rawV2;
3762
+ const view = toolResponse.view;
3763
+ const providerMeta = providerMetaFromToolResponseRawV2(
3764
+ rawV2,
3765
+ view ?? "rawV2"
3766
+ );
3767
+ const responseMeta = isRecord7(toolResponse.responseMeta) ? toolResponse.responseMeta : void 0;
3768
+ return {
3769
+ ...response,
3770
+ toolResponse: {
3771
+ ...toolResponse,
3772
+ raw: legacyRawFromToolResponseRawV2(
3773
+ rawV2,
3774
+ view ?? "rawV2",
3775
+ responseMeta
3776
+ ),
3777
+ ...toolResponse.meta || providerMeta || responseMeta ? {
3778
+ meta: {
3779
+ ...toolResponse.meta ?? {},
3780
+ ...providerMeta ?? {},
3781
+ ...responseMeta ?? {}
3782
+ }
3783
+ } : {}
3784
+ }
3785
+ };
3786
+ }
3718
3787
  function isPrebuiltPlayDescription(play) {
3719
3788
  return play.origin === "prebuilt" || play.ownerType === "deepline";
3720
3789
  }
@@ -4264,14 +4333,14 @@ var DeeplineClient = class {
4264
4333
  */
4265
4334
  async executeTool(toolId, input, options) {
4266
4335
  const headers = {
4267
- [EXECUTE_RESPONSE_CONTRACT_HEADER]: V2_EXECUTE_RESPONSE_CONTRACT,
4336
+ [EXECUTE_RESPONSE_CONTRACT_HEADER]: RAW_V2_EXECUTE_RESPONSE_CONTRACT,
4268
4337
  [TOOL_EXECUTION_ERROR_SCHEMA_HEADER]: String(
4269
4338
  TOOL_EXECUTION_ERROR_SCHEMA_VERSION
4270
4339
  ),
4271
4340
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
4272
4341
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw"
4273
4342
  };
4274
- return this.http.post(
4343
+ const response = await this.http.post(
4275
4344
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
4276
4345
  {
4277
4346
  payload: input,
@@ -4285,6 +4354,7 @@ var DeeplineClient = class {
4285
4354
  toolId
4286
4355
  }
4287
4356
  );
4357
+ return materializeToolExecutionResponse(response);
4288
4358
  }
4289
4359
  /**
4290
4360
  * Back-compatible alias for {@link executeTool}.
@@ -7731,6 +7801,8 @@ function createToolExecuteResult(input) {
7731
7801
  const resultRoot = {
7732
7802
  toolResponse: {
7733
7803
  raw: result.data,
7804
+ ...input.response && "rawV2" in input.response ? { rawV2: input.response.rawV2 } : {},
7805
+ ...input.response?.view ? { view: input.response.view } : {},
7734
7806
  ...result.meta ? { meta: result.meta } : {}
7735
7807
  }
7736
7808
  };
@@ -7754,6 +7826,8 @@ function createToolExecuteResult(input) {
7754
7826
  };
7755
7827
  const toolResponse = {
7756
7828
  raw: result.data,
7829
+ ...input.response && "rawV2" in input.response ? { rawV2: input.response.rawV2 } : {},
7830
+ ...input.response?.view ? { view: input.response.view } : {},
7757
7831
  ...result.meta ? { meta: result.meta } : {}
7758
7832
  };
7759
7833
  const extractedValues = buildExtractedAccessors(targets);
@@ -8384,6 +8458,8 @@ function attachSdkQueryResultDatasetResult(toolId, result, options) {
8384
8458
  }
8385
8459
  function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
8386
8460
  const raw = response.toolResponse?.raw ?? null;
8461
+ const rawV2 = response.toolResponse?.rawV2;
8462
+ const view = response.toolResponse?.view;
8387
8463
  const meta = response.toolResponse?.meta;
8388
8464
  const metadata = isRecord9(response._metadata) ? response._metadata.tool : null;
8389
8465
  const toolMetadata = isRecord9(metadata) ? metadata : {};
@@ -8396,6 +8472,11 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
8396
8472
  data: raw,
8397
8473
  ...isRecord9(meta) ? { meta } : {}
8398
8474
  },
8475
+ response: {
8476
+ ...rawV2 !== void 0 ? { rawV2 } : {},
8477
+ ...view === "data" || view === "rawV2" ? { view } : {},
8478
+ ...isRecord9(meta) ? { meta } : {}
8479
+ },
8399
8480
  metadata: {
8400
8481
  toolId: typeof toolMetadata.toolId === "string" ? toolMetadata.toolId : fallbackToolId,
8401
8482
  extractors: extractorDescriptorRecord(toolMetadata.extractors),
package/dist/index.mjs CHANGED
@@ -703,7 +703,11 @@ var SDK_RELEASE = {
703
703
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
704
704
  // exposed storage-dependent synchronous access. This deliberate minor
705
705
  // release keeps lazy paging semantics independent of row residency.
706
- version: "0.2.73",
706
+ // 0.3.0 introduces raw-v2: complete scrubbed provider responses are
707
+ // available at toolResponse.rawV2 while toolResponse.raw and all declared
708
+ // getters keep their established compatibility behavior.
709
+ version: "0.3.0",
710
+ updateSummary: "New raw-v2 tool responses preserve complete scrubbed provider envelopes at toolResponse.rawV2, including JSON:API included resources, links, cursors, and totals. Existing toolResponse.raw and declared getters keep working unchanged.",
707
711
  contracts: {
708
712
  api: {
709
713
  name: "sdk-http-api",
@@ -3418,12 +3422,33 @@ function normalizePlayRuntimeEnvironment(value) {
3418
3422
  return typeof value === "string" && PLAY_RUNTIME_ENVIRONMENTS.includes(value) ? value : null;
3419
3423
  }
3420
3424
 
3425
+ // ../shared_libs/play-runtime/tool-response-contract.ts
3426
+ var RAW_V2_TOOL_RESPONSE_CONTRACT = "raw-v2";
3427
+ function legacyRawFromToolResponseRawV2(rawV2, view, responseMeta) {
3428
+ const legacyRaw = view === "data" && rawV2 && typeof rawV2 === "object" && !Array.isArray(rawV2) ? rawV2.data : rawV2;
3429
+ const deeplineBilling = responseMeta?.deepline_billing;
3430
+ if (view === "rawV2" && deeplineBilling !== void 0 && legacyRaw && typeof legacyRaw === "object" && !Array.isArray(legacyRaw)) {
3431
+ return {
3432
+ ...legacyRaw,
3433
+ deepline_billing: deeplineBilling
3434
+ };
3435
+ }
3436
+ return legacyRaw;
3437
+ }
3438
+ function providerMetaFromToolResponseRawV2(rawV2, view) {
3439
+ if (view !== "data" || !rawV2 || typeof rawV2 !== "object" || Array.isArray(rawV2)) {
3440
+ return void 0;
3441
+ }
3442
+ const meta = rawV2.meta;
3443
+ return meta && typeof meta === "object" && !Array.isArray(meta) ? meta : void 0;
3444
+ }
3445
+
3421
3446
  // src/client.ts
3422
3447
  var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
3423
3448
  var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
3424
3449
  var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
3425
3450
  var EXECUTE_RESPONSE_INTENT_HEADER = "x-deepline-execute-response-intent";
3426
- var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-response";
3451
+ var RAW_V2_EXECUTE_RESPONSE_CONTRACT = RAW_V2_TOOL_RESPONSE_CONTRACT;
3427
3452
  var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
3428
3453
  var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
3429
3454
  var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
@@ -3638,6 +3663,50 @@ function requireTargetBillingIdempotencyKey(value) {
3638
3663
  function isRecord7(value) {
3639
3664
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
3640
3665
  }
3666
+ function materializeToolExecutionResponse(response) {
3667
+ const toolResponse = response.toolResponse;
3668
+ if (!toolResponse && isRecord7(response.result)) {
3669
+ const legacyResult = response.result;
3670
+ if (Object.prototype.hasOwnProperty.call(legacyResult, "data")) {
3671
+ const legacyMeta = isRecord7(legacyResult.meta) ? legacyResult.meta : void 0;
3672
+ return {
3673
+ ...response,
3674
+ toolResponse: {
3675
+ raw: legacyResult.data,
3676
+ ...legacyMeta ? { meta: legacyMeta } : {}
3677
+ }
3678
+ };
3679
+ }
3680
+ }
3681
+ if (!toolResponse || Object.prototype.hasOwnProperty.call(toolResponse, "raw")) {
3682
+ return response;
3683
+ }
3684
+ const rawV2 = toolResponse.rawV2;
3685
+ const view = toolResponse.view;
3686
+ const providerMeta = providerMetaFromToolResponseRawV2(
3687
+ rawV2,
3688
+ view ?? "rawV2"
3689
+ );
3690
+ const responseMeta = isRecord7(toolResponse.responseMeta) ? toolResponse.responseMeta : void 0;
3691
+ return {
3692
+ ...response,
3693
+ toolResponse: {
3694
+ ...toolResponse,
3695
+ raw: legacyRawFromToolResponseRawV2(
3696
+ rawV2,
3697
+ view ?? "rawV2",
3698
+ responseMeta
3699
+ ),
3700
+ ...toolResponse.meta || providerMeta || responseMeta ? {
3701
+ meta: {
3702
+ ...toolResponse.meta ?? {},
3703
+ ...providerMeta ?? {},
3704
+ ...responseMeta ?? {}
3705
+ }
3706
+ } : {}
3707
+ }
3708
+ };
3709
+ }
3641
3710
  function isPrebuiltPlayDescription(play) {
3642
3711
  return play.origin === "prebuilt" || play.ownerType === "deepline";
3643
3712
  }
@@ -4187,14 +4256,14 @@ var DeeplineClient = class {
4187
4256
  */
4188
4257
  async executeTool(toolId, input, options) {
4189
4258
  const headers = {
4190
- [EXECUTE_RESPONSE_CONTRACT_HEADER]: V2_EXECUTE_RESPONSE_CONTRACT,
4259
+ [EXECUTE_RESPONSE_CONTRACT_HEADER]: RAW_V2_EXECUTE_RESPONSE_CONTRACT,
4191
4260
  [TOOL_EXECUTION_ERROR_SCHEMA_HEADER]: String(
4192
4261
  TOOL_EXECUTION_ERROR_SCHEMA_VERSION
4193
4262
  ),
4194
4263
  ...options?.includeToolMetadata ? { [INCLUDE_TOOL_METADATA_HEADER]: "true" } : {},
4195
4264
  [EXECUTE_RESPONSE_INTENT_HEADER]: options?.responseIntent ?? "raw"
4196
4265
  };
4197
- return this.http.post(
4266
+ const response = await this.http.post(
4198
4267
  `/api/v2/integrations/${encodeURIComponent(toolId)}/execute`,
4199
4268
  {
4200
4269
  payload: input,
@@ -4208,6 +4277,7 @@ var DeeplineClient = class {
4208
4277
  toolId
4209
4278
  }
4210
4279
  );
4280
+ return materializeToolExecutionResponse(response);
4211
4281
  }
4212
4282
  /**
4213
4283
  * Back-compatible alias for {@link executeTool}.
@@ -7654,6 +7724,8 @@ function createToolExecuteResult(input) {
7654
7724
  const resultRoot = {
7655
7725
  toolResponse: {
7656
7726
  raw: result.data,
7727
+ ...input.response && "rawV2" in input.response ? { rawV2: input.response.rawV2 } : {},
7728
+ ...input.response?.view ? { view: input.response.view } : {},
7657
7729
  ...result.meta ? { meta: result.meta } : {}
7658
7730
  }
7659
7731
  };
@@ -7677,6 +7749,8 @@ function createToolExecuteResult(input) {
7677
7749
  };
7678
7750
  const toolResponse = {
7679
7751
  raw: result.data,
7752
+ ...input.response && "rawV2" in input.response ? { rawV2: input.response.rawV2 } : {},
7753
+ ...input.response?.view ? { view: input.response.view } : {},
7680
7754
  ...result.meta ? { meta: result.meta } : {}
7681
7755
  };
7682
7756
  const extractedValues = buildExtractedAccessors(targets);
@@ -8307,6 +8381,8 @@ function attachSdkQueryResultDatasetResult(toolId, result, options) {
8307
8381
  }
8308
8382
  function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
8309
8383
  const raw = response.toolResponse?.raw ?? null;
8384
+ const rawV2 = response.toolResponse?.rawV2;
8385
+ const view = response.toolResponse?.view;
8310
8386
  const meta = response.toolResponse?.meta;
8311
8387
  const metadata = isRecord9(response._metadata) ? response._metadata.tool : null;
8312
8388
  const toolMetadata = isRecord9(metadata) ? metadata : {};
@@ -8319,6 +8395,11 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response, options) {
8319
8395
  data: raw,
8320
8396
  ...isRecord9(meta) ? { meta } : {}
8321
8397
  },
8398
+ response: {
8399
+ ...rawV2 !== void 0 ? { rawV2 } : {},
8400
+ ...view === "data" || view === "rawV2" ? { view } : {},
8401
+ ...isRecord9(meta) ? { meta } : {}
8402
+ },
8322
8403
  metadata: {
8323
8404
  toolId: typeof toolMetadata.toolId === "string" ? toolMetadata.toolId : fallbackToolId,
8324
8405
  extractors: extractorDescriptorRecord(toolMetadata.extractors),
@@ -173,6 +173,7 @@
173
173
  "dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts",
174
174
  "dist/bundling-sources/shared_libs/play-runtime/tool-execution-outcome.ts",
175
175
  "dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts",
176
+ "dist/bundling-sources/shared_libs/play-runtime/tool-response-contract.ts",
176
177
  "dist/bundling-sources/shared_libs/play-runtime/tool-result-paths.ts",
177
178
  "dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts",
178
179
  "dist/bundling-sources/shared_libs/play-runtime/tool-result.ts",
@@ -225,8 +226,8 @@
225
226
  "dist/cli/index.d.ts",
226
227
  "dist/cli/index.js",
227
228
  "dist/cli/index.mjs",
228
- "dist/compiler-manifest-DFBtSjB2.d.mts",
229
- "dist/compiler-manifest-DFBtSjB2.d.ts",
229
+ "dist/compiler-manifest-BX85pKXW.d.mts",
230
+ "dist/compiler-manifest-BX85pKXW.d.ts",
230
231
  "dist/helpers.d.mts",
231
232
  "dist/helpers.d.ts",
232
233
  "dist/helpers.js",
@@ -1,7 +1,15 @@
1
- import { T as ToolExecutionErrorSchemaVersion, P as PlayAuthoringContractEdition, a as PlayArtifactKind$1, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-DFBtSjB2.mjs';
2
- export { d as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-DFBtSjB2.mjs';
1
+ import { T as ToolExecutionErrorSchemaVersion, P as PlayAuthoringContractEdition, a as PlayArtifactKind$1, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-BX85pKXW.mjs';
2
+ export { d as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-BX85pKXW.mjs';
3
3
  import '@sinclair/typebox';
4
4
 
5
+ /**
6
+ * Public tool-response contracts shared by the API, SDK, Play bundler, and
7
+ * runtime. A response contract is transport behavior, never Play authoring.
8
+ */
9
+ declare const V2_TOOL_RESPONSE_CONTRACT: "v2-tool-response";
10
+ declare const RAW_V2_TOOL_RESPONSE_CONTRACT: "raw-v2";
11
+ type ToolResponseContract = typeof V2_TOOL_RESPONSE_CONTRACT | typeof RAW_V2_TOOL_RESPONSE_CONTRACT;
12
+
5
13
  type PlayPackageImport = {
6
14
  name: string;
7
15
  version: string | null;
@@ -22,6 +30,8 @@ type PlayArtifactCompatibility = {
22
30
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
23
31
  /** Missing preserves edition 1 for artifacts created before authoring contracts were pinned. */
24
32
  authoringContractEdition?: PlayAuthoringContractEdition;
33
+ /** Missing preserves the raw-only V2 execute response contract. */
34
+ toolResponseContract?: ToolResponseContract;
25
35
  };
26
36
  /** The only executable Play artifact contract. */
27
37
  type PlayArtifactKind = 'cjs_node20';
@@ -1,7 +1,15 @@
1
- import { T as ToolExecutionErrorSchemaVersion, P as PlayAuthoringContractEdition, a as PlayArtifactKind$1, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-DFBtSjB2.js';
2
- export { d as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-DFBtSjB2.js';
1
+ import { T as ToolExecutionErrorSchemaVersion, P as PlayAuthoringContractEdition, a as PlayArtifactKind$1, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-BX85pKXW.js';
2
+ export { d as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-BX85pKXW.js';
3
3
  import '@sinclair/typebox';
4
4
 
5
+ /**
6
+ * Public tool-response contracts shared by the API, SDK, Play bundler, and
7
+ * runtime. A response contract is transport behavior, never Play authoring.
8
+ */
9
+ declare const V2_TOOL_RESPONSE_CONTRACT: "v2-tool-response";
10
+ declare const RAW_V2_TOOL_RESPONSE_CONTRACT: "raw-v2";
11
+ type ToolResponseContract = typeof V2_TOOL_RESPONSE_CONTRACT | typeof RAW_V2_TOOL_RESPONSE_CONTRACT;
12
+
5
13
  type PlayPackageImport = {
6
14
  name: string;
7
15
  version: string | null;
@@ -22,6 +30,8 @@ type PlayArtifactCompatibility = {
22
30
  toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
23
31
  /** Missing preserves edition 1 for artifacts created before authoring contracts were pinned. */
24
32
  authoringContractEdition?: PlayAuthoringContractEdition;
33
+ /** Missing preserves the raw-only V2 execute response contract. */
34
+ toolResponseContract?: ToolResponseContract;
25
35
  };
26
36
  /** The only executable Play artifact contract. */
27
37
  type PlayArtifactKind = 'cjs_node20';
@@ -3942,6 +3942,7 @@ var PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
3942
3942
  "declare const SECRET_HANDLE_BRAND: unique symbol;",
3943
3943
  "export type SecretHandle = { readonly [SECRET_HANDLE_BRAND]: never; readonly name: string; toString(): string; toJSON(): never };",
3944
3944
  "export type SecretAuth = { readonly kind: 'bearer' | 'header'; readonly secret: SecretHandle; readonly header?: string };",
3945
+ "export type SecretAuthInput = SecretAuth | readonly SecretAuth[];",
3945
3946
  "export type PlayInputContract<TInput> = { readonly schema: Record<string, unknown>; readonly __inputType?: TInput };",
3946
3947
  "export type PlayReturnObject = Record<string, unknown> & { readonly _metadata?: never };",
3947
3948
  "export type CsvRenameMap = Record<string, string | readonly string[]>;",
@@ -3990,7 +3991,7 @@ var PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
3990
3991
  ` customerDb: { query<TRow extends Record<string, unknown> = Record<string, unknown>>(statement: SqlQuery, options?: { maxRows?: ${cloudReferenceType("ctx.customerDb.query.options.maxRows")}; timeoutMs?: ${cloudReferenceType("ctx.customerDb.query.options.timeoutMs")} }): Promise<TRow[]> };`,
3991
3992
  ` tool<K extends string>(key: ${cloudReferenceType("ctx.tool.key")}, toolId: K, input: ${cloudReferenceType("ctx.tool.input")}, options?: { description?: ${cloudReferenceType("ctx.tool.options.description")} }): Promise<ToolExecutionOutput<K>>;`,
3992
3993
  " step<T>(id: string, run: () => T | Promise<T>, options?: RuntimeStepOptions): Promise<T>;",
3993
- " fetch(key: string, url: string | URL, init?: RequestInit & { headers?: HeadersInit & { 'Idempotency-Key'?: string; 'X-Idempotency-Key'?: string }; auth?: SecretAuth }, options?: FetchOptions): Promise<PlayFetchResponse>;",
3994
+ " fetch(key: string, url: string | URL, init?: RequestInit & { headers?: HeadersInit & { 'Idempotency-Key'?: string; 'X-Idempotency-Key'?: string }; auth?: SecretAuthInput }, options?: FetchOptions): Promise<PlayFetchResponse>;",
3994
3995
  " secrets: { get(name: string): SecretHandle; bearer(secret: SecretHandle): SecretAuth; header(header: string, secret: SecretHandle): SecretAuth };",
3995
3996
  ` runPlay<TOutput = unknown>(key: string, playRef: ${cloudReferenceType("ctx.runPlay.playRef")}, input: ${cloudReferenceType("ctx.runPlay.input")}, options: PlayCallOptions): Promise<TOutput>;`,
3996
3997
  " log(message: string): void;",
@@ -4000,6 +4001,9 @@ var PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
4000
4001
  "export type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & { readonly name: string; readonly __inputType?: TInput; readonly __outputType?: TOutput; readonly runtime?: PlayBindings['runtime']; readonly compatibility?: PlayBindings['compatibility'] };"
4001
4002
  ];
4002
4003
 
4004
+ // ../shared_libs/play-runtime/tool-response-contract.ts
4005
+ var RAW_V2_TOOL_RESPONSE_CONTRACT = "raw-v2";
4006
+
4003
4007
  // ../shared_libs/plays/contracts.ts
4004
4008
  var PLAY_PUBLIC_API_VERSION = 1;
4005
4009
  var PLAY_ARTIFACT_VERSION = CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION;
@@ -4018,7 +4022,8 @@ function buildPlayContractCompatibility(input) {
4018
4022
  runtimeFeatures: [...PLAY_RUNTIME_FEATURES],
4019
4023
  runtimeBackend: input?.runtimeBackend ?? null,
4020
4024
  toolErrorSchemaVersion: input?.toolErrorSchemaVersion ?? TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
4021
- authoringContractEdition: input?.authoringContractEdition ?? PLAY_AUTHORING_CONTRACT_EDITION
4025
+ authoringContractEdition: input?.authoringContractEdition ?? PLAY_AUTHORING_CONTRACT_EDITION,
4026
+ toolResponseContract: input?.toolResponseContract ?? RAW_V2_TOOL_RESPONSE_CONTRACT
4022
4027
  };
4023
4028
  }
4024
4029
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.73",
3
+ "version": "0.3.0",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",