@app-vitals/agent-admin 1.120.1 → 1.122.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.
Files changed (79) hide show
  1. package/openapi.platform.json +20 -0
  2. package/package.json +2 -2
  3. package/src/account-repo-lookup-api.integration.test.ts +1 -1
  4. package/src/admin-boot-config.ts +2 -2
  5. package/src/admin-boot-config.unit.test.ts +1 -1
  6. package/src/admin-boot.ts +1 -1
  7. package/src/admin-ui-account.ts +2 -2
  8. package/src/admin-ui-agent-template.smoke.test.ts +1 -1
  9. package/src/admin-ui-github-identity-pages.ts +2 -2
  10. package/src/admin-ui-push-test.smoke.test.ts +7 -5
  11. package/src/admin-ui-styles.unit.test.ts +3 -1
  12. package/src/admin-ui-templates-pages.ts +5 -5
  13. package/src/agent-cron-run-stats.integration.test.ts +11 -2
  14. package/src/agent-deletion-checklist.unit.test.ts +1 -1
  15. package/src/agent-manifest.unit.test.ts +3 -3
  16. package/src/agent-marketplaces-api.integration.test.ts +9 -7
  17. package/src/agent-members.integration.test.ts +1 -1
  18. package/src/agent-pod-labels.unit.test.ts +2 -2
  19. package/src/agent-provisioner.unit.test.ts +4 -4
  20. package/src/agent-setup.unit.test.ts +14 -3
  21. package/src/agent-template-items.ts +1 -1
  22. package/src/agent-templates.ts +1 -1
  23. package/src/agent-tools-token.integration.test.ts +3 -3
  24. package/src/api-auth.ts +10 -4
  25. package/src/brand-tokens.json +23 -4
  26. package/src/brand-tokens.unit.test.ts +11 -4
  27. package/src/chat-credential-config.unit.test.ts +6 -2
  28. package/src/chat-markers.unit.test.ts +5 -2
  29. package/src/cron-run-now.smoke.test.ts +1 -1
  30. package/src/cron-run-now.ts +1 -1
  31. package/src/errors.unit.test.ts +7 -4
  32. package/src/fixtures/github-agent-installation-cassette.json +35 -5
  33. package/src/github-access-backfill.ts +1 -1
  34. package/src/github-access-backfill.unit.test.ts +1 -1
  35. package/src/github-agent-installation-crawler.integration.test.ts +29 -12
  36. package/src/github-agent-installation-crawler.ts +2 -2
  37. package/src/github-agent-installation-crawler.unit.test.ts +28 -7
  38. package/src/github-app-api.ts +1 -1
  39. package/src/github-app-jwt.unit.test.ts +2 -1
  40. package/src/github-cache-roundtrip.integration.test.ts +4 -4
  41. package/src/github-enterprise-api.integration.test.ts +4 -4
  42. package/src/github-enterprise-api.ts +6 -6
  43. package/src/github-enterprise-client-page.unit.test.ts +18 -6
  44. package/src/github-enterprise-client.integration.test.ts +97 -32
  45. package/src/github-enterprise-client.ts +81 -22
  46. package/src/github-enterprise-client.unit.test.ts +1 -1
  47. package/src/github-enterprise-warnings.unit.test.ts +19 -6
  48. package/src/github-installation-selection.integration.test.ts +4 -1
  49. package/src/github-installation-wiring.unit.test.ts +1 -1
  50. package/src/github-repo-refresh-discovery.unit.test.ts +1 -1
  51. package/src/github-repo-refresher.unit.test.ts +11 -5
  52. package/src/github-sync-cache.integration.test.ts +1 -1
  53. package/src/github-sync-cached-access.ts +1 -1
  54. package/src/github-sync-reverify.unit.test.ts +1 -1
  55. package/src/github-sync-snapshot-refresh.integration.test.ts +1 -1
  56. package/src/github-sync.unit.test.ts +6 -6
  57. package/src/installation-ports-fixture.integration.test.ts +2 -2
  58. package/src/installation-repos-service.ts +5 -5
  59. package/src/kubernetes-client.integration.test.ts +1 -2
  60. package/src/openapi-schemas.ts +9 -0
  61. package/src/platform-routes.ts +1 -1
  62. package/src/principal-lookup.ts +26 -4
  63. package/src/principal-lookup.unit.test.ts +61 -4
  64. package/src/principals-api.integration.test.ts +9 -1
  65. package/src/principals-api.smoke.test.ts +96 -0
  66. package/src/push-content.unit.test.ts +2 -2
  67. package/src/push-sender.unit.test.ts +1 -1
  68. package/src/push-service.integration.test.ts +1 -1
  69. package/src/pwa-icons.unit.test.ts +1 -1
  70. package/src/slack-config-token-resolve.unit.test.ts +25 -7
  71. package/src/slack-provisioning-client.integration.test.ts +10 -8
  72. package/src/slack-provisioning-client.ts +2 -6
  73. package/src/tools-token-policy.integration.test.ts +48 -6
  74. package/src/tools-token-policy.smoke.test.ts +11 -5
  75. package/src/tools-token-policy.ts +85 -8
  76. package/src/tools-token-policy.unit.test.ts +111 -4
  77. package/src/trial-expiry-sweeper.unit.test.ts +1 -1
  78. package/src/user-prefs.integration.test.ts +1 -1
  79. package/src/user-repo-access-resolver.unit.test.ts +1 -1
