@yansirplus/cli 0.5.17
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/PUBLIC_API.md +22 -0
- package/README.md +34 -0
- package/dist/build/agent-authoring/config.d.ts +177 -0
- package/dist/build/agent-authoring/config.js +607 -0
- package/dist/build/agent-authoring/manifest-compiler.d.ts +159 -0
- package/dist/build/agent-authoring/manifest-compiler.js +737 -0
- package/dist/build/agent-authoring/shared.d.ts +10 -0
- package/dist/build/agent-authoring/shared.js +57 -0
- package/dist/build/agent-authoring/static-target.d.ts +59 -0
- package/dist/build/agent-authoring/static-target.js +1857 -0
- package/dist/build/agent-authoring.d.ts +9 -0
- package/dist/build/agent-authoring.js +5 -0
- package/dist/build/build-cli.d.ts +2 -0
- package/dist/build/build-cli.js +264 -0
- package/dist/check/algorithmic/architecture-checks.mjs +971 -0
- package/dist/check/algorithmic/client-boundary-checks.mjs +337 -0
- package/dist/check/algorithmic/convergence-smoke-checks.mjs +608 -0
- package/dist/check/algorithmic/distribution-checks.mjs +919 -0
- package/dist/check/algorithmic/owner-checks.mjs +647 -0
- package/dist/check/algorithmic/package-boundary-checks.mjs +985 -0
- package/dist/check/algorithmic/projection-boundary-checks.mjs +302 -0
- package/dist/check/algorithmic/repo-surface-checks.mjs +267 -0
- package/dist/check/algorithmic/runtime-structural-checks.mjs +264 -0
- package/dist/check/algorithmic/source-alias-checks.mjs +106 -0
- package/dist/check/algorithmic/static-target-checks.mjs +447 -0
- package/dist/check/algorithmic-checks.mjs +482 -0
- package/dist/check/check-coverage.mjs +231 -0
- package/dist/check/command-runner.mjs +22 -0
- package/dist/check/default-gate.mjs +51 -0
- package/dist/check/gate-selector.mjs +305 -0
- package/dist/check/manifest-rules.mjs +223 -0
- package/dist/check/package-graph.mjs +464 -0
- package/dist/generate/generate-agent-docs.mjs +435 -0
- package/dist/generate/generate-carrier-reference.mjs +514 -0
- package/dist/generate/generate-docs.mjs +345 -0
- package/dist/generate/generate-effect-skill-manifests.mjs +193 -0
- package/dist/generate/project-docs-site.mjs +190 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +25 -0
- package/dist/lib/agent-docs-model.mjs +888 -0
- package/dist/lib/boundary-rules.mjs +63 -0
- package/dist/lib/capability-routes.mjs +354 -0
- package/dist/lib/projection-sink.mjs +113 -0
- package/dist/lib/public-api-model.mjs +306 -0
- package/dist/main.mjs +233 -0
- package/dist/runner.mjs +127 -0
- package/package.json +32 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
export const createStaticTargetChecks = ({ read, failIfAny }) => {
|
|
2
|
+
const sliceBetweenMarkers = (source, startMarker, endMarker) => {
|
|
3
|
+
const start = source.indexOf(startMarker);
|
|
4
|
+
if (start === -1) return "";
|
|
5
|
+
const end = source.indexOf(endMarker, start);
|
|
6
|
+
return end === -1 ? source.slice(start) : source.slice(start, end);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const checkGeneratedStaticTargetLinking = () => {
|
|
10
|
+
const failures = [];
|
|
11
|
+
const sourcePath = "packages/cli/src/build/agent-authoring/static-target.ts";
|
|
12
|
+
const workspaceAgentSourcePath = "packages/core/src/workspace-agent.ts";
|
|
13
|
+
const source = read(sourcePath);
|
|
14
|
+
const workspaceAgentSource = read(workspaceAgentSourcePath);
|
|
15
|
+
const renderWorkspaceStaticTargetSource = sliceBetweenMarkers(
|
|
16
|
+
source,
|
|
17
|
+
"const renderWorkspaceStaticTarget =",
|
|
18
|
+
"const renderChatStaticTarget =",
|
|
19
|
+
);
|
|
20
|
+
const renderChatStaticTargetSource = sliceBetweenMarkers(
|
|
21
|
+
source,
|
|
22
|
+
"const renderChatStaticTarget =",
|
|
23
|
+
"const renderStaticTarget =",
|
|
24
|
+
);
|
|
25
|
+
const renderStaticTargetDispatchSource = sliceBetweenMarkers(
|
|
26
|
+
source,
|
|
27
|
+
"const renderStaticTarget =",
|
|
28
|
+
"const renderCloudflareScopeHelper =",
|
|
29
|
+
);
|
|
30
|
+
const renderStaticTargetSource = [
|
|
31
|
+
renderWorkspaceStaticTargetSource,
|
|
32
|
+
renderChatStaticTargetSource,
|
|
33
|
+
renderStaticTargetDispatchSource,
|
|
34
|
+
].join("\n");
|
|
35
|
+
const linkWorkspaceStaticTargetSource = sliceBetweenMarkers(
|
|
36
|
+
source,
|
|
37
|
+
"export const linkWorkspaceStaticTarget =",
|
|
38
|
+
"const renderAgentOsConfigSchema =",
|
|
39
|
+
);
|
|
40
|
+
const renderWorkspaceSvelteKitRemoteSource = sliceBetweenMarkers(
|
|
41
|
+
source,
|
|
42
|
+
"const renderWorkspaceSvelteKitRemote =",
|
|
43
|
+
"const renderChatSvelteKitRemote =",
|
|
44
|
+
);
|
|
45
|
+
const renderChatSvelteKitRemoteSource = sliceBetweenMarkers(
|
|
46
|
+
source,
|
|
47
|
+
"const renderChatSvelteKitRemote =",
|
|
48
|
+
"const renderSvelteKitRemote =",
|
|
49
|
+
);
|
|
50
|
+
const renderSvelteKitRemoteDispatchSource = sliceBetweenMarkers(
|
|
51
|
+
source,
|
|
52
|
+
"const renderSvelteKitRemote =",
|
|
53
|
+
"const renderWorkspaceStaticClient =",
|
|
54
|
+
);
|
|
55
|
+
const renderSvelteKitRemoteSource = [
|
|
56
|
+
renderWorkspaceSvelteKitRemoteSource,
|
|
57
|
+
renderChatSvelteKitRemoteSource,
|
|
58
|
+
renderSvelteKitRemoteDispatchSource,
|
|
59
|
+
].join("\n");
|
|
60
|
+
const renderCloudflareScopeHelperSource = sliceBetweenMarkers(
|
|
61
|
+
source,
|
|
62
|
+
"const renderCloudflareScopeHelper =",
|
|
63
|
+
"const renderCloudflareWorkerEntry =",
|
|
64
|
+
);
|
|
65
|
+
const renderCloudflareWorkerEntrySource = sliceBetweenMarkers(
|
|
66
|
+
source,
|
|
67
|
+
"const renderCloudflareWorkerEntry =",
|
|
68
|
+
"const renderCloudflareWranglerConfig =",
|
|
69
|
+
);
|
|
70
|
+
const renderCloudflareWranglerConfigSource = sliceBetweenMarkers(
|
|
71
|
+
source,
|
|
72
|
+
"const renderCloudflareWranglerConfig =",
|
|
73
|
+
"const generatedClientModuleImports =",
|
|
74
|
+
);
|
|
75
|
+
const renderWorkspaceStaticClientSource = sliceBetweenMarkers(
|
|
76
|
+
source,
|
|
77
|
+
"const renderWorkspaceStaticClient =",
|
|
78
|
+
"const renderChatStaticClient =",
|
|
79
|
+
);
|
|
80
|
+
const renderChatStaticClientSource = sliceBetweenMarkers(
|
|
81
|
+
source,
|
|
82
|
+
"const renderChatStaticClient =",
|
|
83
|
+
"const renderStaticClient =",
|
|
84
|
+
);
|
|
85
|
+
const renderStaticClientDispatchSource = sliceBetweenMarkers(
|
|
86
|
+
source,
|
|
87
|
+
"const renderStaticClient =",
|
|
88
|
+
"const renderStaticClientTypes =",
|
|
89
|
+
);
|
|
90
|
+
const renderStaticClientSource = [
|
|
91
|
+
renderWorkspaceStaticClientSource,
|
|
92
|
+
renderChatStaticClientSource,
|
|
93
|
+
renderStaticClientDispatchSource,
|
|
94
|
+
].join("\n");
|
|
95
|
+
if (renderStaticTargetSource.length === 0) {
|
|
96
|
+
failures.push(`${sourcePath}: generated-static-target-linking: missing renderStaticTarget`);
|
|
97
|
+
}
|
|
98
|
+
if (linkWorkspaceStaticTargetSource.length === 0) {
|
|
99
|
+
failures.push(
|
|
100
|
+
`${sourcePath}: generated-static-target-linking: missing linkWorkspaceStaticTarget`,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
if (renderSvelteKitRemoteSource.length === 0) {
|
|
104
|
+
failures.push(
|
|
105
|
+
`${sourcePath}: generated-static-target-linking: missing renderSvelteKitRemote`,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
if (renderCloudflareScopeHelperSource.length === 0) {
|
|
109
|
+
failures.push(
|
|
110
|
+
`${sourcePath}: generated-static-target-linking: missing renderCloudflareScopeHelper`,
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
if (renderCloudflareWorkerEntrySource.length === 0) {
|
|
114
|
+
failures.push(
|
|
115
|
+
`${sourcePath}: generated-static-target-linking: missing renderCloudflareWorkerEntry`,
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
if (renderCloudflareWranglerConfigSource.length === 0) {
|
|
119
|
+
failures.push(
|
|
120
|
+
`${sourcePath}: generated-static-target-linking: missing renderCloudflareWranglerConfig`,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
if (renderStaticClientSource.length === 0) {
|
|
124
|
+
failures.push(`${sourcePath}: generated-static-target-linking: missing renderStaticClient`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const commandBlock =
|
|
128
|
+
workspaceAgentSource.match(
|
|
129
|
+
/export const WORKSPACE_AGENT_COMMAND = \{([\s\S]*?)\} as const;/u,
|
|
130
|
+
)?.[1] ?? "";
|
|
131
|
+
const workspaceCommandKeys = [...commandBlock.matchAll(/^\s*([A-Z_]+):\s*"([^"]+)"/gmu)].map(
|
|
132
|
+
(match) => match[1],
|
|
133
|
+
);
|
|
134
|
+
if (workspaceCommandKeys.length === 0) {
|
|
135
|
+
failures.push(
|
|
136
|
+
`${workspaceAgentSourcePath}: generated-static-target-linking: missing WORKSPACE_AGENT_COMMAND`,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
const generatedCommandProjection = {
|
|
140
|
+
SUBMIT: {
|
|
141
|
+
method: "submitRunInput",
|
|
142
|
+
parser: "submitInputFromUnknown",
|
|
143
|
+
},
|
|
144
|
+
RESUME_INPUT_REQUEST: {
|
|
145
|
+
method: "resumeInputRequest",
|
|
146
|
+
parser: "resumeInputRequestFromUnknown",
|
|
147
|
+
},
|
|
148
|
+
DECIDE_INPUT_REQUEST: {
|
|
149
|
+
method: "decideInputRequest",
|
|
150
|
+
parser: "decideInputRequestFromUnknown",
|
|
151
|
+
},
|
|
152
|
+
CUSTOM: {
|
|
153
|
+
method: "customCommand",
|
|
154
|
+
parser: "customInputFromUnknown",
|
|
155
|
+
},
|
|
156
|
+
READ_STATE: {
|
|
157
|
+
method: "readWorkspaceState",
|
|
158
|
+
parser: "readStateInputFromUnknown",
|
|
159
|
+
},
|
|
160
|
+
READ_FILE: {
|
|
161
|
+
method: "readWorkspaceFile",
|
|
162
|
+
parser: "readFileInputFromUnknown",
|
|
163
|
+
},
|
|
164
|
+
RESET: {
|
|
165
|
+
method: "resetWorkspace",
|
|
166
|
+
parser: "resetInputFromUnknown",
|
|
167
|
+
},
|
|
168
|
+
DESTROY: {
|
|
169
|
+
method: "destroyWorkspace",
|
|
170
|
+
parser: "destroyInputFromUnknown",
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
const commonGeneratedCommandKeys = [
|
|
174
|
+
"SUBMIT",
|
|
175
|
+
"RESUME_INPUT_REQUEST",
|
|
176
|
+
"DECIDE_INPUT_REQUEST",
|
|
177
|
+
"CUSTOM",
|
|
178
|
+
];
|
|
179
|
+
const workspaceOnlyGeneratedCommandKeys = ["READ_STATE", "READ_FILE", "RESET", "DESTROY"];
|
|
180
|
+
const knownGeneratedCommandKeys = new Set([
|
|
181
|
+
...commonGeneratedCommandKeys,
|
|
182
|
+
...workspaceOnlyGeneratedCommandKeys,
|
|
183
|
+
]);
|
|
184
|
+
for (const commandKey of workspaceCommandKeys) {
|
|
185
|
+
if (!knownGeneratedCommandKeys.has(commandKey)) {
|
|
186
|
+
failures.push(
|
|
187
|
+
`${sourcePath}: generated-static-target-linking: generated target missing profile classification for WORKSPACE_AGENT_COMMAND.${commandKey}`,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const assertCommandProjection = ({ commandKey, targetSource, remoteSource, profile }) => {
|
|
192
|
+
const projection = generatedCommandProjection[commandKey];
|
|
193
|
+
if (projection === undefined) {
|
|
194
|
+
failures.push(
|
|
195
|
+
`${sourcePath}: generated-static-target-linking: generated target missing projection for WORKSPACE_AGENT_COMMAND.${commandKey}`,
|
|
196
|
+
);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (!targetSource.includes(`${projection.method}(`)) {
|
|
200
|
+
failures.push(
|
|
201
|
+
`${sourcePath}: generated-static-target-linking: ${profile} renderStaticTarget missing ${projection.method} for WORKSPACE_AGENT_COMMAND.${commandKey}`,
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
if (!remoteSource.includes(`readonly ${projection.method}:`)) {
|
|
205
|
+
failures.push(
|
|
206
|
+
`${sourcePath}: generated-static-target-linking: ${profile} AgentOSRpc missing ${projection.method} for WORKSPACE_AGENT_COMMAND.${commandKey}`,
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
if (!remoteSource.includes(`if (name === WORKSPACE_AGENT_COMMAND.${commandKey})`)) {
|
|
210
|
+
failures.push(
|
|
211
|
+
`${sourcePath}: generated-static-target-linking: ${profile} invokeAgentCommand missing WORKSPACE_AGENT_COMMAND.${commandKey}`,
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
if (!remoteSource.includes(projection.parser)) {
|
|
215
|
+
failures.push(
|
|
216
|
+
`${sourcePath}: generated-static-target-linking: ${profile} invokeAgentCommand missing ${projection.parser} for WORKSPACE_AGENT_COMMAND.${commandKey}`,
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
if (!remoteSource.includes(`runtime.${projection.method}(`)) {
|
|
220
|
+
failures.push(
|
|
221
|
+
`${sourcePath}: generated-static-target-linking: ${profile} invokeAgentCommand missing runtime.${projection.method} for WORKSPACE_AGENT_COMMAND.${commandKey}`,
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
for (const commandKey of commonGeneratedCommandKeys) {
|
|
226
|
+
assertCommandProjection({
|
|
227
|
+
commandKey,
|
|
228
|
+
targetSource: renderWorkspaceStaticTargetSource,
|
|
229
|
+
remoteSource: renderWorkspaceSvelteKitRemoteSource,
|
|
230
|
+
profile: "workspace@1",
|
|
231
|
+
});
|
|
232
|
+
assertCommandProjection({
|
|
233
|
+
commandKey,
|
|
234
|
+
targetSource: renderChatStaticTargetSource,
|
|
235
|
+
remoteSource: renderChatSvelteKitRemoteSource,
|
|
236
|
+
profile: "chat@1",
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
for (const commandKey of workspaceOnlyGeneratedCommandKeys) {
|
|
240
|
+
const projection = generatedCommandProjection[commandKey];
|
|
241
|
+
assertCommandProjection({
|
|
242
|
+
commandKey,
|
|
243
|
+
targetSource: renderWorkspaceStaticTargetSource,
|
|
244
|
+
remoteSource: renderWorkspaceSvelteKitRemoteSource,
|
|
245
|
+
profile: "workspace@1",
|
|
246
|
+
});
|
|
247
|
+
if (
|
|
248
|
+
projection !== undefined &&
|
|
249
|
+
(renderChatStaticTargetSource.includes(`${projection.method}(`) ||
|
|
250
|
+
renderChatSvelteKitRemoteSource.includes(`WORKSPACE_AGENT_COMMAND.${commandKey}`) ||
|
|
251
|
+
renderChatSvelteKitRemoteSource.includes(projection.parser))
|
|
252
|
+
) {
|
|
253
|
+
failures.push(
|
|
254
|
+
`${sourcePath}: generated-static-target-linking: chat@1 must not project WORKSPACE_AGENT_COMMAND.${commandKey}`,
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const requiredStaticWiringMarkers = [
|
|
260
|
+
'import semanticDeclarations from "./manifest.json";',
|
|
261
|
+
'import deploymentProvenance from "./deployment.json";',
|
|
262
|
+
"createAgentDurableObject",
|
|
263
|
+
"installCloudflareWorkspaceOperationProvider",
|
|
264
|
+
"OpenAiCompatibleLlmTransportLive",
|
|
265
|
+
"defineWorkspaceAgentMount",
|
|
266
|
+
"bindWorkspaceToolsForRuntime",
|
|
267
|
+
"makeCloudflareWorkspaceEnv",
|
|
268
|
+
"getSandbox",
|
|
269
|
+
"generatedCustomTools",
|
|
270
|
+
"llmTransport: () => OpenAiCompatibleLlmTransportLive",
|
|
271
|
+
"extensions: (env) => workspaceOperationInstallFor(env).extensions",
|
|
272
|
+
"override submit(spec: AgentSubmitSpec): Promise<SubmitResult>",
|
|
273
|
+
"submitRunInput(input: SubmitRunInput): Promise<SubmitResult>",
|
|
274
|
+
"readWorkspaceFile(",
|
|
275
|
+
];
|
|
276
|
+
for (const marker of requiredStaticWiringMarkers) {
|
|
277
|
+
if (!renderStaticTargetSource.includes(marker)) {
|
|
278
|
+
failures.push(
|
|
279
|
+
`${sourcePath}: generated-static-target-linking: renderStaticTarget missing static marker ${marker}`,
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const requiredModuleKinds = [
|
|
285
|
+
'"semantic-json"',
|
|
286
|
+
'"target-runtime"',
|
|
287
|
+
'"target-scope-helper"',
|
|
288
|
+
'"target-worker"',
|
|
289
|
+
'"target-config"',
|
|
290
|
+
'"provider-runtime"',
|
|
291
|
+
'"workspace-host"',
|
|
292
|
+
'"authored-tool"',
|
|
293
|
+
'"workspace-binding"',
|
|
294
|
+
'"execution-domain-runtime"',
|
|
295
|
+
'"platform-runtime"',
|
|
296
|
+
'"client-core"',
|
|
297
|
+
'"client-transport"',
|
|
298
|
+
'"client-framework"',
|
|
299
|
+
];
|
|
300
|
+
for (const marker of requiredModuleKinds) {
|
|
301
|
+
if (!source.includes(`kind: ${marker}`) && !source.includes(`| ${marker}`)) {
|
|
302
|
+
failures.push(
|
|
303
|
+
`${sourcePath}: generated-static-target-linking: module graph missing ${marker}`,
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const durableObjectConfigSections = [
|
|
309
|
+
renderWorkspaceStaticTargetSource,
|
|
310
|
+
renderChatStaticTargetSource,
|
|
311
|
+
]
|
|
312
|
+
.map((profileSource) =>
|
|
313
|
+
sliceBetweenMarkers(profileSource, "createAgentDurableObject<", "export class"),
|
|
314
|
+
)
|
|
315
|
+
.filter((section) => section.length > 0);
|
|
316
|
+
if (durableObjectConfigSections.length === 0) {
|
|
317
|
+
failures.push(
|
|
318
|
+
`${sourcePath}: generated-static-target-linking: target must call createAgentDurableObject`,
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
for (const forbidden of ["deploymentProvenance", "targetDeployment"]) {
|
|
322
|
+
if (durableObjectConfigSections.some((section) => section.includes(forbidden))) {
|
|
323
|
+
failures.push(
|
|
324
|
+
`${sourcePath}: generated-static-target-linking: runtime wiring must not consume ${forbidden}`,
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
for (const forbidden of [
|
|
329
|
+
"makeRuntime({",
|
|
330
|
+
"workspaceExtension(",
|
|
331
|
+
"dynamic import",
|
|
332
|
+
"await import(",
|
|
333
|
+
"import(",
|
|
334
|
+
]) {
|
|
335
|
+
if (renderStaticTargetSource.includes(forbidden)) {
|
|
336
|
+
failures.push(
|
|
337
|
+
`${sourcePath}: generated-static-target-linking: closed target must not contain ${forbidden}`,
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const requiredRemoteBridgeMarkers = [
|
|
343
|
+
'renderNamedImport(["command", "getRequestEvent", "query"], modules.svelteKitServer)',
|
|
344
|
+
'renderNamedImport(["agentOSRpcClient", "agentOSTruthIdentity"], "./cloudflare-scope")',
|
|
345
|
+
"decodeSseHttpEvents",
|
|
346
|
+
"responseToSseHttpChunks",
|
|
347
|
+
"agentOSRpcClient<AgentOSRpc>(platformEnv)",
|
|
348
|
+
"submitRunInput",
|
|
349
|
+
"readWorkspaceFile",
|
|
350
|
+
"streamEvents",
|
|
351
|
+
"export const invokeAgentCommand = command(",
|
|
352
|
+
"export const runEventStream = query.live(",
|
|
353
|
+
];
|
|
354
|
+
for (const marker of requiredRemoteBridgeMarkers) {
|
|
355
|
+
if (!renderSvelteKitRemoteSource.includes(marker)) {
|
|
356
|
+
failures.push(
|
|
357
|
+
`${sourcePath}: generated-static-target-linking: renderSvelteKitRemote missing bridge marker ${marker}`,
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const requiredClientBridgeMarkers = [
|
|
363
|
+
'import { invokeAgentCommand, runEventStream } from "./sveltekit.remote";',
|
|
364
|
+
"streamSource: options.streamSource ?? generatedStreamSource",
|
|
365
|
+
"rpcInvoker: options.rpcInvoker ?? generatedRpcInvoker",
|
|
366
|
+
"clientReadable(bridge.client)",
|
|
367
|
+
"selectClientReadable(bridge.client",
|
|
368
|
+
];
|
|
369
|
+
for (const marker of requiredClientBridgeMarkers) {
|
|
370
|
+
if (!renderStaticClientSource.includes(marker)) {
|
|
371
|
+
failures.push(
|
|
372
|
+
`${sourcePath}: generated-static-target-linking: renderStaticClient missing generated bridge marker ${marker}`,
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (!linkWorkspaceStaticTargetSource.includes('".agentos/generated/sveltekit.remote.ts"')) {
|
|
378
|
+
failures.push(
|
|
379
|
+
`${sourcePath}: generated-static-target-linking: SvelteKit target must emit sveltekit.remote.ts`,
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
for (const generatedFile of [
|
|
383
|
+
'".agentos/generated/cloudflare-scope.ts"',
|
|
384
|
+
'".agentos/generated/worker.ts"',
|
|
385
|
+
'".agentos/generated/wrangler.jsonc"',
|
|
386
|
+
]) {
|
|
387
|
+
if (!linkWorkspaceStaticTargetSource.includes(generatedFile)) {
|
|
388
|
+
failures.push(
|
|
389
|
+
`${sourcePath}: generated-static-target-linking: target shell must emit ${generatedFile}`,
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const requiredScopeHelperMarkers = [
|
|
395
|
+
"durableObjectRpcClient",
|
|
396
|
+
"manifestTruthIdentity",
|
|
397
|
+
"agentOSTruthIdentity",
|
|
398
|
+
"agentOSScopeId",
|
|
399
|
+
"agentOSDurableObjectBinding",
|
|
400
|
+
"agentOSRpcClient",
|
|
401
|
+
];
|
|
402
|
+
for (const marker of requiredScopeHelperMarkers) {
|
|
403
|
+
if (!renderCloudflareScopeHelperSource.includes(marker)) {
|
|
404
|
+
failures.push(
|
|
405
|
+
`${sourcePath}: generated-static-target-linking: scope helper missing ${marker}`,
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const requiredWorkerEntryMarkers = [
|
|
411
|
+
"Sandbox",
|
|
412
|
+
'"./target"',
|
|
413
|
+
'normalized.profile === AGENTOS_CONFIG_PROFILE.WORKSPACE_V1 ? ", Sandbox" : ""',
|
|
414
|
+
"satisfies ExportedHandler<AgentOSTargetEnv>",
|
|
415
|
+
];
|
|
416
|
+
for (const marker of requiredWorkerEntryMarkers) {
|
|
417
|
+
if (!renderCloudflareWorkerEntrySource.includes(marker)) {
|
|
418
|
+
failures.push(
|
|
419
|
+
`${sourcePath}: generated-static-target-linking: worker entry missing ${marker}`,
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const requiredWranglerMarkers = [
|
|
425
|
+
'main: "./worker.ts"',
|
|
426
|
+
'compatibility_flags: ["nodejs_compat"]',
|
|
427
|
+
'class_name: "Sandbox"',
|
|
428
|
+
'image: "../../Dockerfile"',
|
|
429
|
+
"durable_objects",
|
|
430
|
+
"new_sqlite_classes",
|
|
431
|
+
];
|
|
432
|
+
for (const marker of requiredWranglerMarkers) {
|
|
433
|
+
if (!renderCloudflareWranglerConfigSource.includes(marker)) {
|
|
434
|
+
failures.push(
|
|
435
|
+
`${sourcePath}: generated-static-target-linking: wrangler config missing ${marker}`,
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
failIfAny("generated static target linking", failures);
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
return {
|
|
444
|
+
sliceBetweenMarkers,
|
|
445
|
+
checkGeneratedStaticTargetLinking,
|
|
446
|
+
};
|
|
447
|
+
};
|