@ericsanchezok/meta-protocol 1.1.20 → 1.1.22
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/package.json +1 -1
- package/src/env.ts +16 -3
package/package.json
CHANGED
package/src/env.ts
CHANGED
|
@@ -34,14 +34,23 @@ export namespace MetaProtocolEnv {
|
|
|
34
34
|
|
|
35
35
|
const PLACEHOLDER_ALIASES = new Set(["undefined", "null", "none", "nil", "n/a"])
|
|
36
36
|
|
|
37
|
+
const ENVID_PREFIX = "env_"
|
|
38
|
+
|
|
39
|
+
export type InvalidReason = "placeholder_alias" | "invalid_format"
|
|
40
|
+
|
|
37
41
|
export class InvalidEnvIDError extends Error {
|
|
38
42
|
constructor(
|
|
39
43
|
readonly envID: string,
|
|
40
|
-
readonly reason:
|
|
44
|
+
readonly reason: InvalidReason,
|
|
41
45
|
) {
|
|
42
46
|
super(
|
|
43
|
-
|
|
44
|
-
`
|
|
47
|
+
reason === "placeholder_alias"
|
|
48
|
+
? `Invalid envID "${envID}". This looks like a placeholder value, not a real remote environment ID. ` +
|
|
49
|
+
`For local execution, do NOT include the envID parameter at all — remove it from your tool call. ` +
|
|
50
|
+
`For remote execution, pass a real remote envID such as "env_...".`
|
|
51
|
+
: `Invalid envID "${envID}". Remote environment IDs must start with "${ENVID_PREFIX}". ` +
|
|
52
|
+
`For local execution, do NOT include the envID parameter at all — remove it from your tool call. ` +
|
|
53
|
+
`Do not try to pass a value meaning "local" or "omit" — simply leave out the envID key entirely.`,
|
|
45
54
|
)
|
|
46
55
|
this.name = "MetaProtocolInvalidEnvIDError"
|
|
47
56
|
}
|
|
@@ -66,6 +75,10 @@ export namespace MetaProtocolEnv {
|
|
|
66
75
|
throw new InvalidEnvIDError(trimmed, "placeholder_alias")
|
|
67
76
|
}
|
|
68
77
|
|
|
78
|
+
if (!trimmed.startsWith(ENVID_PREFIX)) {
|
|
79
|
+
throw new InvalidEnvIDError(trimmed, "invalid_format")
|
|
80
|
+
}
|
|
81
|
+
|
|
69
82
|
return trimmed as EnvID
|
|
70
83
|
}
|
|
71
84
|
|