thursday-agent 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +3 -2
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.json +8 -1
- package/.next/routes-manifest.json +18 -6
- package/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +13 -13
- package/.next/server/app/_not-found.segments/_full.segment.rsc +13 -13
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +12 -12
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/server/app/api/artifact/route.js +10 -6
- package/.next/server/app/api/artifact/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/files/route.js +6 -5
- package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/memory/route.js +8 -8
- package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/route.js +8 -8
- package/.next/server/app/api/bot/route.js.nft.json +1 -1
- package/.next/server/app/api/bot/thread/[id]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/bot/thread/[id]/route.js +15 -0
- package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/bot/thread/[id]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/bot/thread/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/bot/thread/route.js +15 -0
- package/.next/server/app/api/bot/thread/route.js.nft.json +1 -0
- package/.next/server/app/api/bot/thread/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/config/route.js +7 -7
- package/.next/server/app/api/config/route.js.nft.json +1 -1
- package/.next/server/app/api/events/route.js +3 -3
- package/.next/server/app/api/events/route.js.nft.json +1 -1
- package/.next/server/app/api/file/[...path]/route.js +5 -5
- package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/catalog/route.js +8 -8
- package/.next/server/app/api/llm-model/catalog/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/credits/route.js +8 -8
- package/.next/server/app/api/llm-model/credits/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/route.js +8 -8
- package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
- package/.next/server/app/api/llm-model/subscription/route.js +8 -8
- package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/[name]/route.js +6 -6
- package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/oauth/callback/route.js +4 -4
- package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/route.js +6 -6
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/mcp/tools/route.js +6 -6
- package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/edit/route.js +13 -13
- package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
- package/.next/server/app/api/memory/route.js +7 -6
- package/.next/server/app/api/memory/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/[source]/[name]/route.js +6 -6
- package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
- package/.next/server/app/api/skills/route.js +6 -6
- package/.next/server/app/api/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/call/route.js +10 -11
- package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/skills/route.js +10 -11
- package/.next/server/app/api/thursday/skills/route.js.nft.json +1 -1
- package/.next/server/app/api/thursday/tool-call/route.js +15 -15
- package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
- package/.next/server/app/api/workspace/missing/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/workspace/missing/route/build-manifest.json +12 -0
- package/.next/server/app/api/workspace/missing/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/workspace/missing/route.js +12 -0
- package/.next/server/app/api/workspace/missing/route.js.map +5 -0
- package/.next/server/app/api/workspace/missing/route.js.nft.json +1 -0
- package/.next/server/app/api/workspace/missing/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/workspace/route.js +5 -4
- package/.next/server/app/api/workspace/route.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +1 -1
- package/.next/server/app/artifact/[...path]/page.js +4 -3
- package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
- package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
- package/.next/server/app/page/server-reference-manifest.json +67 -45
- package/.next/server/app/page.js +10 -9
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +3 -2
- package/.next/server/chunks/[root-of-the-server]__02846fb._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__049f521._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__05luceg._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__06--3q3._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__07bnah_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__08eae20._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__0_ue8oe._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0c9fgca._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__0g-ueei._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__0h_x6q6._.js +5 -0
- package/.next/server/chunks/{[root-of-the-server]__0pa2n68._.js → [root-of-the-server]__0kxrvxf._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0q0vvt2._.js → [root-of-the-server]__0ov3iir._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0qwtlmx._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__0sm5xvm._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0ye3da2._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0zp35ul._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__144u9d_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__18-2tsq._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1e-ci13._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1e2365e._.js +8 -0
- package/.next/server/chunks/[root-of-the-server]__1fix932._.js +8 -0
- package/.next/server/chunks/{[root-of-the-server]__0ce8nf8._.js → [root-of-the-server]__1g3t7vn._.js} +3 -3
- package/.next/server/chunks/[root-of-the-server]__1kp-83u._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1kv8p3e._.js +5 -0
- package/.next/server/chunks/[root-of-the-server]__1orn-5b._.js +2 -3
- package/.next/server/chunks/_02szwk8._.js +5 -0
- package/.next/server/chunks/_05h2cii._.js +1 -1
- package/.next/server/chunks/_06c9kie._.js +216 -0
- package/.next/server/chunks/{_1x6kd1r._.js → _07y2gj-._.js} +1 -1
- package/.next/server/chunks/_0a43a-0._.js +3 -0
- package/.next/server/chunks/_0bujjey._.js +5 -0
- package/.next/server/chunks/_0c9j6rb._.js +1 -1
- package/.next/server/chunks/_0dkd549._.js +3 -0
- package/.next/server/chunks/_0ej1kvv._.js +3 -0
- package/.next/server/chunks/_0f6ts7z._.js +3 -0
- package/.next/server/chunks/_0gm9hyv._.js +55 -0
- package/.next/server/chunks/_0i55en5._.js +25 -0
- package/.next/server/chunks/_0k50n27._.js +18 -0
- package/.next/server/chunks/_0khihjk._.js +3 -3
- package/.next/server/chunks/_0n74zsf._.js +5 -5
- package/.next/server/chunks/_0nvm9ef._.js +3 -0
- package/.next/server/chunks/_0p56fn0._.js +3 -0
- package/.next/server/chunks/_0recufk._.js +1 -1
- package/.next/server/chunks/_0xbkz10._.js +3 -0
- package/.next/server/chunks/_10tkr26._.js +3 -0
- package/.next/server/chunks/{_0ioz3nd._.js → _11u2kp7._.js} +1 -1
- package/.next/server/chunks/_11ujpya._.js +3 -0
- package/.next/server/chunks/_127nx_p._.js +5 -0
- package/.next/server/chunks/_17l5ygt._.js +1 -1
- package/.next/server/chunks/_19uauj6._.js +3 -0
- package/.next/server/chunks/_1_5mnq4._.js +5 -5
- package/.next/server/chunks/_1abl6t9._.js +55 -0
- package/.next/server/chunks/_1d0j961._.js +3 -3
- package/.next/server/chunks/_1dbixxz._.js +3 -0
- package/.next/server/chunks/_1dc_d1q._.js +98 -0
- package/.next/server/chunks/_1drgfx4._.js +5 -5
- package/.next/server/chunks/_1e48czp._.js +3 -3
- package/.next/server/chunks/_1f31u5x._.js +5 -0
- package/.next/server/chunks/_1kg70wc._.js +3 -3
- package/.next/server/chunks/_1klbcft._.js +5 -0
- package/.next/server/chunks/_1krd9rf._.js +4 -1
- package/.next/server/chunks/_1kwmzab._.js +3 -0
- package/.next/server/chunks/{_1pf4qe-._.js → _1oxj9fa._.js} +1 -1
- package/.next/server/chunks/{_1f46eie._.js → _1pcmdbb._.js} +1 -1
- package/.next/server/chunks/_1qgix-j._.js +3 -0
- package/.next/server/chunks/{lib_logger_ts_1exwjut._.js → _1rpchta._.js} +5 -5
- package/.next/server/chunks/_1vsej-s._.js +5 -0
- package/.next/server/chunks/_1yx0p_s._.js +5 -0
- package/.next/server/chunks/{_0rnf-6n._.js → _20fsr_z._.js} +6 -6
- package/.next/server/chunks/_2128hkj._.js +5 -0
- package/.next/server/chunks/_next-internal_server_app_api_bot_thread_[id]_route_actions_1fstjn2.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_bot_thread_route_actions_003ccso.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_workspace_missing_route_actions_1fidi6p.js +3 -0
- package/.next/server/chunks/config_ts_1g4sz5o._.js +1 -1
- package/.next/server/chunks/features_0-cnt0l._.js +4 -0
- package/.next/server/chunks/features_0hdaci0._.js +4 -0
- package/.next/server/chunks/features_1e39j7-._.js +8 -0
- package/.next/server/chunks/features_bot_bot_query_ts_12mgkl2._.js +1 -1
- package/.next/server/chunks/features_memory_1uqvksn._.js +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0r28-sm._.js → node_modules_consola_dist_chunks_prompt_mjs_0a7-pbw._.js} +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0v_7drq._.js → node_modules_consola_dist_chunks_prompt_mjs_0gzvgfv._.js} +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0i7cvml._.js → node_modules_consola_dist_chunks_prompt_mjs_107pxfn._.js} +1 -1
- package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0icqaqw._.js → node_modules_consola_dist_chunks_prompt_mjs_15hbel8._.js} +1 -1
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_18i-23e._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1bewgf3._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1kipdeo._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1nlww1m._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1q77nfx._.js +3 -0
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1xqdzx_._.js +3 -0
- package/.next/server/chunks/{node_modules_zod_v4_1801ax7._.js → node_modules_zod_v4_0lkux5-._.js} +2 -2
- package/.next/server/chunks/{node_modules_zod_v4_1cha_bw._.js → node_modules_zod_v4_1jmr9cq._.js} +2 -2
- package/.next/server/chunks/{node_modules_zod_v4_0ubdflj._.js → node_modules_zod_v4_1yrxmek._.js} +2 -2
- package/.next/server/chunks/node_modules_zod_v4_classic_errors_0tp0y-q.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__09q9med._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0bxsfyn._.js +101 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0lyi8i2._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__16jc196._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__172cq4x._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__18dthbp._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__18e68w8._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1fll8dc._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1mzi-ju._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__1nygfik._.js +5 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1sdphb0._.js +8 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1waa3rc._.js +100 -0
- package/.next/server/chunks/ssr/_00rehl_._.js +3 -0
- package/.next/server/chunks/ssr/{_1lz_cq2._.js → _02oc_h5._.js} +76 -89
- package/.next/server/chunks/ssr/_03_928f._.js +3 -0
- package/.next/server/chunks/ssr/_05yghx6._.js +3 -0
- package/.next/server/chunks/ssr/_08c4z-9._.js +3 -0
- package/.next/server/chunks/ssr/_0_qfdlw._.js +4 -0
- package/.next/server/chunks/ssr/_0c9e5w6._.js +9 -0
- package/.next/server/chunks/ssr/{_0s99bgb._.js → _0dh2e1j._.js} +9 -3
- package/.next/server/chunks/ssr/_0dr-ddg._.js +3 -0
- package/.next/server/chunks/ssr/_0eaog6_._.js +3 -0
- package/.next/server/chunks/ssr/_0evkpto._.js +3 -0
- package/.next/server/chunks/ssr/_0g_rlog._.js +3 -0
- package/.next/server/chunks/ssr/_0geg212._.js +3 -0
- package/.next/server/chunks/ssr/{_1gd8q8l._.js → _0hxt2ul._.js} +2 -2
- package/.next/server/chunks/ssr/_0i_6q1w._.js +2 -2
- package/.next/server/chunks/ssr/_0lu1n_x._.js +1 -1
- package/.next/server/chunks/ssr/{_15j2_8f._.js → _0wzaht-._.js} +2 -2
- package/.next/server/chunks/ssr/_0z-g0uy._.js +3 -0
- package/.next/server/chunks/ssr/_123ttsf._.js +3 -0
- package/.next/server/chunks/ssr/_123y-ah._.js +3 -0
- package/.next/server/chunks/ssr/_12w42gi._.js +3 -0
- package/.next/server/chunks/ssr/_161kqav._.js +3 -0
- package/.next/server/chunks/ssr/{_0ap2fzn._.js → _16c6_xm._.js} +2 -2
- package/.next/server/chunks/ssr/_18opah7._.js +3 -0
- package/.next/server/chunks/ssr/_18xqmny._.js +3 -0
- package/.next/server/chunks/ssr/_1_krfph._.js +3 -0
- package/.next/server/chunks/ssr/{_1-_etts._.js → _1anqots._.js} +2 -2
- package/.next/server/chunks/ssr/_1ey7qn-._.js +70 -0
- package/.next/server/chunks/ssr/_1g9vs7q._.js +3 -0
- package/.next/server/chunks/ssr/_1jmz33w._.js +3 -0
- package/.next/server/chunks/ssr/{_0n3toaw._.js → _1k0spz7._.js} +2 -2
- package/.next/server/chunks/ssr/_1rgtxhr._.js +5 -0
- package/.next/server/chunks/ssr/_1slp25y._.js +3 -0
- package/.next/server/chunks/ssr/{_1fojd41._.js → _1x9pskj._.js} +3 -3
- package/.next/server/chunks/ssr/_1y6b5mr._.js +101 -0
- package/.next/server/chunks/ssr/_1ztk7p6._.js +7 -0
- package/.next/server/chunks/ssr/components_ui_tabs_tsx_0ej40b4._.js +3 -0
- package/.next/server/chunks/ssr/features_bot_thread_query_ts_023eklt._.js +4 -0
- package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +1 -1
- package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
- package/.next/server/chunks/ssr/{_1-teee5._.js → lib_logger_ts_0-olsze._.js} +2 -7
- package/.next/server/chunks/ssr/{node_modules_0cxaxk9._.js → node_modules_00_51_v._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_04jf_m8._.js → node_modules_022sipm._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0g7fzk3._.js → node_modules_0332gw4._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1cx_ql6._.js → node_modules_04vxchl._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1vh5ntv._.js → node_modules_0746rzi._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0yugy6m._.js → node_modules_0d5uzof._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_09q35v_._.js → node_modules_0exkwcm._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_08dhkiq._.js → node_modules_0fr-ml8._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_14q6g4n._.js → node_modules_0mxvg8h._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0arus10._.js → node_modules_0qapgjr._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1eg7m6c._.js → node_modules_0qbfyjh._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1cz2hle._.js → node_modules_0t-9nup._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_17bwo43._.js → node_modules_0tusx4d._.js} +3 -3
- package/.next/server/chunks/ssr/{node_modules_1efrqxi._.js → node_modules_0vsxbzp._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0_-_a--._.js → node_modules_0vv0-fg._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1gdh31p._.js → node_modules_0wsvp00._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1hpopmo._.js → node_modules_1-urho9._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1_pc9kq._.js → node_modules_16pi_dd._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_00etblx._.js → node_modules_1d53yiq._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1aaxuef._.js → node_modules_1g1eihe._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_198nmll._.js → node_modules_1gpednh._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0pvd7q-._.js → node_modules_1gu1pph._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0b__sgl._.js → node_modules_1he1w8_._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_1qpjvy5._.js → node_modules_1lnjapm._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0940ns5._.js → node_modules_1lynj9m._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0x3-ply._.js → node_modules_1seuurl._.js} +2 -2
- package/.next/server/chunks/ssr/{node_modules_14om4ar._.js → node_modules_1u6w1pb._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_0had7xd._.js → node_modules_1xn6saw._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1b748ic._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_067_exa._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1z4hm5e._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0nrrdaq._.js} +1 -1
- package/.next/server/chunks/ssr/{node_modules_@vercel_oidc_dist_06mk8id._.js → node_modules_@vercel_oidc_dist_21a5haa._.js} +1 -1
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_trash_mjs_0px2gzr._.js +3 -0
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +68 -46
- package/.next/static/chunks/0dr16v67vj4n7.js +2 -0
- package/.next/static/chunks/0g4b348l0pve7.js +1 -0
- package/.next/static/chunks/0joan-69kbspd.js +1 -0
- package/.next/static/chunks/0vlgzqo9ka90v.js +1 -0
- package/.next/static/chunks/0zrupxgci5gqc.js +1 -0
- package/.next/static/chunks/10k2xvap03z20.css +1 -0
- package/.next/static/chunks/18mkhstgiqcbt.js +1 -0
- package/.next/static/chunks/{15m575979un5f.js → 1i-u2wzub_to1.js} +2 -2
- package/.next/static/chunks/1kp5nfp06nj9h.js +5 -0
- package/.next/static/chunks/1ohslk4568tm3.js +1 -0
- package/.next/static/chunks/1sbmwswc9k2-1.js +1 -0
- package/.next/static/chunks/1t9qms5pwwa3n.js +1 -0
- package/.next/static/chunks/1vj_5bnbxx84e.js +1 -0
- package/.next/static/chunks/1vqezbhjm3goq.js +1 -0
- package/.next/static/chunks/{3akmqm77muj4-.js → 1wlo979mx-y3w.js} +1 -1
- package/.next/static/chunks/26ql4y-43xwhp.js +1 -0
- package/.next/static/chunks/{0fl3gwe4-l6tz.js → 2_pnccjp6j1ca.js} +1 -1
- package/.next/static/chunks/2a51-ywz9b2a3.js +1 -0
- package/.next/static/chunks/2fvdgxih7x7hr.js +1 -0
- package/.next/static/chunks/2jlz8zp4jax_m.js +18 -0
- package/.next/static/chunks/2nvepds1fu2ux.js +1 -0
- package/.next/static/chunks/3addj3i4-izma.js +1 -0
- package/.next/static/chunks/3bfwpww3m3x4u.js +1 -0
- package/.next/static/chunks/3gfh7nxwusbt0.js +1 -0
- package/.next/static/chunks/3gwa44cvz4qoi.js +1 -0
- package/.next/static/chunks/{38gweqdo4jpfj.js → 3izg0a3k87q1-.js} +5 -5
- package/.next/static/chunks/3zk6q3-3f9swq.js +99 -0
- package/.next/static/chunks/3zkg5iup3v4a2.js +12 -0
- package/.next/static/chunks/405m0bqtoihev.js +1 -0
- package/.next/static/chunks/42wcg3wfg_m_p.js +1 -0
- package/README.md +27 -216
- package/app/api/events/app-event.ts +6 -4
- package/app/api/query-key.ts +25 -16
- package/bin/database.mjs +37 -0
- package/bin/thursday.mjs +44 -28
- package/components/ui/custom-icon.tsx +0 -60
- package/components/ui/radio-group.tsx +37 -0
- package/components/ui/shiny-text.tsx +33 -6
- package/database/migrations/{20260910173049_numerous_spirit → 20260916145701_clever_multiple_man}/migration.sql +80 -24
- package/database/migrations/{20260910173049_numerous_spirit → 20260916145701_clever_multiple_man}/snapshot.json +689 -110
- package/database/migrations/20260916160713_thread_cancelled/migration.sql +2 -0
- package/database/migrations/{20260911030320_opposite_jack_power → 20260916160713_thread_cancelled}/snapshot.json +706 -84
- package/docs/how-it-works.md +39 -36
- package/docs/images/keeps-going.png +0 -0
- package/docs/images/two-minds.png +0 -0
- package/docs/live-calls.md +231 -0
- package/docs/thread-rooms.md +71 -0
- package/features/ai/chatgpt.ts +1 -2
- package/features/ai/live.schema.ts +128 -0
- package/features/ai/load-tools.ts +148 -77
- package/features/ai/model.schema.ts +2 -120
- package/features/ai/model.ts +52 -88
- package/features/ai/prompts/bot.prompt.ts +91 -214
- package/features/ai/prompts/live.prompt.ts +265 -0
- package/features/ai/prompts/prompt-helper.ts +91 -32
- package/features/ai/prompts/thursday.prompt.ts +125 -172
- package/features/ai/tools/bot.tool.ts +38 -145
- package/features/ai/tools/call.tool.ts +1 -1
- package/features/ai/tools/connected.ts +5 -3
- package/features/ai/tools/mcp.tool.ts +7 -4
- package/features/ai/tools/memory.tool.ts +35 -31
- package/features/ai/tools/skills.tool.ts +36 -14
- package/features/ai/tools/studio.tool.ts +26 -21
- package/features/ai/tools/tool-name.ts +2 -5
- package/features/ai/tools/workspace.tool.ts +33 -10
- package/features/artifact/artifact.action.ts +2 -2
- package/features/artifact/artifact.query.ts +112 -61
- package/features/artifact/artifact.schema.ts +8 -6
- package/features/artifact/components/artifact-setting.tsx +83 -33
- package/features/bot/bot.action.ts +43 -36
- package/features/bot/bot.memory.ts +137 -20
- package/features/bot/bot.query.ts +28 -11
- package/features/bot/bot.run.ts +299 -636
- package/features/bot/bot.runner.ts +468 -844
- package/features/bot/bot.schema.ts +93 -82
- package/features/bot/bot.seed.ts +141 -64
- package/features/bot/components/bot-mark.tsx +324 -232
- package/features/bot/components/bot-room.tsx +1613 -697
- package/features/bot/components/bot-roster.tsx +8 -13
- package/features/bot/components/bot-setting.tsx +58 -42
- package/features/bot/components/bot-tool.tsx +55 -87
- package/features/bot/components/mark-palette.tsx +35 -32
- package/features/bot/components/path-chips.tsx +33 -3
- package/features/bot/components/thread-badge.tsx +34 -0
- package/features/bot/components/thread-reply.tsx +639 -0
- package/features/bot/components/thread-setting.tsx +674 -0
- package/features/bot/mark.const.ts +79 -31
- package/features/bot/room.query.ts +889 -0
- package/features/bot/room.schema.ts +64 -0
- package/features/bot/seed-bots.ts +2 -1
- package/features/bot/thread.query.ts +971 -0
- package/features/bot/thread.store.ts +587 -0
- package/features/config/components/voice-key.tsx +113 -88
- package/features/config/config.const.ts +5 -9
- package/features/connectors/mcp.schema.ts +0 -2
- package/features/intro/components/intro.tsx +169 -139
- package/features/memory/components/memory-setting.tsx +2 -7
- package/features/memory/memory.schema.ts +14 -23
- package/features/settings/components/setting-ui.tsx +0 -44
- package/features/settings/components/settings.tsx +12 -12
- package/features/settings/settings.alert.ts +3 -3
- package/features/settings/settings.store.ts +1 -1
- package/features/skills/skills.schema.ts +0 -2
- package/features/thursday/components/ascii-field.tsx +24 -44
- package/features/thursday/components/ascii-orb.tsx +359 -358
- package/features/thursday/components/call-log.tsx +46 -44
- package/features/thursday/components/face.tsx +35 -10
- package/features/thursday/components/tab-state.tsx +3 -3
- package/features/thursday/components/thursday-mark.tsx +1 -0
- package/features/thursday/components/thursday-setting.tsx +631 -332
- package/features/thursday/components/thursday.tsx +106 -41
- package/features/thursday/components/voice-picker.tsx +255 -0
- package/features/thursday/thursday.action.ts +94 -68
- package/features/thursday/thursday.query.ts +49 -30
- package/features/thursday/thursday.schema.ts +27 -30
- package/features/thursday/thursday.store.ts +11 -7
- package/features/thursday/tool-call.ts +3 -3
- package/features/thursday/tool-line.ts +5 -3
- package/features/thursday/use-thursday.ts +725 -450
- package/features/workspace/workspace.query.ts +17 -0
- package/features/workspace/workspace.ts +103 -50
- package/lib/live/live.schema.ts +47 -0
- package/lib/live/live.server.ts +155 -0
- package/lib/live/live.session.ts +574 -0
- package/lib/{realtime/realtime.tap.ts → live/live.tap.ts} +41 -12
- package/lib/live/live.transport.ts +152 -0
- package/lib/protocol/use-server-pages.ts +9 -5
- package/lib/utils.ts +21 -20
- package/package.json +2 -2
- package/public/voices/alloy.ogg +0 -0
- package/public/voices/ash.ogg +0 -0
- package/public/voices/ballad.ogg +0 -0
- package/public/voices/beacon.ogg +0 -0
- package/public/voices/bossa.ogg +0 -0
- package/public/voices/cedar.ogg +0 -0
- package/public/voices/cinder.ogg +0 -0
- package/public/voices/coral.ogg +0 -0
- package/public/voices/delta.ogg +0 -0
- package/public/voices/echo.ogg +0 -0
- package/public/voices/gleam.ogg +0 -0
- package/public/voices/marin.ogg +0 -0
- package/public/voices/meridian.ogg +0 -0
- package/public/voices/quartz.ogg +0 -0
- package/public/voices/ripple.ogg +0 -0
- package/public/voices/sage.ogg +0 -0
- package/public/voices/shimmer.ogg +0 -0
- package/public/voices/stone.ogg +0 -0
- package/public/voices/tempo.ogg +0 -0
- package/public/voices/verse.ogg +0 -0
- package/public/voices/vesper.ogg +0 -0
- package/public/voices/willow.ogg +0 -0
- package/scripts/artifact-paths.test.mts +25 -0
- package/scripts/bot-context.test.mts +1408 -0
- package/scripts/live-history.test.mts +115 -0
- package/scripts/live-session.test.mts +948 -0
- package/server.js +1 -1
- package/skills/browser/SKILL.md +17 -6
- package/skills/computer/SKILL.md +1 -1
- package/skills/find-skills/SKILL.md +3 -8
- package/skills/interactive-page/SKILL.md +12 -7
- package/skills/interactive-page/references/diagram.md +89 -0
- package/skills/interactive-page/scripts/archify/LICENSE +22 -0
- package/skills/interactive-page/scripts/archify/README.md +25 -0
- package/skills/interactive-page/scripts/archify/assets/JetBrainsMono-OFL.txt +93 -0
- package/skills/interactive-page/scripts/archify/assets/template.html +14934 -0
- package/skills/interactive-page/scripts/archify/bin/archify.mjs +2126 -0
- package/skills/interactive-page/scripts/archify/bin/open-artifact.mjs +86 -0
- package/skills/interactive-page/scripts/archify/bin/preview.mjs +653 -0
- package/skills/interactive-page/scripts/archify/bin/visual-check.mjs +829 -0
- package/skills/interactive-page/scripts/archify/delta/architecture-delta.mjs +1223 -0
- package/skills/interactive-page/scripts/archify/examples/agent-run.lifecycle.json +60 -0
- package/skills/interactive-page/scripts/archify/examples/agent-tool-call.workflow.json +94 -0
- package/skills/interactive-page/scripts/archify/examples/async-job-roundtrip.sequence.json +61 -0
- package/skills/interactive-page/scripts/archify/examples/cache-miss-request.sequence.json +82 -0
- package/skills/interactive-page/scripts/archify/examples/checkout-platform.base.architecture.json +31 -0
- package/skills/interactive-page/scripts/archify/examples/checkout-platform.head.architecture.json +31 -0
- package/skills/interactive-page/scripts/archify/examples/deployment-release.lifecycle.json +49 -0
- package/skills/interactive-page/scripts/archify/examples/event-stream.dataflow.json +57 -0
- package/skills/interactive-page/scripts/archify/examples/incident-response.workflow.json +64 -0
- package/skills/interactive-page/scripts/archify/examples/product-analytics.dataflow.json +76 -0
- package/skills/interactive-page/scripts/archify/examples/production-deployment.architecture.json +71 -0
- package/skills/interactive-page/scripts/archify/examples/release-delivery.workflow.json +62 -0
- package/skills/interactive-page/scripts/archify/examples/web-app.architecture.json +46 -0
- package/skills/interactive-page/scripts/archify/migrations/workflow-v2.mjs +279 -0
- package/skills/interactive-page/scripts/archify/recipes/scenarios.mjs +284 -0
- package/skills/interactive-page/scripts/archify/references/authoring-contract.md +243 -0
- package/skills/interactive-page/scripts/archify/references/delivery-contract.md +120 -0
- package/skills/interactive-page/scripts/archify/references/viewer-runtime.md +45 -0
- package/skills/interactive-page/scripts/archify/renderers/architecture/grid.mjs +62 -0
- package/skills/interactive-page/scripts/archify/renderers/architecture/render-architecture.mjs +1078 -0
- package/skills/interactive-page/scripts/archify/renderers/dataflow/README.md +104 -0
- package/skills/interactive-page/scripts/archify/renderers/dataflow/render-dataflow.mjs +483 -0
- package/skills/interactive-page/scripts/archify/renderers/lifecycle/README.md +115 -0
- package/skills/interactive-page/scripts/archify/renderers/lifecycle/render-lifecycle.mjs +561 -0
- package/skills/interactive-page/scripts/archify/renderers/sequence/README.md +114 -0
- package/skills/interactive-page/scripts/archify/renderers/sequence/render-sequence.mjs +464 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/brand-marks.mjs +563 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/cli.mjs +218 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/desktop-readability.mjs +26 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/diagnostics.mjs +127 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/engineering-profiles.mjs +157 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/generated-brand-marks.mjs +3 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/generated-validators.mjs +13 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/geometry.mjs +1423 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/i18n.mjs +595 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/layout-report.mjs +40 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/legend.mjs +217 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/output-path.mjs +340 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/repository-evidence.mjs +238 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/repository-location.mjs +58 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/text-fit.mjs +49 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/utils.mjs +232 -0
- package/skills/interactive-page/scripts/archify/renderers/shared/validator.mjs +86 -0
- package/skills/interactive-page/scripts/archify/renderers/workflow/README.md +223 -0
- package/skills/interactive-page/scripts/archify/renderers/workflow/render-workflow.mjs +35 -0
- package/skills/interactive-page/scripts/archify/renderers/workflow/workflow-compiler.mjs +4400 -0
- package/skills/interactive-page/scripts/archify/renderers/workflow/workflow-migration-geometry.mjs +144 -0
- package/skills/interactive-page/scripts/archify/schemas/README.md +211 -0
- package/skills/interactive-page/scripts/archify/schemas/architecture.schema.json +178 -0
- package/skills/interactive-page/scripts/archify/schemas/common.schema.json +115 -0
- package/skills/interactive-page/scripts/archify/schemas/dataflow.schema.json +243 -0
- package/skills/interactive-page/scripts/archify/schemas/lifecycle.schema.json +266 -0
- package/skills/interactive-page/scripts/archify/schemas/sequence.schema.json +223 -0
- package/skills/interactive-page/scripts/archify/schemas/workflow.schema.json +428 -0
- package/skills/interactive-page/scripts/archify/scripts/check-render-output.mjs +916 -0
- package/skills/interactive-page/scripts/archify/scripts/render-examples.mjs +26 -0
- package/skills/interactive-page/scripts/bundle-artifact.sh +9 -8
- package/skills/skill-creator/SKILL.md +4 -5
- package/.next/server/app/api/bot/task/[id]/route/app-paths-manifest.json +0 -3
- package/.next/server/app/api/bot/task/[id]/route.js +0 -16
- package/.next/server/app/api/bot/task/[id]/route.js.nft.json +0 -1
- package/.next/server/app/api/bot/task/[id]/route_client-reference-manifest.js +0 -3
- package/.next/server/app/api/bot/task/route/app-paths-manifest.json +0 -3
- package/.next/server/app/api/bot/task/route.js +0 -16
- package/.next/server/app/api/bot/task/route.js.nft.json +0 -1
- package/.next/server/app/api/bot/task/route_client-reference-manifest.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__01dkp4a._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__02va5wz._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__02xjoto._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__04q--0f._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__0bl-e63._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ffbg85._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0jq4ohy._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__0ls6_8y._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__0ncs9uu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1-ga0kh._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__11n256_._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__12cabg9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1339jnv._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__18_teo8._.js +0 -8
- package/.next/server/chunks/[root-of-the-server]__1_04mcf._.js +0 -5
- package/.next/server/chunks/[root-of-the-server]__1anc1p9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ccon1w._.js +0 -10
- package/.next/server/chunks/[root-of-the-server]__1fizn31._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1llj3-b._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1p8m3f4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1wa1k7r._.js +0 -8
- package/.next/server/chunks/_0-73of8._.js +0 -55
- package/.next/server/chunks/_0-fjql4._.js +0 -26
- package/.next/server/chunks/_00xh_q0._.js +0 -25
- package/.next/server/chunks/_03a0897._.js +0 -3
- package/.next/server/chunks/_051qh8u._.js +0 -3
- package/.next/server/chunks/_05sovvj._.js +0 -3
- package/.next/server/chunks/_0fzqt2y._.js +0 -134
- package/.next/server/chunks/_0mecv0f._.js +0 -26
- package/.next/server/chunks/_0mh8j4m._.js +0 -3
- package/.next/server/chunks/_0obojvv._.js +0 -3
- package/.next/server/chunks/_0sb7tlz._.js +0 -3
- package/.next/server/chunks/_0sbynis._.js +0 -3
- package/.next/server/chunks/_0u10wmw._.js +0 -55
- package/.next/server/chunks/_0u4aiy2._.js +0 -3
- package/.next/server/chunks/_0wp4le3._.js +0 -3
- package/.next/server/chunks/_0y5fg-x._.js +0 -3
- package/.next/server/chunks/_1230wbx._.js +0 -10
- package/.next/server/chunks/_12nheja._.js +0 -3
- package/.next/server/chunks/_13510xh._.js +0 -3
- package/.next/server/chunks/_15hq89o._.js +0 -3
- package/.next/server/chunks/_18-1wcc._.js +0 -55
- package/.next/server/chunks/_1_9mjx-._.js +0 -3
- package/.next/server/chunks/_1c78vw5._.js +0 -229
- package/.next/server/chunks/_1h5_8sk._.js +0 -3
- package/.next/server/chunks/_1hdnxb7._.js +0 -3
- package/.next/server/chunks/_1j8k_j5._.js +0 -3
- package/.next/server/chunks/_1nula3v._.js +0 -3
- package/.next/server/chunks/_1php4eq._.js +0 -3
- package/.next/server/chunks/_1yuv4vp._.js +0 -3
- package/.next/server/chunks/_1zjrdag._.js +0 -3
- package/.next/server/chunks/_next-internal_server_app_api_bot_task_[id]_route_actions_1_k_8u3.js +0 -3
- package/.next/server/chunks/_next-internal_server_app_api_bot_task_route_actions_0xln6ra.js +0 -3
- package/.next/server/chunks/features_0rpfxbk._.js +0 -3
- package/.next/server/chunks/features_1qf3cei._.js +0 -3
- package/.next/server/chunks/features_bot_0zt92oh._.js +0 -3
- package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1xoq2rl._.js +0 -3
- package/.next/server/chunks/ssr/[externals]__0dizgek._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__092knlj._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0mz33a7._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0s9dq5u._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0s9l2sv._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0vnmv-s._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0xsog8n._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__10-dz5o._.js +0 -61
- package/.next/server/chunks/ssr/[root-of-the-server]__1gtlw6v._.js +0 -43
- package/.next/server/chunks/ssr/[root-of-the-server]__1ox7hbk._.js +0 -4
- package/.next/server/chunks/ssr/[root-of-the-server]__202p40z._.js +0 -3
- package/.next/server/chunks/ssr/_001_ms1._.js +0 -28
- package/.next/server/chunks/ssr/_01n3o0m._.js +0 -3
- package/.next/server/chunks/ssr/_0fz4mf_._.js +0 -3
- package/.next/server/chunks/ssr/_0gb4gmf._.js +0 -3
- package/.next/server/chunks/ssr/_0h42fze._.js +0 -3
- package/.next/server/chunks/ssr/_0h7zdni._.js +0 -3
- package/.next/server/chunks/ssr/_0ilna52._.js +0 -42
- package/.next/server/chunks/ssr/_0q0zan6._.js +0 -70
- package/.next/server/chunks/ssr/_0zcjrbg._.js +0 -3
- package/.next/server/chunks/ssr/_0zhoc3r._.js +0 -3
- package/.next/server/chunks/ssr/_13fke0x._.js +0 -3
- package/.next/server/chunks/ssr/_18cymkq._.js +0 -3
- package/.next/server/chunks/ssr/_1b2mjwr._.js +0 -3
- package/.next/server/chunks/ssr/_1f-dg-6._.js +0 -3
- package/.next/server/chunks/ssr/_1h0rw11._.js +0 -3
- package/.next/server/chunks/ssr/_1jhd09t._.js +0 -3
- package/.next/server/chunks/ssr/_1nnsk7z._.js +0 -3
- package/.next/server/chunks/ssr/_1ov37if._.js +0 -3
- package/.next/server/chunks/ssr/_1sji22n._.js +0 -3
- package/.next/server/chunks/ssr/_1vi_uo7._.js +0 -3
- package/.next/server/chunks/ssr/_1vyd1ji._.js +0 -3
- package/.next/server/chunks/ssr/_1xx4zlb._.js +0 -3
- package/.next/server/chunks/ssr/components_ui_1y1l7yj._.js +0 -3
- package/.next/server/chunks/ssr/features_bot_1s_-2vj._.js +0 -3
- package/.next/server/chunks/ssr/lib_realtime_12wg_dd._.js +0 -27
- package/.next/server/chunks/ssr/lib_realtime_15h_v1v._.js +0 -27
- package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_0npjf8-._.js +0 -3
- package/.next/static/chunks/00rd4-v8r7axp.js +0 -1
- package/.next/static/chunks/08qe4as2q428z.js +0 -3
- package/.next/static/chunks/0gnqdjn2lvdad.js +0 -2
- package/.next/static/chunks/0hwap1-p0m5sa.js +0 -1
- package/.next/static/chunks/0r5qcctujhxli.js +0 -1
- package/.next/static/chunks/0w52rrrmuj9r9.js +0 -1
- package/.next/static/chunks/0wcprt5ot5she.js +0 -1
- package/.next/static/chunks/10teww7wt-f6h.js +0 -1
- package/.next/static/chunks/17p6tk6k88dq6.js +0 -1
- package/.next/static/chunks/18a96rkhi4_yd.js +0 -1
- package/.next/static/chunks/1dkjg87pxk0n9.js +0 -28
- package/.next/static/chunks/1jd09sxcjddu1.js +0 -1
- package/.next/static/chunks/1w73ece_6bheu.js +0 -18
- package/.next/static/chunks/214ya3n5gxeih.js +0 -1
- package/.next/static/chunks/22_zkas21rpna.js +0 -1
- package/.next/static/chunks/2fh4-3z_q8b_w.js +0 -1
- package/.next/static/chunks/2h0sd2vumhb15.js +0 -1
- package/.next/static/chunks/2t4vhi3m8ahya.js +0 -1
- package/.next/static/chunks/2tigdtz3dpcy8.js +0 -1
- package/.next/static/chunks/2u7xt6mxg44lf.js +0 -1
- package/.next/static/chunks/3786h5vayt80-.js +0 -28
- package/.next/static/chunks/39j0fvpybzabl.js +0 -40
- package/.next/static/chunks/3cq5g494yuke8.css +0 -1
- package/.next/static/chunks/3hibbjnt85-k6.js +0 -1
- package/.next/static/chunks/3woj-xd7ki5_i.js +0 -1
- package/.next/static/chunks/3xk7yqgomx7yq.js +0 -1
- package/.next/static/chunks/3zmcsnuo25zvq.js +0 -1
- package/database/migrations/20260911030320_opposite_jack_power/migration.sql +0 -1
- package/docs/images/task-thread.png +0 -0
- package/features/bot/components/task-badge.tsx +0 -42
- package/features/bot/components/task-reply.tsx +0 -328
- package/features/bot/components/task-setting.tsx +0 -524
- package/features/bot/task.query.ts +0 -976
- package/features/bot/task.store.ts +0 -489
- package/lib/realtime/client-secret.ts +0 -86
- package/lib/realtime/open-session.ts +0 -31
- package/lib/realtime/openai.ts +0 -35
- package/lib/realtime/realtime.audio.ts +0 -196
- package/lib/realtime/realtime.driver.ts +0 -489
- package/lib/realtime/realtime.protocol.ts +0 -393
- package/lib/realtime/realtime.schema.ts +0 -37
- package/lib/realtime/realtime.session.ts +0 -106
- package/lib/realtime/realtime.transport.ts +0 -384
- package/lib/realtime/xai.ts +0 -39
- /package/.next/server/app/api/bot/{task → thread}/[id]/route/build-manifest.json +0 -0
- /package/.next/server/app/api/bot/{task → thread}/[id]/route/server-reference-manifest.json +0 -0
- /package/.next/server/app/api/bot/{task → thread}/[id]/route.js.map +0 -0
- /package/.next/server/app/api/bot/{task → thread}/route/build-manifest.json +0 -0
- /package/.next/server/app/api/bot/{task → thread}/route/server-reference-manifest.json +0 -0
- /package/.next/server/app/api/bot/{task → thread}/route.js.map +0 -0
- /package/.next/static/{kaTO0UHqF1bMnWgCDik2f → 0qzGoKn2wTERVZtblX1tp}/_buildManifest.js +0 -0
- /package/.next/static/{kaTO0UHqF1bMnWgCDik2f → 0qzGoKn2wTERVZtblX1tp}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{kaTO0UHqF1bMnWgCDik2f → 0qzGoKn2wTERVZtblX1tp}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,1223 @@
|
|
|
1
|
+
import { parseRepositoryRemote } from '../renderers/shared/repository-location.mjs';
|
|
2
|
+
|
|
3
|
+
const COMPARATOR_VERSION = 1;
|
|
4
|
+
const CANONICAL_VERSION = 1;
|
|
5
|
+
|
|
6
|
+
export class ArchitectureDeltaError extends Error {
|
|
7
|
+
constructor(code, message, details = {}) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'ArchitectureDeltaError';
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.details = details;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const codepointOrder = (left, right) => (left < right ? -1 : left > right ? 1 : 0);
|
|
16
|
+
const sorted = (values) => [...values].sort((left, right) => codepointOrder(String(left), String(right)));
|
|
17
|
+
|
|
18
|
+
function canonical(value) {
|
|
19
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(',')}]`;
|
|
20
|
+
if (value && typeof value === 'object') {
|
|
21
|
+
return `{${Object.keys(value).sort(codepointOrder).map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`).join(',')}}`;
|
|
22
|
+
}
|
|
23
|
+
return JSON.stringify(value);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const equal = (left, right) => canonical(left) === canonical(right);
|
|
27
|
+
|
|
28
|
+
function sortedObjects(values) {
|
|
29
|
+
return [...values].sort((left, right) => codepointOrder(canonical(left), canonical(right)));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function sortedBy(values, keyFor) {
|
|
33
|
+
return [...values].sort((left, right) => codepointOrder(String(keyFor(left)), String(keyFor(right))));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function normalizeRepository(repository) {
|
|
37
|
+
if (!repository) return undefined;
|
|
38
|
+
const location = parseRepositoryRemote(repository.url, { authored: true });
|
|
39
|
+
const url = location?.url || String(repository.url || '');
|
|
40
|
+
return {
|
|
41
|
+
url: location?.provider === 'github' ? url.toLowerCase() : url,
|
|
42
|
+
revision: String(repository.revision || '').toLowerCase(),
|
|
43
|
+
...(repository.provider !== undefined ? { provider: repository.provider } : {}),
|
|
44
|
+
...(repository.link_mode !== undefined ? { link_mode: repository.link_mode } : {}),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function normalizeComponent(component) {
|
|
49
|
+
return {
|
|
50
|
+
...component,
|
|
51
|
+
...(Array.isArray(component.sources) ? { sources: sortedObjects(component.sources) } : {}),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function normalizeBoundary(boundary) {
|
|
56
|
+
return { ...boundary, wraps: sorted(boundary.wraps || []) };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function canonicalArchitecture(diagram) {
|
|
60
|
+
const meta = { ...(diagram.meta || {}) };
|
|
61
|
+
delete meta.output;
|
|
62
|
+
if (meta.repository) meta.repository = normalizeRepository(meta.repository);
|
|
63
|
+
return {
|
|
64
|
+
schema_version: diagram.schema_version,
|
|
65
|
+
diagram_type: diagram.diagram_type,
|
|
66
|
+
meta,
|
|
67
|
+
...(diagram.layout ? { layout: diagram.layout } : {}),
|
|
68
|
+
components: sortedBy((diagram.components || []).map(normalizeComponent), (component) => component.id),
|
|
69
|
+
boundaries: sortedBy((diagram.boundaries || []).map(normalizeBoundary), boundaryKey),
|
|
70
|
+
connections: sortedBy(diagram.connections || [], (connection) => connection.id || ''),
|
|
71
|
+
...(diagram.cards ? { cards: diagram.cards } : {}),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function canonicalArchitectureJson(diagram) {
|
|
76
|
+
return canonical(canonicalArchitecture(diagram));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function fail(code, message, details) {
|
|
80
|
+
throw new ArchitectureDeltaError(code, message, details);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function requireComparableShape(diagram, side) {
|
|
84
|
+
if (diagram?.schema_version !== 1) {
|
|
85
|
+
fail('delta/schema-version-mismatch', `${side} must use schema_version 1.`, { side, path: '/schema_version', actual: diagram?.schema_version });
|
|
86
|
+
}
|
|
87
|
+
if (diagram?.diagram_type !== 'architecture') {
|
|
88
|
+
fail('delta/type-mismatch', `${side} must use diagram_type architecture.`, { side, path: '/diagram_type', actual: diagram?.diagram_type });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function stableIndex(items, collection, side, missingCode = 'delta/stable-id-required') {
|
|
93
|
+
const index = new Map();
|
|
94
|
+
const missing = [];
|
|
95
|
+
const duplicates = [];
|
|
96
|
+
(items || []).forEach((item, itemIndex) => {
|
|
97
|
+
if (!item?.id) missing.push(`/${collection}/${itemIndex}/id`);
|
|
98
|
+
else if (index.has(item.id)) duplicates.push(item.id);
|
|
99
|
+
else index.set(item.id, item);
|
|
100
|
+
});
|
|
101
|
+
if (missing.length) {
|
|
102
|
+
fail(missingCode, `${side} ${collection} require authored stable ids for comparison.`, {
|
|
103
|
+
side,
|
|
104
|
+
paths: sorted(missing),
|
|
105
|
+
supportedFixes: [`add a unique id to every ${collection} item`],
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (duplicates.length) {
|
|
109
|
+
fail('delta/duplicate-stable-id', `${side} ${collection} contain duplicate ids.`, {
|
|
110
|
+
side,
|
|
111
|
+
collection,
|
|
112
|
+
ids: sorted(new Set(duplicates)),
|
|
113
|
+
supportedFixes: [`make every ${collection} id unique`],
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return index;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const boundaryKey = (boundary) => `${boundary.kind}\u001f${boundary.label}`;
|
|
120
|
+
|
|
121
|
+
function boundaryIndex(boundaries, side) {
|
|
122
|
+
const index = new Map();
|
|
123
|
+
const ambiguous = [];
|
|
124
|
+
for (const boundary of boundaries || []) {
|
|
125
|
+
const key = boundaryKey(boundary);
|
|
126
|
+
if (index.has(key)) ambiguous.push(`${boundary.kind}:${boundary.label}`);
|
|
127
|
+
else index.set(key, boundary);
|
|
128
|
+
}
|
|
129
|
+
if (ambiguous.length) {
|
|
130
|
+
fail('delta/boundary-key-ambiguous', `${side} boundary kind + label keys must be unique.`, {
|
|
131
|
+
side,
|
|
132
|
+
boundaries: sorted(new Set(ambiguous)),
|
|
133
|
+
supportedFixes: ['rename one duplicate boundary or add stable boundary ids in a future schema version'],
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return index;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function normalizedField(item, field) {
|
|
140
|
+
const value = item?.[field];
|
|
141
|
+
if (field === 'sources' && Array.isArray(value)) return sortedObjects(value);
|
|
142
|
+
if (field === 'wraps' && Array.isArray(value)) return sorted(value);
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function fieldChanges(before, after, groups) {
|
|
147
|
+
const classifications = [];
|
|
148
|
+
const changedFields = [];
|
|
149
|
+
for (const [classification, fields] of Object.entries(groups)) {
|
|
150
|
+
const changed = fields.filter((field) => !equal(normalizedField(before, field), normalizedField(after, field)));
|
|
151
|
+
if (changed.length) classifications.push(classification);
|
|
152
|
+
changedFields.push(...changed.map((field) => `/${field}`));
|
|
153
|
+
}
|
|
154
|
+
return { classifications: sorted(classifications), changedFields: sorted(changedFields) };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const COMPONENT_FIELDS = {
|
|
158
|
+
semantic: ['type', 'label', 'sublabel', 'tag', 'brand'],
|
|
159
|
+
evidence: ['sources'],
|
|
160
|
+
geometry: ['row', 'col', 'pos', 'size'],
|
|
161
|
+
};
|
|
162
|
+
const CONNECTION_FIELDS = {
|
|
163
|
+
topology: ['from', 'to'],
|
|
164
|
+
semantic: ['label', 'variant'],
|
|
165
|
+
geometry: ['fromSide', 'toSide', 'route', 'via', 'labelAt', 'labelDx', 'labelDy', 'labelSegment', 'width'],
|
|
166
|
+
};
|
|
167
|
+
const BOUNDARY_FIELDS = { scope: ['wraps'], geometry: ['pad'] };
|
|
168
|
+
|
|
169
|
+
function statusFor(classifications, kind) {
|
|
170
|
+
if (classifications.some((value) => ['topology', 'semantic', 'scope'].includes(value))) return 'changed';
|
|
171
|
+
if (classifications.includes('evidence')) return 'evidence-changed';
|
|
172
|
+
if (classifications.includes('geometry')) return kind === 'connection' ? 'rerouted' : kind === 'component' ? 'moved' : 'geometry-changed';
|
|
173
|
+
return 'same';
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function compareEntities(baseIndex, headIndex, kind, groups, describe) {
|
|
177
|
+
const changes = [];
|
|
178
|
+
const identityClassification = kind === 'connection' ? 'topology' : kind === 'boundary' ? 'scope' : 'semantic';
|
|
179
|
+
for (const id of sorted(new Set([...baseIndex.keys(), ...headIndex.keys()]))) {
|
|
180
|
+
const base = baseIndex.get(id);
|
|
181
|
+
const head = headIndex.get(id);
|
|
182
|
+
if (!base) changes.push({ ...describe(id, undefined, head), status: 'added', classifications: [identityClassification], changedFields: [] });
|
|
183
|
+
else if (!head) changes.push({ ...describe(id, base, undefined), status: 'removed', classifications: [identityClassification], changedFields: [] });
|
|
184
|
+
else {
|
|
185
|
+
const fields = fieldChanges(base, head, groups);
|
|
186
|
+
const status = statusFor(fields.classifications, kind);
|
|
187
|
+
if (status !== 'same') changes.push({ ...describe(id, base, head), status, ...fields });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return changes;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function summaryFor(changes, shape) {
|
|
194
|
+
const summary = Object.fromEntries(shape.map((key) => [key, 0]));
|
|
195
|
+
for (const change of changes) {
|
|
196
|
+
const key = change.status.replace(/-([a-z])/g, (_all, letter) => letter.toUpperCase());
|
|
197
|
+
if (Object.hasOwn(summary, key)) summary[key] += 1;
|
|
198
|
+
}
|
|
199
|
+
return summary;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function presentationChanged(base, head) {
|
|
203
|
+
const basePresentation = {
|
|
204
|
+
title: base.meta?.title,
|
|
205
|
+
locale: base.meta?.locale,
|
|
206
|
+
subtitle: base.meta?.subtitle,
|
|
207
|
+
animation: base.meta?.animation,
|
|
208
|
+
visual_preset: base.meta?.visual_preset,
|
|
209
|
+
quality_profile: base.meta?.quality_profile,
|
|
210
|
+
engineering_profile: base.meta?.engineering_profile,
|
|
211
|
+
legend: base.meta?.legend,
|
|
212
|
+
views: base.meta?.views,
|
|
213
|
+
viewBox: base.meta?.viewBox,
|
|
214
|
+
layout: base.layout,
|
|
215
|
+
cards: base.cards,
|
|
216
|
+
};
|
|
217
|
+
const headPresentation = {
|
|
218
|
+
title: head.meta?.title,
|
|
219
|
+
locale: head.meta?.locale,
|
|
220
|
+
subtitle: head.meta?.subtitle,
|
|
221
|
+
animation: head.meta?.animation,
|
|
222
|
+
visual_preset: head.meta?.visual_preset,
|
|
223
|
+
quality_profile: head.meta?.quality_profile,
|
|
224
|
+
engineering_profile: head.meta?.engineering_profile,
|
|
225
|
+
legend: head.meta?.legend,
|
|
226
|
+
views: head.meta?.views,
|
|
227
|
+
viewBox: head.meta?.viewBox,
|
|
228
|
+
layout: head.layout,
|
|
229
|
+
cards: head.cards,
|
|
230
|
+
};
|
|
231
|
+
return !equal(basePresentation, headPresentation);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function compareArchitecture(base, head, evidence = {}) {
|
|
235
|
+
requireComparableShape(base, 'base');
|
|
236
|
+
requireComparableShape(head, 'head');
|
|
237
|
+
const baseComponents = stableIndex(base.components, 'components', 'base');
|
|
238
|
+
const headComponents = stableIndex(head.components, 'components', 'head');
|
|
239
|
+
const shared = sorted([...baseComponents.keys()].filter((id) => headComponents.has(id)));
|
|
240
|
+
if (!shared.length) {
|
|
241
|
+
fail('delta/no-shared-component-id', 'The snapshots share no component id, so Archify cannot prove that they describe the same system.', {
|
|
242
|
+
supportedFixes: ['preserve at least one authored component id across snapshots'],
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const baseConnections = stableIndex(base.connections, 'connections', 'base', 'delta/relationship-id-required');
|
|
247
|
+
const headConnections = stableIndex(head.connections, 'connections', 'head', 'delta/relationship-id-required');
|
|
248
|
+
const baseBoundaries = boundaryIndex(base.boundaries, 'base');
|
|
249
|
+
const headBoundaries = boundaryIndex(head.boundaries, 'head');
|
|
250
|
+
|
|
251
|
+
const baseRepository = normalizeRepository(base.meta?.repository);
|
|
252
|
+
const headRepository = normalizeRepository(head.meta?.repository);
|
|
253
|
+
const identity = (repository) => parseRepositoryRemote(repository.url, { authored: true })?.identity || repository.url;
|
|
254
|
+
if (baseRepository && headRepository && identity(baseRepository) !== identity(headRepository)) {
|
|
255
|
+
fail('delta/repository-mismatch', 'The snapshots name different repositories.', {
|
|
256
|
+
baseRepository: baseRepository.url,
|
|
257
|
+
headRepository: headRepository.url,
|
|
258
|
+
supportedFixes: ['compare snapshots from the same repository or remove repository evidence from both inputs'],
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
const proofLevel = baseRepository && headRepository
|
|
262
|
+
&& evidence.baseVerified && evidence.headVerified
|
|
263
|
+
&& /^[a-f0-9]{40}$/.test(baseRepository.revision)
|
|
264
|
+
&& /^[a-f0-9]{40}$/.test(headRepository.revision)
|
|
265
|
+
? 'revision-pinned'
|
|
266
|
+
: 'authored';
|
|
267
|
+
|
|
268
|
+
const components = compareEntities(baseComponents, headComponents, 'component', COMPONENT_FIELDS, (id, before, after) => ({
|
|
269
|
+
id,
|
|
270
|
+
baseLabel: before?.label,
|
|
271
|
+
headLabel: after?.label,
|
|
272
|
+
}));
|
|
273
|
+
const connections = compareEntities(baseConnections, headConnections, 'connection', CONNECTION_FIELDS, (id, before, after) => ({
|
|
274
|
+
id,
|
|
275
|
+
...(before ? { base: { from: before.from, to: before.to, label: before.label || '' } } : {}),
|
|
276
|
+
...(after ? { head: { from: after.from, to: after.to, label: after.label || '' } } : {}),
|
|
277
|
+
}));
|
|
278
|
+
const boundaries = compareEntities(baseBoundaries, headBoundaries, 'boundary', BOUNDARY_FIELDS, (_key, before, after) => ({
|
|
279
|
+
key: `${(after || before).kind}:${(after || before).label}`,
|
|
280
|
+
kind: (after || before).kind,
|
|
281
|
+
label: (after || before).label,
|
|
282
|
+
}));
|
|
283
|
+
const provenanceChanged = !equal(baseRepository, headRepository);
|
|
284
|
+
|
|
285
|
+
return {
|
|
286
|
+
schemaVersion: 1,
|
|
287
|
+
ok: true,
|
|
288
|
+
command: 'compare',
|
|
289
|
+
type: 'architecture',
|
|
290
|
+
comparatorVersion: COMPARATOR_VERSION,
|
|
291
|
+
canonicalVersion: CANONICAL_VERSION,
|
|
292
|
+
completeness: 'complete',
|
|
293
|
+
proofLevel,
|
|
294
|
+
base: {
|
|
295
|
+
title: base.meta?.title || '',
|
|
296
|
+
...(evidence.baseRawSha256 ? { rawSha256: evidence.baseRawSha256 } : {}),
|
|
297
|
+
...(evidence.baseSemanticSha256 ? { semanticSha256: evidence.baseSemanticSha256 } : {}),
|
|
298
|
+
...(Number.isInteger(evidence.baseBytes) ? { bytes: evidence.baseBytes } : {}),
|
|
299
|
+
...(baseRepository?.revision ? { revision: baseRepository.revision } : {}),
|
|
300
|
+
},
|
|
301
|
+
head: {
|
|
302
|
+
title: head.meta?.title || '',
|
|
303
|
+
...(evidence.headRawSha256 ? { rawSha256: evidence.headRawSha256 } : {}),
|
|
304
|
+
...(evidence.headSemanticSha256 ? { semanticSha256: evidence.headSemanticSha256 } : {}),
|
|
305
|
+
...(Number.isInteger(evidence.headBytes) ? { bytes: evidence.headBytes } : {}),
|
|
306
|
+
...(headRepository?.revision ? { revision: headRepository.revision } : {}),
|
|
307
|
+
},
|
|
308
|
+
summary: {
|
|
309
|
+
components: summaryFor(components, ['added', 'changed', 'evidenceChanged', 'removed', 'moved']),
|
|
310
|
+
connections: summaryFor(connections, ['added', 'changed', 'removed', 'rerouted']),
|
|
311
|
+
boundaries: summaryFor(boundaries, ['added', 'changed', 'removed', 'geometryChanged']),
|
|
312
|
+
presentationChanged: presentationChanged(base, head),
|
|
313
|
+
provenanceChanged,
|
|
314
|
+
},
|
|
315
|
+
changes: { components, connections, boundaries },
|
|
316
|
+
identity: {
|
|
317
|
+
components: 'components[].id',
|
|
318
|
+
connections: 'connections[].id (required)',
|
|
319
|
+
boundaries: 'boundaries[].kind + boundaries[].label (derived)',
|
|
320
|
+
},
|
|
321
|
+
view: { visualPreset: head.meta?.visual_preset || 'classic' },
|
|
322
|
+
limitations: [
|
|
323
|
+
'Authored Architecture IR only; no runtime impact, causality, risk, or mergeability is inferred.',
|
|
324
|
+
'Boundary identity is conservatively derived from kind + label.',
|
|
325
|
+
],
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
function esc(value) {
|
|
330
|
+
return String(value ?? '').replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('"', '"').replaceAll("'", ''');
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const safeJson = (value) => JSON.stringify(value, null, 2).replaceAll('<', '\\u003c').replaceAll('>', '\\u003e').replaceAll('&', '\\u0026');
|
|
334
|
+
|
|
335
|
+
export function extractArchitectureSvg(html) {
|
|
336
|
+
const match = html.match(/<svg viewBox="0 0 [^"]+" role="img"[\s\S]*?<\/svg>/);
|
|
337
|
+
if (!match) fail('delta/svg-missing', 'A validated Architecture artifact did not contain its primary SVG.');
|
|
338
|
+
return match[0];
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export function extractArtifactCss(html) {
|
|
342
|
+
const match = html.match(/<style>([\s\S]*?)<\/style>/);
|
|
343
|
+
if (!match) fail('delta/css-missing', 'A validated Architecture artifact did not contain its stylesheet.');
|
|
344
|
+
return match[1];
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function changeMap(changes) {
|
|
348
|
+
return new Map(changes.map((change) => [change.id, change]));
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function boundaryChangeMap(changes) {
|
|
352
|
+
return new Map(changes.map((change) => [`${change.kind}:${esc(change.label)}`, change]));
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
function addState(tag, change, side, forcedState) {
|
|
356
|
+
const append = (attributes) => tag.endsWith('/>')
|
|
357
|
+
? tag.replace(/\/>$/, `${attributes}/>`)
|
|
358
|
+
: tag.replace(/>$/, `${attributes}>`);
|
|
359
|
+
if (!change && !forcedState) return append(' data-delta-state="same"');
|
|
360
|
+
let state = forcedState || change.status;
|
|
361
|
+
if (change?.status === 'added' && side === 'base') state = 'same';
|
|
362
|
+
if (change?.status === 'removed' && side === 'head') state = 'same';
|
|
363
|
+
const classes = change?.classifications?.join(',') || '';
|
|
364
|
+
return append(` data-delta-state="${esc(state)}"${classes ? ` data-delta-classifications="${esc(classes)}"` : ''}`);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function markerFor(state) {
|
|
368
|
+
return ({ added: '+', removed: '−', changed: '~', moved: '↔', 'moved-from': '↔', rerouted: '↔', 'geometry-changed': '↔', 'evidence-changed': 'E' })[state] || '';
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function addNodeMarker(group, state) {
|
|
372
|
+
const symbol = markerFor(state);
|
|
373
|
+
if (!symbol) return group;
|
|
374
|
+
const box = group.match(/<rect x="([^"]+)" y="([^"]+)" width="([^"]+)"/);
|
|
375
|
+
if (!box) return group;
|
|
376
|
+
const x = Number(box[1]) + Number(box[3]) - 9;
|
|
377
|
+
const y = Number(box[2]) + 9;
|
|
378
|
+
return group.replace(/<\/g>$/, `\n <g class="delta-node-marker" aria-hidden="true"><circle cx="${x}" cy="${y}" r="8"/><text x="${x}" y="${y + 3}" text-anchor="middle">${symbol}</text></g>\n </g>`);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function prefixSvgIds(svg, prefix) {
|
|
382
|
+
const ids = [...svg.matchAll(/\sid="([^"]+)"/g)].map((match) => match[1]);
|
|
383
|
+
let result = svg.replace(/(\s)id="([^"]+)"/g, (_match, space, id) => `${space}id="${prefix}-${id}"`);
|
|
384
|
+
for (const id of ids) {
|
|
385
|
+
result = result.replaceAll(`url(#${id})`, `url(#${prefix}-${id})`).replaceAll(`href="#${id}"`, `href="#${prefix}-${id}"`);
|
|
386
|
+
}
|
|
387
|
+
result = result.replace(/aria-labelledby="([^"]+)"/g, (_match, value) => `aria-labelledby="${value.split(/\s+/).map((id) => `${prefix}-${id}`).join(' ')}"`);
|
|
388
|
+
return result;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function staticize(svg) {
|
|
392
|
+
return svg.replaceAll('tabindex="0" role="button"', 'role="group"').replaceAll(' aria-pressed="false"', '').replaceAll('aria-label="Focus ', 'aria-label="');
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function nodeGroupRanges(svg) {
|
|
396
|
+
const ranges = [];
|
|
397
|
+
const opener = /<g\s+[^>]*\bdata-node-id="([^"]+)"[^>]*>/g;
|
|
398
|
+
let open;
|
|
399
|
+
while ((open = opener.exec(svg))) {
|
|
400
|
+
const tags = /<\/?g\b[^>]*>/g;
|
|
401
|
+
tags.lastIndex = open.index;
|
|
402
|
+
let depth = 0;
|
|
403
|
+
let tag;
|
|
404
|
+
while ((tag = tags.exec(svg))) {
|
|
405
|
+
depth += tag[0].startsWith('</') ? -1 : 1;
|
|
406
|
+
if (depth === 0) {
|
|
407
|
+
ranges.push({ id: open[1], start: open.index, end: tags.lastIndex });
|
|
408
|
+
opener.lastIndex = tags.lastIndex;
|
|
409
|
+
break;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return ranges;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
function transformNodeGroups(svg, transform) {
|
|
417
|
+
const ranges = nodeGroupRanges(svg);
|
|
418
|
+
let cursor = 0;
|
|
419
|
+
const parts = [];
|
|
420
|
+
for (const range of ranges) {
|
|
421
|
+
parts.push(svg.slice(cursor, range.start));
|
|
422
|
+
parts.push(transform(svg.slice(range.start, range.end), range.id));
|
|
423
|
+
cursor = range.end;
|
|
424
|
+
}
|
|
425
|
+
parts.push(svg.slice(cursor));
|
|
426
|
+
return parts.join('');
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const BOUNDARY_FRAME_RE = /<rect data-graph-role="structural-frame"[^>]*data-composition-frame-kind="([^"]+)"[^>]*data-composition-frame-label="([^"]+)"[^>]*\/>/g;
|
|
430
|
+
const BOUNDARY_LABEL_RE = /<g data-graph-role="structural-frame-label"[^>]*data-composition-frame-kind="([^"]+)"[^>]*data-composition-frame-label="([^"]+)"[^>]*>[\s\S]*?<\/g>/g;
|
|
431
|
+
|
|
432
|
+
function boundaryElements(svg) {
|
|
433
|
+
const collect = (pattern, part) => [...svg.matchAll(pattern)].map((match) => ({
|
|
434
|
+
start: match.index,
|
|
435
|
+
end: match.index + match[0].length,
|
|
436
|
+
markup: match[0],
|
|
437
|
+
key: `${match[1]}:${match[2]}`,
|
|
438
|
+
part,
|
|
439
|
+
}));
|
|
440
|
+
return [
|
|
441
|
+
...collect(BOUNDARY_FRAME_RE, 'frame'),
|
|
442
|
+
...collect(BOUNDARY_LABEL_RE, 'label'),
|
|
443
|
+
].sort((left, right) => left.start - right.start);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function transformBoundaryElements(svg, transform) {
|
|
447
|
+
let cursor = 0;
|
|
448
|
+
const parts = [];
|
|
449
|
+
for (const element of boundaryElements(svg)) {
|
|
450
|
+
parts.push(svg.slice(cursor, element.start));
|
|
451
|
+
parts.push(transform(element.markup, element.key, element.part));
|
|
452
|
+
cursor = element.end;
|
|
453
|
+
}
|
|
454
|
+
parts.push(svg.slice(cursor));
|
|
455
|
+
return parts.join('');
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export function annotateArchitectureSideSvg(svg, receipt, side) {
|
|
459
|
+
const nodes = changeMap(receipt.changes.components);
|
|
460
|
+
const edges = changeMap(receipt.changes.connections);
|
|
461
|
+
const boundaries = boundaryChangeMap(receipt.changes.boundaries);
|
|
462
|
+
let result = transformBoundaryElements(svg, (markup, key, part) => {
|
|
463
|
+
const change = boundaries.get(key);
|
|
464
|
+
if (!change) return markup;
|
|
465
|
+
if (part === 'frame') {
|
|
466
|
+
return addState(markup, change, side)
|
|
467
|
+
.replace(/\/>$/, ` data-delta-boundary-key="${esc(change.key)}"/>`);
|
|
468
|
+
}
|
|
469
|
+
return markup.replace(
|
|
470
|
+
/<text[^>]*>/,
|
|
471
|
+
(tag) => tag.replace(/>$/, ` data-delta-state="${change.status}" data-delta-boundary-state="${change.status}" data-delta-boundary-key="${esc(change.key)}">`),
|
|
472
|
+
);
|
|
473
|
+
});
|
|
474
|
+
result = transformNodeGroups(result, (group, id) => {
|
|
475
|
+
const change = nodes.get(id);
|
|
476
|
+
if ((side === 'base' && change?.status === 'added') || (side === 'head' && change?.status === 'removed')) return group;
|
|
477
|
+
const tagged = group.replace(/^<g[^>]+>/, (tag) => addState(tag, change, side));
|
|
478
|
+
return addNodeMarker(tagged, change?.status);
|
|
479
|
+
});
|
|
480
|
+
result = result.replace(/<(?:path|g)\s+[^>]*\bdata-edge-id="([^"]+)"[^>]*>/g, (tag, id) => addState(tag, edges.get(id), side));
|
|
481
|
+
return prefixSvgIds(staticize(result), side);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function elementById(svg, kind, id) {
|
|
485
|
+
const safe = id.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
486
|
+
if (kind === 'node') {
|
|
487
|
+
const range = nodeGroupRanges(svg).find((candidate) => candidate.id === id);
|
|
488
|
+
return range ? svg.slice(range.start, range.end) : '';
|
|
489
|
+
}
|
|
490
|
+
const path = svg.match(new RegExp(`<path\\s+[^>]*\\bdata-edge-id="${safe}"[^>]*/>`))?.[0] || '';
|
|
491
|
+
const label = svg.match(new RegExp(`<g\\s+[^>]*\\bdata-edge-id="${safe}"[^>]*>[\\s\\S]*?<\\/g>`))?.[0] || '';
|
|
492
|
+
return [path, label].filter(Boolean).join('\n');
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
function forceElementState(markup, state, classifications = []) {
|
|
496
|
+
let result;
|
|
497
|
+
if (markup.includes('data-node-id=')) {
|
|
498
|
+
result = markup.replace(/^<g\s+[^>]*>/, (tag) => addState(tag, { classifications }, 'delta', state));
|
|
499
|
+
} else {
|
|
500
|
+
result = markup
|
|
501
|
+
.replace(/<path\s+[^>]*\bdata-edge-id="[^"]+"[^>]*\/>/g, (tag) => addState(tag, { classifications }, 'delta', state))
|
|
502
|
+
.replace(/<g\s+[^>]*\bdata-edge-id="[^"]+"[^>]*>/g, (tag) => addState(tag, { classifications }, 'delta', state));
|
|
503
|
+
}
|
|
504
|
+
result = result.replace(/\bid="node-/, 'id="base-node-');
|
|
505
|
+
if (markup.includes('data-node-id=')) result = addNodeMarker(result, state);
|
|
506
|
+
return result;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
function boundaryMarkupByKey(svg, key) {
|
|
510
|
+
return boundaryElements(svg)
|
|
511
|
+
.filter((element) => element.key === key)
|
|
512
|
+
.map((element) => element.markup)
|
|
513
|
+
.join('\n');
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
function boundaryMarkupParts(markup) {
|
|
517
|
+
const parts = { frame: '', label: '' };
|
|
518
|
+
for (const element of boundaryElements(markup)) parts[element.part] = element.markup;
|
|
519
|
+
return parts;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function forceBoundaryState(markup, state, key, classifications = []) {
|
|
523
|
+
return markup
|
|
524
|
+
.replace(/^<rect[^>]+\/>/, (tag) => addState(tag, { classifications }, 'delta', state).replace(/\/>$/, ` data-delta-boundary-key="${esc(key)}"/>`))
|
|
525
|
+
.replace(
|
|
526
|
+
/<rect data-graph-role="structural-frame-label-mask"[^>]*\/>/,
|
|
527
|
+
(tag) => addState(tag, { classifications }, 'delta', state)
|
|
528
|
+
.replace(/\/>$/, ` data-delta-boundary-state="${state}" data-delta-boundary-mask-key="${esc(key)}"/>`),
|
|
529
|
+
)
|
|
530
|
+
.replace(/<text[^>]*>/, (tag) => tag.replace(/>$/, ` data-delta-state="${state}" data-delta-boundary-state="${state}" data-delta-boundary-key="${esc(key)}">`));
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
function viewBoxSize(svg) {
|
|
534
|
+
const match = svg.match(/viewBox="0 0 ([\d.]+) ([\d.]+)"/);
|
|
535
|
+
return match ? [Number(match[1]), Number(match[2])] : [0, 0];
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
function edgeSymbolMarkup(markup, state) {
|
|
539
|
+
const symbol = markerFor(state);
|
|
540
|
+
const point = markup.match(/data-composition-points="([\d.-]+),([\d.-]+)/);
|
|
541
|
+
const edgeId = markup.match(/\bdata-edge-id="([^"]+)"/)?.[1];
|
|
542
|
+
if (!symbol || !point) return '';
|
|
543
|
+
return `<text class="delta-edge-marker" data-delta-state="${state}"${edgeId ? ` data-edge-id="${esc(edgeId)}"` : ''} x="${Number(point[1]) + 9}" y="${Number(point[2]) - 7}" aria-hidden="true">${symbol}</text>`;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function boundarySymbolMarkup(markup, state) {
|
|
547
|
+
const symbol = markerFor(state);
|
|
548
|
+
const frame = markup.match(/<rect[^>]*\bx="([\d.-]+)"\s+y="([\d.-]+)"\s+width="([\d.-]+)"/);
|
|
549
|
+
if (!symbol || !frame) return '';
|
|
550
|
+
const x = Number(frame[1]) + Number(frame[3]) - 12;
|
|
551
|
+
const y = Number(frame[2]) + 16;
|
|
552
|
+
return `<text class="delta-boundary-marker" data-delta-state="${state}" x="${x}" y="${y}" text-anchor="middle" aria-hidden="true">${symbol}</text>`;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
export function buildDeltaSvg(baseSvg, headSvg, receipt) {
|
|
556
|
+
const [baseW, baseH] = viewBoxSize(baseSvg);
|
|
557
|
+
const [headW, headH] = viewBoxSize(headSvg);
|
|
558
|
+
const nodes = changeMap(receipt.changes.components);
|
|
559
|
+
const edges = changeMap(receipt.changes.connections);
|
|
560
|
+
const boundaries = boundaryChangeMap(receipt.changes.boundaries);
|
|
561
|
+
const baseNodePhantoms = [];
|
|
562
|
+
const baseEdgePhantoms = [];
|
|
563
|
+
const baseBoundaryFramePhantoms = [];
|
|
564
|
+
const baseBoundaryLabelPhantoms = [];
|
|
565
|
+
const edgeMarkers = [];
|
|
566
|
+
const boundaryMarkers = [];
|
|
567
|
+
|
|
568
|
+
for (const change of nodes.values()) {
|
|
569
|
+
if (change.status === 'removed') baseNodePhantoms.push(forceElementState(elementById(baseSvg, 'node', change.id), 'removed', change.classifications));
|
|
570
|
+
else if (change.classifications.includes('geometry')) baseNodePhantoms.push(forceElementState(elementById(baseSvg, 'node', change.id), 'moved-from', change.classifications));
|
|
571
|
+
}
|
|
572
|
+
for (const change of edges.values()) {
|
|
573
|
+
if (change.status === 'removed' || change.classifications.includes('topology')) {
|
|
574
|
+
const phantom = forceElementState(elementById(baseSvg, 'edge', change.id), 'removed', change.classifications);
|
|
575
|
+
baseEdgePhantoms.push(phantom);
|
|
576
|
+
edgeMarkers.push(edgeSymbolMarkup(phantom, 'removed'));
|
|
577
|
+
} else if (change.classifications.includes('geometry')) {
|
|
578
|
+
const phantom = forceElementState(elementById(baseSvg, 'edge', change.id), 'moved-from', change.classifications);
|
|
579
|
+
baseEdgePhantoms.push(phantom);
|
|
580
|
+
edgeMarkers.push(edgeSymbolMarkup(phantom, 'moved-from'));
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
for (const change of boundaries.values()) {
|
|
584
|
+
const renderedKey = `${change.kind}:${esc(change.label)}`;
|
|
585
|
+
if (change.status === 'removed') {
|
|
586
|
+
const phantom = forceBoundaryState(boundaryMarkupByKey(baseSvg, renderedKey), 'removed', change.key, change.classifications);
|
|
587
|
+
const parts = boundaryMarkupParts(phantom);
|
|
588
|
+
baseBoundaryFramePhantoms.push(parts.frame);
|
|
589
|
+
baseBoundaryLabelPhantoms.push(parts.label);
|
|
590
|
+
boundaryMarkers.push(boundarySymbolMarkup(phantom, 'removed'));
|
|
591
|
+
}
|
|
592
|
+
else if (change.status === 'changed' || change.status === 'geometry-changed') {
|
|
593
|
+
const phantom = forceBoundaryState(boundaryMarkupByKey(baseSvg, renderedKey), 'moved-from', change.key, change.classifications);
|
|
594
|
+
const parts = boundaryMarkupParts(phantom);
|
|
595
|
+
baseBoundaryFramePhantoms.push(parts.frame);
|
|
596
|
+
baseBoundaryLabelPhantoms.push(parts.label);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
let delta = annotateArchitectureSideSvg(headSvg, receipt, 'head');
|
|
601
|
+
delta = delta.replace(/^<svg[^>]+>/, (tag) => tag.replace(/viewBox="[^"]+"/, `viewBox="0 0 ${Math.max(baseW, headW) + 24} ${Math.max(baseH, headH) + 24}"`));
|
|
602
|
+
delta = delta.replace(' <!-- Boundaries (behind everything) -->', ` <!-- Baseline boundary frame phantoms -->\n${baseBoundaryFramePhantoms.filter(Boolean).join('\n')}\n\n <!-- Boundaries (behind everything) -->`);
|
|
603
|
+
delta = delta.replace(' <!-- Connection paths (before components for correct z-order) -->', ` <!-- Baseline relationship phantoms -->\n${baseEdgePhantoms.join('\n')}\n\n <!-- Connection paths (before components for correct z-order) -->`);
|
|
604
|
+
delta = delta.replace(' <!-- Components -->', ` <!-- Baseline boundary label phantoms (below current components) -->\n${baseBoundaryLabelPhantoms.filter(Boolean).join('\n')}\n\n <!-- Baseline removed and move-from component phantoms -->\n${baseNodePhantoms.join('\n')}\n\n <!-- Components -->`);
|
|
605
|
+
|
|
606
|
+
for (const change of edges.values()) {
|
|
607
|
+
if (change.status === 'added' || change.status === 'changed' || change.status === 'rerouted') {
|
|
608
|
+
const current = elementById(delta, 'edge', change.id);
|
|
609
|
+
edgeMarkers.push(edgeSymbolMarkup(current, change.status === 'changed' && change.classifications.includes('topology') ? 'added' : change.status));
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
for (const change of boundaries.values()) {
|
|
613
|
+
if (!['added', 'changed', 'geometry-changed'].includes(change.status)) continue;
|
|
614
|
+
const renderedKey = `${change.kind}:${esc(change.label)}`;
|
|
615
|
+
boundaryMarkers.push(boundarySymbolMarkup(boundaryMarkupByKey(delta, renderedKey), change.status));
|
|
616
|
+
}
|
|
617
|
+
delta = delta.replace(' <!-- Legend -->', ` <!-- Delta relationship symbols -->\n${edgeMarkers.filter(Boolean).join('\n')}\n\n <!-- Delta boundary symbols -->\n${boundaryMarkers.filter(Boolean).join('\n')}\n\n <!-- Legend -->`);
|
|
618
|
+
return prefixSvgIds(staticize(delta), 'delta');
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
export function architectureDeltaChangeRows(receipt) {
|
|
622
|
+
const rows = [];
|
|
623
|
+
for (const change of receipt.changes.components) rows.push({ ...change, kind: 'Component', kindKey: 'component', key: `component:${change.id}`, id: change.id });
|
|
624
|
+
for (const change of receipt.changes.connections) rows.push({ ...change, kind: 'Relationship', kindKey: 'relationship', key: `relationship:${change.id}`, id: change.id });
|
|
625
|
+
for (const change of receipt.changes.boundaries) rows.push({ ...change, kind: 'Boundary', kindKey: 'boundary', key: `boundary:${change.key}`, id: change.key });
|
|
626
|
+
return rows.sort((left, right) => codepointOrder(`${left.status}:${left.kind}:${left.id}`, `${right.status}:${right.kind}:${right.id}`));
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
function reviewPrimaryStates(row) {
|
|
630
|
+
if (row.kindKey === 'component' && row.classifications.includes('geometry')) return [row.status, 'moved-from'];
|
|
631
|
+
if (row.kindKey === 'relationship' && row.status === 'changed' && row.classifications.includes('topology')) return ['changed', 'removed'];
|
|
632
|
+
if (row.kindKey === 'relationship' && row.classifications.includes('geometry')) return ['moved-from', row.status];
|
|
633
|
+
if (row.kindKey === 'boundary' && ['changed', 'geometry-changed'].includes(row.status)) return [row.status, 'moved-from'].sort();
|
|
634
|
+
return [row.status];
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
function reviewIdentity(row) {
|
|
638
|
+
const attribute = row.kindKey === 'component' ? 'data-node-id' : row.kindKey === 'relationship' ? 'data-edge-id' : 'data-delta-boundary-key';
|
|
639
|
+
return { attribute, value: esc(row.id) };
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
function reviewTargetTags(deltaMarkup, row) {
|
|
643
|
+
const { attribute, value } = reviewIdentity(row);
|
|
644
|
+
const safeValue = value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
645
|
+
const identity = new RegExp(`\\b${attribute}="${safeValue}"`);
|
|
646
|
+
return [...deltaMarkup.matchAll(/<([a-z][\w:-]*)\s+[^>]*>/g)]
|
|
647
|
+
.map((match) => ({ name: match[1], tag: match[0] }))
|
|
648
|
+
.filter(({ tag }) => identity.test(tag));
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
function primaryReviewTags(deltaMarkup, row) {
|
|
652
|
+
const tagName = row.kindKey === 'component' ? 'g' : row.kindKey === 'relationship' ? 'path' : 'rect';
|
|
653
|
+
return reviewTargetTags(deltaMarkup, row).filter(({ name }) => name === tagName).map(({ tag }) => tag);
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function reviewTargetSignature(tags) {
|
|
657
|
+
return tags.map(({ name, tag }) => {
|
|
658
|
+
const state = tag.match(/\bdata-delta-state="([^"]+)"/)?.[1] || '';
|
|
659
|
+
const classifications = tag.match(/\bdata-delta-classifications="([^"]*)"/)?.[1] || '';
|
|
660
|
+
return `${name}:${state}:${classifications}`;
|
|
661
|
+
}).sort(codepointOrder).join('|');
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
function expectedReviewTargetSignature(row) {
|
|
665
|
+
const classifications = row.classifications.join(',');
|
|
666
|
+
const descriptors = [];
|
|
667
|
+
if (row.kindKey === 'component') {
|
|
668
|
+
for (const state of reviewPrimaryStates(row)) descriptors.push(`g:${state}:${classifications}`);
|
|
669
|
+
} else if (row.kindKey === 'boundary') {
|
|
670
|
+
for (const state of reviewPrimaryStates(row)) {
|
|
671
|
+
descriptors.push(`rect:${state}:${classifications}`, `text:${state}:`);
|
|
672
|
+
}
|
|
673
|
+
} else {
|
|
674
|
+
const forms = row.status === 'added'
|
|
675
|
+
? [{ state: 'added', marker: 'added', label: row.head?.label }]
|
|
676
|
+
: row.status === 'removed'
|
|
677
|
+
? [{ state: 'removed', marker: 'removed', label: row.base?.label }]
|
|
678
|
+
: row.classifications.includes('topology')
|
|
679
|
+
? [
|
|
680
|
+
{ state: 'removed', marker: 'removed', label: row.base?.label },
|
|
681
|
+
{ state: 'changed', marker: 'added', label: row.head?.label },
|
|
682
|
+
]
|
|
683
|
+
: row.classifications.includes('geometry')
|
|
684
|
+
? [
|
|
685
|
+
{ state: 'moved-from', marker: 'moved-from', label: row.base?.label },
|
|
686
|
+
{ state: row.status, marker: row.status, label: row.head?.label },
|
|
687
|
+
]
|
|
688
|
+
: [{ state: 'changed', marker: 'changed', label: row.head?.label }];
|
|
689
|
+
for (const form of forms) {
|
|
690
|
+
descriptors.push(`path:${form.state}:${classifications}`, `text:${form.marker}:`);
|
|
691
|
+
if (form.label) descriptors.push(`g:${form.state}:${classifications}`);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return descriptors.sort(codepointOrder).join('|');
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
const total = (summary, key) => summary.components[key] + summary.connections[key] + summary.boundaries[key];
|
|
698
|
+
|
|
699
|
+
export function renderArchitectureDeltaHtml({ receipt, baseSvg, deltaSvg, headSvg, baseHtml = '', headHtml = '', artifactCss }) {
|
|
700
|
+
const rows = architectureDeltaChangeRows(receipt);
|
|
701
|
+
const changed = total(receipt.summary, 'changed');
|
|
702
|
+
const proof = receipt.proofLevel === 'revision-pinned' ? 'REVISION-PINNED INPUTS' : 'AUTHORED SNAPSHOTS';
|
|
703
|
+
const rowHtml = rows.length ? rows.map((row, index) => {
|
|
704
|
+
const label = row.headLabel || row.baseLabel || row.head?.label || row.base?.label || row.label || row.id;
|
|
705
|
+
const targetSignature = expectedReviewTargetSignature(row);
|
|
706
|
+
return `<li data-change-status="${esc(row.status)}"><button class="change-row" type="button" data-change-index="${index}" data-change-key="${esc(row.key)}" data-change-kind="${esc(row.kindKey)}" data-change-id="${esc(row.id)}" data-change-label="${esc(label)}" data-change-status="${esc(row.status)}" data-change-classifications="${esc(row.classifications.join(', '))}" data-change-target-signature="${esc(targetSignature)}"><span class="token">${esc(markerFor(row.status) || '~')}</span><span>${esc(row.kind)}</span><strong>${esc(label)}</strong><code>${esc(row.id)}</code><span>${esc(row.classifications.join(', '))}</span><span>${esc(row.changedFields.join(', ') || 'identity')}</span></button></li>`;
|
|
707
|
+
}).join('\n') : '<li class="empty">No authored architecture changes.</li>';
|
|
708
|
+
const baseView = baseHtml
|
|
709
|
+
? `<iframe class="snapshot-frame" title="Before architecture explorer" srcdoc="${esc(baseHtml)}"></iframe>`
|
|
710
|
+
: baseSvg;
|
|
711
|
+
const headView = headHtml
|
|
712
|
+
? `<iframe class="snapshot-frame" title="After architecture explorer" srcdoc="${esc(headHtml)}"></iframe>`
|
|
713
|
+
: headSvg;
|
|
714
|
+
const html = `<!doctype html>
|
|
715
|
+
<html lang="en" data-theme="dark" data-preset="${esc(receipt.view.visualPreset)}">
|
|
716
|
+
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${esc(receipt.head.title)} Architecture Delta</title>
|
|
717
|
+
<style>
|
|
718
|
+
${artifactCss}
|
|
719
|
+
:root{color-scheme:dark;--d-add:#34d399;--d-remove:#fb7185;--d-change:#fbbf24;--d-move:#7dd3fc;--d-focus:#7dd3fc;--d-ink:#e6edf5;--d-muted:#8aa0b5;--d-line:#25384a}
|
|
720
|
+
*{box-sizing:border-box}body{margin:0;overflow-x:hidden;background:#071019;color:var(--d-ink);font-family:"JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,monospace}.proof-page{width:min(1600px,calc(100vw - 64px));margin:auto;padding:30px 0 42px}.proof-head{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:28px;align-items:end;padding-bottom:20px;border-bottom:1px solid var(--d-line)}.eyebrow{margin:0 0 8px;color:#7dd3fc;font:700 11px/1.2 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.14em}.proof-head h1{margin:0;font-size:clamp(32px,4vw,56px);line-height:.96;letter-spacing:-.04em}.subtitle{margin:12px 0 0;color:var(--d-muted);font-size:14px}.metrics{display:flex;gap:9px}.metric{min-width:86px;padding:11px 13px;border:1px solid var(--d-line);border-radius:8px;background:#0b1722}.metric strong{display:block;font:700 23px/1 ui-monospace,SFMono-Regular,Menlo,monospace}.metric span{display:block;margin-top:6px;color:var(--d-muted);font:700 9px/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.1em}.add strong{color:var(--d-add)}.remove strong{color:var(--d-remove)}.change strong{color:var(--d-change)}
|
|
721
|
+
.proof-tools{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:16px 0 10px}.view-switch{display:inline-flex;padding:3px;border:1px solid var(--d-line);border-radius:8px;background:#0a141e}.view-switch button,.utility,.review-step{border:0;border-radius:6px;background:transparent;color:var(--d-muted);padding:8px 14px;font:700 11px/1 ui-monospace,SFMono-Regular,Menlo,monospace;cursor:pointer}.view-switch button[aria-selected="true"]{background:#173047;color:#fff}.utility{border:1px solid var(--d-line)}.view-switch button:focus-visible,.utility:focus-visible,.review-step:focus-visible,.change-row:focus-visible{outline:2px solid var(--d-focus);outline-offset:2px}.utility:disabled,.review-step:disabled{cursor:not-allowed;opacity:.45}.legend{display:flex;gap:16px;color:var(--d-muted);font:650 10px/1 ui-monospace,SFMono-Regular,Menlo,monospace}.legend span{display:inline-flex;align-items:center;gap:6px}.legend i{width:22px;border-top:3px solid currentColor}.legend .add{color:var(--d-add)}.legend .remove{color:var(--d-remove)}.legend .remove i{border-top-style:dashed}.legend .change{color:var(--d-change)}.legend .change i{border-top-style:dotted}.legend .move{color:var(--d-move)}.legend .move i{border-top-style:double}
|
|
722
|
+
.review-strip{display:grid;grid-template-columns:auto auto auto auto minmax(0,1fr);align-items:center;gap:5px;margin:0 0 10px;padding:7px 8px;border-block:1px solid var(--d-line);font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.review-step{min-height:34px;border:1px solid var(--d-line);padding-inline:11px}.review-step[aria-pressed="true"]{border-color:var(--d-focus);color:var(--d-ink)}.review-status{min-width:0;padding-left:9px;color:var(--d-muted);font-size:10px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.review-status strong{color:var(--d-ink);font-weight:750}.review-status[data-state="unavailable"]{color:var(--d-remove)}
|
|
723
|
+
.canvas{overflow:hidden;border:1px solid var(--d-line);border-radius:10px;background:#09141e;padding:12px;min-height:520px}.canvas svg{display:block;width:100%;height:auto;max-height:72vh}.canvas[hidden]{display:none}.snapshot-frame{display:block;width:100%;height:min(76vh,920px);min-height:620px;border:0;border-radius:6px;background:#071019}.canvas[data-view="base"],.canvas[data-view="head"]{padding:0}.canvas[data-view="delta"] [data-delta-state="same"]{opacity:.38}.canvas[data-delta-review-active]{--review-same-opacity:.14;--review-change-opacity:.28}.canvas[data-delta-review-active] [data-delta-state="same"]{opacity:var(--review-same-opacity)!important}.canvas[data-delta-review-active] [data-delta-state]:not([data-delta-state="same"]):not([data-delta-review-current]){opacity:var(--review-change-opacity)!important}.canvas[data-delta-review-active] [data-delta-review-current]{opacity:1!important;transition:opacity .16s ease-out}g[data-node-id][data-delta-state="added"]>rect:last-of-type{stroke:var(--d-add)!important;stroke-width:3!important}g[data-node-id][data-delta-state="removed"]>rect:last-of-type{stroke:var(--d-remove)!important;stroke-width:3!important;stroke-dasharray:7 5}g[data-node-id][data-delta-state="changed"]>rect:last-of-type{stroke:var(--d-change)!important;stroke-width:3!important;stroke-dasharray:2 3}g[data-node-id][data-delta-state="moved"]>rect:last-of-type,g[data-node-id][data-delta-state="moved-from"]>rect:last-of-type{stroke:var(--d-move)!important;stroke-width:3!important;stroke-dasharray:8 3 2 3}g[data-node-id][data-delta-state="moved-from"],path[data-delta-state="moved-from"]{opacity:.42}path[data-delta-state="added"]{stroke:var(--d-add)!important;stroke-width:3!important}path[data-delta-state="removed"]{stroke:var(--d-remove)!important;stroke-width:3!important;stroke-dasharray:7 5!important}path[data-delta-state="changed"]{stroke:var(--d-change)!important;stroke-width:3!important;stroke-dasharray:2 3!important}path[data-delta-state="rerouted"],path[data-delta-state="moved-from"]{stroke:var(--d-move)!important;stroke-width:2.5!important;stroke-dasharray:8 3 2 3!important}.delta-node-marker circle{fill:#071019;stroke:currentColor;stroke-width:1.5}.delta-node-marker text,.delta-edge-marker,.delta-boundary-marker{fill:currentColor;font:800 9px ui-monospace,SFMono-Regular,Menlo,monospace}[data-delta-state="added"] .delta-node-marker,.delta-edge-marker[data-delta-state="added"],.delta-boundary-marker[data-delta-state="added"]{color:var(--d-add)}[data-delta-state="removed"] .delta-node-marker,.delta-edge-marker[data-delta-state="removed"],.delta-boundary-marker[data-delta-state="removed"]{color:var(--d-remove)}[data-delta-state="changed"] .delta-node-marker,.delta-edge-marker[data-delta-state="changed"],.delta-boundary-marker[data-delta-state="changed"]{color:var(--d-change)}[data-delta-state="moved"] .delta-node-marker,[data-delta-state="moved-from"] .delta-node-marker,.delta-edge-marker[data-delta-state="moved-from"],.delta-edge-marker[data-delta-state="rerouted"],.delta-boundary-marker[data-delta-state="geometry-changed"]{color:var(--d-move)}.delta-edge-marker,.delta-boundary-marker{paint-order:stroke;stroke:#071019;stroke-width:3px}
|
|
724
|
+
rect[data-graph-role="structural-frame"][data-delta-state="added"]{stroke:var(--d-add)!important;stroke-width:2.5!important}rect[data-graph-role="structural-frame"][data-delta-state="removed"]{stroke:var(--d-remove)!important;stroke-width:2.5!important;stroke-dasharray:7 5!important}rect[data-graph-role="structural-frame"][data-delta-state="changed"]{stroke:var(--d-change)!important;stroke-width:2.5!important;stroke-dasharray:2 3!important}rect[data-graph-role="structural-frame"][data-delta-state="moved-from"]{stroke:var(--d-move)!important;stroke-width:2!important;stroke-dasharray:8 3 2 3!important;opacity:.42}text[data-delta-boundary-state="added"]{fill:var(--d-add)!important}text[data-delta-boundary-state="removed"]{fill:var(--d-remove)!important}text[data-delta-boundary-state="changed"]{fill:var(--d-change)!important}text[data-delta-boundary-state="moved-from"]{fill:var(--d-move)!important;opacity:.55}
|
|
725
|
+
details{margin-top:12px;border:1px solid var(--d-line);border-radius:9px;background:#0a141e}summary{padding:13px 15px;cursor:pointer;font-weight:700}.changes{list-style:none;margin:0;padding:0 8px 8px}.changes li{border-top:1px solid rgba(138,160,181,.16)}.change-row{display:grid;grid-template-columns:30px 90px minmax(140px,1fr) minmax(100px,.7fr) minmax(120px,.8fr) minmax(140px,1.2fr);gap:10px;width:100%;margin:0;padding:9px 7px;border:0;border-radius:5px;background:transparent;color:inherit;font:inherit;font-size:11px;text-align:left;align-items:baseline;cursor:pointer}.change-row:hover{background:rgba(125,211,252,.06)}.change-row[aria-current="step"]{background:rgba(125,211,252,.1);box-shadow:inset 0 0 0 1px var(--d-focus)}.change-row:disabled{cursor:default}.token{font:800 13px/1 ui-monospace,SFMono-Regular,Menlo,monospace}.changes code,.change-row>span:last-child{color:var(--d-muted)}.proof-foot{display:flex;justify-content:space-between;gap:24px;margin-top:14px;color:var(--d-muted);font:650 10px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace}
|
|
726
|
+
html[data-theme="dark"] body{background:#071019!important;background-image:none!important}html[data-theme="light"]{color-scheme:light;--d-ink:#10283c;--d-muted:#587187;--d-line:#c8d6e2;--d-focus:#006b8f}html[data-theme="light"] body{background:#eef3f7!important;background-image:none!important;color:var(--d-ink)}html[data-theme="light"] .metric,html[data-theme="light"] .view-switch,html[data-theme="light"] details{background:#fff}html[data-theme="light"] .canvas{background:#f8fbfd}html[data-theme="light"] .view-switch button[aria-selected="true"]{background:#dbeaf5;color:#10283c}html[data-theme="light"] .delta-node-marker circle{fill:#fff}html[data-preset="blueprint"] body{background-image:none!important}
|
|
727
|
+
@media(max-width:760px){.proof-page{width:100%;padding:12px}.proof-head{grid-template-columns:1fr;gap:14px;align-items:start}.proof-head h1{font-size:32px}.metrics{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%}.metric{min-width:0}.proof-tools{align-items:stretch;flex-wrap:wrap;gap:8px}.view-switch{display:flex;flex:1 1 100%}.view-switch button{flex:1;padding-inline:8px}.legend{flex-wrap:wrap;gap:8px}.proof-tools>div:last-child{margin-left:auto}.review-strip{grid-template-columns:auto auto auto auto}.review-status{grid-column:1/-1;padding:4px 2px 0}.canvas{min-height:0;padding:6px;overflow:auto}.canvas svg{min-width:720px;max-height:none}.snapshot-frame{min-width:720px}.changes{overflow-x:auto}.change-row{min-width:820px}.proof-foot{flex-direction:column;gap:4px}}
|
|
728
|
+
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}.canvas[data-delta-review-active] [data-delta-review-current]{transition:none!important}}@media print{body{min-width:0;background:#fff;color:#111}.proof-page{width:100%;padding:0}.proof-tools,.review-strip,details{display:none!important}.canvas{display:none!important}.canvas[data-view="delta"]{display:block!important;border:0}.canvas[data-view="delta"] [data-delta-state="same"]{opacity:1!important;transition:none!important}.canvas[data-delta-review-active]{--review-same-opacity:1;--review-change-opacity:1}.canvas[data-delta-review-active] [data-delta-review-current]{opacity:1!important;transition:none!important}.proof-foot{color:#444}}
|
|
729
|
+
</style></head>
|
|
730
|
+
<body><main class="proof-page"><header class="proof-head"><div><p class="eyebrow">ARCHITECTURE DELTA · ${proof}</p><h1>See what changed<br>before you merge.</h1><p class="subtitle">${esc(receipt.base.title)} → ${esc(receipt.head.title)}</p></div><div class="metrics"><div class="metric add"><strong>${total(receipt.summary, 'added')}</strong><span>ADDED</span></div><div class="metric remove"><strong>${total(receipt.summary, 'removed')}</strong><span>REMOVED</span></div><div class="metric change"><strong>${changed}</strong><span>CHANGED</span></div></div></header>
|
|
731
|
+
<div class="proof-tools"><div class="view-switch" role="tablist" aria-label="Architecture snapshot"><button role="tab" data-target="base" aria-selected="false">Before</button><button role="tab" data-target="delta" aria-selected="true">Delta</button><button role="tab" data-target="head" aria-selected="false">After</button></div><div class="legend"><span class="add"><i></i>+ ADD</span><span class="remove"><i></i>− DEL</span><span class="change"><i></i>~ MOD</span><span class="move"><i></i>↔ MOVE</span></div><div><button class="utility" id="export-svg" type="button">Export SVG</button> <button class="utility" id="share-card" type="button">Share Card</button> <button class="utility" id="preset" type="button">Preset</button> <button class="utility" id="theme" type="button">Theme</button></div></div>
|
|
732
|
+
<nav class="review-strip" aria-label="Authored change review"><button class="review-step" id="review-overview" type="button" disabled>Overview</button><button class="review-step" id="review-previous" type="button" aria-label="Previous authored change" disabled>←</button><button class="review-step" id="review-play" type="button" aria-pressed="false"${rows.length ? '' : ' disabled'}>Review</button><button class="review-step" id="review-next" type="button" aria-label="Next authored change" disabled>→</button><div class="review-status" id="review-status" role="status" aria-live="polite">Overview · ${rows.length} authored changes</div></nav>
|
|
733
|
+
<section class="canvas" data-view="base" hidden>${baseView}</section><section class="canvas" data-view="delta">${deltaSvg}</section><section class="canvas" data-view="head" hidden>${headView}</section>
|
|
734
|
+
<details${rows.length <= 10 ? ' open' : ''}><summary>Exact authored changes · ${rows.length}</summary><ul class="changes">${rowHtml}</ul></details>
|
|
735
|
+
<footer class="proof-foot"><span>Stable IDs only · completeness: complete · ${proof}</span><span>Authored IR only · no risk or mergeability inference</span></footer></main>
|
|
736
|
+
<script id="archify-compare-receipt" type="application/json">${safeJson(receipt)}</script>
|
|
737
|
+
<script>(()=>{
|
|
738
|
+
const REVIEW_DWELL_MS = 1400;
|
|
739
|
+
const tabs = [...document.querySelectorAll('[role="tab"]')];
|
|
740
|
+
const views = [...document.querySelectorAll('[data-view]')];
|
|
741
|
+
const deltaCanvas = document.querySelector('[data-view="delta"]');
|
|
742
|
+
const rowButtons = [...document.querySelectorAll('.change-row')];
|
|
743
|
+
const overviewButton = document.querySelector('#review-overview');
|
|
744
|
+
const previousButton = document.querySelector('#review-previous');
|
|
745
|
+
const playButton = document.querySelector('#review-play');
|
|
746
|
+
const nextButton = document.querySelector('#review-next');
|
|
747
|
+
const status = document.querySelector('#review-status');
|
|
748
|
+
const receiptNode = document.querySelector('#archify-compare-receipt');
|
|
749
|
+
const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
750
|
+
const exportCss = ${safeJson(artifactCss)};
|
|
751
|
+
let activeIndex = -1;
|
|
752
|
+
let playbackToken = 0;
|
|
753
|
+
let playbackTimer = 0;
|
|
754
|
+
let playing = false;
|
|
755
|
+
let reviewAvailable = false;
|
|
756
|
+
let reviewSources = [];
|
|
757
|
+
|
|
758
|
+
function show(id) {
|
|
759
|
+
tabs.forEach((tab) => tab.setAttribute('aria-selected', String(tab.dataset.target === id)));
|
|
760
|
+
views.forEach((view) => { view.hidden = view.dataset.view !== id; });
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
function stopPlayback() {
|
|
764
|
+
playbackToken += 1;
|
|
765
|
+
if (playbackTimer) window.clearTimeout(playbackTimer);
|
|
766
|
+
playbackTimer = 0;
|
|
767
|
+
playing = false;
|
|
768
|
+
playButton.setAttribute('aria-pressed', 'false');
|
|
769
|
+
playButton.textContent = activeIndex === rowButtons.length - 1 && rowButtons.length ? 'Replay' : 'Review';
|
|
770
|
+
status.setAttribute('aria-live', 'polite');
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
function failReview() {
|
|
774
|
+
stopPlayback();
|
|
775
|
+
reviewAvailable = false;
|
|
776
|
+
activeIndex = -1;
|
|
777
|
+
deltaCanvas?.removeAttribute('data-delta-review-active');
|
|
778
|
+
deltaCanvas?.querySelectorAll('[data-delta-review-current]').forEach((element) => element.removeAttribute('data-delta-review-current'));
|
|
779
|
+
rowButtons.forEach((row) => {
|
|
780
|
+
row.disabled = true;
|
|
781
|
+
row.tabIndex = -1;
|
|
782
|
+
row.removeAttribute('aria-current');
|
|
783
|
+
});
|
|
784
|
+
[overviewButton, previousButton, playButton, nextButton].forEach((button) => { button.disabled = true; });
|
|
785
|
+
status.dataset.state = 'unavailable';
|
|
786
|
+
status.textContent = 'Review unavailable · compare identity mismatch';
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
function receiptRows(receipt) {
|
|
790
|
+
const definitions = [
|
|
791
|
+
{ collection: 'components', kind: 'component', id: 'id', statuses: ['added', 'changed', 'evidence-changed', 'removed', 'moved'] },
|
|
792
|
+
{ collection: 'connections', kind: 'relationship', id: 'id', statuses: ['added', 'changed', 'removed', 'rerouted'] },
|
|
793
|
+
{ collection: 'boundaries', kind: 'boundary', id: 'key', statuses: ['added', 'changed', 'removed', 'geometry-changed'] },
|
|
794
|
+
];
|
|
795
|
+
const rows = [];
|
|
796
|
+
for (const definition of definitions) {
|
|
797
|
+
const changes = receipt.changes[definition.collection];
|
|
798
|
+
if (!Array.isArray(changes)) return null;
|
|
799
|
+
for (const change of changes) {
|
|
800
|
+
if (!change || typeof change !== 'object' || Array.isArray(change)) return null;
|
|
801
|
+
const id = change[definition.id];
|
|
802
|
+
if (typeof id !== 'string' || !id || !definition.statuses.includes(change.status)) return null;
|
|
803
|
+
if (!Array.isArray(change.classifications) || !change.classifications.length || change.classifications.some((value) => typeof value !== 'string')) return null;
|
|
804
|
+
if (new Set(change.classifications).size !== change.classifications.length) return null;
|
|
805
|
+
if (!Array.isArray(change.changedFields) || change.changedFields.some((value) => typeof value !== 'string')) return null;
|
|
806
|
+
rows.push({ ...change, kind: definition.kind, key: definition.kind + ':' + id, id });
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
return rows;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
function exactTargets(row) {
|
|
813
|
+
const attribute = row.dataset.changeKind === 'component'
|
|
814
|
+
? 'data-node-id'
|
|
815
|
+
: row.dataset.changeKind === 'relationship'
|
|
816
|
+
? 'data-edge-id'
|
|
817
|
+
: 'data-delta-boundary-key';
|
|
818
|
+
return [...deltaCanvas.querySelectorAll('[' + attribute + ']')]
|
|
819
|
+
.filter((element) => element.getAttribute(attribute) === row.dataset.changeId);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
function targetSignature(matches) {
|
|
823
|
+
return matches.map((element) => {
|
|
824
|
+
const tag = element.tagName.toLowerCase();
|
|
825
|
+
const state = element.dataset.deltaState || '';
|
|
826
|
+
const classifications = element.dataset.deltaClassifications || '';
|
|
827
|
+
return tag + ':' + state + ':' + classifications;
|
|
828
|
+
}).sort().join('|');
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
function targetsMatch(source, row, matches) {
|
|
832
|
+
if (!source || !matches.length || !row.dataset.changeTargetSignature) return false;
|
|
833
|
+
if (row.dataset.changeKind !== source.kind || row.dataset.changeId !== source.id || row.dataset.changeStatus !== source.status) return false;
|
|
834
|
+
if (row.dataset.changeClassifications !== source.classifications.join(', ')) return false;
|
|
835
|
+
return row.dataset.changeTargetSignature === targetSignature(matches);
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
function validateReview() {
|
|
839
|
+
try {
|
|
840
|
+
if (document.querySelectorAll('#archify-compare-receipt').length !== 1 || !receiptNode) return false;
|
|
841
|
+
if (!deltaCanvas || !['base', 'delta', 'head'].every((id) => document.querySelectorAll('[data-view="' + id + '"]').length === 1)) return false;
|
|
842
|
+
if (deltaCanvas.children.length !== 1 || deltaCanvas.firstElementChild?.tagName.toLowerCase() !== 'svg') return false;
|
|
843
|
+
const receipt = JSON.parse(receiptNode.textContent);
|
|
844
|
+
if (!receipt || receipt.schemaVersion !== 1 || receipt.command !== 'compare' || receipt.completeness !== 'complete' || !receipt.changes) return false;
|
|
845
|
+
const sources = receiptRows(receipt);
|
|
846
|
+
if (!sources || sources.length !== rowButtons.length) return false;
|
|
847
|
+
const sourceByKey = new Map(sources.map((source) => [source.key, source]));
|
|
848
|
+
if (sourceByKey.size !== sources.length) return false;
|
|
849
|
+
const seen = new Set();
|
|
850
|
+
const orderedSources = [];
|
|
851
|
+
for (let index = 0; index < rowButtons.length; index += 1) {
|
|
852
|
+
const row = rowButtons[index];
|
|
853
|
+
const source = sourceByKey.get(row.dataset.changeKey);
|
|
854
|
+
if (!source || seen.has(source.key) || row.dataset.changeIndex !== String(index)) return false;
|
|
855
|
+
const matches = exactTargets(row);
|
|
856
|
+
if (!targetsMatch(source, row, matches)) return false;
|
|
857
|
+
seen.add(source.key);
|
|
858
|
+
orderedSources.push(source);
|
|
859
|
+
}
|
|
860
|
+
if (seen.size !== sourceByKey.size) return false;
|
|
861
|
+
reviewSources = orderedSources;
|
|
862
|
+
return true;
|
|
863
|
+
} catch {
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
function updateControls() {
|
|
869
|
+
overviewButton.disabled = !reviewAvailable || activeIndex < 0;
|
|
870
|
+
previousButton.disabled = !reviewAvailable || activeIndex <= 0;
|
|
871
|
+
nextButton.disabled = !reviewAvailable || activeIndex < 0 || activeIndex >= rowButtons.length - 1;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
function selectChange(index, fromPlayback = false) {
|
|
875
|
+
if (!reviewAvailable || index < 0 || index >= rowButtons.length) return false;
|
|
876
|
+
const row = rowButtons[index];
|
|
877
|
+
const matches = exactTargets(row);
|
|
878
|
+
if (!targetsMatch(reviewSources[index], row, matches)) { failReview(); return false; }
|
|
879
|
+
show('delta');
|
|
880
|
+
deltaCanvas.querySelectorAll('[data-delta-review-current]').forEach((element) => element.removeAttribute('data-delta-review-current'));
|
|
881
|
+
matches.forEach((element) => element.setAttribute('data-delta-review-current', 'true'));
|
|
882
|
+
deltaCanvas.setAttribute('data-delta-review-active', 'true');
|
|
883
|
+
rowButtons.forEach((button, rowIndex) => {
|
|
884
|
+
button.tabIndex = rowIndex === index ? 0 : -1;
|
|
885
|
+
if (rowIndex === index) button.setAttribute('aria-current', 'step');
|
|
886
|
+
else button.removeAttribute('aria-current');
|
|
887
|
+
});
|
|
888
|
+
activeIndex = index;
|
|
889
|
+
updateControls();
|
|
890
|
+
const kind = row.dataset.changeKind.charAt(0).toUpperCase() + row.dataset.changeKind.slice(1);
|
|
891
|
+
status.textContent = String(index + 1).padStart(2, '0') + ' / ' + String(rowButtons.length).padStart(2, '0') + ' · ' + kind + ' · ' + row.dataset.changeLabel + ' [' + row.dataset.changeId + '] · ' + row.dataset.changeClassifications;
|
|
892
|
+
if (fromPlayback) status.setAttribute('aria-live', 'off');
|
|
893
|
+
return true;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
function overview() {
|
|
897
|
+
if (!reviewAvailable) { failReview(); return; }
|
|
898
|
+
stopPlayback();
|
|
899
|
+
activeIndex = -1;
|
|
900
|
+
deltaCanvas.removeAttribute('data-delta-review-active');
|
|
901
|
+
deltaCanvas.querySelectorAll('[data-delta-review-current]').forEach((element) => element.removeAttribute('data-delta-review-current'));
|
|
902
|
+
rowButtons.forEach((row, index) => {
|
|
903
|
+
row.tabIndex = index === 0 ? 0 : -1;
|
|
904
|
+
row.removeAttribute('aria-current');
|
|
905
|
+
});
|
|
906
|
+
show('delta');
|
|
907
|
+
status.removeAttribute('data-state');
|
|
908
|
+
status.textContent = 'Overview · ' + rowButtons.length + ' authored changes';
|
|
909
|
+
updateControls();
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
function schedulePlayback(token) {
|
|
913
|
+
if (!playing || token !== playbackToken || activeIndex >= rowButtons.length - 1) {
|
|
914
|
+
if (activeIndex >= rowButtons.length - 1) stopPlayback();
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
playbackTimer = window.setTimeout(() => {
|
|
918
|
+
if (!playing || token !== playbackToken) return;
|
|
919
|
+
if (!selectChange(activeIndex + 1, true)) return;
|
|
920
|
+
schedulePlayback(token);
|
|
921
|
+
}, REVIEW_DWELL_MS);
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
function startReview() {
|
|
925
|
+
if (!reviewAvailable) return;
|
|
926
|
+
if (playing) { stopPlayback(); return; }
|
|
927
|
+
stopPlayback();
|
|
928
|
+
if (!selectChange(0, false)) return;
|
|
929
|
+
if (reducedMotion.matches || rowButtons.length < 2) return;
|
|
930
|
+
playing = true;
|
|
931
|
+
const token = ++playbackToken;
|
|
932
|
+
playButton.textContent = 'Pause';
|
|
933
|
+
playButton.setAttribute('aria-pressed', 'true');
|
|
934
|
+
status.setAttribute('aria-live', 'off');
|
|
935
|
+
schedulePlayback(token);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
function canonicalDeltaSvg() {
|
|
939
|
+
const source = deltaCanvas?.querySelector(':scope > svg');
|
|
940
|
+
if (!source) throw new Error('Canonical Delta SVG is unavailable.');
|
|
941
|
+
const clone = source.cloneNode(true);
|
|
942
|
+
clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
943
|
+
clone.removeAttribute('style');
|
|
944
|
+
clone.querySelectorAll('[data-delta-review-current]').forEach((element) => element.removeAttribute('data-delta-review-current'));
|
|
945
|
+
const style = document.createElementNS('http://www.w3.org/2000/svg', 'style');
|
|
946
|
+
style.textContent = exportCss + '\\n' +
|
|
947
|
+
'[data-delta-state="same"]{opacity:.38}' +
|
|
948
|
+
'[data-delta-state="added"]{--delta:#34d399}' +
|
|
949
|
+
'[data-delta-state="removed"]{--delta:#fb7185}' +
|
|
950
|
+
'[data-delta-state="changed"]{--delta:#fbbf24}' +
|
|
951
|
+
'[data-delta-state="moved"],[data-delta-state="moved-from"],[data-delta-state="rerouted"],[data-delta-state="geometry-changed"]{--delta:#7dd3fc}' +
|
|
952
|
+
'g[data-node-id][data-delta-state]:not([data-delta-state="same"])>rect:last-of-type{stroke:var(--delta)!important;stroke-width:3!important}' +
|
|
953
|
+
'path[data-delta-state]:not([data-delta-state="same"]){stroke:var(--delta)!important;stroke-width:3!important}' +
|
|
954
|
+
'rect[data-graph-role="structural-frame"][data-delta-state]:not([data-delta-state="same"]){stroke:var(--delta)!important;stroke-width:2.5!important}' +
|
|
955
|
+
'rect[data-graph-role="structural-frame"][data-delta-state="changed"]{stroke-dasharray:2 3!important}' +
|
|
956
|
+
'[data-delta-state="removed"],[data-delta-state="moved-from"]{stroke-dasharray:7 5!important}' +
|
|
957
|
+
'[data-delta-state="moved-from"]{opacity:.42}' +
|
|
958
|
+
'[data-delta-state]:not([data-delta-state="same"]) .delta-node-marker,.delta-edge-marker[data-delta-state],.delta-boundary-marker[data-delta-state]{color:var(--delta)}' +
|
|
959
|
+
'text[data-delta-boundary-state="added"]{fill:#34d399!important}text[data-delta-boundary-state="removed"]{fill:#fb7185!important}text[data-delta-boundary-state="changed"]{fill:#fbbf24!important}text[data-delta-boundary-state="moved-from"]{fill:#7dd3fc!important;opacity:.55}' +
|
|
960
|
+
'.delta-node-marker circle{fill:#071019;stroke:currentColor;stroke-width:1.5}.delta-node-marker text,.delta-edge-marker,.delta-boundary-marker{fill:currentColor;font:800 9px ui-monospace,SFMono-Regular,Menlo,monospace}';
|
|
961
|
+
clone.insertBefore(style, clone.firstChild);
|
|
962
|
+
return new XMLSerializer().serializeToString(clone);
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
function artifactName(suffix) {
|
|
966
|
+
const title = String(JSON.parse(receiptNode.textContent).head.title || 'architecture-delta')
|
|
967
|
+
.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '') || 'architecture-delta';
|
|
968
|
+
return title + suffix;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
function downloadBlob(blob, name) {
|
|
972
|
+
const url = URL.createObjectURL(blob);
|
|
973
|
+
const link = document.createElement('a');
|
|
974
|
+
link.href = url;
|
|
975
|
+
link.download = name;
|
|
976
|
+
document.body.appendChild(link);
|
|
977
|
+
link.click();
|
|
978
|
+
link.remove();
|
|
979
|
+
window.setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
function recordExport(format, blob, dimensions) {
|
|
983
|
+
document.documentElement.dataset.archifyDeltaExport = JSON.stringify({
|
|
984
|
+
ok: true,
|
|
985
|
+
format,
|
|
986
|
+
bytes: blob.size,
|
|
987
|
+
mime: blob.type,
|
|
988
|
+
...(dimensions || {}),
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
function exportCanonicalSvg() {
|
|
993
|
+
const blob = new Blob([canonicalDeltaSvg()], { type: 'image/svg+xml;charset=utf-8' });
|
|
994
|
+
downloadBlob(blob, artifactName('-architecture-delta.svg'));
|
|
995
|
+
recordExport('svg', blob);
|
|
996
|
+
return blob;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
function loadSvgImage(blob) {
|
|
1000
|
+
return new Promise((resolve, reject) => {
|
|
1001
|
+
const url = URL.createObjectURL(blob);
|
|
1002
|
+
const image = new Image();
|
|
1003
|
+
image.onload = () => { URL.revokeObjectURL(url); resolve(image); };
|
|
1004
|
+
image.onerror = () => { URL.revokeObjectURL(url); reject(new Error('Could not rasterize canonical Delta SVG.')); };
|
|
1005
|
+
image.src = url;
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
function pngBlob(canvas) {
|
|
1010
|
+
return new Promise((resolve, reject) => canvas.toBlob((blob) => {
|
|
1011
|
+
if (blob) resolve(blob);
|
|
1012
|
+
else reject(new Error('Canvas returned no Share Card PNG.'));
|
|
1013
|
+
}, 'image/png'));
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
async function shareCard() {
|
|
1017
|
+
const receipt = JSON.parse(receiptNode.textContent);
|
|
1018
|
+
const canvas = document.createElement('canvas');
|
|
1019
|
+
canvas.width = 1200;
|
|
1020
|
+
canvas.height = 630;
|
|
1021
|
+
const ctx = canvas.getContext('2d');
|
|
1022
|
+
if (!ctx) throw new Error('2D canvas context unavailable for Architecture Delta Share Card.');
|
|
1023
|
+
ctx.fillStyle = '#071019';
|
|
1024
|
+
ctx.fillRect(0, 0, 1200, 630);
|
|
1025
|
+
ctx.fillStyle = '#0b1722';
|
|
1026
|
+
ctx.fillRect(34, 28, 1132, 574);
|
|
1027
|
+
ctx.strokeStyle = '#25384a';
|
|
1028
|
+
ctx.lineWidth = 2;
|
|
1029
|
+
ctx.strokeRect(34, 28, 1132, 574);
|
|
1030
|
+
ctx.font = '700 18px ui-monospace, SFMono-Regular, Menlo, monospace';
|
|
1031
|
+
ctx.fillStyle = '#7dd3fc';
|
|
1032
|
+
ctx.fillText('ARCHITECTURE DELTA', 66, 68);
|
|
1033
|
+
ctx.font = '700 34px ui-monospace, SFMono-Regular, Menlo, monospace';
|
|
1034
|
+
ctx.fillStyle = '#e6edf5';
|
|
1035
|
+
const title = String(receipt.head.title || 'Architecture').slice(0, 46) + ' Architecture Delta';
|
|
1036
|
+
ctx.fillText(title.slice(0, 58), 66, 112);
|
|
1037
|
+
ctx.font = '700 17px ui-monospace, SFMono-Regular, Menlo, monospace';
|
|
1038
|
+
ctx.fillStyle = '#8aa0b5';
|
|
1039
|
+
const componentLine = 'COMPONENTS +' + receipt.summary.components.added + ' ~' + receipt.summary.components.changed + ' −' + receipt.summary.components.removed;
|
|
1040
|
+
const connectionLine = 'CONNECTIONS +' + receipt.summary.connections.added + ' ~' + receipt.summary.connections.changed + ' −' + receipt.summary.connections.removed;
|
|
1041
|
+
const boundaryLine = 'BOUNDARY SCOPE +' + receipt.summary.boundaries.added + ' ~' + receipt.summary.boundaries.changed + ' −' + receipt.summary.boundaries.removed;
|
|
1042
|
+
ctx.fillText(componentLine, 66, 151);
|
|
1043
|
+
ctx.fillText(connectionLine, 420, 151);
|
|
1044
|
+
ctx.fillText(boundaryLine, 786, 151);
|
|
1045
|
+
ctx.font = '650 14px ui-monospace, SFMono-Regular, Menlo, monospace';
|
|
1046
|
+
const authoredChanges = ['components', 'connections', 'boundaries'].reduce((sum, collection) => {
|
|
1047
|
+
const summary = receipt.summary[collection];
|
|
1048
|
+
return sum + summary.added + summary.changed + summary.removed;
|
|
1049
|
+
}, 0);
|
|
1050
|
+
const movementSummary = '↔ moved ' + receipt.summary.components.moved + ' · rerouted ' + receipt.summary.connections.rerouted + ' · presentation ' + (receipt.summary.presentationChanged ? 'changed' : 'unchanged');
|
|
1051
|
+
const secondary = authoredChanges === 0
|
|
1052
|
+
? 'No authored architecture changes · ' + movementSummary
|
|
1053
|
+
: movementSummary;
|
|
1054
|
+
ctx.fillText(secondary, 66, 181);
|
|
1055
|
+
const proofLine = receipt.proofLevel === 'revision-pinned'
|
|
1056
|
+
? 'REV ' + String(receipt.base.revision).slice(0, 8) + ' → ' + String(receipt.head.revision).slice(0, 8) + ' · REVISION-PINNED INPUTS'
|
|
1057
|
+
: 'AUTHORED SNAPSHOTS';
|
|
1058
|
+
ctx.textAlign = 'right';
|
|
1059
|
+
ctx.fillText(proofLine, 1134, 181);
|
|
1060
|
+
ctx.textAlign = 'left';
|
|
1061
|
+
ctx.fillStyle = '#09141e';
|
|
1062
|
+
ctx.fillRect(66, 206, 1068, 358);
|
|
1063
|
+
ctx.strokeStyle = '#25384a';
|
|
1064
|
+
ctx.strokeRect(66, 206, 1068, 358);
|
|
1065
|
+
const svgBlob = new Blob([canonicalDeltaSvg()], { type: 'image/svg+xml;charset=utf-8' });
|
|
1066
|
+
const image = await loadSvgImage(svgBlob);
|
|
1067
|
+
const ratio = Math.min(1024 / image.width, 322 / image.height);
|
|
1068
|
+
const width = image.width * ratio;
|
|
1069
|
+
const height = image.height * ratio;
|
|
1070
|
+
ctx.drawImage(image, 600 - width / 2, 385 - height / 2, width, height);
|
|
1071
|
+
ctx.font = '650 12px ui-monospace, SFMono-Regular, Menlo, monospace';
|
|
1072
|
+
ctx.fillStyle = '#8aa0b5';
|
|
1073
|
+
ctx.fillText('Stable authored IDs · static complete Delta · no risk or mergeability inference', 66, 588);
|
|
1074
|
+
return pngBlob(canvas);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
async function downloadShareCard() {
|
|
1078
|
+
const blob = await shareCard();
|
|
1079
|
+
downloadBlob(blob, artifactName('-architecture-delta-share-card.png'));
|
|
1080
|
+
recordExport('share-card', blob, { width: 1200, height: 630 });
|
|
1081
|
+
return blob;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
window.Archify = window.Archify || {};
|
|
1085
|
+
window.Archify.deltaExport = { canonicalSvg: canonicalDeltaSvg, shareCard, exportSvg: exportCanonicalSvg, downloadShareCard };
|
|
1086
|
+
window.Archify.exportMenu = {
|
|
1087
|
+
shareCard,
|
|
1088
|
+
run(format) {
|
|
1089
|
+
if (format === 'svg') return exportCanonicalSvg();
|
|
1090
|
+
if (format === 'share-card') return downloadShareCard();
|
|
1091
|
+
throw new Error('Unknown Architecture Delta export format: ' + format);
|
|
1092
|
+
},
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
tabs.forEach((tab, index) => {
|
|
1096
|
+
tab.addEventListener('click', () => { stopPlayback(); show(tab.dataset.target); });
|
|
1097
|
+
tab.addEventListener('keydown', (event) => {
|
|
1098
|
+
if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return;
|
|
1099
|
+
event.preventDefault();
|
|
1100
|
+
stopPlayback();
|
|
1101
|
+
const next = event.key === 'Home' ? 0 : event.key === 'End' ? tabs.length - 1 : (index + (event.key === 'ArrowRight' ? 1 : -1) + tabs.length) % tabs.length;
|
|
1102
|
+
tabs[next].focus();
|
|
1103
|
+
show(tabs[next].dataset.target);
|
|
1104
|
+
});
|
|
1105
|
+
});
|
|
1106
|
+
|
|
1107
|
+
rowButtons.forEach((row, index) => {
|
|
1108
|
+
row.tabIndex = index === 0 ? 0 : -1;
|
|
1109
|
+
row.addEventListener('click', () => { stopPlayback(); selectChange(index); });
|
|
1110
|
+
row.addEventListener('keydown', (event) => {
|
|
1111
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
1112
|
+
event.preventDefault();
|
|
1113
|
+
stopPlayback();
|
|
1114
|
+
selectChange(index);
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
if (!['ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key)) return;
|
|
1118
|
+
event.preventDefault();
|
|
1119
|
+
stopPlayback();
|
|
1120
|
+
const next = event.key === 'Home' ? 0 : event.key === 'End' ? rowButtons.length - 1 : (index + (event.key === 'ArrowDown' ? 1 : -1) + rowButtons.length) % rowButtons.length;
|
|
1121
|
+
rowButtons.forEach((button, rowIndex) => { button.tabIndex = rowIndex === next ? 0 : -1; });
|
|
1122
|
+
rowButtons[next].focus();
|
|
1123
|
+
});
|
|
1124
|
+
});
|
|
1125
|
+
|
|
1126
|
+
overviewButton.addEventListener('click', overview);
|
|
1127
|
+
previousButton.addEventListener('click', () => { stopPlayback(); selectChange(activeIndex - 1); });
|
|
1128
|
+
nextButton.addEventListener('click', () => { stopPlayback(); selectChange(activeIndex + 1); });
|
|
1129
|
+
playButton.addEventListener('click', startReview);
|
|
1130
|
+
document.addEventListener('focusin', (event) => {
|
|
1131
|
+
if (playing && event.target.closest('button')) stopPlayback();
|
|
1132
|
+
});
|
|
1133
|
+
document.addEventListener('visibilitychange', () => { if (document.hidden) stopPlayback(); });
|
|
1134
|
+
window.addEventListener('beforeprint', overview);
|
|
1135
|
+
reducedMotion.addEventListener('change', () => { if (reducedMotion.matches) stopPlayback(); });
|
|
1136
|
+
document.addEventListener('keydown', (event) => {
|
|
1137
|
+
if (event.key === 'Escape' && activeIndex >= 0) {
|
|
1138
|
+
event.preventDefault();
|
|
1139
|
+
overview();
|
|
1140
|
+
playButton.focus();
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
document.querySelector('#theme').addEventListener('click', () => { document.documentElement.dataset.theme = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark'; });
|
|
1145
|
+
const presets = ['classic', 'signal-flow', 'blueprint'];
|
|
1146
|
+
document.querySelector('#preset').addEventListener('click', () => { const now = document.documentElement.dataset.preset; document.documentElement.dataset.preset = presets[(presets.indexOf(now) + 1) % presets.length]; });
|
|
1147
|
+
document.querySelector('#export-svg').addEventListener('click', exportCanonicalSvg);
|
|
1148
|
+
document.querySelector('#share-card').addEventListener('click', () => { downloadShareCard().catch((error) => window.alert(error.message)); });
|
|
1149
|
+
|
|
1150
|
+
reviewAvailable = validateReview();
|
|
1151
|
+
if (!reviewAvailable) failReview();
|
|
1152
|
+
else {
|
|
1153
|
+
status.removeAttribute('data-state');
|
|
1154
|
+
updateControls();
|
|
1155
|
+
}
|
|
1156
|
+
})();</script></body></html>`;
|
|
1157
|
+
return html.replace(/[ \t]+$/gm, '');
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
export function validateArchitectureDeltaHtml(html, receipt) {
|
|
1161
|
+
const failures = [];
|
|
1162
|
+
const rows = architectureDeltaChangeRows(receipt);
|
|
1163
|
+
const deltaMarkup = html.match(/<section class="canvas" data-view="delta">([\s\S]*?)<\/section>/)?.[1] || '';
|
|
1164
|
+
const svgTags = [...deltaMarkup.matchAll(/<\/?svg\b[^>]*>/g)];
|
|
1165
|
+
let svgDepth = 0;
|
|
1166
|
+
let svgRoots = 0;
|
|
1167
|
+
let rootStart = -1;
|
|
1168
|
+
let rootEnd = -1;
|
|
1169
|
+
let svgBalanced = true;
|
|
1170
|
+
for (const match of svgTags) {
|
|
1171
|
+
if (match[0].startsWith('</')) {
|
|
1172
|
+
svgDepth -= 1;
|
|
1173
|
+
if (svgDepth < 0) svgBalanced = false;
|
|
1174
|
+
if (svgDepth === 0) rootEnd = match.index + match[0].length;
|
|
1175
|
+
} else {
|
|
1176
|
+
if (svgDepth === 0) {
|
|
1177
|
+
svgRoots += 1;
|
|
1178
|
+
if (rootStart < 0) rootStart = match.index;
|
|
1179
|
+
}
|
|
1180
|
+
svgDepth += 1;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
if (!['base', 'delta', 'head'].every((id) => (html.match(new RegExp(`<section class="canvas" data-view="${id}"`, 'g')) || []).length === 1)) failures.push('expected one Before, Delta, and After canvas');
|
|
1184
|
+
if ((html.match(/class="snapshot-frame" title="Before architecture explorer"/g) || []).length !== 1
|
|
1185
|
+
|| (html.match(/class="snapshot-frame" title="After architecture explorer"/g) || []).length !== 1) {
|
|
1186
|
+
failures.push('Before and After must preserve one complete architecture explorer each');
|
|
1187
|
+
}
|
|
1188
|
+
if (!svgBalanced || svgDepth !== 0 || svgRoots !== 1 || deltaMarkup.slice(0, rootStart).trim() || deltaMarkup.slice(rootEnd).trim()) failures.push('expected exactly one root SVG in the Delta canvas');
|
|
1189
|
+
if ((html.match(/id="archify-compare-receipt"/g) || []).length !== 1) failures.push('expected exactly one embedded compare receipt');
|
|
1190
|
+
if (!html.includes('aria-label="Authored change review"')) failures.push('missing exact-ID change navigator');
|
|
1191
|
+
if ((html.match(/class="change-row"/g) || []).length !== rows.length) failures.push('change navigator row count does not match the receipt');
|
|
1192
|
+
if (!html.includes('id="export-svg"') || !html.includes('id="share-card"')
|
|
1193
|
+
|| !html.includes('window.Archify.deltaExport = { canonicalSvg: canonicalDeltaSvg, shareCard')) {
|
|
1194
|
+
failures.push('missing canonical Delta SVG or Share Card export contract');
|
|
1195
|
+
}
|
|
1196
|
+
for (const [index, row] of rows.entries()) {
|
|
1197
|
+
const safeKey = esc(row.key).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
1198
|
+
const rowMatches = [...html.matchAll(new RegExp(`<button class="change-row"[^>]*data-change-key="${safeKey}"[^>]*>`, 'g'))].map((match) => match[0]);
|
|
1199
|
+
if (rowMatches.length !== 1) failures.push(`expected exactly one change row ${row.key}`);
|
|
1200
|
+
const targets = reviewTargetTags(deltaMarkup, row);
|
|
1201
|
+
if (!targets.length) failures.push(`missing Delta identity ${row.key}`);
|
|
1202
|
+
if (targets.some(({ tag }) => !/\bdata-delta-state="[^"]+"/.test(tag))) failures.push(`missing Delta target state ${row.key}`);
|
|
1203
|
+
const signature = reviewTargetSignature(targets);
|
|
1204
|
+
const expectedSignature = expectedReviewTargetSignature(row);
|
|
1205
|
+
const storedSignature = rowMatches[0]?.match(/\bdata-change-target-signature="([^"]*)"/)?.[1];
|
|
1206
|
+
if (!signature || signature !== expectedSignature || storedSignature !== expectedSignature) failures.push(`ambiguous Delta target signature ${row.key}`);
|
|
1207
|
+
if (rowMatches[0]?.match(/\bdata-change-index="([^"]+)"/)?.[1] !== String(index)) failures.push(`incorrect change row order ${row.key}`);
|
|
1208
|
+
const primary = primaryReviewTags(deltaMarkup, row);
|
|
1209
|
+
const states = primary.map((tag) => tag.match(/\bdata-delta-state="([^"]+)"/)?.[1]).filter(Boolean).sort();
|
|
1210
|
+
if (JSON.stringify(states) !== JSON.stringify(reviewPrimaryStates(row).sort())) failures.push(`ambiguous Delta identity ${row.key}`);
|
|
1211
|
+
const classifications = row.classifications.join(',');
|
|
1212
|
+
if (primary.some((tag) => tag.match(/\bdata-delta-classifications="([^"]*)"/)?.[1] !== classifications)) failures.push(`conflicting Delta classification ${row.key}`);
|
|
1213
|
+
}
|
|
1214
|
+
// Before/After embed the complete existing explorer runtime. Validate claims
|
|
1215
|
+
// made by the Delta shell itself, not implementation vocabulary inside an
|
|
1216
|
+
// escaped srcdoc script (for example, "safe scale" in image export code).
|
|
1217
|
+
const deltaShell = html.replace(/<iframe\b[^>]*><\/iframe>/g, '');
|
|
1218
|
+
if (/\b(?:SAFE|LOW RISK|MERGEABLE|NO IMPACT|VERIFIED PR)\b/i.test(deltaShell)) failures.push('contains a forbidden risk or mergeability claim');
|
|
1219
|
+
if (/\b(?:NaN|Infinity)\b/.test(html)) failures.push('contains non-finite output');
|
|
1220
|
+
if (receipt.completeness !== 'complete') failures.push('receipt is not complete');
|
|
1221
|
+
if (failures.length) fail('delta/artifact-invalid', `Architecture Delta artifact failed validation: ${failures.join('; ')}.`, { failures });
|
|
1222
|
+
return { ok: true, checksPassed: 10, checkCount: 10 };
|
|
1223
|
+
}
|