@@ -4579,6 +4579,26 @@
4579
4579
  ],
4580
4580
  "description": "null for agents",
4581
4581
  "example": "o@acme.com"
4582
+ },
4583
+ "accountId": {
4584
+ "type": [
4585
+ "string",
4586
+ "null"
4587
+ ],
4588
+ "description": "Account the user belongs to; null for users without membership (e.g. platform admins), omitted for agents",
4589
+ "example": "clx1acc"
4590
+ },
4591
+ "role": {
4592
+ "type": [
4593
+ "string",
4594
+ "null"
4595
+ ],
4596
+ "enum": [
4597
+ "owner",
4598
+ "member",
4599
+ null
4600
+ ],
4601
+ "description": "Membership role; null for users without membership (e.g. platform admins), omitted for agents"
4582
4602
  }
4583
4603
  },
4584
4604
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-admin",
3
- "version": "1.120.1",
3
+ "version": "1.122.0",
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.120.1",
47
+ "@app-vitals/agent-lib": "1.122.0",
48
48
  "@hono/zod-openapi": "^1.0.0",
49
49
  "@prisma/adapter-pg": "^7.10.0",
50
50
  "@prisma/client": "^7.10.0",
@@ -7,8 +7,8 @@
7
7
 
8
8
  import { afterEach, beforeEach, describe, expect, it } from "bun:test";
9
9
  import type { PrismaClient } from "../prisma/client/client.ts";
10
- import { createAccountRepoLookupApp } from "./account-repo-lookup-api.ts";
11
10
  import { AccountRepoLookupService } from "./account-repo-lookup.ts";
11
+ import { createAccountRepoLookupApp } from "./account-repo-lookup-api.ts";
12
12
  import { createAdminPrismaClient } from "./prisma-client.ts";
13
13
 
14
14
  const TEST_DB = process.env.DATABASE_URL_ADMIN_TEST;
@@ -12,9 +12,9 @@
12
12
  import { join } from "node:path";
13
13
  import type { PrismaClient } from "../prisma/client/client.ts";
14
14
  import { AgentAnthropicIdentityService } from "./agent-anthropic-identity.ts";
15
- import { parseAgentPodLabels } from "./agent-pod-labels.ts";
16
15
  import { parseAgentImageMap } from "./agent-image-map.ts";
17
16
  import type { AgentAnthropicFederation } from "./agent-manifest.ts";
