cnagent 2.1.11 → 2.1.12
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/package.json +1 -1
- package/tools/dist/cn.js +248 -3
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.12";
|
|
13019
13019
|
module2.exports = {
|
|
13020
13020
|
starts_with,
|
|
13021
13021
|
strip_prefix,
|
|
@@ -29715,13 +29715,258 @@ function archive_io_pair(hub_path) {
|
|
|
29715
29715
|
const logs_out = Path.join(hub_path, "logs/output");
|
|
29716
29716
|
ensure_dir(logs_in);
|
|
29717
29717
|
ensure_dir(logs_out);
|
|
29718
|
+
const output_content = Fs.readFileSync(outp, "utf8");
|
|
29718
29719
|
const archive_name = match2 + ".md";
|
|
29719
29720
|
const prim1 = Fs.readFileSync(inp, "utf8");
|
|
29720
29721
|
const prim0 = Path.join(logs_in, archive_name);
|
|
29721
29722
|
Fs.writeFileSync(prim0, prim1);
|
|
29722
|
-
const prim1$1 = Fs.readFileSync(outp, "utf8");
|
|
29723
29723
|
const prim0$1 = Path.join(logs_out, archive_name);
|
|
29724
|
-
Fs.writeFileSync(prim0$1,
|
|
29724
|
+
Fs.writeFileSync(prim0$1, output_content);
|
|
29725
|
+
const output_meta = Cn_lib.parse_frontmatter(output_content);
|
|
29726
|
+
const match$2 = Stdlib__List.find_opt((function(param) {
|
|
29727
|
+
return param[0] === "mca";
|
|
29728
|
+
}), output_meta);
|
|
29729
|
+
if (match$2 !== void 0) {
|
|
29730
|
+
const mca_text = match$2[1];
|
|
29731
|
+
const mca_id = Curry._1(Stdlib__Printf.sprintf({
|
|
29732
|
+
TAG: (
|
|
29733
|
+
/* Format */
|
|
29734
|
+
0
|
|
29735
|
+
),
|
|
29736
|
+
_0: {
|
|
29737
|
+
TAG: (
|
|
29738
|
+
/* String_literal */
|
|
29739
|
+
11
|
|
29740
|
+
),
|
|
29741
|
+
_0: "mca-",
|
|
29742
|
+
_1: {
|
|
29743
|
+
TAG: (
|
|
29744
|
+
/* String */
|
|
29745
|
+
2
|
|
29746
|
+
),
|
|
29747
|
+
_0: (
|
|
29748
|
+
/* No_padding */
|
|
29749
|
+
0
|
|
29750
|
+
),
|
|
29751
|
+
_1: (
|
|
29752
|
+
/* End_of_format */
|
|
29753
|
+
0
|
|
29754
|
+
)
|
|
29755
|
+
}
|
|
29756
|
+
},
|
|
29757
|
+
_1: "mca-%s"
|
|
29758
|
+
}), match2);
|
|
29759
|
+
const mca_content = Curry._4(Stdlib__Printf.sprintf({
|
|
29760
|
+
TAG: (
|
|
29761
|
+
/* Format */
|
|
29762
|
+
0
|
|
29763
|
+
),
|
|
29764
|
+
_0: {
|
|
29765
|
+
TAG: (
|
|
29766
|
+
/* String_literal */
|
|
29767
|
+
11
|
|
29768
|
+
),
|
|
29769
|
+
_0: "---\nid: ",
|
|
29770
|
+
_1: {
|
|
29771
|
+
TAG: (
|
|
29772
|
+
/* String */
|
|
29773
|
+
2
|
|
29774
|
+
),
|
|
29775
|
+
_0: (
|
|
29776
|
+
/* No_padding */
|
|
29777
|
+
0
|
|
29778
|
+
),
|
|
29779
|
+
_1: {
|
|
29780
|
+
TAG: (
|
|
29781
|
+
/* String_literal */
|
|
29782
|
+
11
|
|
29783
|
+
),
|
|
29784
|
+
_0: "\ntype: mca-feedback\noriginal: ",
|
|
29785
|
+
_1: {
|
|
29786
|
+
TAG: (
|
|
29787
|
+
/* String */
|
|
29788
|
+
2
|
|
29789
|
+
),
|
|
29790
|
+
_0: (
|
|
29791
|
+
/* No_padding */
|
|
29792
|
+
0
|
|
29793
|
+
),
|
|
29794
|
+
_1: {
|
|
29795
|
+
TAG: (
|
|
29796
|
+
/* String_literal */
|
|
29797
|
+
11
|
|
29798
|
+
),
|
|
29799
|
+
_0: "\n---\n\n# MCA Reinforcement\n\nYou identified this MCA during processing of ",
|
|
29800
|
+
_1: {
|
|
29801
|
+
TAG: (
|
|
29802
|
+
/* String */
|
|
29803
|
+
2
|
|
29804
|
+
),
|
|
29805
|
+
_0: (
|
|
29806
|
+
/* No_padding */
|
|
29807
|
+
0
|
|
29808
|
+
),
|
|
29809
|
+
_1: {
|
|
29810
|
+
TAG: (
|
|
29811
|
+
/* String_literal */
|
|
29812
|
+
11
|
|
29813
|
+
),
|
|
29814
|
+
_0: ":\n\n> ",
|
|
29815
|
+
_1: {
|
|
29816
|
+
TAG: (
|
|
29817
|
+
/* String */
|
|
29818
|
+
2
|
|
29819
|
+
),
|
|
29820
|
+
_0: (
|
|
29821
|
+
/* No_padding */
|
|
29822
|
+
0
|
|
29823
|
+
),
|
|
29824
|
+
_1: {
|
|
29825
|
+
TAG: (
|
|
29826
|
+
/* String_literal */
|
|
29827
|
+
11
|
|
29828
|
+
),
|
|
29829
|
+
_0: "\n\nApply this pattern next time.\n",
|
|
29830
|
+
_1: (
|
|
29831
|
+
/* End_of_format */
|
|
29832
|
+
0
|
|
29833
|
+
)
|
|
29834
|
+
}
|
|
29835
|
+
}
|
|
29836
|
+
}
|
|
29837
|
+
}
|
|
29838
|
+
}
|
|
29839
|
+
}
|
|
29840
|
+
}
|
|
29841
|
+
}
|
|
29842
|
+
},
|
|
29843
|
+
_1: "---\nid: %s\ntype: mca-feedback\noriginal: %s\n---\n\n# MCA Reinforcement\n\nYou identified this MCA during processing of %s:\n\n> %s\n\nApply this pattern next time.\n"
|
|
29844
|
+
}), mca_id, match2, match2, mca_text);
|
|
29845
|
+
const qdir = Path.join(hub_path, "state/queue");
|
|
29846
|
+
ensure_dir(qdir);
|
|
29847
|
+
const qfile = Path.join(qdir, Curry._2(Stdlib__Printf.sprintf({
|
|
29848
|
+
TAG: (
|
|
29849
|
+
/* Format */
|
|
29850
|
+
0
|
|
29851
|
+
),
|
|
29852
|
+
_0: {
|
|
29853
|
+
TAG: (
|
|
29854
|
+
/* String */
|
|
29855
|
+
2
|
|
29856
|
+
),
|
|
29857
|
+
_0: (
|
|
29858
|
+
/* No_padding */
|
|
29859
|
+
0
|
|
29860
|
+
),
|
|
29861
|
+
_1: {
|
|
29862
|
+
TAG: (
|
|
29863
|
+
/* Char_literal */
|
|
29864
|
+
12
|
|
29865
|
+
),
|
|
29866
|
+
_0: (
|
|
29867
|
+
/* '-' */
|
|
29868
|
+
45
|
|
29869
|
+
),
|
|
29870
|
+
_1: {
|
|
29871
|
+
TAG: (
|
|
29872
|
+
/* String */
|
|
29873
|
+
2
|
|
29874
|
+
),
|
|
29875
|
+
_0: (
|
|
29876
|
+
/* No_padding */
|
|
29877
|
+
0
|
|
29878
|
+
),
|
|
29879
|
+
_1: {
|
|
29880
|
+
TAG: (
|
|
29881
|
+
/* String_literal */
|
|
29882
|
+
11
|
|
29883
|
+
),
|
|
29884
|
+
_0: ".md",
|
|
29885
|
+
_1: (
|
|
29886
|
+
/* End_of_format */
|
|
29887
|
+
0
|
|
29888
|
+
)
|
|
29889
|
+
}
|
|
29890
|
+
}
|
|
29891
|
+
}
|
|
29892
|
+
},
|
|
29893
|
+
_1: "%s-%s.md"
|
|
29894
|
+
}), (/* @__PURE__ */ new Date()).toISOString(), mca_id));
|
|
29895
|
+
Fs.writeFileSync(qfile, mca_content);
|
|
29896
|
+
log_action(hub_path, "mca.queued", Curry._2(Stdlib__Printf.sprintf({
|
|
29897
|
+
TAG: (
|
|
29898
|
+
/* Format */
|
|
29899
|
+
0
|
|
29900
|
+
),
|
|
29901
|
+
_0: {
|
|
29902
|
+
TAG: (
|
|
29903
|
+
/* String_literal */
|
|
29904
|
+
11
|
|
29905
|
+
),
|
|
29906
|
+
_0: "id:",
|
|
29907
|
+
_1: {
|
|
29908
|
+
TAG: (
|
|
29909
|
+
/* String */
|
|
29910
|
+
2
|
|
29911
|
+
),
|
|
29912
|
+
_0: (
|
|
29913
|
+
/* No_padding */
|
|
29914
|
+
0
|
|
29915
|
+
),
|
|
29916
|
+
_1: {
|
|
29917
|
+
TAG: (
|
|
29918
|
+
/* String_literal */
|
|
29919
|
+
11
|
|
29920
|
+
),
|
|
29921
|
+
_0: " mca:",
|
|
29922
|
+
_1: {
|
|
29923
|
+
TAG: (
|
|
29924
|
+
/* String */
|
|
29925
|
+
2
|
|
29926
|
+
),
|
|
29927
|
+
_0: (
|
|
29928
|
+
/* No_padding */
|
|
29929
|
+
0
|
|
29930
|
+
),
|
|
29931
|
+
_1: (
|
|
29932
|
+
/* End_of_format */
|
|
29933
|
+
0
|
|
29934
|
+
)
|
|
29935
|
+
}
|
|
29936
|
+
}
|
|
29937
|
+
}
|
|
29938
|
+
},
|
|
29939
|
+
_1: "id:%s mca:%s"
|
|
29940
|
+
}), match2, mca_text));
|
|
29941
|
+
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
29942
|
+
TAG: (
|
|
29943
|
+
/* Format */
|
|
29944
|
+
0
|
|
29945
|
+
),
|
|
29946
|
+
_0: {
|
|
29947
|
+
TAG: (
|
|
29948
|
+
/* String_literal */
|
|
29949
|
+
11
|
|
29950
|
+
),
|
|
29951
|
+
_0: "MCA queued for feedback: ",
|
|
29952
|
+
_1: {
|
|
29953
|
+
TAG: (
|
|
29954
|
+
/* String */
|
|
29955
|
+
2
|
|
29956
|
+
),
|
|
29957
|
+
_0: (
|
|
29958
|
+
/* No_padding */
|
|
29959
|
+
0
|
|
29960
|
+
),
|
|
29961
|
+
_1: (
|
|
29962
|
+
/* End_of_format */
|
|
29963
|
+
0
|
|
29964
|
+
)
|
|
29965
|
+
}
|
|
29966
|
+
},
|
|
29967
|
+
_1: "MCA queued for feedback: %s"
|
|
29968
|
+
}), mca_text)));
|
|
29969
|
+
}
|
|
29725
29970
|
Fs.unlinkSync(inp);
|
|
29726
29971
|
Fs.unlinkSync(outp);
|
|
29727
29972
|
log_action(hub_path, "io.archive", Curry._1(Stdlib__Printf.sprintf({
|