cnagent 2.2.8 → 2.2.9

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 +140 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnagent",
3
- "version": "2.2.8",
3
+ "version": "2.2.9",
4
4
  "description": "Coherent Network agent CLI — everything runs through cn",
5
5
  "keywords": [
6
6
  "cn-agent",
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.8";
13601
+ var version = "2.2.9";
13602
13602
  module2.exports = {
13603
13603
  starts_with,
13604
13604
  strip_prefix,
@@ -36259,6 +36259,143 @@ function run_update_with_cron(hub_path) {
36259
36259
  }
36260
36260
  console.log(color("2", "No runtime changes to commit"));
36261
36261
  }
36262
+ function self_update_check(param) {
36263
+ const args2 = Stdlib__Array.to_list(process.argv);
36264
+ const is_skip_cmd = Stdlib__List.exists((function(a) {
36265
+ if (a === "--help" || a === "-h" || a === "--version" || a === "-V") {
36266
+ return true;
36267
+ } else {
36268
+ return a === "help";
36269
+ }
36270
+ }), args2);
36271
+ if (is_skip_cmd) {
36272
+ return;
36273
+ }
36274
+ const latest_raw = exec("npm view cnagent version --fetch-timeout=5000 2>/dev/null");
36275
+ if (latest_raw === void 0) {
36276
+ return;
36277
+ }
36278
+ const latest = Stdlib__String.trim(latest_raw);
36279
+ if (!(latest !== Cn_lib.version && latest !== "")) {
36280
+ return;
36281
+ }
36282
+ console.log(color("36", Curry._2(Stdlib__Printf.sprintf({
36283
+ TAG: (
36284
+ /* Format */
36285
+ 0
36286
+ ),
36287
+ _0: {
36288
+ TAG: (
36289
+ /* String_literal */
36290
+ 11
36291
+ ),
36292
+ _0: "Updating cn ",
36293
+ _1: {
36294
+ TAG: (
36295
+ /* String */
36296
+ 2
36297
+ ),
36298
+ _0: (
36299
+ /* No_padding */
36300
+ 0
36301
+ ),
36302
+ _1: {
36303
+ TAG: (
36304
+ /* String_literal */
36305
+ 11
36306
+ ),
36307
+ _0: " \xE2\x86\x92 ",
36308
+ _1: {
36309
+ TAG: (
36310
+ /* String */
36311
+ 2
36312
+ ),
36313
+ _0: (
36314
+ /* No_padding */
36315
+ 0
36316
+ ),
36317
+ _1: {
36318
+ TAG: (
36319
+ /* String_literal */
36320
+ 11
36321
+ ),
36322
+ _0: "...",
36323
+ _1: (
36324
+ /* End_of_format */
36325
+ 0
36326
+ )
36327
+ }
36328
+ }
36329
+ }
36330
+ }
36331
+ },
36332
+ _1: "Updating cn %s \xE2\x86\x92 %s..."
36333
+ }), Cn_lib.version, latest)));
36334
+ const match2 = exec("npm install -g cnagent@latest 2>/dev/null");
36335
+ if (match2 !== void 0) {
36336
+ const msg = Curry._1(Stdlib__Printf.sprintf({
36337
+ TAG: (
36338
+ /* Format */
36339
+ 0
36340
+ ),
36341
+ _0: {
36342
+ TAG: (
36343
+ /* String_literal */
36344
+ 11
36345
+ ),
36346
+ _0: "Updated to cn ",
36347
+ _1: {
36348
+ TAG: (
36349
+ /* String */
36350
+ 2
36351
+ ),
36352
+ _0: (
36353
+ /* No_padding */
36354
+ 0
36355
+ ),
36356
+ _1: (
36357
+ /* End_of_format */
36358
+ 0
36359
+ )
36360
+ }
36361
+ },
36362
+ _1: "Updated to cn %s"
36363
+ }), latest);
36364
+ console.log(color("32", "\xE2\x9C\x93 ") + msg);
36365
+ const args_str = Stdlib__String.concat(" ", Stdlib__List.tl(args2));
36366
+ exec(Curry._1(Stdlib__Printf.sprintf({
36367
+ TAG: (
36368
+ /* Format */
36369
+ 0
36370
+ ),
36371
+ _0: {
36372
+ TAG: (
36373
+ /* String_literal */
36374
+ 11
36375
+ ),
36376
+ _0: "cn ",
36377
+ _1: {
36378
+ TAG: (
36379
+ /* String */
36380
+ 2
36381
+ ),
36382
+ _0: (
36383
+ /* No_padding */
36384
+ 0
36385
+ ),
36386
+ _1: (
36387
+ /* End_of_format */
36388
+ 0
36389
+ )
36390
+ }
36391
+ },
36392
+ _1: "cn %s"
36393
+ }), args_str));
36394
+ process.exit(0);
36395
+ return;
36396
+ }
36397
+ console.log(color("33", "\xE2\x9A\xA0 ") + "Self-update failed - continuing with current version");
36398
+ }
36262
36399
  function drop(n, lst) {
36263
36400
  let _n = n;
36264
36401
  let _lst = lst;
@@ -36280,6 +36417,7 @@ function drop(n, lst) {
36280
36417
  }
36281
36418
  ;
36282
36419
  }
36420
+ self_update_check(void 0);
36283
36421
  var args = drop(2, Stdlib__Array.to_list(process.argv));
36284
36422
  var match = Cn_lib.parse_flags(args);
36285
36423
  var cmd_args = match[1];
@@ -36647,5 +36785,6 @@ module.exports = {
36647
36785
  update_cron,
36648
36786
  run_update,
36649
36787
  run_update_with_cron,
36788
+ self_update_check,
36650
36789
  drop
36651
36790
  };