deepline 0.2.71 → 0.2.73

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.d.mts CHANGED
@@ -1304,6 +1304,19 @@ interface PlayDetail {
1304
1304
  customerDbUrl: string;
1305
1305
  /** Change cursor for incremental sync. */
1306
1306
  deltaCursor: number;
1307
+ /**
1308
+ * Present only when requested through `getPlay(..., { source: ... })`.
1309
+ * `files` is the complete authored source tree, keyed by logical path.
1310
+ */
1311
+ source?: {
1312
+ selector: 'working' | 'live' | `version:${number}`;
1313
+ revision: {
1314
+ id: string;
1315
+ version: number;
1316
+ };
1317
+ entryFile: string;
1318
+ files: Record<string, string>;
1319
+ };
1307
1320
  }
1308
1321
  interface ClearPlayHistoryRequest {
1309
1322
  /** Optional explicit ctx.dataset keys to clear. Omit to clear all discovered sheets for the play. */
@@ -3405,7 +3418,9 @@ declare class DeeplineClient {
3405
3418
  * console.log(`Total runs: ${detail.play.runCount}`);
3406
3419
  * ```
3407
3420
  */
3408
- getPlay(name: string): Promise<PlayDetail>;
3421
+ getPlay(name: string, options?: {
3422
+ source?: 'working' | 'live' | `version:${number}`;
3423
+ }): Promise<PlayDetail>;
3409
3424
  /**
3410
3425
  * Get a normalized play description suitable for agents and CLIs.
3411
3426
  *
package/dist/index.d.ts CHANGED
@@ -1304,6 +1304,19 @@ interface PlayDetail {
1304
1304
  customerDbUrl: string;
1305
1305
  /** Change cursor for incremental sync. */
1306
1306
  deltaCursor: number;
1307
+ /**
1308
+ * Present only when requested through `getPlay(..., { source: ... })`.
1309
+ * `files` is the complete authored source tree, keyed by logical path.
1310
+ */
1311
+ source?: {
1312
+ selector: 'working' | 'live' | `version:${number}`;
1313
+ revision: {
1314
+ id: string;
1315
+ version: number;
1316
+ };
1317
+ entryFile: string;
1318
+ files: Record<string, string>;
1319
+ };
1307
1320
  }
1308
1321
  interface ClearPlayHistoryRequest {
1309
1322
  /** Optional explicit ctx.dataset keys to clear. Omit to clear all discovered sheets for the play. */
@@ -3405,7 +3418,9 @@ declare class DeeplineClient {
3405
3418
  * console.log(`Total runs: ${detail.play.runCount}`);
3406
3419
  * ```
3407
3420
  */
3408
- getPlay(name: string): Promise<PlayDetail>;
3421
+ getPlay(name: string, options?: {
3422
+ source?: 'working' | 'live' | `version:${number}`;
3423
+ }): Promise<PlayDetail>;
3409
3424
  /**
3410
3425
  * Get a normalized play description suitable for agents and CLIs.
3411
3426
  *
package/dist/index.js CHANGED
@@ -780,7 +780,7 @@ 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.71",
783
+ version: "0.2.73",
784
784
  contracts: {
785
785
  api: {
786
786
  name: "sdk-http-api",
@@ -5728,9 +5728,10 @@ var DeeplineClient = class {
5728
5728
  * console.log(`Total runs: ${detail.play.runCount}`);
5729
5729
  * ```
5730
5730
  */
5731
- async getPlay(name) {
5731
+ async getPlay(name, options) {
5732
5732
  const encodedName = encodeURIComponent(name);
5733
- return this.http.get(`/api/v2/plays/${encodedName}`);
5733
+ const query = options?.source ? `?include=source&revision=${encodeURIComponent(options.source)}` : "";
5734
+ return this.http.get(`/api/v2/plays/${encodedName}${query}`);
5734
5735
  }
5735
5736
  /**
5736
5737
  * Get a normalized play description suitable for agents and CLIs.
@@ -7103,16 +7104,41 @@ function listNameFromDeclaredPath(path) {
7103
7104
  }
7104
7105
 
7105
7106
  // ../shared_libs/play-runtime/tool-result.ts
7107
+ var DESCRIPTOR_SUFFIX = /_(status|type|score|count|id|verified|valid|confidence|quality|source)$/i;
7108
+ var COMPANY_SCOPED = /company/i;
7106
7109
  var TARGET_FALLBACK_KEYS = {
7107
- email: [/^email$/i, /^address$/i, /email/i],
7108
- phone: [/^phone$/i, /mobile/i, /phone/i, /telephone/i],
7109
- linkedin: [/^linkedin_url$/i, /^linkedin$/i, /linkedin/i],
7110
- company_linkedin_url: [/company.*linkedin/i, /linkedin.*company/i],
7111
- company_domain: [/^company_domain$/i, /company.*domain/i],
7112
- company_name: [/^company_name$/i, /company.*name/i],
7113
- domain: [/^domain$/i, /company_domain/i, /domain/i],
7114
- status: [/^email_status$/i, /^status$/i],
7115
- email_status: [/^email_status$/i, /^status$/i]
7110
+ email: {
7111
+ match: [/^email$/i, /^address$/i, /email/i],
7112
+ reject: [DESCRIPTOR_SUFFIX]
7113
+ },
7114
+ phone: {
7115
+ match: [/^phone$/i, /mobile/i, /phone/i, /telephone/i],
7116
+ reject: [DESCRIPTOR_SUFFIX]
7117
+ },
7118
+ linkedin: {
7119
+ match: [/^linkedin_url$/i, /^linkedin$/i, /linkedin/i],
7120
+ reject: [DESCRIPTOR_SUFFIX, COMPANY_SCOPED]
7121
+ },
7122
+ company_linkedin_url: {
7123
+ match: [/company.*linkedin/i, /linkedin.*company/i],
7124
+ reject: [DESCRIPTOR_SUFFIX]
7125
+ },
7126
+ company_domain: {
7127
+ match: [/^company_domain$/i, /company.*domain/i],
7128
+ reject: [DESCRIPTOR_SUFFIX]
7129
+ },
7130
+ company_name: {
7131
+ match: [/^company_name$/i, /company.*name/i],
7132
+ reject: [DESCRIPTOR_SUFFIX]
7133
+ },
7134
+ domain: {
7135
+ match: [/^domain$/i, /company_domain/i, /domain/i],
7136
+ reject: [DESCRIPTOR_SUFFIX]
7137
+ },
7138
+ // Status targets legitimately want the `_status` keys the suffix rule
7139
+ // rejects elsewhere, so they carry no rejections.
7140
+ status: { match: [/^email_status$/i, /^status$/i] },
7141
+ email_status: { match: [/^email_status$/i, /^status$/i] }
7116
7142
  };
7117
7143
  function isRecord8(value) {
7118
7144
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -7334,11 +7360,12 @@ function findFirstTargetByKey(result, target, depth = 0, path = []) {
7334
7360
  return null;
7335
7361
  }
7336
7362
  if (!isRecord8(result)) return null;
7337
- const patterns = TARGET_FALLBACK_KEYS[target] ?? [
7338
- new RegExp(`^${target}$`, "i")
7339
- ];
7363
+ const rule = TARGET_FALLBACK_KEYS[target] ?? {
7364
+ match: [new RegExp(`^${target}$`, "i")]
7365
+ };
7340
7366
  for (const [key, value] of Object.entries(result)) {
7341
- if (patterns.some((pattern) => pattern.test(key)) && isMeaningfulValue(value)) {
7367
+ if (rule.reject?.some((pattern) => pattern.test(key))) continue;
7368
+ if (rule.match.some((pattern) => pattern.test(key)) && isMeaningfulValue(value)) {
7342
7369
  return { value, path: pathToString([...path, key]) };
7343
7370
  }
7344
7371
  }
package/dist/index.mjs CHANGED
@@ -703,7 +703,7 @@ 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.71",
706
+ version: "0.2.73",
707
707
  contracts: {
708
708
  api: {
709
709
  name: "sdk-http-api",
@@ -5651,9 +5651,10 @@ var DeeplineClient = class {
5651
5651
  * console.log(`Total runs: ${detail.play.runCount}`);
5652
5652
  * ```
5653
5653
  */
5654
- async getPlay(name) {
5654
+ async getPlay(name, options) {
5655
5655
  const encodedName = encodeURIComponent(name);
5656
- return this.http.get(`/api/v2/plays/${encodedName}`);
5656
+ const query = options?.source ? `?include=source&revision=${encodeURIComponent(options.source)}` : "";
5657
+ return this.http.get(`/api/v2/plays/${encodedName}${query}`);
5657
5658
  }
5658
5659
  /**
5659
5660
  * Get a normalized play description suitable for agents and CLIs.
@@ -7026,16 +7027,41 @@ function listNameFromDeclaredPath(path) {
7026
7027
  }
7027
7028
 
7028
7029
  // ../shared_libs/play-runtime/tool-result.ts
7030
+ var DESCRIPTOR_SUFFIX = /_(status|type|score|count|id|verified|valid|confidence|quality|source)$/i;
7031
+ var COMPANY_SCOPED = /company/i;
7029
7032
  var TARGET_FALLBACK_KEYS = {
7030
- email: [/^email$/i, /^address$/i, /email/i],
7031
- phone: [/^phone$/i, /mobile/i, /phone/i, /telephone/i],
7032
- linkedin: [/^linkedin_url$/i, /^linkedin$/i, /linkedin/i],
7033
- company_linkedin_url: [/company.*linkedin/i, /linkedin.*company/i],
7034
- company_domain: [/^company_domain$/i, /company.*domain/i],
7035
- company_name: [/^company_name$/i, /company.*name/i],
7036
- domain: [/^domain$/i, /company_domain/i, /domain/i],
7037
- status: [/^email_status$/i, /^status$/i],
7038
- email_status: [/^email_status$/i, /^status$/i]
7033
+ email: {
7034
+ match: [/^email$/i, /^address$/i, /email/i],
7035
+ reject: [DESCRIPTOR_SUFFIX]
7036
+ },
7037
+ phone: {
7038
+ match: [/^phone$/i, /mobile/i, /phone/i, /telephone/i],
7039
+ reject: [DESCRIPTOR_SUFFIX]
7040
+ },
7041
+ linkedin: {
7042
+ match: [/^linkedin_url$/i, /^linkedin$/i, /linkedin/i],
7043
+ reject: [DESCRIPTOR_SUFFIX, COMPANY_SCOPED]
7044
+ },
7045
+ company_linkedin_url: {
7046
+ match: [/company.*linkedin/i, /linkedin.*company/i],
7047
+ reject: [DESCRIPTOR_SUFFIX]
7048
+ },
7049
+ company_domain: {
7050
+ match: [/^company_domain$/i, /company.*domain/i],
7051
+ reject: [DESCRIPTOR_SUFFIX]
7052
+ },
7053
+ company_name: {
7054
+ match: [/^company_name$/i, /company.*name/i],
7055
+ reject: [DESCRIPTOR_SUFFIX]
7056
+ },
7057
+ domain: {
7058
+ match: [/^domain$/i, /company_domain/i, /domain/i],
7059
+ reject: [DESCRIPTOR_SUFFIX]
7060
+ },
7061
+ // Status targets legitimately want the `_status` keys the suffix rule
7062
+ // rejects elsewhere, so they carry no rejections.
7063
+ status: { match: [/^email_status$/i, /^status$/i] },
7064
+ email_status: { match: [/^email_status$/i, /^status$/i] }
7039
7065
  };
7040
7066
  function isRecord8(value) {
7041
7067
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -7257,11 +7283,12 @@ function findFirstTargetByKey(result, target, depth = 0, path = []) {
7257
7283
  return null;
7258
7284
  }
7259
7285
  if (!isRecord8(result)) return null;
7260
- const patterns = TARGET_FALLBACK_KEYS[target] ?? [
7261
- new RegExp(`^${target}$`, "i")
7262
- ];
7286
+ const rule = TARGET_FALLBACK_KEYS[target] ?? {
7287
+ match: [new RegExp(`^${target}$`, "i")]
7288
+ };
7263
7289
  for (const [key, value] of Object.entries(result)) {
7264
- if (patterns.some((pattern) => pattern.test(key)) && isMeaningfulValue(value)) {
7290
+ if (rule.reject?.some((pattern) => pattern.test(key))) continue;
7291
+ if (rule.match.some((pattern) => pattern.test(key)) && isMeaningfulValue(value)) {
7265
7292
  return { value, path: pathToString([...path, key]) };
7266
7293
  }
7267
7294
  }
@@ -5262,6 +5262,11 @@ var NODE_BUILTIN_SET = new Set(
5262
5262
  (name) => name.startsWith("node:") ? [name, name.slice(5)] : [name, `node:${name}`]
5263
5263
  )
5264
5264
  );
5265
+ var defaultPathRelationshipApi = {
5266
+ relative,
5267
+ isAbsolute,
5268
+ sep
5269
+ };
5265
5270
  function assertValidExportName(exportName) {
5266
5271
  if (exportName === "default") return;
5267
5272
  if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(exportName)) {
@@ -5273,9 +5278,9 @@ function assertValidExportName(exportName) {
5273
5278
  function sha256(value) {
5274
5279
  return createHash("sha256").update(value).digest("hex");
5275
5280
  }
5276
- function sourceIdentityPath(filePath, adapter) {
5277
- if (!adapter.sourceIdentityRoot) return filePath;
5278
- const identityRoot = resolve(adapter.sourceIdentityRoot);
5281
+ function sourceIdentityPath(filePath, sourceIdentityRoot) {
5282
+ if (!sourceIdentityRoot) return filePath;
5283
+ const identityRoot = resolve(sourceIdentityRoot);
5279
5284
  const logicalPath = relative(identityRoot, resolve(filePath));
5280
5285
  if (!logicalPath || logicalPath === ".." || logicalPath.startsWith(`..${sep}`) || isAbsolute(logicalPath)) {
5281
5286
  return filePath;
@@ -5302,8 +5307,9 @@ function createPlayWorkspace(entryFile) {
5302
5307
  rootDir: dirname(entryFile)
5303
5308
  };
5304
5309
  }
5305
- function isPathInsideDirectory(filePath, directory) {
5306
- return filePath === directory || filePath.startsWith(`${directory}/`);
5310
+ function isPathInsideDirectory(filePath, directory, pathApi = defaultPathRelationshipApi) {
5311
+ const relationship = pathApi.relative(directory, filePath);
5312
+ return relationship === "" || relationship !== ".." && !relationship.startsWith(`..${pathApi.sep}`) && !pathApi.isAbsolute(relationship);
5307
5313
  }
5308
5314
  function assertWithinPlayWorkspace(input) {
5309
5315
  if (isPathInsideDirectory(input.resolvedPath, input.workspace.rootDir)) {
@@ -6286,6 +6292,7 @@ function resolvePackageImport(specifier, fromFile, adapter) {
6286
6292
  async function analyzeSourceGraph(entryFile, adapter, exportName) {
6287
6293
  const absoluteEntryFile = await normalizeLocalPath(entryFile);
6288
6294
  const workspace = createPlayWorkspace(absoluteEntryFile);
6295
+ const sourceIdentityRoot = adapter.sourceIdentityRoot;
6289
6296
  const localFiles = /* @__PURE__ */ new Map();
6290
6297
  const nodeBuiltins = /* @__PURE__ */ new Set();
6291
6298
  const packages = /* @__PURE__ */ new Map();
@@ -6382,15 +6389,15 @@ async function analyzeSourceGraph(entryFile, adapter, exportName) {
6382
6389
  const sourceHash = sha256(sourceCode);
6383
6390
  const graphHash = sha256(
6384
6391
  JSON.stringify({
6385
- entryFile: sourceIdentityPath(absoluteEntryFile, adapter),
6392
+ entryFile: sourceIdentityPath(absoluteEntryFile, sourceIdentityRoot),
6386
6393
  localFiles: [...localFiles.entries()].map(([filePath, contents]) => ({
6387
- filePath: sourceIdentityPath(filePath, adapter),
6394
+ filePath: sourceIdentityPath(filePath, sourceIdentityRoot),
6388
6395
  hash: sha256(contents)
6389
6396
  })).sort((left, right) => left.filePath.localeCompare(right.filePath)),
6390
6397
  nodeBuiltins: [...nodeBuiltins].sort(),
6391
6398
  packages: [...packages.entries()].map(([name, version]) => ({ name, version })).sort((left, right) => left.name.localeCompare(right.name)),
6392
6399
  importedPlayDependencies: [...importedPlayDependencies.values()].map((dependency) => ({
6393
- filePath: sourceIdentityPath(dependency.filePath, adapter),
6400
+ filePath: sourceIdentityPath(dependency.filePath, sourceIdentityRoot),
6394
6401
  playName: dependency.playName
6395
6402
  })).sort((left, right) => left.filePath.localeCompare(right.filePath))
6396
6403
  })
@@ -6543,6 +6550,7 @@ async function bundlePlayFile(filePath, options) {
6543
6550
  const exportName = options.exportName?.trim() || "default";
6544
6551
  assertValidExportName(exportName);
6545
6552
  const absolutePath = await normalizeLocalPath(filePath);
6553
+ const sourceIdentityRoot = adapter.sourceIdentityRoot;
6546
6554
  adapter.warnAboutNonDevelopmentBundling?.(absolutePath);
6547
6555
  try {
6548
6556
  const analysis = await analyzeSourceGraph(
@@ -6555,6 +6563,19 @@ async function bundlePlayFile(filePath, options) {
6555
6563
  entry-export:${exportName}
6556
6564
  authoring-contract-edition:${PLAY_AUTHORING_CONTRACT_EDITION}`
6557
6565
  );
6566
+ const sourceFiles = Object.fromEntries(
6567
+ Object.entries(analysis.sourceFiles).map(([sourcePath, sourceCode]) => [
6568
+ sourceIdentityPath(sourcePath, sourceIdentityRoot),
6569
+ sourceCode
6570
+ ])
6571
+ );
6572
+ const importPolicy = {
6573
+ ...analysis.importPolicy,
6574
+ localFiles: analysis.importPolicy.localFiles.map(
6575
+ (sourcePath) => sourceIdentityPath(sourcePath, sourceIdentityRoot)
6576
+ )
6577
+ };
6578
+ const entryFile = sourceIdentityPath(absolutePath, sourceIdentityRoot);
6558
6579
  try {
6559
6580
  validatePlaySourceFilesHaveNoInlineSecrets(analysis.sourceFiles);
6560
6581
  } catch (error) {
@@ -6606,16 +6627,16 @@ authoring-contract-edition:${PLAY_AUTHORING_CONTRACT_EDITION}`
6606
6627
  success: true,
6607
6628
  artifact: {
6608
6629
  ...cachedArtifact,
6609
- entryFile: absolutePath,
6630
+ entryFile,
6610
6631
  sourceHash: analysis.sourceHash,
6611
- importPolicy: analysis.importPolicy,
6632
+ importPolicy,
6612
6633
  compatibility: buildPlayContractCompatibility({
6613
6634
  toolErrorSchemaVersion: analysis.toolErrorSchemaVersion ?? void 0
6614
6635
  }),
6615
6636
  cacheHit: true
6616
6637
  },
6617
6638
  sourceCode: analysis.sourceCode,
6618
- sourceFiles: analysis.sourceFiles,
6639
+ sourceFiles,
6619
6640
  filePath: absolutePath,
6620
6641
  playName: analysis.playName,
6621
6642
  playDescription: analysis.playDescription,
@@ -6664,7 +6685,7 @@ authoring-contract-edition:${PLAY_AUTHORING_CONTRACT_EDITION}`
6664
6685
  const artifact = {
6665
6686
  codeFormat: "cjs_module",
6666
6687
  artifactKind: target,
6667
- entryFile: absolutePath,
6688
+ entryFile,
6668
6689
  virtualFilename,
6669
6690
  sourceHash: analysis.sourceHash,
6670
6691
  graphHash: analysis.graphHash,
@@ -6672,7 +6693,7 @@ authoring-contract-edition:${PLAY_AUTHORING_CONTRACT_EDITION}`
6672
6693
  sourceMapHash: sha256(normalizedSourceMap),
6673
6694
  bundledCode: executableCode,
6674
6695
  sourceMap: normalizedSourceMap,
6675
- importPolicy: analysis.importPolicy,
6696
+ importPolicy,
6676
6697
  compatibility: buildPlayContractCompatibility({
6677
6698
  toolErrorSchemaVersion: analysis.toolErrorSchemaVersion ?? void 0
6678
6699
  }),
@@ -6684,7 +6705,7 @@ authoring-contract-edition:${PLAY_AUTHORING_CONTRACT_EDITION}`
6684
6705
  success: true,
6685
6706
  artifact,
6686
6707
  sourceCode: analysis.sourceCode,
6687
- sourceFiles: analysis.sourceFiles,
6708
+ sourceFiles,
6688
6709
  filePath: absolutePath,
6689
6710
  playName: analysis.playName,
6690
6711
  playDescription: analysis.playDescription,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.71",
3
+ "version": "0.2.73",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",