@opengeni/contracts 0.44.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-authored-durable-text.d.ts +70 -0
- package/dist/agent-config.d.ts +869 -0
- package/dist/agent-instruction-changes.d.ts +110 -0
- package/dist/agent-learning.d.ts +243 -0
- package/dist/agent-topology.d.ts +292 -0
- 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 +161 -0
- package/dist/artifacts.d.ts +135 -11
- 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 +2 -0
- package/dist/atlassian.js +27 -11
- 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 +40 -0
- package/dist/canonical-human-identities.d.ts +157 -0
- package/dist/canonical-human-identities.js +23 -0
- package/dist/canonical-human-identities.js.map +1 -0
- package/dist/chunk-2ACYHZFB.js +292 -0
- package/dist/chunk-2ACYHZFB.js.map +1 -0
- package/dist/chunk-2VORLN2R.js +353 -0
- package/dist/chunk-2VORLN2R.js.map +1 -0
- package/dist/{chunk-Y3MLSLB4.js → chunk-3SIZGL3O.js} +42 -30
- package/dist/chunk-3SIZGL3O.js.map +1 -0
- package/dist/chunk-46KLD2UH.js +186 -0
- package/dist/chunk-46KLD2UH.js.map +1 -0
- package/dist/chunk-4JGHSSB7.js +11 -0
- package/dist/chunk-4JGHSSB7.js.map +1 -0
- package/dist/{chunk-52SGB2QO.js → chunk-5IXYF6XN.js} +50 -10
- package/dist/chunk-5IXYF6XN.js.map +1 -0
- package/dist/chunk-BCS7WHCK.js +139 -0
- package/dist/chunk-BCS7WHCK.js.map +1 -0
- package/dist/chunk-EK7NDGFR.js +128 -0
- package/dist/chunk-EK7NDGFR.js.map +1 -0
- package/dist/{chunk-5UDNP7AO.js → chunk-FZ6BXQHL.js} +78 -38
- package/dist/chunk-FZ6BXQHL.js.map +1 -0
- package/dist/chunk-GRG7PHWQ.js +25 -0
- package/dist/chunk-GRG7PHWQ.js.map +1 -0
- package/dist/chunk-JUFK3T4Q.js +80 -0
- package/dist/chunk-JUFK3T4Q.js.map +1 -0
- package/dist/chunk-KHHZTBP7.js +11 -0
- package/dist/chunk-KHHZTBP7.js.map +1 -0
- package/dist/chunk-KR2V42UZ.js +187 -0
- package/dist/chunk-KR2V42UZ.js.map +1 -0
- package/dist/chunk-MZLBPKFE.js +168 -0
- package/dist/chunk-MZLBPKFE.js.map +1 -0
- package/dist/{chunk-H5BVCZKF.js → chunk-NRMCVHAU.js} +6 -5
- package/dist/chunk-NRMCVHAU.js.map +1 -0
- package/dist/{chunk-TZ6YEYN4.js → chunk-NVJMJWLL.js} +3 -1
- package/dist/chunk-NVJMJWLL.js.map +1 -0
- package/dist/chunk-O77VSFYZ.js +70 -0
- package/dist/chunk-O77VSFYZ.js.map +1 -0
- package/dist/chunk-PX3VCKAU.js +29 -0
- package/dist/chunk-PX3VCKAU.js.map +1 -0
- package/dist/chunk-QR5D2IQC.js +61 -0
- package/dist/chunk-QR5D2IQC.js.map +1 -0
- package/dist/chunk-RJ76DRPO.js +117 -0
- package/dist/chunk-RJ76DRPO.js.map +1 -0
- package/dist/chunk-RKX3NQYS.js +28 -0
- package/dist/chunk-RKX3NQYS.js.map +1 -0
- package/dist/{chunk-FJBG5E4O.js → chunk-SIOU2K4U.js} +45 -22
- package/dist/chunk-SIOU2K4U.js.map +1 -0
- package/dist/chunk-TSCDAGET.js +75 -0
- package/dist/chunk-TSCDAGET.js.map +1 -0
- package/dist/{chunk-LSB7GRLG.js → chunk-TXTQIYCV.js} +15 -11
- package/dist/chunk-TXTQIYCV.js.map +1 -0
- package/dist/chunk-X7ETVO4P.js +26544 -0
- package/dist/chunk-X7ETVO4P.js.map +1 -0
- package/dist/{chunk-CADSX6UN.js → chunk-Y3KNXVTD.js} +2 -2
- package/dist/chunk-YBW5JSA3.js +251 -0
- package/dist/chunk-YBW5JSA3.js.map +1 -0
- package/dist/chunk-YRXAWWCU.js +45 -0
- package/dist/chunk-YRXAWWCU.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 +109 -0
- package/dist/client-error-report.js +87 -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.d.ts +23 -0
- package/dist/codex-provider-account-authority.js +23 -0
- package/dist/codex-provider-account-authority.js.map +1 -0
- package/dist/company-brain-governed-writes.d.ts +475 -0
- package/dist/company-brain.d.ts +336 -0
- package/dist/company-profile.d.ts +566 -0
- package/dist/connect.d.ts +325 -0
- package/dist/connect.js +191 -0
- package/dist/connect.js.map +1 -0
- 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 +193 -0
- package/dist/connection-authority.js +50 -0
- package/dist/connection-authority.js.map +1 -0
- package/dist/connector-attachments.d.ts +95 -0
- package/dist/connector-attachments.js +51 -0
- package/dist/connector-attachments.js.map +1 -0
- package/dist/connector-tool-permissions.d.ts +73 -0
- package/dist/direct-model-provider.d.ts +36 -0
- package/dist/editable-artifact-codec-registry.d.ts +16 -7
- package/dist/editable-artifact-codec-registry.js +19 -9
- package/dist/editable-artifact-committed-transaction.d.ts +2 -2
- package/dist/editable-artifact-committed-transaction.js +2 -2
- package/dist/editable-artifact-live.d.ts +11 -12
- package/dist/editable-artifact-live.js +110 -45
- package/dist/editable-artifact-live.js.map +1 -1
- package/dist/editable-artifact-serialized-commit.d.ts +2 -1
- package/dist/editable-artifact-serialized-commit.js +8 -7
- package/dist/editable-artifact-versions.d.ts +20 -5
- package/dist/editable-artifact-versions.js +23 -5
- package/dist/editable-artifacts.d.ts +2 -0
- package/dist/editable-artifacts.js +48 -36
- package/dist/external-identities.d.ts +784 -0
- package/dist/external-identities.js +44 -0
- package/dist/external-identities.js.map +1 -0
- package/dist/feedback.d.ts +51 -0
- package/dist/github-repository-contracts.d.ts +36 -0
- package/dist/github-repository-contracts.js +59 -0
- package/dist/github-repository-contracts.js.map +1 -0
- package/dist/github-repository.d.ts +14 -0
- package/dist/github-repository.js +36 -0
- package/dist/github-repository.js.map +1 -0
- package/dist/google-drive.d.ts +90 -1
- package/dist/google-drive.js +91 -15
- package/dist/google-drive.js.map +1 -1
- package/dist/governed-learning-activation.d.ts +154 -0
- package/dist/governed-learning-evaluator.d.ts +152 -0
- package/dist/host-mcp-bindings.d.ts +326 -0
- package/dist/host-mcp-bindings.js +252 -0
- package/dist/host-mcp-bindings.js.map +1 -0
- package/dist/image-generation.d.ts +1 -0
- package/dist/index.d.ts +27574 -5374
- package/dist/index.js +2531 -177
- package/dist/insights-usage.d.ts +877 -0
- package/dist/insights-usage.js +509 -0
- package/dist/insights-usage.js.map +1 -0
- package/dist/interaction.d.ts +1752 -13
- package/dist/knowledge-entries.d.ts +982 -0
- package/dist/knowledge-preparation.d.ts +237 -0
- package/dist/knowledge.d.ts +740 -0
- package/dist/managed-auth-session-sets.d.ts +241 -0
- package/dist/managed-auth-session-sets.js +191 -0
- package/dist/managed-auth-session-sets.js.map +1 -0
- package/dist/managed-sign-in-methods.d.ts +56 -0
- package/dist/managed-sign-in-methods.js +46 -0
- package/dist/managed-sign-in-methods.js.map +1 -0
- package/dist/mcp-catalog-limits.d.ts +2 -0
- package/dist/mcp-endpoint.d.ts +7 -0
- package/dist/mcp-endpoint.js +9 -0
- package/dist/mcp-endpoint.js.map +1 -0
- package/dist/mcp-oauth.d.ts +71 -0
- package/dist/modal-native-proof-v2.d.ts +587 -0
- package/dist/modal-native-proof-v2.js +37 -0
- package/dist/modal-native-proof-v2.js.map +1 -0
- package/dist/model-availability.d.ts +15 -0
- package/dist/model-connection-access.d.ts +24 -0
- package/dist/model-context-inspector.d.ts +329 -0
- package/dist/model-display.d.ts +38 -0
- package/dist/model-display.js +134 -0
- package/dist/model-display.js.map +1 -0
- package/dist/model-picker-order.d.ts +25 -0
- package/dist/model-picker-order.js +42 -0
- package/dist/model-picker-order.js.map +1 -0
- package/dist/organization-access.d.ts +231 -0
- package/dist/organization-access.js +34 -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 +1022 -0
- package/dist/organization-model-usage.d.ts +146 -0
- package/dist/organization-model-usage.js +67 -0
- package/dist/organization-model-usage.js.map +1 -0
- package/dist/organization-recovery.d.ts +337 -0
- package/dist/organization-recovery.js +37 -0
- package/dist/organization-recovery.js.map +1 -0
- package/dist/organization-usage.d.ts +138 -0
- package/dist/permissions.d.ts +54 -0
- package/dist/personal-github.d.ts +320 -0
- package/dist/personal-github.js +222 -0
- package/dist/personal-github.js.map +1 -0
- package/dist/plugin-discovery.d.ts +35 -0
- package/dist/plugin-discovery.js +7 -0
- package/dist/plugin-discovery.js.map +1 -0
- package/dist/preference-registry.d.ts +44 -1
- package/dist/product-analytics.d.ts +113 -0
- package/dist/product-lifecycle-facts.d.ts +73 -0
- package/dist/remember.d.ts +350 -0
- package/dist/retained-output.d.ts +8 -0
- package/dist/sandbox-file-artifacts.d.ts +57 -0
- package/dist/sandbox-provider-command.d.ts +113 -0
- package/dist/sandbox-recovery.d.ts +146 -0
- package/dist/sandbox-snapshots.d.ts +39 -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 +947 -0
- package/dist/session-list-entries.d.ts +4 -0
- package/dist/session-list-entries.js +51 -0
- package/dist/session-list-entries.js.map +1 -0
- package/dist/session-mcp-projections.d.ts +215 -0
- package/dist/session-message-search.d.ts +68 -0
- package/dist/session-titles.d.ts +68 -0
- package/dist/session-titles.js +25 -0
- package/dist/session-titles.js.map +1 -0
- package/dist/session-topology-primitives.d.ts +22 -0
- package/dist/signup-attribution.d.ts +39 -0
- package/dist/site-request-headers.test.d.ts +1 -0
- package/dist/site-session-http.d.ts +11 -0
- package/dist/site-session-http.js +11 -0
- package/dist/site-session-http.js.map +1 -0
- package/dist/skill-catalog-context.d.ts +7 -0
- package/dist/skill-files.d.ts +12 -0
- package/dist/skill-metadata.d.ts +9 -0
- package/dist/skill-use.d.ts +61 -0
- package/dist/skills.d.ts +185 -0
- package/dist/slack-bot-scopes.d.ts +46 -21
- package/dist/slack-bot-scopes.js +14 -3
- package/dist/slack-rest-mcp.d.ts +31 -0
- package/dist/slack-rest-mcp.js +19 -0
- package/dist/slack-rest-mcp.js.map +1 -0
- package/dist/slack-task-policy.d.ts +294 -0
- package/dist/spreadsheet-artifact-commands.d.ts +2 -3
- package/dist/spreadsheet-artifact-commands.js +4 -2
- package/dist/spreadsheet-artifact-query.js +3 -2
- package/dist/subscription-account-pools.d.ts +292 -0
- package/dist/task-notes.d.ts +169 -0
- package/dist/tool-catalog.d.ts +286 -0
- package/dist/tool-result-spill.d.ts +16 -0
- package/dist/usage-allowances.d.ts +285 -0
- package/dist/usage-allowances.js +49 -0
- package/dist/usage-allowances.js.map +1 -0
- package/dist/video-generation.d.ts +51 -0
- package/dist/video-generation.js +9 -1
- package/dist/work-claims.d.ts +411 -0
- package/dist/workspace-instruction-policies.d.ts +94 -0
- 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 +948 -0
- package/dist/workspace-learning-administration.d.ts +289 -0
- package/dist/workspace-learning-policy.d.ts +1 -1
- package/dist/workspace-state.d.ts +85 -416
- package/dist/xai-provider-account-authority.d.ts +26 -0
- package/dist/xai-provider-account-authority.js +9 -0
- package/dist/xai-provider-account-authority.js.map +1 -0
- package/package.json +146 -1
- package/src/agent-authored-durable-text.ts +116 -0
- package/src/agent-config.ts +1527 -0
- package/src/agent-instruction-changes.ts +98 -0
- package/src/agent-learning.ts +161 -0
- package/src/agent-topology.ts +69 -0
- package/src/allowance-refusal.ts +81 -0
- package/src/analytics-consent-report.ts +20 -0
- package/src/api-key-presets.ts +25 -0
- package/src/artifact-catalog.ts +60 -0
- package/src/artifacts.ts +146 -18
- package/src/atlassian-native-retirement.ts +33 -0
- package/src/browser-storage.ts +10 -0
- package/src/bundled-skills.ts +73 -0
- package/src/canonical-human-identities.ts +93 -0
- package/src/claude-provider-account-authority.ts +12 -0
- package/src/claude-subscription-oauth.ts +62 -0
- package/src/claude-subscription-usage.ts +59 -0
- package/src/client-error-report.ts +184 -0
- package/src/code-search.ts +105 -0
- package/src/codex-provider-account-authority.ts +37 -0
- package/src/company-brain-governed-writes.ts +356 -0
- package/src/company-brain.ts +201 -0
- package/src/company-profile.ts +167 -1
- package/src/connect.ts +202 -0
- package/src/connection-account-label.ts +46 -0
- package/src/connection-authority.ts +213 -0
- package/src/connector-attachments.ts +327 -0
- package/src/connector-tool-permissions.ts +60 -0
- package/src/direct-model-provider.ts +98 -0
- package/src/editable-artifact-codec-registry.ts +55 -17
- package/src/editable-artifact-committed-transaction.ts +44 -31
- package/src/editable-artifact-live.ts +123 -57
- package/src/editable-artifact-serialized-commit.ts +2 -1
- package/src/editable-artifact-versions.ts +26 -5
- package/src/editable-artifacts.ts +2 -0
- package/src/external-identities.ts +285 -0
- package/src/feedback.ts +39 -0
- package/src/github-repository-contracts.ts +85 -0
- package/src/github-repository.ts +59 -0
- package/src/google-drive.ts +76 -4
- package/src/governed-learning-activation.ts +191 -0
- package/src/governed-learning-evaluator.ts +176 -0
- package/src/host-mcp-bindings.ts +298 -0
- package/src/image-generation.ts +8 -2
- package/src/index.ts +8019 -1799
- package/src/insights-usage.ts +679 -0
- package/src/interaction.ts +1102 -6
- package/src/knowledge-entries.ts +375 -0
- package/src/knowledge-preparation.ts +50 -0
- package/src/knowledge.ts +335 -0
- package/src/managed-auth-session-sets.ts +253 -0
- package/src/managed-sign-in-methods.ts +37 -0
- package/src/mcp-catalog-limits.ts +2 -0
- package/src/mcp-endpoint.ts +30 -0
- package/src/mcp-oauth.ts +66 -0
- package/src/modal-native-proof-v2.ts +398 -0
- package/src/model-availability.ts +22 -0
- package/src/model-connection-access.ts +17 -0
- package/src/model-context-inspector.ts +139 -0
- package/src/model-display.ts +195 -0
- package/src/model-picker-order.ts +97 -0
- package/src/organization-access.ts +176 -0
- package/src/organization-integration-policy.ts +54 -0
- package/src/organization-membership-lifecycle.ts +559 -0
- package/src/organization-model-usage.ts +72 -0
- package/src/organization-recovery.ts +186 -0
- package/src/organization-usage.ts +79 -0
- package/src/permissions.ts +58 -0
- package/src/personal-github.ts +267 -0
- package/src/plugin-discovery.ts +33 -0
- package/src/preference-registry.ts +20 -1
- package/src/product-analytics.ts +253 -0
- package/src/product-lifecycle-facts.ts +121 -0
- package/src/remember.ts +243 -0
- package/src/retained-output.ts +20 -3
- package/src/sandbox-file-artifacts.ts +73 -0
- package/src/sandbox-provider-command.ts +82 -0
- package/src/sandbox-recovery.ts +116 -0
- package/src/sandbox-snapshots.ts +142 -0
- package/src/session-final-reply.ts +16 -0
- package/src/session-goal-reports.ts +55 -0
- package/src/session-history-import.ts +159 -0
- package/src/session-list-entries.ts +91 -0
- package/src/session-mcp-projections.ts +273 -0
- package/src/session-message-search.ts +54 -0
- package/src/session-titles.ts +467 -0
- package/src/session-topology-primitives.ts +21 -0
- package/src/signup-attribution.ts +81 -0
- package/src/site-request-headers.test.ts +28 -0
- package/src/site-session-http.ts +63 -0
- package/src/skill-catalog-context.ts +50 -0
- package/src/skill-files.ts +52 -0
- package/src/skill-metadata.ts +40 -0
- package/src/skill-use.ts +77 -0
- package/src/skills.ts +136 -0
- package/src/slack-bot-scopes.ts +106 -42
- package/src/slack-rest-mcp.ts +194 -0
- package/src/slack-task-policy.ts +215 -0
- package/src/spreadsheet-artifact-commands.ts +12 -13
- package/src/subscription-account-pools.ts +44 -0
- package/src/task-notes.ts +105 -0
- package/src/tool-catalog.ts +155 -0
- package/src/tool-result-spill.ts +35 -0
- package/src/usage-allowances.ts +187 -0
- package/src/video-generation.ts +43 -6
- package/src/work-claims.ts +266 -0
- package/src/workspace-instruction-policies.ts +31 -0
- package/src/workspace-integration-wire.ts +99 -0
- package/src/workspace-integrations.ts +640 -0
- package/src/workspace-learning-administration.ts +88 -0
- package/src/workspace-learning-policy.ts +4 -3
- package/src/workspace-state.ts +16 -126
- package/src/xai-provider-account-authority.ts +38 -0
- package/dist/chunk-52SGB2QO.js.map +0 -1
- package/dist/chunk-5UDNP7AO.js.map +0 -1
- package/dist/chunk-BVGIYW7D.js +0 -11
- package/dist/chunk-BVGIYW7D.js.map +0 -1
- package/dist/chunk-FJBG5E4O.js.map +0 -1
- package/dist/chunk-H5BVCZKF.js.map +0 -1
- package/dist/chunk-LSB7GRLG.js.map +0 -1
- package/dist/chunk-TZ6YEYN4.js.map +0 -1
- package/dist/chunk-VA22KRHS.js +0 -15177
- package/dist/chunk-VA22KRHS.js.map +0 -1
- package/dist/chunk-Y3MLSLB4.js.map +0 -1
- /package/dist/{chunk-CADSX6UN.js.map → chunk-Y3KNXVTD.js.map} +0 -0
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
// Content-free product-analytics dimensions carried on durable facts and the
|
|
4
|
+
// optional host export. Every value comes from a fixed list or from OpenGeni's
|
|
5
|
+
// own code-defined names. None of them is an authorization input, and none
|
|
6
|
+
// may carry prompt text, tool arguments, customer names, tenant domains, or
|
|
7
|
+
// operator-configured identifiers.
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The product surface through which a turn's request entered OpenGeni.
|
|
11
|
+
*
|
|
12
|
+
* - `web`: the OpenGeni web app (managed cookie or the local browser context).
|
|
13
|
+
* - `slack`: a Slack mention, command, DM, shortcut, thread reply, or reaction.
|
|
14
|
+
* - `api_key`: an API key or configured key, including the SDK and scripts.
|
|
15
|
+
* - `embedded`: a host that embeds OpenGeni through signed delegation or an
|
|
16
|
+
* organization key acting for an external user.
|
|
17
|
+
* - `scheduled`: a scheduled-task occurrence.
|
|
18
|
+
* - `agent`: another agent (a child session, an agent message, or Agent Steer).
|
|
19
|
+
* - `voice`: a realtime voice delegation or its end-of-call handoff.
|
|
20
|
+
* - `site`: a published workspace Site.
|
|
21
|
+
* - `automation`: an event-triggered automation run.
|
|
22
|
+
* - `mcp`: an external MCP client connected through workspace MCP OAuth.
|
|
23
|
+
* - `system`: OpenGeni's own maintenance work with no human entry.
|
|
24
|
+
*
|
|
25
|
+
* Turns that no new request entered (goal continuations, child results,
|
|
26
|
+
* command results, wait timeouts, compaction) inherit the surface of the
|
|
27
|
+
* session's latest started turn. Null means no surface was captured: rows
|
|
28
|
+
* written before capture existed, or machine work in a session that has
|
|
29
|
+
* never started a turn with one.
|
|
30
|
+
*/
|
|
31
|
+
export const SESSION_TURN_SURFACES = [
|
|
32
|
+
"web",
|
|
33
|
+
"slack",
|
|
34
|
+
"api_key",
|
|
35
|
+
"embedded",
|
|
36
|
+
"scheduled",
|
|
37
|
+
"agent",
|
|
38
|
+
"voice",
|
|
39
|
+
"site",
|
|
40
|
+
"automation",
|
|
41
|
+
"mcp",
|
|
42
|
+
"system",
|
|
43
|
+
] as const;
|
|
44
|
+
export const SessionTurnSurface = z.enum(SESSION_TURN_SURFACES);
|
|
45
|
+
export type SessionTurnSurface = z.infer<typeof SessionTurnSurface>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Request header the first-party web console sends while its tab is visible
|
|
49
|
+
* and the person interacted with it in the last few minutes. The API records
|
|
50
|
+
* server-side presence (`opengeni_active_users`, `user.active`) only for
|
|
51
|
+
* canonical managed browser sessions carrying this exact value, so an idle open
|
|
52
|
+
* tab, background polling and stream re-authorization never count as activity.
|
|
53
|
+
* Analytics only: it never grants or narrows access.
|
|
54
|
+
*/
|
|
55
|
+
export const OPENGENI_USER_ACTIVITY_HEADER = "x-opengeni-user-activity";
|
|
56
|
+
export const OPENGENI_USER_ACTIVITY_ACTIVE = "active";
|
|
57
|
+
/** Interaction recency, in milliseconds, behind the activity header. */
|
|
58
|
+
export const OPENGENI_USER_ACTIVITY_WINDOW_MS = 5 * 60_000;
|
|
59
|
+
|
|
60
|
+
/** Parse a stored value; anything outside the fixed list is treated as absent. */
|
|
61
|
+
export function sessionTurnSurfaceOrNull(value: unknown): SessionTurnSurface | null {
|
|
62
|
+
const parsed = SessionTurnSurface.safeParse(value);
|
|
63
|
+
return parsed.success ? parsed.data : null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Model provider families exported for analytics. Reserved OpenGeni provider
|
|
68
|
+
* ids pass through unchanged; every operator-configured registry provider is
|
|
69
|
+
* reported as `registry` so a deployment's own naming never leaves it.
|
|
70
|
+
* `opengeni_private.analytics_model_provider` (migration 0533) mirrors this.
|
|
71
|
+
*/
|
|
72
|
+
export const ANALYTICS_MODEL_PROVIDERS = [
|
|
73
|
+
"openai",
|
|
74
|
+
"azure",
|
|
75
|
+
"codex-subscription",
|
|
76
|
+
"supergrok-subscription",
|
|
77
|
+
"opengeni-gateway",
|
|
78
|
+
"workspace-gateway",
|
|
79
|
+
"organization-gateway",
|
|
80
|
+
"openrouter",
|
|
81
|
+
"workspace-openrouter",
|
|
82
|
+
"organization-openrouter",
|
|
83
|
+
"registry",
|
|
84
|
+
] as const;
|
|
85
|
+
export const AnalyticsModelProvider = z.enum(ANALYTICS_MODEL_PROVIDERS);
|
|
86
|
+
export type AnalyticsModelProvider = z.infer<typeof AnalyticsModelProvider>;
|
|
87
|
+
|
|
88
|
+
const RESERVED_ANALYTICS_MODEL_PROVIDERS: ReadonlySet<string> = new Set(
|
|
89
|
+
ANALYTICS_MODEL_PROVIDERS.filter((provider) => provider !== "registry"),
|
|
90
|
+
);
|
|
91
|
+
const REGISTRY_PROVIDER_ID = /^[A-Za-z0-9_-]{1,128}$/u;
|
|
92
|
+
|
|
93
|
+
/** Map an accepted turn's execution-policy provider id to its analytics family. */
|
|
94
|
+
export function analyticsModelProvider(
|
|
95
|
+
providerId: string | null | undefined,
|
|
96
|
+
): AnalyticsModelProvider | null {
|
|
97
|
+
if (typeof providerId !== "string") return null;
|
|
98
|
+
if (RESERVED_ANALYTICS_MODEL_PROVIDERS.has(providerId)) {
|
|
99
|
+
return providerId as AnalyticsModelProvider;
|
|
100
|
+
}
|
|
101
|
+
return REGISTRY_PROVIDER_ID.test(providerId) ? "registry" : null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Tool family on a tool-call fact: an OpenGeni first-party tool name,
|
|
106
|
+
* `integration:<catalog domain>` for a reviewed catalog integration, or
|
|
107
|
+
* `custom` for any other MCP server (a workspace's own server, a self-hosted
|
|
108
|
+
* provider, or an unreviewed catalog entry). The domain part is limited to
|
|
109
|
+
* {@link TOOL_FAMILY_INTEGRATION_DOMAINS}, so a tenant's own host name is
|
|
110
|
+
* never exported.
|
|
111
|
+
*/
|
|
112
|
+
export const ToolFamily = z
|
|
113
|
+
.string()
|
|
114
|
+
.max(160)
|
|
115
|
+
.regex(/^(?:custom|integration:[a-z0-9](?:[a-z0-9.-]{0,150}[a-z0-9])?|[a-z][a-z0-9_]{0,63})$/u);
|
|
116
|
+
export type ToolFamily = z.infer<typeof ToolFamily>;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Reviewed integration domains that may appear as `integration:<domain>`:
|
|
120
|
+
* OpenGeni's native provider domains plus the MCP host of every curated
|
|
121
|
+
* catalog entry (`data/catalog/curated.json`). A test keeps the curated part
|
|
122
|
+
* in sync. Any other domain is reported as `custom`.
|
|
123
|
+
*/
|
|
124
|
+
export const TOOL_FAMILY_INTEGRATION_DOMAINS = [
|
|
125
|
+
// Native provider domains.
|
|
126
|
+
"github.com",
|
|
127
|
+
"gitlab.com",
|
|
128
|
+
"dev.azure.com",
|
|
129
|
+
"slack.com",
|
|
130
|
+
"chatgpt.com",
|
|
131
|
+
"x.com",
|
|
132
|
+
"reddit.com",
|
|
133
|
+
"fiken.no",
|
|
134
|
+
"api.atlassian.com",
|
|
135
|
+
"googleapis.com",
|
|
136
|
+
// Curated catalog MCP hosts.
|
|
137
|
+
"gmailmcp.googleapis.com",
|
|
138
|
+
"mcp.slack.com",
|
|
139
|
+
"api.mobbin.com",
|
|
140
|
+
"mcp.linear.app",
|
|
141
|
+
"mcp.asana.com",
|
|
142
|
+
"mcp.stripe.com",
|
|
143
|
+
"mcp.figma.com",
|
|
144
|
+
"mcp.canva.com",
|
|
145
|
+
"mcp.sentry.dev",
|
|
146
|
+
"mcp.vercel.com",
|
|
147
|
+
"bindings.mcp.cloudflare.com",
|
|
148
|
+
"mcp.paypal.com",
|
|
149
|
+
"mcp.monday.com",
|
|
150
|
+
"mcp.airtable.com",
|
|
151
|
+
"mcp.zapier.com",
|
|
152
|
+
"mcp.webflow.com",
|
|
153
|
+
"mcp.supabase.com",
|
|
154
|
+
"mcp.clickup.com",
|
|
155
|
+
"mcp.calendly.com",
|
|
156
|
+
"mcp.box.com",
|
|
157
|
+
"mcp.dropbox.com",
|
|
158
|
+
"mcp.amplitude.com",
|
|
159
|
+
"mcp.posthog.com",
|
|
160
|
+
"mcp.pagerduty.com",
|
|
161
|
+
"mcp.apollo.io",
|
|
162
|
+
"api.ahrefs.com",
|
|
163
|
+
"mcp.semrush.com",
|
|
164
|
+
"mcp.frontapp.com",
|
|
165
|
+
"mcp.otter.ai",
|
|
166
|
+
"mcp.notion.com",
|
|
167
|
+
"mcp.hubspot.com",
|
|
168
|
+
"mcp.atlassian.com",
|
|
169
|
+
"mcp.intercom.com",
|
|
170
|
+
] as const;
|
|
171
|
+
|
|
172
|
+
const TOOL_FAMILY_INTEGRATION_DOMAIN_SET: ReadonlySet<string> = new Set(
|
|
173
|
+
TOOL_FAMILY_INTEGRATION_DOMAINS,
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
function normalizedDomain(value: string | null | undefined): string | null {
|
|
177
|
+
if (typeof value !== "string") return null;
|
|
178
|
+
const domain = value.trim().toLowerCase().replace(/\.$/u, "");
|
|
179
|
+
return domain.length > 0 ? domain : null;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Tool family for an MCP server that is not first-party. The first candidate
|
|
184
|
+
* domain on the reviewed list wins; otherwise the server is `custom`.
|
|
185
|
+
*/
|
|
186
|
+
export function integrationToolFamily(
|
|
187
|
+
candidateDomains: readonly (string | null | undefined)[],
|
|
188
|
+
): ToolFamily {
|
|
189
|
+
for (const candidate of candidateDomains) {
|
|
190
|
+
const domain = normalizedDomain(candidate);
|
|
191
|
+
if (domain && TOOL_FAMILY_INTEGRATION_DOMAIN_SET.has(domain)) {
|
|
192
|
+
return `integration:${domain}`;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return "custom";
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* First-party tools the runtime exposes outside any MCP server: base sandbox
|
|
200
|
+
* and runtime tools, progressive-disclosure routers, media generation, and
|
|
201
|
+
* provider-hosted tool calls as the event stream names them.
|
|
202
|
+
*/
|
|
203
|
+
export const FIRST_PARTY_FUNCTION_TOOL_FAMILY_NAMES = [
|
|
204
|
+
"exec_command",
|
|
205
|
+
"write_stdin",
|
|
206
|
+
"view_image",
|
|
207
|
+
"apply_patch",
|
|
208
|
+
"skill_read",
|
|
209
|
+
"repository_skill_read",
|
|
210
|
+
"request_human_input",
|
|
211
|
+
"list_models",
|
|
212
|
+
"code_search",
|
|
213
|
+
"tool_search",
|
|
214
|
+
"tool_list",
|
|
215
|
+
"tool_invoke",
|
|
216
|
+
"generate_image",
|
|
217
|
+
"generate_video",
|
|
218
|
+
"get_video_generation_capabilities",
|
|
219
|
+
"computer_screenshot",
|
|
220
|
+
"web_search_call",
|
|
221
|
+
"image_generation_call",
|
|
222
|
+
"code_interpreter_call",
|
|
223
|
+
"file_search_call",
|
|
224
|
+
"computer_call",
|
|
225
|
+
"local_shell_call",
|
|
226
|
+
"shell_call",
|
|
227
|
+
"apply_patch_call",
|
|
228
|
+
] as const;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* First-party tools served by in-process attempt definitions or the dedicated
|
|
232
|
+
* `files` server rather than the public `opengeni` MCP catalog.
|
|
233
|
+
*/
|
|
234
|
+
export const FIRST_PARTY_ATTEMPT_TOOL_FAMILY_NAMES = [
|
|
235
|
+
"skill_checkout",
|
|
236
|
+
"skill_publish",
|
|
237
|
+
"skill_install",
|
|
238
|
+
"skill_remove",
|
|
239
|
+
"skill_save",
|
|
240
|
+
"skill_search",
|
|
241
|
+
"operation_read",
|
|
242
|
+
"knowledge_source_fetch",
|
|
243
|
+
"knowledge_source_read",
|
|
244
|
+
"files_get_download_url",
|
|
245
|
+
] as const;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* OpenGeni's in-process integration tools that are not registry MCP servers,
|
|
249
|
+
* keyed by their catalog server id, with the provider domain they act on.
|
|
250
|
+
*/
|
|
251
|
+
export const IN_PROCESS_INTEGRATION_TOOL_FAMILY_DOMAINS: Readonly<Record<string, string>> = {
|
|
252
|
+
"google-drive-publishing": "googleapis.com",
|
|
253
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content-free per-person product lifecycle facts.
|
|
3
|
+
*
|
|
4
|
+
* Migration `0532_product_lifecycle_fact_export.sql` captures one fact per
|
|
5
|
+
* product change with row triggers and writes it to the durable host export as
|
|
6
|
+
* the `lifecycle_fact` kind; `0565_usage_analytics_presence_and_facts.sql` adds
|
|
7
|
+
* `user.active`, `credits.granted` and `connection.revoked`. Every value is drawn from a fixed list; the
|
|
8
|
+
* database function `opengeni_private.product_lifecycle_fact_valid` enforces
|
|
9
|
+
* the same lists and a test keeps the two copies identical.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Closed class of a positive credit grant (`grant` or `manual_credit_grant`
|
|
14
|
+
* ledger row). `opengeni_private.credit_grant_class` mirrors this mapping:
|
|
15
|
+
* - `signup_trial`: the one-time verified-signup trial (source `verified_signup_trial`).
|
|
16
|
+
* - `coupon`: a fully discounted Stripe checkout (source `stripe_checkout_coupon`).
|
|
17
|
+
* - `manual`: an operator grant (`manual_credit_grant` or source `operator_adjustment`).
|
|
18
|
+
* - `other`: any other grant source.
|
|
19
|
+
*/
|
|
20
|
+
export const CREDIT_GRANT_CLASSES = ["signup_trial", "coupon", "manual", "other"] as const;
|
|
21
|
+
export type CreditGrantClass = (typeof CREDIT_GRANT_CLASSES)[number];
|
|
22
|
+
|
|
23
|
+
const CONNECTION_PROVIDER_CLASSES = [
|
|
24
|
+
"slack",
|
|
25
|
+
"github",
|
|
26
|
+
"gitlab",
|
|
27
|
+
"azure_devops",
|
|
28
|
+
"bitbucket",
|
|
29
|
+
"google",
|
|
30
|
+
"microsoft",
|
|
31
|
+
"linear",
|
|
32
|
+
"atlassian",
|
|
33
|
+
"notion",
|
|
34
|
+
"supabase",
|
|
35
|
+
"datadog",
|
|
36
|
+
"posthog",
|
|
37
|
+
"openai",
|
|
38
|
+
"x",
|
|
39
|
+
"other",
|
|
40
|
+
] as const;
|
|
41
|
+
|
|
42
|
+
/** Each fact type and the fixed values its `attribute` may carry. */
|
|
43
|
+
export const PRODUCT_LIFECYCLE_FACT_ATTRIBUTES = {
|
|
44
|
+
/** A managed account was created. Attribute: first sign-in method. */
|
|
45
|
+
"auth.sign_up": ["email", "google", "github", "other"],
|
|
46
|
+
/**
|
|
47
|
+
* The account email became verified: by the verification link, or at
|
|
48
|
+
* creation when a social provider already verified it.
|
|
49
|
+
*/
|
|
50
|
+
"auth.email_verified": [],
|
|
51
|
+
/** A live sign-in session was created. Attribute: method of that session. */
|
|
52
|
+
"auth.sign_in": ["email", "google", "github", "other"],
|
|
53
|
+
/** An organization was created by self-service setup or as an additional one. */
|
|
54
|
+
"organization.setup": ["created", "additional"],
|
|
55
|
+
/** A model subscription or organization model provider was connected. */
|
|
56
|
+
"model.connected": [
|
|
57
|
+
"codex",
|
|
58
|
+
"supergrok",
|
|
59
|
+
"vercel_gateway",
|
|
60
|
+
"openrouter",
|
|
61
|
+
"anthropic",
|
|
62
|
+
"claude_subscription",
|
|
63
|
+
],
|
|
64
|
+
/** A credit top-up payment was granted. */
|
|
65
|
+
"credits.purchased": [],
|
|
66
|
+
/** Credits were granted without a purchase. Attribute: grant class. */
|
|
67
|
+
"credits.granted": CREDIT_GRANT_CLASSES,
|
|
68
|
+
/** An integration connection was created. Attribute: provider class. */
|
|
69
|
+
"connection.created": CONNECTION_PROVIDER_CLASSES,
|
|
70
|
+
/**
|
|
71
|
+
* An integration connection was revoked, or deleted while still live.
|
|
72
|
+
* Attribute: provider class, the same list as `connection.created`.
|
|
73
|
+
*/
|
|
74
|
+
"connection.revoked": CONNECTION_PROVIDER_CLASSES,
|
|
75
|
+
"scheduled_task.created": [],
|
|
76
|
+
/** A catalog Skill was installed into a workspace. */
|
|
77
|
+
"skill.installed": [],
|
|
78
|
+
/** A Slack user was linked to an OpenGeni user. */
|
|
79
|
+
"slack.user_linked": [],
|
|
80
|
+
/** A new Connected Machine was enrolled. */
|
|
81
|
+
"machine.enrolled": [],
|
|
82
|
+
/** A person became an active member of an organization that already had one. */
|
|
83
|
+
"member.joined": [],
|
|
84
|
+
/**
|
|
85
|
+
* A managed person was active in an authenticated browser session on a new
|
|
86
|
+
* UTC day: at most one fact per person per UTC day, with no organization.
|
|
87
|
+
*/
|
|
88
|
+
"user.active": [],
|
|
89
|
+
} as const satisfies Record<string, readonly string[]>;
|
|
90
|
+
|
|
91
|
+
export type ProductLifecycleFactType = keyof typeof PRODUCT_LIFECYCLE_FACT_ATTRIBUTES;
|
|
92
|
+
|
|
93
|
+
export const PRODUCT_LIFECYCLE_FACT_TYPES = Object.keys(
|
|
94
|
+
PRODUCT_LIFECYCLE_FACT_ATTRIBUTES,
|
|
95
|
+
) as ProductLifecycleFactType[];
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* What kind of subject caused the fact. Only `user` and `api_key` facts carry
|
|
99
|
+
* their opaque subject id; every other subject string is reduced to its kind
|
|
100
|
+
* because embedded hosts may put their own identifiers in it.
|
|
101
|
+
*/
|
|
102
|
+
export const PRODUCT_LIFECYCLE_SUBJECT_KINDS = [
|
|
103
|
+
"user",
|
|
104
|
+
"api_key",
|
|
105
|
+
"service",
|
|
106
|
+
"other",
|
|
107
|
+
"none",
|
|
108
|
+
] as const;
|
|
109
|
+
export type ProductLifecycleSubjectKind = (typeof PRODUCT_LIFECYCLE_SUBJECT_KINDS)[number];
|
|
110
|
+
|
|
111
|
+
/** Pseudonymous subject ids that may leave the database. */
|
|
112
|
+
export const PRODUCT_LIFECYCLE_SUBJECT_ID_PATTERN = /^(user|api_key):[A-Za-z0-9_-]{8,128}$/;
|
|
113
|
+
|
|
114
|
+
export function isProductLifecycleFact(type: string, attribute: string | null): boolean {
|
|
115
|
+
if (!Object.hasOwn(PRODUCT_LIFECYCLE_FACT_ATTRIBUTES, type)) return false;
|
|
116
|
+
const allowed: readonly string[] =
|
|
117
|
+
PRODUCT_LIFECYCLE_FACT_ATTRIBUTES[type as ProductLifecycleFactType];
|
|
118
|
+
return allowed.length === 0
|
|
119
|
+
? attribute === null
|
|
120
|
+
: attribute !== null && allowed.includes(attribute);
|
|
121
|
+
}
|
package/src/remember.ts
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import {
|
|
3
|
+
AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_MAX_CHARS,
|
|
4
|
+
AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_TOO_LONG_MESSAGE,
|
|
5
|
+
AGENT_AUTHORED_PREFERENCE_CONTENT_MAX_CHARS,
|
|
6
|
+
AGENT_AUTHORED_PREFERENCE_CONTENT_TOO_LONG_MESSAGE,
|
|
7
|
+
} from "./agent-authored-durable-text";
|
|
8
|
+
import {
|
|
9
|
+
CompanyBrainLearningDecisionSummary,
|
|
10
|
+
CompanyBrainLearningStepFailure,
|
|
11
|
+
} from "./company-brain-governed-writes";
|
|
12
|
+
import { GovernedLearningActivationDestination } from "./governed-learning-activation";
|
|
13
|
+
import { HumanInputQuestion } from "./index";
|
|
14
|
+
import {
|
|
15
|
+
PREFERENCE_REGISTRY_DESCRIPTOR_DESCRIPTION_MAX_CHARS,
|
|
16
|
+
PREFERENCE_REGISTRY_TITLE_MAX_CHARS,
|
|
17
|
+
PreferenceRegistryStableKey,
|
|
18
|
+
} from "./preference-registry";
|
|
19
|
+
import { WorkspaceInstructionPolicyTarget } from "./workspace-instruction-policies";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Explicit user-directed durable write ("remember X for this workspace").
|
|
23
|
+
*
|
|
24
|
+
* The lane is the Agent Knowledge area the content belongs to:
|
|
25
|
+
* - `preference`: a Ways-of-working preference (how agents should act);
|
|
26
|
+
* - `instruction_policy`: a mandatory workspace rule ("always"/"never");
|
|
27
|
+
* - `knowledge`: a company/product/people fact.
|
|
28
|
+
*
|
|
29
|
+
* v1 supports the workspace scope only. Personal and organization scopes are
|
|
30
|
+
* separate authorities that are not yet active for governed writes.
|
|
31
|
+
*/
|
|
32
|
+
export const RememberLane = z.enum(["preference", "instruction_policy", "knowledge"]);
|
|
33
|
+
export type RememberLane = z.infer<typeof RememberLane>;
|
|
34
|
+
|
|
35
|
+
export const RememberScope = z.enum(["workspace"]);
|
|
36
|
+
export type RememberScope = z.infer<typeof RememberScope>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Ceiling for the Knowledge lane, which is retrieval evidence rather than
|
|
40
|
+
* always-composed prompt text. Other lanes have their own destination bounds:
|
|
41
|
+
* see `AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_MAX_CHARS` and
|
|
42
|
+
* `AGENT_AUTHORED_PREFERENCE_CONTENT_MAX_CHARS`.
|
|
43
|
+
*/
|
|
44
|
+
export const REMEMBER_CONTENT_MAX_CHARS = 4_000;
|
|
45
|
+
|
|
46
|
+
const rememberBase = {
|
|
47
|
+
operationId: z.string().uuid(),
|
|
48
|
+
scope: RememberScope.default("workspace"),
|
|
49
|
+
/** The exact user-directed content to remember, in the user's words. */
|
|
50
|
+
content: z.string().trim().min(1).max(REMEMBER_CONTENT_MAX_CHARS),
|
|
51
|
+
/** Why the agent believes the user asked for this to be remembered. */
|
|
52
|
+
reason: z.string().trim().min(1).max(4_096),
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const RememberRequest = z.discriminatedUnion("lane", [
|
|
56
|
+
z
|
|
57
|
+
.object({
|
|
58
|
+
...rememberBase,
|
|
59
|
+
lane: z.literal("preference"),
|
|
60
|
+
// Only the short title/description descriptors are prompt-composed; the
|
|
61
|
+
// content is retrieved on demand, so this length is retrieval cost rather
|
|
62
|
+
// than standing prompt cost.
|
|
63
|
+
content: z
|
|
64
|
+
.string()
|
|
65
|
+
.trim()
|
|
66
|
+
.min(1)
|
|
67
|
+
.max(
|
|
68
|
+
AGENT_AUTHORED_PREFERENCE_CONTENT_MAX_CHARS,
|
|
69
|
+
AGENT_AUTHORED_PREFERENCE_CONTENT_TOO_LONG_MESSAGE,
|
|
70
|
+
),
|
|
71
|
+
stableKey: PreferenceRegistryStableKey,
|
|
72
|
+
title: z.string().trim().min(1).max(PREFERENCE_REGISTRY_TITLE_MAX_CHARS),
|
|
73
|
+
description: z
|
|
74
|
+
.string()
|
|
75
|
+
.trim()
|
|
76
|
+
.min(1)
|
|
77
|
+
.max(PREFERENCE_REGISTRY_DESCRIPTOR_DESCRIPTION_MAX_CHARS),
|
|
78
|
+
})
|
|
79
|
+
.strict(),
|
|
80
|
+
z
|
|
81
|
+
.object({
|
|
82
|
+
...rememberBase,
|
|
83
|
+
lane: z.literal("instruction_policy"),
|
|
84
|
+
// A mandatory rule is composed verbatim into the prompt of every session
|
|
85
|
+
// it applies to, for as long as it stays active. Its storage bound is
|
|
86
|
+
// shared with the human workspace-instruction editor.
|
|
87
|
+
content: z
|
|
88
|
+
.string()
|
|
89
|
+
.trim()
|
|
90
|
+
.min(1)
|
|
91
|
+
.max(
|
|
92
|
+
AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_MAX_CHARS,
|
|
93
|
+
AGENT_AUTHORED_INSTRUCTION_POLICY_CONTENT_TOO_LONG_MESSAGE,
|
|
94
|
+
),
|
|
95
|
+
target: WorkspaceInstructionPolicyTarget.default({
|
|
96
|
+
kind: "policy",
|
|
97
|
+
scope: "global",
|
|
98
|
+
roleKey: null,
|
|
99
|
+
}),
|
|
100
|
+
})
|
|
101
|
+
.strict(),
|
|
102
|
+
z
|
|
103
|
+
.object({
|
|
104
|
+
...rememberBase,
|
|
105
|
+
lane: z.literal("knowledge"),
|
|
106
|
+
/** Short entity label the fact is about (company, product, person, team, ...). */
|
|
107
|
+
subject: z.string().trim().min(1).max(512),
|
|
108
|
+
})
|
|
109
|
+
.strict(),
|
|
110
|
+
]);
|
|
111
|
+
export type RememberRequest = z.infer<typeof RememberRequest>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Bound structured human-input question that authorizes a confirmed remember.
|
|
115
|
+
* The question id binds the exact confirmation target: the
|
|
116
|
+
* `knowledge_change_proposals` id for Ways-of-working lanes, or the
|
|
117
|
+
* `knowledge_claims` id for the Knowledge lane.
|
|
118
|
+
*/
|
|
119
|
+
export const REMEMBER_HUMAN_INPUT_SAVE_OPTION = "save" as const;
|
|
120
|
+
export const REMEMBER_HUMAN_INPUT_SKIP_OPTION = "skip" as const;
|
|
121
|
+
export function rememberHumanInputQuestionId(targetId: string): string {
|
|
122
|
+
return `remember:${targetId}`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// z.lazy: this module is re-exported from ./index, so resolve the question
|
|
126
|
+
// schema at parse time instead of at import time.
|
|
127
|
+
export const RememberHumanInputPrompt = z.object({
|
|
128
|
+
questions: z.array(z.lazy(() => HumanInputQuestion)).length(1),
|
|
129
|
+
allowSkip: z.literal(false),
|
|
130
|
+
});
|
|
131
|
+
export type RememberHumanInputPrompt = z.infer<typeof RememberHumanInputPrompt>;
|
|
132
|
+
|
|
133
|
+
export const RememberActivationSummary = z.discriminatedUnion("destination", [
|
|
134
|
+
z.object({
|
|
135
|
+
destination: GovernedLearningActivationDestination,
|
|
136
|
+
receiptId: z.string().uuid(),
|
|
137
|
+
destinationRevisionId: z.string().uuid().nullable(),
|
|
138
|
+
effectiveAt: z.string().datetime().nullable(),
|
|
139
|
+
authorityKind: z.enum(["automatic", "human_confirmed"]),
|
|
140
|
+
/** The `/learning` API/SDK history exposes exact undo for this receipt. */
|
|
141
|
+
undo: z.literal("learning_history"),
|
|
142
|
+
}),
|
|
143
|
+
z.object({
|
|
144
|
+
destination: z.literal("knowledge"),
|
|
145
|
+
receiptId: z.string().uuid(),
|
|
146
|
+
claimId: z.string().uuid(),
|
|
147
|
+
/** The retrievable Memory record materialized from the approved claim. */
|
|
148
|
+
memoryId: z.string().uuid(),
|
|
149
|
+
approvalReviewId: z.string().uuid(),
|
|
150
|
+
effectiveAt: z.string().datetime().nullable(),
|
|
151
|
+
authorityKind: z.literal("human_confirmed"),
|
|
152
|
+
/** Correct or archive the materialized record through the Memory lifecycle. */
|
|
153
|
+
undo: z.literal("memory_management"),
|
|
154
|
+
}),
|
|
155
|
+
]);
|
|
156
|
+
export type RememberActivationSummary = z.infer<typeof RememberActivationSummary>;
|
|
157
|
+
|
|
158
|
+
export const RememberReceipt = z.discriminatedUnion("status", [
|
|
159
|
+
/** Learning policy is off for this source: nothing durable was written. */
|
|
160
|
+
z.object({
|
|
161
|
+
status: z.literal("blocked"),
|
|
162
|
+
operationId: z.string().uuid(),
|
|
163
|
+
lane: RememberLane,
|
|
164
|
+
scope: RememberScope,
|
|
165
|
+
reason: z.literal("learning_policy_off"),
|
|
166
|
+
}),
|
|
167
|
+
/** Kept for callers that still expect review-only Knowledge; not returned by `remember` today. */
|
|
168
|
+
z.object({
|
|
169
|
+
status: z.literal("proposed_for_review"),
|
|
170
|
+
operationId: z.string().uuid(),
|
|
171
|
+
lane: RememberLane,
|
|
172
|
+
scope: RememberScope,
|
|
173
|
+
noteId: z.string().uuid(),
|
|
174
|
+
claimId: z.string().uuid(),
|
|
175
|
+
evidenceId: z.string().uuid(),
|
|
176
|
+
reviewId: z.string().uuid().nullable(),
|
|
177
|
+
}),
|
|
178
|
+
/** Activated immediately (automatic policy) through the destination lifecycle. */
|
|
179
|
+
z.object({
|
|
180
|
+
status: z.literal("activated"),
|
|
181
|
+
operationId: z.string().uuid(),
|
|
182
|
+
lane: RememberLane,
|
|
183
|
+
scope: RememberScope,
|
|
184
|
+
noteId: z.string().uuid(),
|
|
185
|
+
proposalId: z.string().uuid(),
|
|
186
|
+
learning: CompanyBrainLearningDecisionSummary.nullable(),
|
|
187
|
+
activation: RememberActivationSummary,
|
|
188
|
+
}),
|
|
189
|
+
/**
|
|
190
|
+
* The proposal is durable but the workspace policy will not activate it on
|
|
191
|
+
* its own. The agent must ask the human exactly this question through the
|
|
192
|
+
* built-in `request_human_input` tool, then call `remember_confirm` with the
|
|
193
|
+
* returned request id.
|
|
194
|
+
*/
|
|
195
|
+
z.object({
|
|
196
|
+
status: z.literal("confirmation_required"),
|
|
197
|
+
operationId: z.string().uuid(),
|
|
198
|
+
lane: RememberLane,
|
|
199
|
+
scope: RememberScope,
|
|
200
|
+
noteId: z.string().uuid(),
|
|
201
|
+
/** Ways-of-working lanes confirm a change proposal; Knowledge confirms the claim. */
|
|
202
|
+
proposalId: z.string().uuid().nullable(),
|
|
203
|
+
claimId: z.string().uuid(),
|
|
204
|
+
learning: CompanyBrainLearningDecisionSummary.nullable(),
|
|
205
|
+
learningFailure: CompanyBrainLearningStepFailure.nullable(),
|
|
206
|
+
humanInput: RememberHumanInputPrompt,
|
|
207
|
+
confirmWith: z.literal("remember_confirm"),
|
|
208
|
+
}),
|
|
209
|
+
]);
|
|
210
|
+
export type RememberReceipt = z.infer<typeof RememberReceipt>;
|
|
211
|
+
|
|
212
|
+
export const RememberConfirmRequest = z.discriminatedUnion("target", [
|
|
213
|
+
z
|
|
214
|
+
.object({
|
|
215
|
+
target: z.literal("proposal"),
|
|
216
|
+
operationId: z.string().uuid(),
|
|
217
|
+
proposalId: z.string().uuid(),
|
|
218
|
+
/** `learning.receiptId` from the `confirmation_required` remember receipt. */
|
|
219
|
+
decisionReceiptId: z.string().uuid(),
|
|
220
|
+
/** The `requestId` returned by `request_human_input`. */
|
|
221
|
+
humanInputRequestId: z.string().uuid(),
|
|
222
|
+
})
|
|
223
|
+
.strict(),
|
|
224
|
+
z
|
|
225
|
+
.object({
|
|
226
|
+
target: z.literal("knowledge_claim"),
|
|
227
|
+
operationId: z.string().uuid(),
|
|
228
|
+
claimId: z.string().uuid(),
|
|
229
|
+
humanInputRequestId: z.string().uuid(),
|
|
230
|
+
})
|
|
231
|
+
.strict(),
|
|
232
|
+
]);
|
|
233
|
+
export type RememberConfirmRequest = z.infer<typeof RememberConfirmRequest>;
|
|
234
|
+
|
|
235
|
+
export const RememberConfirmReceipt = z.object({
|
|
236
|
+
status: z.literal("activated"),
|
|
237
|
+
operationId: z.string().uuid(),
|
|
238
|
+
proposalId: z.string().uuid().nullable(),
|
|
239
|
+
claimId: z.string().uuid(),
|
|
240
|
+
decisionReceiptId: z.string().uuid().nullable(),
|
|
241
|
+
activation: RememberActivationSummary,
|
|
242
|
+
});
|
|
243
|
+
export type RememberConfirmReceipt = z.infer<typeof RememberConfirmReceipt>;
|
package/src/retained-output.ts
CHANGED
|
@@ -35,6 +35,7 @@ export const RetainedOutputKind = z.enum([
|
|
|
35
35
|
"internal_update",
|
|
36
36
|
"event_media",
|
|
37
37
|
"computer_screenshot",
|
|
38
|
+
"browser_screenshot",
|
|
38
39
|
"generated_image",
|
|
39
40
|
"generated_video",
|
|
40
41
|
"file",
|
|
@@ -124,6 +125,7 @@ export const RetainedArtifactReferenceSchema = z
|
|
|
124
125
|
|
|
125
126
|
if (
|
|
126
127
|
value.kind === "computer_screenshot" ||
|
|
128
|
+
value.kind === "browser_screenshot" ||
|
|
127
129
|
value.kind === "generated_image" ||
|
|
128
130
|
value.kind === "generated_video"
|
|
129
131
|
) {
|
|
@@ -187,12 +189,12 @@ export const RetainedArtifactReferenceSchema = z
|
|
|
187
189
|
}
|
|
188
190
|
}
|
|
189
191
|
|
|
190
|
-
if (value.kind === "computer_screenshot") {
|
|
192
|
+
if (value.kind === "computer_screenshot" || value.kind === "browser_screenshot") {
|
|
191
193
|
if (value.retention.policy !== "session_screenshot" || !sessionMatch) {
|
|
192
194
|
ctx.addIssue({
|
|
193
195
|
code: "custom",
|
|
194
196
|
path: ["retention"],
|
|
195
|
-
message: "
|
|
197
|
+
message: "session screenshots require session-scoped expiring retrieval",
|
|
196
198
|
});
|
|
197
199
|
}
|
|
198
200
|
}
|
|
@@ -252,8 +254,23 @@ export type RetainedScreenshotArtifactInput = RetainedArtifactFileInput & {
|
|
|
252
254
|
width: number;
|
|
253
255
|
height: number;
|
|
254
256
|
expiresAt: string;
|
|
257
|
+
kind?: "computer_screenshot" | "browser_screenshot";
|
|
255
258
|
};
|
|
256
259
|
|
|
260
|
+
export type RetainedSessionScreenshotKind = "computer_screenshot" | "browser_screenshot";
|
|
261
|
+
|
|
262
|
+
/** The persisted, server-authored storage key distinguishes browser captures from legacy computer captures. */
|
|
263
|
+
export function retainedSessionScreenshotKindFromObjectKey(
|
|
264
|
+
objectKey: string,
|
|
265
|
+
): RetainedSessionScreenshotKind | null {
|
|
266
|
+
const match =
|
|
267
|
+
/^workspaces\/[0-9a-f-]+\/files\/[0-9a-f-]+\/retained\/(session-image|computer-screenshot|screenshot|browser-screenshot)\.(png|jpg|webp)$/.exec(
|
|
268
|
+
objectKey,
|
|
269
|
+
);
|
|
270
|
+
if (!match) return null;
|
|
271
|
+
return match[1] === "browser-screenshot" ? "browser_screenshot" : "computer_screenshot";
|
|
272
|
+
}
|
|
273
|
+
|
|
257
274
|
export type RetainedGeneratedImageArtifactInput = RetainedArtifactFileInput & {
|
|
258
275
|
width: number;
|
|
259
276
|
height: number;
|
|
@@ -305,7 +322,7 @@ export function retainedScreenshotReferenceFromFile(
|
|
|
305
322
|
const value = {
|
|
306
323
|
available: true as const,
|
|
307
324
|
artifactId: file.id,
|
|
308
|
-
kind: "computer_screenshot"
|
|
325
|
+
kind: file.kind ?? "computer_screenshot",
|
|
309
326
|
contentType: canonicalRetainedContentType(file.contentType),
|
|
310
327
|
originalBytes: file.sizeBytes,
|
|
311
328
|
sha256: file.sha256,
|