@matteeh/osq 0.1.0 → 0.2.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/README.md +415 -72
- package/dist/cli/approve.d.ts +13 -3
- package/dist/cli/approve.d.ts.map +1 -1
- package/dist/cli/approve.js +59 -4
- package/dist/cli/approve.js.map +1 -1
- package/dist/cli/bin.js +0 -0
- package/dist/cli/confirm.d.ts +21 -0
- package/dist/cli/confirm.d.ts.map +1 -0
- package/dist/cli/confirm.js +28 -0
- package/dist/cli/confirm.js.map +1 -0
- package/dist/cli/doctor.d.ts +13 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +23 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/done.d.ts +12 -0
- package/dist/cli/done.d.ts.map +1 -0
- package/dist/cli/done.js +26 -0
- package/dist/cli/done.js.map +1 -0
- package/dist/cli/inbox.d.ts +22 -0
- package/dist/cli/inbox.d.ts.map +1 -0
- package/dist/cli/inbox.js +41 -0
- package/dist/cli/inbox.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +127 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.d.ts +1 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +9 -3
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/lint.d.ts +26 -0
- package/dist/cli/lint.d.ts.map +1 -0
- package/dist/cli/lint.js +60 -0
- package/dist/cli/lint.js.map +1 -0
- package/dist/cli/migrate.d.ts +18 -0
- package/dist/cli/migrate.d.ts.map +1 -0
- package/dist/cli/migrate.js +42 -0
- package/dist/cli/migrate.js.map +1 -0
- package/dist/cli/new.js +1 -1
- package/dist/cli/new.js.map +1 -1
- package/dist/cli/plan-queue.d.ts +50 -0
- package/dist/cli/plan-queue.d.ts.map +1 -0
- package/dist/cli/plan-queue.js +167 -0
- package/dist/cli/plan-queue.js.map +1 -0
- package/dist/cli/plan.d.ts +35 -0
- package/dist/cli/plan.d.ts.map +1 -0
- package/dist/cli/plan.js +153 -0
- package/dist/cli/plan.js.map +1 -0
- package/dist/cli/queue.d.ts +9 -0
- package/dist/cli/queue.d.ts.map +1 -0
- package/dist/cli/queue.js +24 -0
- package/dist/cli/queue.js.map +1 -0
- package/dist/cli/reject.d.ts +8 -0
- package/dist/cli/reject.d.ts.map +1 -0
- package/dist/cli/reject.js +18 -0
- package/dist/cli/reject.js.map +1 -0
- package/dist/cli/report.d.ts +1 -1
- package/dist/cli/report.d.ts.map +1 -1
- package/dist/cli/report.js +141 -14
- package/dist/cli/report.js.map +1 -1
- package/dist/cli/retry.d.ts +7 -0
- package/dist/cli/retry.d.ts.map +1 -0
- package/dist/cli/retry.js +29 -0
- package/dist/cli/retry.js.map +1 -0
- package/dist/cli/serve.d.ts +30 -0
- package/dist/cli/serve.d.ts.map +1 -0
- package/dist/cli/serve.js +136 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +7 -1
- package/dist/cli/setup.js.map +1 -1
- package/dist/cli/show.d.ts +2 -1
- package/dist/cli/show.d.ts.map +1 -1
- package/dist/cli/show.js +20 -3
- package/dist/cli/show.js.map +1 -1
- package/dist/cli/status.d.ts +1 -1
- package/dist/cli/status.d.ts.map +1 -1
- package/dist/cli/status.js +2 -2
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/watch.d.ts +9 -6
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +15 -2
- package/dist/cli/watch.js.map +1 -1
- package/dist/core/foundation/config-codex.d.ts +22 -0
- package/dist/core/foundation/config-codex.d.ts.map +1 -0
- package/dist/core/foundation/config-codex.js +58 -0
- package/dist/core/foundation/config-codex.js.map +1 -0
- package/dist/core/foundation/config-doctor.d.ts +14 -0
- package/dist/core/foundation/config-doctor.d.ts.map +1 -0
- package/dist/core/foundation/config-doctor.js +29 -0
- package/dist/core/foundation/config-doctor.js.map +1 -0
- package/dist/core/foundation/config-env.d.ts +3 -0
- package/dist/core/foundation/config-env.d.ts.map +1 -0
- package/dist/core/foundation/config-env.js +22 -0
- package/dist/core/foundation/config-env.js.map +1 -0
- package/dist/core/foundation/config-gates.d.ts +22 -0
- package/dist/core/foundation/config-gates.d.ts.map +1 -0
- package/dist/core/foundation/config-gates.js +43 -0
- package/dist/core/foundation/config-gates.js.map +1 -0
- package/dist/core/foundation/config-pi.d.ts +64 -0
- package/dist/core/foundation/config-pi.d.ts.map +1 -0
- package/dist/core/foundation/config-pi.js +131 -0
- package/dist/core/foundation/config-pi.js.map +1 -0
- package/dist/core/foundation/config-planning.d.ts +24 -0
- package/dist/core/foundation/config-planning.d.ts.map +1 -0
- package/dist/core/foundation/config-planning.js +60 -0
- package/dist/core/foundation/config-planning.js.map +1 -0
- package/dist/core/foundation/config-queue.d.ts +15 -0
- package/dist/core/foundation/config-queue.d.ts.map +1 -0
- package/dist/core/foundation/config-queue.js +24 -0
- package/dist/core/foundation/config-queue.js.map +1 -0
- package/dist/core/foundation/config-serve.d.ts +20 -0
- package/dist/core/foundation/config-serve.d.ts.map +1 -0
- package/dist/core/foundation/config-serve.js +35 -0
- package/dist/core/foundation/config-serve.js.map +1 -0
- package/dist/core/{config.d.ts → foundation/config.d.ts} +34 -3
- package/dist/core/foundation/config.d.ts.map +1 -0
- package/dist/core/{config.js → foundation/config.js} +35 -18
- package/dist/core/foundation/config.js.map +1 -0
- package/dist/core/foundation/doctor-managed.d.ts +13 -0
- package/dist/core/foundation/doctor-managed.d.ts.map +1 -0
- package/dist/core/foundation/doctor-managed.js +77 -0
- package/dist/core/foundation/doctor-managed.js.map +1 -0
- package/dist/core/foundation/doctor.d.ts +19 -0
- package/dist/core/foundation/doctor.d.ts.map +1 -0
- package/dist/core/foundation/doctor.js +187 -0
- package/dist/core/foundation/doctor.js.map +1 -0
- package/dist/core/foundation/harness-catalog.d.ts +96 -0
- package/dist/core/foundation/harness-catalog.d.ts.map +1 -0
- package/dist/core/foundation/harness-catalog.js +182 -0
- package/dist/core/foundation/harness-catalog.js.map +1 -0
- package/dist/core/foundation/init-blocks.d.ts +33 -0
- package/dist/core/foundation/init-blocks.d.ts.map +1 -0
- package/dist/core/foundation/init-blocks.js +165 -0
- package/dist/core/foundation/init-blocks.js.map +1 -0
- package/dist/core/foundation/init-managed.d.ts +10 -0
- package/dist/core/foundation/init-managed.d.ts.map +1 -0
- package/dist/core/foundation/init-managed.js +115 -0
- package/dist/core/foundation/init-managed.js.map +1 -0
- package/dist/core/foundation/init.d.ts +18 -0
- package/dist/core/foundation/init.d.ts.map +1 -0
- package/dist/core/foundation/init.js +113 -0
- package/dist/core/foundation/init.js.map +1 -0
- package/dist/core/{logger.d.ts → foundation/logger.d.ts} +1 -0
- package/dist/core/foundation/logger.d.ts.map +1 -0
- package/dist/core/{logger.js → foundation/logger.js} +18 -2
- package/dist/core/foundation/logger.js.map +1 -0
- package/dist/core/{new.d.ts → foundation/new.d.ts} +3 -0
- package/dist/core/foundation/new.d.ts.map +1 -0
- package/dist/core/foundation/new.js +206 -0
- package/dist/core/foundation/new.js.map +1 -0
- package/dist/core/foundation/package-root.d.ts +9 -0
- package/dist/core/foundation/package-root.d.ts.map +1 -0
- package/dist/core/foundation/package-root.js +11 -0
- package/dist/core/foundation/package-root.js.map +1 -0
- package/dist/core/lifecycle/done.d.ts +17 -0
- package/dist/core/lifecycle/done.d.ts.map +1 -0
- package/dist/core/lifecycle/done.js +97 -0
- package/dist/core/lifecycle/done.js.map +1 -0
- package/dist/core/lifecycle/reject.d.ts +26 -0
- package/dist/core/lifecycle/reject.d.ts.map +1 -0
- package/dist/core/lifecycle/reject.js +83 -0
- package/dist/core/lifecycle/reject.js.map +1 -0
- package/dist/core/lifecycle/retry-transition.d.ts +23 -0
- package/dist/core/lifecycle/retry-transition.d.ts.map +1 -0
- package/dist/core/lifecycle/retry-transition.js +41 -0
- package/dist/core/lifecycle/retry-transition.js.map +1 -0
- package/dist/core/lifecycle/retry.d.ts +18 -0
- package/dist/core/lifecycle/retry.d.ts.map +1 -0
- package/dist/core/lifecycle/retry.js +179 -0
- package/dist/core/lifecycle/retry.js.map +1 -0
- package/dist/core/report/approval-flags.d.ts +29 -0
- package/dist/core/report/approval-flags.d.ts.map +1 -0
- package/dist/core/report/approval-flags.js +138 -0
- package/dist/core/report/approval-flags.js.map +1 -0
- package/dist/core/report/planning-economics.d.ts +39 -0
- package/dist/core/report/planning-economics.d.ts.map +1 -0
- package/dist/core/report/planning-economics.js +168 -0
- package/dist/core/report/planning-economics.js.map +1 -0
- package/dist/core/report/planning-observed.d.ts +59 -0
- package/dist/core/report/planning-observed.d.ts.map +1 -0
- package/dist/core/report/planning-observed.js +135 -0
- package/dist/core/report/planning-observed.js.map +1 -0
- package/dist/core/report/planning-records.d.ts +69 -0
- package/dist/core/report/planning-records.d.ts.map +1 -0
- package/dist/core/report/planning-records.js +149 -0
- package/dist/core/report/planning-records.js.map +1 -0
- package/dist/core/report/planning-slice-lookup.d.ts +13 -0
- package/dist/core/report/planning-slice-lookup.d.ts.map +1 -0
- package/dist/core/report/planning-slice-lookup.js +146 -0
- package/dist/core/report/planning-slice-lookup.js.map +1 -0
- package/dist/core/report/planning-slice-measures.d.ts +17 -0
- package/dist/core/report/planning-slice-measures.d.ts.map +1 -0
- package/dist/core/report/planning-slice-measures.js +85 -0
- package/dist/core/report/planning-slice-measures.js.map +1 -0
- package/dist/core/report/planning-slice-record.d.ts +4 -0
- package/dist/core/report/planning-slice-record.d.ts.map +1 -0
- package/dist/core/report/planning-slice-record.js +66 -0
- package/dist/core/report/planning-slice-record.js.map +1 -0
- package/dist/core/report/planning-slice-turns.d.ts +13 -0
- package/dist/core/report/planning-slice-turns.d.ts.map +1 -0
- package/dist/core/report/planning-slice-turns.js +41 -0
- package/dist/core/report/planning-slice-turns.js.map +1 -0
- package/dist/core/report/planning-slice.d.ts +70 -0
- package/dist/core/report/planning-slice.d.ts.map +1 -0
- package/dist/core/report/planning-slice.js +147 -0
- package/dist/core/report/planning-slice.js.map +1 -0
- package/dist/core/report/planning.d.ts +31 -0
- package/dist/core/report/planning.d.ts.map +1 -0
- package/dist/core/report/planning.js +75 -0
- package/dist/core/report/planning.js.map +1 -0
- package/dist/core/report/report-events.d.ts +52 -0
- package/dist/core/report/report-events.d.ts.map +1 -0
- package/dist/core/report/report-events.js +198 -0
- package/dist/core/report/report-events.js.map +1 -0
- package/dist/core/report/report-pre-spawn.d.ts +25 -0
- package/dist/core/report/report-pre-spawn.d.ts.map +1 -0
- package/dist/core/report/report-pre-spawn.js +40 -0
- package/dist/core/report/report-pre-spawn.js.map +1 -0
- package/dist/core/report/report-retries.d.ts +30 -0
- package/dist/core/report/report-retries.d.ts.map +1 -0
- package/dist/core/report/report-retries.js +100 -0
- package/dist/core/report/report-retries.js.map +1 -0
- package/dist/core/report/report.d.ts +276 -0
- package/dist/core/report/report.d.ts.map +1 -0
- package/dist/core/report/report.js +1421 -0
- package/dist/core/report/report.js.map +1 -0
- package/dist/core/{lock.d.ts → run/lock.d.ts} +6 -0
- package/dist/core/run/lock.d.ts.map +1 -0
- package/dist/core/{lock.js → run/lock.js} +7 -15
- package/dist/core/run/lock.js.map +1 -0
- package/dist/core/run/manifest.d.ts +39 -0
- package/dist/core/run/manifest.d.ts.map +1 -0
- package/dist/core/run/manifest.js +137 -0
- package/dist/core/run/manifest.js.map +1 -0
- package/dist/core/run/scope-hash.d.ts +71 -0
- package/dist/core/run/scope-hash.d.ts.map +1 -0
- package/dist/core/run/scope-hash.js +177 -0
- package/dist/core/run/scope-hash.js.map +1 -0
- package/dist/core/run/scope.d.ts +30 -0
- package/dist/core/run/scope.d.ts.map +1 -0
- package/dist/core/run/scope.js +193 -0
- package/dist/core/run/scope.js.map +1 -0
- package/dist/core/run/summary.d.ts +8 -0
- package/dist/core/run/summary.d.ts.map +1 -0
- package/dist/core/run/summary.js +25 -0
- package/dist/core/run/summary.js.map +1 -0
- package/dist/core/run/verification.d.ts +23 -0
- package/dist/core/run/verification.d.ts.map +1 -0
- package/dist/core/run/verification.js +78 -0
- package/dist/core/run/verification.js.map +1 -0
- package/dist/core/spec/approve.d.ts +31 -0
- package/dist/core/spec/approve.d.ts.map +1 -0
- package/dist/core/spec/approve.js +111 -0
- package/dist/core/spec/approve.js.map +1 -0
- package/dist/core/spec/delta.d.ts +77 -0
- package/dist/core/spec/delta.d.ts.map +1 -0
- package/dist/core/spec/delta.js +581 -0
- package/dist/core/spec/delta.js.map +1 -0
- package/dist/core/spec/digest-flags.d.ts +21 -0
- package/dist/core/spec/digest-flags.d.ts.map +1 -0
- package/dist/core/spec/digest-flags.js +194 -0
- package/dist/core/spec/digest-flags.js.map +1 -0
- package/dist/core/spec/digest-verify-starts.d.ts +5 -0
- package/dist/core/spec/digest-verify-starts.d.ts.map +1 -0
- package/dist/core/spec/digest-verify-starts.js +31 -0
- package/dist/core/spec/digest-verify-starts.js.map +1 -0
- package/dist/core/spec/digest.d.ts +42 -0
- package/dist/core/spec/digest.d.ts.map +1 -0
- package/dist/core/spec/digest.js +170 -0
- package/dist/core/spec/digest.js.map +1 -0
- package/dist/core/spec/hasher.d.ts +11 -0
- package/dist/core/spec/hasher.d.ts.map +1 -0
- package/dist/core/{hasher.js → spec/hasher.js} +27 -3
- package/dist/core/spec/hasher.js.map +1 -0
- package/dist/core/spec/linter.d.ts +79 -0
- package/dist/core/spec/linter.d.ts.map +1 -0
- package/dist/core/spec/linter.js +826 -0
- package/dist/core/spec/linter.js.map +1 -0
- package/dist/core/spec/migrate.d.ts +54 -0
- package/dist/core/spec/migrate.d.ts.map +1 -0
- package/dist/core/spec/migrate.js +297 -0
- package/dist/core/spec/migrate.js.map +1 -0
- package/dist/core/spec/openspec-version.d.ts +30 -0
- package/dist/core/spec/openspec-version.d.ts.map +1 -0
- package/dist/core/spec/openspec-version.js +118 -0
- package/dist/core/spec/openspec-version.js.map +1 -0
- package/dist/core/spec/parser.d.ts +82 -0
- package/dist/core/spec/parser.d.ts.map +1 -0
- package/dist/core/spec/parser.js +221 -0
- package/dist/core/spec/parser.js.map +1 -0
- package/dist/core/spec/verify-paths.d.ts +18 -0
- package/dist/core/spec/verify-paths.d.ts.map +1 -0
- package/dist/core/spec/verify-paths.js +139 -0
- package/dist/core/spec/verify-paths.js.map +1 -0
- package/dist/core/spec/verify-starts.d.ts +45 -0
- package/dist/core/spec/verify-starts.d.ts.map +1 -0
- package/dist/core/spec/verify-starts.js +61 -0
- package/dist/core/spec/verify-starts.js.map +1 -0
- package/dist/core/status/inbox-cursor.d.ts +10 -0
- package/dist/core/status/inbox-cursor.d.ts.map +1 -0
- package/dist/core/status/inbox-cursor.js +33 -0
- package/dist/core/status/inbox-cursor.js.map +1 -0
- package/dist/core/status/inbox-projection.d.ts +15 -0
- package/dist/core/status/inbox-projection.d.ts.map +1 -0
- package/dist/core/status/inbox-projection.js +20 -0
- package/dist/core/status/inbox-projection.js.map +1 -0
- package/dist/core/status/inbox-text.d.ts +4 -0
- package/dist/core/status/inbox-text.d.ts.map +1 -0
- package/dist/core/status/inbox-text.js +48 -0
- package/dist/core/status/inbox-text.js.map +1 -0
- package/dist/core/status/inbox.d.ts +53 -0
- package/dist/core/status/inbox.d.ts.map +1 -0
- package/dist/core/status/inbox.js +167 -0
- package/dist/core/status/inbox.js.map +1 -0
- package/dist/core/status/layout.d.ts +29 -0
- package/dist/core/status/layout.d.ts.map +1 -0
- package/dist/core/status/layout.js +77 -0
- package/dist/core/status/layout.js.map +1 -0
- package/dist/core/status/queue-parser.d.ts +13 -0
- package/dist/core/status/queue-parser.d.ts.map +1 -0
- package/dist/core/status/queue-parser.js +88 -0
- package/dist/core/status/queue-parser.js.map +1 -0
- package/dist/core/status/queue-planning.d.ts +62 -0
- package/dist/core/status/queue-planning.d.ts.map +1 -0
- package/dist/core/status/queue-planning.js +158 -0
- package/dist/core/status/queue-planning.js.map +1 -0
- package/dist/core/status/queue-report-detail.d.ts +50 -0
- package/dist/core/status/queue-report-detail.d.ts.map +1 -0
- package/dist/core/status/queue-report-detail.js +140 -0
- package/dist/core/status/queue-report-detail.js.map +1 -0
- package/dist/core/status/queue-report.d.ts +14 -0
- package/dist/core/status/queue-report.d.ts.map +1 -0
- package/dist/core/status/queue-report.js +41 -0
- package/dist/core/status/queue-report.js.map +1 -0
- package/dist/core/status/queue-state.d.ts +53 -0
- package/dist/core/status/queue-state.d.ts.map +1 -0
- package/dist/core/status/queue-state.js +167 -0
- package/dist/core/status/queue-state.js.map +1 -0
- package/dist/core/status/queue.d.ts +7 -0
- package/dist/core/status/queue.d.ts.map +1 -0
- package/dist/core/status/queue.js +4 -0
- package/dist/core/status/queue.js.map +1 -0
- package/dist/core/status/show.d.ts +102 -0
- package/dist/core/status/show.d.ts.map +1 -0
- package/dist/core/status/show.js +704 -0
- package/dist/core/status/show.js.map +1 -0
- package/dist/core/status/state.d.ts +56 -0
- package/dist/core/status/state.d.ts.map +1 -0
- package/dist/core/status/state.js +187 -0
- package/dist/core/status/state.js.map +1 -0
- package/dist/core/status/status.d.ts +23 -0
- package/dist/core/status/status.d.ts.map +1 -0
- package/dist/core/status/status.js +173 -0
- package/dist/core/status/status.js.map +1 -0
- package/dist/core/web/web-data-change.d.ts +10 -0
- package/dist/core/web/web-data-change.d.ts.map +1 -0
- package/dist/core/web/web-data-change.js +106 -0
- package/dist/core/web/web-data-change.js.map +1 -0
- package/dist/core/web/web-data-folders.d.ts +39 -0
- package/dist/core/web/web-data-folders.d.ts.map +1 -0
- package/dist/core/web/web-data-folders.js +125 -0
- package/dist/core/web/web-data-folders.js.map +1 -0
- package/dist/core/web/web-data-graph.d.ts +8 -0
- package/dist/core/web/web-data-graph.d.ts.map +1 -0
- package/dist/core/web/web-data-graph.js +113 -0
- package/dist/core/web/web-data-graph.js.map +1 -0
- package/dist/core/web/web-data-lifecycle.d.ts +43 -0
- package/dist/core/web/web-data-lifecycle.d.ts.map +1 -0
- package/dist/core/web/web-data-lifecycle.js +141 -0
- package/dist/core/web/web-data-lifecycle.js.map +1 -0
- package/dist/core/web/web-data-observations.d.ts +30 -0
- package/dist/core/web/web-data-observations.d.ts.map +1 -0
- package/dist/core/web/web-data-observations.js +181 -0
- package/dist/core/web/web-data-observations.js.map +1 -0
- package/dist/core/web/web-data-tokens.d.ts +29 -0
- package/dist/core/web/web-data-tokens.d.ts.map +1 -0
- package/dist/core/web/web-data-tokens.js +62 -0
- package/dist/core/web/web-data-tokens.js.map +1 -0
- package/dist/core/web/web-data-types.d.ts +156 -0
- package/dist/core/web/web-data-types.d.ts.map +1 -0
- package/dist/core/web/web-data-types.js +15 -0
- package/dist/core/web/web-data-types.js.map +1 -0
- package/dist/core/web/web-data.d.ts +10 -0
- package/dist/core/web/web-data.d.ts.map +1 -0
- package/dist/core/web/web-data.js +8 -0
- package/dist/core/web/web-data.js.map +1 -0
- package/dist/core/web/web-events.d.ts +54 -0
- package/dist/core/web/web-events.d.ts.map +1 -0
- package/dist/core/web/web-events.js +162 -0
- package/dist/core/web/web-events.js.map +1 -0
- package/dist/core/web/web-export.d.ts +18 -0
- package/dist/core/web/web-export.d.ts.map +1 -0
- package/dist/core/web/web-export.js +112 -0
- package/dist/core/web/web-export.js.map +1 -0
- package/dist/core/web/web-server.d.ts +34 -0
- package/dist/core/web/web-server.d.ts.map +1 -0
- package/dist/core/web/web-server.js +182 -0
- package/dist/core/web/web-server.js.map +1 -0
- package/dist/core/web/web-static.d.ts +20 -0
- package/dist/core/web/web-static.d.ts.map +1 -0
- package/dist/core/web/web-static.js +104 -0
- package/dist/core/web/web-static.js.map +1 -0
- package/dist/harness/{agy.d.ts → agy/agy.d.ts} +8 -6
- package/dist/harness/agy/agy.d.ts.map +1 -0
- package/dist/harness/{agy.js → agy/agy.js} +49 -34
- package/dist/harness/agy/agy.js.map +1 -0
- package/dist/harness/claude/claude-turns.d.ts +29 -0
- package/dist/harness/claude/claude-turns.d.ts.map +1 -0
- package/dist/harness/claude/claude-turns.js +162 -0
- package/dist/harness/claude/claude-turns.js.map +1 -0
- package/dist/harness/claude/claude-usage.d.ts +12 -0
- package/dist/harness/claude/claude-usage.d.ts.map +1 -0
- package/dist/harness/claude/claude-usage.js +144 -0
- package/dist/harness/claude/claude-usage.js.map +1 -0
- package/dist/harness/codex/codex-observe-usage.d.ts +6 -0
- package/dist/harness/codex/codex-observe-usage.d.ts.map +1 -0
- package/dist/harness/codex/codex-observe-usage.js +215 -0
- package/dist/harness/codex/codex-observe-usage.js.map +1 -0
- package/dist/harness/codex/codex-prompt.d.ts +17 -0
- package/dist/harness/codex/codex-prompt.d.ts.map +1 -0
- package/dist/harness/codex/codex-prompt.js +43 -0
- package/dist/harness/codex/codex-prompt.js.map +1 -0
- package/dist/harness/codex/codex-stream.d.ts +23 -0
- package/dist/harness/codex/codex-stream.d.ts.map +1 -0
- package/dist/harness/codex/codex-stream.js +182 -0
- package/dist/harness/codex/codex-stream.js.map +1 -0
- package/dist/harness/codex/codex-usage.d.ts +26 -0
- package/dist/harness/codex/codex-usage.d.ts.map +1 -0
- package/dist/harness/codex/codex-usage.js +122 -0
- package/dist/harness/codex/codex-usage.js.map +1 -0
- package/dist/harness/codex/codex.d.ts +16 -0
- package/dist/harness/codex/codex.d.ts.map +1 -0
- package/dist/harness/codex/codex.js +92 -0
- package/dist/harness/codex/codex.js.map +1 -0
- package/dist/harness/index.d.ts +11 -2
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +24 -9
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/mock.d.ts +5 -2
- package/dist/harness/mock.d.ts.map +1 -1
- package/dist/harness/mock.js +10 -11
- package/dist/harness/mock.js.map +1 -1
- package/dist/harness/opencode/opencode-observe-usage.d.ts +4 -0
- package/dist/harness/opencode/opencode-observe-usage.d.ts.map +1 -0
- package/dist/harness/opencode/opencode-observe-usage.js +100 -0
- package/dist/harness/opencode/opencode-observe-usage.js.map +1 -0
- package/dist/harness/opencode/opencode-usage.d.ts +24 -0
- package/dist/harness/opencode/opencode-usage.d.ts.map +1 -0
- package/dist/harness/opencode/opencode-usage.js +181 -0
- package/dist/harness/opencode/opencode-usage.js.map +1 -0
- package/dist/harness/{opencode.d.ts → opencode/opencode.d.ts} +10 -7
- package/dist/harness/opencode/opencode.d.ts.map +1 -0
- package/dist/harness/{opencode.js → opencode/opencode.js} +159 -70
- package/dist/harness/opencode/opencode.js.map +1 -0
- package/dist/harness/pi/pi-args.d.ts +9 -0
- package/dist/harness/pi/pi-args.d.ts.map +1 -0
- package/dist/harness/pi/pi-args.js +33 -0
- package/dist/harness/pi/pi-args.js.map +1 -0
- package/dist/harness/pi/pi-stream.d.ts +27 -0
- package/dist/harness/pi/pi-stream.d.ts.map +1 -0
- package/dist/harness/pi/pi-stream.js +176 -0
- package/dist/harness/pi/pi-stream.js.map +1 -0
- package/dist/harness/pi/pi-tools.d.ts +5 -0
- package/dist/harness/pi/pi-tools.d.ts.map +1 -0
- package/dist/harness/pi/pi-tools.js +31 -0
- package/dist/harness/pi/pi-tools.js.map +1 -0
- package/dist/harness/pi/pi.d.ts +11 -0
- package/dist/harness/pi/pi.d.ts.map +1 -0
- package/dist/harness/pi/pi.js +109 -0
- package/dist/harness/pi/pi.js.map +1 -0
- package/dist/harness/prompt.d.ts +11 -0
- package/dist/harness/prompt.d.ts.map +1 -0
- package/dist/harness/prompt.js +105 -0
- package/dist/harness/prompt.js.map +1 -0
- package/dist/harness/types.d.ts +287 -8
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js +125 -0
- package/dist/harness/types.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/watcher/archive-verify.d.ts +9 -0
- package/dist/watcher/archive-verify.d.ts.map +1 -0
- package/dist/watcher/archive-verify.js +80 -0
- package/dist/watcher/archive-verify.js.map +1 -0
- package/dist/watcher/archiver.d.ts +14 -2
- package/dist/watcher/archiver.d.ts.map +1 -1
- package/dist/watcher/archiver.js +112 -33
- package/dist/watcher/archiver.js.map +1 -1
- package/dist/watcher/attempt.d.ts +19 -0
- package/dist/watcher/attempt.d.ts.map +1 -0
- package/dist/watcher/attempt.js +94 -0
- package/dist/watcher/attempt.js.map +1 -0
- package/dist/watcher/auto-retry.d.ts +11 -0
- package/dist/watcher/auto-retry.d.ts.map +1 -0
- package/dist/watcher/auto-retry.js +180 -0
- package/dist/watcher/auto-retry.js.map +1 -0
- package/dist/watcher/build.d.ts +24 -0
- package/dist/watcher/build.d.ts.map +1 -0
- package/dist/watcher/build.js +169 -0
- package/dist/watcher/build.js.map +1 -0
- package/dist/watcher/change-verify.d.ts +25 -0
- package/dist/watcher/change-verify.d.ts.map +1 -0
- package/dist/watcher/change-verify.js +57 -0
- package/dist/watcher/change-verify.js.map +1 -0
- package/dist/watcher/dev.d.ts +51 -0
- package/dist/watcher/dev.d.ts.map +1 -0
- package/dist/watcher/dev.js +124 -0
- package/dist/watcher/dev.js.map +1 -0
- package/dist/watcher/failure-reason.d.ts +7 -0
- package/dist/watcher/failure-reason.d.ts.map +1 -0
- package/dist/watcher/failure-reason.js +2 -0
- package/dist/watcher/failure-reason.js.map +1 -0
- package/dist/watcher/fingerprint.d.ts +19 -0
- package/dist/watcher/fingerprint.d.ts.map +1 -0
- package/dist/watcher/fingerprint.js +53 -0
- package/dist/watcher/fingerprint.js.map +1 -0
- package/dist/watcher/heartbeat.d.ts +33 -0
- package/dist/watcher/heartbeat.d.ts.map +1 -0
- package/dist/watcher/heartbeat.js +135 -0
- package/dist/watcher/heartbeat.js.map +1 -0
- package/dist/watcher/lock.d.ts +10 -0
- package/dist/watcher/lock.d.ts.map +1 -0
- package/dist/watcher/lock.js +14 -0
- package/dist/watcher/lock.js.map +1 -0
- package/dist/watcher/loop.d.ts +26 -6
- package/dist/watcher/loop.d.ts.map +1 -1
- package/dist/watcher/loop.js +154 -37
- package/dist/watcher/loop.js.map +1 -1
- package/dist/watcher/measures.d.ts +46 -0
- package/dist/watcher/measures.d.ts.map +1 -0
- package/dist/watcher/measures.js +203 -0
- package/dist/watcher/measures.js.map +1 -0
- package/dist/watcher/outcome.d.ts +32 -0
- package/dist/watcher/outcome.d.ts.map +1 -0
- package/dist/watcher/outcome.js +127 -0
- package/dist/watcher/outcome.js.map +1 -0
- package/dist/watcher/regression.d.ts +43 -0
- package/dist/watcher/regression.d.ts.map +1 -0
- package/dist/watcher/regression.js +175 -0
- package/dist/watcher/regression.js.map +1 -0
- package/dist/watcher/runner.d.ts +6 -68
- package/dist/watcher/runner.d.ts.map +1 -1
- package/dist/watcher/runner.js +74 -523
- package/dist/watcher/runner.js.map +1 -1
- package/dist/watcher/spawn.d.ts +48 -0
- package/dist/watcher/spawn.d.ts.map +1 -0
- package/dist/watcher/spawn.js +130 -0
- package/dist/watcher/spawn.js.map +1 -0
- package/dist/watcher/task-verify.d.ts +59 -0
- package/dist/watcher/task-verify.d.ts.map +1 -0
- package/dist/watcher/task-verify.js +108 -0
- package/dist/watcher/task-verify.js.map +1 -0
- package/dist/watcher/verify.d.ts +44 -0
- package/dist/watcher/verify.d.ts.map +1 -0
- package/dist/watcher/verify.js +156 -0
- package/dist/watcher/verify.js.map +1 -0
- package/package.json +21 -9
- package/templates/PLANNER.md +77 -0
- package/templates/openspec/config.yaml +24 -0
- package/templates/openspec/schemas/osq/README.md +30 -0
- package/templates/openspec/schemas/osq/schema.yaml +133 -0
- package/templates/openspec/schemas/osq/templates/proposal.md +66 -0
- package/templates/openspec/schemas/osq/templates/spec.md +13 -0
- package/templates/openspec/schemas/osq/templates/tasks.md +11 -0
- package/templates/proposal.md +66 -0
- package/templates/tasks.md +5 -0
- package/ui/dist/assets/index-CZYeQ8la.js +9 -0
- package/ui/dist/assets/index-D6zVSjO7.css +1 -0
- package/ui/dist/index.html +14 -0
- package/dist/core/approve.d.ts +0 -11
- package/dist/core/approve.d.ts.map +0 -1
- package/dist/core/approve.js +0 -52
- package/dist/core/approve.js.map +0 -1
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js.map +0 -1
- package/dist/core/hasher.d.ts +0 -4
- package/dist/core/hasher.d.ts.map +0 -1
- package/dist/core/hasher.js.map +0 -1
- package/dist/core/init.d.ts +0 -12
- package/dist/core/init.d.ts.map +0 -1
- package/dist/core/init.js +0 -151
- package/dist/core/init.js.map +0 -1
- package/dist/core/linter.d.ts +0 -8
- package/dist/core/linter.d.ts.map +0 -1
- package/dist/core/linter.js +0 -100
- package/dist/core/linter.js.map +0 -1
- package/dist/core/lock.d.ts.map +0 -1
- package/dist/core/lock.js.map +0 -1
- package/dist/core/logger.d.ts.map +0 -1
- package/dist/core/logger.js.map +0 -1
- package/dist/core/new.d.ts.map +0 -1
- package/dist/core/new.js +0 -79
- package/dist/core/new.js.map +0 -1
- package/dist/core/parser.d.ts +0 -32
- package/dist/core/parser.d.ts.map +0 -1
- package/dist/core/parser.js +0 -87
- package/dist/core/parser.js.map +0 -1
- package/dist/core/report.d.ts +0 -54
- package/dist/core/report.d.ts.map +0 -1
- package/dist/core/report.js +0 -475
- package/dist/core/report.js.map +0 -1
- package/dist/core/show.d.ts +0 -50
- package/dist/core/show.d.ts.map +0 -1
- package/dist/core/show.js +0 -374
- package/dist/core/show.js.map +0 -1
- package/dist/core/state.d.ts +0 -25
- package/dist/core/state.d.ts.map +0 -1
- package/dist/core/state.js +0 -180
- package/dist/core/state.js.map +0 -1
- package/dist/core/status.d.ts +0 -10
- package/dist/core/status.d.ts.map +0 -1
- package/dist/core/status.js +0 -106
- package/dist/core/status.js.map +0 -1
- package/dist/harness/agy.d.ts.map +0 -1
- package/dist/harness/agy.js.map +0 -1
- package/dist/harness/opencode.d.ts.map +0 -1
- package/dist/harness/opencode.js.map +0 -1
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { watch } from 'chokidar';
|
|
3
|
+
import { getArchiveDir, getChangesDir, getRejectedDir } from '../status/layout.js';
|
|
4
|
+
import { numericIdOf } from './web-data-folders.js';
|
|
5
|
+
/** SSE response headers shared by GET and HEAD. */
|
|
6
|
+
export const SSE_HEADERS = {
|
|
7
|
+
'Content-Type': 'text/event-stream; charset=utf-8',
|
|
8
|
+
'Cache-Control': 'no-store',
|
|
9
|
+
Connection: 'keep-alive',
|
|
10
|
+
};
|
|
11
|
+
const WATCHED_EVENTS = ['add', 'change', 'unlink', 'addDir', 'unlinkDir'];
|
|
12
|
+
function defaultWatch(paths, options) {
|
|
13
|
+
const watcher = watch([...paths], { ignoreInitial: options.ignoreInitial });
|
|
14
|
+
const emitter = watcher;
|
|
15
|
+
return {
|
|
16
|
+
on: (event, listener) => emitter.on(event, listener),
|
|
17
|
+
close: () => watcher.close(),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function defaultSchedule(callback, delayMs) {
|
|
21
|
+
const timer = setTimeout(callback, delayMs);
|
|
22
|
+
return { cancel: () => clearTimeout(timer) };
|
|
23
|
+
}
|
|
24
|
+
function folderKeyWithin(base, target) {
|
|
25
|
+
const relative = path.relative(base, target);
|
|
26
|
+
if (relative === '' || relative.startsWith('..') || path.isAbsolute(relative))
|
|
27
|
+
return null;
|
|
28
|
+
const key = relative.split(path.sep)[0];
|
|
29
|
+
return key === undefined || key === '' || key === '.' ? null : key;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Leading numeric id for a path inside exactly one change folder, or `null`
|
|
33
|
+
* when the path belongs to shared state: capability specs, root layout, or an
|
|
34
|
+
* unrecognized folder.
|
|
35
|
+
*/
|
|
36
|
+
export function classifyChangePath(target, changesDir, archiveDir, rejectedDir) {
|
|
37
|
+
for (const base of [archiveDir, rejectedDir]) {
|
|
38
|
+
const key = folderKeyWithin(base, target);
|
|
39
|
+
if (key !== null)
|
|
40
|
+
return numericIdOf(key);
|
|
41
|
+
}
|
|
42
|
+
const key = folderKeyWithin(changesDir, target);
|
|
43
|
+
if (key === null || key === 'archive' || key === 'rejected')
|
|
44
|
+
return null;
|
|
45
|
+
return numericIdOf(key);
|
|
46
|
+
}
|
|
47
|
+
/** Create the one watcher and debounce accumulator owned by a server. */
|
|
48
|
+
export function createInvalidationHub(options) {
|
|
49
|
+
const changesDir = path.resolve(getChangesDir(options.openspecRoot, options.projectRoot));
|
|
50
|
+
const archiveDir = path.resolve(getArchiveDir(options.openspecRoot, options.projectRoot));
|
|
51
|
+
const rejectedDir = path.resolve(getRejectedDir(options.openspecRoot, options.projectRoot));
|
|
52
|
+
const root = path.resolve(options.projectRoot, options.openspecRoot);
|
|
53
|
+
const factory = options.watch ?? defaultWatch;
|
|
54
|
+
const schedule = options.schedule ?? defaultSchedule;
|
|
55
|
+
const listeners = new Set();
|
|
56
|
+
const ids = new Set();
|
|
57
|
+
let global = false;
|
|
58
|
+
let pending = null;
|
|
59
|
+
let sequence = 0;
|
|
60
|
+
let closed = false;
|
|
61
|
+
let closing = null;
|
|
62
|
+
function emitBatch() {
|
|
63
|
+
const batch = { ids: global ? [] : [...ids].sort((a, b) => a - b) };
|
|
64
|
+
ids.clear();
|
|
65
|
+
global = false;
|
|
66
|
+
for (const listener of [...listeners])
|
|
67
|
+
listener(batch);
|
|
68
|
+
}
|
|
69
|
+
function cancelPending() {
|
|
70
|
+
sequence += 1;
|
|
71
|
+
if (pending !== null) {
|
|
72
|
+
pending.cancel();
|
|
73
|
+
pending = null;
|
|
74
|
+
}
|
|
75
|
+
ids.clear();
|
|
76
|
+
global = false;
|
|
77
|
+
}
|
|
78
|
+
const watcher = factory([root], { ignoreInitial: true });
|
|
79
|
+
for (const event of WATCHED_EVENTS) {
|
|
80
|
+
watcher.on(event, (target) => {
|
|
81
|
+
if (closed || typeof target !== 'string')
|
|
82
|
+
return;
|
|
83
|
+
const id = classifyChangePath(path.resolve(target), changesDir, archiveDir, rejectedDir);
|
|
84
|
+
if (id === null)
|
|
85
|
+
global = true;
|
|
86
|
+
else
|
|
87
|
+
ids.add(id);
|
|
88
|
+
if (pending === null) {
|
|
89
|
+
sequence += 1;
|
|
90
|
+
const token = sequence;
|
|
91
|
+
pending = schedule(() => {
|
|
92
|
+
if (closed || token !== sequence)
|
|
93
|
+
return;
|
|
94
|
+
pending = null;
|
|
95
|
+
emitBatch();
|
|
96
|
+
}, options.debounceMs);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
watcher.on('error', () => undefined);
|
|
101
|
+
return {
|
|
102
|
+
subscribe(listener) {
|
|
103
|
+
if (closed)
|
|
104
|
+
return () => undefined;
|
|
105
|
+
listeners.add(listener);
|
|
106
|
+
return () => {
|
|
107
|
+
listeners.delete(listener);
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
cancelPending,
|
|
111
|
+
close() {
|
|
112
|
+
if (closing !== null)
|
|
113
|
+
return closing;
|
|
114
|
+
closed = true;
|
|
115
|
+
cancelPending();
|
|
116
|
+
listeners.clear();
|
|
117
|
+
closing = Promise.resolve().then(() => watcher.close());
|
|
118
|
+
return closing;
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/** The exact wire frame for one debounced invalidation. */
|
|
123
|
+
export function formatChangedEvent(ids) {
|
|
124
|
+
return `event: changed\ndata: ${JSON.stringify({ ids })}\n\n`;
|
|
125
|
+
}
|
|
126
|
+
/** Track connected SSE responses and fan out one frame per derived batch. */
|
|
127
|
+
export function createEventStream(hub) {
|
|
128
|
+
const clients = new Set();
|
|
129
|
+
const unsubscribe = hub.subscribe((batch) => {
|
|
130
|
+
const frame = formatChangedEvent(batch.ids);
|
|
131
|
+
for (const res of clients) {
|
|
132
|
+
if (!res.writableEnded)
|
|
133
|
+
res.write(frame);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
return {
|
|
137
|
+
handle(res, head) {
|
|
138
|
+
if (head) {
|
|
139
|
+
res.writeHead(200, SSE_HEADERS);
|
|
140
|
+
res.end();
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
res.writeHead(200, SSE_HEADERS);
|
|
144
|
+
res.flushHeaders();
|
|
145
|
+
clients.add(res);
|
|
146
|
+
const remove = () => {
|
|
147
|
+
clients.delete(res);
|
|
148
|
+
};
|
|
149
|
+
res.on('close', remove);
|
|
150
|
+
res.on('error', remove);
|
|
151
|
+
},
|
|
152
|
+
close() {
|
|
153
|
+
unsubscribe();
|
|
154
|
+
for (const res of clients) {
|
|
155
|
+
if (!res.writableEnded)
|
|
156
|
+
res.end();
|
|
157
|
+
}
|
|
158
|
+
clients.clear();
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=web-events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-events.js","sourceRoot":"","sources":["../../../src/core/web/web-events.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AA4CpD,mDAAmD;AACnD,MAAM,CAAC,MAAM,WAAW,GAA6B;IACnD,cAAc,EAAE,kCAAkC;IAClD,eAAe,EAAE,UAAU;IAC3B,UAAU,EAAE,YAAY;CACzB,CAAC;AAEF,MAAM,cAAc,GAA0B,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAEjG,SAAS,YAAY,CAAC,KAAwB,EAAE,OAAqB;IACnE,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,OAGf,CAAC;IACF,OAAO;QACL,EAAE,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC;QACpD,KAAK,EAAE,GAAG,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,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO;QACL,MAAM,CAAC,GAAG,EAAE,IAAI;YACd,IAAI,IAAI,EAAE,CAAC;gBACT,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;gBAChC,GAAG,CAAC,GAAG,EAAE,CAAC;gBACV,OAAO;YACT,CAAC;YACD,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YAChC,GAAG,CAAC,YAAY,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,MAAM,MAAM,GAAG,GAAS,EAAE;gBACxB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACtB,CAAC,CAAC;YACF,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACxB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC1B,CAAC;QACD,KAAK;YACH,WAAW,EAAE,CAAC;YACd,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;gBAC1B,IAAI,CAAC,GAAG,CAAC,aAAa;oBAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YACpC,CAAC;YACD,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { OsqConfig } from '../foundation/config.js';
|
|
2
|
+
export interface ExportDashboardOptions {
|
|
3
|
+
readonly projectRoot: string;
|
|
4
|
+
readonly config: OsqConfig;
|
|
5
|
+
readonly targetDir: string;
|
|
6
|
+
/** Built UI directory; defaults to the package-root staged `ui/dist`. */
|
|
7
|
+
readonly uiDir?: string;
|
|
8
|
+
/** Home directory scrubbed to `~`; defaults to `os.homedir()`. */
|
|
9
|
+
readonly home?: string;
|
|
10
|
+
/** Derivation clock; defaults to the current time. */
|
|
11
|
+
readonly now?: Date;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Write a self-contained snapshot of every dashboard view into `targetDir`.
|
|
15
|
+
* A non-empty target is refused before any write. Returns the written files.
|
|
16
|
+
*/
|
|
17
|
+
export declare function exportDashboard(options: ExportDashboardOptions): Promise<string[]>;
|
|
18
|
+
//# sourceMappingURL=web-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-export.d.ts","sourceRoot":"","sources":["../../../src/core/web/web-export.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAwBzD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC;CACrB;AAsFD;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBxF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { getMetricsReport } from '../report/report.js';
|
|
5
|
+
import { readInbox } from '../status/inbox-projection.js';
|
|
6
|
+
import { getWebChange } from './web-data-change.js';
|
|
7
|
+
import { getWebGraph } from './web-data.js';
|
|
8
|
+
import { serializeWebJson } from './web-server.js';
|
|
9
|
+
import { resolveUiDir } from './web-static.js';
|
|
10
|
+
const DATA_SCRIPT = '<script src="./data.js"></script>';
|
|
11
|
+
const DATA_FILE = 'data.js';
|
|
12
|
+
const INDEX_FILE = 'index.html';
|
|
13
|
+
/** Replace every occurrence of each source string in every nested string value. */
|
|
14
|
+
function scrubStrings(value, replacements) {
|
|
15
|
+
if (typeof value === 'string') {
|
|
16
|
+
let result = value;
|
|
17
|
+
for (const [from, to] of replacements)
|
|
18
|
+
result = result.split(from).join(to);
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(value))
|
|
22
|
+
return value.map((item) => scrubStrings(item, replacements));
|
|
23
|
+
if (value !== null && typeof value === 'object') {
|
|
24
|
+
const result = {};
|
|
25
|
+
for (const [key, item] of Object.entries(value)) {
|
|
26
|
+
result[key] = scrubStrings(item, replacements);
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
/** The folder key plus the padded numeric id prefix for one change node. */
|
|
33
|
+
function changeKeys(folderKey) {
|
|
34
|
+
const prefix = /^(\d+)/.exec(folderKey)?.[1];
|
|
35
|
+
return prefix === undefined ? [folderKey] : [folderKey, prefix.padStart(3, '0')];
|
|
36
|
+
}
|
|
37
|
+
/** Compose every route document from the current project tree. */
|
|
38
|
+
async function buildInlineData(projectRoot, config, now, home) {
|
|
39
|
+
const graph = await getWebGraph(projectRoot, config);
|
|
40
|
+
const report = await getMetricsReport(projectRoot, config);
|
|
41
|
+
const inbox = await readInbox(projectRoot, { config, now, home });
|
|
42
|
+
const changes = {};
|
|
43
|
+
for (const node of graph.changes) {
|
|
44
|
+
const change = await getWebChange(projectRoot, node.folderKey, config, now);
|
|
45
|
+
for (const key of changeKeys(node.folderKey))
|
|
46
|
+
changes[key] = change;
|
|
47
|
+
}
|
|
48
|
+
return { report, graph, inbox, changes };
|
|
49
|
+
}
|
|
50
|
+
/** `true` when `target` is missing, or an existing empty directory. */
|
|
51
|
+
async function targetIsWritable(target) {
|
|
52
|
+
const stat = await fs.lstat(target).catch(() => null);
|
|
53
|
+
if (stat === null)
|
|
54
|
+
return true;
|
|
55
|
+
if (!stat.isDirectory())
|
|
56
|
+
return false;
|
|
57
|
+
return (await fs.readdir(target)).length === 0;
|
|
58
|
+
}
|
|
59
|
+
/** Copy each top-level entry of `uiDir` into the existing empty `target`. */
|
|
60
|
+
async function copyUi(uiDir, target) {
|
|
61
|
+
const entries = await fs.readdir(uiDir, { withFileTypes: true });
|
|
62
|
+
for (const entry of entries) {
|
|
63
|
+
await fs.cp(path.join(uiDir, entry.name), path.join(target, entry.name), { recursive: true });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** Insert the data script immediately before the copied index's first script. */
|
|
67
|
+
async function injectDataScript(indexPath) {
|
|
68
|
+
const html = await fs.readFile(indexPath, 'utf8');
|
|
69
|
+
const at = html.indexOf('<script');
|
|
70
|
+
if (at < 0)
|
|
71
|
+
throw new Error(`exported dashboard index has no script tag: ${indexPath}`);
|
|
72
|
+
await fs.writeFile(indexPath, `${html.slice(0, at)}${DATA_SCRIPT}${html.slice(at)}`, 'utf8');
|
|
73
|
+
}
|
|
74
|
+
/** Every regular file below `root`, absolute and sorted. */
|
|
75
|
+
async function listFiles(root) {
|
|
76
|
+
const files = [];
|
|
77
|
+
const entries = await fs.readdir(root, { withFileTypes: true });
|
|
78
|
+
for (const entry of entries) {
|
|
79
|
+
const full = path.join(root, entry.name);
|
|
80
|
+
if (entry.isDirectory())
|
|
81
|
+
files.push(...(await listFiles(full)));
|
|
82
|
+
else if (entry.isFile())
|
|
83
|
+
files.push(full);
|
|
84
|
+
}
|
|
85
|
+
return files.sort((a, b) => a.localeCompare(b));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Write a self-contained snapshot of every dashboard view into `targetDir`.
|
|
89
|
+
* A non-empty target is refused before any write. Returns the written files.
|
|
90
|
+
*/
|
|
91
|
+
export async function exportDashboard(options) {
|
|
92
|
+
const target = path.resolve(options.targetDir);
|
|
93
|
+
const uiDir = options.uiDir ?? resolveUiDir();
|
|
94
|
+
const home = options.home ?? os.homedir();
|
|
95
|
+
const now = options.now ?? new Date();
|
|
96
|
+
if (!(await targetIsWritable(target))) {
|
|
97
|
+
throw new Error(`dashboard export target must be an empty directory: ${target}`);
|
|
98
|
+
}
|
|
99
|
+
const data = await buildInlineData(options.projectRoot, options.config, now, home);
|
|
100
|
+
const replacements = [];
|
|
101
|
+
if (options.projectRoot)
|
|
102
|
+
replacements.push([options.projectRoot, '.']);
|
|
103
|
+
if (home)
|
|
104
|
+
replacements.push([home, '~']);
|
|
105
|
+
await fs.mkdir(target, { recursive: true });
|
|
106
|
+
await copyUi(uiDir, target);
|
|
107
|
+
await injectDataScript(path.join(target, INDEX_FILE));
|
|
108
|
+
const serialized = serializeWebJson(scrubStrings(data, replacements));
|
|
109
|
+
await fs.writeFile(path.join(target, DATA_FILE), `window.__OSQ_DATA__ = ${serialized};`, 'utf8');
|
|
110
|
+
return listFiles(target);
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=web-export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-export.js","sourceRoot":"","sources":["../../../src/core/web/web-export.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAsB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAiC,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AA6B/C,MAAM,WAAW,GAAG,mCAAmC,CAAC;AACxD,MA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C,CAAC;IAEzC,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,MAAM,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC5B,MAAM,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD,MAAM,UAAU,GAAG,gBAAgB,CAAC,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IACtE,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,yBAAyB,UAAU,GAAG,EAAE,MAAM,CAAC,CAAC;IAEjG,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { OsqConfig } from '../foundation/config.js';
|
|
2
|
+
import { type MetricsReport } from '../report/report.js';
|
|
3
|
+
import { type ReadInboxOptions } from '../status/inbox-projection.js';
|
|
4
|
+
import type { Inbox } from '../status/inbox.js';
|
|
5
|
+
import type { WebChange, WebGraph } from './web-data-types.js';
|
|
6
|
+
import { type ScheduleFn, type WatcherFactory } from './web-events.js';
|
|
7
|
+
type ChangeDocumentFn = (projectRoot: string, selector: string, config: OsqConfig, now: Date) => Promise<WebChange>;
|
|
8
|
+
/** Dependency-injected composition root for the read-only loopback server. */
|
|
9
|
+
export interface WebServerOptions {
|
|
10
|
+
readonly projectRoot: string;
|
|
11
|
+
readonly config: OsqConfig;
|
|
12
|
+
readonly port?: number;
|
|
13
|
+
readonly uiDir?: string;
|
|
14
|
+
readonly now?: () => Date;
|
|
15
|
+
readonly home?: string;
|
|
16
|
+
readonly getReport?: (projectRoot: string, config: OsqConfig) => Promise<MetricsReport>;
|
|
17
|
+
readonly getGraph?: (projectRoot: string, config: OsqConfig) => Promise<WebGraph>;
|
|
18
|
+
readonly getChange?: ChangeDocumentFn;
|
|
19
|
+
readonly getInbox?: (projectRoot: string, options: ReadInboxOptions) => Promise<Inbox>;
|
|
20
|
+
readonly watch?: WatcherFactory;
|
|
21
|
+
readonly schedule?: ScheduleFn;
|
|
22
|
+
}
|
|
23
|
+
/** An idempotently closable listener with its actual bound loopback URL. */
|
|
24
|
+
export interface WebServerHandle {
|
|
25
|
+
readonly url: string;
|
|
26
|
+
readonly port: number;
|
|
27
|
+
close(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
/** Deterministic UTF-8 JSON shared by every API document. */
|
|
30
|
+
export declare function serializeWebJson(data: unknown): string;
|
|
31
|
+
/** Start one loopback-only HTTP server over the current project tree. */
|
|
32
|
+
export declare function startWebServer(options: WebServerOptions): Promise<WebServerHandle>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=web-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-server.d.ts","sourceRoot":"","sources":["../../../src/core/web/web-server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/D,OAAO,EACL,KAAK,UAAU,EACf,KAAK,cAAc,EAGpB,MAAM,iBAAiB,CAAC;AAOzB,KAAK,gBAAgB,GAAG,CACtB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,IAAI,KACN,OAAO,CAAC,SAAS,CAAC,CAAC;AAExB,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,QA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|
2
|
+
import { DEFAULT_SERVE_CONFIG } from '../foundation/config-serve.js';
|
|
3
|
+
import { getMetricsReport } from '../report/report.js';
|
|
4
|
+
import { readInbox } from '../status/inbox-projection.js';
|
|
5
|
+
import { getWebChange } from './web-data-change.js';
|
|
6
|
+
import { getWebGraph } from './web-data-graph.js';
|
|
7
|
+
import { WebDataError } from './web-data-types.js';
|
|
8
|
+
import { createEventStream, createInvalidationHub, } from './web-events.js';
|
|
9
|
+
import { UI_CONTENT_SECURITY_POLICY, resolveStaticFile, resolveUiDir } from './web-static.js';
|
|
10
|
+
const SERVE_HOST = '127.0.0.1';
|
|
11
|
+
const CHANGE_PREFIX = '/api/changes/';
|
|
12
|
+
const EVENTS_PATH = '/api/events';
|
|
13
|
+
function sortKeysDeep(value) {
|
|
14
|
+
if (Array.isArray(value))
|
|
15
|
+
return value.map(sortKeysDeep);
|
|
16
|
+
if (value === null || typeof value !== 'object')
|
|
17
|
+
return value;
|
|
18
|
+
const source = value;
|
|
19
|
+
const sorted = {};
|
|
20
|
+
for (const key of Object.keys(source).sort())
|
|
21
|
+
sorted[key] = sortKeysDeep(source[key]);
|
|
22
|
+
return sorted;
|
|
23
|
+
}
|
|
24
|
+
/** Deterministic UTF-8 JSON shared by every API document. */
|
|
25
|
+
export function serializeWebJson(data) {
|
|
26
|
+
return JSON.stringify(sortKeysDeep(data));
|
|
27
|
+
}
|
|
28
|
+
function send(res, status, body, contentType, cache, head, headers = {}) {
|
|
29
|
+
res.writeHead(status, {
|
|
30
|
+
'Content-Type': contentType,
|
|
31
|
+
'Content-Length': body.byteLength,
|
|
32
|
+
'Cache-Control': cache,
|
|
33
|
+
...headers,
|
|
34
|
+
});
|
|
35
|
+
if (head)
|
|
36
|
+
res.end();
|
|
37
|
+
else
|
|
38
|
+
res.end(body);
|
|
39
|
+
}
|
|
40
|
+
function sendJson(res, status, data, head, headers = {}) {
|
|
41
|
+
const body = Buffer.from(serializeWebJson(data), 'utf8');
|
|
42
|
+
send(res, status, body, 'application/json; charset=utf-8', 'no-store', head, headers);
|
|
43
|
+
}
|
|
44
|
+
function sendFailure(res, error, head = false) {
|
|
45
|
+
if (res.headersSent) {
|
|
46
|
+
res.end();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
sendJson(res, 500, { error: error instanceof Error ? error.message : String(error) }, head);
|
|
50
|
+
}
|
|
51
|
+
/** Decode a change selector once, rejecting separators, traversal, and bad escapes. */
|
|
52
|
+
function decodeChangeSelector(raw) {
|
|
53
|
+
let decoded;
|
|
54
|
+
try {
|
|
55
|
+
decoded = decodeURIComponent(raw);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
if (decoded.length === 0 || decoded.includes('\0'))
|
|
61
|
+
return null;
|
|
62
|
+
if (decoded.includes('/') || decoded.includes('\\'))
|
|
63
|
+
return null;
|
|
64
|
+
if (decoded === '.' || decoded === '..')
|
|
65
|
+
return null;
|
|
66
|
+
return decoded;
|
|
67
|
+
}
|
|
68
|
+
/** Start one loopback-only HTTP server over the current project tree. */
|
|
69
|
+
export async function startWebServer(options) {
|
|
70
|
+
const projectRoot = options.projectRoot;
|
|
71
|
+
const config = options.config;
|
|
72
|
+
const uiDir = options.uiDir ?? resolveUiDir();
|
|
73
|
+
const home = options.home;
|
|
74
|
+
const clock = options.now ?? (() => new Date());
|
|
75
|
+
const getReport = options.getReport ?? getMetricsReport;
|
|
76
|
+
const getGraph = options.getGraph ?? getWebGraph;
|
|
77
|
+
const getChange = options.getChange ?? getWebChange;
|
|
78
|
+
const getInbox = options.getInbox ?? ((root, inbox) => readInbox(root, inbox));
|
|
79
|
+
const hub = createInvalidationHub({
|
|
80
|
+
projectRoot,
|
|
81
|
+
openspecRoot: config.paths.openspecRoot,
|
|
82
|
+
debounceMs: config.serve?.eventDebounceMs ?? DEFAULT_SERVE_CONFIG.eventDebounceMs,
|
|
83
|
+
watch: options.watch,
|
|
84
|
+
schedule: options.schedule,
|
|
85
|
+
});
|
|
86
|
+
const events = createEventStream(hub);
|
|
87
|
+
async function handleChange(res, pathname, head) {
|
|
88
|
+
const raw = pathname.slice(CHANGE_PREFIX.length);
|
|
89
|
+
if (raw.length === 0)
|
|
90
|
+
return sendJson(res, 404, { error: 'change not found' }, head);
|
|
91
|
+
const selector = decodeChangeSelector(raw);
|
|
92
|
+
if (selector === null)
|
|
93
|
+
return sendJson(res, 400, { error: 'unsafe change selector' }, head);
|
|
94
|
+
try {
|
|
95
|
+
sendJson(res, 200, await getChange(projectRoot, selector, config, clock()), head);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (error instanceof WebDataError) {
|
|
99
|
+
return sendJson(res, error.kind === 'ambiguous' ? 409 : 404, { error: error.message }, head);
|
|
100
|
+
}
|
|
101
|
+
sendFailure(res, error, head);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
async function handleApi(res, pathname, head) {
|
|
105
|
+
try {
|
|
106
|
+
if (pathname === EVENTS_PATH)
|
|
107
|
+
return events.handle(res, head);
|
|
108
|
+
const documents = {
|
|
109
|
+
'/api/report': () => getReport(projectRoot, config),
|
|
110
|
+
'/api/graph': () => getGraph(projectRoot, config),
|
|
111
|
+
'/api/inbox': () => getInbox(projectRoot, { config, now: clock(), home }),
|
|
112
|
+
};
|
|
113
|
+
const document = documents[pathname];
|
|
114
|
+
if (document)
|
|
115
|
+
return sendJson(res, 200, await document(), head);
|
|
116
|
+
if (pathname.startsWith(CHANGE_PREFIX))
|
|
117
|
+
return await handleChange(res, pathname, head);
|
|
118
|
+
sendJson(res, 404, { error: 'not found' }, head);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
sendFailure(res, error, head);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async function handleStatic(res, pathname, head) {
|
|
125
|
+
const asset = await resolveStaticFile(pathname, uiDir);
|
|
126
|
+
if (asset === null) {
|
|
127
|
+
const body = Buffer.from('Not Found\n', 'utf8');
|
|
128
|
+
return send(res, 404, body, 'text/plain; charset=utf-8', 'no-store', head);
|
|
129
|
+
}
|
|
130
|
+
const headers = asset.isHtml
|
|
131
|
+
? { 'Content-Security-Policy': UI_CONTENT_SECURITY_POLICY }
|
|
132
|
+
: {};
|
|
133
|
+
send(res, 200, asset.body, asset.contentType, asset.cacheControl, head, headers);
|
|
134
|
+
}
|
|
135
|
+
async function handleRequest(req, res) {
|
|
136
|
+
const method = req.method ?? 'GET';
|
|
137
|
+
if (method !== 'GET' && method !== 'HEAD') {
|
|
138
|
+
return sendJson(res, 405, { error: 'method not allowed' }, false, { Allow: 'GET, HEAD' });
|
|
139
|
+
}
|
|
140
|
+
const head = method === 'HEAD';
|
|
141
|
+
const rawUrl = req.url ?? '/';
|
|
142
|
+
const pathname = rawUrl.startsWith('/') ? rawUrl.replace(/[?#].*$/, '') : null;
|
|
143
|
+
if (pathname === null)
|
|
144
|
+
return sendJson(res, 400, { error: 'malformed request url' }, head);
|
|
145
|
+
if (pathname.startsWith('/api/'))
|
|
146
|
+
await handleApi(res, pathname, head);
|
|
147
|
+
else
|
|
148
|
+
await handleStatic(res, pathname, head);
|
|
149
|
+
}
|
|
150
|
+
const server = http.createServer((req, res) => {
|
|
151
|
+
handleRequest(req, res).catch((error) => sendFailure(res, error));
|
|
152
|
+
});
|
|
153
|
+
try {
|
|
154
|
+
await new Promise((resolve, reject) => {
|
|
155
|
+
server.once('error', reject);
|
|
156
|
+
server.once('listening', resolve);
|
|
157
|
+
server.listen(options.port ?? config.serve?.port ?? DEFAULT_SERVE_CONFIG.port, SERVE_HOST);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
hub.cancelPending();
|
|
162
|
+
events.close();
|
|
163
|
+
await hub.close();
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
const address = server.address();
|
|
167
|
+
let closed = false;
|
|
168
|
+
const close = async () => {
|
|
169
|
+
if (closed)
|
|
170
|
+
return;
|
|
171
|
+
closed = true;
|
|
172
|
+
hub.cancelPending();
|
|
173
|
+
events.close();
|
|
174
|
+
await hub.close();
|
|
175
|
+
await new Promise((resolve) => {
|
|
176
|
+
server.close(() => resolve());
|
|
177
|
+
server.closeIdleConnections();
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
return { url: `http://${SERVE_HOST}:${address.port}/`, port: address.port, close };
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=web-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-server.js","sourceRoot":"","sources":["../../../src/core/web/web-server.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAsB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAyB,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAGL,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE9F,MAAM,UAAU,GAAG,WAAW,CAAC;AAC/B,MAAM,aAAa,GAAG,eAAe,CAAC;AACtC,MAAM,WAAW,GAAG,aAAa,CAAC;AAgClC,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACzD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC9D,M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AG,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,KAAK,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAiB,CAAC;IAChD,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,KAAK,GAAG,KAAK,IAAmB,EAAE;QACtC,IAAI,MAAM;YAAE,OAAO;QACnB,MAAM,GAAG,IAAI,CAAC;QACd,GAAG,CAAC,aAAa,EAAE,CAAC;QACpB,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAClC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9B,MAAM,CAAC,oBAAoB,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IACF,OAAO,EAAE,GAAG,EAAE,UAAU,UAAU,IAAI,OAAO,CAAC,IAAI,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Package-root `ui/dist` for both `src/core` under tsx and `dist/core` shipped. */
|
|
2
|
+
export declare function resolveUiDir(): string;
|
|
3
|
+
/** Self-only policy for the generated application plus same-origin SSE. */
|
|
4
|
+
export declare const UI_CONTENT_SECURITY_POLICY: string;
|
|
5
|
+
/** Fingerprinted build assets may be cached immutably; everything else revalidates. */
|
|
6
|
+
export declare function isFingerprintedAsset(fileName: string): boolean;
|
|
7
|
+
/** One resolved static file with its delivery metadata. */
|
|
8
|
+
export interface StaticAsset {
|
|
9
|
+
readonly body: Buffer;
|
|
10
|
+
readonly contentType: string;
|
|
11
|
+
readonly cacheControl: string;
|
|
12
|
+
readonly isHtml: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Resolve `pathname` to one regular file inside `uiDir`. Returns null for
|
|
16
|
+
* malformed escapes, traversal, dot segments, directories, and absent files.
|
|
17
|
+
* `/` and `/index.html` both resolve to the application shell.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveStaticFile(pathname: string, uiDir?: string): Promise<StaticAsset | null>;
|
|
20
|
+
//# sourceMappingURL=web-static.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-static.d.ts","sourceRoot":"","sources":["../../../src/core/web/web-static.ts"],"names":[],"mappings":"AAaA,oFAAoF;AACpF,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,2EAA2E;AAC3E,eAAO,MAAM,0BAA0B,QAW3B,CAAC;AA0Bb,uFAAuF;AACvF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAiBD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,MAAuB,GAC7B,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CA8B7B"}
|