@opengeni/contracts 0.36.0 → 0.38.1

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.
@@ -6,6 +6,7 @@ export declare const WORKSPACE_STATE_MAX_GAPS = 16;
6
6
  export declare const WORKSPACE_STATE_BASE_NAME_MAX_CHARS = 160;
7
7
  export declare const WORKSPACE_STATE_TOPIC_MAX_CHARS = 96;
8
8
  export declare const WORKSPACE_STATE_MEMORY_SAMPLE_LIMIT = 100;
9
+ export declare const WORKSPACE_STATE_EXPORT_SCHEMA_VERSION = 1;
9
10
  export declare const WorkspaceStateQuery: z.ZodObject<{
10
11
  attemptId: z.ZodOptional<z.ZodString>;
11
12
  }, z.core.$strict>;
@@ -28,6 +29,12 @@ export declare const WorkspaceStateSourceKindCounts: z.ZodObject<{
28
29
  other: z.ZodNumber;
29
30
  }, z.core.$strict>;
30
31
  export type WorkspaceStateSourceKindCounts = z.infer<typeof WorkspaceStateSourceKindCounts>;
32
+ export declare const WorkspaceStateDocumentAuthorityKindCounts: z.ZodObject<{
33
+ organization: z.ZodNumber;
34
+ workspace: z.ZodNumber;
35
+ personal: z.ZodNumber;
36
+ }, z.core.$strict>;
37
+ export type WorkspaceStateDocumentAuthorityKindCounts = z.infer<typeof WorkspaceStateDocumentAuthorityKindCounts>;
31
38
  export declare const WorkspaceStateMemoryStatusCounts: z.ZodObject<{
32
39
  proposed: z.ZodNumber;
33
40
  approved: z.ZodNumber;
@@ -141,6 +148,17 @@ export declare const WorkspaceStatePolicy: z.ZodObject<{
141
148
  status: z.ZodLiteral<"not_implemented">;
142
149
  }, z.core.$strict>;
143
150
  }, z.core.$strict>;
