deepline 0.1.47 → 0.1.48

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/README.md CHANGED
@@ -50,10 +50,10 @@ cd sdk && bun run build # or: npm run sdk:build from root
50
50
 
51
51
  ## Env files
52
52
 
53
- | File | Set by | Contains |
54
- | ------------------------------------ | ------------------- | ----------------------------------------- |
55
- | `~/.local/deepline/<host-slug>/.env` | SDK `auth register` | `DEEPLINE_HOST_URL`, `DEEPLINE_API_KEY` |
56
- | `.env.deepline` | Developer/agent | `DEEPLINE_HOST_URL`, `DEEPLINE_API_KEY` |
53
+ | File | Set by | Contains |
54
+ | ------------------------------------ | ------------------- | --------------------------------------- |
55
+ | `~/.local/deepline/<host-slug>/.env` | SDK `auth register` | `DEEPLINE_HOST_URL`, `DEEPLINE_API_KEY` |
56
+ | `.env.deepline` | Developer/agent | `DEEPLINE_HOST_URL`, `DEEPLINE_API_KEY` |
57
57
 
58
58
  The SDK CLI env contract is only `DEEPLINE_HOST_URL` and `DEEPLINE_API_KEY`.
59
59
  Do not route the SDK CLI through `.env`, `.env.local`, or `.env.worktree`.
