@app-vitals/agent-lib 0.16.2 → 1.0.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.
@@ -20,7 +20,7 @@ describe("default specialty resolution", () => {
20
20
  join(import.meta.dir, "..", "agent-types"),
21
21
  );
22
22
  expect(
23
- existsSync(join(SHIPPED_AGENT_TYPES_DIR, "specialist", "manifest.yaml")),
23
+ existsSync(join(SHIPPED_AGENT_TYPES_DIR, "specialist", "templates")),
24
24
  ).toBe(true);
25
25
  });
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-lib",
3
- "version": "0.16.2",
3
+ "version": "1.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",
@@ -14,7 +14,6 @@
14
14
  "exports": {
15
15
  "./admin-types": "./admin-types.ts",
16
16
  "./chat-notify": "./chat-notify.ts",
17
- "./claim-ttl": "./claim-ttl.ts",
18
17
  "./claude-timeout": "./claude-timeout.ts",
19
18
  "./cli-flags": "./cli-flags.ts",
20
19
  "./clone-plan": "./clone-plan.ts",
@@ -29,11 +28,10 @@
29
28
  "./redact": "./redact.ts",
30
29
  "./request-context": "./request-context.ts",
31
30
  "./secret-env-vars": "./secret-env-vars.ts",
32
- "./default-account": "./default-account.ts",
33
31
  "./default-agent-env": "./default-agent-env.ts",
34
32
  "./default-specialty": "./default-specialty.ts",
33
+ "./specialist-type": "./specialist-type.ts",
35
34
  "./sentry": "./sentry.ts",
36
- "./task-store-types": "./task-store-types.ts",
37
35
  "./web/*": "./web/*"
38
36
  },
