@app-vitals/agent-admin 1.36.2 → 1.37.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/openapi.json +5 -0
- package/openapi.platform.json +5 -0
- package/package.json +2 -2
- package/src/admin-boot.ts +1 -0
- package/src/api.smoke.test.ts +47 -0
- package/src/api.ts +14 -1
- package/src/openapi-schemas.ts +8 -1
- package/src/transcript-config.ts +12 -1
- package/src/transcript-config.unit.test.ts +18 -0
package/openapi.json
CHANGED
|
@@ -3490,6 +3490,11 @@
|
|
|
3490
3490
|
"type": "boolean",
|
|
3491
3491
|
"description": "Reserved for the repo-access check (COS-44.1).",
|
|
3492
3492
|
"example": false
|
|
3493
|
+
},
|
|
3494
|
+
"loopTranscriptUpload": {
|
|
3495
|
+
"type": "boolean",
|
|
3496
|
+
"description": "True when SHIPWRIGHT_TRANSCRIPT_API_ENABLED is on and this agent is listed in SHIPWRIGHT_LOOP_TRANSCRIPT_AGENT_IDS: coding-loop runs may upload a redacted transcript through the extension capability.",
|
|
3497
|
+
"example": false
|
|
3493
3498
|
}
|
|
3494
3499
|
},
|
|
3495
3500
|
"required": [
|
package/openapi.platform.json
CHANGED
|
@@ -3731,6 +3731,11 @@
|
|
|
3731
3731
|
"type": "boolean",
|
|
3732
3732
|
"description": "Reserved for the repo-access check (COS-44.1).",
|
|
3733
3733
|
"example": false
|
|
3734
|
+
},
|
|
3735
|
+
"loopTranscriptUpload": {
|
|
3736
|
+
"type": "boolean",
|
|
3737
|
+
"description": "True when SHIPWRIGHT_TRANSCRIPT_API_ENABLED is on and this agent is listed in SHIPWRIGHT_LOOP_TRANSCRIPT_AGENT_IDS: coding-loop runs may upload a redacted transcript through the extension capability.",
|
|
3738
|
+
"example": false
|
|
3734
3739
|
}
|
|
3735
3740
|
},
|
|
3736
3741
|
"required": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@app-vitals/agent-admin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/app-vitals/agent.git",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@anthropic-ai/sdk": "0.135.0",
|
|
45
|
-
"@app-vitals/agent-lib": "1.
|
|
45
|
+
"@app-vitals/agent-lib": "1.37.0",
|
|
46
46
|
"@hono/zod-openapi": "^1.0.0",
|
|
47
47
|
"@prisma/adapter-pg": "^7.10.0",
|
|
48
48
|
"@prisma/client": "^7.10.0",
|
package/src/admin-boot.ts
CHANGED
|
@@ -456,6 +456,7 @@ export async function startAdmin(
|
|
|
456
456
|
agentTokenService,
|
|
457
457
|
anthropicFederationEnabled,
|
|
458
458
|
transcriptUploadEnabled: transcriptConfig.enabled,
|
|
459
|
+
loopTranscriptAgentIds: transcriptConfig.loopAgentIds,
|
|
459
460
|
repoAccessCheckEnabled: repoAccessConfig.enabled,
|
|
460
461
|
});
|
|
461
462
|
|
package/src/api.smoke.test.ts
CHANGED
|
@@ -244,6 +244,7 @@ function buildApp(opts?: {
|
|
|
244
244
|
cleanupMergedWorktrees?: boolean;
|
|
245
245
|
cleanupAfterDays?: number;
|
|
246
246
|
transcriptUploadEnabled?: boolean;
|
|
247
|
+
loopTranscriptAgentIds?: string[];
|
|
247
248
|
repoAccessCheckEnabled?: boolean;
|
|
248
249
|
}) {
|
|
249
250
|
const hasAgent = opts?.hasAgent ?? true;
|
|
@@ -319,6 +320,7 @@ function buildApp(opts?: {
|
|
|
319
320
|
sessionSecret: SESSION_SECRET,
|
|
320
321
|
anthropicFederationEnabled: opts?.anthropicFederationEnabled,
|
|
321
322
|
transcriptUploadEnabled: opts?.transcriptUploadEnabled,
|
|
323
|
+
loopTranscriptAgentIds: opts?.loopTranscriptAgentIds,
|
|
322
324
|
repoAccessCheckEnabled: opts?.repoAccessCheckEnabled,
|
|
323
325
|
});
|
|
324
326
|
}
|
|
@@ -364,6 +366,7 @@ describe("GET /:id/config features (COS-43.1)", () => {
|
|
|
364
366
|
expect(body.features).toEqual({
|
|
365
367
|
transcriptUpload: false,
|
|
366
368
|
repoAccessCheck: false,
|
|
369
|
+
loopTranscriptUpload: false,
|
|
367
370
|
});
|
|
368
371
|
});
|
|
369
372
|
|
|
@@ -374,10 +377,53 @@ describe("GET /:id/config features (COS-43.1)", () => {
|
|
|
374
377
|
expect(body.features).toEqual({
|
|
375
378
|
transcriptUpload: true,
|
|
376
379
|
repoAccessCheck: false,
|
|
380
|
+
loopTranscriptUpload: false,
|
|
377
381
|
});
|
|
378
382
|
});
|
|
379
383
|
});
|
|
380
384
|
|
|
385
|
+
describe("GET /:id/config features.loopTranscriptUpload", () => {
|
|
386
|
+
const loopFlag = async (opts: Parameters<typeof buildApp>[0]) => {
|
|
387
|
+
const res = await buildApp(opts).request(`/${KNOWN_AGENT_ID}/config`, {
|
|
388
|
+
headers: { Authorization: `Bearer ${VALID_ADMIN_KEY}` },
|
|
389
|
+
});
|
|
390
|
+
return (await res.json()).features.loopTranscriptUpload;
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
test("truth table: only a listed agent with the transcript flag on is true", async () => {
|
|
394
|
+
expect(await loopFlag({})).toBe(false);
|
|
395
|
+
expect(await loopFlag({ loopTranscriptAgentIds: [] })).toBe(false);
|
|
396
|
+
expect(
|
|
397
|
+
await loopFlag({
|
|
398
|
+
transcriptUploadEnabled: true,
|
|
399
|
+
loopTranscriptAgentIds: ["other-agent"],
|
|
400
|
+
}),
|
|
401
|
+
).toBe(false);
|
|
402
|
+
expect(
|
|
403
|
+
await loopFlag({
|
|
404
|
+
transcriptUploadEnabled: false,
|
|
405
|
+
loopTranscriptAgentIds: [KNOWN_AGENT_ID],
|
|
406
|
+
}),
|
|
407
|
+
).toBe(false);
|
|
408
|
+
expect(
|
|
409
|
+
await loopFlag({
|
|
410
|
+
transcriptUploadEnabled: true,
|
|
411
|
+
loopTranscriptAgentIds: [KNOWN_AGENT_ID],
|
|
412
|
+
}),
|
|
413
|
+
).toBe(true);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
test("leaves features.transcriptUpload untouched", async () => {
|
|
417
|
+
const res = await buildApp({
|
|
418
|
+
transcriptUploadEnabled: false,
|
|
419
|
+
loopTranscriptAgentIds: [KNOWN_AGENT_ID],
|
|
420
|
+
}).request(`/${KNOWN_AGENT_ID}/config`, {
|
|
421
|
+
headers: { Authorization: `Bearer ${VALID_ADMIN_KEY}` },
|
|
422
|
+
});
|
|
423
|
+
expect((await res.json()).features.transcriptUpload).toBe(false);
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
|
|
381
427
|
describe("GET /:id/config features.repoAccessCheck (COS-44.1)", () => {
|
|
382
428
|
test("follows the repo-access flag", async () => {
|
|
383
429
|
const app = buildApp({ repoAccessCheckEnabled: true });
|
|
@@ -387,6 +433,7 @@ describe("GET /:id/config features.repoAccessCheck (COS-44.1)", () => {
|
|
|
387
433
|
expect((await res.json()).features).toEqual({
|
|
388
434
|
transcriptUpload: false,
|
|
389
435
|
repoAccessCheck: true,
|
|
436
|
+
loopTranscriptUpload: false,
|
|
390
437
|
});
|
|
391
438
|
});
|
|
392
439
|
});
|
package/src/api.ts
CHANGED
|
@@ -108,7 +108,11 @@ export interface AgentConfigResponse {
|
|
|
108
108
|
* COS-43.1: feature flags the runtime acts on. Optional so fixtures built
|
|
109
109
|
* before it keep compiling; the live handler always populates it.
|
|
110
110
|
*/
|
|
111
|
-
features?: {
|
|
111
|
+
features?: {
|
|
112
|
+
transcriptUpload: boolean;
|
|
113
|
+
repoAccessCheck: boolean;
|
|
114
|
+
loopTranscriptUpload?: boolean;
|
|
115
|
+
};
|
|
112
116
|
}
|
|
113
117
|
|
|
114
118
|
interface AgentEnvServiceLike {
|
|
@@ -201,6 +205,12 @@ export interface AgentRuntimeDeps {
|
|
|
201
205
|
* as `features.transcriptUpload` in the config bundle. Defaults to false.
|
|
202
206
|
*/
|
|
203
207
|
transcriptUploadEnabled?: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* SHIPWRIGHT_LOOP_TRANSCRIPT_AGENT_IDS: agent ids whose coding-loop runs
|
|
210
|
+
* upload transcripts. Combined with `transcriptUploadEnabled` into
|
|
211
|
+
* `features.loopTranscriptUpload`. Defaults to none.
|
|
212
|
+
*/
|
|
213
|
+
loopTranscriptAgentIds?: readonly string[];
|
|
204
214
|
/**
|
|
205
215
|
* COS-44.1: SHIPWRIGHT_AGENT_REPO_ACCESS_CHECK_ENABLED is on — surfaced to the
|
|
206
216
|
* runtime as `features.repoAccessCheck` in the config bundle. Defaults to false.
|
|
@@ -393,6 +403,9 @@ export function createAgentRuntimeApp(deps: AgentRuntimeDeps): OpenAPIHono {
|
|
|
393
403
|
cleanupAfterDays: agent.cleanupAfterDays,
|
|
394
404
|
features: {
|
|
395
405
|
transcriptUpload: deps.transcriptUploadEnabled === true,
|
|
406
|
+
loopTranscriptUpload:
|
|
407
|
+
deps.transcriptUploadEnabled === true &&
|
|
408
|
+
(deps.loopTranscriptAgentIds ?? []).includes(agent.id),
|
|
396
409
|
repoAccessCheck: deps.repoAccessCheckEnabled === true,
|
|
397
410
|
},
|
|
398
411
|
};
|
package/src/openapi-schemas.ts
CHANGED
|
@@ -1104,7 +1104,9 @@ export const PutBakedMarketplacesBodySchema = z
|
|
|
1104
1104
|
|
|
1105
1105
|
export const BakedMarketplacesResultSchema = z
|
|
1106
1106
|
.object({
|
|
1107
|
-
bakedMarketplaces: z
|
|
1107
|
+
bakedMarketplaces: z
|
|
1108
|
+
.array(z.string())
|
|
1109
|
+
.openapi({ example: ["example-marketplace"] }),
|
|
1108
1110
|
})
|
|
1109
1111
|
.openapi("BakedMarketplacesResult");
|
|
1110
1112
|
|
|
@@ -1475,6 +1477,11 @@ export const AgentConfigResponseSchema = z
|
|
|
1475
1477
|
description: "Reserved for the repo-access check (COS-44.1).",
|
|
1476
1478
|
example: false,
|
|
1477
1479
|
}),
|
|
1480
|
+
loopTranscriptUpload: z.boolean().optional().openapi({
|
|
1481
|
+
description:
|
|
1482
|
+
"True when SHIPWRIGHT_TRANSCRIPT_API_ENABLED is on and this agent is listed in SHIPWRIGHT_LOOP_TRANSCRIPT_AGENT_IDS: coding-loop runs may upload a redacted transcript through the extension capability.",
|
|
1483
|
+
example: false,
|
|
1484
|
+
}),
|
|
1478
1485
|
})
|
|
1479
1486
|
.optional()
|
|
1480
1487
|
.openapi("AgentConfigFeatures"),
|
package/src/transcript-config.ts
CHANGED
|
@@ -12,8 +12,19 @@ type TranscriptEnv = Readonly<Record<string, string | undefined>>;
|
|
|
12
12
|
export interface TranscriptConfig {
|
|
13
13
|
/** True only when SHIPWRIGHT_TRANSCRIPT_API_ENABLED === "enabled". */
|
|
14
14
|
enabled: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Agent ids allowed to upload coding-loop run transcripts
|
|
17
|
+
* (SHIPWRIGHT_LOOP_TRANSCRIPT_AGENT_IDS, comma-separated). Empty by default.
|
|
18
|
+
*/
|
|
19
|
+
loopAgentIds: readonly string[];
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
export function parseTranscriptConfig(env: TranscriptEnv): TranscriptConfig {
|
|
18
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
enabled: env.SHIPWRIGHT_TRANSCRIPT_API_ENABLED === "enabled",
|
|
25
|
+
loopAgentIds: (env.SHIPWRIGHT_LOOP_TRANSCRIPT_AGENT_IDS ?? "")
|
|
26
|
+
.split(",")
|
|
27
|
+
.map((id) => id.trim())
|
|
28
|
+
.filter(Boolean),
|
|
29
|
+
};
|
|
19
30
|
}
|
|
@@ -30,3 +30,21 @@ describe("parseTranscriptConfig", () => {
|
|
|
30
30
|
expect(parseTranscriptConfig({}).enabled).toBe(false);
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
|
+
|
|
34
|
+
describe("loop transcript allowlist", () => {
|
|
35
|
+
it("defaults to empty when unset or blank", () => {
|
|
36
|
+
expect(parseTranscriptConfig({}).loopAgentIds).toEqual([]);
|
|
37
|
+
expect(
|
|
38
|
+
parseTranscriptConfig({ SHIPWRIGHT_LOOP_TRANSCRIPT_AGENT_IDS: " , " })
|
|
39
|
+
.loopAgentIds,
|
|
40
|
+
).toEqual([]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("parses a trimmed comma-separated list", () => {
|
|
44
|
+
expect(
|
|
45
|
+
parseTranscriptConfig({
|
|
46
|
+
SHIPWRIGHT_LOOP_TRANSCRIPT_AGENT_IDS: "a, b ,,c",
|
|
47
|
+
}).loopAgentIds,
|
|
48
|
+
).toEqual(["a", "b", "c"]);
|
|
49
|
+
});
|
|
50
|
+
});
|