deepline 0.1.211 → 0.1.212
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/bundling-sources/apps/play-runner-workers/src/entry.ts +150 -11
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/customer-console.ts +23 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +1 -1
- package/dist/bundling-sources/sdk/src/client.ts +118 -3
- package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/sdk/src/types.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +253 -30
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +22 -20
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/dataset-id.ts +10 -4
- package/dist/bundling-sources/shared_libs/play-runtime/db-session.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +3 -5
- package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +14 -2
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +4 -2
- package/dist/bundling-sources/shared_libs/play-runtime/receipt-sql.ts +21 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +128 -6
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +37 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +19 -10
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +63 -7
- package/dist/bundling-sources/shared_libs/play-runtime/secret-capability.ts +18 -4
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +29 -9
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-state-machine.ts +22 -1
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +79 -1
- package/dist/cli/index.js +637 -229
- package/dist/cli/index.mjs +637 -229
- package/dist/index.d.mts +76 -6
- package/dist/index.d.ts +76 -6
- package/dist/index.js +225 -43
- package/dist/index.mjs +225 -43
- package/dist/plays/bundle-play-file.mjs +65 -4
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ import { buildPlayContractCompatibility } from '../contracts';
|
|
|
31
31
|
import { validatePlaySourceFilesHaveNoInlineSecrets } from '../secret-guardrails';
|
|
32
32
|
import { MAX_ESM_WORKERS_BUNDLE_BYTES, MAX_PLAY_BUNDLE_BYTES } from './limits';
|
|
33
33
|
|
|
34
|
-
const PLAY_BUNDLE_CACHE_VERSION =
|
|
34
|
+
const PLAY_BUNDLE_CACHE_VERSION = 25;
|
|
35
35
|
const PLAY_ARTIFACT_CACHE_DIR = join(
|
|
36
36
|
tmpdir(),
|
|
37
37
|
`deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION}`,
|
|
@@ -1223,6 +1223,72 @@ function workersPlayEntryAliasPlugin(playFilePath: string): Plugin {
|
|
|
1223
1223
|
};
|
|
1224
1224
|
}
|
|
1225
1225
|
|
|
1226
|
+
const CUSTOMER_CONSOLE_CAPTURE_GLOBAL = '__deeplineCaptureCustomerConsole';
|
|
1227
|
+
|
|
1228
|
+
function sourceLoaderForPath(path: string): 'ts' | 'tsx' | 'js' | 'jsx' {
|
|
1229
|
+
const extension = extname(path).toLowerCase();
|
|
1230
|
+
if (extension === '.tsx') return 'tsx';
|
|
1231
|
+
if (extension === '.jsx') return 'jsx';
|
|
1232
|
+
if (extension === '.js' || extension === '.mjs' || extension === '.cjs') {
|
|
1233
|
+
return 'js';
|
|
1234
|
+
}
|
|
1235
|
+
return 'ts';
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
/**
|
|
1239
|
+
* Give the customer's entry module a lexical console without replacing the
|
|
1240
|
+
* Worker's process-wide console. Runtime diagnostics therefore keep flowing
|
|
1241
|
+
* to Cloudflare while console.* calls authored in the play join its Run Log
|
|
1242
|
+
* Stream. The lazy global lookup is required because ESM dependencies are
|
|
1243
|
+
* evaluated before the harness installs the request-scoped capture function.
|
|
1244
|
+
*/
|
|
1245
|
+
function workersCustomerConsolePlugin(
|
|
1246
|
+
customerSourceFilePaths: readonly string[],
|
|
1247
|
+
): Plugin {
|
|
1248
|
+
const customerSourceFiles = new Set(
|
|
1249
|
+
customerSourceFilePaths
|
|
1250
|
+
.filter((path) => extname(path).toLowerCase() !== '.json')
|
|
1251
|
+
.map((path) => resolve(path)),
|
|
1252
|
+
);
|
|
1253
|
+
return {
|
|
1254
|
+
name: 'deepline-workers-customer-console',
|
|
1255
|
+
setup(buildContext) {
|
|
1256
|
+
buildContext.onLoad({ filter: /./ }, (args) => {
|
|
1257
|
+
if (!customerSourceFiles.has(resolve(args.path))) return undefined;
|
|
1258
|
+
const source = readFileSync(args.path, 'utf8');
|
|
1259
|
+
const declaresOwnConsole =
|
|
1260
|
+
/(?:^|\n)\s*(?:(?:const|let|var|class|function)\s+console\b|import[^\n]*\bconsole\b)/m.test(
|
|
1261
|
+
source,
|
|
1262
|
+
);
|
|
1263
|
+
if (declaresOwnConsole) {
|
|
1264
|
+
return {
|
|
1265
|
+
contents: source,
|
|
1266
|
+
loader: sourceLoaderForPath(args.path),
|
|
1267
|
+
resolveDir: dirname(args.path),
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
const prelude = `
|
|
1271
|
+
const console = new Proxy(globalThis.console, {
|
|
1272
|
+
get(target, property) {
|
|
1273
|
+
const capture = globalThis.${CUSTOMER_CONSOLE_CAPTURE_GLOBAL};
|
|
1274
|
+
if (typeof capture === 'function') {
|
|
1275
|
+
return (...args) => capture(String(property), args);
|
|
1276
|
+
}
|
|
1277
|
+
const value = Reflect.get(target, property);
|
|
1278
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
1279
|
+
},
|
|
1280
|
+
});
|
|
1281
|
+
`;
|
|
1282
|
+
return {
|
|
1283
|
+
contents: `${prelude}\n${source}`,
|
|
1284
|
+
loader: sourceLoaderForPath(args.path),
|
|
1285
|
+
resolveDir: dirname(args.path),
|
|
1286
|
+
};
|
|
1287
|
+
});
|
|
1288
|
+
},
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1226
1292
|
function workersNamedPlayEntryAliasPlugin(
|
|
1227
1293
|
playFilePath: string,
|
|
1228
1294
|
exportName: string,
|
|
@@ -1989,6 +2055,7 @@ type PlayArtifactTargetAdapter = {
|
|
|
1989
2055
|
includeWorkersHarnessInGraphHash: boolean;
|
|
1990
2056
|
runEsbuild(input: {
|
|
1991
2057
|
entryFile: string;
|
|
2058
|
+
customerSourceFilePaths: string[];
|
|
1992
2059
|
importedPlayDependencies: ImportedPlayDependency[];
|
|
1993
2060
|
adapter: PlayBundlingAdapter;
|
|
1994
2061
|
exportName: string;
|
|
@@ -1997,6 +2064,7 @@ type PlayArtifactTargetAdapter = {
|
|
|
1997
2064
|
|
|
1998
2065
|
async function runEsbuildForCjsNode(
|
|
1999
2066
|
entryFile: string,
|
|
2067
|
+
_customerSourceFilePaths: string[],
|
|
2000
2068
|
importedPlayDependencies: ImportedPlayDependency[],
|
|
2001
2069
|
adapter: PlayBundlingAdapter,
|
|
2002
2070
|
exportName: string,
|
|
@@ -2048,6 +2116,7 @@ async function runEsbuildForCjsNode(
|
|
|
2048
2116
|
|
|
2049
2117
|
async function runEsbuildForEsmWorkers(
|
|
2050
2118
|
playEntryFile: string,
|
|
2119
|
+
customerSourceFilePaths: string[],
|
|
2051
2120
|
importedPlayDependencies: ImportedPlayDependency[],
|
|
2052
2121
|
adapter: PlayBundlingAdapter,
|
|
2053
2122
|
exportName: string,
|
|
@@ -2058,6 +2127,9 @@ async function runEsbuildForEsmWorkers(
|
|
|
2058
2127
|
exportName === 'default'
|
|
2059
2128
|
? workersPlayEntryAliasPlugin(playEntryFile)
|
|
2060
2129
|
: workersNamedPlayEntryAliasPlugin(playEntryFile, exportName);
|
|
2130
|
+
const customerConsolePlugin = workersCustomerConsolePlugin(
|
|
2131
|
+
customerSourceFilePaths,
|
|
2132
|
+
);
|
|
2061
2133
|
const result = await build({
|
|
2062
2134
|
// Entry is the Workers harness; it imports the play via the virtual
|
|
2063
2135
|
// `deepline-play-entry` alias resolved by workersPlayEntryAliasPlugin.
|
|
@@ -2102,6 +2174,7 @@ async function runEsbuildForEsmWorkers(
|
|
|
2102
2174
|
sdkAliasPlugin,
|
|
2103
2175
|
playProxyPlugin,
|
|
2104
2176
|
playEntryAlias,
|
|
2177
|
+
customerConsolePlugin,
|
|
2105
2178
|
workersNodeBuiltinStubPlugin(),
|
|
2106
2179
|
// Strip non-English zod locale data from the bundle. zod's locales
|
|
2107
2180
|
// are re-exported as a static namespace from `zod/v4/core`, so
|
|
@@ -2136,12 +2209,14 @@ const PLAY_ARTIFACT_TARGET_ADAPTERS: Record<
|
|
|
2136
2209
|
includeWorkersHarnessInGraphHash: false,
|
|
2137
2210
|
runEsbuild: ({
|
|
2138
2211
|
entryFile,
|
|
2212
|
+
customerSourceFilePaths,
|
|
2139
2213
|
importedPlayDependencies,
|
|
2140
2214
|
adapter,
|
|
2141
2215
|
exportName,
|
|
2142
2216
|
}) =>
|
|
2143
2217
|
runEsbuildForCjsNode(
|
|
2144
2218
|
entryFile,
|
|
2219
|
+
customerSourceFilePaths,
|
|
2145
2220
|
importedPlayDependencies,
|
|
2146
2221
|
adapter,
|
|
2147
2222
|
exportName,
|
|
@@ -2153,12 +2228,14 @@ const PLAY_ARTIFACT_TARGET_ADAPTERS: Record<
|
|
|
2153
2228
|
includeWorkersHarnessInGraphHash: true,
|
|
2154
2229
|
runEsbuild: ({
|
|
2155
2230
|
entryFile,
|
|
2231
|
+
customerSourceFilePaths,
|
|
2156
2232
|
importedPlayDependencies,
|
|
2157
2233
|
adapter,
|
|
2158
2234
|
exportName,
|
|
2159
2235
|
}) =>
|
|
2160
2236
|
runEsbuildForEsmWorkers(
|
|
2161
2237
|
entryFile,
|
|
2238
|
+
customerSourceFilePaths,
|
|
2162
2239
|
importedPlayDependencies,
|
|
2163
2240
|
adapter,
|
|
2164
2241
|
exportName,
|
|
@@ -2288,6 +2365,7 @@ export async function bundlePlayFile(
|
|
|
2288
2365
|
|
|
2289
2366
|
const buildOutcome = await targetAdapter.runEsbuild({
|
|
2290
2367
|
entryFile: absolutePath,
|
|
2368
|
+
customerSourceFilePaths: analysis.importPolicy.localFiles,
|
|
2291
2369
|
importedPlayDependencies: analysis.importedPlayDependencies,
|
|
2292
2370
|
adapter,
|
|
2293
2371
|
exportName,
|