@app-vitals/agent-admin 1.115.0 → 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@app-vitals/agent-admin",
|
|
3
|
-
"version": "1.115.
|
|
3
|
+
"version": "1.115.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/app-vitals/agent.git",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@anthropic-ai/sdk": "0.137.0",
|
|
47
|
-
"@app-vitals/agent-lib": "1.115.
|
|
47
|
+
"@app-vitals/agent-lib": "1.115.2",
|
|
48
48
|
"@hono/zod-openapi": "^1.0.0",
|
|
49
49
|
"@prisma/adapter-pg": "^7.10.0",
|
|
50
50
|
"@prisma/client": "^7.10.0",
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* admin/src/agent-env-classification.unit.test.ts
|
|
3
|
+
*
|
|
4
|
+
* Every env var the platform provisions onto an agent (written by the GitHub
|
|
5
|
+
* and Slack provisioners, or emitted by the agent pod manifest) must be
|
|
6
|
+
* classified for the model's child process: runtime-only (stripped),
|
|
7
|
+
* pass-through secret, or an explicitly listed non-secret system var. A new
|
|
8
|
+
* system-provisioned var that is not classified fails here, so it cannot reach
|
|
9
|
+
* the child env by default. (Lives in admin: admin may import lib, not the
|
|
10
|
+
* reverse.)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { describe, expect, it } from "bun:test";
|
|
14
|
+
import { readFileSync } from "node:fs";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import {
|
|
17
|
+
CHILD_ALLOWED_SECRET_ENV_VARS,
|
|
18
|
+
RUNTIME_ONLY_ENV_VARS,
|
|
19
|
+
} from "@app-vitals/agent-lib/child-env";
|
|
20
|
+
import {
|
|
21
|
+
type AgentDeploymentOpts,
|
|
22
|
+
buildAgentDeploymentManifest,
|
|
23
|
+
} from "./agent-manifest.ts";
|
|
24
|
+
|
|
25
|
+
/** Non-secret vars the platform provisions: ids, slugs, URLs, paths, flags. */
|
|
26
|
+
const NON_SECRET_SYSTEM_ENV_VARS: readonly string[] = [
|
|
27
|
+
// GitHub provisioner
|
|
28
|
+
"GH_APP_ID",
|
|
29
|
+
"GH_APP_CLIENT_ID",
|
|
30
|
+
"GH_APP_SLUG",
|
|
31
|
+
"GH_APP_INSTALLATION_ID",
|
|
32
|
+
// Slack provisioner
|
|
33
|
+
"SLACK_APP_ID",
|
|
34
|
+
"SLACK_CLIENT_ID",
|
|
35
|
+
// Pod manifest
|
|
36
|
+
"SHIPWRIGHT_AGENT_ID",
|
|
37
|
+
"SHIPWRIGHT_API_URL",
|
|
38
|
+
"SHIPWRIGHT_HEALTH_PORT",
|
|
39
|
+
"AGENT_HOME",
|
|
40
|
+
"SHIPWRIGHT_REPO_DIR",
|
|
41
|
+
"SHIPWRIGHT_WORKTREE_DIR",
|
|
42
|
+
"SHIPWRIGHT_TASK_STORE_URL",
|
|
43
|
+
"SHIPWRIGHT_CHAT_SERVICE_URL",
|
|
44
|
+
"WHISPER_SERVICE_URL",
|
|
45
|
+
"ELEVENLABS_VOICE_ID",
|
|
46
|
+
"ANTHROPIC_IDENTITY_TOKEN_FILE",
|
|
47
|
+
"ANTHROPIC_FEDERATION_RULE_ID",
|
|
48
|
+
"ANTHROPIC_ORGANIZATION_ID",
|
|
49
|
+
"ANTHROPIC_SERVICE_ACCOUNT_ID",
|
|
50
|
+
"ANTHROPIC_WORKSPACE_ID",
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const classified = new Set<string>([
|
|
54
|
+
...RUNTIME_ONLY_ENV_VARS,
|
|
55
|
+
...CHILD_ALLOWED_SECRET_ENV_VARS,
|
|
56
|
+
...NON_SECRET_SYSTEM_ENV_VARS,
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
/** Every env name the pod manifest emits with all optional wiring switched on. */
|
|
60
|
+
function manifestEnvNames(): string[] {
|
|
61
|
+
const opts: AgentDeploymentOpts = {
|
|
62
|
+
agentId: "agent-1",
|
|
63
|
+
namespace: "ns",
|
|
64
|
+
image: "img",
|
|
65
|
+
imageTag: "t",
|
|
66
|
+
apiUrl: "http://admin.svc",
|
|
67
|
+
pvcName: "pvc",
|
|
68
|
+
secretName: "secret",
|
|
69
|
+
serviceIntegrations: [
|
|
70
|
+
{
|
|
71
|
+
tokenEnv: "SHIPWRIGHT_TASK_STORE_TOKEN",
|
|
72
|
+
urlEnv: "SHIPWRIGHT_TASK_STORE_URL",
|
|
73
|
+
secretKey: "task-store-token",
|
|
74
|
+
url: "http://task-store.svc",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
chatServiceUrl: "http://chat.svc",
|
|
78
|
+
voice: {
|
|
79
|
+
whisperServiceUrl: "http://whisper.svc",
|
|
80
|
+
groqApiKey: "g",
|
|
81
|
+
elevenLabsApiKey: "e",
|
|
82
|
+
voiceId: "v",
|
|
83
|
+
},
|
|
84
|
+
anthropicFederation: {
|
|
85
|
+
serviceAccountName: "sa",
|
|
86
|
+
ruleId: "r",
|
|
87
|
+
organizationId: "o",
|
|
88
|
+
serviceAccountId: "s",
|
|
89
|
+
workspaceId: "w",
|
|
90
|
+
audience: "a",
|
|
91
|
+
expirationSeconds: 3600,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
const env =
|
|
95
|
+
buildAgentDeploymentManifest(opts).spec.template.spec.containers[0].env;
|
|
96
|
+
return (env ?? []).map((e) => e.name);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** Every GH_* / SLACK_* name the provisioner sources mention (writes and reads). */
|
|
100
|
+
function provisionerEnvNames(): string[] {
|
|
101
|
+
const names = new Set<string>();
|
|
102
|
+
for (const file of [
|
|
103
|
+
"github-provisioning-service.ts",
|
|
104
|
+
"slack-provisioning-service.ts",
|
|
105
|
+
]) {
|
|
106
|
+
const src = readFileSync(join(import.meta.dir, file), "utf-8");
|
|
107
|
+
for (const m of src.matchAll(/\b(?:GH|SLACK)_[A-Z0-9]+(?:_[A-Z0-9]+)*\b/g))
|
|
108
|
+
names.add(m[0]);
|
|
109
|
+
}
|
|
110
|
+
return [...names];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
describe("system-provisioned agent env classification", () => {
|
|
114
|
+
it("collects a non-trivial set from each source", () => {
|
|
115
|
+
expect(manifestEnvNames()).toContain("SHIPWRIGHT_AGENT_API_KEY");
|
|
116
|
+
expect(manifestEnvNames()).toContain("GROQ_API_KEY");
|
|
117
|
+
expect(provisionerEnvNames()).toContain("GH_APP_PRIVATE_KEY");
|
|
118
|
+
expect(provisionerEnvNames()).toContain("SLACK_APP_TOKEN");
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it.each(manifestEnvNames())("manifest env %s is classified", (name) => {
|
|
122
|
+
expect(classified.has(name)).toBe(true);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it.each(provisionerEnvNames())("provisioner env %s is classified", (name) => {
|
|
126
|
+
expect(classified.has(name)).toBe(true);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("classifies every Slack var the Slack flow stores", () => {
|
|
130
|
+
for (const name of [
|
|
131
|
+
"SLACK_BOT_TOKEN",
|
|
132
|
+
"SLACK_APP_TOKEN",
|
|
133
|
+
"SLACK_APP_ID",
|
|
134
|
+
"SLACK_CLIENT_ID",
|
|
135
|
+
"SLACK_CLIENT_SECRET",
|
|
136
|
+
"SLACK_SIGNING_SECRET",
|
|
137
|
+
])
|
|
138
|
+
expect(classified.has(name)).toBe(true);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it("keeps the non-secret list disjoint from the secret lists", () => {
|
|
142
|
+
const secretish = new Set<string>([
|
|
143
|
+
...RUNTIME_ONLY_ENV_VARS,
|
|
144
|
+
...CHILD_ALLOWED_SECRET_ENV_VARS,
|
|
145
|
+
]);
|
|
146
|
+
for (const name of NON_SECRET_SYSTEM_ENV_VARS)
|
|
147
|
+
expect(secretish.has(name)).toBe(false);
|
|
148
|
+
});
|
|
149
|
+
});
|