cnagent 2.2.13 → 2.2.14

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 +1 -1
  2. package/tools/dist/cn.js +83 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnagent",
3
- "version": "2.2.13",
3
+ "version": "2.2.14",
4
4
  "description": "Coherent Network agent CLI — everything runs through cn",
5
5
  "keywords": [
6
6
  "cn-agent",
package/tools/dist/cn.js CHANGED
@@ -13618,7 +13618,7 @@ var require_cn_lib = __commonJS({
13618
13618
  );
13619
13619
  }
13620
13620
  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";
13621
- var version = "2.2.13";
13621
+ var version = "2.2.14";
13622
13622
  module2.exports = {
13623
13623
  starts_with,
13624
13624
  strip_prefix,
@@ -15275,7 +15275,7 @@ var require_camlinternalFormat = __commonJS({
15275
15275
  var CamlinternalFormatBasics = require_camlinternalFormatBasics();
15276
15276
  var Curry2 = require_curry();
15277
15277
  var Stdlib2 = require_stdlib();
15278
- var Stdlib__Buffer = require_buffer();
15278
+ var Stdlib__Buffer2 = require_buffer();
15279
15279
  var Stdlib__Bytes = require_bytes();
15280
15280
  var Stdlib__Char = require_char();
15281
15281
  var Stdlib__Int = require_int();
@@ -21776,7 +21776,7 @@ var require_camlinternalFormat = __commonJS({
21776
21776
  0:
21777
21777
  const s = string_of_formatting_lit(acc._1);
21778
21778
  bufput_acc(b, acc._0);
21779
- return Stdlib__Buffer.add_string(b, s);
21779
+ return Stdlib__Buffer2.add_string(b, s);
21780
21780
  case /* Acc_formatting_gen */
21781
21781
  1:
21782
21782
  const acc$p = acc._1;
@@ -21784,12 +21784,12 @@ var require_camlinternalFormat = __commonJS({
21784
21784
  if (acc$p.TAG === /* Acc_open_tag */
21785
21785
  0) {
21786
21786
  bufput_acc(b, p);
21787
- Stdlib__Buffer.add_string(b, "@{");
21787
+ Stdlib__Buffer2.add_string(b, "@{");
21788
21788
  _acc = acc$p._0;
21789
21789
  continue;
21790
21790
  }
21791
21791
  bufput_acc(b, p);
21792
- Stdlib__Buffer.add_string(b, "@[");
21792
+ Stdlib__Buffer2.add_string(b, "@[");
21793
21793
  _acc = acc$p._0;
21794
21794
  continue;
21795
21795
  case /* Acc_string_literal */
@@ -21823,10 +21823,10 @@ var require_camlinternalFormat = __commonJS({
21823
21823
  switch (exit) {
21824
21824
  case 1:
21825
21825
  bufput_acc(b, acc._0);
21826
- return Stdlib__Buffer.add_string(b, acc._1);
21826
+ return Stdlib__Buffer2.add_string(b, acc._1);
21827
21827
  case 2:
21828
21828
  bufput_acc(b, acc._0);
21829
- return Stdlib__Buffer.add_char(b, acc._1);
21829
+ return Stdlib__Buffer2.add_char(b, acc._1);
21830
21830
  }
21831
21831
  }
21832
21832
  ;
@@ -21846,7 +21846,7 @@ var require_camlinternalFormat = __commonJS({
21846
21846
  0:
21847
21847
  const s = string_of_formatting_lit(acc._1);
21848
21848
  strput_acc(b, acc._0);
21849
- return Stdlib__Buffer.add_string(b, s);
21849
+ return Stdlib__Buffer2.add_string(b, s);
21850
21850
  case /* Acc_formatting_gen */
21851
21851
  1:
21852
21852
  const acc$p = acc._1;
@@ -21854,12 +21854,12 @@ var require_camlinternalFormat = __commonJS({
21854
21854
  if (acc$p.TAG === /* Acc_open_tag */
21855
21855
  0) {
21856
21856
  strput_acc(b, p);
21857
- Stdlib__Buffer.add_string(b, "@{");
21857
+ Stdlib__Buffer2.add_string(b, "@{");
21858
21858
  _acc = acc$p._0;
21859
21859
  continue;
21860
21860
  }
21861
21861
  strput_acc(b, p);
21862
- Stdlib__Buffer.add_string(b, "@[");
21862
+ Stdlib__Buffer2.add_string(b, "@[");
21863
21863
  _acc = acc$p._0;
21864
21864
  continue;
21865
21865
  case /* Acc_string_literal */
@@ -21877,7 +21877,7 @@ var require_camlinternalFormat = __commonJS({
21877
21877
  case /* Acc_delay */
21878
21878
  6:
21879
21879
  strput_acc(b, acc._0);
21880
- return Stdlib__Buffer.add_string(b, Curry2._1(acc._1, void 0));
21880
+ return Stdlib__Buffer2.add_string(b, Curry2._1(acc._1, void 0));
21881
21881
  case /* Acc_flush */
21882
21882
  7:
21883
21883
  _acc = acc._0;
@@ -21893,19 +21893,19 @@ var require_camlinternalFormat = __commonJS({
21893
21893
  switch (exit) {
21894
21894
  case 1:
21895
21895
  strput_acc(b, acc._0);
21896
- return Stdlib__Buffer.add_string(b, acc._1);
21896
+ return Stdlib__Buffer2.add_string(b, acc._1);
21897
21897
  case 2:
21898
21898
  strput_acc(b, acc._0);
21899
- return Stdlib__Buffer.add_char(b, acc._1);
21899
+ return Stdlib__Buffer2.add_char(b, acc._1);
21900
21900
  }
21901
21901
  }
21902
21902
  ;
21903
21903
  }
21904
21904
  function failwith_message(param) {
21905
- const buf = Stdlib__Buffer.create(256);
21905
+ const buf = Stdlib__Buffer2.create(256);
21906
21906
  const k = function(acc) {
21907
21907
  strput_acc(buf, acc);
21908
- const s = Stdlib__Buffer.contents(buf);
21908
+ const s = Stdlib__Buffer2.contents(buf);
21909
21909
  throw new Caml_js_exceptions2.MelangeError("Failure", {
21910
21910
  MEL_EXN_ID: "Failure",
21911
21911
  _1: s
@@ -26169,7 +26169,7 @@ var require_printf = __commonJS({
26169
26169
  var CamlinternalFormat = require_camlinternalFormat();
26170
26170
  var Curry2 = require_curry();
26171
26171
  var Stdlib2 = require_stdlib();
26172
- var Stdlib__Buffer = require_buffer();
26172
+ var Stdlib__Buffer2 = require_buffer();
26173
26173
  function kfprintf(k, o, param) {
26174
26174
  return CamlinternalFormat.make_printf(
26175
26175
  (function(acc) {
@@ -26219,9 +26219,9 @@ var require_printf = __commonJS({
26219
26219
  }
26220
26220
  function ksprintf(k, param) {
26221
26221
  const k$p = function(acc) {
26222
- const buf = Stdlib__Buffer.create(64);
26222
+ const buf = Stdlib__Buffer2.create(64);
26223
26223
  CamlinternalFormat.strput_acc(buf, acc);
26224
- return Curry2._1(k, Stdlib__Buffer.contents(buf));
26224
+ return Curry2._1(k, Stdlib__Buffer2.contents(buf));
26225
26225
  };
26226
26226
  return CamlinternalFormat.make_printf(
26227
26227
  k$p,
@@ -26265,6 +26265,7 @@ var Js__Js_dict = require_js_dict();
26265
26265
  var Js__Js_exn = require_js_exn();
26266
26266
  var Stdlib = require_stdlib();
26267
26267
  var Stdlib__Array = require_array();
26268
+ var Stdlib__Buffer = require_buffer();
26268
26269
  var Stdlib__List = require_list();
26269
26270
  var Stdlib__Option = require_option();
26270
26271
  var Stdlib__Printf = require_printf();
@@ -33087,14 +33088,68 @@ function feed_next_input(hub_path) {
33087
33088
  console.log(ok("Queue empty - nothing to process"));
33088
33089
  return false;
33089
33090
  }
33090
- function wake_agent(param) {
33091
- console.log(color("36", "Triggering OpenClaw wake..."));
33092
- const match2 = exec("openclaw system event --text 'input.md ready' --mode now 2>/dev/null");
33093
- if (match2 !== void 0) {
33094
- console.log(ok("Wake triggered"));
33095
- } else {
33096
- console.log(warn("Wake trigger failed - is OpenClaw running?"));
33091
+ function shell_escape(s) {
33092
+ const buf = Stdlib__Buffer.create(s.length << 1);
33093
+ Stdlib__String.iter((function(c) {
33094
+ if (c === /* '\'' */
33095
+ 39) {
33096
+ return Stdlib__Buffer.add_string(buf, "'\\''");
33097
+ } else {
33098
+ return Stdlib__Buffer.add_char(buf, c);
33099
+ }
33100
+ }), s);
33101
+ return Stdlib__Buffer.contents(buf);
33102
+ }
33103
+ function wake_agent(hub_path) {
33104
+ const inp = Path.join(hub_path, "state/input.md");
33105
+ if (Fs.existsSync(inp)) {
33106
+ const content = Fs.readFileSync(inp, "utf8");
33107
+ const escaped = shell_escape(content);
33108
+ console.log(color("36", "Triggering OpenClaw wake with input content..."));
33109
+ const wake_cmd = Curry._1(Stdlib__Printf.sprintf({
33110
+ TAG: (
33111
+ /* Format */
33112
+ 0
33113
+ ),
33114
+ _0: {
33115
+ TAG: (
33116
+ /* String_literal */
33117
+ 11
33118
+ ),
33119
+ _0: "openclaw system event --text '",
33120
+ _1: {
33121
+ TAG: (
33122
+ /* String */
33123
+ 2
33124
+ ),
33125
+ _0: (
33126
+ /* No_padding */
33127
+ 0
33128
+ ),
33129
+ _1: {
33130
+ TAG: (
33131
+ /* String_literal */
33132
+ 11
33133
+ ),
33134
+ _0: "' --mode now 2>/dev/null",
33135
+ _1: (
33136
+ /* End_of_format */
33137
+ 0
33138
+ )
33139
+ }
33140
+ }
33141
+ },
33142
+ _1: "openclaw system event --text '%s' --mode now 2>/dev/null"
33143
+ }), escaped);
33144
+ const match2 = exec(wake_cmd);
33145
+ if (match2 !== void 0) {
33146
+ console.log(ok("Wake triggered with input content"));
33147
+ } else {
33148
+ console.log(warn("Wake trigger failed - is OpenClaw running?"));
33149
+ }
33150
+ return;
33097
33151
  }
33152
+ console.log(warn("No input.md to wake with"));
33098
33153
  }
33099
33154
  function run_sync(hub_path, name) {
33100
33155
  console.log(color("36", "Syncing..."));
@@ -35622,7 +35677,7 @@ function run_inbound(hub_path, name) {
35622
35677
  if (archive_io_pair(hub_path, name)) {
35623
35678
  auto_save(hub_path, name);
35624
35679
  if (feed_next_input(hub_path)) {
35625
- return wake_agent(void 0);
35680
+ return wake_agent(hub_path);
35626
35681
  } else {
35627
35682
  return;
35628
35683
  }
@@ -35669,7 +35724,7 @@ function run_inbound(hub_path, name) {
35669
35724
  }), queue_count(hub_path))));
35670
35725
  return;
35671
35726
  } else if (feed_next_input(hub_path)) {
35672
- return wake_agent(void 0);
35727
+ return wake_agent(hub_path);
35673
35728
  } else {
35674
35729
  return;
35675
35730
  }
@@ -37790,6 +37845,7 @@ module.exports = {
37790
37845
  archive_io_pair,
37791
37846
  queue_inbox_items,
37792
37847
  feed_next_input,
37848
+ shell_escape,
37793
37849
  wake_agent,
37794
37850
  run_sync,
37795
37851
  run_queue_list,