@trojanbox-vcp-test/contracts 0.1.0 → 0.2.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/index.d.ts +1500 -132
- package/dist/index.js +1 -2352
- package/dist/site-edit-class-name-source.d.ts +62 -77
- package/dist/site-edit-command-result.d.ts +50 -0
- package/dist/site-edit-event.d.ts +1 -22
- package/dist/site-edit-operation.d.ts +56 -24
- package/dist/site-edit-render-document.d.ts +0 -304
- package/package.json +1 -1
- package/dist/site-edit-capability.js +0 -49
- package/dist/site-edit-class-name-source.js +0 -118
- package/dist/site-edit-event.js +0 -41
- package/dist/site-edit-identity.js +0 -33
- package/dist/site-edit-operation.js +0 -379
- package/dist/site-edit-patch-plan.js +0 -62
- package/dist/site-edit-render-document.js +0 -236
- package/dist/user-facing-copy.js +0 -56
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { SiteEditBoundaryKindSchema } from "./site-edit-capability.js";
|
|
3
|
-
import { SiteEditNodeCapabilitySnapshotSchema } from "./site-edit-capability.js";
|
|
4
|
-
import { SiteEditOperationTypeSchema } from "./site-edit-operation.js";
|
|
5
|
-
import { SiteEditStyleBreakpointSchema } from "./site-edit-operation.js";
|
|
6
|
-
import { SiteEditStyleStateModeSchema } from "./site-edit-operation.js";
|
|
7
|
-
import { SiteEditStylePropertySchema } from "./site-edit-operation.js";
|
|
8
|
-
export const SiteEditOperationSummarySchema = z.object({
|
|
9
|
-
canUpdateText: z.boolean(),
|
|
10
|
-
canInsertChild: z.boolean(),
|
|
11
|
-
canMove: z.boolean(),
|
|
12
|
-
canRemove: z.boolean(),
|
|
13
|
-
});
|
|
14
|
-
export const SiteEditRenderEntrySchema = z.object({
|
|
15
|
-
key: z.string().min(1),
|
|
16
|
-
tag: z.string().min(1),
|
|
17
|
-
label: z.string().min(1),
|
|
18
|
-
parentKey: z.string().min(1).nullable(),
|
|
19
|
-
childKeys: z.array(z.string().min(1)),
|
|
20
|
-
operationSummary: SiteEditOperationSummarySchema,
|
|
21
|
-
});
|
|
22
|
-
export const SiteEditRenderDocumentSchema = z.object({
|
|
23
|
-
siteId: z.string().min(1),
|
|
24
|
-
snapshotId: z.string().min(1),
|
|
25
|
-
routeId: z.string().min(1),
|
|
26
|
-
version: z.number().int().nonnegative(),
|
|
27
|
-
rootKeys: z.array(z.string().min(1)),
|
|
28
|
-
entries: z.array(SiteEditRenderEntrySchema),
|
|
29
|
-
});
|
|
30
|
-
export const SiteEditExternalSourceKindSchema = z.enum([
|
|
31
|
-
"api-field",
|
|
32
|
-
"cms-field",
|
|
33
|
-
"i18n-message",
|
|
34
|
-
"config-entry",
|
|
35
|
-
]);
|
|
36
|
-
export const SiteEditTextSourceSchema = z.object({
|
|
37
|
-
kind: z.enum(["literal", "binding", "imported-binding", "repeat-template"]),
|
|
38
|
-
file: z.string().min(1),
|
|
39
|
-
expression: z.string().min(1),
|
|
40
|
-
bindingName: z.string().min(1).optional(),
|
|
41
|
-
path: z.array(z.union([z.string(), z.number()])).optional(),
|
|
42
|
-
});
|
|
43
|
-
export const SiteEditTextSegmentSchema = z.object({
|
|
44
|
-
index: z.number().int().min(0),
|
|
45
|
-
value: z.string(),
|
|
46
|
-
editable: z.boolean(),
|
|
47
|
-
source: SiteEditTextSourceSchema.nullable(),
|
|
48
|
-
});
|
|
49
|
-
export const SiteEditRenderEntryRefSchema = z.object({
|
|
50
|
-
key: z.string().min(1),
|
|
51
|
-
label: z.string().min(1),
|
|
52
|
-
tag: z.string().min(1),
|
|
53
|
-
});
|
|
54
|
-
export const SiteEditObjectCapabilitiesSchema = z.object({
|
|
55
|
-
key: z.string().min(1),
|
|
56
|
-
canUpdateText: z.boolean(),
|
|
57
|
-
canInsertChild: z.boolean(),
|
|
58
|
-
canMove: z.boolean(),
|
|
59
|
-
canRemove: z.boolean(),
|
|
60
|
-
boundaryKind: SiteEditBoundaryKindSchema.nullable(),
|
|
61
|
-
isOpaque: z.boolean(),
|
|
62
|
-
});
|
|
63
|
-
export const SiteEditWriteTargetSchema = z.object({
|
|
64
|
-
kind: z.enum([
|
|
65
|
-
"jsx-node",
|
|
66
|
-
"component-proxy",
|
|
67
|
-
"value-binding",
|
|
68
|
-
"route-export",
|
|
69
|
-
]),
|
|
70
|
-
file: z.string().min(1),
|
|
71
|
-
componentName: z.string().min(1),
|
|
72
|
-
isProxy: z.boolean(),
|
|
73
|
-
});
|
|
74
|
-
export const SiteEditEffectiveWriteTargetSchema = z.object({
|
|
75
|
-
kind: z.enum(["jsx-node", "value-path", "route-export", "external-entry"]),
|
|
76
|
-
file: z.string().min(1).optional(),
|
|
77
|
-
isProxy: z.boolean(),
|
|
78
|
-
displayPath: z.string().min(1).optional(),
|
|
79
|
-
sourceType: SiteEditExternalSourceKindSchema.optional(),
|
|
80
|
-
sourceId: z.string().min(1).optional(),
|
|
81
|
-
});
|
|
82
|
-
export const SiteEditSemanticSourceSchema = z.object({
|
|
83
|
-
kind: z.union([
|
|
84
|
-
z.enum([
|
|
85
|
-
"jsx-literal",
|
|
86
|
-
"component-prop",
|
|
87
|
-
"binding",
|
|
88
|
-
"imported-binding",
|
|
89
|
-
"object-field",
|
|
90
|
-
"array-item",
|
|
91
|
-
"repeat-template",
|
|
92
|
-
"conditional-branch",
|
|
93
|
-
]),
|
|
94
|
-
SiteEditExternalSourceKindSchema,
|
|
95
|
-
]),
|
|
96
|
-
file: z.string().min(1),
|
|
97
|
-
displayPath: z.string().min(1),
|
|
98
|
-
externalSource: z
|
|
99
|
-
.object({
|
|
100
|
-
sourceType: SiteEditExternalSourceKindSchema,
|
|
101
|
-
sourceId: z.string().min(1),
|
|
102
|
-
adapterId: z.string().min(1).optional(),
|
|
103
|
-
})
|
|
104
|
-
.optional(),
|
|
105
|
-
});
|
|
106
|
-
export const SiteEditProvenanceHopSchema = z.object({
|
|
107
|
-
kind: SiteEditSemanticSourceSchema.shape.kind,
|
|
108
|
-
file: z.string().min(1),
|
|
109
|
-
displayName: z.string().min(1),
|
|
110
|
-
canEditHere: z.boolean(),
|
|
111
|
-
});
|
|
112
|
-
export const SiteEditProvenanceChainSchema = z.object({
|
|
113
|
-
finalSource: SiteEditSemanticSourceSchema.nullable(),
|
|
114
|
-
chain: z.array(SiteEditProvenanceHopSchema),
|
|
115
|
-
confidence: z.enum(["exact", "safe-derived", "partial", "unknown"]),
|
|
116
|
-
editMode: z.enum(["direct", "proxy", "upstream", "readonly", "unsupported"]),
|
|
117
|
-
diagnostics: z.array(z.object({
|
|
118
|
-
code: z.string().min(1),
|
|
119
|
-
message: z.string().min(1),
|
|
120
|
-
})),
|
|
121
|
-
});
|
|
122
|
-
const SiteEditStyleModelStructuredSchema = z.object({
|
|
123
|
-
kind: z.literal("css-style-model"),
|
|
124
|
-
properties: z.array(z.object({
|
|
125
|
-
property: SiteEditStylePropertySchema,
|
|
126
|
-
value: z.union([z.string(), z.number(), z.boolean(), z.null()]),
|
|
127
|
-
resolvedValue: z
|
|
128
|
-
.union([z.string(), z.number(), z.boolean(), z.null()])
|
|
129
|
-
.optional(),
|
|
130
|
-
breakpoint: SiteEditStyleBreakpointSchema.optional(),
|
|
131
|
-
state: SiteEditStyleStateModeSchema.optional(),
|
|
132
|
-
variants: z.array(z.string().min(1)).optional(),
|
|
133
|
-
options: z.array(z.union([z.string(), z.number()])).optional(),
|
|
134
|
-
editable: z.boolean(),
|
|
135
|
-
diagnostics: z
|
|
136
|
-
.array(z.object({
|
|
137
|
-
code: z.string().min(1),
|
|
138
|
-
message: z.string().min(1),
|
|
139
|
-
}))
|
|
140
|
-
.optional(),
|
|
141
|
-
operationBoundary: z.array(SiteEditOperationTypeSchema).optional(),
|
|
142
|
-
})),
|
|
143
|
-
});
|
|
144
|
-
export const SiteEditStyleModelSchema = z.union([
|
|
145
|
-
z.record(z.string(), z.unknown()),
|
|
146
|
-
SiteEditStyleModelStructuredSchema,
|
|
147
|
-
]);
|
|
148
|
-
export const SiteEditStyleSourceSchema = z.object({
|
|
149
|
-
kind: z.literal("class-name-source"),
|
|
150
|
-
className: z.string(),
|
|
151
|
-
sourceKind: z.enum([
|
|
152
|
-
"missing",
|
|
153
|
-
"static-attribute",
|
|
154
|
-
"static-expression",
|
|
155
|
-
"dynamic-expression",
|
|
156
|
-
]),
|
|
157
|
-
editable: z.boolean(),
|
|
158
|
-
operationBoundary: z.array(SiteEditOperationTypeSchema),
|
|
159
|
-
sourcePath: z.string().min(1).optional(),
|
|
160
|
-
diagnostics: z
|
|
161
|
-
.array(z.object({
|
|
162
|
-
code: z.enum([
|
|
163
|
-
"missing-class-name",
|
|
164
|
-
"dynamic-binding",
|
|
165
|
-
"non-string-binding",
|
|
166
|
-
]),
|
|
167
|
-
message: z.string().min(1),
|
|
168
|
-
}))
|
|
169
|
-
.optional(),
|
|
170
|
-
});
|
|
171
|
-
export const SiteEditObjectDetailSchema = z.object({
|
|
172
|
-
key: z.string().min(1),
|
|
173
|
-
tag: z.string().min(1),
|
|
174
|
-
componentName: z.string().min(1),
|
|
175
|
-
sourceFile: z.string().min(1),
|
|
176
|
-
label: z.string().min(1),
|
|
177
|
-
capabilities: SiteEditNodeCapabilitySnapshotSchema,
|
|
178
|
-
writeTarget: SiteEditWriteTargetSchema,
|
|
179
|
-
effectiveWriteTarget: SiteEditEffectiveWriteTargetSchema.optional(),
|
|
180
|
-
provenanceChain: SiteEditProvenanceChainSchema.optional(),
|
|
181
|
-
componentSemantic: z.record(z.string(), z.unknown()).optional(),
|
|
182
|
-
contentModel: z.record(z.string(), z.unknown()).optional(),
|
|
183
|
-
mediaModel: z.record(z.string(), z.unknown()).optional(),
|
|
184
|
-
styleSource: SiteEditStyleSourceSchema.optional(),
|
|
185
|
-
styleModel: SiteEditStyleModelSchema.optional(),
|
|
186
|
-
conditional: z.record(z.string(), z.unknown()).optional(),
|
|
187
|
-
textSegments: z.array(SiteEditTextSegmentSchema),
|
|
188
|
-
boundaryKind: SiteEditBoundaryKindSchema.nullable(),
|
|
189
|
-
isOpaque: z.boolean(),
|
|
190
|
-
ancestors: z.array(SiteEditRenderEntryRefSchema),
|
|
191
|
-
children: z.array(SiteEditRenderEntryRefSchema),
|
|
192
|
-
siblings: z.array(SiteEditRenderEntryRefSchema),
|
|
193
|
-
});
|
|
194
|
-
export const SiteEditObjectSummarySchema = z.object({
|
|
195
|
-
key: z.string().min(1),
|
|
196
|
-
tag: z.string().min(1),
|
|
197
|
-
label: z.string().min(1),
|
|
198
|
-
capabilities: z.object({
|
|
199
|
-
constraints: SiteEditNodeCapabilitySnapshotSchema.shape.constraints,
|
|
200
|
-
}),
|
|
201
|
-
isOpaque: z.boolean(),
|
|
202
|
-
provenanceChain: z
|
|
203
|
-
.object({
|
|
204
|
-
editMode: SiteEditProvenanceChainSchema.shape.editMode,
|
|
205
|
-
diagnostics: SiteEditProvenanceChainSchema.shape.diagnostics,
|
|
206
|
-
})
|
|
207
|
-
.optional(),
|
|
208
|
-
ancestors: z.array(SiteEditRenderEntryRefSchema),
|
|
209
|
-
});
|
|
210
|
-
export const SiteEditObjectEditContextSchema = z.object({
|
|
211
|
-
key: z.string().min(1),
|
|
212
|
-
componentName: z.string().min(1),
|
|
213
|
-
sourceFile: z.string().min(1),
|
|
214
|
-
capabilities: SiteEditNodeCapabilitySnapshotSchema,
|
|
215
|
-
writeTarget: SiteEditWriteTargetSchema,
|
|
216
|
-
effectiveWriteTarget: SiteEditEffectiveWriteTargetSchema.optional(),
|
|
217
|
-
provenanceChain: SiteEditProvenanceChainSchema.optional(),
|
|
218
|
-
componentSemantic: z.record(z.string(), z.unknown()).optional(),
|
|
219
|
-
textSegments: z.array(SiteEditTextSegmentSchema),
|
|
220
|
-
boundaryKind: SiteEditBoundaryKindSchema.nullable(),
|
|
221
|
-
children: z.array(SiteEditRenderEntryRefSchema),
|
|
222
|
-
siblings: z.array(SiteEditRenderEntryRefSchema),
|
|
223
|
-
});
|
|
224
|
-
export const SiteEditObjectStyleDetailSchema = z.object({
|
|
225
|
-
key: z.string().min(1),
|
|
226
|
-
styleSource: SiteEditStyleSourceSchema.optional(),
|
|
227
|
-
styleModel: SiteEditStyleModelSchema.optional(),
|
|
228
|
-
});
|
|
229
|
-
export const SiteEditObjectContentDetailSchema = z.object({
|
|
230
|
-
key: z.string().min(1),
|
|
231
|
-
contentModel: z.record(z.string(), z.unknown()).optional(),
|
|
232
|
-
});
|
|
233
|
-
export const SiteEditObjectMediaDetailSchema = z.object({
|
|
234
|
-
key: z.string().min(1),
|
|
235
|
-
mediaModel: z.record(z.string(), z.unknown()).optional(),
|
|
236
|
-
});
|
package/dist/user-facing-copy.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workspace iteration 用户面文案 single source of truth(详见 Plan Task 11)。
|
|
3
|
-
*
|
|
4
|
-
* 凡是会被用户看到的字符串(错误 banner、拒绝模板、澄清卡片标签、聊天提示)
|
|
5
|
-
* 必须从这里导出,前后端共用。禁止在 app 代码里硬编码 user-facing 英文/中文文案。
|
|
6
|
-
*
|
|
7
|
-
* - `ERROR_COPY`:用户面错误兜底;任何 agent `run.failed` 的 `error_code` 必须能
|
|
8
|
-
* 映射到这里的一个 key,找不到时由前端回退到 `GENERIC`。
|
|
9
|
-
* - `REFUSAL_COPY`:模型拒绝越界请求时的统一英文模板(system prompt 注入)。
|
|
10
|
-
* - `CLARIFICATION_COPY`:澄清卡片 UI 文案。
|
|
11
|
-
* - `CHAT_COPY`:聊天面板小型提示文案。
|
|
12
|
-
*/
|
|
13
|
-
export const ERROR_COPY = {
|
|
14
|
-
PATCH_VALIDATION_FAILED: "The code didn't pass validation. Try describing the change more specifically.",
|
|
15
|
-
PATCH_BATCH_FAILED: "The site code couldn't be generated. Please regenerate the site.",
|
|
16
|
-
PATCH_BATCH_INVALID: "The change couldn't be applied. Try simpler instructions.",
|
|
17
|
-
WORKSPACE_TOOL_RESULT_INVALID: "This change couldn't be completed and was rolled back. Please try again.",
|
|
18
|
-
WORKSPACE_TOOL_FAILED: "A tool step failed. Please try again.",
|
|
19
|
-
WORKSPACE_TOOL_RESULT_MISSING: "The tool didn't return a usable result. Please try again.",
|
|
20
|
-
WORKSPACE_MODEL_STREAM_FAILED: "The model stream ended unexpectedly. Please try again.",
|
|
21
|
-
WORKSPACE_EDIT_NOT_APPLIED: "No change was applied. Try describing the change differently.",
|
|
22
|
-
WORKSPACE_INITIAL_EXECUTION_FAILED: "Initial generation failed. Please retry from the brief.",
|
|
23
|
-
WORKSPACE_INITIAL_GENERATION_CHECK_FAILED: "Initial generation could not be verified. Please retry.",
|
|
24
|
-
WORKSPACE_INITIAL_GENERATION_FINALIZE_FAILED: "Initial generation could not finalize. Please retry.",
|
|
25
|
-
WORKSPACE_SOCKET_DEAD: "The workspace connection was lost. Please retry.",
|
|
26
|
-
WORKSPACE_RUN_CANCELLED: "The run was cancelled.",
|
|
27
|
-
WORKSPACE_RUN_REQUEST_FAILED: "Couldn't start the workspace. Please try again.",
|
|
28
|
-
WORKSPACE_RUN_BAD_RESPONSE: "The server response was malformed. Please try again.",
|
|
29
|
-
WORKSPACE_SOCKET_UNAVAILABLE: "Workspace connection unavailable. Please try again.",
|
|
30
|
-
WORKSPACE_SOCKET_ERROR: "The workspace connection had an error. Please try again.",
|
|
31
|
-
WORKSPACE_SOCKET_CLOSED: "The workspace connection closed. Please try again.",
|
|
32
|
-
SITE_SNAPSHOT_REQUIRED: "This site has no usable snapshot yet. Complete Step 3 first.",
|
|
33
|
-
AGENT_TIMEOUT: "That took longer than expected. Try breaking the change into smaller pieces.",
|
|
34
|
-
SANDBOX_NOT_AVAILABLE: "The preview environment isn't ready. Your edits have still been saved.",
|
|
35
|
-
PREVIEW_BUILD_FAILED: "Preview is available, but the production build failed. Fix the reported build error before deploying.",
|
|
36
|
-
PREVIEW_BUILD_NOT_CONFIGURED: "Preview is available, but the production build check is not configured.",
|
|
37
|
-
PREVIEW_BUILD_SANDBOX_NOT_FOUND: "Preview is available, but the build check could not find the active preview sandbox.",
|
|
38
|
-
WS_CONNECTION_ERROR: "Connection lost. Reconnecting…",
|
|
39
|
-
USER_MESSAGE_PERSIST_FAILED: "Your message wasn't saved. Please send it again.",
|
|
40
|
-
CLARIFICATION_REPLY_STALE: "That question has expired. Please tell me what you'd like to do now.",
|
|
41
|
-
WORKSPACE_RUN_IN_FLIGHT: "Another session is already running. Please try again in a moment.",
|
|
42
|
-
GENERIC: "Something went wrong. Please try again.",
|
|
43
|
-
};
|
|
44
|
-
export const REFUSAL_COPY = {
|
|
45
|
-
UNDO_OR_ROLLBACK: "I can't roll back from chat. Use the version history at the top right to pick a restore point.",
|
|
46
|
-
HISTORY_RECALL: "Tell me what you'd like to change now—I'll work from the current page state.",
|
|
47
|
-
OUT_OF_SCOPE: "That's outside what I can do from chat. Try the corresponding panel on the right.",
|
|
48
|
-
};
|
|
49
|
-
export const CLARIFICATION_COPY = {
|
|
50
|
-
CARD_HEADER: "Needs your confirmation",
|
|
51
|
-
FREE_TEXT_PLACEHOLDER: "Or describe what you'd like instead",
|
|
52
|
-
SUBMIT_LABEL: "Submit",
|
|
53
|
-
};
|
|
54
|
-
export const CHAT_COPY = {
|
|
55
|
-
SEND_FAILED_RETRY: "Send failed — tap to retry",
|
|
56
|
-
};
|