151
+ export declare const WorkspaceStatePreferences: z.ZodObject<{
152
+ authority: z.ZodLiteral<"preference_registry_preferences">;
153
+ activeDescriptorCount: z.ZodNumber;
154
+ activeDescriptorHash: z.ZodString;
155
+ scopeCounts: z.ZodObject<{
156
+ organization: z.ZodNumber;
157
+ workspace: z.ZodNumber;
158
+ user: z.ZodNumber;
159
+ }, z.core.$strict>;
160
+ truncated: z.ZodBoolean;
161
+ }, z.core.$strict>;
144
162
  export declare const WorkspaceStateKnowledgeBase: z.ZodObject<{
145
163
  id: z.ZodString;
146
164
  name: z.ZodString;
@@ -223,6 +241,11 @@ export declare const WorkspaceStateKnowledgeAvailable: z.ZodObject<{
223
241
  web: z.ZodNumber;
224
242
  other: z.ZodNumber;
225
243
  }, z.core.$strict>;
244
+ authorityKindCounts: z.ZodObject<{
245
+ organization: z.ZodNumber;
246
+ workspace: z.ZodNumber;
247
+ personal: z.ZodNumber;
248
+ }, z.core.$strict>;
226
249
  topics: z.ZodArray<z.ZodObject<{
227
250
  name: z.ZodString;
228
251
  documentCount: z.ZodNumber;
@@ -314,6 +337,11 @@ export declare const WorkspaceStateKnowledge: z.ZodDiscriminatedUnion<[z.ZodObje
314
337
  web: z.ZodNumber;
315
338
  other: z.ZodNumber;
316
339
  }, z.core.$strict>;
340
+ authorityKindCounts: z.ZodObject<{
341
+ organization: z.ZodNumber;
342
+ workspace: z.ZodNumber;
343
+ personal: z.ZodNumber;
344
+ }, z.core.$strict>;
317
345
  topics: z.ZodArray<z.ZodObject<{
318
346
  name: z.ZodString;
319
347
  documentCount: z.ZodNumber;
@@ -646,6 +674,17 @@ export declare const WorkspaceStateResponse: z.ZodObject<{
646
674
  status: z.ZodLiteral<"not_implemented">;
647
675
  }, z.core.$strict>;
648
676
  }, z.core.$strict>;
677
+ preferences: z.ZodObject<{
678
+ authority: z.ZodLiteral<"preference_registry_preferences">;
679
+ activeDescriptorCount: z.ZodNumber;
680
+ activeDescriptorHash: z.ZodString;
681
+ scopeCounts: z.ZodObject<{
682
+ organization: z.ZodNumber;
683
+ workspace: z.ZodNumber;
684
+ user: z.ZodNumber;
685
+ }, z.core.$strict>;
686
+ truncated: z.ZodBoolean;
687
+ }, z.core.$strict>;
649
688
  knowledge: z.ZodDiscriminatedUnion<[z.ZodObject<{
650
689
  availability: z.ZodLiteral<"available">;
651
690
  coverage: z.ZodEnum<{
@@ -683,6 +722,11 @@ export declare const WorkspaceStateResponse: z.ZodObject<{
683
722
  web: z.ZodNumber;
684
723
  other: z.ZodNumber;
685
724
  }, z.core.$strict>;
725
+ authorityKindCounts: z.ZodObject<{
726
+ organization: z.ZodNumber;
727
+ workspace: z.ZodNumber;
728
+ personal: z.ZodNumber;
729
+ }, z.core.$strict>;
686
730
  topics: z.ZodArray<z.ZodObject<{
687
731
  name: z.ZodString;
688
732
  documentCount: z.ZodNumber;
@@ -738,3 +782,302 @@ export declare const WorkspaceStateResponse: z.ZodObject<{
738
782
  }, z.core.$strict>], "availability">;
739
783
  }, z.core.$strict>;
740
784
  export type WorkspaceStateResponse = z.infer<typeof WorkspaceStateResponse>;
785
+ export declare const WorkspaceStateExportOmission: z.ZodEnum<{
786
+ document_content_and_private_metadata: "document_content_and_private_metadata";
787
+ hidden_platform_prompts: "hidden_platform_prompts";
788
+ memory_content_and_provenance: "memory_content_and_provenance";
789
+ policy_bodies: "policy_bodies";
790
+ preference_content: "preference_content";
791
+ secret_values_and_credentials: "secret_values_and_credentials";
792
+ session_messages_and_tool_outputs: "session_messages_and_tool_outputs";
793
+ }>;
794
+ export type WorkspaceStateExportOmission = z.infer<typeof WorkspaceStateExportOmission>;
795
+ export declare const WorkspaceStateExportResponse: z.ZodObject<{
796
+ kind: z.ZodLiteral<"opengeni.workspace_state.sanitized_export">;
797
+ schemaVersion: z.ZodLiteral<1>;
798
+ generatedAt: z.ZodString;
799
+ stateSha256: z.ZodString;
800
+ omissions: z.ZodArray<z.ZodEnum<{
801
+ document_content_and_private_metadata: "document_content_and_private_metadata";
802
+ hidden_platform_prompts: "hidden_platform_prompts";
803
+ memory_content_and_provenance: "memory_content_and_provenance";
804
+ policy_bodies: "policy_bodies";
805
+ preference_content: "preference_content";
806
+ secret_values_and_credentials: "secret_values_and_credentials";
807
+ session_messages_and_tool_outputs: "session_messages_and_tool_outputs";
808
+ }>>;
809
+ state: z.ZodObject<{
810
+ workspaceId: z.ZodString;
811
+ generatedAt: z.ZodString;
812
+ truth: z.ZodObject<{
813
+ current: z.ZodObject<{
814
+ source: z.ZodLiteral<"read_time_projection">;
815
+ capturedAt: z.ZodString;
816
+ }, z.core.$strict>;
817
+ attemptGovernance: z.ZodDiscriminatedUnion<[z.ZodObject<{
818
+ status: z.ZodLiteral<"not_requested">;
819
+ }, z.core.$strict>, z.ZodObject<{
820
+ status: z.ZodLiteral<"unavailable">;
821
+ reason: z.ZodLiteral<"attempt_not_found_or_not_authorized">;
822
+ driftStatus: z.ZodLiteral<"unavailable">;
823
+ }, z.core.$strict>, z.ZodObject<{
824
+ status: z.ZodLiteral<"available">;
825
+ attemptId: z.ZodString;
826
+ executionGeneration: z.ZodNumber;
827
+ acceptedAt: z.ZodString;
828
+ policySnapshot: z.ZodDiscriminatedUnion<[z.ZodObject<{
829
+ status: z.ZodLiteral<"available">;
830
+ id: z.ZodString;
831
+ createdAt: z.ZodString;
832
+ entryHash: z.ZodString;
833
+ policyRole: z.ZodNullable<z.ZodString>;
834
+ roleSource: z.ZodEnum<{
835
+ invalid_metadata_fallback: "invalid_metadata_fallback";
836
+ metadata_fallback: "metadata_fallback";
837
+ none: "none";
838
+ session_binding: "session_binding";
839
+ }>;
840
+ entries: z.ZodArray<z.ZodObject<{
841
+ kind: z.ZodEnum<{
842
+ charter: "charter";
843
+ policy: "policy";
844
+ }>;
845
+ scope: z.ZodEnum<{
846
+ global: "global";
847
+ role: "role";
848
+ }>;
849
+ roleKey: z.ZodNullable<z.ZodString>;
850
+ revisionId: z.ZodString;
851
+ revision: z.ZodNumber;
852
+ contentHash: z.ZodString;
853
+ activationVersion: z.ZodNumber;
854
+ activatedAt: z.ZodString;
855
+ provenance: z.ZodObject<{
856
+ source: z.ZodEnum<{
857
+ human: "human";
858
+ knowledge_proposal: "knowledge_proposal";
859
+ legacy_import: "legacy_import";
860
+ onboarding: "onboarding";
861
+ }>;
862
+ sourceIdHash: z.ZodNullable<z.ZodString>;
863
+ }, z.core.$strip>;
864
+ }, z.core.$strip>>;
865
+ }, z.core.$strict>, z.ZodObject<{
866
+ status: z.ZodLiteral<"missing">;
867
+ }, z.core.$strict>], "status">;
868
+ preferenceSnapshot: z.ZodDiscriminatedUnion<[z.ZodObject<{
869
+ status: z.ZodLiteral<"available">;
870
+ id: z.ZodString;
871
+ createdAt: z.ZodString;
872
+ descriptorHash: z.ZodString;
873
+ descriptorCount: z.ZodNumber;
874
+ truncated: z.ZodBoolean;
875
+ }, z.core.$strict>, z.ZodObject<{
876
+ status: z.ZodLiteral<"missing">;
877
+ }, z.core.$strict>], "status">;
878
+ drift: z.ZodObject<{
879
+ overall: z.ZodEnum<{
880
+ changed: "changed";
881
+ identical: "identical";
882
+ missing: "missing";
883
+ superseded: "superseded";
884
+ truncated: "truncated";
885
+ unavailable: "unavailable";
886
+ }>;
887
+ policy: z.ZodObject<{
888
+ status: z.ZodEnum<{
889
+ changed: "changed";
890
+ identical: "identical";
891
+ missing: "missing";
892
+ superseded: "superseded";
893
+ truncated: "truncated";
894
+ unavailable: "unavailable";
895
+ }>;
896
+ snapshotHash: z.ZodNullable<z.ZodString>;
897
+ currentHash: z.ZodNullable<z.ZodString>;
898
+ snapshotTargetCount: z.ZodNumber;
899
+ currentTargetCount: z.ZodNumber;
900
+ }, z.core.$strict>;
901
+ preferences: z.ZodObject<{
902
+ status: z.ZodEnum<{
903
+ changed: "changed";
904
+ identical: "identical";
905
+ missing: "missing";
906
+ superseded: "superseded";
907
+ truncated: "truncated";
908
+ unavailable: "unavailable";
909
+ }>;
910
+ snapshotHash: z.ZodNullable<z.ZodString>;
911
+ currentHash: z.ZodNullable<z.ZodString>;
912
+ snapshotDescriptorCount: z.ZodNumber;
913
+ currentDescriptorCount: z.ZodNumber;
914
+ snapshotTruncated: z.ZodBoolean;
915
+ currentTruncated: z.ZodBoolean;
916
+ }, z.core.$strict>;
917
+ }, z.core.$strict>;
918
+ }, z.core.$strict>], "status">;
919
+ }, z.core.$strict>;
920
+ policy: z.ZodObject<{
921
+ authority: z.ZodLiteral<"workspace_instruction_policy_heads">;
922
+ activeHeads: z.ZodArray<z.ZodObject<{
923
+ kind: z.ZodEnum<{
924
+ charter: "charter";
925
+ policy: "policy";
926
+ }>;
927
+ scope: z.ZodEnum<{
928
+ global: "global";
929
+ role: "role";
930
+ }>;
931
+ roleKey: z.ZodNullable<z.ZodString>;
932
+ revisionId: z.ZodString;
933
+ revision: z.ZodNumber;
934
+ contentHash: z.ZodString;
935
+ activationVersion: z.ZodNumber;
936
+ activatedAt: z.ZodString;
937
+ }, z.core.$strict>>;
938
+ activeHeadsTruncated: z.ZodBoolean;
939
+ latestRevision: z.ZodNullable<z.ZodObject<{
940
+ kind: z.ZodEnum<{
941
+ charter: "charter";
942
+ policy: "policy";
943
+ }>;
944
+ scope: z.ZodEnum<{
945
+ global: "global";
946
+ role: "role";
947
+ }>;
948
+ roleKey: z.ZodNullable<z.ZodString>;
949
+ revisionId: z.ZodString;
950
+ revision: z.ZodNumber;
951
+ contentHash: z.ZodString;
952
+ provenanceSource: z.ZodEnum<{
953
+ human: "human";
954
+ knowledge_proposal: "knowledge_proposal";
955
+ legacy_import: "legacy_import";
956
+ onboarding: "onboarding";
957
+ }>;
958
+ state: z.ZodEnum<{
959
+ active: "active";
960
+ inactive: "inactive";
961
+ }>;
962
+ createdAt: z.ZodString;
963
+ }, z.core.$strict>>;
964
+ legacyRuntime: z.ZodObject<{
965
+ source: z.ZodEnum<{
966
+ deployment_default: "deployment_default";
967
+ workspace_override: "workspace_override";
968
+ }>;
969
+ workspaceOverrideConfigured: z.ZodBoolean;
970
+ }, z.core.$strict>;
971
+ runtimeComposition: z.ZodObject<{
972
+ status: z.ZodLiteral<"not_implemented">;
973
+ }, z.core.$strict>;
974
+ }, z.core.$strict>;
975
+ preferences: z.ZodObject<{
976
+ authority: z.ZodLiteral<"preference_registry_preferences">;
977
+ activeDescriptorCount: z.ZodNumber;
978
+ activeDescriptorHash: z.ZodString;
979
+ scopeCounts: z.ZodObject<{
980
+ organization: z.ZodNumber;
981
+ workspace: z.ZodNumber;
982
+ user: z.ZodNumber;
983
+ }, z.core.$strict>;
984
+ truncated: z.ZodBoolean;
985
+ }, z.core.$strict>;
986
+ knowledge: z.ZodDiscriminatedUnion<[z.ZodObject<{
987
+ availability: z.ZodLiteral<"available">;
988
+ coverage: z.ZodEnum<{
989
+ complete: "complete";
990
+ partial: "partial";
991
+ }>;
992
+ baseCount: z.ZodNumber;
993
+ bases: z.ZodArray<z.ZodObject<{
994
+ id: z.ZodString;
995
+ name: z.ZodString;
996
+ visibleDocumentCount: z.ZodNumber;
997
+ statusCounts: z.ZodObject<{
998
+ queued: z.ZodNumber;
999
+ indexing: z.ZodNumber;
1000
+ ready: z.ZodNumber;
1001
+ failed: z.ZodNumber;
1002
+ }, z.core.$strict>;
1003
+ latestUpdatedAt: z.ZodNullable<z.ZodString>;
1004
+ }, z.core.$strict>>;
1005
+ basesTruncated: z.ZodBoolean;
1006
+ inspectedVisibleDocumentCount: z.ZodNumber;
1007
+ documentStatusCounts: z.ZodObject<{
1008
+ queued: z.ZodNumber;
1009
+ indexing: z.ZodNumber;
1010
+ ready: z.ZodNumber;
1011
+ failed: z.ZodNumber;
1012
+ }, z.core.$strict>;
1013
+ sourceKindCounts: z.ZodObject<{
1014
+ manual_upload: z.ZodNumber;
1015
+ meeting_transcript: z.ZodNumber;
1016
+ repository: z.ZodNumber;
1017
+ email: z.ZodNumber;
1018
+ chat: z.ZodNumber;
1019
+ document: z.ZodNumber;
1020
+ web: z.ZodNumber;
1021
+ other: z.ZodNumber;
1022
+ }, z.core.$strict>;
1023
+ authorityKindCounts: z.ZodObject<{
1024
+ organization: z.ZodNumber;
1025
+ workspace: z.ZodNumber;
1026
+ personal: z.ZodNumber;
1027
+ }, z.core.$strict>;
1028
+ topics: z.ZodArray<z.ZodObject<{
1029
+ name: z.ZodString;
1030
+ documentCount: z.ZodNumber;
1031
+ }, z.core.$strict>>;
1032
+ topicsTruncated: z.ZodBoolean;
1033
+ latestDocumentUpdatedAt: z.ZodNullable<z.ZodString>;
1034
+ memorySample: z.ZodObject<{
1035
+ recordCount: z.ZodNumber;
1036
+ sampleLimit: z.ZodLiteral<100>;
1037
+ limitReached: z.ZodBoolean;
1038
+ statusCounts: z.ZodObject<{
1039
+ proposed: z.ZodNumber;
1040
+ approved: z.ZodNumber;
1041
+ rejected: z.ZodNumber;
1042
+ active: z.ZodNumber;
1043
+ superseded: z.ZodNumber;
1044
+ archived: z.ZodNumber;
1045
+ }, z.core.$strict>;
1046
+ kindCounts: z.ZodObject<{
1047
+ semantic: z.ZodNumber;
1048
+ episodic: z.ZodNumber;
1049
+ procedural: z.ZodNumber;
1050
+ decision: z.ZodNumber;
1051
+ preference: z.ZodNumber;
1052
+ }, z.core.$strict>;
1053
+ preferenceAuthority: z.ZodObject<{
1054
+ kindCountSource: z.ZodLiteral<"knowledge_memories_legacy_observations">;
1055
+ activeAuthority: z.ZodLiteral<"structured_preference_registry">;
1056
+ }, z.core.$strict>;
1057
+ latestUpdatedAt: z.ZodNullable<z.ZodString>;
1058
+ }, z.core.$strict>;
1059
+ gaps: z.ZodArray<z.ZodObject<{
1060
+ code: z.ZodEnum<{
1061
+ failed_documents: "failed_documents";
1062
+ missing_topic_coverage: "missing_topic_coverage";
1063
+ no_document_bases: "no_document_bases";
1064
+ no_memory_records: "no_memory_records";
1065
+ no_visible_documents: "no_visible_documents";
1066
+ partial_inventory: "partial_inventory";
1067
+ pending_memory_review: "pending_memory_review";
1068
+ processing_documents: "processing_documents";
1069
+ }>;
1070
+ severity: z.ZodEnum<{
1071
+ info: "info";
1072
+ warning: "warning";
1073
+ }>;
1074
+ relatedCount: z.ZodNullable<z.ZodNumber>;
1075
+ }, z.core.$strict>>;
1076
+ }, z.core.$strict>, z.ZodObject<{
1077
+ availability: z.ZodLiteral<"unavailable">;
1078
+ reason: z.ZodLiteral<"missing_permission">;
1079
+ requiredPermission: z.ZodLiteral<"documents:search">;
1080
+ }, z.core.$strict>], "availability">;
1081
+ }, z.core.$strict>;
1082
+ }, z.core.$strict>;
1083
+ export type WorkspaceStateExportResponse = z.infer<typeof WorkspaceStateExportResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/contracts",
3
- "version": "0.36.0",
3
+ "version": "0.38.1",
4
4
  "description": "Shared zod schemas and wire-contract types for the OpenGeni API.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -29,6 +29,10 @@
29
29
  "./google-drive": {
30
30
  "types": "./dist/google-drive.d.ts",
31
31
  "import": "./dist/google-drive.js"
32
+ },
33
+ "./connector-destinations": {
34
+ "types": "./dist/connector-destinations.d.ts",
35
+ "import": "./dist/connector-destinations.js"
32
36
  }
33
37
  },
34
38
  "publishConfig": {
@@ -0,0 +1,132 @@
1
+ import { z } from "zod";
2
+
3
+ export const ConnectorDocumentDestinationAuthority = z.enum([
4
+ "organization",
5
+ "workspace",
6
+ "personal",
7
+ ]);
8
+ export type ConnectorDocumentDestinationAuthority = z.infer<
9
+ typeof ConnectorDocumentDestinationAuthority
10
+ >;
11
+
12
+ export const ConnectorDocumentDestinationSelection = z.object({
13
+ authorityKind: ConnectorDocumentDestinationAuthority,
14
+ collectionId: z.string().uuid().nullable().default(null),
15
+ });
16
+ export type ConnectorDocumentDestinationSelection = z.infer<
17
+ typeof ConnectorDocumentDestinationSelection
18
+ >;
19
+
20
+ export const ConnectorDocumentDestination = z
21
+ .object({
22
+ authorityKind: ConnectorDocumentDestinationAuthority,
23
+ authorityAccountId: z.string().uuid(),
24
+ authorityWorkspaceId: z.string().uuid().nullable(),
25
+ authoritySubjectId: z.string().trim().min(1).max(1024).nullable(),
26
+ collectionId: z.string().uuid().nullable().default(null),
27
+ })
28
+ .superRefine((destination, context) => {
29
+ if (destination.authorityKind === "organization") {
30
+ if (destination.authorityWorkspaceId !== null || destination.authoritySubjectId !== null) {
31
+ context.addIssue({
32
+ code: "custom",
33
+ message: "organization connector destinations cannot bind workspace or subject authority",
34
+ });
35
+ }
36
+ return;
37
+ }
38
+ if (destination.authorityWorkspaceId === null) {
39
+ context.addIssue({
40
+ code: "custom",
41
+ message: "workspace and personal connector destinations require workspace authority",
42
+ });
43
+ }
44
+ if (destination.authorityKind === "workspace" && destination.authoritySubjectId !== null) {
45
+ context.addIssue({
46
+ code: "custom",
47
+ message: "workspace connector destinations cannot bind subject authority",
48
+ });
49
+ }
50
+ if (destination.authorityKind === "personal" && destination.authoritySubjectId === null) {
51
+ context.addIssue({
52
+ code: "custom",
53
+ message: "personal connector destinations require immutable subject authority",
54
+ });
55
+ }
56
+ });
57
+ export type ConnectorDocumentDestination = z.infer<typeof ConnectorDocumentDestination>;
58
+
59
+ export function bindConnectorDocumentDestination(
60
+ selection: ConnectorDocumentDestinationSelection,
61
+ context: { accountId: string; workspaceId: string; initiatingSubjectId: string },
62
+ ): ConnectorDocumentDestination {
63
+ return ConnectorDocumentDestination.parse({
64
+ authorityKind: selection.authorityKind,
65
+ authorityAccountId: context.accountId,
66
+ authorityWorkspaceId: selection.authorityKind === "organization" ? null : context.workspaceId,
67
+ authoritySubjectId: selection.authorityKind === "personal" ? context.initiatingSubjectId : null,
68
+ collectionId: selection.collectionId,
69
+ });
70
+ }
71
+
72
+ export function legacyWorkspaceConnectorDocumentDestination(context: {
73
+ accountId: string;
74
+ workspaceId: string;
75
+ }): ConnectorDocumentDestination {
76
+ return ConnectorDocumentDestination.parse({
77
+ authorityKind: "workspace",
78
+ authorityAccountId: context.accountId,
79
+ authorityWorkspaceId: context.workspaceId,
80
+ authoritySubjectId: null,
81
+ collectionId: null,
82
+ });
83
+ }
84
+
85
+ export function resolveConnectorDocumentDestination(
86
+ value: unknown,
87
+ context: {
88
+ accountId: string;
89
+ workspaceId: string;
90
+ connectionSubjectId?: string | null | undefined;
91
+ },
92
+ ): ConnectorDocumentDestination {
93
+ if (value === undefined || value === null) {
94
+ return legacyWorkspaceConnectorDocumentDestination(context);
95
+ }
96
+ const destination = ConnectorDocumentDestination.parse(value);
97
+ if (destination.authorityAccountId !== context.accountId) {
98
+ throw new Error("connector destination organization authority mismatch");
99
+ }
100
+ if (
101
+ destination.authorityKind !== "organization" &&
102
+ destination.authorityWorkspaceId !== context.workspaceId
103
+ ) {
104
+ throw new Error("connector destination workspace authority mismatch");
105
+ }
106
+ if (
107
+ destination.authorityKind === "personal" &&
108
+ destination.authoritySubjectId !== context.connectionSubjectId
109
+ ) {
110
+ throw new Error("connector destination personal authority mismatch");
111
+ }
112
+ return destination;
113
+ }
114
+
115
+ export function connectorDestinationDocumentAuthority(destination: ConnectorDocumentDestination): {
116
+ authorityKind: ConnectorDocumentDestinationAuthority;
117
+ authorityWorkspaceId: string | null;
118
+ authoritySubjectId: string | null;
119
+ } {
120
+ return {
121
+ authorityKind: destination.authorityKind,
122
+ authorityWorkspaceId: destination.authorityWorkspaceId,
123
+ authoritySubjectId: destination.authoritySubjectId,
124
+ };
125
+ }
126
+
127
+ export function connectorDocumentDestinationCollectionId(
128
+ destination: ConnectorDocumentDestination,
129
+ defaultCollectionId: string,
130
+ ): string {
131
+ return destination.collectionId ?? z.string().uuid().parse(defaultCollectionId);
132
+ }
@@ -1,6 +1,10 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  import { ConnectionMetadata } from "./index";
4
+ import {
5
+ ConnectorDocumentDestination,
6
+ ConnectorDocumentDestinationSelection,
7
+ } from "./connector-destinations";
4
8
 
5
9
  export const GOOGLE_DRIVE_PROVIDER_DOMAIN = "googleapis.com" as const;
6
10
  export const GOOGLE_DRIVE_FULL_SCOPE = "https://www.googleapis.com/auth/drive" as const;
@@ -63,6 +67,7 @@ export function googleDriveScopesAllowCapability(
63
67
  return googleDriveOAuthScopeDecision(grantedScopes).capabilities.includes(capability);
64
68
  }
65
69
 
70
+ /** @deprecated Connector document destinations use organization/workspace/personal authority. */
66
71
  export const GoogleDriveTargetScope = z.enum(["user", "workspace", "organization"]);
67
72
  export type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;
68
73
 
@@ -130,7 +135,9 @@ export const GoogleDriveSelectedSource = z.object({
130
135
  name: z.string().min(1).max(1024),
131
136
  mimeType: z.string().min(1).max(256),
132
137
  driveId: z.string().min(1).max(256).nullable().default(null),
133
- targetScope: GoogleDriveTargetScope,
138
+ destination: ConnectorDocumentDestination.optional(),
139
+ /** @deprecated Missing destinations resolve to the current workspace boundary. */
140
+ targetScope: GoogleDriveTargetScope.optional(),
134
141
  syncCadence: GoogleDriveSyncCadence.default("hourly"),
135
142
  readPolicy: GoogleDriveReadPolicy.default("allow"),
136
143
  selectedAt: z.string().datetime({ offset: true }),
@@ -147,6 +154,7 @@ export const GoogleDriveConnectionMetadata = z
147
154
  verifiedAt: z.string().datetime({ offset: true }),
148
155
  accessMode: z.enum(["metadata_readonly", "readonly"]),
149
156
  lifecycle: GoogleDriveConnectionLifecycle.optional(),
157
+ documentDestination: ConnectorDocumentDestination.optional(),
150
158
  selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),
151
159
  /** @deprecated Read `selectedSources`; retained while existing connections migrate. */
152
160
  selectedSource: GoogleDriveSelectedSource.nullable().optional(),
@@ -199,22 +207,28 @@ export const GoogleDriveBrowseResponse = z.object({
199
207
  });
200
208
  export type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;
201
209
 
202
- export const SaveGoogleDriveSourceRequest = z.object({
203
- sources: z
204
- .array(
205
- GoogleDriveBrowseItem.pick({
206
- id: true,
207
- name: true,
208
- mimeType: true,
209
- driveId: true,
210
+ export const SaveGoogleDriveSourceRequest = z
211
+ .object({
212
+ sources: z
213
+ .array(
214
+ GoogleDriveBrowseItem.pick({
215
+ id: true,
216
+ name: true,
217
+ mimeType: true,
218
+ driveId: true,
219
+ }),
220
+ )
221
+ .max(100)
222
+ .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {
223
+ message: "Google Drive sources must be unique",
210
224
  }),
211
- )
212
- .max(100)
213
- .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {
214
- message: "Google Drive sources must be unique",
215
- }),
216
- targetScope: GoogleDriveTargetScope,
217
- syncCadence: GoogleDriveSyncCadence.default("hourly"),
218
- readPolicy: GoogleDriveReadPolicy.default("allow"),
219
- });
225
+ destination: ConnectorDocumentDestinationSelection.optional(),
226
+ /** @deprecated Legacy requests are accepted but resolve to workspace authority. */
227
+ targetScope: GoogleDriveTargetScope.optional(),
228
+ syncCadence: GoogleDriveSyncCadence.default("hourly"),
229
+ readPolicy: GoogleDriveReadPolicy.default("allow"),
230
+ })
231
+ .refine((request) => request.destination !== undefined || request.targetScope !== undefined, {
232
+ message: "Google Drive document destination is required",
233
+ });
220
234
  export type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  import { WorkspaceInstructionPolicyRoleKeyInput } from "./workspace-instruction-policies";
9
9
 
10
10
  export * from "./slack-bot-scopes";
11
+ export * from "./connector-destinations";
11
12
 
12
13
  export {
13
14
  CreateWorkspaceArtifactRequest,
@@ -1149,7 +1150,11 @@ export const ClientVoiceInputConfig = z
1149
1150
  .object({
1150
1151
  available: z.boolean(),
1151
1152
  maxDurationSeconds: z.number().int().positive().max(600),
1152
- maxSizeBytes: z.number().int().positive(),
1153
+ maxSizeBytes: z
1154
+ .number()
1155
+ .int()
1156
+ .positive()
1157
+ .max(25 * 1024 * 1024),
1153
1158
  acceptedMimeTypes: z.array(z.string().trim().min(1).max(128)).min(1).max(32),
1154
1159
  })
1155
1160
  .strict();
@@ -1164,7 +1169,7 @@ export const TranscribeAudioResponse = z
1164
1169
  .strict();
1165
1170
  export type TranscribeAudioResponse = z.infer<typeof TranscribeAudioResponse>;
1166
1171
 
1167
- /** Default ceilings for native voice input (hard-stop recording + upload). */
1172
+ /** Default safety ceiling for one-shot native voice input (60 seconds). */
1168
1173
  export const VOICE_INPUT_MAX_DURATION_SECONDS = 60 as const;
1169
1174
  export const VOICE_INPUT_MAX_SIZE_BYTES = 25 * 1024 * 1024;
1170
1175
  export const VOICE_INPUT_ACCEPTED_MIME_TYPES = [
@@ -6205,6 +6210,9 @@ export const Session = z.object({
6205
6210
  // stale in-flight op and retry against the new active sandbox.
6206
6211
  activeSandboxId: z.string().uuid().nullable(),
6207
6212
  activeEpoch: z.number().int().nonnegative(),
6213
+ // The explicit connected-machine project root selected for this session.
6214
+ // Null means the enrolled agent's launch workspace root.
6215
+ workingDir: z.string().nullable().default(null),
6208
6216
  variableSetId: z.string().uuid().nullable().default(null),
6209
6217
  /** @deprecated use variableSetId */
6210
6218
  environmentId: z.string().uuid().nullable().default(null),
@@ -9768,6 +9776,8 @@ export const ClientModel = /* @__PURE__ */ defineModelContractSchema(() =>
9768
9776
  z.object({
9769
9777
  id: z.string(),
9770
9778
  label: z.string(),
9779
+ /** Optional curated compact label for dense UI (e.g. mobile composer). */
9780
+ shortLabel: z.string().min(1).max(64).optional(),
9771
9781
  provider: z.string(), // provider id
9772
9782
  providerLabel: z.string(),
9773
9783
  api: z.enum(["responses", "chat"]),