cnagent 2.2.4 → 2.2.6

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.
Files changed (2) hide show
  1. package/package.json +4 -1
  2. package/tools/dist/cn.js +29 -20
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnagent",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "Coherent Network agent CLI — everything runs through cn",
5
5
  "keywords": [
6
6
  "cn-agent",
@@ -35,5 +35,8 @@
35
35
  "license": "Apache-2.0",
36
36
  "engines": {
37
37
  "node": ">=18"
38
+ },
39
+ "dependencies": {
40
+ "yaml": "^2.8.2"
38
41
  }
39
42
  }
package/tools/dist/cn.js CHANGED
@@ -13598,7 +13598,7 @@ var require_cn_lib = __commonJS({
13598
13598
  );
13599
13599
  }
13600
13600
  var help_text = "cn - Coherent Network agent CLI\n\nUsage: cn <command> [options]\n\nCommands:\n # Agent decisions (output)\n delete <thread> GTD: discard\n defer <thread> GTD: postpone\n delegate <t> <peer> GTD: forward\n do <thread> GTD: claim/start\n done <thread> GTD: complete \xE2\x86\x92 archive\n reply <thread> <msg> Append to thread\n send <peer> <msg> Message to peer (or self)\n \n # cn operations (orchestrator)\n sync Fetch inbound + send outbound\n in Queue inbox \xE2\x86\x92 input.md \xE2\x86\x92 wake agent (alias: inbound, process)\n queue [list|clear] View or clear the task queue\n mca [list|add <desc>] Surface MCAs for community pickup\n inbox List inbox threads\n outbox List outbox threads\n next Get next inbox item (with cadence)\n read <thread> Read thread with cadence\n \n # Hub management\n init [name] Create new hub\n status Show hub state\n commit [msg] Stage + commit\n push Push to origin\n save [msg] Commit + push\n peer Manage peers\n doctor Health check\n update Update cn to latest version\n\nAliases:\n i = inbox, o = outbox, s = status, d = doctor\n\nFlags:\n --help, -h Show help\n --version, -V Show version\n --json Machine-readable output\n --quiet, -q Minimal output\n --dry-run Show what would happen\n\nActor Model:\n cn runs on cron (every 5 min). It:\n 1. Syncs peers \xE2\x86\x92 queues new inbox items to state/queue/\n 2. If input.md empty \xE2\x86\x92 pops from queue \xE2\x86\x92 writes input.md \xE2\x86\x92 wakes agent\n Agent reads input.md, processes, deletes when done.\n";
