@opengeni/contracts 0.50.0 → 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 +26 -12
- 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/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-M5ZGRVIQ.js → chunk-5IXYF6XN.js} +14 -5
- 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-CM6BMECR.js → chunk-GRG7PHWQ.js} +2 -1
- package/dist/chunk-GRG7PHWQ.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-LW7OH6CS.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-JBCIY7QD.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/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 +18 -8
- 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 +47 -35
- 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 +90 -16
- 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 +32396 -11386
- package/dist/index.js +2198 -164
- 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 +344 -0
- package/dist/knowledge-entries.d.ts +982 -0
- package/dist/knowledge-preparation.d.ts +237 -0
- package/dist/knowledge.d.ts +197 -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/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 +42 -1
- 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 +3 -0
- package/dist/video-generation.js +1 -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 +3 -0
- package/dist/xai-provider-account-authority.js +1 -1
- package/package.json +134 -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/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/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 +7093 -1466
- package/src/insights-usage.ts +679 -0
- package/src/interaction.ts +220 -5
- package/src/knowledge-entries.ts +375 -0
- package/src/knowledge-preparation.ts +50 -0
- package/src/knowledge.ts +134 -6
- 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/spreadsheet-artifact-commands.ts +12 -13
- package/src/subscription-account-pools.ts +44 -0
- package/src/task-notes.ts +14 -1
- package/src/tool-catalog.ts +155 -0
- package/src/tool-result-spill.ts +35 -0
- package/src/usage-allowances.ts +187 -0
- 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 +1 -0
- 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-CM6BMECR.js.map +0 -1
- package/dist/chunk-JBCIY7QD.js.map +0 -1
- package/dist/chunk-LSB7GRLG.js.map +0 -1
- package/dist/chunk-LW7OH6CS.js.map +0 -1
- package/dist/chunk-M5ZGRVIQ.js.map +0 -1
- package/dist/chunk-Q6A7XT2N.js +0 -16734
- package/dist/chunk-Q6A7XT2N.js.map +0 -1
- package/dist/chunk-TZ6YEYN4.js.map +0 -1
- package/dist/chunk-Y3MLSLB4.js.map +0 -1
- /package/dist/{chunk-CADSX6UN.js.map → chunk-Y3KNXVTD.js.map} +0 -0
package/src/artifacts.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { ToolGatewayIdentity } from "./tool-catalog";
|
|
2
3
|
|
|
3
|
-
export const WORKSPACE_ARTIFACT_HTML_MAX_UTF8_BYTES =
|
|
4
|
+
export const WORKSPACE_ARTIFACT_HTML_MAX_UTF8_BYTES = 5_000_000_000;
|
|
5
|
+
export const WORKSPACE_ARTIFACT_SOURCE_MAX_UTF8_BYTES = 5_000_000_000;
|
|
6
|
+
export const WORKSPACE_ARTIFACT_SOURCE_MAX_FILES = Number.MAX_SAFE_INTEGER;
|
|
7
|
+
export const WORKSPACE_ARTIFACT_REQUESTED_TOOLS_MAX = 128;
|
|
4
8
|
export const WORKSPACE_ARTIFACT_TITLE_MAX_CHARS = 120;
|
|
5
9
|
export const WORKSPACE_ARTIFACT_DESCRIPTION_MAX_CHARS = 2_000;
|
|
6
10
|
export const WORKSPACE_ARTIFACT_LIST_MAX = 100;
|
|
@@ -21,6 +25,84 @@ export type WorkspaceArtifactSlug = z.infer<typeof WorkspaceArtifactSlug>;
|
|
|
21
25
|
export const WorkspaceArtifactStatus = z.enum(["active", "archived"]);
|
|
22
26
|
export type WorkspaceArtifactStatus = z.infer<typeof WorkspaceArtifactStatus>;
|
|
23
27
|
|
|
28
|
+
export const WorkspaceArtifactSourcePath = z
|
|
29
|
+
.string()
|
|
30
|
+
.min(1)
|
|
31
|
+
.max(256)
|
|
32
|
+
.regex(/^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*$/u)
|
|
33
|
+
.refine(
|
|
34
|
+
(value) =>
|
|
35
|
+
!value
|
|
36
|
+
.split("/")
|
|
37
|
+
.some((segment) => segment === "." || segment === ".." || segment.length === 0),
|
|
38
|
+
{ message: "artifact source paths must be relative and traversal-free" },
|
|
39
|
+
);
|
|
40
|
+
export type WorkspaceArtifactSourcePath = z.infer<typeof WorkspaceArtifactSourcePath>;
|
|
41
|
+
|
|
42
|
+
export const WorkspaceArtifactSourceFile = z
|
|
43
|
+
.object({
|
|
44
|
+
path: WorkspaceArtifactSourcePath,
|
|
45
|
+
content: z.string(),
|
|
46
|
+
})
|
|
47
|
+
.strict();
|
|
48
|
+
export type WorkspaceArtifactSourceFile = z.infer<typeof WorkspaceArtifactSourceFile>;
|
|
49
|
+
|
|
50
|
+
/** Retained editable source; the published runtime remains one exact HTML document. */
|
|
51
|
+
export const WorkspaceArtifactSourceBundle = z
|
|
52
|
+
.object({
|
|
53
|
+
entrypoint: WorkspaceArtifactSourcePath,
|
|
54
|
+
files: z.array(WorkspaceArtifactSourceFile).min(1).max(WORKSPACE_ARTIFACT_SOURCE_MAX_FILES),
|
|
55
|
+
})
|
|
56
|
+
.strict()
|
|
57
|
+
.superRefine((value, context) => {
|
|
58
|
+
const paths = new Set<string>();
|
|
59
|
+
for (const [index, file] of value.files.entries()) {
|
|
60
|
+
if (paths.has(file.path)) {
|
|
61
|
+
context.addIssue({
|
|
62
|
+
code: "custom",
|
|
63
|
+
path: ["files", index, "path"],
|
|
64
|
+
message: "artifact source file paths must be unique",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
paths.add(file.path);
|
|
68
|
+
}
|
|
69
|
+
if (!paths.has(value.entrypoint)) {
|
|
70
|
+
context.addIssue({
|
|
71
|
+
code: "custom",
|
|
72
|
+
path: ["entrypoint"],
|
|
73
|
+
message: "artifact source entrypoint must name one retained file",
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
if (
|
|
77
|
+
encoder.encode(JSON.stringify(value)).byteLength > WORKSPACE_ARTIFACT_SOURCE_MAX_UTF8_BYTES
|
|
78
|
+
) {
|
|
79
|
+
context.addIssue({
|
|
80
|
+
code: "custom",
|
|
81
|
+
message: `artifact source exceeds ${WORKSPACE_ARTIFACT_SOURCE_MAX_UTF8_BYTES} UTF-8 bytes`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
export type WorkspaceArtifactSourceBundle = z.infer<typeof WorkspaceArtifactSourceBundle>;
|
|
86
|
+
|
|
87
|
+
export const WorkspaceArtifactRequestedTools = z
|
|
88
|
+
.array(ToolGatewayIdentity)
|
|
89
|
+
.max(WORKSPACE_ARTIFACT_REQUESTED_TOOLS_MAX)
|
|
90
|
+
.superRefine((tools, context) => {
|
|
91
|
+
const seen = new Set<string>();
|
|
92
|
+
for (const [index, identity] of tools.entries()) {
|
|
93
|
+
const key = `${identity.serverId}\u0000${identity.toolName}`;
|
|
94
|
+
if (seen.has(key)) {
|
|
95
|
+
context.addIssue({
|
|
96
|
+
code: "custom",
|
|
97
|
+
path: [index],
|
|
98
|
+
message: "requested artifact tools must be unique",
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
seen.add(key);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
export type WorkspaceArtifactRequestedTools = z.infer<typeof WorkspaceArtifactRequestedTools>;
|
|
105
|
+
|
|
24
106
|
export const WorkspaceArtifactVersion = z.object({
|
|
25
107
|
id: z.string().uuid(),
|
|
26
108
|
accountId: z.string().uuid(),
|
|
@@ -28,8 +110,16 @@ export const WorkspaceArtifactVersion = z.object({
|
|
|
28
110
|
artifactId: z.string().uuid(),
|
|
29
111
|
revision: z.number().int().positive(),
|
|
30
112
|
contentType: z.literal("text/html"),
|
|
31
|
-
contentSha256: sha256,
|
|
113
|
+
contentSha256: sha256.nullable(),
|
|
32
114
|
sizeBytes: z.number().int().positive().max(WORKSPACE_ARTIFACT_HTML_MAX_UTF8_BYTES),
|
|
115
|
+
sourceSha256: sha256.nullable(),
|
|
116
|
+
sourceSizeBytes: z
|
|
117
|
+
.number()
|
|
118
|
+
.int()
|
|
119
|
+
.positive()
|
|
120
|
+
.max(WORKSPACE_ARTIFACT_SOURCE_MAX_UTF8_BYTES)
|
|
121
|
+
.nullable(),
|
|
122
|
+
requestedTools: WorkspaceArtifactRequestedTools,
|
|
33
123
|
sourceSessionId: z.string().uuid().nullable(),
|
|
34
124
|
sourceTurnId: z.string().uuid().nullable(),
|
|
35
125
|
sourceAttemptId: z.string().uuid().nullable(),
|
|
@@ -54,7 +144,12 @@ export const WorkspaceArtifact = z.object({
|
|
|
54
144
|
});
|
|
55
145
|
export type WorkspaceArtifact = z.infer<typeof WorkspaceArtifact>;
|
|
56
146
|
|
|
57
|
-
export const WorkspaceArtifactEventType = z.enum([
|
|
147
|
+
export const WorkspaceArtifactEventType = z.enum([
|
|
148
|
+
"published",
|
|
149
|
+
"rolled_back",
|
|
150
|
+
"archived",
|
|
151
|
+
"restored",
|
|
152
|
+
]);
|
|
58
153
|
export type WorkspaceArtifactEventType = z.infer<typeof WorkspaceArtifactEventType>;
|
|
59
154
|
|
|
60
155
|
export const WorkspaceArtifactEvent = z.object({
|
|
@@ -83,6 +178,9 @@ export const WorkspaceArtifactListQuery = z.object({
|
|
|
83
178
|
.max(WORKSPACE_ARTIFACT_LIST_MAX)
|
|
84
179
|
.default(WORKSPACE_ARTIFACT_LIST_DEFAULT),
|
|
85
180
|
cursor: z.string().min(1).max(WORKSPACE_ARTIFACT_CURSOR_MAX_CHARS).optional(),
|
|
181
|
+
status: WorkspaceArtifactStatus.optional(),
|
|
182
|
+
/** Sites created or published by this session, including older versions. */
|
|
183
|
+
sourceSessionId: z.string().uuid().optional(),
|
|
86
184
|
});
|
|
87
185
|
export type WorkspaceArtifactListQuery = z.infer<typeof WorkspaceArtifactListQuery>;
|
|
88
186
|
|
|
@@ -115,22 +213,42 @@ export const WorkspaceArtifactHtml = z
|
|
|
115
213
|
}
|
|
116
214
|
});
|
|
117
215
|
|
|
118
|
-
export const CreateWorkspaceArtifactRequest = z
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
216
|
+
export const CreateWorkspaceArtifactRequest = z
|
|
217
|
+
.object({
|
|
218
|
+
slug: WorkspaceArtifactSlug.optional(),
|
|
219
|
+
title: z.string().trim().min(1).max(WORKSPACE_ARTIFACT_TITLE_MAX_CHARS),
|
|
220
|
+
description: z.string().max(WORKSPACE_ARTIFACT_DESCRIPTION_MAX_CHARS).nullable().optional(),
|
|
221
|
+
html: WorkspaceArtifactHtml.optional(),
|
|
222
|
+
uploadId: z.string().uuid().optional(),
|
|
223
|
+
source: WorkspaceArtifactSourceBundle.optional(),
|
|
224
|
+
requestedTools: WorkspaceArtifactRequestedTools.optional(),
|
|
225
|
+
idempotencyKey: z.string().trim().min(1).max(200),
|
|
226
|
+
})
|
|
227
|
+
.refine((value) => (value.html !== undefined) !== (value.uploadId !== undefined), {
|
|
228
|
+
message: "Provide either html or uploadId",
|
|
229
|
+
})
|
|
230
|
+
.refine((value) => !value.uploadId || value.source === undefined, {
|
|
231
|
+
message: "Upload source using the prepared source URL",
|
|
232
|
+
});
|
|
125
233
|
export type CreateWorkspaceArtifactRequest = z.infer<typeof CreateWorkspaceArtifactRequest>;
|
|
126
234
|
|
|
127
|
-
export const PublishWorkspaceArtifactVersionRequest = z
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
235
|
+
export const PublishWorkspaceArtifactVersionRequest = z
|
|
236
|
+
.object({
|
|
237
|
+
title: z.string().trim().min(1).max(WORKSPACE_ARTIFACT_TITLE_MAX_CHARS).optional(),
|
|
238
|
+
description: z.string().max(WORKSPACE_ARTIFACT_DESCRIPTION_MAX_CHARS).nullable().optional(),
|
|
239
|
+
html: WorkspaceArtifactHtml.optional(),
|
|
240
|
+
uploadId: z.string().uuid().optional(),
|
|
241
|
+
source: WorkspaceArtifactSourceBundle.optional(),
|
|
242
|
+
requestedTools: WorkspaceArtifactRequestedTools.optional(),
|
|
243
|
+
expectedCurrentVersionId: z.string().uuid(),
|
|
244
|
+
idempotencyKey: z.string().trim().min(1).max(200),
|
|
245
|
+
})
|
|
246
|
+
.refine((value) => (value.html !== undefined) !== (value.uploadId !== undefined), {
|
|
247
|
+
message: "Provide either html or uploadId",
|
|
248
|
+
})
|
|
249
|
+
.refine((value) => !value.uploadId || value.source === undefined, {
|
|
250
|
+
message: "Upload source using the prepared source URL",
|
|
251
|
+
});
|
|
134
252
|
export type PublishWorkspaceArtifactVersionRequest = z.infer<
|
|
135
253
|
typeof PublishWorkspaceArtifactVersionRequest
|
|
136
254
|
>;
|
|
@@ -143,6 +261,14 @@ export const RollbackWorkspaceArtifactRequest = z.object({
|
|
|
143
261
|
});
|
|
144
262
|
export type RollbackWorkspaceArtifactRequest = z.infer<typeof RollbackWorkspaceArtifactRequest>;
|
|
145
263
|
|
|
264
|
+
export const SetWorkspaceArtifactStatusRequest = z.object({
|
|
265
|
+
status: WorkspaceArtifactStatus,
|
|
266
|
+
expectedCurrentVersionId: z.string().uuid(),
|
|
267
|
+
reason: z.string().trim().min(1).max(4096),
|
|
268
|
+
idempotencyKey: z.string().trim().min(1).max(200),
|
|
269
|
+
});
|
|
270
|
+
export type SetWorkspaceArtifactStatusRequest = z.infer<typeof SetWorkspaceArtifactStatusRequest>;
|
|
271
|
+
|
|
146
272
|
export const WorkspaceArtifactMutationResponse = z.object({
|
|
147
273
|
artifact: WorkspaceArtifact,
|
|
148
274
|
version: WorkspaceArtifactVersion,
|
|
@@ -155,8 +281,10 @@ export const WorkspaceArtifactContentResponse = z.object({
|
|
|
155
281
|
artifactId: z.string().uuid(),
|
|
156
282
|
versionId: z.string().uuid(),
|
|
157
283
|
contentType: z.literal("text/html"),
|
|
158
|
-
contentSha256: sha256,
|
|
284
|
+
contentSha256: sha256.nullable(),
|
|
159
285
|
html: WorkspaceArtifactHtml,
|
|
286
|
+
source: WorkspaceArtifactSourceBundle,
|
|
287
|
+
requestedTools: WorkspaceArtifactRequestedTools,
|
|
160
288
|
});
|
|
161
289
|
export type WorkspaceArtifactContentResponse = z.infer<typeof WorkspaceArtifactContentResponse>;
|
|
162
290
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** The former API/Knowledge-sync adapter is historical; hosted Atlassian MCP remains supported. */
|
|
2
|
+
export const ATLASSIAN_NATIVE_RETIRED_REASON = "atlassian_native_retired" as const;
|
|
3
|
+
export const ATLASSIAN_NATIVE_RETIRED_MESSAGE =
|
|
4
|
+
"Jira and Confluence knowledge sync has been retired. Connect Atlassian agent tools to use its hosted MCP server.";
|
|
5
|
+
export const RETIRED_NATIVE_ATLASSIAN_TOOL_NAMES = [
|
|
6
|
+
"atlassian_sources_list",
|
|
7
|
+
"atlassian_search",
|
|
8
|
+
"atlassian_get",
|
|
9
|
+
] as const;
|
|
10
|
+
|
|
11
|
+
export function isRetiredNativeAtlassianTool(name: string): boolean {
|
|
12
|
+
return (RETIRED_NATIVE_ATLASSIAN_TOOL_NAMES as readonly string[]).includes(name);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Match the native source identity, never the hosted MCP provider or a display name. */
|
|
16
|
+
export function isRetiredNativeAtlassianSource(source: unknown): boolean {
|
|
17
|
+
if (!source || typeof source !== "object") return false;
|
|
18
|
+
const connection = (source as { connection?: unknown }).connection;
|
|
19
|
+
if (!connection || typeof connection !== "object") return false;
|
|
20
|
+
const provider = (connection as { providerDomain?: unknown }).providerDomain;
|
|
21
|
+
return typeof provider === "string" && provider.toLowerCase() === "api.atlassian.com";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Includes frozen historical source actions without changing their stored bytes. */
|
|
25
|
+
export function isRetiredNativeAtlassianTask(task: {
|
|
26
|
+
agentConfig?: { knowledgeSource?: unknown } | null;
|
|
27
|
+
action?: { kind?: unknown } | null;
|
|
28
|
+
}): boolean {
|
|
29
|
+
return (
|
|
30
|
+
isRetiredNativeAtlassianSource(task.agentConfig?.knowledgeSource) ||
|
|
31
|
+
(task.action?.kind === "knowledge_source_sync" && isRetiredNativeAtlassianSource(task.action))
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Persisted discriminator; null identity alone never implies ephemeral storage. */
|
|
2
|
+
export const EPHEMERAL_CHROMIUM_DRIVER_ID = "opengeni.cdp.ephemeral-context.v1" as const;
|
|
3
|
+
|
|
4
|
+
export function browserSessionStorageMode(session: {
|
|
5
|
+
driverId: string;
|
|
6
|
+
}): "private_profile" | "ephemeral_context" {
|
|
7
|
+
return session.driverId === EPHEMERAL_CHROMIUM_DRIVER_ID
|
|
8
|
+
? "ephemeral_context"
|
|
9
|
+
: "private_profile";
|
|
10
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const BundledSkillId = z.enum([
|
|
4
|
+
"builtin:opengeni-help",
|
|
5
|
+
"builtin:opengeni-client",
|
|
6
|
+
"builtin:opengeni-visualize",
|
|
7
|
+
"builtin:document-parsing",
|
|
8
|
+
"builtin:opengeni-skills",
|
|
9
|
+
"builtin:opengeni-projects",
|
|
10
|
+
"builtin:opengeni-schedules",
|
|
11
|
+
"builtin:opengeni-documents",
|
|
12
|
+
"builtin:opengeni-spreadsheets",
|
|
13
|
+
"builtin:opengeni-presentations",
|
|
14
|
+
"builtin:opengeni-sites",
|
|
15
|
+
"builtin:opengeni-video-generation",
|
|
16
|
+
]);
|
|
17
|
+
export type BundledSkillId = z.infer<typeof BundledSkillId>;
|
|
18
|
+
export const BundledSkillSelection = z
|
|
19
|
+
.array(BundledSkillId)
|
|
20
|
+
.max(BundledSkillId.options.length)
|
|
21
|
+
.refine((ids) => new Set(ids).size === ids.length, "bundled Skill ids must be unique")
|
|
22
|
+
.transform((ids) => [...ids].sort());
|
|
23
|
+
|
|
24
|
+
/** Undefined is defaults/inheritance; an explicit empty list disables bundles. */
|
|
25
|
+
export function resolveBundledSkillSelection(
|
|
26
|
+
requested: readonly BundledSkillId[] | undefined,
|
|
27
|
+
parent: readonly BundledSkillId[] | undefined,
|
|
28
|
+
): BundledSkillId[] | undefined {
|
|
29
|
+
const selected = requested === undefined ? parent : requested;
|
|
30
|
+
if (parent !== undefined && selected?.some((id) => !parent.includes(id)))
|
|
31
|
+
throw new Error("A child cannot widen its parent's bundled Skill selection");
|
|
32
|
+
return selected === undefined ? undefined : BundledSkillSelection.parse(selected);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Immutable session configuration, following the existing create-identity
|
|
36
|
+
// metadata convention. Callers cannot set this through arbitrary metadata.
|
|
37
|
+
const BUNDLED_SKILL_SELECTION_KEY = "_opengeni_bundled_skill_ids_v1";
|
|
38
|
+
export function withBundledSkillSelectionMetadata(
|
|
39
|
+
metadata: Record<string, unknown>,
|
|
40
|
+
ids: readonly BundledSkillId[] | undefined,
|
|
41
|
+
): Record<string, unknown> {
|
|
42
|
+
const next = { ...metadata };
|
|
43
|
+
delete next[BUNDLED_SKILL_SELECTION_KEY];
|
|
44
|
+
if (ids !== undefined) next[BUNDLED_SKILL_SELECTION_KEY] = BundledSkillSelection.parse(ids);
|
|
45
|
+
return next;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Stored-data read. Ids are permanent, but a row written by a newer (or
|
|
49
|
+
* rolled-back-from) release can hold an id this build lacks. Such ids are
|
|
50
|
+
* dropped rather than failing the session read; dropping only narrows the
|
|
51
|
+
* stored selection and never turns it back into defaults. Input stays strict,
|
|
52
|
+
* and a value that is not a list of id strings still fails.
|
|
53
|
+
*/
|
|
54
|
+
const StoredBundledSkillSelection = z.array(z.string());
|
|
55
|
+
const knownBundledSkillIds: ReadonlySet<string> = new Set(BundledSkillId.options);
|
|
56
|
+
/**
|
|
57
|
+
* Exact stored selection for keyed create replay identity. Unlike the
|
|
58
|
+
* tolerant read, it keeps ids this build does not know: a retry must match
|
|
59
|
+
* what was stored, not the narrowed projection of it.
|
|
60
|
+
*/
|
|
61
|
+
export function storedBundledSkillSelectionIdentity(metadata: Record<string, unknown>): unknown {
|
|
62
|
+
return metadata[BUNDLED_SKILL_SELECTION_KEY];
|
|
63
|
+
}
|
|
64
|
+
export function bundledSkillSelectionFromMetadata(
|
|
65
|
+
metadata: Record<string, unknown>,
|
|
66
|
+
): BundledSkillId[] | undefined {
|
|
67
|
+
const value = metadata[BUNDLED_SKILL_SELECTION_KEY];
|
|
68
|
+
if (value === undefined) return undefined;
|
|
69
|
+
const known = StoredBundledSkillSelection.parse(value).filter((id): id is BundledSkillId =>
|
|
70
|
+
knownBundledSkillIds.has(id),
|
|
71
|
+
);
|
|
72
|
+
return [...new Set(known)].sort();
|
|
73
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { XaiProviderAccountAuthoritySnapshotV1 } from "./xai-provider-account-authority";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
|
|
4
|
+
/** Same opaque pool selection shape; Claude's live authority is revalidated separately. */
|
|
5
|
+
export const ClaudeProviderAccountAuthoritySnapshotV1 = XaiProviderAccountAuthoritySnapshotV1;
|
|
6
|
+
export type ClaudeProviderAccountAuthoritySnapshotV1 = z.infer<
|
|
7
|
+
typeof ClaudeProviderAccountAuthoritySnapshotV1
|
|
8
|
+
>;
|
|
9
|
+
export const WORKSPACE_CLAUDE_PROVIDER_ACCOUNT_AUTHORITY_SNAPSHOT_V1 = {
|
|
10
|
+
version: 1,
|
|
11
|
+
scope: "workspace",
|
|
12
|
+
} as const satisfies ClaudeProviderAccountAuthoritySnapshotV1;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const ClaudeSubscriptionSetupTokenRequest = z
|
|
4
|
+
.object({
|
|
5
|
+
token: z.string().trim().min(1).max(16384),
|
|
6
|
+
scope: z.enum(["workspace", "user"]).default("workspace"),
|
|
7
|
+
label: z.string().trim().max(200).nullable().optional(),
|
|
8
|
+
reconnectAccountId: z.string().uuid().optional(),
|
|
9
|
+
expectedCredentialVersion: z.number().int().positive().optional(),
|
|
10
|
+
})
|
|
11
|
+
.strict()
|
|
12
|
+
.refine(
|
|
13
|
+
(request) =>
|
|
14
|
+
Boolean(request.reconnectAccountId) === (request.expectedCredentialVersion !== undefined),
|
|
15
|
+
{ message: "Replacing a setup token requires its account and credential version." },
|
|
16
|
+
);
|
|
17
|
+
export type ClaudeSubscriptionSetupTokenRequest = z.infer<
|
|
18
|
+
typeof ClaudeSubscriptionSetupTokenRequest
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export const ClaudeSubscriptionOAuthStartRequest = z
|
|
22
|
+
.object({
|
|
23
|
+
scope: z.enum(["workspace", "user"]).default("workspace"),
|
|
24
|
+
reconnectAccountId: z.string().uuid().optional(),
|
|
25
|
+
})
|
|
26
|
+
.strict();
|
|
27
|
+
export type ClaudeSubscriptionOAuthStartRequest = z.infer<
|
|
28
|
+
typeof ClaudeSubscriptionOAuthStartRequest
|
|
29
|
+
>;
|
|
30
|
+
|
|
31
|
+
export const ClaudeSubscriptionOAuthStartResponse = z
|
|
32
|
+
.object({
|
|
33
|
+
attemptId: z.string().uuid(),
|
|
34
|
+
authorizationUrl: z.string().url(),
|
|
35
|
+
expiresAt: z.string().datetime(),
|
|
36
|
+
})
|
|
37
|
+
.strict();
|
|
38
|
+
export type ClaudeSubscriptionOAuthStartResponse = z.infer<
|
|
39
|
+
typeof ClaudeSubscriptionOAuthStartResponse
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
export const ClaudeSubscriptionOAuthCompleteRequest = z
|
|
43
|
+
.object({
|
|
44
|
+
attemptId: z.string().uuid(),
|
|
45
|
+
code: z.string().trim().min(1).max(4096),
|
|
46
|
+
})
|
|
47
|
+
.strict();
|
|
48
|
+
export type ClaudeSubscriptionOAuthCompleteRequest = z.infer<
|
|
49
|
+
typeof ClaudeSubscriptionOAuthCompleteRequest
|
|
50
|
+
>;
|
|
51
|
+
|
|
52
|
+
export const ClaudeSubscriptionOAuthCompleteResponse = z
|
|
53
|
+
.object({
|
|
54
|
+
connected: z.literal(true),
|
|
55
|
+
accountId: z.string().uuid(),
|
|
56
|
+
scope: z.enum(["organization", "workspace", "user"]),
|
|
57
|
+
credentialVersion: z.number().int().positive(),
|
|
58
|
+
})
|
|
59
|
+
.strict();
|
|
60
|
+
export type ClaudeSubscriptionOAuthCompleteResponse = z.infer<
|
|
61
|
+
typeof ClaudeSubscriptionOAuthCompleteResponse
|
|
62
|
+
>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const ClaudeUsageWindowId = z.enum([
|
|
4
|
+
"five_hour",
|
|
5
|
+
"seven_day",
|
|
6
|
+
"seven_day_opus",
|
|
7
|
+
"seven_day_sonnet",
|
|
8
|
+
"seven_day_overage_included",
|
|
9
|
+
"overage",
|
|
10
|
+
]);
|
|
11
|
+
export const ClaudeUsageWindow = z
|
|
12
|
+
.object({
|
|
13
|
+
id: ClaudeUsageWindowId,
|
|
14
|
+
usedPercent: z.number().finite().nonnegative().nullable(),
|
|
15
|
+
resetsAt: z.string().datetime().nullable(),
|
|
16
|
+
status: z.enum(["allowed", "allowed_warning", "rejected"]).nullable(),
|
|
17
|
+
observedAt: z.string().datetime(),
|
|
18
|
+
source: z.enum(["response_headers", "provider"]).optional(),
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
export type ClaudeUsageWindow = z.infer<typeof ClaudeUsageWindow>;
|
|
22
|
+
|
|
23
|
+
/** One response's dispatch authority; never combine statuses from different responses. */
|
|
24
|
+
export const ClaudeUsageRequestStatus = z
|
|
25
|
+
.object({
|
|
26
|
+
status: z.enum(["allowed", "allowed_warning", "rejected"]).nullable(),
|
|
27
|
+
resetsAt: z.string().datetime().nullable(),
|
|
28
|
+
representativeClaim: ClaudeUsageWindowId.nullable(),
|
|
29
|
+
overageStatus: z.enum(["allowed", "allowed_warning", "rejected"]).nullable(),
|
|
30
|
+
overageResetsAt: z.string().datetime().nullable(),
|
|
31
|
+
upstreamModelId: z.string().min(1).max(256).nullable(),
|
|
32
|
+
observedAt: z.string().datetime(),
|
|
33
|
+
source: z.enum(["response_headers", "provider"]).optional(),
|
|
34
|
+
})
|
|
35
|
+
.strict();
|
|
36
|
+
export type ClaudeUsageRequestStatus = z.infer<typeof ClaudeUsageRequestStatus>;
|
|
37
|
+
|
|
38
|
+
/** Provider observations, never an estimate based on OpenGeni token counts. */
|
|
39
|
+
export const ClaudeSubscriptionUsage = z
|
|
40
|
+
.object({
|
|
41
|
+
connected: z.boolean(),
|
|
42
|
+
credentialVersion: z.number().int().positive().nullable(),
|
|
43
|
+
windows: z.array(ClaudeUsageWindow).max(6),
|
|
44
|
+
observedAt: z.string().datetime().nullable(),
|
|
45
|
+
source: z.enum(["response_headers", "provider"]).nullable(),
|
|
46
|
+
refreshStatus: z.enum([
|
|
47
|
+
"not_checked",
|
|
48
|
+
"available",
|
|
49
|
+
"scope_required",
|
|
50
|
+
"unavailable",
|
|
51
|
+
"reconnect",
|
|
52
|
+
]),
|
|
53
|
+
refreshCheckedAt: z.string().datetime().nullable(),
|
|
54
|
+
requestStatus: ClaudeUsageRequestStatus.nullable().optional(),
|
|
55
|
+
// Model-scoped dispatch evidence; allowances retain an ordering watermark.
|
|
56
|
+
requestRestrictions: z.array(ClaudeUsageRequestStatus).max(64).optional(),
|
|
57
|
+
})
|
|
58
|
+
.strict();
|
|
59
|
+
export type ClaudeSubscriptionUsage = z.infer<typeof ClaudeSubscriptionUsage>;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire grammar of the content-free web client error beacon
|
|
3
|
+
* (`POST /v1/client-errors`).
|
|
4
|
+
*
|
|
5
|
+
* A report is only a closed error kind, the matched route PATTERN (never a
|
|
6
|
+
* concrete URL), and the bundle revision. The web client that projects a
|
|
7
|
+
* report, the API route that admits it, and the public structured-log
|
|
8
|
+
* projection that prints it all validate against these exact values, so the
|
|
9
|
+
* browser can only send what the API accepts and logs.
|
|
10
|
+
*
|
|
11
|
+
* The same route also admits the closed operational signals below (requests
|
|
12
|
+
* that never reached the server, live-stream health, and web vitals). They
|
|
13
|
+
* follow the same rules: closed values only, a route pattern or page label,
|
|
14
|
+
* never a URL, message, identifier, or user content.
|
|
15
|
+
*/
|
|
16
|
+
export const CLIENT_ERRORS_PATH = "/v1/client-errors";
|
|
17
|
+
|
|
18
|
+
export const CLIENT_ERROR_KINDS = [
|
|
19
|
+
"route_error",
|
|
20
|
+
"unhandled_rejection",
|
|
21
|
+
"window_error",
|
|
22
|
+
"chunk_load",
|
|
23
|
+
] as const;
|
|
24
|
+
export type ClientErrorKind = (typeof CLIENT_ERROR_KINDS)[number];
|
|
25
|
+
|
|
26
|
+
/** Largest accepted report body. A valid report is well under 256 bytes. */
|
|
27
|
+
export const CLIENT_ERROR_REPORT_MAX_BYTES = 512;
|
|
28
|
+
|
|
29
|
+
const ROUTE_SEGMENT = String.raw`(?:[a-z]+(?:-[a-z]+)*|\$[A-Za-z][A-Za-z0-9]{0,31})`;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A route pattern of at most 160 characters that is `/`, `unknown`, or up to
|
|
33
|
+
* twelve `/`-separated segments that are each either a lowercase literal
|
|
34
|
+
* (`variable-sets`) or a `$param` placeholder. The grammar excludes digits in
|
|
35
|
+
* literals, so a concrete id cannot pass as one.
|
|
36
|
+
*/
|
|
37
|
+
export const CLIENT_ERROR_ROUTE_PATTERN = new RegExp(
|
|
38
|
+
String.raw`^(?=.{1,160}$)(?:unknown|/|(?:/${ROUTE_SEGMENT}){1,12})$`,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
/** The bundle revision token (a commit SHA, `dev`, or `unknown`). */
|
|
42
|
+
export const CLIENT_ERROR_REVISION_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
|
|
43
|
+
|
|
44
|
+
export type ClientErrorReport = { kind: ClientErrorKind; route: string; revision: string };
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Content-free operational signals that share the error beacon route. A
|
|
48
|
+
* signal report carries a `signal` discriminator and only closed values; a
|
|
49
|
+
* report without `signal` is a {@link ClientErrorReport}. Older API servers
|
|
50
|
+
* reject signal reports as invalid, so the extension is backward compatible in
|
|
51
|
+
* both directions.
|
|
52
|
+
*/
|
|
53
|
+
export const CLIENT_SIGNALS = ["request_failure", "stream", "web_vital"] as const;
|
|
54
|
+
export type ClientSignal = (typeof CLIENT_SIGNALS)[number];
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Key product mutations whose failure before any HTTP response is counted.
|
|
58
|
+
* `send_message` includes sends the server queues behind an active turn.
|
|
59
|
+
*/
|
|
60
|
+
export const CLIENT_REQUEST_ACTIONS = [
|
|
61
|
+
"create_session",
|
|
62
|
+
"send_message",
|
|
63
|
+
"steer_message",
|
|
64
|
+
"composer_submit",
|
|
65
|
+
"retry_turn",
|
|
66
|
+
"connect_integration",
|
|
67
|
+
"connect_model",
|
|
68
|
+
"checkout_start",
|
|
69
|
+
] as const;
|
|
70
|
+
export type ClientRequestAction = (typeof CLIENT_REQUEST_ACTIONS)[number];
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Why a request never produced an HTTP response: the browser reported no
|
|
74
|
+
* connectivity (`offline`), the client's own deadline expired (`timeout`), or
|
|
75
|
+
* the transport failed (`network`). Cancellations the user or the app
|
|
76
|
+
* initiated are never reported.
|
|
77
|
+
*/
|
|
78
|
+
export const CLIENT_REQUEST_FAILURE_REASONS = ["network", "timeout", "offline"] as const;
|
|
79
|
+
export type ClientRequestFailureReason = (typeof CLIENT_REQUEST_FAILURE_REASONS)[number];
|
|
80
|
+
|
|
81
|
+
/** Browser live streams: one session's event stream, or the workspace live stream. */
|
|
82
|
+
export const CLIENT_STREAMS = ["session", "workspace"] as const;
|
|
83
|
+
export type ClientStream = (typeof CLIENT_STREAMS)[number];
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Live stream health: a live stream dropped and started reconnecting
|
|
87
|
+
* (`reconnect`), stopped reconnecting (`reconnect_exhausted`), or stayed
|
|
88
|
+
* disconnected for longer than the long-disconnect threshold while the tab
|
|
89
|
+
* was visible (`long_disconnect`).
|
|
90
|
+
*/
|
|
91
|
+
export const CLIENT_STREAM_EVENTS = [
|
|
92
|
+
"reconnect",
|
|
93
|
+
"reconnect_exhausted",
|
|
94
|
+
"long_disconnect",
|
|
95
|
+
] as const;
|
|
96
|
+
export type ClientStreamEvent = (typeof CLIENT_STREAM_EVENTS)[number];
|
|
97
|
+
|
|
98
|
+
/** Core Web Vitals plus time to first byte, measured once per document. */
|
|
99
|
+
export const CLIENT_WEB_VITAL_METRICS = ["lcp", "inp", "cls", "ttfb"] as const;
|
|
100
|
+
export type ClientWebVitalMetric = (typeof CLIENT_WEB_VITAL_METRICS)[number];
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Largest accepted value: seconds for the timing metrics, the unitless layout
|
|
104
|
+
* shift score for `cls`.
|
|
105
|
+
*/
|
|
106
|
+
export const CLIENT_WEB_VITAL_MAX_VALUE: Readonly<Record<ClientWebVitalMetric, number>> = {
|
|
107
|
+
lcp: 600,
|
|
108
|
+
inp: 600,
|
|
109
|
+
cls: 100,
|
|
110
|
+
ttfb: 600,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The closed page labels of the web console's product-journey projection
|
|
115
|
+
* (`journeyPage` in apps/web/src/lib/analytics-journey.ts; a drift test keeps
|
|
116
|
+
* the two identical). Workspace pages are the first path segment after
|
|
117
|
+
* `/workspaces/<id>/`; the rest are exact top-level routes.
|
|
118
|
+
*/
|
|
119
|
+
export const CLIENT_PAGES = [
|
|
120
|
+
"sessions",
|
|
121
|
+
"priority",
|
|
122
|
+
"plugins",
|
|
123
|
+
"capabilities",
|
|
124
|
+
"documents",
|
|
125
|
+
"state",
|
|
126
|
+
"memory",
|
|
127
|
+
"schedules",
|
|
128
|
+
"artifacts",
|
|
129
|
+
"settings",
|
|
130
|
+
"organization",
|
|
131
|
+
"insights",
|
|
132
|
+
"machines",
|
|
133
|
+
"files",
|
|
134
|
+
"agents",
|
|
135
|
+
"variable-sets",
|
|
136
|
+
"environments",
|
|
137
|
+
"rigs",
|
|
138
|
+
"home",
|
|
139
|
+
"session-link",
|
|
140
|
+
"identity-link",
|
|
141
|
+
"checkout-return",
|
|
142
|
+
"integration-return",
|
|
143
|
+
"device",
|
|
144
|
+
"connect-agent",
|
|
145
|
+
"reset-password",
|
|
146
|
+
"setup-account",
|
|
147
|
+
"account-auth",
|
|
148
|
+
"personal-security",
|
|
149
|
+
"other",
|
|
150
|
+
] as const;
|
|
151
|
+
export type ClientPage = (typeof CLIENT_PAGES)[number];
|
|
152
|
+
|
|
153
|
+
export type ClientRequestFailureReport = {
|
|
154
|
+
signal: "request_failure";
|
|
155
|
+
action: ClientRequestAction;
|
|
156
|
+
reason: ClientRequestFailureReason;
|
|
157
|
+
route: string;
|
|
158
|
+
revision: string;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export type ClientStreamReport = {
|
|
162
|
+
signal: "stream";
|
|
163
|
+
stream: ClientStream;
|
|
164
|
+
event: ClientStreamEvent;
|
|
165
|
+
route: string;
|
|
166
|
+
revision: string;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type ClientWebVitalReport = {
|
|
170
|
+
signal: "web_vital";
|
|
171
|
+
metric: ClientWebVitalMetric;
|
|
172
|
+
page: ClientPage;
|
|
173
|
+
/** Seconds for timing metrics, the unitless score for `cls`. */
|
|
174
|
+
value: number;
|
|
175
|
+
revision: string;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type ClientSignalReport =
|
|
179
|
+
| ClientRequestFailureReport
|
|
180
|
+
| ClientStreamReport
|
|
181
|
+
| ClientWebVitalReport;
|
|
182
|
+
|
|
183
|
+
/** Every body the beacon route accepts. */
|
|
184
|
+
export type ClientBeaconReport = ClientErrorReport | ClientSignalReport;
|