clinkx 0.2.3 → 1.0.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/CHANGELOG.md +33 -0
- package/LICENSE +10 -0
- package/README.md +113 -18
- package/clinkx-workflows/dist/allowed-roots.d.ts +1 -0
- package/clinkx-workflows/dist/allowed-roots.js +5 -0
- package/clinkx-workflows/dist/allowed-roots.js.map +1 -0
- package/clinkx-workflows/dist/artifacts.d.ts +20 -1
- package/clinkx-workflows/dist/artifacts.js +38 -9
- package/clinkx-workflows/dist/artifacts.js.map +1 -1
- package/clinkx-workflows/dist/backend.d.ts +4 -0
- package/clinkx-workflows/dist/citation-check.d.ts +40 -0
- package/clinkx-workflows/dist/citation-check.js +348 -0
- package/clinkx-workflows/dist/citation-check.js.map +1 -0
- package/clinkx-workflows/dist/clink-client.d.ts +2 -1
- package/clinkx-workflows/dist/clink-client.js +17 -4
- package/clinkx-workflows/dist/clink-client.js.map +1 -1
- package/clinkx-workflows/dist/config.d.ts +145 -16
- package/clinkx-workflows/dist/config.js +384 -26
- package/clinkx-workflows/dist/config.js.map +1 -1
- package/clinkx-workflows/dist/contained-file.d.ts +172 -0
- package/clinkx-workflows/dist/contained-file.js +483 -0
- package/clinkx-workflows/dist/contained-file.js.map +1 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-contract.d.ts +416 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-contract.js +328 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-contract.js.map +1 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-router.d.ts +24 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-router.js +39 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-router.js.map +1 -0
- package/clinkx-workflows/dist/context-cache-key.d.ts +53 -0
- package/clinkx-workflows/dist/context-cache-key.js +91 -0
- package/clinkx-workflows/dist/context-cache-key.js.map +1 -0
- package/clinkx-workflows/dist/context-mode-resolver.d.ts +27 -0
- package/clinkx-workflows/dist/context-mode-resolver.js +126 -0
- package/clinkx-workflows/dist/context-mode-resolver.js.map +1 -0
- package/clinkx-workflows/dist/context-preflight.d.ts +184 -0
- package/clinkx-workflows/dist/context-preflight.js +91 -0
- package/clinkx-workflows/dist/context-preflight.js.map +1 -0
- package/clinkx-workflows/dist/council-expander.d.ts +1 -1
- package/clinkx-workflows/dist/council-expander.js +2 -1
- package/clinkx-workflows/dist/council-expander.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/activity-contract.d.ts +165 -0
- package/clinkx-workflows/dist/dashboard/activity-contract.js +105 -0
- package/clinkx-workflows/dist/dashboard/activity-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/activity-lease.d.ts +25 -0
- package/clinkx-workflows/dist/dashboard/activity-lease.js +34 -0
- package/clinkx-workflows/dist/dashboard/activity-lease.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/activity-reader.d.ts +86 -0
- package/clinkx-workflows/dist/dashboard/activity-reader.js +480 -0
- package/clinkx-workflows/dist/dashboard/activity-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/api-routes.d.ts +36 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js +1047 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/artifact-index.d.ts +37 -0
- package/clinkx-workflows/dist/dashboard/artifact-index.js +145 -0
- package/clinkx-workflows/dist/dashboard/artifact-index.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.d.ts +31 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.js +65 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.d.ts +26 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.js +596 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/credential-store.d.ts +60 -0
- package/clinkx-workflows/dist/dashboard/auth/credential-store.js +776 -0
- package/clinkx-workflows/dist/dashboard/auth/credential-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.d.ts +9 -0
- package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js +44 -0
- package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/session-store.d.ts +17 -0
- package/clinkx-workflows/dist/dashboard/auth/session-store.js +77 -0
- package/clinkx-workflows/dist/dashboard/auth/session-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/webauthn-service.d.ts +25 -0
- package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js +71 -0
- package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/context-run-liveness.d.ts +37 -0
- package/clinkx-workflows/dist/dashboard/context-run-liveness.js +49 -0
- package/clinkx-workflows/dist/dashboard/context-run-liveness.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/context-run-reader.d.ts +222 -0
- package/clinkx-workflows/dist/dashboard/context-run-reader.js +1178 -0
- package/clinkx-workflows/dist/dashboard/context-run-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +8936 -0
- package/clinkx-workflows/dist/dashboard/contracts.js +1157 -0
- package/clinkx-workflows/dist/dashboard/contracts.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/generation.d.ts +14 -0
- package/clinkx-workflows/dist/dashboard/generation.js +41 -0
- package/clinkx-workflows/dist/dashboard/generation.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/index.d.ts +28 -0
- package/clinkx-workflows/dist/dashboard/index.js +16 -0
- package/clinkx-workflows/dist/dashboard/index.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/lazy-content.d.ts +101 -0
- package/clinkx-workflows/dist/dashboard/lazy-content.js +748 -0
- package/clinkx-workflows/dist/dashboard/lazy-content.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +303 -0
- package/clinkx-workflows/dist/dashboard/progress-report-contract.js +221 -0
- package/clinkx-workflows/dist/dashboard/progress-report-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-reader.d.ts +50 -0
- package/clinkx-workflows/dist/dashboard/progress-report-reader.js +581 -0
- package/clinkx-workflows/dist/dashboard/progress-report-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.d.ts +89 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js +71 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.d.ts +28 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.js +110 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/read-model.d.ts +86 -0
- package/clinkx-workflows/dist/dashboard/read-model.js +440 -0
- package/clinkx-workflows/dist/dashboard/read-model.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/request-admission.d.ts +31 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js +126 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/scanner.d.ts +75 -0
- package/clinkx-workflows/dist/dashboard/scanner.js +1110 -0
- package/clinkx-workflows/dist/dashboard/scanner.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/server-factory.d.ts +50 -0
- package/clinkx-workflows/dist/dashboard/server-factory.js +431 -0
- package/clinkx-workflows/dist/dashboard/server-factory.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +2611 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.js +480 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-identity.d.ts +21 -0
- package/clinkx-workflows/dist/dashboard/session-log-identity.js +101 -0
- package/clinkx-workflows/dist/dashboard/session-log-identity.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-journal.d.ts +43 -0
- package/clinkx-workflows/dist/dashboard/session-log-journal.js +522 -0
- package/clinkx-workflows/dist/dashboard/session-log-journal.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-reader.d.ts +61 -0
- package/clinkx-workflows/dist/dashboard/session-log-reader.js +378 -0
- package/clinkx-workflows/dist/dashboard/session-log-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.d.ts +6 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js +367 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-retention.d.ts +23 -0
- package/clinkx-workflows/dist/dashboard/session-log-retention.js +212 -0
- package/clinkx-workflows/dist/dashboard/session-log-retention.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/static-responses.d.ts +10 -0
- package/clinkx-workflows/dist/dashboard/static-responses.js +94 -0
- package/clinkx-workflows/dist/dashboard/static-responses.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/worker-lock-observer.d.ts +28 -0
- package/clinkx-workflows/dist/dashboard/worker-lock-observer.js +241 -0
- package/clinkx-workflows/dist/dashboard/worker-lock-observer.js.map +1 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-DOkMXTfB.js +25 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-ChJsn0KD.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/contracts/council-plan-review-input-v1.json +158 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +15 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Mono-OFL.txt +93 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Sans-OFL.txt +93 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/JetBrains-Mono-OFL.txt +93 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/NOTICE.md +32 -0
- package/clinkx-workflows/dist/dashboard-ui/theme-init.js +8 -0
- package/clinkx-workflows/dist/definition-normalizer.d.ts +19 -0
- package/clinkx-workflows/dist/definition-normalizer.js.map +1 -1
- package/clinkx-workflows/dist/delegate-validate.d.ts +78 -0
- package/clinkx-workflows/dist/delegate-validate.js +97 -0
- package/clinkx-workflows/dist/delegate-validate.js.map +1 -0
- package/clinkx-workflows/dist/engine.d.ts +141 -0
- package/clinkx-workflows/dist/engine.js +882 -28
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/errors.d.ts +2 -0
- package/clinkx-workflows/dist/errors.js.map +1 -1
- package/clinkx-workflows/dist/fingerprint.d.ts +1 -1
- package/clinkx-workflows/dist/fingerprint.js +1 -1
- package/clinkx-workflows/dist/index.d.ts +19 -0
- package/clinkx-workflows/dist/index.js +15 -0
- package/clinkx-workflows/dist/index.js.map +1 -1
- package/clinkx-workflows/dist/loader.d.ts +9 -3
- package/clinkx-workflows/dist/loader.js +92 -21
- package/clinkx-workflows/dist/loader.js.map +1 -1
- package/clinkx-workflows/dist/plan-review/admission.d.ts +160 -0
- package/clinkx-workflows/dist/plan-review/admission.js +290 -0
- package/clinkx-workflows/dist/plan-review/admission.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/context-policy.d.ts +55 -0
- package/clinkx-workflows/dist/plan-review/context-policy.js +146 -0
- package/clinkx-workflows/dist/plan-review/context-policy.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/contract.d.ts +763 -0
- package/clinkx-workflows/dist/plan-review/contract.js +289 -0
- package/clinkx-workflows/dist/plan-review/contract.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/digest.d.ts +68 -0
- package/clinkx-workflows/dist/plan-review/digest.js +241 -0
- package/clinkx-workflows/dist/plan-review/digest.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/discovery.d.ts +45 -0
- package/clinkx-workflows/dist/plan-review/discovery.js +36 -0
- package/clinkx-workflows/dist/plan-review/discovery.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/execution-contract.d.ts +298 -0
- package/clinkx-workflows/dist/plan-review/execution-contract.js +194 -0
- package/clinkx-workflows/dist/plan-review/execution-contract.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/expander.d.ts +48 -0
- package/clinkx-workflows/dist/plan-review/expander.js +243 -0
- package/clinkx-workflows/dist/plan-review/expander.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/projector.d.ts +126 -0
- package/clinkx-workflows/dist/plan-review/projector.js +437 -0
- package/clinkx-workflows/dist/plan-review/projector.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/publication.d.ts +95 -0
- package/clinkx-workflows/dist/plan-review/publication.js +182 -0
- package/clinkx-workflows/dist/plan-review/publication.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/ranking-reducer.d.ts +34 -0
- package/clinkx-workflows/dist/plan-review/ranking-reducer.js +139 -0
- package/clinkx-workflows/dist/plan-review/ranking-reducer.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/resume.d.ts +38 -0
- package/clinkx-workflows/dist/plan-review/resume.js +122 -0
- package/clinkx-workflows/dist/plan-review/resume.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/rubric.d.ts +7 -0
- package/clinkx-workflows/dist/plan-review/rubric.js +24 -0
- package/clinkx-workflows/dist/plan-review/rubric.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/run-state.d.ts +398 -0
- package/clinkx-workflows/dist/plan-review/run-state.js +183 -0
- package/clinkx-workflows/dist/plan-review/run-state.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/runtime-policy.d.ts +74 -0
- package/clinkx-workflows/dist/plan-review/runtime-policy.js +186 -0
- package/clinkx-workflows/dist/plan-review/runtime-policy.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/snapshot.d.ts +81 -0
- package/clinkx-workflows/dist/plan-review/snapshot.js +170 -0
- package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/stage-error.d.ts +19 -0
- package/clinkx-workflows/dist/plan-review/stage-error.js +20 -0
- package/clinkx-workflows/dist/plan-review/stage-error.js.map +1 -0
- package/clinkx-workflows/dist/post-processors/index.d.ts +20 -0
- package/clinkx-workflows/dist/post-processors/index.js +21 -0
- package/clinkx-workflows/dist/post-processors/index.js.map +1 -0
- package/clinkx-workflows/dist/prompt-budget.d.ts +7 -0
- package/clinkx-workflows/dist/prompt-budget.js +7 -1
- package/clinkx-workflows/dist/prompt-budget.js.map +1 -1
- package/clinkx-workflows/dist/reducers/index.js +2 -0
- package/clinkx-workflows/dist/reducers/index.js.map +1 -1
- package/clinkx-workflows/dist/run-lock-heartbeat.d.ts +2 -0
- package/clinkx-workflows/dist/run-lock-heartbeat.js +3 -0
- package/clinkx-workflows/dist/run-lock-heartbeat.js.map +1 -0
- package/clinkx-workflows/dist/run-summary/cards/council-plan-review.d.ts +34 -0
- package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js +74 -0
- package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js.map +1 -0
- package/clinkx-workflows/dist/run-summary/cards/index.js +5 -0
- package/clinkx-workflows/dist/run-summary/cards/index.js.map +1 -1
- package/clinkx-workflows/dist/run-summary.d.ts +13 -0
- package/clinkx-workflows/dist/run-summary.js +29 -1
- package/clinkx-workflows/dist/run-summary.js.map +1 -1
- package/clinkx-workflows/dist/schema.d.ts +76 -21
- package/clinkx-workflows/dist/schema.js +10 -1
- package/clinkx-workflows/dist/schema.js.map +1 -1
- package/clinkx-workflows/dist/seed-terms.d.ts +30 -0
- package/clinkx-workflows/dist/seed-terms.js +176 -0
- package/clinkx-workflows/dist/seed-terms.js.map +1 -0
- package/clinkx-workflows/dist/server.d.ts +5 -2
- package/clinkx-workflows/dist/server.js +82 -52
- package/clinkx-workflows/dist/server.js.map +1 -1
- package/clinkx-workflows/dist/shutdown.d.ts +18 -20
- package/clinkx-workflows/dist/shutdown.js +43 -61
- package/clinkx-workflows/dist/shutdown.js.map +1 -1
- package/clinkx-workflows/dist/state-schema.d.ts +38 -0
- package/clinkx-workflows/dist/state.d.ts +170 -3
- package/clinkx-workflows/dist/state.js +1275 -28
- package/clinkx-workflows/dist/state.js.map +1 -1
- package/clinkx-workflows/dist/transport.d.ts +15 -0
- package/clinkx-workflows/dist/transport.js +19 -10
- package/clinkx-workflows/dist/transport.js.map +1 -1
- package/clinkx-workflows/dist/types.d.ts +14 -2
- package/clinkx-workflows/dist/validators/council.d.ts +318 -85
- package/clinkx-workflows/dist/validators/council.js +52 -13
- package/clinkx-workflows/dist/validators/council.js.map +1 -1
- package/clinkx-workflows/dist/validators/index.d.ts +1 -0
- package/clinkx-workflows/dist/validators/index.js +3 -0
- package/clinkx-workflows/dist/validators/index.js.map +1 -1
- package/clinkx-workflows/dist/validators/plan-review.d.ts +398 -0
- package/clinkx-workflows/dist/validators/plan-review.js +316 -0
- package/clinkx-workflows/dist/validators/plan-review.js.map +1 -0
- package/clinkx-workflows/dist/workflow-receipt.js +188 -4
- package/clinkx-workflows/dist/workflow-receipt.js.map +1 -1
- package/clinkx-workflows/dist/workflow-tools.d.ts +48 -3
- package/clinkx-workflows/dist/workflow-tools.js +1402 -59
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- package/clinkx-workflows/dist/workspace-signature.d.ts +16 -0
- package/clinkx-workflows/dist/workspace-signature.js +388 -0
- package/clinkx-workflows/dist/workspace-signature.js.map +1 -0
- package/clinkx-workflows/templates/council/answer-specialist.txt +2 -1
- package/clinkx-workflows/templates/council/code-review-chairman.txt +13 -0
- package/clinkx-workflows/templates/council/code-review-cross-reviewer.txt +4 -1
- package/clinkx-workflows/templates/council/code-review-reviewer.txt +19 -3
- package/clinkx-workflows/templates/council/debug-debugger.txt +2 -1
- package/clinkx-workflows/templates/council/discover-analyst.txt +2 -1
- package/clinkx-workflows/templates/council/member.txt +2 -1
- package/clinkx-workflows/templates/council/plan-review-chairman.txt +68 -0
- package/clinkx-workflows/templates/council/plan-review-cross-reviewer.txt +51 -0
- package/clinkx-workflows/templates/council/plan-review-reviewer.txt +60 -0
- package/clinkx-workflows/templates/plan-review/chairman.txt +48 -0
- package/clinkx-workflows/templates/plan-review/cross-review.txt +52 -0
- package/clinkx-workflows/templates/plan-review/ranking.txt +16 -0
- package/clinkx-workflows/templates/plan-review/reviewer.txt +57 -0
- package/clinkx-workflows/workflows/council-answer.yaml +97 -8
- package/clinkx-workflows/workflows/council-code-review.yaml +103 -8
- package/clinkx-workflows/workflows/council-debug.yaml +97 -8
- package/clinkx-workflows/workflows/council-default.yaml +97 -8
- package/clinkx-workflows/workflows/council-discover.yaml +97 -8
- package/clinkx-workflows/workflows/council-plan-review.yaml +250 -0
- package/clinkx-workflows/workflows/plan-review-receipts.yaml +230 -0
- package/conf/adapters/agy.json +49 -0
- package/conf/adapters/claude.json +5 -0
- package/conf/adapters/codex-app-server.json +44 -0
- package/conf/adapters/codex.json +7 -2
- package/conf/adapters/glm.json +5 -0
- package/conf/adapters/grok.json +60 -0
- package/conf/adapters/hapi/agy.json +52 -0
- package/conf/adapters/hapi/claude.json +5 -0
- package/conf/adapters/hapi/codex.json +7 -2
- package/conf/adapters/hapi/glm.json +5 -0
- package/conf/prompts/json-codereviewer.txt +1 -0
- package/conf/prompts/json.txt +1 -0
- package/dist/activity-journal.d.ts +42 -0
- package/dist/activity-journal.js +381 -0
- package/dist/activity-journal.js.map +1 -0
- package/dist/allowed-roots.d.ts +53 -0
- package/dist/allowed-roots.js +216 -0
- package/dist/allowed-roots.js.map +1 -0
- package/dist/codex/activity-session-log.d.ts +14 -0
- package/dist/codex/activity-session-log.js +206 -0
- package/dist/codex/activity-session-log.js.map +1 -0
- package/dist/codex/agent-tools.d.ts +23 -0
- package/dist/codex/agent-tools.js +1270 -0
- package/dist/codex/agent-tools.js.map +1 -0
- package/dist/codex/app-server-client.d.ts +76 -0
- package/dist/codex/app-server-client.js +582 -0
- package/dist/codex/app-server-client.js.map +1 -0
- package/dist/codex/app-server-registry.d.ts +389 -0
- package/dist/codex/app-server-registry.js +1407 -0
- package/dist/codex/app-server-registry.js.map +1 -0
- package/dist/codex/client-types.d.ts +109 -0
- package/dist/codex/client-types.js +2 -0
- package/dist/codex/client-types.js.map +1 -0
- package/dist/codex/protocol.d.ts +5375 -0
- package/dist/codex/protocol.js +614 -0
- package/dist/codex/protocol.js.map +1 -0
- package/dist/codex/session.d.ts +263 -0
- package/dist/codex/session.js +466 -0
- package/dist/codex/session.js.map +1 -0
- package/dist/config.d.ts +185 -19
- package/dist/config.js +82 -16
- package/dist/config.js.map +1 -1
- package/dist/context-builder/anchors.d.ts +12 -0
- package/dist/context-builder/anchors.js +22 -0
- package/dist/context-builder/anchors.js.map +1 -0
- package/dist/context-builder/bundle.d.ts +109 -0
- package/dist/context-builder/bundle.js +1498 -0
- package/dist/context-builder/bundle.js.map +1 -0
- package/dist/context-builder/codemap.d.ts +22 -0
- package/dist/context-builder/codemap.js +675 -0
- package/dist/context-builder/codemap.js.map +1 -0
- package/dist/context-builder/config.d.ts +61 -0
- package/dist/context-builder/config.js +216 -0
- package/dist/context-builder/config.js.map +1 -0
- package/dist/context-builder/context-run-catalog.d.ts +17 -0
- package/dist/context-builder/context-run-catalog.js +99 -0
- package/dist/context-builder/context-run-catalog.js.map +1 -0
- package/dist/context-builder/delegate-packet.d.ts +219 -0
- package/dist/context-builder/delegate-packet.js +1190 -0
- package/dist/context-builder/delegate-packet.js.map +1 -0
- package/dist/context-builder/delegate-reconstruction.d.ts +13 -0
- package/dist/context-builder/delegate-reconstruction.js +220 -0
- package/dist/context-builder/delegate-reconstruction.js.map +1 -0
- package/dist/context-builder/delegate-validation.d.ts +27 -0
- package/dist/context-builder/delegate-validation.js +479 -0
- package/dist/context-builder/delegate-validation.js.map +1 -0
- package/dist/context-builder/delegate.d.ts +26 -0
- package/dist/context-builder/delegate.js +134 -0
- package/dist/context-builder/delegate.js.map +1 -0
- package/dist/context-builder/diagnostics.d.ts +36 -0
- package/dist/context-builder/diagnostics.js +107 -0
- package/dist/context-builder/diagnostics.js.map +1 -0
- package/dist/context-builder/discovery.d.ts +146 -0
- package/dist/context-builder/discovery.js +2129 -0
- package/dist/context-builder/discovery.js.map +1 -0
- package/dist/context-builder/globs.d.ts +14 -0
- package/dist/context-builder/globs.js +175 -0
- package/dist/context-builder/globs.js.map +1 -0
- package/dist/context-builder/handler.d.ts +41 -0
- package/dist/context-builder/handler.js +2590 -0
- package/dist/context-builder/handler.js.map +1 -0
- package/dist/context-builder/lifecycle-contract.d.ts +424 -0
- package/dist/context-builder/lifecycle-contract.js +523 -0
- package/dist/context-builder/lifecycle-contract.js.map +1 -0
- package/dist/context-builder/lifecycle-journal.d.ts +62 -0
- package/dist/context-builder/lifecycle-journal.js +88 -0
- package/dist/context-builder/lifecycle-journal.js.map +1 -0
- package/dist/context-builder/lifecycle-observer.d.ts +102 -0
- package/dist/context-builder/lifecycle-observer.js +258 -0
- package/dist/context-builder/lifecycle-observer.js.map +1 -0
- package/dist/context-builder/lifecycle-reconcile.d.ts +32 -0
- package/dist/context-builder/lifecycle-reconcile.js +191 -0
- package/dist/context-builder/lifecycle-reconcile.js.map +1 -0
- package/dist/context-builder/lifecycle-recovery.d.ts +2 -0
- package/dist/context-builder/lifecycle-recovery.js +14 -0
- package/dist/context-builder/lifecycle-recovery.js.map +1 -0
- package/dist/context-builder/path-signals.d.ts +7 -0
- package/dist/context-builder/path-signals.js +70 -0
- package/dist/context-builder/path-signals.js.map +1 -0
- package/dist/context-builder/paths.d.ts +30 -0
- package/dist/context-builder/paths.js +153 -0
- package/dist/context-builder/paths.js.map +1 -0
- package/dist/context-builder/progress.d.ts +17 -0
- package/dist/context-builder/progress.js +93 -0
- package/dist/context-builder/progress.js.map +1 -0
- package/dist/context-builder/receipt.d.ts +91 -0
- package/dist/context-builder/receipt.js +180 -0
- package/dist/context-builder/receipt.js.map +1 -0
- package/dist/context-builder/refine-handler.d.ts +14 -0
- package/dist/context-builder/refine-handler.js +790 -0
- package/dist/context-builder/refine-handler.js.map +1 -0
- package/dist/context-builder/review-coverage.d.ts +84 -0
- package/dist/context-builder/review-coverage.js +437 -0
- package/dist/context-builder/review-coverage.js.map +1 -0
- package/dist/context-builder/run-id.d.ts +7 -0
- package/dist/context-builder/run-id.js +31 -0
- package/dist/context-builder/run-id.js.map +1 -0
- package/dist/context-builder/schema.d.ts +669 -0
- package/dist/context-builder/schema.js +399 -0
- package/dist/context-builder/schema.js.map +1 -0
- package/dist/context-builder/secrets.d.ts +41 -0
- package/dist/context-builder/secrets.js +1651 -0
- package/dist/context-builder/secrets.js.map +1 -0
- package/dist/context-builder/selection.d.ts +56 -0
- package/dist/context-builder/selection.js +1111 -0
- package/dist/context-builder/selection.js.map +1 -0
- package/dist/context-builder/session-log-identity.d.ts +1 -0
- package/dist/context-builder/session-log-identity.js +66 -0
- package/dist/context-builder/session-log-identity.js.map +1 -0
- package/dist/context-builder/slice-range-math.d.ts +16 -0
- package/dist/context-builder/slice-range-math.js +137 -0
- package/dist/context-builder/slice-range-math.js.map +1 -0
- package/dist/context-builder/status.d.ts +66 -0
- package/dist/context-builder/status.js +160 -0
- package/dist/context-builder/status.js.map +1 -0
- package/dist/context-builder/storage.d.ts +118 -0
- package/dist/context-builder/storage.js +1003 -0
- package/dist/context-builder/storage.js.map +1 -0
- package/dist/context-builder/token-estimate.d.ts +19 -0
- package/dist/context-builder/token-estimate.js +90 -0
- package/dist/context-builder/token-estimate.js.map +1 -0
- package/dist/context-builder/versions.d.ts +29 -0
- package/dist/context-builder/versions.js +30 -0
- package/dist/context-builder/versions.js.map +1 -0
- package/dist/context-builder/workflow-runner.d.ts +69 -0
- package/dist/context-builder/workflow-runner.js +1051 -0
- package/dist/context-builder/workflow-runner.js.map +1 -0
- package/dist/context-builder/write-watchdog.d.ts +14 -0
- package/dist/context-builder/write-watchdog.js +38 -0
- package/dist/context-builder/write-watchdog.js.map +1 -0
- package/dist/dashboard-adapter-catalog.d.ts +9 -0
- package/dist/dashboard-adapter-catalog.js +46 -0
- package/dist/dashboard-adapter-catalog.js.map +1 -0
- package/dist/dashboard-cli.d.ts +79 -0
- package/dist/dashboard-cli.js +585 -0
- package/dist/dashboard-cli.js.map +1 -0
- package/dist/dashboard-companion/client.d.ts +36 -0
- package/dist/dashboard-companion/client.js +210 -0
- package/dist/dashboard-companion/client.js.map +1 -0
- package/dist/dashboard-companion/config.d.ts +8 -0
- package/dist/dashboard-companion/config.js +52 -0
- package/dist/dashboard-companion/config.js.map +1 -0
- package/dist/dashboard-companion/http-proxy.d.ts +10 -0
- package/dist/dashboard-companion/http-proxy.js +234 -0
- package/dist/dashboard-companion/http-proxy.js.map +1 -0
- package/dist/dashboard-companion/protocol.d.ts +80 -0
- package/dist/dashboard-companion/protocol.js +455 -0
- package/dist/dashboard-companion/protocol.js.map +1 -0
- package/dist/dashboard-companion/standalone-assets.d.ts +12 -0
- package/dist/dashboard-companion/standalone-assets.js +72 -0
- package/dist/dashboard-companion/standalone-assets.js.map +1 -0
- package/dist/dashboard-companion/standalone-entry.d.ts +1 -0
- package/dist/dashboard-companion/standalone-entry.js +17 -0
- package/dist/dashboard-companion/standalone-entry.js.map +1 -0
- package/dist/dashboard-gateway/config.d.ts +9 -0
- package/dist/dashboard-gateway/config.js +44 -0
- package/dist/dashboard-gateway/config.js.map +1 -0
- package/dist/dashboard-gateway/index.d.ts +11 -0
- package/dist/dashboard-gateway/index.js +755 -0
- package/dist/dashboard-gateway/index.js.map +1 -0
- package/dist/dashboard-gateway/main.d.ts +1 -0
- package/dist/dashboard-gateway/main.js +25 -0
- package/dist/dashboard-gateway/main.js.map +1 -0
- package/dist/dashboard-pairing-token.d.ts +1 -0
- package/dist/dashboard-pairing-token.js +5 -0
- package/dist/dashboard-pairing-token.js.map +1 -0
- package/dist/elaris/client.d.ts +73 -0
- package/dist/elaris/client.js +825 -0
- package/dist/elaris/client.js.map +1 -0
- package/dist/elaris/config.d.ts +18 -0
- package/dist/elaris/config.js +75 -0
- package/dist/elaris/config.js.map +1 -0
- package/dist/elaris/errors.d.ts +41 -0
- package/dist/elaris/errors.js +205 -0
- package/dist/elaris/errors.js.map +1 -0
- package/dist/elaris/github-repo.d.ts +18 -0
- package/dist/elaris/github-repo.js +89 -0
- package/dist/elaris/github-repo.js.map +1 -0
- package/dist/elaris/index.d.ts +10 -0
- package/dist/elaris/index.js +11 -0
- package/dist/elaris/index.js.map +1 -0
- package/dist/elaris/redact.d.ts +89 -0
- package/dist/elaris/redact.js +423 -0
- package/dist/elaris/redact.js.map +1 -0
- package/dist/elaris/run-id.d.ts +5 -0
- package/dist/elaris/run-id.js +20 -0
- package/dist/elaris/run-id.js.map +1 -0
- package/dist/elaris/status.d.ts +45 -0
- package/dist/elaris/status.js +122 -0
- package/dist/elaris/status.js.map +1 -0
- package/dist/elaris/tool-schemas.d.ts +314 -0
- package/dist/elaris/tool-schemas.js +208 -0
- package/dist/elaris/tool-schemas.js.map +1 -0
- package/dist/elaris/tools.d.ts +73 -0
- package/dist/elaris/tools.js +1065 -0
- package/dist/elaris/tools.js.map +1 -0
- package/dist/elaris/types.d.ts +1541 -0
- package/dist/elaris/types.js +252 -0
- package/dist/elaris/types.js.map +1 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.js +19 -0
- package/dist/errors.js.map +1 -1
- package/dist/handler.d.ts +4 -0
- package/dist/handler.js +10 -1
- package/dist/handler.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/local-clink-backend.d.ts +3 -0
- package/dist/local-clink-backend.js +4 -0
- package/dist/local-clink-backend.js.map +1 -1
- package/dist/package-info.d.ts +2 -0
- package/dist/package-info.js +18 -0
- package/dist/package-info.js.map +1 -0
- package/dist/parsers/codex-jsonl.js +48 -3
- package/dist/parsers/codex-jsonl.js.map +1 -1
- package/dist/parsers/extract.d.ts +10 -1
- package/dist/parsers/extract.js +11 -3
- package/dist/parsers/extract.js.map +1 -1
- package/dist/paths.d.ts +8 -0
- package/dist/paths.js +31 -43
- package/dist/paths.js.map +1 -1
- package/dist/pipeline.d.ts +51 -3
- package/dist/pipeline.js +264 -47
- package/dist/pipeline.js.map +1 -1
- package/dist/run-dir.d.ts +24 -0
- package/dist/run-dir.js +201 -2
- package/dist/run-dir.js.map +1 -1
- package/dist/runner.d.ts +13 -0
- package/dist/runner.js +184 -15
- package/dist/runner.js.map +1 -1
- package/dist/safety.d.ts +4 -4
- package/dist/safety.js +4 -4
- package/dist/schema.d.ts +7 -7
- package/dist/server.d.ts +2 -0
- package/dist/server.js +396 -24
- package/dist/server.js.map +1 -1
- package/dist/session-log-stream.d.ts +18 -0
- package/dist/session-log-stream.js +319 -0
- package/dist/session-log-stream.js.map +1 -0
- package/package.json +47 -5
- package/conf/adapters/gemini.json +0 -44
- package/conf/adapters/hapi/gemini.json +0 -47
- package/dist/artifacts.d.ts +0 -9
- package/dist/artifacts.js +0 -24
- package/dist/artifacts.js.map +0 -1
- package/dist/parsers/gemini-json.d.ts +0 -2
- package/dist/parsers/gemini-json.js +0 -72
- package/dist/parsers/gemini-json.js.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export interface RedactOptions {
|
|
2
|
+
apiKeyEnvName?: string | undefined;
|
|
3
|
+
apiKeyValue?: string | undefined;
|
|
4
|
+
maxDepth?: number | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Object keys whose values are exempt from BOTH the aggressive bare-entropy
|
|
7
|
+
* LONG_TOKEN_PATTERN rule AND keyword-proximity. Used to protect control-plane
|
|
8
|
+
* locators (cursors, URLs, ids, ranges, paths) from having their UUIDs/URLs/
|
|
9
|
+
* base64 cursors — or legitimate keyworded paths like
|
|
10
|
+
* `artifacts/auth_token_<hex>.log` — shredded. Preserved string values still
|
|
11
|
+
* receive the UNAMBIGUOUS credential shapes (own-key / Bearer / prefixed vendor
|
|
12
|
+
* token), and preserved object/array values are still recursed into —
|
|
13
|
+
* preservation is not a blanket redaction bypass.
|
|
14
|
+
*/
|
|
15
|
+
preserveKeys?: ReadonlySet<string> | undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Control-plane locator keys whose values must survive the aggressive
|
|
19
|
+
* bare-entropy rule so the caller still receives usable locators.
|
|
20
|
+
*
|
|
21
|
+
* LONG_TOKEN_PATTERN matches any >=32 char run of [A-Za-z0-9+/=_-], which
|
|
22
|
+
* destroys legitimate URLs/paths, UUID ids, and base64 cursors; keyword-proximity
|
|
23
|
+
* likewise over-redacts legitimate keyworded paths (e.g.
|
|
24
|
+
* `artifacts/auth_token_<hex>.log`, where the `token` keyword sits next to an
|
|
25
|
+
* opaque hex run). These keys are exempt from BOTH rules — their string values
|
|
26
|
+
* still receive the UNAMBIGUOUS credential shapes (own-key / Bearer / prefixed
|
|
27
|
+
* vendor token) and their object/array values are still recursed into, so a real
|
|
28
|
+
* credential embedded in a locator field cannot bypass redaction while legitimate
|
|
29
|
+
* locators survive.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_LOCATOR_KEYS: readonly string[];
|
|
32
|
+
export declare function redact(value: unknown): unknown;
|
|
33
|
+
export declare function redactWithOptions(value: unknown, options?: RedactOptions): unknown;
|
|
34
|
+
/**
|
|
35
|
+
* Metadata-bearing analog of {@link redact}: deep-redacts `value` in the SAME
|
|
36
|
+
* single pass and additionally reports how many redactions fired
|
|
37
|
+
* (`redaction_count`) — each [REDACTED] token substitution and each field-level
|
|
38
|
+
* clobber counts once. When `apiKeyEnvName`/`apiKeyValue` are omitted they are
|
|
39
|
+
* resolved from the environment exactly like {@link redact}, so read paths get
|
|
40
|
+
* own-credential scrubbing by default. Counting happens DURING the existing
|
|
41
|
+
* walk; the tree is never traversed twice.
|
|
42
|
+
*/
|
|
43
|
+
export declare function redactWithMetadata(value: unknown, options?: RedactOptions): {
|
|
44
|
+
value: unknown;
|
|
45
|
+
redaction_count: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Shared high-confidence credential detector. Returns the number of distinct
|
|
49
|
+
* high-confidence credential redactions the ruleset would apply to `text`:
|
|
50
|
+
* own-key env name/value, Bearer tokens, prefixed vendor tokens, and
|
|
51
|
+
* keyword-proximity high-entropy runs. Deliberately does NOT flag bare-entropy
|
|
52
|
+
* long tokens, git SHAs, JWTs, plain base64, or UUIDs. This is the same ruleset
|
|
53
|
+
* used by the read-path redactor — one source of truth.
|
|
54
|
+
*/
|
|
55
|
+
export declare function detectCredentials(text: string): {
|
|
56
|
+
count: number;
|
|
57
|
+
};
|
|
58
|
+
/** Convenience boolean wrapper over {@link detectCredentials}. */
|
|
59
|
+
export declare function hasCredential(text: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Deep-redact a value like {@link redact} but exempt control-plane locator keys
|
|
62
|
+
* from BOTH the aggressive bare-entropy rule AND keyword-proximity so cursors,
|
|
63
|
+
* URLs, ids, ranges, and keyworded paths (e.g. `artifacts/auth_token_<hex>.log`)
|
|
64
|
+
* survive. Preserved string values still get the UNAMBIGUOUS credential shapes
|
|
65
|
+
* (own-key / Bearer / prefixed vendor token); preserved objects/arrays still
|
|
66
|
+
* recurse. Caller-supplied `locatorKeys` EXTEND the default allowlist (they never
|
|
67
|
+
* shrink it).
|
|
68
|
+
*/
|
|
69
|
+
export declare function redactPreservingLocators(value: unknown, locatorKeys?: Iterable<string>): unknown;
|
|
70
|
+
/**
|
|
71
|
+
* Metadata-bearing analog of {@link redactPreservingLocators}: deep-redacts
|
|
72
|
+
* `value` in the SAME single pass, exempts control-plane locators from BOTH the
|
|
73
|
+
* bare-entropy rule and keyword-proximity (they still get the unambiguous
|
|
74
|
+
* own-key / Bearer / prefixed-vendor-token scrubbing), and reports
|
|
75
|
+
* `redaction_count`. Used by the read-path client so a redaction count
|
|
76
|
+
* can bubble to the tool envelope without a second traversal.
|
|
77
|
+
*/
|
|
78
|
+
export declare function redactPreservingLocatorsWithMetadata(value: unknown, locatorKeys?: Iterable<string>): {
|
|
79
|
+
value: unknown;
|
|
80
|
+
redaction_count: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Scrub ONLY ClinkX's own credentials from a string: the Bearer header pattern,
|
|
84
|
+
* the api-key env-var name, and the api-key value. Deliberately does NOT apply
|
|
85
|
+
* TOKEN_LIKE_PATTERN or LONG_TOKEN_PATTERN, so raw artifact bytes (hashes,
|
|
86
|
+
* base64 blobs, long identifiers) are not corrupted. Use for explicit
|
|
87
|
+
* raw-inspection paths where the caller asked for provider bytes verbatim.
|
|
88
|
+
*/
|
|
89
|
+
export declare function scrubOwnCredentials(text: string): string;
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
const DEFAULT_SECRET_FIELD_PATTERN = /(?:authorization|api[_-]?key|secret|token|password|credential|bearer)/i;
|
|
2
|
+
const BEARER_PATTERN = /\bBearer\s+[A-Za-z0-9._~+/=-]+/gi;
|
|
3
|
+
/**
|
|
4
|
+
* High-confidence PREFIXED credential shapes. Each alternative carries a vendor
|
|
5
|
+
* marker (a scheme prefix or a fixed-length structured body) so a match is a
|
|
6
|
+
* credential, not arbitrary high-entropy content. Extends the original GitHub /
|
|
7
|
+
* Stripe / ClinkX family with AWS, Slack, Google, GitLab, npm, and Anthropic.
|
|
8
|
+
*/
|
|
9
|
+
const TOKEN_LIKE_PATTERN = new RegExp([
|
|
10
|
+
// prefix_<body>: stripe (sk/pk), github (ghp/gho/ghu/ghs/github_pat), npm, clinkx (cxel/cxmsg)
|
|
11
|
+
"\\b(?:sk|pk|ghp|gho|ghu|ghs|github_pat|cxel|cxmsg|npm)_[A-Za-z0-9_:-]{12,}\\b",
|
|
12
|
+
// anthropic: sk-ant-...
|
|
13
|
+
"\\bsk-ant-[A-Za-z0-9_-]{12,}\\b",
|
|
14
|
+
// gitlab personal access token: glpat-...
|
|
15
|
+
"\\bglpat-[A-Za-z0-9_-]{12,}\\b",
|
|
16
|
+
// slack: xoxb-/xoxp-/xoxa-/xoxr-/xoxs-...
|
|
17
|
+
"\\bxox[baprs]-[A-Za-z0-9-]{10,}\\b",
|
|
18
|
+
// aws access key id: AKIA/ASIA + 16 uppercase alnum
|
|
19
|
+
"\\b(?:AKIA|ASIA)[0-9A-Z]{16}\\b",
|
|
20
|
+
// google api key: AIza + 35
|
|
21
|
+
"\\bAIza[0-9A-Za-z_-]{35}\\b",
|
|
22
|
+
].join("|"), "g");
|
|
23
|
+
/**
|
|
24
|
+
* Aggressive bare-entropy fallback. Default OFF — it destroys legitimate content
|
|
25
|
+
* (git SHAs, JWTs, base64 blobs, UUIDs). Re-enabled only via the opt-in
|
|
26
|
+
* CLINKX_ELARIS_REDACT_AGGRESSIVE flag. See {@link isAggressiveRedaction}.
|
|
27
|
+
*/
|
|
28
|
+
const LONG_TOKEN_PATTERN = /\b[A-Za-z0-9+/=_-]{32,}\b/g;
|
|
29
|
+
/**
|
|
30
|
+
* Credential-keyword proximity rule (single source of truth, shared by the
|
|
31
|
+
* detector and the read-path redactor). A high-entropy run is treated as a
|
|
32
|
+
* credential ONLY when one of these keywords sits within a small window of it,
|
|
33
|
+
* so secrets labelled `api_key=`, `secret:`, `password ...`, `token=`, or
|
|
34
|
+
* `authorization` are caught while bare high-entropy content is left alone.
|
|
35
|
+
*/
|
|
36
|
+
const CREDENTIAL_KEYWORD_PATTERN = /(?:api[_-]?key|secret|token|password|authorization)/gi;
|
|
37
|
+
const HIGH_ENTROPY_RUN_PATTERN = /[A-Za-z0-9+/=_-]{16,}/g;
|
|
38
|
+
const KEYWORD_PROXIMITY_WINDOW = 24;
|
|
39
|
+
const DEFAULT_MAX_DEPTH = 8;
|
|
40
|
+
const REDACTED = "[REDACTED]";
|
|
41
|
+
/**
|
|
42
|
+
* Control-plane locator keys whose values must survive the aggressive
|
|
43
|
+
* bare-entropy rule so the caller still receives usable locators.
|
|
44
|
+
*
|
|
45
|
+
* LONG_TOKEN_PATTERN matches any >=32 char run of [A-Za-z0-9+/=_-], which
|
|
46
|
+
* destroys legitimate URLs/paths, UUID ids, and base64 cursors; keyword-proximity
|
|
47
|
+
* likewise over-redacts legitimate keyworded paths (e.g.
|
|
48
|
+
* `artifacts/auth_token_<hex>.log`, where the `token` keyword sits next to an
|
|
49
|
+
* opaque hex run). These keys are exempt from BOTH rules — their string values
|
|
50
|
+
* still receive the UNAMBIGUOUS credential shapes (own-key / Bearer / prefixed
|
|
51
|
+
* vendor token) and their object/array values are still recursed into, so a real
|
|
52
|
+
* credential embedded in a locator field cannot bypass redaction while legitimate
|
|
53
|
+
* locators survive.
|
|
54
|
+
*/
|
|
55
|
+
export const DEFAULT_LOCATOR_KEYS = [
|
|
56
|
+
"next_cursor",
|
|
57
|
+
"resume_cursor",
|
|
58
|
+
"cursor",
|
|
59
|
+
"status_url",
|
|
60
|
+
"result_url",
|
|
61
|
+
"content_url",
|
|
62
|
+
"events_url",
|
|
63
|
+
"logs_url",
|
|
64
|
+
"artifacts_url",
|
|
65
|
+
"session_id",
|
|
66
|
+
"chat_id",
|
|
67
|
+
"run_id",
|
|
68
|
+
"turn_id",
|
|
69
|
+
"message_id",
|
|
70
|
+
"call_id",
|
|
71
|
+
"request_id",
|
|
72
|
+
"stage_id",
|
|
73
|
+
"content_range",
|
|
74
|
+
"accept_ranges",
|
|
75
|
+
"path",
|
|
76
|
+
];
|
|
77
|
+
export function redact(value) {
|
|
78
|
+
const apiKeyEnvName = process.env["CLINKX_ELARIS_API_KEY_ENV"] ?? "CLINKX_ELARIS_API_KEY";
|
|
79
|
+
return redactWithOptions(value, {
|
|
80
|
+
apiKeyEnvName,
|
|
81
|
+
apiKeyValue: process.env[apiKeyEnvName],
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export function redactWithOptions(value, options = {}) {
|
|
85
|
+
return redactInner(value, options, 0);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Metadata-bearing analog of {@link redact}: deep-redacts `value` in the SAME
|
|
89
|
+
* single pass and additionally reports how many redactions fired
|
|
90
|
+
* (`redaction_count`) — each [REDACTED] token substitution and each field-level
|
|
91
|
+
* clobber counts once. When `apiKeyEnvName`/`apiKeyValue` are omitted they are
|
|
92
|
+
* resolved from the environment exactly like {@link redact}, so read paths get
|
|
93
|
+
* own-credential scrubbing by default. Counting happens DURING the existing
|
|
94
|
+
* walk; the tree is never traversed twice.
|
|
95
|
+
*/
|
|
96
|
+
export function redactWithMetadata(value, options = {}) {
|
|
97
|
+
const counter = { n: 0 };
|
|
98
|
+
const redacted = redactInner(value, withEnvApiKeyDefaults(options), 0, counter);
|
|
99
|
+
return { value: redacted, redaction_count: counter.n };
|
|
100
|
+
}
|
|
101
|
+
function redactInner(value, options, depth, counter) {
|
|
102
|
+
if (depth > (options.maxDepth ?? DEFAULT_MAX_DEPTH))
|
|
103
|
+
return "[MaxDepth]";
|
|
104
|
+
if (typeof value === "string")
|
|
105
|
+
return redactString(value, options, counter);
|
|
106
|
+
if (value == null || typeof value === "number" || typeof value === "boolean")
|
|
107
|
+
return value;
|
|
108
|
+
if (Array.isArray(value))
|
|
109
|
+
return value.map((item) => redactInner(item, options, depth + 1, counter));
|
|
110
|
+
if (typeof value === "object") {
|
|
111
|
+
const out = {};
|
|
112
|
+
for (const [key, item] of Object.entries(value)) {
|
|
113
|
+
if (options.preserveKeys?.has(key)) {
|
|
114
|
+
out[key] = redactPreservedLocator(item, options, depth, counter);
|
|
115
|
+
}
|
|
116
|
+
else if (shouldRedactField(key, options) && isRedactableFieldValue(item)) {
|
|
117
|
+
out[key] = REDACTED;
|
|
118
|
+
if (counter)
|
|
119
|
+
counter.n += 1;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
out[key] = redactInner(item, options, depth + 1, counter);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Redact a value stored under a PRESERVED locator key. Locators (cursors, URLs,
|
|
131
|
+
* ids, ranges, paths) are exactly where keyword-adjacent high-entropy runs are
|
|
132
|
+
* legitimate (e.g. `artifacts/auth_token_a1b2c3d4e5f6g7h8.log`), not secrets, so
|
|
133
|
+
* a preserved locator is EXEMPT from BOTH the bare-entropy LONG_TOKEN rule AND
|
|
134
|
+
* keyword-proximity — either would shred a legitimate path/URL/cursor. But
|
|
135
|
+
* preservation must NOT be a blanket bypass for real credentials embedded in a
|
|
136
|
+
* locator value. So:
|
|
137
|
+
* - string → apply ONLY the UNAMBIGUOUS credential shapes via
|
|
138
|
+
* {@link redactUnambiguousCredentials}: own-key env name+value,
|
|
139
|
+
* Bearer, and prefixed vendor tokens (sk, pk, ghp, sk-ant,
|
|
140
|
+
* glpat, xox_, AKIA|ASIA, AIza). NEVER keyword-proximity and NEVER
|
|
141
|
+
* LONG_TOKEN_PATTERN. UUIDs/URLs/base64 cursors and keyworded
|
|
142
|
+
* paths pass through intact, while an embedded Bearer/vendor/own-key
|
|
143
|
+
* secret is still scrubbed.
|
|
144
|
+
* - object/array → recurse via {@link redactInner} so nested fields keep their
|
|
145
|
+
* protection and nested preserved keys stay preserved.
|
|
146
|
+
* - number/boolean/null → passed through unchanged.
|
|
147
|
+
*/
|
|
148
|
+
function redactPreservedLocator(value, options, depth, counter) {
|
|
149
|
+
if (typeof value === "string") {
|
|
150
|
+
const { text, count } = redactUnambiguousCredentials(value, options);
|
|
151
|
+
if (counter)
|
|
152
|
+
counter.n += count;
|
|
153
|
+
return text;
|
|
154
|
+
}
|
|
155
|
+
if (value !== null && typeof value === "object") {
|
|
156
|
+
return redactInner(value, options, depth + 1, counter);
|
|
157
|
+
}
|
|
158
|
+
return value;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Fill in env-derived own-key options (name + value) when the caller supplied
|
|
162
|
+
* neither, matching {@link redact}. A caller that passes an explicit
|
|
163
|
+
* `apiKeyEnvName` or `apiKeyValue` keeps {@link redactWithOptions} semantics
|
|
164
|
+
* (no env fallback).
|
|
165
|
+
*/
|
|
166
|
+
function withEnvApiKeyDefaults(options) {
|
|
167
|
+
if (options.apiKeyEnvName !== undefined || options.apiKeyValue !== undefined)
|
|
168
|
+
return options;
|
|
169
|
+
const apiKeyEnvName = process.env["CLINKX_ELARIS_API_KEY_ENV"] ?? "CLINKX_ELARIS_API_KEY";
|
|
170
|
+
return { ...options, apiKeyEnvName, apiKeyValue: process.env[apiKeyEnvName] };
|
|
171
|
+
}
|
|
172
|
+
function shouldRedactField(key, options) {
|
|
173
|
+
if (DEFAULT_SECRET_FIELD_PATTERN.test(key))
|
|
174
|
+
return true;
|
|
175
|
+
return options.apiKeyEnvName === key;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Whether a value matched by a secret-bearing FIELD NAME should be replaced with
|
|
179
|
+
* the [REDACTED] marker. Only strings (literal secrets) and objects/arrays
|
|
180
|
+
* (which may nest secrets) are clobbered. Numbers, booleans, and null are passed
|
|
181
|
+
* through: a field like `input_tokens`/`total_tokens` matches the "token"
|
|
182
|
+
* keyword but holds a count, not a credential — redacting it would corrupt
|
|
183
|
+
* legitimate typed metadata.
|
|
184
|
+
*/
|
|
185
|
+
function isRedactableFieldValue(value) {
|
|
186
|
+
return typeof value === "string" || (value !== null && typeof value === "object");
|
|
187
|
+
}
|
|
188
|
+
function redactString(value, options, counter) {
|
|
189
|
+
const { text, count } = redactHighConfidence(value, options);
|
|
190
|
+
if (counter)
|
|
191
|
+
counter.n += count;
|
|
192
|
+
if (!isAggressiveRedaction())
|
|
193
|
+
return text;
|
|
194
|
+
return text.replace(LONG_TOKEN_PATTERN, (match) => {
|
|
195
|
+
if (/^\d+$/.test(match))
|
|
196
|
+
return match;
|
|
197
|
+
if (counter)
|
|
198
|
+
counter.n += 1;
|
|
199
|
+
return REDACTED;
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Whether the opt-in aggressive bare-entropy rule is enabled. Default OFF: read
|
|
204
|
+
* paths only redact high-confidence credential shapes so SHAs, JWTs, base64
|
|
205
|
+
* blobs, and UUIDs pass through. Set `CLINKX_ELARIS_REDACT_AGGRESSIVE=true` to
|
|
206
|
+
* restore the legacy behavior of clobbering every >=32-char alphanumeric run.
|
|
207
|
+
*/
|
|
208
|
+
function isAggressiveRedaction() {
|
|
209
|
+
return process.env["CLINKX_ELARIS_REDACT_AGGRESSIVE"] === "true";
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Apply the SINGLE high-confidence credential ruleset to a string and report how
|
|
213
|
+
* many redactions fired. Shared verbatim by {@link redactString} (read-path
|
|
214
|
+
* redaction) and {@link detectCredentials} (fail-closed detection) so there is
|
|
215
|
+
* exactly one ruleset, never two that can drift. The bare-entropy
|
|
216
|
+
* LONG_TOKEN_PATTERN is deliberately NOT part of this set.
|
|
217
|
+
*/
|
|
218
|
+
function redactHighConfidence(value, options) {
|
|
219
|
+
const unambiguous = redactUnambiguousCredentials(value, options);
|
|
220
|
+
let text = unambiguous.text;
|
|
221
|
+
let count = unambiguous.count;
|
|
222
|
+
const proximity = redactKeywordProximity(text);
|
|
223
|
+
text = proximity.text;
|
|
224
|
+
count += proximity.count;
|
|
225
|
+
return { text, count };
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* The UNAMBIGUOUS subset of {@link redactHighConfidence}: own-key env name +
|
|
229
|
+
* own-key value (split/join), {@link BEARER_PATTERN}, and {@link
|
|
230
|
+
* TOKEN_LIKE_PATTERN} (prefixed vendor tokens). Every one of these carries an
|
|
231
|
+
* explicit vendor/scheme marker or matches ClinkX's own configured credential,
|
|
232
|
+
* so a hit is a real secret regardless of surrounding text. This subset
|
|
233
|
+
* DELIBERATELY excludes {@link redactKeywordProximity} (keyword-adjacent
|
|
234
|
+
* high-entropy runs) and the bare-entropy {@link LONG_TOKEN_PATTERN}, both of
|
|
235
|
+
* which are heuristic and over-fire on legitimate locators (paths/URLs/cursors
|
|
236
|
+
* that merely contain a credential-keyword substring next to an opaque run).
|
|
237
|
+
* Used by the preserved-locator branch so real embedded credentials are still
|
|
238
|
+
* scrubbed without shredding legitimate keyworded locators.
|
|
239
|
+
*/
|
|
240
|
+
function redactUnambiguousCredentials(value, options) {
|
|
241
|
+
let text = value;
|
|
242
|
+
let count = 0;
|
|
243
|
+
const bearer = replaceCounting(text, BEARER_PATTERN, () => `Bearer ${REDACTED}`);
|
|
244
|
+
text = bearer.text;
|
|
245
|
+
count += bearer.count;
|
|
246
|
+
if (options.apiKeyEnvName) {
|
|
247
|
+
const scrubbed = splitJoinCounting(text, options.apiKeyEnvName, REDACTED);
|
|
248
|
+
text = scrubbed.text;
|
|
249
|
+
count += scrubbed.count;
|
|
250
|
+
}
|
|
251
|
+
if (options.apiKeyValue) {
|
|
252
|
+
const scrubbed = splitJoinCounting(text, options.apiKeyValue, REDACTED);
|
|
253
|
+
text = scrubbed.text;
|
|
254
|
+
count += scrubbed.count;
|
|
255
|
+
}
|
|
256
|
+
const tokenLike = replaceCounting(text, TOKEN_LIKE_PATTERN, () => REDACTED);
|
|
257
|
+
text = tokenLike.text;
|
|
258
|
+
count += tokenLike.count;
|
|
259
|
+
return { text, count };
|
|
260
|
+
}
|
|
261
|
+
function replaceCounting(text, pattern, replacement) {
|
|
262
|
+
let count = 0;
|
|
263
|
+
const out = text.replace(pattern, (match) => {
|
|
264
|
+
count += 1;
|
|
265
|
+
return replacement(match);
|
|
266
|
+
});
|
|
267
|
+
return { text: out, count };
|
|
268
|
+
}
|
|
269
|
+
function splitJoinCounting(text, needle, replacement) {
|
|
270
|
+
if (!needle)
|
|
271
|
+
return { text, count: 0 };
|
|
272
|
+
const parts = text.split(needle);
|
|
273
|
+
return { text: parts.join(replacement), count: parts.length - 1 };
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Redact each high-entropy run that sits within {@link KEYWORD_PROXIMITY_WINDOW}
|
|
277
|
+
* characters of a credential keyword. Runs with no nearby keyword (bare SHAs,
|
|
278
|
+
* UUIDs, base64) are passed through untouched.
|
|
279
|
+
*
|
|
280
|
+
* Linear (O(K+R)) equivalent of the original O(K*R) per-run keyword scan. The
|
|
281
|
+
* old "near" predicate for a run [start,end) held iff, for SOME keyword range
|
|
282
|
+
* [kStart,kEnd), one of three clauses was true: keyword-before-within-W,
|
|
283
|
+
* keyword-after-within-W, or overlap. Those three clauses union to exactly "the
|
|
284
|
+
* run intersects the keyword range expanded by W on each side" — the danger zone
|
|
285
|
+
* [kStart - W, kEnd + W] (endpoints inclusive; run end is exclusive). So we
|
|
286
|
+
* pre-expand every keyword range by W, MERGE the expanded intervals into a
|
|
287
|
+
* sorted, disjoint list of zones, then sweep the (already ascending) high-entropy
|
|
288
|
+
* runs against the (ascending) zones with one advancing index: drop zones that
|
|
289
|
+
* end before the run starts, then the run is near iff the current zone starts
|
|
290
|
+
* at/before the run end. Each sequence is visited once — a single linear pass,
|
|
291
|
+
* no per-run scan of all keywords.
|
|
292
|
+
*
|
|
293
|
+
* Worst case: K keyword ranges + R entropy runs → O(K + R) time and O(K) space
|
|
294
|
+
* for the merged zones, replacing the O(K*R) product that stalled for seconds on
|
|
295
|
+
* a ~1 MiB response densely labelled with credential keywords.
|
|
296
|
+
*/
|
|
297
|
+
function redactKeywordProximity(text) {
|
|
298
|
+
const keywords = findKeywordRanges(text);
|
|
299
|
+
if (keywords.length === 0)
|
|
300
|
+
return { text, count: 0 };
|
|
301
|
+
// Expand each keyword range by W on both sides and merge overlapping/touching
|
|
302
|
+
// intervals. findKeywordRanges yields ascending, non-overlapping ranges, so
|
|
303
|
+
// expanded starts stay ascending and a single linear merge suffices.
|
|
304
|
+
const W = KEYWORD_PROXIMITY_WINDOW;
|
|
305
|
+
const zones = [];
|
|
306
|
+
for (const [kStart, kEnd] of keywords) {
|
|
307
|
+
const zStart = Math.max(0, kStart - W);
|
|
308
|
+
const zEnd = kEnd + W;
|
|
309
|
+
const last = zones[zones.length - 1];
|
|
310
|
+
if (last && zStart <= last[1]) {
|
|
311
|
+
if (zEnd > last[1])
|
|
312
|
+
last[1] = zEnd;
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
zones.push([zStart, zEnd]);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
let count = 0;
|
|
319
|
+
let zi = 0;
|
|
320
|
+
HIGH_ENTROPY_RUN_PATTERN.lastIndex = 0;
|
|
321
|
+
const out = text.replace(HIGH_ENTROPY_RUN_PATTERN, (match, offset) => {
|
|
322
|
+
const start = offset;
|
|
323
|
+
const end = offset + match.length;
|
|
324
|
+
// Runs arrive left-to-right. Drop zones that end before this run starts;
|
|
325
|
+
// they cannot intersect this run nor any later (further-right) run.
|
|
326
|
+
while (zi < zones.length && zones[zi][1] < start)
|
|
327
|
+
zi += 1;
|
|
328
|
+
// Near iff the current (first still-relevant) zone starts at/before run end.
|
|
329
|
+
const near = zi < zones.length && zones[zi][0] <= end;
|
|
330
|
+
if (!near)
|
|
331
|
+
return match;
|
|
332
|
+
count += 1;
|
|
333
|
+
return REDACTED;
|
|
334
|
+
});
|
|
335
|
+
return { text: out, count };
|
|
336
|
+
}
|
|
337
|
+
function findKeywordRanges(text) {
|
|
338
|
+
const ranges = [];
|
|
339
|
+
CREDENTIAL_KEYWORD_PATTERN.lastIndex = 0;
|
|
340
|
+
let match;
|
|
341
|
+
while ((match = CREDENTIAL_KEYWORD_PATTERN.exec(text)) !== null) {
|
|
342
|
+
ranges.push([match.index, match.index + match[0].length]);
|
|
343
|
+
if (match.index === CREDENTIAL_KEYWORD_PATTERN.lastIndex)
|
|
344
|
+
CREDENTIAL_KEYWORD_PATTERN.lastIndex += 1;
|
|
345
|
+
}
|
|
346
|
+
return ranges;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Shared high-confidence credential detector. Returns the number of distinct
|
|
350
|
+
* high-confidence credential redactions the ruleset would apply to `text`:
|
|
351
|
+
* own-key env name/value, Bearer tokens, prefixed vendor tokens, and
|
|
352
|
+
* keyword-proximity high-entropy runs. Deliberately does NOT flag bare-entropy
|
|
353
|
+
* long tokens, git SHAs, JWTs, plain base64, or UUIDs. This is the same ruleset
|
|
354
|
+
* used by the read-path redactor — one source of truth.
|
|
355
|
+
*/
|
|
356
|
+
export function detectCredentials(text) {
|
|
357
|
+
const apiKeyEnvName = process.env["CLINKX_ELARIS_API_KEY_ENV"] ?? "CLINKX_ELARIS_API_KEY";
|
|
358
|
+
const { count } = redactHighConfidence(text, {
|
|
359
|
+
apiKeyEnvName,
|
|
360
|
+
apiKeyValue: process.env[apiKeyEnvName],
|
|
361
|
+
});
|
|
362
|
+
return { count };
|
|
363
|
+
}
|
|
364
|
+
/** Convenience boolean wrapper over {@link detectCredentials}. */
|
|
365
|
+
export function hasCredential(text) {
|
|
366
|
+
return detectCredentials(text).count > 0;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Deep-redact a value like {@link redact} but exempt control-plane locator keys
|
|
370
|
+
* from BOTH the aggressive bare-entropy rule AND keyword-proximity so cursors,
|
|
371
|
+
* URLs, ids, ranges, and keyworded paths (e.g. `artifacts/auth_token_<hex>.log`)
|
|
372
|
+
* survive. Preserved string values still get the UNAMBIGUOUS credential shapes
|
|
373
|
+
* (own-key / Bearer / prefixed vendor token); preserved objects/arrays still
|
|
374
|
+
* recurse. Caller-supplied `locatorKeys` EXTEND the default allowlist (they never
|
|
375
|
+
* shrink it).
|
|
376
|
+
*/
|
|
377
|
+
export function redactPreservingLocators(value, locatorKeys) {
|
|
378
|
+
return redactWithOptions(value, locatorPreservingOptions(locatorKeys));
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Metadata-bearing analog of {@link redactPreservingLocators}: deep-redacts
|
|
382
|
+
* `value` in the SAME single pass, exempts control-plane locators from BOTH the
|
|
383
|
+
* bare-entropy rule and keyword-proximity (they still get the unambiguous
|
|
384
|
+
* own-key / Bearer / prefixed-vendor-token scrubbing), and reports
|
|
385
|
+
* `redaction_count`. Used by the read-path client so a redaction count
|
|
386
|
+
* can bubble to the tool envelope without a second traversal.
|
|
387
|
+
*/
|
|
388
|
+
export function redactPreservingLocatorsWithMetadata(value, locatorKeys) {
|
|
389
|
+
const counter = { n: 0 };
|
|
390
|
+
const redacted = redactInner(value, locatorPreservingOptions(locatorKeys), 0, counter);
|
|
391
|
+
return { value: redacted, redaction_count: counter.n };
|
|
392
|
+
}
|
|
393
|
+
function locatorPreservingOptions(locatorKeys) {
|
|
394
|
+
const apiKeyEnvName = process.env["CLINKX_ELARIS_API_KEY_ENV"] ?? "CLINKX_ELARIS_API_KEY";
|
|
395
|
+
const preserveKeys = new Set(DEFAULT_LOCATOR_KEYS);
|
|
396
|
+
if (locatorKeys) {
|
|
397
|
+
for (const key of locatorKeys)
|
|
398
|
+
preserveKeys.add(key);
|
|
399
|
+
}
|
|
400
|
+
return {
|
|
401
|
+
apiKeyEnvName,
|
|
402
|
+
apiKeyValue: process.env[apiKeyEnvName],
|
|
403
|
+
preserveKeys,
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Scrub ONLY ClinkX's own credentials from a string: the Bearer header pattern,
|
|
408
|
+
* the api-key env-var name, and the api-key value. Deliberately does NOT apply
|
|
409
|
+
* TOKEN_LIKE_PATTERN or LONG_TOKEN_PATTERN, so raw artifact bytes (hashes,
|
|
410
|
+
* base64 blobs, long identifiers) are not corrupted. Use for explicit
|
|
411
|
+
* raw-inspection paths where the caller asked for provider bytes verbatim.
|
|
412
|
+
*/
|
|
413
|
+
export function scrubOwnCredentials(text) {
|
|
414
|
+
const apiKeyEnvName = process.env["CLINKX_ELARIS_API_KEY_ENV"] ?? "CLINKX_ELARIS_API_KEY";
|
|
415
|
+
const apiKeyValue = process.env[apiKeyEnvName];
|
|
416
|
+
let scrubbed = text.replace(BEARER_PATTERN, `Bearer ${REDACTED}`);
|
|
417
|
+
scrubbed = scrubbed.split(apiKeyEnvName).join(REDACTED);
|
|
418
|
+
if (apiKeyValue) {
|
|
419
|
+
scrubbed = scrubbed.split(apiKeyValue).join(REDACTED);
|
|
420
|
+
}
|
|
421
|
+
return scrubbed;
|
|
422
|
+
}
|
|
423
|
+
//# sourceMappingURL=redact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../../src/elaris/redact.ts"],"names":[],"mappings":"AAAA,MAAM,4BAA4B,GAAG,wEAAwE,CAAC;AAC9G,MAAM,cAAc,GAAG,kCAAkC,CAAC;AAE1D;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AC,aAAa,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,IAAI,WAAW,EAAE,CAAC;QAChB,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const ELARIS_RUN_ID_PATTERN: RegExp;
|
|
2
|
+
export declare const ELARIS_RUN_ID_PREFIX = "cxel_";
|
|
3
|
+
export declare function isValidElarisRunId(runId: string): boolean;
|
|
4
|
+
export declare function assertValidElarisRunId(runId: string): string;
|
|
5
|
+
export declare function generateElarisRunId(now?: Date): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { InvalidParamsError } from "../errors.js";
|
|
3
|
+
export const ELARIS_RUN_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
|
|
4
|
+
export const ELARIS_RUN_ID_PREFIX = "cxel_";
|
|
5
|
+
export function isValidElarisRunId(runId) {
|
|
6
|
+
return ELARIS_RUN_ID_PATTERN.test(runId);
|
|
7
|
+
}
|
|
8
|
+
export function assertValidElarisRunId(runId) {
|
|
9
|
+
if (!isValidElarisRunId(runId)) {
|
|
10
|
+
throw new InvalidParamsError("run_id must match ^[A-Za-z0-9_-]{1,64}$.");
|
|
11
|
+
}
|
|
12
|
+
return runId;
|
|
13
|
+
}
|
|
14
|
+
export function generateElarisRunId(now = new Date()) {
|
|
15
|
+
const timestamp = now.toISOString().replace(/\D/g, "").slice(0, 14);
|
|
16
|
+
const suffix = randomBytes(9).toString("base64url");
|
|
17
|
+
const runId = `${ELARIS_RUN_ID_PREFIX}${timestamp}_${suffix}`;
|
|
18
|
+
return assertValidElarisRunId(runId);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=run-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-id.js","sourceRoot":"","sources":["../../src/elaris/run-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,kBAAkB,CAAC,0CAA0C,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAY,IAAI,IAAI,EAAE;IACxD,MAAM,SAAS,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,GAAG,oBAAoB,GAAG,SAAS,IAAI,MAAM,EAAE,CAAC;IAC9D,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AgentSessionErrorSummary, AgentSessionStage, AgentSessionStatusResponse, AgentSessionURLResponse, ElarisRawStatus } from "./types.js";
|
|
2
|
+
export type ElarisNormalizedStatus = "running" | "succeeded" | "failed" | "cancelling" | "cancelled" | "orphaned";
|
|
3
|
+
export interface ElarisStatusSnapshot {
|
|
4
|
+
run_id: string;
|
|
5
|
+
raw_status: ElarisRawStatus;
|
|
6
|
+
normalized_status: ElarisNormalizedStatus;
|
|
7
|
+
terminal: boolean;
|
|
8
|
+
source: "create" | "status" | "synthetic";
|
|
9
|
+
session_id?: string | undefined;
|
|
10
|
+
chat_id?: string | undefined;
|
|
11
|
+
status_url?: string | undefined;
|
|
12
|
+
result_url?: string | undefined;
|
|
13
|
+
events_url?: string | undefined;
|
|
14
|
+
logs_url?: string | undefined;
|
|
15
|
+
artifacts_url?: string | undefined;
|
|
16
|
+
cleaned_up_at?: string | null | undefined;
|
|
17
|
+
artifacts_available?: boolean | undefined;
|
|
18
|
+
status_reason?: string | null | undefined;
|
|
19
|
+
started_at?: string | null | undefined;
|
|
20
|
+
completed_at?: string | null | undefined;
|
|
21
|
+
cleanup_due_at?: string | null | undefined;
|
|
22
|
+
cleanup_grace_remaining_ms?: number | null | undefined;
|
|
23
|
+
progress?: number | null | undefined;
|
|
24
|
+
result_available?: boolean | undefined;
|
|
25
|
+
result_bytes?: number | null | undefined;
|
|
26
|
+
stages?: AgentSessionStage[] | undefined;
|
|
27
|
+
error?: AgentSessionErrorSummary | null | undefined;
|
|
28
|
+
failure_class?: string | null | undefined;
|
|
29
|
+
keep_alive?: boolean | undefined;
|
|
30
|
+
keep_alive_known?: boolean | undefined;
|
|
31
|
+
}
|
|
32
|
+
export declare function normalizeElarisStatus(status: ElarisRawStatus): ElarisNormalizedStatus;
|
|
33
|
+
export declare function isTerminalElarisStatus(status: ElarisRawStatus): boolean;
|
|
34
|
+
export declare function mapCreateResponseToSnapshot(response: AgentSessionURLResponse): ElarisStatusSnapshot;
|
|
35
|
+
export declare function mapStatusResponseToSnapshot(response: AgentSessionStatusResponse): ElarisStatusSnapshot;
|
|
36
|
+
/**
|
|
37
|
+
* Single source of truth for whether a RAW Elaris status is an error
|
|
38
|
+
* disposition. Shared by {@link snapshotIsError} (full snapshots) and callers
|
|
39
|
+
* that only hold a raw status not yet folded into a snapshot (message-derived
|
|
40
|
+
* bodies), so the two can never drift.
|
|
41
|
+
*/
|
|
42
|
+
export declare function rawStatusIsError(status: ElarisRawStatus): boolean;
|
|
43
|
+
export declare function snapshotIsError(snapshot: ElarisStatusSnapshot): boolean;
|
|
44
|
+
export declare function withKnownKeepAlive(snapshot: ElarisStatusSnapshot, keepAlive: boolean): ElarisStatusSnapshot;
|
|
45
|
+
export declare function mergeCreateProvenance(snapshot: ElarisStatusSnapshot, createSnapshot: ElarisStatusSnapshot): ElarisStatusSnapshot;
|