deepline 0.3.582 → 0.4.0
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/client-core.ts +79 -36
- package/dist/bundling-sources/sdk/src/index.ts +2 -0
- package/dist/bundling-sources/sdk/src/release.ts +7 -3
- package/dist/bundling-sources/sdk/src/types.ts +37 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +22 -3
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +94 -5
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +66 -12
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-recovery.ts +9 -3
- package/dist/bundling-sources/shared_libs/play-runtime/docflow-node-io.ts +86 -20
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +17 -6
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +22 -6
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +54 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/row-failure-summary.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +4 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +62 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +197 -19
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +25 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +140 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-wake-policy.ts +419 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +47 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +24 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +36 -19
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +380 -51
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +21 -10
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +32 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +6 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -1
- package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +34 -4
- package/dist/bundling-sources/shared_libs/plays/docflow-recording-lint.ts +512 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-requirement.ts +346 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-rule-codes.ts +38 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts +42 -2
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +223 -32
- package/dist/bundling-sources/shared_libs/plays/play-check-compact.ts +14 -1
- package/dist/bundling-sources/shared_libs/plays/run-result.ts +35 -0
- package/dist/cli/{agents-UAXDG4FS.mjs → agents-AHXB7N7Y.mjs} +68 -4
- package/dist/cli/{agents-2L73CJHH.js → agents-KBZ7OUZS.js} +95 -31
- package/dist/cli/{auth-3B2QB4UH.mjs → auth-3CACO52T.mjs} +5 -5
- package/dist/cli/auth-UOHCO5K6.js +44 -0
- package/dist/cli/{billing-E7FO622G.js → billing-5KXPGKMO.js} +105 -105
- package/dist/cli/{billing-CPBRWG3M.mjs → billing-TSTK63NB.mjs} +9 -9
- package/dist/cli/{chunk-3DVWSTAI.mjs → chunk-2GWKBQJZ.mjs} +1 -1
- package/dist/cli/{chunk-PNQVB4UD.mjs → chunk-3DJMPID5.mjs} +11 -11
- package/dist/cli/{chunk-FBSPHBAF.js → chunk-3ET6NRXP.js} +7 -3
- package/dist/cli/{chunk-NZR5PBNP.mjs → chunk-3MWTAM3F.mjs} +3 -3
- package/dist/cli/{chunk-ROUNT4NX.mjs → chunk-4ANDW2OT.mjs} +1 -1
- package/dist/cli/{chunk-ZH23XGJO.js → chunk-4BSCSQ6I.js} +4 -4
- package/dist/cli/{chunk-7QX5PCHP.mjs → chunk-4UEXAMDU.mjs} +2 -2
- package/dist/cli/{chunk-3EOET5UB.js → chunk-5XGLDVSD.js} +100 -100
- package/dist/cli/{chunk-MRSYC74T.js → chunk-7XXJJVSI.js} +5 -5
- package/dist/cli/{chunk-NJGXYYHN.js → chunk-7ZCD7OPO.js} +5 -5
- package/dist/cli/{chunk-JF4DUC2F.mjs → chunk-AJJSKKH4.mjs} +2 -2
- package/dist/cli/{chunk-XYQMOXP4.mjs → chunk-BHF5UW34.mjs} +1 -1
- package/dist/cli/{chunk-POYADK77.js → chunk-BO2TXH5Y.js} +20 -20
- package/dist/cli/{chunk-RNZXMOA6.mjs → chunk-BUC2TNF2.mjs} +2 -2
- package/dist/cli/{chunk-EGH4JNJP.js → chunk-BUUAFSSN.js} +68 -50
- package/dist/cli/{chunk-GZBXN56A.js → chunk-C45E47KC.js} +23 -23
- package/dist/cli/{chunk-HP6A3JCX.js → chunk-D4R3AL4F.js} +5 -5
- package/dist/cli/{chunk-ABJZQHON.mjs → chunk-DAZRIAXW.mjs} +4 -4
- package/dist/cli/{chunk-SKKRESFB.js → chunk-DNOZQGJF.js} +3 -3
- package/dist/cli/{chunk-DPLYQITT.js → chunk-DUL6UQ2T.js} +2 -2
- package/dist/cli/{chunk-U2QQQNWW.mjs → chunk-ES3S6UXR.mjs} +2 -2
- package/dist/cli/{chunk-4TTEAUZV.mjs → chunk-FDAYUP3M.mjs} +3 -3
- package/dist/cli/{chunk-V54YQHPV.js → chunk-FEVUIT2U.js} +6 -6
- package/dist/cli/{chunk-KDITCSPN.mjs → chunk-FSPEUU3V.mjs} +68 -6
- package/dist/cli/{chunk-OUFOJTEJ.mjs → chunk-FZZMCVOS.mjs} +5 -5
- package/dist/cli/{chunk-ISN4F6AY.js → chunk-GHOB72U6.js} +13 -13
- package/dist/cli/{chunk-LHA45DNY.mjs → chunk-GLYWRTEL.mjs} +3 -3
- package/dist/cli/{chunk-LDMCTV2Z.mjs → chunk-HNTIGYRT.mjs} +1 -1
- package/dist/cli/{chunk-EB2YLLZJ.js → chunk-IGPHYKEJ.js} +41 -41
- package/dist/cli/{chunk-VA35T3AF.js → chunk-ISSYN3DJ.js} +20 -20
- package/dist/cli/{chunk-DSHIB2XQ.mjs → chunk-JKQPITEE.mjs} +54 -36
- package/dist/cli/{chunk-ZARGHLZZ.mjs → chunk-KMLACXI2.mjs} +7 -3
- package/dist/cli/{chunk-DI5MULNX.js → chunk-KQXACHYA.js} +26 -26
- package/dist/cli/{chunk-CPZL6Z7D.js → chunk-LW2GKYZW.js} +2 -2
- package/dist/cli/{chunk-G5YU6RJ4.mjs → chunk-O2KSPI2M.mjs} +2 -2
- package/dist/cli/{chunk-H3KVMALU.js → chunk-O6GT6JD7.js} +9 -9
- package/dist/cli/{chunk-4ZAWRCB6.mjs → chunk-OCXWUWUI.mjs} +5 -5
- package/dist/cli/{chunk-YPP436NM.js → chunk-QKRDAJ3T.js} +53 -53
- package/dist/cli/{chunk-KQEW3EAU.js → chunk-QQESWF6D.js} +16 -16
- package/dist/cli/{chunk-CYZSHD66.js → chunk-REX5SUYU.js} +2 -2
- package/dist/cli/{chunk-Z3IAEHID.js → chunk-RXIQWG2N.js} +48 -48
- package/dist/cli/{chunk-5436ZJPH.js → chunk-S33BN7GZ.js} +3 -3
- package/dist/cli/{chunk-JD7P73ZW.mjs → chunk-SGRJJLNV.mjs} +1 -1
- package/dist/cli/{chunk-2K6EIL2D.mjs → chunk-TCNYSNVU.mjs} +1 -1
- package/dist/cli/{chunk-I5J6HGVR.mjs → chunk-TFPMVSGK.mjs} +2 -2
- package/dist/cli/{chunk-6NEMTKTA.mjs → chunk-V73WDQEA.mjs} +5 -5
- package/dist/cli/{chunk-Y36SQMSN.js → chunk-VYERVFGB.js} +68 -6
- package/dist/cli/{chunk-SYWLWTWM.mjs → chunk-WBRSVML3.mjs} +4 -4
- package/dist/cli/{chunk-NVHICORD.mjs → chunk-WW52ANX4.mjs} +2 -2
- package/dist/cli/{chunk-3HIJNXRB.js → chunk-XZS35M3Y.js} +10 -10
- package/dist/cli/{chunk-ZL3O7F5J.js → chunk-YNYHYL5C.js} +15 -15
- package/dist/cli/{chunk-FWB3QR7W.mjs → chunk-ZHE5E2WJ.mjs} +1 -1
- package/dist/cli/{chunk-D7J33HTK.mjs → chunk-ZJ2H77VV.mjs} +5 -5
- package/dist/cli/{chunk-JUZIMW4S.js → chunk-ZX6UVPGZ.js} +7 -7
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/concurrent-runs-help-H5SZUA5J.js +22 -0
- package/dist/cli/{concurrent-runs-help-UFNYQYU2.mjs → concurrent-runs-help-IYELSCHB.mjs} +6 -6
- package/dist/cli/{csv-QSDRGLQH.mjs → csv-ENEC3APZ.mjs} +4 -4
- package/dist/cli/{csv-ZI5LYFHF.js → csv-X6CP57R4.js} +13 -13
- package/dist/cli/{db-ZDL6Q53U.js → db-6HLRSE2M.js} +27 -27
- package/dist/cli/{db-WVWXNNMO.mjs → db-YGKRFK4T.mjs} +6 -6
- package/dist/cli/{describe-UUQBKUVL.mjs → describe-4SGQEX7K.mjs} +18 -18
- package/dist/cli/describe-Q2OYHDVZ.js +50 -0
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-SCGHTWTC.js → executions-IC55YJ67.js} +8 -8
- package/dist/cli/{executions-QN3OYJKT.mjs → executions-PO2IOSZ7.mjs} +6 -6
- package/dist/cli/{feedback-7QPHLXGU.mjs → feedback-6BUD5F4I.mjs} +6 -6
- package/dist/cli/{feedback-6QQ7ONLW.js → feedback-BCGQLZ5T.js} +14 -14
- package/dist/cli/git-5X3MLBIP.js +26 -0
- package/dist/cli/{git-HFPJX573.mjs → git-IN4IBL2K.mjs} +5 -5
- package/dist/cli/index.js +148 -148
- package/dist/cli/index.mjs +47 -47
- package/dist/cli/{integrations-ND2HULSH.js → integrations-R2Z2MDO3.js} +29 -29
- package/dist/cli/{integrations-4SZ5O24P.mjs → integrations-ZMGB6NQA.mjs} +7 -7
- package/dist/cli/{legacy-noops-WUP3TBR2.mjs → legacy-noops-GIC5OZKP.mjs} +6 -6
- package/dist/cli/{legacy-noops-GQF6AYP5.js → legacy-noops-X4JPRPTJ.js} +9 -9
- package/dist/cli/{mcp-3GUFYGCQ.mjs → mcp-G4IRJIKK.mjs} +4 -4
- package/dist/cli/{mcp-L3YYVEU6.js → mcp-USZKTVL2.js} +24 -24
- package/dist/cli/{monitors-OFCVJSH5.mjs → monitors-SNFZPSCY.mjs} +7 -7
- package/dist/cli/{monitors-CVZZN5WG.js → monitors-T7LRP7OB.js} +100 -100
- package/dist/cli/{org-MQ5AUN7I.js → org-2L2ZZL2P.js} +121 -121
- package/dist/cli/{org-3DTAYA52.mjs → org-YTXLKW52.mjs} +6 -6
- package/dist/cli/{outcomes-42W24EXG.mjs → outcomes-CJWBIFTA.mjs} +6 -6
- package/dist/cli/{outcomes-MGDUYHUD.js → outcomes-O63F57JF.js} +14 -14
- package/dist/cli/{play-PD45RNYZ.mjs → play-6UWPUHC6.mjs} +331 -70
- package/dist/cli/{play-IMAD7QTV.js → play-T353SULJ.js} +930 -669
- package/dist/cli/{providers-DYKHG7NV.mjs → providers-LZABK2UW.mjs} +6 -6
- package/dist/cli/{providers-WONHPTRG.js → providers-XORJH2VW.js} +9 -9
- package/dist/cli/{quickstart-5QPGHLEX.mjs → quickstart-O4RF7J55.mjs} +4 -4
- package/dist/cli/{quickstart-6AAFULGC.js → quickstart-QBNUNPZR.js} +6 -6
- package/dist/cli/{run-WOW7QO3W.js → run-2CPMFC6W.js} +44 -44
- package/dist/cli/{run-4K6ZU7H7.mjs → run-GBRPFC6P.mjs} +23 -23
- package/dist/cli/{search-CKVFWVXQ.mjs → search-G7TS7OFB.mjs} +7 -7
- package/dist/cli/search-M3AHFCKQ.js +32 -0
- package/dist/cli/{search-output-WWB25JWA.mjs → search-output-BIIJRUCP.mjs} +4 -4
- package/dist/cli/{search-output-B5QE7ZNK.js → search-output-NRKLNWSD.js} +6 -6
- package/dist/cli/{secrets-SVZB6TSW.mjs → secrets-DN3XEZNH.mjs} +6 -6
- package/dist/cli/{secrets-WKIMR346.js → secrets-FUXYSEL5.js} +15 -15
- package/dist/cli/{sessions-P3QENG6T.mjs → sessions-PMUTPCTT.mjs} +6 -6
- package/dist/cli/sessions-VMBMBGVJ.js +23 -0
- package/dist/cli/{settings-V5ABL6D2.mjs → settings-N6GNS2KA.mjs} +12 -12
- package/dist/cli/{settings-UIFRGJW3.js → settings-ZDTWCQ6B.js} +85 -85
- package/dist/cli/{setup-E67NJTEF.mjs → setup-LJ3KWPSA.mjs} +9 -9
- package/dist/cli/{setup-A5MIJU3S.js → setup-PN5TSSJE.js} +49 -49
- package/dist/cli/{skills-WLHOQ4DO.mjs → skills-7J42K6VC.mjs} +7 -7
- package/dist/cli/skills-CXDENBLF.js +37 -0
- package/dist/cli/{tools-EG4KL3BB.mjs → tools-M3S6D6DA.mjs} +17 -17
- package/dist/cli/tools-WY2GMOC7.js +57 -0
- package/dist/cli/{update-IPFBE6SA.mjs → update-XTVFG74E.mjs} +9 -9
- package/dist/cli/update-ZB2IBGXG.js +37 -0
- package/dist/cli/{views-ZIBY2RVB.js → views-B4X2FWTF.js} +21 -21
- package/dist/cli/{views-XDN6SEWY.mjs → views-UFYRDO4X.mjs} +6 -6
- package/dist/cli/{workflow-BLKPBRBT.js → workflow-I2RM2J2J.js} +53 -29
- package/dist/cli/{workflow-O2XPMOVL.mjs → workflow-ZLMS3PDE.mjs} +42 -18
- package/dist/{client-QznpkWrk.d.ts → client-2QWMJInp.d.ts} +1 -1
- package/dist/{client-CmG8MT0x.d.mts → client-7H8TXmLa.d.mts} +1 -1
- package/dist/{client-core-CY0jNW0e.d.mts → client-core-BraEuxbg.d.mts} +67 -4
- package/dist/{client-core-CXDqfeiB.d.ts → client-core-DRglY5xa.d.ts} +67 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +125 -120
- package/dist/plays/bundle-play-file.mjs +5 -0
- 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/release.d.mts +3 -3
- package/dist/release.d.ts +3 -3
- 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 +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-ALBG5LF4.js +0 -44
- package/dist/cli/concurrent-runs-help-E3YMAO5Q.js +0 -22
- package/dist/cli/describe-QB5T47B3.js +0 -50
- package/dist/cli/git-4FXTWHXT.js +0 -26
- package/dist/cli/search-YZIJS7QU.js +0 -32
- package/dist/cli/sessions-VQPGPXMU.js +0 -23
- package/dist/cli/skills-GTBK33MV.js +0 -37
- package/dist/cli/tools-GPAIPRPQ.js +0 -57
- package/dist/cli/update-QLWS32WR.js +0 -37
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a Play's source carries a diagram that counts, and the diagnostic an
|
|
3
|
+
* author gets when it does not.
|
|
4
|
+
*
|
|
5
|
+
* A run records a step's `in:`/`out:` values only for steps a `@mermaid`
|
|
6
|
+
* diagram binds, so source admission (check, publish, save, deploy-on-push,
|
|
7
|
+
* MCP publish) requires a diagram that compiles and binds at least one step,
|
|
8
|
+
* or the explicit `/** @mermaid off: <reason> *\/` opt-out. `in:`/`out:` stay
|
|
9
|
+
* optional (warnings). Launch never asks, a local `plays run --file` only
|
|
10
|
+
* warns, a trigger edit is exempt. Callers decide the seam and the gate
|
|
11
|
+
* (`apps/deepline-api/src/lib/plays/diagram-requirement.ts`); this module
|
|
12
|
+
* decides what the source says and what the author reads, so `plays check`,
|
|
13
|
+
* the publish route, MCP and the dashboard print the same words.
|
|
14
|
+
*/
|
|
15
|
+
import {
|
|
16
|
+
findUnreadDocflowBlocks,
|
|
17
|
+
parsePlayDocflow,
|
|
18
|
+
parsePlayDocflowFile,
|
|
19
|
+
readPlayDiagramOptOut,
|
|
20
|
+
} from './docflow';
|
|
21
|
+
import {
|
|
22
|
+
PLAY_DIAGRAM_OPT_OUT_BLOCK,
|
|
23
|
+
PLAY_DIAGRAM_OPT_OUT_CODE,
|
|
24
|
+
PLAY_DIAGRAM_OPT_OUT_FORM,
|
|
25
|
+
PLAY_DIAGRAM_RULE_CODES,
|
|
26
|
+
} from './docflow-rule-codes';
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
PLAY_DIAGRAM_OPT_OUT_BLOCK,
|
|
30
|
+
PLAY_DIAGRAM_OPT_OUT_CODE,
|
|
31
|
+
PLAY_DIAGRAM_OPT_OUT_FORM,
|
|
32
|
+
PLAY_DIAGRAM_RULE_CODES,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type PlayDiagramStatus =
|
|
36
|
+
/** A diagram for this export compiles and binds at least one step. */
|
|
37
|
+
| { kind: 'present' }
|
|
38
|
+
| { kind: 'opted_out'; line: number; reason: string }
|
|
39
|
+
| { kind: 'invalid_opt_out'; line: number }
|
|
40
|
+
/** A `@mermaid` block was written but does not compile, or is not read. */
|
|
41
|
+
| { kind: 'broken'; problems: string[]; line?: number }
|
|
42
|
+
/** The diagram compiles but no `// @mermaid-node` binds a step. */
|
|
43
|
+
| { kind: 'unbound' }
|
|
44
|
+
/** The file's diagrams describe other exports, not this one. */
|
|
45
|
+
| { kind: 'other_exports'; exports: string[] }
|
|
46
|
+
| { kind: 'missing' };
|
|
47
|
+
|
|
48
|
+
/** Problems shown per broken diagram; the rest are in check's other issues. */
|
|
49
|
+
const MAX_PROBLEMS = 3;
|
|
50
|
+
|
|
51
|
+
export function playDiagramStatus(
|
|
52
|
+
sourceCode: string,
|
|
53
|
+
options: {
|
|
54
|
+
exportName?: string | null;
|
|
55
|
+
/** Imported modules, whose annotations can bind the diagram's boxes. */
|
|
56
|
+
moduleSources?: ReadonlyMap<string, string> | null;
|
|
57
|
+
} = {},
|
|
58
|
+
): PlayDiagramStatus {
|
|
59
|
+
const own = parsePlayDocflow(sourceCode, {
|
|
60
|
+
exportName: options.exportName?.trim() || undefined,
|
|
61
|
+
moduleSources: options.moduleSources ?? undefined,
|
|
62
|
+
});
|
|
63
|
+
if (own.docflow && own.docflow.bindings.length > 0) {
|
|
64
|
+
return { kind: 'present' };
|
|
65
|
+
}
|
|
66
|
+
const optOut = readPlayDiagramOptOut(sourceCode);
|
|
67
|
+
if (optOut) {
|
|
68
|
+
return optOut.reason
|
|
69
|
+
? { kind: 'opted_out', line: optOut.line, reason: optOut.reason }
|
|
70
|
+
: { kind: 'invalid_opt_out', line: optOut.line };
|
|
71
|
+
}
|
|
72
|
+
if (own.docflow) return { kind: 'unbound' };
|
|
73
|
+
const unread = findUnreadDocflowBlocks(sourceCode);
|
|
74
|
+
if (unread.length > 0) {
|
|
75
|
+
return {
|
|
76
|
+
kind: 'broken',
|
|
77
|
+
problems: unread
|
|
78
|
+
.slice(0, MAX_PROBLEMS)
|
|
79
|
+
.map((block) => `line ${block.line}: ${block.reason}`),
|
|
80
|
+
line: unread[0]!.line,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (own.unreadReason || own.errors.length > 0) {
|
|
84
|
+
const problems = own.unreadReason
|
|
85
|
+
? [own.unreadReason]
|
|
86
|
+
: own.errors.slice(0, MAX_PROBLEMS);
|
|
87
|
+
const line = /\(line (\d+)\)$/.exec(problems[0] ?? '')?.[1];
|
|
88
|
+
return {
|
|
89
|
+
kind: 'broken',
|
|
90
|
+
problems,
|
|
91
|
+
...(line ? { line: Number(line) } : {}),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
const otherExports = parsePlayDocflowFile(sourceCode).blocks.map(
|
|
95
|
+
(block) => block.exportName,
|
|
96
|
+
);
|
|
97
|
+
if (otherExports.length > 0) {
|
|
98
|
+
return { kind: 'other_exports', exports: otherExports };
|
|
99
|
+
}
|
|
100
|
+
return { kind: 'missing' };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* How a seam treats a Play whose diagram does not count.
|
|
105
|
+
*
|
|
106
|
+
* - `require`: an error. Publishing is refused.
|
|
107
|
+
* - `recommend`: a warning that the requirement starts on
|
|
108
|
+
* {@link PLAY_DIAGRAM_REQUIRED_FROM_LABEL} (a client the requirement does
|
|
109
|
+
* not reach yet: an older CLI, or any surface before that date).
|
|
110
|
+
* - `recommend_run`: a warning on a run that never publishes (`plays run
|
|
111
|
+
* --file`, an inline MCP run) for a client the requirement already reaches:
|
|
112
|
+
* running is allowed, publishing is refused.
|
|
113
|
+
*/
|
|
114
|
+
export type PlayDiagramRequirement = 'require' | 'recommend' | 'recommend_run';
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* From this instant every surface that is not a versioned CLI (dashboard
|
|
118
|
+
* save, API, MCP publish, deploy-on-push) refuses a Play without a diagram.
|
|
119
|
+
* A code constant, never an env var or rollout.
|
|
120
|
+
*/
|
|
121
|
+
export const PLAY_DIAGRAM_REQUIRED_FROM = new Date('2026-12-15T00:00:00Z');
|
|
122
|
+
export const PLAY_DIAGRAM_REQUIRED_FROM_LABEL = '15 Dec 2026';
|
|
123
|
+
|
|
124
|
+
export type PlayDiagramRequirementIssue = {
|
|
125
|
+
code:
|
|
126
|
+
| 'docflow_visualization_missing'
|
|
127
|
+
| 'docflow_diagram_disabled'
|
|
128
|
+
| 'docflow_diagram_opt_out_invalid';
|
|
129
|
+
severity: 'error' | 'warning';
|
|
130
|
+
message: string;
|
|
131
|
+
path: 'docflow';
|
|
132
|
+
hint: string;
|
|
133
|
+
fix?: string;
|
|
134
|
+
line?: number;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
/** A whole two-step diagram an author can paste and adapt. */
|
|
139
|
+
export const PLAY_DIAGRAM_EXAMPLE = [
|
|
140
|
+
'/** @mermaid',
|
|
141
|
+
' * flowchart TD',
|
|
142
|
+
' * lookup["Look up the company"] --> score["Score the fit"]',
|
|
143
|
+
' */',
|
|
144
|
+
"import deepline from 'deepline';",
|
|
145
|
+
'',
|
|
146
|
+
'export default async function (input: { domain: string }) {',
|
|
147
|
+
' // @mermaid-node lookup in:"input.domain" out:"company"',
|
|
148
|
+
' const company = await findCompany(input.domain);',
|
|
149
|
+
' // @mermaid-node score in:"company" out:"score"',
|
|
150
|
+
' const score = scoreFit(company);',
|
|
151
|
+
' return { score };',
|
|
152
|
+
'}',
|
|
153
|
+
].join('\n');
|
|
154
|
+
|
|
155
|
+
const WHY =
|
|
156
|
+
'A run records what each step read and produced only for steps a diagram binds, so without one its runs record no per-step values.';
|
|
157
|
+
|
|
158
|
+
/** The fix, in the order an author should try it. */
|
|
159
|
+
const HOW_TO_FIX = [
|
|
160
|
+
'Add a `/** @mermaid … */` flowchart above the imports and put `// @mermaid-node <id> in:"…" out:"…"` on the line above each step it draws, naming what the step reads and produces, as in the example below.',
|
|
161
|
+
'See `deepline plays check --help` (Diagram) and docs/play-syntax-spec.md, "Flow diagrams".',
|
|
162
|
+
].join(' ');
|
|
163
|
+
|
|
164
|
+
function consequence(requirement: PlayDiagramRequirement): string {
|
|
165
|
+
switch (requirement) {
|
|
166
|
+
case 'require':
|
|
167
|
+
return 'A diagram is required to publish: add a `@mermaid` diagram (see `deepline plays check --help`).';
|
|
168
|
+
case 'recommend_run':
|
|
169
|
+
return 'Running it is allowed; publishing it is refused until it has one: add a `@mermaid` diagram (see `deepline plays check --help`).';
|
|
170
|
+
case 'recommend':
|
|
171
|
+
return `A diagram is required from ${PLAY_DIAGRAM_REQUIRED_FROM_LABEL} — add a \`@mermaid\` diagram (see \`deepline plays check --help\`).`;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* The issues a diagram status raises at source admission. Empty when the
|
|
177
|
+
* source has a diagram that counts.
|
|
178
|
+
*/
|
|
179
|
+
export function playDiagramRequirementIssues(
|
|
180
|
+
status: PlayDiagramStatus,
|
|
181
|
+
options: {
|
|
182
|
+
requirement: PlayDiagramRequirement;
|
|
183
|
+
exportName?: string | null;
|
|
184
|
+
},
|
|
185
|
+
): PlayDiagramRequirementIssue[] {
|
|
186
|
+
const severity = options.requirement === 'require' ? 'error' : 'warning';
|
|
187
|
+
const then = consequence(options.requirement);
|
|
188
|
+
const missing = (
|
|
189
|
+
what: string,
|
|
190
|
+
line?: number,
|
|
191
|
+
): PlayDiagramRequirementIssue => ({
|
|
192
|
+
code: 'docflow_visualization_missing',
|
|
193
|
+
severity,
|
|
194
|
+
message: `${what} ${WHY} ${then}`,
|
|
195
|
+
path: 'docflow',
|
|
196
|
+
hint: HOW_TO_FIX,
|
|
197
|
+
fix: PLAY_DIAGRAM_EXAMPLE,
|
|
198
|
+
...(line === undefined ? {} : { line }),
|
|
199
|
+
});
|
|
200
|
+
switch (status.kind) {
|
|
201
|
+
case 'present':
|
|
202
|
+
return [];
|
|
203
|
+
case 'opted_out':
|
|
204
|
+
return [
|
|
205
|
+
{
|
|
206
|
+
code: 'docflow_diagram_disabled',
|
|
207
|
+
severity: 'warning',
|
|
208
|
+
message: `Diagram disabled: runs record no per-step values (not recommended). Reason given on line ${status.line}: ${status.reason}`,
|
|
209
|
+
path: 'docflow',
|
|
210
|
+
hint: 'Replace the `@mermaid off` line with a diagram so runs show what each step read and produced, as in the example below. See `deepline plays check --help` (Diagram).',
|
|
211
|
+
fix: PLAY_DIAGRAM_EXAMPLE,
|
|
212
|
+
line: status.line,
|
|
213
|
+
},
|
|
214
|
+
];
|
|
215
|
+
case 'invalid_opt_out':
|
|
216
|
+
return [
|
|
217
|
+
{
|
|
218
|
+
code: 'docflow_diagram_opt_out_invalid',
|
|
219
|
+
// An error wherever the requirement applies; a client it does not
|
|
220
|
+
// reach yet (an older CLI) is warned, never refused.
|
|
221
|
+
severity,
|
|
222
|
+
message: `\`@mermaid off\` on line ${status.line} gives no reason. The opt-out is accepted only in this form, with a reason after the colon: \`${PLAY_DIAGRAM_OPT_OUT_FORM}\`.`,
|
|
223
|
+
path: 'docflow',
|
|
224
|
+
hint: 'Write why this Play has no diagram after the colon (not recommended: its runs record no per-step values), or replace the line with a diagram (see `deepline plays check --help`).',
|
|
225
|
+
fix: '/** @mermaid off: one tool call; nothing worth drawing */',
|
|
226
|
+
line: status.line,
|
|
227
|
+
},
|
|
228
|
+
];
|
|
229
|
+
case 'broken':
|
|
230
|
+
return [
|
|
231
|
+
missing(
|
|
232
|
+
`This play's \`@mermaid\` diagram does not count: it does not compile (${status.problems.join('; ')}).`,
|
|
233
|
+
status.line,
|
|
234
|
+
),
|
|
235
|
+
];
|
|
236
|
+
case 'unbound':
|
|
237
|
+
return [
|
|
238
|
+
missing(
|
|
239
|
+
"This play's `@mermaid` diagram does not count: no `// @mermaid-node <id>` line binds any of its boxes to a step.",
|
|
240
|
+
),
|
|
241
|
+
];
|
|
242
|
+
case 'other_exports':
|
|
243
|
+
return [
|
|
244
|
+
missing(
|
|
245
|
+
`This file's \`@mermaid\` diagram${status.exports.length === 1 ? ' describes export' : 's describe exports'} ${status.exports.map((name) => `\`${name}\``).join(', ')}, not \`${options.exportName?.trim() || 'default'}\`, so this play has no diagram of its own (name it in the block header, \`/** @mermaid <export>\`).`,
|
|
246
|
+
),
|
|
247
|
+
];
|
|
248
|
+
case 'missing':
|
|
249
|
+
return [missing('This play has no `@mermaid` diagram.')];
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* One diagram issue as plain text: what is wrong, then the fix, then the
|
|
255
|
+
* lines to paste. For surfaces that print text rather than issues (an older
|
|
256
|
+
* CLI reading `errors`, an MCP failure, the dashboard editor).
|
|
257
|
+
*/
|
|
258
|
+
export function renderPlayDiagramIssueText(issue: {
|
|
259
|
+
message: string;
|
|
260
|
+
hint?: string;
|
|
261
|
+
fix?: string;
|
|
262
|
+
line?: number;
|
|
263
|
+
}): string {
|
|
264
|
+
return [
|
|
265
|
+
`${issue.line ? `line ${issue.line}: ` : ''}${issue.message}`,
|
|
266
|
+
issue.hint ? `Fix: ${issue.hint}` : undefined,
|
|
267
|
+
issue.fix,
|
|
268
|
+
]
|
|
269
|
+
.filter(Boolean)
|
|
270
|
+
.join('\n');
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* A refusal for the diagram as one text, in `plays check`'s order: the
|
|
275
|
+
* headline, each issue with its fix, then the opt-out offer last. Null when
|
|
276
|
+
* no diagram rule refused. For surfaces that print text (MCP, the dashboard
|
|
277
|
+
* editor, an older CLI).
|
|
278
|
+
*/
|
|
279
|
+
export function renderPlayDiagramRefusalText(
|
|
280
|
+
issues: ReadonlyArray<Record<string, unknown>>,
|
|
281
|
+
playName?: string | null,
|
|
282
|
+
): string | null {
|
|
283
|
+
const refused = issues.filter(
|
|
284
|
+
(issue) =>
|
|
285
|
+
issue.severity === 'error' &&
|
|
286
|
+
typeof issue.message === 'string' &&
|
|
287
|
+
(PLAY_DIAGRAM_RULE_CODES.has(String(issue.code)) ||
|
|
288
|
+
issue.code === 'docflow_diagram_opt_out_invalid'),
|
|
289
|
+
);
|
|
290
|
+
if (refused.length === 0) return null;
|
|
291
|
+
const what = refused.some(
|
|
292
|
+
(issue) => issue.code === 'docflow_visualization_missing',
|
|
293
|
+
)
|
|
294
|
+
? 'missing diagram'
|
|
295
|
+
: `diagram incomplete: ${refused.length} ${refused.length === 1 ? 'issue' : 'issues'}`;
|
|
296
|
+
const offer = issues.find(
|
|
297
|
+
(issue) => issue.code === PLAY_DIAGRAM_OPT_OUT_CODE,
|
|
298
|
+
);
|
|
299
|
+
return [
|
|
300
|
+
`✗ ${playName ?? 'play'} — ${what} (required)`,
|
|
301
|
+
...refused.map((issue) =>
|
|
302
|
+
renderPlayDiagramIssueText({
|
|
303
|
+
message: issue.message as string,
|
|
304
|
+
hint: typeof issue.hint === 'string' ? issue.hint : undefined,
|
|
305
|
+
fix: typeof issue.fix === 'string' ? issue.fix : undefined,
|
|
306
|
+
line: typeof issue.line === 'number' ? issue.line : undefined,
|
|
307
|
+
}),
|
|
308
|
+
),
|
|
309
|
+
...(offer && typeof offer.message === 'string' ? [offer.message] : []),
|
|
310
|
+
].join('\n\n');
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const DIAGRAM_REQUIREMENT_CODES: ReadonlySet<string> = new Set([
|
|
314
|
+
'docflow_visualization_missing',
|
|
315
|
+
'docflow_diagram_disabled',
|
|
316
|
+
'docflow_diagram_opt_out_invalid',
|
|
317
|
+
]);
|
|
318
|
+
|
|
319
|
+
/** Whether `code` is one this module raises. */
|
|
320
|
+
export function isPlayDiagramRequirementCode(code: unknown): boolean {
|
|
321
|
+
return typeof code === 'string' && DIAGRAM_REQUIREMENT_CODES.has(code);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** The severity a diagram issue gets under `requirement`. */
|
|
325
|
+
export function playDiagramIssueSeverity(
|
|
326
|
+
code: string,
|
|
327
|
+
requirement: PlayDiagramRequirement,
|
|
328
|
+
): 'error' | 'warning' {
|
|
329
|
+
return PLAY_DIAGRAM_RULE_CODES.has(code) && requirement === 'require'
|
|
330
|
+
? 'error'
|
|
331
|
+
: 'warning';
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export function playDiagramOptOutIssue(): {
|
|
335
|
+
code: typeof PLAY_DIAGRAM_OPT_OUT_CODE;
|
|
336
|
+
severity: 'warning';
|
|
337
|
+
message: string;
|
|
338
|
+
path: 'docflow';
|
|
339
|
+
} {
|
|
340
|
+
return {
|
|
341
|
+
code: PLAY_DIAGRAM_OPT_OUT_CODE,
|
|
342
|
+
severity: 'warning',
|
|
343
|
+
message: PLAY_DIAGRAM_OPT_OUT_BLOCK,
|
|
344
|
+
path: 'docflow',
|
|
345
|
+
};
|
|
346
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The diagram requirement's issue codes, dependency-free so the SDK CLI can
|
|
3
|
+
* lay out `plays check` output without loading the diagram parser.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Diagram rules the requirement enforces: the diagram exists, compiles and
|
|
8
|
+
* binds every box (`docflow_compile_error`), each marker names what its
|
|
9
|
+
* statement produces (`docflow_io_missing`) and the local values it reads
|
|
10
|
+
* (`docflow_inputs_undeclared`), and what it records is the value
|
|
11
|
+
* (`docflow_output_records_empty`). They take the requirement's severity;
|
|
12
|
+
* every other diagram issue stays a warning, `docflow_output_is_tool_result`
|
|
13
|
+
* among them: a tool result records the fields its tool declares, so only a
|
|
14
|
+
* tool that declares none records `{}`, which check cannot tell from source.
|
|
15
|
+
*/
|
|
16
|
+
export const PLAY_DIAGRAM_RULE_CODES: ReadonlySet<string> = new Set([
|
|
17
|
+
'docflow_visualization_missing',
|
|
18
|
+
'docflow_compile_error',
|
|
19
|
+
'docflow_io_missing',
|
|
20
|
+
'docflow_inputs_undeclared',
|
|
21
|
+
'docflow_output_records_empty',
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
/** The opt-out offer: one per check, printed last. */
|
|
25
|
+
export const PLAY_DIAGRAM_OPT_OUT_CODE = 'play_diagram_opt_out_available';
|
|
26
|
+
|
|
27
|
+
/** The exact accepted opt-out, as an author pastes it. */
|
|
28
|
+
export const PLAY_DIAGRAM_OPT_OUT_FORM =
|
|
29
|
+
'/** @mermaid off: <why this Play has no diagram> */';
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Shown once, last, whenever a diagram rule is not met: the way out, marked
|
|
33
|
+
* as the last resort it is.
|
|
34
|
+
*/
|
|
35
|
+
export const PLAY_DIAGRAM_OPT_OUT_BLOCK = [
|
|
36
|
+
"Can't add a diagram to this Play? Opt out by adding this line at the top of the file (not recommended — its runs will record no per-step values):",
|
|
37
|
+
` ${PLAY_DIAGRAM_OPT_OUT_FORM}`,
|
|
38
|
+
].join('\n');
|
|
@@ -94,6 +94,14 @@ export type DocflowUnreachedReason =
|
|
|
94
94
|
* of lie as calling it "Queued".
|
|
95
95
|
*/
|
|
96
96
|
| { kind: 'not_recorded' }
|
|
97
|
+
/**
|
|
98
|
+
* A code step bound to its own statement, on a run that records its bound
|
|
99
|
+
* steps (another bound step left state), with the step after it run, and
|
|
100
|
+
* nothing from this one: the statement never executed — a loop with
|
|
101
|
+
* nothing to do, an `if` not taken. Unlike `not_recorded`, an absent record
|
|
102
|
+
* here IS an absent event, because a bound statement records when it runs.
|
|
103
|
+
*/
|
|
104
|
+
| { kind: 'not_run' }
|
|
97
105
|
/**
|
|
98
106
|
* The run reached the frontier, went on past it by some other path, and never
|
|
99
107
|
* came through here. Not a branch (the frontier is no decision) and not a
|
|
@@ -300,6 +308,34 @@ function decidedByValue(
|
|
|
300
308
|
* Priority tier?" is false: the run completed. So a stop is only ever claimed
|
|
301
309
|
* when nothing downstream of the frontier ran either.
|
|
302
310
|
*/
|
|
311
|
+
/**
|
|
312
|
+
* A code step bound to its own statement, on a run whose other bound code
|
|
313
|
+
* steps recorded state: such a statement records whenever it runs, so its
|
|
314
|
+
* silence means it did not run. Datasets, Play calls and unbound boxes are
|
|
315
|
+
* never judged this way — they can run without a record of their own.
|
|
316
|
+
*/
|
|
317
|
+
function boundStatementSkipped(
|
|
318
|
+
docflow: PlayDocflow,
|
|
319
|
+
nodeStates: readonly DocflowReasonNodeState[],
|
|
320
|
+
nodeId: string,
|
|
321
|
+
): boolean {
|
|
322
|
+
const bound = new Set(
|
|
323
|
+
(docflow.bindings ?? []).map((binding) => binding.nodeId),
|
|
324
|
+
);
|
|
325
|
+
const actions = new Set(
|
|
326
|
+
docflow.nodes
|
|
327
|
+
.filter((node) => node.kind === 'action' && bound.has(node.id))
|
|
328
|
+
.map((node) => node.id),
|
|
329
|
+
);
|
|
330
|
+
if (!actions.has(nodeId)) return false;
|
|
331
|
+
return nodeStates.some(
|
|
332
|
+
(state) =>
|
|
333
|
+
state.nodeId !== nodeId &&
|
|
334
|
+
actions.has(state.nodeId.replace(/^docflow:/, '')) &&
|
|
335
|
+
(state.status === 'completed' || state.status === 'failed'),
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
303
339
|
export function deriveDocflowUnreachedReason(input: {
|
|
304
340
|
docflow: PlayDocflow;
|
|
305
341
|
nodeStates: readonly DocflowReasonNodeState[];
|
|
@@ -345,7 +381,8 @@ export function deriveDocflowUnreachedReason(input: {
|
|
|
345
381
|
const recorded = stateFor(nodeStates, reachedId)?.nodeIo?.decision;
|
|
346
382
|
const taken = recorded
|
|
347
383
|
? outgoing.find(
|
|
348
|
-
(edge) =>
|
|
384
|
+
(edge) =>
|
|
385
|
+
edge.to === recorded.to && edge.label?.trim() === recorded.arm,
|
|
349
386
|
)
|
|
350
387
|
: outgoing.find((edge) => graph.reached.has(edge.to));
|
|
351
388
|
const skipped = outgoing.find((edge) => edge.to === skippedId);
|
|
@@ -397,7 +434,9 @@ export function deriveDocflowUnreachedReason(input: {
|
|
|
397
434
|
(predecessor) => predecessor !== nodeId && graph.reached.has(predecessor),
|
|
398
435
|
);
|
|
399
436
|
if (otherWayIn) continue;
|
|
400
|
-
return
|
|
437
|
+
return boundStatementSkipped(docflow, nodeStates, nodeId)
|
|
438
|
+
? { kind: 'not_run' }
|
|
439
|
+
: { kind: 'not_recorded' };
|
|
401
440
|
}
|
|
402
441
|
|
|
403
442
|
// 4b. A loop region whose per-row work is not instrumented per member: NO
|
|
@@ -610,6 +649,7 @@ export function docflowUnreachedVerdict(input: {
|
|
|
610
649
|
return null;
|
|
611
650
|
case 'branch_not_taken':
|
|
612
651
|
case 'skipped_by_run':
|
|
652
|
+
case 'not_run':
|
|
613
653
|
return 'skipped';
|
|
614
654
|
case 'row_grain_branch':
|
|
615
655
|
case 'not_recorded':
|