jfl 0.4.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/context-hub.d.ts +1 -0
- package/dist/commands/context-hub.d.ts.map +1 -1
- package/dist/commands/context-hub.js +1064 -41
- package/dist/commands/context-hub.js.map +1 -1
- package/dist/commands/eval.d.ts +1 -1
- package/dist/commands/eval.d.ts.map +1 -1
- package/dist/commands/eval.js +192 -1
- package/dist/commands/eval.js.map +1 -1
- package/dist/commands/findings.d.ts +6 -0
- package/dist/commands/findings.d.ts.map +1 -0
- package/dist/commands/findings.js +203 -0
- package/dist/commands/findings.js.map +1 -0
- package/dist/commands/hud.d.ts.map +1 -1
- package/dist/commands/hud.js +47 -9
- package/dist/commands/hud.js.map +1 -1
- package/dist/commands/ide.d.ts +27 -0
- package/dist/commands/ide.d.ts.map +1 -0
- package/dist/commands/ide.js +546 -0
- package/dist/commands/ide.js.map +1 -0
- package/dist/commands/onboard.d.ts.map +1 -1
- package/dist/commands/onboard.js +212 -2
- package/dist/commands/onboard.js.map +1 -1
- package/dist/commands/openclaw.d.ts +3 -0
- package/dist/commands/openclaw.d.ts.map +1 -1
- package/dist/commands/openclaw.js +76 -2
- package/dist/commands/openclaw.js.map +1 -1
- package/dist/commands/peter.d.ts +3 -0
- package/dist/commands/peter.d.ts.map +1 -1
- package/dist/commands/peter.js +1168 -58
- package/dist/commands/peter.js.map +1 -1
- package/dist/commands/pi-fleet.d.ts +18 -0
- package/dist/commands/pi-fleet.d.ts.map +1 -0
- package/dist/commands/pi-fleet.js +382 -0
- package/dist/commands/pi-fleet.js.map +1 -0
- package/dist/commands/pi.d.ts.map +1 -1
- package/dist/commands/pi.js +18 -3
- package/dist/commands/pi.js.map +1 -1
- package/dist/commands/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +90 -1
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/services.d.ts.map +1 -1
- package/dist/commands/services.js +18 -0
- package/dist/commands/services.js.map +1 -1
- package/dist/commands/setup.d.ts +12 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +322 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +22 -4
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/train.d.ts +33 -0
- package/dist/commands/train.d.ts.map +1 -0
- package/dist/commands/train.js +510 -0
- package/dist/commands/train.js.map +1 -0
- package/dist/commands/verify.d.ts +14 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +276 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/commands/viz.d.ts.map +1 -1
- package/dist/commands/viz.js +417 -0
- package/dist/commands/viz.js.map +1 -1
- package/dist/dashboard-static/assets/index-CW9ZxqX8.css +1 -0
- package/dist/dashboard-static/assets/index-DNN__p4K.js +121 -0
- package/dist/dashboard-static/index.html +2 -2
- package/dist/index.js +324 -64
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-config.d.ts +52 -0
- package/dist/lib/agent-config.d.ts.map +1 -0
- package/dist/lib/agent-config.js +231 -0
- package/dist/lib/agent-config.js.map +1 -0
- package/dist/lib/agent-generator.d.ts +10 -0
- package/dist/lib/agent-generator.d.ts.map +1 -1
- package/dist/lib/agent-generator.js +64 -10
- package/dist/lib/agent-generator.js.map +1 -1
- package/dist/lib/agent-session.d.ts +104 -0
- package/dist/lib/agent-session.d.ts.map +1 -0
- package/dist/lib/agent-session.js +635 -0
- package/dist/lib/agent-session.js.map +1 -0
- package/dist/lib/eval-snapshot.d.ts +47 -0
- package/dist/lib/eval-snapshot.d.ts.map +1 -0
- package/dist/lib/eval-snapshot.js +315 -0
- package/dist/lib/eval-snapshot.js.map +1 -0
- package/dist/lib/eval-store.d.ts +5 -0
- package/dist/lib/eval-store.d.ts.map +1 -1
- package/dist/lib/eval-store.js +33 -3
- package/dist/lib/eval-store.js.map +1 -1
- package/dist/lib/findings-engine.d.ts +51 -0
- package/dist/lib/findings-engine.d.ts.map +1 -0
- package/dist/lib/findings-engine.js +338 -0
- package/dist/lib/findings-engine.js.map +1 -0
- package/dist/lib/flow-engine.d.ts +8 -0
- package/dist/lib/flow-engine.d.ts.map +1 -1
- package/dist/lib/flow-engine.js +84 -2
- package/dist/lib/flow-engine.js.map +1 -1
- package/dist/lib/hub-client.d.ts +1 -0
- package/dist/lib/hub-client.d.ts.map +1 -1
- package/dist/lib/hub-client.js +33 -6
- package/dist/lib/hub-client.js.map +1 -1
- package/dist/lib/ide-panes.d.ts +58 -0
- package/dist/lib/ide-panes.d.ts.map +1 -0
- package/dist/lib/ide-panes.js +508 -0
- package/dist/lib/ide-panes.js.map +1 -0
- package/dist/lib/memory-db.js +4 -4
- package/dist/lib/memory-db.js.map +1 -1
- package/dist/lib/memory-indexer.d.ts.map +1 -1
- package/dist/lib/memory-indexer.js +3 -0
- package/dist/lib/memory-indexer.js.map +1 -1
- package/dist/lib/memory-search.d.ts +148 -4
- package/dist/lib/memory-search.d.ts.map +1 -1
- package/dist/lib/memory-search.js +496 -58
- package/dist/lib/memory-search.js.map +1 -1
- package/dist/lib/meta-orchestrator.d.ts +104 -0
- package/dist/lib/meta-orchestrator.d.ts.map +1 -0
- package/dist/lib/meta-orchestrator.js +373 -0
- package/dist/lib/meta-orchestrator.js.map +1 -0
- package/dist/lib/peer-agent-generator.d.ts.map +1 -1
- package/dist/lib/peer-agent-generator.js +43 -19
- package/dist/lib/peer-agent-generator.js.map +1 -1
- package/dist/lib/pi-sky/bridge.d.ts +55 -0
- package/dist/lib/pi-sky/bridge.d.ts.map +1 -0
- package/dist/lib/pi-sky/bridge.js +264 -0
- package/dist/lib/pi-sky/bridge.js.map +1 -0
- package/dist/lib/pi-sky/cost-monitor.d.ts +21 -0
- package/dist/lib/pi-sky/cost-monitor.d.ts.map +1 -0
- package/dist/lib/pi-sky/cost-monitor.js +126 -0
- package/dist/lib/pi-sky/cost-monitor.js.map +1 -0
- package/dist/lib/pi-sky/eval-sweep.d.ts +27 -0
- package/dist/lib/pi-sky/eval-sweep.d.ts.map +1 -0
- package/dist/lib/pi-sky/eval-sweep.js +141 -0
- package/dist/lib/pi-sky/eval-sweep.js.map +1 -0
- package/dist/lib/pi-sky/event-router.d.ts +32 -0
- package/dist/lib/pi-sky/event-router.d.ts.map +1 -0
- package/dist/lib/pi-sky/event-router.js +176 -0
- package/dist/lib/pi-sky/event-router.js.map +1 -0
- package/dist/lib/pi-sky/experiment.d.ts +9 -0
- package/dist/lib/pi-sky/experiment.d.ts.map +1 -0
- package/dist/lib/pi-sky/experiment.js +83 -0
- package/dist/lib/pi-sky/experiment.js.map +1 -0
- package/dist/lib/pi-sky/index.d.ts +16 -0
- package/dist/lib/pi-sky/index.d.ts.map +1 -0
- package/dist/lib/pi-sky/index.js +16 -0
- package/dist/lib/pi-sky/index.js.map +1 -0
- package/dist/lib/pi-sky/stratus-gate.d.ts +28 -0
- package/dist/lib/pi-sky/stratus-gate.d.ts.map +1 -0
- package/dist/lib/pi-sky/stratus-gate.js +61 -0
- package/dist/lib/pi-sky/stratus-gate.js.map +1 -0
- package/dist/lib/pi-sky/swarm.d.ts +28 -0
- package/dist/lib/pi-sky/swarm.d.ts.map +1 -0
- package/dist/lib/pi-sky/swarm.js +208 -0
- package/dist/lib/pi-sky/swarm.js.map +1 -0
- package/dist/lib/pi-sky/types.d.ts +139 -0
- package/dist/lib/pi-sky/types.d.ts.map +1 -0
- package/dist/lib/pi-sky/types.js +2 -0
- package/dist/lib/pi-sky/types.js.map +1 -0
- package/dist/lib/pi-sky/voice-bridge.d.ts +20 -0
- package/dist/lib/pi-sky/voice-bridge.d.ts.map +1 -0
- package/dist/lib/pi-sky/voice-bridge.js +91 -0
- package/dist/lib/pi-sky/voice-bridge.js.map +1 -0
- package/dist/lib/policy-head.d.ts +40 -0
- package/dist/lib/policy-head.d.ts.map +1 -0
- package/dist/lib/policy-head.js +234 -0
- package/dist/lib/policy-head.js.map +1 -0
- package/dist/lib/predictor.d.ts +10 -0
- package/dist/lib/predictor.d.ts.map +1 -1
- package/dist/lib/predictor.js +46 -7
- package/dist/lib/predictor.js.map +1 -1
- package/dist/lib/replay-buffer.d.ts +93 -0
- package/dist/lib/replay-buffer.d.ts.map +1 -0
- package/dist/lib/replay-buffer.js +302 -0
- package/dist/lib/replay-buffer.js.map +1 -0
- package/dist/lib/sentinel-rl.d.ts +97 -0
- package/dist/lib/sentinel-rl.d.ts.map +1 -0
- package/dist/lib/sentinel-rl.js +430 -0
- package/dist/lib/sentinel-rl.js.map +1 -0
- package/dist/lib/session-lock.d.ts +61 -0
- package/dist/lib/session-lock.d.ts.map +1 -0
- package/dist/lib/session-lock.js +438 -0
- package/dist/lib/session-lock.js.map +1 -0
- package/dist/lib/setup/agent-generator.d.ts +18 -0
- package/dist/lib/setup/agent-generator.d.ts.map +1 -0
- package/dist/lib/setup/agent-generator.js +114 -0
- package/dist/lib/setup/agent-generator.js.map +1 -0
- package/dist/lib/setup/context-analyzer.d.ts +16 -0
- package/dist/lib/setup/context-analyzer.d.ts.map +1 -0
- package/dist/lib/setup/context-analyzer.js +112 -0
- package/dist/lib/setup/context-analyzer.js.map +1 -0
- package/dist/lib/setup/doc-auditor.d.ts +54 -0
- package/dist/lib/setup/doc-auditor.d.ts.map +1 -0
- package/dist/lib/setup/doc-auditor.js +629 -0
- package/dist/lib/setup/doc-auditor.js.map +1 -0
- package/dist/lib/setup/domain-generator.d.ts +7 -0
- package/dist/lib/setup/domain-generator.d.ts.map +1 -0
- package/dist/lib/setup/domain-generator.js +58 -0
- package/dist/lib/setup/domain-generator.js.map +1 -0
- package/dist/lib/setup/smart-eval-generator.d.ts +38 -0
- package/dist/lib/setup/smart-eval-generator.d.ts.map +1 -0
- package/dist/lib/setup/smart-eval-generator.js +378 -0
- package/dist/lib/setup/smart-eval-generator.js.map +1 -0
- package/dist/lib/setup/smart-recommender.d.ts +63 -0
- package/dist/lib/setup/smart-recommender.d.ts.map +1 -0
- package/dist/lib/setup/smart-recommender.js +329 -0
- package/dist/lib/setup/smart-recommender.js.map +1 -0
- package/dist/lib/setup/spec-generator.d.ts +63 -0
- package/dist/lib/setup/spec-generator.d.ts.map +1 -0
- package/dist/lib/setup/spec-generator.js +310 -0
- package/dist/lib/setup/spec-generator.js.map +1 -0
- package/dist/lib/setup/violation-agent-generator.d.ts +32 -0
- package/dist/lib/setup/violation-agent-generator.d.ts.map +1 -0
- package/dist/lib/setup/violation-agent-generator.js +255 -0
- package/dist/lib/setup/violation-agent-generator.js.map +1 -0
- package/dist/lib/stratus-client.d.ts +1 -0
- package/dist/lib/stratus-client.d.ts.map +1 -1
- package/dist/lib/stratus-client.js +24 -2
- package/dist/lib/stratus-client.js.map +1 -1
- package/dist/lib/telemetry-agent-v2.d.ts +128 -0
- package/dist/lib/telemetry-agent-v2.d.ts.map +1 -0
- package/dist/lib/telemetry-agent-v2.js +1042 -0
- package/dist/lib/telemetry-agent-v2.js.map +1 -0
- package/dist/lib/telemetry-agent.d.ts.map +1 -1
- package/dist/lib/telemetry-agent.js +27 -6
- package/dist/lib/telemetry-agent.js.map +1 -1
- package/dist/lib/telemetry-digest.d.ts.map +1 -1
- package/dist/lib/telemetry-digest.js +27 -5
- package/dist/lib/telemetry-digest.js.map +1 -1
- package/dist/lib/telemetry.d.ts.map +1 -1
- package/dist/lib/telemetry.js +29 -4
- package/dist/lib/telemetry.js.map +1 -1
- package/dist/lib/text-preprocessing.d.ts +83 -0
- package/dist/lib/text-preprocessing.d.ts.map +1 -0
- package/dist/lib/text-preprocessing.js +261 -0
- package/dist/lib/text-preprocessing.js.map +1 -0
- package/dist/lib/training-buffer.d.ts +86 -0
- package/dist/lib/training-buffer.d.ts.map +1 -0
- package/dist/lib/training-buffer.js +139 -0
- package/dist/lib/training-buffer.js.map +1 -0
- package/dist/lib/tuple-miner.d.ts +30 -0
- package/dist/lib/tuple-miner.d.ts.map +1 -0
- package/dist/lib/tuple-miner.js +427 -0
- package/dist/lib/tuple-miner.js.map +1 -0
- package/dist/lib/vm-backend.d.ts +72 -0
- package/dist/lib/vm-backend.d.ts.map +1 -0
- package/dist/lib/vm-backend.js +175 -0
- package/dist/lib/vm-backend.js.map +1 -0
- package/dist/lib/workspace/backend.d.ts +53 -0
- package/dist/lib/workspace/backend.d.ts.map +1 -0
- package/dist/lib/workspace/backend.js +37 -0
- package/dist/lib/workspace/backend.js.map +1 -0
- package/dist/lib/workspace/cmux-adapter.d.ts +46 -0
- package/dist/lib/workspace/cmux-adapter.d.ts.map +1 -0
- package/dist/lib/workspace/cmux-adapter.js +261 -0
- package/dist/lib/workspace/cmux-adapter.js.map +1 -0
- package/dist/lib/workspace/data-pipeline.d.ts +35 -0
- package/dist/lib/workspace/data-pipeline.d.ts.map +1 -0
- package/dist/lib/workspace/data-pipeline.js +463 -0
- package/dist/lib/workspace/data-pipeline.js.map +1 -0
- package/dist/lib/workspace/engine.d.ts +64 -0
- package/dist/lib/workspace/engine.d.ts.map +1 -0
- package/dist/lib/workspace/engine.js +397 -0
- package/dist/lib/workspace/engine.js.map +1 -0
- package/dist/lib/workspace/notifications.d.ts +14 -0
- package/dist/lib/workspace/notifications.d.ts.map +1 -0
- package/dist/lib/workspace/notifications.js +41 -0
- package/dist/lib/workspace/notifications.js.map +1 -0
- package/dist/lib/workspace/surface-registry.d.ts +49 -0
- package/dist/lib/workspace/surface-registry.d.ts.map +1 -0
- package/dist/lib/workspace/surface-registry.js +217 -0
- package/dist/lib/workspace/surface-registry.js.map +1 -0
- package/dist/lib/workspace/surface-type.d.ts +153 -0
- package/dist/lib/workspace/surface-type.d.ts.map +1 -0
- package/dist/lib/workspace/surface-type.js +9 -0
- package/dist/lib/workspace/surface-type.js.map +1 -0
- package/dist/lib/workspace/surfaces/agent-overview.d.ts +16 -0
- package/dist/lib/workspace/surfaces/agent-overview.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/agent-overview.js +116 -0
- package/dist/lib/workspace/surfaces/agent-overview.js.map +1 -0
- package/dist/lib/workspace/surfaces/agent.d.ts +16 -0
- package/dist/lib/workspace/surfaces/agent.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/agent.js +112 -0
- package/dist/lib/workspace/surfaces/agent.js.map +1 -0
- package/dist/lib/workspace/surfaces/claude.d.ts +15 -0
- package/dist/lib/workspace/surfaces/claude.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/claude.js +23 -0
- package/dist/lib/workspace/surfaces/claude.js.map +1 -0
- package/dist/lib/workspace/surfaces/dashboard.d.ts +21 -0
- package/dist/lib/workspace/surfaces/dashboard.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/dashboard.js +32 -0
- package/dist/lib/workspace/surfaces/dashboard.js.map +1 -0
- package/dist/lib/workspace/surfaces/eval.d.ts +15 -0
- package/dist/lib/workspace/surfaces/eval.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/eval.js +42 -0
- package/dist/lib/workspace/surfaces/eval.js.map +1 -0
- package/dist/lib/workspace/surfaces/event-stream.d.ts +16 -0
- package/dist/lib/workspace/surfaces/event-stream.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/event-stream.js +40 -0
- package/dist/lib/workspace/surfaces/event-stream.js.map +1 -0
- package/dist/lib/workspace/surfaces/flow.d.ts +16 -0
- package/dist/lib/workspace/surfaces/flow.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/flow.js +49 -0
- package/dist/lib/workspace/surfaces/flow.js.map +1 -0
- package/dist/lib/workspace/surfaces/index.d.ts +16 -0
- package/dist/lib/workspace/surfaces/index.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/index.js +16 -0
- package/dist/lib/workspace/surfaces/index.js.map +1 -0
- package/dist/lib/workspace/surfaces/portfolio.d.ts +16 -0
- package/dist/lib/workspace/surfaces/portfolio.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/portfolio.js +102 -0
- package/dist/lib/workspace/surfaces/portfolio.js.map +1 -0
- package/dist/lib/workspace/surfaces/service.d.ts +16 -0
- package/dist/lib/workspace/surfaces/service.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/service.js +45 -0
- package/dist/lib/workspace/surfaces/service.js.map +1 -0
- package/dist/lib/workspace/surfaces/shell.d.ts +15 -0
- package/dist/lib/workspace/surfaces/shell.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/shell.js +19 -0
- package/dist/lib/workspace/surfaces/shell.js.map +1 -0
- package/dist/lib/workspace/surfaces/telemetry.d.ts +16 -0
- package/dist/lib/workspace/surfaces/telemetry.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/telemetry.js +48 -0
- package/dist/lib/workspace/surfaces/telemetry.js.map +1 -0
- package/dist/lib/workspace/surfaces/topology.d.ts +15 -0
- package/dist/lib/workspace/surfaces/topology.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/topology.js +19 -0
- package/dist/lib/workspace/surfaces/topology.js.map +1 -0
- package/dist/lib/workspace/surfaces/training.d.ts +16 -0
- package/dist/lib/workspace/surfaces/training.d.ts.map +1 -0
- package/dist/lib/workspace/surfaces/training.js +22 -0
- package/dist/lib/workspace/surfaces/training.js.map +1 -0
- package/dist/lib/workspace/tmux-adapter.d.ts +27 -0
- package/dist/lib/workspace/tmux-adapter.d.ts.map +1 -0
- package/dist/lib/workspace/tmux-adapter.js +106 -0
- package/dist/lib/workspace/tmux-adapter.js.map +1 -0
- package/dist/mcp/context-hub-mcp.js +7 -24
- package/dist/mcp/context-hub-mcp.js.map +1 -1
- package/dist/types/flows.d.ts +2 -0
- package/dist/types/flows.d.ts.map +1 -1
- package/dist/types/ide.d.ts +49 -0
- package/dist/types/ide.d.ts.map +1 -0
- package/dist/types/ide.js +5 -0
- package/dist/types/ide.js.map +1 -0
- package/dist/types/platform-digest.d.ts +228 -0
- package/dist/types/platform-digest.d.ts.map +1 -0
- package/dist/types/platform-digest.js +5 -0
- package/dist/types/platform-digest.js.map +1 -0
- package/dist/types/telemetry-digest.d.ts +2 -0
- package/dist/types/telemetry-digest.d.ts.map +1 -1
- package/dist/utils/ensure-project.d.ts +1 -0
- package/dist/utils/ensure-project.d.ts.map +1 -1
- package/dist/utils/ensure-project.js +19 -7
- package/dist/utils/ensure-project.js.map +1 -1
- package/dist/utils/jfl-config.d.ts +1 -0
- package/dist/utils/jfl-config.d.ts.map +1 -1
- package/dist/utils/jfl-config.js +19 -1
- package/dist/utils/jfl-config.js.map +1 -1
- package/dist/utils/jfl-paths.d.ts +5 -0
- package/dist/utils/jfl-paths.d.ts.map +1 -1
- package/dist/utils/jfl-paths.js +25 -3
- package/dist/utils/jfl-paths.js.map +1 -1
- package/package.json +3 -2
- package/packages/pi/AGENTS.md +112 -0
- package/packages/pi/extensions/agent-grid.ts +191 -0
- package/packages/pi/extensions/agent-names.ts +178 -0
- package/packages/pi/extensions/autoresearch.ts +427 -0
- package/packages/pi/extensions/bookmarks.ts +85 -0
- package/packages/pi/extensions/context.ts +184 -0
- package/packages/pi/extensions/crm-tool.ts +61 -0
- package/packages/pi/extensions/eval-tool.ts +224 -0
- package/packages/pi/extensions/eval.ts +60 -0
- package/packages/pi/extensions/footer.ts +239 -0
- package/packages/pi/extensions/hub-resolver.ts +63 -0
- package/packages/pi/extensions/hud-tool.ts +145 -0
- package/packages/pi/extensions/index.ts +405 -0
- package/packages/pi/extensions/journal.ts +224 -0
- package/packages/pi/extensions/map-bridge.ts +178 -0
- package/packages/pi/extensions/memory-tool.ts +73 -0
- package/packages/pi/extensions/notifications.ts +73 -0
- package/packages/pi/extensions/peter-parker.ts +202 -0
- package/packages/pi/extensions/policy-head-tool.ts +276 -0
- package/packages/pi/extensions/portfolio-bridge.ts +90 -0
- package/packages/pi/extensions/session.ts +142 -0
- package/packages/pi/extensions/shortcuts.ts +259 -0
- package/packages/pi/extensions/stratus-bridge.ts +115 -0
- package/packages/pi/extensions/synopsis-tool.ts +83 -0
- package/packages/pi/extensions/tool-renderers.ts +353 -0
- package/packages/pi/extensions/training-buffer-tool.ts +368 -0
- package/packages/pi/extensions/types.ts +163 -0
- package/packages/pi/package-lock.json +346 -0
- package/packages/pi/package.json +44 -0
- package/packages/pi/skills/agent-browser/SKILL.md +116 -0
- package/packages/pi/skills/brand-architect/SKILL.md +240 -0
- package/packages/pi/skills/brand-architect/config.yaml +137 -0
- package/packages/pi/skills/campaign-hud/config.yaml +112 -0
- package/packages/pi/skills/content-creator/SKILL.md +294 -0
- package/packages/pi/skills/context/SKILL.md +65 -0
- package/packages/pi/skills/debug/MULTI_AGENT.md +360 -0
- package/packages/pi/skills/debug/SKILL.md +554 -0
- package/packages/pi/skills/end/SKILL.md +1782 -0
- package/packages/pi/skills/eval/SKILL.md +75 -0
- package/packages/pi/skills/fly-deploy/SKILL.md +676 -0
- package/packages/pi/skills/founder-video/SKILL.md +467 -0
- package/packages/pi/skills/hud/SKILL.md +160 -0
- package/packages/pi/skills/orchestrate/SKILL.md +74 -0
- package/packages/pi/skills/pi-agents/SKILL.md +78 -0
- package/packages/pi/skills/react-best-practices/AGENTS.md +2249 -0
- package/packages/pi/skills/react-best-practices/README.md +123 -0
- package/packages/pi/skills/react-best-practices/SKILL.md +125 -0
- package/packages/pi/skills/react-best-practices/metadata.json +15 -0
- package/packages/pi/skills/react-best-practices/rules/_sections.md +46 -0
- package/packages/pi/skills/react-best-practices/rules/_template.md +28 -0
- package/packages/pi/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/packages/pi/skills/react-best-practices/rules/advanced-use-latest.md +49 -0
- package/packages/pi/skills/react-best-practices/rules/async-api-routes.md +38 -0
- package/packages/pi/skills/react-best-practices/rules/async-defer-await.md +80 -0
- package/packages/pi/skills/react-best-practices/rules/async-dependencies.md +36 -0
- package/packages/pi/skills/react-best-practices/rules/async-parallel.md +28 -0
- package/packages/pi/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/packages/pi/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/packages/pi/skills/react-best-practices/rules/bundle-conditional.md +31 -0
- package/packages/pi/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/packages/pi/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/packages/pi/skills/react-best-practices/rules/bundle-preload.md +50 -0
- package/packages/pi/skills/react-best-practices/rules/client-event-listeners.md +74 -0
- package/packages/pi/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/packages/pi/skills/react-best-practices/rules/js-batch-dom-css.md +82 -0
- package/packages/pi/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/packages/pi/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/packages/pi/skills/react-best-practices/rules/js-cache-storage.md +70 -0
- package/packages/pi/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/packages/pi/skills/react-best-practices/rules/js-early-exit.md +50 -0
- package/packages/pi/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/packages/pi/skills/react-best-practices/rules/js-index-maps.md +37 -0
- package/packages/pi/skills/react-best-practices/rules/js-length-check-first.md +49 -0
- package/packages/pi/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/packages/pi/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/packages/pi/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/packages/pi/skills/react-best-practices/rules/rendering-activity.md +26 -0
- package/packages/pi/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/packages/pi/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/packages/pi/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/packages/pi/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/packages/pi/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/packages/pi/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/packages/pi/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/packages/pi/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/packages/pi/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/packages/pi/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/packages/pi/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/packages/pi/skills/react-best-practices/rules/rerender-memo.md +44 -0
- package/packages/pi/skills/react-best-practices/rules/rerender-transitions.md +40 -0
- package/packages/pi/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/packages/pi/skills/react-best-practices/rules/server-cache-lru.md +41 -0
- package/packages/pi/skills/react-best-practices/rules/server-cache-react.md +26 -0
- package/packages/pi/skills/react-best-practices/rules/server-parallel-fetching.md +79 -0
- package/packages/pi/skills/react-best-practices/rules/server-serialization.md +38 -0
- package/packages/pi/skills/remotion-best-practices/SKILL.md +43 -0
- package/packages/pi/skills/remotion-best-practices/rules/3d.md +86 -0
- package/packages/pi/skills/remotion-best-practices/rules/animations.md +29 -0
- package/packages/pi/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
- package/packages/pi/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
- package/packages/pi/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +108 -0
- package/packages/pi/skills/remotion-best-practices/rules/assets.md +78 -0
- package/packages/pi/skills/remotion-best-practices/rules/audio.md +172 -0
- package/packages/pi/skills/remotion-best-practices/rules/calculate-metadata.md +104 -0
- package/packages/pi/skills/remotion-best-practices/rules/can-decode.md +75 -0
- package/packages/pi/skills/remotion-best-practices/rules/charts.md +58 -0
- package/packages/pi/skills/remotion-best-practices/rules/compositions.md +146 -0
- package/packages/pi/skills/remotion-best-practices/rules/display-captions.md +126 -0
- package/packages/pi/skills/remotion-best-practices/rules/extract-frames.md +229 -0
- package/packages/pi/skills/remotion-best-practices/rules/fonts.md +152 -0
- package/packages/pi/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
- package/packages/pi/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
- package/packages/pi/skills/remotion-best-practices/rules/get-video-duration.md +58 -0
- package/packages/pi/skills/remotion-best-practices/rules/gifs.md +138 -0
- package/packages/pi/skills/remotion-best-practices/rules/images.md +130 -0
- package/packages/pi/skills/remotion-best-practices/rules/import-srt-captions.md +67 -0
- package/packages/pi/skills/remotion-best-practices/rules/lottie.md +68 -0
- package/packages/pi/skills/remotion-best-practices/rules/measuring-dom-nodes.md +35 -0
- package/packages/pi/skills/remotion-best-practices/rules/measuring-text.md +143 -0
- package/packages/pi/skills/remotion-best-practices/rules/sequencing.md +106 -0
- package/packages/pi/skills/remotion-best-practices/rules/tailwind.md +11 -0
- package/packages/pi/skills/remotion-best-practices/rules/text-animations.md +20 -0
- package/packages/pi/skills/remotion-best-practices/rules/timing.md +179 -0
- package/packages/pi/skills/remotion-best-practices/rules/transcribe-captions.md +19 -0
- package/packages/pi/skills/remotion-best-practices/rules/transitions.md +122 -0
- package/packages/pi/skills/remotion-best-practices/rules/trimming.md +53 -0
- package/packages/pi/skills/remotion-best-practices/rules/videos.md +171 -0
- package/packages/pi/skills/search/SKILL.md +220 -0
- package/packages/pi/skills/spec/SKILL.md +377 -0
- package/packages/pi/skills/startup/SKILL.md +315 -0
- package/packages/pi/skills/web-architect/SKILL.md +309 -0
- package/packages/pi/skills/x-algorithm/SKILL.md +305 -0
- package/packages/pi/teams/dev-team.yaml +63 -0
- package/packages/pi/teams/gtm-team.yaml +79 -0
- package/packages/pi/themes/jfl.theme.json +76 -0
- package/packages/pi/tsconfig.json +21 -0
- package/scripts/collect-tuples.sh +124 -0
- package/scripts/destroy-fleet.sh +37 -0
- package/scripts/jfl-ide.sh +48 -0
- package/scripts/session/session-cleanup.sh +4 -11
- package/scripts/session/session-init.sh +6 -0
- package/scripts/session/session-sync.sh +25 -0
- package/scripts/setup-branch-protection.sh +106 -0
- package/scripts/spawn-fleet.sh +144 -0
- package/scripts/train/requirements.txt +5 -0
- package/scripts/train/train-policy-head.py +477 -0
- package/scripts/train/v2/dataset.py +81 -0
- package/scripts/train/v2/domain.json +18 -0
- package/scripts/train/v2/eval.py +196 -0
- package/scripts/train/v2/generate_data.py +219 -0
- package/scripts/train/v2/infer.py +188 -0
- package/scripts/train/v2/model.py +112 -0
- package/scripts/train/v2/precompute.py +132 -0
- package/scripts/train/v2/train.py +302 -0
- package/scripts/train/v2/transform_buffer.py +227 -0
- package/scripts/train/v2/validate_data.py +115 -0
- package/scripts/train-policy-head.py +434 -0
- package/scripts/vm-swarm/README.md +301 -0
- package/scripts/vm-swarm/collect-tuples.sh +331 -0
- package/scripts/vm-swarm/create-base-template.sh +339 -0
- package/scripts/vm-swarm/kill-fleet.sh +204 -0
- package/scripts/vm-swarm/monitor-fleet.sh +346 -0
- package/scripts/vm-swarm/spawn-fleet.sh +304 -0
- package/template/.claude/settings.json +2 -15
- package/template/.github/workflows/jfl-eval.yml +6 -1
- package/template/.github/workflows/jfl-review.yml +4 -0
- package/template/scripts/session/session-cleanup.sh +2 -11
- package/template/scripts/session/session-end-hub.sh +72 -0
- package/template/scripts/session/session-end.sh +69 -6
- package/template/scripts/session/session-init.sh +55 -30
- package/template/scripts/session/session-lock.sh +464 -0
- package/template/scripts/session/session-start-hub.sh +105 -0
- package/template/templates/service-agent/workflows/jfl-eval.yml +19 -0
- package/dist/dashboard-static/assets/index-B6kRK9Rq.js +0 -116
- package/dist/dashboard-static/assets/index-BpdKJPLu.css +0 -1
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# session-lock.sh — File-based session lock registry + merge sequencer
|
|
4
|
+
#
|
|
5
|
+
# Pure bash, no external dependencies beyond flock(1). Designed for use by
|
|
6
|
+
# session-init.sh and session-end.sh to coordinate multiple concurrent sessions.
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# session-lock.sh register <session-id> <branch> [worktree-path]
|
|
10
|
+
# session-lock.sh heartbeat <session-id>
|
|
11
|
+
# session-lock.sh unregister <session-id>
|
|
12
|
+
# session-lock.sh active # list active sessions (JSON)
|
|
13
|
+
# session-lock.sh count # count of active sessions
|
|
14
|
+
# session-lock.sh stale # list stale sessions
|
|
15
|
+
# session-lock.sh clean # remove stale lock files
|
|
16
|
+
# session-lock.sh claim <session-id> <path,...> # declare file claims
|
|
17
|
+
# session-lock.sh check-claim <session-id> <path> # check for conflicts
|
|
18
|
+
# session-lock.sh merge <session-branch> <target-branch> <session-id> [cwd]
|
|
19
|
+
# session-lock.sh emit <session-id> <event-type> [key=value...]
|
|
20
|
+
#
|
|
21
|
+
# @purpose Bash session concurrency control (lock registry + merge sequencer)
|
|
22
|
+
|
|
23
|
+
set -euo pipefail
|
|
24
|
+
|
|
25
|
+
REPO_DIR="${JFL_REPO_DIR:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
|
|
26
|
+
SESSIONS_DIR="$REPO_DIR/.jfl/sessions"
|
|
27
|
+
HEARTBEAT_STALE_SECONDS=90
|
|
28
|
+
MERGE_LOCK_TIMEOUT_SECONDS=120
|
|
29
|
+
MERGE_RETRY_SECONDS=2
|
|
30
|
+
|
|
31
|
+
mkdir -p "$SESSIONS_DIR"
|
|
32
|
+
|
|
33
|
+
# ---------------------------------------------------------------------------
|
|
34
|
+
# Helpers
|
|
35
|
+
# ---------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
now_iso() { date -u +"%Y-%m-%dT%H:%M:%S.000Z"; }
|
|
38
|
+
|
|
39
|
+
lock_file() { echo "$SESSIONS_DIR/${1}.lock"; }
|
|
40
|
+
flock_file() { echo "$SESSIONS_DIR/${1}.lock.flock"; }
|
|
41
|
+
merge_queue() { echo "$SESSIONS_DIR/merge-queue.jsonl"; }
|
|
42
|
+
merge_lock() { echo "$SESSIONS_DIR/merge.lock"; }
|
|
43
|
+
events_file() { echo "$SESSIONS_DIR/events.jsonl"; }
|
|
44
|
+
|
|
45
|
+
pid_alive() {
|
|
46
|
+
kill -0 "$1" 2>/dev/null
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
file_age_seconds() {
|
|
50
|
+
local file="$1"
|
|
51
|
+
if [[ ! -f "$file" ]]; then echo "999999"; return; fi
|
|
52
|
+
if [[ "$(uname)" == "Darwin" ]]; then
|
|
53
|
+
local mtime
|
|
54
|
+
mtime=$(stat -f %m "$file" 2>/dev/null || echo 0)
|
|
55
|
+
echo $(( $(date +%s) - mtime ))
|
|
56
|
+
else
|
|
57
|
+
local mtime
|
|
58
|
+
mtime=$(stat -c %Y "$file" 2>/dev/null || echo 0)
|
|
59
|
+
echo $(( $(date +%s) - mtime ))
|
|
60
|
+
fi
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
flock_write() {
|
|
64
|
+
local file="$1"
|
|
65
|
+
local content="$2"
|
|
66
|
+
local fl="${file}.flock"
|
|
67
|
+
(
|
|
68
|
+
flock -x 200 2>/dev/null || true
|
|
69
|
+
printf '%s' "$content" > "$file"
|
|
70
|
+
) 200>"$fl"
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
flock_append() {
|
|
74
|
+
local file="$1"
|
|
75
|
+
local line="$2"
|
|
76
|
+
local fl="${file}.flock"
|
|
77
|
+
(
|
|
78
|
+
flock -x 200 2>/dev/null || true
|
|
79
|
+
echo "$line" >> "$file"
|
|
80
|
+
) 200>"$fl"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
emit_event() {
|
|
84
|
+
local session_id="${1:-unknown}"
|
|
85
|
+
local event_type="${2:-unknown}"
|
|
86
|
+
shift 2 || true
|
|
87
|
+
local extra=""
|
|
88
|
+
for kv in "$@"; do
|
|
89
|
+
local key="${kv%%=*}"
|
|
90
|
+
local val="${kv#*=}"
|
|
91
|
+
extra="${extra},\"${key}\":\"${val}\""
|
|
92
|
+
done
|
|
93
|
+
local ev="{\"session\":\"${session_id}\",\"event\":\"${event_type}\"${extra},\"ts\":\"$(now_iso)\"}"
|
|
94
|
+
flock_append "$(events_file)" "$ev"
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# ---------------------------------------------------------------------------
|
|
98
|
+
# Commands
|
|
99
|
+
# ---------------------------------------------------------------------------
|
|
100
|
+
|
|
101
|
+
cmd_register() {
|
|
102
|
+
local session_id="$1"
|
|
103
|
+
local branch="$2"
|
|
104
|
+
local worktree="${3:-null}"
|
|
105
|
+
local user
|
|
106
|
+
user=$(git config user.name 2>/dev/null | tr ' ' '-' | tr '[:upper:]' '[:lower:]' || echo "unknown")
|
|
107
|
+
|
|
108
|
+
if [[ "$worktree" != "null" ]]; then
|
|
109
|
+
worktree="\"$worktree\""
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
local lock_json
|
|
113
|
+
lock_json=$(cat <<EOF
|
|
114
|
+
{
|
|
115
|
+
"id": "${session_id}",
|
|
116
|
+
"pid": $$,
|
|
117
|
+
"branch": "${branch}",
|
|
118
|
+
"worktree": ${worktree},
|
|
119
|
+
"user": "${user}",
|
|
120
|
+
"claiming": [],
|
|
121
|
+
"started": "$(now_iso)",
|
|
122
|
+
"heartbeat": "$(now_iso)"
|
|
123
|
+
}
|
|
124
|
+
EOF
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
flock_write "$(lock_file "$session_id")" "$lock_json"
|
|
128
|
+
emit_event "$session_id" "session:register" "branch=$branch" "user=$user"
|
|
129
|
+
echo "registered: $session_id"
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
cmd_heartbeat() {
|
|
133
|
+
local session_id="$1"
|
|
134
|
+
local lf
|
|
135
|
+
lf="$(lock_file "$session_id")"
|
|
136
|
+
if [[ ! -f "$lf" ]]; then
|
|
137
|
+
echo "error: no lock file for $session_id" >&2
|
|
138
|
+
return 1
|
|
139
|
+
fi
|
|
140
|
+
|
|
141
|
+
# Update heartbeat timestamp in the JSON
|
|
142
|
+
local content
|
|
143
|
+
content=$(cat "$lf")
|
|
144
|
+
local updated
|
|
145
|
+
updated=$(echo "$content" | sed "s/\"heartbeat\": *\"[^\"]*\"/\"heartbeat\": \"$(now_iso)\"/")
|
|
146
|
+
flock_write "$lf" "$updated"
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
cmd_unregister() {
|
|
150
|
+
local session_id="$1"
|
|
151
|
+
emit_event "$session_id" "session:unregister"
|
|
152
|
+
rm -f "$(lock_file "$session_id")" "$(flock_file "$session_id")"
|
|
153
|
+
echo "unregistered: $session_id"
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
cmd_active() {
|
|
157
|
+
local active_json="["
|
|
158
|
+
local first=true
|
|
159
|
+
|
|
160
|
+
for lf in "$SESSIONS_DIR"/*.lock; do
|
|
161
|
+
[[ -f "$lf" ]] || continue
|
|
162
|
+
[[ "$lf" == *.flock ]] && continue
|
|
163
|
+
|
|
164
|
+
local content
|
|
165
|
+
content=$(cat "$lf" 2>/dev/null) || continue
|
|
166
|
+
local pid
|
|
167
|
+
pid=$(echo "$content" | grep -o '"pid": *[0-9]*' | grep -o '[0-9]*') || continue
|
|
168
|
+
|
|
169
|
+
# Check heartbeat age
|
|
170
|
+
local age
|
|
171
|
+
age=$(file_age_seconds "$lf")
|
|
172
|
+
if [[ $age -gt $HEARTBEAT_STALE_SECONDS ]]; then continue; fi
|
|
173
|
+
|
|
174
|
+
# Check PID alive
|
|
175
|
+
if ! pid_alive "$pid"; then continue; fi
|
|
176
|
+
|
|
177
|
+
if [[ "$first" == "true" ]]; then
|
|
178
|
+
first=false
|
|
179
|
+
else
|
|
180
|
+
active_json="${active_json},"
|
|
181
|
+
fi
|
|
182
|
+
active_json="${active_json}${content}"
|
|
183
|
+
done
|
|
184
|
+
|
|
185
|
+
active_json="${active_json}]"
|
|
186
|
+
echo "$active_json"
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
cmd_count() {
|
|
190
|
+
local count=0
|
|
191
|
+
|
|
192
|
+
for lf in "$SESSIONS_DIR"/*.lock; do
|
|
193
|
+
[[ -f "$lf" ]] || continue
|
|
194
|
+
[[ "$lf" == *.flock ]] && continue
|
|
195
|
+
|
|
196
|
+
local content
|
|
197
|
+
content=$(cat "$lf" 2>/dev/null) || continue
|
|
198
|
+
local pid
|
|
199
|
+
pid=$(echo "$content" | grep -o '"pid": *[0-9]*' | grep -o '[0-9]*') || continue
|
|
200
|
+
|
|
201
|
+
local age
|
|
202
|
+
age=$(file_age_seconds "$lf")
|
|
203
|
+
if [[ $age -gt $HEARTBEAT_STALE_SECONDS ]]; then continue; fi
|
|
204
|
+
if ! pid_alive "$pid"; then continue; fi
|
|
205
|
+
|
|
206
|
+
count=$((count + 1))
|
|
207
|
+
done
|
|
208
|
+
|
|
209
|
+
echo "$count"
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
cmd_stale() {
|
|
213
|
+
local stale_json="["
|
|
214
|
+
local first=true
|
|
215
|
+
|
|
216
|
+
for lf in "$SESSIONS_DIR"/*.lock; do
|
|
217
|
+
[[ -f "$lf" ]] || continue
|
|
218
|
+
[[ "$lf" == *.flock ]] && continue
|
|
219
|
+
|
|
220
|
+
local content
|
|
221
|
+
content=$(cat "$lf" 2>/dev/null) || continue
|
|
222
|
+
local pid
|
|
223
|
+
pid=$(echo "$content" | grep -o '"pid": *[0-9]*' | grep -o '[0-9]*') || continue
|
|
224
|
+
|
|
225
|
+
local age
|
|
226
|
+
age=$(file_age_seconds "$lf")
|
|
227
|
+
local alive=true
|
|
228
|
+
pid_alive "$pid" || alive=false
|
|
229
|
+
|
|
230
|
+
if [[ $age -gt $HEARTBEAT_STALE_SECONDS ]] || [[ "$alive" == "false" ]]; then
|
|
231
|
+
if [[ "$first" == "true" ]]; then first=false; else stale_json="${stale_json},"; fi
|
|
232
|
+
stale_json="${stale_json}${content}"
|
|
233
|
+
fi
|
|
234
|
+
done
|
|
235
|
+
|
|
236
|
+
stale_json="${stale_json}]"
|
|
237
|
+
echo "$stale_json"
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
cmd_clean() {
|
|
241
|
+
local cleaned=0
|
|
242
|
+
|
|
243
|
+
for lf in "$SESSIONS_DIR"/*.lock; do
|
|
244
|
+
[[ -f "$lf" ]] || continue
|
|
245
|
+
[[ "$lf" == *.flock ]] && continue
|
|
246
|
+
|
|
247
|
+
local content
|
|
248
|
+
content=$(cat "$lf" 2>/dev/null) || continue
|
|
249
|
+
local pid session_id
|
|
250
|
+
pid=$(echo "$content" | grep -o '"pid": *[0-9]*' | grep -o '[0-9]*') || continue
|
|
251
|
+
session_id=$(echo "$content" | grep -o '"id": *"[^"]*"' | sed 's/"id": *"//;s/"//') || continue
|
|
252
|
+
|
|
253
|
+
local age
|
|
254
|
+
age=$(file_age_seconds "$lf")
|
|
255
|
+
local alive=true
|
|
256
|
+
pid_alive "$pid" || alive=false
|
|
257
|
+
|
|
258
|
+
if [[ $age -gt $HEARTBEAT_STALE_SECONDS ]] || [[ "$alive" == "false" ]]; then
|
|
259
|
+
rm -f "$lf" "${lf}.flock"
|
|
260
|
+
emit_event "$session_id" "session:stale-cleaned"
|
|
261
|
+
cleaned=$((cleaned + 1))
|
|
262
|
+
fi
|
|
263
|
+
done
|
|
264
|
+
|
|
265
|
+
echo "cleaned: $cleaned"
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
cmd_claim() {
|
|
269
|
+
local session_id="$1"
|
|
270
|
+
local paths_csv="$2"
|
|
271
|
+
local lf
|
|
272
|
+
lf="$(lock_file "$session_id")"
|
|
273
|
+
|
|
274
|
+
if [[ ! -f "$lf" ]]; then
|
|
275
|
+
echo "error: no lock file for $session_id" >&2
|
|
276
|
+
return 1
|
|
277
|
+
fi
|
|
278
|
+
|
|
279
|
+
# Build JSON array from CSV
|
|
280
|
+
local json_arr="["
|
|
281
|
+
local first=true
|
|
282
|
+
IFS=',' read -ra PATHS <<< "$paths_csv"
|
|
283
|
+
for p in "${PATHS[@]}"; do
|
|
284
|
+
if [[ "$first" == "true" ]]; then first=false; else json_arr="${json_arr},"; fi
|
|
285
|
+
json_arr="${json_arr}\"${p}\""
|
|
286
|
+
done
|
|
287
|
+
json_arr="${json_arr}]"
|
|
288
|
+
|
|
289
|
+
local content
|
|
290
|
+
content=$(cat "$lf")
|
|
291
|
+
local updated
|
|
292
|
+
updated=$(echo "$content" | sed "s/\"claiming\": *\[[^]]*\]/\"claiming\": ${json_arr}/")
|
|
293
|
+
updated=$(echo "$updated" | sed "s/\"heartbeat\": *\"[^\"]*\"/\"heartbeat\": \"$(now_iso)\"/")
|
|
294
|
+
flock_write "$lf" "$updated"
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
cmd_check_claim() {
|
|
298
|
+
local session_id="$1"
|
|
299
|
+
local check_path="$2"
|
|
300
|
+
local conflicts=""
|
|
301
|
+
|
|
302
|
+
for lf in "$SESSIONS_DIR"/*.lock; do
|
|
303
|
+
[[ -f "$lf" ]] || continue
|
|
304
|
+
[[ "$lf" == *.flock ]] && continue
|
|
305
|
+
|
|
306
|
+
local content
|
|
307
|
+
content=$(cat "$lf" 2>/dev/null) || continue
|
|
308
|
+
local other_id
|
|
309
|
+
other_id=$(echo "$content" | grep -o '"id": *"[^"]*"' | sed 's/"id": *"//;s/"//') || continue
|
|
310
|
+
[[ "$other_id" == "$session_id" ]] && continue
|
|
311
|
+
|
|
312
|
+
# Check PID alive and not stale
|
|
313
|
+
local pid
|
|
314
|
+
pid=$(echo "$content" | grep -o '"pid": *[0-9]*' | grep -o '[0-9]*') || continue
|
|
315
|
+
local age
|
|
316
|
+
age=$(file_age_seconds "$lf")
|
|
317
|
+
if [[ $age -gt $HEARTBEAT_STALE_SECONDS ]]; then continue; fi
|
|
318
|
+
pid_alive "$pid" || continue
|
|
319
|
+
|
|
320
|
+
# Extract claiming array (simple grep, not full JSON parse)
|
|
321
|
+
local claims
|
|
322
|
+
claims=$(echo "$content" | grep -o '"claiming": *\[[^]]*\]' | sed 's/"claiming": *\[//;s/\]//;s/"//g;s/,/ /g')
|
|
323
|
+
|
|
324
|
+
for claimed in $claims; do
|
|
325
|
+
if [[ "$check_path" == "$claimed"* ]] || [[ "$claimed" == "$check_path"* ]]; then
|
|
326
|
+
conflicts="${conflicts}${other_id}:${claimed} "
|
|
327
|
+
fi
|
|
328
|
+
done
|
|
329
|
+
done
|
|
330
|
+
|
|
331
|
+
if [[ -n "$conflicts" ]]; then
|
|
332
|
+
echo "conflict: $conflicts"
|
|
333
|
+
return 1
|
|
334
|
+
else
|
|
335
|
+
echo "clear"
|
|
336
|
+
return 0
|
|
337
|
+
fi
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
cmd_merge() {
|
|
341
|
+
local session_branch="$1"
|
|
342
|
+
local target_branch="$2"
|
|
343
|
+
local session_id="$3"
|
|
344
|
+
local work_dir="${4:-$REPO_DIR}"
|
|
345
|
+
|
|
346
|
+
# Enqueue
|
|
347
|
+
local entry="{\"session\":\"${session_id}\",\"branch\":\"${session_branch}\",\"targetBranch\":\"${target_branch}\",\"ts\":\"$(now_iso)\",\"status\":\"pending\"}"
|
|
348
|
+
flock_append "$(merge_queue)" "$entry"
|
|
349
|
+
emit_event "$session_id" "merge:enqueued" "branch=$session_branch" "target=$target_branch"
|
|
350
|
+
|
|
351
|
+
# Acquire merge lock with timeout
|
|
352
|
+
local ml
|
|
353
|
+
ml="$(merge_lock)"
|
|
354
|
+
local deadline=$(( $(date +%s) + MERGE_LOCK_TIMEOUT_SECONDS ))
|
|
355
|
+
|
|
356
|
+
while true; do
|
|
357
|
+
if (set -o noclobber; echo "{\"session\":\"${session_id}\",\"ts\":\"$(now_iso)\"}" > "$ml") 2>/dev/null; then
|
|
358
|
+
break
|
|
359
|
+
fi
|
|
360
|
+
|
|
361
|
+
# Check if existing lock is stale
|
|
362
|
+
if [[ -f "$ml" ]]; then
|
|
363
|
+
local lock_age
|
|
364
|
+
lock_age=$(file_age_seconds "$ml")
|
|
365
|
+
if [[ $lock_age -gt $MERGE_LOCK_TIMEOUT_SECONDS ]]; then
|
|
366
|
+
rm -f "$ml"
|
|
367
|
+
continue
|
|
368
|
+
fi
|
|
369
|
+
fi
|
|
370
|
+
|
|
371
|
+
if [[ $(date +%s) -ge $deadline ]]; then
|
|
372
|
+
echo "error: merge lock timeout after ${MERGE_LOCK_TIMEOUT_SECONDS}s" >&2
|
|
373
|
+
return 1
|
|
374
|
+
fi
|
|
375
|
+
|
|
376
|
+
sleep "$MERGE_RETRY_SECONDS"
|
|
377
|
+
done
|
|
378
|
+
|
|
379
|
+
# We have the lock — merge
|
|
380
|
+
trap 'rm -f "$ml"' EXIT
|
|
381
|
+
|
|
382
|
+
emit_event "$session_id" "merge:start" "branch=$session_branch" "target=$target_branch"
|
|
383
|
+
|
|
384
|
+
cd "$work_dir"
|
|
385
|
+
|
|
386
|
+
if ! git checkout "$target_branch" 2>&1; then
|
|
387
|
+
echo "error: failed to checkout $target_branch" >&2
|
|
388
|
+
rm -f "$ml"
|
|
389
|
+
trap - EXIT
|
|
390
|
+
return 1
|
|
391
|
+
fi
|
|
392
|
+
|
|
393
|
+
# Pull latest target
|
|
394
|
+
git pull --rebase origin "$target_branch" 2>/dev/null || {
|
|
395
|
+
git rebase --abort 2>/dev/null || true
|
|
396
|
+
git pull origin "$target_branch" 2>/dev/null || true
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
# Merge session branch
|
|
400
|
+
if git merge "$session_branch" --no-ff -m "merge: session ${session_id} (${session_branch})" 2>&1; then
|
|
401
|
+
git push origin "$target_branch" 2>/dev/null || true
|
|
402
|
+
emit_event "$session_id" "merge:complete" "branch=$session_branch" "target=$target_branch"
|
|
403
|
+
echo "merged: $session_branch -> $target_branch"
|
|
404
|
+
rm -f "$ml"
|
|
405
|
+
trap - EXIT
|
|
406
|
+
return 0
|
|
407
|
+
else
|
|
408
|
+
# Conflict
|
|
409
|
+
local conflict_files
|
|
410
|
+
conflict_files=$(git diff --name-only --diff-filter=U 2>/dev/null || echo "unknown")
|
|
411
|
+
git merge --abort 2>/dev/null || true
|
|
412
|
+
emit_event "$session_id" "merge:conflict" "branch=$session_branch" "target=$target_branch"
|
|
413
|
+
echo "conflict: $conflict_files" >&2
|
|
414
|
+
rm -f "$ml"
|
|
415
|
+
trap - EXIT
|
|
416
|
+
return 1
|
|
417
|
+
fi
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
cmd_emit() {
|
|
421
|
+
local session_id="$1"
|
|
422
|
+
local event_type="$2"
|
|
423
|
+
shift 2 || true
|
|
424
|
+
emit_event "$session_id" "$event_type" "$@"
|
|
425
|
+
echo "emitted: $event_type"
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
# ---------------------------------------------------------------------------
|
|
429
|
+
# Dispatch
|
|
430
|
+
# ---------------------------------------------------------------------------
|
|
431
|
+
|
|
432
|
+
case "${1:-help}" in
|
|
433
|
+
register) cmd_register "${2:?session-id required}" "${3:?branch required}" "${4:-null}" ;;
|
|
434
|
+
heartbeat) cmd_heartbeat "${2:?session-id required}" ;;
|
|
435
|
+
unregister) cmd_unregister "${2:?session-id required}" ;;
|
|
436
|
+
active) cmd_active ;;
|
|
437
|
+
count) cmd_count ;;
|
|
438
|
+
stale) cmd_stale ;;
|
|
439
|
+
clean) cmd_clean ;;
|
|
440
|
+
claim) cmd_claim "${2:?session-id required}" "${3:?paths required}" ;;
|
|
441
|
+
check-claim) cmd_check_claim "${2:?session-id required}" "${3:?path required}" ;;
|
|
442
|
+
merge) cmd_merge "${2:?session-branch required}" "${3:?target-branch required}" "${4:?session-id required}" "${5:-}" ;;
|
|
443
|
+
emit) cmd_emit "${2:?session-id required}" "${3:?event-type required}" "${@:4}" ;;
|
|
444
|
+
help|--help|-h)
|
|
445
|
+
echo "Usage: session-lock.sh <command> [args]"
|
|
446
|
+
echo ""
|
|
447
|
+
echo "Commands:"
|
|
448
|
+
echo " register <id> <branch> [worktree] Register a new session"
|
|
449
|
+
echo " heartbeat <id> Update session heartbeat"
|
|
450
|
+
echo " unregister <id> Remove session lock"
|
|
451
|
+
echo " active List active sessions (JSON)"
|
|
452
|
+
echo " count Count active sessions"
|
|
453
|
+
echo " stale List stale sessions (JSON)"
|
|
454
|
+
echo " clean Remove stale lock files"
|
|
455
|
+
echo " claim <id> <path,path,...> Declare file claims"
|
|
456
|
+
echo " check-claim <id> <path> Check for claim conflicts"
|
|
457
|
+
echo " merge <branch> <target> <id> [cwd] Sequenced merge with lock"
|
|
458
|
+
echo " emit <id> <event> [key=val...] Emit event"
|
|
459
|
+
;;
|
|
460
|
+
*)
|
|
461
|
+
echo "Unknown command: $1 (try --help)" >&2
|
|
462
|
+
exit 1
|
|
463
|
+
;;
|
|
464
|
+
esac
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
#
|
|
3
|
+
# session-start-hub.sh — Session init via Context Hub API
|
|
4
|
+
#
|
|
5
|
+
# Ensures hub is running, then calls POST /api/session/init.
|
|
6
|
+
# Falls back to session-init.sh if hub is unavailable.
|
|
7
|
+
#
|
|
8
|
+
# @purpose Hub-first session initialization with script fallback
|
|
9
|
+
|
|
10
|
+
set -e
|
|
11
|
+
|
|
12
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
13
|
+
REPO_DIR="${JFL_REPO_DIR:-$(pwd)}"
|
|
14
|
+
RUNTIME="${1:-claude-code}"
|
|
15
|
+
|
|
16
|
+
GREEN='\033[0;32m'
|
|
17
|
+
YELLOW='\033[1;33m'
|
|
18
|
+
NC='\033[0m'
|
|
19
|
+
|
|
20
|
+
cd "$REPO_DIR" || exit 1
|
|
21
|
+
|
|
22
|
+
# Ensure .jfl directories exist before any logging
|
|
23
|
+
mkdir -p .jfl/logs .jfl/journal
|
|
24
|
+
|
|
25
|
+
echo ""
|
|
26
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
27
|
+
echo " JFL Session Init"
|
|
28
|
+
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
29
|
+
|
|
30
|
+
# Step 1: Ensure Context Hub is running
|
|
31
|
+
jfl context-hub ensure >> .jfl/logs/context-hub.log 2>&1 || true
|
|
32
|
+
|
|
33
|
+
# Step 2: Read port and token
|
|
34
|
+
PORT=$(jq -r '.contextHub.port // empty' .jfl/config.json 2>/dev/null)
|
|
35
|
+
if [ -z "$PORT" ]; then
|
|
36
|
+
# Try runtime port file
|
|
37
|
+
PORT=$(cat .jfl/context-hub.port 2>/dev/null)
|
|
38
|
+
fi
|
|
39
|
+
if [ -z "$PORT" ]; then
|
|
40
|
+
PORT="4242"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
TOKEN=$(cat .jfl/context-hub.token 2>/dev/null || echo "")
|
|
44
|
+
AUTH_HEADER=""
|
|
45
|
+
if [ -n "$TOKEN" ]; then
|
|
46
|
+
AUTH_HEADER="Authorization: Bearer $TOKEN"
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# Step 3: Call Hub API
|
|
50
|
+
HUB_URL="http://localhost:${PORT}"
|
|
51
|
+
RESULT=""
|
|
52
|
+
|
|
53
|
+
if curl -sf "$HUB_URL/health" >/dev/null 2>&1; then
|
|
54
|
+
RESULT=$(curl -sf -X POST "$HUB_URL/api/session/init" \
|
|
55
|
+
-H "Content-Type: application/json" \
|
|
56
|
+
${AUTH_HEADER:+-H "$AUTH_HEADER"} \
|
|
57
|
+
-d "{\"runtime\":\"$RUNTIME\"}" \
|
|
58
|
+
--max-time 90 2>/dev/null) || RESULT=""
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
if [ -n "$RESULT" ]; then
|
|
62
|
+
# Parse Hub response
|
|
63
|
+
BRANCH=$(echo "$RESULT" | jq -r '.branch // "unknown"' 2>/dev/null)
|
|
64
|
+
SYNC_OK=$(echo "$RESULT" | jq -r '.syncOk // false' 2>/dev/null)
|
|
65
|
+
DOC_ERRORS=$(echo "$RESULT" | jq -r '.doctor.errors // 0' 2>/dev/null)
|
|
66
|
+
DOC_WARNINGS=$(echo "$RESULT" | jq -r '.doctor.warnings // 0' 2>/dev/null)
|
|
67
|
+
WARNINGS=$(echo "$RESULT" | jq -r '.warnings[]?' 2>/dev/null)
|
|
68
|
+
|
|
69
|
+
if [ "$SYNC_OK" = "true" ]; then
|
|
70
|
+
echo -e "${GREEN}✓${NC} Repos synced"
|
|
71
|
+
else
|
|
72
|
+
echo -e "${YELLOW}⚠${NC} Sync had warnings"
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
if [ "$DOC_ERRORS" -gt 0 ] 2>/dev/null; then
|
|
76
|
+
echo -e "${YELLOW}⚠${NC} Doctor: $DOC_ERRORS errors, $DOC_WARNINGS warnings"
|
|
77
|
+
elif [ "$DOC_WARNINGS" -gt 0 ] 2>/dev/null; then
|
|
78
|
+
echo -e "${GREEN}✓${NC} Doctor: $DOC_WARNINGS warnings"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
if [ -n "$WARNINGS" ]; then
|
|
82
|
+
echo "$WARNINGS" | while IFS= read -r w; do
|
|
83
|
+
echo -e "${YELLOW}⚠${NC} $w"
|
|
84
|
+
done
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
echo -e "${GREEN}✓${NC} Session branch: $BRANCH"
|
|
88
|
+
|
|
89
|
+
# Start auto-commit daemon (Hub doesn't do this — needs a local detached process)
|
|
90
|
+
if [ -x "$SCRIPT_DIR/auto-commit.sh" ]; then
|
|
91
|
+
"$SCRIPT_DIR/auto-commit.sh" start >> .jfl/logs/auto-commit.log 2>&1 &
|
|
92
|
+
echo -e "${GREEN}✓${NC} Auto-commit started"
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
echo -e "${GREEN}✓${NC} Session ready (via Hub)"
|
|
96
|
+
echo ""
|
|
97
|
+
else
|
|
98
|
+
# Fallback: run session-init.sh directly
|
|
99
|
+
echo -e "${YELLOW}→${NC} Hub unavailable, falling back to local init"
|
|
100
|
+
if [ -x "$SCRIPT_DIR/session-init.sh" ]; then
|
|
101
|
+
"$SCRIPT_DIR/session-init.sh"
|
|
102
|
+
else
|
|
103
|
+
echo -e "${YELLOW}⚠${NC} No session-init.sh found"
|
|
104
|
+
fi
|
|
105
|
+
fi
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: JFL Eval
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize]
|
|
6
|
+
branches: [main]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
eval:
|
|
10
|
+
uses: 402goose/jfl-cli/.github/workflows/jfl-eval.yml@main
|
|
11
|
+
with:
|
|
12
|
+
test-command: 'npx jest --json --silent'
|
|
13
|
+
branch-prefix: 'pp/'
|
|
14
|
+
auto-merge: true
|
|
15
|
+
retrain-threshold: 50
|
|
16
|
+
secrets:
|
|
17
|
+
STRATUS_API_KEY: ${{ secrets.STRATUS_API_KEY }}
|
|
18
|
+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
19
|
+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|