@app-vitals/agent-lib 1.115.1 → 1.115.2
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/child-env.ts +29 -15
- package/child-env.unit.test.ts +36 -3
- package/package.json +1 -1
- package/secret-env-vars.ts +3 -0
- package/secret-env-vars.unit.test.ts +3 -1
package/child-env.ts
CHANGED
|
@@ -12,25 +12,30 @@ import type { SECRET_ENV_VARS } from "./secret-env-vars.ts";
|
|
|
12
12
|
|
|
13
13
|
type SecretEnvVar = (typeof SECRET_ENV_VARS)[number];
|
|
14
14
|
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Vars only the runtime consumes: credentials for the runtime's own Slack,
|
|
17
|
+
* GitHub App and voice integrations, plus the Sentry client DSN. Never passed
|
|
18
|
+
* to a child. Entries are secret-shaped (and so also in SECRET_ENV_VARS)
|
|
19
|
+
* except SENTRY_DSN, a client DSN that is not secret but must not let a spawned
|
|
20
|
+
* session (or any `bun test` it runs) build a real Sentry client.
|
|
21
|
+
*/
|
|
16
22
|
export const RUNTIME_ONLY_ENV_VARS = [
|
|
17
23
|
"GH_APP_PRIVATE_KEY",
|
|
18
24
|
"GH_APP_CLIENT_SECRET",
|
|
19
|
-
"SLACK_SIGNING_SECRET",
|
|
20
25
|
"SLACK_APP_TOKEN",
|
|
26
|
+
"SLACK_SIGNING_SECRET",
|
|
21
27
|
"SLACK_CLIENT_SECRET",
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
"SHIPWRIGHT_ADMIN_VAPID_PRIVATE_KEY",
|
|
27
|
-
"SHIPWRIGHT_ADMIN_PUSH_WEBHOOK_TOKEN",
|
|
28
|
-
"SHIPWRIGHT_CHAT_PUSH_WEBHOOK_TOKEN",
|
|
29
|
-
"SHIPWRIGHT_CHAT_SERVICE_ADMIN_TOKEN",
|
|
30
|
-
"GOOGLE_CLIENT_SECRET",
|
|
31
|
-
] as const satisfies readonly SecretEnvVar[];
|
|
28
|
+
"SENTRY_DSN",
|
|
29
|
+
"GROQ_API_KEY",
|
|
30
|
+
"ELEVENLABS_API_KEY",
|
|
31
|
+
] as const satisfies readonly (SecretEnvVar | "SENTRY_DSN")[];
|
|
32
32
|
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Secrets that pass through to the child. Some the child uses directly (skills,
|
|
35
|
+
* the claude CLI itself). The rest belong to the admin, chat or task-store
|
|
36
|
+
* services: the platform never writes them onto an agent, so one present on an
|
|
37
|
+
* agent was set there on purpose by an operator and is kept.
|
|
38
|
+
*/
|
|
34
39
|
export const CHILD_ALLOWED_SECRET_ENV_VARS = [
|
|
35
40
|
"ANTHROPIC_API_KEY",
|
|
36
41
|
"CLAUDE_CODE_OAUTH_TOKEN",
|
|
@@ -40,9 +45,18 @@ export const CHILD_ALLOWED_SECRET_ENV_VARS = [
|
|
|
40
45
|
"SHIPWRIGHT_TASK_STORE_TOKEN",
|
|
41
46
|
"SHIPWRIGHT_CHAT_SERVICE_TOKEN",
|
|
42
47
|
// The shipped shipwright task-store skill still mints scoped tokens with
|
|
43
|
-
// this admin token.
|
|
44
|
-
// stops using it (follow-up).
|
|
48
|
+
// this admin token.
|
|
45
49
|
"SHIPWRIGHT_TASK_STORE_ADMIN_TOKEN",
|
|
50
|
+
// Service-side secrets, never provisioned onto an agent (operator-set only).
|
|
51
|
+
"SLACK_ADMIN_TOKEN",
|
|
52
|
+
"SHIPWRIGHT_ADMIN_API_KEYS",
|
|
53
|
+
"SHIPWRIGHT_ENCRYPTION_KEY",
|
|
54
|
+
"SHIPWRIGHT_SESSION_SECRET",
|
|
55
|
+
"SHIPWRIGHT_ADMIN_VAPID_PRIVATE_KEY",
|
|
56
|
+
"SHIPWRIGHT_ADMIN_PUSH_WEBHOOK_TOKEN",
|
|
57
|
+
"SHIPWRIGHT_CHAT_PUSH_WEBHOOK_TOKEN",
|
|
58
|
+
"SHIPWRIGHT_CHAT_SERVICE_ADMIN_TOKEN",
|
|
59
|
+
"GOOGLE_CLIENT_SECRET",
|
|
46
60
|
] as const satisfies readonly SecretEnvVar[];
|
|
47
61
|
|
|
48
62
|
/**
|
package/child-env.unit.test.ts
CHANGED
|
@@ -18,9 +18,42 @@ describe("buildChildEnv", () => {
|
|
|
18
18
|
expect(child.MY_OPERATOR_VAR).toBe("x");
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
test("
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
test("RUNTIME_ONLY_ENV_VARS is exactly the runtime-consumed set", () => {
|
|
22
|
+
expect([...(RUNTIME_ONLY_ENV_VARS as readonly string[])].sort()).toEqual(
|
|
23
|
+
[
|
|
24
|
+
"GH_APP_PRIVATE_KEY",
|
|
25
|
+
"GH_APP_CLIENT_SECRET",
|
|
26
|
+
"SLACK_APP_TOKEN",
|
|
27
|
+
"SLACK_SIGNING_SECRET",
|
|
28
|
+
"SLACK_CLIENT_SECRET",
|
|
29
|
+
"SENTRY_DSN",
|
|
30
|
+
"GROQ_API_KEY",
|
|
31
|
+
"ELEVENLABS_API_KEY",
|
|
32
|
+
].sort(),
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("service-side secrets pass through when an operator set them on the agent", () => {
|
|
37
|
+
const names = [
|
|
38
|
+
"SLACK_ADMIN_TOKEN",
|
|
39
|
+
"SHIPWRIGHT_ADMIN_API_KEYS",
|
|
40
|
+
"SHIPWRIGHT_ENCRYPTION_KEY",
|
|
41
|
+
"SHIPWRIGHT_SESSION_SECRET",
|
|
42
|
+
"SHIPWRIGHT_ADMIN_VAPID_PRIVATE_KEY",
|
|
43
|
+
"SHIPWRIGHT_ADMIN_PUSH_WEBHOOK_TOKEN",
|
|
44
|
+
"SHIPWRIGHT_CHAT_PUSH_WEBHOOK_TOKEN",
|
|
45
|
+
"SHIPWRIGHT_TASK_STORE_ADMIN_TOKEN",
|
|
46
|
+
"SHIPWRIGHT_CHAT_SERVICE_ADMIN_TOKEN",
|
|
47
|
+
"GOOGLE_CLIENT_SECRET",
|
|
48
|
+
];
|
|
49
|
+
const env = Object.fromEntries(names.map((n) => [n, "v"]));
|
|
50
|
+
const child = buildChildEnv(env);
|
|
51
|
+
for (const n of names) expect(child[n]).toBe("v");
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("drops SENTRY_DSN, which is runtime-only but not a secret-shaped var", () => {
|
|
55
|
+
const child = buildChildEnv({ SENTRY_DSN: "https://x@sentry.invalid/1" });
|
|
56
|
+
expect("SENTRY_DSN" in child).toBe(false);
|
|
24
57
|
});
|
|
25
58
|
|
|
26
59
|
test("extra is applied last and wins, even over a runtime-only key", () => {
|
package/package.json
CHANGED
package/secret-env-vars.ts
CHANGED
|
@@ -38,4 +38,7 @@ export const SECRET_ENV_VARS = [
|
|
|
38
38
|
// var name (chat-side vs. admin-side).
|
|
39
39
|
"SHIPWRIGHT_CHAT_PUSH_WEBHOOK_TOKEN",
|
|
40
40
|
"GOOGLE_CLIENT_SECRET",
|
|
41
|
+
// Voice provider keys, written onto the agent pod when voice is configured.
|
|
42
|
+
"GROQ_API_KEY",
|
|
43
|
+
"ELEVENLABS_API_KEY",
|
|
41
44
|
] as const;
|
|
@@ -31,6 +31,8 @@ describe("SECRET_ENV_VARS", () => {
|
|
|
31
31
|
"SHIPWRIGHT_ADMIN_PUSH_WEBHOOK_TOKEN",
|
|
32
32
|
"SHIPWRIGHT_CHAT_PUSH_WEBHOOK_TOKEN",
|
|
33
33
|
"GOOGLE_CLIENT_SECRET",
|
|
34
|
+
"GROQ_API_KEY",
|
|
35
|
+
"ELEVENLABS_API_KEY",
|
|
34
36
|
];
|
|
35
37
|
|
|
36
38
|
for (const entry of expectedEntries) {
|
|
@@ -39,7 +41,7 @@ describe("SECRET_ENV_VARS", () => {
|
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
test("has exactly the expected number of entries (catches accidental additions/removals)", () => {
|
|
42
|
-
expect(SECRET_ENV_VARS.length).toBe(
|
|
44
|
+
expect(SECRET_ENV_VARS.length).toBe(24);
|
|
43
45
|
});
|
|
44
46
|
|
|
45
47
|
test("every entry is a non-empty string", () => {
|