@@ -257,27 +257,27 @@ export default definePlay('rate-limit-waterfall', async (ctx) => {
257
257
 
258
258
  const probeFallback = steps<{ lead_id: string; row_number: number }>()
259
259
  .step("primary_probe", (row, ctx) =>
260
- ctx.tool({
260
+ ctx.tools.execute({
261
261
  id: 'rate_limit_probe',
262
262
  tool: 'test_rate_limit',
263
263
  input: {
264
- key: 'redis-shared-scenario',
265
- lead_id: row.lead_id,
266
- row_number: row.row_number,
267
- },
264
+ key: 'redis-shared-scenario',
265
+ lead_id: row.lead_id,
266
+ row_number: row.row_number,
267
+ },
268
268
  description: 'Exercise primary rate-limit behavior.',
269
269
  }))
270
270
  .step("backup_probe", when(
271
271
  (row) => !row.primary_probe,
272
272
  (row, ctx) =>
273
- ctx.tool({
273
+ ctx.tools.execute({
274
274
  id: 'rate_limit_probe_backup',
275
275
  tool: 'test_rate_limit',
276
276
  input: {
277
- key: 'redis-shared-scenario',
278
- lead_id: row.lead_id,
279
- row_number: row.row_number,
280
- },
277
+ key: 'redis-shared-scenario',
278
+ lead_id: row.lead_id,
279
+ row_number: row.row_number,
280
+ },
281
281
  description: 'Exercise fallback rate-limit behavior.',
282
282
  }),
283
283
  ))
package/dist/cli/index.js CHANGED
@@ -216,7 +216,7 @@ function resolveConfig(options) {
216
216
  }
217
217
 
218
218
  // src/version.ts
219
- var SDK_VERSION = "0.1.47";
219
+ var SDK_VERSION = "0.1.48";
220
220
  var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
221
221
 
222
222
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -2795,8 +2795,10 @@ async function handleCheckout(options) {
2795
2795
  }
2796
2796
  async function handleRedeemCode(code, options) {
2797
2797
  const { http } = getAuthedHttpClient();
2798
- const payload = await http.post("/api/v2/billing/checkout/verify", { code });
2799
- const url = String(payload.url || "");
2798
+ const payload = await http.post("/api/v2/billing/checkout", {
2799
+ discountCode: code
2800
+ });
2801
+ const url = String(payload.url || payload.checkout_url || "");
2800
2802
  if (!options.json && !options.noOpen && url) openInBrowser(url);
2801
2803
  printCommandEnvelope({
2802
2804
  ...payload,
@@ -193,7 +193,7 @@ function resolveConfig(options) {
193
193
  }
194
194
 
195
195
  // src/version.ts
196
- var SDK_VERSION = "0.1.47";
196
+ var SDK_VERSION = "0.1.48";
197
197
  var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
198
198
 
199
199
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -2777,8 +2777,10 @@ async function handleCheckout(options) {
2777
2777
  }
2778
2778
  async function handleRedeemCode(code, options) {
2779
2779
  const { http } = getAuthedHttpClient();
2780
- const payload = await http.post("/api/v2/billing/checkout/verify", { code });
2781
- const url = String(payload.url || "");
2780
+ const payload = await http.post("/api/v2/billing/checkout", {
2781
+ discountCode: code
2782
+ });
2783
+ const url = String(payload.url || payload.checkout_url || "");
2782
2784
  if (!options.json && !options.noOpen && url) openInBrowser(url);
2783
2785
  printCommandEnvelope({
2784
2786
  ...payload,
package/dist/index.d.mts CHANGED
@@ -1533,7 +1533,7 @@ declare class DeeplineClient {
1533
1533
  }>;
1534
1534
  }
1535
1535
 
1536
- declare const SDK_VERSION = "0.1.47";
1536
+ declare const SDK_VERSION = "0.1.48";
1537
1537
  declare const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
1538
1538
 
1539
1539
  /**
@@ -1851,6 +1851,7 @@ type ToolExecutionRequest = {
1851
1851
  tool: string;
1852
1852
  input: Record<string, unknown>;
1853
1853
  description?: string;
1854
+ staleAfterSeconds?: number;
1854
1855
  };
1855
1856
  type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number) => Value | Promise<Value>;
1856
1857
  type ConditionalStepResolver<Row, Value, Else = null> = {
@@ -1934,7 +1935,10 @@ type CsvOptions = {
1934
1935
  * const enriched = await ctx
1935
1936
  * .map('companies', [{ domain: 'a.com' }, { domain: 'b.com' }])
1936
1937
  * .step('company', (row, rowCtx) =>
1937
- * rowCtx.tool('company_search', 'test_company_search', { domain: row.domain }, {
1938
+ * rowCtx.tools.execute({
1939
+ * id: 'company_search',
1940
+ * tool: 'test_company_search',
1941
+ * input: { domain: row.domain },
1938
1942
  * description: 'Look up company details by domain.',
1939
1943
  * }))
1940
1944
  * .run({ description: 'Look up company details.' });
@@ -1995,30 +1999,30 @@ interface DeeplinePlayRuntimeContext {
1995
1999
  *
1996
2000
  * @example Single tool per row
1997
2001
  * ```typescript
1998
- * const results = await ctx
1999
- * .map('companies', leads)
2000
- * .step('company', (row, ctx) =>
2001
- * ctx.tools.execute({
2002
- * id: 'company_search',
2003
- * tool: 'test_company_search',
2004
- * input: { domain: row.domain },
2005
- * description: 'Look up company details by domain.',
2006
- * }))
2002
+ * const results = await ctx
2003
+ * .map('companies', leads)
2004
+ * .step('company', (row, ctx) =>
2005
+ * ctx.tools.execute({
2006
+ * id: 'company_search',
2007
+ * tool: 'test_company_search',
2008
+ * input: { domain: row.domain },
2009
+ * description: 'Look up company details by domain.',
2010
+ * }))
2007
2011
  * .run({ description: 'Look up companies.' });
2008
2012
  * // [{ domain: 'stripe.com', company: { name: 'Stripe', ... } }, ...]
2009
2013
  * ```
2010
2014
  *
2011
2015
  * @example Multiple columns with pre/post logic
2012
2016
  * ```typescript
2013
- * const results = await ctx
2014
- * .map('leads', leads)
2015
- * .step('company', (row, ctx) =>
2016
- * ctx.tools.execute({
2017
- * id: 'company_search',
2018
- * tool: 'test_company_search',
2019
- * input: { domain: row.domain },
2020
- * description: 'Look up company details by domain.',
2021
- * }))
2017
+ * const results = await ctx
2018
+ * .map('leads', leads)
2019
+ * .step('company', (row, ctx) =>
2020
+ * ctx.tools.execute({
2021
+ * id: 'company_search',
2022
+ * tool: 'test_company_search',
2023
+ * input: { domain: row.domain },
2024
+ * description: 'Look up company details by domain.',
2025
+ * }))
2022
2026
  * .step('score', (row) =>
2023
2027
  * row.company?.employeeCount > 100 ? 'enterprise' : 'smb')
2024
2028
  * .run({ description: 'Enrich leads.' });
@@ -2035,22 +2039,19 @@ interface DeeplinePlayRuntimeContext {
2035
2039
  * @param request.input - Tool-specific input parameters
2036
2040
  * @returns The tool's output
2037
2041
  */
2038
- execute<TOutput = LoosePlayObject>(request: ToolExecutionRequest): Promise<ToolExecuteResult<TOutput>>;
2042
+ execute<TOutput = LoosePlayObject>(request: ToolExecutionRequest & {
2043
+ staleAfterSeconds?: number;
2044
+ }): Promise<ToolExecuteResult<TOutput>>;
2039
2045
  };
2040
- /**
2041
- * Execute a single tool by stable step key and tool ID.
2042
- *
2043
- * Shorthand for `ctx.tools.execute(...)`; this is the preferred spelling in
2044
- * row-level step programs.
2045
- */
2046
- tool<TOutput = LoosePlayObject>(key: string, toolId: string, input: Record<string, unknown>, options?: {
2047
- description?: string;
2048
- }): Promise<ToolExecuteResult<TOutput>>;
2049
2046
  runSteps<TInput extends Record<string, unknown>, TOutput>(program: StepProgram<TInput, any, TOutput>, input: TInput, options?: {
2050
2047
  description?: string;
2051
2048
  }): Promise<TOutput>;
2052
- step<T>(id: string, run: () => T | Promise<T>): Promise<T>;
2053
- fetch(key: string, url: string | URL, init?: RequestInit): Promise<{
2049
+ step<T>(id: string, run: () => T | Promise<T>, options?: {
2050
+ staleAfterSeconds?: number;
2051
+ }): Promise<T>;
2052
+ fetch(key: string, url: string | URL, init?: RequestInit, options?: {
2053
+ staleAfterSeconds?: number;
2054
+ }): Promise<{
2054
2055
  ok: boolean;
2055
2056
  status: number;
2056
2057
  statusText: string;
@@ -2061,6 +2062,7 @@ interface DeeplinePlayRuntimeContext {
2061
2062
  }>;
2062
2063
  runPlay(key: string, playRef: string | PlayReferenceLike, input: Record<string, unknown>, options: {
2063
2064
  description?: string;
2065
+ staleAfterSeconds?: number;
2064
2066
  }): Promise<Record<string, unknown>>;
2065
2067
  /**
2066
2068
  * Emit a log line visible in `play tail` and the play's progress logs.
package/dist/index.d.ts CHANGED
@@ -1533,7 +1533,7 @@ declare class DeeplineClient {
1533
1533
  }>;
1534
1534
  }
1535
1535
 
1536
- declare const SDK_VERSION = "0.1.47";
1536
+ declare const SDK_VERSION = "0.1.48";
1537
1537
  declare const SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
1538
1538
 
1539
1539
  /**
@@ -1851,6 +1851,7 @@ type ToolExecutionRequest = {
1851
1851
  tool: string;
1852
1852
  input: Record<string, unknown>;
1853
1853
  description?: string;
1854
+ staleAfterSeconds?: number;
1854
1855
  };
1855
1856
  type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number) => Value | Promise<Value>;
1856
1857
  type ConditionalStepResolver<Row, Value, Else = null> = {
@@ -1934,7 +1935,10 @@ type CsvOptions = {
1934
1935
  * const enriched = await ctx
1935
1936
  * .map('companies', [{ domain: 'a.com' }, { domain: 'b.com' }])
1936
1937
  * .step('company', (row, rowCtx) =>
1937
- * rowCtx.tool('company_search', 'test_company_search', { domain: row.domain }, {
1938
+ * rowCtx.tools.execute({
1939
+ * id: 'company_search',
1940
+ * tool: 'test_company_search',
1941
+ * input: { domain: row.domain },
1938
1942
  * description: 'Look up company details by domain.',
1939
1943
  * }))
1940
1944
  * .run({ description: 'Look up company details.' });
@@ -1995,30 +1999,30 @@ interface DeeplinePlayRuntimeContext {
1995
1999
  *
1996
2000
  * @example Single tool per row
1997
2001
  * ```typescript
1998
- * const results = await ctx
1999
- * .map('companies', leads)
2000
- * .step('company', (row, ctx) =>
2001
- * ctx.tools.execute({
2002
- * id: 'company_search',
2003
- * tool: 'test_company_search',
2004
- * input: { domain: row.domain },
2005
- * description: 'Look up company details by domain.',
2006
- * }))
2002
+ * const results = await ctx
2003
+ * .map('companies', leads)
2004
+ * .step('company', (row, ctx) =>
2005
+ * ctx.tools.execute({
2006
+ * id: 'company_search',
2007
+ * tool: 'test_company_search',
2008
+ * input: { domain: row.domain },
2009
+ * description: 'Look up company details by domain.',
2010
+ * }))
2007
2011
  * .run({ description: 'Look up companies.' });
2008
2012
  * // [{ domain: 'stripe.com', company: { name: 'Stripe', ... } }, ...]
2009
2013
  * ```
2010
2014
  *
2011
2015
  * @example Multiple columns with pre/post logic
2012
2016
  * ```typescript
2013
- * const results = await ctx
2014
- * .map('leads', leads)
2015
- * .step('company', (row, ctx) =>
2016
- * ctx.tools.execute({
2017
- * id: 'company_search',
2018
- * tool: 'test_company_search',
2019
- * input: { domain: row.domain },
2020
- * description: 'Look up company details by domain.',
2021
- * }))
2017
+ * const results = await ctx
2018
+ * .map('leads', leads)
2019
+ * .step('company', (row, ctx) =>
2020
+ * ctx.tools.execute({
2021
+ * id: 'company_search',
2022
+ * tool: 'test_company_search',
2023
+ * input: { domain: row.domain },
2024
+ * description: 'Look up company details by domain.',
2025
+ * }))
2022
2026
  * .step('score', (row) =>
2023
2027
  * row.company?.employeeCount > 100 ? 'enterprise' : 'smb')
2024
2028
  * .run({ description: 'Enrich leads.' });
@@ -2035,22 +2039,19 @@ interface DeeplinePlayRuntimeContext {
2035
2039
  * @param request.input - Tool-specific input parameters
2036
2040
  * @returns The tool's output
2037
2041
  */
2038
- execute<TOutput = LoosePlayObject>(request: ToolExecutionRequest): Promise<ToolExecuteResult<TOutput>>;
2042
+ execute<TOutput = LoosePlayObject>(request: ToolExecutionRequest & {
2043
+ staleAfterSeconds?: number;
2044
+ }): Promise<ToolExecuteResult<TOutput>>;
2039
2045
  };
2040
- /**
2041
- * Execute a single tool by stable step key and tool ID.
2042
- *
2043
- * Shorthand for `ctx.tools.execute(...)`; this is the preferred spelling in
2044
- * row-level step programs.
2045
- */
2046
- tool<TOutput = LoosePlayObject>(key: string, toolId: string, input: Record<string, unknown>, options?: {
2047
- description?: string;
2048
- }): Promise<ToolExecuteResult<TOutput>>;
2049
2046
  runSteps<TInput extends Record<string, unknown>, TOutput>(program: StepProgram<TInput, any, TOutput>, input: TInput, options?: {
2050
2047
  description?: string;
2051
2048
  }): Promise<TOutput>;
2052
- step<T>(id: string, run: () => T | Promise<T>): Promise<T>;
2053
- fetch(key: string, url: string | URL, init?: RequestInit): Promise<{
2049
+ step<T>(id: string, run: () => T | Promise<T>, options?: {
2050
+ staleAfterSeconds?: number;
2051
+ }): Promise<T>;
2052
+ fetch(key: string, url: string | URL, init?: RequestInit, options?: {
2053
+ staleAfterSeconds?: number;
2054
+ }): Promise<{
2054
2055
  ok: boolean;
2055
2056
  status: number;
2056
2057
  statusText: string;
@@ -2061,6 +2062,7 @@ interface DeeplinePlayRuntimeContext {
2061
2062
  }>;
2062
2063
  runPlay(key: string, playRef: string | PlayReferenceLike, input: Record<string, unknown>, options: {
2063
2064
  description?: string;
2065
+ staleAfterSeconds?: number;
2064
2066
  }): Promise<Record<string, unknown>>;
2065
2067
  /**
2066
2068
  * Emit a log line visible in `play tail` and the play's progress logs.
package/dist/index.js CHANGED
@@ -215,7 +215,7 @@ function resolveConfig(options) {
215
215
  }
216
216
 
217
217
  // src/version.ts
218
- var SDK_VERSION = "0.1.47";
218
+ var SDK_VERSION = "0.1.48";
219
219
  var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
220
220
 
221
221
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -2195,11 +2195,9 @@ var DeeplineContext = class {
2195
2195
  get: (toolId) => this.client.getTool(toolId),
2196
2196
  /** Execute a tool and return the standard execution envelope. */
2197
2197
  execute: async (toolId, input) => {
2198
- const response = await this.client.executeTool(
2199
- toolId,
2200
- input,
2201
- { includeToolMetadata: true }
2202
- );
2198
+ const response = await this.client.executeTool(toolId, input, {
2199
+ includeToolMetadata: true
2200
+ });
2203
2201
  return toolExecutionEnvelopeToResult(toolId, response);
2204
2202
  }
2205
2203
  };
@@ -2348,9 +2346,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response) {
2348
2346
  metadata: {
2349
2347
  toolId: typeof toolMetadata.toolId === "string" ? toolMetadata.toolId : fallbackToolId,
2350
2348
  extractors: extractorDescriptorRecord(toolMetadata.extractors),
2351
- targetGetters: stringArrayRecord(
2352
- toolMetadata.targetGetters
2353
- ),
2349
+ targetGetters: stringArrayRecord(toolMetadata.targetGetters),
2354
2350
  listExtractorPaths: stringArray(toolMetadata.listExtractorPaths),
2355
2351
  listIdentityGetters: stringArrayRecord(toolMetadata.listIdentityGetters)
2356
2352
  },
package/dist/index.mjs CHANGED
@@ -169,7 +169,7 @@ function resolveConfig(options) {
169
169
  }
170
170
 
171
171
  // src/version.ts
172
- var SDK_VERSION = "0.1.47";
172
+ var SDK_VERSION = "0.1.48";
173
173
  var SDK_API_CONTRACT = "2026-05-stripe-promo-checkout";
174
174
 
175
175
  // ../shared_libs/play-runtime/coordinator-headers.ts
@@ -2149,11 +2149,9 @@ var DeeplineContext = class {
2149
2149
  get: (toolId) => this.client.getTool(toolId),
2150
2150
  /** Execute a tool and return the standard execution envelope. */
2151
2151
  execute: async (toolId, input) => {
2152
- const response = await this.client.executeTool(
2153
- toolId,
2154
- input,
2155
- { includeToolMetadata: true }
2156
- );
2152
+ const response = await this.client.executeTool(toolId, input, {
2153
+ includeToolMetadata: true
2154
+ });
2157
2155
  return toolExecutionEnvelopeToResult(toolId, response);
2158
2156
  }
2159
2157
  };
@@ -2302,9 +2300,7 @@ function toolExecutionEnvelopeToResult(fallbackToolId, response) {
2302
2300
  metadata: {
2303
2301
  toolId: typeof toolMetadata.toolId === "string" ? toolMetadata.toolId : fallbackToolId,
2304
2302
  extractors: extractorDescriptorRecord(toolMetadata.extractors),
2305
- targetGetters: stringArrayRecord(
2306
- toolMetadata.targetGetters
2307
- ),
2303
+ targetGetters: stringArrayRecord(toolMetadata.targetGetters),
2308
2304
  listExtractorPaths: stringArray(toolMetadata.listExtractorPaths),
2309
2305
  listIdentityGetters: stringArrayRecord(toolMetadata.listIdentityGetters)
2310
2306
  },