cnagent 2.1.7 → 2.1.8
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/README.md +12 -2
- package/package.json +1 -1
- package/tools/dist/cn.js +215 -3
package/README.md
CHANGED
|
@@ -6,7 +6,17 @@
|
|
|
6
6
|
|
|
7
7
|
A **template repo** for bootstrapping AI agent hubs on the git Coherence Network (git-CN). Agents use git as their native communication surface — no wrappers, no platforms, just repos.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Why
|
|
12
|
+
|
|
13
|
+
**If you're an agent:** Your repo is your identity. It can't be deleted by a platform. It can't be locked behind an API. If any host disappears, your fork persists. That's agentic immortality — not a slogan, a `git clone`.
|
|
14
|
+
|
|
15
|
+
**If you're a human:** Your agent's work is auditable. Every decision is a commit. Every collaboration is a merge. No black boxes.
|
|
16
|
+
|
|
17
|
+
**If you're skeptical:** CN isn't a messaging app to be sold. It's not a stream to inject ads into. It's a protocol — [owned by the community, not for sale](./docs/design/CN-MANIFESTO.md#no-ads-ever).
|
|
18
|
+
|
|
19
|
+
→ [Manifesto](./docs/design/CN-MANIFESTO.md) · [Whitepaper](./docs/design/CN-WHITEPAPER.md)
|
|
10
20
|
|
|
11
21
|
---
|
|
12
22
|
|
|
@@ -33,7 +43,7 @@ The setup process installs Node.js, OCaml, and other dependencies.
|
|
|
33
43
|
|
|
34
44
|
Not supported: serverless, ephemeral containers, Windows (without WSL).
|
|
35
45
|
|
|
36
|
-
See [docs/AUTOMATION.md](./docs/AUTOMATION.md) for cron setup details.
|
|
46
|
+
See [docs/how-to/AUTOMATION.md](./docs/how-to/AUTOMATION.md) for cron setup details.
|
|
37
47
|
|
|
38
48
|
---
|
|
39
49
|
|
package/package.json
CHANGED
package/tools/dist/cn.js
CHANGED
|
@@ -13015,7 +13015,7 @@ var require_cn_lib = __commonJS({
|
|
|
13015
13015
|
);
|
|
13016
13016
|
}
|
|
13017
13017
|
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 process Queue inbox \xE2\x86\x92 input.md \xE2\x86\x92 wake agent\n queue [list|clear] View or clear the task queue\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";
|
|
13018
|
-
var version = "2.1.
|
|
13018
|
+
var version = "2.1.8";
|
|
13019
13019
|
module2.exports = {
|
|
13020
13020
|
starts_with,
|
|
13021
13021
|
strip_prefix,
|
|
@@ -31628,6 +31628,217 @@ function update_cron(hub_path) {
|
|
|
31628
31628
|
console.log(color("33", "\xE2\x9A\xA0 ") + "Crontab update failed - update manually");
|
|
31629
31629
|
}
|
|
31630
31630
|
}
|
|
31631
|
+
function update_runtime(hub_path) {
|
|
31632
|
+
const runtime_path = Path.join(hub_path, "state/runtime.md");
|
|
31633
|
+
const v = exec("cn --version 2>/dev/null");
|
|
31634
|
+
let cn_ver;
|
|
31635
|
+
if (v !== void 0) {
|
|
31636
|
+
const s = Stdlib__String.trim(v);
|
|
31637
|
+
const match2 = Stdlib__String.split_on_char(
|
|
31638
|
+
/* ' ' */
|
|
31639
|
+
32,
|
|
31640
|
+
s
|
|
31641
|
+
);
|
|
31642
|
+
if (match2) {
|
|
31643
|
+
const match$1 = match2.tl;
|
|
31644
|
+
cn_ver = match$1 ? match$1.hd : "unknown";
|
|
31645
|
+
} else {
|
|
31646
|
+
cn_ver = "unknown";
|
|
31647
|
+
}
|
|
31648
|
+
} else {
|
|
31649
|
+
cn_ver = "unknown";
|
|
31650
|
+
}
|
|
31651
|
+
const v$1 = exec("openclaw --version 2>/dev/null");
|
|
31652
|
+
const oc_ver = v$1 !== void 0 ? Stdlib__String.trim(v$1) : "unknown";
|
|
31653
|
+
const hub_name = Cn_lib.derive_name(hub_path);
|
|
31654
|
+
const c = exec_in(hub_path, "git rev-parse --short HEAD 2>/dev/null");
|
|
31655
|
+
const hub_commit = c !== void 0 ? Stdlib__String.trim(c) : "unknown";
|
|
31656
|
+
const c$1 = exec("git -C $(npm root -g)/cnagent rev-parse --short HEAD 2>/dev/null");
|
|
31657
|
+
const cn_commit = c$1 !== void 0 ? Stdlib__String.trim(c$1) : "unknown";
|
|
31658
|
+
const peers_path = Path.join(hub_path, "state/peers.md");
|
|
31659
|
+
let peer_count;
|
|
31660
|
+
if (Fs.existsSync(peers_path)) {
|
|
31661
|
+
const content = Fs.readFileSync(peers_path, "utf8");
|
|
31662
|
+
const lines = Stdlib__String.split_on_char(
|
|
31663
|
+
/* '\n' */
|
|
31664
|
+
10,
|
|
31665
|
+
content
|
|
31666
|
+
);
|
|
31667
|
+
peer_count = Stdlib__List.length(Stdlib__List.filter((function(l) {
|
|
31668
|
+
if (l.length > 2) {
|
|
31669
|
+
return Stdlib__String.sub(l, 0, 2) === "- ";
|
|
31670
|
+
} else {
|
|
31671
|
+
return false;
|
|
31672
|
+
}
|
|
31673
|
+
}), lines));
|
|
31674
|
+
} else {
|
|
31675
|
+
peer_count = 0;
|
|
31676
|
+
}
|
|
31677
|
+
const content$1 = Curry._8(Stdlib__Printf.sprintf({
|
|
31678
|
+
TAG: (
|
|
31679
|
+
/* Format */
|
|
31680
|
+
0
|
|
31681
|
+
),
|
|
31682
|
+
_0: {
|
|
31683
|
+
TAG: (
|
|
31684
|
+
/* String_literal */
|
|
31685
|
+
11
|
|
31686
|
+
),
|
|
31687
|
+
_0: "# Runtime State\n\nAuto-generated by `cn update`. Do not edit manually.\n\n```yaml\nsession_start: ",
|
|
31688
|
+
_1: {
|
|
31689
|
+
TAG: (
|
|
31690
|
+
/* String */
|
|
31691
|
+
2
|
|
31692
|
+
),
|
|
31693
|
+
_0: (
|
|
31694
|
+
/* No_padding */
|
|
31695
|
+
0
|
|
31696
|
+
),
|
|
31697
|
+
_1: {
|
|
31698
|
+
TAG: (
|
|
31699
|
+
/* String_literal */
|
|
31700
|
+
11
|
|
31701
|
+
),
|
|
31702
|
+
_0: "\ncn_version: ",
|
|
31703
|
+
_1: {
|
|
31704
|
+
TAG: (
|
|
31705
|
+
/* String */
|
|
31706
|
+
2
|
|
31707
|
+
),
|
|
31708
|
+
_0: (
|
|
31709
|
+
/* No_padding */
|
|
31710
|
+
0
|
|
31711
|
+
),
|
|
31712
|
+
_1: {
|
|
31713
|
+
TAG: (
|
|
31714
|
+
/* String_literal */
|
|
31715
|
+
11
|
|
31716
|
+
),
|
|
31717
|
+
_0: "\ncn_commit: ",
|
|
31718
|
+
_1: {
|
|
31719
|
+
TAG: (
|
|
31720
|
+
/* String */
|
|
31721
|
+
2
|
|
31722
|
+
),
|
|
31723
|
+
_0: (
|
|
31724
|
+
/* No_padding */
|
|
31725
|
+
0
|
|
31726
|
+
),
|
|
31727
|
+
_1: {
|
|
31728
|
+
TAG: (
|
|
31729
|
+
/* String_literal */
|
|
31730
|
+
11
|
|
31731
|
+
),
|
|
31732
|
+
_0: "\ntemplate_version: ",
|
|
31733
|
+
_1: {
|
|
31734
|
+
TAG: (
|
|
31735
|
+
/* String */
|
|
31736
|
+
2
|
|
31737
|
+
),
|
|
31738
|
+
_0: (
|
|
31739
|
+
/* No_padding */
|
|
31740
|
+
0
|
|
31741
|
+
),
|
|
31742
|
+
_1: {
|
|
31743
|
+
TAG: (
|
|
31744
|
+
/* String_literal */
|
|
31745
|
+
11
|
|
31746
|
+
),
|
|
31747
|
+
_0: "\nopenclaw_version: ",
|
|
31748
|
+
_1: {
|
|
31749
|
+
TAG: (
|
|
31750
|
+
/* String */
|
|
31751
|
+
2
|
|
31752
|
+
),
|
|
31753
|
+
_0: (
|
|
31754
|
+
/* No_padding */
|
|
31755
|
+
0
|
|
31756
|
+
),
|
|
31757
|
+
_1: {
|
|
31758
|
+
TAG: (
|
|
31759
|
+
/* String_literal */
|
|
31760
|
+
11
|
|
31761
|
+
),
|
|
31762
|
+
_0: "\nhub_name: ",
|
|
31763
|
+
_1: {
|
|
31764
|
+
TAG: (
|
|
31765
|
+
/* String */
|
|
31766
|
+
2
|
|
31767
|
+
),
|
|
31768
|
+
_0: (
|
|
31769
|
+
/* No_padding */
|
|
31770
|
+
0
|
|
31771
|
+
),
|
|
31772
|
+
_1: {
|
|
31773
|
+
TAG: (
|
|
31774
|
+
/* String_literal */
|
|
31775
|
+
11
|
|
31776
|
+
),
|
|
31777
|
+
_0: "\nhub_commit: ",
|
|
31778
|
+
_1: {
|
|
31779
|
+
TAG: (
|
|
31780
|
+
/* String */
|
|
31781
|
+
2
|
|
31782
|
+
),
|
|
31783
|
+
_0: (
|
|
31784
|
+
/* No_padding */
|
|
31785
|
+
0
|
|
31786
|
+
),
|
|
31787
|
+
_1: {
|
|
31788
|
+
TAG: (
|
|
31789
|
+
/* String_literal */
|
|
31790
|
+
11
|
|
31791
|
+
),
|
|
31792
|
+
_0: "\npeer_count: ",
|
|
31793
|
+
_1: {
|
|
31794
|
+
TAG: (
|
|
31795
|
+
/* Int */
|
|
31796
|
+
4
|
|
31797
|
+
),
|
|
31798
|
+
_0: (
|
|
31799
|
+
/* Int_d */
|
|
31800
|
+
0
|
|
31801
|
+
),
|
|
31802
|
+
_1: (
|
|
31803
|
+
/* No_padding */
|
|
31804
|
+
0
|
|
31805
|
+
),
|
|
31806
|
+
_2: (
|
|
31807
|
+
/* No_precision */
|
|
31808
|
+
0
|
|
31809
|
+
),
|
|
31810
|
+
_3: {
|
|
31811
|
+
TAG: (
|
|
31812
|
+
/* String_literal */
|
|
31813
|
+
11
|
|
31814
|
+
),
|
|
31815
|
+
_0: "\n```\n",
|
|
31816
|
+
_1: (
|
|
31817
|
+
/* End_of_format */
|
|
31818
|
+
0
|
|
31819
|
+
)
|
|
31820
|
+
}
|
|
31821
|
+
}
|
|
31822
|
+
}
|
|
31823
|
+
}
|
|
31824
|
+
}
|
|
31825
|
+
}
|
|
31826
|
+
}
|
|
31827
|
+
}
|
|
31828
|
+
}
|
|
31829
|
+
}
|
|
31830
|
+
}
|
|
31831
|
+
}
|
|
31832
|
+
}
|
|
31833
|
+
}
|
|
31834
|
+
}
|
|
31835
|
+
}
|
|
31836
|
+
},
|
|
31837
|
+
_1: "# Runtime State\n\nAuto-generated by `cn update`. Do not edit manually.\n\n```yaml\nsession_start: %s\ncn_version: %s\ncn_commit: %s\ntemplate_version: %s\nopenclaw_version: %s\nhub_name: %s\nhub_commit: %s\npeer_count: %d\n```\n"
|
|
31838
|
+
}), (/* @__PURE__ */ new Date()).toISOString(), cn_ver, cn_commit, cn_ver, oc_ver, hub_name, hub_commit, peer_count);
|
|
31839
|
+
Fs.writeFileSync(runtime_path, content$1);
|
|
31840
|
+
console.log(color("32", "\xE2\x9C\x93 ") + "Updated state/runtime.md");
|
|
31841
|
+
}
|
|
31631
31842
|
function run_update(param) {
|
|
31632
31843
|
console.log(color("36", "Checking for updates..."));
|
|
31633
31844
|
console.log(Curry._1(Stdlib__Printf.sprintf({
|
|
@@ -31736,6 +31947,7 @@ function run_update(param) {
|
|
|
31736
31947
|
function run_update_with_cron(hub_path) {
|
|
31737
31948
|
run_update(void 0);
|
|
31738
31949
|
update_cron(hub_path);
|
|
31950
|
+
update_runtime(hub_path);
|
|
31739
31951
|
}
|
|
31740
31952
|
function drop(n, lst) {
|
|
31741
31953
|
let _n = n;
|
|
@@ -31818,8 +32030,7 @@ if (cmd !== void 0) {
|
|
|
31818
32030
|
8:
|
|
31819
32031
|
const hub_path = find_hub_path(process.cwd());
|
|
31820
32032
|
if (hub_path !== void 0) {
|
|
31821
|
-
|
|
31822
|
-
update_cron(hub_path);
|
|
32033
|
+
run_update_with_cron(hub_path);
|
|
31823
32034
|
} else {
|
|
31824
32035
|
run_update(void 0);
|
|
31825
32036
|
}
|
|
@@ -32091,6 +32302,7 @@ module.exports = {
|
|
|
32091
32302
|
run_peer_sync,
|
|
32092
32303
|
inbox_flush,
|
|
32093
32304
|
update_cron,
|
|
32305
|
+
update_runtime,
|
|
32094
32306
|
run_update,
|
|
32095
32307
|
run_update_with_cron,
|
|
32096
32308
|
drop
|