cnagent 2.2.3 → 2.2.5
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 +50 -50
package/package.json
CHANGED
package/tools/dist/cn.js
CHANGED
|
@@ -11874,9 +11874,9 @@ var require_string = __commonJS({
|
|
|
11874
11874
|
}
|
|
11875
11875
|
});
|
|
11876
11876
|
|
|
11877
|
-
// _build/default/tools/src/cn/output/tools/src/cn/
|
|
11878
|
-
var
|
|
11879
|
-
"_build/default/tools/src/cn/output/tools/src/cn/
|
|
11877
|
+
// _build/default/tools/src/cn/output/tools/src/cn/cn_lib.js
|
|
11878
|
+
var require_cn_lib = __commonJS({
|
|
11879
|
+
"_build/default/tools/src/cn/output/tools/src/cn/cn_lib.js"(exports2, module2) {
|
|
11880
11880
|
"use strict";
|
|
11881
11881
|
var Caml_obj = require_caml_obj();
|
|
11882
11882
|
var Caml_option2 = require_caml_option();
|
|
@@ -13598,7 +13598,7 @@ var require_cn_ops = __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.
|
|
13601
|
+
var version = "2.2.5";
|
|
13602
13602
|
module2.exports = {
|
|
13603
13603
|
starts_with,
|
|
13604
13604
|
strip_prefix,
|
|
@@ -26239,7 +26239,7 @@ var require_printf = __commonJS({
|
|
|
26239
26239
|
var Caml = require_caml();
|
|
26240
26240
|
var Caml_js_exceptions = require_caml_js_exceptions();
|
|
26241
26241
|
var Caml_option = require_caml_option();
|
|
26242
|
-
var
|
|
26242
|
+
var Cn_lib = require_cn_lib();
|
|
26243
26243
|
var Curry = require_curry();
|
|
26244
26244
|
var Js__Js_dict = require_js_dict();
|
|
26245
26245
|
var Js__Js_exn = require_js_exn();
|
|
@@ -26453,7 +26453,7 @@ function log_action(hub_path, action, details) {
|
|
|
26453
26453
|
function load_peers(hub_path) {
|
|
26454
26454
|
const peers_path = Path.join(hub_path, "state/peers.md");
|
|
26455
26455
|
if (Fs.existsSync(peers_path)) {
|
|
26456
|
-
return
|
|
26456
|
+
return Cn_lib.parse_peers_md(Fs.readFileSync(peers_path, "utf8"));
|
|
26457
26457
|
} else {
|
|
26458
26458
|
return (
|
|
26459
26459
|
/* [] */
|
|
@@ -26462,10 +26462,10 @@ function load_peers(hub_path) {
|
|
|
26462
26462
|
}
|
|
26463
26463
|
}
|
|
26464
26464
|
function is_md_file(param) {
|
|
26465
|
-
return
|
|
26465
|
+
return Cn_lib.ends_with(".md", param);
|
|
26466
26466
|
}
|
|
26467
26467
|
function split_lines(s) {
|
|
26468
|
-
return Stdlib__List.filter(
|
|
26468
|
+
return Stdlib__List.filter(Cn_lib.non_empty, Stdlib__String.split_on_char(
|
|
26469
26469
|
/* '\n' */
|
|
26470
26470
|
10,
|
|
26471
26471
|
s
|
|
@@ -26892,7 +26892,7 @@ function materialize_branch(hub_path, inbox_dir, peer_name, branch) {
|
|
|
26892
26892
|
hd: meta_0,
|
|
26893
26893
|
tl: meta_1
|
|
26894
26894
|
};
|
|
26895
|
-
const prim1 =
|
|
26895
|
+
const prim1 = Cn_lib.update_frontmatter(content, meta);
|
|
26896
26896
|
Fs.writeFileSync(inbox_path, prim1);
|
|
26897
26897
|
log_action(hub_path, "inbox.materialize", inbox_file);
|
|
26898
26898
|
return inbox_file;
|
|
@@ -27047,7 +27047,7 @@ function outbox_check(hub_path) {
|
|
|
27047
27047
|
console.log(color("33", "\xE2\x9A\xA0 ") + msg);
|
|
27048
27048
|
return Stdlib__List.iter((function(f) {
|
|
27049
27049
|
const content = Fs.readFileSync(Path.join(outbox_dir, f), "utf8");
|
|
27050
|
-
const meta =
|
|
27050
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
27051
27051
|
const to_peer = Stdlib__Option.value(Stdlib__List.find_map((function(param) {
|
|
27052
27052
|
if (param[0] === "to") {
|
|
27053
27053
|
return param[1];
|
|
@@ -27108,7 +27108,7 @@ function outbox_check(hub_path) {
|
|
|
27108
27108
|
function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
27109
27109
|
const file_path = Path.join(outbox_dir, file);
|
|
27110
27110
|
const content = Fs.readFileSync(file_path, "utf8");
|
|
27111
|
-
const meta =
|
|
27111
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
27112
27112
|
const to_peer = Stdlib__List.find_map((function(param) {
|
|
27113
27113
|
if (param[0] === "to") {
|
|
27114
27114
|
return param[1];
|
|
@@ -27344,7 +27344,7 @@ function send_thread(hub_path, name, peers, outbox_dir, sent_dir, file) {
|
|
|
27344
27344
|
_1: "git push -u origin %s -f"
|
|
27345
27345
|
}), branch_name));
|
|
27346
27346
|
exec_in(clone_path, "git checkout main 2>/dev/null || git checkout master");
|
|
27347
|
-
const prim1 =
|
|
27347
|
+
const prim1 = Cn_lib.update_frontmatter(content, {
|
|
27348
27348
|
hd: [
|
|
27349
27349
|
"sent",
|
|
27350
27350
|
(/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -27845,7 +27845,7 @@ function get_next_inbox_item(hub_path) {
|
|
|
27845
27845
|
const file = param.hd;
|
|
27846
27846
|
const file_path = Path.join(inbox_dir, file);
|
|
27847
27847
|
const content = Fs.readFileSync(file_path, "utf8");
|
|
27848
|
-
const meta =
|
|
27848
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
27849
27849
|
const from = Stdlib__Option.value(Stdlib__List.find_map((function(param2) {
|
|
27850
27850
|
if (param2[0] === "from") {
|
|
27851
27851
|
return param2[1];
|
|
@@ -28155,7 +28155,7 @@ function gtd_defer(hub_path, thread_id, until) {
|
|
|
28155
28155
|
ensure_dir(deferred_dir);
|
|
28156
28156
|
const content = Fs.readFileSync(path, "utf8");
|
|
28157
28157
|
const until_str = Stdlib__Option.value(until, "unspecified");
|
|
28158
|
-
const prim1 =
|
|
28158
|
+
const prim1 = Cn_lib.update_frontmatter(content, {
|
|
28159
28159
|
hd: [
|
|
28160
28160
|
"deferred",
|
|
28161
28161
|
(/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -28290,7 +28290,7 @@ function gtd_delegate(hub_path, name, thread_id, peer) {
|
|
|
28290
28290
|
const outbox_dir = Path.join(hub_path, "threads/outbox");
|
|
28291
28291
|
ensure_dir(outbox_dir);
|
|
28292
28292
|
const content = Fs.readFileSync(path, "utf8");
|
|
28293
|
-
const prim1 =
|
|
28293
|
+
const prim1 = Cn_lib.update_frontmatter(content, {
|
|
28294
28294
|
hd: [
|
|
28295
28295
|
"to",
|
|
28296
28296
|
peer
|
|
@@ -28438,7 +28438,7 @@ function gtd_do(hub_path, thread_id) {
|
|
|
28438
28438
|
const doing_dir = Path.join(hub_path, "threads/doing");
|
|
28439
28439
|
ensure_dir(doing_dir);
|
|
28440
28440
|
const content = Fs.readFileSync(path, "utf8");
|
|
28441
|
-
const prim1 =
|
|
28441
|
+
const prim1 = Cn_lib.update_frontmatter(content, {
|
|
28442
28442
|
hd: [
|
|
28443
28443
|
"started",
|
|
28444
28444
|
(/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -28519,7 +28519,7 @@ function gtd_done(hub_path, thread_id) {
|
|
|
28519
28519
|
const archived_dir = Path.join(hub_path, "threads/archived");
|
|
28520
28520
|
ensure_dir(archived_dir);
|
|
28521
28521
|
const content = Fs.readFileSync(path, "utf8");
|
|
28522
|
-
const prim1 =
|
|
28522
|
+
const prim1 = Cn_lib.update_frontmatter(content, {
|
|
28523
28523
|
hd: [
|
|
28524
28524
|
"completed",
|
|
28525
28525
|
(/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -28605,8 +28605,8 @@ function run_read(hub_path, thread_id) {
|
|
|
28605
28605
|
const path = find_thread(hub_path, thread_id);
|
|
28606
28606
|
if (path !== void 0) {
|
|
28607
28607
|
const content = Fs.readFileSync(path, "utf8");
|
|
28608
|
-
const cadence =
|
|
28609
|
-
const meta =
|
|
28608
|
+
const cadence = Cn_lib.string_of_cadence(Cn_lib.cadence_of_path(path));
|
|
28609
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
28610
28610
|
Curry._1(Stdlib__Printf.printf({
|
|
28611
28611
|
TAG: (
|
|
28612
28612
|
/* Format */
|
|
@@ -28761,7 +28761,7 @@ function run_inbox_list(hub_path) {
|
|
|
28761
28761
|
if (ts) {
|
|
28762
28762
|
return Stdlib__List.iter((function(f) {
|
|
28763
28763
|
const id = Path.basename(f, ".md");
|
|
28764
|
-
const meta =
|
|
28764
|
+
const meta = Cn_lib.parse_frontmatter(Fs.readFileSync(Path.join(inbox_dir, f), "utf8"));
|
|
28765
28765
|
const from = Stdlib__Option.value(Stdlib__List.find_map((function(param) {
|
|
28766
28766
|
if (param[0] === "from") {
|
|
28767
28767
|
return param[1];
|
|
@@ -28833,7 +28833,7 @@ function run_outbox_list(hub_path) {
|
|
|
28833
28833
|
if (ts) {
|
|
28834
28834
|
return Stdlib__List.iter((function(f) {
|
|
28835
28835
|
const id = Path.basename(f, ".md");
|
|
28836
|
-
const meta =
|
|
28836
|
+
const meta = Cn_lib.parse_frontmatter(Fs.readFileSync(Path.join(outbox_dir, f), "utf8"));
|
|
28837
28837
|
const to_peer = Stdlib__Option.value(Stdlib__List.find_map((function(param) {
|
|
28838
28838
|
if (param[0] === "to") {
|
|
28839
28839
|
return param[1];
|
|
@@ -29662,7 +29662,7 @@ function run_status(hub_path, name) {
|
|
|
29662
29662
|
}
|
|
29663
29663
|
},
|
|
29664
29664
|
_1: "[status] ok version=%s"
|
|
29665
|
-
}),
|
|
29665
|
+
}), Cn_lib.version)));
|
|
29666
29666
|
}
|
|
29667
29667
|
function run_doctor(hub_path) {
|
|
29668
29668
|
Curry._1(Stdlib__Printf.printf({
|
|
@@ -29702,7 +29702,7 @@ function run_doctor(hub_path) {
|
|
|
29702
29702
|
}
|
|
29703
29703
|
},
|
|
29704
29704
|
_1: "cn v%s\n"
|
|
29705
|
-
}),
|
|
29705
|
+
}), Cn_lib.version);
|
|
29706
29706
|
console.log(color("36", "Checking health..."));
|
|
29707
29707
|
console.log("");
|
|
29708
29708
|
const v = exec("git --version");
|
|
@@ -30030,7 +30030,7 @@ function run_doctor(hub_path) {
|
|
|
30030
30030
|
}
|
|
30031
30031
|
},
|
|
30032
30032
|
_1: "[status] ok=%d warn=0 fail=%d version=%s"
|
|
30033
|
-
}), oks, fails,
|
|
30033
|
+
}), oks, fails, Cn_lib.version)));
|
|
30034
30034
|
}
|
|
30035
30035
|
function queue_dir(hub_path) {
|
|
30036
30036
|
return Path.join(hub_path, "state/queue");
|
|
@@ -30285,7 +30285,7 @@ function get_file_id(path) {
|
|
|
30285
30285
|
return;
|
|
30286
30286
|
}
|
|
30287
30287
|
const content = Fs.readFileSync(path, "utf8");
|
|
30288
|
-
const meta =
|
|
30288
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
30289
30289
|
return Stdlib__List.find_map((function(param) {
|
|
30290
30290
|
if (param[0] === "id") {
|
|
30291
30291
|
return param[1];
|
|
@@ -30841,7 +30841,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30841
30841
|
const outbox_dir$1 = Path.join(hub_path, "threads/outbox");
|
|
30842
30842
|
ensure_dir(outbox_dir$1);
|
|
30843
30843
|
const content$1 = Fs.readFileSync(path$1, "utf8");
|
|
30844
|
-
const prim1 =
|
|
30844
|
+
const prim1 = Cn_lib.update_frontmatter(content$1, {
|
|
30845
30845
|
hd: [
|
|
30846
30846
|
"to",
|
|
30847
30847
|
peer$1
|
|
@@ -30991,7 +30991,7 @@ function execute_op(hub_path, name, input_id, op) {
|
|
|
30991
30991
|
ensure_dir(deferred_dir);
|
|
30992
30992
|
const content$2 = Fs.readFileSync(path$2, "utf8");
|
|
30993
30993
|
const until_str = Stdlib__Option.value(op._1, "unspecified");
|
|
30994
|
-
const prim1$1 =
|
|
30994
|
+
const prim1$1 = Cn_lib.update_frontmatter(content$2, {
|
|
30995
30995
|
hd: [
|
|
30996
30996
|
"deferred",
|
|
30997
30997
|
(/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -31455,8 +31455,8 @@ function archive_io_pair(hub_path, name) {
|
|
|
31455
31455
|
Fs.writeFileSync(prim0, prim1);
|
|
31456
31456
|
const prim0$1 = Path.join(logs_out, archive_name);
|
|
31457
31457
|
Fs.writeFileSync(prim0$1, output_content);
|
|
31458
|
-
const output_meta =
|
|
31459
|
-
const ops =
|
|
31458
|
+
const output_meta = Cn_lib.parse_frontmatter(output_content);
|
|
31459
|
+
const ops = Cn_lib.extract_ops(output_meta);
|
|
31460
31460
|
Stdlib__List.iter((function(op) {
|
|
31461
31461
|
console.log(color("36", Curry._1(Stdlib__Printf.sprintf({
|
|
31462
31462
|
TAG: (
|
|
@@ -31485,7 +31485,7 @@ function archive_io_pair(hub_path, name) {
|
|
|
31485
31485
|
}
|
|
31486
31486
|
},
|
|
31487
31487
|
_1: "Executing: %s"
|
|
31488
|
-
}),
|
|
31488
|
+
}), Cn_lib.string_of_agent_op(op))));
|
|
31489
31489
|
execute_op(hub_path, name, match2, op);
|
|
31490
31490
|
}), ops);
|
|
31491
31491
|
Fs.unlinkSync(inp);
|
|
@@ -31615,7 +31615,7 @@ function queue_inbox_items(hub_path) {
|
|
|
31615
31615
|
return Stdlib__List.length(Stdlib__List.filter_map((function(file) {
|
|
31616
31616
|
const file_path = Path.join(inbox_dir, file);
|
|
31617
31617
|
const content = Fs.readFileSync(file_path, "utf8");
|
|
31618
|
-
const meta =
|
|
31618
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
31619
31619
|
const is_queued = Stdlib__List.exists((function(param) {
|
|
31620
31620
|
return param[0] === "queued-for-processing";
|
|
31621
31621
|
}), meta);
|
|
@@ -31629,7 +31629,7 @@ function queue_inbox_items(hub_path) {
|
|
|
31629
31629
|
}
|
|
31630
31630
|
}), meta), "unknown");
|
|
31631
31631
|
queue_add(hub_path, id, from, content);
|
|
31632
|
-
const prim1 =
|
|
31632
|
+
const prim1 = Cn_lib.update_frontmatter(content, {
|
|
31633
31633
|
hd: [
|
|
31634
31634
|
"queued-for-processing",
|
|
31635
31635
|
(/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -31708,7 +31708,7 @@ function feed_next_input(hub_path) {
|
|
|
31708
31708
|
if (content !== void 0) {
|
|
31709
31709
|
ensure_dir(Path.join(hub_path, "state"));
|
|
31710
31710
|
Fs.writeFileSync(inp, content);
|
|
31711
|
-
const meta =
|
|
31711
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
31712
31712
|
const id = Stdlib__Option.value(Stdlib__List.find_map((function(param) {
|
|
31713
31713
|
if (param[0] === "id") {
|
|
31714
31714
|
return param[1];
|
|
@@ -31929,7 +31929,7 @@ function run_queue_list(hub_path) {
|
|
|
31929
31929
|
return Stdlib__List.iter((function(file) {
|
|
31930
31930
|
const file_path = Path.join(Path.join(hub_path, "state/queue"), file);
|
|
31931
31931
|
const content = Fs.readFileSync(file_path, "utf8");
|
|
31932
|
-
const meta =
|
|
31932
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
31933
31933
|
const id = Stdlib__Option.value(Stdlib__List.find_map((function(param) {
|
|
31934
31934
|
if (param[0] === "id") {
|
|
31935
31935
|
return param[1];
|
|
@@ -32356,7 +32356,7 @@ function run_mca_list(hub_path) {
|
|
|
32356
32356
|
return Stdlib__List.iter((function(file) {
|
|
32357
32357
|
const file_path = Path.join(dir, file);
|
|
32358
32358
|
const content = Fs.readFileSync(file_path, "utf8");
|
|
32359
|
-
const meta =
|
|
32359
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
32360
32360
|
const id = Stdlib__Option.value(Stdlib__List.find_map((function(param) {
|
|
32361
32361
|
if (param[0] === "id") {
|
|
32362
32362
|
return param[1];
|
|
@@ -32406,7 +32406,7 @@ function run_mca_list(hub_path) {
|
|
|
32406
32406
|
const desc = Stdlib__Option.value(Stdlib__List.find_opt((function(l) {
|
|
32407
32407
|
const t = Stdlib__String.trim(l);
|
|
32408
32408
|
if (t !== "") {
|
|
32409
|
-
return !
|
|
32409
|
+
return !Cn_lib.starts_with("#", t);
|
|
32410
32410
|
} else {
|
|
32411
32411
|
return false;
|
|
32412
32412
|
}
|
|
@@ -32496,7 +32496,7 @@ function run_out(hub_path, name, gtd) {
|
|
|
32496
32496
|
const inp = Path.join(hub_path, "state/input.md");
|
|
32497
32497
|
const outp = Path.join(hub_path, "state/output.md");
|
|
32498
32498
|
const input_content = Fs.existsSync(inp) ? Fs.readFileSync(inp, "utf8") : "";
|
|
32499
|
-
const input_meta = input_content !== "" ?
|
|
32499
|
+
const input_meta = input_content !== "" ? Cn_lib.parse_frontmatter(input_content) : void 0;
|
|
32500
32500
|
const get_meta = function(key) {
|
|
32501
32501
|
if (input_meta !== void 0) {
|
|
32502
32502
|
return Stdlib__List.find_map((function(param) {
|
|
@@ -33820,7 +33820,7 @@ function queue_mca_review(hub_path) {
|
|
|
33820
33820
|
const mcas = Stdlib__List.sort(Stdlib__String.compare, Stdlib__List.filter(is_md_file, Stdlib__Array.to_list(Fs.readdirSync(dir))));
|
|
33821
33821
|
const mca_list = Stdlib__String.concat("\n", Stdlib__List.map((function(file) {
|
|
33822
33822
|
const content = Fs.readFileSync(Path.join(dir, file), "utf8");
|
|
33823
|
-
const meta =
|
|
33823
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
33824
33824
|
const id = Stdlib__Option.value(Stdlib__List.find_map((function(param) {
|
|
33825
33825
|
if (param[0] === "id") {
|
|
33826
33826
|
return param[1];
|
|
@@ -33870,7 +33870,7 @@ function queue_mca_review(hub_path) {
|
|
|
33870
33870
|
const desc = Stdlib__Option.value(Stdlib__List.find_opt((function(l) {
|
|
33871
33871
|
const t = Stdlib__String.trim(l);
|
|
33872
33872
|
if (t !== "") {
|
|
33873
|
-
return !
|
|
33873
|
+
return !Cn_lib.starts_with("#", t);
|
|
33874
33874
|
} else {
|
|
33875
33875
|
return false;
|
|
33876
33876
|
}
|
|
@@ -34329,7 +34329,7 @@ function update_runtime(hub_path) {
|
|
|
34329
34329
|
}
|
|
34330
34330
|
const v$1 = exec("openclaw --version 2>/dev/null");
|
|
34331
34331
|
const oc_ver = v$1 !== void 0 ? Stdlib__String.trim(v$1) : "unknown";
|
|
34332
|
-
const hub_name =
|
|
34332
|
+
const hub_name = Cn_lib.derive_name(hub_path);
|
|
34333
34333
|
const c = exec_in(hub_path, "git rev-parse --short HEAD 2>/dev/null");
|
|
34334
34334
|
const hub_commit = c !== void 0 ? Stdlib__String.trim(c) : "unknown";
|
|
34335
34335
|
const c$1 = exec("git -C $(npm root -g)/cnagent rev-parse --short HEAD 2>/dev/null");
|
|
@@ -35498,7 +35498,7 @@ function inbox_flush(hub_path, _name) {
|
|
|
35498
35498
|
const flushed = Stdlib__List.filter_map((function(file) {
|
|
35499
35499
|
const file_path = Path.join(inbox_dir, file);
|
|
35500
35500
|
const content = Fs.readFileSync(file_path, "utf8");
|
|
35501
|
-
const meta =
|
|
35501
|
+
const meta = Cn_lib.parse_frontmatter(content);
|
|
35502
35502
|
const is_triaged = Stdlib__List.exists((function(param) {
|
|
35503
35503
|
const k = param[0];
|
|
35504
35504
|
if (k === "reply" || k === "completed" || k === "deleted") {
|
|
@@ -35556,7 +35556,7 @@ function inbox_flush(hub_path, _name) {
|
|
|
35556
35556
|
exec_in(hub_path, delete_cmd);
|
|
35557
35557
|
const archived_dir = Path.join(hub_path, "threads/archived");
|
|
35558
35558
|
ensure_dir(archived_dir);
|
|
35559
|
-
const prim1 =
|
|
35559
|
+
const prim1 = Cn_lib.update_frontmatter(content, {
|
|
35560
35560
|
hd: [
|
|
35561
35561
|
"flushed",
|
|
35562
35562
|
(/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -35805,11 +35805,11 @@ function run_update(param) {
|
|
|
35805
35805
|
}
|
|
35806
35806
|
},
|
|
35807
35807
|
_1: "Current version: %s"
|
|
35808
|
-
}),
|
|
35808
|
+
}), Cn_lib.version));
|
|
35809
35809
|
const latest_raw = exec("npm view cnagent version 2>/dev/null");
|
|
35810
35810
|
if (latest_raw !== void 0) {
|
|
35811
35811
|
const latest = Stdlib__String.trim(latest_raw);
|
|
35812
|
-
if (latest ===
|
|
35812
|
+
if (latest === Cn_lib.version) {
|
|
35813
35813
|
console.log(color("32", "\xE2\x9C\x93 ") + "Already up to date");
|
|
35814
35814
|
return;
|
|
35815
35815
|
}
|
|
@@ -35928,9 +35928,9 @@ function drop(n, lst) {
|
|
|
35928
35928
|
;
|
|
35929
35929
|
}
|
|
35930
35930
|
var args = drop(2, Stdlib__Array.to_list(process.argv));
|
|
35931
|
-
var match =
|
|
35931
|
+
var match = Cn_lib.parse_flags(args);
|
|
35932
35932
|
var cmd_args = match[1];
|
|
35933
|
-
var cmd =
|
|
35933
|
+
var cmd = Cn_lib.parse_command(cmd_args);
|
|
35934
35934
|
if (cmd !== void 0) {
|
|
35935
35935
|
let exit = 0;
|
|
35936
35936
|
if (
|
|
@@ -35940,7 +35940,7 @@ if (cmd !== void 0) {
|
|
|
35940
35940
|
switch (cmd) {
|
|
35941
35941
|
case /* Help */
|
|
35942
35942
|
0:
|
|
35943
|
-
console.log(
|
|
35943
|
+
console.log(Cn_lib.help_text);
|
|
35944
35944
|
break;
|
|
35945
35945
|
case /* Version */
|
|
35946
35946
|
1:
|
|
@@ -35981,7 +35981,7 @@ if (cmd !== void 0) {
|
|
|
35981
35981
|
}
|
|
35982
35982
|
},
|
|
35983
35983
|
_1: "cn %s\n"
|
|
35984
|
-
}),
|
|
35984
|
+
}), Cn_lib.version);
|
|
35985
35985
|
break;
|
|
35986
35986
|
case /* Update */
|
|
35987
35987
|
8:
|
|
@@ -36004,7 +36004,7 @@ if (cmd !== void 0) {
|
|
|
36004
36004
|
if (exit === 1) {
|
|
36005
36005
|
const hub_path$1 = find_hub_path(process.cwd());
|
|
36006
36006
|
if (hub_path$1 !== void 0) {
|
|
36007
|
-
const name =
|
|
36007
|
+
const name = Cn_lib.derive_name(hub_path$1);
|
|
36008
36008
|
if (
|
|
36009
36009
|
/* tag */
|
|
36010
36010
|
typeof cmd === "number" || typeof cmd === "string"
|
|
@@ -36198,7 +36198,7 @@ if (cmd !== void 0) {
|
|
|
36198
36198
|
}), cmd_args.hd);
|
|
36199
36199
|
console.log(color("31", "\xE2\x9C\x97 ") + msg);
|
|
36200
36200
|
}
|
|
36201
|
-
console.log(
|
|
36201
|
+
console.log(Cn_lib.help_text);
|
|
36202
36202
|
process.exit(1);
|
|
36203
36203
|
}
|
|
36204
36204
|
var info = cyan;
|