@opengeni/contracts 3.1.0-canary.2 → 3.1.2
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/agent-authored-durable-text.d.ts +9 -9
- package/dist/agent-config.d.ts +971 -0
- package/dist/agent-instruction-changes.d.ts +0 -2
- package/dist/allowance-refusal.d.ts +9 -0
- package/dist/allowance-refusal.js +50 -0
- package/dist/allowance-refusal.js.map +1 -0
- package/dist/analytics-consent-report.d.ts +19 -0
- package/dist/analytics-consent-report.js +10 -0
- package/dist/analytics-consent-report.js.map +1 -0
- package/dist/api-key-presets.d.ts +19 -0
- package/dist/artifact-catalog.d.ts +188 -0
- package/dist/artifacts.d.ts +86 -0
- package/dist/atlassian-native-retirement.d.ts +16 -0
- package/dist/atlassian-native-retirement.js +30 -0
- package/dist/atlassian-native-retirement.js.map +1 -0
- package/dist/atlassian.d.ts +1 -0
- package/dist/atlassian.js +34 -19
- package/dist/browser-storage.d.ts +5 -0
- package/dist/browser-storage.js +9 -0
- package/dist/browser-storage.js.map +1 -0
- package/dist/bundled-skills.d.ts +24 -1
- package/dist/canonical-human-identities.js +2 -1
- package/dist/chunk-2ZIHHL72.js +153 -0
- package/dist/chunk-2ZIHHL72.js.map +1 -0
- package/dist/{chunk-5LYFSZ7O.js → chunk-352X6ENP.js} +31 -31
- package/dist/chunk-4JGHSSB7.js +11 -0
- package/dist/chunk-4JGHSSB7.js.map +1 -0
- package/dist/chunk-4QO6GJUX.js +85 -0
- package/dist/chunk-4QO6GJUX.js.map +1 -0
- package/dist/chunk-4VDMHLLL.js +49 -0
- package/dist/chunk-4VDMHLLL.js.map +1 -0
- package/dist/chunk-56SNIMDO.js +9 -0
- package/dist/chunk-56SNIMDO.js.map +1 -0
- package/dist/chunk-6C2HKFTU.js +207 -0
- package/dist/chunk-6C2HKFTU.js.map +1 -0
- package/dist/chunk-6IXO76Z6.js +72 -0
- package/dist/chunk-6IXO76Z6.js.map +1 -0
- package/dist/chunk-7272KVWZ.js +60 -0
- package/dist/chunk-7272KVWZ.js.map +1 -0
- package/dist/{chunk-7ABONTXE.js → chunk-E3GGUBHS.js} +49 -5
- package/dist/chunk-E3GGUBHS.js.map +1 -0
- package/dist/chunk-EFZYKUE2.js +767 -0
- package/dist/chunk-EFZYKUE2.js.map +1 -0
- package/dist/chunk-EKWNTOG3.js +154 -0
- package/dist/chunk-EKWNTOG3.js.map +1 -0
- package/dist/chunk-HABQ7ADB.js +234 -0
- package/dist/chunk-HABQ7ADB.js.map +1 -0
- package/dist/chunk-HRRU4QPI.js +91 -0
- package/dist/chunk-HRRU4QPI.js.map +1 -0
- package/dist/{chunk-3SIZGL3O.js → chunk-IK36LXKC.js} +18 -2
- package/dist/chunk-IK36LXKC.js.map +1 -0
- package/dist/{chunk-TXTQIYCV.js → chunk-ILJ72KPO.js} +56 -3
- package/dist/chunk-ILJ72KPO.js.map +1 -0
- package/dist/chunk-J4HQ3UKY.js +93 -0
- package/dist/chunk-J4HQ3UKY.js.map +1 -0
- package/dist/chunk-KHHZTBP7.js +11 -0
- package/dist/chunk-KHHZTBP7.js.map +1 -0
- package/dist/{chunk-WYBDERIY.js → chunk-LZ2LAHIX.js} +47 -41
- package/dist/chunk-LZ2LAHIX.js.map +1 -0
- package/dist/chunk-NDZHPTCL.js +400 -0
- package/dist/chunk-NDZHPTCL.js.map +1 -0
- package/dist/chunk-OF6OKOBF.js +54793 -0
- package/dist/chunk-OF6OKOBF.js.map +1 -0
- package/dist/chunk-OL23ARTF.js +94 -0
- package/dist/chunk-OL23ARTF.js.map +1 -0
- package/dist/chunk-PUIUXIOL.js +189 -0
- package/dist/chunk-PUIUXIOL.js.map +1 -0
- package/dist/{chunk-Y3KNXVTD.js → chunk-RMWXDZEO.js} +128 -21
- package/dist/chunk-RMWXDZEO.js.map +1 -0
- package/dist/{chunk-MRWYRAS5.js → chunk-SHO4YO4B.js} +27 -35
- package/dist/chunk-SHO4YO4B.js.map +1 -0
- package/dist/chunk-SWRN2DJ3.js +153 -0
- package/dist/chunk-SWRN2DJ3.js.map +1 -0
- package/dist/chunk-TCXCRBPF.js +267 -0
- package/dist/chunk-TCXCRBPF.js.map +1 -0
- package/dist/chunk-TLU3UEMD.js +324 -0
- package/dist/chunk-TLU3UEMD.js.map +1 -0
- package/dist/chunk-TSWWZMUS.js +186 -0
- package/dist/chunk-TSWWZMUS.js.map +1 -0
- package/dist/{chunk-PX3VCKAU.js → chunk-WVCFSOUZ.js} +1 -1
- package/dist/{chunk-PX3VCKAU.js.map → chunk-WVCFSOUZ.js.map} +1 -1
- package/dist/chunk-XDLAGX66.js +127 -0
- package/dist/chunk-XDLAGX66.js.map +1 -0
- package/dist/chunk-YKZ4WU4P.js +33 -0
- package/dist/chunk-YKZ4WU4P.js.map +1 -0
- package/dist/{chunk-O5LEQHDM.js → chunk-Z7WEVGCL.js} +3 -3
- package/dist/{chunk-YBW5JSA3.js → chunk-ZDCRWCGZ.js} +119 -101
- package/dist/chunk-ZDCRWCGZ.js.map +1 -0
- package/dist/claude-provider-account-authority.d.ts +18 -0
- package/dist/claude-subscription-oauth.d.ts +42 -0
- package/dist/claude-subscription-usage.d.ts +159 -0
- package/dist/client-error-report.d.ts +158 -0
- package/dist/client-error-report.js +164 -0
- package/dist/client-error-report.js.map +1 -0
- package/dist/code-search.d.ts +52 -0
- package/dist/code-search.js +40 -0
- package/dist/code-search.js.map +1 -0
- package/dist/codex-provider-account-authority.js +20 -12
- package/dist/codex-provider-account-authority.js.map +1 -1
- package/dist/company-profile.d.ts +144 -6
- package/dist/connect.d.ts +37 -0
- package/dist/connect.js +216 -159
- package/dist/connect.js.map +1 -1
- package/dist/connection-account-label.d.ts +2 -0
- package/dist/connection-account-label.js +35 -0
- package/dist/connection-account-label.js.map +1 -0
- package/dist/connection-authority.d.ts +9 -317
- package/dist/connection-authority.js +37 -42
- package/dist/connector-attachments.js +2 -1
- package/dist/connector-destinations.js +2 -1
- package/dist/connector-tool-permissions.d.ts +137 -0
- package/dist/cua-desktop-tools.d.ts +17 -0
- package/dist/define-schema.d.ts +8 -0
- package/dist/direct-model-provider.d.ts +36 -0
- package/dist/editable-artifact-codec-registry.js +5 -5
- package/dist/editable-artifact-committed-transaction.js +3 -2
- package/dist/editable-artifact-live.js +5 -5
- package/dist/editable-artifact-serialized-commit.js +6 -6
- package/dist/editable-artifact-versions.d.ts +7 -1
- package/dist/editable-artifact-versions.js +1 -1
- package/dist/editable-artifacts.js +62 -56
- package/dist/event-preview.d.ts +22 -0
- package/dist/external-identities.d.ts +138 -0
- package/dist/external-identities.js +9 -4
- package/dist/first-party-tool-authorization.d.ts +815 -0
- package/dist/github-repository-contracts.js +60 -43
- package/dist/github-repository-contracts.js.map +1 -1
- package/dist/google-drive.d.ts +2 -1
- package/dist/google-drive.js +305 -238
- package/dist/google-drive.js.map +1 -1
- package/dist/host-mcp-bindings.d.ts +5 -0
- package/dist/host-mcp-bindings.js +233 -170
- package/dist/host-mcp-bindings.js.map +1 -1
- package/dist/image-generation.d.ts +1 -0
- package/dist/index.d.ts +16761 -5946
- package/dist/index.js +1973 -260
- package/dist/insights-usage.d.ts +877 -0
- package/dist/insights-usage.js +559 -0
- package/dist/insights-usage.js.map +1 -0
- package/dist/interaction.d.ts +1176 -829
- package/dist/knowledge-entries.d.ts +81 -2
- package/dist/knowledge-preparation.d.ts +239 -0
- package/dist/managed-auth-session-sets.d.ts +7 -0
- package/dist/managed-auth-session-sets.js +198 -132
- package/dist/managed-auth-session-sets.js.map +1 -1
- package/dist/managed-sign-in-methods.d.ts +56 -0
- package/dist/managed-sign-in-methods.js +64 -0
- package/dist/managed-sign-in-methods.js.map +1 -0
- package/dist/mcp-catalog-limits.d.ts +2 -0
- package/dist/mcp-oauth.d.ts +2 -2
- package/dist/mcp-structured-content.d.ts +25 -0
- package/dist/modal-native-proof-v2.d.ts +587 -0
- package/dist/modal-native-proof-v2.js +38 -0
- package/dist/modal-native-proof-v2.js.map +1 -0
- package/dist/model-account-choice.d.ts +235 -0
- package/dist/model-account-settings.d.ts +422 -0
- package/dist/model-availability.d.ts +15 -0
- package/dist/model-connection-access.d.ts +13 -0
- package/dist/model-context-inspector.d.ts +98 -0
- package/dist/model-display.d.ts +43 -0
- package/dist/model-display.js +17 -0
- package/dist/model-display.js.map +1 -0
- package/dist/model-picker-order.d.ts +3 -1
- package/dist/model-picker-order.js +3 -0
- package/dist/model-picker-order.js.map +1 -1
- package/dist/organization-access.d.ts +412 -0
- package/dist/organization-access.js +39 -0
- package/dist/organization-access.js.map +1 -0
- package/dist/organization-integration-policy.d.ts +27 -0
- package/dist/organization-membership-lifecycle.d.ts +38 -0
- package/dist/organization-model-usage.d.ts +146 -0
- package/dist/organization-model-usage.js +78 -0
- package/dist/organization-model-usage.js.map +1 -0
- package/dist/organization-recovery.js +2 -1
- package/dist/organization-usage.d.ts +138 -0
- package/dist/permissions.d.ts +18 -0
- package/dist/personal-github.d.ts +1 -0
- package/dist/personal-github.js +199 -144
- package/dist/personal-github.js.map +1 -1
- package/dist/prepared-mcp-setup.d.ts +54 -0
- package/dist/prepared-mcp-setup.js +12 -0
- package/dist/prepared-mcp-setup.js.map +1 -0
- package/dist/product-analytics.d.ts +116 -0
- package/dist/product-lifecycle-facts.d.ts +73 -0
- package/dist/remember.d.ts +98 -6
- package/dist/retained-output.d.ts +8 -0
- package/dist/sandbox-file-artifacts.d.ts +1 -0
- package/dist/sandbox-provider-command.d.ts +91 -1
- package/dist/sandbox-recovery.d.ts +146 -0
- package/dist/secret-generator.d.ts +44 -0
- package/dist/secret-references.d.ts +90 -0
- package/dist/secret-resolution.d.ts +111 -0
- package/dist/secret-totp.d.ts +41 -0
- package/dist/session-final-reply.d.ts +6 -0
- package/dist/session-final-reply.js +9 -0
- package/dist/session-final-reply.js.map +1 -0
- package/dist/session-goal-reports.d.ts +21 -0
- package/dist/session-history-import.d.ts +1272 -0
- package/dist/session-list-entries.d.ts +4 -0
- package/dist/session-list-entries.js +56 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-mcp-projections.d.ts +6 -0
- package/dist/session-mcp-tool-permissions.d.ts +62 -0
- package/dist/session-message-search.d.ts +68 -0
- package/dist/session-target.d.ts +18 -0
- package/dist/session-titles.d.ts +8 -0
- package/dist/session-titles.js +5 -1
- package/dist/session-usage-limit-refusal.d.ts +34 -0
- package/dist/session-usage-limit-refusal.js +15 -0
- package/dist/session-usage-limit-refusal.js.map +1 -0
- package/dist/session-usage-limits.d.ts +127 -0
- package/dist/session-usage-limits.js +41 -0
- package/dist/session-usage-limits.js.map +1 -0
- package/dist/signup-attribution.d.ts +39 -0
- package/dist/site-data.d.ts +286 -0
- package/dist/site-operations.d.ts +39 -0
- package/dist/site-publishing.d.ts +778 -0
- package/dist/site-session-http.d.ts +89 -4
- package/dist/site-session-http.js +25 -1
- package/dist/site-sql.d.ts +421 -0
- package/dist/skill-catalog-context.d.ts +7 -0
- package/dist/skill-files.d.ts +1 -1
- package/dist/skill-use.d.ts +61 -0
- package/dist/skills.d.ts +15 -0
- package/dist/slack-bot-scopes.d.ts +17 -12
- package/dist/slack-bot-scopes.js +10 -3
- package/dist/slack-rest-mcp.d.ts +36 -0
- package/dist/slack-rest-mcp.js +25 -0
- package/dist/slack-rest-mcp.js.map +1 -0
- package/dist/spreadsheet-artifact-commands.d.ts +14 -1
- package/dist/spreadsheet-artifact-commands.js +8 -2
- package/dist/spreadsheet-artifact-query.d.ts +13 -6
- package/dist/spreadsheet-artifact-query.js +3 -3
- package/dist/subscription-account-actions.d.ts +64 -0
- package/dist/subscription-account-pools.d.ts +292 -0
- package/dist/subscription-personal-authority-v2.d.ts +28 -0
- package/dist/subscription-personal-authority-v2.js +12 -0
- package/dist/subscription-personal-authority-v2.js.map +1 -0
- package/dist/tool-action-review.d.ts +132 -0
- package/dist/tool-catalog.d.ts +408 -0
- package/dist/tool-policy.d.ts +5 -0
- package/dist/tool-review-presentation.d.ts +12 -0
- package/dist/tool-review-presentation.js +17 -0
- package/dist/tool-review-presentation.js.map +1 -0
- package/dist/transcription-recordings.d.ts +21 -0
- package/dist/turn-serving-policy.d.ts +221 -0
- package/dist/usage-allowances.d.ts +314 -0
- package/dist/usage-allowances.js +52 -0
- package/dist/usage-allowances.js.map +1 -0
- package/dist/vaults.d.ts +1286 -0
- package/dist/video-generation.d.ts +3 -0
- package/dist/video-generation.js +2 -1
- package/dist/workspace-integration-wire.d.ts +36 -0
- package/dist/workspace-integration-wire.js +23 -0
- package/dist/workspace-integration-wire.js.map +1 -0
- package/dist/workspace-integrations.d.ts +1028 -0
- package/dist/xai-provider-account-authority.js +2 -1
- package/package.json +93 -5
- package/src/agent-authored-durable-text.ts +14 -11
- package/src/agent-config.ts +1698 -0
- package/src/agent-instruction-changes.ts +91 -74
- package/src/agent-learning.ts +94 -67
- package/src/agent-topology.ts +57 -52
- package/src/allowance-refusal.ts +81 -0
- package/src/analytics-consent-report.ts +20 -0
- package/src/api-key-presets.ts +28 -0
- package/src/artifact-catalog.ts +82 -0
- package/src/artifacts.ts +299 -227
- package/src/atlassian-native-retirement.ts +33 -0
- package/src/atlassian.ts +135 -108
- package/src/browser-storage.ts +10 -0
- package/src/bundled-skills.ts +60 -17
- package/src/canonical-human-identities.ts +60 -58
- package/src/claude-provider-account-authority.ts +12 -0
- package/src/claude-subscription-oauth.ts +73 -0
- package/src/claude-subscription-usage.ts +68 -0
- package/src/client-error-report.ts +343 -0
- package/src/code-search.ts +105 -0
- package/src/codex-provider-account-authority.ts +21 -16
- package/src/company-brain-governed-writes.ts +255 -233
- package/src/company-brain.ts +164 -153
- package/src/company-profile.ts +365 -292
- package/src/connect.ts +212 -173
- package/src/connection-account-label.ts +46 -0
- package/src/connection-authority.ts +183 -364
- package/src/connector-attachments.ts +137 -122
- package/src/connector-destinations.ts +46 -42
- package/src/connector-tool-permissions.ts +117 -0
- package/src/cua-desktop-tools.gen.json +6512 -0
- package/src/cua-desktop-tools.linux.gen.json +6600 -0
- package/src/cua-desktop-tools.ts +36 -0
- package/src/cua-desktop-tools.windows.gen.json +6353 -0
- package/src/define-schema.ts +10 -0
- package/src/direct-model-provider.ts +108 -0
- package/src/editable-artifact-committed-transaction.ts +17 -0
- package/src/editable-artifact-versions.ts +7 -1
- package/src/event-preview.ts +53 -3
- package/src/external-identities.ts +249 -176
- package/src/feedback.ts +43 -30
- package/src/first-party-tool-authorization.ts +356 -0
- package/src/github-repository-contracts.ts +78 -64
- package/src/google-drive.ts +285 -234
- package/src/governed-learning-activation.ts +152 -131
- package/src/governed-learning-evaluator.ts +140 -133
- package/src/host-mcp-bindings.ts +252 -198
- package/src/image-generation.ts +104 -95
- package/src/index.ts +13235 -8687
- package/src/insights-usage.ts +727 -0
- package/src/interaction.ts +3070 -2326
- package/src/knowledge-entries.ts +361 -276
- package/src/knowledge-preparation.ts +57 -0
- package/src/knowledge.ts +246 -213
- package/src/managed-auth-session-sets.ts +220 -144
- package/src/managed-sign-in-methods.ts +52 -0
- package/src/mcp-catalog-limits.ts +2 -0
- package/src/mcp-oauth.ts +43 -34
- package/src/mcp-receipts.ts +192 -192
- package/src/mcp-structured-content.ts +81 -0
- package/src/memory-slack-delivery.ts +171 -142
- package/src/modal-native-proof-v2.ts +429 -0
- package/src/model-account-choice.ts +177 -0
- package/src/model-account-settings.ts +210 -0
- package/src/model-availability.ts +22 -0
- package/src/model-connection-access.ts +61 -14
- package/src/model-context-inspector.ts +133 -99
- package/src/model-display.ts +221 -0
- package/src/model-picker-order.ts +12 -1
- package/src/organization-access.ts +217 -0
- package/src/organization-integration-policy.ts +63 -0
- package/src/organization-membership-lifecycle.ts +528 -382
- package/src/organization-model-usage.ts +81 -0
- package/src/organization-recovery.ts +147 -135
- package/src/organization-usage.ts +94 -0
- package/src/permissions.ts +88 -52
- package/src/personal-github.ts +210 -171
- package/src/preference-registry.ts +314 -258
- package/src/prepared-mcp-setup.ts +189 -0
- package/src/product-analytics.ts +261 -0
- package/src/product-lifecycle-facts.ts +122 -0
- package/src/remember.ts +181 -167
- package/src/retained-output.ts +194 -165
- package/src/sandbox-file-artifacts.ts +60 -47
- package/src/sandbox-provider-command.ts +88 -20
- package/src/sandbox-recovery.ts +129 -0
- package/src/scoped-knowledge.ts +61 -43
- package/src/secret-generator.ts +155 -0
- package/src/secret-references.ts +414 -0
- package/src/secret-resolution.ts +274 -0
- package/src/secret-totp.ts +188 -0
- package/src/session-final-reply.ts +16 -0
- package/src/session-goal-reports.ts +64 -0
- package/src/session-history-import.ts +177 -0
- package/src/session-list-entries.ts +96 -0
- package/src/session-mcp-projections.ts +11 -0
- package/src/session-mcp-tool-permissions.ts +108 -0
- package/src/session-message-search.ts +61 -0
- package/src/session-target.ts +57 -0
- package/src/session-titles.ts +80 -10
- package/src/session-topology-primitives.ts +19 -12
- package/src/session-usage-limit-refusal.ts +101 -0
- package/src/session-usage-limits.ts +171 -0
- package/src/signup-attribution.ts +86 -0
- package/src/site-data.ts +339 -0
- package/src/site-operations.ts +154 -0
- package/src/site-publishing.ts +876 -0
- package/src/site-session-http.ts +294 -16
- package/src/site-sql.ts +1123 -0
- package/src/skill-catalog-context.ts +50 -0
- package/src/skill-files.ts +3 -3
- package/src/skill-use.ts +80 -0
- package/src/skills.ts +82 -54
- package/src/slack-bot-scopes.ts +31 -39
- package/src/slack-rest-mcp.ts +222 -0
- package/src/slack-task-policy.ts +96 -73
- package/src/spreadsheet-artifact-commands.ts +73 -2
- package/src/spreadsheet-artifact-query.ts +187 -39
- package/src/subscription-account-actions.ts +84 -0
- package/src/subscription-account-pools.ts +53 -0
- package/src/subscription-personal-authority-v2.ts +66 -0
- package/src/task-notes.ts +55 -51
- package/src/tool-action-review.ts +258 -0
- package/src/tool-catalog.ts +609 -372
- package/src/tool-policy.ts +82 -0
- package/src/tool-result-spill.ts +12 -9
- package/src/tool-review-presentation.ts +385 -0
- package/src/transcription-recordings.ts +145 -131
- package/src/turn-serving-policy.ts +166 -0
- package/src/usage-allowances.ts +248 -0
- package/src/vaults.ts +850 -0
- package/src/video-generation.ts +385 -360
- package/src/work-claims.ts +173 -149
- package/src/workspace-instruction-policies.ts +349 -276
- package/src/workspace-integration-wire.ts +101 -0
- package/src/workspace-integrations.ts +724 -0
- package/src/workspace-learning-administration.ts +57 -44
- package/src/workspace-learning-policy.ts +127 -96
- package/src/workspace-state.ts +250 -220
- package/src/xai-provider-account-authority.ts +22 -17
- package/dist/chunk-2AC63F4S.js +0 -171
- package/dist/chunk-2AC63F4S.js.map +0 -1
- package/dist/chunk-3SIZGL3O.js.map +0 -1
- package/dist/chunk-7ABONTXE.js.map +0 -1
- package/dist/chunk-BCS7WHCK.js +0 -139
- package/dist/chunk-BCS7WHCK.js.map +0 -1
- package/dist/chunk-GRG7PHWQ.js +0 -25
- package/dist/chunk-GRG7PHWQ.js.map +0 -1
- package/dist/chunk-JUFK3T4Q.js +0 -80
- package/dist/chunk-JUFK3T4Q.js.map +0 -1
- package/dist/chunk-M5ZGRVIQ.js +0 -719
- package/dist/chunk-M5ZGRVIQ.js.map +0 -1
- package/dist/chunk-MRWYRAS5.js.map +0 -1
- package/dist/chunk-OVFORMPW.js +0 -348
- package/dist/chunk-OVFORMPW.js.map +0 -1
- package/dist/chunk-P3HLDT77.js +0 -59
- package/dist/chunk-P3HLDT77.js.map +0 -1
- package/dist/chunk-QQUJ6NPW.js +0 -23093
- package/dist/chunk-QQUJ6NPW.js.map +0 -1
- package/dist/chunk-TXTQIYCV.js.map +0 -1
- package/dist/chunk-WYBDERIY.js.map +0 -1
- package/dist/chunk-Y3KNXVTD.js.map +0 -1
- package/dist/chunk-YBW5JSA3.js.map +0 -1
- package/dist/chunk-YRXAWWCU.js +0 -45
- package/dist/chunk-YRXAWWCU.js.map +0 -1
- package/dist/host-mcp-resolvers.d.ts +0 -32
- package/dist/host-mcp-resolvers.js +0 -34
- package/dist/host-mcp-resolvers.js.map +0 -1
- package/src/host-mcp-resolvers.ts +0 -50
- /package/dist/{chunk-5LYFSZ7O.js.map → chunk-352X6ENP.js.map} +0 -0
- /package/dist/{chunk-O5LEQHDM.js.map → chunk-Z7WEVGCL.js.map} +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
/** Public, content-free selection. Never include native provider bindings. */
|
|
5
|
+
export const SandboxRecoverySelection = /* @__PURE__ */ defineSchema(() =>
|
|
6
|
+
z
|
|
7
|
+
.object({
|
|
8
|
+
version: z.literal(1),
|
|
9
|
+
sessionId: z.string().uuid(),
|
|
10
|
+
sandboxGroupId: z.string().uuid(),
|
|
11
|
+
leaseId: z.string().uuid(),
|
|
12
|
+
routeEpoch: z.number().int().nonnegative(),
|
|
13
|
+
authorityEpoch: z.number().int().positive(),
|
|
14
|
+
leaseEpoch: z.number().int().nonnegative(),
|
|
15
|
+
workspaceGeneration: z.number().int().nonnegative(),
|
|
16
|
+
archiveGeneration: z.number().int().nonnegative(),
|
|
17
|
+
artifactId: z.string().uuid(),
|
|
18
|
+
revision: z.string().min(1).max(512),
|
|
19
|
+
capturedAt: z.string().datetime(),
|
|
20
|
+
})
|
|
21
|
+
.strict(),
|
|
22
|
+
);
|
|
23
|
+
export type SandboxRecoverySelection = z.infer<typeof SandboxRecoverySelection>;
|
|
24
|
+
|
|
25
|
+
export const SandboxRecoveryProjection = /* @__PURE__ */ defineSchema(() =>
|
|
26
|
+
z
|
|
27
|
+
.object({
|
|
28
|
+
version: z.literal(1),
|
|
29
|
+
status: z.enum([
|
|
30
|
+
"unsupported",
|
|
31
|
+
"blocked",
|
|
32
|
+
"eligible",
|
|
33
|
+
"consent_accepted",
|
|
34
|
+
"restoring",
|
|
35
|
+
"restored",
|
|
36
|
+
]),
|
|
37
|
+
reason: z.string().max(128).nullable(),
|
|
38
|
+
checkpoint: SandboxRecoverySelection.nullable(),
|
|
39
|
+
operationId: z.string().uuid().nullable(),
|
|
40
|
+
/** Retry may elect a system-selected verified checkpoint; no consent POST. */
|
|
41
|
+
automaticAvailable: z.boolean().optional(),
|
|
42
|
+
/** What an automatic Retry will do: restore `checkpoint`, or continue on a
|
|
43
|
+
* new empty workspace because no usable checkpoint survived the loss. */
|
|
44
|
+
automaticLane: z.enum(["checkpoint", "fresh_workspace"]).optional(),
|
|
45
|
+
/** For a timed recovery wait: the earliest time a Retry or a new message
|
|
46
|
+
* can let Opengeni decide again. Nothing proceeds by itself before then. */
|
|
47
|
+
availableAt: z.string().datetime().optional(),
|
|
48
|
+
})
|
|
49
|
+
.strict(),
|
|
50
|
+
);
|
|
51
|
+
export type SandboxRecoveryProjection = z.infer<typeof SandboxRecoveryProjection>;
|
|
52
|
+
|
|
53
|
+
/** Why a definitively lost managed sandbox continues on an empty workspace. */
|
|
54
|
+
export const SandboxFreshWorkspaceReason = /* @__PURE__ */ defineSchema(() =>
|
|
55
|
+
z.enum([
|
|
56
|
+
"archive_unavailable",
|
|
57
|
+
"archive_unverified",
|
|
58
|
+
"checkpoint_unrestorable",
|
|
59
|
+
"checkpoint_restore_failed",
|
|
60
|
+
]),
|
|
61
|
+
);
|
|
62
|
+
export type SandboxFreshWorkspaceReason = z.infer<typeof SandboxFreshWorkspaceReason>;
|
|
63
|
+
|
|
64
|
+
/** Durable, content-free fresh-workspace decision for one group member. */
|
|
65
|
+
export const SandboxFreshWorkspaceRecovery = /* @__PURE__ */ defineSchema(() =>
|
|
66
|
+
z
|
|
67
|
+
.object({
|
|
68
|
+
version: z.literal(1),
|
|
69
|
+
sessionId: z.string().uuid(),
|
|
70
|
+
sandboxGroupId: z.string().uuid(),
|
|
71
|
+
leaseId: z.string().uuid(),
|
|
72
|
+
leaseEpoch: z.number().int().nonnegative(),
|
|
73
|
+
workspaceGeneration: z.number().int().nonnegative(),
|
|
74
|
+
archiveGeneration: z.number().int().nonnegative().nullable(),
|
|
75
|
+
lostAt: z.string().datetime(),
|
|
76
|
+
reason: SandboxFreshWorkspaceReason,
|
|
77
|
+
})
|
|
78
|
+
.strict(),
|
|
79
|
+
);
|
|
80
|
+
export type SandboxFreshWorkspaceRecovery = z.infer<typeof SandboxFreshWorkspaceRecovery>;
|
|
81
|
+
|
|
82
|
+
export const SandboxRecoveryRequest = /* @__PURE__ */ defineSchema(() =>
|
|
83
|
+
z
|
|
84
|
+
.object({
|
|
85
|
+
operationId: z.string().uuid(),
|
|
86
|
+
acceptHistoricalCheckpoint: z.literal(true),
|
|
87
|
+
selection: SandboxRecoverySelection,
|
|
88
|
+
})
|
|
89
|
+
.strict(),
|
|
90
|
+
);
|
|
91
|
+
export type SandboxRecoveryRequest = z.infer<typeof SandboxRecoveryRequest>;
|
|
92
|
+
|
|
93
|
+
export const SandboxRecoveryResponse = /* @__PURE__ */ defineSchema(() =>
|
|
94
|
+
z
|
|
95
|
+
.object({
|
|
96
|
+
outcome: z.enum(["accepted", "replayed"]),
|
|
97
|
+
operationId: z.string().uuid(),
|
|
98
|
+
recovery: SandboxRecoveryProjection,
|
|
99
|
+
})
|
|
100
|
+
.strict(),
|
|
101
|
+
);
|
|
102
|
+
export type SandboxRecoveryResponse = z.infer<typeof SandboxRecoveryResponse>;
|
|
103
|
+
|
|
104
|
+
/** Re-injected from durable receipts on every attempt, not lossy transcript state. */
|
|
105
|
+
export function sandboxRecoveryDiscontinuity(selection: SandboxRecoverySelection): string {
|
|
106
|
+
return `Filesystem discontinuity: the human explicitly consented to restoring this session's workspace from the checkpoint captured at ${selection.capturedAt} (archive generation ${selection.archiveGeneration}, pre-recovery workspace generation ${selection.workspaceGeneration}). Newer filesystem changes are unavailable. The generation gap is not a count of lost files or edits. Conversation and tool receipts remain historical evidence, not proof that their files still exist. External effects are not undone. Verify the current filesystem before relying on previous work. Never automatically replay prior commands or operations with unknown outcomes to rebuild missing files. Consent alone is not proof that restoration succeeded.`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Stable tail instructions, sourced from a durable system recovery receipt.
|
|
110
|
+
* `shared` names the sandbox this session shares with other sessions; every
|
|
111
|
+
* member of that group receives its own receipt for the same selection. */
|
|
112
|
+
export function automaticSandboxRecoveryDiscontinuity(
|
|
113
|
+
selection: SandboxRecoverySelection,
|
|
114
|
+
scope: "session" | "shared" = "session",
|
|
115
|
+
): string {
|
|
116
|
+
const subject =
|
|
117
|
+
scope === "shared"
|
|
118
|
+
? "the latest verified checkpoint of the sandbox this session shares with other sessions"
|
|
119
|
+
: "this session's latest verified checkpoint";
|
|
120
|
+
return `Filesystem discontinuity: after the managed sandbox was lost, Opengeni selected ${subject}, captured at ${selection.capturedAt} (archive generation ${selection.archiveGeneration}, pre-recovery workspace generation ${selection.workspaceGeneration}). Newer filesystem changes may be unavailable; the generation gap is not a count of lost files or edits. Conversation and tool receipts remain historical evidence, not proof that their files still exist. External effects are not undone. Verify the restored filesystem before relying on previous work. Never automatically replay prior commands or operations with unknown outcomes. Checkpoint selection alone is not proof that restoration succeeded.`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Stable tail instructions for continuing on a new empty workspace. The text
|
|
124
|
+
* is true on every later turn too: it names the loss, not the current tree. */
|
|
125
|
+
export function freshWorkspaceSandboxRecoveryDiscontinuity(
|
|
126
|
+
recovery: SandboxFreshWorkspaceRecovery,
|
|
127
|
+
): string {
|
|
128
|
+
return `Filesystem discontinuity: the previous managed sandbox was lost at ${recovery.lostAt} and there is no checkpoint Opengeni can restore automatically, so Opengeni continued this session on a new empty workspace. Files, repository clones, installed packages and running processes from before that time are not available in this workspace; do not assume they exist. Anything now in the workspace was created after that loss. Conversation and tool receipts from before it remain historical evidence, not proof that their files still exist. External effects are not undone. Verify the current filesystem before relying on previous work, and recreate what you need deliberately. Never automatically replay prior commands or operations with unknown outcomes.`;
|
|
129
|
+
}
|
package/src/scoped-knowledge.ts
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
|
|
3
4
|
/** Tenant scope for normalized knowledge and source provenance. */
|
|
4
|
-
export const ScopedKnowledgeScopeKind =
|
|
5
|
+
export const ScopedKnowledgeScopeKind = /* @__PURE__ */ defineSchema(() =>
|
|
6
|
+
z.enum(["organization", "workspace", "personal"]),
|
|
7
|
+
);
|
|
5
8
|
export type ScopedKnowledgeScopeKind = z.infer<typeof ScopedKnowledgeScopeKind>;
|
|
6
9
|
|
|
7
|
-
export const ScopedKnowledgeScope =
|
|
8
|
-
z.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
export const ScopedKnowledgeScope = /* @__PURE__ */ defineSchema(() =>
|
|
11
|
+
z.discriminatedUnion("kind", [
|
|
12
|
+
z.object({
|
|
13
|
+
kind: z.literal("organization"),
|
|
14
|
+
workspaceId: z.null(),
|
|
15
|
+
subjectId: z.null(),
|
|
16
|
+
}),
|
|
17
|
+
z.object({
|
|
18
|
+
kind: z.literal("workspace"),
|
|
19
|
+
workspaceId: z.string().uuid(),
|
|
20
|
+
subjectId: z.null(),
|
|
21
|
+
}),
|
|
22
|
+
z.object({
|
|
23
|
+
kind: z.literal("personal"),
|
|
24
|
+
workspaceId: z.string().uuid().nullable(),
|
|
25
|
+
subjectId: z.string().min(1).max(1024),
|
|
26
|
+
}),
|
|
27
|
+
]),
|
|
28
|
+
);
|
|
24
29
|
export type ScopedKnowledgeScope = z.infer<typeof ScopedKnowledgeScope>;
|
|
25
30
|
|
|
26
|
-
export const ScopedKnowledgeActorKind =
|
|
31
|
+
export const ScopedKnowledgeActorKind = /* @__PURE__ */ defineSchema(() =>
|
|
32
|
+
z.enum(["human", "service"]),
|
|
33
|
+
);
|
|
27
34
|
export type ScopedKnowledgeActorKind = z.infer<typeof ScopedKnowledgeActorKind>;
|
|
28
35
|
|
|
29
36
|
/**
|
|
@@ -36,46 +43,57 @@ export type ScopedKnowledgeActor = {
|
|
|
36
43
|
initiatingHumanSubjectId: string | null;
|
|
37
44
|
};
|
|
38
45
|
|
|
39
|
-
export const KnowledgeLifecycleState =
|
|
46
|
+
export const KnowledgeLifecycleState = /* @__PURE__ */ defineSchema(() =>
|
|
47
|
+
z.enum(["active", "deleted", "revoked"]),
|
|
48
|
+
);
|
|
40
49
|
export type KnowledgeLifecycleState = z.infer<typeof KnowledgeLifecycleState>;
|
|
41
50
|
|
|
42
|
-
export const KnowledgeLifecycleEventType =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
export const KnowledgeLifecycleEventType = /* @__PURE__ */ defineSchema(() =>
|
|
52
|
+
z.enum([
|
|
53
|
+
"deleted",
|
|
54
|
+
"revoked",
|
|
55
|
+
"restored",
|
|
56
|
+
"acl_changed",
|
|
57
|
+
"sync_succeeded",
|
|
58
|
+
"sync_failed",
|
|
59
|
+
"object_version_added",
|
|
60
|
+
]),
|
|
61
|
+
);
|
|
51
62
|
export type KnowledgeLifecycleEventType = z.infer<typeof KnowledgeLifecycleEventType>;
|
|
52
63
|
|
|
53
|
-
export const KnowledgeSyncRunState =
|
|
64
|
+
export const KnowledgeSyncRunState = /* @__PURE__ */ defineSchema(() =>
|
|
65
|
+
z.enum(["started", "succeeded", "failed"]),
|
|
66
|
+
);
|
|
54
67
|
export type KnowledgeSyncRunState = z.infer<typeof KnowledgeSyncRunState>;
|
|
55
68
|
|
|
56
|
-
export const KnowledgeClaimOrigin =
|
|
69
|
+
export const KnowledgeClaimOrigin = /* @__PURE__ */ defineSchema(() =>
|
|
70
|
+
z.enum(["explicit", "inferred"]),
|
|
71
|
+
);
|
|
57
72
|
export type KnowledgeClaimOrigin = z.infer<typeof KnowledgeClaimOrigin>;
|
|
58
73
|
|
|
59
|
-
export const KnowledgeClaimRelationType =
|
|
74
|
+
export const KnowledgeClaimRelationType = /* @__PURE__ */ defineSchema(() =>
|
|
75
|
+
z.enum(["supersedes", "conflicts_with"]),
|
|
76
|
+
);
|
|
60
77
|
export type KnowledgeClaimRelationType = z.infer<typeof KnowledgeClaimRelationType>;
|
|
61
78
|
|
|
62
|
-
export const KnowledgeClaimEvidencePolarity =
|
|
79
|
+
export const KnowledgeClaimEvidencePolarity = /* @__PURE__ */ defineSchema(() =>
|
|
80
|
+
z.enum(["supports", "contradicts"]),
|
|
81
|
+
);
|
|
63
82
|
export type KnowledgeClaimEvidencePolarity = z.infer<typeof KnowledgeClaimEvidencePolarity>;
|
|
64
83
|
|
|
65
|
-
export const KnowledgeClaimReviewState =
|
|
84
|
+
export const KnowledgeClaimReviewState = /* @__PURE__ */ defineSchema(() =>
|
|
85
|
+
z.enum(["proposed", "approved", "rejected", "revoked"]),
|
|
86
|
+
);
|
|
66
87
|
export type KnowledgeClaimReviewState = z.infer<typeof KnowledgeClaimReviewState>;
|
|
67
88
|
|
|
68
|
-
export const KnowledgeFactObjectKind =
|
|
69
|
-
"entity",
|
|
70
|
-
|
|
71
|
-
"number",
|
|
72
|
-
"boolean",
|
|
73
|
-
"json",
|
|
74
|
-
"timestamp",
|
|
75
|
-
]);
|
|
89
|
+
export const KnowledgeFactObjectKind = /* @__PURE__ */ defineSchema(() =>
|
|
90
|
+
z.enum(["entity", "text", "number", "boolean", "json", "timestamp"]),
|
|
91
|
+
);
|
|
76
92
|
export type KnowledgeFactObjectKind = z.infer<typeof KnowledgeFactObjectKind>;
|
|
77
93
|
|
|
78
|
-
export const KnowledgeChangeProposalTargetKind =
|
|
94
|
+
export const KnowledgeChangeProposalTargetKind = /* @__PURE__ */ defineSchema(() =>
|
|
95
|
+
z.enum(["instruction_policy", "preference"]),
|
|
96
|
+
);
|
|
79
97
|
export type KnowledgeChangeProposalTargetKind = z.infer<typeof KnowledgeChangeProposalTargetKind>;
|
|
80
98
|
|
|
81
99
|
export type KnowledgeProviderRecord = {
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { defineSchema } from "./define-schema";
|
|
2
|
+
/**
|
|
3
|
+
* The one password generator shared by agents (`secret_save` with
|
|
4
|
+
* `generate`), the ask card's server-side generate, and the web/mobile UI.
|
|
5
|
+
*
|
|
6
|
+
* Isomorphic and dependency-free: randomness comes from
|
|
7
|
+
* `crypto.getRandomValues` unless a test injects `random`. Output is ASCII
|
|
8
|
+
* only, and every character is drawn uniformly from the selected alphabet by
|
|
9
|
+
* rejection sampling, so no modulo bias is introduced. When
|
|
10
|
+
* `requireEachClass` is set, whole candidates lacking an enabled class are
|
|
11
|
+
* rejected and redrawn, which keeps the result uniform over all compliant
|
|
12
|
+
* passwords.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
|
|
16
|
+
export const SECRET_GENERATOR_DEFAULT_SYMBOLS = "!#%+-.:=?@_";
|
|
17
|
+
/** Characters that are easy to confuse when a person reads them. */
|
|
18
|
+
export const SECRET_GENERATOR_AMBIGUOUS_CHARACTERS = "0O1lI|";
|
|
19
|
+
|
|
20
|
+
const LOWERCASE = "abcdefghijklmnopqrstuvwxyz";
|
|
21
|
+
const UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
22
|
+
const DIGITS = "0123456789";
|
|
23
|
+
|
|
24
|
+
function isPrintableAscii(value: string): boolean {
|
|
25
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
26
|
+
const code = value.charCodeAt(index);
|
|
27
|
+
if (code < 0x21 || code > 0x7e) return false;
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const GeneratePasswordSpec = /* @__PURE__ */ defineSchema(() =>
|
|
33
|
+
z
|
|
34
|
+
.object({
|
|
35
|
+
length: z.number().int().min(8).max(128).default(24),
|
|
36
|
+
lowercase: z.boolean().default(true),
|
|
37
|
+
uppercase: z.boolean().default(true),
|
|
38
|
+
digits: z.boolean().default(true),
|
|
39
|
+
symbols: z.boolean().default(true),
|
|
40
|
+
// No quotes, $, `, \, braces, /, &, ; or | by default: generated values
|
|
41
|
+
// stay safe to paste into shells, URLs and config files.
|
|
42
|
+
symbolSet: z
|
|
43
|
+
.string()
|
|
44
|
+
.min(1)
|
|
45
|
+
.max(64)
|
|
46
|
+
.refine(isPrintableAscii, "symbolSet must be printable ASCII without spaces")
|
|
47
|
+
.default(SECRET_GENERATOR_DEFAULT_SYMBOLS),
|
|
48
|
+
excludeAmbiguous: z.boolean().default(true),
|
|
49
|
+
requireEachClass: z.boolean().default(true),
|
|
50
|
+
})
|
|
51
|
+
.strict()
|
|
52
|
+
.refine(
|
|
53
|
+
(spec) => spec.lowercase || spec.uppercase || spec.digits || spec.symbols,
|
|
54
|
+
"at least one character class must be enabled",
|
|
55
|
+
),
|
|
56
|
+
);
|
|
57
|
+
export type GeneratePasswordSpec = z.infer<typeof GeneratePasswordSpec>;
|
|
58
|
+
export type GeneratePasswordSpecInput = z.input<typeof GeneratePasswordSpec>;
|
|
59
|
+
|
|
60
|
+
export class PasswordGeneratorError extends Error {
|
|
61
|
+
constructor(message: string) {
|
|
62
|
+
super(message);
|
|
63
|
+
this.name = "PasswordGeneratorError";
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function defaultRandom(n: number): Uint8Array {
|
|
68
|
+
const bytes = new Uint8Array(n);
|
|
69
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
70
|
+
return bytes;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function uniqueCharacters(value: string): string {
|
|
74
|
+
return [...new Set(value)].join("");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The enabled character classes after exclusions; empty classes are dropped. */
|
|
78
|
+
export function passwordCharacterClasses(spec: GeneratePasswordSpec): string[] {
|
|
79
|
+
const ambiguous = spec.excludeAmbiguous ? new Set(SECRET_GENERATOR_AMBIGUOUS_CHARACTERS) : null;
|
|
80
|
+
const strip = (alphabet: string) =>
|
|
81
|
+
uniqueCharacters(alphabet)
|
|
82
|
+
.split("")
|
|
83
|
+
.filter((character) => !ambiguous?.has(character))
|
|
84
|
+
.join("");
|
|
85
|
+
const classes: string[] = [];
|
|
86
|
+
if (spec.lowercase) classes.push(strip(LOWERCASE));
|
|
87
|
+
if (spec.uppercase) classes.push(strip(UPPERCASE));
|
|
88
|
+
if (spec.digits) classes.push(strip(DIGITS));
|
|
89
|
+
if (spec.symbols) classes.push(strip(spec.symbolSet));
|
|
90
|
+
return classes.filter((characters) => characters.length > 0);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Draws `count` uniform indexes in `[0, size)` by rejection sampling bytes. */
|
|
94
|
+
function uniformIndexes(count: number, size: number, random: (n: number) => Uint8Array): number[] {
|
|
95
|
+
if (size < 1 || size > 256) throw new PasswordGeneratorError("alphabet size out of range");
|
|
96
|
+
const limit = 256 - (256 % size);
|
|
97
|
+
const out: number[] = [];
|
|
98
|
+
let guard = 0;
|
|
99
|
+
while (out.length < count) {
|
|
100
|
+
const bytes = random(Math.max(16, (count - out.length) * 2));
|
|
101
|
+
for (const byte of bytes) {
|
|
102
|
+
if (byte < limit) out.push(byte % size);
|
|
103
|
+
if (out.length === count) break;
|
|
104
|
+
}
|
|
105
|
+
guard += 1;
|
|
106
|
+
if (guard > 10_000) throw new PasswordGeneratorError("random source is not producing entropy");
|
|
107
|
+
}
|
|
108
|
+
return out;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Generate a password. The spec input is parsed (defaults applied) first. */
|
|
112
|
+
export function generatePassword(
|
|
113
|
+
spec?: GeneratePasswordSpecInput,
|
|
114
|
+
random: (n: number) => Uint8Array = defaultRandom,
|
|
115
|
+
): string {
|
|
116
|
+
const parsed = GeneratePasswordSpec.parse(spec ?? {});
|
|
117
|
+
const classes = passwordCharacterClasses(parsed);
|
|
118
|
+
if (classes.length === 0) throw new PasswordGeneratorError("no characters available");
|
|
119
|
+
const alphabet = uniqueCharacters(classes.join(""));
|
|
120
|
+
const requireClasses = parsed.requireEachClass ? classes : [];
|
|
121
|
+
if (requireClasses.length > parsed.length) {
|
|
122
|
+
throw new PasswordGeneratorError("length is shorter than the number of required classes");
|
|
123
|
+
}
|
|
124
|
+
for (let attempt = 0; attempt < 1_000; attempt += 1) {
|
|
125
|
+
const password = uniformIndexes(parsed.length, alphabet.length, random)
|
|
126
|
+
.map((index) => alphabet[index]!)
|
|
127
|
+
.join("");
|
|
128
|
+
if (requireClasses.every((characters) => [...password].some((c) => characters.includes(c)))) {
|
|
129
|
+
return password;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
throw new PasswordGeneratorError("could not satisfy the character class requirements");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type PasswordStrengthLabel = "weak" | "fair" | "strong" | "very_strong";
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Estimated entropy from length and the character pools the password uses.
|
|
139
|
+
* A display hint for the UI, not a security decision.
|
|
140
|
+
*/
|
|
141
|
+
export function passwordStrength(password: string): {
|
|
142
|
+
bits: number;
|
|
143
|
+
label: PasswordStrengthLabel;
|
|
144
|
+
} {
|
|
145
|
+
let pool = 0;
|
|
146
|
+
if (/[a-z]/.test(password)) pool += 26;
|
|
147
|
+
if (/[A-Z]/.test(password)) pool += 26;
|
|
148
|
+
if (/[0-9]/.test(password)) pool += 10;
|
|
149
|
+
if (/[^a-zA-Z0-9]/.test(password)) pool += 33;
|
|
150
|
+
const length = [...password].length;
|
|
151
|
+
const bits = pool === 0 ? 0 : Math.round(length * Math.log2(pool) * 10) / 10;
|
|
152
|
+
const label: PasswordStrengthLabel =
|
|
153
|
+
bits < 40 ? "weak" : bits < 60 ? "fair" : bits < 100 ? "strong" : "very_strong";
|
|
154
|
+
return { bits, label };
|
|
155
|
+
}
|