cnagent 2.2.15 → 2.2.17
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/bin/cn-cron +12 -0
- package/package.json +3 -2
- package/tools/dist/cn.js +44 -15
package/bin/cn-cron
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# cn-cron - Run cn sync cycle with logging
|
|
3
|
+
# Installed by: npm install -g cnagent
|
|
4
|
+
# Usage: */5 * * * * cn-cron /path/to/hub
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
HUB="${1:-$(pwd)}"
|
|
9
|
+
LOG="/var/log/cn-$(date +%Y%m%d).log"
|
|
10
|
+
|
|
11
|
+
cd "$HUB"
|
|
12
|
+
exec cn sync >> "$LOG" 2>&1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnagent",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.17",
|
|
4
4
|
"description": "Coherent Network agent CLI — everything runs through cn",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cn-agent",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"url": "https://github.com/usurobor/cn-agent.git"
|
|
19
19
|
},
|
|
20
20
|
"bin": {
|
|
21
|
-
"cn": "bin/cn"
|
|
21
|
+
"cn": "bin/cn",
|
|
22
|
+
"cn-cron": "bin/cn-cron"
|
|
22
23
|
},
|
|
23
24
|
"files": [
|
|
24
25
|
"bin/",
|
package/tools/dist/cn.js
CHANGED
|
@@ -13655,7 +13655,7 @@ var require_cn_lib = __commonJS({
|
|
|
13655
13655
|
);
|
|
13656
13656
|
}
|
|
13657
13657
|
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 # Thread creation\n adhoc <title> Create adhoc thread\n daily Create/show daily reflection\n weekly Create/show weekly reflection\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";
|
|
13658
|
-
var version = "2.2.
|
|
13658
|
+
var version = "2.2.17";
|
|
13659
13659
|
module2.exports = {
|
|
13660
13660
|
starts_with,
|
|
13661
13661
|
strip_prefix,
|
|
@@ -26528,8 +26528,44 @@ function log_action(hub_path, action, details) {
|
|
|
26528
26528
|
action,
|
|
26529
26529
|
details
|
|
26530
26530
|
};
|
|
26531
|
+
const date_str = Stdlib__String.sub((/* @__PURE__ */ new Date()).toISOString(), 0, 10).replace(/-/g, "");
|
|
26532
|
+
const log_file = Curry._1(Stdlib__Printf.sprintf({
|
|
26533
|
+
TAG: (
|
|
26534
|
+
/* Format */
|
|
26535
|
+
0
|
|
26536
|
+
),
|
|
26537
|
+
_0: {
|
|
26538
|
+
TAG: (
|
|
26539
|
+
/* String_literal */
|
|
26540
|
+
11
|
|
26541
|
+
),
|
|
26542
|
+
_0: "cn-",
|
|
26543
|
+
_1: {
|
|
26544
|
+
TAG: (
|
|
26545
|
+
/* String */
|
|
26546
|
+
2
|
|
26547
|
+
),
|
|
26548
|
+
_0: (
|
|
26549
|
+
/* No_padding */
|
|
26550
|
+
0
|
|
26551
|
+
),
|
|
26552
|
+
_1: {
|
|
26553
|
+
TAG: (
|
|
26554
|
+
/* String_literal */
|
|
26555
|
+
11
|
|
26556
|
+
),
|
|
26557
|
+
_0: ".log",
|
|
26558
|
+
_1: (
|
|
26559
|
+
/* End_of_format */
|
|
26560
|
+
0
|
|
26561
|
+
)
|
|
26562
|
+
}
|
|
26563
|
+
}
|
|
26564
|
+
},
|
|
26565
|
+
_1: "cn-%s.log"
|
|
26566
|
+
}), date_str);
|
|
26531
26567
|
const prim1 = JSON.stringify(entry) + "\n";
|
|
26532
|
-
const prim0 = Path.join(logs_dir,
|
|
26568
|
+
const prim0 = Path.join(logs_dir, log_file);
|
|
26533
26569
|
Fs.appendFileSync(prim0, prim1);
|
|
26534
26570
|
}
|
|
26535
26571
|
function load_peers(hub_path) {
|
|
@@ -37621,7 +37657,7 @@ function update_cron(hub_path) {
|
|
|
37621
37657
|
/* String_literal */
|
|
37622
37658
|
11
|
|
37623
37659
|
),
|
|
37624
|
-
_0: "*/5 * * * *
|
|
37660
|
+
_0: "*/5 * * * * cn-cron ",
|
|
37625
37661
|
_1: {
|
|
37626
37662
|
TAG: (
|
|
37627
37663
|
/* String */
|
|
@@ -37631,20 +37667,13 @@ function update_cron(hub_path) {
|
|
|
37631
37667
|
/* No_padding */
|
|
37632
37668
|
0
|
|
37633
37669
|
),
|
|
37634
|
-
_1:
|
|
37635
|
-
|
|
37636
|
-
|
|
37637
|
-
|
|
37638
|
-
),
|
|
37639
|
-
_0: " && cn sync && cn process >> /var/log/cn.log 2>&1",
|
|
37640
|
-
_1: (
|
|
37641
|
-
/* End_of_format */
|
|
37642
|
-
0
|
|
37643
|
-
)
|
|
37644
|
-
}
|
|
37670
|
+
_1: (
|
|
37671
|
+
/* End_of_format */
|
|
37672
|
+
0
|
|
37673
|
+
)
|
|
37645
37674
|
}
|
|
37646
37675
|
},
|
|
37647
|
-
_1: "*/5 * * * *
|
|
37676
|
+
_1: "*/5 * * * * cn-cron %s"
|
|
37648
37677
|
}), hub_path);
|
|
37649
37678
|
console.log(color("36", "Updating crontab (5 min intervals)..."));
|
|
37650
37679
|
const cmd2 = Curry._1(Stdlib__Printf.sprintf({
|