@agentprojectcontext/apx 1.10.0 → 1.10.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentprojectcontext/apx",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "APX — unified CLI + daemon for the Agent Project Context (APC) standard.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -2,6 +2,8 @@
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
  import { findApfRoot } from "../../core/parser.js";
5
+ import { http } from "../http.js";
6
+ import { resolveProjectId } from "./project.js";
5
7
 
6
8
  function commandsDir(root) {
7
9
  return path.join(root, ".apc", "commands");
@@ -13,9 +15,28 @@ function listCommandFiles(root) {
13
15
  return fs.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
14
16
  }
15
17
 
16
- export function cmdCommandList() {
18
+ async function resolveCommandRoot(args = {}) {
19
+ const explicitProject = args?.flags?.project;
20
+ if (explicitProject !== undefined && explicitProject !== null && explicitProject !== "") {
21
+ const pid = await resolveProjectId(explicitProject);
22
+ const projects = await http.get("/projects");
23
+ const project = projects.find((p) => p.id === pid);
24
+ if (!project) throw new Error(`project ${pid} not found`);
25
+ return project.path;
26
+ }
27
+
17
28
  const root = findApfRoot();
18
- if (!root) throw new Error("not inside an APC project");
29
+ if (root) return root;
30
+
31
+ const pid = await resolveProjectId();
32
+ const projects = await http.get("/projects");
33
+ const project = projects.find((p) => p.id === pid);
34
+ if (!project) throw new Error(`project ${pid} not found`);
35
+ return project.path;
36
+ }
37
+
38
+ export async function cmdCommandList(args = {}) {
39
+ const root = await resolveCommandRoot(args);
19
40
  const files = listCommandFiles(root);
20
41
  if (files.length === 0) {
21
42
  console.log("(no commands — add .md files to .apc/commands/)");
@@ -31,11 +52,10 @@ export function cmdCommandList() {
31
52
  }
32
53
  }
33
54
 
34
- export function cmdCommandShow(args) {
55
+ export async function cmdCommandShow(args) {
35
56
  const name = args._[0];
36
57
  if (!name) throw new Error("apx command show: missing <name>");
37
- const root = findApfRoot();
38
- if (!root) throw new Error("not inside an APC project");
58
+ const root = await resolveCommandRoot(args);
39
59
  const file = path.join(commandsDir(root), `${name}.md`);
40
60
  if (!fs.existsSync(file)) throw new Error(`command "${name}" not found in .apc/commands/`);
41
61
  process.stdout.write(fs.readFileSync(file, "utf8"));
package/src/cli/index.js CHANGED
@@ -60,7 +60,7 @@ import {
60
60
  cmdConversationsList,
61
61
  cmdConversationsGet,
62
62
  } from "./commands/chat.js";
63
- import { cmdSys } from "./commands/sys.js";
63
+ import { cmdSys as cmdCode } from "./commands/sys.js";
64
64
  import { cmdRun, cmdEnvDetect } from "./commands/runtime.js";
65
65
  import { cmdSend, cmdConnections } from "./commands/a2a.js";
66
66
  import {
@@ -184,7 +184,7 @@ const HELP_TOPICS = new Map(Object.entries({
184
184
  title: "apx project add",
185
185
  summary: "Register a project with the APX daemon.",
186
186
  usage: ["apx project add [path]"],
187
- examples: ["apx project add .", "apx add project ../repo"],
187
+ examples: ["apx project add .", "apx project add ../repo"],
188
188
  }),
189
189
  "project list": topic({
190
190
  title: "apx project list",
@@ -204,19 +204,6 @@ const HELP_TOPICS = new Map(Object.entries({
204
204
  usage: ["apx project rebuild [id]"],
205
205
  examples: ["apx project rebuild", "apx project rebuild default"],
206
206
  }),
207
- add: topic({
208
- title: "apx add",
209
- summary: "Friendly alias namespace for add operations.",
210
- usage: ["apx add project [path]"],
211
- commands: [["project [path]", "Alias for apx project add [path]."]],
212
- examples: ["apx add project ."],
213
- }),
214
- "add project": topic({
215
- title: "apx add project",
216
- summary: "Alias for apx project add.",
217
- usage: ["apx add project [path]"],
218
- examples: ["apx add project ."],
219
- }),
220
207
  agent: topic({
221
208
  title: "apx agent",
222
209
  summary: "Create, inspect, import, and vault agent definitions.",
@@ -298,7 +285,7 @@ const HELP_TOPICS = new Map(Object.entries({
298
285
  }),
299
286
  identity: topic({
300
287
  title: "apx identity",
301
- summary: "Read or edit daemon identity fields.",
288
+ summary: "Read or edit APX profile identity fields.",
302
289
  usage: ["apx identity <show|set|wizard> [args]"],
303
290
  commands: [
304
291
  ["show", "Print current identity."],
@@ -309,13 +296,13 @@ const HELP_TOPICS = new Map(Object.entries({
309
296
  }),
310
297
  "identity show": topic({
311
298
  title: "apx identity show",
312
- summary: "Print current daemon identity.",
299
+ summary: "Print current APX profile identity.",
313
300
  usage: ["apx identity show"],
314
301
  examples: ["apx identity show"],
315
302
  }),
316
303
  "identity set": topic({
317
304
  title: "apx identity set",
318
- summary: "Set one daemon identity field.",
305
+ summary: "Set one APX profile identity field.",
319
306
  usage: ["apx identity set <key> <value>"],
320
307
  examples: ["apx identity set agent_name Ada", "apx identity set owner_name Sam"],
321
308
  }),
@@ -364,7 +351,7 @@ const HELP_TOPICS = new Map(Object.entries({
364
351
  }),
365
352
  permission: topic({
366
353
  title: "apx permission",
367
- summary: "Show or set super-agent permission mode.",
354
+ summary: "Show or set APX tool permission mode.",
368
355
  usage: ["apx permission show", "apx permission set <total|automatico|permiso>"],
369
356
  commands: [
370
357
  ["show", "Print current permission mode."],
@@ -374,13 +361,13 @@ const HELP_TOPICS = new Map(Object.entries({
374
361
  }),
375
362
  "permission show": topic({
376
363
  title: "apx permission show",
377
- summary: "Print current super-agent permission mode.",
364
+ summary: "Print current APX tool permission mode.",
378
365
  usage: ["apx permission show"],
379
366
  examples: ["apx permission show"],
380
367
  }),
381
368
  "permission set": topic({
382
369
  title: "apx permission set",
383
- summary: "Set super-agent permission mode.",
370
+ summary: "Set APX tool permission mode.",
384
371
  usage: ["apx permission set <total|automatico|permiso>"],
385
372
  examples: ["apx permission set permiso"],
386
373
  }),
@@ -702,14 +689,14 @@ const HELP_TOPICS = new Map(Object.entries({
702
689
  ],
703
690
  examples: ["apx chat reviewer", "apx chat reviewer --conversation abc123"],
704
691
  }),
705
- sys: topic({
706
- title: "apx sys",
707
- summary: "Start an interactive super-agent chat REPL with system and workspace context.",
708
- usage: ["apx sys [--project <name|id|path>]"],
692
+ code: topic({
693
+ title: "apx code",
694
+ summary: "Start the APX terminal coding assistant with system and workspace context.",
695
+ usage: ["apx code [--project <name|id|path>]"],
709
696
  options: [
710
697
  ["--project <name|id|path>", "Pin command to a specific project."],
711
698
  ],
712
- examples: ["apx sys", "apx sys --project default"],
699
+ examples: ["apx code", "apx code --project default"],
713
700
  }),
714
701
  conversations: topic({
715
702
  title: "apx conversations",
@@ -779,17 +766,10 @@ const HELP_TOPICS = new Map(Object.entries({
779
766
  connections: topic({
780
767
  title: "apx connections",
781
768
  summary: "Show an agent communication map.",
782
- usage: ["apx connections <agent> [--project <name|id|path>]", "apx graph <agent> [--project <name|id|path>]"],
769
+ usage: ["apx connections <agent> [--project <name|id|path>]"],
783
770
  options: [["--project <name|id|path>", "Pin command to a specific project."]],
784
771
  examples: ["apx connections reviewer"],
785
772
  }),
786
- graph: topic({
787
- title: "apx graph",
788
- summary: "Alias for apx connections.",
789
- usage: ["apx graph <agent> [--project <name|id|path>]"],
790
- options: [["--project <name|id|path>", "Pin command to a specific project."]],
791
- examples: ["apx graph reviewer"],
792
- }),
793
773
  routine: topic({
794
774
  title: "apx routine",
795
775
  summary: "Manage scheduled APX routines.",
@@ -931,11 +911,12 @@ const HELP_TOPICS = new Map(Object.entries({
931
911
  command: topic({
932
912
  title: "apx command",
933
913
  summary: "List or show workflow commands from .apc/commands/.",
934
- usage: ["apx command [list]", "apx command show <name>"],
914
+ usage: ["apx command [list] [--project <name|id|path>]", "apx command show <name> [--project <name|id|path>]"],
935
915
  commands: [
936
916
  ["list | ls", "List workflow commands."],
937
917
  ["show | get <name>", "Print one command file."],
938
918
  ],
919
+ options: [["--project <name|id|path>", "Pin command to a specific project; defaults to current APC project or default."]],
939
920
  examples: ["apx command list", "apx command show release"],
940
921
  }),
941
922
  commands: topic({
@@ -947,13 +928,15 @@ const HELP_TOPICS = new Map(Object.entries({
947
928
  "command list": topic({
948
929
  title: "apx command list",
949
930
  summary: "List workflow commands in .apc/commands/.",
950
- usage: ["apx command list", "apx command ls"],
931
+ usage: ["apx command list [--project <name|id|path>]", "apx command ls [--project <name|id|path>]"],
932
+ options: [["--project <name|id|path>", "Pin command to a specific project; defaults to current APC project or default."]],
951
933
  examples: ["apx command list"],
952
934
  }),
953
935
  "command show": topic({
954
936
  title: "apx command show",
955
937
  summary: "Print one workflow command file.",
956
- usage: ["apx command show <name>", "apx command get <name>"],
938
+ usage: ["apx command show <name> [--project <name|id|path>]", "apx command get <name> [--project <name|id|path>]"],
939
+ options: [["--project <name|id|path>", "Pin command to a specific project; defaults to current APC project or default."]],
957
940
  examples: ["apx command show release"],
958
941
  }),
959
942
  skills: topic({
@@ -1019,6 +1002,7 @@ const HELP_TOPICS = new Map(Object.entries({
1019
1002
  const HELP_ALIASES = new Map(Object.entries({
1020
1003
  "project ls": "project list",
1021
1004
  "project rm": "project remove",
1005
+ "sys": "code",
1022
1006
  "agent ls": "agent list",
1023
1007
  "agent show": "agent get",
1024
1008
  "agent vault ls": "agent vault list",
@@ -1074,11 +1058,12 @@ function buildHelp(version) {
1074
1058
  hCmd("apx setup", 36, "interactive wizard: provider → model → channels → daemon (alias: install)"),
1075
1059
  hCmd("apx status", 36, "full system status: daemon, super-agent, engines, telegram, projects"),
1076
1060
  hCmd("apx update", 36, "check for updates and upgrade (alias: upgrade)"),
1061
+
1062
+ hSec("Projects"),
1077
1063
  hCmd("apx project add [path]", 36, "register a project with the daemon"),
1078
1064
  hCmd("apx project list", 36, ""),
1079
1065
  hCmd("apx project remove <id>", 36, ""),
1080
1066
  hCmd("apx project rebuild [id]", 36, "rebuild project index from filesystem"),
1081
- hCmd("apx add project [path]", 36, "alias for: apx project add"),
1082
1067
 
1083
1068
  hSec("Agents"),
1084
1069
  hCmd("apx agent add <slug>", 36, "--role R --model M --skills a,b --language es-AR --description D"),
@@ -1088,15 +1073,16 @@ function buildHelp(version) {
1088
1073
  hCmd("apx agent vault list", 36, ""),
1089
1074
  hCmd("apx agent vault add", 36, ""),
1090
1075
 
1091
- hSec("Identity & Config"),
1092
- hCmd("apx identity show", 36, "print current agent identity (name, owner, personality)"),
1076
+ hSec("APX Profile"),
1077
+ hCmd("apx identity show", 36, "print current APX identity (name, owner, personality)"),
1093
1078
  hCmd("apx identity set <k> <v>", 36, "set identity field"),
1094
1079
  hCmd("apx identity wizard", 36, "interactive identity setup"),
1080
+
1081
+ hSec("Config"),
1095
1082
  hCmd("apx config show", 36, "--effective --only-overrides"),
1096
- hCmd("apx config set <key> <val>", 36, "set key in .apc/config.json (JSON-aware)"),
1097
- hCmd("apx permission show", 36, "show super-agent permission mode"),
1083
+ hCmd("apx config set|unset", 36, "<key> [value] edit .apc/config.json (JSON-aware)"),
1084
+ hCmd("apx permission show", 36, "show APX tool permission mode"),
1098
1085
  hCmd("apx permission set <mode>", 36, "mode: total | automatico | permiso"),
1099
- hCmd("apx config unset <key>", 36, "remove key from .apc/config.json"),
1100
1086
 
1101
1087
  hSec("Memory"),
1102
1088
  hCmd("apx memory <slug>", 36, "print memory.md"),
@@ -1123,7 +1109,7 @@ function buildHelp(version) {
1123
1109
  hCmd("apx mcp tools <name>", 36, "list available tools"),
1124
1110
  hCmd("apx mcp check", 36, "audit multi-source merge"),
1125
1111
 
1126
- hSec("Daemon"),
1112
+ hSec("Daemon Service"),
1127
1113
  hCmd("apx daemon start", 36, ""),
1128
1114
  hCmd("apx daemon stop", 36, ""),
1129
1115
  hCmd("apx daemon status", 36, ""),
@@ -1139,11 +1125,11 @@ function buildHelp(version) {
1139
1125
  hCmd("apx messages chat", 36, "--channel telegram -n 50"),
1140
1126
  hCmd("apx messages search \"q\"", 36, ""),
1141
1127
 
1142
- hSec("LLM / Chat"),
1143
- hCmd("apx exec <agent> \"prompt\"",36, "--model <id> --max-tokens N --temperature T"),
1144
- hCmd("apx chat <agent>", 36, "--conversation <id> --model <id> (interactive REPL)"),
1145
- hCmd("apx sys", 36, "super-agent chat w/ system+workspace context"),
1146
- hCmd("apx conversations list", 36, "<agent>"),
1128
+ hSec("LLM / Code"),
1129
+ hCmd("apx code", 36, "APX terminal coding assistant"),
1130
+ hCmd("apx exec <agent> \"prompt\"",36, "one-shot agent call --model <id> --max-tokens N"),
1131
+ hCmd("apx chat <agent>", 36, "interactive agent REPL --conversation <id>"),
1132
+ hCmd("apx conversations list", 36, "stored exec/chat conversations for <agent>"),
1147
1133
  hCmd("apx conversations get", 36, "<agent> <id>"),
1148
1134
 
1149
1135
  hSec("Runtimes"),
@@ -1154,7 +1140,6 @@ function buildHelp(version) {
1154
1140
  hSec("Agent-to-Agent"),
1155
1141
  hCmd("apx send <from> <to> \"msg\"",36, "--deliver log A2A message; --deliver runs target engine"),
1156
1142
  hCmd("apx connections <agent>", 36, "mental map: who/how/when this agent talked"),
1157
- hCmd("apx graph <agent>", 36, "alias for connections"),
1158
1143
 
1159
1144
  hSec("Routines & Pipeline"),
1160
1145
  hCmd("apx routine list", 36, "list routines + next/last run"),
@@ -1452,8 +1437,9 @@ async function dispatch(cmd, rest) {
1452
1437
  await cmdChat(parseArgs(rest));
1453
1438
  break;
1454
1439
 
1440
+ case "code":
1455
1441
  case "sys":
1456
- await cmdSys(parseArgs(rest));
1442
+ await cmdCode(parseArgs(rest));
1457
1443
  break;
1458
1444
 
1459
1445
  case "conversations":
@@ -1482,7 +1468,6 @@ async function dispatch(cmd, rest) {
1482
1468
  break;
1483
1469
 
1484
1470
  case "connections":
1485
- case "graph":
1486
1471
  await cmdConnections(parseArgs(rest));
1487
1472
  break;
1488
1473
 
@@ -1543,8 +1528,8 @@ async function dispatch(cmd, rest) {
1543
1528
  case "commands": {
1544
1529
  const sub = rest[0];
1545
1530
  const a = parseArgs(rest.slice(1));
1546
- if (!sub || sub === "list" || sub === "ls") cmdCommandList();
1547
- else if (sub === "show" || sub === "get") cmdCommandShow(a);
1531
+ if (!sub || sub === "list" || sub === "ls") await cmdCommandList(a);
1532
+ else if (sub === "show" || sub === "get") await cmdCommandShow(a);
1548
1533
  else die(`unknown command subcommand: ${sub}`);
1549
1534
  break;
1550
1535
  }
@@ -1563,14 +1548,6 @@ async function dispatch(cmd, rest) {
1563
1548
  await cmdIdentity(parseArgs(rest));
1564
1549
  break;
1565
1550
 
1566
- case "add": {
1567
- // apx add <domain> [...args] — consistent alternative to apx <domain> add
1568
- const sub = rest[0];
1569
- if (sub === "project") await cmdProjectAdd(parseArgs(rest.slice(1)));
1570
- else die(`unknown 'add' subcommand: ${sub || "(none)"} — try: project`);
1571
- break;
1572
- }
1573
-
1574
1551
  case "status":
1575
1552
  await cmdStatus();
1576
1553
  return; // skip checkForUpdate after status (avoid noise)
@@ -88,7 +88,7 @@ apx messages tail --agent <slug> -n 20
88
88
  Message rows expose `type` (`user`, `agent`, `tool`, `system`) and `actor_id`; use `messages chat`
89
89
  when you need a readable transcript.
90
90
 
91
- ## Super-agent permissions
91
+ ## APX tool permissions
92
92
 
93
93
  ```bash
94
94
  apx permission show
@@ -7,7 +7,7 @@ export default {
7
7
  type: "function",
8
8
  function: {
9
9
  name: "set_identity",
10
- description: "Update daemon identity fields. Persists to ~/.apx/identity.json.",
10
+ description: "Update APX profile identity fields. Persists to ~/.apx/identity.json.",
11
11
  parameters: {
12
12
  type: "object",
13
13
  properties: {
@@ -9,7 +9,7 @@ export default {
9
9
  type: "function",
10
10
  function: {
11
11
  name: "set_permission_mode",
12
- description: "Set the super-agent permission mode in ~/.apx/config.json. Modes: total, automatico, permiso.",
12
+ description: "Set APX tool permission mode in ~/.apx/config.json. Modes: total, automatico, permiso.",
13
13
  parameters: {
14
14
  type: "object",
15
15
  properties: {