@paperclipai/shared 2026.817.0 → 2026.818.0-beta.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.
- package/dist/adapter-auth-session.d.ts +16 -0
- package/dist/adapter-auth-session.d.ts.map +1 -0
- package/dist/adapter-auth-session.js +37 -0
- package/dist/adapter-auth-session.js.map +1 -0
- package/dist/company-import-transfer.d.ts +97 -0
- package/dist/company-import-transfer.d.ts.map +1 -0
- package/dist/company-import-transfer.js +50 -0
- package/dist/company-import-transfer.js.map +1 -0
- package/dist/constants.d.ts +19 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +50 -3
- package/dist/constants.js.map +1 -1
- package/dist/environment-support.d.ts +16 -1
- package/dist/environment-support.d.ts.map +1 -1
- package/dist/environment-support.js +25 -2
- package/dist/environment-support.js.map +1 -1
- package/dist/environment-support.test.js +20 -0
- package/dist/environment-support.test.js.map +1 -1
- package/dist/feature-catalog.d.ts.map +1 -1
- package/dist/feature-catalog.js +10 -3
- package/dist/feature-catalog.js.map +1 -1
- package/dist/index.d.ts +13 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/issue-thread-interactions.test.js +45 -1
- package/dist/issue-thread-interactions.test.js.map +1 -1
- package/dist/runtime-exposure/loopback-bind.d.ts +52 -0
- package/dist/runtime-exposure/loopback-bind.d.ts.map +1 -0
- package/dist/runtime-exposure/loopback-bind.js +93 -0
- package/dist/runtime-exposure/loopback-bind.js.map +1 -0
- package/dist/runtime-exposure/loopback-bind.test.d.ts +2 -0
- package/dist/runtime-exposure/loopback-bind.test.d.ts.map +1 -0
- package/dist/runtime-exposure/loopback-bind.test.js +93 -0
- package/dist/runtime-exposure/loopback-bind.test.js.map +1 -0
- package/dist/runtime-exposure/ports.d.ts +61 -0
- package/dist/runtime-exposure/ports.d.ts.map +1 -0
- package/dist/runtime-exposure/ports.js +96 -0
- package/dist/runtime-exposure/ports.js.map +1 -0
- package/dist/runtime-exposure/ports.test.d.ts +2 -0
- package/dist/runtime-exposure/ports.test.d.ts.map +1 -0
- package/dist/runtime-exposure/ports.test.js +46 -0
- package/dist/runtime-exposure/ports.test.js.map +1 -0
- package/dist/summary-slot.test.js +10 -1
- package/dist/summary-slot.test.js.map +1 -1
- package/dist/telemetry/events.d.ts +5 -0
- package/dist/telemetry/events.d.ts.map +1 -1
- package/dist/telemetry/events.js +7 -0
- package/dist/telemetry/events.js.map +1 -1
- package/dist/telemetry/generated/paperclip-telemetry.d.ts +20 -2
- package/dist/telemetry/generated/paperclip-telemetry.d.ts.map +1 -1
- package/dist/telemetry/generated/paperclip-telemetry.js +12 -0
- package/dist/telemetry/generated/paperclip-telemetry.js.map +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/retention.d.ts.map +1 -1
- package/dist/telemetry/retention.js +2 -0
- package/dist/telemetry/retention.js.map +1 -1
- package/dist/telemetry/retention.test.js +4 -0
- package/dist/telemetry/retention.test.js.map +1 -1
- package/dist/types/agent.adapter-auth-session.test.d.ts +2 -0
- package/dist/types/agent.adapter-auth-session.test.d.ts.map +1 -0
- package/dist/types/agent.adapter-auth-session.test.js +103 -0
- package/dist/types/agent.adapter-auth-session.test.js.map +1 -0
- package/dist/types/agent.d.ts +56 -0
- package/dist/types/agent.d.ts.map +1 -1
- package/dist/types/agent.js +50 -1
- package/dist/types/agent.js.map +1 -1
- package/dist/types/attention.d.ts +35 -0
- package/dist/types/attention.d.ts.map +1 -1
- package/dist/types/attention.js.map +1 -1
- package/dist/types/company-portability.d.ts +8 -0
- package/dist/types/company-portability.d.ts.map +1 -1
- package/dist/types/document-annotation.d.ts +17 -0
- package/dist/types/document-annotation.d.ts.map +1 -1
- package/dist/types/environment.d.ts +15 -12
- package/dist/types/environment.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -6
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/instance.d.ts +6 -1
- package/dist/types/instance.d.ts.map +1 -1
- package/dist/types/instance.js.map +1 -1
- package/dist/types/issue.d.ts +35 -7
- package/dist/types/issue.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +46 -0
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/runtime-exposure.d.ts +74 -0
- package/dist/types/runtime-exposure.d.ts.map +1 -0
- package/dist/types/runtime-exposure.js +12 -0
- package/dist/types/runtime-exposure.js.map +1 -0
- package/dist/types/workspace-file-resource.d.ts +25 -0
- package/dist/types/workspace-file-resource.d.ts.map +1 -1
- package/dist/types/workspace-runtime.d.ts +9 -0
- package/dist/types/workspace-runtime.d.ts.map +1 -1
- package/dist/validators/access.d.ts +6 -6
- package/dist/validators/adapter-auth-session.d.ts +129 -0
- package/dist/validators/adapter-auth-session.d.ts.map +1 -0
- package/dist/validators/adapter-auth-session.js +34 -0
- package/dist/validators/adapter-auth-session.js.map +1 -0
- package/dist/validators/adapter-registry.d.ts +2 -2
- package/dist/validators/adapter-skills.d.ts +22 -22
- package/dist/validators/agent.d.ts +316 -298
- package/dist/validators/agent.d.ts.map +1 -1
- package/dist/validators/agent.js +9 -0
- package/dist/validators/agent.js.map +1 -1
- package/dist/validators/app-definition.d.ts +156 -156
- package/dist/validators/artifact.d.ts +64 -64
- package/dist/validators/claude-setup-token-session.d.ts +244 -0
- package/dist/validators/claude-setup-token-session.d.ts.map +1 -0
- package/dist/validators/claude-setup-token-session.js +128 -0
- package/dist/validators/claude-setup-token-session.js.map +1 -0
- package/dist/validators/claude-setup-token-session.test.d.ts +2 -0
- package/dist/validators/claude-setup-token-session.test.d.ts.map +1 -0
- package/dist/validators/claude-setup-token-session.test.js +107 -0
- package/dist/validators/claude-setup-token-session.test.js.map +1 -0
- package/dist/validators/company-portability.d.ts +342 -294
- package/dist/validators/company-portability.d.ts.map +1 -1
- package/dist/validators/company-portability.js +6 -0
- package/dist/validators/company-portability.js.map +1 -1
- package/dist/validators/company-skill.d.ts +386 -386
- package/dist/validators/company.d.ts +120 -120
- package/dist/validators/cost.d.ts +8 -8
- package/dist/validators/decision-queue.d.ts +6 -6
- package/dist/validators/decision.d.ts +124 -124
- package/dist/validators/environment-custom-images.d.ts +8 -8
- package/dist/validators/environment.d.ts +16 -16
- package/dist/validators/execution-workspace.d.ts +38 -38
- package/dist/validators/finance.d.ts +12 -12
- package/dist/validators/folder.d.ts +38 -38
- package/dist/validators/index.d.ts +4 -3
- package/dist/validators/index.d.ts.map +1 -1
- package/dist/validators/index.js +4 -3
- package/dist/validators/index.js.map +1 -1
- package/dist/validators/instance.d.ts +30 -16
- package/dist/validators/instance.d.ts.map +1 -1
- package/dist/validators/instance.js +2 -1
- package/dist/validators/instance.js.map +1 -1
- package/dist/validators/issue-tree-control.d.ts +4 -4
- package/dist/validators/issue.d.ts +1254 -1156
- package/dist/validators/issue.d.ts.map +1 -1
- package/dist/validators/issue.js +59 -5
- package/dist/validators/issue.js.map +1 -1
- package/dist/validators/onboarding-seed.d.ts +64 -0
- package/dist/validators/onboarding-seed.d.ts.map +1 -0
- package/dist/validators/onboarding-seed.js +33 -0
- package/dist/validators/onboarding-seed.js.map +1 -0
- package/dist/validators/pipeline.d.ts +96 -96
- package/dist/validators/plugin.d.ts +325 -184
- package/dist/validators/plugin.d.ts.map +1 -1
- package/dist/validators/plugin.js +14 -0
- package/dist/validators/plugin.js.map +1 -1
- package/dist/validators/plugin.test.js +80 -0
- package/dist/validators/plugin.test.js.map +1 -1
- package/dist/validators/project.d.ts +216 -216
- package/dist/validators/routine.d.ts +148 -148
- package/dist/validators/runtime-exposure.d.ts +149 -0
- package/dist/validators/runtime-exposure.d.ts.map +1 -0
- package/dist/validators/runtime-exposure.js +138 -0
- package/dist/validators/runtime-exposure.js.map +1 -0
- package/dist/validators/runtime-exposure.test.d.ts +2 -0
- package/dist/validators/runtime-exposure.test.d.ts.map +1 -0
- package/dist/validators/runtime-exposure.test.js +112 -0
- package/dist/validators/runtime-exposure.test.js.map +1 -0
- package/dist/validators/search.d.ts +13 -13
- package/dist/validators/secret.d.ts +53 -53
- package/dist/validators/status-card.d.ts +34 -34
- package/dist/validators/summary-slot.d.ts +6 -6
- package/dist/validators/summary-slot.d.ts.map +1 -1
- package/dist/validators/teams-catalog.d.ts +30 -30
- package/dist/validators/tool-access.d.ts +179 -179
- package/dist/validators/trust-policy.d.ts +18 -18
- package/dist/validators/work-product.d.ts +21 -21
- package/dist/validators/workspace-file-resource.d.ts +430 -16
- package/dist/validators/workspace-file-resource.d.ts.map +1 -1
- package/dist/validators/workspace-file-resource.js +19 -0
- package/dist/validators/workspace-file-resource.js.map +1 -1
- package/dist/workspace-file-resource.test.d.ts +2 -0
- package/dist/workspace-file-resource.test.d.ts.map +1 -0
- package/dist/workspace-file-resource.test.js +52 -0
- package/dist/workspace-file-resource.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const setupTokenTransportAdvisorySchema: z.ZodObject<{
|
|
3
|
+
code: z.ZodLiteral<"insecure_transport">;
|
|
4
|
+
}, "strict", z.ZodTypeAny, {
|
|
5
|
+
code: "insecure_transport";
|
|
6
|
+
}, {
|
|
7
|
+
code: "insecure_transport";
|
|
8
|
+
}>;
|
|
9
|
+
export type SetupTokenTransportAdvisory = z.infer<typeof setupTokenTransportAdvisorySchema>;
|
|
10
|
+
export declare const claudeSetupTokenOverwriteSchema: z.ZodObject<{
|
|
11
|
+
expectedSecretId: z.ZodString;
|
|
12
|
+
expectedLatestVersion: z.ZodNumber;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
expectedSecretId: string;
|
|
15
|
+
expectedLatestVersion: number;
|
|
16
|
+
}, {
|
|
17
|
+
expectedSecretId: string;
|
|
18
|
+
expectedLatestVersion: number;
|
|
19
|
+
}>;
|
|
20
|
+
export type ClaudeSetupTokenOverwrite = z.infer<typeof claudeSetupTokenOverwriteSchema>;
|
|
21
|
+
export declare const startClaudeSetupTokenSessionRequestSchema: z.ZodObject<{
|
|
22
|
+
environmentId: z.ZodString;
|
|
23
|
+
adapterType: z.ZodEnum<["process", "http", "claude_local", "codex_local", "cursor_cloud", "gemini_local", "grok_local", "hermes_gateway", "hermes_local", "opencode_local", "pi_local", "cursor", "openclaw_gateway"]>;
|
|
24
|
+
overwrite: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
expectedSecretId: z.ZodString;
|
|
26
|
+
expectedLatestVersion: z.ZodNumber;
|
|
27
|
+
}, "strict", z.ZodTypeAny, {
|
|
28
|
+
expectedSecretId: string;
|
|
29
|
+
expectedLatestVersion: number;
|
|
30
|
+
}, {
|
|
31
|
+
expectedSecretId: string;
|
|
32
|
+
expectedLatestVersion: number;
|
|
33
|
+
}>>;
|
|
34
|
+
}, "strict", z.ZodTypeAny, {
|
|
35
|
+
adapterType: "process" | "http" | "claude_local" | "codex_local" | "cursor_cloud" | "gemini_local" | "grok_local" | "hermes_gateway" | "hermes_local" | "opencode_local" | "pi_local" | "cursor" | "openclaw_gateway";
|
|
36
|
+
environmentId: string;
|
|
37
|
+
overwrite?: {
|
|
38
|
+
expectedSecretId: string;
|
|
39
|
+
expectedLatestVersion: number;
|
|
40
|
+
} | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
adapterType: "process" | "http" | "claude_local" | "codex_local" | "cursor_cloud" | "gemini_local" | "grok_local" | "hermes_gateway" | "hermes_local" | "opencode_local" | "pi_local" | "cursor" | "openclaw_gateway";
|
|
43
|
+
environmentId: string;
|
|
44
|
+
overwrite?: {
|
|
45
|
+
expectedSecretId: string;
|
|
46
|
+
expectedLatestVersion: number;
|
|
47
|
+
} | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
export type StartClaudeSetupTokenSessionRequest = z.infer<typeof startClaudeSetupTokenSessionRequestSchema>;
|
|
50
|
+
export declare const adapterAuthPanelModeSchema: z.ZodEnum<["displayed_code", "submitted_browser_code"]>;
|
|
51
|
+
export type AdapterAuthPanelMode = z.infer<typeof adapterAuthPanelModeSchema>;
|
|
52
|
+
export declare const claudeSetupTokenSessionResponseSchema: z.ZodObject<{
|
|
53
|
+
sessionId: z.ZodString;
|
|
54
|
+
environmentId: z.ZodString;
|
|
55
|
+
status: z.ZodEnum<["starting", "waiting_for_user", "authenticated", "failed", "timed_out", "cancelled"]>;
|
|
56
|
+
expiresAt: z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodString]>>;
|
|
57
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
58
|
+
reason: z.ZodString;
|
|
59
|
+
message: z.ZodNullable<z.ZodString>;
|
|
60
|
+
}, "strict", z.ZodTypeAny, {
|
|
61
|
+
message: string | null;
|
|
62
|
+
reason: string;
|
|
63
|
+
}, {
|
|
64
|
+
message: string | null;
|
|
65
|
+
reason: string;
|
|
66
|
+
}>>;
|
|
67
|
+
transportAdvisory: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
68
|
+
code: z.ZodLiteral<"insecure_transport">;
|
|
69
|
+
}, "strict", z.ZodTypeAny, {
|
|
70
|
+
code: "insecure_transport";
|
|
71
|
+
}, {
|
|
72
|
+
code: "insecure_transport";
|
|
73
|
+
}>>>;
|
|
74
|
+
}, "strict", z.ZodTypeAny, {
|
|
75
|
+
failure: {
|
|
76
|
+
message: string | null;
|
|
77
|
+
reason: string;
|
|
78
|
+
} | null;
|
|
79
|
+
status: "authenticated" | "cancelled" | "failed" | "starting" | "waiting_for_user" | "timed_out";
|
|
80
|
+
environmentId: string;
|
|
81
|
+
expiresAt: string | Date | null;
|
|
82
|
+
sessionId: string;
|
|
83
|
+
transportAdvisory?: {
|
|
84
|
+
code: "insecure_transport";
|
|
85
|
+
} | null | undefined;
|
|
86
|
+
}, {
|
|
87
|
+
failure: {
|
|
88
|
+
message: string | null;
|
|
89
|
+
reason: string;
|
|
90
|
+
} | null;
|
|
91
|
+
status: "authenticated" | "cancelled" | "failed" | "starting" | "waiting_for_user" | "timed_out";
|
|
92
|
+
environmentId: string;
|
|
93
|
+
expiresAt: string | Date | null;
|
|
94
|
+
sessionId: string;
|
|
95
|
+
transportAdvisory?: {
|
|
96
|
+
code: "insecure_transport";
|
|
97
|
+
} | null | undefined;
|
|
98
|
+
}>;
|
|
99
|
+
export type ClaudeSetupTokenSessionResponse = z.infer<typeof claudeSetupTokenSessionResponseSchema>;
|
|
100
|
+
export declare const claudeSetupTokenSessionPromptSchema: z.ZodObject<{
|
|
101
|
+
authorizationUrl: z.ZodString;
|
|
102
|
+
transportAdvisory: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
103
|
+
code: z.ZodLiteral<"insecure_transport">;
|
|
104
|
+
}, "strict", z.ZodTypeAny, {
|
|
105
|
+
code: "insecure_transport";
|
|
106
|
+
}, {
|
|
107
|
+
code: "insecure_transport";
|
|
108
|
+
}>>>;
|
|
109
|
+
}, "strict", z.ZodTypeAny, {
|
|
110
|
+
authorizationUrl: string;
|
|
111
|
+
transportAdvisory?: {
|
|
112
|
+
code: "insecure_transport";
|
|
113
|
+
} | null | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
authorizationUrl: string;
|
|
116
|
+
transportAdvisory?: {
|
|
117
|
+
code: "insecure_transport";
|
|
118
|
+
} | null | undefined;
|
|
119
|
+
}>;
|
|
120
|
+
export type ClaudeSetupTokenSessionPrompt = z.infer<typeof claudeSetupTokenSessionPromptSchema>;
|
|
121
|
+
export declare const claudeSetupTokenSessionOwnerResponseSchema: z.ZodObject<{
|
|
122
|
+
sessionId: z.ZodString;
|
|
123
|
+
environmentId: z.ZodString;
|
|
124
|
+
status: z.ZodEnum<["starting", "waiting_for_user", "authenticated", "failed", "timed_out", "cancelled"]>;
|
|
125
|
+
expiresAt: z.ZodNullable<z.ZodUnion<[z.ZodDate, z.ZodString]>>;
|
|
126
|
+
failure: z.ZodNullable<z.ZodObject<{
|
|
127
|
+
reason: z.ZodString;
|
|
128
|
+
message: z.ZodNullable<z.ZodString>;
|
|
129
|
+
}, "strict", z.ZodTypeAny, {
|
|
130
|
+
message: string | null;
|
|
131
|
+
reason: string;
|
|
132
|
+
}, {
|
|
133
|
+
message: string | null;
|
|
134
|
+
reason: string;
|
|
135
|
+
}>>;
|
|
136
|
+
transportAdvisory: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
137
|
+
code: z.ZodLiteral<"insecure_transport">;
|
|
138
|
+
}, "strict", z.ZodTypeAny, {
|
|
139
|
+
code: "insecure_transport";
|
|
140
|
+
}, {
|
|
141
|
+
code: "insecure_transport";
|
|
142
|
+
}>>>;
|
|
143
|
+
} & {
|
|
144
|
+
panelMode: z.ZodEnum<["displayed_code", "submitted_browser_code"]>;
|
|
145
|
+
prompt: z.ZodNullable<z.ZodObject<{
|
|
146
|
+
authorizationUrl: z.ZodString;
|
|
147
|
+
transportAdvisory: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
148
|
+
code: z.ZodLiteral<"insecure_transport">;
|
|
149
|
+
}, "strict", z.ZodTypeAny, {
|
|
150
|
+
code: "insecure_transport";
|
|
151
|
+
}, {
|
|
152
|
+
code: "insecure_transport";
|
|
153
|
+
}>>>;
|
|
154
|
+
}, "strict", z.ZodTypeAny, {
|
|
155
|
+
authorizationUrl: string;
|
|
156
|
+
transportAdvisory?: {
|
|
157
|
+
code: "insecure_transport";
|
|
158
|
+
} | null | undefined;
|
|
159
|
+
}, {
|
|
160
|
+
authorizationUrl: string;
|
|
161
|
+
transportAdvisory?: {
|
|
162
|
+
code: "insecure_transport";
|
|
163
|
+
} | null | undefined;
|
|
164
|
+
}>>;
|
|
165
|
+
}, "strict", z.ZodTypeAny, {
|
|
166
|
+
failure: {
|
|
167
|
+
message: string | null;
|
|
168
|
+
reason: string;
|
|
169
|
+
} | null;
|
|
170
|
+
prompt: {
|
|
171
|
+
authorizationUrl: string;
|
|
172
|
+
transportAdvisory?: {
|
|
173
|
+
code: "insecure_transport";
|
|
174
|
+
} | null | undefined;
|
|
175
|
+
} | null;
|
|
176
|
+
status: "authenticated" | "cancelled" | "failed" | "starting" | "waiting_for_user" | "timed_out";
|
|
177
|
+
environmentId: string;
|
|
178
|
+
expiresAt: string | Date | null;
|
|
179
|
+
sessionId: string;
|
|
180
|
+
panelMode: "displayed_code" | "submitted_browser_code";
|
|
181
|
+
transportAdvisory?: {
|
|
182
|
+
code: "insecure_transport";
|
|
183
|
+
} | null | undefined;
|
|
184
|
+
}, {
|
|
185
|
+
failure: {
|
|
186
|
+
message: string | null;
|
|
187
|
+
reason: string;
|
|
188
|
+
} | null;
|
|
189
|
+
prompt: {
|
|
190
|
+
authorizationUrl: string;
|
|
191
|
+
transportAdvisory?: {
|
|
192
|
+
code: "insecure_transport";
|
|
193
|
+
} | null | undefined;
|
|
194
|
+
} | null;
|
|
195
|
+
status: "authenticated" | "cancelled" | "failed" | "starting" | "waiting_for_user" | "timed_out";
|
|
196
|
+
environmentId: string;
|
|
197
|
+
expiresAt: string | Date | null;
|
|
198
|
+
sessionId: string;
|
|
199
|
+
panelMode: "displayed_code" | "submitted_browser_code";
|
|
200
|
+
transportAdvisory?: {
|
|
201
|
+
code: "insecure_transport";
|
|
202
|
+
} | null | undefined;
|
|
203
|
+
}>;
|
|
204
|
+
export type ClaudeSetupTokenSessionOwnerResponse = z.infer<typeof claudeSetupTokenSessionOwnerResponseSchema>;
|
|
205
|
+
export declare const BROWSER_CODE_MAX_LENGTH = 512;
|
|
206
|
+
export declare const BROWSER_CODE_DISALLOWED_CHAR: RegExp;
|
|
207
|
+
/**
|
|
208
|
+
* Returns true when the browser code obeys the grammar. The code has one or more
|
|
209
|
+
* characters, no character outside the visible ASCII range, and a length at or
|
|
210
|
+
* below the bounded maximum.
|
|
211
|
+
*/
|
|
212
|
+
export declare function isValidBrowserCode(code: string): boolean;
|
|
213
|
+
export declare const BROWSER_CODE_PATTERN: RegExp;
|
|
214
|
+
export declare const browserCodeSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
215
|
+
export type BrowserCode = z.infer<typeof browserCodeSchema>;
|
|
216
|
+
export declare const submitBrowserCodeRequestSchema: z.ZodObject<{
|
|
217
|
+
browserCode: z.ZodEffects<z.ZodString, string, string>;
|
|
218
|
+
}, "strict", z.ZodTypeAny, {
|
|
219
|
+
browserCode: string;
|
|
220
|
+
}, {
|
|
221
|
+
browserCode: string;
|
|
222
|
+
}>;
|
|
223
|
+
export type SubmitBrowserCodeRequest = z.infer<typeof submitBrowserCodeRequestSchema>;
|
|
224
|
+
export declare const storedSessionIdSchema: z.ZodString;
|
|
225
|
+
export declare const claudeSetupTokenCompletionResponseSchema: z.ZodObject<{
|
|
226
|
+
storedSessionId: z.ZodString;
|
|
227
|
+
}, "strict", z.ZodTypeAny, {
|
|
228
|
+
storedSessionId: string;
|
|
229
|
+
}, {
|
|
230
|
+
storedSessionId: string;
|
|
231
|
+
}>;
|
|
232
|
+
export type ClaudeSetupTokenCompletionResponse = z.infer<typeof claudeSetupTokenCompletionResponseSchema>;
|
|
233
|
+
export declare const claudeOAuthTokenStatusResponseSchema: z.ZodObject<{
|
|
234
|
+
secretId: z.ZodString;
|
|
235
|
+
latestVersion: z.ZodNumber;
|
|
236
|
+
}, "strict", z.ZodTypeAny, {
|
|
237
|
+
secretId: string;
|
|
238
|
+
latestVersion: number;
|
|
239
|
+
}, {
|
|
240
|
+
secretId: string;
|
|
241
|
+
latestVersion: number;
|
|
242
|
+
}>;
|
|
243
|
+
export type ClaudeOAuthTokenStatusResponse = z.infer<typeof claudeOAuthTokenStatusResponseSchema>;
|
|
244
|
+
//# sourceMappingURL=claude-setup-token-session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-setup-token-session.d.ts","sourceRoot":"","sources":["../../src/validators/claude-setup-token-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MA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CAMxD;AAQD,eAAO,MAAM,oBAAoB,QAAoB,CAAC;AAMtD,eAAO,MAAM,iBAAiB,2CAO1B,CAAC;AACL,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAG5D,eAAO,MAAM,8BAA8B;;;;;;EAEhC,CAAC;AACZ,MAAM,MAAM,wBAAwB,GAClC,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAIjD,eAAO,MAAM,qBAAqB,aAA6B,CAAC;AAKhE,eAAO,MAAM,wCAAwC;;;;;;EAE1C,CAAC;AACZ,MAAM,MAAM,kCAAkC,GAC5C,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC;AAO3D,eAAO,MAAM,oCAAoC;;;;;;;;;EAGtC,CAAC;AACZ,MAAM,MAAM,8BAA8B,GACxC,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AGENT_ADAPTER_TYPES } from "../constants.js";
|
|
3
|
+
import { ADAPTER_AUTH_PANEL_MODES, SETUP_TOKEN_TRANSPORT_ADVISORY_CODE } from "../types/agent.js";
|
|
4
|
+
import { adapterAuthSessionFailureSchema, adapterAuthSessionStatusSchema, } from "./adapter-auth-session.js";
|
|
5
|
+
const isoDateTime = z.union([z.date(), z.string().datetime()]);
|
|
6
|
+
// The transport advisory schema. A guarded confidential response carries it when
|
|
7
|
+
// the login rides a non-confidential transport. The client shows a disclaimer.
|
|
8
|
+
export const setupTokenTransportAdvisorySchema = z.object({
|
|
9
|
+
code: z.literal(SETUP_TOKEN_TRANSPORT_ADVISORY_CODE),
|
|
10
|
+
}).strict();
|
|
11
|
+
// The confirmed-overwrite capture for a replacement login. The client reads the
|
|
12
|
+
// stored value metadata from the status route and passes it back when it starts
|
|
13
|
+
// a replacement login. The server maps it to the owner-bound compare-and-set: it
|
|
14
|
+
// rotates the value only when the captured version still matches. The server
|
|
15
|
+
// still derives the owner and the definition; this body carries no owner. A
|
|
16
|
+
// missing capture starts a first-write login instead.
|
|
17
|
+
export const claudeSetupTokenOverwriteSchema = z.object({
|
|
18
|
+
expectedSecretId: z.string().uuid(),
|
|
19
|
+
expectedLatestVersion: z.number().int().min(1),
|
|
20
|
+
}).strict();
|
|
21
|
+
// The start request for a company-and-environment Claude login session. The
|
|
22
|
+
// company and the owner user come from the authenticated caller, not from this
|
|
23
|
+
// body. The body names the adapter and the environment of the login. It reuses
|
|
24
|
+
// the adapter login-session request fields; every field has the same meaning.
|
|
25
|
+
//
|
|
26
|
+
// The optional `overwrite` capture turns the login into a confirmed replacement.
|
|
27
|
+
// The client sends it only after a stored token fails the agent test. The server
|
|
28
|
+
// rotates the stored value under the captured version, so a concurrent change
|
|
29
|
+
// fails closed with a stale conflict.
|
|
30
|
+
//
|
|
31
|
+
// `.strict()` rejects an extra field, so an agent id never validates. The scope
|
|
32
|
+
// carries no agent id: a hire flow with no agent still starts one session. The
|
|
33
|
+
// runtime does not support a caller-supplied session length, so the schema
|
|
34
|
+
// exposes no `ttlSeconds` field; a legacy `ttlSeconds` fails the strict parse.
|
|
35
|
+
export const startClaudeSetupTokenSessionRequestSchema = z.object({
|
|
36
|
+
environmentId: z.string().uuid(),
|
|
37
|
+
adapterType: z.enum(AGENT_ADAPTER_TYPES),
|
|
38
|
+
overwrite: claudeSetupTokenOverwriteSchema.optional(),
|
|
39
|
+
}).strict();
|
|
40
|
+
// The panel-mode schema. It accepts only the two known panel modes.
|
|
41
|
+
export const adapterAuthPanelModeSchema = z.enum(ADAPTER_AUTH_PANEL_MODES);
|
|
42
|
+
// The session id is an opaque, cryptographically random string, not a UUID. So
|
|
43
|
+
// the schema accepts a bounded opaque string, not a UUID.
|
|
44
|
+
const sessionIdSchema = z.string().min(1).max(256);
|
|
45
|
+
// The public Claude login-session response schema. `.strict()` rejects an extra
|
|
46
|
+
// field, so a prompt, a token, an account identifier, or a provider lease
|
|
47
|
+
// identifier never validates.
|
|
48
|
+
export const claudeSetupTokenSessionResponseSchema = z.object({
|
|
49
|
+
sessionId: sessionIdSchema,
|
|
50
|
+
environmentId: z.string().uuid(),
|
|
51
|
+
status: adapterAuthSessionStatusSchema,
|
|
52
|
+
expiresAt: isoDateTime.nullable(),
|
|
53
|
+
failure: adapterAuthSessionFailureSchema.nullable(),
|
|
54
|
+
transportAdvisory: setupTokenTransportAdvisorySchema.nullable().optional(),
|
|
55
|
+
}).strict();
|
|
56
|
+
// The one-time Claude login prompt schema. It carries the authorization URL the
|
|
57
|
+
// user opens. It carries no server-displayed code.
|
|
58
|
+
export const claudeSetupTokenSessionPromptSchema = z.object({
|
|
59
|
+
authorizationUrl: z.string().min(1),
|
|
60
|
+
transportAdvisory: setupTokenTransportAdvisorySchema.nullable().optional(),
|
|
61
|
+
}).strict();
|
|
62
|
+
// The owner read schema. It adds the panel mode and the one-time prompt to the
|
|
63
|
+
// public response.
|
|
64
|
+
export const claudeSetupTokenSessionOwnerResponseSchema = claudeSetupTokenSessionResponseSchema.extend({
|
|
65
|
+
panelMode: adapterAuthPanelModeSchema,
|
|
66
|
+
prompt: claudeSetupTokenSessionPromptSchema.nullable(),
|
|
67
|
+
}).strict();
|
|
68
|
+
// The bounded maximum length of a browser code. The provider code is short. The
|
|
69
|
+
// server rejects an oversized code before it reaches the live login process.
|
|
70
|
+
export const BROWSER_CODE_MAX_LENGTH = 512;
|
|
71
|
+
// The conservative printable grammar for the submitted browser code. It matches
|
|
72
|
+
// one character outside the visible ASCII range (0x21-0x7E). The validator
|
|
73
|
+
// rejects a code that contains a match, so it rejects a space, a carriage
|
|
74
|
+
// return, a line feed, a NUL, and every other control byte. A later
|
|
75
|
+
// characterization test narrows this set to the exact provider format.
|
|
76
|
+
export const BROWSER_CODE_DISALLOWED_CHAR = /[^\x21-\x7E]/;
|
|
77
|
+
/**
|
|
78
|
+
* Returns true when the browser code obeys the grammar. The code has one or more
|
|
79
|
+
* characters, no character outside the visible ASCII range, and a length at or
|
|
80
|
+
* below the bounded maximum.
|
|
81
|
+
*/
|
|
82
|
+
export function isValidBrowserCode(code) {
|
|
83
|
+
return (code.length >= 1 &&
|
|
84
|
+
code.length <= BROWSER_CODE_MAX_LENGTH &&
|
|
85
|
+
!BROWSER_CODE_DISALLOWED_CHAR.test(code));
|
|
86
|
+
}
|
|
87
|
+
// The printable-ASCII allowlist pattern for the published contract. It is an
|
|
88
|
+
// anchored allowlist of the visible ASCII range (0x21-0x7E). The converter reads
|
|
89
|
+
// this `.regex()` from the inner `ZodString` and emits it as the OpenAPI
|
|
90
|
+
// `pattern`. It is NOT the authoritative guard: JavaScript `$` matches before a
|
|
91
|
+
// final line feed, so this pattern accepts a trailing newline. The `.refine()`
|
|
92
|
+
// below is the authoritative guard that rejects a trailing newline.
|
|
93
|
+
export const BROWSER_CODE_PATTERN = /^[\x21-\x7E]+$/u;
|
|
94
|
+
// The browser-code grammar schema. It rejects an empty code, an oversized code,
|
|
95
|
+
// and a code with a control byte or any other non-printable character. The
|
|
96
|
+
// `.regex()` runs before the `.refine()` so the converter serializes its
|
|
97
|
+
// `pattern`; the `.refine()` stays the authoritative guard.
|
|
98
|
+
export const browserCodeSchema = z
|
|
99
|
+
.string()
|
|
100
|
+
.min(1, "A browser code is required.")
|
|
101
|
+
.max(BROWSER_CODE_MAX_LENGTH, "The browser code is too long.")
|
|
102
|
+
.regex(BROWSER_CODE_PATTERN, "The browser code has an invalid character.")
|
|
103
|
+
.refine((code) => !BROWSER_CODE_DISALLOWED_CHAR.test(code), {
|
|
104
|
+
message: "The browser code has an invalid character.",
|
|
105
|
+
});
|
|
106
|
+
// The submit-browser-code request schema. `.strict()` rejects an extra field.
|
|
107
|
+
export const submitBrowserCodeRequestSchema = z.object({
|
|
108
|
+
browserCode: browserCodeSchema,
|
|
109
|
+
}).strict();
|
|
110
|
+
// The stored-session claim schema. The `storedSessionId` is the opaque durable
|
|
111
|
+
// session id. It is a non-secret claim; it carries no token.
|
|
112
|
+
export const storedSessionIdSchema = z.string().min(1).max(256);
|
|
113
|
+
// The completion response schema. It carries the non-secret `storedSessionId`
|
|
114
|
+
// claim and no token. `.strict()` rejects an extra field, so a token never
|
|
115
|
+
// validates.
|
|
116
|
+
export const claudeSetupTokenCompletionResponseSchema = z.object({
|
|
117
|
+
storedSessionId: storedSessionIdSchema,
|
|
118
|
+
}).strict();
|
|
119
|
+
// The stored Claude OAuth token status response schema. It carries only the
|
|
120
|
+
// secret id and the latest version of the owner value; it carries no token.
|
|
121
|
+
// `.strict()` rejects an extra field, so a token never validates. The status
|
|
122
|
+
// route returns a fixed 404 for a missing or a foreign value, so a 200 body
|
|
123
|
+
// always describes a present owner value.
|
|
124
|
+
export const claudeOAuthTokenStatusResponseSchema = z.object({
|
|
125
|
+
secretId: z.string().uuid(),
|
|
126
|
+
latestVersion: z.number().int().min(1),
|
|
127
|
+
}).strict();
|
|
128
|
+
//# sourceMappingURL=claude-setup-token-session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-setup-token-session.js","sourceRoot":"","sources":["../../src/validators/claude-setup-token-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC;AAClG,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AAE/D,iFAAiF;AACjF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,IAAI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AAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACvC,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-setup-token-session.test.d.ts","sourceRoot":"","sources":["../../src/validators/claude-setup-token-session.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { BROWSER_CODE_MAX_LENGTH, browserCodeSchema, claudeSetupTokenCompletionResponseSchema, claudeSetupTokenSessionOwnerResponseSchema, isValidBrowserCode, startClaudeSetupTokenSessionRequestSchema, submitBrowserCodeRequestSchema, } from "./claude-setup-token-session.js";
|
|
3
|
+
import { createAgentSchema, createAgentHireSchema } from "./agent.js";
|
|
4
|
+
const ENVIRONMENT_ID = "11111111-1111-4111-8111-111111111111";
|
|
5
|
+
describe("claude setup-token session start request", () => {
|
|
6
|
+
it("accepts a company-and-environment request with no agent id", () => {
|
|
7
|
+
const parsed = startClaudeSetupTokenSessionRequestSchema.parse({
|
|
8
|
+
environmentId: ENVIRONMENT_ID,
|
|
9
|
+
adapterType: "claude_local",
|
|
10
|
+
});
|
|
11
|
+
expect(parsed.environmentId).toBe(ENVIRONMENT_ID);
|
|
12
|
+
expect(parsed.adapterType).toBe("claude_local");
|
|
13
|
+
});
|
|
14
|
+
it("rejects a legacy ttlSeconds: the runtime does not support it", () => {
|
|
15
|
+
const result = startClaudeSetupTokenSessionRequestSchema.safeParse({
|
|
16
|
+
environmentId: ENVIRONMENT_ID,
|
|
17
|
+
adapterType: "claude_local",
|
|
18
|
+
ttlSeconds: 300,
|
|
19
|
+
});
|
|
20
|
+
expect(result.success).toBe(false);
|
|
21
|
+
});
|
|
22
|
+
it("rejects an agent id: the scope carries no agent id", () => {
|
|
23
|
+
const result = startClaudeSetupTokenSessionRequestSchema.safeParse({
|
|
24
|
+
environmentId: ENVIRONMENT_ID,
|
|
25
|
+
adapterType: "claude_local",
|
|
26
|
+
agentId: "22222222-2222-4222-8222-222222222222",
|
|
27
|
+
});
|
|
28
|
+
expect(result.success).toBe(false);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
describe("browser-code grammar", () => {
|
|
32
|
+
it("accepts a conservative printable code", () => {
|
|
33
|
+
const code = "ac_012-AZ_az.9#state";
|
|
34
|
+
expect(browserCodeSchema.parse(code)).toBe(code);
|
|
35
|
+
expect(isValidBrowserCode(code)).toBe(true);
|
|
36
|
+
});
|
|
37
|
+
it("rejects a carriage return, a line feed, a NUL, and a control byte", () => {
|
|
38
|
+
for (const bad of ["ab\rcd", "ab\ncd", "ab\u0000cd", "ab\u0001cd", "ab\u007fcd", "ab cd", "ab\tcd"]) {
|
|
39
|
+
expect(browserCodeSchema.safeParse(bad).success).toBe(false);
|
|
40
|
+
expect(isValidBrowserCode(bad)).toBe(false);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
it("rejects a trailing newline that an anchored regex would let pass", () => {
|
|
44
|
+
// The runtime `.refine()` is the authoritative guard. JavaScript `$`
|
|
45
|
+
// matches before a final line feed, so an anchored printable-ASCII regex
|
|
46
|
+
// accepts a trailing newline. The `.refine()` closes that trap.
|
|
47
|
+
expect(browserCodeSchema.safeParse("abc\n").success).toBe(false);
|
|
48
|
+
expect(isValidBrowserCode("abc\n")).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
it("rejects a single control byte and accepts a printable code", () => {
|
|
51
|
+
expect(browserCodeSchema.safeParse("abc").success).toBe(true);
|
|
52
|
+
expect(browserCodeSchema.safeParse("valid-code_123").success).toBe(true);
|
|
53
|
+
});
|
|
54
|
+
it("rejects an empty code", () => {
|
|
55
|
+
expect(browserCodeSchema.safeParse("").success).toBe(false);
|
|
56
|
+
expect(isValidBrowserCode("")).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
it("rejects an oversized code", () => {
|
|
59
|
+
const oversized = "a".repeat(BROWSER_CODE_MAX_LENGTH + 1);
|
|
60
|
+
expect(browserCodeSchema.safeParse(oversized).success).toBe(false);
|
|
61
|
+
expect(isValidBrowserCode(oversized)).toBe(false);
|
|
62
|
+
const atLimit = "a".repeat(BROWSER_CODE_MAX_LENGTH);
|
|
63
|
+
expect(browserCodeSchema.parse(atLimit)).toBe(atLimit);
|
|
64
|
+
});
|
|
65
|
+
it("wraps the grammar in the submit-browser-code request and rejects an extra field", () => {
|
|
66
|
+
expect(submitBrowserCodeRequestSchema.parse({ browserCode: "abc123" }).browserCode).toBe("abc123");
|
|
67
|
+
expect(submitBrowserCodeRequestSchema.safeParse({ browserCode: "a\nb" }).success).toBe(false);
|
|
68
|
+
expect(submitBrowserCodeRequestSchema.safeParse({ browserCode: "abc", extra: 1 }).success).toBe(false);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe("claude setup-token owner response and completion response", () => {
|
|
72
|
+
it("accepts an owner response with the submitted-browser-code panel mode and a prompt", () => {
|
|
73
|
+
const parsed = claudeSetupTokenSessionOwnerResponseSchema.parse({
|
|
74
|
+
sessionId: "opaque-base64url-session-id",
|
|
75
|
+
environmentId: ENVIRONMENT_ID,
|
|
76
|
+
status: "waiting_for_user",
|
|
77
|
+
expiresAt: null,
|
|
78
|
+
failure: null,
|
|
79
|
+
panelMode: "submitted_browser_code",
|
|
80
|
+
prompt: { authorizationUrl: "https://example.test/authorize" },
|
|
81
|
+
});
|
|
82
|
+
expect(parsed.panelMode).toBe("submitted_browser_code");
|
|
83
|
+
expect(parsed.prompt?.authorizationUrl).toBe("https://example.test/authorize");
|
|
84
|
+
});
|
|
85
|
+
it("rejects a token on the completion response: the claim carries no token", () => {
|
|
86
|
+
expect(claudeSetupTokenCompletionResponseSchema.parse({ storedSessionId: "session-claim" })
|
|
87
|
+
.storedSessionId).toBe("session-claim");
|
|
88
|
+
const withToken = claudeSetupTokenCompletionResponseSchema.safeParse({
|
|
89
|
+
storedSessionId: "session-claim",
|
|
90
|
+
token: "secret",
|
|
91
|
+
});
|
|
92
|
+
expect(withToken.success).toBe(false);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe("agent create and hire carry an optional stored-session claim", () => {
|
|
96
|
+
const base = { name: "Claude Agent", adapterType: "claude_local" };
|
|
97
|
+
it("accepts a create request without a stored-session claim", () => {
|
|
98
|
+
expect(createAgentSchema.parse({ ...base }).storedSessionId).toBeUndefined();
|
|
99
|
+
});
|
|
100
|
+
it("accepts a create request with a stored-session claim", () => {
|
|
101
|
+
expect(createAgentSchema.parse({ ...base, storedSessionId: "session-claim" }).storedSessionId).toBe("session-claim");
|
|
102
|
+
});
|
|
103
|
+
it("accepts a hire request with a stored-session claim", () => {
|
|
104
|
+
expect(createAgentHireSchema.parse({ ...base, storedSessionId: "session-claim" }).storedSessionId).toBe("session-claim");
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=claude-setup-token-session.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-setup-token-session.test.js","sourceRoot":"","sources":["../../src/validators/claude-setup-token-session.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,wCAAwC,EACxC,0CAA0C,EAC1C,kBAAkB,EAClB,yCAAyC,EACzC,8BAA8B,GAC/B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEtE,MAAM,cAAc,GAAG,sCAAsC,CAAC;AAE9D,QAAQ,CAAC,0CAA0C,EAAE,GAAG,EAAE;IACxD,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,MAAM,GAAG,yCAAyC,CAAC,KAAK,CAAC;YAC7D,aAAa,EAAE,cAAc;YAC7B,WAAW,EAAE,cAAc;SAC5B,C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