@app-vitals/agent-admin 1.108.1 → 1.109.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/Dockerfile CHANGED
@@ -47,6 +47,10 @@ COPY . .
47
47
  # dependency, so run the lockfile-pinned CLI from node_modules (no bunx download).
48
48
  RUN cd admin && ../node_modules/.bin/prisma generate --schema=prisma/schema
49
49
 
50
+ # The account move tool (docs/account-move.md) runs inside this image; loading
51
+ # its --help fails the build if the script or anything it imports is missing.
52
+ RUN bun admin/src/move-accounts.ts --help > /dev/null
53
+
50
54
  EXPOSE 3000
51
55
 
52
56
  USER 1000
@@ -0,0 +1,22 @@
1
+ {
2
+ "accounts": [
3
+ {
4
+ "id": "example-account-a",
5
+ "name": "Example Account A",
6
+ "maxAgents": 1,
7
+ "agents": ["example-agent-one"],
8
+ "members": [
9
+ { "email": "owner@example.com", "role": "owner" },
10
+ { "email": "teammate@example.com", "role": "member" }
11
+ ]
12
+ },
13
+ {
14
+ "id": "example-home",
15
+ "agents": ["example-agent-two", "example-agent-three"]
16
+ }
17
+ ],
18
+ "settings": [
19
+ { "setting": "githubLookupApp", "toAccountId": "example-home" },
20
+ { "setting": "slackConfigToken", "toAccountId": "example-home" }
21
+ ]
22
+ }
@@ -619,6 +619,11 @@
619
619
  "anthropicApiKey": {
620
620
  "type": "string"
621
621
  },
622
+ "accountId": {
623
+ "type": "string",
624
+ "minLength": 1,
625
+ "example": "acct_123"
626
+ },
622
627
  "env": {
623
628
  "type": "object",
624
629
  "additionalProperties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-admin",
3
- "version": "1.108.1",
3
+ "version": "1.109.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.108.1",
47
+ "@app-vitals/agent-lib": "1.109.0",
48
48
  "@hono/zod-openapi": "^1.0.0",
49
49
  "@prisma/adapter-pg": "^7.10.0",
50
50
  "@prisma/client": "^7.10.0",
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Shared rules for self-serve agent creation by account users (SSP-4.2),
5
5
  * used by both the admin UI form handler and the JSON API route so the two
6
- * cannot drift: account users always create the self-serve specialty (see
7
- * getSelfServeSpecialty) stamped with THEIR account (never a client-supplied
6
+ * cannot drift: account owners always create the default agent type (see
7
+ * getOwnerAgentSpecialty) stamped with THEIR account (never a client-supplied
8
8
  * one), and quota / account-status failures surface as clear messages.
9
9
  */
10
10
 
@@ -12,16 +12,24 @@ import type { CallerScope } from "./caller-scope.ts";
12
12
  import { resolveDefaultSpecialtyName } from "./specialty-types.ts";
13
13
 
14
14
  /**
15
- * The only specialty account users may create: SHIPWRIGHT_SELF_SERVE_AGENT_TYPE
16
- * when set, else the platform's default specialty (SHIPWRIGHT_DEFAULT_AGENT_TYPE,
17
- * "specialist" when unset).
15
+ * The only type an account owner may create: the deployment's default agent
16
+ * type (SHIPWRIGHT_DEFAULT_AGENT_TYPE, "specialist" when unset). Platform
17
+ * admins choose any type.
18
+ */
19
+ export function getOwnerAgentSpecialty(
20
+ env: Record<string, string | undefined> = process.env,
21
+ ): string {
22
+ return resolveDefaultSpecialtyName(env);
23
+ }
24
+
25
+ /**
26
+ * @deprecated The separate self-serve agent type setting is no longer read;
27
+ * this is the default agent type. Use getOwnerAgentSpecialty().
18
28
  */
19
29
  export function getSelfServeSpecialty(
20
30
  env: Record<string, string | undefined> = process.env,
21
31
  ): string {
22
- return (
23
- env.SHIPWRIGHT_SELF_SERVE_AGENT_TYPE || resolveDefaultSpecialtyName(env)
24
- );
32
+ return getOwnerAgentSpecialty(env);
25
33
  }
26
34
 
27
35
  /** Account the caller may create agents in, or null when they have none. */
@@ -31,7 +39,8 @@ export function accountIdFromScope(scope: CallerScope): string | null {
31
39
 
32
40
  /** Clear, user-facing messages for the account-specific createAgent() errors. */
33
41
  export const ACCOUNT_CREATE_ERROR_MESSAGES = {
34
- quota_exceeded: "This account has reached its agent limit.",
42
+ quota_exceeded:
43
+ "This account has reached its agent limit. Delete an agent to free a slot.",
35
44
  account_inactive: "This account is not active.",
36
45
  } as const;
37
46
 
@@ -7,28 +7,26 @@ import { describe, expect, it } from "bun:test";
7
7
  import {
8
8
  canCreateAgent,
9
9
  createAccountIdFromScope,
10
+ getOwnerAgentSpecialty,
10
11
  getSelfServeSpecialty,
11
12
  } from "./account-agent-create.ts";
12
13
  import type { CallerScope } from "./caller-scope.ts";
13
14
 
14
- describe("getSelfServeSpecialty", () => {
15
- it("defaults to specialist", () => {
16
- expect(getSelfServeSpecialty({})).toBe("specialist");
15
+ describe("getOwnerAgentSpecialty", () => {
16
+ it("is the deployment default agent type", () => {
17
+ expect(getOwnerAgentSpecialty({})).toBe("specialist");
17
18
  expect(
18
- getSelfServeSpecialty({ SHIPWRIGHT_DEFAULT_AGENT_TYPE: "fixture" }),
19
+ getOwnerAgentSpecialty({ SHIPWRIGHT_DEFAULT_AGENT_TYPE: "fixture" }),
19
20
  ).toBe("fixture");
20
- expect(
21
- getSelfServeSpecialty({
22
- SHIPWRIGHT_DEFAULT_AGENT_TYPE: "fixture",
23
- SHIPWRIGHT_SELF_SERVE_AGENT_TYPE: "other",
24
- }),
25
- ).toBe("other");
26
21
  });
27
22
 
28
- it("honours SHIPWRIGHT_SELF_SERVE_AGENT_TYPE", () => {
29
- expect(
30
- getSelfServeSpecialty({ SHIPWRIGHT_SELF_SERVE_AGENT_TYPE: "base" }),
31
- ).toBe("base");
23
+ it("ignores the retired self-serve agent type setting", () => {
24
+ const env = {
25
+ SHIPWRIGHT_DEFAULT_AGENT_TYPE: "fixture",
26
+ SHIPWRIGHT_SELF_SERVE_AGENT_TYPE: "other",
27
+ };
28
+ expect(getOwnerAgentSpecialty(env)).toBe("fixture");
29
+ expect(getSelfServeSpecialty(env)).toBe("fixture");
32
30
  });
33
31
  });
34
32