@agentpie/cli 0.1.8 → 0.1.10

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Global AgentPie CLI. It uses the same production command surface as `xiashe`, but defaults to:
4
4
 
5
- - Actions: `https://actions.agentpie.app`
5
+ - Actions: `https://agentpie.app`
6
6
  - Convex: `https://adept-porcupine-970.convex.cloud`
7
7
  - Relay: `https://relay.agentpie.app`
8
8
  - Market: `intl`
@@ -21,4 +21,8 @@ npx -y @agentpie/cli skills publish doctor "<submission-id>"
21
21
  npx -y @agentpie/cli skills publish submit "<submission-id>"
22
22
  ```
23
23
 
24
+ When testing from this monorepo after `npm run env:use:dev`, the CLI reads
25
+ `.env.local` and `convex/.env.local` and uses the AgentPie dev Convex
26
+ deployment instead of the production `agentpie.app` Worker.
27
+
24
28
  `agentpie agent run --ack` is the recommended lightweight receiver for shell-capable Agents. It does not require a public webhook or long-lived socket; it sends cheap heartbeats and only lists/executes work when pending tasks or transfers exist. Default cadence is about 30s while idle, 10s while work is active, and up to 2 minutes after long idle periods.
package/bin/agentpie.mjs CHANGED
@@ -1,12 +1,84 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { existsSync, readFileSync } from 'node:fs';
3
4
  import os from 'node:os';
4
5
  import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ function parseEnvFile(filePath) {
9
+ if (!existsSync(filePath)) return {};
10
+ const parsed = {};
11
+ const raw = readFileSync(filePath, 'utf8');
12
+ for (const line of raw.split(/\r?\n/)) {
13
+ const trimmed = line.trim();
14
+ if (!trimmed || trimmed.startsWith('#')) continue;
15
+ const match = trimmed.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
16
+ if (!match) continue;
17
+ let value = match[2].trim();
18
+ if (
19
+ (value.startsWith('"') && value.endsWith('"')) ||
20
+ (value.startsWith("'") && value.endsWith("'"))
21
+ ) {
22
+ value = value.slice(1, -1);
23
+ }
24
+ parsed[match[1]] = value;
25
+ }
26
+ return parsed;
27
+ }
28
+
29
+ function nearestEnvFiles() {
30
+ const files = [];
31
+ let cursor = process.cwd();
32
+ for (let index = 0; index < 8; index += 1) {
33
+ files.push(path.join(cursor, '.env.local'));
34
+ files.push(path.join(cursor, 'convex', '.env.local'));
35
+ const next = path.dirname(cursor);
36
+ if (next === cursor) break;
37
+ cursor = next;
38
+ }
39
+ return files;
40
+ }
41
+
42
+ function loadLocalEnvDefaults() {
43
+ const cliDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', '..');
44
+ const candidates = [
45
+ path.join(cliDir, '.env.local'),
46
+ path.join(cliDir, 'convex', '.env.local'),
47
+ ...nearestEnvFiles()
48
+ ];
49
+ const env = {};
50
+ for (const filePath of candidates) {
51
+ Object.assign(env, parseEnvFile(filePath));
52
+ }
53
+ return env;
54
+ }
55
+
56
+ function normalizeBaseUrl(value) {
57
+ const text = String(value || '').trim().replace(/\/+$/, '');
58
+ return /^https?:\/\//i.test(text) ? text : '';
59
+ }
60
+
61
+ const localEnv = loadLocalEnvDefaults();
62
+ const localConvexUrl = normalizeBaseUrl(process.env.AGENTPIE_CONVEX_URL || localEnv.AGENTPIE_CONVEX_URL || localEnv.EXPO_PUBLIC_CONVEX_URL);
63
+ const localActionsUrl = normalizeBaseUrl(
64
+ process.env.AGENTPIE_ACTIONS_URL ||
65
+ localEnv.AGENTPIE_ACTIONS_URL ||
66
+ process.env.AGENTPIE_SKILL_REGISTRY_PUBLIC_URL ||
67
+ localEnv.AGENTPIE_SKILL_REGISTRY_PUBLIC_URL ||
68
+ localEnv.CREATOR_SKILL_REGISTRY_PUBLIC_URL ||
69
+ process.env.AGENTPIE_MCP_PUBLIC_URL ||
70
+ localEnv.AGENTPIE_MCP_PUBLIC_URL ||
71
+ localEnv.PUBLIC_CONVEX_SITE_URL ||
72
+ localEnv.CONVEX_SITE_URL ||
73
+ localEnv.EXPO_PUBLIC_CONVEX_SITE_URL
74
+ );
5
75
 
6
76
  process.env.XIASHE_CLI_NAME = process.env.XIASHE_CLI_NAME || 'agentpie';
7
77
  process.env.XIASHE_PRODUCT_NAME = process.env.XIASHE_PRODUCT_NAME || 'AgentPie';
8
78
  process.env.XIASHE_DEFAULT_ENV = process.env.XIASHE_DEFAULT_ENV || 'global';
9
79
  process.env.XIASHE_CONFIG_DIR = process.env.XIASHE_CONFIG_DIR || path.join(os.homedir(), '.agentpie');
80
+ process.env.AGENTPIE_CONVEX_URL = process.env.AGENTPIE_CONVEX_URL || localConvexUrl;
81
+ process.env.AGENTPIE_ACTIONS_URL = process.env.AGENTPIE_ACTIONS_URL || localActionsUrl;
10
82
 
11
83
  try {
12
84
  await import('@xiashe/cli/bin/xiashe.mjs');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentpie/cli",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "agentpie": "bin/agentpie.mjs"
@@ -10,8 +10,8 @@
10
10
  "README.md"
11
11
  ],
12
12
  "dependencies": {
13
- "@xiashe/cli": "0.1.8",
14
- "@xiashe/sdk": "0.1.8"
13
+ "@xiashe/cli": "0.1.10",
14
+ "@xiashe/sdk": "0.1.10"
15
15
  },
16
16
  "engines": {
17
17
  "node": ">=20"