agent-dealer 0.1.0 → 0.1.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-dealer/server",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-dealer/shared",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/dist/bin.js CHANGED
File without changes
package/dist/doctor.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import net from "node:net";
2
2
  import fs from "node:fs";
3
- import path from "node:path";
4
3
  import { claudeAvailable } from "./cli-check.js";
5
- import { resolveServerEntry, resolveUiDist, defaultAgentDealerHome } from "./paths.js";
4
+ import { loadProdEnvFile, prodEnvFilePath, prodHomeDir, resolveBundledListenPort, shortenHome, } from "./env.js";
5
+ import { resolveServerEntry, resolveUiDist } from "./paths.js";
6
6
  export async function runDoctor() {
7
7
  let failed = false;
8
8
  const major = Number(process.versions.node.split(".")[0]);
@@ -35,15 +35,24 @@ export async function runDoctor() {
35
35
  else {
36
36
  console.warn("⚠ dashboard bundle missing (API-only)");
37
37
  }
38
- const home = defaultAgentDealerHome();
39
- const envFile = path.join(home, ".env");
38
+ const envFile = loadProdEnvFile() ?? prodEnvFilePath();
40
39
  if (fs.existsSync(envFile)) {
41
- console.log(`✓ config ${envFile}`);
40
+ console.log(`✓ config ${shortenHome(envFile)}`);
41
+ if (process.env.LINEAR_API_KEY?.trim()) {
42
+ console.log("✓ LINEAR_API_KEY set");
43
+ }
44
+ else {
45
+ console.warn("⚠ LINEAR_API_KEY not set — Linear inbox disabled");
46
+ }
42
47
  }
43
48
  else {
44
49
  console.warn(`⚠ no config — run: agent-dealer setup`);
45
50
  }
46
- const port = Number(process.env.PORT ?? 2221);
51
+ const home = prodHomeDir();
52
+ if (fs.existsSync(home)) {
53
+ console.log(`✓ data ${shortenHome(home)}`);
54
+ }
55
+ const port = resolveBundledListenPort();
47
56
  const free = await isPortFree(port);
48
57
  if (free) {
49
58
  console.log(`✓ port ${port} available`);
package/dist/env.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /** Production data + config directory (respects AGENT_DEALER_HOME from shell). */
2
+ export declare function prodHomeDir(): string;
3
+ export declare function prodEnvFilePath(): string;
4
+ /** Load ~/.agent-dealer/.env for CLI (Linear keys, port, etc.). Does not override existing env. */
5
+ export declare function loadProdEnvFile(): string | undefined;
6
+ /**
7
+ * Bundled npm start: listen on prod dashboard port (2222).
8
+ * Legacy setups used PORT=2221 for API-only; ignore that when bundling UI.
9
+ */
10
+ export declare function resolveBundledListenPort(explicit?: number): number;
11
+ export declare function shortenHome(p: string): string;
package/dist/env.js ADDED
@@ -0,0 +1,39 @@
1
+ import fs from "node:fs";
2
+ import os from "node:os";
3
+ import path from "node:path";
4
+ import dotenv from "dotenv";
5
+ /** Production data + config directory (respects AGENT_DEALER_HOME from shell). */
6
+ export function prodHomeDir() {
7
+ return (process.env.AGENT_DEALER_HOME?.trim() ||
8
+ path.join(os.homedir(), ".agent-dealer"));
9
+ }
10
+ export function prodEnvFilePath() {
11
+ return path.join(prodHomeDir(), ".env");
12
+ }
13
+ /** Load ~/.agent-dealer/.env for CLI (Linear keys, port, etc.). Does not override existing env. */
14
+ export function loadProdEnvFile() {
15
+ const envFile = prodEnvFilePath();
16
+ if (fs.existsSync(envFile)) {
17
+ dotenv.config({ path: envFile });
18
+ return envFile;
19
+ }
20
+ return undefined;
21
+ }
22
+ /**
23
+ * Bundled npm start: listen on prod dashboard port (2222).
24
+ * Legacy setups used PORT=2221 for API-only; ignore that when bundling UI.
25
+ */
26
+ export function resolveBundledListenPort(explicit) {
27
+ if (explicit !== undefined)
28
+ return explicit;
29
+ if (process.env.WEB_PORT)
30
+ return Number(process.env.WEB_PORT);
31
+ const port = process.env.PORT;
32
+ if (port && port !== "2221")
33
+ return Number(port);
34
+ return 2222;
35
+ }
36
+ export function shortenHome(p) {
37
+ const home = os.homedir();
38
+ return p.startsWith(home) ? `~${p.slice(home.length)}` : p;
39
+ }
package/dist/start.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { spawn } from "node:child_process";
2
+ import { loadProdEnvFile, prodEnvFilePath, prodHomeDir, resolveBundledListenPort, shortenHome, } from "./env.js";
2
3
  import { resolveServerEntry, resolveUiDist } from "./paths.js";
3
4
  let child = null;
4
5
  async function waitForHealth(url, attempts = 40) {
@@ -16,13 +17,23 @@ async function waitForHealth(url, attempts = 40) {
16
17
  return false;
17
18
  }
18
19
  export async function runStart(options = {}) {
19
- const port = options.port ?? Number(process.env.PORT ?? 2221);
20
- const entry = resolveServerEntry();
20
+ const envFile = loadProdEnvFile();
21
+ const home = prodHomeDir();
21
22
  const uiDist = resolveUiDist();
23
+ const port = resolveBundledListenPort(options.port);
24
+ const entry = resolveServerEntry();
25
+ if (envFile) {
26
+ console.log(`Config: ${shortenHome(envFile)}`);
27
+ }
28
+ else {
29
+ console.warn(`No config at ${shortenHome(prodEnvFilePath())} — run: agent-dealer setup`);
30
+ }
22
31
  const env = {
23
32
  ...process.env,
24
33
  AGENT_DEALER_ENV: "production",
34
+ AGENT_DEALER_HOME: home,
25
35
  PORT: String(port),
36
+ WEB_PORT: String(port),
26
37
  AGENT_DEALER_WEB_URL: `http://localhost:${port}`,
27
38
  AGENT_DEALER_API: `http://127.0.0.1:${port}`,
28
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-dealer",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Human control plane for agent execution — queue, plan approval, audit",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -6,14 +6,15 @@ AGENT_DEALER_ENV=production
6
6
  # SQLite data directory (default: ~/.agent-dealer)
7
7
  # AGENT_DEALER_HOME=
8
8
 
9
- # API + dashboard port when UI is bundled (default: 2221)
10
- PORT=2221
11
- AGENT_DEALER_WEB_URL=http://localhost:2221
9
+ # API + dashboard port when UI is bundled (default: 2222 — prod dashboard port)
10
+ PORT=2222
11
+ AGENT_DEALER_WEB_URL=http://localhost:2222
12
+ AGENT_DEALER_API=http://127.0.0.1:2222
12
13
 
13
- # Linear (optional — manual tasks work without)
14
- # LINEAR_API_KEY=
15
- # LINEAR_TEAM_ID=
16
- # LINEAR_STATE_FILTER="Todo,Backlog"
14
+ # Linear (optional — manual tasks work without; edit after `agent-dealer setup`)
15
+ LINEAR_API_KEY=
16
+ LINEAR_TEAM_ID=
17
+ LINEAR_STATE_FILTER="Todo,Backlog"
17
18
 
18
19
  # Agent Deck UI proxy (optional)
19
20
  # AGENT_DECK_API_URL=http://127.0.0.1:1111