@event4u/agent-config 9.29.0 → 9.31.0
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +32 -214
- package/README.md +1 -0
- package/dist/agent-src/commands/analyze/inbox.md +22 -1
- package/dist/agent-src/commands/explain-run.md +31 -1
- package/dist/agent-src/commands/team/delegate.md +1 -0
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +4 -1
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +17 -0
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +11 -1
- package/dist/agent-src/rules/preservation-guard.md +9 -0
- package/dist/agent-src/scripts/roadmap_gates.ts +312 -0
- package/dist/agent-src/scripts/update_roadmap_progress.ts +72 -4
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +10 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/registry.js +2 -0
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/{chunk-RCIA67XN.js → chunk-2WCLVDWC.js} +45 -2
- package/dist/cli-delegate/{chunk-66OVWGB5.js → chunk-AG47LAGQ.js} +1 -1
- package/dist/cli-delegate/{chunk-MP3JT3IU.js → chunk-DS6BLDMG.js} +1 -1
- package/dist/cli-delegate/chunk-EJITJBJX.js +172 -0
- package/dist/cli-delegate/{chunk-NZ5N2XQL.js → chunk-ITIQSGOQ.js} +3 -3
- package/dist/cli-delegate/{chunk-LCFJIQ4J.js → chunk-JEJABGKB.js} +110 -6
- package/dist/cli-delegate/chunk-MMJL4TIX.js +18 -0
- package/dist/cli-delegate/{chunk-REKCMYOU.js → chunk-PFBV6XRT.js} +36 -20
- package/dist/cli-delegate/{chunk-OJM3MBJM.js → chunk-QEEB4LHO.js} +22 -35
- package/dist/cli-delegate/chunk-RVGBH4XK.js +142 -0
- package/dist/cli-delegate/{chunk-MMXA5GY7.js → chunk-UVKNIJH2.js} +14 -0
- package/dist/cli-delegate/cmd_analyze_session.js +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +1 -1
- package/dist/cli-delegate/cmd_conformance.js +2861 -96
- package/dist/cli-delegate/cmd_doctor.js +3 -2
- package/dist/cli-delegate/cmd_explain.js +2 -2
- package/dist/cli-delegate/cmd_export.js +4 -4
- package/dist/cli-delegate/cmd_handoff.js +87 -7
- package/dist/cli-delegate/cmd_mcp_available.js +1 -1
- package/dist/cli-delegate/cmd_migrate.js +2 -2
- package/dist/cli-delegate/cmd_packs_active.js +2 -2
- package/dist/cli-delegate/cmd_prune.js +4 -4
- package/dist/cli-delegate/cmd_route_audit.js +3 -2
- package/dist/cli-delegate/cmd_route_explain.js +1 -1
- package/dist/cli-delegate/cmd_session_recycle.js +177 -0
- package/dist/cli-delegate/cmd_settings_get.js +3 -56
- package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
- package/dist/cli-delegate/cmd_settings_set.js +2 -2
- package/dist/cli-delegate/cmd_sync.js +4 -4
- package/dist/cli-delegate/cmd_uninstall.js +4 -4
- package/dist/cli-delegate/cmd_update.js +1 -1
- package/dist/cli-delegate/cmd_upgrade.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +4 -4
- package/dist/cli-delegate/cmd_versions.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +7 -7
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +2143 -641
- package/dist/install/install.mjs +133 -14
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +3967 -761
- package/dist/scripts/_lib/agent_settings.js +111 -2
- package/dist/scripts/_lib/agent_settings.js.map +1 -1
- package/dist/server/schemas/settings.js +6 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/ui/assets/index-B5qGYOJo.js +26 -0
- package/dist/ui/assets/index-B5qGYOJo.js.map +1 -0
- package/dist/ui/index.html +1 -1
- package/docs/contracts/settings-classes.md +21 -5
- package/package.json +1 -1
- package/src/agent-src/scripts/roadmap_gates.ts +312 -0
- package/src/agent-src/scripts/update_roadmap_progress.ts +72 -4
- package/src/config/agent-settings.template.yml +36 -0
- package/src/config/dispatch-economy-metrics.json +61 -0
- package/src/config/evaluator-budgets.json +4 -4
- package/src/config/hook-token-budget.json +91 -0
- package/src/config/pack-size-budget.json +3 -2
- package/src/config/recycle-threshold-budget.json +12 -0
- package/src/config/rule-enforcement-baseline.json +86 -0
- package/src/scripts/_cli/cmd_conformance.ts +17 -2
- package/src/scripts/_cli/cmd_session_recycle.ts +226 -0
- package/src/scripts/_cli/explain_last/inputs.ts +13 -0
- package/src/scripts/_dispatch.bash +23 -0
- package/src/scripts/_lib/agent_settings.ts +119 -2
- package/src/scripts/_lib/carrier_divergence.ts +47 -0
- package/src/scripts/_lib/judgment_ladder.ts +254 -2
- package/src/scripts/_lib/orchestration_record.ts +41 -10
- package/src/scripts/_lib/recycle_envelope_paths.ts +35 -0
- package/src/scripts/_lib/self_repair.ts +194 -0
- package/src/scripts/_lib/session_eol.ts +230 -0
- package/src/scripts/_lib/session_role.ts +42 -0
- package/src/scripts/_lib/subagent_capsule.ts +159 -0
- package/src/scripts/_lib/subagent_response.ts +75 -0
- package/src/scripts/ai_council/clients.ts +50 -1
- package/src/scripts/ask_transport.ts +221 -0
- package/src/scripts/bench_hook_injection.ts +234 -0
- package/src/scripts/check_adr_frontmatter.ts +84 -40
- package/src/scripts/check_branch_freshness.ts +1 -0
- package/src/scripts/check_corpus_staleness.ts +18 -4
- package/src/scripts/check_detector_corpus.ts +17 -0
- package/src/scripts/check_gitignore_freshness.ts +42 -8
- package/src/scripts/check_hook_bundle_freshness.ts +20 -0
- package/src/scripts/check_kernel_prefix_stability.ts +1 -0
- package/src/scripts/check_standing_rule_delivery.ts +73 -32
- package/src/scripts/check_static_layer_stability.ts +154 -0
- package/src/scripts/check_suppression_hygiene.ts +48 -0
- package/src/scripts/dispatch_economy_report.ts +448 -0
- package/src/scripts/dispatch_r2_reviewer.ts +15 -2
- package/src/scripts/explain_run.ts +206 -4
- package/src/scripts/generate_settings_reference.ts +1 -0
- package/src/scripts/handoff_context_hook.ts +112 -4
- package/src/scripts/hook_manifest.yaml +117 -10
- package/src/scripts/hooks/concern_registry.ts +8 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +40 -3
- package/src/scripts/hooks/dispatch_hook.ts +39 -2
- package/src/scripts/hooks/edit_shape_hook.ts +303 -0
- package/src/scripts/hooks/orchestration_record_hook.ts +19 -1
- package/src/scripts/hooks/reread_guard_hook.ts +314 -0
- package/src/scripts/hooks/rtk_wrap_hook.ts +133 -14
- package/src/scripts/hooks/session_eol_hook.ts +268 -0
- package/src/scripts/hooks/turn_end_gate_hook.ts +715 -0
- package/src/scripts/install-hooks.sh +1 -1
- package/src/scripts/language_mirror_hook.ts +143 -1
- package/src/scripts/lint_decision_impact.ts +14 -1
- package/src/scripts/lint_hook_manifest.ts +82 -0
- package/src/scripts/lint_readme_serial_comma.ts +1 -0
- package/src/scripts/lint_rule_enforcement_declaration.ts +347 -0
- package/src/scripts/measure_turn_end_gate.ts +272 -0
- package/src/scripts/orchestration_record.ts +4 -1
- package/src/scripts/rebuild_hook_bundle.ts +1 -0
- package/src/scripts/report_carrier_divergence.ts +72 -24
- package/src/scripts/report_conformance_funnel.ts +291 -0
- package/src/scripts/report_imperative_density.ts +1 -0
- package/src/scripts/routing_doctor.ts +97 -0
- package/src/scripts/self_repair_cli.ts +51 -3
- package/src/scripts/session_eol_report.ts +261 -0
- package/src/server/schemas/settings.ts +14 -0
- package/src/templates/compact-instructions.md +40 -0
- package/dist/ui/assets/index-JDAF00bC.js +0 -26
- package/dist/ui/assets/index-JDAF00bC.js.map +0 -1
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/scripts/hooks/state_io.ts
|
|
4
|
+
import fs from "node:fs";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
var LOCK_BASENAME = ".dispatcher.lock";
|
|
7
|
+
var REPLAY_ENV_VAR = "AGENT_CONFIG_REPLAY";
|
|
8
|
+
function is_replay_mode() {
|
|
9
|
+
return (process.env[REPLAY_ENV_VAR] ?? "").trim() === "1";
|
|
10
|
+
}
|
|
11
|
+
function _lock_path(state_dir) {
|
|
12
|
+
return path.join(state_dir, LOCK_BASENAME);
|
|
13
|
+
}
|
|
14
|
+
function _py_json_dumps(value, indent) {
|
|
15
|
+
const pad = " ".repeat(indent);
|
|
16
|
+
const escapeString = (s) => {
|
|
17
|
+
let out = '"';
|
|
18
|
+
for (const ch of s) {
|
|
19
|
+
const code = ch.codePointAt(0);
|
|
20
|
+
switch (ch) {
|
|
21
|
+
case '"':
|
|
22
|
+
out += '\\"';
|
|
23
|
+
break;
|
|
24
|
+
case "\\":
|
|
25
|
+
out += "\\\\";
|
|
26
|
+
break;
|
|
27
|
+
case "\n":
|
|
28
|
+
out += "\\n";
|
|
29
|
+
break;
|
|
30
|
+
case "\r":
|
|
31
|
+
out += "\\r";
|
|
32
|
+
break;
|
|
33
|
+
case " ":
|
|
34
|
+
out += "\\t";
|
|
35
|
+
break;
|
|
36
|
+
case "\b":
|
|
37
|
+
out += "\\b";
|
|
38
|
+
break;
|
|
39
|
+
case "\f":
|
|
40
|
+
out += "\\f";
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
if (code < 32 || code > 126) {
|
|
44
|
+
if (code > 65535) {
|
|
45
|
+
const c = code - 65536;
|
|
46
|
+
const hi = 55296 + (c >> 10);
|
|
47
|
+
const lo = 56320 + (c & 1023);
|
|
48
|
+
out += "\\u" + hi.toString(16).padStart(4, "0") + "\\u" + lo.toString(16).padStart(4, "0");
|
|
49
|
+
} else {
|
|
50
|
+
out += "\\u" + code.toString(16).padStart(4, "0");
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
out += ch;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return out + '"';
|
|
58
|
+
};
|
|
59
|
+
const render = (v, depth) => {
|
|
60
|
+
if (v === null || v === void 0) {
|
|
61
|
+
return "null";
|
|
62
|
+
}
|
|
63
|
+
if (typeof v === "boolean") {
|
|
64
|
+
return v ? "true" : "false";
|
|
65
|
+
}
|
|
66
|
+
if (typeof v === "number") {
|
|
67
|
+
if (!Number.isFinite(v)) {
|
|
68
|
+
if (Number.isNaN(v)) return "NaN";
|
|
69
|
+
return v > 0 ? "Infinity" : "-Infinity";
|
|
70
|
+
}
|
|
71
|
+
return String(v);
|
|
72
|
+
}
|
|
73
|
+
if (typeof v === "string") {
|
|
74
|
+
return escapeString(v);
|
|
75
|
+
}
|
|
76
|
+
const curPad = pad.repeat(depth + 1);
|
|
77
|
+
const closePad = pad.repeat(depth);
|
|
78
|
+
if (Array.isArray(v)) {
|
|
79
|
+
if (v.length === 0) {
|
|
80
|
+
return "[]";
|
|
81
|
+
}
|
|
82
|
+
const items = v.map((item) => curPad + render(item, depth + 1));
|
|
83
|
+
return "[\n" + items.join(",\n") + "\n" + closePad + "]";
|
|
84
|
+
}
|
|
85
|
+
if (typeof v === "object") {
|
|
86
|
+
const obj = v;
|
|
87
|
+
const keys = Object.keys(obj);
|
|
88
|
+
if (keys.length === 0) {
|
|
89
|
+
return "{}";
|
|
90
|
+
}
|
|
91
|
+
const items = keys.map(
|
|
92
|
+
(k) => curPad + escapeString(k) + ": " + render(obj[k], depth + 1)
|
|
93
|
+
);
|
|
94
|
+
return "{\n" + items.join(",\n") + "\n" + closePad + "}";
|
|
95
|
+
}
|
|
96
|
+
throw new TypeError(`Object of type ${typeof v} is not JSON serializable`);
|
|
97
|
+
};
|
|
98
|
+
return render(value, 0);
|
|
99
|
+
}
|
|
100
|
+
function atomic_write_json(target, payload, options = {}) {
|
|
101
|
+
if (is_replay_mode()) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const indent = options.indent ?? 2;
|
|
105
|
+
const targetPath = path.resolve(target);
|
|
106
|
+
const state_dir = path.dirname(targetPath);
|
|
107
|
+
fs.mkdirSync(state_dir, { recursive: true });
|
|
108
|
+
const body = _py_json_dumps(payload, indent) + "\n";
|
|
109
|
+
_atomic_write_text(targetPath, body);
|
|
110
|
+
}
|
|
111
|
+
function atomic_write_text(target, text) {
|
|
112
|
+
if (is_replay_mode()) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const targetPath = path.resolve(target);
|
|
116
|
+
const state_dir = path.dirname(targetPath);
|
|
117
|
+
fs.mkdirSync(state_dir, { recursive: true });
|
|
118
|
+
_atomic_write_text(targetPath, text);
|
|
119
|
+
}
|
|
120
|
+
function _acquire_lock(lock_path) {
|
|
121
|
+
const fd = fs.openSync(lock_path, "a", 420);
|
|
122
|
+
const held = lock_path + ".held";
|
|
123
|
+
const deadlineMs = 5e3;
|
|
124
|
+
const start = Date.now();
|
|
125
|
+
for (; ; ) {
|
|
126
|
+
try {
|
|
127
|
+
const heldFd = fs.openSync(held, "wx", 420);
|
|
128
|
+
fs.closeSync(heldFd);
|
|
129
|
+
return fd;
|
|
130
|
+
} catch (err) {
|
|
131
|
+
if (err.code !== "EEXIST") {
|
|
132
|
+
return fd;
|
|
133
|
+
}
|
|
134
|
+
if (Date.now() - start > deadlineMs) {
|
|
135
|
+
try {
|
|
136
|
+
fs.rmSync(held, { force: true });
|
|
137
|
+
} catch {
|
|
138
|
+
}
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const sab = new Int32Array(new SharedArrayBuffer(4));
|
|
142
|
+
Atomics.wait(sab, 0, 0, 2);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
function _release_lock(fd, lock_path) {
|
|
147
|
+
try {
|
|
148
|
+
fs.closeSync(fd);
|
|
149
|
+
} catch {
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
fs.rmSync(lock_path + ".held", { force: true });
|
|
153
|
+
} catch {
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function _atomic_write_text(target, text) {
|
|
157
|
+
const tmp = target + `.tmp.${process.pid}`;
|
|
158
|
+
const lock_path = _lock_path(path.dirname(target));
|
|
159
|
+
const fd = _acquire_lock(lock_path);
|
|
160
|
+
try {
|
|
161
|
+
fs.writeFileSync(tmp, text, { encoding: "utf-8" });
|
|
162
|
+
fs.renameSync(tmp, target);
|
|
163
|
+
} finally {
|
|
164
|
+
_release_lock(fd, lock_path);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export {
|
|
169
|
+
is_replay_mode,
|
|
170
|
+
atomic_write_json,
|
|
171
|
+
atomic_write_text
|
|
172
|
+
};
|
|
@@ -2,10 +2,10 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
|
|
|
2
2
|
import {
|
|
3
3
|
ZodFirstPartyTypeKind,
|
|
4
4
|
settingsSchema
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UVKNIJH2.js";
|
|
6
6
|
import {
|
|
7
7
|
main
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DS6BLDMG.js";
|
|
9
9
|
import {
|
|
10
10
|
RULE_SOURCE_REL
|
|
11
11
|
} from "./chunk-BKO2AZ7Z.js";
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
import {
|
|
49
49
|
find_project_root_with_anchor,
|
|
50
50
|
load_agent_settings
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-JEJABGKB.js";
|
|
52
52
|
import {
|
|
53
53
|
event4u_root,
|
|
54
54
|
legacy_xdg_root,
|
|
@@ -4,11 +4,67 @@ import {
|
|
|
4
4
|
write_target
|
|
5
5
|
} from "./chunk-NDJLNC6Q.js";
|
|
6
6
|
|
|
7
|
+
// src/shared/settingsCarveOut.ts
|
|
8
|
+
var SETTINGS_CARVE_OUT = [
|
|
9
|
+
{
|
|
10
|
+
key: "projection.mode",
|
|
11
|
+
reader: "src/scripts/install.ts:3409 _resolve_scoped_projection",
|
|
12
|
+
absentResolvesTo: "legacy-all",
|
|
13
|
+
reason: "The template fallback applies only when NO global settings file exists. Once a file exists, an absent key means legacy-all by documented contract, so an existing install is never silently narrowed on upgrade."
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: "projection.rule_workspaces",
|
|
17
|
+
reader: "src/install/rule_scope.ts:96 ruleScopeFromSettings",
|
|
18
|
+
absentResolvesTo: "null \u2014 LEGACY_ALL, i.e. every rule ships including maintainer-only ones",
|
|
19
|
+
reason: "Same upgrade contract as projection.mode, and the failure is louder: an absent list widens the projection instead of narrowing it."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: "discipline_profile",
|
|
23
|
+
reader: "work_engine/_lib/agent_settings.ts:1263",
|
|
24
|
+
absentResolvesTo: "essential, unconditionally",
|
|
25
|
+
reason: "The template ships `auto`, which resolves to `off` on any measured-null model, any non-Claude host, and any host exposing no model id. Absent skips that resolution entirely and loads the essential tier everywhere."
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: "chat_history.frequency",
|
|
29
|
+
reader: "src/scripts/chat_history.ts:1140",
|
|
30
|
+
absentResolvesTo: "per_phase",
|
|
31
|
+
reason: "Canonical substitution is `per_turn`. Absent gives coarser capture than the shipped default \u2014 an audit-thinning change, which the class contract's own test 8 (what can the attacker HIDE) names as the severe direction."
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: "profile.id",
|
|
35
|
+
reader: "src/scripts/config/profiles.ts:221 resolve_profile",
|
|
36
|
+
absentResolvesTo: "the id `developer`, but a DEGRADED profile \u2014 packs: [], personas: [], hints: []",
|
|
37
|
+
reason: "Exactly the projection.mode shape: the template default is honoured only when no settings file exists. With a file present the id resolves but its profile body does not load, so the install silently loses every pack and persona."
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: "quality.local_auto_run",
|
|
41
|
+
reader: "src/scripts/lint_roadmap_ci_steps.ts:106",
|
|
42
|
+
absentResolvesTo: "true \u2014 which DISABLES the CI-step gate",
|
|
43
|
+
reason: "Inverted polarity, and the most dangerous row in the set: the template ships `false`, which ARMS the gate. Omitting the key would disarm a quality gate for every fresh install while the reference page says it is on."
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "onboarding.onboarded",
|
|
47
|
+
reader: "src/scripts/onboarding_gate_hook.ts:99",
|
|
48
|
+
absentResolvesTo: "gate skipped, as if onboarding had already completed",
|
|
49
|
+
reason: "Absent behaves like `onboarded: true`, not like the template default `false`. Omitting it would skip the onboarding gate on precisely the fresh installs the gate exists for."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: "chat_history.enabled",
|
|
53
|
+
reader: "src/scripts/chat_history.ts:1025 _read_chat_history_enabled",
|
|
54
|
+
absentResolvesTo: "false",
|
|
55
|
+
reason: "The reader falls back to false while the template ships true. This one is privacy-shaped: fixing the reader would start recording history for every install whose file lacks the key. Writing it explicitly keeps the decision visible in the file the user can read."
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
function carveOutKeys() {
|
|
59
|
+
return SETTINGS_CARVE_OUT.map((c) => c.key);
|
|
60
|
+
}
|
|
61
|
+
|
|
7
62
|
// src/scripts/_lib/agent_settings.ts
|
|
8
63
|
import { createRequire } from "node:module";
|
|
9
64
|
import * as fs from "node:fs";
|
|
10
65
|
import * as os from "node:os";
|
|
11
66
|
import * as path from "node:path";
|
|
67
|
+
import { fileURLToPath } from "node:url";
|
|
12
68
|
var _require = createRequire(import.meta.url);
|
|
13
69
|
var Logger = class {
|
|
14
70
|
name = "scripts._lib.agent_settings";
|
|
@@ -117,7 +173,45 @@ var MERGEABLE_KEYS = [
|
|
|
117
173
|
"knowledge.global_sharing.freshness.hypothesis_after_days",
|
|
118
174
|
"knowledge.global_sharing.freshness.stale_after_days"
|
|
119
175
|
];
|
|
120
|
-
var
|
|
176
|
+
var TEMPLATE_RELATIVE = path.join("src", "config", "agent-settings.template.yml");
|
|
177
|
+
var _PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
|
|
178
|
+
function default_template_path() {
|
|
179
|
+
return path.join(_PACKAGE_ROOT, TEMPLATE_RELATIVE);
|
|
180
|
+
}
|
|
181
|
+
function _is_placeholder(value) {
|
|
182
|
+
return typeof value === "string" && /^__[A-Z0-9_]+__$/.test(value);
|
|
183
|
+
}
|
|
184
|
+
function _prune_template(tree, excluded, prefix = "") {
|
|
185
|
+
const out = {};
|
|
186
|
+
for (const [key, value] of Object.entries(tree)) {
|
|
187
|
+
const dotted = prefix === "" ? key : `${prefix}.${key}`;
|
|
188
|
+
if (excluded.has(dotted) || _is_placeholder(value)) {
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (_is_plain_dict(value)) {
|
|
192
|
+
const child = _prune_template(value, excluded, dotted);
|
|
193
|
+
if (Object.keys(child).length > 0) {
|
|
194
|
+
out[key] = child;
|
|
195
|
+
}
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
out[key] = value;
|
|
199
|
+
}
|
|
200
|
+
return out;
|
|
201
|
+
}
|
|
202
|
+
var _template_defaults_cache = null;
|
|
203
|
+
function template_defaults(template_path) {
|
|
204
|
+
const use_cache = template_path === void 0;
|
|
205
|
+
if (use_cache && _template_defaults_cache !== null) {
|
|
206
|
+
return _deepcopy(_template_defaults_cache);
|
|
207
|
+
}
|
|
208
|
+
const parsed = _read_yaml(template_path ?? default_template_path()) ?? {};
|
|
209
|
+
const pruned = _prune_template(parsed, new Set(carveOutKeys()));
|
|
210
|
+
if (use_cache) {
|
|
211
|
+
_template_defaults_cache = pruned;
|
|
212
|
+
}
|
|
213
|
+
return _deepcopy(pruned);
|
|
214
|
+
}
|
|
121
215
|
var ANCHOR_AGENT_SETTINGS = "agent-settings";
|
|
122
216
|
var ANCHOR_AGENTS_DIR = "agents-dir";
|
|
123
217
|
var ANCHOR_GIT = "git";
|
|
@@ -386,6 +480,7 @@ function load_agent_settings(options = {}) {
|
|
|
386
480
|
const user_global_path = options.user_global_path ?? null;
|
|
387
481
|
const verbose = options.verbose ?? false;
|
|
388
482
|
const cwd = options.cwd ?? null;
|
|
483
|
+
const template_path = options.template_path ?? null;
|
|
389
484
|
const user_global_raw = {};
|
|
390
485
|
for (const p of user_global_path ? [user_global_path] : user_global_settings_paths()) {
|
|
391
486
|
_deep_merge(user_global_raw, _read_yaml(p) ?? {});
|
|
@@ -398,7 +493,7 @@ function load_agent_settings(options = {}) {
|
|
|
398
493
|
);
|
|
399
494
|
}
|
|
400
495
|
const cascade = _resolve_cascade_paths(cwd, project_path);
|
|
401
|
-
const merged =
|
|
496
|
+
const merged = template_defaults(template_path ?? void 0);
|
|
402
497
|
_deep_merge(merged, user_global_filtered);
|
|
403
498
|
for (const p of cascade) {
|
|
404
499
|
const layer = _read_yaml(p) ?? {};
|
|
@@ -555,16 +650,25 @@ function _deep_merge(dst, src) {
|
|
|
555
650
|
}
|
|
556
651
|
}
|
|
557
652
|
}
|
|
558
|
-
function
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
653
|
+
function _deepcopy(value) {
|
|
654
|
+
if (Array.isArray(value)) {
|
|
655
|
+
return value.map((v) => _deepcopy(v));
|
|
656
|
+
}
|
|
657
|
+
if (_is_plain_dict(value)) {
|
|
658
|
+
const out = {};
|
|
659
|
+
for (const [k, v] of Object.entries(value)) {
|
|
660
|
+
out[k] = _deepcopy(v);
|
|
661
|
+
}
|
|
662
|
+
return out;
|
|
663
|
+
}
|
|
664
|
+
return value;
|
|
562
665
|
}
|
|
563
666
|
function _is_plain_dict(value) {
|
|
564
667
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
565
668
|
}
|
|
566
669
|
|
|
567
670
|
export {
|
|
671
|
+
SETTINGS_CARVE_OUT,
|
|
568
672
|
logger,
|
|
569
673
|
DEFAULT_PROJECT_FILE,
|
|
570
674
|
LOCAL_PROJECT_FILE,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/scripts/hooks/hook_stdin.ts
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
|
+
var _override = null;
|
|
6
|
+
function readHookStdin() {
|
|
7
|
+
if (_override !== null) return _override;
|
|
8
|
+
try {
|
|
9
|
+
if (process.stdin.isTTY) return "";
|
|
10
|
+
return fs.readFileSync(0, "utf-8");
|
|
11
|
+
} catch {
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
readHookStdin
|
|
18
|
+
};
|
|
@@ -422,6 +422,11 @@ var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
|
|
|
422
422
|
});
|
|
423
423
|
var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
424
424
|
var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
425
|
+
function makeUtcDate(year, month, day, hour = 0, minute = 0, second = 0, fraction = 0) {
|
|
426
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
427
|
+
date.setUTCFullYear(year, month, day);
|
|
428
|
+
return date;
|
|
429
|
+
}
|
|
425
430
|
function resolveYamlTimestamp(source) {
|
|
426
431
|
let match = YAML_DATE_REGEXP.exec(source);
|
|
427
432
|
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source);
|
|
@@ -430,7 +435,7 @@ function resolveYamlTimestamp(source) {
|
|
|
430
435
|
const month = +match[2] - 1;
|
|
431
436
|
const day = +match[3];
|
|
432
437
|
if (!match[4]) {
|
|
433
|
-
const date2 =
|
|
438
|
+
const date2 = makeUtcDate(year, month, day);
|
|
434
439
|
if (date2.getUTCFullYear() !== year || date2.getUTCMonth() !== month || date2.getUTCDate() !== day) return NOT_RESOLVED;
|
|
435
440
|
return date2;
|
|
436
441
|
}
|
|
@@ -444,7 +449,7 @@ function resolveYamlTimestamp(source) {
|
|
|
444
449
|
while (value.length < 3) value += "0";
|
|
445
450
|
fraction = +value;
|
|
446
451
|
}
|
|
447
|
-
const date =
|
|
452
|
+
const date = makeUtcDate(year, month, day, hour, minute, second, fraction);
|
|
448
453
|
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
449
454
|
if (match[9]) {
|
|
450
455
|
const offsetHour = +match[10];
|
|
@@ -542,7 +547,11 @@ var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
542
547
|
return Object.prototype.hasOwnProperty.call(container, String(key));
|
|
543
548
|
},
|
|
544
549
|
keys: (container) => Object.keys(container),
|
|
545
|
-
get: (container, key) =>
|
|
550
|
+
get: (container, key) => {
|
|
551
|
+
const normalizedKey = String(key);
|
|
552
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
553
|
+
return container[normalizedKey];
|
|
554
|
+
}
|
|
546
555
|
});
|
|
547
556
|
var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
548
557
|
create: () => /* @__PURE__ */ new Set(),
|
|
@@ -563,9 +572,9 @@ var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
|
563
572
|
});
|
|
564
573
|
function createTagDefinitionMap() {
|
|
565
574
|
return {
|
|
566
|
-
scalar:
|
|
567
|
-
sequence:
|
|
568
|
-
mapping:
|
|
575
|
+
scalar: /* @__PURE__ */ Object.create(null),
|
|
576
|
+
sequence: /* @__PURE__ */ Object.create(null),
|
|
577
|
+
mapping: /* @__PURE__ */ Object.create(null)
|
|
569
578
|
};
|
|
570
579
|
}
|
|
571
580
|
function createTagDefinitionListMap() {
|
|
@@ -735,7 +744,11 @@ var legacyMapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
735
744
|
return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey);
|
|
736
745
|
},
|
|
737
746
|
keys: (container) => Object.keys(container),
|
|
738
|
-
get: (container, key) =>
|
|
747
|
+
get: (container, key) => {
|
|
748
|
+
const normalizedKey = String(key);
|
|
749
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
750
|
+
return container[normalizedKey];
|
|
751
|
+
}
|
|
739
752
|
});
|
|
740
753
|
var DEFAULT_SNIPPET_OPTIONS = {
|
|
741
754
|
maxLength: 79,
|
|
@@ -1071,10 +1084,10 @@ function getScalarValue(input, scalar) {
|
|
|
1071
1084
|
return getPlainValue(input, valueStart, valueEnd);
|
|
1072
1085
|
}
|
|
1073
1086
|
}
|
|
1074
|
-
var DEFAULT_TAG_HANDLERS = {
|
|
1087
|
+
var DEFAULT_TAG_HANDLERS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1075
1088
|
"!": "!",
|
|
1076
1089
|
"!!": "tag:yaml.org,2002:"
|
|
1077
|
-
};
|
|
1090
|
+
});
|
|
1078
1091
|
function tagPercentEncode(source) {
|
|
1079
1092
|
return encodeURI(source).replace(/!/g, "%21");
|
|
1080
1093
|
}
|
|
@@ -1327,6 +1340,10 @@ function constructFromEvents(events, options) {
|
|
|
1327
1340
|
}
|
|
1328
1341
|
case 6: {
|
|
1329
1342
|
const frame = state.frames.pop();
|
|
1343
|
+
if (frame.kind === "mapping" && frame.hasKey) {
|
|
1344
|
+
state.position = frame.keyPosition;
|
|
1345
|
+
throwError$1(state, "incomplete mapping pair in event stream");
|
|
1346
|
+
}
|
|
1330
1347
|
if (frame.kind === "document") state.documents.push(frame.value);
|
|
1331
1348
|
else {
|
|
1332
1349
|
const value = frame.tag.carrierIsResult ? frame.value : finalizeCollection(state, frame.position, frame.tag, frame.value);
|
|
@@ -1997,10 +2014,6 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
1997
2014
|
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
1998
2015
|
else indentStatus = -1;
|
|
1999
2016
|
}
|
|
2000
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2001
|
-
state.depth--;
|
|
2002
|
-
return false;
|
|
2003
|
-
}
|
|
2004
2017
|
if (indentStatus === 1) while (true) {
|
|
2005
2018
|
const ch = state.input.charCodeAt(state.position);
|
|
2006
2019
|
const propertyState = snapshotState(state);
|
|
@@ -2549,14 +2562,14 @@ function chooseScalarStyle(state, string, layout, singleLineOnly, forceQuote, in
|
|
|
2549
2562
|
if (char === CHAR_LINE_FEED) {
|
|
2550
2563
|
hasLineBreak = true;
|
|
2551
2564
|
if (shouldTrackWidth) {
|
|
2552
|
-
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1]
|
|
2565
|
+
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && !isMoreIndented(string[previousLineBreak + 1]);
|
|
2553
2566
|
previousLineBreak = i;
|
|
2554
2567
|
}
|
|
2555
2568
|
} else if (!isPrintable(char)) return STYLE_DOUBLE;
|
|
2556
2569
|
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
2557
2570
|
prevChar = char;
|
|
2558
2571
|
}
|
|
2559
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1]
|
|
2572
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && !isMoreIndented(string[previousLineBreak + 1]);
|
|
2560
2573
|
}
|
|
2561
2574
|
if (!hasLineBreak && !hasFoldableLine) {
|
|
2562
2575
|
if (plain && !forceQuote) return STYLE_PLAIN;
|
|
@@ -2621,27 +2634,30 @@ function encodeFlowBreaks(string, indent) {
|
|
|
2621
2634
|
function dropEndingNewline(string) {
|
|
2622
2635
|
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
2623
2636
|
}
|
|
2637
|
+
function isMoreIndented(char) {
|
|
2638
|
+
return char === " " || char === " ";
|
|
2639
|
+
}
|
|
2624
2640
|
function foldBlockScalar(string, width) {
|
|
2625
2641
|
const lineRe = /(\n+)([^\n]*)/g;
|
|
2626
2642
|
let nextLF = string.indexOf("\n");
|
|
2627
2643
|
if (nextLF === -1) nextLF = string.length;
|
|
2628
2644
|
lineRe.lastIndex = nextLF;
|
|
2629
2645
|
let result = foldLine(string.slice(0, nextLF), width);
|
|
2630
|
-
let prevMoreIndented = string[0] === "\n" || string[0]
|
|
2646
|
+
let prevMoreIndented = string[0] === "\n" || isMoreIndented(string[0]);
|
|
2631
2647
|
let moreIndented;
|
|
2632
2648
|
let match;
|
|
2633
2649
|
while (match = lineRe.exec(string)) {
|
|
2634
2650
|
const prefix = match[1];
|
|
2635
2651
|
const line = match[2];
|
|
2636
|
-
moreIndented = line
|
|
2652
|
+
moreIndented = line !== "" && isMoreIndented(line[0]);
|
|
2637
2653
|
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
2638
2654
|
prevMoreIndented = moreIndented;
|
|
2639
2655
|
}
|
|
2640
2656
|
return result;
|
|
2641
2657
|
}
|
|
2642
2658
|
function foldLine(line, width) {
|
|
2643
|
-
if (line === "" || line[0]
|
|
2644
|
-
const breakRe = / [^ ]/g;
|
|
2659
|
+
if (line === "" || isMoreIndented(line[0])) return line;
|
|
2660
|
+
const breakRe = / [^ \t]/g;
|
|
2645
2661
|
let match;
|
|
2646
2662
|
let start = 0;
|
|
2647
2663
|
let end;
|
|
@@ -2987,5 +3003,5 @@ export {
|
|
|
2987
3003
|
/*! Bundled license information:
|
|
2988
3004
|
|
|
2989
3005
|
js-yaml/dist/js-yaml.mjs:
|
|
2990
|
-
(*! js-yaml 5.2.
|
|
3006
|
+
(*! js-yaml 5.2.3 https://github.com/nodeca/js-yaml @license MIT *)
|
|
2991
3007
|
*/
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
readHookStdin
|
|
4
|
+
} from "./chunk-MMJL4TIX.js";
|
|
2
5
|
import {
|
|
3
6
|
load_agent_settings
|
|
4
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-JEJABGKB.js";
|
|
5
8
|
|
|
6
9
|
// src/scripts/chat_history.ts
|
|
7
10
|
import { createHash } from "node:crypto";
|
|
8
|
-
import * as
|
|
11
|
+
import * as fs from "node:fs";
|
|
9
12
|
import * as path from "node:path";
|
|
10
13
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
11
|
-
|
|
12
|
-
// src/scripts/hooks/hook_stdin.ts
|
|
13
|
-
import * as fs from "node:fs";
|
|
14
|
-
var _override = null;
|
|
15
|
-
function readHookStdin() {
|
|
16
|
-
if (_override !== null) return _override;
|
|
17
|
-
try {
|
|
18
|
-
if (process.stdin.isTTY) return "";
|
|
19
|
-
return fs.readFileSync(0, "utf-8");
|
|
20
|
-
} catch {
|
|
21
|
-
return "";
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// src/scripts/chat_history.ts
|
|
26
14
|
var DEFAULT_FILE = "agents/runtime/.agent-chat-history";
|
|
27
15
|
var DEFAULT_SETTINGS_FILE = ".agent-settings.yml";
|
|
28
16
|
var SCHEMA_VERSION = 4;
|
|
@@ -249,14 +237,14 @@ function derive_session_tag(session_id) {
|
|
|
249
237
|
}
|
|
250
238
|
function _isFile(p) {
|
|
251
239
|
try {
|
|
252
|
-
return
|
|
240
|
+
return fs.statSync(p).isFile();
|
|
253
241
|
} catch {
|
|
254
242
|
return false;
|
|
255
243
|
}
|
|
256
244
|
}
|
|
257
245
|
function _statSize(p) {
|
|
258
246
|
try {
|
|
259
|
-
return
|
|
247
|
+
return fs.statSync(p).size;
|
|
260
248
|
} catch {
|
|
261
249
|
return -1;
|
|
262
250
|
}
|
|
@@ -307,7 +295,7 @@ function _session_tag_enabled() {
|
|
|
307
295
|
return (process.env.AGENT_CHAT_HISTORY_SESSION_TAG ?? "true").trim().toLowerCase() !== "false";
|
|
308
296
|
}
|
|
309
297
|
function _readLines(p) {
|
|
310
|
-
const raw =
|
|
298
|
+
const raw = fs.readFileSync(p, "utf-8");
|
|
311
299
|
if (raw === "") {
|
|
312
300
|
return [];
|
|
313
301
|
}
|
|
@@ -353,7 +341,7 @@ function read_header(p) {
|
|
|
353
341
|
}
|
|
354
342
|
let first;
|
|
355
343
|
try {
|
|
356
|
-
const raw =
|
|
344
|
+
const raw = fs.readFileSync(target, "utf-8");
|
|
357
345
|
first = _strip(raw.split("\n", 1)[0] ?? "");
|
|
358
346
|
} catch {
|
|
359
347
|
return null;
|
|
@@ -383,8 +371,8 @@ function init(freq = "per_phase", options = {}) {
|
|
|
383
371
|
if (_is_replay_mode()) {
|
|
384
372
|
return header;
|
|
385
373
|
}
|
|
386
|
-
|
|
387
|
-
|
|
374
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
375
|
+
fs.writeFileSync(target, _pyDumps(header) + "\n", { encoding: "utf-8" });
|
|
388
376
|
return header;
|
|
389
377
|
}
|
|
390
378
|
function migrate_header(p, options = {}) {
|
|
@@ -410,7 +398,7 @@ function migrate_header(p, options = {}) {
|
|
|
410
398
|
if (typeof existing.started === "string") {
|
|
411
399
|
new_header.started = existing.started;
|
|
412
400
|
}
|
|
413
|
-
const raw =
|
|
401
|
+
const raw = fs.readFileSync(target, "utf-8");
|
|
414
402
|
const lines = _pySplitlines(raw);
|
|
415
403
|
if (lines.length === 0) {
|
|
416
404
|
return null;
|
|
@@ -465,7 +453,7 @@ function append(entry, options = {}) {
|
|
|
465
453
|
if (_is_replay_mode()) {
|
|
466
454
|
return;
|
|
467
455
|
}
|
|
468
|
-
|
|
456
|
+
fs.appendFileSync(target, _pyDumps(entry) + "\n", { encoding: "utf-8" });
|
|
469
457
|
}
|
|
470
458
|
function _atomic_write_text(target, text) {
|
|
471
459
|
if (_is_replay_mode()) {
|
|
@@ -475,11 +463,11 @@ function _atomic_write_text(target, text) {
|
|
|
475
463
|
const uniq = `${process.pid}.${createHash("sha256").update(`${process.pid}:${Date.now()}:${Math.random()}`).digest("hex").slice(0, 8)}`;
|
|
476
464
|
const tmp = target.slice(0, target.length - suffix.length) + `${suffix}.${uniq}.tmp`;
|
|
477
465
|
try {
|
|
478
|
-
|
|
479
|
-
|
|
466
|
+
fs.writeFileSync(tmp, text, { encoding: "utf-8" });
|
|
467
|
+
fs.renameSync(tmp, target);
|
|
480
468
|
} catch (exc) {
|
|
481
469
|
try {
|
|
482
|
-
|
|
470
|
+
fs.unlinkSync(tmp);
|
|
483
471
|
} catch {
|
|
484
472
|
}
|
|
485
473
|
throw exc;
|
|
@@ -509,7 +497,7 @@ function reset_with_entries(entries, freq = "per_phase", options = {}) {
|
|
|
509
497
|
const target = options.path ?? file_path();
|
|
510
498
|
const header = _build_header(freq);
|
|
511
499
|
const body = _normalize_entries(entries);
|
|
512
|
-
|
|
500
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
513
501
|
const lines = [_pyDumps(header), ...body.map((e) => _pyDumps(e))];
|
|
514
502
|
_atomic_write_text(target, lines.join("\n") + "\n");
|
|
515
503
|
return header;
|
|
@@ -530,7 +518,7 @@ function prepend_entries(entries, options = {}) {
|
|
|
530
518
|
return new_lines.length;
|
|
531
519
|
}
|
|
532
520
|
function _readLinesKeepNewline(p) {
|
|
533
|
-
const raw =
|
|
521
|
+
const raw = fs.readFileSync(p, "utf-8");
|
|
534
522
|
if (raw === "") {
|
|
535
523
|
return [];
|
|
536
524
|
}
|
|
@@ -552,8 +540,8 @@ function clear(options = {}) {
|
|
|
552
540
|
return;
|
|
553
541
|
}
|
|
554
542
|
const target = options.path ?? file_path();
|
|
555
|
-
if (
|
|
556
|
-
|
|
543
|
+
if (fs.existsSync(target)) {
|
|
544
|
+
fs.unlinkSync(target);
|
|
557
545
|
}
|
|
558
546
|
}
|
|
559
547
|
function read_entries(options = {}) {
|
|
@@ -2010,8 +1998,8 @@ function _isCliEntry() {
|
|
|
2010
1998
|
return true;
|
|
2011
1999
|
}
|
|
2012
2000
|
try {
|
|
2013
|
-
const here =
|
|
2014
|
-
const argv =
|
|
2001
|
+
const here = fs.realpathSync(fileURLToPath(import.meta.url));
|
|
2002
|
+
const argv = fs.realpathSync(path.resolve(process.argv[1]));
|
|
2015
2003
|
return here === argv;
|
|
2016
2004
|
} catch {
|
|
2017
2005
|
return false;
|
|
@@ -2033,7 +2021,6 @@ if (_invokedDirectly) {
|
|
|
2033
2021
|
}
|
|
2034
2022
|
|
|
2035
2023
|
export {
|
|
2036
|
-
readHookStdin,
|
|
2037
2024
|
derive_session_tag,
|
|
2038
2025
|
read_entries,
|
|
2039
2026
|
list_sessions
|