deepline 0.3.500 → 0.3.502
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/sdk/src/plays/client-core.ts +45 -7
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +20 -2
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +155 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +29 -14
- package/dist/bundling-sources/shared_libs/play-runtime/durable-invocation-fence.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +54 -1
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +264 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +56 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +53 -10
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +1 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +9 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +31 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +74 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +226 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +41 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +5 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-app-transport.ts +374 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +49 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-oidc.ts +55 -11
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-profile.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-sandbox-credential.ts +338 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-staging.ts +417 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +184 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +17 -3
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/gateway-progress-registry.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +18 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +198 -20
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-attempt.ts +81 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-journal.ts +708 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-gateway-staging-teardown.ts +160 -0
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +4 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +2 -0
- package/dist/cli/{auth-WK3FDPRP.mjs → auth-EFHLOVG4.mjs} +5 -5
- package/dist/cli/auth-VM3IKP5F.js +43 -0
- package/dist/cli/{billing-O3LVKXE7.mjs → billing-Q5XKEYPP.mjs} +8 -8
- package/dist/cli/{billing-K7UHZUF4.js → billing-SKT2VE34.js} +81 -81
- package/dist/cli/{chunk-4CJWOLOS.mjs → chunk-2JS3H6H6.mjs} +3 -3
- package/dist/cli/{chunk-CIV5GJAE.mjs → chunk-2MVIS2UI.mjs} +2 -2
- package/dist/cli/{chunk-LNMY2T5S.js → chunk-2S2F6YSI.js} +41 -41
- package/dist/cli/{chunk-RAZ3TMOS.js → chunk-32YQBJON.js} +7 -7
- package/dist/cli/{chunk-JHNFUCVT.mjs → chunk-3KEZVGGV.mjs} +4 -4
- package/dist/cli/{chunk-5JXGYSXH.mjs → chunk-3MJSWVQ2.mjs} +1 -1
- package/dist/cli/{chunk-5TVY5OEH.mjs → chunk-4CCMD7QM.mjs} +21 -20
- package/dist/cli/{chunk-T4AGTOKQ.mjs → chunk-4WTC5SSN.mjs} +7 -7
- package/dist/cli/{chunk-XCBOOB73.mjs → chunk-54QXWK3C.mjs} +1 -1
- package/dist/cli/{chunk-5AC7NUQN.mjs → chunk-7ZYSXSJJ.mjs} +5 -5
- package/dist/cli/{chunk-PHGMC33I.js → chunk-AJL2Q6IQ.js} +2 -2
- package/dist/cli/{chunk-UBKA33KY.mjs → chunk-BMCRTI6Z.mjs} +22 -1
- package/dist/cli/{chunk-74VKLBJD.js → chunk-DKAMCJIT.js} +14 -14
- package/dist/cli/{chunk-C5R3UH5V.mjs → chunk-DRBD4IYQ.mjs} +1 -1
- package/dist/cli/{chunk-Z5LE7NXM.js → chunk-DYHTXGLX.js} +2 -2
- package/dist/cli/{chunk-TOGCDNMH.js → chunk-EUWRKWT4.js} +4 -4
- package/dist/cli/{chunk-GBICEYUA.js → chunk-FVM4PS5Q.js} +116 -8
- package/dist/cli/{chunk-I42EOZKQ.js → chunk-FWDAEWCD.js} +5 -5
- package/dist/cli/{chunk-GOO4VI5M.js → chunk-GINKIZ7S.js} +16 -16
- package/dist/cli/{chunk-56QAHX2K.mjs → chunk-HIVRCTDR.mjs} +90 -30
- package/dist/cli/{chunk-XUOZYAP5.mjs → chunk-HMZF2CSP.mjs} +2 -2
- package/dist/cli/{chunk-5KAZGZG7.js → chunk-IL666WJE.js} +5 -5
- package/dist/cli/{chunk-G3NA4R7M.js → chunk-JFBJLNBI.js} +53 -53
- package/dist/cli/{chunk-KSHAFYYG.mjs → chunk-JFUXUSKB.mjs} +112 -4
- package/dist/cli/{chunk-RHE4YI4H.js → chunk-JL6H4H3G.js} +6 -6
- package/dist/cli/{chunk-K3BHKRMS.js → chunk-JLYDLK6X.js} +3 -3
- package/dist/cli/{chunk-QRKCCY4L.mjs → chunk-L5CTJY74.mjs} +1 -1
- package/dist/cli/{chunk-W64Y7GE7.js → chunk-LA3UYRVZ.js} +1 -1
- package/dist/cli/{chunk-HI2BFS5S.mjs → chunk-MP5QY4A2.mjs} +2 -2
- package/dist/cli/{chunk-V7MZYIA7.mjs → chunk-MYUISF3P.mjs} +5 -5
- package/dist/cli/{chunk-CS2AEAD6.mjs → chunk-N4TR6QRI.mjs} +1 -1
- package/dist/cli/{chunk-C7355NMU.mjs → chunk-NKLM4J4X.mjs} +1 -1
- package/dist/cli/{chunk-FJZUG633.mjs → chunk-NXVYLX3F.mjs} +3 -3
- package/dist/cli/{chunk-L7X6ADNM.mjs → chunk-NZXB27TP.mjs} +4 -4
- package/dist/cli/{chunk-VLCY4F6E.js → chunk-OEUMXKR5.js} +26 -26
- package/dist/cli/{chunk-SRS2D27G.mjs → chunk-OFBLT2LQ.mjs} +1 -1
- package/dist/cli/{chunk-SNPZ2QWL.js → chunk-OVZOMSH2.js} +8 -8
- package/dist/cli/{chunk-KEBNXJSK.js → chunk-Q3NM6ZL3.js} +19 -19
- package/dist/cli/{chunk-GBRI644Y.js → chunk-QNELA7SX.js} +53 -53
- package/dist/cli/{chunk-IX2DPYIV.js → chunk-QOJBRCAS.js} +3 -3
- package/dist/cli/{chunk-IZ6YWXIK.mjs → chunk-R5F7JXT4.mjs} +2 -2
- package/dist/cli/{chunk-EQR5O2D2.js → chunk-RNSHCJME.js} +3 -3
- package/dist/cli/{chunk-Q2FXZ4Z5.js → chunk-TAK3MVXY.js} +272 -271
- package/dist/cli/{chunk-BIE57V6K.js → chunk-UOANF3DR.js} +360 -300
- package/dist/cli/{chunk-CBZTKDXW.mjs → chunk-W5CHE5Q2.mjs} +1 -1
- package/dist/cli/{chunk-U5GFP26N.js → chunk-WKFAX2K7.js} +21 -21
- package/dist/cli/{chunk-XDVT3GOM.js → chunk-WSGXBROE.js} +22 -1
- package/dist/cli/{chunk-X7ODM2LK.js → chunk-X5MGQ7UT.js} +6 -6
- package/dist/cli/{chunk-REIKJREB.js → chunk-XMKUJ44Z.js} +5 -5
- package/dist/cli/{chunk-SNJNPRIV.js → chunk-YDXEXVBV.js} +7 -7
- package/dist/cli/{chunk-X5SO7RV5.mjs → chunk-YL2CCF6T.mjs} +4 -4
- package/dist/cli/{chunk-VPVEPGYS.mjs → chunk-YWOQYYYS.mjs} +2 -2
- package/dist/cli/{chunk-MAHLIWOF.mjs → chunk-Z2H7OQ6E.mjs} +2 -2
- package/dist/cli/{chunk-PGRPNRP6.mjs → chunk-ZNB6GR3P.mjs} +1 -1
- package/dist/cli/{csv-DEUOSTEB.mjs → csv-6AEPKKCO.mjs} +4 -4
- package/dist/cli/{csv-MWCWNIBJ.js → csv-OXGSCV75.js} +13 -13
- package/dist/cli/{db-Q6IRXTTG.js → db-6NVHDUZY.js} +29 -29
- package/dist/cli/{db-QM5R5BRY.mjs → db-K3KRK4CZ.mjs} +8 -8
- package/dist/cli/describe-JOUAXXPE.js +49 -0
- package/dist/cli/describe-P3ZJS7TQ.mjs +49 -0
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/describe-core.js +3 -4
- package/dist/cli/describe-core.mjs +2 -3
- package/dist/cli/{executions-DCCDXSQI.js → executions-2C2FFG52.js} +10 -10
- package/dist/cli/{executions-SWBKFCY2.mjs → executions-I7XW6WWK.mjs} +8 -8
- package/dist/cli/{feedback-EU3EYF4V.js → feedback-47B57A5Y.js} +8 -8
- package/dist/cli/{feedback-Q27HN3SB.mjs → feedback-RSTNBJAI.mjs} +4 -4
- package/dist/cli/{git-SEQFTQ4N.mjs → git-3G5AFKBT.mjs} +5 -5
- package/dist/cli/git-OPKIC6JQ.js +25 -0
- package/dist/cli/index.js +137 -137
- package/dist/cli/index.mjs +40 -40
- package/dist/cli/{legacy-noops-XKH4VREG.mjs → legacy-noops-NQ262TKL.mjs} +5 -5
- package/dist/cli/{legacy-noops-LCQDEVA3.js → legacy-noops-P665PBG4.js} +8 -8
- package/dist/cli/{monitors-DJCID6X5.js → monitors-IPWAD7LS.js} +97 -97
- package/dist/cli/{monitors-4XWBV46I.mjs → monitors-KUPZODZS.mjs} +9 -9
- package/dist/cli/{org-BU4FG5PN.js → org-WFC3N672.js} +74 -74
- package/dist/cli/{org-PSBGXBRW.mjs → org-ZCQGEM3L.mjs} +8 -8
- package/dist/cli/{pages-3PHJYXYB.js → pages-N5BNC67L.js} +20 -20
- package/dist/cli/{pages-7QLXLJGQ.mjs → pages-VE66IU7B.mjs} +8 -8
- package/dist/cli/{play-4OLYXRCG.mjs → play-EIMDIAJB.mjs} +20 -20
- package/dist/cli/{play-S3CWPQKB.js → play-NKIRJSKX.js} +336 -336
- package/dist/cli/{providers-JT7C2QTC.mjs → providers-KDTJ63ED.mjs} +8 -8
- package/dist/cli/{providers-U4JUMLB2.js → providers-XU3AGY2F.js} +11 -11
- package/dist/cli/{quickstart-OUSMXLYZ.js → quickstart-OSCHOSXU.js} +6 -6
- package/dist/cli/{quickstart-DQF5CF2I.mjs → quickstart-TXFXUODF.mjs} +4 -4
- package/dist/cli/{run-6XXHLB4X.js → run-ET2KVTPK.js} +45 -46
- package/dist/cli/{run-RECNI77K.mjs → run-ODGML35U.mjs} +26 -27
- package/dist/cli/run-identity-HFYABUJS.js +31 -0
- package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MNRZS2N3.mjs} +9 -3
- package/dist/cli/search-6U54Y3OK.js +32 -0
- package/dist/cli/{search-JN7K3GC6.mjs → search-DK67K6PR.mjs} +9 -9
- package/dist/cli/{search-output-L6PC5SPM.mjs → search-output-6SOKQTCW.mjs} +53 -75
- package/dist/cli/{search-output-JGNYXDWZ.js → search-output-KXP4FA62.js} +58 -80
- package/dist/cli/{secrets-UOXZWHBY.mjs → secrets-C6SYTMU7.mjs} +8 -8
- package/dist/cli/{secrets-TX6PCZ77.js → secrets-WPS6NMNK.js} +17 -17
- package/dist/cli/{sessions-GCEIX4KB.js → sessions-IP562J5Z.js} +6 -6
- package/dist/cli/{sessions-DTE733EH.mjs → sessions-PXVOH34X.mjs} +5 -5
- package/dist/cli/{settings-ZGIMRCTC.mjs → settings-FBUQGYVJ.mjs} +13 -13
- package/dist/cli/{settings-UGXSDHR5.js → settings-SUDUIVMY.js} +80 -80
- package/dist/cli/{setup-JYB6Z376.js → setup-I5H6IOEY.js} +49 -49
- package/dist/cli/{setup-UT7AO53D.mjs → setup-JSIMTR73.mjs} +9 -9
- package/dist/cli/{skills-4QJCMN7J.mjs → skills-FJQ3LX6N.mjs} +7 -7
- package/dist/cli/skills-VHININXC.js +36 -0
- package/dist/cli/{tools-RGNXIAA6.mjs → tools-IGBK4BVE.mjs} +19 -20
- package/dist/cli/tools-XMBMHVKF.js +56 -0
- package/dist/cli/{update-Q62EVSXZ.mjs → update-7MTT6F5K.mjs} +9 -9
- package/dist/cli/update-H7JVW43I.js +34 -0
- package/dist/cli/{workflow-YNIOWM7J.mjs → workflow-PM2J2OU3.mjs} +9 -9
- package/dist/cli/{workflow-GENV47RD.js → workflow-UX3ZX6BQ.js} +19 -19
- package/dist/{client-Cj3UqrCZ.d.ts → client-Bn8FwKGO.d.ts} +1 -1
- package/dist/{client-DSCTVVRj.d.mts → client-CfNRmjLK.d.mts} +1 -1
- package/dist/{client-core-dI4KTuWS.d.ts → client-core-B91EV0WS.d.ts} +19 -0
- package/dist/{client-core-B-8DTIN1.d.mts → client-core-BG8Cgrmk.d.mts} +19 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -19
- package/dist/index.mjs +8 -8
- package/dist/install-integrity.json +119 -114
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/plays/run-request.js +3 -3
- package/dist/plays/run-request.mjs +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +7 -7
- package/dist/server.mjs +5 -5
- package/package.json +1 -1
- package/dist/cli/auth-H4PCVUN3.js +0 -43
- package/dist/cli/chunk-XK5DMLZE.js +0 -111
- package/dist/cli/chunk-XRDXNAAY.mjs +0 -111
- package/dist/cli/describe-BZ544347.js +0 -50
- package/dist/cli/describe-CQZ7TBOG.mjs +0 -50
- package/dist/cli/git-NW6BAXX2.js +0 -25
- package/dist/cli/run-identity-G257GQED.js +0 -25
- package/dist/cli/search-BIQ62ZBE.js +0 -32
- package/dist/cli/skills-53LCPB5R.js +0 -36
- package/dist/cli/tools-HKJK6UNJ.js +0 -57
- package/dist/cli/update-QMZSFTFZ.js +0 -34
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isPlayDataset,
|
|
3
|
+
residentPlayDatasetRows,
|
|
4
|
+
} from '../plays/dataset';
|
|
5
|
+
|
|
6
|
+
const RESULT_COLUMNS = {
|
|
7
|
+
'company-to-contact': 'contacts',
|
|
8
|
+
'company-to-domain': 'company_domain',
|
|
9
|
+
'company-to-info': 'company_domain',
|
|
10
|
+
'company-to-job-postings': 'job_postings',
|
|
11
|
+
'company-to-news': 'news_events',
|
|
12
|
+
'company-to-tech-stack': 'technologies',
|
|
13
|
+
'name-and-domain-to-email-waterfall': 'email',
|
|
14
|
+
'person-linkedin-to-company': 'company_domain',
|
|
15
|
+
'person-linkedin-to-email': 'email',
|
|
16
|
+
'person-to-email': 'email',
|
|
17
|
+
'person-to-linkedin': 'linkedin_url',
|
|
18
|
+
'person-to-linkedin-harvestapi': 'linkedin_url',
|
|
19
|
+
'person-to-phone': 'phone',
|
|
20
|
+
'personal-email': 'personal_email',
|
|
21
|
+
'personal-email-to-linkedin': 'linkedin_url',
|
|
22
|
+
'professional-to-email': 'email',
|
|
23
|
+
'smb-business-email': 'email',
|
|
24
|
+
} as const;
|
|
25
|
+
|
|
26
|
+
export const PREBUILT_RESULT_QUALITY_COLUMNS: Readonly<Record<string, string>> =
|
|
27
|
+
{
|
|
28
|
+
...Object.fromEntries(
|
|
29
|
+
Object.entries(RESULT_COLUMNS).flatMap(([name, column]) => [
|
|
30
|
+
[name, column],
|
|
31
|
+
[`${name}-batch`, column],
|
|
32
|
+
]),
|
|
33
|
+
),
|
|
34
|
+
'company-to-employees-batch': 'employees',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const LIST_COLUMNS = new Set([
|
|
38
|
+
'contacts',
|
|
39
|
+
'employees',
|
|
40
|
+
'job_postings',
|
|
41
|
+
'news_events',
|
|
42
|
+
'technologies',
|
|
43
|
+
]);
|
|
44
|
+
|
|
45
|
+
const SOURCE_COLUMNS: Readonly<Record<string, string>> = {
|
|
46
|
+
email: 'email_source',
|
|
47
|
+
personal_email: 'email_source',
|
|
48
|
+
phone: 'phone_source',
|
|
49
|
+
linkedin_url: 'linkedin_source',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const DOMAIN_SOURCE_PLAYS = new Set([
|
|
53
|
+
'company-to-domain',
|
|
54
|
+
'company-to-domain-batch',
|
|
55
|
+
'person-linkedin-to-company',
|
|
56
|
+
'person-linkedin-to-company-batch',
|
|
57
|
+
]);
|
|
58
|
+
const DOMAIN_SOURCES = new Set([
|
|
59
|
+
'company_identify',
|
|
60
|
+
'linkedin_company_page',
|
|
61
|
+
'company_database',
|
|
62
|
+
'google_maps',
|
|
63
|
+
'web_search',
|
|
64
|
+
'linkedin_profile',
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
// Stable attribution buckets. Never put an arbitrary output value into the ledger.
|
|
68
|
+
const SOURCES = new Map([
|
|
69
|
+
...[
|
|
70
|
+
'aviato',
|
|
71
|
+
'contactout',
|
|
72
|
+
'datagma',
|
|
73
|
+
'exa',
|
|
74
|
+
'findymail',
|
|
75
|
+
'forager',
|
|
76
|
+
'fullenrich',
|
|
77
|
+
'hunter',
|
|
78
|
+
'harvestapi',
|
|
79
|
+
'icypeas',
|
|
80
|
+
'leadmagic',
|
|
81
|
+
'limadata',
|
|
82
|
+
'openmart',
|
|
83
|
+
'prospeo',
|
|
84
|
+
'quickenrich',
|
|
85
|
+
'serper',
|
|
86
|
+
'upcell',
|
|
87
|
+
'wiza',
|
|
88
|
+
].map((provider) => [provider, provider] as const),
|
|
89
|
+
['ai_ark', 'ai_ark'],
|
|
90
|
+
['native', 'deepline_native'],
|
|
91
|
+
['pdl', 'peopledatalabs'],
|
|
92
|
+
['trykitt', 'kitt'],
|
|
93
|
+
['pattern', 'email_pattern'],
|
|
94
|
+
]);
|
|
95
|
+
const SOURCE_BUCKETS = new Set([
|
|
96
|
+
...SOURCES.values(),
|
|
97
|
+
...DOMAIN_SOURCES,
|
|
98
|
+
'unknown',
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
export type PrebuiltResultQuality = {
|
|
102
|
+
rows: number;
|
|
103
|
+
hits: number;
|
|
104
|
+
sources: Record<string, number>;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
function record(value: unknown): Record<string, unknown> | null {
|
|
108
|
+
return value && typeof value === 'object' && !Array.isArray(value)
|
|
109
|
+
? (value as Record<string, unknown>)
|
|
110
|
+
: null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function resultShape(reference: string | undefined) {
|
|
114
|
+
if (!reference?.startsWith('prebuilt/')) return undefined;
|
|
115
|
+
const name = reference.slice('prebuilt/'.length);
|
|
116
|
+
if (!Object.hasOwn(PREBUILT_RESULT_QUALITY_COLUMNS, name)) return undefined;
|
|
117
|
+
const column = PREBUILT_RESULT_QUALITY_COLUMNS[name];
|
|
118
|
+
return {
|
|
119
|
+
column,
|
|
120
|
+
sourceColumn: DOMAIN_SOURCE_PLAYS.has(name)
|
|
121
|
+
? 'company_domain_source'
|
|
122
|
+
: SOURCE_COLUMNS[column],
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function measureRows(
|
|
127
|
+
{ column, sourceColumn }: NonNullable<ReturnType<typeof resultShape>>,
|
|
128
|
+
rows: Iterable<unknown>,
|
|
129
|
+
): PrebuiltResultQuality | null {
|
|
130
|
+
const quality: PrebuiltResultQuality = { rows: 0, hits: 0, sources: {} };
|
|
131
|
+
for (const item of rows) {
|
|
132
|
+
const row = record(item);
|
|
133
|
+
if (!row || !Object.hasOwn(row, column)) return null;
|
|
134
|
+
quality.rows++;
|
|
135
|
+
const value = row[column];
|
|
136
|
+
if (value === null) continue;
|
|
137
|
+
if (LIST_COLUMNS.has(column)) {
|
|
138
|
+
if (!Array.isArray(value)) return null;
|
|
139
|
+
if (!value.length) continue;
|
|
140
|
+
} else {
|
|
141
|
+
if (typeof value !== 'string') return null;
|
|
142
|
+
if (!value.trim()) continue;
|
|
143
|
+
}
|
|
144
|
+
const source = sourceColumn ? row[sourceColumn] : undefined;
|
|
145
|
+
const prefix =
|
|
146
|
+
typeof source === 'string'
|
|
147
|
+
? /^(ai_ark|[a-z0-9]+)(?:_|$)/.exec(
|
|
148
|
+
source.replace(/^waterfall:/, ''),
|
|
149
|
+
)?.[1]
|
|
150
|
+
: undefined;
|
|
151
|
+
const bucket =
|
|
152
|
+
sourceColumn === 'company_domain_source'
|
|
153
|
+
? typeof source === 'string' && DOMAIN_SOURCES.has(source)
|
|
154
|
+
? source
|
|
155
|
+
: 'unknown'
|
|
156
|
+
: (SOURCES.get(prefix ?? '') ?? 'unknown');
|
|
157
|
+
quality.sources[bucket] = (quality.sources[bucket] ?? 0) + 1;
|
|
158
|
+
quality.hits++;
|
|
159
|
+
}
|
|
160
|
+
return quality;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Tally only first-attempt writes proved committed by the sheet owner. */
|
|
164
|
+
export function createPrebuiltBatchQualityCollector(
|
|
165
|
+
reference: string | undefined,
|
|
166
|
+
) {
|
|
167
|
+
const shape = reference?.endsWith('-batch') && resultShape(reference);
|
|
168
|
+
if (!shape) return null;
|
|
169
|
+
const datasets = new Map<string, PrebuiltResultQuality | null>();
|
|
170
|
+
return {
|
|
171
|
+
record(input: {
|
|
172
|
+
datasetId: string;
|
|
173
|
+
rows: ReadonlyArray<{ key: string; status?: string; data: unknown }>;
|
|
174
|
+
committedKeys: readonly string[];
|
|
175
|
+
updated: number;
|
|
176
|
+
recoveredStaleKeys: readonly string[];
|
|
177
|
+
}) {
|
|
178
|
+
if (datasets.get(input.datasetId) === null) return;
|
|
179
|
+
// A reconciled stale write proves ownership but may have been written by
|
|
180
|
+
// another invocation. Its candidate values cannot establish attribution.
|
|
181
|
+
if (
|
|
182
|
+
input.updated !== input.committedKeys.length ||
|
|
183
|
+
input.recoveredStaleKeys.length
|
|
184
|
+
) {
|
|
185
|
+
datasets.set(input.datasetId, null);
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const committed = new Set(input.committedKeys);
|
|
189
|
+
const accepted = new Map(
|
|
190
|
+
input.rows
|
|
191
|
+
.filter((row) => committed.has(row.key))
|
|
192
|
+
.map((row) => [row.key, row]),
|
|
193
|
+
);
|
|
194
|
+
const batch =
|
|
195
|
+
accepted.size === committed.size
|
|
196
|
+
? measureRows(
|
|
197
|
+
shape,
|
|
198
|
+
[...accepted.values()]
|
|
199
|
+
.filter((row) => row.status !== 'failed')
|
|
200
|
+
.map((row) => row.data),
|
|
201
|
+
)
|
|
202
|
+
: null;
|
|
203
|
+
const previous = datasets.get(input.datasetId);
|
|
204
|
+
if (batch && previous) {
|
|
205
|
+
batch.rows += previous.rows;
|
|
206
|
+
batch.hits += previous.hits;
|
|
207
|
+
for (const [source, count] of Object.entries(previous.sources)) {
|
|
208
|
+
batch.sources[source] = (batch.sources[source] ?? 0) + count;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
datasets.set(input.datasetId, batch);
|
|
212
|
+
},
|
|
213
|
+
complete(datasetId: string, rows: number): PrebuiltResultQuality | null {
|
|
214
|
+
const quality = datasets.get(datasetId);
|
|
215
|
+
return quality?.rows === rows ? quality : null;
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export function measurePrebuiltResultQuality(
|
|
221
|
+
reference: string | undefined,
|
|
222
|
+
result: unknown,
|
|
223
|
+
collector?: ReturnType<typeof createPrebuiltBatchQualityCollector>,
|
|
224
|
+
): PrebuiltResultQuality | null {
|
|
225
|
+
const shape = resultShape(reference);
|
|
226
|
+
const output = record(result);
|
|
227
|
+
if (!shape || !output) return null;
|
|
228
|
+
if (!reference?.endsWith('-batch')) return measureRows(shape, [output]);
|
|
229
|
+
const [dataset, ...others] = Object.values(output).filter(isPlayDataset);
|
|
230
|
+
if (!dataset || others.length) return null;
|
|
231
|
+
const rows = residentPlayDatasetRows(dataset);
|
|
232
|
+
if (rows) return measureRows(shape, rows);
|
|
233
|
+
// The retained preview is incomplete. Only accept counts proved to cover
|
|
234
|
+
// the entire returned handle. This path never reads the sheet again.
|
|
235
|
+
return collector?.complete(dataset.datasetId, dataset.toJSON().count) ?? null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** Scheduler boundary. Accept only counts and the fixed attribution vocabulary. */
|
|
239
|
+
export function readPrebuiltResultQuality(
|
|
240
|
+
value: unknown,
|
|
241
|
+
): PrebuiltResultQuality | null {
|
|
242
|
+
const quality = record(value);
|
|
243
|
+
const sources = record(quality?.sources);
|
|
244
|
+
const count = (n: unknown): n is number =>
|
|
245
|
+
typeof n === 'number' && Number.isSafeInteger(n) && n >= 0;
|
|
246
|
+
if (
|
|
247
|
+
!quality ||
|
|
248
|
+
!sources ||
|
|
249
|
+
!count(quality.rows) ||
|
|
250
|
+
!count(quality.hits) ||
|
|
251
|
+
quality.hits > quality.rows
|
|
252
|
+
)
|
|
253
|
+
return null;
|
|
254
|
+
const cleanSources: Record<string, number> = {};
|
|
255
|
+
let hits = 0;
|
|
256
|
+
for (const [source, n] of Object.entries(sources)) {
|
|
257
|
+
if (!SOURCE_BUCKETS.has(source) || !count(n) || n === 0) return null;
|
|
258
|
+
cleanSources[source] = n;
|
|
259
|
+
hits += n;
|
|
260
|
+
}
|
|
261
|
+
return hits === quality.hits
|
|
262
|
+
? { rows: quality.rows, hits, sources: cleanSources }
|
|
263
|
+
: null;
|
|
264
|
+
}
|
|
@@ -26,6 +26,8 @@ import type { ToolResponseContract } from '../plays/tool-response-contract';
|
|
|
26
26
|
import type { FixtureBehavior } from './fixture-behavior';
|
|
27
27
|
import type { CtxFetchHttpFailureDiagnostic } from './log-provenance';
|
|
28
28
|
|
|
29
|
+
import type { PrebuiltResultQuality } from './prebuilt-result-quality';
|
|
30
|
+
|
|
29
31
|
export type PlayRunnerRateStateBackendConfig =
|
|
30
32
|
| {
|
|
31
33
|
kind: 'in_memory';
|
|
@@ -245,6 +247,19 @@ export interface PlayRunnerContextConfig extends RetainedPipelineCarrier {
|
|
|
245
247
|
*/
|
|
246
248
|
executionGatewayBaseUrl?: string | null;
|
|
247
249
|
receiptGatewayBaseUrl?: string | null;
|
|
250
|
+
/**
|
|
251
|
+
* Runtime gateway profile pin (`runtime-gateway-profile.ts`). Absent on
|
|
252
|
+
* unpinned runs. Set only by the worker from a validated launch pin; the
|
|
253
|
+
* gateway URLs above then name the pinned deployment.
|
|
254
|
+
*/
|
|
255
|
+
runtimeGatewayProfileId?: string | null;
|
|
256
|
+
runtimeGatewayDeploymentId?: string | null;
|
|
257
|
+
/** Exact origin and gateway path prefixes that may receive the OIDC token. */
|
|
258
|
+
runtimeGatewayCredentialScope?:
|
|
259
|
+
| import('./runtime-gateway-sandbox-credential').RuntimeGatewayCredentialScope
|
|
260
|
+
| null;
|
|
261
|
+
/** Short-lived edge credential for the pinned gateway; renewed by the watchdog. */
|
|
262
|
+
runtimeGatewayOidcToken?: string | null;
|
|
248
263
|
/**
|
|
249
264
|
* Internal fixture-canary pin for a cordoned receipt-gateway candidate. This
|
|
250
265
|
* is a signed launch fact, never a customer-authored or sandbox-supplied
|
|
@@ -292,6 +307,8 @@ export interface PlayRunnerContextConfig extends RetainedPipelineCarrier {
|
|
|
292
307
|
rootRunId?: string;
|
|
293
308
|
runAttempt?: number | null;
|
|
294
309
|
playName?: string;
|
|
310
|
+
/** Canonical system prebuilt reference for internal result coverage. */
|
|
311
|
+
prebuiltQualityReference?: string;
|
|
295
312
|
userEmail?: string;
|
|
296
313
|
/** Authenticated account snapshot projected from durable runtime authority. */
|
|
297
314
|
runActor?:
|
|
@@ -473,6 +490,7 @@ export type PlayRunnerResult =
|
|
|
473
490
|
/** Customer-safe runtime observations that must survive bounded log tails. */
|
|
474
491
|
runtimeDiagnostics?: CtxFetchHttpFailureDiagnostic[];
|
|
475
492
|
outputRowCount?: number;
|
|
493
|
+
prebuiltResultQuality?: PrebuiltResultQuality;
|
|
476
494
|
rowOutcomes?: PlayRunnerRowOutcomeSummary;
|
|
477
495
|
logs: string[];
|
|
478
496
|
logIds?: string[];
|
|
@@ -229,3 +229,59 @@ export function buildAsyncPlayRequestFingerprint(input: {
|
|
|
229
229
|
}),
|
|
230
230
|
);
|
|
231
231
|
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Longest run id any runtime scope accepts. Play names are Postgres
|
|
235
|
+
* identifiers (at most 63 characters), so every built id is far below it.
|
|
236
|
+
*/
|
|
237
|
+
export const PLAY_RUN_ID_MAX_LENGTH = 256;
|
|
238
|
+
|
|
239
|
+
const RUNTIME_SCOPE_RUN_ID_PATTERN = /^[A-Za-z0-9_.:@/-]+$/;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* The one run-id check that may gate a request: a non-empty id of at most
|
|
243
|
+
* `PLAY_RUN_ID_MAX_LENGTH` characters from the path-safe alphabet. Run ids are
|
|
244
|
+
* path-shaped (`play/<family>/run/<suffix>`), so `/` is allowed. It is
|
|
245
|
+
* deliberately permissive: it never parses the id, so a scheduler row with an
|
|
246
|
+
* older or foreign id shape is still served.
|
|
247
|
+
*/
|
|
248
|
+
export function isRuntimeScopeRunId(value: unknown): value is string {
|
|
249
|
+
return (
|
|
250
|
+
typeof value === 'string' &&
|
|
251
|
+
value.length > 0 &&
|
|
252
|
+
value.length <= PLAY_RUN_ID_MAX_LENGTH &&
|
|
253
|
+
RUNTIME_SCOPE_RUN_ID_PATTERN.test(value)
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export type ParsedPlayRunId = Readonly<{
|
|
258
|
+
familyKey: string;
|
|
259
|
+
startedAtMs: number;
|
|
260
|
+
kind: 'root' | 'caller' | 'async' | 'rerun';
|
|
261
|
+
}>;
|
|
262
|
+
|
|
263
|
+
const PLAY_RUN_ID_PATTERN =
|
|
264
|
+
/^play\/([a-z0-9-]+(?:\/[a-z0-9-]+)*)\/run\/\d{8}t\d{6}-\d{3}(?:-[a-z0-9]{8}(-caller-[a-f0-9]{64})?|(-async-[a-f0-9]{20})|(-rerun-[a-f0-9]{20}))?$/;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Parse an id built by this module's builders. Diagnostic only: use
|
|
268
|
+
* `isRuntimeScopeRunId` to admit or refuse a request.
|
|
269
|
+
*/
|
|
270
|
+
export function parsePlayRunId(value: unknown): ParsedPlayRunId | null {
|
|
271
|
+
if (!isRuntimeScopeRunId(value)) return null;
|
|
272
|
+
const match = PLAY_RUN_ID_PATTERN.exec(value);
|
|
273
|
+
if (!match) return null;
|
|
274
|
+
const startedAtMs = canonicalPlayRunStartedAtMs(value);
|
|
275
|
+
if (startedAtMs === null) return null;
|
|
276
|
+
return Object.freeze({
|
|
277
|
+
familyKey: match[1]!,
|
|
278
|
+
startedAtMs,
|
|
279
|
+
kind: match[2]
|
|
280
|
+
? 'caller'
|
|
281
|
+
: match[3]
|
|
282
|
+
? 'async'
|
|
283
|
+
: match[4]
|
|
284
|
+
? 'rerun'
|
|
285
|
+
: 'root',
|
|
286
|
+
});
|
|
287
|
+
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { runtimeToolPath } from '../runtime-api-paths';
|
|
2
|
+
import {
|
|
3
|
+
createPrebuiltBatchQualityCollector,
|
|
4
|
+
measurePrebuiltResultQuality,
|
|
5
|
+
} from '../prebuilt-result-quality';
|
|
1
6
|
import {
|
|
2
7
|
emptyRowFailureCounts,
|
|
3
8
|
readRowFailureCounts,
|
|
@@ -9,6 +14,10 @@ import { appendFileSync, createReadStream, writeFileSync } from 'node:fs';
|
|
|
9
14
|
import { readFile } from 'node:fs/promises';
|
|
10
15
|
import { dirname, isAbsolute, resolve } from 'node:path';
|
|
11
16
|
import { createRequire } from 'node:module';
|
|
17
|
+
import {
|
|
18
|
+
installSandboxRuntimeAppTransport,
|
|
19
|
+
sandboxRuntimeAppFetch,
|
|
20
|
+
} from '../runtime-app-transport';
|
|
12
21
|
import { createHash, randomUUID } from 'node:crypto';
|
|
13
22
|
import { formatWithOptions } from 'node:util';
|
|
14
23
|
import { compileFunction } from 'node:vm';
|
|
@@ -215,21 +224,23 @@ export function createReceiptGatewayResponseObserver(): {
|
|
|
215
224
|
};
|
|
216
225
|
}
|
|
217
226
|
|
|
218
|
-
|
|
227
|
+
// `safeOutboundFetch` sends with node:http, not the global fetch, so the
|
|
228
|
+
// pinned-run gateway credential is applied explicitly by the transport owner.
|
|
229
|
+
const safeNodeOutboundFetch = sandboxRuntimeAppFetch((async (
|
|
219
230
|
input: string | URL,
|
|
220
231
|
init?: RequestInit,
|
|
221
|
-
): Promise<Response> {
|
|
232
|
+
): Promise<Response> => {
|
|
222
233
|
const { safeOutboundFetch } = await loadSafeOutboundFetch();
|
|
223
234
|
return safeOutboundFetch(input, init);
|
|
224
|
-
}
|
|
235
|
+
}) as typeof fetch);
|
|
225
236
|
|
|
226
|
-
|
|
237
|
+
const safeNodeStreamingOutboundFetch = sandboxRuntimeAppFetch((async (
|
|
227
238
|
input: string | URL,
|
|
228
239
|
init?: RequestInit,
|
|
229
|
-
): Promise<Response> {
|
|
240
|
+
): Promise<Response> => {
|
|
230
241
|
const { safeOutboundFetch } = await loadSafeOutboundFetch();
|
|
231
242
|
return safeOutboundFetch(input, init, { streamResponseBody: true });
|
|
232
|
-
}
|
|
243
|
+
}) as typeof fetch);
|
|
233
244
|
|
|
234
245
|
import {
|
|
235
246
|
resolveSheetContractForTableNamespace,
|
|
@@ -709,7 +720,7 @@ function createRuntimeToolMetadataResolver(config: PlayRunnerExecutionConfig) {
|
|
|
709
720
|
}
|
|
710
721
|
|
|
711
722
|
const promise = (async () => {
|
|
712
|
-
const url = `${config.context.baseUrl}
|
|
723
|
+
const url = `${config.context.baseUrl}${runtimeToolPath(normalizedToolId, 'metadata')}`;
|
|
713
724
|
const response = await fetchRunnerRuntimeControl({
|
|
714
725
|
url,
|
|
715
726
|
description: `Runtime metadata lookup for tool ${normalizedToolId}`,
|
|
@@ -758,7 +769,7 @@ export function createAppRuntimeToolAuthScopeDigestResolver(
|
|
|
758
769
|
`Runtime auth scope lookup for tool ${normalizedToolId || '<empty>'} requires executorToken and baseUrl.`,
|
|
759
770
|
);
|
|
760
771
|
}
|
|
761
|
-
const url = `${config.context.baseUrl}
|
|
772
|
+
const url = `${config.context.baseUrl}${runtimeToolPath(normalizedToolId, 'auth_scope')}`;
|
|
762
773
|
const response = await fetchRunnerRuntimeControl({
|
|
763
774
|
url,
|
|
764
775
|
description: `Runtime auth scope lookup for tool ${normalizedToolId}`,
|
|
@@ -857,7 +868,7 @@ export function createAppRuntimeToolAuthScopeDigestResolver(
|
|
|
857
868
|
if (!proof) {
|
|
858
869
|
proof = (async () => {
|
|
859
870
|
const response = await fetchRunnerRuntimeControl({
|
|
860
|
-
url: `${executionBase}
|
|
871
|
+
url: `${executionBase}${runtimeToolPath(normalized, 'auth_scope')}`,
|
|
861
872
|
description: `Runtime async recovery capability for tool ${normalized}`,
|
|
862
873
|
retrySafe: true,
|
|
863
874
|
init: {
|
|
@@ -963,7 +974,7 @@ export function createRuntimeEventWaitHandler(
|
|
|
963
974
|
boundary: IntegrationEventWaitBoundary;
|
|
964
975
|
},
|
|
965
976
|
): Promise<IntegrationEventWaitBoundary> {
|
|
966
|
-
const url = `${config.context.baseUrl}
|
|
977
|
+
const url = `${config.context.baseUrl}${runtimeToolPath(normalizedToolId, 'event_wait')}`;
|
|
967
978
|
const response = await fetchRunnerRuntimeControl({
|
|
968
979
|
url,
|
|
969
980
|
description: `Event wait runtime call for tool ${normalizedToolId}`,
|
|
@@ -2335,6 +2346,15 @@ async function run(
|
|
|
2335
2346
|
writeVersion?: number;
|
|
2336
2347
|
}
|
|
2337
2348
|
>();
|
|
2349
|
+
// A resumed map can return the rows completed by this invocation alone.
|
|
2350
|
+
const prebuiltQualityReference =
|
|
2351
|
+
config.checkpoint &&
|
|
2352
|
+
config.context.prebuiltQualityReference?.endsWith('-batch')
|
|
2353
|
+
? undefined
|
|
2354
|
+
: config.context.prebuiltQualityReference;
|
|
2355
|
+
const prebuiltBatchQuality = createPrebuiltBatchQualityCollector(
|
|
2356
|
+
prebuiltQualityReference,
|
|
2357
|
+
);
|
|
2338
2358
|
const membershipCapturingMaps = new Set<string>();
|
|
2339
2359
|
const runtimeMapDatasetSettlements = new Map<
|
|
2340
2360
|
string,
|
|
@@ -3251,6 +3271,19 @@ async function run(
|
|
|
3251
3271
|
});
|
|
3252
3272
|
const datasetPath = `datasets.${input.tableNamespace}`;
|
|
3253
3273
|
const datasetId = createRuntimeDatasetId(playName, input.tableNamespace);
|
|
3274
|
+
if (
|
|
3275
|
+
prebuiltBatchQuality &&
|
|
3276
|
+
canUseRootPreloadedDbSessions &&
|
|
3277
|
+
playName === config.context.playName
|
|
3278
|
+
) {
|
|
3279
|
+
prebuiltBatchQuality.record({
|
|
3280
|
+
datasetId,
|
|
3281
|
+
rows: input.rows,
|
|
3282
|
+
committedKeys: result.committedKeys,
|
|
3283
|
+
updated: result.updated,
|
|
3284
|
+
recoveredStaleKeys,
|
|
3285
|
+
});
|
|
3286
|
+
}
|
|
3254
3287
|
const settlement = runtimeMapDatasetSettlements.get(datasetId) ?? {
|
|
3255
3288
|
datasetId,
|
|
3256
3289
|
path: datasetPath,
|
|
@@ -3706,6 +3739,11 @@ async function run(
|
|
|
3706
3739
|
]),
|
|
3707
3740
|
).values(),
|
|
3708
3741
|
).slice(0, 16);
|
|
3742
|
+
const prebuiltResultQuality = measurePrebuiltResultQuality(
|
|
3743
|
+
prebuiltQualityReference,
|
|
3744
|
+
result,
|
|
3745
|
+
prebuiltBatchQuality,
|
|
3746
|
+
);
|
|
3709
3747
|
const checkpoint = ctx.getCheckpoint();
|
|
3710
3748
|
const rowOutcomes = rowOutcomesFromCheckpoint(checkpoint);
|
|
3711
3749
|
|
|
@@ -3724,6 +3762,7 @@ async function run(
|
|
|
3724
3762
|
logMetadata: terminalLogMetadata(ctx),
|
|
3725
3763
|
...(runtimeDiagnostics.length > 0 ? { runtimeDiagnostics } : {}),
|
|
3726
3764
|
...(rowOutcomes ? { rowOutcomes } : {}),
|
|
3765
|
+
...(prebuiltResultQuality ? { prebuiltResultQuality } : {}),
|
|
3727
3766
|
stats: runtimeStats(),
|
|
3728
3767
|
steps: ctx.getSteps(),
|
|
3729
3768
|
checkpoint,
|
|
@@ -4125,6 +4164,10 @@ async function main() {
|
|
|
4125
4164
|
? gunzipSync(configBuffer).toString('utf-8')
|
|
4126
4165
|
: configBuffer.toString('utf-8');
|
|
4127
4166
|
const parsedConfig = JSON.parse(configJson) as PlayRunnerExecutionConfig;
|
|
4167
|
+
// Pinned runs only: code-owned requests to the pinned gateway origin and
|
|
4168
|
+
// paths carry the watchdog-renewed OIDC credential. Other targets, signed
|
|
4169
|
+
// object URLs included, are untouched. Unpinned configs install nothing.
|
|
4170
|
+
installSandboxRuntimeAppTransport(parsedConfig.context);
|
|
4128
4171
|
writeRunnerStartupDiagnostic(
|
|
4129
4172
|
process.env.DEEPLINE_PLAY_RUNNER_STARTUP_DIAGNOSTIC_PATH,
|
|
4130
4173
|
{ phase: 'booted' },
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APP_RUNTIME_COMPAT_PATH } from '../runtime-api-paths';
|
|
1
2
|
import { RUNTIME_CLAIM_HEARTBEAT_DIVISOR } from '../runtime-constants';
|
|
2
3
|
import { PLAY_RUNTIME_TRANSPORT_ATTEMPT_HEADER } from '../runtime-contract';
|
|
3
4
|
import {
|
|
@@ -106,7 +107,6 @@ export interface RunnerHeartbeatLoopHandle {
|
|
|
106
107
|
lastSuccessAtMs: () => number;
|
|
107
108
|
}
|
|
108
109
|
|
|
109
|
-
const APP_RUNTIME_COMPAT_PATH = '/api/v2/plays/runtime';
|
|
110
110
|
export const RUNNER_HEARTBEAT_REQUEST_TIMEOUT_MS = 10_000;
|
|
111
111
|
// The detached startup deadline is shorter than the normal 40s cadence.
|
|
112
112
|
// Retry initial transport failures while customer execution remains fenced.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APP_RUNTIME_COMPAT_PATH } from '../runtime-api-paths';
|
|
1
2
|
import type { PlayRunnerEvent } from '../protocol';
|
|
2
3
|
import { isDurableDirectRunnerLog } from '../log-provenance';
|
|
3
4
|
import { jsonByteLengthUpTo } from '../output-size-limits';
|
|
@@ -28,8 +29,6 @@ export const RUNNER_PROGRESS_PUSH_MAX_BATCH = 500;
|
|
|
28
29
|
*/
|
|
29
30
|
export const RUNNER_PROGRESS_PUSH_STOP_TIMEOUT_MS = 5_000;
|
|
30
31
|
|
|
31
|
-
const APP_RUNTIME_COMPAT_PATH = '/api/v2/plays/runtime';
|
|
32
|
-
|
|
33
32
|
export interface RunnerProgressPusher {
|
|
34
33
|
snapshot: () => {
|
|
35
34
|
retainedBytes: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APP_RUNTIME_COMPAT_PATH } from '../runtime-api-paths';
|
|
1
2
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
3
|
import {
|
|
3
4
|
RUNNER_TERMINAL_CHECKPOINT_DISPOSITION,
|
|
@@ -45,7 +46,6 @@ const TERMINAL_PUSH_MAX_ATTEMPTS =
|
|
|
45
46
|
const TERMINAL_PUSH_RETRY_DELAYS_MS = [500, 1_000, 2_000, 4_000] as const;
|
|
46
47
|
const TERMINAL_PUSH_REQUEST_TIMEOUT_MS =
|
|
47
48
|
RUNTIME_RELIABILITY_POLICY.gateway.terminalPushRequestTimeoutMs;
|
|
48
|
-
const APP_RUNTIME_COMPAT_PATH = '/api/v2/plays/runtime';
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* A terminal result reserves its 5 MiB customer budget for the authored
|
|
@@ -21,7 +21,10 @@ import axios, { type InternalAxiosRequestConfig } from 'axios';
|
|
|
21
21
|
import { Readable } from 'node:stream';
|
|
22
22
|
import type { DaytonaClientOptions } from '../../daytona-runtime-config';
|
|
23
23
|
import type { CreateSandboxFromSnapshotParams } from '@daytonaio/sdk';
|
|
24
|
-
import type {
|
|
24
|
+
import type {
|
|
25
|
+
DaytonaDeleteRetryAuthorization,
|
|
26
|
+
DaytonaDomainAllowListParam,
|
|
27
|
+
} from './daytona-lifecycle';
|
|
25
28
|
import {
|
|
26
29
|
DAYTONA_CONTROL_TIMEOUT_MS,
|
|
27
30
|
DaytonaControlTimeoutError,
|
|
@@ -558,7 +561,7 @@ export function createDaytonaLaunchClient(
|
|
|
558
561
|
resolvedDomains.set(sandbox, organizationId.trim());
|
|
559
562
|
},
|
|
560
563
|
async create(
|
|
561
|
-
params: CreateSandboxFromSnapshotParams,
|
|
564
|
+
params: CreateSandboxFromSnapshotParams & DaytonaDomainAllowListParam,
|
|
562
565
|
options: { timeout?: number } = {},
|
|
563
566
|
) {
|
|
564
567
|
const timeoutMs = (options.timeout ?? 60) * 1_000;
|
|
@@ -597,6 +600,10 @@ export function createDaytonaLaunchClient(
|
|
|
597
600
|
volumes: params.volumes,
|
|
598
601
|
networkBlockAll: params.networkBlockAll,
|
|
599
602
|
networkAllowList: params.networkAllowList,
|
|
603
|
+
// Pinned Runtime gateway host only; absent on every other run.
|
|
604
|
+
...(params.domainAllowList
|
|
605
|
+
? { domainAllowList: params.domainAllowList }
|
|
606
|
+
: {}),
|
|
600
607
|
linkedSandbox: params.linkedSandbox,
|
|
601
608
|
},
|
|
602
609
|
undefined,
|
package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts
CHANGED
|
@@ -84,7 +84,7 @@ export type DaytonaDeleteRetryAuthorization = {
|
|
|
84
84
|
|
|
85
85
|
export type DaytonaClient = {
|
|
86
86
|
create(
|
|
87
|
-
params: CreateSandboxFromSnapshotParams,
|
|
87
|
+
params: CreateSandboxFromSnapshotParams & DaytonaDomainAllowListParam,
|
|
88
88
|
options: { timeout: number },
|
|
89
89
|
): Promise<Sandbox>;
|
|
90
90
|
get?(name: string): Promise<Sandbox>;
|
|
@@ -548,6 +548,31 @@ export function filterIpv4CidrAllowList(raw: string | null): string | null {
|
|
|
548
548
|
return ipv4.length > 0 ? ipv4.join(',') : null;
|
|
549
549
|
}
|
|
550
550
|
|
|
551
|
+
/** Daytona create accepts a comma-separated domain allow-list beside CIDRs. */
|
|
552
|
+
export type DaytonaDomainAllowListParam = { domainAllowList?: string };
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* A run pinned to an app-hosted Runtime gateway reaches that immutable
|
|
556
|
+
* deployment by hostname, whose addresses cannot be enumerated as CIDRs. When
|
|
557
|
+
* egress is already restricted to an allow-list, add exactly the pinned host;
|
|
558
|
+
* an unrestricted sandbox needs nothing (adding a domain list would restrict
|
|
559
|
+
* it). Unpinned runs return null.
|
|
560
|
+
*/
|
|
561
|
+
export function runtimeGatewayDaytonaDomainAllowList(input: {
|
|
562
|
+
credentialScope:
|
|
563
|
+
| PlayRunnerExecutionConfig['context']['runtimeGatewayCredentialScope']
|
|
564
|
+
| undefined;
|
|
565
|
+
networkAllowList: string | null;
|
|
566
|
+
}): string | null {
|
|
567
|
+
const scope = input.credentialScope;
|
|
568
|
+
if (!scope || !input.networkAllowList) return null;
|
|
569
|
+
const hostname = new URL(scope.origin).hostname;
|
|
570
|
+
if (!hostname) {
|
|
571
|
+
throw new Error('Runtime gateway credential scope has no hostname.');
|
|
572
|
+
}
|
|
573
|
+
return hostname;
|
|
574
|
+
}
|
|
575
|
+
|
|
551
576
|
export function resolveDaytonaSandboxNetworkPolicy(input: {
|
|
552
577
|
runtimeSchedulerSchema: string | null | undefined;
|
|
553
578
|
env?: NodeJS.ProcessEnv;
|
|
@@ -618,6 +643,10 @@ async function createOneShotDaytonaSandbox(input: {
|
|
|
618
643
|
const { networkAllowList } = resolveDaytonaSandboxNetworkPolicy({
|
|
619
644
|
runtimeSchedulerSchema: input.context.runtimeSchedulerSchema ?? null,
|
|
620
645
|
});
|
|
646
|
+
const domainAllowList = runtimeGatewayDaytonaDomainAllowList({
|
|
647
|
+
credentialScope: input.context.runtimeGatewayCredentialScope,
|
|
648
|
+
networkAllowList,
|
|
649
|
+
});
|
|
621
650
|
|
|
622
651
|
const commonParams = {
|
|
623
652
|
name: input.sandboxName,
|
|
@@ -639,6 +668,7 @@ async function createOneShotDaytonaSandbox(input: {
|
|
|
639
668
|
// the allow-list alone so the egress restriction holds without the
|
|
640
669
|
// contradictory flag.
|
|
641
670
|
...(networkAllowList ? { networkAllowList } : {}),
|
|
671
|
+
...(domainAllowList ? { domainAllowList } : {}),
|
|
642
672
|
};
|
|
643
673
|
return input.daytona.create(commonParams, {
|
|
644
674
|
timeout: DAYTONA_CREATE_TIMEOUT_SECONDS,
|