39
37
  "dependencies": {
@@ -0,0 +1,29 @@
1
+ /**
2
+ * lib/specialist-type.ts
3
+ *
4
+ * The platform's one built-in agent type, as a plain typed record. Replaces
5
+ * the former agent-types/specialist/manifest.yaml (and its strict Zod
6
+ * schema/loader): the values below are exactly what that manifest declared
7
+ * and that anything still read from it. Shared by admin (tools floor,
8
+ * required-env reporting, type validity) and runtime (template lookup).
9
+ */
10
+
11
+ export interface SpecialtyType {
12
+ /** The value stored in Agent.specialty. */
13
+ name: string;
14
+ displayName: string;
15
+ /** Workspace template directory, relative to the repo/image root. */
16
+ templatesDir: string;
17
+ /** Tool patterns seeded as AgentTool rows on create. */
18
+ tools: readonly string[];
19
+ /** Env keys an agent of this type must have; reported when missing. */
20
+ requiredEnv: readonly string[];
21
+ }
22
+
23
+ export const SPECIALIST_TYPE: SpecialtyType = {
24
+ name: "specialist",
25
+ displayName: "Specialist Agent",
26
+ templatesDir: "agent-types/specialist/templates/",
27
+ tools: ["Bash", "WebSearch", "WebFetch", "Agent"],
28
+ requiredEnv: ["CLAUDE_CODE_OAUTH_TOKEN"],
29
+ };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Contract test: the specialist type record carries the exact values the
3
+ * retired agent-types/specialist/manifest.yaml declared, so existing
4
+ * specialist agents keep the same tools floor, required-env reporting and
5
+ * template seeding.
6
+ */
7
+
8
+ import { describe, expect, it } from "bun:test";
9
+ import { existsSync } from "node:fs";
10
+ import { join } from "node:path";
11
+ import { SPECIALIST_TYPE } from "./specialist-type.ts";
12
+
13
+ describe("SPECIALIST_TYPE", () => {
14
+ it("keeps the old manifest's identity and tools floor", () => {
15
+ expect(SPECIALIST_TYPE.name).toBe("specialist");
16
+ expect(SPECIALIST_TYPE.displayName).toBe("Specialist Agent");
17
+ expect([...SPECIALIST_TYPE.tools]).toEqual([
18
+ "Bash",
19
+ "WebSearch",
20
+ "WebFetch",
21
+ "Agent",
22
+ ]);
23
+ });
24
+
25
+ it("keeps the old manifest's required env keys", () => {
26
+ expect([...SPECIALIST_TYPE.requiredEnv]).toEqual([
27
+ "CLAUDE_CODE_OAUTH_TOKEN",
28
+ ]);
29
+ });
30
+
31
+ it("points templatesDir at the shipped specialist templates", () => {
32
+ expect(SPECIALIST_TYPE.templatesDir).toBe(
33
+ "agent-types/specialist/templates/",
34
+ );
35
+ const dir = join(import.meta.dir, "..", SPECIALIST_TYPE.templatesDir);
36
+ for (const f of [
37
+ "CLAUDE.md.template",
38
+ "SOUL.md.template",
39
+ "IDENTITY.md.template",
40
+ "SPECIALTY.md.template",
41
+ ]) {
42
+ expect(existsSync(join(dir, f))).toBe(true);
43
+ }
44
+ });
45
+ });
package/claim-ttl.ts DELETED
@@ -1,12 +0,0 @@
1
- import { DEFAULT_CLAUDE_TIMEOUT_MS } from "./claude-timeout.ts";
2
-
3
- /** Extra headroom added on top of the session timeout (5min). */
4
- export const CLAIM_TTL_BUFFER_MS = 300_000;
5
-
6
- /**
7
- * Default claim TTL: how long a claim (Task or PR review/patch/deploy) remains
8
- * valid without a heartbeat before it's eligible for reaping. Must exceed
9
- * DEFAULT_CLAUDE_TIMEOUT_MS so a claim isn't reaped mid-session.
10
- */
11
- export const DEFAULT_CLAIM_TTL_MS =
12
- DEFAULT_CLAUDE_TIMEOUT_MS + CLAIM_TTL_BUFFER_MS;
@@ -1,26 +0,0 @@
1
- import { describe, expect, test } from "bun:test";
2
- import { CLAIM_TTL_BUFFER_MS, DEFAULT_CLAIM_TTL_MS } from "./claim-ttl.ts";
3
- import { DEFAULT_CLAUDE_TIMEOUT_MS } from "./claude-timeout.ts";
4
-
5
- describe("claim-ttl constants", () => {
6
- test("CLAIM_TTL_BUFFER_MS is 300_000 (5min)", () => {
7
- expect(CLAIM_TTL_BUFFER_MS).toBe(300_000);
8
- });
9
-
10
- test("DEFAULT_CLAIM_TTL_MS is 3_900_000 (65min)", () => {
11
- expect(DEFAULT_CLAIM_TTL_MS).toBe(3_900_000);
12
- });
13
-
14
- test("DEFAULT_CLAIM_TTL_MS is computed as the sum of the other two constants", () => {
15
- expect(DEFAULT_CLAIM_TTL_MS).toBe(
16
- DEFAULT_CLAUDE_TIMEOUT_MS + CLAIM_TTL_BUFFER_MS,
17
- );
18
- });
19
-
20
- // Relocated from claude-timeout.unit.test.ts (AEP-4.1): claim-ttl is the
21
- // task-store side, so the cross-module invariant belongs here and the
22
- // platform-set lib test no longer imports it.
23
- test("DEFAULT_CLAIM_TTL_MS exceeds DEFAULT_CLAUDE_TIMEOUT_MS", () => {
24
- expect(DEFAULT_CLAIM_TTL_MS).toBeGreaterThan(DEFAULT_CLAUDE_TIMEOUT_MS);
25
- });
26
- });
@@ -1,5 +0,0 @@
1
- /**
2
- * The account every pre-multi-tenancy task-store row belongs to. Never use
3
- * NULL for task-store accountId — the column is NOT NULL DEFAULT 'default'.
4
- */
5
- export const DEFAULT_ACCOUNT_ID = "default";
@@ -1,8 +0,0 @@
1
- import { describe, expect, it } from "bun:test";
2
- import { DEFAULT_ACCOUNT_ID } from "./default-account.ts";
3
-
4
- describe("DEFAULT_ACCOUNT_ID", () => {
5
- it("is the literal 'default' matching the migration's column default", () => {
6
- expect(DEFAULT_ACCOUNT_ID).toBe("default");
7
- });
8
- });