deepline 0.1.63 → 0.1.64
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/cli/index.js +702 -339
- package/dist/cli/index.mjs +727 -348
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +56 -40
- package/dist/index.mjs +56 -40
- package/dist/repo/apps/play-runner-workers/src/coordinator-entry.ts +9 -10
- package/dist/repo/apps/play-runner-workers/src/runtime/dataset-handles.ts +36 -27
- package/dist/repo/apps/play-runner-workers/src/runtime/tool-http-errors.ts +5 -2
- package/dist/repo/sdk/src/client.ts +71 -63
- package/dist/repo/sdk/src/errors.ts +5 -1
- package/dist/repo/sdk/src/http.ts +25 -17
- package/dist/repo/sdk/src/plays/local-file-discovery.ts +93 -24
- package/dist/repo/sdk/src/release.ts +2 -2
- package/dist/repo/sdk/src/tool-output.ts +40 -20
- package/dist/repo/shared_libs/play-runtime/batch-runtime.ts +10 -3
- package/dist/repo/shared_libs/play-runtime/batching-types.ts +15 -4
- package/dist/repo/shared_libs/play-runtime/coordinator-headers.ts +2 -1
- package/dist/repo/shared_libs/play-runtime/dedup-backend.ts +0 -0
- package/dist/repo/shared_libs/play-runtime/default-batch-strategies.ts +3 -4
- package/dist/repo/shared_libs/play-runtime/run-failure.ts +1 -3
- package/dist/repo/shared_libs/play-runtime/step-lifecycle-tracker.ts +4 -1
- package/dist/repo/shared_libs/play-runtime/tool-batch-executor.ts +4 -1
- package/dist/repo/shared_libs/plays/dataset.ts +10 -11
- package/package.json +1 -1
|
@@ -132,7 +132,9 @@ export function compileRequestsWithStrategy<TRequest>(input: {
|
|
|
132
132
|
export async function executeWaterfallProviders<TRequest, TResult>(input: {
|
|
133
133
|
providers: string[];
|
|
134
134
|
getPendingRequests: () => TRequest[];
|
|
135
|
-
getCachedResults: (
|
|
135
|
+
getCachedResults: (
|
|
136
|
+
provider: string,
|
|
137
|
+
) => Array<ChunkExecutionResult<TRequest, TResult>> | null;
|
|
136
138
|
storeCachedResults: (
|
|
137
139
|
provider: string,
|
|
138
140
|
results: Array<ChunkExecutionResult<TRequest, TResult>>,
|
|
@@ -177,6 +179,11 @@ export async function executeWaterfallProviders<TRequest, TResult>(input: {
|
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
181
|
|
|
180
|
-
export function resolveWaterfallToolId(
|
|
181
|
-
|
|
182
|
+
export function resolveWaterfallToolId(
|
|
183
|
+
provider: string,
|
|
184
|
+
toolName: string,
|
|
185
|
+
): string {
|
|
186
|
+
return toolName.startsWith(`${provider}_`)
|
|
187
|
+
? toolName
|
|
188
|
+
: `${provider}_${toolName}`;
|
|
182
189
|
}
|
|
@@ -10,7 +10,10 @@ export type BatchCompileItem<TSingle extends object> = {
|
|
|
10
10
|
payload: TSingle;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export type BatchCompileResult<
|
|
13
|
+
export type BatchCompileResult<
|
|
14
|
+
TBatch extends object,
|
|
15
|
+
TSingle extends object,
|
|
16
|
+
> = {
|
|
14
17
|
batchOperation: string;
|
|
15
18
|
batchPayload: TBatch;
|
|
16
19
|
items: Array<BatchCompileItem<TSingle>>;
|
|
@@ -58,7 +61,10 @@ export type AnyBatchOperationStrategy = {
|
|
|
58
61
|
batchOperation: string;
|
|
59
62
|
kind: BatchStrategyKind;
|
|
60
63
|
maxBatchSize: number;
|
|
61
|
-
canBatchWith(
|
|
64
|
+
canBatchWith(
|
|
65
|
+
left: Record<string, unknown>,
|
|
66
|
+
right: Record<string, unknown>,
|
|
67
|
+
): boolean;
|
|
62
68
|
toBucketKey(payload: Record<string, unknown>): string;
|
|
63
69
|
toItemKey(payload: Record<string, unknown>): string;
|
|
64
70
|
compile(payloads: Record<string, unknown>[]): {
|
|
@@ -81,8 +87,13 @@ export type AnyBatchOperationStrategy = {
|
|
|
81
87
|
|
|
82
88
|
export type BatchStrategyMap = Record<string, AnyBatchOperationStrategy>;
|
|
83
89
|
|
|
84
|
-
type StrictBatchOperationStrategy =
|
|
85
|
-
|
|
90
|
+
type StrictBatchOperationStrategy = BatchOperationStrategy<
|
|
91
|
+
Record<string, unknown>,
|
|
92
|
+
Record<string, unknown>,
|
|
93
|
+
object,
|
|
94
|
+
unknown,
|
|
95
|
+
unknown
|
|
96
|
+
>;
|
|
86
97
|
|
|
87
98
|
export function defineBatchStrategyMap<
|
|
88
99
|
TStrategies extends Record<string, StrictBatchOperationStrategy>,
|
|
@@ -31,7 +31,8 @@ function resolveInternalCoordinatorToken(): string | null {
|
|
|
31
31
|
// Read lazily so the helper is safe to import in environments without
|
|
32
32
|
// env access (e.g. workerd build-time bundling).
|
|
33
33
|
const fromEnv =
|
|
34
|
-
(typeof process !== 'undefined' &&
|
|
34
|
+
(typeof process !== 'undefined' &&
|
|
35
|
+
process?.env?.DEEPLINE_INTERNAL_TOKEN?.trim()) ||
|
|
35
36
|
null;
|
|
36
37
|
if (fromEnv) return fromEnv;
|
|
37
38
|
if (!warnedAboutMissingInternalToken) {
|
|
Binary file
|
|
@@ -109,10 +109,9 @@ const testRateLimitBatchStrategy: BatchOperationStrategy<
|
|
|
109
109
|
},
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
export const DEFAULT_PLAY_RUNTIME_BATCH_STRATEGIES =
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
});
|
|
112
|
+
export const DEFAULT_PLAY_RUNTIME_BATCH_STRATEGIES = defineBatchStrategyMap({
|
|
113
|
+
test_rate_limit: testRateLimitBatchStrategy,
|
|
114
|
+
});
|
|
116
115
|
|
|
117
116
|
export function getDefaultPlayRuntimeBatchStrategy(
|
|
118
117
|
operation: string | null | undefined,
|
|
@@ -27,9 +27,7 @@ export function isCloudflareDurableObjectCodeUpdatedError(
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export function normalizePlayRunFailure(
|
|
31
|
-
error: unknown,
|
|
32
|
-
): PlayRunFailureDetails {
|
|
30
|
+
export function normalizePlayRunFailure(error: unknown): PlayRunFailureDetails {
|
|
33
31
|
const cause = toErrorText(error);
|
|
34
32
|
if (isCloudflareDurableObjectCodeUpdatedError(cause)) {
|
|
35
33
|
return {
|
|
@@ -24,7 +24,10 @@ export class PlayStepLifecycleTracker {
|
|
|
24
24
|
|
|
25
25
|
constructor(
|
|
26
26
|
private readonly nodes: readonly PlayStepLifecycleNode[],
|
|
27
|
-
private readonly getProgress: () => Record<
|
|
27
|
+
private readonly getProgress: () => Record<
|
|
28
|
+
string,
|
|
29
|
+
PlayStepLifecycleProgress
|
|
30
|
+
>,
|
|
28
31
|
private readonly emit: (event: PlayStepLifecycleEvent) => void,
|
|
29
32
|
private readonly now: () => number = Date.now,
|
|
30
33
|
) {}
|
|
@@ -55,7 +55,10 @@ export function createToolBatchExecutor(
|
|
|
55
55
|
): ToolBatchExecutor {
|
|
56
56
|
return {
|
|
57
57
|
async executeToolBatch(request) {
|
|
58
|
-
const providerBatchSize = Math.max(
|
|
58
|
+
const providerBatchSize = Math.max(
|
|
59
|
+
1,
|
|
60
|
+
Math.floor(request.providerBatchSize),
|
|
61
|
+
);
|
|
59
62
|
const batches = chunkToolBatchItems(request.items, providerBatchSize);
|
|
60
63
|
const results: ToolBatchItemResult[] = [];
|
|
61
64
|
for (let batchIndex = 0; batchIndex < batches.length; batchIndex += 1) {
|
|
@@ -172,8 +172,8 @@ function inferPreviewColumns<T>(rows: readonly T[]): string[] | undefined {
|
|
|
172
172
|
export function isPlayDataset<T>(value: unknown): value is PlayDataset<T> {
|
|
173
173
|
return Boolean(
|
|
174
174
|
value &&
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
typeof value === 'object' &&
|
|
176
|
+
(value as Record<PropertyKey, unknown>)[PLAY_DATASET_BRAND] === true,
|
|
177
177
|
);
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -182,13 +182,13 @@ export function isSerializedPlayDataset<T>(
|
|
|
182
182
|
): value is SerializedPlayDataset<T> {
|
|
183
183
|
return Boolean(
|
|
184
184
|
value &&
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
185
|
+
typeof value === 'object' &&
|
|
186
|
+
!Array.isArray(value) &&
|
|
187
|
+
(value as Record<string, unknown>).kind === 'dataset' &&
|
|
188
|
+
typeof (value as Record<string, unknown>).datasetKind === 'string' &&
|
|
189
|
+
typeof (value as Record<string, unknown>).datasetId === 'string' &&
|
|
190
|
+
typeof (value as Record<string, unknown>).count === 'number' &&
|
|
191
|
+
Array.isArray((value as Record<string, unknown>).preview),
|
|
192
192
|
);
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -506,8 +506,7 @@ export function createPlayDataset<T>(
|
|
|
506
506
|
tableNamespace: metadata?.tableNamespace ?? null,
|
|
507
507
|
resolvers: {
|
|
508
508
|
count: async () => materializedRows.length,
|
|
509
|
-
peek: async (limit) =>
|
|
510
|
-
materializedRows.slice(0, Math.max(0, limit)),
|
|
509
|
+
peek: async (limit) => materializedRows.slice(0, Math.max(0, limit)),
|
|
511
510
|
materialize: async (limit) =>
|
|
512
511
|
limit === undefined
|
|
513
512
|
? [...materializedRows]
|