@agentprojectcontext/apx 1.62.0 → 1.63.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentprojectcontext/apx",
3
- "version": "1.62.0",
3
+ "version": "1.63.0",
4
4
  "description": "APX — unified CLI + daemon for the Agent Project Context (APC) standard.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -39,6 +39,11 @@ apx <command> --help
39
39
  ## Core commands you'll actually use
40
40
 
41
41
  ```bash
42
+ # One-shot super-agent call
43
+ apx exec "prompt" # default 'cli' channel
44
+ apx exec --code "prompt" # 'code' channel: coding system prompt + git/code tools
45
+ apx exec --channel <name> "…" # explicit channel (cli, code, api, …)
46
+
42
47
  # Project + daemon
43
48
  apx status # daemon health
44
49
  apx project list # registered projects
@@ -31,6 +31,33 @@ export function resolveExecRequest(args) {
31
31
  };
32
32
  }
33
33
 
34
+ // Valid channel strings the daemon knows how to route.
35
+ const KNOWN_CHANNELS = new Set(Object.values(CHANNELS));
36
+
37
+ /**
38
+ * Resolve which channel `apx exec` should tag the turn with.
39
+ * Default: CHANNELS.CLI (unchanged behaviour).
40
+ * --code / -c → CHANNELS.CODE (coding system prompt + code tools)
41
+ * --channel <name> → explicit channel (must be a known channel string)
42
+ */
43
+ export function resolveExecChannel(args) {
44
+ const flags = args?.flags || {};
45
+ if (flags.code) return CHANNELS.CODE;
46
+
47
+ const raw = flags.channel;
48
+ if (raw && raw !== true) {
49
+ const channel = String(raw).toLowerCase();
50
+ if (!KNOWN_CHANNELS.has(channel)) {
51
+ throw new Error(
52
+ `apx exec: unknown channel "${raw}". Known channels: ${[...KNOWN_CHANNELS].join(", ")}`
53
+ );
54
+ }
55
+ return channel;
56
+ }
57
+
58
+ return CHANNELS.CLI;
59
+ }
60
+
34
61
  async function readPromptFromStdin() {
35
62
  const fs = await import("node:fs");
36
63
  if (process.stdin.isTTY) return "";
@@ -57,14 +84,14 @@ export async function cmdExec(args) {
57
84
  }
58
85
  if (!prompt) {
59
86
  throw new Error(
60
- 'apx exec: prompt is empty. Usage: apx exec "prompt" | apx exec -a <agent> "prompt" | apx exec -- "prompt"'
87
+ 'apx exec: prompt is empty. Usage: apx exec "prompt" | apx exec --code "prompt" | apx exec -a <agent> "prompt" | apx exec -- "prompt"'
61
88
  );
62
89
  }
63
90
 
64
91
  const pid = await resolveProjectId(args?.flags?.project);
65
92
  const body = {
66
93
  prompt,
67
- channel: CHANNELS.CLI,
94
+ channel: resolveExecChannel(args),
68
95
  channelMeta: { cwd: process.cwd() },
69
96
  };
70
97
  if (args.flags.model && args.flags.model !== true) body.model = args.flags.model;
@@ -1100,12 +1100,15 @@ const HELP_TOPICS = new Map(Object.entries({
1100
1100
  summary: "One-shot LLM call. Default target is the APX super-agent (daemon); use -a for an APC agent slug.",
1101
1101
  usage: [
1102
1102
  "apx exec \"<prompt>\" [--model <id>] [--project <name|id|path>]",
1103
+ "apx exec --code \"<prompt>\" (coding channel: code system prompt + git tools)",
1103
1104
  "apx exec -- \"<prompt>\"",
1104
1105
  "apx exec -a <agent> \"<prompt>\" [--model <id>]",
1105
1106
  "apx exec <agent> \"<prompt>\" (legacy positional agent)",
1106
1107
  ],
1107
1108
  options: [
1108
1109
  ["-a, --agent <slug>", "APC agent slug (omit for super-agent default)."],
1110
+ ["-c, --code", "Run on the 'code' channel (coding system prompt + code tools)."],
1111
+ ["--channel <name>", "Explicit channel (cli, code, api, …). Default cli."],
1109
1112
  ["--model <id>", "Override configured model."],
1110
1113
  ["--max-tokens N", "Output token limit."],
1111
1114
  ["--temperature T", "Sampling temperature."],
@@ -1113,6 +1116,7 @@ const HELP_TOPICS = new Map(Object.entries({
1113
1116
  ],
1114
1117
  examples: [
1115
1118
  "apx exec \"What time is it in UTC?\"",
1119
+ "apx exec --code \"refactor the auth middleware\"",
1116
1120
  "apx exec -- \"decime qué hora es\"",
1117
1121
  "apx exec -a reviewer \"Summarize your role\"",
1118
1122
  "apx exec reviewer \"Summarize your role\" --model gpt-5.2",
@@ -2090,7 +2094,7 @@ function buildHelp(version) {
2090
2094
 
2091
2095
  hSec("LLM / Code"),
2092
2096
  hCmd("apx code", 36, "APX terminal coding assistant"),
2093
- hCmd("apx exec \"prompt\"", 36, "super-agent (default) --model <id> -a <agent> for APC slug"),
2097
+ hCmd("apx exec \"prompt\"", 36, "super-agent (default) --code coding channel -a <agent> for APC slug"),
2094
2098
  hCmd("apx chat <agent>", 36, "interactive agent REPL --conversation <id>"),
2095
2099
  hCmd("apx search \"query\"", 36, "web search (ddg | brave | browser) --mode <m> -n N"),
2096
2100
  hCmd("apx conversations list", 36, "stored exec/chat conversations for <agent>"),
@@ -2241,6 +2245,11 @@ function findHelpTopic(argv) {
2241
2245
  return { global: true };
2242
2246
  }
2243
2247
 
2248
+ // Flags that never take a value. Without this the parser would greedily
2249
+ // swallow the following positional (e.g. `apx exec --code "hi"` would set
2250
+ // flags.code = "hi" and drop the prompt). Boolean flags always resolve to true.
2251
+ const BOOLEAN_FLAGS = new Set(["code", "verbose"]);
2252
+
2244
2253
  function parseArgs(argv) {
2245
2254
  const args = { _: [], flags: {} };
2246
2255
  for (let i = 0; i < argv.length; i++) {
@@ -2253,7 +2262,9 @@ function parseArgs(argv) {
2253
2262
  if (a.startsWith("--")) {
2254
2263
  const key = a.slice(2);
2255
2264
  const next = argv[i + 1];
2256
- if (next === undefined || next.startsWith("--")) {
2265
+ if (BOOLEAN_FLAGS.has(key)) {
2266
+ args.flags[key] = true;
2267
+ } else if (next === undefined || next.startsWith("--")) {
2257
2268
  args.flags[key] = true;
2258
2269
  } else {
2259
2270
  // support repeated flags (e.g. --env A=1 --env B=2)
@@ -2269,6 +2280,8 @@ function parseArgs(argv) {
2269
2280
  args.flags.n = argv[++i];
2270
2281
  } else if (a === "-a") {
2271
2282
  args.flags.agent = argv[++i];
2283
+ } else if (a === "-c") {
2284
+ args.flags.code = true;
2272
2285
  } else {
2273
2286
  args._.push(a);
2274
2287
  }