@app-vitals/agent-admin 1.108.1 → 1.110.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 +4 -0
- package/account-move.example.json +22 -0
- package/openapi.platform.json +5 -0
- package/package.json +2 -2
- package/src/account-agent-create.ts +18 -9
- package/src/account-agent-create.unit.test.ts +12 -14
- package/src/account-move.integration.test.ts +594 -0
- package/src/account-move.ts +867 -0
- package/src/account-move.unit.test.ts +206 -0
- package/src/admin-local-agent.smoke.test.ts +65 -0
- package/src/admin-ui-account-pages.ts +2 -3
- package/src/admin-ui-account-pages.unit.test.ts +5 -3
- package/src/admin-ui-github-enterprise-pages.ts +13 -2
- package/src/admin-ui-github-enterprise.smoke.test.ts +20 -1
- package/src/admin-ui-github-enterprise.ts +16 -1
- package/src/admin-ui-pages.ts +16 -5
- package/src/admin-ui-pages.unit.test.ts +25 -20
- package/src/admin-ui-slack-config-token-pages.ts +11 -2
- package/src/admin-ui-slack-config-token.smoke.test.ts +39 -3
- package/src/admin-ui-slack-config-token.ts +51 -9
- package/src/admin-ui-templates-pages.ts +7 -1
- package/src/admin-ui-templates.smoke.test.ts +31 -5
- package/src/admin-ui-templates.ts +43 -8
- package/src/admin-ui.smoke.test.ts +6 -7
- package/src/admin-ui.ts +39 -27
- package/src/agent-templates-api.integration.test.ts +29 -7
- package/src/agent-templates.ts +7 -1
- package/src/agents-api.smoke.test.ts +106 -8
- package/src/agents-api.ts +5 -3
- package/src/agents.integration.test.ts +112 -2
- package/src/agents.ts +37 -6
- package/src/deployment-wide-settings.integration.test.ts +309 -0
- package/src/deployment-wide-settings.ts +42 -0
- package/src/github-agent-installation-crawler.ts +18 -1
- package/src/github-enterprise-api.integration.test.ts +7 -0
- package/src/github-enterprise-api.ts +6 -2
- package/src/github-enterprise-apps.integration.test.ts +33 -8
- package/src/github-enterprise-apps.ts +4 -0
- package/src/github-enterprise-isolation.unit.test.ts +17 -0
- package/src/github-installation-wiring.ts +34 -5
- package/src/github-installation-wiring.unit.test.ts +38 -1
- package/src/github-sync-cache.integration.test.ts +9 -2
- package/src/installation-repos-service.ts +7 -4
- package/src/move-accounts.ts +201 -0
- package/src/openapi-schemas.ts +6 -0
- package/src/self-serve-config.ts +8 -8
- package/src/self-serve-config.unit.test.ts +3 -10
- package/src/slack-config-token.integration.test.ts +19 -2
- package/src/slack-config-token.ts +6 -1
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
|
+
}
|
package/openapi.platform.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@app-vitals/agent-admin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.110.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.
|
|
47
|
+
"@app-vitals/agent-lib": "1.110.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
|
|
7
|
-
*
|
|
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
|
|
16
|
-
*
|
|
17
|
-
*
|
|
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:
|
|
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("
|
|
15
|
-
it("
|
|
16
|
-
expect(
|
|
15
|
+
describe("getOwnerAgentSpecialty", () => {
|
|
16
|
+
it("is the deployment default agent type", () => {
|
|
17
|
+
expect(getOwnerAgentSpecialty({})).toBe("specialist");
|
|
17
18
|
expect(
|
|
18
|
-
|
|
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("
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|