@antasphere/chassis-contract 0.0.0-stage → 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.
Files changed (130) hide show
  1. package/LICENSE +82 -0
  2. package/dist/define.d.ts +177 -0
  3. package/dist/define.d.ts.map +1 -0
  4. package/dist/define.js +35 -0
  5. package/dist/define.js.map +1 -0
  6. package/dist/entitlements.d.ts +486 -0
  7. package/dist/entitlements.d.ts.map +1 -0
  8. package/dist/entitlements.js +344 -0
  9. package/dist/entitlements.js.map +1 -0
  10. package/dist/identity.d.ts +56 -0
  11. package/dist/identity.d.ts.map +1 -0
  12. package/dist/identity.js +2 -0
  13. package/dist/identity.js.map +1 -0
  14. package/dist/index.d.ts +23 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +29 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/routes/index.d.ts +5403 -0
  19. package/dist/routes/index.d.ts.map +1 -0
  20. package/dist/routes/index.js +940 -0
  21. package/dist/routes/index.js.map +1 -0
  22. package/dist/schemas/api-keys.d.ts +54 -0
  23. package/dist/schemas/api-keys.d.ts.map +1 -0
  24. package/dist/schemas/api-keys.js +48 -0
  25. package/dist/schemas/api-keys.js.map +1 -0
  26. package/dist/schemas/audit.d.ts +74 -0
  27. package/dist/schemas/audit.d.ts.map +1 -0
  28. package/dist/schemas/audit.js +65 -0
  29. package/dist/schemas/audit.js.map +1 -0
  30. package/dist/schemas/break-glass.d.ts +42 -0
  31. package/dist/schemas/break-glass.d.ts.map +1 -0
  32. package/dist/schemas/break-glass.js +38 -0
  33. package/dist/schemas/break-glass.js.map +1 -0
  34. package/dist/schemas/cli-auth.d.ts +59 -0
  35. package/dist/schemas/cli-auth.d.ts.map +1 -0
  36. package/dist/schemas/cli-auth.js +68 -0
  37. package/dist/schemas/cli-auth.js.map +1 -0
  38. package/dist/schemas/common.d.ts +96 -0
  39. package/dist/schemas/common.d.ts.map +1 -0
  40. package/dist/schemas/common.js +205 -0
  41. package/dist/schemas/common.js.map +1 -0
  42. package/dist/schemas/demo-passes.d.ts +90 -0
  43. package/dist/schemas/demo-passes.d.ts.map +1 -0
  44. package/dist/schemas/demo-passes.js +60 -0
  45. package/dist/schemas/demo-passes.js.map +1 -0
  46. package/dist/schemas/files.d.ts +39 -0
  47. package/dist/schemas/files.d.ts.map +1 -0
  48. package/dist/schemas/files.js +26 -0
  49. package/dist/schemas/files.js.map +1 -0
  50. package/dist/schemas/instance.d.ts +58 -0
  51. package/dist/schemas/instance.d.ts.map +1 -0
  52. package/dist/schemas/instance.js +70 -0
  53. package/dist/schemas/instance.js.map +1 -0
  54. package/dist/schemas/invitations.d.ts +100 -0
  55. package/dist/schemas/invitations.d.ts.map +1 -0
  56. package/dist/schemas/invitations.js +55 -0
  57. package/dist/schemas/invitations.js.map +1 -0
  58. package/dist/schemas/me.d.ts +81 -0
  59. package/dist/schemas/me.d.ts.map +1 -0
  60. package/dist/schemas/me.js +178 -0
  61. package/dist/schemas/me.js.map +1 -0
  62. package/dist/schemas/members.d.ts +60 -0
  63. package/dist/schemas/members.d.ts.map +1 -0
  64. package/dist/schemas/members.js +43 -0
  65. package/dist/schemas/members.js.map +1 -0
  66. package/dist/schemas/projects.d.ts +232 -0
  67. package/dist/schemas/projects.d.ts.map +1 -0
  68. package/dist/schemas/projects.js +140 -0
  69. package/dist/schemas/projects.js.map +1 -0
  70. package/dist/schemas/scope.d.ts +14 -0
  71. package/dist/schemas/scope.d.ts.map +1 -0
  72. package/dist/schemas/scope.js +5 -0
  73. package/dist/schemas/scope.js.map +1 -0
  74. package/dist/schemas/setup.d.ts +28 -0
  75. package/dist/schemas/setup.d.ts.map +1 -0
  76. package/dist/schemas/setup.js +28 -0
  77. package/dist/schemas/setup.js.map +1 -0
  78. package/dist/schemas/sso-connect.d.ts +30 -0
  79. package/dist/schemas/sso-connect.d.ts.map +1 -0
  80. package/dist/schemas/sso-connect.js +38 -0
  81. package/dist/schemas/sso-connect.js.map +1 -0
  82. package/dist/schemas/sso-logout.d.ts +17 -0
  83. package/dist/schemas/sso-logout.d.ts.map +1 -0
  84. package/dist/schemas/sso-logout.js +16 -0
  85. package/dist/schemas/sso-logout.js.map +1 -0
  86. package/dist/schemas/teams.d.ts +100 -0
  87. package/dist/schemas/teams.d.ts.map +1 -0
  88. package/dist/schemas/teams.js +84 -0
  89. package/dist/schemas/teams.js.map +1 -0
  90. package/dist/schemas/workspaces.d.ts +99 -0
  91. package/dist/schemas/workspaces.d.ts.map +1 -0
  92. package/dist/schemas/workspaces.js +96 -0
  93. package/dist/schemas/workspaces.js.map +1 -0
  94. package/dist/seams.d.ts +185 -0
  95. package/dist/seams.d.ts.map +1 -0
  96. package/dist/seams.js +37 -0
  97. package/dist/seams.js.map +1 -0
  98. package/dist/wire.d.ts +101 -0
  99. package/dist/wire.d.ts.map +1 -0
  100. package/dist/wire.js +161 -0
  101. package/dist/wire.js.map +1 -0
  102. package/package.json +41 -3
  103. package/src/define.ts +64 -0
  104. package/src/entitlements.ts +527 -0
  105. package/src/identity.ts +49 -0
  106. package/src/index.ts +38 -0
  107. package/src/routes/index.ts +1146 -0
  108. package/src/schemas/api-keys.ts +53 -0
  109. package/src/schemas/audit.ts +74 -0
  110. package/src/schemas/break-glass.ts +46 -0
  111. package/src/schemas/cli-auth.ts +78 -0
  112. package/src/schemas/common.ts +206 -0
  113. package/src/schemas/demo-passes.ts +73 -0
  114. package/src/schemas/files.ts +30 -0
  115. package/src/schemas/instance.ts +71 -0
  116. package/src/schemas/invitations.ts +66 -0
  117. package/src/schemas/me.ts +184 -0
  118. package/src/schemas/members.ts +53 -0
  119. package/src/schemas/projects.ts +174 -0
  120. package/src/schemas/scope.ts +18 -0
  121. package/src/schemas/setup.ts +31 -0
  122. package/src/schemas/sso-connect.ts +40 -0
  123. package/src/schemas/sso-logout.ts +17 -0
  124. package/src/schemas/teams.ts +101 -0
  125. package/src/schemas/workspaces.ts +109 -0
  126. package/src/seams.ts +202 -0
  127. package/src/wire.ts +246 -0
  128. package/test/define.test.ts +59 -0
  129. package/test/hub-wire.test.ts +114 -0
  130. package/README.md +0 -3
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+ import { KNOWN_AUTH_METHODS } from '../seams.js';
3
+ import { toolEntitlementsSchema } from '../entitlements.js';
4
+ /**
5
+ * GET /api/v1/instance — unauthenticated, cacheable discovery. This is what
6
+ * CLIs and MCP clients read to route: which auth methods exist, whether
7
+ * first-boot setup is still pending, and what the instance is.
8
+ */
9
+ export const instanceInfoSchema = z.object({
10
+ name: z.string(),
11
+ instanceId: z.string().nullable(),
12
+ edition: z.string(),
13
+ version: z.string(),
14
+ apiVersion: z.literal('v1'),
15
+ setupRequired: z.boolean(),
16
+ auth: z.object({
17
+ // Open enum (ADR 003): the enum documents the known vocabulary, the
18
+ // string branch keeps older clients parsing newer instances. Clients
19
+ // ignore entries they do not recognize.
20
+ methods: z.array(z.enum(KNOWN_AUTH_METHODS).or(z.string())),
21
+ passwordReset: z.boolean(),
22
+ emailChange: z.boolean(),
23
+ twoFactor: z.boolean(),
24
+ /**
25
+ * Hub SSO client hints (cloud edition ONLY — absent on oss, where the
26
+ * discovery wire shape stays byte-identical). The hint cookie is a
27
+ * dashboard-side HINT for the silent auto-connect (attempt vs don't),
28
+ * NEVER a security input: the hub sets it, this tool reads it
29
+ * client-side and clears it on logout / login_required
30
+ * (internal/federation.md, cross-repo contract).
31
+ */
32
+ sso: z
33
+ .object({
34
+ hintCookieName: z.string(),
35
+ hintCookieDomain: z.string()
36
+ })
37
+ .optional()
38
+ }),
39
+ features: z.object({
40
+ mcp: z.boolean(),
41
+ oauth: z.boolean(),
42
+ files: z.boolean()
43
+ }),
44
+ /**
45
+ * `true` while the operator's DEMO_SIGN_IN switch is on (self-hosted
46
+ * edition only): demo links sign people in here, and the dashboard shows
47
+ * every signed-in person a banner saying so. ABSENT otherwise, never false,
48
+ * so an instance without the switch serves the same discovery bytes as
49
+ * before it existed.
50
+ */
51
+ demoSignIn: z.boolean().optional(),
52
+ /**
53
+ * `true` when this cloud instance is a RESTRICTED tool (the operator's
54
+ * TOOL_RESTRICTED switch, PRDCT-2947): organizations that open it are
55
+ * granted by Antasphere, and `POST /workspaces` refuses here. A CLI reads
56
+ * it to say so before offering to create one. ABSENT otherwise, never
57
+ * false, so the self-hosted discovery bytes are unchanged.
58
+ */
59
+ restricted: z.boolean().optional(),
60
+ /**
61
+ * What this version of the tool declares for the billing rail (its priced
62
+ * actions with their default credits, its limits and features per tier):
63
+ * the hub seeds its price book and its plan entitlements from it, staff
64
+ * read what a version declares, and a client reads the limit it will be
65
+ * held to (the CLI's upfront refusal with the right number). Optional on
66
+ * the wire so a client keeps parsing an instance from before the rail.
67
+ */
68
+ entitlements: toolEntitlementsSchema.optional()
69
+ });
70
+ //# sourceMappingURL=instance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.js","sourceRoot":"","sources":["../../src/schemas/instance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,oEAAoE;QACpE,qEAAqE;QACrE,wCAAwC;QACxC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QAC3D,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE;QAC1B,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;QACxB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;QACtB;;;;;;;WAOG;QACH,GAAG,EAAE,CAAC;aACH,MAAM,CAAC;YACN,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;YAC1B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE;SAC7B,CAAC;aACD,QAAQ,EAAE;KACd,CAAC;IACF,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC;QACjB,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE;QAChB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;QAClB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;KACnB,CAAC;IACF;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClC;;;;;;OAMG;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClC;;;;;;;OAOG;IACH,YAAY,EAAE,sBAAsB,CAAC,QAAQ,EAAE;CAChD,CAAC,CAAC"}
@@ -0,0 +1,100 @@
1
+ import { z } from 'zod';
2
+ export declare const invitationSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ email: z.ZodString;
5
+ role: z.ZodEnum<{
6
+ owner: "owner";
7
+ admin: "admin";
8
+ member: "member";
9
+ }>;
10
+ invitedBy: z.ZodString;
11
+ expiresAt: z.ZodString;
12
+ acceptedAt: z.ZodNullable<z.ZodString>;
13
+ revokedAt: z.ZodNullable<z.ZodString>;
14
+ createdAt: z.ZodString;
15
+ }, z.core.$strip>;
16
+ export type InvitationInfo = z.infer<typeof invitationSchema>;
17
+ export declare const invitationsListSchema: z.ZodObject<{
18
+ invitations: z.ZodArray<z.ZodObject<{
19
+ id: z.ZodString;
20
+ email: z.ZodString;
21
+ role: z.ZodEnum<{
22
+ owner: "owner";
23
+ admin: "admin";
24
+ member: "member";
25
+ }>;
26
+ invitedBy: z.ZodString;
27
+ expiresAt: z.ZodString;
28
+ acceptedAt: z.ZodNullable<z.ZodString>;
29
+ revokedAt: z.ZodNullable<z.ZodString>;
30
+ createdAt: z.ZodString;
31
+ }, z.core.$strip>>;
32
+ nextCursor: z.ZodNullable<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ export declare const invitationCreateSchema: z.ZodObject<{
35
+ email: z.ZodEmail;
36
+ role: z.ZodDefault<z.ZodEnum<{
37
+ owner: "owner";
38
+ admin: "admin";
39
+ member: "member";
40
+ }>>;
41
+ }, z.core.$strip>;
42
+ export type InvitationCreate = z.infer<typeof invitationCreateSchema>;
43
+ /**
44
+ * The copyable acceptance link is ALWAYS returned — SMTP is never required
45
+ * to get a teammate in. `emailSent` says whether a mail also went out.
46
+ */
47
+ export declare const invitationCreatedSchema: z.ZodObject<{
48
+ invitation: z.ZodObject<{
49
+ id: z.ZodString;
50
+ email: z.ZodString;
51
+ role: z.ZodEnum<{
52
+ owner: "owner";
53
+ admin: "admin";
54
+ member: "member";
55
+ }>;
56
+ invitedBy: z.ZodString;
57
+ expiresAt: z.ZodString;
58
+ acceptedAt: z.ZodNullable<z.ZodString>;
59
+ revokedAt: z.ZodNullable<z.ZodString>;
60
+ createdAt: z.ZodString;
61
+ }, z.core.$strip>;
62
+ acceptUrl: z.ZodString;
63
+ emailSent: z.ZodBoolean;
64
+ }, z.core.$strip>;
65
+ export type InvitationCreated = z.infer<typeof invitationCreatedSchema>;
66
+ /**
67
+ * Deliberately carries NO account-existence signal (the collaborator-lookup
68
+ * rule, PRDCT-1437): an admin who creates an invitation naming any address
69
+ * holds the copyable accept URL, so the lookup was an instance-global
70
+ * account oracle. The accept page offers sign-in and create-account
71
+ * neutrally; the accept endpoint answers `account_exists` when a create
72
+ * collides.
73
+ */
74
+ export declare const invitationLookupSchema: z.ZodObject<{
75
+ email: z.ZodString;
76
+ role: z.ZodEnum<{
77
+ owner: "owner";
78
+ admin: "admin";
79
+ member: "member";
80
+ }>;
81
+ workspaceName: z.ZodString;
82
+ expiresAt: z.ZodString;
83
+ }, z.core.$strip>;
84
+ export type InvitationLookup = z.infer<typeof invitationLookupSchema>;
85
+ export declare const invitationAcceptSchema: z.ZodObject<{
86
+ token: z.ZodString;
87
+ name: z.ZodOptional<z.ZodString>;
88
+ password: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strip>;
90
+ export type InvitationAccept = z.infer<typeof invitationAcceptSchema>;
91
+ export declare const invitationAcceptedSchema: z.ZodObject<{
92
+ workspaceId: z.ZodString;
93
+ userId: z.ZodString;
94
+ role: z.ZodEnum<{
95
+ owner: "owner";
96
+ admin: "admin";
97
+ member: "member";
98
+ }>;
99
+ }, z.core.$strip>;
100
+ //# sourceMappingURL=invitations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invitations.d.ts","sourceRoot":"","sources":["../../src/schemas/invitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;iBAS3B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;iBAGjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;iBAIlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;iBAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;iBAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,wBAAwB;;;;;;;;iBAInC,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { z } from 'zod';
2
+ import { plainText, workspaceRoleSchema } from './common.js';
3
+ export const invitationSchema = z.object({
4
+ id: z.string(),
5
+ email: z.string(),
6
+ role: workspaceRoleSchema,
7
+ invitedBy: z.string(),
8
+ expiresAt: z.string(),
9
+ acceptedAt: z.string().nullable(),
10
+ revokedAt: z.string().nullable(),
11
+ createdAt: z.string()
12
+ });
13
+ export const invitationsListSchema = z.object({
14
+ invitations: z.array(invitationSchema),
15
+ nextCursor: z.string().nullable()
16
+ });
17
+ export const invitationCreateSchema = z.object({
18
+ email: z.email(),
19
+ role: workspaceRoleSchema.default('member')
20
+ });
21
+ /**
22
+ * The copyable acceptance link is ALWAYS returned — SMTP is never required
23
+ * to get a teammate in. `emailSent` says whether a mail also went out.
24
+ */
25
+ export const invitationCreatedSchema = z.object({
26
+ invitation: invitationSchema,
27
+ acceptUrl: z.string(),
28
+ emailSent: z.boolean()
29
+ });
30
+ /**
31
+ * Deliberately carries NO account-existence signal (the collaborator-lookup
32
+ * rule, PRDCT-1437): an admin who creates an invitation naming any address
33
+ * holds the copyable accept URL, so the lookup was an instance-global
34
+ * account oracle. The accept page offers sign-in and create-account
35
+ * neutrally; the accept endpoint answers `account_exists` when a create
36
+ * collides.
37
+ */
38
+ export const invitationLookupSchema = z.object({
39
+ email: z.string(),
40
+ role: workspaceRoleSchema,
41
+ workspaceName: z.string(),
42
+ expiresAt: z.string()
43
+ });
44
+ export const invitationAcceptSchema = z.object({
45
+ token: z.string().min(16),
46
+ /** Required when the invited email has no account yet. */
47
+ name: plainText(1, 120).optional(),
48
+ password: z.string().min(12).max(256).optional()
49
+ });
50
+ export const invitationAcceptedSchema = z.object({
51
+ workspaceId: z.string(),
52
+ userId: z.string(),
53
+ role: workspaceRoleSchema
54
+ });
55
+ //# sourceMappingURL=invitations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invitations.js","sourceRoot":"","sources":["../../src/schemas/invitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,mBAAmB;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IACtC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE;IAChB,IAAI,EAAE,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC;CAC5C,CAAC,CAAC;AAGH;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,UAAU,EAAE,gBAAgB;IAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAC;AAGH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,mBAAmB;IACzB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IACzB,0DAA0D;IAC1D,IAAI,EAAE,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,QAAQ,EAAE;IAClC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,IAAI,EAAE,mBAAmB;CAC1B,CAAC,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { z } from 'zod';
2
+ import type { ScopeSchema } from './scope.js';
3
+ /**
4
+ * POST /api/v1/me/onboarding/dismiss (cloud edition ONLY; sessions only —
5
+ * machines 403 fail-closed via the scope allowlist, oss answers the JSON
6
+ * 404 terminator): records the explicit dismissal that flips
7
+ * `firstRunPending` to false, permanently (upsert; an earlier dismissal
8
+ * timestamp is preserved). Idempotent — dismissing twice is a no-op.
9
+ */
10
+ export declare const onboardingDismissedSchema: z.ZodObject<{
11
+ dismissed: z.ZodLiteral<true>;
12
+ }, z.core.$strip>;
13
+ export type OnboardingDismissed = z.infer<typeof onboardingDismissedSchema>;
14
+ /** `/me` reports the credential's scopes, so it is built per tool (../define.ts). */
15
+ export declare function defineMeSchemas<TScope extends string>(scopeSchema: ScopeSchema<TScope>): {
16
+ meResponseSchema: z.ZodObject<{
17
+ user: z.ZodObject<{
18
+ id: z.ZodString;
19
+ email: z.ZodString;
20
+ name: z.ZodString;
21
+ }, z.core.$strip>;
22
+ workspace: z.ZodNullable<z.ZodObject<{
23
+ id: z.ZodString;
24
+ name: z.ZodString;
25
+ hubOrigin: z.ZodBoolean;
26
+ look: z.ZodObject<{
27
+ theme: z.ZodNullable<z.ZodString>;
28
+ pattern: z.ZodNullable<z.ZodString>;
29
+ field: z.ZodNullable<z.ZodNumber>;
30
+ grain: z.ZodNullable<z.ZodNumber>;
31
+ }, z.core.$strip>;
32
+ }, z.core.$strip>>;
33
+ role: z.ZodNullable<z.ZodEnum<{
34
+ owner: "owner";
35
+ admin: "admin";
36
+ member: "member";
37
+ }>>;
38
+ origin: z.ZodNullable<z.ZodEnum<{
39
+ local: "local";
40
+ hub: "hub";
41
+ guest: "guest";
42
+ }>>;
43
+ via: z.ZodEnum<{
44
+ session: "session";
45
+ api_key: "api_key";
46
+ oauth: "oauth";
47
+ }>;
48
+ scopes: z.ZodNullable<z.ZodArray<ScopeSchema<TScope>>>;
49
+ apiKeyExpiresAt: z.ZodNullable<z.ZodString>;
50
+ workspaces: z.ZodArray<z.ZodObject<{
51
+ id: z.ZodString;
52
+ name: z.ZodString;
53
+ role: z.ZodEnum<{
54
+ owner: "owner";
55
+ admin: "admin";
56
+ member: "member";
57
+ }>;
58
+ hubOrigin: z.ZodBoolean;
59
+ centralAccountId: z.ZodNullable<z.ZodString>;
60
+ look: z.ZodObject<{
61
+ theme: z.ZodNullable<z.ZodString>;
62
+ pattern: z.ZodNullable<z.ZodString>;
63
+ field: z.ZodNullable<z.ZodNumber>;
64
+ grain: z.ZodNullable<z.ZodNumber>;
65
+ }, z.core.$strip>;
66
+ suspended: z.ZodBoolean;
67
+ default: z.ZodBoolean;
68
+ }, z.core.$strip>>;
69
+ activeWorkspaceId: z.ZodNullable<z.ZodString>;
70
+ hubManageUrl: z.ZodNullable<z.ZodString>;
71
+ canCreateWorkspace: z.ZodBoolean;
72
+ firstRunPending: z.ZodOptional<z.ZodBoolean>;
73
+ ssoOnly: z.ZodOptional<z.ZodBoolean>;
74
+ hubDenied: z.ZodOptional<z.ZodArray<z.ZodObject<{
75
+ id: z.ZodString;
76
+ name: z.ZodString;
77
+ }, z.core.$strip>>>;
78
+ hubNoAccessUrl: z.ZodOptional<z.ZodString>;
79
+ }, z.core.$strip>;
80
+ };
81
+ //# sourceMappingURL=me.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../src/schemas/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAG9C;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB;;iBAEpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqKtF"}
@@ -0,0 +1,178 @@
1
+ import { z } from 'zod';
2
+ import { workspaceRoleSchema } from './common.js';
3
+ import { workspaceLookSchema } from './workspaces.js';
4
+ /**
5
+ * POST /api/v1/me/onboarding/dismiss (cloud edition ONLY; sessions only —
6
+ * machines 403 fail-closed via the scope allowlist, oss answers the JSON
7
+ * 404 terminator): records the explicit dismissal that flips
8
+ * `firstRunPending` to false, permanently (upsert; an earlier dismissal
9
+ * timestamp is preserved). Idempotent — dismissing twice is a no-op.
10
+ */
11
+ export const onboardingDismissedSchema = z.object({
12
+ dismissed: z.literal(true)
13
+ });
14
+ /** `/me` reports the credential's scopes, so it is built per tool (../define.ts). */
15
+ export function defineMeSchemas(scopeSchema) {
16
+ /**
17
+ * GET /api/v1/me — the resolved AuthContext of the calling principal,
18
+ * whichever credential path it arrived on. The whoami for humans, keys, and
19
+ * (later) OAuth tokens alike; also the MCP get_me tool's backing endpoint.
20
+ *
21
+ * ZERO-MEMBERSHIP sessions answer 200 too (user-scoped federation): a LIVE
22
+ * session whose user holds no active membership — the cloud operator before
23
+ * break-glass, a hub user whose last org was removed — gets
24
+ * `{ workspaces: [], workspace: null, activeWorkspaceId: null, role: null,
25
+ * origin: null, via: 'session' }` instead of a 401, so the dashboard can
26
+ * render the no-organization zero state instead of a login bounce. Machine
27
+ * credentials never see this shape: a key/token whose user has no active
28
+ * membership fails resolution (401) before the route runs.
29
+ */
30
+ const meResponseSchema = z.object({
31
+ user: z.object({
32
+ id: z.string(),
33
+ email: z.string(),
34
+ name: z.string()
35
+ }),
36
+ /**
37
+ * The ACTIVE workspace this request resolved to (= activeWorkspaceId).
38
+ * Null ONLY for the zero-membership session state described above.
39
+ */
40
+ workspace: z
41
+ .object({
42
+ id: z.string(),
43
+ name: z.string(),
44
+ /**
45
+ * True when this workspace is the lazy projection of a hub org (cloud
46
+ * edition, internal/federation.md) — its MEMBERSHIP is managed at the hub,
47
+ * so clients hide local member/invitation management and link out
48
+ * (P7). Derived from `centralAccountId IS NOT NULL`; the raw hub org
49
+ * id is deliberately never exposed. Always false on oss.
50
+ */
51
+ hubOrigin: z.boolean(),
52
+ /** The workspace's look, a fact of the workspace (schemas/workspaces.ts). */
53
+ look: workspaceLookSchema
54
+ })
55
+ .nullable(),
56
+ /** Null only in the zero-membership session state. */
57
+ role: workspaceRoleSchema.nullable(),
58
+ /**
59
+ * How the caller's membership of the ACTIVE workspace came to exist
60
+ * (mirrors Principal.origin): 'local' = setup/invitation, 'hub' = SSO
61
+ * projection (cloud), 'guest' = a per-resource collaborator (D2) — clients
62
+ * hide the guest-forbidden workspace surfaces (resource creation, files,
63
+ * member roster, export) for 'guest'. Null only in the zero-membership
64
+ * session state.
65
+ */
66
+ origin: z.enum(['local', 'hub', 'guest']).nullable(),
67
+ via: z.enum(['session', 'api_key', 'oauth']),
68
+ scopes: z.array(scopeSchema).nullable(),
69
+ /** Expiry of the presented API key; null for sessions/OAuth or non-expiring keys. */
70
+ apiKeyExpiresAt: z.string().nullable(),
71
+ /**
72
+ * The workspaces this credential can name (user-scoped credential model):
73
+ * EVERY credential kind — session, API key, OAuth bearer — lists ALL of
74
+ * the user's active memberships; the target workspace is a per-request
75
+ * parameter (X-Workspace-Id), never baked into the credential. Clients
76
+ * MUST read the `default` flag to find the selector-less default — never
77
+ * assume index 0.
78
+ */
79
+ workspaces: z.array(z.object({
80
+ id: z.string(),
81
+ name: z.string(),
82
+ role: workspaceRoleSchema,
83
+ /** Same semantics as `workspace.hubOrigin`, per listed workspace. */
84
+ hubOrigin: z.boolean(),
85
+ /**
86
+ * The id of the hub organization this workspace projects (cloud
87
+ * edition), null on a local workspace and always on self-hosted. It
88
+ * is the person's own organization id, the one the account site
89
+ * shows them, and it is what `--org <hub org id or name>` resolves
90
+ * against: a request may name a workspace by this id in
91
+ * X-Workspace-Id as well as by `id` (PRDCT-2947).
92
+ */
93
+ centralAccountId: z.string().nullable(),
94
+ /** Each workspace's look, so the switcher's tiles carry them (schemas/workspaces.ts). */
95
+ look: workspaceLookSchema,
96
+ /**
97
+ * The hub asserted this org suspended (cloud edition): it stays
98
+ * VISIBLE here but requests into it are refused. Always false on oss
99
+ * and on local workspaces.
100
+ */
101
+ suspended: z.boolean(),
102
+ /**
103
+ * The user's default workspace — what a request naming no workspace
104
+ * resolves to. At most one entry carries it; when none does, the
105
+ * deterministic fallback (oldest active membership) applies.
106
+ */
107
+ default: z.boolean()
108
+ })),
109
+ /**
110
+ * The workspace THIS request resolved to — what X-Workspace-Id selects.
111
+ * Null only in the zero-membership session state.
112
+ */
113
+ activeWorkspaceId: z.string().nullable(),
114
+ /**
115
+ * Where membership of the ACTIVE workspace is managed when it is
116
+ * hub-origin (the hub account console, e.g. https://account.antasphere.com)
117
+ * — the dashboard's link-out target (P7). Also set for the CLOUD
118
+ * zero-membership session state (the "create an organization at
119
+ * Antasphere" CTA target). null on oss and on local (non-projected)
120
+ * workspaces.
121
+ */
122
+ hubManageUrl: z.string().nullable(),
123
+ /**
124
+ * Whether `POST /workspaces` would be accepted for this caller RIGHT NOW
125
+ * (PRDCT-2444 / PRDCT-2443) — the one flag the dashboard keys its "new
126
+ * workspace" entry off, on both editions, never the edition itself. True
127
+ * only for a SESSION whose user is not guest-only, while the operator's
128
+ * `MAX_WORKSPACES_PER_USER` dial is not 0; on self-hosted the user must
129
+ * also own fewer workspaces than that cap, on cloud they must also hold a
130
+ * live Antasphere link (the organization is created there, as them).
131
+ * Always false for API keys and OAuth bearers. STAYS TRUE on cloud for a
132
+ * person whose stored sign-in predates workspace creation (the route then
133
+ * answers 401 `hub_reauth_required`): the creation is one sign-in away,
134
+ * and false would hide the entry from them for good. Advisory: the route
135
+ * re-judges everything, and on cloud the hub's own cap is only known once
136
+ * asked.
137
+ */
138
+ canCreateWorkspace: z.boolean(),
139
+ /**
140
+ * First-run welcome still owed (SL-6). CLOUD + SESSION callers ONLY —
141
+ * absent on oss and for every machine credential. TOOL-LOCAL and
142
+ * retry-safe semantics: true iff NO user_onboarding row with a dismissal
143
+ * exists (`NOT EXISTS (row WHERE dismissed_at IS NOT NULL)`), so a lost
144
+ * first-login write still shows the welcome and only an explicit
145
+ * POST /me/onboarding/dismiss (or the deploy backfill) ever hides it.
146
+ * The hub's advisory `tool_first_login` claim plays no part.
147
+ */
148
+ firstRunPending: z.boolean().optional(),
149
+ /**
150
+ * The hint-watch discriminator (SL-4/SL-6). CLOUD + SESSION callers ONLY
151
+ * — absent on oss and for machine credentials. True iff the user's ONLY
152
+ * way in is hub SSO: they hold an `antasphere` account row AND no local
153
+ * credential (password) account row. A break-glass-capable operator has
154
+ * a credential account and is therefore NEVER ssoOnly — the dashboard's
155
+ * hint-watch may auto-sign-out ssoOnly users when the hub hint cookie
156
+ * disappears, and must never sign out an operator.
157
+ */
158
+ ssoOnly: z.boolean().optional(),
159
+ /**
160
+ * The organizations the person belongs to at Antasphere that do NOT open
161
+ * this tool to them (the organization lets only some of its teams use
162
+ * it). CLOUD + SESSION callers only; absent on the self-hosted edition
163
+ * and for machine credentials, and a reader treats an absent field as
164
+ * none (an older server never sends it). A hint for the refusal page,
165
+ * read from the hub's last answer as the person: the hub is the truth,
166
+ * never this list.
167
+ */
168
+ hubDenied: z.array(z.object({ id: z.string(), name: z.string() })).optional(),
169
+ /**
170
+ * The Antasphere page that lists whom to ask for this tool (the owners
171
+ * and admins of the refusing organization), ready-made with the tool's
172
+ * client id. CLOUD + SESSION callers only; absent otherwise.
173
+ */
174
+ hubNoAccessUrl: z.string().optional()
175
+ });
176
+ return { meResponseSchema };
177
+ }
178
+ //# sourceMappingURL=me.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"me.js","sourceRoot":"","sources":["../../src/schemas/me.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,60 @@
1
+ import { z } from 'zod';
2
+ export declare const memberSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ userId: z.ZodString;
5
+ email: z.ZodString;
6
+ name: z.ZodString;
7
+ role: z.ZodEnum<{
8
+ owner: "owner";
9
+ admin: "admin";
10
+ member: "member";
11
+ }>;
12
+ isActive: z.ZodBoolean;
13
+ createdAt: z.ZodString;
14
+ lastSeenAt: z.ZodNullable<z.ZodString>;
15
+ }, z.core.$strip>;
16
+ export type Member = z.infer<typeof memberSchema>;
17
+ export declare const membersListSchema: z.ZodObject<{
18
+ members: z.ZodArray<z.ZodObject<{
19
+ id: z.ZodString;
20
+ userId: z.ZodString;
21
+ email: z.ZodString;
22
+ name: z.ZodString;
23
+ role: z.ZodEnum<{
24
+ owner: "owner";
25
+ admin: "admin";
26
+ member: "member";
27
+ }>;
28
+ isActive: z.ZodBoolean;
29
+ createdAt: z.ZodString;
30
+ lastSeenAt: z.ZodNullable<z.ZodString>;
31
+ }, z.core.$strip>>;
32
+ nextCursor: z.ZodNullable<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ export declare const memberUpdateSchema: z.ZodObject<{
35
+ role: z.ZodOptional<z.ZodEnum<{
36
+ owner: "owner";
37
+ admin: "admin";
38
+ member: "member";
39
+ }>>;
40
+ isActive: z.ZodOptional<z.ZodBoolean>;
41
+ }, z.core.$strip>;
42
+ export type MemberUpdate = z.infer<typeof memberUpdateSchema>;
43
+ /** Admin-generated password reset link for a member (the SMTP-free recovery path). */
44
+ export declare const memberResetLinkSchema: z.ZodObject<{
45
+ resetUrl: z.ZodString;
46
+ expiresAt: z.ZodString;
47
+ }, z.core.$strip>;
48
+ export type MemberResetLink = z.infer<typeof memberResetLinkSchema>;
49
+ /** Admin-generated email change link for a member (the SMTP-free email-change path). */
50
+ export declare const memberChangeEmailLinkRequestSchema: z.ZodObject<{
51
+ newEmail: z.ZodEmail;
52
+ }, z.core.$strip>;
53
+ export type MemberChangeEmailLinkRequest = z.infer<typeof memberChangeEmailLinkRequestSchema>;
54
+ export declare const memberChangeEmailLinkSchema: z.ZodObject<{
55
+ verifyUrl: z.ZodString;
56
+ newEmail: z.ZodString;
57
+ expiresAt: z.ZodString;
58
+ }, z.core.$strip>;
59
+ export type MemberChangeEmailLink = z.infer<typeof memberChangeEmailLinkSchema>;
60
+ //# sourceMappingURL=members.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"members.d.ts","sourceRoot":"","sources":["../../src/schemas/members.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;iBASvB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;iBAG5B,CAAC;AAMH,eAAO,MAAM,kBAAkB;;;;;;;iBAO3B,CAAC;AACL,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,sFAAsF;AACtF,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,wFAAwF;AACxF,eAAO,MAAM,kCAAkC;;iBAE7C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F,eAAO,MAAM,2BAA2B;;;;iBAItC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod';
2
+ import { workspaceRoleSchema } from './common.js';
3
+ export const memberSchema = z.object({
4
+ id: z.string(),
5
+ userId: z.string(),
6
+ email: z.string(),
7
+ name: z.string(),
8
+ role: workspaceRoleSchema,
9
+ isActive: z.boolean(),
10
+ createdAt: z.string(),
11
+ lastSeenAt: z.string().nullable()
12
+ });
13
+ export const membersListSchema = z.object({
14
+ members: z.array(memberSchema),
15
+ nextCursor: z.string().nullable()
16
+ });
17
+ // Both fields optional, so an empty body must be refused HERE: `{}` used to
18
+ // pass validation and build an empty drizzle `.set({})`, which Postgres
19
+ // refuses — an anonymous-shaped 500 for a plain client mistake (FUZZ-5,
20
+ // PRDCT-1358).
21
+ export const memberUpdateSchema = z
22
+ .object({
23
+ role: workspaceRoleSchema.optional(),
24
+ isActive: z.boolean().optional()
25
+ })
26
+ .refine((v) => v.role !== undefined || v.isActive !== undefined, {
27
+ error: 'at least one of role or isActive is required'
28
+ });
29
+ /** Admin-generated password reset link for a member (the SMTP-free recovery path). */
30
+ export const memberResetLinkSchema = z.object({
31
+ resetUrl: z.string(),
32
+ expiresAt: z.string()
33
+ });
34
+ /** Admin-generated email change link for a member (the SMTP-free email-change path). */
35
+ export const memberChangeEmailLinkRequestSchema = z.object({
36
+ newEmail: z.email()
37
+ });
38
+ export const memberChangeEmailLinkSchema = z.object({
39
+ verifyUrl: z.string(),
40
+ newEmail: z.string(),
41
+ expiresAt: z.string()
42
+ });
43
+ //# sourceMappingURL=members.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"members.js","sourceRoot":"","sources":["../../src/schemas/members.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC;IAC9B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC;AAEH,4EAA4E;AAC5E,wEAAwE;AACxE,wEAAwE;AACxE,eAAe;AACf,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,CAAC;IACN,IAAI,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IACpC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC;KACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS,EAAE;IAC/D,KAAK,EAAE,8CAA8C;CACtD,CAAC,CAAC;AAGL,sFAAsF;AACtF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAGH,wFAAwF;AACxF,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE;CACpB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC"}