openpond 0.0.30-bootstrap.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.
- package/CHANGELOG.md +128 -0
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/RELEASE.md +20 -0
- package/dist/api/core.d.ts +22 -0
- package/dist/api/deployments.d.ts +30 -0
- package/dist/api/types.d.ts +624 -0
- package/dist/api.d.ts +90 -0
- package/dist/cache.d.ts +22 -0
- package/dist/chunks/app-layer-YKXEQGOW.js +163 -0
- package/dist/chunks/apps-GGSIN2ZF.js +539 -0
- package/dist/chunks/chunk-3CC6MH35.js +1663 -0
- package/dist/chunks/chunk-3Y4EL3P6.js +1090 -0
- package/dist/chunks/chunk-4HYJG2JE.js +3875 -0
- package/dist/chunks/chunk-5G4E547X.js +294 -0
- package/dist/chunks/chunk-74O6FGVN.js +598 -0
- package/dist/chunks/chunk-AUJLPKGI.js +632 -0
- package/dist/chunks/chunk-BYAPLT37.js +744 -0
- package/dist/chunks/chunk-FUP7EGT7.js +1845 -0
- package/dist/chunks/chunk-I6HN3ZGW.js +88 -0
- package/dist/chunks/chunk-KRKGHVMQ.js +294 -0
- package/dist/chunks/chunk-LHYK6QO2.js +1300 -0
- package/dist/chunks/chunk-NLBKZZEK.js +224 -0
- package/dist/chunks/chunk-OG75GMVO.js +1 -0
- package/dist/chunks/chunk-Q57SVPEH.js +11663 -0
- package/dist/chunks/chunk-UACZUFIA.js +47 -0
- package/dist/chunks/chunk-VQX33YAG.js +5135 -0
- package/dist/chunks/chunk-W5GKHH77.js +168 -0
- package/dist/chunks/chunk-WYDVQOBL.js +17581 -0
- package/dist/chunks/chunk-XSAXENQD.js +4167 -0
- package/dist/chunks/chunk-Y6G6WRTG.js +210 -0
- package/dist/chunks/cli-NVKNE4AZ.js +11 -0
- package/dist/chunks/cli-X3HPLSOV.js +19 -0
- package/dist/chunks/core-commands-IM2UKLU4.js +41 -0
- package/dist/chunks/extend-YXCBULPO.js +84 -0
- package/dist/chunks/harness-GMK6IY2U.js +140 -0
- package/dist/chunks/help-LMH5FGT2.js +65 -0
- package/dist/chunks/opchat-BWXZ32GX.js +169 -0
- package/dist/chunks/organizations-4ISQRGMQ.js +738 -0
- package/dist/chunks/profile-NLDZDT3L.js +1110 -0
- package/dist/chunks/project-agent-ZPVO25HA.js +892 -0
- package/dist/chunks/sandbox-command-5GFJ2U3V.js +1652 -0
- package/dist/chunks/sandbox-template-LZN4F55Z.js +1646 -0
- package/dist/chunks/src-3RBI4DNN.js +3595 -0
- package/dist/chunks/src-EYXQS6XD.js +73427 -0
- package/dist/chunks/teams-bot-WP3FHKGA.js +137 -0
- package/dist/cli.js +77 -0
- package/dist/client-types.d.ts +222 -0
- package/dist/client.d.ts +19 -0
- package/dist/config.d.ts +184 -0
- package/dist/hosted-chat.d.ts +162 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +25481 -0
- package/dist/indicators.d.ts +38 -0
- package/dist/opchat-smoke.d.ts +47 -0
- package/dist/private-json-file.d.ts +3 -0
- package/dist/profile/local-profile-types.d.ts +160 -0
- package/dist/profile/local-profile.d.ts +69 -0
- package/dist/profile/profile-catalog.d.ts +14 -0
- package/dist/profile/profile-git.d.ts +17 -0
- package/dist/profile/profile-promotion.d.ts +21 -0
- package/dist/profile/profile-setup-gate.d.ts +22 -0
- package/dist/profile/profile-skills.d.ts +30 -0
- package/dist/profile/profile-source-upload.d.ts +29 -0
- package/dist/profile/source-upload-cache.d.ts +29 -0
- package/dist/sandbox/async-request-options.d.ts +2 -0
- package/dist/sandbox/client-handles.d.ts +113 -0
- package/dist/sandbox/client.d.ts +348 -0
- package/dist/sandbox/runtime-handle.d.ts +36 -0
- package/dist/sandbox/sandbox-instance-client.d.ts +72 -0
- package/dist/sandbox/smoke.d.ts +3 -0
- package/dist/sandbox/stream.d.ts +7 -0
- package/dist/sandbox/types/billing.d.ts +176 -0
- package/dist/sandbox/types/client.d.ts +103 -0
- package/dist/sandbox/types/core.d.ts +140 -0
- package/dist/sandbox/types/index.d.ts +14 -0
- package/dist/sandbox/types/io.d.ts +240 -0
- package/dist/sandbox/types/microsoft-teams-bot.d.ts +51 -0
- package/dist/sandbox/types/org-project-agent.d.ts +610 -0
- package/dist/sandbox/types/record.d.ts +53 -0
- package/dist/sandbox/types/responses.d.ts +295 -0
- package/dist/sandbox/types/runtime-profiles.d.ts +15 -0
- package/dist/sandbox/types/runtime.d.ts +152 -0
- package/dist/sandbox/types/schedules.d.ts +141 -0
- package/dist/sandbox/types/snapshots.d.ts +205 -0
- package/dist/sandbox/types/workflow-modes.d.ts +1 -0
- package/dist/sandbox/types/workload-sources.d.ts +20 -0
- package/dist/sandbox/url.d.ts +2 -0
- package/dist/sandbox-template/manifest.d.ts +304 -0
- package/dist/sandbox-template/manifest.js +18381 -0
- package/dist/skills/openpond-cli/SKILL.md +49 -0
- package/dist/skills/openpond-desktop-harness/SKILL.md +113 -0
- package/dist/skills/openpond-desktop-harness/agents/openai.yaml +4 -0
- package/dist/skills/openpond-taskset-authoring/SKILL.md +38 -0
- package/dist/skills/openpond-taskset-authoring/references/graders-and-rewards.md +11 -0
- package/dist/skills/openpond-taskset-authoring/references/method-selection.md +12 -0
- package/dist/skills/openpond-taskset-authoring/references/privacy-and-provenance.md +8 -0
- package/dist/skills/openpond-taskset-authoring/references/task-design.md +13 -0
- package/dist/stream.d.ts +20 -0
- package/dist/types.d.ts +57 -0
- package/dist/urls.d.ts +4 -0
- package/dist/web/assets/AppsView-Bu-Nc3Ew.js +1 -0
- package/dist/web/assets/AppsView-DIhprTIC.css +1 -0
- package/dist/web/assets/BrowserSidebar-CCguQ-DR.js +1 -0
- package/dist/web/assets/BrowserSidebar-D9i7gQzw.css +1 -0
- package/dist/web/assets/CloudWorkView-DNoPIlMj.css +1 -0
- package/dist/web/assets/CloudWorkView-Dr3xqLE5.js +1 -0
- package/dist/web/assets/CommandMenu-CnodJFHD.js +1 -0
- package/dist/web/assets/CommandMenu-hNQCm8mw.css +1 -0
- package/dist/web/assets/CommunityView-CIbjNUZr.js +1 -0
- package/dist/web/assets/CommunityView-DSik4sd2.css +1 -0
- package/dist/web/assets/GetStartedView-C3ZrnEz5.css +1 -0
- package/dist/web/assets/GetStartedView-C8nyH_PT.js +1 -0
- package/dist/web/assets/LabsExtensions-GtJzxDnK.js +1 -0
- package/dist/web/assets/LabsProfile-DG7rWYur.js +1 -0
- package/dist/web/assets/LabsRoute-D6MDHBzq.js +2 -0
- package/dist/web/assets/LabsRoute-TEt9j1vB.css +1 -0
- package/dist/web/assets/LabsSignals-BfsDN86w.js +1 -0
- package/dist/web/assets/LabsSignals-D6iA6Ryl.css +1 -0
- package/dist/web/assets/NewProjectDialog-CaKiCoVS.js +1 -0
- package/dist/web/assets/ProfileSettingsSection-DTQS2DVL.css +1 -0
- package/dist/web/assets/ProfileSettingsSection-DxEzoF3K.js +1 -0
- package/dist/web/assets/ProfileView-CEscW7Ru.js +1 -0
- package/dist/web/assets/SettingsView-DwbGu8Kj.css +1 -0
- package/dist/web/assets/SettingsView-JIRR_FO4.js +63 -0
- package/dist/web/assets/TeamChatView-B5M1ThhJ.js +3 -0
- package/dist/web/assets/TeamChatView-Bx44q3WV.css +1 -0
- package/dist/web/assets/TerminalOverlay-C1iP4OS1.js +19 -0
- package/dist/web/assets/TerminalOverlay-DwBiZLwk.css +1 -0
- package/dist/web/assets/TrainingSettingsSection-BDYvI2te.js +1 -0
- package/dist/web/assets/TrainingView-CoCFK6W3.js +5 -0
- package/dist/web/assets/WorkspaceDiffPanel-CMxKQeo7.js +14 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-B8JJbwIz.js +32 -0
- package/dist/web/assets/WorkspaceEnvironmentMenu-DGIFdG3o.css +1 -0
- package/dist/web/assets/WorkspaceGitDialogs-B4sp9BGn.js +1 -0
- package/dist/web/assets/WorkspaceMonacoEditor-BBqimG5X.js +845 -0
- package/dist/web/assets/WorkspaceMonacoEditor-BwKcXIZw.css +1 -0
- package/dist/web/assets/boxes-DAaDUabq.js +1 -0
- package/dist/web/assets/codicon-ngg6Pgfi.ttf +0 -0
- package/dist/web/assets/css.worker-DBVD8oXr.js +93 -0
- package/dist/web/assets/cssMode-CBF1mieJ.js +1 -0
- package/dist/web/assets/dockerfile-BG73LgW2.js +1 -0
- package/dist/web/assets/editor.worker-CdQrwHl8.js +26 -0
- package/dist/web/assets/git-commit-horizontal-CAickXpN.js +1 -0
- package/dist/web/assets/git-dialogs-BZDqS1eT.css +1 -0
- package/dist/web/assets/html.worker-CwpTb9lJ.js +470 -0
- package/dist/web/assets/htmlMode-2u8OHtWO.js +1 -0
- package/dist/web/assets/index-BdY6A-YN.css +1 -0
- package/dist/web/assets/index-CU2qhUYV.js +195 -0
- package/dist/web/assets/index-Dz2B3-4C.js +1 -0
- package/dist/web/assets/info-CQNTh78o.js +1 -0
- package/dist/web/assets/json.worker-BoL8UZqY.js +58 -0
- package/dist/web/assets/jsonMode-C4CWXViX.js +7 -0
- package/dist/web/assets/lspLanguageFeatures-CBs_BOlB.js +4 -0
- package/dist/web/assets/markdown-BFxVWTOG.js +1 -0
- package/dist/web/assets/monaco.contribution-C1LUxAKf.js +2 -0
- package/dist/web/assets/monaco.contribution-Cpf6dWsh.js +2 -0
- package/dist/web/assets/monaco.contribution-lOXpG2xQ.js +2 -0
- package/dist/web/assets/monaco.contribution-sd3cFkcN.js +2 -0
- package/dist/web/assets/monitor-DsIswrMV.js +1 -0
- package/dist/web/assets/play-CeRw21NV.js +1 -0
- package/dist/web/assets/python-CXYq3BUl.js +1 -0
- package/dist/web/assets/refresh-cw-N5b_6AP5.js +1 -0
- package/dist/web/assets/reply-BSKjZrJg.js +1 -0
- package/dist/web/assets/save-D0oHH1a3.js +1 -0
- package/dist/web/assets/settings-lists-BEg6LMcy.css +1 -0
- package/dist/web/assets/shell-DiJ1NA_G.js +1 -0
- package/dist/web/assets/toggleHighContrast-B7NOMXDY.css +1 -0
- package/dist/web/assets/toggleHighContrast-DRjlcwes.js +62 -0
- package/dist/web/assets/training-model-data-BPrc68VG.js +1 -0
- package/dist/web/assets/ts.worker-BH9nVgjN.js +67718 -0
- package/dist/web/assets/tsMode-x-1A7ZcB.js +11 -0
- package/dist/web/assets/wifi-off-Dt52ofzh.js +1 -0
- package/dist/web/assets/workers-Ciff6Dzi.js +1 -0
- package/dist/web/assets/yaml-CB67Kxnz.js +1 -0
- package/dist/web/connected-apps/github.svg +3 -0
- package/dist/web/connected-apps/google.svg +6 -0
- package/dist/web/connected-apps/linear.svg +3 -0
- package/dist/web/connected-apps/microsoft.svg +6 -0
- package/dist/web/connected-apps/notion.svg +3 -0
- package/dist/web/connected-apps/openpond-mcp.svg +4 -0
- package/dist/web/connected-apps/slack.svg +6 -0
- package/dist/web/connected-apps/x.svg +3 -0
- package/dist/web/favicon-16x16.png +0 -0
- package/dist/web/favicon-32x32.png +0 -0
- package/dist/web/index.html +16 -0
- package/dist/web/openpond-icon.png +0 -0
- package/dist/web/openpond-wordlogo-white.png +0 -0
- package/dist/web/tokens/eth.svg +1 -0
- package/dist/web/tokens/usdc.svg +1 -0
- package/docs/agent-edit-check-status-json.md +132 -0
- package/docs/command-reference.md +695 -0
- package/package.json +84 -0
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
external_exports,
|
|
4
|
+
yaml
|
|
5
|
+
} from "./chunk-WYDVQOBL.js";
|
|
6
|
+
|
|
7
|
+
// ../../packages/cloud/src/sandbox-template/manifest.ts
|
|
8
|
+
var SANDBOX_TEMPLATE_PREVIEW_PORT_MIN = 3e3;
|
|
9
|
+
var SANDBOX_TEMPLATE_PREVIEW_PORT_MAX = 9999;
|
|
10
|
+
var OPENPOND_MANIFEST_FILE_NAME = "openpond.yaml";
|
|
11
|
+
var SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME = "openpond-template-plan.json";
|
|
12
|
+
var SANDBOX_TEMPLATE_BUILD_PLAN_KIND = "openpond.sandboxTemplate.buildPlan.v1";
|
|
13
|
+
var INTEGRATION_PROVIDERS = [
|
|
14
|
+
"google",
|
|
15
|
+
"github",
|
|
16
|
+
"x"
|
|
17
|
+
];
|
|
18
|
+
var RESERVED_PREVIEW_PORTS = /* @__PURE__ */ new Set([
|
|
19
|
+
22,
|
|
20
|
+
2222,
|
|
21
|
+
2375,
|
|
22
|
+
2376,
|
|
23
|
+
3108,
|
|
24
|
+
5900,
|
|
25
|
+
5901,
|
|
26
|
+
6080,
|
|
27
|
+
7818
|
|
28
|
+
]);
|
|
29
|
+
var CommandListSchema = external_exports.array(external_exports.string().trim().min(1).max(1e3)).max(50);
|
|
30
|
+
var RelativeWorkspacePathSchema = external_exports.string().trim().min(1).max(4096).refine(isSafeRelativeWorkspacePath, {
|
|
31
|
+
message: "path must be a relative workspace path"
|
|
32
|
+
});
|
|
33
|
+
var OciImageRefSchema = external_exports.string().trim().min(1).max(500).refine(
|
|
34
|
+
(value) => !value.includes("\0") && !/\s/.test(value),
|
|
35
|
+
"image ref must be a single OCI reference"
|
|
36
|
+
);
|
|
37
|
+
var OciDigestSchema = external_exports.string().trim().regex(/^sha256:[0-9a-f]{64}$/i);
|
|
38
|
+
var RuntimeWorkspaceRootSchema = external_exports.string().trim().min(1).max(500).refine(
|
|
39
|
+
(value) => value.startsWith("/") && !value.includes("\0"),
|
|
40
|
+
"workspaceRoot must be an absolute guest path"
|
|
41
|
+
);
|
|
42
|
+
var DockerfileRuntimeImageSchema = external_exports.object({
|
|
43
|
+
ref: OciImageRefSchema,
|
|
44
|
+
digest: OciDigestSchema.optional(),
|
|
45
|
+
registrySecretRef: external_exports.string().trim().min(1).max(500).optional(),
|
|
46
|
+
platform: external_exports.literal("linux/amd64").optional(),
|
|
47
|
+
workspaceRoot: RuntimeWorkspaceRootSchema.optional()
|
|
48
|
+
}).strict();
|
|
49
|
+
var DockerfileRuntimeSourceSchema = external_exports.object({
|
|
50
|
+
context: RelativeWorkspacePathSchema.default("."),
|
|
51
|
+
path: RelativeWorkspacePathSchema.default("Dockerfile"),
|
|
52
|
+
target: external_exports.string().trim().min(1).max(191).optional(),
|
|
53
|
+
buildArgs: external_exports.record(external_exports.string().max(191), external_exports.string().max(500)).optional(),
|
|
54
|
+
registrySecretRefs: external_exports.array(external_exports.string().trim().min(1).max(500)).max(10).optional(),
|
|
55
|
+
platform: external_exports.literal("linux/amd64").optional(),
|
|
56
|
+
workspaceRoot: RuntimeWorkspaceRootSchema.optional()
|
|
57
|
+
}).strict();
|
|
58
|
+
var SandboxTemplateRuntimeSchema = external_exports.object({
|
|
59
|
+
base: external_exports.string().trim().min(1).max(120).optional(),
|
|
60
|
+
snapshot: external_exports.string().trim().min(1).max(191).optional(),
|
|
61
|
+
image: DockerfileRuntimeImageSchema.optional(),
|
|
62
|
+
dockerfile: DockerfileRuntimeSourceSchema.optional()
|
|
63
|
+
}).strict().superRefine((runtime, context) => {
|
|
64
|
+
const selected = [
|
|
65
|
+
runtime.base,
|
|
66
|
+
runtime.snapshot,
|
|
67
|
+
runtime.image,
|
|
68
|
+
runtime.dockerfile
|
|
69
|
+
].filter(Boolean).length;
|
|
70
|
+
if (selected !== 1) {
|
|
71
|
+
context.addIssue({
|
|
72
|
+
code: external_exports.ZodIssueCode.custom,
|
|
73
|
+
message: "runtime must declare exactly one of base, snapshot, image, or dockerfile"
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
var SandboxTemplateResourcesSchema = external_exports.object({
|
|
78
|
+
cpu: external_exports.number().positive().max(8).optional(),
|
|
79
|
+
memoryGb: external_exports.number().positive().max(32).optional(),
|
|
80
|
+
diskGb: external_exports.number().positive().max(100).optional()
|
|
81
|
+
}).strict();
|
|
82
|
+
var SandboxTemplateRequiredLeaseSchema = external_exports.object({
|
|
83
|
+
provider: external_exports.enum(INTEGRATION_PROVIDERS),
|
|
84
|
+
scopes: external_exports.array(external_exports.string().trim().min(1).max(200)).max(100).default([]),
|
|
85
|
+
capabilities: external_exports.array(external_exports.string().trim().min(1).max(200)).max(100).default([])
|
|
86
|
+
}).strict();
|
|
87
|
+
var SandboxTemplateOpChatPermissionsSchema = external_exports.object({
|
|
88
|
+
models: external_exports.array(external_exports.string().trim().min(1).max(200)).max(100).default([]),
|
|
89
|
+
scopes: external_exports.array(external_exports.string().trim().min(1).max(200)).max(100).default([])
|
|
90
|
+
}).strict();
|
|
91
|
+
var SandboxTemplatePermissionsSchema = external_exports.object({
|
|
92
|
+
opchat: SandboxTemplateOpChatPermissionsSchema.optional()
|
|
93
|
+
}).catchall(external_exports.record(external_exports.string(), external_exports.unknown())).default({});
|
|
94
|
+
var SandboxTemplateVolumeSchema = external_exports.object({
|
|
95
|
+
name: external_exports.string().trim().regex(/^[A-Za-z_][A-Za-z0-9_-]*$/).max(63).optional(),
|
|
96
|
+
mountPath: external_exports.string().trim().min(1).max(256).optional(),
|
|
97
|
+
storageGb: external_exports.number().int().positive().max(100).optional(),
|
|
98
|
+
deleteOnSandboxDelete: external_exports.boolean().optional()
|
|
99
|
+
}).strict();
|
|
100
|
+
var SandboxTemplatePortSchema = external_exports.object({
|
|
101
|
+
port: external_exports.number().int().min(SANDBOX_TEMPLATE_PREVIEW_PORT_MIN).max(SANDBOX_TEMPLATE_PREVIEW_PORT_MAX).refine((port) => !RESERVED_PREVIEW_PORTS.has(port), {
|
|
102
|
+
message: "preview port is reserved"
|
|
103
|
+
}),
|
|
104
|
+
protocol: external_exports.literal("http").default("http"),
|
|
105
|
+
label: external_exports.string().trim().min(1).max(80).optional(),
|
|
106
|
+
access: external_exports.enum(["private", "public"]).default("private"),
|
|
107
|
+
path: external_exports.string().trim().min(1).max(512).refine((value) => value.startsWith("/"), {
|
|
108
|
+
message: "preview path must start with /"
|
|
109
|
+
}).default("/")
|
|
110
|
+
}).strict();
|
|
111
|
+
var SandboxTemplateCommandSchema = external_exports.object({
|
|
112
|
+
command: external_exports.string().trim().min(1).max(1e3),
|
|
113
|
+
cwd: RelativeWorkspacePathSchema.optional(),
|
|
114
|
+
timeoutSeconds: external_exports.number().int().positive().max(86400).optional(),
|
|
115
|
+
requiresStart: external_exports.boolean().default(false),
|
|
116
|
+
ports: external_exports.array(SandboxTemplatePortSchema).max(20).default([]),
|
|
117
|
+
artifactPaths: external_exports.array(RelativeWorkspacePathSchema).max(100).default([])
|
|
118
|
+
}).strict();
|
|
119
|
+
var SandboxTemplateNamedCommandSchema = SandboxTemplateCommandSchema.extend({
|
|
120
|
+
name: external_exports.string().trim().min(1).max(80)
|
|
121
|
+
}).strict();
|
|
122
|
+
var SandboxTemplateMcpEndpointSchema = external_exports.object({
|
|
123
|
+
name: external_exports.string().trim().min(1).max(80).optional(),
|
|
124
|
+
service: external_exports.string().trim().min(1).max(80).optional(),
|
|
125
|
+
port: external_exports.number().int().min(SANDBOX_TEMPLATE_PREVIEW_PORT_MIN).max(SANDBOX_TEMPLATE_PREVIEW_PORT_MAX).refine((port) => !RESERVED_PREVIEW_PORTS.has(port), {
|
|
126
|
+
message: "app MCP port is reserved"
|
|
127
|
+
}),
|
|
128
|
+
path: external_exports.string().trim().min(1).max(512).refine((value) => value.startsWith("/"), {
|
|
129
|
+
message: "app MCP path must start with /"
|
|
130
|
+
}).default("/mcp")
|
|
131
|
+
}).strict();
|
|
132
|
+
var SandboxTemplateValidationProbeSchema = external_exports.object({
|
|
133
|
+
name: external_exports.string().trim().min(1).max(80).optional(),
|
|
134
|
+
port: external_exports.number().int().min(SANDBOX_TEMPLATE_PREVIEW_PORT_MIN).max(SANDBOX_TEMPLATE_PREVIEW_PORT_MAX).refine((port) => !RESERVED_PREVIEW_PORTS.has(port), {
|
|
135
|
+
message: "validation probe port is reserved"
|
|
136
|
+
}),
|
|
137
|
+
path: external_exports.string().trim().min(1).max(512).refine((value) => value.startsWith("/"), {
|
|
138
|
+
message: "validation probe path must start with /"
|
|
139
|
+
}).default("/"),
|
|
140
|
+
expectedStatus: external_exports.number().int().min(100).max(599).default(200)
|
|
141
|
+
}).strict();
|
|
142
|
+
var SandboxTemplateJsonSchema = external_exports.record(external_exports.string(), external_exports.unknown()).refine(
|
|
143
|
+
(schema) => schema.type === "object",
|
|
144
|
+
"input schema must be a JSON schema object"
|
|
145
|
+
);
|
|
146
|
+
var SandboxTemplateEnvInputSchema = external_exports.object({
|
|
147
|
+
name: external_exports.string().trim().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(191),
|
|
148
|
+
required: external_exports.boolean().default(false),
|
|
149
|
+
secret: external_exports.boolean().default(true),
|
|
150
|
+
description: external_exports.string().trim().max(500).optional()
|
|
151
|
+
}).strict();
|
|
152
|
+
var SandboxTemplateScheduleDateSchema = external_exports.string().trim().min(1).max(120);
|
|
153
|
+
var SandboxTemplateScheduleSchema = external_exports.object({
|
|
154
|
+
name: external_exports.string().trim().min(1).max(120),
|
|
155
|
+
description: external_exports.string().trim().max(500).optional(),
|
|
156
|
+
cron: external_exports.string().trim().min(1).max(500).optional(),
|
|
157
|
+
rate: external_exports.string().trim().min(1).max(500).optional(),
|
|
158
|
+
once: SandboxTemplateScheduleDateSchema.optional(),
|
|
159
|
+
scheduleType: external_exports.enum(["rate", "cron", "once"]).optional(),
|
|
160
|
+
scheduleExpression: external_exports.string().trim().min(1).max(500).optional(),
|
|
161
|
+
timezone: external_exports.string().trim().min(1).max(100).optional(),
|
|
162
|
+
enabled: external_exports.boolean().default(true),
|
|
163
|
+
startAt: SandboxTemplateScheduleDateSchema.optional(),
|
|
164
|
+
endAt: SandboxTemplateScheduleDateSchema.optional(),
|
|
165
|
+
maxRuns: external_exports.number().int().positive().nullable().optional(),
|
|
166
|
+
runtimePolicy: external_exports.enum([
|
|
167
|
+
"run_and_stop",
|
|
168
|
+
"run_and_archive",
|
|
169
|
+
"run_and_delete",
|
|
170
|
+
"use_existing_running"
|
|
171
|
+
]).default("run_and_stop"),
|
|
172
|
+
action: external_exports.string().trim().min(1).max(120).optional(),
|
|
173
|
+
actionName: external_exports.string().trim().min(1).max(120).optional(),
|
|
174
|
+
command: external_exports.string().trim().min(1).max(2e3).optional(),
|
|
175
|
+
target: external_exports.object({
|
|
176
|
+
kind: external_exports.enum(["start", "action", "service", "command"]).optional(),
|
|
177
|
+
name: external_exports.string().trim().min(1).max(120).optional(),
|
|
178
|
+
actionName: external_exports.string().trim().min(1).max(120).optional(),
|
|
179
|
+
command: external_exports.string().trim().min(1).max(2e3).optional(),
|
|
180
|
+
requiresStart: external_exports.boolean().optional()
|
|
181
|
+
}).strict().optional(),
|
|
182
|
+
requiresStart: external_exports.boolean().optional(),
|
|
183
|
+
budget: external_exports.object({
|
|
184
|
+
maxUsd: external_exports.string().trim().min(1).max(40).optional()
|
|
185
|
+
}).strict().optional(),
|
|
186
|
+
resources: SandboxTemplateResourcesSchema.optional(),
|
|
187
|
+
quotas: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
188
|
+
lifecycle: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
189
|
+
retentionPolicy: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
190
|
+
env: external_exports.array(
|
|
191
|
+
external_exports.object({
|
|
192
|
+
name: external_exports.string().trim().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).max(191),
|
|
193
|
+
value: external_exports.string().optional(),
|
|
194
|
+
secretRef: external_exports.string().optional()
|
|
195
|
+
}).strict()
|
|
196
|
+
).max(100).optional(),
|
|
197
|
+
integrationLeases: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).max(20).optional(),
|
|
198
|
+
metadata: external_exports.record(external_exports.string(), external_exports.unknown()).optional()
|
|
199
|
+
}).strict().superRefine((schedule, context) => {
|
|
200
|
+
const expressionCount = [
|
|
201
|
+
schedule.cron,
|
|
202
|
+
schedule.rate,
|
|
203
|
+
schedule.once,
|
|
204
|
+
schedule.scheduleExpression
|
|
205
|
+
].filter((value) => typeof value === "string" && value.trim()).length;
|
|
206
|
+
if (expressionCount !== 1) {
|
|
207
|
+
context.addIssue({
|
|
208
|
+
code: external_exports.ZodIssueCode.custom,
|
|
209
|
+
path: ["scheduleExpression"],
|
|
210
|
+
message: "schedule must declare exactly one of cron, rate, once, or scheduleExpression"
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
if (schedule.scheduleExpression && !schedule.scheduleType) {
|
|
214
|
+
context.addIssue({
|
|
215
|
+
code: external_exports.ZodIssueCode.custom,
|
|
216
|
+
path: ["scheduleType"],
|
|
217
|
+
message: "scheduleType is required with scheduleExpression"
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
const command = schedule.command ?? schedule.target?.command ?? null;
|
|
221
|
+
const targetName = schedule.target?.name ?? null;
|
|
222
|
+
const actionName = schedule.actionName ?? schedule.action ?? schedule.target?.actionName ?? (schedule.target?.kind === "action" ? targetName : null);
|
|
223
|
+
const kind = schedule.target?.kind ?? (command ? "command" : "action");
|
|
224
|
+
if (kind === "action" && !actionName) {
|
|
225
|
+
context.addIssue({
|
|
226
|
+
code: external_exports.ZodIssueCode.custom,
|
|
227
|
+
path: ["action"],
|
|
228
|
+
message: "schedule action target is required"
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
if (kind === "service" && !targetName) {
|
|
232
|
+
context.addIssue({
|
|
233
|
+
code: external_exports.ZodIssueCode.custom,
|
|
234
|
+
path: ["target", "name"],
|
|
235
|
+
message: "schedule service target name is required"
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
if (kind === "command" && !command) {
|
|
239
|
+
context.addIssue({
|
|
240
|
+
code: external_exports.ZodIssueCode.custom,
|
|
241
|
+
path: ["command"],
|
|
242
|
+
message: "schedule command target is required"
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
var SandboxTemplateManifestSchema = external_exports.object({
|
|
247
|
+
schemaVersion: external_exports.literal(1),
|
|
248
|
+
name: external_exports.string().trim().min(1).max(80).regex(/^[a-z0-9][a-z0-9-]*[a-z0-9]$/),
|
|
249
|
+
version: external_exports.string().trim().min(1).max(40),
|
|
250
|
+
useCase: external_exports.string().trim().min(1).max(80),
|
|
251
|
+
description: external_exports.string().trim().min(1).max(500),
|
|
252
|
+
runtime: SandboxTemplateRuntimeSchema,
|
|
253
|
+
resources: SandboxTemplateResourcesSchema.optional(),
|
|
254
|
+
setup: external_exports.object({
|
|
255
|
+
commands: CommandListSchema.default([])
|
|
256
|
+
}).strict().default({ commands: [] }),
|
|
257
|
+
validation: external_exports.object({
|
|
258
|
+
commands: CommandListSchema.min(1),
|
|
259
|
+
probes: external_exports.array(SandboxTemplateValidationProbeSchema).max(20).default([])
|
|
260
|
+
}).strict(),
|
|
261
|
+
start: SandboxTemplateCommandSchema,
|
|
262
|
+
actions: external_exports.array(SandboxTemplateNamedCommandSchema).max(20).default([]),
|
|
263
|
+
services: external_exports.array(SandboxTemplateNamedCommandSchema).max(20).default([]),
|
|
264
|
+
schedules: external_exports.array(SandboxTemplateScheduleSchema).max(20).default([]),
|
|
265
|
+
mcp: external_exports.object({
|
|
266
|
+
endpoints: external_exports.array(SandboxTemplateMcpEndpointSchema).max(10).default([])
|
|
267
|
+
}).strict().default({ endpoints: [] }),
|
|
268
|
+
volumes: external_exports.array(SandboxTemplateVolumeSchema).max(5).default([]),
|
|
269
|
+
integrations: external_exports.object({
|
|
270
|
+
requiredLeases: external_exports.array(SandboxTemplateRequiredLeaseSchema).max(20).default([])
|
|
271
|
+
}).strict().default({ requiredLeases: [] }),
|
|
272
|
+
permissions: SandboxTemplatePermissionsSchema,
|
|
273
|
+
inputs: external_exports.object({
|
|
274
|
+
schema: SandboxTemplateJsonSchema.default({ type: "object" }),
|
|
275
|
+
env: external_exports.array(SandboxTemplateEnvInputSchema).max(100).default([])
|
|
276
|
+
}).strict().default({ schema: { type: "object" }, env: [] }),
|
|
277
|
+
artifacts: external_exports.object({
|
|
278
|
+
paths: external_exports.array(RelativeWorkspacePathSchema).max(100).default([])
|
|
279
|
+
}).strict().default({ paths: [] }),
|
|
280
|
+
network: external_exports.object({
|
|
281
|
+
egress: external_exports.enum(["restricted", "allow", "block"]).default("restricted")
|
|
282
|
+
}).strict().default({ egress: "restricted" })
|
|
283
|
+
}).strict().superRefine((manifest, context) => {
|
|
284
|
+
validateExecutableNames(manifest, context);
|
|
285
|
+
addDuplicateNameIssue(
|
|
286
|
+
context,
|
|
287
|
+
manifest.volumes.flatMap((volume) => volume.name ? [volume.name] : []),
|
|
288
|
+
"volume names must be unique",
|
|
289
|
+
"volumes"
|
|
290
|
+
);
|
|
291
|
+
validateInputSchemaUploadTargets(manifest, context);
|
|
292
|
+
validateEnvInputs(manifest, context);
|
|
293
|
+
validateMcpEndpoints(manifest, context);
|
|
294
|
+
validateScheduleTargets(manifest, context);
|
|
295
|
+
});
|
|
296
|
+
var SandboxTemplateValidationDiagnosticSchema = external_exports.object({
|
|
297
|
+
path: external_exports.string(),
|
|
298
|
+
message: external_exports.string(),
|
|
299
|
+
code: external_exports.string()
|
|
300
|
+
});
|
|
301
|
+
function validateSandboxTemplateYaml(source) {
|
|
302
|
+
let parsed;
|
|
303
|
+
try {
|
|
304
|
+
parsed = yaml.load(source);
|
|
305
|
+
} catch (error) {
|
|
306
|
+
return {
|
|
307
|
+
ok: false,
|
|
308
|
+
manifest: null,
|
|
309
|
+
diagnostics: [
|
|
310
|
+
{
|
|
311
|
+
path: "$",
|
|
312
|
+
code: "invalid_yaml",
|
|
313
|
+
message: error instanceof Error ? error.message : "Invalid YAML"
|
|
314
|
+
}
|
|
315
|
+
]
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
return validateSandboxTemplateManifest(parsed);
|
|
319
|
+
}
|
|
320
|
+
function validateSandboxTemplateManifest(value) {
|
|
321
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
322
|
+
return {
|
|
323
|
+
ok: false,
|
|
324
|
+
manifest: null,
|
|
325
|
+
diagnostics: [
|
|
326
|
+
{
|
|
327
|
+
path: "$",
|
|
328
|
+
code: "invalid_type",
|
|
329
|
+
message: `${OPENPOND_MANIFEST_FILE_NAME} must be an object`
|
|
330
|
+
}
|
|
331
|
+
]
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
if (Object.prototype.hasOwnProperty.call(value, "databases")) {
|
|
335
|
+
return {
|
|
336
|
+
ok: false,
|
|
337
|
+
manifest: null,
|
|
338
|
+
diagnostics: [
|
|
339
|
+
{
|
|
340
|
+
path: "$.databases",
|
|
341
|
+
code: "database_resources_removed",
|
|
342
|
+
message: "managed database requests are unsupported for Firecracker sandbox templates; use a durable volume with SQLite or files instead"
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
const result = SandboxTemplateManifestSchema.safeParse(value);
|
|
348
|
+
if (result.success)
|
|
349
|
+
return { ok: true, manifest: result.data, diagnostics: [] };
|
|
350
|
+
return {
|
|
351
|
+
ok: false,
|
|
352
|
+
manifest: null,
|
|
353
|
+
diagnostics: result.error.issues.map((issue) => ({
|
|
354
|
+
path: formatIssuePath(issue.path),
|
|
355
|
+
code: issue.code,
|
|
356
|
+
message: issue.message
|
|
357
|
+
}))
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function formatSandboxTemplateDiagnostics(diagnostics) {
|
|
361
|
+
return diagnostics.map((diagnostic) => `${diagnostic.path}: ${diagnostic.message}`).join("\n");
|
|
362
|
+
}
|
|
363
|
+
function sandboxTemplateExecutableEntries(manifest) {
|
|
364
|
+
return [
|
|
365
|
+
{
|
|
366
|
+
kind: "start",
|
|
367
|
+
name: "start",
|
|
368
|
+
...manifest.start,
|
|
369
|
+
artifactPaths: commandArtifactPaths(manifest.start, manifest)
|
|
370
|
+
},
|
|
371
|
+
...manifest.actions.map((action) => ({
|
|
372
|
+
kind: "action",
|
|
373
|
+
name: action.name,
|
|
374
|
+
command: action.command,
|
|
375
|
+
cwd: action.cwd,
|
|
376
|
+
timeoutSeconds: action.timeoutSeconds,
|
|
377
|
+
requiresStart: action.requiresStart,
|
|
378
|
+
ports: action.ports,
|
|
379
|
+
artifactPaths: commandArtifactPaths(action, manifest)
|
|
380
|
+
})),
|
|
381
|
+
...manifest.services.map((service) => ({
|
|
382
|
+
kind: "service",
|
|
383
|
+
name: service.name,
|
|
384
|
+
command: service.command,
|
|
385
|
+
cwd: service.cwd,
|
|
386
|
+
timeoutSeconds: service.timeoutSeconds,
|
|
387
|
+
requiresStart: service.requiresStart,
|
|
388
|
+
ports: service.ports,
|
|
389
|
+
artifactPaths: commandArtifactPaths(service, manifest)
|
|
390
|
+
}))
|
|
391
|
+
];
|
|
392
|
+
}
|
|
393
|
+
function sandboxTemplateBuildMetadata(manifest) {
|
|
394
|
+
const executables = sandboxTemplateExecutableEntries(manifest);
|
|
395
|
+
return {
|
|
396
|
+
template: {
|
|
397
|
+
name: manifest.name,
|
|
398
|
+
version: manifest.version,
|
|
399
|
+
useCase: manifest.useCase,
|
|
400
|
+
runtime: manifest.runtime
|
|
401
|
+
},
|
|
402
|
+
resources: manifest.resources ?? null,
|
|
403
|
+
volumes: manifest.volumes,
|
|
404
|
+
executables: executables.map((entry) => ({
|
|
405
|
+
kind: entry.kind,
|
|
406
|
+
name: entry.name,
|
|
407
|
+
command: entry.command,
|
|
408
|
+
cwd: entry.cwd ?? null,
|
|
409
|
+
timeoutSeconds: entry.timeoutSeconds ?? null,
|
|
410
|
+
requiresStart: entry.requiresStart,
|
|
411
|
+
ports: entry.ports.map((port) => port.port),
|
|
412
|
+
artifactPaths: entry.artifactPaths
|
|
413
|
+
})),
|
|
414
|
+
ports: executables.flatMap(
|
|
415
|
+
(entry) => entry.ports.map((port) => ({
|
|
416
|
+
executable: entry.name,
|
|
417
|
+
kind: entry.kind,
|
|
418
|
+
port: port.port,
|
|
419
|
+
access: port.access,
|
|
420
|
+
label: port.label ?? null
|
|
421
|
+
}))
|
|
422
|
+
),
|
|
423
|
+
appMcpEndpoints: manifest.mcp.endpoints.map((endpoint) => ({
|
|
424
|
+
name: endpoint.name ?? null,
|
|
425
|
+
service: endpoint.service ?? null,
|
|
426
|
+
port: endpoint.port,
|
|
427
|
+
path: endpoint.path
|
|
428
|
+
})),
|
|
429
|
+
validation: {
|
|
430
|
+
commands: manifest.validation.commands,
|
|
431
|
+
probes: manifest.validation.probes
|
|
432
|
+
},
|
|
433
|
+
schedules: manifest.schedules
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
function sandboxTemplateBuildPlan(input) {
|
|
437
|
+
return {
|
|
438
|
+
kind: SANDBOX_TEMPLATE_BUILD_PLAN_KIND,
|
|
439
|
+
schemaVersion: 1,
|
|
440
|
+
manifestFile: input.manifestFile,
|
|
441
|
+
projectRoot: input.projectRoot,
|
|
442
|
+
manifest: input.manifest,
|
|
443
|
+
metadata: sandboxTemplateBuildMetadata(input.manifest),
|
|
444
|
+
executables: sandboxTemplateExecutableEntries(input.manifest)
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
function sandboxTemplateScaffoldFiles(input) {
|
|
448
|
+
const displayName = input.name.trim() || "Sandbox Template";
|
|
449
|
+
const name = slug(displayName);
|
|
450
|
+
const description = input.description?.trim() || `Local scaffold for ${displayName}.`;
|
|
451
|
+
return {
|
|
452
|
+
".gitignore": ["node_modules", "artifacts", ".DS_Store", ""].join("\n"),
|
|
453
|
+
"README.md": [
|
|
454
|
+
`# ${displayName}`,
|
|
455
|
+
"",
|
|
456
|
+
"Local sandbox template scaffold.",
|
|
457
|
+
"",
|
|
458
|
+
"## Commands",
|
|
459
|
+
"",
|
|
460
|
+
"- `pnpm dev` starts the preview service on port 3000.",
|
|
461
|
+
"- `pnpm process` writes a sample artifact.",
|
|
462
|
+
`- \`pnpm validate\` validates ${OPENPOND_MANIFEST_FILE_NAME}.`,
|
|
463
|
+
""
|
|
464
|
+
].join("\n"),
|
|
465
|
+
"package.json": `${JSON.stringify(
|
|
466
|
+
{
|
|
467
|
+
private: true,
|
|
468
|
+
type: "module",
|
|
469
|
+
scripts: {
|
|
470
|
+
dev: "node src/server.ts",
|
|
471
|
+
process: "node scripts/process.ts",
|
|
472
|
+
validate: `openpond sandbox-template validate --file ${OPENPOND_MANIFEST_FILE_NAME}`
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
null,
|
|
476
|
+
2
|
|
477
|
+
)}
|
|
478
|
+
`,
|
|
479
|
+
[OPENPOND_MANIFEST_FILE_NAME]: [
|
|
480
|
+
"schemaVersion: 1",
|
|
481
|
+
`name: ${name}`,
|
|
482
|
+
"version: 0.1.0",
|
|
483
|
+
"useCase: sandbox-template-scaffold",
|
|
484
|
+
`description: ${description}`,
|
|
485
|
+
"runtime:",
|
|
486
|
+
" base: node-bun-workspace",
|
|
487
|
+
"resources:",
|
|
488
|
+
" cpu: 1",
|
|
489
|
+
" memoryGb: 1",
|
|
490
|
+
" diskGb: 8",
|
|
491
|
+
"setup:",
|
|
492
|
+
" commands:",
|
|
493
|
+
" - mkdir -p artifacts",
|
|
494
|
+
"validation:",
|
|
495
|
+
" commands:",
|
|
496
|
+
" - test -f src/server.ts",
|
|
497
|
+
" - test -f scripts/process.ts",
|
|
498
|
+
"start:",
|
|
499
|
+
" command: pnpm process",
|
|
500
|
+
" timeoutSeconds: 300",
|
|
501
|
+
" ports: []",
|
|
502
|
+
" artifactPaths:",
|
|
503
|
+
" - artifacts/result.json",
|
|
504
|
+
"actions: []",
|
|
505
|
+
"schedules: []",
|
|
506
|
+
"services:",
|
|
507
|
+
" - name: web",
|
|
508
|
+
" command: pnpm dev",
|
|
509
|
+
" timeoutSeconds: 3600",
|
|
510
|
+
" ports:",
|
|
511
|
+
" - port: 3000",
|
|
512
|
+
" protocol: http",
|
|
513
|
+
" label: web",
|
|
514
|
+
" access: private",
|
|
515
|
+
" path: /",
|
|
516
|
+
" artifactPaths: []",
|
|
517
|
+
"inputs:",
|
|
518
|
+
" env:",
|
|
519
|
+
" - name: FOO_API_KEY",
|
|
520
|
+
" required: false",
|
|
521
|
+
" secret: true",
|
|
522
|
+
" description: API key used by the sample action.",
|
|
523
|
+
" schema:",
|
|
524
|
+
" type: object",
|
|
525
|
+
" properties:",
|
|
526
|
+
" subject:",
|
|
527
|
+
" type: string",
|
|
528
|
+
" title: Subject",
|
|
529
|
+
" default: Example",
|
|
530
|
+
"artifacts:",
|
|
531
|
+
" paths:",
|
|
532
|
+
" - artifacts/result.json",
|
|
533
|
+
"network:",
|
|
534
|
+
" egress: restricted",
|
|
535
|
+
""
|
|
536
|
+
].join("\n"),
|
|
537
|
+
"src/server.ts": [
|
|
538
|
+
"import { createServer } from 'node:http';",
|
|
539
|
+
"",
|
|
540
|
+
"createServer((_request, response) => {",
|
|
541
|
+
" response.setHeader('content-type', 'application/json');",
|
|
542
|
+
" response.end(JSON.stringify({ ok: true, template: 'sandbox-template-scaffold' }));",
|
|
543
|
+
"}).listen(3000, '0.0.0.0');",
|
|
544
|
+
""
|
|
545
|
+
].join("\n"),
|
|
546
|
+
"scripts/process.ts": [
|
|
547
|
+
"import { mkdir, writeFile } from 'node:fs/promises';",
|
|
548
|
+
"",
|
|
549
|
+
"const raw = process.env.OPENPOND_REPLAY_PARAMS_BASE64;",
|
|
550
|
+
"const params = raw ? JSON.parse(Buffer.from(raw, 'base64').toString('utf8')).input ?? {} : {};",
|
|
551
|
+
"await mkdir('artifacts', { recursive: true });",
|
|
552
|
+
"await writeFile('artifacts/result.json', JSON.stringify({ ok: true, input: params }, null, 2));",
|
|
553
|
+
"console.log('wrote artifacts/result.json');",
|
|
554
|
+
""
|
|
555
|
+
].join("\n"),
|
|
556
|
+
"fixtures/input.txt": "Example input\n"
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
function sandboxTemplateJsonSchema() {
|
|
560
|
+
return external_exports.toJSONSchema(SandboxTemplateManifestSchema);
|
|
561
|
+
}
|
|
562
|
+
function isSafeRelativeWorkspacePath(value) {
|
|
563
|
+
return !value.includes("\0") && !value.startsWith("/") && !value.split(/[\\/]+/).some((segment) => segment === ".." || segment === "");
|
|
564
|
+
}
|
|
565
|
+
function formatIssuePath(path) {
|
|
566
|
+
if (path.length === 0) return "$";
|
|
567
|
+
return `$${path.map(
|
|
568
|
+
(part) => typeof part === "number" ? `[${part}]` : `.${String(part)}`
|
|
569
|
+
).join("")}`;
|
|
570
|
+
}
|
|
571
|
+
function addDuplicateNameIssue(context, names, message, path) {
|
|
572
|
+
const seen = /* @__PURE__ */ new Set();
|
|
573
|
+
for (const name of names) {
|
|
574
|
+
if (seen.has(name)) {
|
|
575
|
+
context.addIssue({
|
|
576
|
+
code: external_exports.ZodIssueCode.custom,
|
|
577
|
+
path: [path],
|
|
578
|
+
message
|
|
579
|
+
});
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
seen.add(name);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
function validateExecutableNames(manifest, context) {
|
|
586
|
+
const names = [
|
|
587
|
+
"start",
|
|
588
|
+
...manifest.actions.map((action) => action.name),
|
|
589
|
+
...manifest.services.map((service) => service.name)
|
|
590
|
+
];
|
|
591
|
+
addDuplicateNameIssue(
|
|
592
|
+
context,
|
|
593
|
+
names,
|
|
594
|
+
"start, action, and service names must be unique",
|
|
595
|
+
"actions"
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
function validateInputSchemaUploadTargets(manifest, context) {
|
|
599
|
+
const properties = asRecord(manifest.inputs.schema.properties);
|
|
600
|
+
const volumeNames = new Set(
|
|
601
|
+
manifest.volumes.map((volume) => volume.name).filter((name) => Boolean(name))
|
|
602
|
+
);
|
|
603
|
+
for (const [inputName, rawProperty] of Object.entries(properties)) {
|
|
604
|
+
const property = asRecord(rawProperty);
|
|
605
|
+
const upload = asRecord(
|
|
606
|
+
property["x-openpond-upload"] ?? property.xOpenPondUpload
|
|
607
|
+
);
|
|
608
|
+
const targetPath = typeof upload.targetPath === "string" && upload.targetPath.trim() ? upload.targetPath.trim() : typeof upload.path === "string" && upload.path.trim() ? upload.path.trim() : "";
|
|
609
|
+
if (!targetPath) continue;
|
|
610
|
+
const normalizedTargetPath = targetPath.replace(/^workspace\//, "").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
611
|
+
if (!isSafeRelativeWorkspacePath(normalizedTargetPath)) {
|
|
612
|
+
context.addIssue({
|
|
613
|
+
code: external_exports.ZodIssueCode.custom,
|
|
614
|
+
path: [
|
|
615
|
+
"inputs",
|
|
616
|
+
"schema",
|
|
617
|
+
"properties",
|
|
618
|
+
inputName,
|
|
619
|
+
"x-openpond-upload",
|
|
620
|
+
"targetPath"
|
|
621
|
+
],
|
|
622
|
+
message: "upload target must be a relative workspace path"
|
|
623
|
+
});
|
|
624
|
+
continue;
|
|
625
|
+
}
|
|
626
|
+
const parts = normalizedTargetPath.split("/");
|
|
627
|
+
if (parts[0] === "volumes" && (!parts[1] || !volumeNames.has(parts[1]))) {
|
|
628
|
+
context.addIssue({
|
|
629
|
+
code: external_exports.ZodIssueCode.custom,
|
|
630
|
+
path: [
|
|
631
|
+
"inputs",
|
|
632
|
+
"schema",
|
|
633
|
+
"properties",
|
|
634
|
+
inputName,
|
|
635
|
+
"x-openpond-upload",
|
|
636
|
+
"targetPath"
|
|
637
|
+
],
|
|
638
|
+
message: "upload target references an undeclared volume"
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
function validateEnvInputs(manifest, context) {
|
|
644
|
+
addDuplicateNameIssue(
|
|
645
|
+
context,
|
|
646
|
+
manifest.inputs.env.map((env) => env.name),
|
|
647
|
+
"env input names must be unique",
|
|
648
|
+
"inputs"
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
function validateMcpEndpoints(manifest, context) {
|
|
652
|
+
const servicePorts = new Map(
|
|
653
|
+
manifest.services.map((service) => [
|
|
654
|
+
service.name,
|
|
655
|
+
new Set(service.ports.map((port) => port.port))
|
|
656
|
+
])
|
|
657
|
+
);
|
|
658
|
+
const declaredPorts = /* @__PURE__ */ new Set([
|
|
659
|
+
...manifest.start.ports.map((port) => port.port),
|
|
660
|
+
...manifest.services.flatMap(
|
|
661
|
+
(service) => service.ports.map((port) => port.port)
|
|
662
|
+
)
|
|
663
|
+
]);
|
|
664
|
+
for (const [index, endpoint] of manifest.mcp.endpoints.entries()) {
|
|
665
|
+
if (endpoint.service) {
|
|
666
|
+
const ports = servicePorts.get(endpoint.service);
|
|
667
|
+
if (!ports) {
|
|
668
|
+
context.addIssue({
|
|
669
|
+
code: external_exports.ZodIssueCode.custom,
|
|
670
|
+
path: ["mcp", "endpoints", index, "service"],
|
|
671
|
+
message: `app MCP service does not exist: ${endpoint.service}`
|
|
672
|
+
});
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
675
|
+
if (!ports.has(endpoint.port)) {
|
|
676
|
+
context.addIssue({
|
|
677
|
+
code: external_exports.ZodIssueCode.custom,
|
|
678
|
+
path: ["mcp", "endpoints", index, "port"],
|
|
679
|
+
message: `app MCP port ${endpoint.port} is not declared on service ${endpoint.service}`
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
684
|
+
if (!declaredPorts.has(endpoint.port)) {
|
|
685
|
+
context.addIssue({
|
|
686
|
+
code: external_exports.ZodIssueCode.custom,
|
|
687
|
+
path: ["mcp", "endpoints", index, "port"],
|
|
688
|
+
message: `app MCP port ${endpoint.port} is not declared on start or services`
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
function validateScheduleTargets(manifest, context) {
|
|
694
|
+
const actionNames = new Set(manifest.actions.map((action) => action.name));
|
|
695
|
+
const serviceNames = new Set(
|
|
696
|
+
manifest.services.map((service) => service.name)
|
|
697
|
+
);
|
|
698
|
+
for (const [index, schedule] of manifest.schedules.entries()) {
|
|
699
|
+
const command = schedule.command ?? schedule.target?.command ?? null;
|
|
700
|
+
if (schedule.target?.kind === "command" || command) {
|
|
701
|
+
continue;
|
|
702
|
+
}
|
|
703
|
+
const actionName = schedule.actionName ?? schedule.action ?? schedule.target?.actionName ?? (schedule.target?.kind === "action" ? schedule.target?.name : null);
|
|
704
|
+
if (actionName && !actionNames.has(actionName)) {
|
|
705
|
+
context.addIssue({
|
|
706
|
+
code: external_exports.ZodIssueCode.custom,
|
|
707
|
+
path: ["schedules", index, "action"],
|
|
708
|
+
message: `schedule action target does not exist: ${actionName}`
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
if (schedule.target?.kind === "service") {
|
|
712
|
+
const serviceName = schedule.target.name ?? "";
|
|
713
|
+
if (serviceName && !serviceNames.has(serviceName)) {
|
|
714
|
+
context.addIssue({
|
|
715
|
+
code: external_exports.ZodIssueCode.custom,
|
|
716
|
+
path: ["schedules", index, "target", "name"],
|
|
717
|
+
message: `schedule service target does not exist: ${serviceName}`
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
function asRecord(value) {
|
|
724
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
725
|
+
}
|
|
726
|
+
function commandArtifactPaths(command, manifest) {
|
|
727
|
+
return command.artifactPaths.length > 0 ? command.artifactPaths : manifest.artifacts.paths;
|
|
728
|
+
}
|
|
729
|
+
function slug(value) {
|
|
730
|
+
return value.toLowerCase().replace(/[^a-z0-9-]+/g, "-").replace(/^-+|-+$/g, "").replace(/-{2,}/g, "-").slice(0, 80) || "sandbox-template";
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
export {
|
|
734
|
+
OPENPOND_MANIFEST_FILE_NAME,
|
|
735
|
+
SANDBOX_TEMPLATE_BUILD_PLAN_FILE_NAME,
|
|
736
|
+
SANDBOX_TEMPLATE_BUILD_PLAN_KIND,
|
|
737
|
+
validateSandboxTemplateYaml,
|
|
738
|
+
formatSandboxTemplateDiagnostics,
|
|
739
|
+
sandboxTemplateExecutableEntries,
|
|
740
|
+
sandboxTemplateBuildMetadata,
|
|
741
|
+
sandboxTemplateBuildPlan,
|
|
742
|
+
sandboxTemplateScaffoldFiles,
|
|
743
|
+
sandboxTemplateJsonSchema
|
|
744
|
+
};
|