@testmuai/kane-cli 0.6.9 → 0.6.11
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/ChatSurface-TZ554O4U.js +8 -0
- package/dist/{ChromeProfilePicker-FSZB4SZR.js → ChromeProfilePicker-54CAJDUF.js} +1 -1
- package/dist/{CliFeedbackPrompt-WNMDCIHZ.js → CliFeedbackPrompt-TCAH4AHL.js} +1 -1
- package/dist/{CliUploadProgress-H4265KXU.js → CliUploadProgress-UURZ63VQ.js} +1 -1
- package/dist/{ConfigView-XCUZ44SP.js → ConfigView-5QGB7MUS.js} +1 -1
- package/dist/EvidenceViewOffer-SSAM4RRP.js +2 -0
- package/dist/{FolderPicker-S2XVCPYN.js → FolderPicker-Y5MAYFIJ.js} +1 -1
- package/dist/{HelpView-OPKRGNNM.js → HelpView-S3GJGSCE.js} +1 -1
- package/dist/{InfoBox-TW2PGJK5.js → InfoBox-LYTNNMVJ.js} +1 -1
- package/dist/{LinksBox-66M7XP5Y.js → LinksBox-5MSEKNSV.js} +1 -1
- package/dist/{ProfilesView-T2CFQPR5.js → ProfilesView-LTHE5UIO.js} +1 -1
- package/dist/{ProjectPicker-7ALN52CY.js → ProjectPicker-XMXIGHSE.js} +1 -1
- package/dist/{SaveSessionPrompt-HM3F6QML.js → SaveSessionPrompt-VQDEA4WA.js} +1 -1
- package/dist/SingleShotApp-A6PCNPLM.js +2 -0
- package/dist/{SummaryBox-BQZEGOIV.js → SummaryBox-WWF3G263.js} +1 -1
- package/dist/TestMdRunView-MQ7ZPFN2.js +2 -0
- package/dist/{WhoamiView-722MBPSG.js → WhoamiView-PDURYP7E.js} +1 -1
- package/dist/auth-I4RB4KO3.js +2 -0
- package/dist/bind-QJT726NE.js +6 -0
- package/dist/bootstrap-566PPFCC.js +2 -0
- package/dist/{bridge-V4FF5QPK.js → bridge-QCMEOQDD.js} +1 -1
- package/dist/{changelog-KMYZW5MI.js → changelog-OKYH4F7I.js} +1 -1
- package/dist/{chat-committer-MWZ4JQMM.js → chat-committer-OS7ULZMH.js} +1 -1
- package/dist/chat-controller-QLORQWJZ.js +2 -0
- package/dist/{chunk-LRA3V5GY.js → chunk-2WKX3RMA.js} +1 -1
- package/dist/chunk-2XMJ6YAE.js +2 -0
- package/dist/{chunk-FVM7TWKT.js → chunk-3AZTXJY4.js} +1 -1
- package/dist/{chunk-SHAA6FOD.js → chunk-3RZ63RBO.js} +1 -1
- package/dist/{chunk-U5QTE3WX.js → chunk-4CJ55EUY.js} +1 -1
- package/dist/{chunk-T4WZWKIU.js → chunk-54IB6CXK.js} +2 -2
- package/dist/chunk-54VQ46U2.js +14 -0
- package/dist/chunk-55Y65VPA.js +347 -0
- package/dist/chunk-5EOX4MEY.js +2 -0
- package/dist/{chunk-L4JIMNKW.js → chunk-6HYW5RFX.js} +1 -1
- package/dist/{chunk-L3HG5ONB.js → chunk-6W6AIDLJ.js} +1 -1
- package/dist/chunk-73OQDAXF.js +3 -0
- package/dist/{chunk-LEA6IHXC.js → chunk-7E24OCGX.js} +1 -1
- package/dist/{chunk-DKERZJYF.js → chunk-7MRBMDZ5.js} +1 -1
- package/dist/{chunk-345PY4SZ.js → chunk-7NLQ3QQD.js} +1 -1
- package/dist/chunk-7YPK6EDR.js +4 -0
- package/dist/chunk-BKM2LWU2.js +3 -0
- package/dist/{chunk-YY6WPFMT.js → chunk-DSOA6L73.js} +3 -3
- package/dist/{chunk-ZA4GR5R7.js → chunk-EAUUULJQ.js} +1 -1
- package/dist/chunk-EV3EHXEI.js +4 -0
- package/dist/chunk-F7WKDMX7.js +47 -0
- package/dist/{chunk-7Z64BL5D.js → chunk-FCHTL74E.js} +1 -1
- package/dist/chunk-FHKDTM5L.js +6 -0
- package/dist/{chunk-OSALXGD4.js → chunk-FMR2KPSK.js} +1 -1
- package/dist/{chunk-RGDQMKNJ.js → chunk-FRBYGSGJ.js} +1 -1
- package/dist/{chunk-GBYH35H5.js → chunk-FSB3FTIQ.js} +1 -1
- package/dist/{chunk-JHAGEBKE.js → chunk-GIMTSDNC.js} +1 -1
- package/dist/{chunk-FT4G3QGO.js → chunk-GLA6QL3T.js} +1 -1
- package/dist/chunk-H2W2UNTN.js +6 -0
- package/dist/{chunk-7BCZLDNX.js → chunk-HLRLP6TQ.js} +1 -1
- package/dist/{chunk-4FH2KFRT.js → chunk-HMM5FJJO.js} +1 -1
- package/dist/{chunk-TACPTX64.js → chunk-HOQEMPMQ.js} +2 -2
- package/dist/{chunk-MXLXKHW4.js → chunk-ICGHBZFZ.js} +1 -1
- package/dist/{chunk-TFVMSEIA.js → chunk-IQODWB32.js} +1 -1
- package/dist/{chunk-MBXWXBDM.js → chunk-J2KSZUOO.js} +1 -1
- package/dist/chunk-J44RN3FB.js +2 -0
- package/dist/{chunk-O4HWPV67.js → chunk-JXKRO2ZJ.js} +2 -2
- package/dist/{chunk-K5JGCJ2K.js → chunk-K7USHLVZ.js} +4 -4
- package/dist/{chunk-QZJID3OZ.js → chunk-KHJXOFDM.js} +1 -1
- package/dist/chunk-KHQHVSZ6.js +5 -0
- package/dist/{chunk-IWBPV3VS.js → chunk-KSZ72BSC.js} +1 -1
- package/dist/{chunk-QTHITA73.js → chunk-KXUSG5ZI.js} +1 -1
- package/dist/{chunk-DPOES6G3.js → chunk-LHDNJJGE.js} +1 -1
- package/dist/{chunk-P4SE6YON.js → chunk-M5PJQ5Y3.js} +1 -1
- package/dist/{chunk-QM3XF5TW.js → chunk-MFOH7EYR.js} +1 -1
- package/dist/{chunk-EWLLPUP4.js → chunk-MJBCBQC2.js} +1 -1
- package/dist/chunk-MMPFU2YC.js +2 -0
- package/dist/{chunk-RQM3DUSB.js → chunk-MR7CX5VT.js} +1 -1
- package/dist/{chunk-GNNMHYWE.js → chunk-MRP54NCJ.js} +1 -1
- package/dist/chunk-MTNUZEO7.js +12 -0
- package/dist/{chunk-RLICAFFQ.js → chunk-NJAHRITS.js} +1 -1
- package/dist/{chunk-OV2W7KBC.js → chunk-NTGYFYBP.js} +1 -1
- package/dist/{chunk-LMMOR7CR.js → chunk-NTNAHN25.js} +1 -1
- package/dist/{chunk-EASTDHNW.js → chunk-NUQ423YE.js} +1 -1
- package/dist/{chunk-U6TLLYRG.js → chunk-OGWC3J3C.js} +1 -1
- package/dist/chunk-OIYGGEUL.js +6 -0
- package/dist/{chunk-T2ULEJK7.js → chunk-POYZ6SAI.js} +2 -2
- package/dist/chunk-Q2F5QB2W.js +2 -0
- package/dist/{chunk-3YI4QRXF.js → chunk-QJIJC3KC.js} +1 -1
- package/dist/{chunk-G6F2BOFT.js → chunk-RFJAYURU.js} +1 -1
- package/dist/chunk-RGJIRS3B.js +2 -0
- package/dist/{chunk-CLYG26XV.js → chunk-RZJVQUBA.js} +35 -35
- package/dist/{chunk-QB4IOM3X.js → chunk-SURF5Z7Y.js} +1 -1
- package/dist/chunk-TDPWFYTJ.js +2 -0
- package/dist/chunk-V3UE6RJP.js +2 -0
- package/dist/chunk-VOHQA2SP.js +2 -0
- package/dist/{chunk-FFHBQK5N.js → chunk-XSKLH2MC.js} +2 -2
- package/dist/{chunk-OAEZKYYQ.js → chunk-XWSAKVEY.js} +2 -2
- package/dist/{chunk-F42YVALT.js → chunk-XXMNUJX4.js} +1 -1
- package/dist/{chunk-QZNUTCSD.js → chunk-XZRIQ3GF.js} +1 -1
- package/dist/chunk-Y5RNCJAN.js +19 -0
- package/dist/chunk-YSSTGJ7O.js +7 -0
- package/dist/chunk-Z2JSEL3I.js +4 -0
- package/dist/{chunk-R65HNFRB.js → chunk-ZNHXIRCM.js} +9 -9
- package/dist/{chunk-AU7WQ2O5.js → chunk-ZP4S5WGW.js} +1 -1
- package/dist/{chunk-NIKA2V6B.js → chunk-ZPCU6546.js} +1 -1
- package/dist/{config-Z4OS3HEE.js → config-QISRENF5.js} +1 -1
- package/dist/{cover-cmd-L2HSVDLH.js → cover-cmd-SV3I23UM.js} +1 -1
- package/dist/{credentials-TNEVAUHI.js → credentials-OGLK7MPV.js} +1 -1
- package/dist/docx-convert-ZBVQO2LG.js +2 -0
- package/dist/{dossier-ZHSHATVU.js → dossier-KJSJPWOW.js} +1 -1
- package/dist/{evidence-MA3LDBWG.js → evidence-HDD7T7DX.js} +1 -1
- package/dist/evolve-cmd-UE2BIMXK.js +2 -0
- package/dist/exit-manager-MXUD7GQ7.js +2 -0
- package/dist/{explain-VTRHEVUQ.js → explain-EBVIUS2X.js} +1 -1
- package/dist/{explain-cmd-E366QTAD.js → explain-cmd-DBUTPZHA.js} +1 -1
- package/dist/{explain-cmd-327F6ESA.js → explain-cmd-NWIYH5MI.js} +1 -1
- package/dist/extract-bind-6MQYKN3G.js +8 -0
- package/dist/{extract-cmd-LFVMG6UE.js → extract-cmd-2RUIWFZG.js} +1 -1
- package/dist/{gaps-cmd-IAEXXESW.js → gaps-cmd-CKCHH3HQ.js} +1 -1
- package/dist/{generate-headless-TYQRYQKJ.js → generate-headless-TUA3HGRX.js} +2 -2
- package/dist/index.js +67 -65
- package/dist/ingest-FIIO67ZN.js +2 -0
- package/dist/ingest-cmd-CRMY46YC.js +7 -0
- package/dist/interactive-bind-53FCRK34.js +10 -0
- package/dist/{lifecycle-cmd-KZOC4WDW.js → lifecycle-cmd-32LG364Q.js} +1 -1
- package/dist/{list-cmd-6X5U46RD.js → list-cmd-UTZ2PQUK.js} +1 -1
- package/dist/list-commands-F53ZNYOZ.js +2 -0
- package/dist/{logical-ids-RFGWBVML.js → logical-ids-I7B3VJEH.js} +1 -1
- package/dist/login-flow-D7KBR7XR.js +2 -0
- package/dist/{maintenance-cmd-UJG4LPWD.js → maintenance-cmd-BZAGSYGI.js} +1 -1
- package/dist/pdf-convert-S7VYE6AV.js +2 -0
- package/dist/{persist-recorded-session-RAL7UCQT.js → persist-recorded-session-5ZFS5SMZ.js} +1 -1
- package/dist/pipeline-MX3ZR5B3.js +2 -0
- package/dist/readmodel-S5RAQH3F.js +2 -0
- package/dist/reconcile-cmd-4377PWF5.js +2 -0
- package/dist/{recording-banner-MBR3Q7VD.js → recording-banner-ZZUF2MGT.js} +1 -1
- package/dist/{require-project-folder-KE7XOOFN.js → require-project-folder-NQBZFUPF.js} +1 -1
- package/dist/{revert-FRXNIP5R.js → revert-RQJE56HF.js} +1 -1
- package/dist/{review-cmd-XVWPSWU2.js → review-cmd-7LXGYHHQ.js} +1 -1
- package/dist/run-2AIQUJ55.js +2 -0
- package/dist/run-YH5SCBYD.js +2 -0
- package/dist/{run-test-md-ZCAWNP35.js → run-test-md-XOSCYVSS.js} +2 -2
- package/dist/{sessions-cmd-STHKGDX4.js → sessions-cmd-DTQYDZNT.js} +1 -1
- package/dist/{skill-installer-H5DPJJFW.js → skill-installer-VYIIWAK7.js} +1 -1
- package/dist/{spawner-C6B5J73J.js → spawner-7KXVKAD5.js} +1 -1
- package/dist/store-id-EOSGEKVK.js +2 -0
- package/dist/tcg-generate-U6OCCS2E.js +2 -0
- package/dist/testmd-actions-RPALXRZK.js +2 -0
- package/dist/token-refresh-S7CYBZTE.js +2 -0
- package/dist/{validate-basic-VBPGGHES.js → validate-basic-LP3S5PK7.js} +1 -1
- package/dist/{version-check-YPRCQJ7E.js → version-check-XP62HWLJ.js} +1 -1
- package/dist/{view-cmd-G4PGJRQH.js → view-cmd-GQBFCPDL.js} +1 -1
- package/dist/walk-session-YIKHE6PT.js +2 -0
- package/package.json +10 -6
- package/dist/ChatSurface-B2QJYKV4.js +0 -8
- package/dist/EvidenceViewOffer-5TJCRM2T.js +0 -2
- package/dist/SingleShotApp-YQYS6HTB.js +0 -2
- package/dist/TestMdRunView-7CL3PM3J.js +0 -2
- package/dist/bind-HNI5LCNK.js +0 -6
- package/dist/chat-controller-YX5A7R52.js +0 -2
- package/dist/chunk-2Z5MSC23.js +0 -12
- package/dist/chunk-4BAL4OGF.js +0 -7
- package/dist/chunk-4CKZAGBD.js +0 -2
- package/dist/chunk-4GXOBABK.js +0 -4
- package/dist/chunk-E4EHWO3J.js +0 -4
- package/dist/chunk-FXPPQL4D.js +0 -6
- package/dist/chunk-GLS46X7N.js +0 -5
- package/dist/chunk-M5JQXOCE.js +0 -12
- package/dist/chunk-RHNKYNNZ.js +0 -6
- package/dist/chunk-SORKKW7B.js +0 -6
- package/dist/chunk-VCYVSKPM.js +0 -2
- package/dist/chunk-VXLOEM2U.js +0 -347
- package/dist/chunk-XTO236AL.js +0 -14
- package/dist/chunk-XWIN3S7O.js +0 -4
- package/dist/evolve-cmd-DTW4EOXM.js +0 -2
- package/dist/exit-manager-VCSIUYBR.js +0 -2
- package/dist/extract-bind-DZLG4GUE.js +0 -5
- package/dist/ingest-CBQAXVH6.js +0 -2
- package/dist/ingest-cmd-JN6PLDE3.js +0 -3
- package/dist/interactive-bind-QEBWUJCN.js +0 -7
- package/dist/list-commands-BU2MSYRH.js +0 -2
- package/dist/login-flow-4L62GWLT.js +0 -2
- package/dist/pdf-convert-KYXI4FU4.js +0 -2
- package/dist/pipeline-PLI5WQKX.js +0 -2
- package/dist/readmodel-V3DVL6NP.js +0 -2
- package/dist/reconcile-cmd-UXY36ROJ.js +0 -2
- package/dist/run-5DQSL5KH.js +0 -2
- package/dist/run-B7BRNC3X.js +0 -2
- package/dist/tcg-generate-DIMZXAV3.js +0 -2
- package/dist/testmd-actions-X6XCV53D.js +0 -2
- package/dist/token-refresh-7PAPCMQK.js +0 -2
- package/dist/walk-session-GWOP27TX.js +0 -2
package/dist/chunk-VXLOEM2U.js
DELETED
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{c as Fe}from"./chunk-SHAA6FOD.js";import{a as je}from"./chunk-KHU7C6EE.js";import{a as Be,b as Pe}from"./chunk-3C5GMAM4.js";import{a as de,b as Re,c as $e,d as Ce,g as Ae,h as Le}from"./chunk-RQM3DUSB.js";import{a as Te,b as Oe,g as Ne,h as qe}from"./chunk-FXPPQL4D.js";import{a as De}from"./chunk-GG43HSU2.js";import{c as Ee}from"./chunk-OSALXGD4.js";import{a as Ie}from"./chunk-CVOGP253.js";import{b as pe,c as fe,d as he,e as ae,f as ne,g as ie}from"./chunk-ZPDM6FO7.js";import{a as oe}from"./chunk-L5LI2JF4.js";import{a as Y}from"./chunk-LEA6IHXC.js";import{c as ke,n as xe}from"./chunk-L3HG5ONB.js";import{a as ve,b as ce}from"./chunk-L4JIMNKW.js";import{c as we,e as Se}from"./chunk-MBXWXBDM.js";import{d as v,e as E,f as _e,g as be,h as ye}from"./chunk-5YPBPZUR.js";import{mkdirSync as mt,appendFileSync as gt}from"fs";import{randomBytes as pt}from"crypto";import{join as st}from"path";import{existsSync as le,readFileSync as ue,readdirSync as nt}from"fs";import{join as Z}from"path";var Me=`
|
|
3
|
-
version: 1
|
|
4
|
-
techniques:
|
|
5
|
-
- id: eqp
|
|
6
|
-
name: "Equivalence partitioning"
|
|
7
|
-
applies_hint: "any constrained input"
|
|
8
|
-
emits: [absolute, forbidden-presence]
|
|
9
|
-
- id: bva
|
|
10
|
-
name: "Boundary value analysis"
|
|
11
|
-
applies_hint: "input has an ordered range or length"
|
|
12
|
-
emits: [absolute, forbidden-presence]
|
|
13
|
-
- id: negative
|
|
14
|
-
name: "Negative / error"
|
|
15
|
-
applies_hint: "any input or action that can fail"
|
|
16
|
-
emits: [forbidden-presence]
|
|
17
|
-
- id: state_flow
|
|
18
|
-
name: "State / flow"
|
|
19
|
-
applies_hint: "the AC sits in a multi-step flow"
|
|
20
|
-
emits: [state-transition]
|
|
21
|
-
- id: crud
|
|
22
|
-
name: "CRUD round-trip"
|
|
23
|
-
applies_hint: "AC touches a persisted resource"
|
|
24
|
-
emits: [delta, presence, forbidden-presence]
|
|
25
|
-
- id: auth
|
|
26
|
-
name: "Auth / permission"
|
|
27
|
-
applies_hint: "AC is behind a gate or role"
|
|
28
|
-
emits: [forbidden-presence, presence]
|
|
29
|
-
- id: api_contract
|
|
30
|
-
name: "API-contract"
|
|
31
|
-
applies_hint: "surface is REST/GraphQL"
|
|
32
|
-
emits: [absolute]
|
|
33
|
-
- id: concurrency
|
|
34
|
-
name: "Concurrency / race"
|
|
35
|
-
applies_hint: "high-risk (money / data-loss) or shared-resource AC"
|
|
36
|
-
emits: [state-transition, forbidden-presence]
|
|
37
|
-
- id: idempotency
|
|
38
|
-
name: "Idempotency / retry"
|
|
39
|
-
applies_hint: "money or write operations"
|
|
40
|
-
emits: [delta]
|
|
41
|
-
- id: i18n
|
|
42
|
-
name: "i18n / l10n"
|
|
43
|
-
applies_hint: "AC renders user text or formats numbers/dates/currency"
|
|
44
|
-
emits: [presence, absolute]
|
|
45
|
-
- id: a11y
|
|
46
|
-
name: "a11y"
|
|
47
|
-
applies_hint: "any rendered surface"
|
|
48
|
-
emits: [presence, absolute]
|
|
49
|
-
- id: responsiveness
|
|
50
|
-
name: "Responsiveness / layout"
|
|
51
|
-
applies_hint: "rendered surface"
|
|
52
|
-
emits: [presence, forbidden-presence]
|
|
53
|
-
- id: empty_state
|
|
54
|
-
name: "Empty / null / zero state"
|
|
55
|
-
applies_hint: "list / search / collection AC"
|
|
56
|
-
emits: [presence]
|
|
57
|
-
- id: overflow_underflow
|
|
58
|
-
name: "Overflow / underflow"
|
|
59
|
-
applies_hint: "numeric or quantity AC (R9: explicit underflow/overflow)"
|
|
60
|
-
emits: [forbidden-presence]
|
|
61
|
-
- id: persistence
|
|
62
|
-
name: "Persistence / refresh"
|
|
63
|
-
applies_hint: "AC asserts durable state"
|
|
64
|
-
emits: [absolute]
|
|
65
|
-
- id: temporal
|
|
66
|
-
name: "Time / timezone / expiry"
|
|
67
|
-
applies_hint: "AC involves dates, TTLs, schedules"
|
|
68
|
-
emits: [state-transition, forbidden-presence]
|
|
69
|
-
- id: currency
|
|
70
|
-
name: "Currency / rounding"
|
|
71
|
-
applies_hint: "money AC"
|
|
72
|
-
emits: [absolute]
|
|
73
|
-
- id: pagination
|
|
74
|
-
name: "Pagination / sort / filter"
|
|
75
|
-
applies_hint: "list / search AC"
|
|
76
|
-
emits: [absolute, presence]
|
|
77
|
-
- id: file_media
|
|
78
|
-
name: "File / media"
|
|
79
|
-
applies_hint: "upload surface"
|
|
80
|
-
emits: [forbidden-presence]
|
|
81
|
-
- id: notification
|
|
82
|
-
name: "Notification / async-effect"
|
|
83
|
-
applies_hint: "AC produces an out-of-band effect (email/SMS/push)"
|
|
84
|
-
emits: [presence, delta]
|
|
85
|
-
`;var Ge={"web-form":`
|
|
86
|
-
id: web-form
|
|
87
|
-
name: "Web form"
|
|
88
|
-
version: 1
|
|
89
|
-
applies_when: >
|
|
90
|
-
The AC concerns a data-entry form: input fields, required fields, submit,
|
|
91
|
-
validation messages.
|
|
92
|
-
candidate_checks:
|
|
93
|
-
- id: field-validation
|
|
94
|
-
family: negative
|
|
95
|
-
measurable_example: "Enter 'abc' in a numeric quantity field \u2192 inline error 'must be a number', value not accepted"
|
|
96
|
-
emits: forbidden-presence
|
|
97
|
-
- id: required-fields
|
|
98
|
-
family: negative
|
|
99
|
-
measurable_example: "Submit with a required field empty \u2192 submit blocked, field flagged"
|
|
100
|
-
emits: forbidden-presence
|
|
101
|
-
- id: formats
|
|
102
|
-
family: negative
|
|
103
|
-
measurable_example: "Email without @ rejected; valid accepted"
|
|
104
|
-
emits: forbidden-presence
|
|
105
|
-
- id: empty-state
|
|
106
|
-
family: empty_state
|
|
107
|
-
measurable_example: "First load: no stale values, placeholders shown"
|
|
108
|
-
emits: presence
|
|
109
|
-
- id: error-messages
|
|
110
|
-
family: negative
|
|
111
|
-
measurable_example: "Each error is specific and tied to its field"
|
|
112
|
-
emits: presence
|
|
113
|
-
- id: a11y
|
|
114
|
-
family: a11y
|
|
115
|
-
measurable_example: "Every input has a programmatic label; keyboard-only submit works"
|
|
116
|
-
emits: presence
|
|
117
|
-
- id: responsiveness
|
|
118
|
-
family: responsiveness
|
|
119
|
-
measurable_example: "No field overlap at 1280/768/375 px"
|
|
120
|
-
emits: forbidden-presence
|
|
121
|
-
`,"rest-graphql-api":`
|
|
122
|
-
id: rest-graphql-api
|
|
123
|
-
name: "REST / GraphQL API"
|
|
124
|
-
version: 1
|
|
125
|
-
applies_when: >
|
|
126
|
-
The surface is an HTTP/GraphQL endpoint.
|
|
127
|
-
candidate_checks:
|
|
128
|
-
- id: response-shape
|
|
129
|
-
family: api_contract
|
|
130
|
-
measurable_example: "Body validates against the declared schema"
|
|
131
|
-
emits: absolute
|
|
132
|
-
- id: status-codes
|
|
133
|
-
family: api_contract
|
|
134
|
-
measurable_example: "GET 200, POST 201, missing 404, bad 400, unauth 401"
|
|
135
|
-
emits: absolute
|
|
136
|
-
- id: verbs
|
|
137
|
-
family: idempotency
|
|
138
|
-
measurable_example: "PUT is idempotent, POST is not"
|
|
139
|
-
emits: delta
|
|
140
|
-
- id: bad-payloads
|
|
141
|
-
family: negative
|
|
142
|
-
measurable_example: "Malformed JSON \u2192 400, never 500"
|
|
143
|
-
emits: absolute
|
|
144
|
-
- id: idempotency
|
|
145
|
-
family: idempotency
|
|
146
|
-
measurable_example: "Same POST with idempotency-key twice \u2192 one effect"
|
|
147
|
-
emits: delta
|
|
148
|
-
- id: pagination
|
|
149
|
-
family: pagination
|
|
150
|
-
measurable_example: "Page beyond last \u2192 empty list, not error; cursor stable"
|
|
151
|
-
emits: absolute
|
|
152
|
-
- id: versioning
|
|
153
|
-
family: api_contract
|
|
154
|
-
measurable_example: "v1 contract unchanged after v2 ships"
|
|
155
|
-
emits: absolute
|
|
156
|
-
- id: rate-limits
|
|
157
|
-
family: api_contract
|
|
158
|
-
measurable_example: "Over the limit \u2192 429 with retry-after"
|
|
159
|
-
emits: absolute
|
|
160
|
-
`,"mobile-native":`
|
|
161
|
-
id: mobile-native
|
|
162
|
-
name: "Mobile native"
|
|
163
|
-
version: 1
|
|
164
|
-
applies_when: >
|
|
165
|
-
iOS/Android native surface.
|
|
166
|
-
candidate_checks:
|
|
167
|
-
- id: interruptions
|
|
168
|
-
family: state_flow
|
|
169
|
-
measurable_example: "Incoming call mid-flow \u2192 state preserved on return"
|
|
170
|
-
emits: state-transition
|
|
171
|
-
- id: network-transitions
|
|
172
|
-
family: state_flow
|
|
173
|
-
measurable_example: "wifi\u2192cellular\u21924G drop: no data loss, graceful retry"
|
|
174
|
-
emits: state-transition
|
|
175
|
-
- id: permissions
|
|
176
|
-
family: negative
|
|
177
|
-
measurable_example: "Deny camera \u2192 feature degrades, no crash"
|
|
178
|
-
emits: forbidden-presence
|
|
179
|
-
- id: orientation
|
|
180
|
-
family: persistence
|
|
181
|
-
measurable_example: "Rotate mid-form \u2192 input preserved"
|
|
182
|
-
emits: absolute
|
|
183
|
-
- id: deep-links
|
|
184
|
-
family: state_flow
|
|
185
|
-
measurable_example: "Cold-start deep link lands on the right screen with auth"
|
|
186
|
-
emits: state-transition
|
|
187
|
-
- id: state-persistence
|
|
188
|
-
family: persistence
|
|
189
|
-
measurable_example: "Kill + relaunch \u2192 resume where left off"
|
|
190
|
-
emits: absolute
|
|
191
|
-
- id: localization
|
|
192
|
-
family: i18n
|
|
193
|
-
measurable_example: "Device locale switch reformats and re-translates"
|
|
194
|
-
emits: presence
|
|
195
|
-
`,"stateful-flow":`
|
|
196
|
-
id: stateful-flow
|
|
197
|
-
name: "Stateful flow"
|
|
198
|
-
version: 1
|
|
199
|
-
applies_when: >
|
|
200
|
-
Multi-step wizard / checkout / onboarding.
|
|
201
|
-
candidate_checks:
|
|
202
|
-
- id: valid-transitions
|
|
203
|
-
family: state_flow
|
|
204
|
-
measurable_example: "Each step advances only when its precondition is met"
|
|
205
|
-
emits: state-transition
|
|
206
|
-
- id: invalid-transitions
|
|
207
|
-
family: state_flow
|
|
208
|
-
measurable_example: "Can't jump to step 3 with step 2 incomplete"
|
|
209
|
-
emits: forbidden-presence
|
|
210
|
-
- id: back-and-abandon
|
|
211
|
-
family: state_flow
|
|
212
|
-
measurable_example: "Back from step 3, then abandon \u2192 no partial commit"
|
|
213
|
-
emits: forbidden-presence
|
|
214
|
-
- id: refresh-persistence
|
|
215
|
-
family: persistence
|
|
216
|
-
measurable_example: "Reload at step 2 \u2192 still at step 2 with data"
|
|
217
|
-
emits: absolute
|
|
218
|
-
- id: resume
|
|
219
|
-
family: persistence
|
|
220
|
-
measurable_example: "Return later \u2192 resume the saved flow"
|
|
221
|
-
emits: absolute
|
|
222
|
-
- id: double-submission
|
|
223
|
-
family: idempotency
|
|
224
|
-
measurable_example: "Double-click submit \u2192 exactly one submission"
|
|
225
|
-
emits: delta
|
|
226
|
-
`,"data-crud":`
|
|
227
|
-
id: data-crud
|
|
228
|
-
name: "Data CRUD"
|
|
229
|
-
version: 1
|
|
230
|
-
applies_when: >
|
|
231
|
-
A persisted record.
|
|
232
|
-
candidate_checks:
|
|
233
|
-
- id: crud-round-trip
|
|
234
|
-
family: crud
|
|
235
|
-
measurable_example: "Create \u2192 read shows it \u2192 update \u2192 read shows the change \u2192 delete \u2192 read 404"
|
|
236
|
-
emits: state-transition
|
|
237
|
-
- id: retry-safety
|
|
238
|
-
family: idempotency
|
|
239
|
-
measurable_example: "Retried create with same key \u2192 one row"
|
|
240
|
-
emits: delta
|
|
241
|
-
- id: concurrency-lost-update
|
|
242
|
-
family: concurrency
|
|
243
|
-
measurable_example: "Two writers, last must not silently clobber \u2192 conflict surfaced"
|
|
244
|
-
emits: forbidden-presence
|
|
245
|
-
- id: delete-cascade
|
|
246
|
-
family: crud
|
|
247
|
-
measurable_example: "Delete parent \u2192 children handled per rule"
|
|
248
|
-
emits: state-transition
|
|
249
|
-
- id: referential-consistency
|
|
250
|
-
family: crud
|
|
251
|
-
measurable_example: "Can't create a child for a missing parent"
|
|
252
|
-
emits: forbidden-presence
|
|
253
|
-
`,"auth-gated":`
|
|
254
|
-
id: auth-gated
|
|
255
|
-
name: "Auth gated"
|
|
256
|
-
version: 1
|
|
257
|
-
applies_when: >
|
|
258
|
-
Behind login/role.
|
|
259
|
-
candidate_checks:
|
|
260
|
-
- id: login-gate
|
|
261
|
-
family: auth
|
|
262
|
-
measurable_example: "Anonymous \u2192 redirected to login, not the resource"
|
|
263
|
-
emits: forbidden-presence
|
|
264
|
-
- id: role-permission-matrix
|
|
265
|
-
family: auth
|
|
266
|
-
measurable_example: "For each role \xD7 action: allowed/denied as specified"
|
|
267
|
-
emits: absolute
|
|
268
|
-
- id: cross-user-record
|
|
269
|
-
family: auth
|
|
270
|
-
measurable_example: "User A cannot read/edit user B's record by id"
|
|
271
|
-
emits: forbidden-presence
|
|
272
|
-
- id: token-session-expiry
|
|
273
|
-
family: auth
|
|
274
|
-
measurable_example: "Expired token \u2192 401/redirect, no stale access"
|
|
275
|
-
emits: forbidden-presence
|
|
276
|
-
- id: privilege-escalation
|
|
277
|
-
family: auth
|
|
278
|
-
measurable_example: "Non-admin cannot reach an admin action by direct URL/API"
|
|
279
|
-
emits: forbidden-presence
|
|
280
|
-
`,"search-list":`
|
|
281
|
-
id: search-list
|
|
282
|
-
name: "Search / list"
|
|
283
|
-
version: 1
|
|
284
|
-
applies_when: >
|
|
285
|
-
Search results / list views.
|
|
286
|
-
candidate_checks:
|
|
287
|
-
- id: pagination
|
|
288
|
-
family: pagination
|
|
289
|
-
measurable_example: "First/last/empty page correct; total accurate"
|
|
290
|
-
emits: absolute
|
|
291
|
-
- id: sorting
|
|
292
|
-
family: pagination
|
|
293
|
-
measurable_example: "Sort asc/desc actually orders; ties stable"
|
|
294
|
-
emits: absolute
|
|
295
|
-
- id: filtering
|
|
296
|
-
family: pagination
|
|
297
|
-
measurable_example: "Each filter narrows correctly; combined filters AND"
|
|
298
|
-
emits: absolute
|
|
299
|
-
- id: empty-state
|
|
300
|
-
family: empty_state
|
|
301
|
-
measurable_example: "No results \u2192 friendly empty state, not blank/error"
|
|
302
|
-
emits: presence
|
|
303
|
-
- id: invalid-input
|
|
304
|
-
family: negative
|
|
305
|
-
measurable_example: "Garbage query \u2192 no crash, sane result"
|
|
306
|
-
emits: forbidden-presence
|
|
307
|
-
- id: length-limits
|
|
308
|
-
family: bva
|
|
309
|
-
measurable_example: "Max-length query handled"
|
|
310
|
-
emits: absolute
|
|
311
|
-
- id: locale
|
|
312
|
-
family: i18n
|
|
313
|
-
measurable_example: "Locale-correct collation/casing"
|
|
314
|
-
emits: presence
|
|
315
|
-
`};var Ue=`
|
|
316
|
-
version: 1
|
|
317
|
-
principles:
|
|
318
|
-
- "Each step is one complete OBJECTIVE the browser agent achieves autonomously \u2014 state the goal and the path, never low-level actions (the agent emits its own actions)."
|
|
319
|
-
- "One objective (or tightly-related items of one goal) per step; unrelated goals split."
|
|
320
|
-
- "Verbose path: name site, page, section, panel, control, state \u2014 'On the search results page for Noida, in the filter panel's Budget section, set min to 50L and max to 1Cr'."
|
|
321
|
-
- "Self-contained: concrete values inline; never 'as defined in the scenario' \u2014 the agent cannot see the graph."
|
|
322
|
-
- "Browser-only: the agent authors/runs BROWSER tests. Direct API calls and the page's own network traffic ARE in scope; native-app-only behavior, out-of-band email/SMS, backend state with no browser surface are NOT."
|
|
323
|
-
verification:
|
|
324
|
-
- "Phrase checks against the analyzer that observes them:"
|
|
325
|
-
- "Visual \u2014 visible text, labels, counts, prices ('verify the price is 29.99', 'the Sold out label is shown')."
|
|
326
|
-
- "Textual/DOM \u2014 element states/attributes ('the Add button is disabled', 'the placeholder of the search box is \u2026')."
|
|
327
|
-
- "URL \u2014 'URL contains /checkout', 'redirected to /login'. Title \u2014 'page title contains \u2026'."
|
|
328
|
-
- "DevTools/Network \u2014 'no API calls returned 5xx', 'the POST /api/login returned 200' (covers direct API calls too)."
|
|
329
|
-
- "DevTools/Console \u2014 'no console errors'. Performance \u2014 'LCP under 2500ms'. Cookies/localStorage \u2014 'a cookie named session_id exists'."
|
|
330
|
-
- "Assertions: 'Assert/Verify/Confirm \u2026'. Extractions: 'Store \u2026 as name' \u2014 vague verbs (read/tell/report) do NOT persist values."
|
|
331
|
-
- "Baselines/deltas are EXTRACTIONS: 'store the result count as baseline_count' BEFORE the action; compare after. Never an abstract 'capture the state'."
|
|
332
|
-
variables:
|
|
333
|
-
- "Credentials and environment values are {{name}} variables; concrete domain values from the source stay literal."
|
|
334
|
-
- "A value no evidence supplies (start URL, test account, seed data) is ASKED for \u2014 actual value or a variable name \u2014 never invented."
|
|
335
|
-
pitfalls:
|
|
336
|
-
- "A test without a starting URL cannot run \u2014 the first step names it."
|
|
337
|
-
- "'Test the checkout flow' has no end state \u2014 state what done looks like."
|
|
338
|
-
- "Do not cram many unrelated operations into one step; do not reference data outside the step."
|
|
339
|
-
`;var it=["presence","forbidden-presence","count","delta","state-transition","absolute","bound","propagation","latency","graded"];function We(n,s){for(let e of n)if(!it.includes(e))throw new Error(`${s}: emits '${e}' is not an oracle kind`)}function ze(n,s){let e=oe(n);if(!e||!Array.isArray(e.techniques))throw new Error(`${s}: expected { techniques: [...] }`);for(let i of e.techniques){if(!i.id||!i.name||!i.applies_hint||!Array.isArray(i.emits))throw new Error(`${s}: technique '${i?.id??"?"}' missing id/name/applies_hint/emits`);We(i.emits,`${s}: technique '${i.id}'`)}return e.techniques}function He(n,s){let e=oe(n);if(!e||!e.id||!e.name||!e.applies_when||!Array.isArray(e.candidate_checks))throw new Error(`${s}: profile missing id/name/applies_when/candidate_checks`);for(let i of e.candidate_checks){if(!i.id||!i.family||!i.measurable_example||!i.emits)throw new Error(`${s}: candidate_check '${i?.id??"?"}' missing id/family/measurable_example/emits`);We([i.emits],`${s}: check '${i.id}'`)}return e}function Ve(n){let s=new Map(ze(Me,"packaged techniques").map(i=>[i.id,i])),e=Z(n,"design","techniques.yaml");if(le(e))for(let i of ze(ue(e,"utf8"),e))s.set(i.id,i);return[...s.values()]}function Ye(n){let s=new Map(Object.entries(Ge).map(([i,c])=>[i,He(c,`packaged profile '${i}'`)])),e=Z(n,"design","profiles");if(le(e))for(let i of nt(e).filter(c=>c.endsWith(".yaml")||c.endsWith(".yml")).sort()){let c=He(ue(Z(e,i),"utf8"),Z(e,i));s.set(c.id,c)}return[...s.values()]}function Qe(n){let s=Z(n,"design","runner-grammar.yaml");return le(s)?ue(s,"utf8"):Ue}function ee(n,s){return!n.superseded.has(s)}function me(n,s,e){return{cid:s,logical_id:n.nameOf.get(s)??null,content:e}}async function Ke(n,s,e,i,c){let l=await Re(n,"search_similar",{text:s,label:e,k:i},c);return l.ok&&Array.isArray(l.result)?l.result:[]}async function Je(n,s,e={}){let i=Y(n),c=i.resolve(s);if(!c)throw new Error(`assembleDesignContext: unknown use-case '${s}' (run designGate first)`);let l=c.tip,A=i.getNode(l);if(!A||A.label!==v.USECASE)throw new Error(`assembleDesignContext: '${s}' is not a use-case (run designGate first)`);let B=i.derivesInto(l).map(_=>({source_id:_.props.source_id??null,anchor:_.props.anchor??null})),R=[],f=new Set;for(let{cid:_,content:h}of i.byLabel(v.SCENARIO))ee(i,_)&&i.edgesFrom(_).some(o=>o.type===E.BELONGS_TO&&o.dst===l)&&(R.push(me(i,_,h)),f.add(_));let T=[];for(let{cid:_,content:h}of i.byLabel(v.AC)){if(!ee(i,_))continue;let o=i.edgesFrom(_).find(r=>r.type===E.SCOPED_TO);!o||o.dst!==l&&!f.has(o.dst)||T.push({...me(i,_,h),scoped_to:o.dst})}let w=Array.isArray(A.content.criteria)?A.content.criteria:[],S=[A.content.title,A.content.description,...w].filter(Boolean).join(`
|
|
340
|
-
`),P=(await Ke(i,S,v.SCENARIO,10,e.embedSearch)).filter(_=>!f.has(_.cid)),M=[],g=new Set,I=[],F=[l],j=new Set([l]);for(;F.length>0;){let _=F.shift();for(let h of i.edgesFrom(_)){if(h.type!==E.DEPENDS_ON||i.nodeLabel.get(h.dst)!==v.USECASE)continue;let o=i.tipOf(h.dst);j.has(o)||(j.add(o),I.push(o),F.push(o))}}for(let _ of I){let h=`depends_on ${i.nameOf.get(_)??_.slice(0,19)}`;for(let{cid:o}of i.byLabel(v.SCENARIO))if(ee(i,o)&&i.edgesFrom(o).some(r=>r.type===E.BELONGS_TO&&r.dst===_))for(let r of i.edgesInto(o)){if(r.type!==E.AUTOMATES||!ee(i,r.src)||g.has(r.src))continue;g.add(r.src);let u=String(i.getNode(r.src)?.content.title??"");M.push({cid:r.src,logical_id:i.nameOf.get(r.src)??null,title:u,via:h})}}for(let _ of await Ke(i,S,v.TEST,5,e.embedSearch)){let{cid:h,title:o}=_;g.has(h)||(g.add(h),M.push({cid:h,logical_id:i.nameOf.get(h)??null,title:o??"",via:"similar"}))}let O=i.byLabel(v.STYLENOTE).filter(_=>ee(i,_.cid)).sort((_,h)=>_.cid<h.cid?-1:1).slice(0,5).map(_=>`${String(_.content.statement)} [${String(_.content.learned_from_kind)}]`);return{usecase:me(i,l,A.content),cites:B,committed_acs:T,existing:{scenarios:R,reuse_candidates:P},import_candidates:M,style_notes:O,techniques:Ve(n),profiles:Ye(n),runner_grammar:Qe(n),budget:{...e.max!=null?{max_pairs:e.max}:{},...e.strength!=null?{strength_override:e.strength}:{}},design_of:(()=>{let _=Be(i,l);return _?{engine:_.engine,seq:_.seq}:null})()}}function Xe(n){let s=e=>{if(Array.isArray(e))return e.map(s);if(e!==null&&typeof e=="object"){let i={};for(let c of Object.keys(e).sort())i[c]=s(e[c]);return i}return e};return JSON.stringify(s(n),null,1)}var te=n=>({record:null,errors:n,minted:{},logicalIds:{},superseded:[],warnings:[],finalizedTests:{}});function se(n){return n.toLowerCase().trim().replace(/\s+/g," ")}function ge(n,s){let e=n.resolve(s);if(!e||n.nodeLabel.get(e.cid)!==v.USECASE||e.superseded)return[];let i=new Set;for(let{cid:c}of n.byLabel(v.SCENARIO))if(!n.superseded.has(c)&&n.edgesFrom(c).some(l=>l.type===E.BELONGS_TO&&n.tipOf(l.dst)===e.cid)){i.add(c);for(let l of n.edgesInto(c))l.type!==E.AUTOMATES||n.superseded.has(l.src)||i.add(l.src)}return[...i]}function Ze(n){let{contextDir:s,graph:e,sections:i,by:c}=n,l=n.engine??"design@1",A=we(s);if(e.latestHash!==A)return te([{code:"STALE_BASIS",detail:`graph opened at ${String(e.latestHash)} but chain head is ${String(A)} \u2014 re-open and retry`}]);let B=e.resolve(n.ucRef);if(!B||e.nodeLabel.get(B.cid)!==v.USECASE||B.superseded)return te([{code:"UNKNOWN_UC",detail:`${n.ucRef} is not a live use-case`}]);let R=B.cid,f=[],T=[],w=[],S=[],P=[],M=[],g={},I={},F={},j=[],O=[],_=new Set,h=[],o=new Set,r=new Set,u=[];{let t=n.forceScope??(n.force?ge(e,n.ucRef):[]),d=new Set;n.sections.scenarios?.length&&d.add(v.SCENARIO),n.sections.tests?.length&&d.add(v.TEST);for(let a of t)e.superseded.has(a)||(d.has(e.nodeLabel.get(a)??"")?r.add(a):u.push(a))}let C=new Set,x=t=>!e.superseded.has(t)&&(!r.has(t)||C.has(t)),N=(t,d,a)=>{if(g[t])return g[t];let y=e.resolve(t),p=y?x(y.cid)?y.cid:e.tipOf(y.cid):null;return!y||!p||!x(p)?(f.push({code:"UNKNOWN_REF",detail:`${d}: '${t}' is neither in this payload nor a live committed node`}),null):a&&e.nodeLabel.get(p)!==a?(f.push({code:"ILLEGAL_EDGE",detail:`${d}: '${t}' is a ${e.nodeLabel.get(p)}, expected ${a}`}),null):p},H=(t,d,a,y)=>{if(e.nameOf.has(d)){I[y]=e.nameOf.get(d);return}let p=xe(t,L=>_.has(L),e.names.keys());p!==null&&(_.add(p),P.push({cid:d,slug:p,by:c}),I[y]=p)},U=(t,d,a,y)=>{for(let L of _e(t,a))f.push({code:L.code,detail:`${d}: ${L.detail}`});let p=ve(t,a);return e.hasNode(p)&&!e.superseded.has(p)?(r.has(p)&&C.add(p),g[d]=p,p):(T.push({cid:p,label:t,content:a}),g[d]=p,H(t,p,y,d),p)},q=(t,d,a,y,p)=>{let L=ce(t,d,a,y);if(e.edgesFrom(d).some(m=>m.ecid===L&&!e.superseded.has(m.ecid))){t===E.AUTOMATES&&o.add(a);return}let Q=e.nodeLabel.get(d)??T.find(m=>m.cid===d)?.label??"(unknown)",D=e.nodeLabel.get(a)??T.find(m=>m.cid===a)?.label??"(unknown)";for(let m of ye(t,Q,D,y))f.push({code:m.code,detail:`${p}: ${m.detail}`});let $=ke(e,t,d,a,h);if($){f.push({code:$.code,detail:`${p}: ${$.detail}`});return}if(t===E.AUTOMATES){if(o.has(a)){f.push({code:"CARDINALITY_VIOLATION",detail:`${p}: two automates onto ${a} in one record (strict 1:1)`});return}if(o.add(a),!r.has(a)||C.has(a)){let m=G=>r.has(G)&&!C.has(G);if(e.edgesFrom(d).some(G=>G.type===E.AUTOMATES&&G.dst!==a&&!e.superseded.has(G.dst)&&!m(G.dst))&&e.hasNode(d)){f.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates from ${d} already has a live edge \u2014 supersede it first`});return}if(e.edgesInto(a).some(G=>G.type===E.AUTOMATES&&G.src!==d&&!e.superseded.has(G.src)&&!m(G.src))){f.push({code:"CARDINALITY_VIOLATION",detail:`${p}: automates onto ${a} already has a live edge \u2014 strict 1:1, supersede it first`});return}}}w.push({ecid:ce(t,d,a,y),type:t,src:d,dst:a,props:y}),h.push({src:d,dst:a,type:t})},W=new Set;for(let t of i.gaps??[]){let d=t.temp_ref??t.ref??"gap",a=t.question;if(!a||typeof a!="object"||!a.header||!Array.isArray(a.options)||a.options.length===0||!Number.isInteger(a.recommended_index)){f.push({code:"GAP_QUESTION_INCOMPLETE",detail:`${d}: design gaps carry a full ranked question object (header/options/recommended_index)`});continue}t.kind==="budget-evicted"&&t.ref&&W.add(t.ref);let y={kind:t.kind,question:a,derived:!0,uc:R,...t.risk?{risk:t.risk}:{},...t.risk_rationale?{risk_rationale:t.risk_rationale}:{},...t.text?{text:t.text}:{},...t.ref?{ref:t.ref}:{}};U(v.GAP,d,y,String(a.header))}let K=new Map;for(let{cid:t,content:d}of e.byLabel(v.SCENARIO))x(t)&&e.edgesFrom(t).some(a=>a.type===E.BELONGS_TO&&e.tipOf(a.dst)===R)&&K.set(se(String(d.title??"")),t);for(let t of i.scenarios??[]){let d=K.get(se(t.title));if(d){f.push({code:"DUPLICATE_SCENARIO",detail:`${t.temp_ref}: '${t.title}' duplicates live scenario ${e.nameOf.get(d)??d} \u2014 exercise/link it instead (reuse before minting)`});continue}let a={title:t.title,intent:t.intent,case_type:t.case_type,derived:!0,...t.technique_notes?{technique_notes:t.technique_notes}:{},...t.description?{description:t.description}:{},...t.parameters?{parameters:t.parameters}:{},...t.tags?{tags:t.tags}:{}};U(v.SCENARIO,t.temp_ref,a,t.title)}for(let t of i.scenarios??[]){let d=g[t.temp_ref];if(d){q(E.BELONGS_TO,d,R,{},t.temp_ref);for(let a of t.depends_on??[]){let y=N(a,`${t.temp_ref}.depends_on`,v.SCENARIO);y&&q(E.DEPENDS_ON,d,y,{},`${t.temp_ref}.depends_on`)}}}for(let t of i.acs??[]){let d={text:t.text,kind:t.kind,risk:t.risk,derived:!0,...t.expected_answer?{expected_answer:t.expected_answer}:{},...t.measurable!==void 0?{measurable:t.measurable}:{}},a=U(v.AC,t.temp_ref,d,t.text);if(!a)continue;let y=t.scope?.type==="scenario"&&t.scope.ref?N(t.scope.ref,`${t.temp_ref}.scope`,v.SCENARIO):R;y&&!e.edgesFrom(a).some(p=>p.type===E.SCOPED_TO&&!e.superseded.has(p.ecid))&&q(E.SCOPED_TO,a,y,{},`${t.temp_ref}.scope`);for(let p of t.cites??[]){let L={source_id:p.source_id,source_cid:p.source_cid,anchor:p.anchor,...p.quote?{quote:p.quote}:{}};q(E.DERIVES,p.source_cid,a,L,`${t.temp_ref}.cite`)}}for(let t of i.exercises??[]){let d=N(t.scenario,"exercises.scenario",v.SCENARIO),a=N(t.ac,"exercises.ac",v.AC);d&&a&&q(E.EXERCISES,d,a,{},`exercises ${t.scenario}\u2192${t.ac}`)}for(let t of i.scoped_to_repoints??[]){let d=N(t.ac,"scoped_to_repoints.ac",v.AC),a=N(t.to,"scoped_to_repoints.to");if(!d||!a)continue;let y=e.edgesFrom(d).find(p=>p.type===E.SCOPED_TO&&!e.superseded.has(p.ecid));y&&S.push({kind:"edge",ecid:y.ecid,reason:`re-scoped to ${t.to} by ${c.id}`,by:c}),q(E.SCOPED_TO,d,a,{},`scoped_to_repoints ${t.ac}`)}let J=new Map;if(n.finalizeTestBody)for(let[t,d]of e.nameOf)J.set(e.tipOf(t),d);let V=t=>e.nameOf.get(t)??J.get(e.tipOf(t))??null,X=t=>{let d=g[t];if(d)return I[t]??V(d);if(e.names.has(t))return e.resolve(t)?t:null;let a=e.resolve(t);return a?V(e.tipOf(a.cid)):null};for(let t of i.tests??[]){for(let D of t.reuses??[])W.has(D)&&f.push({code:"REUSES_EVICTED",detail:`${t.temp_ref}: reuses '${D}' which was budget-evicted \u2014 drop the edge; the dependent gap names the missing @import`});let d=t.test_md_blob,a=t.definitionId,y=t.objectives_blob;if(n.finalizeTestBody){let D;try{D=n.finalizeTestBody({temp_ref:t.temp_ref,test_md_blob:t.test_md_blob,verifies:t.verifies,reuses:t.reuses??[]},X)}catch($){return te([{code:"FINALIZE_BODY",detail:`${t.temp_ref}: ${$ instanceof Error?$.message:String($)}`}])}D&&(d=D.test_md_blob,a=D.definitionId,y=D.objectives_blob??y,F[t.temp_ref]=a)}let p={title:t.title,check:t.check,definitionId:a,derived:!0,...t.config?{config:t.config}:{},...d?{test_md_blob:d}:{},...y?{objectives_blob:y}:{},...t.surface_required!==void 0?{surface_required:t.surface_required}:{}},L=U(v.TEST,t.temp_ref,p,t.title);if(!L)continue;let Q=N(t.automates,`${t.temp_ref}.automates`,v.SCENARIO);Q&&q(E.AUTOMATES,L,Q,{},`${t.temp_ref}.automates`);for(let D of t.verifies){let $=N(D,`${t.temp_ref}.verifies`,v.AC);$&&q(E.VERIFIES,L,$,{},`${t.temp_ref}.verifies`)}for(let D of t.reuses??[]){if(W.has(D))continue;let $=N(D,`${t.temp_ref}.reuses`,v.TEST);$&&q(E.REUSES,L,$,{},`${t.temp_ref}.reuses`)}for(let D of t.verifies){let $=g[D]??e.resolve(D)?.cid;$&&(e.trust.get($)??"derived")==="derived"&&!T.some(m=>m.cid===$)?j.push(`${t.temp_ref}: verifies ${D} which is still DERIVED (unapproved) \u2014 committed anyway; approve it in chat or via review`):$&&g[D]===$&&(i.acs??[]).some(m=>m.temp_ref===D)&&j.push(`${t.temp_ref}: verifies ${D} minted in this same record (unapproved) \u2014 committed anyway; approve it in chat`)}if(t.verifies.length>1){let D=t.check?.verified_against;j.push(`${t.temp_ref}: verifies ${t.verifies.length} ACs but machine-asserts only 1 (check.verified_against=${D!=null?String(D):"?"}) \u2014 the rest ride prose only`)}}let re=[];{let t=(m,b)=>`${m??""}\0${se(String(b??""))}`,d=(m,b)=>n.reason?`${n.reason} \u2014 evolve by ${c.id}${b?` (${b})`:""}`:m,a=new Map;for(let m of T){if(m.label!==v.SCENARIO&&m.label!==v.TEST)continue;let b=t(m.label,m.content.title);a.set(b,[...a.get(b)??[],m.cid])}let y=new Map;for(let m of r){if(C.has(m))continue;let b=t(e.nodeLabel.get(m),e.getNode(m)?.content.title);y.set(b,[...y.get(b)??[],m])}for(let[m,b]of y){let k=a.get(m)??[],G=b.length===1&&k.length===1;for(let z of b)G?(S.push({kind:"node",old:z,new:k[0],reason:d(`--force redesign of ${n.ucRef} by ${c.id} (title-matched successor)`,"title-matched successor"),by:c}),re.push({old:z,next:k[0]})):S.push({kind:"node",old:z,new:null,reason:d(`--force redesign of ${n.ucRef} by ${c.id}`),by:c}),O.push(z)}let p=m=>e.edgesFrom(m).some(b=>b.type!==E.SCOPED_TO?!1:b.dst===R||e.tipOf(b.dst)===R?!0:e.nodeLabel.get(b.dst)===v.SCENARIO&&e.edgesFrom(b.dst).some(k=>k.type===E.BELONGS_TO&&e.tipOf(k.dst)===R)),L=new Map;for(let{cid:m,content:b}of e.byLabel(v.AC)){if(e.superseded.has(m)||!p(m))continue;let k=se(String(b.text??""));L.set(k,[...L.get(k)??[],m])}let Q=new Map;for(let m of T){if(m.label!==v.AC)continue;let b=se(String(m.content.text??""));Q.set(b,[...Q.get(b)??[],m.cid])}for(let[m,b]of L){let k=Q.get(m)??[];b.length!==1||k.length!==1||(S.push({kind:"node",old:b[0],new:k[0],reason:d(`AC re-emitted with changed content by ${c.id} (text-matched successor)`,"AC text-matched successor"),by:c}),re.push({old:b[0],next:k[0]}),O.push(b[0]))}let D=new Set(O),$=new Set;for(let m of S)m.kind==="edge"&&$.add(m.ecid);for(let{old:m,next:b}of re)for(let k of e.edgesInto(m))be(k.type)?.pin?.comparesTo!=="dst_tip"||e.superseded.has(k.src)||D.has(k.src)||$.has(k.ecid)||(S.push({kind:"edge",ecid:k.ecid,reason:`re-blessed onto ${b} (redirect successor of ${m}) by ${c.id}`,by:c}),$.add(k.ecid),w.some(z=>z.type===k.type&&z.src===k.src&&z.dst===b)||e.edgesFrom(k.src).some(z=>z.type===k.type&&z.dst===b))||k.type===E.AUTOMATES&&o.has(b)||q(k.type,k.src,b,k.props,`rebless ${k.type} from ${e.nameOf.get(k.src)??k.src}`)}return f.length>0?te(f):T.length===0&&w.length===0&&S.length===0&&M.length===0?Object.keys(g).length>0?(j.push("everything in this phase is already current \u2014 nothing re-committed"),{record:null,errors:null,minted:g,logicalIds:I,superseded:[],warnings:j,finalizedTests:F,...n.force||n.forceScope?{forceScopeRemaining:u}:{}}):te([{code:"EMPTY_DESIGN",detail:"finalize_design produced nothing to commit"}]):{record:Se(s,{ts:new Date().toISOString(),proposal_id:null,nodes:T,edges:w,review:[],supersessions:S,source_head_moves:{},...P.length>0?{names:P}:{},...(()=>{for(let t of i.judgements??[]){let d=t.target?g[t.target]??e.resolve(t.target)?.cid??R:R;M.push({about:d,rationale:`[${t.kind}] ${t.rationale}`,by:c})}return M.length>0?{judgements:M}:{}})(),design_of:{uc_cid:R,engine:l}}).record,errors:null,minted:g,logicalIds:I,superseded:O,warnings:j,finalizedTests:F,...n.force||n.forceScope?{forceScopeRemaining:u}:{}}}import{basename as rt,dirname as ot,resolve as at}from"path";var ct=new Set(["narrative","acs","scenarios","tests","exercises","gaps","scoped_to_repoints","judgements","phase"]);function dt(n){let s=/strength=(\d+)\s*(?:—|-)?\s*(.*)/.exec(n??"");return s?{strength:Number(s[1]),reason:s[2]||n||""}:{strength:2,reason:n??""}}function lt(n,s,e=new Set,i=0){return ne(s,ie(n),e,i)}function ut(n,s,e,i){let c=s.scenarios?.find(w=>w.temp_ref===e.automates)??(()=>{let w=n.resolve(e.automates),S=w?n.getNode(w.tip)?.content:void 0;return S?{title:String(S.title??""),intent:String(S.intent??""),technique_notes:String(S.technique_notes??"")}:{}})(),l=[...(s.acs??[]).map(w=>({ref:w.temp_ref,text:w.text})),...e.verifies.filter(w=>!(s.acs??[]).some(S=>S.temp_ref===w)).map(w=>{let S=n.resolve(w);return{ref:w,text:S?String(n.getNode(S.tip)?.content.text??""):""}})],{test_md:A,objectives_yaml:B}=he({title:e.title,steps:e.steps,check:e.check,check_prose:e.check_prose,reuses:e.reuses},{title:c.title,intent:c.intent},l),R=ae(lt(n,A)),f=e.check,T={technique:c.technique_notes??"",profile_family:s.judgements?.find(w=>w.kind==="profile_family"&&(w.target===e.temp_ref||w.target===e.automates))?.rationale??"unspecified",anchor:f.verified_against,expected_how:s.judgements?.find(w=>w.kind==="expected_how"&&w.target===f.verified_against)?.rationale??`expected_mode: ${f.expected_mode??"inferred"}`,combinatorial:dt(c.technique_notes),surface_state:"absent",deferred_bindings:f.expected_mode==="runtime-derived"?1:0};return i.push({definitionId:R,rationale:T,anchorRef:f.verified_against,tempRef:e.temp_ref}),{temp_ref:e.temp_ref,title:e.title,automates:e.automates,verifies:e.verifies,check:e.check,definitionId:R,test_md_blob:A,objectives_blob:B,...e.reuses?.length?{reuses:e.reuses}:{},...e.surface_required!==void 0?{surface_required:e.surface_required}:{}}}function et(n){let s=0,e=n.forceScope??null;return{terminalEventType:"design",async onProposalEvent(i){let c=r=>n.steer?(n.steer(`[auto-repair] ${r} \u2014 please re-finalize with this fixed.`),{proposal:null,error:null}):{proposal:null,error:r};if(i==null||typeof i!="object")return c("finalize_design payload is not an object");let l=i,A=Object.keys(l).filter(r=>!ct.has(r));if(A.length>0)return c(`finalize_design carries ungated/unknown section(s): ${A.join(", ")} \u2014 mintable here: acs, scenarios, tests (+gaps)`);let B=new Map;for(let r of l.tests??[]){let u=B.get(r.automates);if(u)return c(`strict 1:1 violated in-payload: ${u} and ${r.temp_ref} both automate ${r.automates}`);B.set(r.automates,r.temp_ref)}let R=Y(n.contextDir);n.force&&!n.resuming&&s===0&&e===null&&(e=ge(R,n.ucRef));let f=R.resolve(n.ucRef),T=f?String(R.getNode(f.tip)?.content.risk??"med"):"med",w=[],S=new Set([n.ucRef,f?.cid,f?.tip].filter(Boolean)),P=r=>{if(S.has(r))return!0;let u=R.resolve(r);return u!=null&&(S.has(u.cid)||S.has(u.tip))},M;try{M={...l.acs?.length?{acs:l.acs.map(r=>({temp_ref:r.temp_ref,text:r.text,kind:r.kind,risk:r.risk??T,...r.expected_answer?{expected_answer:r.expected_answer}:{},...r.scoped_to&&!P(r.scoped_to)?{scope:{type:"scenario",ref:r.scoped_to}}:{}}))}:{},...l.scenarios?.length?{scenarios:l.scenarios}:{},...l.tests?.length?{tests:l.tests.map(r=>ut(R,l,r,w))}:{},...l.exercises?.length?{exercises:l.exercises}:{},...l.gaps?.length?{gaps:l.gaps}:{},...l.scoped_to_repoints?.length?{scoped_to_repoints:l.scoped_to_repoints}:{},...l.judgements?.length?{judgements:l.judgements}:{}}}catch(r){return c(r instanceof Error?r.message:String(r))}let g=Ze({contextDir:n.contextDir,graph:R,ucRef:n.ucRef,sections:M,by:n.by,...n.engine?{engine:n.engine}:{},...e?.length?{forceScope:e}:{},...n.because?{reason:n.because}:{},finalizeTestBody:(()=>{let r=new Map((M.tests??[]).map(x=>[x.temp_ref,x])),u=new Map,C=(x,N,H)=>{let U=r.get(x);if(!U?.test_md_blob)return null;let q=u.get(x);if(q!==void 0)return q;if(H.has(x))return U.test_md_blob;H.add(x);let W=new Map;for(let V of U.reuses??[]){C(V,N,H);let X=N(V);X!==null&&X!==V&&W.set(V,X)}let K=U.verifies.map(N).filter(V=>V!==null),J=pe(fe(U.test_md_blob,W),K);return u.set(x,J),J};return(x,N)=>{if(!x.test_md_blob)return null;let H=C(x.temp_ref,N,new Set)??x.test_md_blob;if(H===x.test_md_blob)return null;let U=q=>{for(let W of r.keys())if(N(W)===q){let K=C(W,N,new Set);if(K!==null)return{body:K,cycleKey:`batch:${q}`,next:U}}return ie(R)(q)};return{test_md_blob:H,definitionId:ae(ne(H,U))}}})()});if(g.errors)return c("design commit failed: "+g.errors.map(r=>`${r.code}: ${r.detail}`).join("; "));let I=g.warnings.filter(r=>r.includes("\u2014 committed anyway; approve"));for(let r of g.warnings)(!I.includes(r)||I.length===1)&&n.note(`warning: ${r}`);I.length>1&&n.note(`warning: ${I.length} verifies edges target not-yet-approved items \u2014 committed anyway; approve them in chat or via review`);let F=(r,u)=>r?`${r} ${u}${r>1?"s":""}`:null,j=[F(l.acs?.length,"AC"),F(l.scenarios?.length,"scenario"),F(l.tests?.length,"test"),F(l.gaps?.length,"gap")].filter(Boolean);n.aliases?.(Object.entries(g.minted).map(([r,u])=>({ref:r,cid:u,...g.logicalIds[r]?{id:g.logicalIds[r]}:{}})));{let r=`saved ${j.join(" \xB7 ")||"judgements/wiring"} as drafts`;(n.commitLine??n.note)(r)}let O=Y(n.contextDir);n.onCommitted?.(O);for(let r of w){let u=g.logicalIds[r.anchorRef]??g.minted[r.anchorRef];je(n.contextDir,g.finalizedTests[r.tempRef]??r.definitionId,{...r.rationale,anchor:u??r.rationale.anchor})}try{let r=Object.values(g.minted).filter(u=>O.getNode(u)?.label==="test");if(r.length>0){let u=ot(at(n.contextDir)),C=Fe({graph:O,cids:r,cwd:u});C.wrote.length>0&&n.note(`\u2692 wrote ${C.wrote.map(x=>rt(x.path)).join(" \xB7 ")}`);for(let x of C.refused)n.note(`warning: mint refused ${x.id} \u2014 ${x.reason}`)}}catch(r){n.note(`warning: file mint failed (${r instanceof Error?r.message:String(r)}) \u2014 the design commit stands`)}n.event?.({type:"commit",acs:l.acs?.length??0,scenarios:l.scenarios?.length??0,tests:l.tests?.length??0,gaps:l.gaps?.length??0,warnings:g.warnings.length,minted:Object.entries(g.minted).map(([r,u])=>({temp_ref:r,cid:u,...g.logicalIds[r]?{logical_id:g.logicalIds[r]}:{}}))}),s+=1,e!==null&&(e=g.forceScopeRemaining??e,n.onForceScope?.(e));let _=De({verb:"design",commitN:s,ucRef:n.ucRef,phase:l.phase??(l.tests?.length?"tests":l.scenarios?.length?"scenarios":l.acs?.length?"acs":"design"),committed:Object.entries(g.minted).map(([r,u])=>({temp_ref:r,cid:u,...g.logicalIds[r]?{logical_id:g.logicalIds[r]}:{}})),warnings:g.warnings},O),h=_.event.parity?.missing??[],o=!!l.tests?.length&&h.length===0;return{proposal:g,error:null,receipt:_,...o?{sessionComplete:o}:{}}}}}function tt(n,s){return{type:"run_config",version:1,session_id:s.session_id,mode:s.mode,source:{source_id:`design:${n.usecase.logical_id??s.ucCid.slice(0,19)}`,source_cid:s.ucCid,kind:"design_context",numbered_text:Xe({...n,session_mode:s.mode})},existing_use_cases:[],read_basis:s.readBasis,max_free_text_rounds:2,graph_reads:!0,verb:"design",chat:!0,design_budget:n.budget,topology:s.topology}}function ft(n,s){return{terminalEventType:"design",async onProposalEvent(e){let i=e??{},c=["acs","scenarios","tests","gaps"].map(l=>i[l]?.length?`${i[l].length} ${l}`:null).filter(Boolean).join(" \xB7 ");return n(`plan: finalize_design \u2014 ${c||"wiring/judgements only"} (nothing committed)`),n(JSON.stringify(i,null,2)),s?.({type:"plan",payload:i}),{proposal:i,error:null}}}}async function ms(n,s){let e=Y(s.contextDir),i=null,c=n.useCase;if(n.resume){try{let u=qe(s.contextDir,n.resume,e);i=u.handle,u.staleBasis.length>0&&(s.out(`note: sources changed since the pause: ${u.staleBasis.join(", ")} \u2014 the design continues against the current versions`),s.emit?.({type:"stale_basis",sources:u.staleBasis}))}catch(u){if(u instanceof Te)return s.out(`error: ${u.message}`),s.emit?.({type:"error",message:`error: ${u.message}`}),u.code==="SESSION_MISSING"||u.code==="SESSION_EXPIRED"?2:1;throw u}let o=i.state;if(o.verb&&o.verb!=="design")return s.out(`error: session ${n.resume} is a ${o.verb} session \u2014 resume it with kane-cli context extract --resume ${n.resume}`),s.emit?.({type:"error",message:`error: session ${n.resume} is a ${o.verb} session \u2014 resume it with kane-cli context extract --resume ${n.resume}`}),i.release(),2;if(c=c??o.use_case,o.uc_tip&&c){let u=e.resolve(c)?.tip;u&&u!==o.uc_tip&&(s.out("note: the use-case changed since the pause \u2014 the design continues against the new version"),s.emit?.({type:"stale_basis",usecase:c}))}let r=i.state.held_receipts??[];if(r.length>0)if(s.chat?.holdReceipt)for(let u of r)s.chat.holdReceipt(u);else s={...s,initialMessage:[r.join(`
|
|
341
|
-
|
|
342
|
-
`),s.initialMessage].filter(Boolean).join(`
|
|
343
|
-
|
|
344
|
-
`)};if(!c)return s.out(`error: session ${n.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`),s.emit?.({type:"error",message:`error: session ${n.resume} predates use-case persistence \u2014 re-supply --use-case <ref>`}),i.release(),2}let l=!!(n.force||i?.state.force),A=!!(n.resume&&i),B=Pe(e,c,l||A);if(!B.ok)return s.out(`design: ${B.message}`),s.emit?.({type:"gate_refused",message:B.message}),i?.release(),B.code;if(s.preflightTurn){let o=await s.preflightTurn();if(!o.ok)return s.out(o.message??"error: turn-endpoint preflight failed"),s.emit?.({type:"error",message:o.message??"error: turn-endpoint preflight failed",code:"PREFLIGHT"}),i?.release(),2}let R={contextDir:s.contextDir,resolveAlias:o=>$e(o,{env:process.env,auth:s.auth}),embed:(o,r)=>Ce(o,r,{env:process.env,auth:s.auth})};s.chat?.setWorking?.("assembling context\u2026");let f=await Je(s.contextDir,c,{max:n.max,strength:n.strength,embedSearch:R});n.priorDesign!==void 0&&(f.prior_design=n.priorDesign),n.changeDelta!==void 0&&(f.change_delta=n.changeDelta),n.because&&(f.because=n.because);let T=s.now?.()??new Date,w=`${T.toISOString().replace(/[-:]/g,"").slice(0,15)}-${pt(2).toString("hex")}`,S=n.mode??"interactive",P=tt(f,{session_id:n.resume??`design-${w}`,mode:S,ucCid:f.usecase.cid,readBasis:e.latestHash,topology:Ie("design")});n.plan?P.chat=!1:P.chat=!0,n.resume&&i&&(P.resume={agent_state:i.state.agent_state},s.out(`resuming design session ${n.resume}`),i.state.assumed.length>0&&s.out(`note: ${i.state.assumed.length} default(s) were assumed while you were away \u2014 kane-cli context sessions show ${n.resume} lists them`),n.message&&(s={...s,initialMessage:[s.initialMessage,n.message].filter(Boolean).join(`
|
|
345
|
-
|
|
346
|
-
`)}));let M=st(s.contextDir,"logs");mt(M,{recursive:!0});let g=st(M,`design-${w}.log`);s.out(`trace: ${de(g)}`),s.emit?.({type:"run_start",mode:S,trace:g,use_case:c});let I=(o,r,u)=>{try{gt(g,JSON.stringify({ts:new Date().toISOString(),kind:o,session_id:u,data:r})+`
|
|
347
|
-
`)}catch{}},F=null,j={current:e};s.nested||s.chat?.attachOnCommitted?.(o=>{j.current=o});let O="";if(s.chat&&!n.plan&&!s.nested){let o=Ee({contextDir:s.contextDir,graph:Y(s.contextDir),sessionStamp:P.session_id,by:s.by??{kind:"human",id:"owner"}});o.errors===null||o.errors[0]?.code==="CONV_SOURCE_EXISTS"?(O=o.sourceId,s.chat.attachConversationSource?.(O),j.current=Y(s.contextDir)):s.out(`warning: conversation source unavailable (${o.errors[0]?.detail}) \u2014 chat adds will not land this session`)}let _=n.plan?ft(s.out,s.emit):et({contextDir:s.contextDir,ucRef:c,by:{kind:"ai",id:"design-agent"},force:l,engine:"design@1",note:o=>s.chat?s.chat.note(o):s.out(o),commitLine:o=>s.chat?s.chat.ledger({kind:"commit",ok:!0,line:o}):s.out(o),steer:s.chat&&!s.nested?o=>s.chat.submit(o):void 0,event:s.emit,resuming:A,...i?.state.force_scope?.length?{forceScope:i.state.force_scope}:{},onForceScope:o=>{F=o},...n.because?{because:n.because}:{},aliases:s.chat?o=>s.chat.registerAliases?.(o):void 0,onCommitted:o=>{j.current=o}});s.chat||s.out(`designing: ${f.usecase.logical_id??c} (budget ${f.budget.max_pairs!=null?`${f.budget.max_pairs} pairs`:"no ceiling"}${f.budget.strength_override?`, strength ${f.budget.strength_override}`:""})`),s.chat?.setWorking?.(`designing ${f.usecase.logical_id??c}\u2026`);let h;try{h=await Ae(P,{...s,graphSlot:j},new Map,e,I,_)}catch(o){throw I("error",{message:o instanceof Error?o.message:String(o),stack:o instanceof Error?o.stack:void 0},P.session_id),i?.release(),o}finally{s.chat?.setWorking?.(null)}if(h.highRisk)return s.out(`error: ${h.highRisk.length} high-risk decision${h.highRisk.length===1?"":"s"} need a human \u2014 ci mode won't guess. Re-run with --mode agent to pause for review.`),s.emit?.({type:"error",message:`error: high-risk question(s) in ci mode (fail-closed): ${h.highRisk.map(o=>o.id).join(", ")}`,code:"HIGH_RISK_CI"}),i?.release(),1;if(h.paused){let o=i;o||(o=Oe(s.contextDir,{sid:P.session_id,mode:"agent",created_at:T.toISOString(),expires_at:new Date(T.getTime()+1440*60*1e3).toISOString(),agent_state:h.paused.agent_state,pending:{questions:[],proposals:[]},read_basis:Object.fromEntries((e.resolve(c)?e.edgesInto(e.resolve(c).tip):[]).filter(x=>x.type==="DERIVES"&&typeof x.props.source_id=="string").map(x=>[String(x.props.source_id),e.heads.get(String(x.props.source_id))??null])),assumed:[],corpus_cursor:{remaining:[]},conv_source:O,verb:"design",use_case:c,...e.resolve(c)?.tip?{uc_tip:e.resolve(c).tip}:{},...l?{force:!0}:{}})),l&&!o.state.force&&o.save({force:!0}),O&&o.state.conv_source!==O&&o.save({conv_source:O});let r=s.chat?.drainHeldReceipts?.()??[];(r.length>0||(o.state.held_receipts?.length??0)>0)&&o.save({held_receipts:r}),F!==null&&o.save({force_scope:F}),Ne(o,h.paused),I("session_paused",{sid:o.state.sid},P.session_id);let u=S!=="interactive"?` --mode ${S}`:"",C=`kane-cli design tests --resume ${o.state.sid}${u}`;return s.out(`paused \u2014 resume with: ${C}`),s.emit?.({type:"session_paused",sid:o.state.sid,mode:S,resume:C,expires_at:o.state.expires_at,pending_questions:h.paused.pending.questions}),s.chat?.ledger?.({kind:"pause",sid:o.state.sid,expires_at:o.state.expires_at,resume:C,messageForm:`${C} --message "<your words>"`}),3}if(h.error)return s.out(`error: design agent failed: ${h.error}`),s.emit?.({type:"error",message:`error: design agent failed: ${h.error}`}),i?.release(),1;if(h.proposal==null&&S!=="interactive")return s.out(`error: the design agent ended without a finalize event \u2014 nothing committed (trace: ${g})`),s.emit?.({type:"error",message:`error: the design agent ended without a finalize event \u2014 nothing committed (trace: ${g})`}),i?.release(),1;if(h.proposal==null&&s.out("done \u2014 nothing designed this session (no finalize before the session ended)"),h.assumedDefaults&&s.out(`assumed: ${h.assumedDefaults} default(s) auto-taken (flagged)`),i&&s.emit?.({type:"session_complete",sid:n.resume}),i?.complete(),!s.nested){let o=s.chat?.state.ledger.filter(C=>C.kind==="answer"&&C.receipt.form==="assumed").length??0,r=(h.assumedDefaults??0)+o,u=s.chat?.state.credits?.total??h.creditsTotal;s.chat?.ledger?.({kind:"summary",lines:[`designed: ${f.usecase.logical_id??c}${h.proposal==null?" (nothing committed this session)":""}`,...r>0?[`${r} assumed default(s)`]:[],...u!==void 0?[`credits used: ${u.toFixed(1)}`]:[],`trace: ${de(g)}`]})}return n.plan||Le(s.contextDir),0}export{ms as a};
|
package/dist/chunk-XTO236AL.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as j}from"./chunk-T4WZWKIU.js";import{a as U}from"./chunk-DNNZ353O.js";import{d as F}from"./chunk-QM4S2APK.js";import{a as C}from"./chunk-LEA6IHXC.js";import{a as L,b as M,e as G,f as N}from"./chunk-L3HG5ONB.js";import{b as V}from"./chunk-MBXWXBDM.js";import{d as E,e as $,g as P}from"./chunk-5YPBPZUR.js";function W(e,n,t,i,r){let d=t.rows.filter(p=>{let u=i.get(p.temp_ref);return u!==void 0&&u!=="reject"});if(d.length===0)return{record:null,errors:null};let s={version:1,read_basis:n.latestHash,source:{source_id:t.source_id,source_cid:n.heads.get(t.source_id)??""},use_cases:d.map(p=>p.uc)},g=new Map;for(let p of d){let u=i.get(p.temp_ref);typeof u=="object"?g.set(p.temp_ref,{resolution:"edited",edit:u.edited}):g.set(p.temp_ref,{resolution:p.uc.matches_existing&&p.uc.changed?"edited":"approved"})}let l=ee(s,n,t.staged_source_cid);if(l.errors!==null)return{record:null,errors:l.errors};let o=l.proposal,f=s.source.source_cid?D(e,n,s.source.source_cid):null;if(f!==null){o=Z(o,f);let p=G(o,z(f),n);if(p.length>0)return{record:null,errors:[{code:"HELD_CITES_STALE",detail:"the source moved after this plan staged \u2014 its quotes no longer verify against the current head; re-run kane-cli maintain reconcile to re-stage"},...p]}}let m=`held-${(n.latestHash??"root").slice(-12)}-${d.length}`;return N({contextDir:e,graph:n,proposal:o,proposalId:m,verdicts:g,by:r,autoName:!0})}function z(e){return e.replace(/\n$/,"").split(`
|
|
3
|
-
`).map((t,i)=>`${String(i+1).padStart(4,"0")}| ${t}`).join(`
|
|
4
|
-
`)}function Z(e,n){let t=n.replace(/\n$/,""),i=z(n),r=d=>{if(!d?.quote)return d;let s=M(i,d.anchor);if(s!==null&&s.includes(d.quote))return d;let g=t.indexOf(d.quote);if(g===-1||t.indexOf(d.quote,g+1)!==-1)return d;let l=t.slice(0,g).split(`
|
|
5
|
-
`).length,o=l+d.quote.replace(/\n$/,"").split(`
|
|
6
|
-
`).length-1;return{...d,anchor:`L${l}-L${o}`}};return{...e,use_cases:e.use_cases.map(d=>({...d,cite:r(d.cite)??d.cite,...d.criteria?{criteria:d.criteria.map(s=>({...s,cite:r(s.cite)??s.cite}))}:{},...d.updated?.criteria?{updated:{...d.updated,criteria:d.updated.criteria.map(s=>({...s,cite:r(s.cite)??s.cite}))}}:{}}))}}function ee(e,n,t){let i=[],r=n.mediaOf(e.source.source_cid).images??[],d=t!==void 0?n.mediaOf(t).images??[]:null,s=(l,o)=>{let f=l?L(l.anchor):null;if(!l||f?.kind!=="img-part")return l;if(d===null)return i.push({code:"HELD_CITES_STALE",detail:`${o}: this plan predates image-part staging \u2014 ${l.anchor} cannot be verified against the version it staged under; re-run kane-cli maintain reconcile to re-stage`}),l;let m=d.find(c=>c.ref===f.ref)?.blob;if(m===void 0)return i.push({code:"HELD_CITES_STALE",detail:`${o}: ${l.anchor} names no decodable image of the staged version \u2014 re-run kane-cli maintain reconcile to re-stage`}),l;if(r.some(c=>c.ref===f.ref&&c.blob===m))return l;let p=r.filter(c=>c.blob===m),u=p.filter(c=>c.delivery==="selected");return u.length===1?{...l,anchor:`img#${u[0].ref}`}:p.length===1?{...l,anchor:`img#${p[0].ref}`}:(i.push({code:"HELD_CITES_STALE",detail:`${o}: the image behind ${l.anchor} is ${p.length===0?"no longer in":"ambiguous in"} the current head \u2014 re-run kane-cli maintain reconcile to re-stage`}),l)};return{proposal:{...e,use_cases:e.use_cases.map(l=>({...l,cite:s(l.cite,l.temp_ref)??l.cite,...l.criteria?{criteria:l.criteria.map(o=>({...o,cite:s(o.cite,l.temp_ref)??o.cite}))}:{},...l.updated?.criteria?{updated:{...l.updated,criteria:l.updated.criteria.map(o=>({...o,cite:s(o.cite,l.temp_ref)??o.cite}))}}:{}}))},errors:i.length>0?i:null}}function J(e,n,t=[]){let i=j(e,n),r=new Set,d=[],s=f=>{!f||r.has(f)||(r.add(f),d.push(R(e,f)))};for(let f of i.pairs)s(f.scenario),s(f.test);for(let[f,m]of i.verifies){s(f);for(let p of m)s(p)}if(t.length===0)return{stale_refs:d};let g=f=>`${String(f.props.source_id)}\0${String(f.props.anchor)}`,l=new Set;for(let{cid:f}of e.byLabel(E.USECASE))if(e.tipOf(f)===n)for(let m of e.edgesInto(f)){if(m.type!==$.DERIVES)continue;let p=m.props.claim;typeof p=="string"&&t.includes(p)&&l.add(g(m))}if(l.size===0)return{stale_refs:d};let o=new Set;for(let[f,m]of i.verifies)if(e.edgesInto(f).some(u=>u.type===$.DERIVES&&l.has(g(u)))){o.add(R(e,f));for(let u of m)o.add(R(e,u))}return{stale_refs:d,...o.size>0?{direct_refs:[...o]}:{}}}var B="this release plans changes only \u2014 blast-radius impact and drift meaning-checks are not measured, and REMOVE rows are never executed automatically",te="suite untouched; graph updated";function T(e,n){return!e.superseded.has(n)&&e.trust.get(n)!=="archived"}function R(e,n,t=new Set){let i=e.nameOf.get(n);if(i!==void 0)return i;if(t.has(n))return n;t.add(n);for(let[r,d]of e.superseded){if(d!==n)continue;let s=R(e,r,t);if(s!==r)return s}return n}function k(e){return String(e).slice(0,19)}function A(e,n,t){let i=e.edgesFrom(n).find(r=>r.type===t);return i?e.tipOf(i.dst):null}function Y(e,n){let t=e.nodeLabel.get(n);if(t===E.USECASE)return n;if(t===E.SCENARIO)return A(e,n,$.BELONGS_TO);if(t===E.AC){let i=A(e,n,$.SCOPED_TO);return i?e.nodeLabel.get(i)===E.USECASE?i:A(e,i,$.BELONGS_TO):null}if(t===E.TEST){let i=A(e,n,$.AUTOMATES);return i?A(e,i,$.BELONGS_TO):null}return null}function q(e,n){let t=[],i=new Map;for(let r of e.derivesInto(n))i.set(String(r.props.source_id),r);for(let[r,d]of i){let s=e.heads.get(r);if(s==null){t.push(`DERIVES pin ${r} @ ${k(d.props.source_cid)} \u2014 source retired`);continue}if(s!==d.props.source_cid){let g=e.convChains.get(r)?.chain;if(g&&g.includes(String(d.props.source_cid)))continue;t.push(`DERIVES pin ${r} @ ${k(d.props.source_cid)} \u2014 source head moved to ${k(s)}`)}}for(let r of e.edgesFrom(n))P(r.type)?.pin?.comparesTo==="dst_tip"&&e.superseded.has(r.dst)&&t.push(`${r.type} pin \u2192 ${R(e,r.dst)} \u2014 target superseded`);return t.join("; ")||"structural pin broken"}var ne=new Set([E.USECASE,E.SCENARIO,E.AC,E.TEST]);function O(e,n){return e.ref<n.ref?-1:e.ref>n.ref?1:0}function D(e,n,t){let i=U(e,n,t);return i===null?null:i.toString("utf8")}function re(e,n,t,i,r){let d=t.props.quote;if(typeof d=="string"&&d.length>0)return i.includes(d);let s=String(t.props.source_cid);r.has(s)||r.set(s,D(e,n,s));let g=r.get(s);if(g===null)return!1;let l=M(g,String(t.props.anchor));return l===null?!1:l.split(`
|
|
7
|
-
`).some(o=>o.trim().length>0&&i.includes(o.trim()))}function se(e,n,t){let i=L(String(n.props.anchor));if(i?.kind!=="img-part")return!1;let d=(e.mediaOf(String(n.props.source_cid)).images??[]).find(s=>s.ref===i.ref)?.blob;return d===void 0?!1:(e.mediaOf(t).images??[]).some(s=>s.blob===d)}var K=128*1024,X=64*1024;function oe(e,n){let t=e.split(`
|
|
8
|
-
`),i=n.split(`
|
|
9
|
-
`),r=0;for(;r<t.length&&r<i.length&&t[r]===i[r];)r++;let d=t.length,s=i.length;for(;d>r&&s>r&&t[d-1]===i[s-1];)d--,s--;if(d===r&&s===r)return"";let g=t.slice(r,d),l=i.slice(r,s),f=ie(g,l,2e3),m=[];if(f===null)m.push(`@@ old L${r+1}-L${d} \u2192 new L${r+1}-L${s} @@`,...g.map(p=>`- ${p}`),...l.map(p=>`+ ${p}`));else{let p=f.map((c,h)=>c.op==="="?-1:h).filter(c=>c>=0),u=0;for(;u<p.length;){let c=u;for(;c+1<p.length&&p[c+1]-p[c]<=3;)c++;let h=Math.max(p[u]-1,0),v=Math.min(p[c]+1,f.length-1),y=f.slice(h,v+1),S=r+(y[0].ai??0)+1,w=r+(y[0].bi??0)+1,a=y.filter(b=>b.op!=="+").length,_=y.filter(b=>b.op!=="-").length;m.push(`@@ old L${S}-L${S+Math.max(a-1,0)} \u2192 new L${w}-L${w+Math.max(_-1,0)} @@`);for(let b of y)m.push(b.op==="="?` ${b.line}`:`${b.op} ${b.line}`);u=c+1}}return m.join(`
|
|
10
|
-
`)}function ie(e,n,t){let i=e.length,r=n.length,d=Math.min(i+r,t),s=new Map([[1,0]]),g=[],l=!1;for(let p=0;p<=d&&!l;p++){g.push(new Map(s));for(let u=-p;u<=p;u+=2){let c=u===-p||u!==p&&(s.get(u-1)??0)<(s.get(u+1)??0)?s.get(u+1)??0:(s.get(u-1)??0)+1,h=c-u;for(;c<i&&h<r&&e[c]===n[h];)c++,h++;if(s.set(u,c),c>=i&&h>=r){l=!0;break}}}if(!l)return null;let o=i,f=r,m=[];for(let p=g.length-1;p>0;p--){let u=g[p],c=o-f,h=c===-p||c!==p&&(u.get(c-1)??0)<(u.get(c+1)??0)?c+1:c-1,v=u.get(h)??0,y=v-h;for(;o>v&&f>y;)m.push({op:"=",line:e[o-1],ai:o-1,bi:f-1}),o--,f--;p>0&&(o===v?(m.push({op:"+",line:n[f-1],ai:o,bi:f-1}),f--):(m.push({op:"-",line:e[o-1],ai:o-1,bi:f}),o--))}for(;o>0&&f>0;)m.push({op:"=",line:e[o-1],ai:o-1,bi:f-1}),o--,f--;for(;o>0;)m.push({op:"-",line:e[o-1],ai:o-1,bi:0}),o--;for(;f>0;)m.push({op:"+",line:n[f-1],ai:0,bi:f-1}),f--;return m.reverse()}function ce(e){let n=Buffer.byteLength(e,"utf8");if(n<=K+X)return{diff:e,truncated:!1};let t=Buffer.from(e,"utf8"),i=K;for(;i>0&&(t[i]&192)===128;)i--;let r=n-X;for(;r<n&&(t[r]&192)===128;)r++;let d=t.subarray(0,i).toString("utf8"),s=t.subarray(r).toString("utf8");return{diff:`${d}
|
|
11
|
-
\u2026 [diff truncated: ${n-i-(n-r)} bytes omitted] \u2026
|
|
12
|
-
${s}`,truncated:!0}}function ae(e,n){let t=C(e),i=t.heads.get(n);if(typeof i!="string")return null;let r=[];for(let u of V(e).records){let c=u.source_head_moves?.[n];c!==void 0&&c!==r[r.length-1]&&r.push(c)}let d=r.lastIndexOf(i),s=d>0?r[d-1]:null;if(typeof s!="string"||s===i)return null;let g=D(e,t,s),l=D(e,t,i);if(g===null||l===null)return null;let{diff:o,truncated:f}=ce(oe(g,l)),m=new Set,p=[];for(let u of t.edgesFrom(s))u.type!==$.DERIVES||t.nodeLabel.get(u.dst)!==E.USECASE||m.has(u.dst)||(m.add(u.dst),p.push({id:u.dst,title:String(t.getNode(u.dst)?.content.title??"")}));return{source_id:n,old_head:s,new_head:i,diff:o,...f?{truncated:!0}:{},prior_ucs:p}}function de(e,n,t){let i=e.getNode(n)?.content??{},r=e.getNode(t)?.content??{},s=[...new Set([...Object.keys(i),...Object.keys(r)])].sort().filter(g=>JSON.stringify(i[g])!==JSON.stringify(r[g]));return s.length>0?`updated: ${s.join(", ")}`:"updated"}function le(e,n,t,i,r,d,s){let g=new Set((s?.rows??[]).map(c=>c.matched_cid).filter(c=>!!c)),l=[];for(let[c,h]of t.superseded)h===null||c===h||n.superseded.has(c)||t.nodeLabel.get(c)===E.USECASE&&l.push({kind:"MODIFY",ref:R(t,c),old_cid:c,new_cid:h,summary:de(t,c,h)});let o=d.map(c=>({kind:"ADD",ref:R(t,c),cid:c}));for(let c of s?.rows??[])c.kind==="MODIFY"&&c.matched_cid?l.push({kind:"MODIFY",ref:R(t,c.matched_cid),old_cid:c.matched_cid,new_cid:null,summary:`${c.why} (staged)`}):c.kind==="ADD"&&o.push({kind:"ADD",ref:c.title,cid:null});let f=[],m=D(e,t,r),p=new Map;for(let{cid:c}of t.byLabel(E.USECASE)){if(!T(t,c)||g.has(c))continue;let h=t.derivesInto(c),v=h.filter(w=>String(w.props.source_id)===i);v.length===0||v.some(w=>w.props.source_cid===r)||v.some(w=>{let a=String(w.props.anchor),_=L(a);return _?.kind==="img-whole"?!1:_?.kind==="img-part"?se(t,w,r):m!==null&&re(e,t,w,m,p)})||h.some(w=>{let a=String(w.props.source_id);if(a===i)return!1;let _=t.heads.get(a);return _!=null})||f.push({kind:"ARCHIVE",ref:R(t,c),cid:c,why:`evidence decayed: no quote from ${i} relocates into @${k(r)}, no other live source, no fresh evidence this run`,impact:J(t,t.tipOf(c))})}let u=(c,h)=>c.ref<h.ref?-1:c.ref>h.ref?1:0;return[...l.sort(u),...o.sort(u),...f.sort(u)]}function Ee(e,n,t,i,r){let d=n.rows.find(u=>u.temp_ref===t);if(!d)return{ok:!1,message:`held item ${t} missing from the plan artifact`};let s=d,g=C(e);if(s.matched_cid){let u=g.tipOf(s.matched_cid);if(g.superseded.get(u)===null)return{ok:!1,message:`use-case for "${s.title}" was retired meanwhile \u2014 nothing to update`};u!==s.matched_cid&&(s={...s,matched_cid:u,uc:{...s.uc,matches_existing:{cid:u}}})}let l=r?{edited:r}:"approve",o=W(e,g,{source_id:n.source_id,...n.staged_source_cid!==void 0?{staged_source_cid:n.staged_source_cid}:{},rows:[s]},new Map([[s.temp_ref,l]]),i);if(o.errors)return{ok:!1,message:o.errors.map(u=>`${u.code}: ${u.detail}`).join("; ")};let f=C(e),m=s.matched_cid?f.tipOf(s.matched_cid):o.record?.nodes.find(u=>u.label==="usecase")?.cid??o.record?.review[0]?.id;return{ok:!0,ref:m?R(f,m):s.title,kind:s.kind}}async function be(e,n,t,i={}){let r=C(e),d=r.heads.get(n)??null,s=new Set(r.staleList().filter(a=>a.state==="stale").map(a=>a.cid)),g=await t.reingest(n);if(g.status==="unchanged"&&!i.resumeHeld)return{source_id:n,changed:!1,head:{status:g.status,before:d,after:g.cid},note:`nothing to reconcile \u2014 ${n} is unchanged`,skipped_arms:B,changeset:[],rows:[]};let l=i.resumeHeld?{minted:[],matched:[],held:i.resumeHeld}:await t.reextract(n),o=C(e),f=l.minted.map(a=>{let _=R(o,a);return{kind:"ADD",origin:"content-change",ref:_,reason:`new use-case extracted from ${n}`,provenance:`extraction commit \u2014 DERIVES ${n} @ ${k(g.cid)}`,action:`kane-cli design tests --use-case ${_}`}}),m=o.staleList().filter(a=>a.state==="stale"&&!s.has(a.cid)&&T(o,a.cid)).map(a=>a.cid),p=m.map(a=>{let _=R(o,a),b=ne.has(o.nodeLabel.get(a)??"");return{kind:"MODIFY",origin:"structural-stale",ref:_,reason:"stale (structural)",provenance:q(o,a),action:b?`kane-cli maintain evolve ${_}`:`kane-cli design explain ${_}`}}),u=[],c=[];for(let a of l.held?.rows??[])if(a.kind==="ADD")u.push({kind:"ADD",origin:"content-change",ref:a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${k(g.cid)}`,action:"approve to commit + design"});else{let _=a.matched_cid?o.tipOf(a.matched_cid):null,b=_?o.getNode(_)?.content.criteria??[]:[],I=(a.uc.updated?.criteria??[]).map(x=>typeof x=="string"?x:x.text),Q=[...I.filter(x=>!b.includes(x)),...a.uc.updated?.criteria!==void 0?b.filter(x=>!I.includes(x)):[]],H=_?J(o,_,Q):void 0;c.push({kind:"MODIFY",origin:"content-change",ref:a.matched_cid?R(o,a.matched_cid):a.title,held_ref:a.temp_ref,reason:`${a.why} (staged \u2014 commits on approval)`,provenance:`staged extraction of ${n} @ ${k(g.cid)}`,action:"approve to commit the updated version (old\u2192new redirect)",...H?{impact:H}:{}})}let h=new Set;for(let a of[...l.minted,...l.matched])h.add(o.tipOf(a));for(let a of l.held?.rows??[])a.matched_cid&&h.add(o.tipOf(a.matched_cid));for(let a of m){let _=Y(o,o.tipOf(a));_&&o.nodeLabel.get(_)===E.USECASE&&h.add(o.tipOf(_))}let v=[];for(let a of await F(o,"design")){if(a.kind!=="no-verifies")continue;let _=o.resolve(a.ref);if(!_)continue;let b=Y(o,_.tip);!b||!h.has(o.tipOf(b))||v.push({kind:"ADD",origin:"content-change",ref:a.ref,reason:a.why,provenance:`gaps engine (design) \u2014 uncovered AC of touched use-case ${R(o,b)}`,action:a.ready_command})}let y=[];for(let{cid:a}of o.byLabel(E.USECASE))T(o,a)&&o.stale(a)==="orphaned"&&y.push({kind:"REMOVE",ref:R(o,a),reason:"orphaned \u2014 no live source evidences this use-case",provenance:q(o,a),action:"plan-only \u2014 REMOVE is not executed in this release"});let S=new Set,w=[...f.sort(O),...u.sort(O),...v.sort(O),...c.sort(O),...p.sort(O),...y.sort(O)].filter(a=>{let _=`${a.kind}\0${a.ref}`;return S.has(_)?!1:(S.add(_),!0)});return{source_id:n,changed:!0,head:{status:g.status,before:d,after:g.cid},note:te,skipped_arms:B,changeset:le(e,r,o,n,g.cid,l.minted,l.held),rows:w,...l.held?{held:l.held}:{}}}function ve(e,n){return async t=>{let{ingestFile:i}=await import("./ingest-CBQAXVH6.js"),{convertPdf:r}=await import("./pdf-convert-KYXI4FU4.js"),d=await i({contextDir:e,filePath:n,asId:t,pdfConverter:r});return{status:d.status,cid:d.cid}}}function Re(e,n={}){return async t=>{let i=[],[{runExtract:r},{resolveAgentAuthEnv:d},{runAgent:s},{preflightTurn:g}]=await Promise.all([import("./run-B7BRNC3X.js"),import("./spawner-C6B5J73J.js"),import("./bridge-V4FF5QPK.js"),import("./turn-preflight-JGYT7LXP.js")]),l=await d(),o=new Set(C(e).byLabel(E.USECASE).map(S=>S.cid)),f=ae(e,t)??void 0,m=0,p=await r({mode:"override",...f?{changeContext:f}:{}},{contextDir:e,agent:s,preflightTurn:()=>g(l),ask:async()=>[],review:async S=>{if(!n.stage)return new Map(S.map(a=>[a.temp_ref,{resolution:a.matches_existing&&a.changed?"edited":"skipped"}]));let w=new Map;for(let a of S){if(a.matches_existing&&!a.changed){w.set(a.temp_ref,{resolution:"skipped"});continue}i.push({kind:a.matches_existing?"MODIFY":"ADD",temp_ref:a.temp_ref,title:a.title,why:a.matches_existing?`updated: ${Object.keys(a.updated??{}).join(", ")||"content"}`:`newly extracted from ${t}`,...a.matches_existing?{matched_cid:a.matches_existing.cid,updated:a.updated}:{},uc:a}),w.set(a.temp_ref,{resolution:"rejected"})}return w},confirmStale:async()=>!1,out:S=>process.stderr.write(S+`
|
|
13
|
-
`),progress:S=>process.stderr.write(S+`
|
|
14
|
-
`),emit:S=>{S.type==="commit"&&typeof S.assumed=="number"&&(m+=S.assumed)},isTTY:!1,auth:l});if(p!==0)throw new Error(`reconcile: re-extract of ${t} failed (exit ${p})`);let u=C(e),c=u.heads.get(t),h=[],v=[];if(typeof c=="string"){let S=new Set;for(let w of u.edgesFrom(c))w.type!==$.DERIVES||u.nodeLabel.get(w.dst)!==E.USECASE||S.has(w.dst)||(S.add(w.dst),!(n.stage&&u.trust.get(w.dst)==="archived")&&(o.has(w.dst)?v:h).push(w.dst))}let y=C(e).heads.get(t);return{minted:h,matched:v,defaultsTaken:m,...n.stage?{held:{source_id:t,...y!=null?{staged_source_cid:y}:{},rows:i}}:{}}}}export{Ee as a,be as b,ve as c,Re as d};
|
package/dist/chunk-XWIN3S7O.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as Z,d as ee,e as te,f as ne}from"./chunk-GG43HSU2.js";import{b as B,d as Y}from"./chunk-OSALXGD4.js";import{d as X}from"./chunk-NVGBE2DR.js";var oe=new Set(["approve","edit","reject"]);function ae(i,t){return`chatop:${t}:${i.target??"new"}:${i.op}:${i.seq}`}function ue(i,t,x,k){let c=ae(i,t),f=i.payload;switch(i.op){case"approve":return{kind:"approve",target:i.target,expectedCid:i.expected_cid,eventId:c};case"edit":{let{reason:o,...b}=f;return{kind:"edit",target:i.target,expectedCid:i.expected_cid,edit:b,reason:o,eventId:c}}case"enhance":return{kind:"enhance",target:i.target,expectedCid:i.expected_cid,edges:f.edges??[],eventId:c};case"reject":return{kind:"reject",target:i.target,expectedCid:i.expected_cid,reason:f.reason??"",redirectTo:f.redirect_to,eventId:c};case"add":{let o=f.proposal_item??{},b=String(o.label??"");if(!x.mint_gate.includes(b))throw new Error(`GATED_LABEL: cannot mint "${b}" (gate: ${x.mint_gate.join(", ")})`);let a=o.cite??{},g=o.conv_source_id??k;if(!g||typeof a.turn!="number"||!a.quote)throw new Error("INVALID_ADD: a chat add requires a conversation cite {turn, quote} and conv_source_id");return{kind:"add",label:b,content:o.content??{},cite:{turn:a.turn,quote:a.quote},convSourceId:g,rationale:o.rationale,eventId:c}}}}function re(i,t,x={}){let k=x.turn??0,c=[],f=[];for(let a of i)(a.op==="add"||a.op==="enhance")&&f.push(a);let o=new Map;for(let a of i){if(!oe.has(a.op)||!a.target)continue;let g=o.get(a.target)??[];g.push(a),o.set(a.target,g)}for(let[a,g]of o){let w=Math.max(...g.map(_=>_.seq)),C=g.filter(_=>_.seq===w);if(C.length>1){c.push({target:a,seq:w,kinds:C.map(_=>_.op)});continue}f.push(C[0])}return{chatOps:f.sort((a,g)=>a.seq-g.seq).map(a=>ue(a,k,t,x.convSourceId)),ambiguous:c}}function ce(i){let t=[];return i.questions.forEach((x,k)=>{if(i.resolution[k])return;let c=x.recommended_index!=null?x.options[x.recommended_index]?.label:void 0;c!=null&&t.push(x.risk==="high"?`${c} \u203C`:c)}),t.length>3?`${t.slice(0,3).join(" \xB7 ")} \xB7 +${t.length-3} more`:t.join(" \xB7 ")}function ie(i){let t=i.text.replace(/\?+\s*$/,"");return t.length<=36?t:`${t.slice(0,33)}\u2026`}function le(i){return i.use_cases??[]}var de={acs:"acceptance criteria",scenarios:"scenarios",tests:"tests",gaps:"gaps"};function ge(i){let t=[],x=[],k=(o,b)=>{b.length!==0&&(x.push(o),t.push(...b))},c=o=>typeof o=="string"&&/^[a-z]{1,4}\d{1,4}$/i.test(o)?o:null,f=o=>{let b=c(o.automates)??"1 scenario",a=o.verifies??[],g=a.map(c).filter(_=>_!==null).slice(0,2),w=a.length-g.length,C=g.length?`${g.join(" ")}${w>0?` +${w}`:""}`:`${a.length} ACs`;return`covers ${b} \xB7 verifies ${C}`};return k("acs",(i.acs??[]).map(o=>({temp_ref:o.temp_ref,title:o.text,kind:"ac",badge:String(o.kind),extra:{...o.expected_answer?{expects:`${String(o.expected_answer.operator??"")} \xB7 ${String(o.expected_answer.operand??"")}`}:{},"scoped to":o.scoped_to??"(use-case)"}}))),k("scenarios",(i.scenarios??[]).map(o=>({temp_ref:o.temp_ref,title:o.title,kind:"scenario",badge:o.case_type,why:o.intent,depends_on_hint:o.depends_on??[],extra:{technique:o.technique_notes}}))),k("tests",(i.tests??[]).map(o=>({temp_ref:o.temp_ref,title:o.title,kind:"test",why:f(o),depends_on_hint:o.reuses??[],extra:{automates:String(o.automates??"?"),verifies:(o.verifies??[]).join(", "),check:o.check?`${String(o.check.kind)} vs ${String(o.check.verified_against)}`:"?"}}))),k("gaps",(i.gaps??[]).map(o=>({temp_ref:o.temp_ref??o.ref??"?",title:String(o.question?.header??o.kind),kind:"gap",badge:o.kind,why:o.risk_rationale}))),{items:t,heading:x.join(" + ")||"design"}}function be(i={}){let t={turns:[],thinking:ee(),pending:null,confirm:null,status:"idle",ledger:[],activeTurn:null,stream:null,checkpoint:!1},x=e=>{let n=[],r=e.minted.map(u=>u.slug).filter(Boolean);r.length&&n.push(`added ${r.join(", ")}`);let s=e.applied.length-e.minted.length;return s>0&&n.push(`${s} change${s===1?"":"s"} applied`),e.staleDelta.length&&n.push(`stales ${e.staleDelta.length}`),n.join(" \xB7 ")||"no changes"},k=[];i.onRender&&k.push(i.onRender);let c=0,f=0,o=null,b=null,a=null,g=[],w=0,C=e=>{if(!(!a||!i.contextDir||!e.trim()))try{let n=i.refreshGraph?.()??i.graph;if(!n)return;Y({contextDir:i.contextDir,graph:n,sourceId:a,text:e,by:i.by??{kind:"human",id:"owner"}})}catch{}},_=e=>{if(!a||!i.contextDir)return;let n=i.refreshGraph?.()??i.graph,r=n?.heads.get(a),s=n?.convChains.get(a);if(!n||typeof r!="string"||!s)return;let u=n.getNode(r)?.content?.blob,p=typeof u=="string"?X(i.contextDir,u)?.toString("utf8")??"":"";if(p)for(let y of e){if(y.kind!=="add"||y.convSourceId!==a)continue;let E=B(p,y.cite.turn);if(!(E!==null&&E.includes(y.cite.quote)))for(let S=s.turns;S>=1;S--){let N=B(p,S);if(N!==null&&N.includes(y.cite.quote)){y.cite={...y.cite,turn:S};break}}}},P=null,F=new Map,Q=new Map,G=null,m=()=>{D&&(clearTimeout(D),D=null);for(let e of k)e()},D=null,U=()=>{D||(D=setTimeout(()=>{D=null;for(let e of k)e()},80))},d=e=>{t.ledger.push(e)},R=null,O=!1,q=(e=!1)=>{R?d({kind:"agent",text:R}):e&&O&&d({kind:"note",text:'chat to refine ("looks good" approves; /done finishes)'}),R=null,O=!1},se=()=>{R=null,O=!1},T=null,W=e=>{if(T){if(e)for(let n of T.items){let r=e.get(n.temp_ref);r&&(n.logical_id=r)}d({kind:"turn",...T}),T=null}},A=()=>{W(),t.activeTurn&&(t.activeTurn=null)},z=(e,n)=>n.choice||(n.selected_index!=null?e.options[n.selected_index]?.label??"?":"?"),L=()=>{let e=t.pending;if(!e)return;if(!e.resolution.every(Boolean)){e.cursor=e.resolution.findIndex(s=>s===null);return}let n=e.questions.map((s,u)=>{let p=e.resolution[u];return p.form==="deferred"?{id:s.id,selected_index:null,free_text:null}:p.free_text!=null?{id:s.id,selected_index:null,free_text:p.free_text}:{id:s.id,selected_index:p.selected_index,free_text:null}});t.pending=null,t.status=t.status==="pausing"?"pausing":"streaming";let r=P;P=null,r?.(n)},j=(e,n)=>{let r=t.pending,s=r.questions[e],u=r.resolution[e];r.resolution[e]=n;let p=ie(s);u?d({kind:"answer",receipt:{form:"changed",qNum:e+1,stub:p,choice:z(s,n),prev:u.choice}}):n.form==="deferred"?d({kind:"answer",receipt:{form:"deferred",qNum:e+1,stub:p}}):d({kind:"answer",receipt:{form:n.form,qNum:e+1,stub:p,choice:z(s,n)}})},H=()=>{let e=t.pending;e&&(e.questions.forEach((n,r)=>{e.resolution[r]||j(r,{form:"deferred",selected_index:null,free_text:null,choice:""})}),L())},I=new Map,K=e=>{I.clear();let n={high:0,med:1,low:2};return e=e.map((r,s)=>({q:r,i:s})).sort((r,s)=>(n[r.q.risk]??3)-(n[s.q.risk]??3)||r.i-s.i).map(({q:r})=>r),{questions:e,cursor:0,resolution:e.map(()=>null)}};return{state:t,explainLines(e){if(!i.explain||!i.graph||i.contextDir===void 0)return null;let n=i.explain(i.contextDir,i.graph,e);return n.target?[`${n.target.label} ${n.target.slug??n.target.cid.slice(0,19)}:`,...n.entries.map(r=>` [${r.kind}] ${r.rationale??r.detail}`)]:null},explainRef(e){if(!i.explain||!i.graph||i.contextDir===void 0){d({kind:"note",text:"explain isn't available here"}),m();return}let n=i.explain(i.contextDir,i.graph,e),r=n.target?[`${n.target.label} ${n.target.slug??n.target.cid.slice(0,19)}:`,...n.entries.map(s=>` [${s.kind}] ${s.rationale??s.detail}`)].join(`
|
|
3
|
-
`):`unknown ref: ${e}`;d({kind:"note",text:r}),m()},subscribe(e){return k.push(e),()=>{let n=k.indexOf(e);n>=0&&k.splice(n,1)}},submit(e){if(t.confirm&&(t.confirm=null),!t.pending){if(!o){t.turns.push({role:"user",text:e}),d({kind:"user",text:e}),t.notice="the agent isn't running \u2014 nothing sent",m();return}for(t.notice=void 0,t.checkpoint=!1,q(),t.turns.push({role:"user",text:e}),d({kind:"user",text:e}),C(e),t.status="streaming",t.busySince=Date.now(),t.error=void 0,f+=1;g.length>0;)f+=1,o({type:"user_message",message_id:`u${f}-receipt`,text:g.shift()});o({type:"user_message",message_id:`u${f}`,text:e}),m()}},attachSender(e){let n=o;return o=e,()=>{o=n}},attachOnCommitted(e){b=e},attachConversationSource(e){a=e},holdReceipt(e){g.push(e),t.checkpoint=!0,m()},drainHeldReceipts(){return g.splice(0,g.length)},submitAnswer(e,n){let r=t.pending,s=r?.questions[e],u=s?.options[n]?.label;!r||!s||u==null||(j(e,{form:"answered",selected_index:n,free_text:null,choice:u}),L(),m())},submitFreeText(e,n){let r=t.pending,s=r?.questions[e],u=n.trim();!r||!s||!u||(j(e,{form:"answered",selected_index:null,free_text:u,choice:u}),L(),m())},toggleOption(e,n){let r=t.pending?.questions[e];if(!r||r.options[n]==null)return;let s=I.get(e)??new Set;s.has(n)?s.delete(n):s.add(n),I.set(e,s),m()},multiSelection(e){return[...I.get(e)??[]].sort((n,r)=>n-r)},confirmMulti(e){let n=t.pending,r=n?.questions[e];if(!n||!r)return;let s=[...I.get(e)??[]].sort((p,y)=>p-y).map(p=>r.options[p]?.label).filter(p=>p!=null);if(s.length===0)return;I.delete(e);let u=s.join(", ");j(e,{form:"answered",selected_index:null,free_text:u,choice:u}),L(),m()},goWithRecommendations(){let e=t.pending;if(!e)return{picks:""};let n=ce(e),r=null;return e.questions.forEach((s,u)=>{if(e.resolution[u])return;let p=s.recommended_index,y=p!=null?s.options[p]?.label:void 0;if(y==null){r===null&&(r=u);return}j(u,{form:"assumed",selected_index:p,free_text:null,choice:y})}),r!==null?(e.cursor=r,m(),{blocked:r}):(L(),m(),{picks:n})},reopenQuestion(){let e=t.pending;if(!e)return;let n=e.cursor<0?e.questions.length:e.cursor;for(let r=n-1;r>=0;r--)if(e.resolution[r]){e.cursor=r,m();return}},continueParked(){if(!(!o||g.length===0)){for(t.checkpoint=!1,d({kind:"continued"});g.length>0;)f+=1,o({type:"user_message",message_id:`u${f}-receipt`,text:g.shift()});f+=1,o({type:"user_message",message_id:`u${f}`,text:"continue"}),t.status="streaming",t.busySince=Date.now(),m()}},note(e){d({kind:"note",text:e}),m()},aliasOf(e){return Q.get(e)},registerAliases(e){for(let n of e)Q.set(n.ref,n.cid);W(new Map(e.filter(n=>n.id).map(n=>[n.ref,n.id]))),m()},setWorking(e){if(e!=null){if(t.status!=="idle"&&t.status!=="working")return;t.status==="idle"&&(t.busySince=Date.now()),t.status="working",t.workingLabel=e}else{if(t.status!=="working")return;t.status="idle",t.workingLabel=void 0}m()},ledger(e){e.kind==="commit"&&W(),(e.kind==="pause"||e.kind==="error"||e.kind==="summary")&&(A(),q()),(e.kind==="summary"||e.kind==="pause")&&(t.stream=null),d(e),e.kind==="commit"&&(e.ok?q(!0):se()),m()},completeSession(){H(),o?.({type:"session_complete"}),t.status="idle",m()},requestPause(){H(),t.status="pausing";let e=o;Promise.resolve().then(()=>e?.({type:"pause"})),m()},ask(e){return t.pending=K(e),F=new Map(e.map((n,r)=>[n.id,r+1])),t.status="awaiting-input",m(),new Promise(n=>{P=n})},noteCoercion(e,n){d({kind:"answer",receipt:{form:"assumed",qNum:F.get(e.id)??0,stub:ie(e),choice:n,note:"your typed answer couldn't be used here"}}),m()},onAgentEvent(e){switch(e.type){case"reasoning_delta":case"reasoning_done":case"tool_activity":case"decision_activity":{let n=t.thinking;if(t.thinking=ne(n,e),t.thinking!==n){if(e.type==="reasoning_done"&&e.present)d({kind:"thinking",tookMs:e.took_ms});else if(e.type==="tool_activity"&&e.status!=="started")d({kind:"tool",name:e.name,status:e.status==="done"?"ok":e.status,detail:e.detail});else if(e.type==="decision_activity"){let r=`\xB7 ${te(e)}`,s=t.ledger[t.ledger.length-1];s&&s.kind==="note"&&s.text===r||d({kind:"note",text:r})}}if(e.type==="reasoning_delta"){U();return}break}case"usage":t.credits={turn:e.credits,total:e.total_credits};break;case"text_delta":{let n=G;if(n&&(e.turn_id<n.turn_id||e.turn_id===n.turn_id&&e.attempt<n.attempt))return;(!n||n.turn_id!==e.turn_id||n.attempt!==e.attempt)&&(G={turn_id:e.turn_id,attempt:e.attempt},t.stream={text:""}),t.stream={text:(t.stream?.text??"")+e.text},U();return}case"progress":break;case"proposal":{c+=1,A(),t.stream=null,t.busySince&&(d({kind:"note",text:`\u2713 done in ${Math.max(1,Math.round((Date.now()-t.busySince)/1e3))}s`}),t.busySince=void 0);let n=le(e.proposal),r=i.dedupFlags?.(e.proposal);if(r)for(let s of n){let u=r.get(s.temp_ref);u&&(s.matches_existing=u)}t.turns.push({role:"agent",turnIndex:c,items:n,text:e.narrative}),R=e.narrative??null,O=!0,t.activeTurn={turnIndex:c,heading:"use-cases",items:n},T={turnIndex:c,heading:"use-cases",items:n},(t.status==="streaming"||t.status==="working")&&(t.status="idle"),t.workingLabel=void 0;break}case"design":{c+=1,A(),t.stream=null,t.busySince&&(d({kind:"note",text:`\u2713 done in ${Math.max(1,Math.round((Date.now()-t.busySince)/1e3))}s`}),t.busySince=void 0);let{items:n,heading:r}=ge(e.design),s=r.split(" + ").map(u=>de[u]??u).join(" + ");d({kind:"banner",text:`designing: ${s}`}),t.turns.push({role:"agent",turnIndex:c,items:n,itemsHeading:r,text:e.narrative}),R=e.narrative??null,O=!0,t.activeTurn={turnIndex:c,heading:r,items:n},T={turnIndex:c,heading:r,items:n},(t.status==="streaming"||t.status==="working")&&(t.status="idle"),t.workingLabel=void 0;break}case"ask_user":t.pending=K(e.questions),t.status="awaiting-input";break;case"chat_ops":{c+=1,A(),t.stream=null,t.status==="streaming"&&(t.status="idle");let n=e.chat_ops??e,r=Array.isArray(n.ops)?n.ops:[],s=n.text??e.text??"",u=i.refreshGraph?.()??i.graph,p=l=>Q.get(l)??l,y=r.map(l=>{if(!l.target)return l;let h=p(l.target),v=l.expected_cid;if(v==null&&u){let J=u.resolve(h);J&&(v=u.tipOf(J.cid))}let $=l.payload?.redirect_to,M=$&&p($);return h===l.target&&v===l.expected_cid&&M===$?l:{...l,target:h,expected_cid:v,...M!==$?{payload:{...l.payload,redirect_to:M}}:{}}}),E;try{if(!Array.isArray(n.ops))throw new Error("the agent sent an unreadable change set (no ops array) \u2014 say it again in different words");E=re(y,i.descriptor??{mint_gate:[]},{turn:c,...a?{convSourceId:a}:{}})}catch(l){t.error=l instanceof Error?l.message:String(l),t.turns.push({role:"agent",turnIndex:c,text:s,narration:t.error}),s&&d({kind:"agent",text:s}),d({kind:"error",title:t.error,detail:[]});break}let{chatOps:S,ambiguous:N}=E;if(N.length>0){let l=N[0];t.confirm={kind:"ambiguity-confirm",prompt:`did you mean edit or ${l.kinds.filter(h=>h!=="edit").join("/")} on ${l.target}?`},t.turns.push({role:"agent",turnIndex:c,text:s}),s&&d({kind:"agent",text:s});break}if(_(S),i.commitChatTurn&&S.length>0){let l=i.commitChatTurn({contextDir:i.contextDir??"",graph:i.refreshGraph?.()??i.graph,ops:S,by:i.by??{kind:"human",id:"owner"},...i.descriptor?.mint_gate?{mintable:i.descriptor.mint_gate}:{}});if(l.errors)t.error=l.errors.map(h=>h.detail).join("; "),t.turns.push({role:"agent",turnIndex:c,text:s}),d({kind:"commit",ok:!1,line:"commit failed \u2014 nothing landed",warnings:l.errors.map(h=>`${h.code}: ${h.detail}`)}),g.push(["COMMIT FAILED (chat turn) \u2014 nothing landed; do not assume any of your last ops applied.",...l.errors.map(h=>`- ${h.code}: ${h.detail}`),...l.errors.some(h=>h.code==="UNKNOWN_FIELD")?["If you were changing citations or matched-existing content, that is proposal territory (approve/re-propose) \u2014 a chat edit can only replace a node's own schema fields."]:[]].join(`
|
|
4
|
-
`)),s&&d({kind:"agent",text:s});else{l.applied.length>0&&i.session?.markApplied(l.applied);let h=x(l);t.turns.push({role:"agent",turnIndex:c,text:s,narration:h}),d({kind:"commit",ok:!0,line:h});let v=i.refreshGraph?.();if(v&&b&&b(v),v)try{w+=1;let V=i.descriptor?.mint_gate?.includes("usecase")?"extract":"design",$=Z({verb:V,commitN:w,phase:"chat",committed:l.minted.map(M=>({cid:M.cid,...M.slug?{logical_id:M.slug}:{}}))},v);g.push($.text)}catch{}s&&d({kind:"agent",text:s})}}else t.turns.push({role:"agent",turnIndex:c,text:s}),s&&d({kind:"agent",text:s});C(s);break}case"done":case"session_complete":A(),q(),t.status="idle",o=null;break;case"error":A(),q(),t.stream=null,t.status="idle",t.error=e.message,o=null,d({kind:"error",title:e.message,detail:[]});break;case"session_paused":break;default:break}m()}}}export{ce as a,ie as b,be as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g}from"./chunk-T4WZWKIU.js";import"./chunk-GRB66C5S.js";import"./chunk-3C5GMAM4.js";import"./chunk-JFAFKHDX.js";import"./chunk-DNNZ353O.js";import"./chunk-RN4OSVTG.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{b as designStateOf,g as evolveCommand,c as evolveOneUc,f as liveRunDesignForUc,a as resolveParentUc,e as runEvolveCommand,d as staleTargets};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-M5JQXOCE.js";import"./chunk-UR6MHSHU.js";export{l as _reset,g as cleanup,f as deregister,c as getRemoteLogger,k as installHandlers,d as isShuttingDown,b as logOrBufferRemote,e as register,i as setInkExit,a as setRemoteLogger,j as setTerminalRestore,h as shutdown};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as N}from"./chunk-3C5GMAM4.js";import{d as j,e as v}from"./chunk-2Z5MSC23.js";import"./chunk-K5JGCJ2K.js";import"./chunk-RQM3DUSB.js";import"./chunk-FXPPQL4D.js";import"./chunk-GG43HSU2.js";import"./chunk-JFAFKHDX.js";import"./chunk-OSALXGD4.js";import"./chunk-DNNZ353O.js";import{c as I}from"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import{a as k}from"./chunk-P4SE6YON.js";import{d as R}from"./chunk-7BCZLDNX.js";import{c as F}from"./chunk-RN4OSVTG.js";import{a as M}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-VCYVSKPM.js";import"./chunk-UR6MHSHU.js";async function Q(i){let[{render:s},e,{QuestionBatchPrompt:a}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),d=e.default??e;return new Promise(r=>{let f=s(d.createElement(a,{questions:i,onSubmit:p=>{f.unmount(),r(p)}}))})}async function U(i,s){let[{render:e},a,{ReviewChecklist:d}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),r=a.default??a;return new Promise(f=>{let p=e(r.createElement(d,{items:i.map(h=>{let c=s.get(h.temp_ref);return{uc:h,dedupWith:c&&!c.archived?c.cid:void 0,archivedMatch:c?.archived?{cid:c.cid,reason:c.reason}:void 0}}),onSubmit:h=>{p.unmount(),f(h)}}))})}async function q(i){let{createInterface:s}=await import("readline/promises"),e=s({input:process.stdin,output:process.stdout});try{let a=await e.question(`${i} [y/N] `);return/^y(es)?$/i.test(a.trim())}finally{e.close()}}async function te(i){let s=await R(),e=M(process.cwd()),a=await I(s);if(!a.ok)return process.stderr.write((a.message??"error: turn-endpoint preflight failed")+`
|
|
3
|
-
`),2;let d=async()=>a;if(i.plan)return v(i,{contextDir:e,agent:k,preflightTurn:d,ask:Q,review:U,confirmStale:q,out:n=>process.stdout.write(n+`
|
|
4
|
-
`),progress:n=>process.stderr.write(n+`
|
|
5
|
-
`),isTTY:F(),auth:s});let[{render:r},f,{ScrollbackProvider:p},{ChatSurface:h},{ScrollbackTap:c},{makeChatController:o},{setInkExit:P},C]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-B2QJYKV4.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-YX5A7R52.js"),import("./exit-manager-VCSIUYBR.js"),Promise.all([import("./chat-committer-MWZ4JQMM.js"),import("./descriptor-KXDJ4XYD.js"),import("./explain-VTRHEVUQ.js"),import("./readmodel-V3DVL6NP.js")])]),[{commitChatTurn:G},{topologyDescriptor:Y},{explain:z},{openGraph:y}]=C,E=f.default??f,l=o({commitChatTurn:G,descriptor:Y(),contextDir:e,refreshGraph:()=>y(e),graph:y(e),explain:z,by:{kind:"human",id:"owner"},dedupFlags:n=>j(n,y(e))}),D={current:null},V=0,S=null,x=!1,H=()=>{if(V+=1,V>=2){try{b.unmount()}catch{}process.exit(130)}l.requestPause(),S=setTimeout(()=>{x||(x=!0,(async()=>{l.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await D.current?.flush();try{b.unmount()}catch{}process.exit(130)})())},5e3)},$=await import("./dossier-ZHSHATVU.js"),L=n=>{try{return $.buildDossier(y(e),n)}catch{return null}},O={listUcs:()=>{let n=y(e),m=new Set(l.state.turns.flatMap(t=>(t.items??[]).map(u=>u.title.toLowerCase()))),w={high:0,med:1,low:2};return n.byLabel("usecase").filter(t=>!n.superseded.has(t.cid)).map((t,u)=>{let g=t.content,T=String(g.title??t.cid.slice(0,12)),_=N(n,t.cid),A=_?_.designed_at_cid===t.cid?"current":"stale":void 0;return{key:t.cid,title:T,badge:A==="current"?"designed":A==="stale"?"designed \xB7 stale":m.has(T.toLowerCase())?"drafted this session":"existing",designed:A,risk:g.risk,i:u}}).sort((t,u)=>(w[t.risk??"zz"]??3)-(w[u.risk??"zz"]??3)||t.i-u.i).map(({key:t,title:u,badge:g,designed:T})=>({key:t,title:u,badge:g,designed:T}))},runDesignChild:async(n,m=!1)=>{let[{runDesign:w}]=await Promise.all([import("./run-5DQSL5KH.js")]),t="",u=await w({useCase:n,force:m,mode:"interactive"},{contextDir:e,agent:k,preflightTurn:d,ask:g=>l.ask(g),chat:l,nested:!0,out:g=>{t=g},progress:()=>{},isTTY:!0,auth:s});return u!==0&&t&&l.note(t),u}},b=r(E.createElement(p,null,E.createElement(c,{into:D}),E.createElement(h,{controller:l,verb:"extract",onCtrlC:H,chain:O,inspect:L})),{exitOnCtrlC:!1});P(()=>b.unmount()),l.ledger({kind:"banner",text:"kane-cli context \xB7 extract \xB7 interactive"});try{let n=v(i,{contextDir:e,agent:k,preflightTurn:d,ask:m=>l.ask(m),review:async m=>new Map(m.map(w=>[w.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!0,out:m=>l.note(m),progress:()=>{},isTTY:F(),auth:s,chat:l});return n.finally(()=>{x=!0}),await n}finally{x=!0,S&&clearTimeout(S),await D.current?.flush();try{b.unmount()}catch{}}}async function re(i){let s=await R(),{makeHeadlessIO:e,resolveEncoding:a,guardedChannels:d}=await import("./headless-io-PWW6YKH2.js"),r=e(a(i.mode),"extract"),{makeInterruptGuard:f}=await import("./interrupt-guard-UREUWNRL.js"),p=f(k,o=>r.out(o)),c=d(r,()=>p.interrupted(),/^error: (agent failed|repair run failed|agent ended)/);try{let o=await v(i,{contextDir:M(process.cwd()),agent:p.agent,preflightTurn:()=>I(s),ask:async()=>[],review:async P=>new Map(P.map(C=>[C.temp_ref,{resolution:"skipped"}])),confirmStale:async()=>!1,out:c.out,emit:c.emit,progress:r.progress,isTTY:!1,auth:s});return p.interrupted()&&o!==3?(r.out("interrupted \u2014 no session saved"),r.done(130)):r.done(o)}catch(o){return r.event({type:"error",message:`error: extract failed: ${o instanceof Error?o.message:String(o)}`}),r.out(`error: extract failed: ${o instanceof Error?o.message:String(o)}`),r.out("hint: per-run trace logs live under .context/logs/ (extract-*.log)"),r.done(1)}finally{p.dispose()}}export{re as bindExtractHeadless,te as bindExtractInteractive};
|
package/dist/ingest-CBQAXVH6.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as a,c as b,d as c}from"./chunk-4GXOBABK.js";import"./chunk-DNNZ353O.js";import"./chunk-NVGBE2DR.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{c as ingestFile,a as slugFromFilename,b as versionBaseOf};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as g,c as p,d as $}from"./chunk-4GXOBABK.js";import{g as b}from"./chunk-E4EHWO3J.js";import"./chunk-DNNZ353O.js";import{c as l}from"./chunk-RN4OSVTG.js";import{a as m}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import{a as u}from"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";import{existsSync as h}from"fs";async function y(o,d,e,i=process.cwd()){let n=m(i);if(d.as!==void 0&&o.length>1)return(e.err??e.out)(`error: --as names ONE source identity \u2014 pass a single file (got ${o.length})`),2;for(let a of o){let f=d.as;if(e.isTTY&&f===void 0&&h(n)){let r=g(a),s=p(r);if(s){let c=u(n);c.heads.get(s)!=null&&c.heads.get(r)==null&&await e.confirm(`${r} looks like a new version of existing source '${s}' \u2014 ingest as '${s}' (moves its head)?`)&&(f=s)}}let t;try{t=await $({contextDir:n,filePath:a,asId:f,confirmSameSource:e.isTTY?r=>e.confirm(`identical bytes already ingested as ${r} \u2014 treat as the same source?`):void 0,pdfConverter:b})}catch(r){return e.out(`error: ${a}: ${r instanceof Error?r.message:String(r)}`),1}e.out(`${t.status} ${t.source_id} source ${t.cid} blob ${t.blob}`);for(let r of t.warnings??[])e.out(`warning: ${r}`);if(t.pdf&&e.out(`${t.source_id}: pdf, ${t.pdf.pages} pages, ${t.pdf.delivered} images delivered (${t.pdf.omitted} omitted)`),!e.isTTY&&t.status==="created"){let r=u(n);for(let[s,c]of r.heads.entries())if(!(s===t.source_id||c==null)&&r.getNode(c)?.content.blob===t.blob){e.out(`hint: identical bytes already ingested as ${s} \u2014 merged later via review`);break}}}return 0}async function P(o,d){let{createInterface:e}=await import("readline/promises");return y(o,d,{out:i=>process.stdout.write(i+`
|
|
3
|
-
`),isTTY:l(),confirm:async i=>{let n=e({input:process.stdin,output:process.stdout});try{let a=await n.question(`${i} [Y/n] `);return!/^n(o)?$/i.test(a.trim())}finally{n.close()}}})}export{P as ingestCommand,y as runIngestCommand};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as b}from"./chunk-VXLOEM2U.js";import"./chunk-SHAA6FOD.js";import"./chunk-KHU7C6EE.js";import"./chunk-3C5GMAM4.js";import"./chunk-RQM3DUSB.js";import"./chunk-FXPPQL4D.js";import"./chunk-GG43HSU2.js";import"./chunk-JFAFKHDX.js";import"./chunk-OSALXGD4.js";import"./chunk-DNNZ353O.js";import"./chunk-YKTYVJBN.js";import"./chunk-CVOGP253.js";import"./chunk-427OQS2N.js";import{c as y}from"./chunk-RN4OSVTG.js";import"./chunk-ZPDM6FO7.js";import{a as v}from"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-L5LI2JF4.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-VCYVSKPM.js";import"./chunk-UR6MHSHU.js";async function N(t){let[{render:u},o,{QuestionBatchPrompt:p}]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./ui-JEJGTURD.js")]),i=o.default??o;return new Promise(r=>{let m=u(i.createElement(p,{questions:t,onSubmit:a=>{m.unmount(),r(a)}}))})}async function U(t){let[{resolveAgentAuthEnv:u},{runAgent:o},{preflightTurn:p}]=await Promise.all([import("./spawner-C6B5J73J.js"),import("./bridge-V4FF5QPK.js"),import("./turn-preflight-JGYT7LXP.js")]),i=await u(),r=v(process.cwd()),{baseUrlAdvisory:m}=await import("./turn-preflight-JGYT7LXP.js"),a=m();a&&process.stderr.write(a+`
|
|
3
|
-
`);let d=await p(i);if(!d.ok)return process.stderr.write((d.message??"error: turn-endpoint preflight failed")+`
|
|
4
|
-
`),2;let x=async()=>d;if(t.plan)return b(t,{contextDir:r,agent:o,preflightTurn:x,ask:N,out:e=>process.stdout.write(e+`
|
|
5
|
-
`),progress:e=>process.stderr.write(e+`
|
|
6
|
-
`),isTTY:y(),auth:i});if(!t.resume){let[{openGraph:e},{designGate:s}]=await Promise.all([import("./readmodel-V3DVL6NP.js"),import("./gate-B6C6KLFA.js")]),k=s(e(r),t.useCase,!!t.force);if(!k.ok)return process.stderr.write(`design: ${k.message}
|
|
7
|
-
`),k.code}let[{render:C},T,{ScrollbackProvider:D},{ChatSurface:A},{ScrollbackTap:E},{makeChatController:R},{setInkExit:S},G]=await Promise.all([import("./build-JIKYOZUH.js"),import("./react-QWOAB3TB.js"),import("./scrollback-JLPJR25X.js"),import("./ChatSurface-B2QJYKV4.js"),import("./ScrollbackTap-Q3IOKNMS.js"),import("./chat-controller-YX5A7R52.js"),import("./exit-manager-VCSIUYBR.js"),Promise.all([import("./chat-committer-MWZ4JQMM.js"),import("./descriptor-KXDJ4XYD.js"),import("./explain-VTRHEVUQ.js"),import("./readmodel-V3DVL6NP.js")])]),[{commitChatTurn:j},{topologyDescriptor:I},{explain:O},{openGraph:f}]=G,h=T.default??T,n=R({commitChatTurn:j,descriptor:I("design"),contextDir:r,refreshGraph:()=>f(r),graph:f(r),explain:O,by:{kind:"human",id:"owner"}}),{buildDossier:Q}=await import("./dossier-ZHSHATVU.js"),Y=e=>{try{return Q(f(r),e)}catch{return null}},g={current:null},P=0,w=null,c=!1,B=()=>{if(P+=1,P>=2){try{l.unmount()}catch{}process.exit(130)}n.requestPause(),w=setTimeout(()=>{c||(c=!0,(async()=>{n.ledger({kind:"interrupted",detail:"the agent did not confirm the pause within 5s"}),await g.current?.flush();try{l.unmount()}catch{}process.exit(130)})())},5e3)},l=C(h.createElement(D,null,h.createElement(E,{into:g}),h.createElement(A,{controller:n,verb:"design",onCtrlC:B,inspect:Y})),{exitOnCtrlC:!1});S(()=>l.unmount()),n.ledger({kind:"banner",text:`kane-cli design \xB7 ${t.useCase??t.resume??""}`});try{let e=b(t,{contextDir:r,agent:o,preflightTurn:x,ask:s=>n.ask(s),out:s=>n.note(s),progress:()=>{},isTTY:y(),auth:i,chat:n});return e.finally(()=>{c=!0}),await e}finally{c=!0,w&&clearTimeout(w),await g.current?.flush();try{l.unmount()}catch{}}}export{U as bindDesignInteractive};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i}from"./chunk-FFHBQK5N.js";import"./chunk-FPFOW6BS.js";import"./chunk-WAOCHXJ5.js";import"./chunk-M5JQXOCE.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-QZJID3OZ.js";import"./chunk-DPOES6G3.js";import"./chunk-VCYVSKPM.js";import"./chunk-UR6MHSHU.js";export{d as emitNdjson,b as filterByName,g as formatAuthResolutionError,c as paginate,a as parsePagination,i as registerListCommands,e as renderTable,f as resolveTmsBasicAuth,h as validateCreateName};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-4FH2KFRT.js";import"./chunk-U5QTE3WX.js";import"./chunk-RFHMDQXZ.js";import"./chunk-RZ4F3BHX.js";import"./chunk-QZJID3OZ.js";import"./chunk-DPOES6G3.js";import"./chunk-VCYVSKPM.js";import"./chunk-UR6MHSHU.js";export{a as LoginFlow};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g}from"./chunk-E4EHWO3J.js";import"./chunk-NVGBE2DR.js";import"./chunk-IAHKTEET.js";import"./chunk-UR6MHSHU.js";export{e as PDFJS_VERSION,b as PDF_IMAGE_CAP,a as PDF_IMAGE_DIMENSION_FLOOR,d as PDF_IMAGE_MAX_BYTES,c as PDF_VISION_BYTE_BUDGET,f as PdfConvertError,g as convertPdf};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c}from"./chunk-GLS46X7N.js";import"./chunk-2YQ6TW77.js";import"./chunk-WAOCHXJ5.js";import"./chunk-O4HWPV67.js";import"./chunk-FCMLIK7P.js";import"./chunk-CJJXT5DO.js";import"./chunk-QM4S2APK.js";import"./chunk-ZPDM6FO7.js";import"./chunk-BC7UVJJB.js";import"./chunk-NVGBE2DR.js";import"./chunk-EHN5HTUD.js";import"./chunk-L5LI2JF4.js";import"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-2WVKOZ6W.js";import"./chunk-NLCCBXXV.js";import"./chunk-RZ4F3BHX.js";import"./chunk-QZJID3OZ.js";import"./chunk-VCYVSKPM.js";import"./chunk-UR6MHSHU.js";export{c as UploadPipeline,b as packPresignEntry,a as readPackForUpload};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-LEA6IHXC.js";import"./chunk-RGDQMKNJ.js";import"./chunk-L3HG5ONB.js";import"./chunk-L4JIMNKW.js";import"./chunk-MBXWXBDM.js";import"./chunk-IAHKTEET.js";import"./chunk-5YPBPZUR.js";import"./chunk-UR6MHSHU.js";export{a as openGraph,b as staleForEvolve};
|