deepline 0.3.184 → 0.3.185

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.
Files changed (34) hide show
  1. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  2. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +53 -0
  3. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +751 -193
  4. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +4 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +3 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
  7. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +437 -150
  8. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +47 -4
  9. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +3 -1
  10. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +18 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/map-execution-frame.ts +3 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +22 -2
  13. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +6 -1
  14. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +11 -5
  15. package/dist/bundling-sources/shared_libs/play-runtime/runtime-flow.ts +102 -12
  16. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +8 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +136 -28
  18. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +80 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +897 -207
  20. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +33 -1
  21. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +21 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +120 -34
  23. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +82 -2
  24. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +7 -2
  25. package/dist/cli/index.js +1 -1
  26. package/dist/cli/index.mjs +1 -1
  27. package/dist/index.js +1 -1
  28. package/dist/index.mjs +1 -1
  29. package/dist/install-integrity.json +1 -0
  30. package/dist/release.d.mts +1 -1
  31. package/dist/release.d.ts +1 -1
  32. package/dist/release.js +1 -1
  33. package/dist/release.mjs +1 -1
  34. package/package.json +1 -1
@@ -200,7 +200,7 @@ export const SDK_RELEASE = {
200
200
  // getters keep their established compatibility behavior.
201
201
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
202
202
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
203
- version: '0.3.184',
203
+ version: '0.3.185',
204
204
  updateSummary:
205
205
  'Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.',
206
206
  packageCapabilities: {
@@ -40,6 +40,8 @@ import type {
40
40
  PlayRunnerBudgetChargeResult,
41
41
  PlayRunnerRateStatePenalizeInput,
42
42
  PlayRunnerRateStateReleaseInput,
43
+ PlayRunnerRateStateValidateInput,
44
+ PlayRunnerRateStateValidateResult,
43
45
  } from './/protocol';
44
46
  import {
45
47
  PLAY_RUNTIME_TRANSPORT_ATTEMPT_HEADER,
@@ -299,6 +301,9 @@ type RuntimeApiRequest =
299
301
  | ({
300
302
  action: 'rate_state_penalize';
301
303
  } & PlayRunnerRateStatePenalizeInput)
304
+ | ({
305
+ action: 'rate_state_validate';
306
+ } & PlayRunnerRateStateValidateInput)
302
307
  | ({
303
308
  action: 'governor_budget_charge';
304
309
  } & PlayRunnerBudgetChargeInput)
@@ -999,6 +1004,7 @@ function isRetryableAppRuntimeAction(
999
1004
  action === 'rate_state_acquire' ||
1000
1005
  action === 'rate_state_release' ||
1001
1006
  action === 'rate_state_penalize' ||
1007
+ action === 'rate_state_validate' ||
1002
1008
  action === 'record_first_claim_latency' ||
1003
1009
  action === 'project_run_created' ||
1004
1010
  action === 'release_runtime_step_receipt' ||
@@ -1367,6 +1373,19 @@ export class AppRuntimeApiResponseError extends Error {
1367
1373
  }
1368
1374
  }
1369
1375
 
1376
+ /** Older app receivers do not understand cached-permit validation. */
1377
+ export class RateStateValidationUnavailableError extends Error {
1378
+ readonly code = 'RATE_STATE_VALIDATE_UNAVAILABLE';
1379
+
1380
+ constructor(cause?: unknown) {
1381
+ super(
1382
+ 'Shared provider rate-state validation is unavailable on the app runtime receiver; refusing to dispatch a cached provider permit.',
1383
+ cause === undefined ? undefined : { cause },
1384
+ );
1385
+ this.name = 'RateStateValidationUnavailableError';
1386
+ }
1387
+ }
1388
+
1370
1389
  const APP_RUNTIME_CAPACITY_ERROR_CODES = new Set([
1371
1390
  'receipt_db_admission_backpressure',
1372
1391
  'runtime_receipt_claim_timeout',
@@ -2037,6 +2056,23 @@ export async function penalizeRateStateViaAppRuntime(
2037
2056
  });
2038
2057
  }
2039
2058
 
2059
+ export async function validateRateStateViaAppRuntime(
2060
+ context: WorkerRuntimeApiContext,
2061
+ input: PlayRunnerRateStateValidateInput,
2062
+ ): Promise<PlayRunnerRateStateValidateResult> {
2063
+ try {
2064
+ return await postAppRuntimeApi<PlayRunnerRateStateValidateResult>(context, {
2065
+ action: 'rate_state_validate',
2066
+ ...input,
2067
+ });
2068
+ } catch (error) {
2069
+ if (isLegacyRateStateValidationUnavailableResponse(error)) {
2070
+ throw new RateStateValidationUnavailableError(error);
2071
+ }
2072
+ throw error;
2073
+ }
2074
+ }
2075
+
2040
2076
  export async function chargeGovernorBudgetViaAppRuntime(
2041
2077
  context: WorkerRuntimeApiContext,
2042
2078
  input: PlayRunnerBudgetChargeInput,
@@ -2113,6 +2149,23 @@ export function isLegacyRuntimeTrafficPolicyControlPlaneResponse(
2113
2149
  );
2114
2150
  }
2115
2151
 
2152
+ /**
2153
+ * The older app route rejects an unknown action before capability evaluation.
2154
+ * Treat only that exact response as the declared older-receiver limitation;
2155
+ * callers must fail closed because no safe cached-permit fallback exists.
2156
+ */
2157
+ export function isLegacyRateStateValidationUnavailableResponse(
2158
+ error: unknown,
2159
+ ): error is AppRuntimeApiResponseError {
2160
+ return (
2161
+ error instanceof AppRuntimeApiResponseError &&
2162
+ error.action === 'rate_state_validate' &&
2163
+ error.status === 403 &&
2164
+ error.code === null &&
2165
+ error.detail === 'Unsupported runtime action capability scope.'
2166
+ );
2167
+ }
2168
+
2116
2169
  export async function writeStagedFileFromAppRuntime(
2117
2170
  context: WorkerRuntimeApiContext,
2118
2171
  file: Pick<PlayStagedFileRef, 'storageKey'>,