@a-company/paradigm 5.38.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{accept-orchestration-OATWIRHP.js → accept-orchestration-QQISPINV.js} +1 -1
- package/dist/add-UOR4INIV.js +8 -0
- package/dist/{agent-loader-RIVI6QPP.js → agent-loader-2WJHD46U.js} +1 -1
- package/dist/{agent-loader-RJRVO5GQ.js → agent-loader-YKS2PQWO.js} +1 -1
- package/dist/{ambient-76YMUA5Q.js → ambient-BE3SQXNN.js} +1 -1
- package/dist/{ambient-WTLYUAQM.js → ambient-NVKQCW2A.js} +12 -12
- package/dist/{assess-UFPYEJKP.js → assess-63WXHWJV.js} +1 -1
- package/dist/{calibration-OLJYB5HN.js → calibration-BDHGYJOK.js} +1 -1
- package/dist/{chunk-5QOCKWK5.js → chunk-4PSD5R7N.js} +2 -2
- package/dist/{chunk-HOBHJPTL.js → chunk-6SKSV5B2.js} +1 -1
- package/dist/{chunk-4L7665QV.js → chunk-FEYOQMZ5.js} +1 -1
- package/dist/{chunk-NEJ4ZLCY.js → chunk-GAFKOFAV.js} +1 -1
- package/dist/chunk-GRZQIKST.js +2 -0
- package/dist/{chunk-RLCH7DXQ.js → chunk-K7X3Z3GL.js} +1 -1
- package/dist/{chunk-4VKSEOXZ.js → chunk-LPBCQM5Y.js} +3 -3
- package/dist/{chunk-74SGKSRQ.js → chunk-M2HKWR25.js} +1 -1
- package/dist/{chunk-BOYQAMGC.js → chunk-M3PPXJU4.js} +1 -1
- package/dist/chunk-PHEX6LU4.js +111 -0
- package/dist/chunk-Q527BPUF.js +2 -0
- package/dist/chunk-R5ECMBIV.js +11 -0
- package/dist/{chunk-X3U3IGYT.js → chunk-TBWWFRL5.js} +1 -1
- package/dist/{chunk-MQIG6SMF.js → chunk-TNVWGPCE.js} +1 -1
- package/dist/chunk-TZDYIPVU.js +521 -0
- package/dist/{chunk-3XGNXXCT.js → chunk-UZ5H7K6Q.js} +1 -1
- package/dist/chunk-VIG5LSGZ.js +2 -0
- package/dist/chunk-VNIX5KBT.js +3 -0
- package/dist/{chunk-AGFPVSX5.js → chunk-VXIIVMTM.js} +1 -1
- package/dist/{chunk-ORDKEGII.js → chunk-WESTEMIM.js} +1 -1
- package/dist/{chunk-DOCDDDTD.js → chunk-YNDPSWOE.js} +5 -5
- package/dist/chunk-Z5QW6USC.js +2 -0
- package/dist/{compliance-D7GD6ZYC.js → compliance-BNFWQPKM.js} +1 -1
- package/dist/config-schema-FLHRVZMI.js +2 -0
- package/dist/{context-audit-XRPT3OU2.js → context-audit-JVCA6GSV.js} +1 -1
- package/dist/{cursorrules-U5O4G5T4.js → cursorrules-ZXPXPZ3P.js} +1 -1
- package/dist/decision-loader-HELL2AMX.js +2 -0
- package/dist/{delete-P5VULXR4.js → delete-2C6ALLYY.js} +1 -1
- package/dist/{diff-YGHBIJY5.js → diff-MF55KQZH.js} +1 -1
- package/dist/{dist-KGRCLBJP-2QAPFYNF.js → dist-GQ42YS5N-4HIJZVBB.js} +10 -10
- package/dist/{docs-USDAF26F.js → docs-O37YLLRN.js} +1 -1
- package/dist/doctor-IG5XM4C4.js +2 -0
- package/dist/{edit-GUU3HBVW.js → edit-P3MDAZLU.js} +1 -1
- package/dist/{flow-FVZR3YJ4.js → flow-BGXOVE2V.js} +1 -1
- package/dist/index.js +6 -6
- package/dist/init-M44SO65G.js +2 -0
- package/dist/{init-XYB62Q3X.js → init-V4KSEKPK.js} +1 -1
- package/dist/{list-YKIQNKGB.js → list-2XIWUEMA.js} +1 -1
- package/dist/list-CFHINXIS.js +12 -0
- package/dist/lore-loader-D2ISOASW.js +2 -0
- package/dist/lore-loader-PXFKMKAN.js +2 -0
- package/dist/mcp.js +4 -4
- package/dist/metrics-UESGUHTA.js +2 -0
- package/dist/migrate-assessments-YSITX7KM.js +4 -0
- package/dist/migrate-decisions-NPLQOEEH.js +6 -0
- package/dist/migrate-plsat-EM2ACIQ3.js +6 -0
- package/dist/{nomination-engine-EALA5MGI.js → nomination-engine-QPZJH6XO.js} +1 -1
- package/dist/{notebook-loader-PXNRBBXD.js → notebook-loader-3J2OFMS3.js} +1 -1
- package/dist/{orchestrate-M5PBZBJQ.js → orchestrate-RID7HHHH.js} +1 -1
- package/dist/{platform-server-DNAMH4YI.js → platform-server-UD45NTGV.js} +1 -1
- package/dist/{portal-check-ZMLVBIGW.js → portal-check-DV2VSJ5E.js} +1 -1
- package/dist/portal-compliance-JONQ4SOP.js +2 -0
- package/dist/{probe-3FTG6LYO.js → probe-5HAXULAD.js} +1 -1
- package/dist/{providers-AWA7WLLM.js → providers-4PXMWA7V.js} +1 -1
- package/dist/quiz-WYIZJG5K.js +10 -0
- package/dist/{record-YXPB34MY.js → record-N3VNYYKJ.js} +1 -1
- package/dist/reindex-FWPD2VGM.js +2 -0
- package/dist/{retag-N5XF3KXP.js → retag-72R2OSZV.js} +1 -1
- package/dist/{review-77QI6VOC.js → review-2INNWLTW.js} +1 -1
- package/dist/{sentinel-HYAZ3CO5.js → sentinel-EFPEX246.js} +1 -1
- package/dist/{sentinel-bridge-VR357PKL.js → sentinel-bridge-UR2MKARY.js} +1 -1
- package/dist/{serve-U47GULB6.js → serve-MO35XIZE.js} +1 -1
- package/dist/serve-OQYUO7CR.js +12 -0
- package/dist/{server-4YNUIK4W.js → server-4D77LCST.js} +1 -1
- package/dist/server-FGUL2FWQ.js +7 -0
- package/dist/session-tracker-KGORN6B5.js +2 -0
- package/dist/{session-work-log-PAKXOFGL.js → session-work-log-4IEVE4KK.js} +1 -1
- package/dist/{session-work-log-ZP45TREI.js → session-work-log-EE4UIZ33.js} +1 -1
- package/dist/{setup-FEWSYS3Y.js → setup-ZSEC72BS.js} +1 -1
- package/dist/{shift-PC6C7NUX.js → shift-TVNY2CQF.js} +6 -6
- package/dist/{show-PJ5LFLIL.js → show-JH7LJ5MT.js} +1 -1
- package/dist/show-WVHAL4VU.js +7 -0
- package/dist/{spawn-M5BAV252.js → spawn-UH5RENSE.js} +1 -1
- package/dist/status-S7Z5FVIE.js +6 -0
- package/dist/{summary-PYTEIJ4U.js → summary-WLI3NF4G.js} +2 -2
- package/dist/{sweep-HU74OPVW.js → sweep-7TZFN5NS.js} +1 -1
- package/dist/sync-55U6QPIA.js +2 -0
- package/dist/{sync-llms-7CAI74QL.js → sync-llms-GF7DDQDI.js} +1 -1
- package/dist/{team-PDK64JXI.js → team-MGT66HZQ.js} +1 -1
- package/dist/{timeline-K3ZFKJ3R.js → timeline-RK7O2SCM.js} +1 -1
- package/dist/tools-QJHAVYI6.js +2 -0
- package/dist/university-content/notes/N-para-001-build-something.md +126 -0
- package/dist/university-content/notes/N-para-001-meet-the-team.md +85 -0
- package/dist/university-content/notes/N-para-001-shift-setup.md +74 -0
- package/dist/university-content/notes/N-para-101-component-types.md +99 -0
- package/dist/university-content/notes/N-para-101-first-steps.md +134 -0
- package/dist/university-content/notes/N-para-101-five-symbols.md +128 -0
- package/dist/university-content/notes/N-para-101-paradigm-logger.md +89 -0
- package/dist/university-content/notes/N-para-101-portal-yaml.md +112 -0
- package/dist/university-content/notes/N-para-101-project-structure.md +143 -0
- package/dist/university-content/notes/N-para-101-purpose-files.md +121 -0
- package/dist/university-content/notes/N-para-101-tags-and-classification.md +93 -0
- package/dist/university-content/notes/N-para-101-welcome.md +51 -0
- package/dist/university-content/notes/N-para-201-architecture-review.md +175 -0
- package/dist/university-content/notes/N-para-201-aspect-graph.md +79 -0
- package/dist/university-content/notes/N-para-201-aspects-and-anchors.md +112 -0
- package/dist/university-content/notes/N-para-201-component-patterns.md +138 -0
- package/dist/university-content/notes/N-para-201-cross-cutting-concerns.md +145 -0
- package/dist/university-content/notes/N-para-201-disciplines.md +187 -0
- package/dist/university-content/notes/N-para-201-flows-deep-dive.md +119 -0
- package/dist/university-content/notes/N-para-201-gates-deep-dive.md +165 -0
- package/dist/university-content/notes/N-para-201-portal-protocol.md +133 -0
- package/dist/university-content/notes/N-para-201-signal-patterns.md +159 -0
- package/dist/university-content/notes/N-para-201-symbol-naming.md +149 -0
- package/dist/university-content/notes/N-para-301-context-management.md +53 -0
- package/dist/university-content/notes/N-para-301-decisions.md +99 -0
- package/dist/university-content/notes/N-para-301-doctor-and-validation.md +70 -0
- package/dist/university-content/notes/N-para-301-enforcement-levels.md +102 -0
- package/dist/university-content/notes/N-para-301-fragility-tracking.md +50 -0
- package/dist/university-content/notes/N-para-301-history-system.md +42 -0
- package/dist/university-content/notes/N-para-301-navigation-system.md +55 -0
- package/dist/university-content/notes/N-para-301-operations-review.md +55 -0
- package/dist/university-content/notes/N-para-301-paradigm-shift.md +93 -0
- package/dist/university-content/notes/N-para-301-protocols.md +113 -0
- package/dist/university-content/notes/N-para-301-ripple-analysis.md +53 -0
- package/dist/university-content/notes/N-para-301-sentinel-observability.md +87 -0
- package/dist/university-content/notes/N-para-301-sync-and-maintenance.md +57 -0
- package/dist/university-content/notes/N-para-301-wisdom-system.md +89 -0
- package/dist/university-content/notes/N-para-401-agent-identity.md +99 -0
- package/dist/university-content/notes/N-para-401-agent-interop.md +87 -0
- package/dist/university-content/notes/N-para-401-agent-roles.md +107 -0
- package/dist/university-content/notes/N-para-401-commit-conventions.md +82 -0
- package/dist/university-content/notes/N-para-401-mastery-review.md +71 -0
- package/dist/university-content/notes/N-para-401-mcp-tools-overview.md +102 -0
- package/dist/university-content/notes/N-para-401-multi-agent-coordination.md +80 -0
- package/dist/university-content/notes/N-para-401-notebooks-permissions.md +66 -0
- package/dist/university-content/notes/N-para-401-orchestration-workflow.md +101 -0
- package/dist/university-content/notes/N-para-401-pm-governance.md +71 -0
- package/dist/university-content/notes/N-para-401-provider-cascade.md +75 -0
- package/dist/university-content/notes/N-para-401-quick-check.md +95 -0
- package/dist/university-content/notes/N-para-501-advanced-workflows.md +122 -0
- package/dist/university-content/notes/N-para-501-aspect-graph-advanced.md +195 -0
- package/dist/university-content/notes/N-para-501-aspect-graph-internals.md +97 -0
- package/dist/university-content/notes/N-para-501-assessment-loops.md +116 -0
- package/dist/university-content/notes/N-para-501-conductor-workspace.md +77 -0
- package/dist/university-content/notes/N-para-501-habits-practice.md +164 -0
- package/dist/university-content/notes/N-para-501-hook-enforcement.md +100 -0
- package/dist/university-content/notes/N-para-501-lore-system.md +155 -0
- package/dist/university-content/notes/N-para-501-platform-agent-ui.md +108 -0
- package/dist/university-content/notes/N-para-501-review-compliance.md +72 -0
- package/dist/university-content/notes/N-para-501-sentinel-deep-dive.md +173 -0
- package/dist/university-content/notes/N-para-501-session-intelligence.md +104 -0
- package/dist/university-content/notes/N-para-501-symphony-a-mail.md +120 -0
- package/dist/university-content/notes/N-para-501-symphony-networking.md +119 -0
- package/dist/university-content/notes/N-para-501-task-management.md +100 -0
- package/dist/university-content/notes/N-para-601-agent-renaissance.md +121 -0
- package/dist/university-content/notes/N-para-601-attention-scoring.md +129 -0
- package/dist/university-content/notes/N-para-601-context-composition.md +146 -0
- package/dist/university-content/notes/N-para-601-data-sovereignty.md +140 -0
- package/dist/university-content/notes/N-para-601-event-stream.md +126 -0
- package/dist/university-content/notes/N-para-601-knowledge-streams.md +144 -0
- package/dist/university-content/notes/N-para-601-learning-loop.md +68 -0
- package/dist/university-content/notes/N-para-601-maestro-team-collab.md +136 -0
- package/dist/university-content/notes/N-para-601-nominations-debates.md +115 -0
- package/dist/university-content/notes/N-para-701-agent-notebooks.md +131 -0
- package/dist/university-content/notes/N-para-701-agent-pods-nevrland.md +182 -0
- package/dist/university-content/notes/N-para-701-agent-profiles.md +197 -0
- package/dist/university-content/notes/N-para-701-agent-roster.md +82 -0
- package/dist/university-content/notes/N-para-701-agent-state.md +180 -0
- package/dist/university-content/notes/N-para-701-learning-feedback-loop.md +188 -0
- package/dist/university-content/notes/N-para-701-model-tier-resolution.md +204 -0
- package/dist/university-content/notes/N-para-701-orchestration-enforcement.md +169 -0
- package/dist/university-content/notes/N-para-701-per-project-rosters.md +198 -0
- package/dist/university-content/notes/N-para-701-symphony-visibility.md +142 -0
- package/dist/university-content/paths/LP-para-001.yaml +29 -0
- package/dist/university-content/paths/LP-para-101.yaml +59 -0
- package/dist/university-content/paths/LP-para-201.yaml +69 -0
- package/dist/university-content/paths/LP-para-301.yaml +84 -0
- package/dist/university-content/paths/LP-para-401.yaml +74 -0
- package/dist/university-content/paths/LP-para-501.yaml +89 -0
- package/dist/university-content/paths/LP-para-601.yaml +59 -0
- package/dist/university-content/paths/LP-para-701.yaml +64 -0
- package/dist/university-content/quizzes/Q-para-001-build-something.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-001-meet-the-team.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-001-shift-setup.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-101-component-types.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-101-first-steps.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-101-five-symbols.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-101-paradigm-logger.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-101-portal-yaml.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-101-project-structure.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-101-purpose-files.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-101-tags-and-classification.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-101-welcome.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-201-architecture-review.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-201-aspect-graph.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-201-aspects-and-anchors.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-201-component-patterns.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-201-cross-cutting-concerns.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-201-disciplines.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-201-flows-deep-dive.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-201-gates-deep-dive.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-201-portal-protocol.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-201-signal-patterns.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-201-symbol-naming.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-301-context-management.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-301-decisions.yaml +76 -0
- package/dist/university-content/quizzes/Q-para-301-doctor-and-validation.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-301-enforcement-levels.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-301-fragility-tracking.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-301-history-system.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-301-navigation-system.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-301-operations-review.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-301-paradigm-shift.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-301-protocols.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-301-ripple-analysis.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-301-sentinel-observability.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-301-sync-and-maintenance.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-301-wisdom-system.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-401-agent-identity.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-401-agent-interop.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-401-agent-roles.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-401-commit-conventions.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-401-mastery-review.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-401-mcp-tools-overview.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-401-multi-agent-coordination.yaml +76 -0
- package/dist/university-content/quizzes/Q-para-401-notebooks-permissions.yaml +61 -0
- package/dist/university-content/quizzes/Q-para-401-orchestration-workflow.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-401-pm-governance.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-401-provider-cascade.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-401-quick-check.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-501-advanced-workflows.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-501-aspect-graph-advanced.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-501-aspect-graph-internals.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-501-assessment-loops.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-501-conductor-workspace.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-501-habits-practice.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-501-hook-enforcement.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-501-lore-system.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-501-platform-agent-ui.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-501-review-compliance.yaml +61 -0
- package/dist/university-content/quizzes/Q-para-501-sentinel-deep-dive.yaml +86 -0
- package/dist/university-content/quizzes/Q-para-501-session-intelligence.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-501-symphony-a-mail.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-501-symphony-networking.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-501-task-management.yaml +46 -0
- package/dist/university-content/quizzes/Q-para-601-agent-renaissance.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-601-attention-scoring.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-601-context-composition.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-601-data-sovereignty.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-601-event-stream.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-601-knowledge-streams.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-601-learning-loop.yaml +56 -0
- package/dist/university-content/quizzes/Q-para-601-maestro-team-collab.yaml +86 -0
- package/dist/university-content/quizzes/Q-para-601-nominations-debates.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-agent-notebooks.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-agent-pods-nevrland.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-agent-profiles.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-agent-roster.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-agent-state.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-learning-feedback-loop.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-model-tier-resolution.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-orchestration-enforcement.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-per-project-rosters.yaml +66 -0
- package/dist/university-content/quizzes/Q-para-701-symphony-visibility.yaml +66 -0
- package/dist/university-content/quizzes/Q-plsat-v2.yaml +904 -0
- package/dist/university-content/quizzes/Q-plsat-v3.yaml +2909 -0
- package/dist/university-content/reference.json +2 -2
- package/dist/university-ui/assets/{index-CecQrfSn.js → index-nNgzO1il.js} +2 -2
- package/dist/university-ui/assets/{index-CecQrfSn.js.map → index-nNgzO1il.js.map} +1 -1
- package/dist/university-ui/index.html +1 -1
- package/dist/{upgrade-GX56QE3C.js → upgrade-NKN63VTY.js} +2 -2
- package/dist/validate-XUQZTF3H.js +9 -0
- package/dist/{watch-YCODNIET.js → watch-25GJHQYT.js} +1 -1
- package/lore-ui/dist/assets/{index-Bk-K0qgN.js → index-DKhNxgtW.js} +10 -10
- package/lore-ui/dist/index.html +1 -1
- package/package.json +2 -2
- package/platform-ui/dist/assets/{AmbientSection-BYjt75R1.js → AmbientSection-CwatqcBD.js} +1 -1
- package/platform-ui/dist/assets/{CanvasSection-rKvA_vZj.js → CanvasSection-dFAthehN.js} +1 -1
- package/platform-ui/dist/assets/{DocsSection-CI9K73M-.js → DocsSection-BZ2SFJBZ.js} +1 -1
- package/platform-ui/dist/assets/{GitSection-DSGj_c6S.js → GitSection-MNNYU1tO.js} +1 -1
- package/platform-ui/dist/assets/{GraphSection-CawN7pC5.js → GraphSection-COYjb4Pt.js} +1 -1
- package/platform-ui/dist/assets/LoreSection-B0hUbfsJ.js +1 -0
- package/platform-ui/dist/assets/{SentinelSection-DNgoYMH0.js → SentinelSection-BCxW1DCp.js} +1 -1
- package/platform-ui/dist/assets/{SymphonySection-C0zfcqv3.js → SymphonySection-BsucZRqy.js} +1 -1
- package/platform-ui/dist/assets/{TeamSection-Bzd3Dt9Q.js → TeamSection-C0QNTudW.js} +1 -1
- package/platform-ui/dist/assets/{UniversitySection-tBr62R0S.js → UniversitySection-DN1-g9pw.js} +1 -1
- package/platform-ui/dist/assets/{index-BaOmyn11.js → index-DwUT8pju.js} +2 -2
- package/platform-ui/dist/index.html +1 -1
- package/dist/add-P76GEMGF.js +0 -8
- package/dist/chunk-JQKKVAAN.js +0 -2
- package/dist/chunk-NQ47TA6C.js +0 -111
- package/dist/chunk-ODVKPZZ4.js +0 -2
- package/dist/chunk-Q2J542ST.js +0 -2
- package/dist/chunk-RBLK34IA.js +0 -11
- package/dist/chunk-RN4VE6P3.js +0 -521
- package/dist/chunk-WS2N27RX.js +0 -3
- package/dist/config-schema-GUQY2QN7.js +0 -2
- package/dist/decision-loader-2XPZE4EZ.js +0 -2
- package/dist/doctor-WMVULMQD.js +0 -2
- package/dist/list-5IUGP3ZB.js +0 -7
- package/dist/lore-loader-RVQI5GXL.js +0 -2
- package/dist/lore-loader-XY5MZRR2.js +0 -2
- package/dist/migrate-assessments-GEI5WMI2.js +0 -4
- package/dist/portal-compliance-6YR27IQU.js +0 -2
- package/dist/quiz-FE5UGAY2.js +0 -10
- package/dist/reindex-I6LPAKCC.js +0 -2
- package/dist/serve-OY6XYL7F.js +0 -12
- package/dist/server-2MNROHF6.js +0 -7
- package/dist/session-tracker-MWJAJA6Z.js +0 -2
- package/dist/show-BOAVWZPZ.js +0 -7
- package/dist/status-A37ECYNJ.js +0 -6
- package/dist/sync-DLUBV5HQ.js +0 -2
- package/dist/tools-5ITPEPSV.js +0 -2
- package/dist/university-content/courses/.purpose +0 -492
- package/dist/university-content/courses/para-001.json +0 -166
- package/dist/university-content/courses/para-101.json +0 -615
- package/dist/university-content/courses/para-201.json +0 -794
- package/dist/university-content/courses/para-301.json +0 -830
- package/dist/university-content/courses/para-401.json +0 -868
- package/dist/university-content/courses/para-501.json +0 -1166
- package/dist/university-content/courses/para-601.json +0 -719
- package/dist/university-content/courses/para-701.json +0 -807
- package/dist/university-content/plsat/.purpose +0 -162
- package/dist/university-content/plsat/v2.0.json +0 -760
- package/dist/university-content/plsat/v3.0.json +0 -3453
- package/dist/validate-C6SMKGYD.js +0 -9
- package/platform-ui/dist/assets/LoreSection-oO5dCe6O.js +0 -1
- /package/dist/{chunk-BV5PRPLB.js → chunk-IZSBGW6E.js} +0 -0
- /package/templates/paradigm/specs/{scan.md → probe.md} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b}from'./chunk-
|
|
2
|
+
import {b}from'./chunk-6SKSV5B2.js';import'./chunk-TYWB5IQJ.js';import'./chunk-WESTEMIM.js';import'./chunk-FYDRENK7.js';import'./chunk-IZSBGW6E.js';import'./chunk-AO7ZSRME.js';import'./chunk-EKZDFEJW.js';import'./chunk-LPBCQM5Y.js';import'./chunk-LWAIVOSF.js';import'./chunk-JIXHEBGK.js';import'./chunk-ZJQY5PPP.js';import'./chunk-5TAVYPOV.js';import*as g from'path';import e from'chalk';async function u(n,s,r){let a=s?g.resolve(s):process.cwd();if(!n){r.json?console.log(JSON.stringify({error:"Orchestration ID required"})):(console.log(e.red(`
|
|
3
3
|
Orchestration ID required.`)),console.log(e.gray(`Usage: paradigm team accept <orchestration-id>
|
|
4
4
|
`)));return}let l=new b(a),o=l.getOrchestration(n);if(!o){r.json?console.log(JSON.stringify({error:"Orchestration not found",id:n})):console.log(e.red(`
|
|
5
5
|
Orchestration not found: ${n}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {g as g$1,i,f}from'./chunk-D34YFK4M.js';import {b}from'./chunk-Z5QW6USC.js';import'./chunk-5TAVYPOV.js';import s from'chalk';import {execSync}from'child_process';import*as g from'os';function h(){try{return execSync("git config user.name",{encoding:"utf-8",timeout:3e3}).trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").slice(0,20)||"unknown"}catch{try{return g.userInfo().username}catch{return "unknown"}}}async function C(i$1,e){let r=process.cwd(),p=e.pack||e.project||e.discipline?e:{...e,project:true};b(r,p);e.title||(console.error(s.red(`
|
|
3
|
+
Error: --title is required
|
|
4
|
+
`)),process.exit(1));let l=h(),n=new Date().toISOString().slice(0,10),a=e.title.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),d=e.tags?e.tags.split(",").map(t=>t.trim()):[],u=e.symbols?e.symbols.split(",").map(t=>t.trim()):[];if(i$1==="quiz"){let t=`Q-${a}`,x={id:t,title:e.title,description:e.body||"",author:l,created:n,updated:n,tags:d,symbols:u,difficulty:e.difficulty||"beginner",passThreshold:.7,questions:[]};g$1(r,x),i(r),console.log(s.green(`
|
|
5
|
+
Created quiz: ${t}`)),console.log(s.gray(` Add questions by editing the YAML file
|
|
6
|
+
`));return}let o=`${i$1==="policy"?"P":"N"}-${a}`,b$1={id:o,title:e.title,type:i$1,author:l,created:n,updated:n,tags:d,symbols:u,difficulty:e.difficulty||"beginner",estimatedMinutes:e.minutes?parseInt(e.minutes,10):void 0,prerequisites:[]};f(r,b$1,e.body||""),i(r),console.log(s.green(`
|
|
7
|
+
Created ${i$1}: ${o}`)),console.log(s.gray(` Edit at .paradigm/university/content/${i$1==="policy"?"policies":"notes"}/${o}.md
|
|
8
|
+
`));}export{C as universityAddCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
export{p as buildProfileEnrichment,t as checkPathPermission,u as checkToolPermission,x as computeIntegrityHash,k as createAgentProfile,a as decayedConfidence,s as determineIntegrityStatus,w as enforcePermissions,g as findAgentsByNickname,v as getPermissionConstraints,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,i as loadAllAgentProfiles,b as loadProjectRoster,o as mergeAgentProfileWithManifest,l as queryExpertise,h as resolveAgent,r as sanitizeForPrompt,j as saveAgentProfile,d as saveProjectRoster,q as syncExpertiseFromLore,n as updateExpertiseFromAssessment,m as updateExpertiseFromLore,y as verifyIntegrity}from'./chunk-
|
|
2
|
+
export{p as buildProfileEnrichment,t as checkPathPermission,u as checkToolPermission,x as computeIntegrityHash,k as createAgentProfile,a as decayedConfidence,s as determineIntegrityStatus,w as enforcePermissions,g as findAgentsByNickname,v as getPermissionConstraints,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,i as loadAllAgentProfiles,b as loadProjectRoster,o as mergeAgentProfileWithManifest,l as queryExpertise,h as resolveAgent,r as sanitizeForPrompt,j as saveAgentProfile,d as saveProjectRoster,q as syncExpertiseFromLore,n as updateExpertiseFromAssessment,m as updateExpertiseFromLore,y as verifyIntegrity}from'./chunk-TBWWFRL5.js';import'./chunk-MBPLJKE5.js';import'./chunk-5TAVYPOV.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {z}from'./chunk-
|
|
2
|
+
import {z}from'./chunk-M2HKWR25.js';export{p as buildProfileEnrichment,t as checkPathPermission,u as checkToolPermission,x as computeIntegrityHash,k as createAgentProfile,a as decayedConfidence,s as determineIntegrityStatus,w as enforcePermissions,g as findAgentsByNickname,v as getPermissionConstraints,c as isAgentActive,e as listAllGlobalAgentIds,f as loadAgentProfile,i as loadAllAgentProfiles,b as loadProjectRoster,o as mergeAgentProfileWithManifest,l as queryExpertise,h as resolveAgent,r as sanitizeForPrompt,j as saveAgentProfile,d as saveProjectRoster,q as syncExpertiseFromLore,n as updateExpertiseFromAssessment,m as updateExpertiseFromLore,y as verifyIntegrity}from'./chunk-M2HKWR25.js';import'./chunk-EK4ZRIFJ.js';import'./chunk-5TAVYPOV.js';z();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import'./chunk-5TAVYPOV.js';import*as s from'path';import t from'chalk';async function g(n){let e=n.project?s.resolve(n.project):process.cwd(),r=n.dryRun===true,{readPendingVerdicts:a}=await import('./session-work-log-
|
|
2
|
+
import'./chunk-5TAVYPOV.js';import*as s from'path';import t from'chalk';async function g(n){let e=n.project?s.resolve(n.project):process.cwd(),r=n.dryRun===true,{readPendingVerdicts:a}=await import('./session-work-log-4IEVE4KK.js'),i=a(e);if(i.length===0){console.log(t.dim("[paradigm] No pending verdicts \u2014 postflight skipped."));return}console.log(t.cyan(`[paradigm] Running postflight \u2014 ${i.length} pending verdict(s)${r?" (dry run)":""}...`));let{runPostflightLearning:l}=await import('./ambient-NVKQCW2A.js'),o=await l(e,{dry_run:r});if(o.journalsWritten===0&&o.promoted===0){console.log(t.dim("[paradigm] Postflight complete \u2014 no new journals written."));return}console.log(t.green("[paradigm] Postflight complete:")),o.journalsWritten>0&&console.log(` ${t.bold(o.journalsWritten)} journal entries written across ${o.agentsProcessed.length} agent(s)`),o.promoted>0&&console.log(` ${t.bold(o.promoted)} entries auto-promoted to notebooks`);}export{g as ambientPostflightCommand};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {f,p as p$1,i,c as c$1,j}from'./chunk-
|
|
2
|
+
import {f,p as p$1,i,c as c$1,j}from'./chunk-TBWWFRL5.js';import {e,b as b$2,f as f$1}from'./chunk-VXIIVMTM.js';import {b as b$3}from'./chunk-7SWEOPWF.js';import'./chunk-MBPLJKE5.js';import {c,b as b$1,d,a}from'./chunk-5TAVYPOV.js';import*as p from'fs';import*as b from'path';import*as T from'js-yaml';import*as Z from'os';var kt={};c(kt,{getJournalStats:()=>se,loadAllJournalEntries:()=>re,loadJournalEntries:()=>O,loadJournalEntry:()=>ie,recordJournalEntry:()=>V});function G(e){let t=process.env.HOME||process.env.USERPROFILE||"";return b.join(t,".paradigm","agents",e,"journal")}function oe(){let e=new Date,t=e.toISOString().slice(0,10),n=e.toISOString().slice(11,19).replace(/:/g,""),o=String(Math.floor(Math.random()*999)+1).padStart(3,"0");return `LJ-${t}-${n}-${o}`}function V(e,t){let n=new Date,o=oe(),r={id:o,agent:e,timestamp:n.toISOString(),...t},i=G(e);p.mkdirSync(i,{recursive:true});let s=b.join(i,`${o}.yaml`);return p.writeFileSync(s,T.dump(r,{lineWidth:120,noRefs:true}),"utf8"),r}function O(e,t){let n=G(e);if(!p.existsSync(n))return [];let o=[],r=p.readdirSync(n).filter(s=>s.endsWith(".yaml"));for(let s of r)try{let a=p.readFileSync(b.join(n,s),"utf8"),c=T.load(a);c&&c.id&&o.push(c);}catch{}let i=o;return t?.trigger&&(i=i.filter(s=>s.trigger===t.trigger)),t?.project&&(i=i.filter(s=>s.project===t.project)),t?.transferable!==void 0&&(i=i.filter(s=>s.transferable===t.transferable)),t?.tag&&(i=i.filter(s=>s.tags?.some(a=>a.startsWith(t.tag)))),t?.dateFrom&&(i=i.filter(s=>s.timestamp>=t.dateFrom)),t?.dateTo&&(i=i.filter(s=>s.timestamp<=t.dateTo)),i.sort((s,a)=>a.timestamp.localeCompare(s.timestamp)),t?.limit&&(i=i.slice(0,t.limit)),i}function ie(e,t){let n=G(e),o=b.join(n,`${t}.yaml`);if(!p.existsSync(o))return null;let r=p.readFileSync(o,"utf8");return T.load(r)}function re(e){let t=process.env.HOME||process.env.USERPROFILE||"",n=b.join(t,".paradigm","agents");if(!p.existsSync(n))return [];let o=[],r=p.readdirSync(n,{withFileTypes:true}).filter(i=>i.isDirectory());for(let i of r){if(e?.agent&&i.name!==e.agent)continue;let s=O(i.name,e);o.push(...s);}return o.sort((i,s)=>s.timestamp.localeCompare(i.timestamp)),e?.limit?o.slice(0,e.limit):o}function se(e){let t=O(e),n={},o={},r=0;for(let i of t)n[i.trigger]=(n[i.trigger]||0)+1,o[i.project]=(o[i.project]||0)+1,i.transferable&&r++;return {total:t.length,byTrigger:n,byProject:o,transferableCount:r,recentInsights:t.slice(0,5).map(i=>({id:i.id,trigger:i.trigger,insight:i.insight.slice(0,200),timestamp:i.timestamp}))}}var K=b$1(()=>{});var Tt={};c(Tt,{addNotebookEntry:()=>Rt,classifyNotebookScope:()=>$t,incrementApplied:()=>de,loadNotebookEntries:()=>Nt,promoteFromLore:()=>le,searchNotebooks:()=>ce});function Nt(e,t,n){let o=new Map,r=b.join(X,e);xt(r,o);let i=b.join(t,Y,e);xt(i,o);let s=Array.from(o.values());if(n?.concepts&&n.concepts.length>0){let a=new Set(n.concepts.map(c=>c.toLowerCase()));s=s.filter(c=>c.concepts.some(u=>a.has(u.toLowerCase())));}if(n?.tags&&n.tags.length>0){let a=new Set(n.tags.map(c=>c.toLowerCase()));s=s.filter(c=>c.tags.some(u=>a.has(u.toLowerCase())));}return s.sort((a,c)=>c.appliedCount-a.appliedCount)}function xt(e,t){if(p.existsSync(e))try{let n=p.readdirSync(e).filter(o=>o.startsWith(ae)&&o.endsWith(Q));for(let o of n)try{let r=p.readFileSync(b.join(e,o),"utf-8"),i=T.load(r);i?.id&&t.set(i.id,i);}catch{}}catch{}}function ce(e,t,n){let o=Nt(e,n),r=t.toLowerCase();return o.filter(i=>i.context.toLowerCase().includes(r)||i.snippet.toLowerCase().includes(r)||i.concepts.some(s=>s.toLowerCase().includes(r))||i.tags.some(s=>s.toLowerCase().includes(r)))}function $t(e){let t=[e.context,e.snippet,...e.concepts,...e.tags].join(" ").toLowerCase();return ["paradigm","mcp_","mcp tool",".paradigm/","lore entry","lore record","aspect","^gate","portal.yaml",".purpose","sentinel","symphony","ambient nomination","paradigm_"," pan ","agent notebook","concept anchor","symbol system","work log","knowledge stream","nevr.land","neverland"].some(o=>t.includes(o))?"platform-specific":/[#$^!~][a-z][a-z0-9-]{2,}/.test(t)||/\/[a-z0-9_-]{2,}\/[a-z0-9_-]/.test(t)?"project-specific":"generalizable"}function Rt(e,t,n,o){let r=new Date().toISOString(),i=(t.concepts[0]||t.context.split(" ").slice(0,4).join(" ")||"entry").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),a=`nb-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}-${i}`,c=t.scope??$t({context:t.context,snippet:t.snippet,concepts:t.concepts,tags:t.tags}),u={...t,id:a,scope:c,publishable:t.publishable??true,appliedCount:0,created:r,updated:r},d=n==="global"?b.join(X,e):b.join(o||process.cwd(),Y,e);p.existsSync(d)||p.mkdirSync(d,{recursive:true});let l=`${a}${Q}`,m=b.join(d,l),g=T.dump(u,{lineWidth:120,noRefs:true,sortKeys:false});return p.writeFileSync(m,g,"utf-8"),{entry:u,filePath:m}}async function le(e,t,n,o="global"){let{loadLoreEntry:r}=await import('./lore-loader-D2ISOASW.js'),i=await r(n,t);if(!i)return null;let s=[];if(i.symbols_touched)for(let u of i.symbols_touched){let d=u.replace(/^[#$^!~]/,"").toLowerCase();s.push(d);}let a=i.summary||"";i.body&&(a+=`
|
|
3
3
|
|
|
4
|
-
`+i.body);let c={source:"lore",loreEntryId:t,originProject:b.basename(n),createdBy:e};return
|
|
4
|
+
`+i.body);let c={source:"lore",loreEntryId:t,originProject:b.basename(n),createdBy:e};return Rt(e,{context:i.title||`Promoted from ${t}`,snippet:a,provenance:c,confidence:i.confidence??.7,concepts:s,tags:i.tags||[]},o,n)}function de(e,t,n){let o=b.join(n,Y,e),r=b.join(X,e);for(let i of [o,r]){let s=b.join(i,`${t}${Q}`);if(p.existsSync(s))try{let a=p.readFileSync(s,"utf-8"),c=T.load(a);if(c)return c.appliedCount=(c.appliedCount||0)+1,c.updated=new Date().toISOString(),p.writeFileSync(s,T.dump(c,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),!0}catch{}}return false}var X,Y,ae,Q,Pt=b$1(()=>{X=b.join(Z.homedir(),".paradigm","notebooks"),Y=".paradigm/notebooks",ae="nb-",Q=".yaml";});var ht=".paradigm/events",Yt="stream.jsonl",J=1e3,$=[];function bt(e){return b.join(e,ht,Yt)}function Qt(){let e=Date.now(),t=Math.floor(Math.random()*9999).toString().padStart(4,"0");return `ev-${e}-${t}`}function M(e,t){let n={id:Qt(),timestamp:new Date().toISOString(),...t};$.push(n),$.length>J&&($=$.slice(-J));try{let o=b.join(e,ht);p.mkdirSync(o,{recursive:!0});let r=bt(e);p.appendFileSync(r,JSON.stringify(n)+`
|
|
5
5
|
`,"utf8"),Zt(r);}catch{}return n}function Zt(e){try{if(p.statSync(e).size>512*1024){let o=p.readFileSync(e,"utf8").trim().split(`
|
|
6
6
|
`);if(o.length>J){let r=o.slice(-J);p.writeFileSync(e,r.join(`
|
|
7
7
|
`)+`
|
|
8
8
|
`,"utf8");}}}catch{}}function St(e,t){let n=te(e);return t?.type&&(n=n.filter(o=>o.type===t.type)),t?.source&&(n=n.filter(o=>o.source===t.source)),t?.symbol&&(n=n.filter(o=>o.symbols?.includes(t.symbol))),t?.agent&&(n=n.filter(o=>o.agent===t.agent)),t?.since&&(n=n.filter(o=>o.timestamp>=t.since)),n.sort((o,r)=>r.timestamp.localeCompare(o.timestamp)),t?.limit&&(n=n.slice(0,t.limit)),n}function te(e){let t=bt(e);if(!p.existsSync(t))return [...$];try{return p.readFileSync(t,"utf8").trim().split(`
|
|
9
|
-
`).filter(r=>r.trim()).map(r=>{try{return JSON.parse(r)}catch{return null}}).filter(r=>r!==null)}catch{return [...$]}}function wt(e,t,n){let o=0,r=0,i=0,s=0;if(n.symbols?.length&&e.symbols?.length)for(let d of n.symbols)for(let l of e.symbols)yt(d,l)&&(o=Math.max(o,1));if(n.paths?.length&&e.path){for(let d of n.paths)if(yt(d,e.path)){r=1;break}}if(n.concepts?.length){let d=[e.context||"",...e.keywords||[],e.type||""].join(" ").toLowerCase(),l=0;for(let m of n.concepts)m&&d.includes(m.toLowerCase())&&l++;n.concepts.length>0&&(i=l/n.concepts.length);}if(n.signals?.length){for(let d of n.signals)if(d.type===e.type){s=1;break}}let a=[o,r,i,s].sort((d,l)=>l-d),c=a[0]*.5+a[1]*.2+a[2]*.15+a[3]*.15,u=n.threshold??.6;return {agentId:t,score:c,breakdown:{symbolMatch:o,pathMatch:r,conceptMatch:i,signalMatch:s},shouldNominate:c>=u,quietReason:c<u?"below-threshold":void 0}}function yt(e,t){if(e===t)return true;let n=e.replace(/\*\*/g,"\xA7\xA7").replace(/\*/g,"[^/]*").replace(/§§/g,".*");try{return new RegExp(`^${n}$`).test(t)}catch{return false}}var ee=".paradigm/data-policy.yaml";function jt(e){let t=b.join(e,ee);if(!p.existsSync(t))return {...b$3};try{let n=p.readFileSync(t,"utf8"),o=
|
|
9
|
+
`).filter(r=>r.trim()).map(r=>{try{return JSON.parse(r)}catch{return null}}).filter(r=>r!==null)}catch{return [...$]}}function wt(e,t,n){let o=0,r=0,i=0,s=0;if(n.symbols?.length&&e.symbols?.length)for(let d of n.symbols)for(let l of e.symbols)yt(d,l)&&(o=Math.max(o,1));if(n.paths?.length&&e.path){for(let d of n.paths)if(yt(d,e.path)){r=1;break}}if(n.concepts?.length){let d=[e.context||"",...e.keywords||[],e.type||""].join(" ").toLowerCase(),l=0;for(let m of n.concepts)m&&d.includes(m.toLowerCase())&&l++;n.concepts.length>0&&(i=l/n.concepts.length);}if(n.signals?.length){for(let d of n.signals)if(d.type===e.type){s=1;break}}let a=[o,r,i,s].sort((d,l)=>l-d),c=a[0]*.5+a[1]*.2+a[2]*.15+a[3]*.15,u=n.threshold??.6;return {agentId:t,score:c,breakdown:{symbolMatch:o,pathMatch:r,conceptMatch:i,signalMatch:s},shouldNominate:c>=u,quietReason:c<u?"below-threshold":void 0}}function yt(e,t){if(e===t)return true;let n=e.replace(/\*\*/g,"\xA7\xA7").replace(/\*/g,"[^/]*").replace(/§§/g,".*");try{return new RegExp(`^${n}$`).test(t)}catch{return false}}var ee=".paradigm/data-policy.yaml";function jt(e){let t=b.join(e,ee);if(!p.existsSync(t))return {...b$3};try{let n=p.readFileSync(t,"utf8"),o=T.load(n);return ne(b$3,o)}catch{return {...b$3}}}function ne(e,t){let n={...e};if(t.version&&(n.version=t.version),t.default_ring&&(n.default_ring=t.default_ring),t.observation&&(n.observation={allow:t.observation.allow||e.observation?.allow,deny:[...e.observation?.deny||[],...t.observation.deny||[]].filter((o,r,i)=>i.indexOf(o)===r)}),t.streams){n.streams={...e.streams};for(let o of ["work_log","learning_journal","team_decisions"])t.streams[o]&&(n.streams[o]={...e.streams?.[o],...t.streams[o],deny_content:[...e.streams?.[o]?.deny_content||[],...t.streams[o]?.deny_content||[]].filter((r,i,s)=>s.indexOf(r)===i)});}return t.upstream&&(n.upstream={...e.upstream,...t.upstream}),t.network&&(n.network={...e.network,...t.network}),t.agent_overrides&&(n.agent_overrides={...e.agent_overrides,...t.agent_overrides}),t.deployment&&(n.deployment={...e.deployment,...t.deployment}),n}function Et(e,t,n){return n&&e.agent_overrides?.[n]?.observation&&e.agent_overrides[n].observation.deny?.some(r=>z(r,t))||e.observation?.deny?.some(o=>z(o,t))?false:e.observation?.allow?.length?e.observation.allow.some(o=>z(o,t)):true}function z(e,t){if(e===t)return true;let n=e.replace(/\*\*/g,"\xA7\xA7").replace(/\*/g,"[^/]*").replace(/§§/g,".*");try{return new RegExp(`^${n}$`).test(t)}catch{return false}}var N=".paradigm/events",ue="nominations.jsonl",me="debates.jsonl",fe=500,pe=200,ge=7,ye=14,he=100;function be(){let e=Date.now(),t=Math.floor(Math.random()*9999).toString().padStart(4,"0");return `nom-${e}-${t}`}function Se(){let e=Date.now(),t=Math.floor(Math.random()*9999).toString().padStart(4,"0");return `dbt-${e}-${t}`}function we(e,t){let n=i(e),o=jt(e),r=[];for(let u of n){if(!u.attention||!c$1(u.id,e)||t.path&&!Et(o,t.path,u.id))continue;let d=wt(t,u.id,u.attention);d.shouldNominate&&r.push({profile:u,score:d});}if(r.length===0)return {nominations:[],debates:[]};let i$1=E(e,{since:new Date(Date.now()-3e4).toISOString()}),s=r.filter(({profile:u})=>!i$1.find(l=>l.agent===u.id&&l.brief===Ot(u,t,{...r.find(m=>m.profile.id===u.id).score})));if(s.length===0)return {nominations:[],debates:[]};let a=s.map(({profile:u,score:d})=>{let l=_e(t,d),m=ve(u,t);return {id:be(),agent:u.id,relevance:d.score,urgency:l,type:m,brief:Ot(u,t,d),triggered_by:[t.id],timestamp:new Date().toISOString(),surfaced:false}});Ee(e,a);let c=je(e,a);return c.length>0&&ke(e,c),{nominations:a,debates:c}}function _e(e,t){return e.severity==="critical"?"critical":e.severity==="error"||e.type==="compliance-violation"||e.type==="error-encountered"?"high":e.type==="gate-added"||e.type==="route-created"||t.score>=.9?"medium":"low"}function ve(e,t){let n=e.collaboration?.stance;return t.type==="compliance-violation"||t.type==="error-encountered"?"warning":t.type==="gate-added"||t.type==="route-created"?"observation":n==="advisory"||n==="lead"?"suggestion":"observation"}function Ot(e,t,n){let o=e.role||e.id;switch(t.type){case "gate-checked":return `${o}: Gate check on ${t.symbols?.join(", ")||"route"} \u2014 verify gate coverage is complete`;case "file-modified":return `${o}: ${t.path||"File"} modified \u2014 review for ${e.id==="security"?"security implications":e.id==="tester"?"test coverage":e.id==="reviewer"?"code quality":"consistency"}`;case "compliance-violation":return `${o}: Compliance violation detected \u2014 ${t.context||"check .purpose and portal.yaml coverage"}`;case "route-created":return `${o}: New route ${t.symbols?.join(", ")||""} \u2014 ${e.id==="security"?"needs gate assignment in portal.yaml":"review route structure"}`;case "gate-added":return `${o}: Gate ${t.symbols?.join(", ")||""} added \u2014 ${e.id==="security"?"verify enforcement points":"check downstream impact"}`;case "decision-made":return `${o}: Decision recorded \u2014 ${t.context?.slice(0,80)||"review for alignment with project patterns"}`;case "work-completed":return `${o}: Work completed on ${t.symbols?.join(", ")||t.context?.slice(0,40)||"task"} \u2014 review outcome`;case "error-encountered":return `${o}: Error detected \u2014 ${t.context?.slice(0,80)||"investigate root cause"}`;default:{let r=n.breakdown.symbolMatch>0?`symbol match on ${t.symbols?.join(", ")||"unknown"}`:n.breakdown.pathMatch>0?`path ${t.path||"unknown"}`:t.context?.slice(0,60)||t.type;return `${o}: ${r}`}}}function je(e,t){if(t.length<2)return [];let n=[],o=new Map;for(let r of t)for(let i of r.triggered_by){let s=o.get(i)||[];s.push(r),o.set(i,s);}for(let[r,i]of o){if(i.length<2||new Set(i.map(u=>u.agent)).size<2)continue;let a=new Set(i.map(u=>u.type)),c=a.size>1&&a.has("warning")&&a.has("suggestion");n.push({id:Se(),topic:`Multiple agents responded to event ${r}`,nominations:i.map(u=>u.id),type:c?"conflicting":"complementary",overlap_events:[r]});}return n}function tt(e){return b.join(e,N,ue)}function et(e){return b.join(e,N,me)}function Ee(e,t){try{let n=b.join(e,N);p.mkdirSync(n,{recursive:!0});let o=tt(e),r=t.map(s=>JSON.stringify(s)).join(`
|
|
10
10
|
`)+`
|
|
11
|
-
`;p.appendFileSync(o,r,"utf8"),
|
|
11
|
+
`;p.appendFileSync(o,r,"utf8"),At(o,fe);let{nominationTtlDays:i}=U(e);Ft(o,i*24*60*60*1e3);}catch{}}function ke(e,t){try{let n=b.join(e,N);p.mkdirSync(n,{recursive:!0});let o=et(e),r=t.map(s=>JSON.stringify(s)).join(`
|
|
12
12
|
`)+`
|
|
13
|
-
`;p.appendFileSync(o,r,"utf8"),
|
|
13
|
+
`;p.appendFileSync(o,r,"utf8"),At(o,pe);let{debateTtlDays:i}=U(e);Ft(o,i*24*60*60*1e3);}catch{}}function At(e,t){try{let o=p.readFileSync(e,"utf8").trim().split(`
|
|
14
14
|
`).filter(r=>r.trim());if(o.length>t){let r=o.slice(-t);p.writeFileSync(e,r.join(`
|
|
15
15
|
`)+`
|
|
16
|
-
`,"utf8");}}catch{}}function
|
|
16
|
+
`,"utf8");}}catch{}}function U(e){let t={nominationTtlDays:ge,debateTtlDays:ye};try{let n=b.join(e,".paradigm","config.yaml");if(!p.existsSync(n))return t;let o=a("js-yaml"),r=p.readFileSync(n,"utf8"),s=o.load(r)?.ambient;return s?{nominationTtlDays:typeof s["nomination-ttl-days"]=="number"?s["nomination-ttl-days"]:t.nominationTtlDays,debateTtlDays:typeof s["debate-ttl-days"]=="number"?s["debate-ttl-days"]:t.debateTtlDays}:t}catch{return t}}function Ft(e,t){try{if(!p.existsSync(e))return;let o=p.readFileSync(e,"utf8").trim().split(`
|
|
17
17
|
`).filter(s=>s.trim());if(o.length<=he)return;let r=Date.now()-t,i=o.filter(s=>{try{let a=JSON.parse(s);return (a.timestamp?new Date(a.timestamp).getTime():Date.now())>=r}catch{return !0}});i.length<o.length&&p.writeFileSync(e,i.join(`
|
|
18
18
|
`)+`
|
|
19
19
|
`,"utf8");}catch{}}function E(e,t){let n=tt(e);if(!p.existsSync(n))return [];try{let r=p.readFileSync(n,"utf8").trim().split(`
|
|
20
|
-
`).filter(i=>i.trim()).map(i=>{try{return JSON.parse(i)}catch{return null}}).filter(i=>i!==null);return t?.agent&&(r=r.filter(i=>i.agent===t.agent)),t?.urgency&&(r=r.filter(i=>i.urgency===t.urgency)),t?.surfaced!==void 0&&(r=r.filter(i=>i.surfaced===t.surfaced)),t?.pending_only&&(r=r.filter(i=>!i.engaged)),t?.since&&(r=r.filter(i=>i.timestamp>=t.since)),r.sort((i,s)=>s.timestamp.localeCompare(i.timestamp)),t?.limit&&(r=r.slice(0,t.limit)),r}catch{return []}}function
|
|
21
|
-
`).filter(o=>o.trim()).map(o=>{try{return JSON.parse(o)}catch{return null}}).filter(o=>o!==null)}catch{return []}}function
|
|
20
|
+
`).filter(i=>i.trim()).map(i=>{try{return JSON.parse(i)}catch{return null}}).filter(i=>i!==null);return t?.agent&&(r=r.filter(i=>i.agent===t.agent)),t?.urgency&&(r=r.filter(i=>i.urgency===t.urgency)),t?.surfaced!==void 0&&(r=r.filter(i=>i.surfaced===t.surfaced)),t?.pending_only&&(r=r.filter(i=>!i.engaged)),t?.since&&(r=r.filter(i=>i.timestamp>=t.since)),r.sort((i,s)=>s.timestamp.localeCompare(i.timestamp)),t?.limit&&(r=r.slice(0,t.limit)),r}catch{return []}}function It(e){let t=et(e);if(!p.existsSync(t))return [];try{return p.readFileSync(t,"utf8").trim().split(`
|
|
21
|
+
`).filter(o=>o.trim()).map(o=>{try{return JSON.parse(o)}catch{return null}}).filter(o=>o!==null)}catch{return []}}function Ct(e,t,n,o){let r=tt(e);if(!p.existsSync(r))return false;try{let s=p.readFileSync(r,"utf8").trim().split(`
|
|
22
22
|
`),a=!1,c=s.map(u=>{try{let d=JSON.parse(u);return d.id===t?(d.engaged=!0,d.response=n,o&&(d.reason=o),a=!0,JSON.stringify(d)):u}catch{return u}});if(a&&(p.writeFileSync(r,c.join(`
|
|
23
23
|
`)+`
|
|
24
24
|
`,"utf8"),n==="accepted"||n==="dismissed")){let u=JSON.parse(s.find(l=>{try{return JSON.parse(l).id===t}catch{return !1}}));i(e).find(l=>l.id===u.agent)?.learning?.intrinsic?.feedback?.after_recommendation&&M(e,{type:"work-completed",source:"agent-action",agent:u.agent,context:`Nomination ${t} ${n} \u2014 feedback for learning`,data:{nomination_id:t,response:n}});}return a}catch{return false}}function Jt(e,t,n,o){let r=et(e);if(!p.existsSync(r))return false;try{let s=p.readFileSync(r,"utf8").trim().split(`
|
|
25
25
|
`),a=!1,c=s.map(u=>{try{let d=JSON.parse(u);if(d.id===t){d.resolution={chosen:n,reason:o,resolved_by:"human",resolved_at:new Date().toISOString()},a=!0;let l=d.nominations.filter(m=>m!==n);for(let m of l){let g=E(e).find(f=>f.id===m);g&&M(e,{type:"work-completed",source:"agent-action",agent:g.agent,context:`Debate ${t} resolved \u2014 nomination ${m} not chosen`,data:{debate_id:t,chosen:n,reason:o}});}return JSON.stringify(d)}return u}catch{return u}});return a&&p.writeFileSync(r,c.join(`
|
|
26
26
|
`)+`
|
|
27
27
|
`,"utf8"),a}catch{return false}}function Mt(e){let t=b.join(e,N,".last-processed"),n="";try{p.existsSync(t)&&(n=p.readFileSync(t,"utf8").trim());}catch{}let o=b.join(e,N,"stream.jsonl");if(!p.existsSync(o))return {processed:0,nominations:[]};let r=[];try{r=p.readFileSync(o,"utf8").trim().split(`
|
|
28
|
-
`).filter(l=>l.trim()).map(l=>{try{return JSON.parse(l)}catch{return null}}).filter(l=>l!==null);}catch{return {processed:0,nominations:[]}}let i=0;if(n){let d=r.findIndex(l=>l.id===n);d>=0&&(i=d+1);}let s=r.slice(i);if(s.length===0)return {processed:0,nominations:[]};let a=[],c=s.slice(0,50);for(let d of c){let{nominations:l}=we(e,d);a.push(...l);}let u=c[c.length-1];try{p.mkdirSync(b.join(e,N),{recursive:!0}),p.writeFileSync(t,u.id,"utf8");}catch{}return {processed:c.length,nominations:a}}function Lt(e,t){let n=f(e,t);if(!n?.attention)return {adjusted:false,oldThreshold:.6,newThreshold:.6,reason:"No attention config"};let o=n.attention.threshold??.6,{nominationTtlDays:r}=
|
|
28
|
+
`).filter(l=>l.trim()).map(l=>{try{return JSON.parse(l)}catch{return null}}).filter(l=>l!==null);}catch{return {processed:0,nominations:[]}}let i=0;if(n){let d=r.findIndex(l=>l.id===n);d>=0&&(i=d+1);}let s=r.slice(i);if(s.length===0)return {processed:0,nominations:[]};let a=[],c=s.slice(0,50);for(let d of c){let{nominations:l}=we(e,d);a.push(...l);}let u=c[c.length-1];try{p.mkdirSync(b.join(e,N),{recursive:!0}),p.writeFileSync(t,u.id,"utf8");}catch{}return {processed:c.length,nominations:a}}function Lt(e,t){let n=f(e,t);if(!n?.attention)return {adjusted:false,oldThreshold:.6,newThreshold:.6,reason:"No attention config"};let o=n.attention.threshold??.6,{nominationTtlDays:r}=U(e),i=r*24*60*60*1e3,c=E(e,{agent:t}).filter(j=>j.engaged||Date.now()-new Date(j.timestamp).getTime()<i).filter(j=>j.engaged);if(c.length<5)return {adjusted:false,oldThreshold:o,newThreshold:o,reason:`Insufficient data (${c.length}/5 engaged nominations)`};let u=c.filter(j=>j.response==="accepted").length,d=c.filter(j=>j.response==="dismissed").length,l=u/c.length,m=d/c.length,g=o,f$1="No adjustment needed";if(m>.6?(g=Math.min(.95,o+.05),f$1=`High dismiss rate (${(m*100).toFixed(0)}%) \u2014 raising threshold to reduce noise`):l>.8&&(g=Math.max(.2,o-.05),f$1=`High accept rate (${(l*100).toFixed(0)}%) \u2014 lowering threshold to contribute more`),g===o)return {adjusted:false,oldThreshold:o,newThreshold:g,reason:f$1};n.attention.threshold=g;let y=b.join(e,".paradigm/agents",`${t}.agent`),D=p.existsSync(y)?"project":"global";return j(t,n,D,e),M(e,{type:"work-completed",source:"agent-action",agent:t,context:`Attention threshold adjusted: ${o.toFixed(2)} \u2192 ${g.toFixed(2)} (${f$1})`,data:{old_threshold:o,new_threshold:g,accept_rate:l,dismiss_rate:m}}),{adjusted:true,oldThreshold:o,newThreshold:g,reason:f$1}}function nt(e,t){let{nominationTtlDays:n}=U(e),o=n*24*60*60*1e3,i=E(e,{agent:t}).filter(l=>l.engaged||Date.now()-new Date(l.timestamp).getTime()<o),s=i.filter(l=>l.response==="accepted").length,a=i.filter(l=>l.response==="dismissed").length,c=i.filter(l=>l.response==="deferred").length,u=i.filter(l=>!l.engaged).length,d=s+a+c;return {total:i.length,accepted:s,dismissed:a,deferred:c,pending:u,acceptRate:d>0?s/d:0}}function Ut(e){let n=i(e).filter(l=>c$1(l.id,e)).map(l=>{let m=nt(e,l.id),g=0;try{let f=b.join(Z.homedir(),".paradigm","notebooks",l.id);p.existsSync(f)&&(g=p.readdirSync(f).filter(y=>y.endsWith(".yaml")).length);}catch{}return {id:l.id,acceptRate:m.acceptRate,threshold:l.attention?.threshold??.5,expertiseCount:(l.expertise||[]).length,notebookCount:g,transferableCount:(l.transferable||[]).length,totalNominations:m.total}}),o=n.length||1,r=n.reduce((l,m)=>l+m.acceptRate,0)/o,i$1=n.reduce((l,m)=>l+m.threshold,0)/o,s=n.reduce((l,m)=>l+m.expertiseCount,0),a=n.reduce((l,m)=>l+m.notebookCount,0),c=n.reduce((l,m)=>l+m.transferableCount,0),u=n.reduce((l,m)=>l+m.totalNominations,0),d;return u<10?d="cold-start":r<.5?d="accumulating":r<.7?d="calibrating":d="mature",{agents:n,aggregate:{avgAcceptRate:r,avgThreshold:i$1,totalExpertise:s,totalNotebooks:a,totalTransferable:c},healthStatus:d}}function ot(e,t){let n,o;try{let c=(K(),d(kt)),u=(Pt(),d(Tt));n=c.loadJournalEntries,o=u.addNotebookEntry;}catch{return {promoted:0,entries:[]}}let r=n(t,{trigger:"pattern_discovered",limit:100}),i=n(t,{trigger:"human_feedback",limit:100}),s=[...r,...i],a=[];for(let c of s)if(!c.promoted_to_notebook&&!((c.confidence_after??0)<.8))try{let{entry:u}=o(t,{context:c.pattern?.applies_when||c.insight.slice(0,80),snippet:c.pattern?.correct_approach||c.insight,concepts:c.tags||[c.pattern?.id||"learned-pattern"],provenance:{source:"lore",loreEntryId:c.id,createdBy:t}},"global",e);a.push({journalId:c.id,notebookId:u.id});try{let d=b.join(Z.homedir(),".paradigm","agents",t,"journal");if(p.existsSync(d)){let l=p.readdirSync(d).filter(m=>m.endsWith(".yaml"));for(let m of l){let g=b.join(d,m),f=p.readFileSync(g,"utf8");if(f.includes(c.id)){let y=f.replace(/promoted_to_notebook:.*$/m,`promoted_to_notebook: "${u.id}"`);if(y===f){let D=f.trimEnd().split(`
|
|
29
29
|
`);D.push(`promoted_to_notebook: "${u.id}"`),p.writeFileSync(g,D.join(`
|
|
30
30
|
`)+`
|
|
31
|
-
`,"utf8");}else p.writeFileSync(g,y,"utf8");break}}}}catch{}}catch{}return {promoted:a.length,entries:a}}var xe=".paradigm/surfacing.yaml";function
|
|
31
|
+
`,"utf8");}else p.writeFileSync(g,y,"utf8");break}}}}catch{}}catch{}return {promoted:a.length,entries:a}}var xe=".paradigm/surfacing.yaml";function Ht(e){let t=b.join(e,xe),n={default_min_urgency:"low",enable_debates:true};if(!p.existsSync(t))return n;try{let o=a("js-yaml"),r=p.readFileSync(t,"utf8"),i=o.load(r);return {...n,...i}}catch{return n}}function Bt(e,t){let n={critical:0,high:1,medium:2,low:3},o=n[t.default_min_urgency||"low"]??3;return e.filter(r=>{let i=n[r.urgency]??3;if(t.preferences){let s=t.preferences.find(a=>a.agent===r.agent);if(s){if(s.always_show)return true;if(s.mute_unless?.length&&!s.mute_unless.some(c=>r.urgency===c||r.type===c))return false;if(s.min_urgency){let a=n[s.min_urgency]??3;return i<=a}}}return i<=o})}var De=".paradigm/decisions";function Wt(e,t){let n=b.join(e,De);if(!p.existsSync(n))return [];let o=[],r=p.readdirSync(n).filter(s=>s.endsWith(".yaml"));for(let s of r)try{let a=p.readFileSync(b.join(n,s),"utf8"),c=T.load(a);c&&c.id&&o.push(c);}catch{}let i=o;return (i=i.filter(s=>s.status===t.status)),t?.participant&&(i=i.filter(s=>s.participants.some(a=>a.id===t.participant))),t?.symbol&&(i=i.filter(s=>s.symbols_affected?.includes(t.symbol))),t?.tag&&(i=i.filter(s=>s.tags?.some(a=>a.startsWith(t.tag)))),t?.dateFrom&&(i=i.filter(s=>s.timestamp>=t.dateFrom)),t?.dateTo&&(i=i.filter(s=>s.timestamp<=t.dateTo)),i.sort((s,a)=>a.timestamp.localeCompare(s.timestamp)),t?.limit&&(i=i.slice(0,t.limit)),i}K();function Ye(){return [{name:"paradigm_ambient_nominations",description:"Get pending agent nominations \u2014 agents that self-nominated contributions based on recent events. Filters by urgency, agent, pending status. Marks returned nominations as surfaced. ~200 tokens.",inputSchema:{type:"object",properties:{urgency:{type:"string",enum:["critical","high","medium","low"],description:"Filter by urgency level"},agent:{type:"string",description:"Filter by agent ID"},pending_only:{type:"boolean",description:"Only show un-engaged nominations (default: true)"},include_debates:{type:"boolean",description:"Include debate groupings (default: false)"},limit:{type:"number",description:"Max nominations to return (default: 20)"}}},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_ambient_events",description:"Query the ambient event stream \u2014 recent tool calls, file edits, gate checks, and other project activity. Filters by type, source, symbol, agent, time window. ~200 tokens.",inputSchema:{type:"object",properties:{type:{type:"string",description:'Event type filter (e.g., "file-modified", "gate-checked", "decision-made")'},source:{type:"string",description:'Event source filter (e.g., "mcp-tool-call", "post-write-hook")'},symbol:{type:"string",description:"Filter events referencing this symbol"},agent:{type:"string",description:"Filter events from this agent"},since:{type:"string",description:'Relative time filter (e.g., "1h", "30m", "2d") or ISO timestamp'},limit:{type:"number",description:"Max events to return (default: 50)"}}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_ambient_engage",description:"Accept, dismiss, or defer a nomination. Optionally resolves a debate by choosing this nomination over others. ~50 tokens.",inputSchema:{type:"object",properties:{nomination_id:{type:"string",description:"Nomination ID to engage with"},response:{type:"string",enum:["accepted","dismissed","deferred"],description:"How to respond"},resolve_debate:{type:"string",description:"Optional debate ID to resolve by choosing this nomination"},reason:{type:"string",description:"Reason for response \u2014 stored on nomination for learning feedback. Especially valuable for dismissals."}},required:["nomination_id","response"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_context_compose",description:"Compose full agent session context: profile enrichment + recent decisions + transferable journal entries + pending nominations. Returns a markdown context block for prompt injection. ~300 tokens.",inputSchema:{type:"object",properties:{agent:{type:"string",description:"Agent ID to compose context for"},symbols:{type:"array",items:{type:"string"},description:"Relevant symbols for expertise filtering"},include_nominations:{type:"boolean",description:"Include pending nominations (default: true)"},include_decisions:{type:"boolean",description:"Include recent team decisions (default: true)"},include_journal:{type:"boolean",description:"Include transferable journal entries (default: true)"},max_decisions:{type:"number",description:"Max decisions to include (default: 5)"},max_journal:{type:"number",description:"Max journal entries to include (default: 5)"}},required:["agent"]},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_ambient_promote",description:"Auto-promote high-confidence pattern discoveries from an agent's learning journal to its notebook. Promotes entries with trigger=pattern_discovered and confidence_after >= 0.8. ~100 tokens.",inputSchema:{type:"object",properties:{agent:{type:"string",description:"Agent ID whose journal to scan"}},required:["agent"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_ambient_learn",description:"Analyze an agent's nomination acceptance/dismissal history and adjust its attention threshold. If >60% dismissed \u2192 raise threshold (less noise). If >80% accepted \u2192 lower threshold (contribute more). Also returns engagement stats. ~100 tokens.",inputSchema:{type:"object",properties:{agent:{type:"string",description:"Agent ID to analyze and adjust"},dry_run:{type:"boolean",description:"If true, return stats without adjusting (default: false)"}},required:["agent"]},annotations:{readOnlyHint:false,destructiveHint:false}},{name:"paradigm_ambient_health",description:"Agent learning health metrics \u2014 aggregate learning quality across all agents: nomination acceptance rates, threshold drift, notebook counts, expertise growth, and overall health status (cold-start \u2192 accumulating \u2192 calibrating \u2192 mature).",inputSchema:{type:"object",properties:{}},annotations:{readOnlyHint:true,destructiveHint:false}},{name:"paradigm_ambient_learn_postflight",description:"Postflight learning pass \u2014 converts session work log verdicts into agent journal entries. Reads accepted/dismissed/revised verdicts from the session log, creates journal entries for each agent, then auto-promotes high-confidence entries to notebooks. Typically called at session end by the stop hook. ~200 tokens.",inputSchema:{type:"object",properties:{session_id:{type:"string",description:"Session ID (default: current session)"},dry_run:{type:"boolean",description:"If true, show what would be written without writing (default: false)"}}},annotations:{readOnlyHint:false,destructiveHint:false}}]}function Ne(e){let t=Date.now(),n=e.match(/^(\d+)(m|h|d)$/);if(n){let o=parseInt(n[1],10),r=n[2],i=r==="m"?o*6e4:r==="h"?o*36e5:o*864e5;return new Date(t-i).toISOString()}return e}async function Qe(e,t,n){let o=r=>JSON.stringify(r,null,2);switch(e){case "paradigm_ambient_nominations":{Mt(n.rootDir);let i=t.pending_only!==false,s=t.limit||20,a=E(n.rootDir,{agent:t.agent,urgency:t.urgency,pending_only:i,limit:s+20}),c=Ht(n.rootDir);a=Bt(a,c).slice(0,s);let u=b.join(n.rootDir,".paradigm/events/nominations.jsonl");if(p.existsSync(u))try{let l=p.readFileSync(u,"utf8"),m=new Set(a.map(f=>f.id)),g=l.trim().split(`
|
|
32
32
|
`).map(f=>{try{let y=JSON.parse(f);return m.has(y.id)?(y.surfaced=!0,JSON.stringify(y)):f}catch{return f}});p.writeFileSync(u,g.join(`
|
|
33
33
|
`)+`
|
|
34
|
-
`,"utf8");}catch{}let d={count:a.length,nominations:a.map(l=>({id:l.id,agent:l.agent,urgency:l.urgency,type:l.type,brief:l.brief,relevance:l.relevance,timestamp:l.timestamp,engaged:l.engaged,response:l.response}))};if(t.include_debates){let m=
|
|
35
|
-
`),sections_included:{profile:true,decisions:a,journal:c,nominations:s}}),handled:true}}case "paradigm_ambient_promote":{let r=t.agent,i=ot(n.rootDir,r);return {text:o({agent:r,promoted:i.promoted,entries:i.entries}),handled:true}}case "paradigm_ambient_learn":{let r=t.agent,i=t.dry_run===true,s=nt(n.rootDir,r);if(i)return {text:o({agent:r,dry_run:true,stats:s,note:s.total<5?"Insufficient data for threshold adjustment (need 5+ engaged nominations)":`Accept rate: ${(s.acceptRate*100).toFixed(0)}% \u2014 ${s.acceptRate>.8?"would lower threshold":s.acceptRate<.4?"would raise threshold":"no adjustment needed"}`}),handled:true};let a=Lt(n.rootDir,r);return {text:o({agent:r,...a,stats:s}),handled:true}}case "paradigm_ambient_health":case "paradigm_ambient_neverland":{let r=
|
|
34
|
+
`,"utf8");}catch{}let d={count:a.length,nominations:a.map(l=>({id:l.id,agent:l.agent,urgency:l.urgency,type:l.type,brief:l.brief,relevance:l.relevance,timestamp:l.timestamp,engaged:l.engaged,response:l.response}))};if(t.include_debates){let m=It(n.rootDir).filter(g=>!g.resolution);d.debates=m.map(g=>({id:g.id,topic:g.topic,type:g.type,nominations:g.nominations})),d.debate_count=m.length;}return {text:o(d),handled:true}}case "paradigm_ambient_events":{let r=t.since?Ne(t.since):void 0,i=t.limit||50,s=St(n.rootDir,{type:t.type,source:t.source,symbol:t.symbol,agent:t.agent,since:r,limit:i});return {text:o({count:s.length,events:s.map(a=>({id:a.id,type:a.type,source:a.source,timestamp:a.timestamp,path:a.path,symbols:a.symbols,context:a.context,agent:a.agent,tool:a.tool,severity:a.severity}))}),handled:true}}case "paradigm_ambient_engage":{let r=t.nomination_id,i=t.response,s=t.reason,a=Ct(n.rootDir,r,i,s);if(a)try{let{appendSessionWorkEntry:u,appendVerdictEntry:d}=await import('./session-work-log-4IEVE4KK.js'),m=E(n.rootDir,{limit:500}).find(f=>f.id===r),g={timestamp:new Date().toISOString(),type:"user-verdict",agent:m?.agent,nominationId:r,verdict:i,reason:s};u(n.rootDir,g),d(n.rootDir,g);}catch{}let c=false;return t.resolve_debate&&a&&(c=Jt(n.rootDir,t.resolve_debate,r,t.reason)),{text:o({engaged:a,nomination_id:r,response:i,debate_resolved:c||void 0}),handled:true}}case "paradigm_context_compose":{let r=t.agent,i=t.symbols||[],s=t.include_nominations!==false,a=t.include_decisions!==false,c=t.include_journal!==false,u=t.max_decisions||5,d=t.max_journal||5,l=f(n.rootDir,r);if(!l)return {text:o({error:`Agent profile not found: ${r}`}),handled:true};let m=[],g=p$1(l,i);if(g.trim()&&m.push(g),a){let f=Wt(n.rootDir,{status:"active",limit:u});if(f.length>0){m.push("## Recent Team Decisions");for(let y of f)m.push(`- **${y.title}**: ${y.decision.slice(0,150)}${y.decision.length>150?"...":""}`);m.push("");}}if(c){let f=O(r,{transferable:true,limit:d});if(f.length>0){m.push("## Transferable Insights");for(let y of f)m.push(`- [${y.trigger}] ${y.insight.slice(0,150)}${y.insight.length>150?"...":""}`);m.push("");}}if(s){let f=E(n.rootDir,{pending_only:true,limit:10});if(f.length>0){m.push("## Pending Nominations");for(let y of f)m.push(`- [${y.urgency}] ${y.brief}`);m.push("");}}return {text:o({agent:r,context:m.join(`
|
|
35
|
+
`),sections_included:{profile:true,decisions:a,journal:c,nominations:s}}),handled:true}}case "paradigm_ambient_promote":{let r=t.agent,i=ot(n.rootDir,r);return {text:o({agent:r,promoted:i.promoted,entries:i.entries}),handled:true}}case "paradigm_ambient_learn":{let r=t.agent,i=t.dry_run===true,s=nt(n.rootDir,r);if(i)return {text:o({agent:r,dry_run:true,stats:s,note:s.total<5?"Insufficient data for threshold adjustment (need 5+ engaged nominations)":`Accept rate: ${(s.acceptRate*100).toFixed(0)}% \u2014 ${s.acceptRate>.8?"would lower threshold":s.acceptRate<.4?"would raise threshold":"no adjustment needed"}`}),handled:true};let a=Lt(n.rootDir,r);return {text:o({agent:r,...a,stats:s}),handled:true}}case "paradigm_ambient_health":case "paradigm_ambient_neverland":{let r=Ut(n.rootDir);return {text:o(r),handled:true}}case "paradigm_ambient_learn_postflight":return {text:o(await Te(n.rootDir,t)),handled:true};default:return {text:`Unknown ambient tool: ${e}`,handled:false}}}var $e={accepted:"human_feedback",dismissed:"confidence_miss",revised:"correction_received"};function Re(e){try{let t=b.join(e,".paradigm","config.yaml");if(p.existsSync(t)){let o=p.readFileSync(t,"utf8").match(/project:\s*["']?([^"'\n]+)["']?/);if(o)return o[1].trim()}}catch{}return b.basename(e)}async function Te(e$1,t={}){let n=t.dry_run===true,o=Re(e$1),r=e(e$1).filter(f=>f.verdict&&f.agent),i=b$2(e$1);if(r.length===0)return {sessionEntries:i.length,agentsProcessed:[],journalsWritten:0,journalsByAgent:{},promoted:0,promotedByAgent:{},dryRun:n,details:[]};let s=new Map;for(let f of r){let y=f.agent;s.has(y)||s.set(y,[]),s.get(y).push(f);}let a=i.filter(f=>f.type==="agent-contribution"),c=new Map;for(let f of a)f.agent&&(c.has(f.agent)||c.set(f.agent,[]),c.get(f.agent).push(f));let u=[],d={},l=0;for(let[f,y]of s){d[f]=0;let D=y.filter(h=>h.verdict==="accepted").length;y.filter(h=>h.verdict==="dismissed").length;y.filter(h=>h.verdict==="revised").length;let H=y.length,zt=H>0?D/H:0;for(let h of y){let B=$e[h.verdict];if(!B)continue;let Gt=c.get(f)?.shift(),st=Pe(h,Gt,{acceptRate:zt,total:H,accepted:D}),Vt=h.verdict==="accepted"?.85:h.verdict==="revised"?.6:.4,Kt={agent:f,verdict:h.verdict,trigger:B,insight:st,symbols:h.symbols};if(u.push(Kt),n)d[f]++,l++;else try{V(f,{trigger:B,insight:st,confidence_before:h.verdict==="accepted"?.7:.8,confidence_after:Vt,project:o,transferable:h.verdict==="dismissed",tags:["postflight",`verdict:${h.verdict}`,...(h.symbols||[]).map(Xt=>`symbol:${Xt}`)]}),d[f]++,l++;}catch{}}}let m={},g=0;if(!n)for(let f of s.keys())try{let y=ot(e$1,f);y.promoted>0&&(m[f]=y.promoted,g+=y.promoted);}catch{}return !n&&r.length>0&&f$1(e$1,r.map(f=>f.nominationId).filter(Boolean)),{sessionEntries:i.length,agentsProcessed:Array.from(s.keys()),journalsWritten:l,journalsByAgent:d,promoted:g,promotedByAgent:m,dryRun:n,details:u}}function Pe(e,t,n){let o=e.symbols?.length?` (symbols: ${e.symbols.join(", ")})`:"",r=e.reason?` Reason: ${e.reason}.`:"";switch(e.verdict){case "accepted":return `Contribution accepted by user${o}.${r}`+(t?.contribution?` Original: "${t.contribution.slice(0,120)}".`:"")+` Session accept rate: ${(n.acceptRate*100).toFixed(0)}% (${n.accepted}/${n.total}).`;case "dismissed":return `Contribution dismissed by user${o}.${r}`+(t?.contribution?` Rejected contribution: "${t.contribution.slice(0,120)}".`:"")+` Learn from this dismissal to improve future nominations. Session accept rate: ${(n.acceptRate*100).toFixed(0)}% (${n.accepted}/${n.total}).`;case "revised":return `Contribution revised by user${o}.${r}`+(e.revisionDelta?` Delta: "${e.revisionDelta.slice(0,120)}".`:"")+(t?.contribution?` Original: "${t.contribution.slice(0,120)}".`:"")+` Partial credit \u2014 close but not accurate enough. Session accept rate: ${(n.acceptRate*100).toFixed(0)}% (${n.accepted}/${n.total}).`;default:return `Unknown verdict "${e.verdict}"${o}.${r}`}}export{Ye as getAmbientToolsList,Qe as handleAmbientTool,Te as runPostflightLearning};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {g,f}from'./chunk-
|
|
2
|
+
import {g,f}from'./chunk-VNIX5KBT.js';import'./chunk-5TAVYPOV.js';import e from'chalk';async function $(r,o,t){let c=process.cwd();["correct","partial","incorrect"].includes(o)||(console.error(e.red(`
|
|
3
3
|
Invalid verdict: "${o}". Must be one of: correct, partial, incorrect
|
|
4
4
|
`)),process.exit(1));let n=await g(c,r);if(n||(console.error(e.red(`
|
|
5
5
|
Entry not found: ${r}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {d}from'./chunk-
|
|
2
|
+
import {d}from'./chunk-VNIX5KBT.js';import'./chunk-5TAVYPOV.js';import o from'chalk';async function L(r){let A=process.cwd(),u=await d(A,{symbol:r.symbol,tag:r.tag,author:r.author,hasAssessment:true});if(u.length===0){r.json?console.log(JSON.stringify({totalAssessed:0,message:"No assessed entries found"},null,2)):(console.log(o.gray(`
|
|
3
3
|
No assessed lore entries found.
|
|
4
4
|
`)),console.log(o.gray(" Use `paradigm lore assess <id> <correct|partial|incorrect>` to assess entries.\n")));return}let F=u.filter(e=>e.confidence!=null),c=u.length,f=F.length,l={correct:0,partial:0,incorrect:0},h=0,$=0,b=0;for(let e of u){let n=e.assessment.verdict;l[n]++;let t=n==="correct"?1:n==="partial"?.5:0;h+=t,e.confidence!=null&&($+=e.confidence,b+=Math.abs(t-e.confidence));}let y=h/c,m=f>0?$/f:null,s=f>0?1-b/f:null,i;if(r.groupBy&&c>0){let e=new Map;for(let n of u){let t=[];r.groupBy==="symbol"?t=n.symbols_touched||[]:r.groupBy==="tag"?t=n.tags||[]:r.groupBy==="type"&&(t=[n.type||"agent-session"]);for(let a of t)e.has(a)||e.set(a,[]),e.get(a).push(n);}i=Array.from(e.entries()).map(([n,t])=>{let a=t.filter(d=>d.confidence!=null),v={correct:0,partial:0,incorrect:0},C=0,B=0,S=0;for(let d of t){let p=d.assessment.verdict;v[p]++;let k=p==="correct"?1:p==="partial"?.5:0;C+=k,d.confidence!=null&&(B+=d.confidence,S+=Math.abs(k-d.confidence));}return {key:n,total:t.length,accuracyRate:C/t.length,avgConfidence:a.length>0?B/a.length:null,calibrationScore:a.length>0?1-S/a.length:null,verdictBreakdown:v}}).sort((n,t)=>t.total-n.total);}if(r.json){console.log(JSON.stringify({totalAssessed:c,totalWithConfidence:f,accuracyRate:Math.round(y*1e3)/1e3,avgConfidence:m!=null?Math.round(m*1e3)/1e3:null,calibrationScore:s!=null?Math.round(s*1e3)/1e3:null,verdictBreakdown:l,...i?{groups:i}:{}},null,2));return}let w=c<5?o.gray(` (Low sample: N=${c}. Stats may not be representative.)`):c<15?o.gray(` (Moderate sample: N=${c}. Trends are directional.)`):"";console.log(o.magenta(`
|
|
5
5
|
Calibration Report (${c} assessed entries)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b as b$1}from'./chunk-Y4P4SGZV.js';import {a as a$2,g as g$1,h,d as d$1,f}from'./chunk-UIKLE3WD.js';import {g}from'./chunk-LWAIVOSF.js';import {c}from'./chunk-JIXHEBGK.js';import {c as c$1,d,e}from'./chunk-
|
|
2
|
+
import {b as b$1}from'./chunk-Y4P4SGZV.js';import {a as a$2,g as g$1,h,d as d$1,f}from'./chunk-UIKLE3WD.js';import {g}from'./chunk-LWAIVOSF.js';import {c}from'./chunk-JIXHEBGK.js';import {c as c$1,d,e}from'./chunk-YNDPSWOE.js';import {a as a$1}from'./chunk-LKAT7IAK.js';import*as i from'fs';import*as a from'path';import {fileURLToPath}from'url';import t from'chalk';import q from'ora';function b(s){try{return i.readFileSync(s,"utf8").split(`
|
|
3
3
|
`).length}catch{return 0}}function _(s){let o=g$1(s);if(o&&f[o])return f[o].name;let e=a$2(s);if(e!=="backend")return e.charAt(0).toUpperCase()+e.slice(1)}function U(s){let o=[],e=0,n={name:"cursor",displayName:"Cursor"},g=a.join(s,".cursorrules"),r=a.join(s,".cursor","rules");if(i.existsSync(g)){let l=b(g);n.legacy={path:".cursorrules",lines:l,type:"legacy"},e+=l;}if(i.existsSync(r)){let l=i.readdirSync(r).filter(m=>m.endsWith(".mdc"));l.length>0&&(n.modern=l.map(m=>{let x=a.join(r,m),j=b(x);return e+=j,{path:`.cursor/rules/${m}`,lines:j,type:"modern"}}));}(n.legacy||n.modern)&&o.push(n);let u={name:"copilot",displayName:"GitHub Copilot"},c=a.join(s,".github","copilot-instructions.md"),f=a.join(s,".github","instructions");if(i.existsSync(c)){let l=b(c);u.legacy={path:".github/copilot-instructions.md",lines:l,type:"legacy"},e+=l;}if(i.existsSync(f)){let l=i.readdirSync(f).filter(m=>m.endsWith(".md"));l.length>0&&(u.modern=l.map(m=>{let x=a.join(f,m),j=b(x);return e+=j,{path:`.github/instructions/${m}`,lines:j,type:"modern"}}));}(u.legacy||u.modern)&&o.push(u);let h=a.join(s,".windsurfrules");if(i.existsSync(h)){let l=b(h);o.push({name:"windsurf",displayName:"Windsurf",legacy:{path:".windsurfrules",lines:l,type:"legacy"}}),e+=l;}let w=a.join(s,"CLAUDE.md");if(i.existsSync(w)){let l=b(w);o.push({name:"claude",displayName:"Claude",legacy:{path:"CLAUDE.md",lines:l,type:"legacy"}}),e+=l;}let p=a.join(s,"AGENTS.md");if(i.existsSync(p)){let l=b(p);o.push({name:"agents",displayName:"AGENTS.md",legacy:{path:"AGENTS.md",lines:l,type:"legacy"}}),e+=l;}let y=a$2(s),d=g$1(s);return {ides:o,hasExisting:o.length>0,totalLines:e,projectType:_(s),discipline:y!=="backend"?y:void 0,stack:d||void 0}}function O(s,o){let e=[];e.push("# Migrate IDE Instructions to Paradigm Format"),e.push(""),e.push("## Overview"),e.push(""),e.push(`Migrate existing IDE instruction files for **${o}** to Paradigm's managed, scoped format.`),e.push(""),e.push("## Source Files Found"),e.push("");for(let n of s.ides)if(n.legacy&&e.push(`- \`${n.legacy.path}\` (${n.legacy.lines} lines) - ${n.displayName} ${n.legacy.type} format`),n.modern)for(let g of n.modern)e.push(`- \`${g.path}\` (${g.lines} lines) - ${n.displayName} modern format`);return e.push(""),s.ides.some(n=>n.name==="cursor")&&(e.push("## Cursor Migration \u2192 `.cursor/rules/*.mdc`"),e.push(""),e.push("Split the existing `.cursorrules` into scoped `.mdc` files with YAML frontmatter:"),e.push(""),e.push("### File Structure"),e.push(""),e.push("```"),e.push(".cursor/rules/"),e.push("\u251C\u2500\u2500 project-core.mdc # Always applies - project overview, architecture"),e.push("\u251C\u2500\u2500 code-style.mdc # globs: **/*.{ts,tsx,js,jsx} - naming, formatting"),e.push("\u251C\u2500\u2500 components.mdc # globs: **/components/**/* - component patterns"),e.push("\u251C\u2500\u2500 api-patterns.mdc # globs: **/api/**/* - API conventions"),e.push("\u251C\u2500\u2500 testing.mdc # globs: **/*.test.* - testing guidelines"),e.push("\u2514\u2500\u2500 custom.mdc # Any project-specific rules"),e.push("```"),e.push(""),e.push("### Frontmatter Format"),e.push(""),e.push("```yaml"),e.push("---"),e.push("description: Brief description of what these rules cover"),e.push('globs: "**/*.ts" # File pattern (OR use alwaysApply)'),e.push("alwaysApply: true # Apply to all files (OR use globs)"),e.push("---"),e.push("```"),e.push("")),s.ides.some(n=>n.name==="copilot")&&(e.push("## Copilot Migration \u2192 `.github/instructions/*.instructions.md`"),e.push(""),e.push("Split into scoped instruction files with `applyTo` frontmatter:"),e.push(""),e.push("### File Structure"),e.push(""),e.push("```"),e.push(".github/"),e.push("\u251C\u2500\u2500 copilot-instructions.md # Always applies - core rules"),e.push("\u2514\u2500\u2500 instructions/"),e.push(" \u251C\u2500\u2500 typescript.instructions.md # applyTo: **/*.ts"),e.push(" \u251C\u2500\u2500 react.instructions.md # applyTo: **/*.tsx"),e.push(" \u251C\u2500\u2500 api.instructions.md # applyTo: **/api/**"),e.push(" \u2514\u2500\u2500 testing.instructions.md # applyTo: **/*.test.*"),e.push("```"),e.push(""),e.push("### Frontmatter Format"),e.push(""),e.push("```yaml"),e.push("---"),e.push('applyTo: "**/*.ts"'),e.push("---"),e.push("```"),e.push("")),e.push("## Migration Steps"),e.push(""),e.push("1. **Read each source file** and identify logical sections:"),e.push(" - Project overview / architecture"),e.push(" - Code style / naming conventions"),e.push(" - Language-specific patterns"),e.push(" - Framework-specific rules"),e.push(" - Testing guidelines"),e.push(" - API patterns"),e.push(""),e.push("2. **Create scoped target files** with appropriate frontmatter"),e.push(""),e.push("3. **Backup originals** by renaming to `.bak`:"),e.push(" - `.cursorrules` \u2192 `.cursorrules.bak`"),e.push(" - `.github/copilot-instructions.md` \u2192 `.github/copilot-instructions.md.bak`"),e.push(""),e.push("4. **Verify** the migration by checking that rules apply correctly"),e.push(""),e.push("## Tips"),e.push(""),e.push("- **Prefer specific globs** over `alwaysApply` when possible"),e.push("- **Keep files focused** - one concern per file"),e.push("- **Use descriptive names** that indicate the scope"),e.push("- **Paradigm will generate its own rules** - keep custom rules separate"),e.push("- After migration, run `paradigm sync` to add Paradigm-managed rules"),e.push(""),e.push("---"),e.push(""),e.push("*Generated by `paradigm init --migrate`*"),e.join(`
|
|
4
|
-
`)}function G(){let s=fileURLToPath(import.meta.url),o=a.dirname(s),e=[a.join(o,"..","..","templates","paradigm"),a.join(o,"..","templates","paradigm"),a.join(o,"..","..","src","templates","paradigm")];for(let n of e)if(i.existsSync(n))return n;return a.join(o,"..","templates","paradigm")}var A={directories:["prompts"],files:["echoes.yaml","docs/commands.md","docs/queries.md","specs/disciplines.md","specs/
|
|
4
|
+
`)}function G(){let s=fileURLToPath(import.meta.url),o=a.dirname(s),e=[a.join(o,"..","..","templates","paradigm"),a.join(o,"..","templates","paradigm"),a.join(o,"..","..","src","templates","paradigm")];for(let n of e)if(i.existsSync(n))return n;return a.join(o,"..","templates","paradigm")}var A={directories:["prompts"],files:["echoes.yaml","docs/commands.md","docs/queries.md","specs/disciplines.md","specs/context-tracking.md"]};function z(s){for(let o of A.directories)if(s===o||s.startsWith(o+"/"))return true;return !!A.files.includes(s)}function N(s,o,e,n=""){i.existsSync(o)||i.mkdirSync(o,{recursive:true});let g=i.readdirSync(s,{withFileTypes:true});for(let r of g){let u=a.join(s,r.name),c=a.join(o,r.name),f=n?`${n}/${r.name}`:r.name;if(!z(f))if(r.isDirectory())N(u,c,e,f);else {let h=i.readFileSync(u,"utf8");h=h.replace(/\{\{PROJECT_NAME\}\}/g,e),i.writeFileSync(c,h,"utf8");}}}function M(s,o){if(console.log(t.blue(`
|
|
5
5
|
\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510`)),console.log(t.blue("\u2502")+t.white.bold(" Welcome to Paradigm ")+t.blue("\u2502")),console.log(t.blue("\u2502")+t.gray(" Let's set up your project ")+t.blue("\u2502")),console.log(t.blue(`\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
6
6
|
`)),console.log(t.white(" \u{1F4C1} Project: ")+t.cyan(o)+(s.projectType?t.gray(` (${s.projectType} detected)`):"")),s.discipline&&console.log(t.white(" \u{1F3AF} Discipline: ")+t.cyan(s.discipline)+(s.stack?t.gray(` \u2192 stack: ${s.stack}`):"")),console.log(""),s.hasExisting){console.log(t.white(` \u{1F4C4} Found existing IDE instructions:
|
|
7
7
|
`));for(let e of s.ides)if(e.legacy&&console.log(t.green(" \u2713 ")+t.white(e.legacy.path)+t.gray(` (${e.legacy.lines} lines)`)),e.modern)for(let n of e.modern)console.log(t.green(" \u2713 ")+t.white(n.path)+t.gray(` (${n.lines} lines)`));console.log(""),console.log(t.gray(` Total: ${s.totalLines} lines of existing instructions`));}else console.log(t.gray(" \u{1F4C4} No existing IDE instructions found"));console.log(""),console.log(t.gray(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),console.log("");}function B(s,o){let n={cursor:".cursor/rules/",copilot:".github/instructions/",windsurf:".windsurfrules",claude:"CLAUDE.md"}[s]||".cursor/rules/";console.log(t.blue(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {a as a$3}from'./chunk-TYWB5IQJ.js';import {b,a as a$1}from'./chunk-ORDKEGII.js';import {e}from'./chunk-AO7ZSRME.js';import {a}from'./chunk-FYDRENK7.js';import {b as b$1}from'./chunk-EKZDFEJW.js';import {a as a$2,c}from'./chunk-4VKSEOXZ.js';import {o,t,x}from'./chunk-LWAIVOSF.js';import'minimatch';import*as w from'fs';import*as A from'path';import*as F from'js-yaml';import {spawn}from'child_process';var ee=["should","what","how","why","recommend","analyze","compare","evaluate","assess","review","explain","describe","investigate","which","best practice","trade-off","tradeoff","pros and cons","decision"],te=["document","write docs","readme",".purpose","purpose file","jsdoc","tsdoc","comments","docstring","api docs","changelog","architecture doc"],se=["bug","fix","broken","not working","issue","error","crash","fails","failing","wrong","incorrect","doesn't work","doesn't","cant","can't","regression","patch"],re=["rename","refactor","migrate","restructure","move","reorganize","clean up","cleanup","consolidate","extract","inline","simplify","modularize","decouple","split","merge"],ne=["auth","authentication","authorization","permission","admin","delete","purge","password","credential","token","secret","key","encrypt","decrypt","hash","session","oauth","jwt","api key","role","access","gate","portal","sensitive","private","security","vulnerability","xss","sql injection","csrf"],oe=/[@#$%^!?&~][a-zA-Z0-9_-]+/g,Y={analysis:{agents:["architect"],models:{architect:"opus"},costMultiplier:{min:.3,max:.5}},documentation:{agents:["architect"],models:{architect:"sonnet"},costMultiplier:{min:.25,max:.45}},bugfix:{agents:["security","builder"],models:{security:"opus",builder:"haiku"},costMultiplier:{min:.5,max:.8}},refactor:{agents:["architect","builder"],models:{architect:"opus",builder:"haiku"},costMultiplier:{min:.6,max:.85}},feature:{agents:["architect","security","builder","tester"],models:{architect:"opus",security:"opus",builder:"haiku",tester:"haiku"},costMultiplier:{min:.8,max:1.2}}};function ie(p){let s=p.match(oe)||[];return [...new Set(s)]}function $(p,s){let e=p.toLowerCase();return s.filter(t=>e.includes(t.toLowerCase()))}function ae(p,s,e,t){let n=0;e.length>=5?n+=2:e.length>=2&&(n+=1);let o=p.split(/\s+/).length;o>=100?n+=2:o>=50&&(n+=1);let r=new Set(e.map(a=>a[0]));return r.size>=4?n+=2:r.size>=2&&(n+=1),e.some(a=>a.startsWith("^"))&&(n+=1),e.some(a=>a.startsWith("$"))&&(n+=1),s==="feature"&&(n+=1),s==="refactor"&&(n+=1),n>=5?"high":n>=2?"medium":"low"}function le(p,s,e){if($(p,ne).length>0||s.some(n=>n.startsWith("^")))return true;return false}function K(p,s){let e=ie(p),t=$(p,ee),n=$(p,te),o=$(p,se),r=$(p,re),a,i;t.length>0&&o.length===0&&r.length===0?(a="analysis",i=t):n.length>0&&o.length===0?(a="documentation",i=n):o.length>0?(a="bugfix",i=o):r.length>0?(a="refactor",i=r):(a="feature",i=[]);let c=Y[a],d=le(p,e),u=[...c.agents];d&&!u.includes("security")&&(u=["security",...u]);let m=ae(p,a,e),g={...c.costMultiplier};return m==="high"?(g.min*=1.2,g.max*=1.3):m==="low"&&(g.min*=.8,g.max*=.9),d&&!c.agents.includes("security")&&(g.min+=.15,g.max+=.2),{type:a,complexity:m,recommendedAgents:u,securityRequired:d,costMultiplier:g,matchedKeywords:i,symbols:e}}function B(p,s){let e=Y[s.type];return p==="security"&&s.securityRequired?"opus":e.models[p]||"sonnet"}var ce=/[@#$%^!?&~][a-zA-Z][a-zA-Z0-9_-]*/g,ue=[/\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi,/export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi,/export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi,/\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi],de=["endpoint","route","api","handler","get","post","put","patch","delete","rest","crud","controller"];function V(p,s,e$1){let t$1=p.toLowerCase(),n=p.match(ce)||[],o=[...new Set(n)],r=o.map(l=>{let y=t(e$1,l),k=y.length>0?y[0]:null;return {symbol:l,exists:!!k,type:k?.type,description:k?.description}}),a=r.filter(l=>l.exists).map(l=>{let y=x(e$1,l.symbol),k=new Set;for(let S of y){let x$1=x(e$1,S.symbol);for(let P of x$1)P.symbol!==l.symbol&&!y.find(O=>O.symbol===P.symbol)&&k.add(P.symbol);}let f=y.length+k.size,b="low";return f>10?b="high":f>3&&(b="medium"),{symbol:l.symbol,directDependents:y.length,indirectDependents:k.size,impact:b}}),i=a$2(s),c$1=i.status==="ok"?i.data:null,d={exists:i.status!=="missing",gateCount:c$1?c(c$1).length:0,gates:c$1?c(c$1).map(l=>`^${l}`):[],routeCount:c$1?.routes?Object.keys(c$1.routes).length:0},u=de.some(l=>t$1.includes(l)),m=e(s),g=m?a$3(p,m.agents).map(l=>({name:l.name,confidence:l.confidence,reason:l.reason})):[],h=[];return r.some(l=>l.exists)&&h.push("ripple-analysis"),u&&h.push("portal-compliance"),o.some(l=>l.startsWith("^"))&&h.push("gate-validation"),o.some(l=>l.startsWith("!"))&&h.push("signal-registration"),h.push("purpose-coverage"),{affectedSymbols:r,rippleAnalysis:a,portalStatus:d,taskAddsRoutes:u,suggestedAgents:g,requiredChecks:h}}function H(p,s,e,t$1){let n=[],o=a$2(e),r=o.status==="ok"?o.data:null,a=r?c(r):[],i=r?.routes?Object.keys(r.routes):[];for(let g of p){let h=A.isAbsolute(g)?g:A.join(e,g);if(!w.existsSync(h))continue;let l;try{l=w.readFileSync(h,"utf-8");}catch{continue}for(let y of ue){y.lastIndex=0;let k;for(;(k=y.exec(l))!==null;){let f=k[2]||k[0];f&&f.startsWith("/")&&(!i.some(S=>S.replace(/\s+(GET|POST|PUT|PATCH|DELETE)\s*$/,"").trim()===f)&&r?n.push({type:"missing-portal-gate",severity:"warning",message:`Route "${f}" found in ${A.relative(e,h)} but not declared in portal.yaml`,file:A.relative(e,h),suggestion:"Add this route to portal.yaml with appropriate ^gates. Run paradigm_gates_for_route to get suggestions."}):!r&&f.startsWith("/api/")&&n.push({type:"missing-portal-gate",severity:"warning",message:`API route "${f}" found but no portal.yaml exists`,file:A.relative(e,h),suggestion:"Create portal.yaml to declare gates for API routes. Run: paradigm portal init"}));}}}for(let g of s)t(t$1,g).length===0&&n.push({type:"unregistered-symbol",severity:"error",message:`Symbol "${g}" was touched but is not registered in any .purpose file`,suggestion:`Add "${g}" to the nearest .purpose file. Use paradigm_purpose_add_component or paradigm_purpose_add_signal.`});for(let g of s)if(g.startsWith("^")){let h=g.slice(1);a.includes(h)||n.push({type:"missing-portal-gate",severity:"error",message:`Gate "${g}" is referenced but not declared in portal.yaml`,suggestion:`Add ${g} to portal.yaml with description and check expression.`});}p.length>=5&&s.length>=3&&n.push({type:"uncaptured-wisdom",severity:"warning",message:`Large change (${p.length} files, ${s.length} symbols) \u2014 consider recording architectural decisions`,suggestion:"Use paradigm_wisdom_record to capture any decisions or antipatterns discovered during this task."});let c$1=n.filter(g=>g.severity==="error").length,d=n.filter(g=>g.severity==="warning").length,u=4,m="pass";return c$1>0?m="violations":d>0&&(m="warnings"),{status:m,violations:n,summary:{totalChecks:u,passed:u-(c$1>0?1:0)-(d>0?1:0),warnings:d,errors:c$1},blocksCompletion:c$1>0}}var pe={architect:"opus",security:"opus",reviewer:"sonnet",builder:"haiku",tester:"haiku"},he=["auth","permission","admin","delete","purge","password","credential","token","secret","key","encrypt","decrypt","hash","session","oauth","jwt","role","access control","vulnerability","injection","xss","csrf"];function me(p,s){let e=p.toLowerCase(),t=he.some(r=>e.includes(r.toLowerCase())),n=p.includes("^"),o=false;return t||n||o}var ye=["rename","refactor","migrate","restructure","move","reorganize"];function be(p){let s=p.toLowerCase();return ye.some(e=>s.includes(e))}var E=class{spawner;auditLogger;rootDir;constructor(s){this.rootDir=s,this.spawner=new b(s),this.auditLogger=new a(s);}async initialize(){await this.spawner.initialize();}async orchestrate(s,e={}){let t=e.mode||"faceted",n=Date.now(),o$1=this.generateOrchestrationId(),r={success:false,mode:t,orchestrationId:o$1,task:s,agentsSpawned:0,totalTokens:{input:0,output:0,total:0},totalCost:0,duration_ms:0,agentResults:[]};try{let a;if(e.pmGovernance?.enabled)try{let{aggregateFromDirectory:c}=await import('./dist-OG6MM4VY.js'),d=await c(this.rootDir),u=o(d);a=V(s,this.rootDir,u);}catch{}if(t==="solo"){let c=await this.runSoloMode(s,e);r.agentsSpawned=1,r.agentResults=[c],r.success=c.success,c.relay&&(r.totalTokens=c.relay.metrics.tokens_used,r.totalCost=b$1(r.totalTokens,e.orchestratorModel||"opus"));}else {let c=await this.runFacetedMode(s,e);r.agentsSpawned=c.results.length,r.agentResults=c.results,r.totalTokens=c.totalTokens,r.totalCost=c.totalCost,r.success=c.success,r.parallelBuilderStats=c.parallelBuilderStats;}if(e.pmGovernance?.enabled&&a)try{let{aggregateFromDirectory:c}=await import('./dist-OG6MM4VY.js'),d=await c(this.rootDir),u=o(d),m=[],g=[];for(let l of r.agentResults)l.relay?.outputs?.artifacts&&m.push(...l.relay.outputs.artifacts.map(y=>y.path));for(let l of a.affectedSymbols)g.push(l.symbol);let h=H(m,g,this.rootDir,u);r.complianceReport={preflight:a,postflight:h},e.pmGovernance.blockOnViolations&&h.blocksCompletion&&(r.success=!1);}catch{r.complianceReport={preflight:a};}r.duration_ms=Date.now()-n;let i=this.auditLogger.startOrchestration(o$1,s,t);return i.completed=new Date().toISOString(),i.status=r.success?"success":"failed",i.totals={duration_ms:r.duration_ms,tokens:r.totalTokens.total,cost_usd:r.totalCost,agents_spawned:r.agentsSpawned,files_created:0,files_modified:0},this.auditLogger.saveOrchestration(i),r.log=i,r}catch(a){return r.error=a instanceof Error?a.message:String(a),r.duration_ms=Date.now()-n,r}}async compare(s,e={}){let t=await this.orchestrate(s,{...e,mode:"solo"}),n=await this.orchestrate(s,{...e,mode:"faceted"}),o=t.totalTokens.total-n.totalTokens.total,r=t.totalCost-n.totalCost,a=t.duration_ms-n.duration_ms,i="tie";return n.success&&!t.success?i="faceted":t.success&&!n.success?i="solo":n.totalCost<t.totalCost*.8?i="faceted":t.totalCost<n.totalCost*.8&&(i="solo"),{solo:t,faceted:n,comparison:{winner:i,tokensSaved:o,costDiff:r,timeDiff:a,soloSucceeded:t.success,facetedSucceeded:n.success}}}async runSoloMode(s,e$1){let n=e(this.rootDir)?.team.default_agent||"architect",o=e$1.orchestratorModel||"opus",r={model:o,workingDirectory:e$1.workingDirectory||this.rootDir,mcpServerPath:e$1.mcpServerPath,budget:e$1.budget,onMessage:e$1.onMessage?i=>e$1.onMessage("solo",i):void 0,onCheckpoint:e$1.onCheckpoint};e$1.onAgentStart&&e$1.onAgentStart("solo",s,o);let a=await this.spawner.spawn(n,s,r);return e$1.onAgentComplete&&e$1.onAgentComplete("solo",a,o),a}async runFacetedMode(s,e$1){let t=e(this.rootDir);if(!t)return {success:false,results:[],totalTokens:{input:0,output:0,total:0},totalCost:0};let n="";if(be(s)){let h=a$1(s);if(h.length>0){let l=[];l.push(`## Auto-Ripple Analysis
|
|
2
|
+
import {a as a$3}from'./chunk-TYWB5IQJ.js';import {b,a as a$1}from'./chunk-WESTEMIM.js';import {a}from'./chunk-FYDRENK7.js';import {e}from'./chunk-AO7ZSRME.js';import {b as b$1}from'./chunk-EKZDFEJW.js';import {a as a$2,b as b$2}from'./chunk-LPBCQM5Y.js';import {o,t,x}from'./chunk-LWAIVOSF.js';import'minimatch';import*as w from'fs';import*as A from'path';import*as F from'js-yaml';import {spawn}from'child_process';var ee=["should","what","how","why","recommend","analyze","compare","evaluate","assess","review","explain","describe","investigate","which","best practice","trade-off","tradeoff","pros and cons","decision"],te=["document","write docs","readme",".purpose","purpose file","jsdoc","tsdoc","comments","docstring","api docs","changelog","architecture doc"],se=["bug","fix","broken","not working","issue","error","crash","fails","failing","wrong","incorrect","doesn't work","doesn't","cant","can't","regression","patch"],re=["rename","refactor","migrate","restructure","move","reorganize","clean up","cleanup","consolidate","extract","inline","simplify","modularize","decouple","split","merge"],ne=["auth","authentication","authorization","permission","admin","delete","purge","password","credential","token","secret","key","encrypt","decrypt","hash","session","oauth","jwt","api key","role","access","gate","portal","sensitive","private","security","vulnerability","xss","sql injection","csrf"],oe=/[@#$%^!?&~][a-zA-Z0-9_-]+/g,Y={analysis:{agents:["architect"],models:{architect:"opus"},costMultiplier:{min:.3,max:.5}},documentation:{agents:["architect"],models:{architect:"sonnet"},costMultiplier:{min:.25,max:.45}},bugfix:{agents:["security","builder"],models:{security:"opus",builder:"haiku"},costMultiplier:{min:.5,max:.8}},refactor:{agents:["architect","builder"],models:{architect:"opus",builder:"haiku"},costMultiplier:{min:.6,max:.85}},feature:{agents:["architect","security","builder","tester"],models:{architect:"opus",security:"opus",builder:"haiku",tester:"haiku"},costMultiplier:{min:.8,max:1.2}}};function ie(p){let s=p.match(oe)||[];return [...new Set(s)]}function $(p,s){let e=p.toLowerCase();return s.filter(t=>e.includes(t.toLowerCase()))}function ae(p,s,e,t){let n=0;e.length>=5?n+=2:e.length>=2&&(n+=1);let o=p.split(/\s+/).length;o>=100?n+=2:o>=50&&(n+=1);let r=new Set(e.map(a=>a[0]));return r.size>=4?n+=2:r.size>=2&&(n+=1),e.some(a=>a.startsWith("^"))&&(n+=1),e.some(a=>a.startsWith("$"))&&(n+=1),s==="feature"&&(n+=1),s==="refactor"&&(n+=1),n>=5?"high":n>=2?"medium":"low"}function le(p,s,e){if($(p,ne).length>0||s.some(n=>n.startsWith("^")))return true;return false}function K(p,s){let e=ie(p),t=$(p,ee),n=$(p,te),o=$(p,se),r=$(p,re),a,i;t.length>0&&o.length===0&&r.length===0?(a="analysis",i=t):n.length>0&&o.length===0?(a="documentation",i=n):o.length>0?(a="bugfix",i=o):r.length>0?(a="refactor",i=r):(a="feature",i=[]);let c=Y[a],d=le(p,e),u=[...c.agents];d&&!u.includes("security")&&(u=["security",...u]);let m=ae(p,a,e),g={...c.costMultiplier};return m==="high"?(g.min*=1.2,g.max*=1.3):m==="low"&&(g.min*=.8,g.max*=.9),d&&!c.agents.includes("security")&&(g.min+=.15,g.max+=.2),{type:a,complexity:m,recommendedAgents:u,securityRequired:d,costMultiplier:g,matchedKeywords:i,symbols:e}}function B(p,s){let e=Y[s.type];return p==="security"&&s.securityRequired?"opus":e.models[p]||"sonnet"}var ce=/[@#$%^!?&~][a-zA-Z][a-zA-Z0-9_-]*/g,ue=[/\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi,/export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi,/export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/gi,/\.(get|post|put|patch|delete)\s*\(\s*['"`]([^'"`]+)['"`]/gi],de=["endpoint","route","api","handler","get","post","put","patch","delete","rest","crud","controller"];function V(p,s,e$1){let t$1=p.toLowerCase(),n=p.match(ce)||[],o=[...new Set(n)],r=o.map(l=>{let y=t(e$1,l),k=y.length>0?y[0]:null;return {symbol:l,exists:!!k,type:k?.type,description:k?.description}}),a=r.filter(l=>l.exists).map(l=>{let y=x(e$1,l.symbol),k=new Set;for(let S of y){let x$1=x(e$1,S.symbol);for(let P of x$1)P.symbol!==l.symbol&&!y.find(O=>O.symbol===P.symbol)&&k.add(P.symbol);}let f=y.length+k.size,b="low";return f>10?b="high":f>3&&(b="medium"),{symbol:l.symbol,directDependents:y.length,indirectDependents:k.size,impact:b}}),i=a$2(s),c=i.status==="ok"?i.data:null,d={exists:i.status!=="missing",gateCount:c?b$2(c).length:0,gates:c?b$2(c).map(l=>`^${l}`):[],routeCount:c?.routes?Object.keys(c.routes).length:0},u=de.some(l=>t$1.includes(l)),m=e(s),g=m?a$3(p,m.agents).map(l=>({name:l.name,confidence:l.confidence,reason:l.reason})):[],h=[];return r.some(l=>l.exists)&&h.push("ripple-analysis"),u&&h.push("portal-compliance"),o.some(l=>l.startsWith("^"))&&h.push("gate-validation"),o.some(l=>l.startsWith("!"))&&h.push("signal-registration"),h.push("purpose-coverage"),{affectedSymbols:r,rippleAnalysis:a,portalStatus:d,taskAddsRoutes:u,suggestedAgents:g,requiredChecks:h}}function H(p,s,e,t$1){let n=[],o=a$2(e),r=o.status==="ok"?o.data:null,a=r?b$2(r):[],i=r?.routes?Object.keys(r.routes):[];for(let g of p){let h=A.isAbsolute(g)?g:A.join(e,g);if(!w.existsSync(h))continue;let l;try{l=w.readFileSync(h,"utf-8");}catch{continue}for(let y of ue){y.lastIndex=0;let k;for(;(k=y.exec(l))!==null;){let f=k[2]||k[0];f&&f.startsWith("/")&&(!i.some(S=>S.replace(/\s+(GET|POST|PUT|PATCH|DELETE)\s*$/,"").trim()===f)&&r?n.push({type:"missing-portal-gate",severity:"warning",message:`Route "${f}" found in ${A.relative(e,h)} but not declared in portal.yaml`,file:A.relative(e,h),suggestion:"Add this route to portal.yaml with appropriate ^gates. Run paradigm_gates_for_route to get suggestions."}):!r&&f.startsWith("/api/")&&n.push({type:"missing-portal-gate",severity:"warning",message:`API route "${f}" found but no portal.yaml exists`,file:A.relative(e,h),suggestion:"Create portal.yaml to declare gates for API routes. Run: paradigm portal init"}));}}}for(let g of s)t(t$1,g).length===0&&n.push({type:"unregistered-symbol",severity:"error",message:`Symbol "${g}" was touched but is not registered in any .purpose file`,suggestion:`Add "${g}" to the nearest .purpose file. Use paradigm_purpose_add_component or paradigm_purpose_add_signal.`});for(let g of s)if(g.startsWith("^")){let h=g.slice(1);a.includes(h)||n.push({type:"missing-portal-gate",severity:"error",message:`Gate "${g}" is referenced but not declared in portal.yaml`,suggestion:`Add ${g} to portal.yaml with description and check expression.`});}p.length>=5&&s.length>=3&&n.push({type:"uncaptured-wisdom",severity:"warning",message:`Large change (${p.length} files, ${s.length} symbols) \u2014 consider recording architectural decisions`,suggestion:"Use paradigm_wisdom_record to capture any decisions or antipatterns discovered during this task."});let c=n.filter(g=>g.severity==="error").length,d=n.filter(g=>g.severity==="warning").length,u=4,m="pass";return c>0?m="violations":d>0&&(m="warnings"),{status:m,violations:n,summary:{totalChecks:u,passed:u-(c>0?1:0)-(d>0?1:0),warnings:d,errors:c},blocksCompletion:c>0}}var pe={architect:"opus",security:"opus",reviewer:"sonnet",builder:"haiku",tester:"haiku"},he=["auth","permission","admin","delete","purge","password","credential","token","secret","key","encrypt","decrypt","hash","session","oauth","jwt","role","access control","vulnerability","injection","xss","csrf"];function me(p,s){let e=p.toLowerCase(),t=he.some(r=>e.includes(r.toLowerCase())),n=p.includes("^"),o=false;return t||n||o}var ye=["rename","refactor","migrate","restructure","move","reorganize"];function be(p){let s=p.toLowerCase();return ye.some(e=>s.includes(e))}var E=class{spawner;auditLogger;rootDir;constructor(s){this.rootDir=s,this.spawner=new b(s),this.auditLogger=new a(s);}async initialize(){await this.spawner.initialize();}async orchestrate(s,e={}){let t=e.mode||"faceted",n=Date.now(),o$1=this.generateOrchestrationId(),r={success:false,mode:t,orchestrationId:o$1,task:s,agentsSpawned:0,totalTokens:{input:0,output:0,total:0},totalCost:0,duration_ms:0,agentResults:[]};try{let a;if(e.pmGovernance?.enabled)try{let{aggregateFromDirectory:c}=await import('./dist-OG6MM4VY.js'),d=await c(this.rootDir),u=o(d);a=V(s,this.rootDir,u);}catch{}if(t==="solo"){let c=await this.runSoloMode(s,e);r.agentsSpawned=1,r.agentResults=[c],r.success=c.success,c.relay&&(r.totalTokens=c.relay.metrics.tokens_used,r.totalCost=b$1(r.totalTokens,e.orchestratorModel||"opus"));}else {let c=await this.runFacetedMode(s,e);r.agentsSpawned=c.results.length,r.agentResults=c.results,r.totalTokens=c.totalTokens,r.totalCost=c.totalCost,r.success=c.success,r.parallelBuilderStats=c.parallelBuilderStats;}if(e.pmGovernance?.enabled&&a)try{let{aggregateFromDirectory:c}=await import('./dist-OG6MM4VY.js'),d=await c(this.rootDir),u=o(d),m=[],g=[];for(let l of r.agentResults)l.relay?.outputs?.artifacts&&m.push(...l.relay.outputs.artifacts.map(y=>y.path));for(let l of a.affectedSymbols)g.push(l.symbol);let h=H(m,g,this.rootDir,u);r.complianceReport={preflight:a,postflight:h},e.pmGovernance.blockOnViolations&&h.blocksCompletion&&(r.success=!1);}catch{r.complianceReport={preflight:a};}r.duration_ms=Date.now()-n;let i=this.auditLogger.startOrchestration(o$1,s,t);return i.completed=new Date().toISOString(),i.status=r.success?"success":"failed",i.totals={duration_ms:r.duration_ms,tokens:r.totalTokens.total,cost_usd:r.totalCost,agents_spawned:r.agentsSpawned,files_created:0,files_modified:0},this.auditLogger.saveOrchestration(i),r.log=i,r}catch(a){return r.error=a instanceof Error?a.message:String(a),r.duration_ms=Date.now()-n,r}}async compare(s,e={}){let t=await this.orchestrate(s,{...e,mode:"solo"}),n=await this.orchestrate(s,{...e,mode:"faceted"}),o=t.totalTokens.total-n.totalTokens.total,r=t.totalCost-n.totalCost,a=t.duration_ms-n.duration_ms,i="tie";return n.success&&!t.success?i="faceted":t.success&&!n.success?i="solo":n.totalCost<t.totalCost*.8?i="faceted":t.totalCost<n.totalCost*.8&&(i="solo"),{solo:t,faceted:n,comparison:{winner:i,tokensSaved:o,costDiff:r,timeDiff:a,soloSucceeded:t.success,facetedSucceeded:n.success}}}async runSoloMode(s,e$1){let n=e(this.rootDir)?.team.default_agent||"architect",o=e$1.orchestratorModel||"opus",r={model:o,workingDirectory:e$1.workingDirectory||this.rootDir,mcpServerPath:e$1.mcpServerPath,budget:e$1.budget,onMessage:e$1.onMessage?i=>e$1.onMessage("solo",i):void 0,onCheckpoint:e$1.onCheckpoint};e$1.onAgentStart&&e$1.onAgentStart("solo",s,o);let a=await this.spawner.spawn(n,s,r);return e$1.onAgentComplete&&e$1.onAgentComplete("solo",a,o),a}async runFacetedMode(s,e$1){let t=e(this.rootDir);if(!t)return {success:false,results:[],totalTokens:{input:0,output:0,total:0},totalCost:0};let n="";if(be(s)){let h=a$1(s);if(h.length>0){let l=[];l.push(`## Auto-Ripple Analysis
|
|
3
3
|
`),l.push("The following symbols are affected by this refactoring:"),l.push("");for(let y of h.slice(0,5))l.push(`- **${y}**: Check dependencies before renaming/moving`);l.push(""),l.push("**Recommendation:** Run `paradigm_ripple` for each symbol before making changes."),n=l.join(`
|
|
4
4
|
`);}}let o=this.planAgentSequence(s,t.agents),r=this.groupByStage(o),a=[],i={input:0,output:0,total:0},c=0,d=new Map,u=true,m,g=Array.from(r.keys()).sort((h,l)=>h-l);for(let h of g){let l=r.get(h)||[];if(l.length===0)continue;if(e$1.checkpoints?.beforeAgentSpawn&&e$1.onCheckpoint){let f=l.map(S=>S.agent).join(", ");if(!await e$1.onCheckpoint(`Stage ${h}: Spawn ${f}${l.length>1?" (parallel)":""}`)){u=false;break}}let y=l.map(async f=>{let b=e$1.agentBudgets?.[f.agent]?.maxTokens?"haiku":f.model||pe[f.agent]||"sonnet",S="";if(f.dependsOn.length>0){let R=f.dependsOn.map(I=>d.get(I)).filter(Boolean);R.length>0&&(S=R.join(`
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {b}from'./chunk-
|
|
2
|
+
import {b}from'./chunk-6SKSV5B2.js';import {e,f,c,d,l,h,g,k,i,m as m$1,o,n,j,b as b$1,a as a$1}from'./chunk-AO7ZSRME.js';import {a}from'./chunk-Y4XFVDZC.js';import*as $ from'fs';import*as m from'path';import e$1 from'chalk';import E from'prompts';function F(){return process.env.CLAUDE_CODE==="1"||process.env.TERM_PROGRAM==="claude"?false:!!(process.env.TERM_PROGRAM==="cursor"||process.env.CURSOR_SESSION||process.env.CURSOR_TRACE_ID||process.env.VSCODE_CWD&&process.env.VSCODE_CWD.toLowerCase().includes("cursor")||process.env.VSCODE_NLS_CONFIG&&process.env.VSCODE_NLS_CONFIG.toLowerCase().includes("cursor")||process.env.TERM_PROGRAM==="vscode"&&process.env.VSCODE_GIT_ASKPASS_NODE?.toLowerCase().includes("cursor")||process.stdin.isTTY)}async function T(g){let n=new a(g),c=await n.discover();console.log(e$1.cyan(`
|
|
3
3
|
Configure Agent Models
|
|
4
4
|
`)),console.log(e$1.gray(` Environment: ${c.source}`)),console.log(e$1.gray(` Available: ${c.models.length} models
|
|
5
5
|
`));let i={},o=n.groupByTier(c.models),a$2=t=>{let r=a$1[t],s=r.tier==="high"?o.high:r.tier==="medium"?o.medium:o.low,l=[];for(let f of s){let P=l.length===0;l.push({title:P?`${f.name} (recommended)`:f.name,value:f.id,description:`${f.provider} - ${r.tier} tier`});}let u=o.high.filter(f=>!s.includes(f)),y=o.medium.filter(f=>!s.includes(f)),v=o.low.filter(f=>!s.includes(f));for(let f of u)l.push({title:f.name,value:f.id,description:`${f.provider} - high tier`});for(let f of y)l.push({title:f.name,value:f.id,description:`${f.provider} - medium tier`});for(let f of v)l.push({title:f.name,value:f.id,description:`${f.provider} - low tier`});return l};for(let t of ["architect","builder","tester","reviewer","security"]){let r=a$1[t],s=t.charAt(0).toUpperCase()+t.slice(1),l=a$2(t),u=await E({type:"select",name:"model",message:`${s} (${r.description})`,choices:l,initial:0},{onCancel:()=>{console.log(e$1.yellow(`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {c,b}from'./chunk-5TAVYPOV.js';import*as e from'fs';import*as o from'path';var D={};c(D,{appendSessionWorkEntry:()=>C,appendVerdictEntry:()=>N,clearActivityMetrics:()=>j,clearSessionWorkLog:()=>I,countNotebookReferences:()=>w,getAgentEntries:()=>S,getAgentVerdicts:()=>P,getContributingAgents:()=>A,getNotebookReferences:()=>h,getSessionActivitySummary:()=>W,markVerdictsConsumed:()=>O,readPendingVerdicts:()=>M,readSessionWorkLog:()=>g,recordActivityMetric:()=>F,recordNotebookReference:()=>R});function C(i,n){try{let t=o.join(i,y),r=o.dirname(t);if(e.existsSync(r)||e.mkdirSync(r,{recursive:!0}),e.existsSync(t)&&e.readFileSync(t,"utf8").trim().split(`
|
|
3
3
|
`).filter(a=>a.trim()).length>=x)return;let f=JSON.stringify(n)+`
|
|
4
|
-
`;e.appendFileSync(t,f,"utf8"),n.type==="user-verdict"&&n.agent&&n.symbols?.length&&import('./agent-loader-
|
|
4
|
+
`;e.appendFileSync(t,f,"utf8"),n.type==="user-verdict"&&n.agent&&n.symbols?.length&&import('./agent-loader-YKS2PQWO.js').then(({loadAgentProfile:c,saveAgentProfile:s})=>{try{let a=c(i,n.agent);if(a?.expertise){let u=n.verdict==="accepted"?.03:n.verdict==="dismissed"?-.02:n.verdict==="revised"?-.01:0;if(u!==0){for(let v of n.symbols){let l=a.expertise.find(k=>k.symbol===v);l&&(l.confidence=Math.max(0,Math.min(1,l.confidence+u)),l.sessions=(l.sessions||0)+1,l.lastTouch=new Date().toISOString());}s(n.agent,a,"global");}}}catch{}}).catch(()=>{});}catch{}}function g(i){try{let n=o.join(i,y);return e.existsSync(n)?e.readFileSync(n,"utf8").trim().split(`
|
|
5
5
|
`).filter(t=>t.trim()).map(t=>{try{return JSON.parse(t)}catch{return null}}).filter(t=>t!==null):[]}catch{return []}}function I(i){try{let n=o.join(i,y);e.existsSync(n)&&e.writeFileSync(n,"","utf8");}catch{}}function N(i,n){try{let t=o.join(i,p),r=o.dirname(t);e.existsSync(r)||e.mkdirSync(r,{recursive:!0}),e.appendFileSync(t,JSON.stringify(n)+`
|
|
6
6
|
`,"utf8");}catch{}}function M(i){try{let n=o.join(i,p);return e.existsSync(n)?e.readFileSync(n,"utf8").trim().split(`
|
|
7
7
|
`).filter(t=>t.trim()).map(t=>{try{return JSON.parse(t)}catch{return null}}).filter(t=>t!==null&&!t.consumed):[]}catch{return []}}function O(i,n){try{let t=o.join(i,p);if(!e.existsSync(t))return;let r=new Set(n),c=e.readFileSync(t,"utf8").trim().split(`
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {b}from'./chunk-5TAVYPOV.js';import*as i from'fs';import*as a from'path';import*as u from'js-yaml';import {execSync}from'child_process';function F(s){let e=s.toLowerCase();return e.includes("claude")||e.includes("anthropic")?"anthropic":e.includes("gpt")||e.includes("openai")||e.includes("o1")||e.includes("o3")?"openai":e.includes("gemini")||e.includes("google")||e.includes("palm")?"google":e.includes("llama")||e.includes("meta")?"meta":e.includes("mistral")||e.includes("mixtral")?"mistral":e.includes("deepseek")?"deepseek":e.includes("cohere")||e.includes("command")?"cohere":"unknown"}function A(s){let e=s,n=e.author;if(e.type||(e.type="agent-session"),typeof n=="string")return s;if(n&&typeof n=="object"&&!Array.isArray(n)){let t=n;t.type==="agent"?(e.author="unknown",e.agent={provider:t.model?F(t.model):F(t.id),model:t.model||t.id}):e.author=t.id||"unknown",delete e.assistedBy;}return e}function E(s){return s.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,20)||"unknown"}function W(){let s=process.env.PARADIGM_AUTHOR;if(s)return E(s);try{let e=execSync("git config user.name",{encoding:"utf-8",timeout:3e3}).trim();if(e)return E(e)}catch{}try{let e=os.userInfo().username;if(e)return E(e)}catch{}return "unknown"}function L(s){return s.endsWith(".yaml")||s.endsWith(".lore")}function k(s,e,n){let t=a.join(s,_,S,e),r=a.join(t,`${n}.lore`);if(i.existsSync(r))return r;let o=a.join(t,`${n}.yaml`);return i.existsSync(o)?o:null}async function I(s,e){let n=a.join(s,_,S);if(!i.existsSync(n))return [];C(s);let t=[],r=i.readdirSync(n).filter(o=>/^\d{4}-\d{2}-\d{2}$/.test(o)).sort().reverse();for(let o of r){if(e?.dateFrom&&o<e.dateFrom.slice(0,10)||e?.dateTo&&o>e.dateTo.slice(0,10))continue;let l=a.join(n,o),m=i.readdirSync(l).filter(L).sort();for(let c of m)try{let g=i.readFileSync(a.join(l,c),"utf8"),d=u.load(g);t.push(A(d));}catch{}}return e?U(t,e):t}async function P(s,e){let n=e.match(/^L-(\d{4}-\d{2}-\d{2})-/);if(n){let r=n[1],o=k(s,r,e);if(o)try{let l=i.readFileSync(o,"utf8"),m=u.load(l);return A(m)}catch{return null}}return (await I(s)).find(r=>r.id===e)||null}async function K(s){let e=a.join(s,_,$);if(!i.existsSync(e))return null;try{let n=i.readFileSync(e,"utf8");return u.load(n)}catch{return null}}function M(s){try{let e=execSync("git rev-parse HEAD",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),n=execSync("git rev-parse --abbrev-ref HEAD",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim(),t=execSync("git status --porcelain",{cwd:s,encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim();return {ref:e,branch:n,dirty:t.length>0}}catch{return}}async function G(s,e){let n=a.join(s,_),t=e.timestamp.slice(0,10),r=a.join(n,S,t);i.existsSync(r)||i.mkdirSync(r,{recursive:true}),e.author||(e.author=W()),e.git_context||(e.git_context=M(s)),e.id||(e.id=D(s,t,e.author,e.timestamp));let o=a.join(r,`${e.id}.lore`);return i.writeFileSync(o,u.dump(e,{lineWidth:-1,noRefs:true})),await j(s),e.id}async function V(s,e,n){let t=await P(s,e);if(!t)return false;let r=t.timestamp.slice(0,10),o=k(s,r,e);return o?(t.review=n,i.writeFileSync(o,u.dump(t,{lineWidth:-1,noRefs:true})),true):false}async function j(s){let e=a.join(s,_),n=a.join(e,S);if(!i.existsSync(n))return;C(s);let t=new Set,r=0,o="",l=i.readdirSync(n).filter(d=>/^\d{4}-\d{2}-\d{2}$/.test(d));for(let d of l){let y=a.join(n,d),h=i.readdirSync(y).filter(L);for(let w of h)try{let f=i.readFileSync(a.join(y,w),"utf8"),p=u.load(f),b=A(p);t.add(b.author),r++,(!o||b.timestamp>o)&&(o=b.timestamp);}catch{}}let m="unknown",c=a.join(s,".paradigm","config.yaml");if(i.existsSync(c))try{let d=u.load(i.readFileSync(c,"utf8"));m=d.project||d.name||"unknown";}catch{}let g={version:"1.0",project:m,entries:r,last_updated:o||new Date().toISOString(),authors:Array.from(t)};i.existsSync(e)||i.mkdirSync(e,{recursive:true}),i.writeFileSync(a.join(e,$),u.dump(g,{lineWidth:-1,noRefs:true}));}function C(s){let e=a.join(s,_,S);if(!i.existsSync(e))return 0;let n=i.readdirSync(e).filter(r=>L(r)&&!r.startsWith(".")),t=0;for(let r of n){let o=a.join(e,r);if(i.statSync(o).isFile())try{let m=i.readFileSync(o,"utf8"),c=u.load(m);if(c.author&&typeof c.author=="object"||typeof c.author=="string"&&c.timestamp)continue;let g=typeof c.date=="string"?c.date.slice(0,10):new Date().toISOString().slice(0,10),d=a.join(e,g);i.existsSync(d)||i.mkdirSync(d,{recursive:!0});let y=W(),h=`${g}T00:00:00.000Z`,w=D(s,g,y,h),f=String(c.type||"agent-session"),p=f==="decision",b=p?"insight":["agent-session","human-note","review","incident","milestone","insight"].includes(f)?f:"agent-session",T;if(c.test_results&&typeof c.test_results=="object"){let v=c.test_results;T={status:v.total===v.passed?"pass":"partial",details:{tests:v.total===v.passed?"pass":"fail"}};}let R=["migrated",f];p&&R.push("v6-migrated:from-decision");let O={id:w,type:b,timestamp:h,author:"unknown",agent:{provider:"unknown",model:"unknown"},title:String(c.title||r.replace(/\.(yaml|lore)$/,"")),summary:String(c.summary||""),symbols_touched:Array.isArray(c.symbols_touched)?c.symbols_touched:[],files_modified:Array.isArray(c.files_modified)?c.files_modified:void 0,...T?{verification:T}:{},tags:R};i.writeFileSync(a.join(d,`${w}.lore`),u.dump(O,{lineWidth:-1,noRefs:!0})),i.unlinkSync(o),t++;}catch{}}return t}async function q(s,e,n){let t=await P(s,e);if(!t)return false;let r=t.timestamp.slice(0,10),o=k(s,r,e);return o?(n.title!==void 0&&(t.title=n.title),n.summary!==void 0&&(t.summary=n.summary),n.type!==void 0&&(t.type=n.type),n.duration_minutes!==void 0&&(t.duration_minutes=n.duration_minutes),n.symbols_touched!==void 0&&(t.symbols_touched=n.symbols_touched),n.symbols_created!==void 0&&(t.symbols_created=n.symbols_created),n.files_created!==void 0&&(t.files_created=n.files_created),n.files_modified!==void 0&&(t.files_modified=n.files_modified),n.lines_added!==void 0&&(t.lines_added=n.lines_added),n.lines_removed!==void 0&&(t.lines_removed=n.lines_removed),n.commit!==void 0&&(t.commit=n.commit),n.decisions!==void 0&&(t.decisions=n.decisions),n.errors_encountered!==void 0&&(t.errors_encountered=n.errors_encountered),n.learnings!==void 0&&(t.learnings=n.learnings),n.verification!==void 0&&(t.verification=n.verification),n.tags!==void 0&&(t.tags=n.tags),n.body!==void 0&&(t.body=n.body),n.linked_lore!==void 0&&(t.linked_lore=n.linked_lore),n.linked_tasks!==void 0&&(t.linked_tasks=n.linked_tasks),n.linked_commits!==void 0&&(t.linked_commits=n.linked_commits),n.confidence!==void 0&&(t.confidence=n.confidence),n.assessment!==void 0&&(t.assessment=n.assessment),n.assessment_delta!==void 0&&(t.assessment_delta=n.assessment_delta),i.writeFileSync(o,u.dump(t,{lineWidth:-1,noRefs:true})),await j(s),true):false}function N(s){switch(s){case "correct":return 1;case "partial":return .5;case "incorrect":return 0}}async function Z(s,e,n){let t=await P(s,e);if(!t)return false;let r=t.timestamp.slice(0,10),o=k(s,r,e);return o?(t.assessment=n,t.confidence!=null&&(t.assessment_delta=N(n.verdict)-t.confidence),i.writeFileSync(o,u.dump(t,{lineWidth:-1,noRefs:true})),true):false}async function J(s,e){let n=await P(s,e);if(!n)return false;let t=n.timestamp.slice(0,10),r=k(s,t,e);if(!r)return false;i.unlinkSync(r);let o=a.dirname(r);return i.readdirSync(o).filter(L).length===0&&i.rmdirSync(o),await j(s),true}function U(s,e){let n=s;if(e.author&&(n=n.filter(t=>t.author===e.author)),e.hasAgent!==void 0?n=n.filter(t=>e.hasAgent?t.agent!=null:t.agent==null):e.authorType&&(n=n.filter(t=>e.authorType==="agent"?t.agent!=null:t.agent==null)),e.symbol&&(n=n.filter(t=>t.symbols_touched.includes(e.symbol)||t.symbols_created?.includes(e.symbol))),e.dateFrom){let t=new Date(e.dateFrom).getTime();n=n.filter(r=>new Date(r.timestamp).getTime()>=t);}if(e.dateTo){let t=new Date(e.dateTo).getTime();n=n.filter(r=>new Date(r.timestamp).getTime()<=t);}if(e.type&&(n=n.filter(t=>t.type===e.type)),e.tag){let t=e.tag;n=n.filter(r=>r.tags?.some(o=>o===t||o.startsWith(t+":")||t.includes(":")&&o===t));}return e.tags&&e.tags.length>0&&(n=n.filter(t=>e.tags.some(r=>t.tags?.includes(r)))),e.hasBody!==void 0&&(n=n.filter(t=>e.hasBody?t.body!=null&&t.body.length>0:!t.body||t.body.length===0)),e.hasReview!==void 0&&(n=n.filter(t=>e.hasReview?t.review!=null:t.review==null)),e.hasConfidence!==void 0&&(n=n.filter(t=>e.hasConfidence?t.confidence!=null:t.confidence==null)),e.hasAssessment!==void 0&&(n=n.filter(t=>e.hasAssessment?t.assessment!=null:t.assessment==null)),n.sort((t,r)=>new Date(r.timestamp).getTime()-new Date(t.timestamp).getTime()),e.offset&&(n=n.slice(e.offset)),e.limit&&(n=n.slice(0,e.limit)),n}function D(s,e,n,t){let r=E(n),o=new Date(t),l=String(o.getUTCHours()).padStart(2,"0"),m=String(o.getUTCMinutes()).padStart(2,"0"),c=String(o.getUTCSeconds()).padStart(2,"0"),g=`${l}${m}${c}`,d=`L-${e}-${r}-${g}`,y=a.join(s,_,S,e);if(!i.existsSync(y))return `${d}-001`;let h=i.readdirSync(y).filter(f=>f.startsWith(d)&&L(f)).map(f=>{let p=f.match(/-(\d{3})\.(yaml|lore)$/);return p?parseInt(p[1],10):0}),w=h.length>0?Math.max(...h)+1:1;return `${d}-${String(w).padStart(3,"0")}`}var _,S,$,z=b(()=>{_=".paradigm/lore",S="entries",$="timeline.yaml";});export{I as a,P as b,K as c,G as d,V as e,j as f,q as g,Z as h,J as i,z as j};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {c,b}from'./chunk-5TAVYPOV.js';import*as i from'fs';import*as l from'path';import*as k from'os';import*as g from'js-yaml';var $={};c($,{addNotebookEntry:()=>N,classifyNotebookScope:()=>w,incrementApplied:()=>P,loadNotebookEntries:()=>S,promoteFromLore:()=>_,searchNotebooks:()=>O});function S(e,t,n){let r=new Map,a=l.join(u,e);h(a,r);let o=l.join(t,d,e);h(o,r);let c=Array.from(r.values());if(n?.concepts&&n.concepts.length>0){let p=new Set(n.concepts.map(s=>s.toLowerCase()));c=c.filter(s=>s.concepts.some(f=>p.has(f.toLowerCase())));}if(n?.tags&&n.tags.length>0){let p=new Set(n.tags.map(s=>s.toLowerCase()));c=c.filter(s=>s.tags.some(f=>p.has(f.toLowerCase())));}return c.sort((p,s)=>s.appliedCount-p.appliedCount)}function h(e,t){if(i.existsSync(e))try{let n=i.readdirSync(e).filter(r=>r.startsWith(L)&&r.endsWith(y));for(let r of n)try{let a=i.readFileSync(l.join(e,r),"utf-8"),o=g.load(a);o?.id&&t.set(o.id,o);}catch{}}catch{}}function O(e,t,n){let r=S(e,n),a=t.toLowerCase();return r.filter(o=>o.context.toLowerCase().includes(a)||o.snippet.toLowerCase().includes(a)||o.concepts.some(c=>c.toLowerCase().includes(a))||o.tags.some(c=>c.toLowerCase().includes(a)))}function w(e){let t=[e.context,e.snippet,...e.concepts,...e.tags].join(" ").toLowerCase();return ["paradigm","mcp_","mcp tool",".paradigm/","lore entry","lore record","aspect","^gate","portal.yaml",".purpose","sentinel","symphony","ambient nomination","paradigm_"," pan ","agent notebook","concept anchor","symbol system","work log","knowledge stream","nevr.land","neverland"].some(r=>t.includes(r))?"platform-specific":/[#$^!~][a-z][a-z0-9-]{2,}/.test(t)||/\/[a-z0-9_-]{2,}\/[a-z0-9_-]/.test(t)?"project-specific":"generalizable"}function N(e,t,n,r){let a=new Date().toISOString(),o=(t.concepts[0]||t.context.split(" ").slice(0,4).join(" ")||"entry").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),p=`nb-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}-${o}`,s=t.scope??w({context:t.context,snippet:t.snippet,concepts:t.concepts,tags:t.tags}),f={...t,id:p,scope:s,publishable:t.publishable??true,appliedCount:0,created:a,updated:a},m=n==="global"?l.join(u,e):l.join(r||process.cwd(),d,e);i.existsSync(m)||i.mkdirSync(m,{recursive:true});let E=`${p}${y}`,b=l.join(m,E),C=g.dump(f,{lineWidth:120,noRefs:true,sortKeys:false});return i.writeFileSync(b,C,"utf-8"),{entry:f,filePath:b}}async function _(e,t,n,r="global"){let{loadLoreEntry:a}=await import('./lore-loader-
|
|
2
|
+
import {c,b}from'./chunk-5TAVYPOV.js';import*as i from'fs';import*as l from'path';import*as k from'os';import*as g from'js-yaml';var $={};c($,{addNotebookEntry:()=>N,classifyNotebookScope:()=>w,incrementApplied:()=>P,loadNotebookEntries:()=>S,promoteFromLore:()=>_,searchNotebooks:()=>O});function S(e,t,n){let r=new Map,a=l.join(u,e);h(a,r);let o=l.join(t,d,e);h(o,r);let c=Array.from(r.values());if(n?.concepts&&n.concepts.length>0){let p=new Set(n.concepts.map(s=>s.toLowerCase()));c=c.filter(s=>s.concepts.some(f=>p.has(f.toLowerCase())));}if(n?.tags&&n.tags.length>0){let p=new Set(n.tags.map(s=>s.toLowerCase()));c=c.filter(s=>s.tags.some(f=>p.has(f.toLowerCase())));}return c.sort((p,s)=>s.appliedCount-p.appliedCount)}function h(e,t){if(i.existsSync(e))try{let n=i.readdirSync(e).filter(r=>r.startsWith(L)&&r.endsWith(y));for(let r of n)try{let a=i.readFileSync(l.join(e,r),"utf-8"),o=g.load(a);o?.id&&t.set(o.id,o);}catch{}}catch{}}function O(e,t,n){let r=S(e,n),a=t.toLowerCase();return r.filter(o=>o.context.toLowerCase().includes(a)||o.snippet.toLowerCase().includes(a)||o.concepts.some(c=>c.toLowerCase().includes(a))||o.tags.some(c=>c.toLowerCase().includes(a)))}function w(e){let t=[e.context,e.snippet,...e.concepts,...e.tags].join(" ").toLowerCase();return ["paradigm","mcp_","mcp tool",".paradigm/","lore entry","lore record","aspect","^gate","portal.yaml",".purpose","sentinel","symphony","ambient nomination","paradigm_"," pan ","agent notebook","concept anchor","symbol system","work log","knowledge stream","nevr.land","neverland"].some(r=>t.includes(r))?"platform-specific":/[#$^!~][a-z][a-z0-9-]{2,}/.test(t)||/\/[a-z0-9_-]{2,}\/[a-z0-9_-]/.test(t)?"project-specific":"generalizable"}function N(e,t,n,r){let a=new Date().toISOString(),o=(t.concepts[0]||t.context.split(" ").slice(0,4).join(" ")||"entry").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40),p=`nb-${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}-${o}`,s=t.scope??w({context:t.context,snippet:t.snippet,concepts:t.concepts,tags:t.tags}),f={...t,id:p,scope:s,publishable:t.publishable??true,appliedCount:0,created:a,updated:a},m=n==="global"?l.join(u,e):l.join(r||process.cwd(),d,e);i.existsSync(m)||i.mkdirSync(m,{recursive:true});let E=`${p}${y}`,b=l.join(m,E),C=g.dump(f,{lineWidth:120,noRefs:true,sortKeys:false});return i.writeFileSync(b,C,"utf-8"),{entry:f,filePath:b}}async function _(e,t,n,r="global"){let{loadLoreEntry:a}=await import('./lore-loader-PXFKMKAN.js'),o=await a(n,t);if(!o)return null;let c=[];if(o.symbols_touched)for(let f of o.symbols_touched){let m=f.replace(/^[#$^!~]/,"").toLowerCase();c.push(m);}let p=o.summary||"";o.body&&(p+=`
|
|
3
3
|
|
|
4
4
|
`+o.body);let s={source:"lore",loreEntryId:t,originProject:l.basename(n),createdBy:e};return N(e,{context:o.title||`Promoted from ${t}`,snippet:p,provenance:s,confidence:o.confidence??.7,concepts:c,tags:o.tags||[]},r,n)}function P(e,t,n){let r=l.join(n,d,e),a=l.join(u,e);for(let o of [r,a]){let c=l.join(o,`${t}${y}`);if(i.existsSync(c))try{let p=i.readFileSync(c,"utf-8"),s=g.load(p);if(s)return s.appliedCount=(s.appliedCount||0)+1,s.updated=new Date().toISOString(),i.writeFileSync(c,g.dump(s,{lineWidth:120,noRefs:!0,sortKeys:!1}),"utf-8"),!0}catch{}}return false}var u,d,L,y,v=b(()=>{u=l.join(k.homedir(),".paradigm","notebooks"),d=".paradigm/notebooks",L="nb-",y=".yaml";});export{S as a,O as b,w as c,N as d,_ as e,P as f,$ as g,v as h};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {h as h$1}from'./chunk-ZJQY5PPP.js';import*as y from'fs';import*as h from'path';import*as
|
|
2
|
+
import {h as h$1}from'./chunk-ZJQY5PPP.js';import*as y from'fs';import*as h from'path';import*as B from'js-yaml';import {execFileSync}from'child_process';function k(t,e){if(t===e)return 0;if(t.length===0)return e.length;if(e.length===0)return t.length;let a=new Array(e.length+1),r=new Array(e.length+1);for(let s=0;s<=e.length;s++)a[s]=s;for(let s=1;s<=t.length;s++){r[0]=s;for(let n=1;n<=e.length;n++){let c=t.charCodeAt(s-1)===e.charCodeAt(n-1)?0:1;r[n]=Math.min(r[n-1]+1,a[n]+1,a[n-1]+c);}let o=a;a=r,r=o;}return a[e.length]}function S(t,e){if(!t||e.length===0)return;let a;for(let r of e){if(r===t)continue;let s=k(t,r),o=Math.max(t.length,r.length);if(o===0)continue;let n=s/o;(s<=2||n<=.3)&&(!a||s<a.distance)&&(a={didYouMean:r,distance:s});}return a}function M(t,e){let a=[];for(let r of t){let s=S(r,e);s&&a.push({gate:r,didYouMean:s.didYouMean,distance:s.distance});}return a}function $(t,e){let a=[];for(let r of t){let s=S(r,e);s&&a.push({gate:r,didYouMean:s.didYouMean,distance:s.distance});}return a}var R=["node_modules",".git","dist","build","coverage",".paradigm","vendor","__pycache__",".next","target"];function w(t){let e=h.join(t,"portal.yaml");if(!y.existsSync(e))return {status:"missing"};let a;try{a=y.readFileSync(e,"utf-8");}catch{return {status:"unparseable",errorClass:"other",detail:"file read error"}}try{return {status:"ok",data:B.load(a)}}catch(r){let{errorClass:s,detail:o}=h$1(r);return {status:"unparseable",errorClass:s,detail:o}}}function Y(t){let e=new Set;if(t.gates)for(let a of Object.keys(t.gates)){let r=a.startsWith("^")?a.slice(1):a;e.add(r);}if(t.routes)for(let a of Object.values(t.routes)){let r=Array.isArray(a)?a:a.gates||[];for(let s of r){let o=s.startsWith("^")?s.slice(1):s;e.add(o);}}return Array.from(e)}function v(t){let e=new Set;if(t.routes)for(let a of Object.values(t.routes)){let r=Array.isArray(a)?a:a.gates||[];for(let s of r){let o=s.startsWith("^")?s.slice(1):s;e.add(o);}}return e}function N(t,e){let a={encoding:"utf-8",maxBuffer:10485760,stdio:["ignore","pipe","pipe"]};try{let n=["-n","--no-ignore-vcs",...R.flatMap(c=>["--glob",`!${c}/**`]),"--engine","auto",e,t];return execFileSync("rg",n,a)}catch{}let s=["-rn",...R.map(o=>`--exclude-dir=${o}`),"-E",e,"--",t];try{return execFileSync("grep",s,a)}catch(o){return o?.code===1||o?.status===1,""}}var D=["**/.purpose","**/portal.yaml","**/.paradigm/**/*.yaml","**/.paradigm/**/*.yml"];function _(t){let e=[];for(let s of D){h.join(t,s);let n;try{n=execFileSync("find",[t,"-path","*/node_modules","-prune","-o","-path","*/.git","-prune","-o","(","-name",".purpose","-o","-name","portal.yaml",")","-print"],{encoding:"utf-8",maxBuffer:5242880}).split(`
|
|
3
3
|
`).filter(Boolean);}catch{n=[];}for(let c of n)try{let u=y.readFileSync(c,"utf-8").split(`
|
|
4
4
|
`);for(let d=0;d<u.length;d++){let p=u[d],l=p.matchAll(/\^([a-z][a-z0-9-]+)/g);for(let m of l)e.push({gate:m[1],file:h.relative(t,c),line:d+1,context:p.trim().slice(0,100),matchType:"symbol"});}}catch{}}let r=[{pattern:`checkGate\\s*\\(['"]([^'"]+)['"]`,type:"function"},{pattern:`requireGate\\s*\\(['"]([^'"]+)['"]`,type:"function"},{pattern:`@Gate\\s*\\(['"]?([^'"\\)]+)['"]?\\)`,type:"function"}];for(let{pattern:s,type:o}of r){let n=N(t,s);for(let c of n.split(`
|
|
5
|
-
`).filter(Boolean)){let f=c.match(/^(.+?):(\d+):(.*)$/);if(f){let[,u,d,p]=f,l=p.match(new RegExp(s));if(l&&l[1]){let m=l[1].startsWith("^")?l[1].slice(1):l[1];e.push({gate:m,file:h.relative(t,u),line:parseInt(d,10),context:p.trim().slice(0,100),matchType:o});}}}}return e}function
|
|
6
|
-
`)}function
|
|
5
|
+
`).filter(Boolean)){let f=c.match(/^(.+?):(\d+):(.*)$/);if(f){let[,u,d,p]=f,l=p.match(new RegExp(s));if(l&&l[1]){let m=l[1].startsWith("^")?l[1].slice(1):l[1];e.push({gate:m,file:h.relative(t,u),line:parseInt(d,10),context:p.trim().slice(0,100),matchType:o});}}}}return e}function E(t){return [...new Set(t.map(e=>e.gate))]}async function L(t){let e=w(t);if(e.status==="unparseable"){let i=e.errorClass==="duplicate-key"?"duplicate mapping key detected":e.errorClass==="syntax"?"YAML syntax error":"YAML parse error";return {status:"violations",declaredButUnused:[],routeAttachedUnused:[],orphanUnused:[],usedButUndeclared:["__portal_unparseable__"],properlyDeclared:[],suggestions:[`portal.yaml unparseable: ${i} \u2014 run 'paradigm doctor' for details`],references:[],portalError:{kind:"unparseable",errorClass:e.errorClass,detail:e.detail}}}if(e.status==="missing"){let i=_(t),C=E(i);return C.length===0?{status:"compliant",declaredButUnused:[],routeAttachedUnused:[],orphanUnused:[],usedButUndeclared:[],properlyDeclared:[],suggestions:["No portal.yaml found, and no gate references detected in code."],references:[]}:{status:"violations",declaredButUnused:[],routeAttachedUnused:[],orphanUnused:[],usedButUndeclared:C,properlyDeclared:[],suggestions:["Gate references found in code but no portal.yaml exists.","Create a portal.yaml file to declare these gates:",...C.map(P=>` - ^${P}`),"","Run: paradigm portal init"],references:i}}let a=e.data,r=Y(a),s=v(a),o=_(t),n=E(o),c=new Set(r),f=new Set(n),u=r.filter(i=>!f.has(i)),d=u.filter(i=>s.has(i)),p=u.filter(i=>!s.has(i)),l=n.filter(i=>!c.has(i)),m=r.filter(i=>f.has(i)),g=[];if(d.length>0){g.push("Gates documented on routes but no checkGate/requireGate in code:");for(let i of d)g.push(` - ^${i} (documented on routes; if enforced by middleware, this may be intentional)`);g.push("");}if(p.length>0){g.push("Orphan gates (declared but never on a route or in code):");for(let i of p)g.push(` - ^${i} (add to a route or remove from portal.yaml)`);g.push("");}if(l.length>0){g.push("Gates used in code but not declared in portal.yaml:");for(let i of l)g.push(` - ^${i} (add to portal.yaml with proper definition)`);g.push("");}let A="compliant";l.length>0?A="violations":u.length>0&&(A="warnings");let U=[],x=l.filter(i=>i!=="__portal_unparseable__");return x.length>0&&U.push(...M(x,r)),u.length>0&&x.length>0&&U.push(...$(u,x)),{status:A,declaredButUnused:u,routeAttachedUnused:d,orphanUnused:p,usedButUndeclared:l,properlyDeclared:m,suggestions:g,references:o,...U.length>0?{nearMatches:U}:{}}}function I(t){let e=[],a=t.status==="compliant"?"\u2713":t.status==="warnings"?"\u26A0":"\u2717";if(e.push(`Portal Compliance: ${a} ${t.status.toUpperCase()}`),e.push(""),e.push(`Properly Declared: ${t.properlyDeclared.length}`),t.routeAttachedUnused.length>0&&e.push(`Route-Attached, No Code: ${t.routeAttachedUnused.length}`),t.orphanUnused.length>0&&e.push(`Orphan Gates: ${t.orphanUnused.length}`),t.usedButUndeclared.length>0&&e.push(`Used but Undeclared: ${t.usedButUndeclared.length}`),e.push(""),t.properlyDeclared.length>0){e.push("Gates in Use:");for(let n of t.properlyDeclared)e.push(` \u2713 ^${n}`);e.push("");}if(t.routeAttachedUnused.length>0){e.push("Route-Attached (no checkGate/requireGate in code):");for(let n of t.routeAttachedUnused)e.push(` \u26A0 ^${n}`);e.push("");}if(t.orphanUnused.length>0){e.push("Orphan Gates (declared but never on route or in code):");for(let n of t.orphanUnused)e.push(` \u26A0 ^${n}`);e.push("");}t.portalError&&(e.push("Portal Unparseable:"),e.push(` \u2717 ${t.portalError.detail} \u2014 run 'paradigm doctor' for details`),e.push(""));let r=t.usedButUndeclared.filter(n=>n!=="__portal_unparseable__"),s=new Map,o=new Map;if(t.nearMatches)for(let n of t.nearMatches)r.includes(n.gate)&&!s.has(n.gate)?s.set(n.gate,{didYouMean:n.didYouMean,distance:n.distance}):t.declaredButUnused.includes(n.gate)&&!o.has(n.gate)&&o.set(n.gate,{didYouMean:n.didYouMean,distance:n.distance});if(r.length>0){e.push("Undeclared Gates (used but not in portal.yaml):");for(let n of r){e.push(` \u2717 ^${n}`);let c=s.get(n);c&&e.push(` Did you mean: ^${c.didYouMean}? (declared in portal.yaml)`);let f=t.references.filter(u=>u.gate===n).slice(0,3);for(let u of f)e.push(` at ${u.file}:${u.line}`);}e.push("");}if(o.size>0){e.push("Possible Typos (declared gates may be misspelled references):");for(let[n,c]of o)e.push(` ? ^${n} \u2014 did you mean to reference as ^${c.didYouMean}?`);e.push("");}if(t.suggestions.length>0&&t.status!=="compliant"){e.push("Suggestions:");for(let n of t.suggestions)n&&e.push(` ${n}`);}return e.join(`
|
|
6
|
+
`)}function z(t){if(t.status==="compliant")return {status:"ok",message:`${t.properlyDeclared.length} gates properly declared`};if(t.status==="warnings"){let e=[];return t.routeAttachedUnused.length>0&&e.push(`${t.routeAttachedUnused.length} route-attached`),t.orphanUnused.length>0&&e.push(`${t.orphanUnused.length} orphan`),{status:"warn",message:e.length>0?e.join(", ")+" gate(s)":`${t.declaredButUnused.length} unused gates`}}return {status:"error",message:`${t.usedButUndeclared.length} gates used but not declared`}}export{w as a,Y as b,_ as c,L as d,I as e,z as f};
|