@openpalm/lib 0.10.2 → 0.11.0-beta.10
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/README.md +4 -2
- package/package.json +11 -3
- package/src/control-plane/akm-vault.test.ts +105 -0
- package/src/control-plane/akm-vault.ts +311 -0
- package/src/control-plane/channels.ts +11 -9
- package/src/control-plane/cleanup-guardrails.test.ts +8 -9
- package/src/control-plane/compose-args.test.ts +25 -33
- package/src/control-plane/compose-args.ts +0 -4
- package/src/control-plane/compose-errors.test.ts +106 -0
- package/src/control-plane/compose-errors.ts +117 -0
- package/src/control-plane/config-persistence.ts +148 -73
- package/src/control-plane/core-assets.test.ts +104 -0
- package/src/control-plane/core-assets.ts +111 -58
- package/src/control-plane/docker.ts +70 -25
- package/src/control-plane/env.test.ts +25 -1
- package/src/control-plane/env.ts +84 -1
- package/src/control-plane/home.ts +66 -69
- package/src/control-plane/host-opencode.test.ts +260 -0
- package/src/control-plane/host-opencode.ts +229 -0
- package/src/control-plane/install-edge-cases.test.ts +190 -292
- package/src/control-plane/install-lock.ts +157 -0
- package/src/control-plane/lifecycle.ts +65 -75
- package/src/control-plane/markdown-task.ts +200 -0
- package/src/control-plane/migrate-0110.test.ts +177 -0
- package/src/control-plane/migrate-0110.ts +99 -0
- package/src/control-plane/operator-ids.test.ts +130 -0
- package/src/control-plane/operator-ids.ts +89 -0
- package/src/control-plane/paths.ts +80 -0
- package/src/control-plane/provider-models.ts +154 -0
- package/src/control-plane/registry-components.test.ts +105 -27
- package/src/control-plane/registry.test.ts +247 -51
- package/src/control-plane/registry.ts +404 -54
- package/src/control-plane/rollback.ts +17 -16
- package/src/control-plane/scheduler.ts +75 -262
- package/src/control-plane/secret-mappings.ts +4 -8
- package/src/control-plane/secrets.ts +97 -55
- package/src/control-plane/setup-config.schema.json +5 -17
- package/src/control-plane/setup-status.ts +9 -29
- package/src/control-plane/setup-validation.ts +23 -23
- package/src/control-plane/setup.test.ts +143 -244
- package/src/control-plane/setup.ts +216 -133
- package/src/control-plane/skeleton-guardrail.test.ts +151 -0
- package/src/control-plane/spec-to-env.test.ts +75 -60
- package/src/control-plane/spec-to-env.ts +68 -153
- package/src/control-plane/stack-spec.test.ts +22 -84
- package/src/control-plane/stack-spec.ts +9 -89
- package/src/control-plane/types.ts +9 -29
- package/src/control-plane/ui-assets.ts +385 -0
- package/src/control-plane/validate.ts +44 -79
- package/src/index.ts +102 -56
- package/src/logger.test.ts +228 -0
- package/src/logger.ts +71 -1
- package/src/provider-constants.ts +22 -1
- package/src/control-plane/audit.ts +0 -40
- package/src/control-plane/env-schema-validation.test.ts +0 -118
- package/src/control-plane/lock.test.ts +0 -194
- package/src/control-plane/lock.ts +0 -176
- package/src/control-plane/memory-config.ts +0 -298
- package/src/control-plane/provider-config.ts +0 -34
- package/src/control-plane/redact-schema.ts +0 -50
- package/src/control-plane/secret-backend.test.ts +0 -359
- package/src/control-plane/secret-backend.ts +0 -322
- package/src/control-plane/spec-validator.ts +0 -159
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* StackSpec v2 validation.
|
|
3
|
-
*
|
|
4
|
-
* Returns structured, actionable error messages with codes
|
|
5
|
-
* so users can quickly identify and fix configuration issues.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { StackSpec, StackSpecCapabilities } from "./stack-spec.js";
|
|
9
|
-
|
|
10
|
-
export type ValidationError = {
|
|
11
|
-
code: string;
|
|
12
|
-
message: string;
|
|
13
|
-
path?: string;
|
|
14
|
-
hint?: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const IMAGE_NS_RE = /^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;
|
|
18
|
-
|
|
19
|
-
export function validateStackSpec(input: unknown): ValidationError[] {
|
|
20
|
-
const errors: ValidationError[] = [];
|
|
21
|
-
|
|
22
|
-
if (typeof input !== "object" || input === null) {
|
|
23
|
-
errors.push({
|
|
24
|
-
code: "OP-CFG-000",
|
|
25
|
-
message: "Configuration must be an object",
|
|
26
|
-
hint: "Check that the YAML file starts with valid configuration keys",
|
|
27
|
-
});
|
|
28
|
-
return errors;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const spec = input as Record<string, unknown>;
|
|
32
|
-
|
|
33
|
-
// Version check
|
|
34
|
-
if (spec.version !== 2) {
|
|
35
|
-
errors.push({
|
|
36
|
-
code: "OP-CFG-020",
|
|
37
|
-
message: `Expected version: 2, got: ${spec.version ?? "(missing)"}`,
|
|
38
|
-
path: "version",
|
|
39
|
-
hint: "Set version: 2 at the top of your config file",
|
|
40
|
-
});
|
|
41
|
-
return errors;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Capabilities
|
|
45
|
-
if (typeof spec.capabilities !== "object" || spec.capabilities === null) {
|
|
46
|
-
errors.push({
|
|
47
|
-
code: "OP-CFG-001",
|
|
48
|
-
message: "No capabilities defined",
|
|
49
|
-
path: "capabilities",
|
|
50
|
-
hint: "Add capabilities.llm and capabilities.embeddings sections",
|
|
51
|
-
});
|
|
52
|
-
} else {
|
|
53
|
-
validateCapabilities(spec.capabilities as StackSpecCapabilities, errors);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Image
|
|
57
|
-
if (spec.image && typeof spec.image === "object") {
|
|
58
|
-
const img = spec.image as Record<string, unknown>;
|
|
59
|
-
if (
|
|
60
|
-
typeof img.namespace === "string" &&
|
|
61
|
-
!IMAGE_NS_RE.test(img.namespace)
|
|
62
|
-
) {
|
|
63
|
-
errors.push({
|
|
64
|
-
code: "OP-CFG-012",
|
|
65
|
-
message: `image.namespace "${img.namespace}" contains invalid characters`,
|
|
66
|
-
path: "image.namespace",
|
|
67
|
-
hint: "Use lowercase letters, numbers, dots, hyphens, or underscores",
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return errors;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function validateCapabilities(
|
|
76
|
-
capabilities: StackSpecCapabilities,
|
|
77
|
-
errors: ValidationError[],
|
|
78
|
-
): void {
|
|
79
|
-
// LLM (required, "provider/model" string)
|
|
80
|
-
if (!capabilities.llm || typeof capabilities.llm !== "string") {
|
|
81
|
-
errors.push({
|
|
82
|
-
code: "OP-CFG-008",
|
|
83
|
-
message: "capabilities.llm is required (format: provider/model)",
|
|
84
|
-
path: "capabilities.llm",
|
|
85
|
-
hint: 'Example: "anthropic/claude-sonnet-4-5" or "ollama/qwen2.5-coder:3b"',
|
|
86
|
-
});
|
|
87
|
-
} else if (!capabilities.llm.includes("/")) {
|
|
88
|
-
errors.push({
|
|
89
|
-
code: "OP-CFG-008",
|
|
90
|
-
message: `capabilities.llm "${capabilities.llm}" must be in provider/model format`,
|
|
91
|
-
path: "capabilities.llm",
|
|
92
|
-
hint: 'Example: "anthropic/claude-sonnet-4-5"',
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// SLM (optional, same format)
|
|
97
|
-
if (capabilities.slm !== undefined) {
|
|
98
|
-
if (typeof capabilities.slm !== "string") {
|
|
99
|
-
errors.push({
|
|
100
|
-
code: "OP-CFG-008",
|
|
101
|
-
message: "capabilities.slm must be a string (format: provider/model)",
|
|
102
|
-
path: "capabilities.slm",
|
|
103
|
-
});
|
|
104
|
-
} else if (!capabilities.slm.includes("/")) {
|
|
105
|
-
errors.push({
|
|
106
|
-
code: "OP-CFG-008",
|
|
107
|
-
message: `capabilities.slm "${capabilities.slm}" must be in provider/model format`,
|
|
108
|
-
path: "capabilities.slm",
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Embeddings (required object)
|
|
114
|
-
if (!capabilities.embeddings || typeof capabilities.embeddings !== "object") {
|
|
115
|
-
errors.push({
|
|
116
|
-
code: "OP-CFG-002",
|
|
117
|
-
message: "capabilities.embeddings is required",
|
|
118
|
-
path: "capabilities.embeddings",
|
|
119
|
-
hint: "Add provider, model, and dims fields",
|
|
120
|
-
});
|
|
121
|
-
} else {
|
|
122
|
-
const emb = capabilities.embeddings;
|
|
123
|
-
if (!emb.provider || typeof emb.provider !== "string") {
|
|
124
|
-
errors.push({
|
|
125
|
-
code: "OP-CFG-004",
|
|
126
|
-
message: "capabilities.embeddings.provider is required",
|
|
127
|
-
path: "capabilities.embeddings.provider",
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
if (!emb.model || typeof emb.model !== "string") {
|
|
131
|
-
errors.push({
|
|
132
|
-
code: "OP-CFG-008",
|
|
133
|
-
message: "capabilities.embeddings.model is required",
|
|
134
|
-
path: "capabilities.embeddings.model",
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
if (
|
|
138
|
-
emb.dims !== undefined &&
|
|
139
|
-
(typeof emb.dims !== "number" || emb.dims < 1)
|
|
140
|
-
) {
|
|
141
|
-
errors.push({
|
|
142
|
-
code: "OP-CFG-009",
|
|
143
|
-
message: "capabilities.embeddings.dims must be a positive integer",
|
|
144
|
-
path: "capabilities.embeddings.dims",
|
|
145
|
-
hint: "Common values: nomic-embed-text: 768, text-embedding-3-small: 1536",
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Memory (required object)
|
|
151
|
-
if (!capabilities.memory || typeof capabilities.memory !== "object") {
|
|
152
|
-
errors.push({
|
|
153
|
-
code: "OP-CFG-002",
|
|
154
|
-
message: "capabilities.memory is required",
|
|
155
|
-
path: "capabilities.memory",
|
|
156
|
-
hint: "Add at minimum a userId field",
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
}
|