17
+ import { parseAgentPodLabels } from "./agent-pod-labels.ts";
18
18
  import type {
19
19
  AgentProvisioner,
20
20
  PerAgentIdentityConfig,
@@ -32,8 +32,8 @@ import {
32
32
  HttpChatServiceProvisioningClient,
33
33
  NoopChatServiceProvisioningClient,
34
34
  } from "./chat-service-provisioning-client.ts";
35
- import { parsePodServiceAccountConfig } from "./pod-service-account-config.ts";
36
35
  import { HttpKubernetesClient } from "./kubernetes-client.ts";
36
+ import { parsePodServiceAccountConfig } from "./pod-service-account-config.ts";
37
37
  import type { ServiceIntegration } from "./service-integration.ts";
38
38
 
39
39
  // ─── Migration preflight ──────────────────────────────────────────────────────
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from "bun:test";
2
+ import { buildDeletionClients, buildProvisioner } from "./admin-boot-config.ts";
2
3
  import type { AgentTokenService } from "./agent-tokens.ts";
3
- import { buildProvisioner, buildDeletionClients } from "./admin-boot-config.ts";
4
4
  import {
5
5
  HttpChatServiceProvisioningClient,
6
6
  NoopChatServiceProvisioningClient,
package/src/admin-boot.ts CHANGED
@@ -87,8 +87,8 @@ import { AgentPluginService } from "./agent-plugins.ts";
87
87
  import { AgentTemplateReconcileService } from "./agent-template-reconcile.ts";
88
88
  import { AgentTemplateService } from "./agent-templates.ts";
89
89
  import { AgentTokenService } from "./agent-tokens.ts";
90
- import { AgentToolsTokenService } from "./agent-tools-token.ts";
91
90
  import { AgentToolService } from "./agent-tools.ts";
91
+ import { AgentToolsTokenService } from "./agent-tools-token.ts";
92
92
  import { AgentService } from "./agents.ts";
93
93
  import { parseAdminApiKeys } from "./agents-api.ts";
94
94
  import { createAdminAuthMiddleware } from "./api-auth.ts";
@@ -9,16 +9,16 @@
9
9
  */
10
10
 
11
11
  import type { Context, Hono, MiddlewareHandler } from "hono";
12
+ import { normalizeEmail } from "./account-email.ts";
12
13
  import type { AccountInviteService } from "./account-invites.ts";
13
14
  import {
14
15
  AccountMemberNotFoundError,
15
16
  type AccountMemberService,
16
17
  LastOwnerError,
17
18
  } from "./account-members.ts";
18
- import { normalizeEmail } from "./account-email.ts";
19
19
  import type { Account, AccountService } from "./accounts.ts";
20
- import { ACCOUNT_PATH, renderAccountPage } from "./admin-ui-account-pages.ts";
21
20
  import type { AdminUIEnv } from "./admin-ui.ts";
21
+ import { ACCOUNT_PATH, renderAccountPage } from "./admin-ui-account-pages.ts";
22
22
  import type { SettingsNav } from "./admin-ui-settings-layout.ts";
23
23
 
24
24
  export interface AccountRouteDeps {
@@ -14,8 +14,8 @@ import {
14
14
  makeSessionCookie,
15
15
  } from "./admin-ui.fixtures.ts";
16
16
  import { createAdminUIApp } from "./admin-ui.ts";
17
- import { resolveDefaultSpecialtyName } from "./specialty-types.ts";
18
17
  import type { TemplateView } from "./agent-templates.ts";
18
+ import { resolveDefaultSpecialtyName } from "./specialty-types.ts";
19
19
 
20
20
  const TYPE = resolveDefaultSpecialtyName();
21
21
  const d = new Date("2024-01-01");
@@ -6,12 +6,12 @@
6
6
  * escaped.
7
7
  */
8
8
 
9
+ import type { GheOrgs } from "./admin-ui-github-enterprise-pages.ts";
10
+ import { escapeHtml } from "./admin-ui-styles.ts";
9
11
  import {
10
12
  type GithubAppsState,
11
13
  LOOKUP_ONLY_REASON,
12
14
  } from "./github-apps-state.ts";
13
- import type { GheOrgs } from "./admin-ui-github-enterprise-pages.ts";
14
- import { escapeHtml } from "./admin-ui-styles.ts";
15
15
 
16
16
  /** The GitHub username `<tr>` for the "Owner & identities" card. */
17
17
  export function renderGithubUsernameRow(
@@ -9,22 +9,24 @@
9
9
  */
10
10
 
11
11
  import { describe, expect, it } from "bun:test";
12
- import { Hono } from "hono";
13
12
  import type { MiddlewareHandler } from "hono";
13
+ import { Hono } from "hono";
14
+ import type { AdminUIEnv } from "./admin-ui.ts";
14
15
  import {
15
16
  PUSH_TEST_PATH,
16
17
  PUSH_TEST_PAYLOAD,
17
18
  type PushTestRouteDeps,
18
19
  registerPushTestRoute,
19
20
  } from "./admin-ui-push-test.ts";
20
- import type { AdminUIEnv } from "./admin-ui.ts";
21
21
  import type { PushDetailLevel } from "./push-content.ts";
22
22
 
23
23
  const DEFAULT_EMAIL = "dave@example.com";
24
24
 
25
- function makeFakeRequireAuth(
26
- { isAdmin = true }: { isAdmin?: boolean } = {},
27
- ): MiddlewareHandler<AdminUIEnv> {
25
+ function makeFakeRequireAuth({
26
+ isAdmin = true,
27
+ }: {
28
+ isAdmin?: boolean;
29
+ } = {}): MiddlewareHandler<AdminUIEnv> {
28
30
  return async (c, next) => {
29
31
  c.set("userEmail", c.req.header("x-test-user-email") ?? DEFAULT_EMAIL);
30
32
  c.set("isAdmin", isAdmin);
@@ -126,7 +126,9 @@ describe("baseStyles — SGL-1.1 settings layout", () => {
126
126
  expect(css).toMatch(
127
127
  /\.vos-page-wide\s*{\s*max-width:\s*none;\s*width:\s*100%;/,
128
128
  );
129
- expect(block).toMatch(/\.settings-content \.form-input[^}]*max-width: 640px/);
129
+ expect(block).toMatch(
130
+ /\.settings-content \.form-input[^}]*max-width: 640px/,
131
+ );
130
132
  expect(block).toContain('.settings-content input[type="search"]');
131
133
  });
132
134
 
@@ -9,16 +9,16 @@
9
9
  */
10
10
 
11
11
  import { renderAdminPage } from "./admin-ui-layout.ts";
12
- import { escapeHtml } from "./admin-ui-styles.ts";
13
- import {
14
- AGENT_TEMPLATE_ITEM_KINDS,
15
- type AgentTemplateItemKind,
16
- } from "./agent-template-items.ts";
17
12
  import {
18
13
  buildSettingsNav,
19
14
  renderSettingsLayout,
20
15
  type SettingsNav,
21
16
  } from "./admin-ui-settings-layout.ts";
17
+ import { escapeHtml } from "./admin-ui-styles.ts";
18
+ import {
19
+ AGENT_TEMPLATE_ITEM_KINDS,
20
+ type AgentTemplateItemKind,
21
+ } from "./agent-template-items.ts";
22
22
 
23
23
  export const ADMIN_TEMPLATES_PATH = "/admin/settings/templates";
24
24
 
@@ -1506,7 +1506,12 @@ describeOrSkip("AgentCronRunStatsService (integration)", () => {
1506
1506
  const phaseA = await createPhaseCron(cronJobService, agentA, "dev-task");
1507
1507
  const phaseB = await createPhaseCron(cronJobService, agentB, "dev-task");
1508
1508
 
1509
- const mk = (cronId: string, agentId: string, phaseId: string, skipped: boolean) =>
1509
+ const mk = (
1510
+ cronId: string,
1511
+ agentId: string,
1512
+ phaseId: string,
1513
+ skipped: boolean,
1514
+ ) =>
1510
1515
  prisma.agentCronRun.create({
1511
1516
  data: {
1512
1517
  cronId,
@@ -1527,7 +1532,11 @@ describeOrSkip("AgentCronRunStatsService (integration)", () => {
1527
1532
  await mk(cronB, agentB, phaseB, true);
1528
1533
  await mk(cronB, agentB, phaseB, true);
1529
1534
 
1530
- const { series } = await statsService.outcomes(undefined, undefined, agentA);
1535
+ const { series } = await statsService.outcomes(
1536
+ undefined,
1537
+ undefined,
1538
+ agentA,
1539
+ );
1531
1540
  expect(series).toHaveLength(1);
1532
1541
  expect(series[0]).toMatchObject({
1533
1542
  runs: 2,
@@ -6,8 +6,8 @@
6
6
 
7
7
  import { describe, expect, it } from "bun:test";
8
8
  import {
9
- type ManualStep,
10
9
  buildManualStepsChecklist,
10
+ type ManualStep,
11
11
  } from "./agent-deletion-checklist.ts";
12
12
 
13
13
  describe("buildManualStepsChecklist — named keys", () => {
@@ -15,9 +15,9 @@ import {
15
15
  buildAgentDeploymentManifest,
16
16
  buildAgentPvcManifest,
17
17
  buildAgentSecretManifest,
18
+ PodServiceAccountConflictError,
18
19
  resolveAgentContainerResources,
19
20
  sanitizeAgentName,
20
- PodServiceAccountConflictError,
21
21
  TENANT_LABEL,
22
22
  } from "./agent-manifest.ts";
23
23
 
@@ -78,8 +78,8 @@ describe("buildAgentDeploymentManifest", () => {
78
78
  it("adds configured pod labels without changing immutable selectors or identity labels", () => {
79
79
  const base = buildAgentDeploymentManifest(deployOpts);
80
80
  const podLabels = {
81
- "vgs.io/service": "shipwright",
82
- "vgs.io/team": "team-infrastructure",
81
+ "example.com/service": "shipwright",
82
+ "example.com/team": "team-infrastructure",
83
83
  };
84
84
  const labeled = buildAgentDeploymentManifest({
85
85
  ...deployOpts,
@@ -28,6 +28,8 @@ const SESSION_SECRET = "test-admin-session-secret-32-bytes!";
28
28
  const ADMIN_KEY = "admin-key-token";
29
29
 
30
30
  describeOrSkip("AgentMarketplaceService + routes (integration)", () => {
31
+ // Marketplace writes are on the runtime-token denylist, so writes through
32
+ // the admin app use the admin key; per-agent tokens cover scoping and reads.
31
33
  let prisma: PrismaClient;
32
34
  let service: AgentMarketplaceService;
33
35
  let tokens: AgentTokenService;
@@ -152,7 +154,7 @@ describeOrSkip("AgentMarketplaceService + routes (integration)", () => {
152
154
  it("POST upserts (201), GET lists, DELETE removes (204)", async () => {
153
155
  const created = await adminApp.request(
154
156
  `/agents/${agentA}/marketplaces`,
155
- json(tokenA, {
157
+ json(ADMIN_KEY, {
156
158
  name: "shipwright",
157
159
  source: "app-vitals/shipwright",
158
160
  ref: "main",
@@ -176,7 +178,7 @@ describeOrSkip("AgentMarketplaceService + routes (integration)", () => {
176
178
 
177
179
  const del = await adminApp.request(
178
180
  `/agents/${agentA}/marketplaces/${marketplace.id}`,
179
- json(tokenA, undefined, "DELETE"),
181
+ json(ADMIN_KEY, undefined, "DELETE"),
180
182
  );
181
183
  expect(del.status).toBe(204);
182
184
  expect(await service.list(agentA)).toEqual([]);
@@ -199,7 +201,7 @@ describeOrSkip("AgentMarketplaceService + routes (integration)", () => {
199
201
  ]) {
200
202
  const res = await adminApp.request(
201
203
  `/agents/${agentA}/marketplaces`,
202
- json(tokenA, { name: "m", source }),
204
+ json(ADMIN_KEY, { name: "m", source }),
203
205
  );
204
206
  expect(res.status).toBe(422);
205
207
  }
@@ -210,7 +212,7 @@ describeOrSkip("AgentMarketplaceService + routes (integration)", () => {
210
212
  const row = await service.upsert(agentB, { name: "m", source: "o/r" });
211
213
  const res = await adminApp.request(
212
214
  `/agents/${agentA}/marketplaces/${row.id}`,
213
- json(tokenA, undefined, "DELETE"),
215
+ json(ADMIN_KEY, undefined, "DELETE"),
214
216
  );
215
217
  expect(res.status).toBe(404);
216
218
  expect(await service.list(agentB)).toHaveLength(1);
@@ -254,7 +256,7 @@ describeOrSkip("AgentMarketplaceService + routes (integration)", () => {
254
256
  const tpl = await seedTemplate(agentA);
255
257
  const res = await adminApp.request(
256
258
  `/agents/${agentA}/marketplaces`,
257
- json(tokenA, { name: "tpl", source: "o/other" }),
259
+ json(ADMIN_KEY, { name: "tpl", source: "o/other" }),
258
260
  );
259
261
  expect(res.status).toBe(201);
260
262
  const body = (await res.json()).marketplace;
@@ -276,7 +278,7 @@ describeOrSkip("AgentMarketplaceService + routes (integration)", () => {
276
278
  for (const id of [tpl.id, custom.id]) {
277
279
  const res = await adminApp.request(
278
280
  `/agents/${agentA}/marketplaces/${id}`,
279
- json(tokenA, undefined, "DELETE"),
281
+ json(ADMIN_KEY, undefined, "DELETE"),
280
282
  );
281
283
  expect(res.status).toBe(204);
282
284
  }
@@ -332,7 +334,7 @@ describeOrSkip("AgentMarketplaceService + routes (integration)", () => {
332
334
  await service.upsert(agentA, { name: "kept", source: "o/k" });
333
335
  await adminApp.request(
334
336
  `/agents/${agentA}/marketplaces/${tpl.id}`,
335
- json(tokenA, undefined, "DELETE"),
337
+ json(ADMIN_KEY, undefined, "DELETE"),
336
338
  );
337
339
  const list = await adminApp.request(
338
340
  `/agents/${agentA}/marketplaces`,
@@ -9,8 +9,8 @@
9
9
  import { afterEach, beforeEach, describe, expect, it } from "bun:test";
10
10
  import type { PrismaClient } from "../prisma/client/client.ts";
11
11
  import { AgentMemberService, NoAccountMemberError } from "./agent-members.ts";
12
- import { resetMemberIdFixture } from "./test-support/member-id-test-support.ts";
13
12
  import { createAdminPrismaClient } from "./prisma-client.ts";
13
+ import { resetMemberIdFixture } from "./test-support/member-id-test-support.ts";
14
14
 
15
15
  const TEST_DB = process.env.DATABASE_URL_ADMIN_TEST;
16
16
  const describeOrSkip = TEST_DB ? describe : describe.skip;
@@ -13,10 +13,10 @@ describe("agent pod label configuration", () => {
13
13
  it("accepts qualified keys, plain keys and Kubernetes label values", () => {
14
14
  expect(
15
15
  parseAgentPodLabels(
16
- '{"vgs.io/team":"team-infrastructure","app":"shipwright","empty":""}',
16
+ '{"example.com/team":"team-infrastructure","app":"shipwright","empty":""}',
17
17
  ),
18
18
  ).toEqual({
19
- "vgs.io/team": "team-infrastructure",
19
+ "example.com/team": "team-infrastructure",
20
20
  app: "shipwright",
21
21
  empty: "",
22
22
  });
@@ -2208,8 +2208,8 @@ describe("KubernetesAgentProvisioner.reconcile() — pod ServiceAccount drift (C
2208
2208
  describe("KubernetesAgentProvisioner configured pod labels", () => {
2209
2209
  const agentId = "agent-label-example";
2210
2210
  const podLabels = {
2211
- "vgs.io/service": "shipwright",
2212
- "vgs.io/team": "team-infrastructure",
2211
+ "example.com/service": "shipwright",
2212
+ "example.com/team": "team-infrastructure",
2213
2213
  };
2214
2214
  for (const policyOnly of [false, true]) {
2215
2215
  it(`updates existing templates and preserves selectors/unrelated labels (policyOnly=${policyOnly})`, async () => {
@@ -2229,7 +2229,7 @@ describe("KubernetesAgentProvisioner configured pod labels", () => {
2229
2229
  metadata: {
2230
2230
  labels: {
2231
2231
  "other.io/label": "preserved",
2232
- "vgs.io/team": "NOT_SET",
2232
+ "example.com/team": "NOT_SET",
2233
2233
  },
2234
2234
  },
2235
2235
  },
@@ -2247,7 +2247,7 @@ describe("KubernetesAgentProvisioner configured pod labels", () => {
2247
2247
  expect(preview.updated).toEqual([agentId]);
2248
2248
  expect(
2249
2249
  (await client.getDeployment(NAMESPACE, name)).spec.template.metadata
2250
- .labels["vgs.io/team"],
2250
+ .labels["example.com/team"],
2251
2251
  ).toBe("NOT_SET");
2252
2252
  expect(
2253
2253
  (await next.reconcile([{ id: agentId }], { policyOnly })).updated,
@@ -1,5 +1,8 @@
1
1
  import { describe, expect, it } from "bun:test";
2
- import { deriveAgentSetupSteps, renderAgentSetupPage } from "./admin-ui-pages.ts";
2
+ import {
3
+ deriveAgentSetupSteps,
4
+ renderAgentSetupPage,
5
+ } from "./admin-ui-pages.ts";
3
6
 
4
7
  const state = (env: Record<string, unknown>) =>
5
8
  Object.fromEntries(
@@ -29,7 +32,11 @@ describe("deriveAgentSetupSteps", () => {
29
32
  describe("renderAgentSetupPage", () => {
30
33
  const agent = { id: "a1", name: "Bot <b>" };
31
34
  it("shows connect links and no done state when incomplete", () => {
32
- const html = renderAgentSetupPage("u@x.com", agent, deriveAgentSetupSteps("a1", { GH_TOKEN: "t" }));
35
+ const html = renderAgentSetupPage(
36
+ "u@x.com",
37
+ agent,
38
+ deriveAgentSetupSteps("a1", { GH_TOKEN: "t" }),
39
+ );
33
40
  expect(html).toContain("Slack: not connected");
34
41
  expect(html).toContain("GitHub: connected");
35
42
  expect(html).toContain('href="/admin/agents/a1/access"');
@@ -37,7 +44,11 @@ describe("renderAgentSetupPage", () => {
37
44
  expect(html).toContain("Bot &lt;b&gt;");
38
45
  });
39
46
  it("shows all-done state linking to the agent page", () => {
40
- const html = renderAgentSetupPage("u@x.com", agent, deriveAgentSetupSteps("a1", { SLACK_APP_TOKEN: "x", GH_TOKEN: "t" }));
47
+ const html = renderAgentSetupPage(
48
+ "u@x.com",
49
+ agent,
50
+ deriveAgentSetupSteps("a1", { SLACK_APP_TOKEN: "x", GH_TOKEN: "t" }),
51
+ );
41
52
  expect(html).toContain("All set");
42
53
  expect(html).toContain('href="/admin/agents/a1"');
43
54
  });
@@ -11,12 +11,12 @@
11
11
  */
12
12
 
13
13
  import type { Prisma } from "../prisma/client/client.ts";
14
- import { ANTHROPIC_CREDENTIAL_KEYS } from "./anthropic-credential-guard.ts";
15
14
  import {
16
15
  validateMarketplaceName,
17
16
  validateMarketplaceRef,
18
17
  validateMarketplaceSource,
19
18
  } from "./agent-marketplaces.ts";
19
+ import { ANTHROPIC_CREDENTIAL_KEYS } from "./anthropic-credential-guard.ts";
20
20
  import { UnprocessableEntityError } from "./errors.ts";
21
21
  import type { TokenCrypto } from "./token-crypto.ts";
22
22
 
@@ -21,8 +21,8 @@ import { z } from "zod";
21
21
  import type { PrismaClient } from "../prisma/client/client.ts";
22
22
  import {
23
23
  AGENT_TEMPLATE_ITEM_KINDS,
24
- assertMarketplaceTemplateItem,
25
24
  type AgentTemplateItemKind,
25
+ assertMarketplaceTemplateItem,
26
26
  assertTemplateEnvKeyAllowed,
27
27
  openTemplateItemPayload,
28
28
  sealTemplateItemPayload,
@@ -8,15 +8,15 @@ import { AgentCronJobService } from "./agent-cron-jobs.ts";
8
8
  import { AgentEnvService } from "./agent-envs.ts";
9
9
  import { AgentMemberService } from "./agent-members.ts";
10
10
  import { AgentPluginService } from "./agent-plugins.ts";
11
- import { AgentToolService } from "./agent-tools.ts";
12
- import { AgentService, createAgent } from "./agents.ts";
13
- import { SpecialtyTypes } from "./specialty-types.ts";
14
11
  import { AgentTokenService } from "./agent-tokens.ts";
12
+ import { AgentToolService } from "./agent-tools.ts";
15
13
  import {
16
14
  AgentToolsTokenService,
17
15
  TOOLS_TOKEN_ENV_KEY,
18
16
  } from "./agent-tools-token.ts";
17
+ import { AgentService, createAgent } from "./agents.ts";
19
18
  import { createAdminPrismaClient } from "./prisma-client.ts";
19
+ import { SpecialtyTypes } from "./specialty-types.ts";
20
20
  import { identityCrypto } from "./token-crypto.ts";
21
21
 
22
22
  const TEST_DB = process.env.DATABASE_URL_ADMIN_TEST;
package/src/api-auth.ts CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  } from "./caller-scope.ts";
23
23
  import { ForbiddenError } from "./errors.ts";
24
24
  import {
25
+ runtimeTokenDenied,
25
26
  type ToolsTokenPolicyRule,
26
27
  toolsTokenDecision,
27
28
  } from "./tools-token-policy.ts";
@@ -383,11 +384,16 @@ export function createAdminAuthMiddleware(deps: {
383
384
  return c.json({ error: "Forbidden" }, 403);
384
385
  }
385
386
  // Tools-kind tokens are restricted by one route policy (see
386
- // tools-token-policy.ts); runtime-kind tokens are unaffected.
387
+ // tools-token-policy.ts); runtime-kind tokens get the smaller denylist.
387
388
  if (
388
- result.kind === "tools" &&
389
- toolsTokenDecision(c.req.method, c.req.path, deps.toolsTokenPolicy) ===
390
- "deny"
389
+ (result.kind === "tools" &&
390
+ toolsTokenDecision(
391
+ c.req.method,
392
+ c.req.path,
393
+ deps.toolsTokenPolicy,
394
+ ) === "deny") ||
395
+ (result.kind === "runtime" &&
396
+ runtimeTokenDenied(c.req.method, c.req.path))
391
397
  ) {
392
398
  return c.json({ error: "Forbidden" }, 403);
393
399
  }
@@ -1,10 +1,29 @@
1
1
  {
2
2
  "$comment": "The admin UI's actual current palette (light theme): toolbar base from lib/web/toolbar.ts plus the status/badge families from admin-ui-styles.ts. color + font only. Kept separate from theme-tokens.json, which stays PWA-chrome-only.",
3
3
  "color": {
4
- "bg": { "page": "#f7f7fb", "surface": "#ffffff", "subtle": "#f3f4f6", "muted": "#f9fafb" },
5
- "border": { "default": "#e8e8ee", "strong": "#d1d5db", "subtle": "#f3f4f6" },
6
- "text": { "heading": "#1a1a2e", "body": "#374151", "muted": "#6b7280", "faint": "#9ca3af" },
7
- "brand": { "default": "#4f46e5", "strong": "#4338ca", "bg": "#eef2ff", "border": "#c7d2fe" },
4
+ "bg": {
5
+ "page": "#f7f7fb",
6
+ "surface": "#ffffff",
7
+ "subtle": "#f3f4f6",
8
+ "muted": "#f9fafb"
9
+ },
10
+ "border": {
11
+ "default": "#e8e8ee",
12
+ "strong": "#d1d5db",
13
+ "subtle": "#f3f4f6"
14
+ },
15
+ "text": {
16
+ "heading": "#1a1a2e",
17
+ "body": "#374151",
18
+ "muted": "#6b7280",
19
+ "faint": "#9ca3af"
20
+ },
21
+ "brand": {
22
+ "default": "#4f46e5",
23
+ "strong": "#4338ca",
24
+ "bg": "#eef2ff",
25
+ "border": "#c7d2fe"
26
+ },
8
27
  "primary": { "default": "#1a1a2e", "hover": "#2d2d4e", "text": "#ffffff" },
9
28
  "success": { "bg": "#d1fae5", "text": "#065f46", "border": "#a7f3d0" },
10
29
  "warning": { "bg": "#fef3c7", "text": "#92400e", "border": "#fde68a" },
@@ -42,14 +42,21 @@ describe("brand-tokens.json", () => {
42
42
  });
43
43
 
44
44
  it("covers the status/badge families", () => {
45
- for (const k of ["success", "warning", "danger", "info", "violet", "teal"]) {
45
+ for (const k of [
46
+ "success",
47
+ "warning",
48
+ "danger",
49
+ "info",
50
+ "violet",
51
+ "teal",
52
+ ]) {
46
53
  expect(Object.keys(tokens.color), k).toContain(k);
47
54
  }
48
55
  });
49
56
 
50
57
  it("is exported via the package exports map", () => {
51
- expect(
52
- (pkg.exports as Record<string, string>)["./brand-tokens.json"],
53
- ).toBe("./src/brand-tokens.json");
58
+ expect((pkg.exports as Record<string, string>)["./brand-tokens.json"]).toBe(
59
+ "./src/brand-tokens.json",
60
+ );
54
61
  });
55
62
  });
@@ -4,7 +4,9 @@ import { parseChatCredentialConfig } from "./chat-credential-config.ts";
4
4
  describe("parseChatCredentialConfig", () => {
5
5
  it("is enabled only for the exact value 'enabled'", () => {
6
6
  expect(
7
- parseChatCredentialConfig({ SHIPWRIGHT_CHAT_TOKEN_MINT_ENABLED: "enabled" }),
7
+ parseChatCredentialConfig({
8
+ SHIPWRIGHT_CHAT_TOKEN_MINT_ENABLED: "enabled",
9
+ }),
8
10
  ).toEqual({ enabled: true });
9
11
  });
10
12
 
@@ -17,7 +19,9 @@ describe("parseChatCredentialConfig", () => {
17
19
  "fails closed (disabled) for invalid value %p",
18
20
  (value) => {
19
21
  expect(
20
- parseChatCredentialConfig({ SHIPWRIGHT_CHAT_TOKEN_MINT_ENABLED: value }),
22
+ parseChatCredentialConfig({
23
+ SHIPWRIGHT_CHAT_TOKEN_MINT_ENABLED: value,
24
+ }),
21
25
  ).toEqual({ enabled: false });
22
26
  },
23
27
  );
@@ -20,7 +20,9 @@ describe("parseChatMarkers", () => {
20
20
  });
21
21
 
22
22
  it("extracts plan URL from [plan:https://example.com/plan] marker", () => {
23
- const result = parseChatMarkers("See the plan [plan:https://example.com/plan]");
23
+ const result = parseChatMarkers(
24
+ "See the plan [plan:https://example.com/plan]",
25
+ );
24
26
  expect(result.planUrls).toContain("https://example.com/plan");
25
27
  expect(result.cleaned).not.toContain("[plan:");
26
28
  });
@@ -107,7 +109,8 @@ describe("parseChatMarkers", () => {
107
109
  });
108
110
 
109
111
  it("does not extract non-http plan URLs (defense-in-depth against javascript: injection)", () => {
110
- const text = "See [plan:javascript:alert(1)] and [plan:https://safe.example.com]";
112
+ const text =
113
+ "See [plan:javascript:alert(1)] and [plan:https://safe.example.com]";
111
114
  const result = parseChatMarkers(text);
112
115
  // javascript: URL should not be extracted — left in text as-is
113
116
  expect(result.planUrls).toEqual(["https://safe.example.com"]);
@@ -15,8 +15,8 @@ import {
15
15
  import { PLATFORM_OPS_ROUTES } from "./api-auth.ts";
16
16
  import type {
17
17
  CronRunNowStore,
18
- RunRequestRow,
19
18
  RunNowCron,
19
+ RunRequestRow,
20
20
  } from "./cron-run-now.ts";
21
21
  import { parseCronRunNowConfig } from "./cron-run-now-config.ts";
22
22
 
@@ -18,13 +18,13 @@ import { createRoute, type OpenAPIHono } from "@hono/zod-openapi";
18
18
  import type { PrismaClient } from "../prisma/client/client.ts";
19
19
  import type { AdminAuthEnv, AdminScope } from "./api-auth.ts";
20
20
  import { type Clock, SystemClock } from "./clock.ts";
21
+ import type { CronRunNowConfig } from "./cron-run-now-config.ts";
21
22
  import {
22
23
  BadRequestError,
23
24
  ConflictError,
24
25
  ForbiddenError,
25
26
  NotFoundError,
26
27
  } from "./errors.ts";
27
- import type { CronRunNowConfig } from "./cron-run-now-config.ts";
28
28
  import {
29
29
  CronIdParamSchema,
30
30
  CronRunNowResponseSchema,