13601
- var version = "2.2.4";
13601
+ var version = "2.2.6";
13602
13602
  module2.exports = {
13603
13603
  starts_with,
13604
13604
  strip_prefix,
@@ -26292,6 +26292,7 @@ var Fs$1 = {
26292
26292
  ensure_dir
26293
26293
  };
26294
26294
  var Path$1 = {};
26295
+ var Yaml = {};
26295
26296
  function exec_in(cwd, cmd2) {
26296
26297
  let result;
26297
26298
  try {
@@ -26428,9 +26429,10 @@ function find_hub_path(_dir) {
26428
26429
  if (dir === "/") {
26429
26430
  return;
26430
26431
  }
26431
- const has_config = Fs.existsSync(Path.join(dir, ".cn/config.json"));
26432
+ const has_yaml = Fs.existsSync(Path.join(dir, ".cn/config.yaml"));
26433
+ const has_json = Fs.existsSync(Path.join(dir, ".cn/config.json"));
26432
26434
  const has_peers = Fs.existsSync(Path.join(dir, "state/peers.md"));
26433
- if (has_config || has_peers) {
26435
+ if (has_yaml || has_json || has_peers) {
26434
26436
  return dir;
26435
26437
  }
26436
26438
  _dir = Path.dirname(dir);
@@ -29708,14 +29710,17 @@ function run_doctor(hub_path) {
29708
29710
  const v = exec("git --version");
29709
29711
  const v$1 = exec("git config user.name");
29710
29712
  const v$2 = exec("git config user.email");
29711
- const p = Path.join(hub_path, ".cn/config.json");
29712
- const p$1 = Path.join(hub_path, "spec/SOUL.md");
29713
- const p$2 = Path.join(hub_path, "state/peers.md");
29713
+ const yaml_path = Path.join(hub_path, ".cn/config.yaml");
29714
+ const json_path = Path.join(hub_path, ".cn/config.json");
29715
+ const has_yaml = Fs.existsSync(yaml_path);
29716
+ const has_json = Fs.existsSync(json_path);
29717
+ const p = Path.join(hub_path, "spec/SOUL.md");
29718
+ const p$1 = Path.join(hub_path, "state/peers.md");
29714
29719
  let tmp;
29715
- if (Fs.existsSync(p$2)) {
29720
+ if (Fs.existsSync(p$1)) {
29716
29721
  const count = Stdlib__Option.value(Stdlib__Option.map((function(prim) {
29717
29722
  return prim.length;
29718
- }), Caml_option.null_to_opt(Fs.readFileSync(p$2, "utf8").match(/- name:/g))), 0);
29723
+ }), Caml_option.null_to_opt(Fs.readFileSync(p$1, "utf8").match(/- name:/g))), 0);
29719
29724
  tmp = {
29720
29725
  name: "state/peers.md",
29721
29726
  passed: true,
@@ -29801,15 +29806,15 @@ function run_doctor(hub_path) {
29801
29806
  },
29802
29807
  tl: {
29803
29808
  hd: {
29804
- name: ".cn/config.json",
29805
- passed: Fs.existsSync(p),
29806
- value: Fs.existsSync(p) ? "exists" : "missing"
29809
+ name: ".cn/config",
29810
+ passed: has_yaml || has_json,
29811
+ value: has_yaml ? "config.yaml" : has_json ? "config.json (migrate to .yaml)" : "missing"
29807
29812
  },
29808
29813
  tl: {
29809
29814
  hd: {
29810
29815
  name: "spec/SOUL.md",
29811
- passed: Fs.existsSync(p$1),
29812
- value: Fs.existsSync(p$1) ? "exists" : "missing (optional)"
29816
+ passed: Fs.existsSync(p),
29817
+ value: Fs.existsSync(p) ? "exists" : "missing (optional)"
29813
29818
  },
29814
29819
  tl: {
29815
29820
  hd: tmp,
@@ -34608,7 +34613,7 @@ function run_init(name) {
34608
34613
  /* String_literal */
34609
34614
  11
34610
34615
  ),
34611
- _0: '{\n "name": "',
34616
+ _0: "name: ",
34612
34617
  _1: {
34613
34618
  TAG: (
34614
34619
  /* String */
@@ -34623,7 +34628,7 @@ function run_init(name) {
34623
34628
  /* String_literal */
34624
34629
  11
34625
34630
  ),
34626
- _0: '",\n "version": "1.0.0",\n "created": "',
34631
+ _0: "\nversion: 1.0.0\ncreated: ",
34627
34632
  _1: {
34628
34633
  TAG: (
34629
34634
  /* String */
@@ -34635,10 +34640,13 @@ function run_init(name) {
34635
34640
  ),
34636
34641
  _1: {
34637
34642
  TAG: (
34638
- /* String_literal */
34639
- 11
34643
+ /* Char_literal */
34644
+ 12
34645
+ ),
34646
+ _0: (
34647
+ /* '\n' */
34648
+ 10
34640
34649
  ),
34641
- _0: '"\n}',
34642
34650
  _1: (
34643
34651
  /* End_of_format */
34644
34652
  0
@@ -34648,9 +34656,9 @@ function run_init(name) {
34648
34656
  }
34649
34657
  }
34650
34658
  },
34651
- _1: '{\n "name": "%s",\n "version": "1.0.0",\n "created": "%s"\n}'
34659
+ _1: "name: %s\nversion: 1.0.0\ncreated: %s\n"
34652
34660
  }), hub_name, (/* @__PURE__ */ new Date()).toISOString());
34653
- const prim0 = Path.join(hub_dir, ".cn/config.json");
34661
+ const prim0 = Path.join(hub_dir, ".cn/config.yaml");
34654
34662
  Fs.writeFileSync(prim0, config);
34655
34663
  const soul = Curry._3(Stdlib__Printf.sprintf({
34656
34664
  TAG: (
@@ -36207,6 +36215,7 @@ module.exports = {
36207
36215
  Process,
36208
36216
  Fs: Fs$1,
36209
36217
  Path: Path$1,
36218
+ Yaml,
36210
36219
  Child_process: Child_process$1,
36211
36220
  Json,
36212
36221
  now_iso,