@humain/humain-code 0.6.2 → 0.7.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 +119 -0
- package/README.md +23 -6
- package/dist/agent-monitor/entry.lazy.d.ts +3 -0
- package/dist/agent-monitor/entry.lazy.d.ts.map +1 -0
- package/dist/agent-monitor/entry.lazy.js +3 -0
- package/dist/agent-monitor/entry.lazy.js.map +1 -0
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/adaptive-peer-worker-X2ZNZE3S.js +8 -0
- package/dist/bundle/chunks/adaptive-session-host-7KDSQV5I.js +162 -0
- package/dist/bundle/chunks/anthropic-messages-TQK3FUV3.js +68 -0
- package/dist/bundle/chunks/anthropic.js +13 -10
- package/dist/bundle/chunks/{azure-openai-responses-IV74M5OR.js → azure-openai-responses-JY7OSLH2.js} +6 -6
- package/dist/bundle/chunks/bedrock-converse-stream.js +79 -74
- package/dist/bundle/chunks/chunk-2FYYW6FY.js +2 -0
- package/dist/bundle/chunks/{chunk-A2VPLMF2.js → chunk-2G7YVAVF.js} +1 -1
- package/dist/bundle/chunks/chunk-32QLLD2P.js +1114 -0
- package/dist/bundle/chunks/{chunk-3LP543EX.js → chunk-3EDMWQ35.js} +17 -16
- package/dist/bundle/chunks/chunk-3HVHETMU.js +18 -0
- package/dist/bundle/chunks/{chunk-XMZGB3H4.js → chunk-4HTVBBJD.js} +11 -6
- package/dist/bundle/chunks/chunk-4JRER4XK.js +175 -0
- package/dist/bundle/chunks/{chunk-FHLLDO7U.js → chunk-4PRNKB6V.js} +5 -5
- package/dist/bundle/chunks/chunk-4QAXV5T6.js +49 -0
- package/dist/bundle/chunks/{chunk-JCTQQ3DX.js → chunk-4V5VL2BO.js} +1 -1
- package/dist/bundle/chunks/chunk-5B25YXF7.js +24 -0
- package/dist/bundle/chunks/chunk-5L4PBYC7.js +11 -0
- package/dist/bundle/chunks/chunk-66FZJO75.js +5146 -0
- package/dist/bundle/chunks/chunk-6P6GJPYB.js +4 -0
- package/dist/bundle/chunks/chunk-6PNQYO6A.js +10 -0
- package/dist/bundle/chunks/chunk-7NKUVTBL.js +76 -0
- package/dist/bundle/chunks/chunk-AEWYICBL.js +89 -0
- package/dist/bundle/chunks/chunk-AQ4EXORZ.js +14 -0
- package/dist/bundle/chunks/chunk-AZXVJN6E.js +19 -0
- package/dist/bundle/chunks/chunk-CRN54O4D.js +24 -0
- package/dist/bundle/chunks/chunk-CTU2ECLD.js +7 -0
- package/dist/bundle/chunks/{chunk-BQ3TMEWD.js → chunk-EIC7CQX3.js} +4 -3
- package/dist/bundle/chunks/chunk-F6ZAYLU2.js +59 -0
- package/dist/bundle/chunks/chunk-G4QPSFBF.js +493 -0
- package/dist/bundle/chunks/chunk-GME4AWDG.js +23 -0
- package/dist/bundle/chunks/{chunk-SFMDIVZ4.js → chunk-GRJUKEE3.js} +43 -30
- package/dist/bundle/chunks/chunk-GTILMMUF.js +12 -0
- package/dist/bundle/chunks/chunk-GUHNFZ2Q.js +51 -0
- package/dist/bundle/chunks/chunk-GY663MNP.js +11 -0
- package/dist/bundle/chunks/chunk-HTA325LJ.js +56 -0
- package/dist/bundle/chunks/{chunk-5L4JG6PO.js → chunk-I3NDOUHE.js} +8 -7
- package/dist/bundle/chunks/chunk-I5E7RQ5V.js +21 -0
- package/dist/bundle/chunks/chunk-IWZQ25I3.js +5 -0
- package/dist/bundle/chunks/chunk-IYGHKVUG.js +2 -0
- package/dist/bundle/chunks/chunk-J57HOSWD.js +21 -0
- package/dist/bundle/chunks/chunk-JF7FYXAI.js +288 -0
- package/dist/bundle/chunks/chunk-JSZBTGI6.js +10 -0
- package/dist/bundle/chunks/chunk-JYWUOKOI.js +1061 -0
- package/dist/bundle/chunks/{chunk-DLCBSLHW.js → chunk-KRCX3ZBA.js} +1 -1
- package/dist/bundle/chunks/chunk-KTSJYIYC.js +30 -0
- package/dist/bundle/chunks/{chunk-K7SDY3VJ.js → chunk-LB4CIS4F.js} +40 -165
- package/dist/bundle/chunks/{chunk-NN53K2QQ.js → chunk-LYZ37DJP.js} +2 -14
- package/dist/bundle/chunks/chunk-MD7K7RPN.js +20 -0
- package/dist/bundle/chunks/chunk-MX4Q4W6H.js +214 -0
- package/dist/bundle/chunks/{chunk-6PD3T2EF.js → chunk-N2SNMUD3.js} +1 -1
- package/dist/bundle/chunks/chunk-NXA6NEHE.js +54 -0
- package/dist/bundle/chunks/chunk-OB332KMV.js +300 -0
- package/dist/bundle/chunks/chunk-P6AXBESH.js +1883 -0
- package/dist/bundle/chunks/chunk-PPBDDQHP.js +11 -0
- package/dist/bundle/chunks/chunk-PWUDFU5V.js +51 -0
- package/dist/bundle/chunks/chunk-Q5RKNQ2T.js +73 -0
- package/dist/bundle/chunks/chunk-QT6ZHDMP.js +12 -0
- package/dist/bundle/chunks/chunk-R5OOX7RW.js +16 -0
- package/dist/bundle/chunks/chunk-R6YQR7TZ.js +25 -0
- package/dist/bundle/chunks/{chunk-4ZBGTJJM.js → chunk-RNBZBCH2.js} +1 -1
- package/dist/bundle/chunks/chunk-RQU722SY.js +1 -0
- package/dist/bundle/chunks/{chunk-RGUZULEE.js → chunk-RS6PZK35.js} +71 -72
- package/dist/bundle/chunks/{jiti-loader-6P33XTLC.js → chunk-RW7GT7L3.js} +1 -1
- package/dist/bundle/chunks/{chunk-PCTLFSQG.js → chunk-SCINMV4X.js} +1 -1
- package/dist/bundle/chunks/{chunk-NCC2FAJN.js → chunk-SSRCVJZK.js} +28 -28
- package/dist/bundle/chunks/chunk-T5A6T24H.js +93 -0
- package/dist/bundle/chunks/chunk-T7BXP46S.js +3367 -0
- package/dist/bundle/chunks/chunk-TGDPZCSW.js +9 -0
- package/dist/bundle/chunks/{chunk-4J6BGNX2.js → chunk-TWAHPPXN.js} +434 -429
- package/dist/bundle/chunks/chunk-UEW6TUSP.js +36 -0
- package/dist/bundle/chunks/chunk-UZNIPOGS.js +323 -0
- package/dist/bundle/chunks/{chunk-KM4GQ2BU.js → chunk-VFLVWPLZ.js} +5 -6
- package/dist/bundle/chunks/chunk-WAPZN4KP.js +74 -0
- package/dist/bundle/chunks/chunk-WCFHG6NO.js +16 -0
- package/dist/bundle/chunks/chunk-WQ7EJQIT.js +839 -0
- package/dist/bundle/chunks/chunk-WQOOJP7U.js +4 -0
- package/dist/bundle/chunks/chunk-XHDVDJM7.js +17 -0
- package/dist/bundle/chunks/chunk-YPZPCHNV.js +3 -0
- package/dist/bundle/chunks/chunk-Z5YLKK3S.js +41 -0
- package/dist/bundle/chunks/chunk-ZJUU6WOV.js +2052 -0
- package/dist/bundle/chunks/{cli-N7KOVPLB.js → cli-H4LJNE2V.js} +2 -2
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-KRMHG2L3.js → cloudflare-workers-ai-system-one-T5R2RVFQ.js} +1 -1
- package/dist/bundle/chunks/codemode-worker.js +2 -0
- package/dist/bundle/chunks/compat-ZK2DIW3P.js +15 -0
- package/dist/bundle/chunks/dist-EY7YKQHB.js +11 -0
- package/dist/bundle/chunks/dist-FMWWM4H7.js +268 -0
- package/dist/bundle/chunks/dist-NHQTBDHT.js +1107 -0
- package/dist/bundle/chunks/{easter-egg-3d-O2GG2XIG.js → easter-egg-3d-BUEOC3NO.js} +1 -1
- package/dist/bundle/chunks/entry-A2CSLKHC.js +323 -0
- package/dist/bundle/chunks/entry-AL54ZGYO.js +2 -0
- package/dist/bundle/chunks/{execute-LMBACTKA.js → execute-MY5JSEPV.js} +18 -15
- package/dist/bundle/chunks/{extract-CXXLVFC5.js → extract-PTGACPGP.js} +3 -3
- package/dist/bundle/chunks/flow-implementer-APJFY4YI.js +21 -0
- package/dist/bundle/chunks/github-copilot.js +66 -62
- package/dist/bundle/chunks/{google-generative-ai-SBL77OXO.js → google-generative-ai-UL7YEQ6J.js} +2 -3
- package/dist/bundle/chunks/{google-vertex-NZBNNXMK.js → google-vertex-OTMSPUYH.js} +3 -3
- package/dist/bundle/chunks/host-75YAHLDR.js +3 -0
- package/dist/bundle/chunks/index.bundle-THL4EUSU.js +390 -0
- package/dist/bundle/chunks/inprocess-5NP5VJHZ.js +32 -0
- package/dist/bundle/chunks/interactive-mode-IW4PIVAQ.js +5 -0
- package/dist/bundle/chunks/jiti-bun-loader-VSLLRCSD.js +3459 -0
- package/dist/bundle/chunks/jiti-loader-TMJL6S2D.js +2 -0
- package/dist/bundle/chunks/{llama-cpp-classify-PP63BYDF.js → llama-cpp-classify-GJAXULWL.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-DX4YKJSO.js → mistral-conversations-E72Y6OC3.js} +2 -2
- package/dist/bundle/chunks/{node-UGQUSQE6.js → node-ZFIIS5IM.js} +32 -32
- package/dist/bundle/chunks/openai-codex-responses-S7CMCAOY.js +101 -0
- package/dist/bundle/chunks/openai-completions-2Z57N7PC.js +87 -0
- package/dist/bundle/chunks/{openai-decisions-ALJROWBE.js → openai-decisions-JIOJDB4C.js} +1 -1
- package/dist/bundle/chunks/openai-responses-5VBZSTHL.js +27 -0
- package/dist/bundle/chunks/{openrouter-images-FCJT7C7I.js → openrouter-images-S6O7DBEJ.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-NHTQQOPW.js → pi-messages-SMLN5J2W.js} +10 -7
- package/dist/bundle/chunks/runtime-OYTWXIUM.js +2 -0
- package/dist/bundle/chunks/session-picker-DM6S37IF.js +4 -0
- package/dist/bundle/chunks/startup-ui-4GGLWNSU.js +3 -0
- package/dist/bundle/chunks/trace-command-YLDYCL55.js +254 -0
- package/dist/bundle/chunks/typesafe-system-one-7BEL3H5N.js +3 -0
- package/dist/bundle/chunks/virtual-modules-TI3W24YL.js +28 -0
- package/dist/bundle/cli-runtime.js +5 -3
- package/dist/bundle/flow/agents/orch-implementation-fast.md +4 -4
- package/dist/bundle/flow/agents/orch-implementation-strong.md +5 -5
- package/dist/bundle/flow/package.json +35 -3
- package/dist/bundle/index.js +20 -17
- package/dist/bundle/orchestrate/README.md +37 -0
- package/dist/bundle/{flow → orchestrate}/agents/orch-qa-agent.md +1 -1
- package/dist/bundle/{flow → orchestrate}/agents/orch-worker.md +1 -1
- package/dist/bundle/{flow → orchestrate}/agents/orchestrator-lead.md +1 -1
- package/dist/bundle/orchestrate/package.json +29 -0
- package/dist/bundle/rpc-entry.js +5 -3
- package/dist/cli/args.d.ts +6 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +69 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts +3 -2
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js +4 -3
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js +3 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts +2 -0
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js +6 -6
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/metadata-disclosure.d.ts +4 -0
- package/dist/cli/metadata-disclosure.d.ts.map +1 -0
- package/dist/cli/metadata-disclosure.js +23 -0
- package/dist/cli/metadata-disclosure.js.map +1 -0
- package/dist/cli/project-trust.d.ts.map +1 -1
- package/dist/cli/project-trust.js +4 -1
- package/dist/cli/project-trust.js.map +1 -1
- package/dist/cli/session-picker.lazy.d.ts +3 -0
- package/dist/cli/session-picker.lazy.d.ts.map +1 -0
- package/dist/cli/session-picker.lazy.js +3 -0
- package/dist/cli/session-picker.lazy.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +4 -4
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +38 -14
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/cli/startup-ui.lazy.d.ts +3 -0
- package/dist/cli/startup-ui.lazy.d.ts.map +1 -0
- package/dist/cli/startup-ui.lazy.js +3 -0
- package/dist/cli/startup-ui.lazy.js.map +1 -0
- package/dist/cli/trace-command.lazy.d.ts +3 -0
- package/dist/cli/trace-command.lazy.d.ts.map +1 -0
- package/dist/cli/trace-command.lazy.js +3 -0
- package/dist/cli/trace-command.lazy.js.map +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/coordination/broker/entry.lazy.d.ts +3 -0
- package/dist/coordination/broker/entry.lazy.d.ts.map +1 -0
- package/dist/coordination/broker/entry.lazy.js +3 -0
- package/dist/coordination/broker/entry.lazy.js.map +1 -0
- package/dist/core/acceptance-command.d.ts +15 -0
- package/dist/core/acceptance-command.d.ts.map +1 -0
- package/dist/core/acceptance-command.js +150 -0
- package/dist/core/acceptance-command.js.map +1 -0
- package/dist/core/acceptance-ledger.d.ts +52 -0
- package/dist/core/acceptance-ledger.d.ts.map +1 -0
- package/dist/core/acceptance-ledger.js +341 -0
- package/dist/core/acceptance-ledger.js.map +1 -0
- package/dist/core/admission-types.d.ts +69 -0
- package/dist/core/admission-types.js +2 -0
- package/dist/core/admission-types.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +7 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +43 -9
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +8 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +13 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +127 -10
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1390 -145
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/anthropic-subscription-usage.d.ts +1 -1
- package/dist/core/anthropic-subscription-usage.d.ts.map +1 -1
- package/dist/core/anthropic-subscription-usage.js +31 -3
- package/dist/core/anthropic-subscription-usage.js.map +1 -1
- package/dist/core/auth-storage.d.ts +2 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +13 -10
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/auto-session-namer.d.ts.map +1 -1
- package/dist/core/auto-session-namer.js +3 -1
- package/dist/core/auto-session-namer.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +3 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/bug-report-redaction.d.ts +4 -0
- package/dist/core/bug-report-redaction.d.ts.map +1 -0
- package/dist/core/bug-report-redaction.js +209 -0
- package/dist/core/bug-report-redaction.js.map +1 -0
- package/dist/core/bug-report.d.ts +26 -6
- package/dist/core/bug-report.d.ts.map +1 -1
- package/dist/core/bug-report.js +82 -9
- package/dist/core/bug-report.js.map +1 -1
- package/dist/core/cache-warmer.d.ts.map +1 -1
- package/dist/core/cache-warmer.js +5 -0
- package/dist/core/cache-warmer.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +6 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +103 -71
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +2 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/extensions/jiti-bun-babel.d.ts +4 -0
- package/dist/core/extensions/jiti-bun-babel.d.ts.map +1 -0
- package/dist/core/extensions/jiti-bun-babel.js +4 -0
- package/dist/core/extensions/jiti-bun-babel.js.map +1 -0
- package/dist/core/extensions/jiti-bun-loader.d.ts +4 -0
- package/dist/core/extensions/jiti-bun-loader.d.ts.map +1 -0
- package/dist/core/extensions/jiti-bun-loader.js +13 -0
- package/dist/core/extensions/jiti-bun-loader.js.map +1 -0
- package/dist/core/extensions/jiti-bun-loader.lazy.d.ts +3 -0
- package/dist/core/extensions/jiti-bun-loader.lazy.d.ts.map +1 -0
- package/dist/core/extensions/jiti-bun-loader.lazy.js +3 -0
- package/dist/core/extensions/jiti-bun-loader.lazy.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +9 -3
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +4 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +3 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/flow-implementer.d.ts +25 -0
- package/dist/core/flow-implementer.d.ts.map +1 -0
- package/dist/core/flow-implementer.js +301 -0
- package/dist/core/flow-implementer.js.map +1 -0
- package/dist/core/internal-process.d.ts +23 -0
- package/dist/core/internal-process.d.ts.map +1 -0
- package/dist/core/internal-process.js +88 -0
- package/dist/core/internal-process.js.map +1 -0
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.js +1 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +52 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +4 -4
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +4 -0
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +8 -0
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-request-admission.d.ts +51 -0
- package/dist/core/model-request-admission.d.ts.map +1 -0
- package/dist/core/model-request-admission.js +103 -0
- package/dist/core/model-request-admission.js.map +1 -0
- package/dist/core/model-resolver.d.ts +4 -0
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +109 -2
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +56 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +482 -40
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/model-selection-intent.d.ts +14 -0
- package/dist/core/model-selection-intent.d.ts.map +1 -0
- package/dist/core/model-selection-intent.js +15 -0
- package/dist/core/model-selection-intent.js.map +1 -0
- package/dist/core/oauth-account-pool.d.ts +4 -1
- package/dist/core/oauth-account-pool.d.ts.map +1 -1
- package/dist/core/oauth-account-pool.js +251 -228
- package/dist/core/oauth-account-pool.js.map +1 -1
- package/dist/core/os-secret-store.d.ts +25 -0
- package/dist/core/os-secret-store.d.ts.map +1 -0
- package/dist/core/os-secret-store.js +290 -0
- package/dist/core/os-secret-store.js.map +1 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js +62 -2
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/pi-ai-schemas.d.ts +4 -0
- package/dist/core/pi-ai-schemas.d.ts.map +1 -1
- package/dist/core/private-windows-path.d.ts +4 -0
- package/dist/core/private-windows-path.d.ts.map +1 -0
- package/dist/core/private-windows-path.js +44 -0
- package/dist/core/private-windows-path.js.map +1 -0
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +18 -2
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +1 -1
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +6 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/run-outcome.d.ts +40 -0
- package/dist/core/run-outcome.d.ts.map +1 -0
- package/dist/core/run-outcome.js +91 -0
- package/dist/core/run-outcome.js.map +1 -0
- package/dist/core/run-preflight.d.ts +5 -0
- package/dist/core/run-preflight.d.ts.map +1 -0
- package/dist/core/run-preflight.js +96 -0
- package/dist/core/run-preflight.js.map +1 -0
- package/dist/core/runtime-credentials.d.ts +18 -2
- package/dist/core/runtime-credentials.d.ts.map +1 -1
- package/dist/core/runtime-credentials.js +65 -9
- package/dist/core/runtime-credentials.js.map +1 -1
- package/dist/core/sdk.d.ts +19 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +115 -20
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +2 -1
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +2 -1
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager.d.ts +15 -4
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +114 -22
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +7 -2
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +12 -5
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +11 -0
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts +3 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +10 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash-jobs.d.ts +109 -0
- package/dist/core/tools/bash-jobs.d.ts.map +1 -0
- package/dist/core/tools/bash-jobs.js +563 -0
- package/dist/core/tools/bash-jobs.js.map +1 -0
- package/dist/core/tools/bash.d.ts +68 -6
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +350 -37
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts +11 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +89 -20
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +15 -7
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-custody.d.ts +29 -0
- package/dist/core/tools/file-mutation-custody.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-custody.js +173 -0
- package/dist/core/tools/file-mutation-custody.js.map +1 -0
- package/dist/core/tools/find.d.ts +6 -0
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +84 -38
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts +8 -2
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +121 -77
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +3 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +12 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/jobs.d.ts +24 -0
- package/dist/core/tools/jobs.d.ts.map +1 -0
- package/dist/core/tools/jobs.js +86 -0
- package/dist/core/tools/jobs.js.map +1 -0
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +2 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +12 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +88 -8
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/output-cleanup.d.ts +40 -0
- package/dist/core/tools/output-cleanup.d.ts.map +1 -0
- package/dist/core/tools/output-cleanup.js +273 -0
- package/dist/core/tools/output-cleanup.js.map +1 -0
- package/dist/core/tools/powershell.d.ts.map +1 -1
- package/dist/core/tools/powershell.js +15 -2
- package/dist/core/tools/powershell.js.map +1 -1
- package/dist/core/tools/read.d.ts +21 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +162 -29
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/renderers/bash.d.ts.map +1 -1
- package/dist/core/tools/renderers/bash.js +3 -1
- package/dist/core/tools/renderers/bash.js.map +1 -1
- package/dist/core/tools/renderers/index.d.ts.map +1 -1
- package/dist/core/tools/renderers/index.js +1 -0
- package/dist/core/tools/renderers/index.js.map +1 -1
- package/dist/core/tools/subagent.d.ts +5 -1
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +76 -19
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/tools/truncate.d.ts +4 -0
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js +24 -1
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +6 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trace/config.js +3 -3
- package/dist/core/trace/config.js.map +1 -1
- package/dist/core/trace/redaction.d.ts.map +1 -1
- package/dist/core/trace/redaction.js +12 -9
- package/dist/core/trace/redaction.js.map +1 -1
- package/dist/core/trace-client/credential-store.d.ts +1 -1
- package/dist/core/trace-client/credential-store.d.ts.map +1 -1
- package/dist/core/trace-client/credential-store.js +20 -3
- package/dist/core/trace-client/credential-store.js.map +1 -1
- package/dist/core/usage-ledger.d.ts +35 -0
- package/dist/core/usage-ledger.d.ts.map +1 -0
- package/dist/core/usage-ledger.js +140 -0
- package/dist/core/usage-ledger.js.map +1 -0
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +24 -15
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/index.d.ts +4 -2
- package/dist/extensions/codemode/index.d.ts.map +1 -1
- package/dist/extensions/codemode/index.js +8 -4
- package/dist/extensions/codemode/index.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +4 -2
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +34 -12
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/llama/client.d.ts +2 -0
- package/dist/extensions/llama/client.d.ts.map +1 -1
- package/dist/extensions/llama/client.js +23 -2
- package/dist/extensions/llama/client.js.map +1 -1
- package/dist/extensions/llama/ui.d.ts.map +1 -1
- package/dist/extensions/llama/ui.js +15 -3
- package/dist/extensions/llama/ui.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +3 -2
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/extensions/tool-search/tool.d.ts.map +1 -1
- package/dist/extensions/tool-search/tool.js +18 -6
- package/dist/extensions/tool-search/tool.js.map +1 -1
- package/dist/extensions/usage/hcode-overview.d.ts +23 -0
- package/dist/extensions/usage/hcode-overview.d.ts.map +1 -0
- package/dist/extensions/usage/hcode-overview.js +109 -0
- package/dist/extensions/usage/hcode-overview.js.map +1 -0
- package/dist/extensions/usage/index.d.ts +5 -0
- package/dist/extensions/usage/index.d.ts.map +1 -1
- package/dist/extensions/usage/index.js +194 -12
- package/dist/extensions/usage/index.js.map +1 -1
- package/dist/extensions/usage/overview.d.ts +5 -0
- package/dist/extensions/usage/overview.d.ts.map +1 -1
- package/dist/extensions/usage/overview.js +21 -1
- package/dist/extensions/usage/overview.js.map +1 -1
- package/dist/extensions/usage/popup.d.ts +14 -3
- package/dist/extensions/usage/popup.d.ts.map +1 -1
- package/dist/extensions/usage/popup.js +199 -25
- package/dist/extensions/usage/popup.js.map +1 -1
- package/dist/humain/adaptive-execution.d.ts +51 -0
- package/dist/humain/adaptive-execution.d.ts.map +1 -0
- package/dist/humain/adaptive-execution.js +100 -0
- package/dist/humain/adaptive-execution.js.map +1 -0
- package/dist/humain/adaptive-peer-process.d.ts +44 -0
- package/dist/humain/adaptive-peer-process.d.ts.map +1 -0
- package/dist/humain/adaptive-peer-process.js +159 -0
- package/dist/humain/adaptive-peer-process.js.map +1 -0
- package/dist/humain/adaptive-peer-worker.d.ts +3 -0
- package/dist/humain/adaptive-peer-worker.d.ts.map +1 -0
- package/dist/humain/adaptive-peer-worker.js +122 -0
- package/dist/humain/adaptive-peer-worker.js.map +1 -0
- package/dist/humain/adaptive-runtime-types.d.ts +621 -0
- package/dist/humain/adaptive-runtime-types.d.ts.map +1 -0
- package/dist/humain/adaptive-runtime-types.js +3 -0
- package/dist/humain/adaptive-runtime-types.js.map +1 -0
- package/dist/humain/adaptive-session-host.d.ts +113 -0
- package/dist/humain/adaptive-session-host.d.ts.map +1 -0
- package/dist/humain/adaptive-session-host.js +1838 -0
- package/dist/humain/adaptive-session-host.js.map +1 -0
- package/dist/humain/adhd/index.d.ts +2 -2
- package/dist/humain/adhd/index.d.ts.map +1 -1
- package/dist/humain/adhd/index.js +22 -13
- package/dist/humain/adhd/index.js.map +1 -1
- package/dist/humain/bedrock-provider/vendor/index.bundle.mjs +162 -49
- package/dist/humain/caveman/index.d.ts +1 -1
- package/dist/humain/caveman/index.d.ts.map +1 -1
- package/dist/humain/caveman/index.js +21 -12
- package/dist/humain/caveman/index.js.map +1 -1
- package/dist/humain/classify-tool.d.ts +4 -0
- package/dist/humain/classify-tool.d.ts.map +1 -0
- package/dist/humain/classify-tool.js +50 -0
- package/dist/humain/classify-tool.js.map +1 -0
- package/dist/humain/flow-command.d.ts +1 -1
- package/dist/humain/flow-command.d.ts.map +1 -1
- package/dist/humain/flow-command.js +21 -3
- package/dist/humain/flow-command.js.map +1 -1
- package/dist/humain/flow-loader.d.ts +15 -10
- package/dist/humain/flow-loader.d.ts.map +1 -1
- package/dist/humain/flow-loader.js +72 -18
- package/dist/humain/flow-loader.js.map +1 -1
- package/dist/humain/fuse-provider.d.ts +5 -0
- package/dist/humain/fuse-provider.d.ts.map +1 -0
- package/dist/humain/fuse-provider.js +302 -0
- package/dist/humain/fuse-provider.js.map +1 -0
- package/dist/humain/gateway/provider.d.ts.map +1 -1
- package/dist/humain/gateway/provider.js +2 -0
- package/dist/humain/gateway/provider.js.map +1 -1
- package/dist/humain/gateway/secret-store.d.ts +3 -7
- package/dist/humain/gateway/secret-store.d.ts.map +1 -1
- package/dist/humain/gateway/secret-store.js +21 -249
- package/dist/humain/gateway/secret-store.js.map +1 -1
- package/dist/humain/hcode/account-store.d.ts +92 -0
- package/dist/humain/hcode/account-store.d.ts.map +1 -0
- package/dist/humain/hcode/account-store.js +720 -0
- package/dist/humain/hcode/account-store.js.map +1 -0
- package/dist/humain/hcode/account.d.ts +42 -0
- package/dist/humain/hcode/account.d.ts.map +1 -0
- package/dist/humain/hcode/account.js +552 -0
- package/dist/humain/hcode/account.js.map +1 -0
- package/dist/humain/hcode/catalog.d.ts +6 -0
- package/dist/humain/hcode/catalog.d.ts.map +1 -0
- package/dist/humain/hcode/catalog.js +47 -0
- package/dist/humain/hcode/catalog.js.map +1 -0
- package/dist/humain/hcode/contracts.d.ts +389 -0
- package/dist/humain/hcode/contracts.d.ts.map +1 -0
- package/dist/humain/hcode/contracts.js +1243 -0
- package/dist/humain/hcode/contracts.js.map +1 -0
- package/dist/humain/hcode/environment.d.ts +9 -0
- package/dist/humain/hcode/environment.d.ts.map +1 -0
- package/dist/humain/hcode/environment.js +24 -0
- package/dist/humain/hcode/environment.js.map +1 -0
- package/dist/humain/hcode/facade.d.ts +54 -0
- package/dist/humain/hcode/facade.d.ts.map +1 -0
- package/dist/humain/hcode/facade.js +326 -0
- package/dist/humain/hcode/facade.js.map +1 -0
- package/dist/humain/hcode/http.d.ts +10 -0
- package/dist/humain/hcode/http.d.ts.map +1 -0
- package/dist/humain/hcode/http.js +119 -0
- package/dist/humain/hcode/http.js.map +1 -0
- package/dist/humain/hcode/notices.d.ts +15 -0
- package/dist/humain/hcode/notices.d.ts.map +1 -0
- package/dist/humain/hcode/notices.js +69 -0
- package/dist/humain/hcode/notices.js.map +1 -0
- package/dist/humain/hcode/ports.d.ts +34 -0
- package/dist/humain/hcode/ports.d.ts.map +1 -0
- package/dist/humain/hcode/ports.js +2 -0
- package/dist/humain/hcode/ports.js.map +1 -0
- package/dist/humain/hcode/provider.d.ts +15 -0
- package/dist/humain/hcode/provider.d.ts.map +1 -0
- package/dist/humain/hcode/provider.js +200 -0
- package/dist/humain/hcode/provider.js.map +1 -0
- package/dist/humain/hcode/selection.d.ts +16 -0
- package/dist/humain/hcode/selection.d.ts.map +1 -0
- package/dist/humain/hcode/selection.js +37 -0
- package/dist/humain/hcode/selection.js.map +1 -0
- package/dist/humain/hcode/transport.d.ts +22 -0
- package/dist/humain/hcode/transport.d.ts.map +1 -0
- package/dist/humain/hcode/transport.js +368 -0
- package/dist/humain/hcode/transport.js.map +1 -0
- package/dist/humain/hcode/usage.d.ts +5 -0
- package/dist/humain/hcode/usage.d.ts.map +1 -0
- package/dist/humain/hcode/usage.js +66 -0
- package/dist/humain/hcode/usage.js.map +1 -0
- package/dist/humain/hcode/wire.d.ts +16 -0
- package/dist/humain/hcode/wire.d.ts.map +1 -0
- package/dist/humain/hcode/wire.js +104 -0
- package/dist/humain/hcode/wire.js.map +1 -0
- package/dist/humain/index.d.ts +1 -3
- package/dist/humain/index.d.ts.map +1 -1
- package/dist/humain/index.js +8 -60
- package/dist/humain/index.js.map +1 -1
- package/dist/humain/login-menu.d.ts.map +1 -1
- package/dist/humain/login-menu.js +8 -1
- package/dist/humain/login-menu.js.map +1 -1
- package/dist/humain/metadata/contracts.d.ts +82 -0
- package/dist/humain/metadata/contracts.d.ts.map +1 -0
- package/dist/humain/metadata/contracts.js +214 -0
- package/dist/humain/metadata/contracts.js.map +1 -0
- package/dist/humain/metadata/identity.d.ts +10 -0
- package/dist/humain/metadata/identity.d.ts.map +1 -0
- package/dist/humain/metadata/identity.js +209 -0
- package/dist/humain/metadata/identity.js.map +1 -0
- package/dist/humain/metadata/index.d.ts +41 -0
- package/dist/humain/metadata/index.d.ts.map +1 -0
- package/dist/humain/metadata/index.js +100 -0
- package/dist/humain/metadata/index.js.map +1 -0
- package/dist/humain/metadata/sender.d.ts +20 -0
- package/dist/humain/metadata/sender.d.ts.map +1 -0
- package/dist/humain/metadata/sender.js +302 -0
- package/dist/humain/metadata/sender.js.map +1 -0
- package/dist/humain/metadata/version.d.ts +8 -0
- package/dist/humain/metadata/version.d.ts.map +1 -0
- package/dist/humain/metadata/version.js +38 -0
- package/dist/humain/metadata/version.js.map +1 -0
- package/dist/humain/node-http.d.ts +2 -0
- package/dist/humain/node-http.d.ts.map +1 -1
- package/dist/humain/node-http.js +9 -4
- package/dist/humain/node-http.js.map +1 -1
- package/dist/humain/node-provider.d.ts +2 -0
- package/dist/humain/node-provider.d.ts.map +1 -1
- package/dist/humain/node-provider.js +39 -8
- package/dist/humain/node-provider.js.map +1 -1
- package/dist/humain/ponytail/vendor/hooks/ponytail-config.d.ts +1 -1
- package/dist/humain/ponytail/vendor/hooks/ponytail-config.d.ts.map +1 -1
- package/dist/humain/ponytail/vendor/hooks/ponytail-config.js +4 -4
- package/dist/humain/ponytail/vendor/hooks/ponytail-config.js.map +1 -1
- package/dist/humain/ponytail/vendor/hooks/ponytail-instructions.d.ts.map +1 -1
- package/dist/humain/ponytail/vendor/hooks/ponytail-instructions.js +7 -0
- package/dist/humain/ponytail/vendor/hooks/ponytail-instructions.js.map +1 -1
- package/dist/humain/ponytail/vendor/pi-extension/index.d.ts.map +1 -1
- package/dist/humain/ponytail/vendor/pi-extension/index.js +12 -1
- package/dist/humain/ponytail/vendor/pi-extension/index.js.map +1 -1
- package/dist/humain/systemone.d.ts +23 -0
- package/dist/humain/systemone.d.ts.map +1 -0
- package/dist/humain/systemone.js +101 -0
- package/dist/humain/systemone.js.map +1 -0
- package/dist/humain/trace-capture/flow-producer.d.ts.map +1 -1
- package/dist/humain/trace-capture/flow-producer.js +3 -3
- package/dist/humain/trace-capture/flow-producer.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +292 -183
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/bug-report.d.ts.map +1 -1
- package/dist/modes/interactive/bug-report.js +82 -36
- package/dist/modes/interactive/bug-report.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +8 -5
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js +11 -5
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +9 -1
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +10 -5
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +55 -29
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +16 -2
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +164 -19
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +3 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +19 -2
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts +17 -0
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +78 -1
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +19 -10
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +353 -65
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.lazy.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.lazy.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.lazy.js +3 -0
- package/dist/modes/interactive/interactive-mode.lazy.js.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts +2 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.js +12 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +2 -3
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +4 -5
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.js +4 -4
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +2 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +8 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts +2 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/print-mode.d.ts +4 -0
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +57 -11
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +68 -16
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +2 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/changelog.d.ts +1 -1
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +7 -5
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +3 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/lazy-validator.d.ts +5 -0
- package/dist/utils/lazy-validator.d.ts.map +1 -0
- package/dist/utils/lazy-validator.js +7 -0
- package/dist/utils/lazy-validator.js.map +1 -0
- package/dist/utils/shell.d.ts +3 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +9 -4
- package/dist/utils/shell.js.map +1 -1
- package/docs/cli.md +23 -5
- package/docs/codemode.md +21 -1
- package/docs/development.md +18 -0
- package/docs/docs.json +4 -0
- package/docs/extensions.md +4 -0
- package/docs/flow.md +115 -16
- package/docs/headless-modes.md +61 -0
- package/docs/humain-code-forge-architecture.md +65 -13
- package/docs/humain-code-forge-component-scorecard.md +10 -1
- package/docs/humain-code-forge-flow-walkthrough.md +54 -55
- package/docs/humain-code.md +22 -19
- package/docs/index.md +1 -0
- package/docs/keybindings.md +1 -1
- package/docs/models-configuration.md +6 -1
- package/docs/models.md +1 -1
- package/docs/prompt-templates.md +1 -1
- package/docs/providers.md +67 -15
- package/docs/run-preflight.md +47 -0
- package/docs/sdk.md +39 -1
- package/docs/security.md +1 -1
- package/docs/settings.md +12 -5
- package/docs/skills.md +2 -0
- package/docs/slash-commands.md +5 -3
- package/docs/usage.md +29 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/tsconfig.json +13 -0
- package/npm-shrinkwrap.json +67 -67
- package/package.json +25 -19
- package/schemas/models.schema.json +30 -0
- package/schemas/settings.schema.json +28 -9
- package/src/humain/caveman/UPSTREAM.md +19 -3
- package/src/humain/caveman/upstream.json +2 -2
- package/src/humain/ponytail/UPSTREAM.md +16 -1
- package/src/humain/web-access/UPSTREAM.md +10 -0
- package/src/humain/web-access/upstream.json +1 -0
- package/dist/bundle/chunks/anthropic-messages-MNISFDZA.js +0 -66
- package/dist/bundle/chunks/chunk-2HZ2V3HS.js +0 -1985
- package/dist/bundle/chunks/chunk-2PZ46FSM.js +0 -6
- package/dist/bundle/chunks/chunk-4SQUP6IR.js +0 -88
- package/dist/bundle/chunks/chunk-5JSLXC2A.js +0 -3
- package/dist/bundle/chunks/chunk-75CQYZ63.js +0 -1336
- package/dist/bundle/chunks/chunk-DCPACGLH.js +0 -12267
- package/dist/bundle/chunks/chunk-FLVBQ6GS.js +0 -24
- package/dist/bundle/chunks/chunk-H7Y4QY7K.js +0 -11
- package/dist/bundle/chunks/chunk-JEAM6N22.js +0 -139
- package/dist/bundle/chunks/chunk-PS2FJ7M4.js +0 -23
- package/dist/bundle/chunks/chunk-TEOMXMW6.js +0 -23
- package/dist/bundle/chunks/chunk-WEFEQEIQ.js +0 -28
- package/dist/bundle/chunks/chunk-WW4SILXG.js +0 -249
- package/dist/bundle/chunks/compat-MXAZPYDN.js +0 -13
- package/dist/bundle/chunks/dist-3V7ZSLER.js +0 -3166
- package/dist/bundle/chunks/dist-66CW64M2.js +0 -8
- package/dist/bundle/chunks/host-SCZ4IKWR.js +0 -2
- package/dist/bundle/chunks/openai-codex-responses-LZWBQYVP.js +0 -101
- package/dist/bundle/chunks/openai-completions-7NWH423P.js +0 -82
- package/dist/bundle/chunks/openai-responses-5YOLHMCF.js +0 -27
- package/dist/bundle/chunks/runtime-UVPDE4CX.js +0 -2
- package/dist/bundle/chunks/typesafe-system-one-BHJYAZ6E.js +0 -3
- package/dist/bundle/chunks/virtual-modules-YQPK57CW.js +0 -23
- package/dist/humain/legacy-workflow-tiers.d.ts +0 -3
- package/dist/humain/legacy-workflow-tiers.d.ts.map +0 -1
- package/dist/humain/legacy-workflow-tiers.js +0 -46
- package/dist/humain/legacy-workflow-tiers.js.map +0 -1
- /package/dist/bundle/{flow → orchestrate}/agents/orch-architect.md +0 -0
- /package/dist/bundle/{flow → orchestrate}/agents/orch-scout.md +0 -0
- /package/dist/bundle/{flow → orchestrate}/agents/orch-security-review.md +0 -0
- /package/dist/bundle/{flow → orchestrate}/agents/orch-technical-lead.md +0 -0
- /package/dist/bundle/{flow → orchestrate}/agents/orch-technical-review.md +0 -0
|
@@ -0,0 +1,720 @@
|
|
|
1
|
+
// Encrypted, generation-fenced native grants. No token is written to generic auth storage.
|
|
2
|
+
import { createCipheriv, createDecipheriv, randomBytes, randomUUID } from "node:crypto";
|
|
3
|
+
import { closeSync, constants, existsSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readdirSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
4
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
6
|
+
import lockfile from "proper-lockfile";
|
|
7
|
+
import { getAgentDir } from "../../config.js";
|
|
8
|
+
import { createOsSecretStore } from "../../core/os-secret-store.js";
|
|
9
|
+
import { assertPrivateWindowsPath } from "../../core/private-windows-path.js";
|
|
10
|
+
import { spawnCommand } from "../../core/trace-client/credential-store.js";
|
|
11
|
+
import { resolveHcodeEnvironment } from "./environment.js";
|
|
12
|
+
import * as wire from "./wire.js";
|
|
13
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
14
|
+
const MAX_GRANT = 1048576;
|
|
15
|
+
const MAX_ENVELOPE = 1400000;
|
|
16
|
+
const STORAGE_ERROR = "HUMAIN Code secure storage failed. Sign in again after checking private storage access.";
|
|
17
|
+
/** Owns encrypted grants and cross-process serialization for one built-in environment. */
|
|
18
|
+
export class HcodeAccountStore {
|
|
19
|
+
dir;
|
|
20
|
+
environment;
|
|
21
|
+
platform;
|
|
22
|
+
runner;
|
|
23
|
+
secrets;
|
|
24
|
+
publication;
|
|
25
|
+
createdDirectories = new Set();
|
|
26
|
+
cleanupIncomplete = false;
|
|
27
|
+
constructor(options = {}) {
|
|
28
|
+
this.environment = resolveHcodeEnvironment(options.environment);
|
|
29
|
+
const agentDir = resolve(options.agentDir ?? getAgentDir());
|
|
30
|
+
// Config is global, never a project-controlled credential destination.
|
|
31
|
+
for (let path = agentDir;; path = dirname(path)) {
|
|
32
|
+
if (existsSync(join(path, ".git")))
|
|
33
|
+
throw new Error(STORAGE_ERROR);
|
|
34
|
+
if (dirname(path) === path)
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
const fromCwd = relative(process.cwd(), agentDir);
|
|
38
|
+
if (!fromCwd || (!fromCwd.startsWith(`..${sep}`) && !isAbsolute(fromCwd)))
|
|
39
|
+
throw new Error(STORAGE_ERROR);
|
|
40
|
+
this.dir = join(agentDir, "hcode", "accounts", this.environment.id);
|
|
41
|
+
this.platform = options.platform ?? process.platform;
|
|
42
|
+
this.runner = options.run ?? spawnCommand;
|
|
43
|
+
this.secrets = options.secrets;
|
|
44
|
+
this.publication = options.publication;
|
|
45
|
+
}
|
|
46
|
+
/** Attaches the owning host's generic store without reading secrets or recovering at construction. */
|
|
47
|
+
configurePublication(publication) {
|
|
48
|
+
this.publication = publication;
|
|
49
|
+
}
|
|
50
|
+
/** Checks only local replacement evidence, without creating files or touching OS secrets. */
|
|
51
|
+
hasPendingReplacement() {
|
|
52
|
+
this.guardParents(false, true);
|
|
53
|
+
return this.read("replacement.json", 16384) !== undefined;
|
|
54
|
+
}
|
|
55
|
+
/** Recovers only an existing replacement; signed-out startup never creates storage or probes keys. */
|
|
56
|
+
async recoverPendingReplacement(signal) {
|
|
57
|
+
signal?.throwIfAborted();
|
|
58
|
+
if (!this.hasPendingReplacement())
|
|
59
|
+
return false;
|
|
60
|
+
await this.locked(async () => { }, "logout", signal);
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
/** Reads only non-secret local metadata. Never creates files, probes a keyring or sends HTTP. */
|
|
64
|
+
status(environmentId) {
|
|
65
|
+
if (environmentId !== this.environment.id)
|
|
66
|
+
return null;
|
|
67
|
+
try {
|
|
68
|
+
this.guardParents(false);
|
|
69
|
+
const state = this.readState();
|
|
70
|
+
const ref = state.current?.reference;
|
|
71
|
+
return ref?.environmentId === environmentId && !this.tombstoned(ref) ? ref : null;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Compares logout's observed generation independently of its durable logout marker. */
|
|
78
|
+
isCurrent(expected) {
|
|
79
|
+
if (expected.environmentId !== this.environment.id)
|
|
80
|
+
return false;
|
|
81
|
+
try {
|
|
82
|
+
this.guardParents(false);
|
|
83
|
+
return sameReference(this.readState().current?.reference, expected);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Checks existing private state and purpose-key availability without creating or recovering account files. */
|
|
90
|
+
async prepare(signal) {
|
|
91
|
+
signal.throwIfAborted();
|
|
92
|
+
this.guardParents(false, true);
|
|
93
|
+
const state = this.readState();
|
|
94
|
+
if (existsSync(this.dir)) {
|
|
95
|
+
for (const name of readdirSync(this.dir)) {
|
|
96
|
+
await this.acl(join(this.dir, name), signal);
|
|
97
|
+
const text = this.read(name, MAX_ENVELOPE);
|
|
98
|
+
if (name.endsWith(".enc") || name.endsWith(".rotation")) {
|
|
99
|
+
const envelope = wire.object(JSON.parse(text), ["version", "keyId", "nonce", "ciphertext", "tag"]);
|
|
100
|
+
wire.literal(envelope.version, 1);
|
|
101
|
+
uuid(envelope.keyId);
|
|
102
|
+
base64(envelope.nonce, 12);
|
|
103
|
+
base64(envelope.tag, 16);
|
|
104
|
+
base64(envelope.ciphertext);
|
|
105
|
+
}
|
|
106
|
+
else if (name === "replacement.json") {
|
|
107
|
+
this.parseReplacement(text);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
for (const path of [dirname(dirname(this.dir)), dirname(this.dir), this.dir])
|
|
112
|
+
if (existsSync(path))
|
|
113
|
+
await this.acl(path, signal);
|
|
114
|
+
await this.keyStore().probe(signal);
|
|
115
|
+
if (state.current && state.rotation === null)
|
|
116
|
+
await this.decrypt(state.current, undefined, signal);
|
|
117
|
+
signal.throwIfAborted();
|
|
118
|
+
}
|
|
119
|
+
/** Recovers durable intent and rotation evidence under the same lock used by every mutation. */
|
|
120
|
+
async recover(signal) {
|
|
121
|
+
await this.locked(async () => { }, "recover", signal);
|
|
122
|
+
}
|
|
123
|
+
/** Creates the purpose key before starting a grant. A failed replacement leaves the old grant intact. */
|
|
124
|
+
async replace(binding, obtain, retire, publish) {
|
|
125
|
+
this.assertEnvironment(binding.environmentId);
|
|
126
|
+
return this.locked(async (state, assertLock) => {
|
|
127
|
+
await this.keyStore().probe();
|
|
128
|
+
const generation = randomUUID();
|
|
129
|
+
state.intents.push(generation);
|
|
130
|
+
this.saveState(state);
|
|
131
|
+
const key = randomBytes(32);
|
|
132
|
+
let journaled = false;
|
|
133
|
+
let obtained;
|
|
134
|
+
const retireBound = async (issued, grant) => {
|
|
135
|
+
if (retire)
|
|
136
|
+
await retire(sameBinding(issued, binding) ? grant : null);
|
|
137
|
+
};
|
|
138
|
+
try {
|
|
139
|
+
await this.keyStore().set(`${this.environment.id}:${generation}`, key.toString("base64"));
|
|
140
|
+
if ((await this.keyStore().get(`${this.environment.id}:${generation}`)) !== key.toString("base64"))
|
|
141
|
+
throw new Error(STORAGE_ERROR);
|
|
142
|
+
const result = await obtain();
|
|
143
|
+
obtained = result.grant;
|
|
144
|
+
const reference = {
|
|
145
|
+
environmentId: wire.string(binding.environmentId),
|
|
146
|
+
accountId: wire.string(result.accountId),
|
|
147
|
+
generation,
|
|
148
|
+
};
|
|
149
|
+
const next = {
|
|
150
|
+
environmentId: binding.environmentId,
|
|
151
|
+
issuer: binding.issuer,
|
|
152
|
+
clientId: binding.clientId,
|
|
153
|
+
reference,
|
|
154
|
+
};
|
|
155
|
+
const old = state.current;
|
|
156
|
+
// Logout of the observed old generation also cancels an in-flight replacement.
|
|
157
|
+
if (old && this.tombstoned(old.reference))
|
|
158
|
+
throw new Error("HUMAIN Code account changed. Sign in again.");
|
|
159
|
+
assertLock();
|
|
160
|
+
this.atomic(`${generation}.enc`, this.encrypt(next, parseGrant(result.grant), key));
|
|
161
|
+
this.atomic("replacement.json", JSON.stringify({ previous: old, candidate: next }));
|
|
162
|
+
journaled = true;
|
|
163
|
+
const published = {
|
|
164
|
+
...state,
|
|
165
|
+
current: next,
|
|
166
|
+
intents: state.intents.filter((id) => id !== generation),
|
|
167
|
+
};
|
|
168
|
+
this.saveState(published);
|
|
169
|
+
// Publication is the decision; its journal survives until retirement also finishes.
|
|
170
|
+
await publish?.(reference);
|
|
171
|
+
Object.assign(state, published);
|
|
172
|
+
try {
|
|
173
|
+
await this.finishReplacement(state, assertLock, undefined, retireBound);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
// Never revoke or roll back a published candidate because later cleanup failed.
|
|
177
|
+
this.cleanupIncomplete = true;
|
|
178
|
+
}
|
|
179
|
+
if (!sameReference(state.current?.reference, reference))
|
|
180
|
+
throw new Error("HUMAIN Code account reference changed. Sign in again.");
|
|
181
|
+
return reference;
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
if (journaled || this.read("replacement.json", 16384) !== undefined) {
|
|
185
|
+
await this.finishReplacement(state, assertLock, undefined, retireBound);
|
|
186
|
+
// A write-then-reject publisher whose CAS compensation failed may still have committed.
|
|
187
|
+
if (state.current?.reference.generation === generation)
|
|
188
|
+
return state.current.reference;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
if (obtained && retire) {
|
|
192
|
+
try {
|
|
193
|
+
await retire(obtained);
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
/* Local cleanup must still run. */
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
await this.cleanup(state);
|
|
200
|
+
}
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
key.fill(0);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
/** Uses a grant only while its captured binding/generation remains current. Refresh never exposes a token getter. */
|
|
209
|
+
async use(expected, binding, send, refresh, signal) {
|
|
210
|
+
this.validateReference(expected);
|
|
211
|
+
this.assertEnvironment(binding.environmentId);
|
|
212
|
+
const dispatched = await this.locked(async (state, assertLock) => {
|
|
213
|
+
const current = this.requireCurrent(state, expected, binding);
|
|
214
|
+
let grant = await this.decrypt(current, undefined, signal);
|
|
215
|
+
signal?.throwIfAborted();
|
|
216
|
+
assertLock();
|
|
217
|
+
if (refresh && grant.expiresAt <= Date.now() + 30000) {
|
|
218
|
+
// Resolve cancellable OS work before consuming the refresh token; completed rotations must remain durable.
|
|
219
|
+
const key = await this.key(current.reference.generation, signal);
|
|
220
|
+
try {
|
|
221
|
+
signal?.throwIfAborted();
|
|
222
|
+
assertLock();
|
|
223
|
+
this.requireCurrent(state, expected, binding);
|
|
224
|
+
state.rotation = expected.generation;
|
|
225
|
+
this.saveState(state);
|
|
226
|
+
// A consumed refresh token is never retried after an ambiguous response or crash.
|
|
227
|
+
grant = parseGrant(await refresh(grant));
|
|
228
|
+
assertLock();
|
|
229
|
+
this.atomic(`${expected.generation}.rotation`, this.encrypt(current, grant, key));
|
|
230
|
+
}
|
|
231
|
+
finally {
|
|
232
|
+
key.fill(0);
|
|
233
|
+
}
|
|
234
|
+
this.requireCurrent(state, expected, binding);
|
|
235
|
+
this.atomic(`${expected.generation}.enc`, this.read(`${expected.generation}.rotation`, MAX_ENVELOPE));
|
|
236
|
+
state.rotation = null;
|
|
237
|
+
this.saveState(state);
|
|
238
|
+
this.removeFile(`${expected.generation}.rotation`);
|
|
239
|
+
}
|
|
240
|
+
signal?.throwIfAborted();
|
|
241
|
+
assertLock();
|
|
242
|
+
this.requireCurrent(state, expected, binding);
|
|
243
|
+
const response = send(grant);
|
|
244
|
+
// Rejection can precede asynchronous lock release; await the response only after release.
|
|
245
|
+
void response.catch(() => { });
|
|
246
|
+
return { response };
|
|
247
|
+
}, "use", signal);
|
|
248
|
+
return dispatched.response;
|
|
249
|
+
}
|
|
250
|
+
/** Persists logout before waiting for a refresh lock; stale logout affects only its observed generation. */
|
|
251
|
+
tombstone(expected) {
|
|
252
|
+
this.validateReference(expected);
|
|
253
|
+
this.guardParents(false);
|
|
254
|
+
// Exclusive empty markers need no temporary file that a concurrent recovery could collect.
|
|
255
|
+
const name = `${expected.generation}.logout`;
|
|
256
|
+
let fd;
|
|
257
|
+
try {
|
|
258
|
+
fd = openSync(join(this.dir, name), constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL, 0o600);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
if (error instanceof Error && "code" in error && error.code === "EEXIST") {
|
|
262
|
+
this.read(name, 64);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
throw new Error(STORAGE_ERROR);
|
|
266
|
+
}
|
|
267
|
+
try {
|
|
268
|
+
fsyncSync(fd);
|
|
269
|
+
}
|
|
270
|
+
finally {
|
|
271
|
+
closeSync(fd);
|
|
272
|
+
}
|
|
273
|
+
this.syncDirectory();
|
|
274
|
+
}
|
|
275
|
+
/** Removes local state offline even when revocation fails. The callback must not retain the grant. */
|
|
276
|
+
async remove(expected, binding, revoke) {
|
|
277
|
+
if (binding)
|
|
278
|
+
this.assertEnvironment(binding.environmentId);
|
|
279
|
+
this.tombstone(expected);
|
|
280
|
+
await this.locked(async (state) => {
|
|
281
|
+
if (sameReference(state.current?.reference, expected)) {
|
|
282
|
+
const current = state.current;
|
|
283
|
+
try {
|
|
284
|
+
const candidate = `${expected.generation}.rotation`;
|
|
285
|
+
if (binding && sameBinding(current, binding))
|
|
286
|
+
await revoke(await this.decrypt(current, state.rotation === expected.generation && this.read(candidate, MAX_ENVELOPE) !== undefined
|
|
287
|
+
? candidate
|
|
288
|
+
: `${expected.generation}.enc`));
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
/* Removal is independent of remote availability. */
|
|
292
|
+
}
|
|
293
|
+
state.current = null;
|
|
294
|
+
state.rotation = null;
|
|
295
|
+
this.saveState(state);
|
|
296
|
+
}
|
|
297
|
+
await this.cleanup(state);
|
|
298
|
+
}, "logout");
|
|
299
|
+
}
|
|
300
|
+
requireCurrent(state, expected, binding) {
|
|
301
|
+
this.validateReference(expected);
|
|
302
|
+
const current = state.current;
|
|
303
|
+
if (!current ||
|
|
304
|
+
!sameReference(current.reference, expected) ||
|
|
305
|
+
!sameBinding(current, binding) ||
|
|
306
|
+
this.tombstoned(expected))
|
|
307
|
+
throw new Error("HUMAIN Code account changed. Sign in again.");
|
|
308
|
+
return current;
|
|
309
|
+
}
|
|
310
|
+
assertEnvironment(environmentId) {
|
|
311
|
+
// Private storage input must never select another environment namespace.
|
|
312
|
+
if (environmentId !== this.environment.id)
|
|
313
|
+
throw new Error("HUMAIN Code account environment changed.");
|
|
314
|
+
}
|
|
315
|
+
validateReference(ref) {
|
|
316
|
+
this.assertEnvironment(ref.environmentId);
|
|
317
|
+
wire.string(ref.environmentId);
|
|
318
|
+
wire.string(ref.accountId);
|
|
319
|
+
uuid(ref.generation);
|
|
320
|
+
}
|
|
321
|
+
tombstoned(ref) {
|
|
322
|
+
return this.read(`${uuid(ref.generation)}.logout`, 64) !== undefined;
|
|
323
|
+
}
|
|
324
|
+
keyStore() {
|
|
325
|
+
this.secrets ??= createOsSecretStore({ service: "humain-code-account-keys", label: "HUMAIN Code account keys" });
|
|
326
|
+
return this.secrets;
|
|
327
|
+
}
|
|
328
|
+
async key(generation, signal) {
|
|
329
|
+
signal?.throwIfAborted();
|
|
330
|
+
const value = await this.keyStore().get(`${this.environment.id}:${uuid(generation)}`, signal);
|
|
331
|
+
signal?.throwIfAborted();
|
|
332
|
+
if (!value || !/^[A-Za-z0-9+/]{43}=$/.test(value))
|
|
333
|
+
throw new Error(STORAGE_ERROR);
|
|
334
|
+
const bytes = Buffer.from(value, "base64");
|
|
335
|
+
if (bytes.length !== 32 || bytes.toString("base64") !== value)
|
|
336
|
+
throw new Error(STORAGE_ERROR);
|
|
337
|
+
return bytes;
|
|
338
|
+
}
|
|
339
|
+
aad(account) {
|
|
340
|
+
return Buffer.from(JSON.stringify([
|
|
341
|
+
1,
|
|
342
|
+
account.environmentId,
|
|
343
|
+
account.issuer,
|
|
344
|
+
account.clientId,
|
|
345
|
+
account.reference.accountId,
|
|
346
|
+
account.reference.generation,
|
|
347
|
+
]));
|
|
348
|
+
}
|
|
349
|
+
encrypt(account, grant, key) {
|
|
350
|
+
const nonce = randomBytes(12);
|
|
351
|
+
const cipher = createCipheriv("aes-256-gcm", key, nonce);
|
|
352
|
+
cipher.setAAD(this.aad(account));
|
|
353
|
+
const ciphertext = Buffer.concat([cipher.update(JSON.stringify(grant)), cipher.final()]);
|
|
354
|
+
return JSON.stringify({
|
|
355
|
+
version: 1,
|
|
356
|
+
keyId: account.reference.generation,
|
|
357
|
+
nonce: nonce.toString("base64"),
|
|
358
|
+
ciphertext: ciphertext.toString("base64"),
|
|
359
|
+
tag: cipher.getAuthTag().toString("base64"),
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
async decrypt(account, file = `${account.reference.generation}.enc`, signal) {
|
|
363
|
+
try {
|
|
364
|
+
const envelope = wire.object(JSON.parse(this.read(file, MAX_ENVELOPE) ?? "null"), [
|
|
365
|
+
"version",
|
|
366
|
+
"keyId",
|
|
367
|
+
"nonce",
|
|
368
|
+
"ciphertext",
|
|
369
|
+
"tag",
|
|
370
|
+
]);
|
|
371
|
+
wire.literal(envelope.version, 1);
|
|
372
|
+
wire.literal(envelope.keyId, account.reference.generation);
|
|
373
|
+
const nonce = base64(envelope.nonce, 12), tag = base64(envelope.tag, 16), ciphertext = base64(envelope.ciphertext);
|
|
374
|
+
const key = await this.key(account.reference.generation, signal);
|
|
375
|
+
try {
|
|
376
|
+
const decipher = createDecipheriv("aes-256-gcm", key, nonce);
|
|
377
|
+
decipher.setAAD(this.aad(account));
|
|
378
|
+
decipher.setAuthTag(tag);
|
|
379
|
+
return parseGrant(JSON.parse(Buffer.concat([decipher.update(ciphertext), decipher.final()]).toString("utf8")));
|
|
380
|
+
}
|
|
381
|
+
finally {
|
|
382
|
+
key.fill(0);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
catch {
|
|
386
|
+
signal?.throwIfAborted();
|
|
387
|
+
throw new Error(STORAGE_ERROR);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
readState() {
|
|
391
|
+
const text = this.read("state.json", 16384);
|
|
392
|
+
if (text === undefined)
|
|
393
|
+
return { version: 1, current: null, intents: [], rotation: null };
|
|
394
|
+
const v = wire.object(JSON.parse(text), ["version", "current", "intents", "rotation"]);
|
|
395
|
+
const current = v.current === null ? null : this.parseStored(v.current);
|
|
396
|
+
return {
|
|
397
|
+
version: wire.literal(v.version, 1),
|
|
398
|
+
current,
|
|
399
|
+
intents: wire.array(v.intents, uuid, 16),
|
|
400
|
+
rotation: v.rotation === null ? null : uuid(v.rotation),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
parseStored(value) {
|
|
404
|
+
const account = parseStored(value);
|
|
405
|
+
this.assertEnvironment(account.environmentId);
|
|
406
|
+
return account;
|
|
407
|
+
}
|
|
408
|
+
saveState(state) {
|
|
409
|
+
this.atomic("state.json", JSON.stringify(state));
|
|
410
|
+
}
|
|
411
|
+
async locked(operation, intent = "use", signal) {
|
|
412
|
+
signal?.throwIfAborted();
|
|
413
|
+
this.guardParents(true);
|
|
414
|
+
for (const path of [dirname(dirname(this.dir)), dirname(this.dir), this.dir])
|
|
415
|
+
await this.acl(path, signal);
|
|
416
|
+
for (const name of readdirSync(this.dir))
|
|
417
|
+
await this.acl(join(this.dir, name), signal);
|
|
418
|
+
let compromised = false;
|
|
419
|
+
let release;
|
|
420
|
+
for (let attempt = 0;; attempt++) {
|
|
421
|
+
signal?.throwIfAborted();
|
|
422
|
+
try {
|
|
423
|
+
release = await lockfile.lock(this.dir, {
|
|
424
|
+
realpath: true,
|
|
425
|
+
// proper-lockfile's internal retry timers have no cancellation API.
|
|
426
|
+
retries: signal ? 0 : { retries: 100, minTimeout: 20, maxTimeout: 100 },
|
|
427
|
+
onCompromised: () => {
|
|
428
|
+
compromised = true;
|
|
429
|
+
},
|
|
430
|
+
});
|
|
431
|
+
break;
|
|
432
|
+
}
|
|
433
|
+
catch (error) {
|
|
434
|
+
signal?.throwIfAborted();
|
|
435
|
+
if (!signal || attempt >= 100)
|
|
436
|
+
throw error;
|
|
437
|
+
await delay(Math.min(20 * 2 ** attempt, 100), undefined, { signal });
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
const assertLock = () => {
|
|
441
|
+
if (compromised)
|
|
442
|
+
throw new Error(STORAGE_ERROR);
|
|
443
|
+
this.guardParents(false);
|
|
444
|
+
};
|
|
445
|
+
try {
|
|
446
|
+
signal?.throwIfAborted();
|
|
447
|
+
assertLock();
|
|
448
|
+
const state = this.readState();
|
|
449
|
+
await this.finishReplacement(state, assertLock, signal);
|
|
450
|
+
// Normal readers must leave revocable material for serialized logout, not perform crash collection.
|
|
451
|
+
if (intent === "use" && state.current && this.tombstoned(state.current.reference))
|
|
452
|
+
throw new Error("HUMAIN Code account changed. Sign in again.");
|
|
453
|
+
if (state.rotation && !(intent === "logout" && state.current && this.tombstoned(state.current.reference))) {
|
|
454
|
+
const current = state.current;
|
|
455
|
+
if (current &&
|
|
456
|
+
current.reference.generation === state.rotation &&
|
|
457
|
+
!this.tombstoned(current.reference) &&
|
|
458
|
+
this.read(`${state.rotation}.rotation`, MAX_ENVELOPE)) {
|
|
459
|
+
await this.decrypt(current, `${state.rotation}.rotation`, signal);
|
|
460
|
+
assertLock();
|
|
461
|
+
this.atomic(`${state.rotation}.enc`, this.read(`${state.rotation}.rotation`, MAX_ENVELOPE));
|
|
462
|
+
}
|
|
463
|
+
else if (current?.reference.generation === state.rotation)
|
|
464
|
+
state.current = null;
|
|
465
|
+
state.rotation = null;
|
|
466
|
+
this.saveState(state);
|
|
467
|
+
}
|
|
468
|
+
if (intent === "recover" && state.current && this.tombstoned(state.current.reference)) {
|
|
469
|
+
state.current = null;
|
|
470
|
+
state.rotation = null;
|
|
471
|
+
this.saveState(state);
|
|
472
|
+
}
|
|
473
|
+
await this.cleanup(state, signal);
|
|
474
|
+
signal?.throwIfAborted();
|
|
475
|
+
assertLock();
|
|
476
|
+
return await operation(state, assertLock);
|
|
477
|
+
}
|
|
478
|
+
finally {
|
|
479
|
+
await release();
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
parseReplacement(text) {
|
|
483
|
+
const journal = wire.object(JSON.parse(text), ["previous", "candidate"]);
|
|
484
|
+
const previous = journal.previous === null ? null : this.parseStored(journal.previous);
|
|
485
|
+
const candidate = this.parseStored(journal.candidate);
|
|
486
|
+
// Private journal input cannot retire the same generation it selects as survivor.
|
|
487
|
+
if (previous?.reference.generation === candidate.reference.generation)
|
|
488
|
+
return wire.invalid();
|
|
489
|
+
return { previous, candidate };
|
|
490
|
+
}
|
|
491
|
+
async finishReplacement(state, assertLock, signal, retire = this.publication?.retire) {
|
|
492
|
+
const text = this.read("replacement.json", 16384);
|
|
493
|
+
if (text === undefined)
|
|
494
|
+
return;
|
|
495
|
+
const { previous, candidate } = this.parseReplacement(text);
|
|
496
|
+
const published = this.publication ? await this.publication.read(signal) : (state.current?.reference ?? null);
|
|
497
|
+
signal?.throwIfAborted();
|
|
498
|
+
assertLock();
|
|
499
|
+
const forward = sameReference(published, candidate.reference);
|
|
500
|
+
let current = forward ? candidate : previous;
|
|
501
|
+
if (!forward &&
|
|
502
|
+
current &&
|
|
503
|
+
(this.read(`${current.reference.generation}.enc`, MAX_ENVELOPE) === undefined ||
|
|
504
|
+
(await this.keyStore().get(`${this.environment.id}:${current.reference.generation}`, signal)) === undefined)) {
|
|
505
|
+
current = null;
|
|
506
|
+
}
|
|
507
|
+
state.current = current;
|
|
508
|
+
state.rotation = null;
|
|
509
|
+
this.saveState(state);
|
|
510
|
+
if (!forward && previous !== null && current === null)
|
|
511
|
+
await this.publication?.clear(published, signal);
|
|
512
|
+
const discarded = forward ? previous : candidate;
|
|
513
|
+
if (discarded && retire) {
|
|
514
|
+
try {
|
|
515
|
+
await retire(discarded, await this.decrypt(discarded, undefined, signal));
|
|
516
|
+
}
|
|
517
|
+
catch {
|
|
518
|
+
/* Missing retired material or unavailable revocation must not prevent local cleanup. */
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
signal?.throwIfAborted();
|
|
522
|
+
assertLock();
|
|
523
|
+
await this.cleanup(state, signal);
|
|
524
|
+
assertLock();
|
|
525
|
+
this.removeFile("replacement.json");
|
|
526
|
+
}
|
|
527
|
+
async cleanup(state, signal) {
|
|
528
|
+
signal?.throwIfAborted();
|
|
529
|
+
const current = state.current?.reference.generation;
|
|
530
|
+
const orphans = new Set(state.intents.filter((id) => id !== current));
|
|
531
|
+
for (const file of readdirSync(this.dir)) {
|
|
532
|
+
const match = /^([0-9a-f-]+)\.(enc|rotation|logout)$/.exec(file);
|
|
533
|
+
if (match && UUID.test(match[1]) && match[1] !== current)
|
|
534
|
+
orphans.add(match[1]);
|
|
535
|
+
if (/^[0-9a-f-]+\.tmp$/.test(file))
|
|
536
|
+
this.removeFile(file);
|
|
537
|
+
}
|
|
538
|
+
for (const id of orphans) {
|
|
539
|
+
await this.keyStore().delete(`${this.environment.id}:${id}`, signal);
|
|
540
|
+
signal?.throwIfAborted();
|
|
541
|
+
for (const suffix of ["enc", "rotation", "logout"])
|
|
542
|
+
this.removeFile(`${id}.${suffix}`);
|
|
543
|
+
}
|
|
544
|
+
if (state.intents.length) {
|
|
545
|
+
state.intents = [];
|
|
546
|
+
this.saveState(state);
|
|
547
|
+
}
|
|
548
|
+
if (current && state.rotation === null)
|
|
549
|
+
this.removeFile(`${current}.rotation`);
|
|
550
|
+
}
|
|
551
|
+
guardParents(create, allowMissing = false) {
|
|
552
|
+
const paths = [];
|
|
553
|
+
for (let path = this.dir;; path = dirname(path)) {
|
|
554
|
+
paths.unshift(path);
|
|
555
|
+
if (dirname(path) === path)
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
for (const path of paths) {
|
|
559
|
+
if (!existsSync(path) && allowMissing) {
|
|
560
|
+
try {
|
|
561
|
+
lstatSync(path);
|
|
562
|
+
}
|
|
563
|
+
catch (error) {
|
|
564
|
+
if (isMissing(error))
|
|
565
|
+
return;
|
|
566
|
+
throw new Error(STORAGE_ERROR);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
if (!existsSync(path) && create) {
|
|
570
|
+
mkdirSync(path, { mode: 0o700 });
|
|
571
|
+
this.syncDirectory(dirname(path));
|
|
572
|
+
this.createdDirectories.add(path);
|
|
573
|
+
}
|
|
574
|
+
let stat;
|
|
575
|
+
try {
|
|
576
|
+
stat = lstatSync(path);
|
|
577
|
+
}
|
|
578
|
+
catch {
|
|
579
|
+
throw new Error(STORAGE_ERROR);
|
|
580
|
+
}
|
|
581
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
582
|
+
throw new Error(STORAGE_ERROR);
|
|
583
|
+
if ((path === this.dir || path === dirname(this.dir) || path === dirname(dirname(this.dir))) &&
|
|
584
|
+
this.platform !== "win32" &&
|
|
585
|
+
((stat.mode & 0o777) !== 0o700 || stat.uid !== process.getuid?.()))
|
|
586
|
+
throw new Error(STORAGE_ERROR);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
read(name, max) {
|
|
590
|
+
const path = join(this.dir, name);
|
|
591
|
+
try {
|
|
592
|
+
if (lstatSync(path).isSymbolicLink())
|
|
593
|
+
throw new Error(STORAGE_ERROR);
|
|
594
|
+
}
|
|
595
|
+
catch (error) {
|
|
596
|
+
if (isMissing(error))
|
|
597
|
+
return undefined;
|
|
598
|
+
throw new Error(STORAGE_ERROR);
|
|
599
|
+
}
|
|
600
|
+
let fd;
|
|
601
|
+
try {
|
|
602
|
+
fd = openSync(join(this.dir, name), constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
603
|
+
}
|
|
604
|
+
catch (error) {
|
|
605
|
+
if (isMissing(error))
|
|
606
|
+
return undefined;
|
|
607
|
+
throw new Error(STORAGE_ERROR);
|
|
608
|
+
}
|
|
609
|
+
try {
|
|
610
|
+
const stat = fstatSync(fd);
|
|
611
|
+
if (!stat.isFile() ||
|
|
612
|
+
stat.nlink !== 1 ||
|
|
613
|
+
stat.size > max ||
|
|
614
|
+
(this.platform !== "win32" && ((stat.mode & 0o777) !== 0o600 || stat.uid !== process.getuid?.())))
|
|
615
|
+
throw new Error(STORAGE_ERROR);
|
|
616
|
+
return readFileSync(fd, "utf8");
|
|
617
|
+
}
|
|
618
|
+
finally {
|
|
619
|
+
closeSync(fd);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
atomic(name, text) {
|
|
623
|
+
this.guardParents(false);
|
|
624
|
+
// Validate an existing destination rather than following or replacing a hostile link.
|
|
625
|
+
this.read(name, MAX_ENVELOPE);
|
|
626
|
+
const temp = join(this.dir, `${randomUUID()}.tmp`);
|
|
627
|
+
const fd = openSync(temp, constants.O_WRONLY | constants.O_CREAT | constants.O_EXCL, 0o600);
|
|
628
|
+
try {
|
|
629
|
+
writeFileSync(fd, text);
|
|
630
|
+
fsyncSync(fd);
|
|
631
|
+
}
|
|
632
|
+
finally {
|
|
633
|
+
closeSync(fd);
|
|
634
|
+
}
|
|
635
|
+
renameSync(temp, join(this.dir, name));
|
|
636
|
+
this.syncDirectory();
|
|
637
|
+
}
|
|
638
|
+
removeFile(name) {
|
|
639
|
+
this.read(name, MAX_ENVELOPE);
|
|
640
|
+
try {
|
|
641
|
+
unlinkSync(join(this.dir, name));
|
|
642
|
+
}
|
|
643
|
+
catch (error) {
|
|
644
|
+
if (!isMissing(error))
|
|
645
|
+
throw new Error(STORAGE_ERROR);
|
|
646
|
+
}
|
|
647
|
+
this.syncDirectory();
|
|
648
|
+
}
|
|
649
|
+
syncDirectory(path = this.dir) {
|
|
650
|
+
if (this.platform === "win32")
|
|
651
|
+
return;
|
|
652
|
+
const fd = openSync(path, constants.O_RDONLY);
|
|
653
|
+
try {
|
|
654
|
+
fsyncSync(fd);
|
|
655
|
+
}
|
|
656
|
+
finally {
|
|
657
|
+
closeSync(fd);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
async acl(path, signal) {
|
|
661
|
+
signal?.throwIfAborted();
|
|
662
|
+
if (this.platform !== "win32")
|
|
663
|
+
return;
|
|
664
|
+
// Windows filesystem input: protected DACL, owner and every allow ACE must be this user only.
|
|
665
|
+
try {
|
|
666
|
+
await assertPrivateWindowsPath(path, this.createdDirectories.has(path) ? "create" : "verify", this.runner, signal);
|
|
667
|
+
this.createdDirectories.delete(path);
|
|
668
|
+
}
|
|
669
|
+
catch {
|
|
670
|
+
signal?.throwIfAborted();
|
|
671
|
+
throw new Error(STORAGE_ERROR);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
/** Compares non-secret references without adopting another environment, account or generation. */
|
|
676
|
+
export function sameReference(a, b) {
|
|
677
|
+
return (!!a && !!b && a.environmentId === b.environmentId && a.accountId === b.accountId && a.generation === b.generation);
|
|
678
|
+
}
|
|
679
|
+
function sameBinding(a, b) {
|
|
680
|
+
return a.environmentId === b.environmentId && a.issuer === b.issuer && a.clientId === b.clientId;
|
|
681
|
+
}
|
|
682
|
+
function uuid(value) {
|
|
683
|
+
const text = wire.string(value, 36);
|
|
684
|
+
if (!UUID.test(text))
|
|
685
|
+
return wire.invalid();
|
|
686
|
+
return text;
|
|
687
|
+
}
|
|
688
|
+
function base64(value, size) {
|
|
689
|
+
const text = wire.string(value, MAX_ENVELOPE);
|
|
690
|
+
const bytes = Buffer.from(text, "base64");
|
|
691
|
+
if (bytes.toString("base64") !== text || (size !== undefined && bytes.length !== size) || bytes.length > MAX_GRANT)
|
|
692
|
+
return wire.invalid();
|
|
693
|
+
return bytes;
|
|
694
|
+
}
|
|
695
|
+
function parseStored(value) {
|
|
696
|
+
const v = wire.object(value, ["environmentId", "issuer", "clientId", "reference"]), ref = wire.object(v.reference, ["environmentId", "accountId", "generation"]);
|
|
697
|
+
const environmentId = wire.string(v.environmentId);
|
|
698
|
+
if (ref.environmentId !== environmentId)
|
|
699
|
+
return wire.invalid();
|
|
700
|
+
return {
|
|
701
|
+
environmentId,
|
|
702
|
+
issuer: wire.https(v.issuer),
|
|
703
|
+
clientId: wire.string(v.clientId),
|
|
704
|
+
reference: { environmentId, accountId: wire.string(ref.accountId), generation: uuid(ref.generation) },
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
/** Validates untrusted token data before encryption or private send. */
|
|
708
|
+
export function parseGrant(value) {
|
|
709
|
+
if (wire.jsonBytes(value) > MAX_GRANT)
|
|
710
|
+
return wire.invalid();
|
|
711
|
+
const v = wire.object(value, ["accessToken", "refreshToken", "expiresAt"]);
|
|
712
|
+
const accessToken = wire.string(v.accessToken, MAX_GRANT), refreshToken = wire.string(v.refreshToken, MAX_GRANT);
|
|
713
|
+
if (/[^\x21-\x7e]/.test(accessToken) || /[\p{Cc}]/u.test(refreshToken))
|
|
714
|
+
return wire.invalid();
|
|
715
|
+
return { accessToken, refreshToken, expiresAt: wire.integer(v.expiresAt) };
|
|
716
|
+
}
|
|
717
|
+
function isMissing(error) {
|
|
718
|
+
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
719
|
+
}
|
|
720
|
+
//# sourceMappingURL=account-store.js.map
|