@desplega.ai/agent-swarm 1.165.0 → 1.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-adapter-zpvy6321.js +34 -0
- package/dist/{actions-jna0b3wm.js → actions-fq2zrwtf.js} +30 -34
- package/dist/{amp-adapter-0eve81pz.js → amp-adapter-5gbk7501.js} +7 -7
- package/dist/{anthropic-messages-hst62ws9.js → anthropic-messages-13yn502s.js} +4 -4
- package/dist/{app-75hm5cfa.js → app-nctetn1e.js} +11 -11
- package/dist/{assistant-yzd51j33.js → assistant-0aq8gjvj.js} +31 -35
- package/dist/{azure-openai-responses-mh8tvf78.js → azure-openai-responses-9st34pfz.js} +5 -5
- package/dist/{boot-reembed-z158xq32.js → boot-reembed-1ze5853n.js} +14 -16
- package/dist/{boot-reembed-2ex2mcsh.js → boot-reembed-fmp5ww69.js} +15 -16
- package/dist/boot-scrub-sweep-cbp8xd4e.js +212 -0
- package/dist/{boot-seeds-2bmnh18p.js → boot-seeds-22tx8a53.js} +13 -12
- package/dist/{claude-adapter-jbj1mycz.js → claude-adapter-0jhgeh1d.js} +25 -25
- package/dist/{claude-managed-adapter-17ggz09t.js → claude-managed-adapter-tzwxy803.js} +5 -5
- package/dist/{claude-managed-setup-ptm1nzm2.js → claude-managed-setup-nrhfx5b0.js} +5 -5
- package/dist/{claude-sdk-session-9re1g7r2.js → claude-sdk-session-wh77rh83.js} +2632 -2614
- package/dist/{cli-zsh093hk.js → cli-014vns2y.js} +63 -1
- package/dist/{cli-qvfk83fy.js → cli-13xwcqvj.js} +2 -2
- package/dist/{cli-8gpbwy09.js → cli-1yrcfa5s.js} +5 -5
- package/dist/{cli-xtgtyafv.js → cli-577bxkf6.js} +212 -451
- package/dist/{cli-ma3zvh39.js → cli-5qkcdv8c.js} +6118 -5874
- package/dist/{cli-cwxhbf43.js → cli-5t5my0h8.js} +85 -2
- package/dist/{cli-zvckv750.js → cli-69egj654.js} +2 -2
- package/dist/{cli-9xb89xca.js → cli-6bpvv8h4.js} +9 -9
- package/dist/{cli-90v942q1.js → cli-6qxmjpem.js} +8 -8
- package/dist/{cli-9866bd07.js → cli-6vfz44sr.js} +1 -1
- package/dist/{cli-32bca7nr.js → cli-7avy4v8w.js} +1 -1
- package/dist/{cli-xb3c6aat.js → cli-7mhy3ths.js} +21 -18
- package/dist/{cli-q38n4bq0.js → cli-95zs84qw.js} +3 -3
- package/dist/cli-a35hzdve.js +33 -0
- package/dist/{cli-x3x0qwky.js → cli-bxqez1p0.js} +51 -23
- package/dist/{cli-prt9emct.js → cli-c2tpw9ck.js} +3 -3
- package/dist/{cli-0n4fasz0.js → cli-c8r99akr.js} +16 -16
- package/dist/{cli-5anb0ev3.js → cli-cexctgn5.js} +89 -26
- package/dist/{cli-bns5c8k9.js → cli-cf2vgn9d.js} +105 -91
- package/dist/{cli-ng97fjq7.js → cli-cmxkbzzs.js} +33 -7
- package/dist/{cli-nexwh8zg.js → cli-g7k7zbcz.js} +12 -5
- package/dist/{cli-mmzwwptd.js → cli-hf5s9pgf.js} +1 -1
- package/dist/{cli-nvvfd8bq.js → cli-jbzbr36n.js} +4091 -3793
- package/dist/{cli-zn2v3t8v.js → cli-jvmtxqtc.js} +27 -15
- package/dist/{cli-pkke6geq.js → cli-km4x66j0.js} +83 -65
- package/dist/cli-kw0jcfje.js +516 -0
- package/dist/{cli-28smfvbn.js → cli-m7vmeepg.js} +32 -19
- package/dist/{cli-hpryr6em.js → cli-mb75wpxf.js} +1 -1
- package/dist/{cli-qdv8kgz7.js → cli-mkdsy1nq.js} +14018 -3333
- package/dist/{cli-b0f70z24.js → cli-mn8qkd8v.js} +1 -1
- package/dist/{cli-420bdgw0.js → cli-mv2520nm.js} +1 -1
- package/dist/{cli-n9ehc28t.js → cli-mxry91sa.js} +31 -10
- package/dist/{cli-wfajtmf7.js → cli-mxvnnv5q.js} +596 -13
- package/dist/cli-nkqjj42q.js +104 -0
- package/dist/{cli-e7t4snpa.js → cli-p8rt8spp.js} +5 -5
- package/dist/{cli-gh5yqzpe.js → cli-pkj1w46r.js} +12 -7
- package/dist/cli-q1vnz8wv.js +96 -0
- package/dist/{cli-fj86xr3c.js → cli-qd97v6z2.js} +2 -2
- package/dist/{cli-ba66wyhy.js → cli-qzmzwegq.js} +60 -20
- package/dist/{cli-5b2fjjzh.js → cli-r7eeddkq.js} +14 -9
- package/dist/{cli-8ssjez7e.js → cli-rhy7z1rp.js} +22 -11
- package/dist/{cli-4mevd1hf.js → cli-s9y81s7j.js} +5 -5
- package/dist/{cli-59jn5twa.js → cli-tc5zec7v.js} +7 -7
- package/dist/{cli-ttbsse3f.js → cli-tmhsxhb8.js} +1 -1
- package/dist/{cli-k6xx3pve.js → cli-tx2zvn23.js} +4 -4
- package/dist/{cli-pjxnr1jn.js → cli-ty4bzkqr.js} +5 -5
- package/dist/{cli-nfygw434.js → cli-v1pwxreq.js} +55 -52
- package/dist/{cli-ftry7975.js → cli-v1w7pbd8.js} +3 -2
- package/dist/{cli-10zmp1p7.js → cli-vr5avem2.js} +27 -32
- package/dist/{cli-bzr0ftht.js → cli-wnb9b2g3.js} +19 -0
- package/dist/cli-wt7ccy4r.js +2654 -0
- package/dist/{cli-50eg13rj.js → cli-wydz3feg.js} +549 -321
- package/dist/{cli-krqm5f11.js → cli-xezn9nkh.js} +16 -13
- package/dist/{cli-8kt0bmgx.js → cli-xf713zz0.js} +2 -2
- package/dist/{cli-x7afk5wm.js → cli-xvc3q9br.js} +1 -1
- package/dist/{cli-9s3h836g.js → cli-xvdgasgy.js} +1 -1
- package/dist/{cli-j0pdrmwg.js → cli-y0kjpfm9.js} +3 -3
- package/dist/{cli-6zcfw0x7.js → cli-y195hv1a.js} +1 -1
- package/dist/{cli-amwhs8h2.js → cli-ykt8f7va.js} +22 -9
- package/dist/{cli-1kzfvd1z.js → cli-ymmc1zxg.js} +15 -11
- package/dist/{cli-xnzrzets.js → cli-ypgba1a8.js} +2 -2
- package/dist/{cli-bdv39kgj.js → cli-z1dqhc9y.js} +31 -20
- package/dist/{cli-fw6vdcq5.js → cli-zp67qg5x.js} +34 -1
- package/dist/{cli-qbksc292.js → cli-zy39d433.js} +2 -0
- package/dist/cli.js +36 -32
- package/dist/{cloudflare-workers-ai-system-one-tt484t61.js → cloudflare-workers-ai-system-one-sta45jf9.js} +7 -5
- package/dist/{codex-adapter-3qnxshje.js → codex-adapter-cgesnjkr.js} +20 -20
- package/dist/{codex-login-brkxhhdg.js → codex-login-g1cyt5zm.js} +2 -2
- package/dist/{codex-session-runner-612wnapp.js → codex-session-runner-8kd7ddhr.js} +20 -20
- package/dist/{commands-2ybfcxkj.js → commands-h6zaaxym.js} +11 -10
- package/dist/{cursor-adapter-p3jgdehv.js → cursor-adapter-v8mm6bp5.js} +7 -7
- package/dist/{db-f4ans0jj.js → db-qg3myn53.js} +13 -10
- package/dist/{devin-adapter-dhzt01ff.js → devin-adapter-bffjj5n4.js} +2 -2
- package/dist/{dispatcher-pk182apd.js → dispatcher-7vnwj9qw.js} +28 -32
- package/dist/{dsh-adapter-7twaeps1.js → dsh-adapter-tz6hfp5r.js} +7 -7
- package/dist/{e2b-y8t3jzyz.js → e2b-nd50eccg.js} +1 -1
- package/dist/{easter-egg-3d-mtpnw06s.js → easter-egg-3d-66zxervv.js} +2 -2
- package/dist/{event-bus-w7ac4n3c.js → event-bus-vnfthafg.js} +2 -2
- package/dist/{execute-s4ccjq3n.js → execute-h4jgevyw.js} +61 -11
- package/dist/{google-generative-ai-d6nphg3q.js → google-generative-ai-b8zxrpax.js} +5 -5
- package/dist/{google-vertex-cpshkref.js → google-vertex-nrdd697t.js} +5 -5
- package/dist/grok-adapter-jdt2dz2s.js +39 -0
- package/dist/{handlers-g2wnr4t9.js → handlers-2qtkpncr.js} +31 -35
- package/dist/{hook-f7jt9vnm.js → hook-51yfcgsv.js} +48 -39
- package/dist/{hook-bbdpnkb4.js → hook-qnbdgwvd.js} +15 -17
- package/dist/{http-w40q4w94.js → http-jsmtag08.js} +536 -231
- package/dist/{index-056j5kzn.js → index-2t9kesn1.js} +13 -12
- package/dist/{index-cj1r9q83.js → index-bt8wkv1w.js} +29 -33
- package/dist/{index-7n70jwbb.js → index-cx1sb9bq.js} +42 -35
- package/dist/{index-9bfssf54.js → index-ekywyv2v.js} +28 -32
- package/dist/{index-fdk1t4d6.js → index-n0rxa4ca.js} +11962 -9900
- package/dist/{index-k8xc083e.js → index-t4g06w93.js} +28 -32
- package/dist/{keepalive-1tj10tf4.js → keepalive-4aezx4bj.js} +16 -12
- package/dist/{lead-st0bg7v4.js → lead-r44bkpm5.js} +52 -56
- package/dist/{llama-cpp-classify-tgj35k8d.js → llama-cpp-classify-6erb7wwv.js} +3 -1
- package/dist/{maintenance-nz71zats.js → maintenance-grz5jrzh.js} +12 -13
- package/dist/{mistral-conversations-8445ddjn.js → mistral-conversations-059y51zt.js} +4 -4
- package/dist/{node-f0ykebbv.js → node-qm9eb6z0.js} +25 -7
- package/dist/{oauth-refresh-sweep-aefzwvvq.js → oauth-refresh-sweep-wm4ctjfj.js} +15 -11
- package/dist/{onboard-kgpr9mbn.js → onboard-v60zgqf0.js} +2 -2
- package/dist/{openai-codex-responses-9ynm88zy.js → openai-codex-responses-jzxkta9b.js} +8 -7
- package/dist/{openai-completions-nhqwjmaw.js → openai-completions-663yncfq.js} +4 -4
- package/dist/openai-decisions-vj9nkpf8.js +162 -0
- package/dist/{openai-responses-xx1c4kgm.js → openai-responses-m3g43rrt.js} +5 -5
- package/dist/{opencode-adapter-0c8e70dk.js → opencode-adapter-yjyqynzf.js} +8 -8
- package/dist/{openrouter-images-8yx3487g.js → openrouter-images-kr60n6b9.js} +1 -1
- package/dist/{otel-impl-x8zp4y5a.js → otel-impl-ghh4dyf8.js} +2 -2
- package/dist/{pi-messages-vxdt8v7j.js → pi-messages-xszk613n.js} +1 -1
- package/dist/{pi-mono-adapter-t280ah5c.js → pi-mono-adapter-0eg8kw2c.js} +69 -52
- package/dist/{pricing-refresh-9e0q7cwk.js → pricing-refresh-mjrqvnvw.js} +12 -11
- package/dist/{rbac-roles-790j3ga8.js → rbac-roles-axv4d74x.js} +11 -10
- package/dist/{rbac-roles-kcp6zge2.js → rbac-roles-fd5tskj9.js} +11 -10
- package/dist/{render-v2-tch4nefj.js → render-v2-k50j33qd.js} +11 -11
- package/dist/{runtime-v2t1r79e.js → runtime-h9ha1mq6.js} +4 -4
- package/dist/{setup-rcm303ns.js → setup-4syh0pd2.js} +2 -2
- package/dist/{typesafe-system-one-datfr82p.js → typesafe-system-one-e988vty7.js} +7 -5
- package/dist/{virtual-modules-wm8mxdxx.js → virtual-modules-ftr9kwe8.js} +11 -11
- package/dist/{work-objects-ctg7t70w.js → work-objects-jcdbg8rr.js} +32 -36
- package/dist/{worker-5dp0xm55.js → worker-x8j8c9sx.js} +52 -56
- package/dist/{x-v3yw66zs.js → x-ma4gnfgy.js} +2 -2
- package/openapi.json +5 -2
- package/package.json +15 -11
- package/src/be/automation-preflight.ts +9 -4
- package/src/be/boot-scrub-sweep.ts +302 -0
- package/src/be/crypto/key-bootstrap.ts +1 -1
- package/src/be/db/approvals.ts +15 -1
- package/src/be/db/codex-oauth-device-flows.ts +40 -0
- package/src/be/db/config-secrets.ts +31 -0
- package/src/be/db/runtime.ts +4 -0
- package/src/be/db/script-runs.ts +15 -0
- package/src/be/db/tasks/write.ts +1 -1
- package/src/be/db-queries/mcp-oauth.ts +5 -0
- package/src/be/db-queries/oauth.ts +77 -0
- package/src/be/db.ts +162 -59
- package/src/be/events.ts +17 -1
- package/src/be/memory/index-content.ts +2 -2
- package/src/be/memory/providers/openai-embedding.ts +7 -2
- package/src/be/memory/providers/sqlite-store.ts +63 -11
- package/src/be/memory/raters/llm-summarizer.ts +7 -2
- package/src/be/memory/types.ts +14 -0
- package/src/be/migrations/201_workflow_replay_columns.sql +10 -0
- package/src/be/migrations/202_codex_oauth_device_flows.sql +24 -0
- package/src/be/modelsdev-cache.json +61 -0
- package/src/be/scripts/db.ts +28 -4
- package/src/be/scripts/source-secrets.ts +37 -0
- package/src/be/scrub-json.ts +32 -0
- package/src/be/sealed-json.ts +59 -0
- package/src/be/secret-registry.ts +131 -0
- package/src/be/seed-pricing.ts +84 -53
- package/src/be/swarm-config-guard.ts +13 -0
- package/src/be/workflow-replay.ts +77 -0
- package/src/commands/provider-credentials.ts +28 -5
- package/src/commands/runner.ts +7 -12
- package/src/heartbeat/heartbeat.ts +91 -19
- package/src/hooks/hook.ts +72 -27
- package/src/http/codex-oauth-device.ts +8 -10
- package/src/http/db-query-bounded.ts +3 -0
- package/src/http/db-query-shared.ts +107 -15
- package/src/http/db-query.ts +10 -2
- package/src/http/index.ts +23 -6
- package/src/http/mcp.ts +5 -0
- package/src/http/onboarding.ts +2 -0
- package/src/http/script-runs.ts +9 -1
- package/src/http/scripts.ts +15 -0
- package/src/http/workflows.ts +3 -2
- package/src/oauth/mcp-wrapper.ts +1 -1
- package/src/providers/acp-adapter.ts +25 -11
- package/src/providers/acp-target-catalog.ts +35 -1
- package/src/providers/acp-targets.ts +78 -7
- package/src/providers/amp-adapter.ts +1 -1
- package/src/providers/claude-adapter.ts +26 -0
- package/src/providers/codex-adapter.ts +30 -3
- package/src/providers/codex-oauth/auth-json.ts +21 -4
- package/src/providers/codex-oauth/types.ts +2 -0
- package/src/providers/cursor-adapter.ts +1 -1
- package/src/providers/dsh-adapter.ts +10 -1
- package/src/providers/grok-adapter.ts +18 -2
- package/src/providers/opencode-adapter.ts +21 -5
- package/src/providers/pi-mono-extension.ts +56 -25
- package/src/providers/pricing-sources.md +2 -0
- package/src/script-workflows/supervisor.ts +11 -2
- package/src/scripts-runtime/eval-harness.ts +2 -12
- package/src/scripts-runtime/executors/quickjs-bundle.ts +152 -0
- package/src/scripts-runtime/executors/quickjs-prelude.ts +285 -0
- package/src/scripts-runtime/executors/quickjs-runner.ts +580 -0
- package/src/scripts-runtime/executors/quickjs-worker.ts +81 -0
- package/src/scripts-runtime/executors/quickjs.ts +196 -0
- package/src/scripts-runtime/executors/registry.ts +2 -0
- package/src/scripts-runtime/executors/sourcemap.ts +79 -0
- package/src/scripts-runtime/script-error-hints.ts +14 -0
- package/src/server.ts +66 -4
- package/src/tests/acp-adapter.test.ts +277 -12
- package/src/tests/boot-scrub-sweep.test.ts +390 -0
- package/src/tests/check-text-columns.test.ts +145 -0
- package/src/tests/ci-unit-test-report.test.ts +73 -0
- package/src/tests/claude-default-route.test.ts +75 -0
- package/src/tests/claude-hook-output.test.ts +233 -0
- package/src/tests/claude-sdk-process.fixture.ts +13 -2
- package/src/tests/codex-adapter-pool-auth-revalidate.test.ts +4 -2
- package/src/tests/codex-adapter.test.ts +166 -26
- package/src/tests/codex-oauth-auth-timestamps.test.ts +76 -0
- package/src/tests/codex-oauth-device.test.ts +23 -37
- package/src/tests/codex-oauth.test.ts +4 -1
- package/src/tests/context-window.test.ts +2 -2
- package/src/tests/credential-check.test.ts +51 -1
- package/src/tests/db-query-denylist.test.ts +202 -0
- package/src/tests/db-task-read-contract.test.ts +1 -0
- package/src/tests/db-task-write-contract.test.ts +1 -0
- package/src/tests/dsh-adapter.test.ts +23 -1
- package/src/tests/enabled-tools.test.ts +269 -0
- package/src/tests/entrypoint-acp-target-binary.test.ts +31 -1
- package/src/tests/entrypoint-codex-oauth-seed.test.ts +12 -0
- package/src/tests/events-scrub.test.ts +88 -0
- package/src/tests/fixtures/secret-corpus.ts +320 -0
- package/src/tests/grok-adapter.test.ts +13 -0
- package/src/tests/haiku-5-5-pricing.test.ts +38 -0
- package/src/tests/heartbeat-checklist.test.ts +158 -1
- package/src/tests/onboarding.test.ts +44 -0
- package/src/tests/opencode-adapter.test.ts +66 -3
- package/src/tests/opencode-plugin.test.ts +37 -0
- package/src/tests/openrouter-attribution-call-sites.test.ts +204 -0
- package/src/tests/openrouter-base-url.test.ts +30 -39
- package/src/tests/pi-mono-extension.test.ts +161 -2
- package/src/tests/pricing-refresh.test.ts +70 -1
- package/src/tests/reasoning-effort.test.ts +3 -1
- package/src/tests/script-connections.test.ts +5 -0
- package/src/tests/script-executor-conformance.test.ts +3 -0
- package/src/tests/script-executor-quickjs.test.ts +442 -0
- package/src/tests/script-executor-registry.test.ts +6 -1
- package/src/tests/script-runs-http.test.ts +88 -1
- package/src/tests/script-runs-scrub.test.ts +275 -0
- package/src/tests/scripts-http.test.ts +82 -1
- package/src/tests/scrubbed-text-12e.test.ts +289 -0
- package/src/tests/sealed-key-guard.test.ts +166 -0
- package/src/tests/secret-canary-sweep.test.ts +958 -0
- package/src/tests/secret-registry.test.ts +355 -0
- package/src/tests/secret-rules.test.ts +230 -0
- package/src/tests/secret-scrubber.test.ts +3 -2
- package/src/tests/telemetry-trigger.test.ts +12 -1
- package/src/tests/workflow-llm.test.ts +14 -0
- package/src/tests/workflow-replay.test.ts +518 -0
- package/src/tests/workflow-scrub.test.ts +242 -0
- package/src/tests/workflow-system-one-decision-providers.test.ts +33 -0
- package/src/tools/db-query.ts +1 -1
- package/src/tools/inject-learning.ts +1 -1
- package/src/tools/request-human-input.ts +7 -2
- package/src/tools/workflows/get-workflow-run.ts +3 -2
- package/src/types.ts +1 -1
- package/src/utils/enabled-tools.ts +27 -0
- package/src/utils/internal-ai/complete-structured.ts +11 -3
- package/src/utils/openrouter-base-url.ts +23 -0
- package/src/utils/secret-rules.generated.ts +2055 -0
- package/src/utils/secret-scrubber.ts +363 -29
- package/src/workflows/engine.ts +39 -4
- package/src/workflows/executors/raw-llm.ts +1 -0
- package/src/workflows/executors/system-one-decision.ts +2 -0
- package/src/workflows/executors/validate.ts +1 -0
- package/src/workflows/executors/workflow-llm.ts +9 -2
- package/src/workflows/recovery.ts +10 -1
- package/src/workflows/resume.ts +62 -3
- package/src/workflows/retry-poller.ts +3 -0
- package/templates/skills/agent-browser/SKILL.md +2 -0
- package/templates/skills/agent-browser/content.md +2 -0
- package/templates/skills/code-quality/content.md +1 -0
- package/templates/skills/heartbeat-runbook/content.md +1 -1
- package/templates/skills/work-on-task/SKILL.md +4 -0
- package/templates/skills/work-on-task/content.md +4 -0
- package/templates/skills/workflow-iterate/content.md +9 -0
- package/dist/acp-adapter-w6zws6me.js +0 -23
- package/dist/boot-scrub-logs-246yn076.js +0 -99
- package/dist/cli-3a4m1aws.js +0 -572
- package/dist/cli-3dpj7atn.js +0 -11
- package/dist/cli-a87b04k8.js +0 -951
- package/dist/cli-cvk6yzw5.js +0 -40
- package/dist/cli-gvcgmx69.js +0 -183
- package/dist/cli-h1spv8v4.js +0 -427
- package/dist/cli-jqt9hrnz.js +0 -168
- package/dist/cli-yhmwmv0g.js +0 -9281
- package/dist/grok-adapter-yt9pab3k.js +0 -29
- package/src/be/boot-scrub-logs.ts +0 -132
- package/dist/{codex-hook-d2rkvf39.js → codex-hook-15dgc4cb.js} +1 -1
package/dist/cli-cvk6yzw5.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
buildAgentFsLiveUrl,
|
|
3
|
-
buildCombFileUrl,
|
|
4
|
-
getAppUrl,
|
|
5
|
-
init_constants
|
|
6
|
-
} from "./cli-gd4favx9.js";
|
|
7
|
-
import {
|
|
8
|
-
__esm
|
|
9
|
-
} from "./cli-bc05qbss.js";
|
|
10
|
-
|
|
11
|
-
// src/utils/task-attachment-links.ts
|
|
12
|
-
function shellQuote(value) {
|
|
13
|
-
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
14
|
-
}
|
|
15
|
-
function taskAttachmentFetchCommand(taskId, attachmentId, name) {
|
|
16
|
-
const url = `$MCP_BASE_URL/api/fs/tasks/${taskId}/files/${attachmentId}/raw`;
|
|
17
|
-
const outPath = shellQuote(`/tmp/attachments/${attachmentId}/${name.replace(/\//g, "_")}`);
|
|
18
|
-
return `curl -s -H "Authorization: Bearer \${AGENT_SWARM_API_KEY:-$API_KEY}" -H "X-Agent-ID: $AGENT_ID" "${url}" --create-dirs -o ${outPath}`;
|
|
19
|
-
}
|
|
20
|
-
function taskAttachmentDisplayUrl(attachment, opts = {}) {
|
|
21
|
-
if (attachment.kind === "url")
|
|
22
|
-
return attachment.url ?? "";
|
|
23
|
-
if (attachment.kind === "page") {
|
|
24
|
-
return attachment.pageId ? `${getAppUrl()}/pages/${attachment.pageId}` : "page:";
|
|
25
|
-
}
|
|
26
|
-
if (attachment.providerId === "agent-fs" || attachment.kind === "agent-fs") {
|
|
27
|
-
const file = { path: attachment.path, orgId: attachment.orgId, driveId: attachment.driveId };
|
|
28
|
-
const combUrl = opts.comb === false ? null : buildCombFileUrl(file);
|
|
29
|
-
return combUrl ?? buildAgentFsLiveUrl(file) ?? `agent-fs:${attachment.path ?? ""}`;
|
|
30
|
-
}
|
|
31
|
-
if (attachment.providerId === "local-fs" || attachment.kind === "shared-fs") {
|
|
32
|
-
return `${getAppUrl()}/api/fs/tasks/${attachment.taskId}/files/${attachment.id}/raw`;
|
|
33
|
-
}
|
|
34
|
-
return attachment.path ?? attachment.providerKey ?? "";
|
|
35
|
-
}
|
|
36
|
-
var init_task_attachment_links = __esm(() => {
|
|
37
|
-
init_constants();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
export { taskAttachmentFetchCommand, taskAttachmentDisplayUrl, init_task_attachment_links };
|
package/dist/cli-gvcgmx69.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
retryProviderRequest
|
|
3
|
-
} from "./cli-qbksc292.js";
|
|
4
|
-
import {
|
|
5
|
-
formatProviderError,
|
|
6
|
-
normalizeProviderError
|
|
7
|
-
} from "./cli-6map995v.js";
|
|
8
|
-
import {
|
|
9
|
-
headersToRecord,
|
|
10
|
-
providerHeadersToRecord
|
|
11
|
-
} from "./cli-7kyk9jr3.js";
|
|
12
|
-
import {
|
|
13
|
-
calculateCost
|
|
14
|
-
} from "./cli-nexwh8zg.js";
|
|
15
|
-
|
|
16
|
-
// node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js
|
|
17
|
-
function httpError(label, response, body) {
|
|
18
|
-
const error = new Error(`${label} returned ${response.status}`);
|
|
19
|
-
error.status = response.status;
|
|
20
|
-
error.headers = response.headers;
|
|
21
|
-
error.body = body;
|
|
22
|
-
return error;
|
|
23
|
-
}
|
|
24
|
-
function timeoutError(timeoutMs) {
|
|
25
|
-
const error = new Error(`Request timed out after ${timeoutMs}ms`);
|
|
26
|
-
error.name = "TimeoutError";
|
|
27
|
-
error.status = undefined;
|
|
28
|
-
error.headers = undefined;
|
|
29
|
-
error.body = "";
|
|
30
|
-
return error;
|
|
31
|
-
}
|
|
32
|
-
function isRecord(value) {
|
|
33
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
34
|
-
}
|
|
35
|
-
function requiredNumber(label, value, field) {
|
|
36
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
37
|
-
throw new Error(`${label} returned an invalid ${field}`);
|
|
38
|
-
}
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
function probabilities(label, value, id) {
|
|
42
|
-
if (!isRecord(value))
|
|
43
|
-
throw new Error(`${label} returned invalid probabilities for ${id}`);
|
|
44
|
-
return Object.fromEntries(Object.entries(value).map(([key, probability]) => [
|
|
45
|
-
key,
|
|
46
|
-
requiredNumber(label, probability, `probability for ${id}.${key}`)
|
|
47
|
-
]));
|
|
48
|
-
}
|
|
49
|
-
function parseAnswers(label, value, context) {
|
|
50
|
-
if (!isRecord(value))
|
|
51
|
-
throw new Error(`${label} returned an unexpected response`);
|
|
52
|
-
const answers = [];
|
|
53
|
-
for (const [id, question] of Object.entries(context.questions)) {
|
|
54
|
-
const answer = value[id];
|
|
55
|
-
if (!isRecord(answer))
|
|
56
|
-
throw new Error(`${label} did not return an answer for ${id}`);
|
|
57
|
-
if (question.type === "choice") {
|
|
58
|
-
if (answer.type !== "choice" || typeof answer.choice !== "string") {
|
|
59
|
-
throw new Error(`${label} did not return a choice answer for ${id}`);
|
|
60
|
-
}
|
|
61
|
-
answers.push([
|
|
62
|
-
id,
|
|
63
|
-
{
|
|
64
|
-
type: "choice",
|
|
65
|
-
choice: answer.choice,
|
|
66
|
-
probabilities: probabilities(label, answer.probabilities, id),
|
|
67
|
-
confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
|
|
68
|
-
}
|
|
69
|
-
]);
|
|
70
|
-
} else if (question.type === "score") {
|
|
71
|
-
if (answer.type !== "score")
|
|
72
|
-
throw new Error(`${label} did not return a score answer for ${id}`);
|
|
73
|
-
answers.push([
|
|
74
|
-
id,
|
|
75
|
-
{
|
|
76
|
-
type: "score",
|
|
77
|
-
score: requiredNumber(label, answer.score, `score for ${id}`),
|
|
78
|
-
confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
|
|
79
|
-
}
|
|
80
|
-
]);
|
|
81
|
-
} else {
|
|
82
|
-
if (answer.type !== "noul")
|
|
83
|
-
throw new Error(`${label} did not return a bool answer for ${id}`);
|
|
84
|
-
answers.push([
|
|
85
|
-
id,
|
|
86
|
-
{
|
|
87
|
-
type: "bool",
|
|
88
|
-
probability: requiredNumber(label, answer.noul, `probability for ${id}`)
|
|
89
|
-
}
|
|
90
|
-
]);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return Object.fromEntries(answers);
|
|
94
|
-
}
|
|
95
|
-
function tokenCount(value) {
|
|
96
|
-
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 0;
|
|
97
|
-
}
|
|
98
|
-
function parseUsage(value, model) {
|
|
99
|
-
if (!isRecord(value) || value.input_tokens === undefined && value.output_tokens === undefined)
|
|
100
|
-
return;
|
|
101
|
-
const input = tokenCount(value.input_tokens);
|
|
102
|
-
const output = tokenCount(value.output_tokens);
|
|
103
|
-
const usage = {
|
|
104
|
-
input,
|
|
105
|
-
output,
|
|
106
|
-
cacheRead: 0,
|
|
107
|
-
cacheWrite: 0,
|
|
108
|
-
totalTokens: input + output,
|
|
109
|
-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
110
|
-
};
|
|
111
|
-
calculateCost(model, usage);
|
|
112
|
-
return usage;
|
|
113
|
-
}
|
|
114
|
-
function wireRequest(context) {
|
|
115
|
-
return {
|
|
116
|
-
state: context.state,
|
|
117
|
-
questions: Object.fromEntries(Object.entries(context.questions).map(([id, question]) => [
|
|
118
|
-
id,
|
|
119
|
-
question.type === "bool" ? { ...question, type: "noul" } : question
|
|
120
|
-
]))
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function requestHeaders(model, apiKey, optionsHeaders) {
|
|
124
|
-
return providerHeadersToRecord({ authorization: `Bearer ${apiKey}`, "content-type": "application/json" }, model.headers, optionsHeaders) ?? {};
|
|
125
|
-
}
|
|
126
|
-
async function classifySystemOne(transport, model, context, options) {
|
|
127
|
-
const output = {
|
|
128
|
-
api: model.api,
|
|
129
|
-
provider: model.provider,
|
|
130
|
-
model: model.id,
|
|
131
|
-
answers: {},
|
|
132
|
-
stopReason: "stop",
|
|
133
|
-
timestamp: Date.now()
|
|
134
|
-
};
|
|
135
|
-
try {
|
|
136
|
-
if (model.api !== transport.api)
|
|
137
|
-
throw new Error(`Unsupported classifier API: ${model.api}`);
|
|
138
|
-
if (!options?.apiKey)
|
|
139
|
-
throw new Error(`No API key for provider: ${model.provider}`);
|
|
140
|
-
const apiKey = options.apiKey;
|
|
141
|
-
let payload = transport.payload(model, wireRequest(context));
|
|
142
|
-
const transformed = await options.onPayload?.(payload, model);
|
|
143
|
-
if (transformed !== undefined)
|
|
144
|
-
payload = transformed;
|
|
145
|
-
const requestFetch = options.fetch ?? globalThis.fetch;
|
|
146
|
-
const { response, body } = await retryProviderRequest(async () => {
|
|
147
|
-
const timeoutSignal = options.timeoutMs !== undefined ? AbortSignal.timeout(options.timeoutMs) : undefined;
|
|
148
|
-
const signal = options.signal && timeoutSignal ? AbortSignal.any([options.signal, timeoutSignal]) : options.signal ?? timeoutSignal;
|
|
149
|
-
try {
|
|
150
|
-
const next = await requestFetch(transport.url(model), {
|
|
151
|
-
method: "POST",
|
|
152
|
-
headers: requestHeaders(model, apiKey, options.headers),
|
|
153
|
-
body: JSON.stringify(payload),
|
|
154
|
-
signal
|
|
155
|
-
});
|
|
156
|
-
if (!next.ok)
|
|
157
|
-
throw httpError(transport.label, next, await next.text());
|
|
158
|
-
return { response: next, body: await next.json() };
|
|
159
|
-
} catch (error) {
|
|
160
|
-
if (timeoutSignal?.aborted && !options.signal?.aborted)
|
|
161
|
-
throw timeoutError(options.timeoutMs);
|
|
162
|
-
throw error;
|
|
163
|
-
}
|
|
164
|
-
}, {
|
|
165
|
-
maxRetries: options.maxRetries ?? 2,
|
|
166
|
-
maxRetryDelayMs: options.maxRetryDelayMs,
|
|
167
|
-
signal: options.signal
|
|
168
|
-
});
|
|
169
|
-
await options.onResponse?.({ status: response.status, headers: headersToRecord(response.headers) }, model);
|
|
170
|
-
const result = transport.output(body);
|
|
171
|
-
const usage = parseUsage(result.usage, model);
|
|
172
|
-
if (usage)
|
|
173
|
-
output.usage = usage;
|
|
174
|
-
output.answers = parseAnswers(transport.label, result.answers, context);
|
|
175
|
-
return output;
|
|
176
|
-
} catch (error) {
|
|
177
|
-
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
178
|
-
output.errorMessage = formatProviderError(normalizeProviderError(error), `${transport.label} error`);
|
|
179
|
-
return output;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export { isRecord, classifySystemOne };
|
package/dist/cli-h1spv8v4.js
DELETED
|
@@ -1,427 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__esm
|
|
3
|
-
} from "./cli-bc05qbss.js";
|
|
4
|
-
|
|
5
|
-
// src/utils/secret-scrubber.ts
|
|
6
|
-
function normalizeKey(key) {
|
|
7
|
-
if (!/[a-z.-]/.test(key))
|
|
8
|
-
return key;
|
|
9
|
-
let out = key;
|
|
10
|
-
if (/[a-z]/.test(out) && /[A-Z]/.test(out)) {
|
|
11
|
-
out = out.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2");
|
|
12
|
-
}
|
|
13
|
-
return out.replace(/[.-]/g, "_").toUpperCase();
|
|
14
|
-
}
|
|
15
|
-
function escapedForms(value) {
|
|
16
|
-
const forms = new Set([value, value.replace(/[\\$"`]/g, "\\$&"), value.replaceAll("'", "'\\''")]);
|
|
17
|
-
for (const form of [...forms])
|
|
18
|
-
forms.add(JSON.stringify(form).slice(1, -1));
|
|
19
|
-
return [...forms];
|
|
20
|
-
}
|
|
21
|
-
function quoted(open, close, item, lineItem) {
|
|
22
|
-
return `${open}(?:(?:${lineItem})*${close}|(?:${item})*${close}${QUOTE_EOL}|(?:${lineItem})*)`;
|
|
23
|
-
}
|
|
24
|
-
function isSensitiveKeyPath(key) {
|
|
25
|
-
if (isSensitiveKey(key))
|
|
26
|
-
return true;
|
|
27
|
-
const dot = key.lastIndexOf(".");
|
|
28
|
-
return dot >= 0 && isSensitiveKey(key.slice(dot + 1));
|
|
29
|
-
}
|
|
30
|
-
function redactAssignment(match, key, value) {
|
|
31
|
-
if (!isSensitiveKeyPath(key))
|
|
32
|
-
return match;
|
|
33
|
-
let open = "";
|
|
34
|
-
let close = "";
|
|
35
|
-
for (const quote of ["\\\"", '"', "'"]) {
|
|
36
|
-
if (!value.startsWith(quote))
|
|
37
|
-
continue;
|
|
38
|
-
open = quote;
|
|
39
|
-
if (value.length >= quote.length * 2 && value.endsWith(quote))
|
|
40
|
-
close = quote;
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
const inner = value.slice(open.length, value.length - close.length);
|
|
44
|
-
if (inner === "" || /^\[REDACTED:[^\]]*\]$/.test(inner))
|
|
45
|
-
return match;
|
|
46
|
-
return `${key}=${open}[REDACTED:${key}]${close}`;
|
|
47
|
-
}
|
|
48
|
-
function isPlaceholderValue(value) {
|
|
49
|
-
return value === "" || value.includes("[REDACTED") || /^[$<*%{]/.test(value) || /^(?:null|none|nil|true|false|yes|no|undefined|~)$/i.test(value) || /^[+-]?\d+(?:\.\d+)?$/.test(value);
|
|
50
|
-
}
|
|
51
|
-
function looksLikeCode(value) {
|
|
52
|
-
return /[()[\]{};,]/.test(value) || /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/.test(value) || /^[A-Za-z_]+$/.test(value) && value.length < 16;
|
|
53
|
-
}
|
|
54
|
-
function redactLineValue(match, lead, key, sep, value) {
|
|
55
|
-
if (!isSensitiveKeyPath(key))
|
|
56
|
-
return match;
|
|
57
|
-
const quote = /^(?:\\"|"|')/.exec(value)?.[0] ?? "";
|
|
58
|
-
const inner = quote ? value.slice(quote.length, -quote.length) : value;
|
|
59
|
-
if (isPlaceholderValue(inner) || !quote && looksLikeCode(inner))
|
|
60
|
-
return match;
|
|
61
|
-
return `${lead}${key}${sep}${quote}[REDACTED:${key}]${quote}`;
|
|
62
|
-
}
|
|
63
|
-
function jsonStringEnd(text, start, escaped) {
|
|
64
|
-
let innerEscape = false;
|
|
65
|
-
for (let i = start;i < text.length; i++) {
|
|
66
|
-
let ch = text[i];
|
|
67
|
-
if (ch === "\r" || ch === `
|
|
68
|
-
`)
|
|
69
|
-
return -(i + 1);
|
|
70
|
-
const at = i;
|
|
71
|
-
if (escaped) {
|
|
72
|
-
if (ch === '"')
|
|
73
|
-
return -(i + 1);
|
|
74
|
-
if (ch === "\\") {
|
|
75
|
-
ch = text[++i];
|
|
76
|
-
if (ch === undefined || ch === "\r" || ch === `
|
|
77
|
-
`)
|
|
78
|
-
return -(i + 1);
|
|
79
|
-
if (ch !== "\\" && ch !== '"')
|
|
80
|
-
ch = "x";
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (innerEscape)
|
|
84
|
-
innerEscape = false;
|
|
85
|
-
else if (ch === "\\")
|
|
86
|
-
innerEscape = true;
|
|
87
|
-
else if (ch === '"')
|
|
88
|
-
return at;
|
|
89
|
-
}
|
|
90
|
-
return -(text.length + 1);
|
|
91
|
-
}
|
|
92
|
-
function redactJsonValues(text, re, escaped) {
|
|
93
|
-
let out = "";
|
|
94
|
-
let last = 0;
|
|
95
|
-
re.lastIndex = 0;
|
|
96
|
-
for (let m = re.exec(text);m; m = re.exec(text)) {
|
|
97
|
-
const key = m[1] ?? "";
|
|
98
|
-
if (!isSensitiveKeyPath(key))
|
|
99
|
-
continue;
|
|
100
|
-
const valueStart = m.index + m[0].length;
|
|
101
|
-
const end = jsonStringEnd(text, valueStart, escaped);
|
|
102
|
-
if (end < 0) {
|
|
103
|
-
re.lastIndex = Math.max(re.lastIndex, -end - 2);
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
re.lastIndex = end + 1;
|
|
107
|
-
if (isPlaceholderValue(text.slice(valueStart, end)))
|
|
108
|
-
continue;
|
|
109
|
-
out += `${text.slice(last, valueStart)}[REDACTED:${key}]`;
|
|
110
|
-
last = end;
|
|
111
|
-
}
|
|
112
|
-
return last === 0 ? text : out + text.slice(last);
|
|
113
|
-
}
|
|
114
|
-
function redactHeader(match, name, sep, value) {
|
|
115
|
-
if (/^[A-Za-z_]+$/.test(value) && value.length < 16)
|
|
116
|
-
return match;
|
|
117
|
-
return `${name}${sep}[REDACTED:${name.toLowerCase().replace(/-/g, "_")}]`;
|
|
118
|
-
}
|
|
119
|
-
function scrubKeyContext(text) {
|
|
120
|
-
let out = text;
|
|
121
|
-
if (out.includes("PRIVATE KEY")) {
|
|
122
|
-
out = out.replace(PEM_RE, (match, begin, body, end) => body === PEM_MARKER ? match : `${begin}${PEM_MARKER}${end}`);
|
|
123
|
-
}
|
|
124
|
-
if (/authorization|x-api-key/i.test(out)) {
|
|
125
|
-
out = out.replace(AUTH_HEADER_RE, redactHeader).replace(API_KEY_HEADER_RE, redactHeader);
|
|
126
|
-
}
|
|
127
|
-
if (out.includes("--password")) {
|
|
128
|
-
out = out.replace(CURL_PASSWORD_RE, (match, flag, pw) => isPlaceholderValue(pw) ? match : `${flag}[REDACTED:curl_password]`);
|
|
129
|
-
}
|
|
130
|
-
if (/(?:^|\s)-(?:u|U|-user|-proxy-user)\b/.test(out)) {
|
|
131
|
-
out = out.replace(CURL_USER_RE, (match, prefix, user, pw) => isPlaceholderValue(pw) || pw === user ? match : `${prefix}[REDACTED:curl_password]`);
|
|
132
|
-
}
|
|
133
|
-
if (out.includes("://")) {
|
|
134
|
-
out = out.replace(URL_USERINFO_RE, (match, prefix, pw) => isPlaceholderValue(pw) ? match : `${prefix}[REDACTED:url_password]`);
|
|
135
|
-
}
|
|
136
|
-
if (out.includes('"')) {
|
|
137
|
-
out = redactJsonValues(out, JSON_KEY_RE, false);
|
|
138
|
-
if (out.includes("\\\""))
|
|
139
|
-
out = redactJsonValues(out, ESCAPED_JSON_KEY_RE, true);
|
|
140
|
-
}
|
|
141
|
-
if (out.includes(":"))
|
|
142
|
-
out = out.replace(YAML_KEY_RE, redactLineValue);
|
|
143
|
-
return out;
|
|
144
|
-
}
|
|
145
|
-
function snapshotEnv() {
|
|
146
|
-
const parts = [];
|
|
147
|
-
for (const key of Object.keys(process.env).sort()) {
|
|
148
|
-
if (!isSensitiveKey(key))
|
|
149
|
-
continue;
|
|
150
|
-
const v = process.env[key];
|
|
151
|
-
if (!v)
|
|
152
|
-
continue;
|
|
153
|
-
parts.push(`${key}=${v.length}`);
|
|
154
|
-
}
|
|
155
|
-
return parts.join("|");
|
|
156
|
-
}
|
|
157
|
-
function isSensitiveKey(key) {
|
|
158
|
-
const cached = sensitiveKeyVerdicts.get(key);
|
|
159
|
-
if (cached !== undefined)
|
|
160
|
-
return cached;
|
|
161
|
-
const verdict = computeIsSensitiveKey(key);
|
|
162
|
-
if (sensitiveKeyVerdicts.size >= MAX_KEY_VERDICTS)
|
|
163
|
-
sensitiveKeyVerdicts.clear();
|
|
164
|
-
sensitiveKeyVerdicts.set(key, verdict);
|
|
165
|
-
return verdict;
|
|
166
|
-
}
|
|
167
|
-
function computeIsSensitiveKey(key) {
|
|
168
|
-
const normalized = normalizeKey(key);
|
|
169
|
-
if (NON_SECRET_EXCEPTIONS.has(normalized))
|
|
170
|
-
return false;
|
|
171
|
-
if (SENSITIVE_KEY_EXACT.has(normalized))
|
|
172
|
-
return true;
|
|
173
|
-
if (registeredSensitiveKeys.has(key) || registeredSensitiveKeys.has(normalized))
|
|
174
|
-
return true;
|
|
175
|
-
for (const suffix of SENSITIVE_KEY_SUFFIXES) {
|
|
176
|
-
if (normalized.endsWith(suffix))
|
|
177
|
-
return true;
|
|
178
|
-
}
|
|
179
|
-
if (/^codex_oauth(_\d+)?$/.test(key))
|
|
180
|
-
return true;
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
function buildCache() {
|
|
184
|
-
const entries = [];
|
|
185
|
-
const seen = new Set;
|
|
186
|
-
for (const [key, rawValue] of Object.entries(process.env)) {
|
|
187
|
-
if (!rawValue)
|
|
188
|
-
continue;
|
|
189
|
-
if (!isSensitiveKey(key))
|
|
190
|
-
continue;
|
|
191
|
-
const candidates = rawValue.includes(",") ? [rawValue, ...rawValue.split(",").map((s) => s.trim())] : [rawValue];
|
|
192
|
-
for (const candidate of candidates) {
|
|
193
|
-
if (!candidate)
|
|
194
|
-
continue;
|
|
195
|
-
if (candidate.length < MIN_VALUE_LENGTH)
|
|
196
|
-
continue;
|
|
197
|
-
for (const form of escapedForms(candidate)) {
|
|
198
|
-
if (seen.has(form))
|
|
199
|
-
continue;
|
|
200
|
-
seen.add(form);
|
|
201
|
-
entries.push({ value: form, name: key });
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
entries.sort((a, b) => b.value.length - a.value.length);
|
|
206
|
-
return { entries, snapshotKey: snapshotEnv() };
|
|
207
|
-
}
|
|
208
|
-
function getCache() {
|
|
209
|
-
const current = snapshotEnv();
|
|
210
|
-
if (!cache || cache.snapshotKey !== current) {
|
|
211
|
-
cache = buildCache();
|
|
212
|
-
}
|
|
213
|
-
return cache;
|
|
214
|
-
}
|
|
215
|
-
function scrubSecrets(text) {
|
|
216
|
-
if (text == null)
|
|
217
|
-
return "";
|
|
218
|
-
if (text.length === 0)
|
|
219
|
-
return text;
|
|
220
|
-
let out = text;
|
|
221
|
-
const { entries } = getCache();
|
|
222
|
-
for (const { value, name } of entries) {
|
|
223
|
-
if (out.includes(value)) {
|
|
224
|
-
out = out.split(value).join(`[REDACTED:${name}]`);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
for (const [value, name] of volatileSecrets) {
|
|
228
|
-
if (out.includes(value)) {
|
|
229
|
-
out = out.split(value).join(`[REDACTED:${name}]`);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
for (const { name, re } of TOKEN_REGEXES) {
|
|
233
|
-
out = out.replace(re, `[REDACTED:${name}]`);
|
|
234
|
-
}
|
|
235
|
-
out = out.replace(ASSIGNMENT_RE, redactAssignment);
|
|
236
|
-
if (out.includes("="))
|
|
237
|
-
out = out.replace(INI_ASSIGNMENT_RE, redactLineValue);
|
|
238
|
-
return scrubKeyContext(out);
|
|
239
|
-
}
|
|
240
|
-
function scrubObject(value, seen = new WeakSet) {
|
|
241
|
-
if (value === null || value === undefined)
|
|
242
|
-
return value;
|
|
243
|
-
if (typeof value === "string")
|
|
244
|
-
return scrubSecrets(value);
|
|
245
|
-
if (typeof value !== "object")
|
|
246
|
-
return value;
|
|
247
|
-
if (seen.has(value)) {
|
|
248
|
-
return "[Circular]";
|
|
249
|
-
}
|
|
250
|
-
seen.add(value);
|
|
251
|
-
if (Array.isArray(value)) {
|
|
252
|
-
return value.map((item) => scrubObject(item, seen));
|
|
253
|
-
}
|
|
254
|
-
const out = {};
|
|
255
|
-
for (const [key, child] of Object.entries(value)) {
|
|
256
|
-
out[key] = scrubObject(child, seen);
|
|
257
|
-
}
|
|
258
|
-
return out;
|
|
259
|
-
}
|
|
260
|
-
function refreshSecretScrubberCache() {
|
|
261
|
-
cache = null;
|
|
262
|
-
}
|
|
263
|
-
function registerVolatileSecret(value, name) {
|
|
264
|
-
if (value.length < MIN_VALUE_LENGTH)
|
|
265
|
-
return;
|
|
266
|
-
for (const form of escapedForms(value))
|
|
267
|
-
volatileSecrets.set(form, name);
|
|
268
|
-
}
|
|
269
|
-
function registerSensitiveKeyName(key) {
|
|
270
|
-
if (registeredSensitiveKeys.has(key))
|
|
271
|
-
return;
|
|
272
|
-
registeredSensitiveKeys.add(key);
|
|
273
|
-
sensitiveKeyVerdicts.clear();
|
|
274
|
-
cache = null;
|
|
275
|
-
}
|
|
276
|
-
var SENSITIVE_KEY_EXACT, SENSITIVE_KEY_SUFFIXES, NON_SECRET_EXCEPTIONS, MIN_VALUE_LENGTH = 12, QUOTE_EOL, JSON_DQ, RAW_DQ, SQ, BARE, ASSIGNMENT_RE, LINE_START, LINE_END, LINE_VALUE, INI_ASSIGNMENT_RE, YAML_KEY_RE, JSON_KEY, JSON_KEY_RE, ESCAPED_JSON_KEY_RE, TOKEN68, HEADER_SEP, AUTH_HEADER_RE, API_KEY_HEADER_RE, CURL_PASSWORD_RE, CURL_USER_RE, URL_USERINFO_RE, PEM_RE, PEM_MARKER = "[REDACTED:private_key]", TB, TOKEN_REGEXES, cache = null, volatileSecrets, registeredSensitiveKeys, sensitiveKeyVerdicts, MAX_KEY_VERDICTS = 4096;
|
|
277
|
-
var init_secret_scrubber = __esm(() => {
|
|
278
|
-
SENSITIVE_KEY_EXACT = new Set([
|
|
279
|
-
"API_KEY",
|
|
280
|
-
"SECRETS_ENCRYPTION_KEY",
|
|
281
|
-
"GITHUB_TOKEN",
|
|
282
|
-
"GITLAB_TOKEN",
|
|
283
|
-
"AZURE_DEVOPS_TOKEN",
|
|
284
|
-
"AZURE_DEVOPS_EXT_PAT",
|
|
285
|
-
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
286
|
-
"ANTHROPIC_API_KEY",
|
|
287
|
-
"OPENAI_API_KEY",
|
|
288
|
-
"OPENROUTER_API_KEY",
|
|
289
|
-
"SLACK_BOT_TOKEN",
|
|
290
|
-
"SLACK_SIGNING_SECRET",
|
|
291
|
-
"SLACK_CLIENT_SECRET",
|
|
292
|
-
"SLACK_USER_TOKEN",
|
|
293
|
-
"SLACK_APP_TOKEN",
|
|
294
|
-
"SENTRY_AUTH_TOKEN",
|
|
295
|
-
"VERCEL_TOKEN",
|
|
296
|
-
"RESEND_API_KEY",
|
|
297
|
-
"AGENTMAIL_API_KEY",
|
|
298
|
-
"API_AGENT_FS_API_KEY",
|
|
299
|
-
"AGENT_FS_API_KEY",
|
|
300
|
-
"BUSINESS_USE_API_KEY",
|
|
301
|
-
"QA_USE_API_KEY",
|
|
302
|
-
"DOCS_API_KEY",
|
|
303
|
-
"DOKPLOY_API_KEY",
|
|
304
|
-
"DEVTO_API_KEY",
|
|
305
|
-
"ELEVENLABS_API_KEY",
|
|
306
|
-
"ENGINY_API_KEY",
|
|
307
|
-
"OPENFORT_API_KEY",
|
|
308
|
-
"OPENFORT_TEST_SECRET_KEY",
|
|
309
|
-
"OPENFORT_TEST_WALLET_PRIVATE_KEY",
|
|
310
|
-
"OPENFORT_WALLET_SECRET",
|
|
311
|
-
"TURSO_API_TOKEN",
|
|
312
|
-
"TURSO_DB_TOKEN",
|
|
313
|
-
"TURSO_X_POSTS_DB_TOKEN",
|
|
314
|
-
"BROWSER_USE_API_KEY",
|
|
315
|
-
"PLAUSIBLE_API_KEY",
|
|
316
|
-
"IMGFLIP_PASSWORD",
|
|
317
|
-
"GSC_SERVICE_ACCOUNT_BASE64",
|
|
318
|
-
"LINEAR_API_KEY",
|
|
319
|
-
"LINEAR_OAUTH_CLIENT_SECRET",
|
|
320
|
-
"OTEL_EXPORTER_OTLP_HEADERS",
|
|
321
|
-
"SIGNOZ_INGESTION_KEY",
|
|
322
|
-
"SECRET",
|
|
323
|
-
"PASSWORD",
|
|
324
|
-
"PASSWD",
|
|
325
|
-
"TOKEN",
|
|
326
|
-
"PRIVATE_KEY",
|
|
327
|
-
"APIKEY",
|
|
328
|
-
"ACCESS_TOKEN",
|
|
329
|
-
"REFRESH_TOKEN",
|
|
330
|
-
"CLIENT_SECRET",
|
|
331
|
-
"AUTHORIZATION",
|
|
332
|
-
"CREDENTIALS"
|
|
333
|
-
]);
|
|
334
|
-
SENSITIVE_KEY_SUFFIXES = [
|
|
335
|
-
"_API_KEY",
|
|
336
|
-
"_TOKEN",
|
|
337
|
-
"_SECRET",
|
|
338
|
-
"_PASSWORD",
|
|
339
|
-
"_PASS",
|
|
340
|
-
"_PRIVATE_KEY",
|
|
341
|
-
"_ACCESS_KEY",
|
|
342
|
-
"_SECRET_KEY",
|
|
343
|
-
"_APIKEY",
|
|
344
|
-
"_AUTH_HEADER",
|
|
345
|
-
"_CREDENTIALS",
|
|
346
|
-
"_DSN",
|
|
347
|
-
"_DEPLOY_KEY"
|
|
348
|
-
];
|
|
349
|
-
NON_SECRET_EXCEPTIONS = new Set([
|
|
350
|
-
"MCP_BASE_URL",
|
|
351
|
-
"APP_URL",
|
|
352
|
-
"API_URL",
|
|
353
|
-
"TEMPLATE_REGISTRY_URL",
|
|
354
|
-
"GOOGLE_APPLICATION_CREDENTIALS",
|
|
355
|
-
"PAGE_TOKEN",
|
|
356
|
-
"NEXT_PAGE_TOKEN",
|
|
357
|
-
"PREV_PAGE_TOKEN",
|
|
358
|
-
"NEXT_TOKEN",
|
|
359
|
-
"CONTINUATION_TOKEN",
|
|
360
|
-
"SYNC_TOKEN",
|
|
361
|
-
"NEXT_SYNC_TOKEN"
|
|
362
|
-
]);
|
|
363
|
-
QUOTE_EOL = String.raw`(?=$|[\r\n]|\\[rn]|")`;
|
|
364
|
-
JSON_DQ = quoted(String.raw`\\"(?!\$)`, String.raw`\\"`, String.raw`\\\\(?:\\\\|\\"|[^\\"])|\\[^\\"]|[^"\\]`, String.raw`\\\\(?:\\\\|\\"|[^\\"\r\n])|\\[^\\"nr\r\n]|[^"\\\r\n]`);
|
|
365
|
-
RAW_DQ = quoted(`"(?!\\$)`, `"`, String.raw`\\[\s\S]|[^"\\]`, String.raw`\\[^\r\n]|[^"\\\r\n]`);
|
|
366
|
-
SQ = quoted(`'`, `'`, String.raw`[^'\\]|'\\\\?''|\\[\s\S]`, String.raw`[^'\\\r\n]|'\\\\?''|\\[^nr\r\n]`);
|
|
367
|
-
BARE = String.raw`(?!\$)(?:\\[^nrtu"\s]|[^\s"'\\])+`;
|
|
368
|
-
ASSIGNMENT_RE = new RegExp(String.raw`(?:(?<=\\[nrt])|(?<![\w\\.]))([A-Za-z_][A-Za-z0-9_.]*)=(?!=)(${JSON_DQ}|${RAW_DQ}|${SQ}|${BARE})`, "g");
|
|
369
|
-
LINE_START = String.raw`(?:^|(?<=\\[nr]))`;
|
|
370
|
-
LINE_END = String.raw`(?=[ \t]*(?:$|\r|\\[nr]|"))`;
|
|
371
|
-
LINE_VALUE = String.raw`"[^"\\\r\n]*"|'[^'\\\r\n]*'|\\"[^"\\\r\n]*\\"|[^\s"'\\]+`;
|
|
372
|
-
INI_ASSIGNMENT_RE = new RegExp(String.raw`${LINE_START}([ \t]*)([A-Za-z_][\w.]*)([ \t]*=[ \t]*)(${LINE_VALUE})${LINE_END}`, "gm");
|
|
373
|
-
YAML_KEY_RE = new RegExp(String.raw`${LINE_START}([ \t]*(?:-[ \t]+)?)([A-Za-z_][\w.-]*)([ \t]*:[ \t]+)(${LINE_VALUE})${LINE_END}`, "gm");
|
|
374
|
-
JSON_KEY = String.raw`[A-Za-z_][\w.-]{0,63}`;
|
|
375
|
-
JSON_KEY_RE = new RegExp(String.raw`"(${JSON_KEY})"[ \t]*:[ \t]*"`, "g");
|
|
376
|
-
ESCAPED_JSON_KEY_RE = new RegExp(String.raw`\\"(${JSON_KEY})\\"[ \t]*:[ \t]*\\"`, "g");
|
|
377
|
-
TOKEN68 = String.raw`[A-Za-z0-9._~+/=-]{8,}(?![A-Za-z0-9._~+/=\[-])`;
|
|
378
|
-
HEADER_SEP = String.raw`\\?["']?[ \t]*:[ \t]*\\?["']?`;
|
|
379
|
-
AUTH_HEADER_RE = new RegExp(String.raw`(?<![\w-])((?:proxy-)?authorization)(${HEADER_SEP}(?:bearer|basic|token|bot)[ \t]+)(${TOKEN68})`, "gi");
|
|
380
|
-
API_KEY_HEADER_RE = new RegExp(String.raw`(?<![\w-])(x-api-key)(${HEADER_SEP})(${TOKEN68})`, "gi");
|
|
381
|
-
CURL_PASSWORD_RE = /(?<=^|[\s'"])(--password(?:[ \t]+|=)\\?["']?)([^\s"'\\]+)/g;
|
|
382
|
-
CURL_USER_RE = /(?<=^|[\s'"])((?:-u|-U|--user|--proxy-user)(?:[ \t]+|=)\\?["']?([^\s"'\\:@]+):)([^\s"'\\@]+)/g;
|
|
383
|
-
URL_USERINFO_RE = /(?<![a-z0-9+.-])([a-z][a-z0-9+.-]{0,31}:\/\/[^\s/:@?#"'\\]+:)([^\s/@?#"'\\]+)(?=@)/gi;
|
|
384
|
-
PEM_RE = /(-----BEGIN [A-Z0-9 ]{0,32}PRIVATE KEY(?: BLOCK)?-----)((?:(?!-----)[\s\S]){1,16384})(-----END [A-Z0-9 ]{0,32}PRIVATE KEY(?: BLOCK)?-----)/g;
|
|
385
|
-
TB = String.raw`(?:(?<=\\[nrtbfu0])|(?<!\w))`;
|
|
386
|
-
TOKEN_REGEXES = [
|
|
387
|
-
{ name: "github_pat", re: /github_pat_[A-Za-z0-9_]{20,}/g },
|
|
388
|
-
{ name: "github_token", re: new RegExp(String.raw`${TB}gh[pousr]_[A-Za-z0-9]{20,}\b`, "g") },
|
|
389
|
-
{ name: "acp_session_token", re: new RegExp(String.raw`${TB}aseph_[A-Za-z0-9]{20,}\b`, "g") },
|
|
390
|
-
{ name: "gitlab_pat", re: new RegExp(String.raw`${TB}glpat-[A-Za-z0-9_-]{20,}\b`, "g") },
|
|
391
|
-
{
|
|
392
|
-
name: "azure_devops_pat",
|
|
393
|
-
re: new RegExp(String.raw`${TB}[A-Za-z0-9]{76}AZDO[A-Za-z0-9]{4}\b`, "g")
|
|
394
|
-
},
|
|
395
|
-
{ name: "anthropic_key", re: new RegExp(String.raw`${TB}sk-ant-[A-Za-z0-9_-]{20,}\b`, "g") },
|
|
396
|
-
{ name: "openai_proj_key", re: new RegExp(String.raw`${TB}sk-proj-[A-Za-z0-9_-]{20,}\b`, "g") },
|
|
397
|
-
{
|
|
398
|
-
name: "openrouter_key",
|
|
399
|
-
re: new RegExp(String.raw`${TB}sk-or-(?:v1-)?[A-Za-z0-9_-]{20,}\b`, "g")
|
|
400
|
-
},
|
|
401
|
-
{ name: "sk_key", re: new RegExp(String.raw`${TB}sk-[A-Za-z0-9]{20,}\b`, "g") },
|
|
402
|
-
{ name: "slack_token", re: new RegExp(String.raw`${TB}xox[baprseo]-[A-Za-z0-9-]{10,}\b`, "g") },
|
|
403
|
-
{ name: "aws_access_key", re: new RegExp(String.raw`${TB}AKIA[0-9A-Z]{16}\b`, "g") },
|
|
404
|
-
{ name: "google_api_key", re: new RegExp(String.raw`${TB}AIza[A-Za-z0-9_-]{35}\b`, "g") },
|
|
405
|
-
{
|
|
406
|
-
name: "jwt",
|
|
407
|
-
re: new RegExp(String.raw`${TB}eyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b`, "g")
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
name: "signoz_ingestion_key",
|
|
411
|
-
re: new RegExp(String.raw`${TB}signoz-ingestion-key=[A-Za-z0-9._~+/-]{20,}={0,2}\b`, "g")
|
|
412
|
-
},
|
|
413
|
-
{ name: "linear_oauth", re: new RegExp(String.raw`${TB}lin_oauth_[A-Za-z0-9_-]{10,}\b`, "g") },
|
|
414
|
-
{ name: "linear_api", re: new RegExp(String.raw`${TB}lin_api_[A-Za-z0-9_-]{10,}\b`, "g") },
|
|
415
|
-
{ name: "npm_token", re: new RegExp(String.raw`${TB}npm_[A-Za-z0-9_-]{20,}\b`, "g") },
|
|
416
|
-
{
|
|
417
|
-
name: "atlassian_token",
|
|
418
|
-
re: new RegExp(String.raw`${TB}ATATT[A-Za-z0-9_-]{20,}\b`, "g")
|
|
419
|
-
},
|
|
420
|
-
{ name: "mcp_token", re: new RegExp(String.raw`${TB}aswt_[A-Za-z0-9]{20,}\b`, "g") }
|
|
421
|
-
];
|
|
422
|
-
volatileSecrets = new Map;
|
|
423
|
-
registeredSensitiveKeys = new Set;
|
|
424
|
-
sensitiveKeyVerdicts = new Map;
|
|
425
|
-
});
|
|
426
|
-
|
|
427
|
-
export { isSensitiveKey, scrubSecrets, scrubObject, refreshSecretScrubberCache, registerVolatileSecret, registerSensitiveKeyName, init_secret_scrubber };
|