deepline 0.2.70 → 0.2.72

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
@@ -1108,6 +1108,10 @@ interface PlayDefinitionDetail {
1108
1108
  name: string;
1109
1109
  /** Human-friendly display name for UI surfaces. */
1110
1110
  displayName?: string;
1111
+ /** Whether this Play sorts before unpinned Plays. */
1112
+ pinned?: boolean;
1113
+ /** Canonical categories declared by tools used in this Play. */
1114
+ toolCategories?: string[];
1111
1115
  /** Whether this entry comes from the Deepline prebuilt registry or the org-owned catalog. */
1112
1116
  origin?: 'prebuilt' | 'owned';
1113
1117
  /** Ownership class used for permissions and badges. */
@@ -1161,6 +1165,8 @@ interface PlayListItem {
1161
1165
  name: string;
1162
1166
  displayName?: string;
1163
1167
  description?: string | null;
1168
+ pinned?: boolean;
1169
+ toolCategories?: string[];
1164
1170
  origin?: 'prebuilt' | 'owned';
1165
1171
  ownerType?: 'deepline' | 'org';
1166
1172
  ownerSlug?: string;
@@ -1240,6 +1246,8 @@ interface PlayDescription {
1240
1246
  reference?: string;
1241
1247
  displayName?: string;
1242
1248
  description?: string | null;
1249
+ pinned?: boolean;
1250
+ toolCategories?: string[];
1243
1251
  origin?: 'prebuilt' | 'owned';
1244
1252
  ownerType?: 'deepline' | 'org';
1245
1253
  canEdit?: boolean;
@@ -1296,6 +1304,19 @@ interface PlayDetail {
1296
1304
  customerDbUrl: string;
1297
1305
  /** Change cursor for incremental sync. */
1298
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
+ };
1299
1320
  }
1300
1321
  interface ClearPlayHistoryRequest {
1301
1322
  /** Optional explicit ctx.dataset keys to clear. Omit to clear all discovered sheets for the play. */
@@ -3278,7 +3299,15 @@ declare class DeeplineClient {
3278
3299
  origin?: 'prebuilt' | 'owned';
3279
3300
  grep?: string;
3280
3301
  grepMode?: 'all' | 'any' | 'phrase';
3302
+ categories?: string | string[];
3303
+ includeToolCategories?: boolean;
3304
+ includeArchived?: boolean;
3281
3305
  }): Promise<PlayListItem[]>;
3306
+ /** Set whether an org-owned Play sorts before unpinned Plays. */
3307
+ setPlayPinned(playName: string, pinned: boolean): Promise<{
3308
+ name: string;
3309
+ pinned: boolean;
3310
+ }>;
3282
3311
  /** Read product-notification destinations, subscriptions, event catalog, and DLQ health. */
3283
3312
  getNotificationSettings(): Promise<ProductNotificationSettings>;
3284
3313
  /** Start the Slack OAuth flow required by product notifications. */
@@ -3389,7 +3418,9 @@ declare class DeeplineClient {
3389
3418
  * console.log(`Total runs: ${detail.play.runCount}`);
3390
3419
  * ```
3391
3420
  */
3392
- getPlay(name: string): Promise<PlayDetail>;
3421
+ getPlay(name: string, options?: {
3422
+ source?: 'working' | 'live' | `version:${number}`;
3423
+ }): Promise<PlayDetail>;
3393
3424
  /**
3394
3425
  * Get a normalized play description suitable for agents and CLIs.
3395
3426
  *
package/dist/index.d.ts CHANGED
@@ -1108,6 +1108,10 @@ interface PlayDefinitionDetail {
1108
1108
  name: string;
1109
1109
  /** Human-friendly display name for UI surfaces. */
1110
1110
  displayName?: string;
1111
+ /** Whether this Play sorts before unpinned Plays. */
1112
+ pinned?: boolean;
1113
+ /** Canonical categories declared by tools used in this Play. */
1114
+ toolCategories?: string[];
1111
1115
  /** Whether this entry comes from the Deepline prebuilt registry or the org-owned catalog. */
1112
1116
  origin?: 'prebuilt' | 'owned';
1113
1117
  /** Ownership class used for permissions and badges. */
@@ -1161,6 +1165,8 @@ interface PlayListItem {
1161
1165
  name: string;
1162
1166
  displayName?: string;
1163
1167
  description?: string | null;
1168
+ pinned?: boolean;
1169
+ toolCategories?: string[];
1164
1170
  origin?: 'prebuilt' | 'owned';
1165
1171
  ownerType?: 'deepline' | 'org';
1166
1172
  ownerSlug?: string;
@@ -1240,6 +1246,8 @@ interface PlayDescription {
1240
1246
  reference?: string;
1241
1247
  displayName?: string;
1242
1248
  description?: string | null;
1249
+ pinned?: boolean;
1250
+ toolCategories?: string[];
1243
1251
  origin?: 'prebuilt' | 'owned';
1244
1252
  ownerType?: 'deepline' | 'org';
1245
1253
  canEdit?: boolean;
@@ -1296,6 +1304,19 @@ interface PlayDetail {
1296
1304
  customerDbUrl: string;
1297
1305
  /** Change cursor for incremental sync. */
1298
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
+ };
1299
1320
  }
1300
1321
  interface ClearPlayHistoryRequest {
1301
1322
  /** Optional explicit ctx.dataset keys to clear. Omit to clear all discovered sheets for the play. */
@@ -3278,7 +3299,15 @@ declare class DeeplineClient {
3278
3299
  origin?: 'prebuilt' | 'owned';
3279
3300
  grep?: string;
3280
3301
  grepMode?: 'all' | 'any' | 'phrase';
3302
+ categories?: string | string[];
3303
+ includeToolCategories?: boolean;
3304
+ includeArchived?: boolean;
3281
3305
  }): Promise<PlayListItem[]>;
3306
+ /** Set whether an org-owned Play sorts before unpinned Plays. */
3307
+ setPlayPinned(playName: string, pinned: boolean): Promise<{
3308
+ name: string;
3309
+ pinned: boolean;
3310
+ }>;
3282
3311
  /** Read product-notification destinations, subscriptions, event catalog, and DLQ health. */
3283
3312
  getNotificationSettings(): Promise<ProductNotificationSettings>;
3284
3313
  /** Start the Slack OAuth flow required by product notifications. */
@@ -3389,7 +3418,9 @@ declare class DeeplineClient {
3389
3418
  * console.log(`Total runs: ${detail.play.runCount}`);
3390
3419
  * ```
3391
3420
  */
3392
- getPlay(name: string): Promise<PlayDetail>;
3421
+ getPlay(name: string, options?: {
3422
+ source?: 'working' | 'live' | `version:${number}`;
3423
+ }): Promise<PlayDetail>;
3393
3424
  /**
3394
3425
  * Get a normalized play description suitable for agents and CLIs.
3395
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.70",
783
+ version: "0.2.72",
784
784
  contracts: {
785
785
  api: {
786
786
  name: "sdk-http-api",
@@ -3719,16 +3719,9 @@ function isPrebuiltPlayDescription(play) {
3719
3719
  return play.origin === "prebuilt" || play.ownerType === "deepline";
3720
3720
  }
3721
3721
  function preferPrebuiltPlayDescriptions(plays) {
3722
- const prebuilt = [];
3723
- const owned = [];
3724
- for (const play of plays) {
3725
- if (isPrebuiltPlayDescription(play)) {
3726
- prebuilt.push(play);
3727
- } else {
3728
- owned.push(play);
3729
- }
3730
- }
3731
- return [...prebuilt, ...owned];
3722
+ return plays.map((play, index) => ({ play, index })).sort(
3723
+ (left, right) => Number(right.play.pinned) - Number(left.play.pinned) || Number(isPrebuiltPlayDescription(right.play)) - Number(isPrebuiltPlayDescription(left.play)) || left.index - right.index
3724
+ ).map(({ play }) => play);
3732
3725
  }
3733
3726
  function isPlayRunPackage(value) {
3734
3727
  return Boolean(
@@ -4075,6 +4068,8 @@ var DeeplineClient = class {
4075
4068
  ...play.reference ? { reference: play.reference } : {},
4076
4069
  ...play.displayName ? { displayName: play.displayName } : {},
4077
4070
  ...description ? { description } : {},
4071
+ pinned: Boolean(play.pinned),
4072
+ toolCategories: play.toolCategories ?? [],
4078
4073
  origin: play.origin,
4079
4074
  ownerType: play.ownerType,
4080
4075
  canEdit: play.canEdit,
@@ -5573,6 +5568,16 @@ var DeeplineClient = class {
5573
5568
  async listPlays(options) {
5574
5569
  const params = new URLSearchParams();
5575
5570
  if (options?.origin) params.set("origin", options.origin);
5571
+ if (options?.categories) {
5572
+ params.set(
5573
+ "categories",
5574
+ Array.isArray(options.categories) ? options.categories.join(",") : options.categories
5575
+ );
5576
+ }
5577
+ if (options?.categories || options?.includeToolCategories) {
5578
+ params.set("include_tool_categories", "1");
5579
+ }
5580
+ if (options?.includeArchived) params.set("include_archived", "1");
5576
5581
  if (options?.grep?.trim()) {
5577
5582
  params.set("grep", options.grep.trim());
5578
5583
  params.set("grep_mode", options.grepMode ?? "all");
@@ -5584,6 +5589,12 @@ var DeeplineClient = class {
5584
5589
  );
5585
5590
  return response.plays ?? [];
5586
5591
  }
5592
+ /** Set whether an org-owned Play sorts before unpinned Plays. */
5593
+ async setPlayPinned(playName, pinned) {
5594
+ return this.http.post(`/api/v2/plays/${encodeURIComponent(playName)}/pin`, {
5595
+ pinned
5596
+ });
5597
+ }
5587
5598
  /** Read product-notification destinations, subscriptions, event catalog, and DLQ health. */
5588
5599
  async getNotificationSettings() {
5589
5600
  return this.http.get("/api/v2/settings/notifications");
@@ -5717,9 +5728,10 @@ var DeeplineClient = class {
5717
5728
  * console.log(`Total runs: ${detail.play.runCount}`);
5718
5729
  * ```
5719
5730
  */
5720
- async getPlay(name) {
5731
+ async getPlay(name, options) {
5721
5732
  const encodedName = encodeURIComponent(name);
5722
- 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}`);
5723
5735
  }
5724
5736
  /**
5725
5737
  * Get a normalized play description suitable for agents and CLIs.
@@ -7092,16 +7104,41 @@ function listNameFromDeclaredPath(path) {
7092
7104
  }
7093
7105
 
7094
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;
7095
7109
  var TARGET_FALLBACK_KEYS = {
7096
- email: [/^email$/i, /^address$/i, /email/i],
7097
- phone: [/^phone$/i, /mobile/i, /phone/i, /telephone/i],
7098
- linkedin: [/^linkedin_url$/i, /^linkedin$/i, /linkedin/i],
7099
- company_linkedin_url: [/company.*linkedin/i, /linkedin.*company/i],
7100
- company_domain: [/^company_domain$/i, /company.*domain/i],
7101
- company_name: [/^company_name$/i, /company.*name/i],
7102
- domain: [/^domain$/i, /company_domain/i, /domain/i],
7103
- status: [/^email_status$/i, /^status$/i],
7104
- 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] }
7105
7142
  };
7106
7143
  function isRecord8(value) {
7107
7144
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -7323,11 +7360,12 @@ function findFirstTargetByKey(result, target, depth = 0, path = []) {
7323
7360
  return null;
7324
7361
  }
7325
7362
  if (!isRecord8(result)) return null;
7326
- const patterns = TARGET_FALLBACK_KEYS[target] ?? [
7327
- new RegExp(`^${target}$`, "i")
7328
- ];
7363
+ const rule = TARGET_FALLBACK_KEYS[target] ?? {
7364
+ match: [new RegExp(`^${target}$`, "i")]
7365
+ };
7329
7366
  for (const [key, value] of Object.entries(result)) {
7330
- 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)) {
7331
7369
  return { value, path: pathToString([...path, key]) };
7332
7370
  }
7333
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.70",
706
+ version: "0.2.72",
707
707
  contracts: {
708
708
  api: {
709
709
  name: "sdk-http-api",
@@ -3642,16 +3642,9 @@ function isPrebuiltPlayDescription(play) {
3642
3642
  return play.origin === "prebuilt" || play.ownerType === "deepline";
3643
3643
  }
3644
3644
  function preferPrebuiltPlayDescriptions(plays) {
3645
- const prebuilt = [];
3646
- const owned = [];
3647
- for (const play of plays) {
3648
- if (isPrebuiltPlayDescription(play)) {
3649
- prebuilt.push(play);
3650
- } else {
3651
- owned.push(play);
3652
- }
3653
- }
3654
- return [...prebuilt, ...owned];
3645
+ return plays.map((play, index) => ({ play, index })).sort(
3646
+ (left, right) => Number(right.play.pinned) - Number(left.play.pinned) || Number(isPrebuiltPlayDescription(right.play)) - Number(isPrebuiltPlayDescription(left.play)) || left.index - right.index
3647
+ ).map(({ play }) => play);
3655
3648
  }
3656
3649
  function isPlayRunPackage(value) {
3657
3650
  return Boolean(
@@ -3998,6 +3991,8 @@ var DeeplineClient = class {
3998
3991
  ...play.reference ? { reference: play.reference } : {},
3999
3992
  ...play.displayName ? { displayName: play.displayName } : {},
4000
3993
  ...description ? { description } : {},
3994
+ pinned: Boolean(play.pinned),
3995
+ toolCategories: play.toolCategories ?? [],
4001
3996
  origin: play.origin,
4002
3997
  ownerType: play.ownerType,
4003
3998
  canEdit: play.canEdit,
@@ -5496,6 +5491,16 @@ var DeeplineClient = class {
5496
5491
  async listPlays(options) {
5497
5492
  const params = new URLSearchParams();
5498
5493
  if (options?.origin) params.set("origin", options.origin);
5494
+ if (options?.categories) {
5495
+ params.set(
5496
+ "categories",
5497
+ Array.isArray(options.categories) ? options.categories.join(",") : options.categories
5498
+ );
5499
+ }
5500
+ if (options?.categories || options?.includeToolCategories) {
5501
+ params.set("include_tool_categories", "1");
5502
+ }
5503
+ if (options?.includeArchived) params.set("include_archived", "1");
5499
5504
  if (options?.grep?.trim()) {
5500
5505
  params.set("grep", options.grep.trim());
5501
5506
  params.set("grep_mode", options.grepMode ?? "all");
@@ -5507,6 +5512,12 @@ var DeeplineClient = class {
5507
5512
  );
5508
5513
  return response.plays ?? [];
5509
5514
  }
5515
+ /** Set whether an org-owned Play sorts before unpinned Plays. */
5516
+ async setPlayPinned(playName, pinned) {
5517
+ return this.http.post(`/api/v2/plays/${encodeURIComponent(playName)}/pin`, {
5518
+ pinned
5519
+ });
5520
+ }
5510
5521
  /** Read product-notification destinations, subscriptions, event catalog, and DLQ health. */
5511
5522
  async getNotificationSettings() {
5512
5523
  return this.http.get("/api/v2/settings/notifications");
@@ -5640,9 +5651,10 @@ var DeeplineClient = class {
5640
5651
  * console.log(`Total runs: ${detail.play.runCount}`);
5641
5652
  * ```
5642
5653
  */
5643
- async getPlay(name) {
5654
+ async getPlay(name, options) {
5644
5655
  const encodedName = encodeURIComponent(name);
5645
- 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}`);
5646
5658
  }
5647
5659
  /**
5648
5660
  * Get a normalized play description suitable for agents and CLIs.
@@ -7015,16 +7027,41 @@ function listNameFromDeclaredPath(path) {
7015
7027
  }
7016
7028
 
7017
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;
7018
7032
  var TARGET_FALLBACK_KEYS = {
7019
- email: [/^email$/i, /^address$/i, /email/i],
7020
- phone: [/^phone$/i, /mobile/i, /phone/i, /telephone/i],
7021
- linkedin: [/^linkedin_url$/i, /^linkedin$/i, /linkedin/i],
7022
- company_linkedin_url: [/company.*linkedin/i, /linkedin.*company/i],
7023
- company_domain: [/^company_domain$/i, /company.*domain/i],
7024
- company_name: [/^company_name$/i, /company.*name/i],
7025
- domain: [/^domain$/i, /company_domain/i, /domain/i],
7026
- status: [/^email_status$/i, /^status$/i],
7027
- 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] }
7028
7065
  };
7029
7066
  function isRecord8(value) {
7030
7067
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -7246,11 +7283,12 @@ function findFirstTargetByKey(result, target, depth = 0, path = []) {
7246
7283
  return null;
7247
7284
  }
7248
7285
  if (!isRecord8(result)) return null;
7249
- const patterns = TARGET_FALLBACK_KEYS[target] ?? [
7250
- new RegExp(`^${target}$`, "i")
7251
- ];
7286
+ const rule = TARGET_FALLBACK_KEYS[target] ?? {
7287
+ match: [new RegExp(`^${target}$`, "i")]
7288
+ };
7252
7289
  for (const [key, value] of Object.entries(result)) {
7253
- 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)) {
7254
7292
  return { value, path: pathToString([...path, key]) };
7255
7293
  }
7256
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.70",
3
+ "version": "0.2.72",
4
4
  "description": "GTM data CLI and TypeScript SDK for coding agents",
5
5
  "license": "MIT",
6
6
  "homepage": "https://code.deepline.com",