signetai 0.78.2 → 0.78.3
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/dashboard/_app/immutable/assets/0.CU0K3a5Q.css +1 -0
- package/dashboard/_app/immutable/assets/AuditTab.DfUZSCcu.css +1 -0
- package/dashboard/_app/immutable/assets/CortexTab.DM0MR2Ew.css +1 -0
- package/dashboard/_app/immutable/assets/{TaskDetail.YLB6Rg4e.css → CortexTasksPanel.C4153GOT.css} +1 -1
- package/dashboard/_app/immutable/assets/TroubleshooterPanel.Bj27xjMc.css +1 -0
- package/dashboard/_app/immutable/chunks/2sVhTPqV.js +5 -0
- package/dashboard/_app/immutable/chunks/{BMHg4p9s.js → 8I6zSz1_.js} +1 -1
- package/dashboard/_app/immutable/chunks/B1CG30Tk.js +1 -0
- package/dashboard/_app/immutable/chunks/B5EqjC58.js +2 -0
- package/dashboard/_app/immutable/chunks/B7Trm0Eb.js +1 -0
- package/dashboard/_app/immutable/chunks/{BX1Yz7rd.js → BDT3hrUw.js} +1 -1
- package/dashboard/_app/immutable/chunks/{BjFLqtWT.js → BFQszhNF.js} +1 -1
- package/dashboard/_app/immutable/chunks/BFjTMOJT.js +1 -0
- package/dashboard/_app/immutable/chunks/BLxYnJFM.js +1 -0
- package/dashboard/_app/immutable/chunks/{ycjTzGx9.js → BU2RpiOd.js} +1 -1
- package/dashboard/_app/immutable/chunks/{C6Ut0qMj.js → BUfNSShc.js} +1 -1
- package/dashboard/_app/immutable/chunks/{Sbdhs5rk.js → BfyKCXaY.js} +1 -1
- package/dashboard/_app/immutable/chunks/BlyEKFy6.js +1 -0
- package/dashboard/_app/immutable/chunks/{otBz_bAw.js → C1mzMGVK.js} +1 -1
- package/dashboard/_app/immutable/chunks/C3uL_G-6.js +3 -0
- package/dashboard/_app/immutable/chunks/CJKt8AUS.js +32 -0
- package/dashboard/_app/immutable/chunks/{D4fMMG5j.js → CKyI7_iw.js} +1 -1
- package/dashboard/_app/immutable/chunks/{TDeGgAzG.js → CQXEoRQp.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CYGmkkOT.js → CQm_y4uV.js} +1 -1
- package/dashboard/_app/immutable/chunks/CZ4IBYNe.js +1 -0
- package/dashboard/_app/immutable/chunks/{Dg17Auac.js → CeI7UBRO.js} +1 -1
- package/dashboard/_app/immutable/chunks/CjQstM_p.js +15 -0
- package/dashboard/_app/immutable/chunks/CwRhzb5g.js +1 -0
- package/dashboard/_app/immutable/chunks/CwqzNZZy.js +2 -0
- package/dashboard/_app/immutable/chunks/CziGSIXa.js +1 -0
- package/dashboard/_app/immutable/chunks/D4hiagJ4.js +3 -0
- package/dashboard/_app/immutable/chunks/{Bf45f0Vp.js → D5r8Pi79.js} +1 -1
- package/dashboard/_app/immutable/chunks/{D7ozeA5b.js → D8vxVi1s.js} +1 -1
- package/dashboard/_app/immutable/chunks/DFBQgsWq.js +2 -0
- package/dashboard/_app/immutable/chunks/DJ34Ow8B.js +64 -0
- package/dashboard/_app/immutable/chunks/{CjrslgAi.js → DOaCXx_K.js} +1 -1
- package/dashboard/_app/immutable/chunks/{2MfvoDg1.js → DVXNr7Gr.js} +1 -1
- package/dashboard/_app/immutable/chunks/{BHvXyetp.js → DYIWBQCf.js} +1 -1
- package/dashboard/_app/immutable/chunks/DYOdoKxT.js +264 -0
- package/dashboard/_app/immutable/chunks/{DWi5AdTB.js → DZJZefYk.js} +2 -2
- package/dashboard/_app/immutable/chunks/Db1xOFju.js +1 -0
- package/dashboard/_app/immutable/chunks/DddEkaw0.js +1 -0
- package/dashboard/_app/immutable/chunks/Ddm7yfuh.js +7 -0
- package/dashboard/_app/immutable/chunks/{CH07uMzE.js → DlL5xNTX.js} +1 -1
- package/dashboard/_app/immutable/chunks/{8qq9odk9.js → Dnh29zl2.js} +1 -1
- package/dashboard/_app/immutable/chunks/{CCS36Mqc.js → DyjGoGyT.js} +1 -1
- package/dashboard/_app/immutable/chunks/JGLyxup4.js +27 -0
- package/dashboard/_app/immutable/chunks/{DP3h6pcQ.js → LDm615q6.js} +1 -1
- package/dashboard/_app/immutable/chunks/{gnFq108l.js → NJkCFQbe.js} +1 -1
- package/dashboard/_app/immutable/chunks/{BnRD8JUX.js → P0vgGLcV.js} +1 -1
- package/dashboard/_app/immutable/chunks/{DP2Cqb23.js → QQITl5fF.js} +1 -1
- package/dashboard/_app/immutable/chunks/TyeR9VWg.js +26 -0
- package/dashboard/_app/immutable/chunks/{BLrn3yUI.js → altURCqx.js} +1 -1
- package/dashboard/_app/immutable/chunks/{Bfse3fCo.js → anLJSqtR.js} +1 -1
- package/dashboard/_app/immutable/chunks/{DMYKaFD3.js → rn86Xwnc.js} +1 -1
- package/dashboard/_app/immutable/chunks/sCGNJapo.js +36 -0
- package/dashboard/_app/immutable/chunks/zWsBWM0e.js +4 -0
- package/dashboard/_app/immutable/entry/app.CRVX7NHY.js +2 -0
- package/dashboard/_app/immutable/entry/start.D6fHbnXJ.js +1 -0
- package/dashboard/_app/immutable/nodes/{0.jIuPfYNn.js → 0.B0A_vgr9.js} +1 -1
- package/dashboard/_app/immutable/nodes/1.B4ePHtXd.js +1 -0
- package/dashboard/_app/immutable/nodes/2.UCOJaFhi.js +1 -0
- package/dashboard/_app/version.json +1 -1
- package/dashboard/index.html +7 -7
- package/dist/daemon.js +240 -216
- package/package.json +1 -1
- package/dashboard/_app/immutable/assets/0.CJqciL3X.css +0 -1
- package/dashboard/_app/immutable/assets/CortexTab.CbEfH7Fd.css +0 -1
- package/dashboard/_app/immutable/assets/CortexTasksPanel.Ds5n7IaC.css +0 -1
- package/dashboard/_app/immutable/assets/TasksTab.Bok2ZX0D.css +0 -1
- package/dashboard/_app/immutable/assets/TroubleshooterPanel.Dw-L2Im3.css +0 -1
- package/dashboard/_app/immutable/chunks/2MRzfVP3.js +0 -1
- package/dashboard/_app/immutable/chunks/3MTuhkkM.js +0 -1
- package/dashboard/_app/immutable/chunks/7pObTy5Z.js +0 -27
- package/dashboard/_app/immutable/chunks/B82MekTh.js +0 -4
- package/dashboard/_app/immutable/chunks/BXXcrVDk.js +0 -1
- package/dashboard/_app/immutable/chunks/Bh3nIh1p.js +0 -7
- package/dashboard/_app/immutable/chunks/Bo0KuYql.js +0 -26
- package/dashboard/_app/immutable/chunks/C2EsmaBq.js +0 -32
- package/dashboard/_app/immutable/chunks/CAzEUj7-.js +0 -3
- package/dashboard/_app/immutable/chunks/CQlsEtmr.js +0 -2
- package/dashboard/_app/immutable/chunks/CRs_2u26.js +0 -39
- package/dashboard/_app/immutable/chunks/Ca7ofCGO.js +0 -264
- package/dashboard/_app/immutable/chunks/CaQOFuOW.js +0 -1
- package/dashboard/_app/immutable/chunks/Cfzanl-M.js +0 -1
- package/dashboard/_app/immutable/chunks/Cvtb1Uv1.js +0 -5
- package/dashboard/_app/immutable/chunks/D2L-5-73.js +0 -61
- package/dashboard/_app/immutable/chunks/D4j6_yDm.js +0 -1
- package/dashboard/_app/immutable/chunks/D7-Y1GbH.js +0 -1
- package/dashboard/_app/immutable/chunks/D7kvLQQv.js +0 -1
- package/dashboard/_app/immutable/chunks/D9AMLR_o.js +0 -1
- package/dashboard/_app/immutable/chunks/DPqWqYTP.js +0 -15
- package/dashboard/_app/immutable/chunks/DW-0HYki.js +0 -3
- package/dashboard/_app/immutable/chunks/cLV2Mo98.js +0 -2
- package/dashboard/_app/immutable/chunks/pP_VsnEc.js +0 -1
- package/dashboard/_app/immutable/chunks/u_Tqmrjo.js +0 -1
- package/dashboard/_app/immutable/entry/app.D33Fg_EX.js +0 -2
- package/dashboard/_app/immutable/entry/start.CKfFW3OZ.js +0 -1
- package/dashboard/_app/immutable/nodes/1.CixhrL0r.js +0 -1
- package/dashboard/_app/immutable/nodes/2.BF93CE4w.js +0 -1
package/dist/daemon.js
CHANGED
|
@@ -29039,6 +29039,17 @@ var init_agent_id = __esm(() => {
|
|
|
29039
29039
|
init_db_accessor();
|
|
29040
29040
|
});
|
|
29041
29041
|
|
|
29042
|
+
// ../daemon/src/file-sync.ts
|
|
29043
|
+
import { existsSync as existsSync15, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "fs";
|
|
29044
|
+
function writeFileIfChanged(path, content) {
|
|
29045
|
+
const existing = existsSync15(path) ? readFileSync14(path, "utf-8") : null;
|
|
29046
|
+
if (existing === content)
|
|
29047
|
+
return false;
|
|
29048
|
+
writeFileSync5(path, content);
|
|
29049
|
+
return true;
|
|
29050
|
+
}
|
|
29051
|
+
var init_file_sync = () => {};
|
|
29052
|
+
|
|
29042
29053
|
// ../daemon/src/temporal-expand.ts
|
|
29043
29054
|
function mapNode(row) {
|
|
29044
29055
|
return {
|
|
@@ -33966,7 +33977,7 @@ var init_continuity_state = __esm(() => {
|
|
|
33966
33977
|
|
|
33967
33978
|
// ../daemon/src/memory-head.ts
|
|
33968
33979
|
import { createHash as createHash2, randomUUID as randomUUID3 } from "crypto";
|
|
33969
|
-
import { existsSync as
|
|
33980
|
+
import { existsSync as existsSync16, mkdirSync as mkdirSync6, readFileSync as readFileSync15, writeFileSync as writeFileSync7 } from "fs";
|
|
33970
33981
|
import { homedir as homedir11 } from "os";
|
|
33971
33982
|
import { join as join19 } from "path";
|
|
33972
33983
|
function hashContent(content) {
|
|
@@ -34044,13 +34055,13 @@ function releaseHeadLease(agentId, token) {
|
|
|
34044
34055
|
}
|
|
34045
34056
|
function writeProjection(content) {
|
|
34046
34057
|
const path = join19(AGENTS_DIR2, "MEMORY.md");
|
|
34047
|
-
if (
|
|
34058
|
+
if (existsSync16(path)) {
|
|
34048
34059
|
const stamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
34049
34060
|
const backup = join19(AGENTS_DIR2, "memory", `MEMORY.backup-${stamp}.md`);
|
|
34050
34061
|
mkdirSync6(join19(AGENTS_DIR2, "memory"), { recursive: true });
|
|
34051
|
-
|
|
34062
|
+
writeFileSync7(backup, readFileSync15(path, "utf-8"));
|
|
34052
34063
|
}
|
|
34053
|
-
|
|
34064
|
+
writeFileSync7(path, projectMemoryMd(content));
|
|
34054
34065
|
}
|
|
34055
34066
|
function writeMemoryHead(content, opts) {
|
|
34056
34067
|
const trimmed = content.trim();
|
|
@@ -34113,7 +34124,7 @@ __export(exports_predictor_state, {
|
|
|
34113
34124
|
getAlphaFloor: () => getAlphaFloor,
|
|
34114
34125
|
computeEffectiveAlpha: () => computeEffectiveAlpha
|
|
34115
34126
|
});
|
|
34116
|
-
import { existsSync as
|
|
34127
|
+
import { existsSync as existsSync17, mkdirSync as mkdirSync7, readFileSync as readFileSync16, writeFileSync as writeFileSync8 } from "fs";
|
|
34117
34128
|
import { homedir as homedir12 } from "os";
|
|
34118
34129
|
import { dirname as dirname8, join as join20 } from "path";
|
|
34119
34130
|
function statePath(agentId) {
|
|
@@ -34138,10 +34149,10 @@ function parseState(raw2) {
|
|
|
34138
34149
|
}
|
|
34139
34150
|
function getPredictorState(agentId) {
|
|
34140
34151
|
const path = statePath(agentId);
|
|
34141
|
-
if (!
|
|
34152
|
+
if (!existsSync17(path))
|
|
34142
34153
|
return { ...DEFAULT_STATE };
|
|
34143
34154
|
try {
|
|
34144
|
-
const content =
|
|
34155
|
+
const content = readFileSync16(path, "utf-8");
|
|
34145
34156
|
return parseState(JSON.parse(content));
|
|
34146
34157
|
} catch {
|
|
34147
34158
|
logger.warn("predictor", "Failed to read predictor state, using defaults");
|
|
@@ -34161,10 +34172,10 @@ function updatePredictorState(agentId, update) {
|
|
|
34161
34172
|
const path = statePath(agentId);
|
|
34162
34173
|
try {
|
|
34163
34174
|
const dir = dirname8(path);
|
|
34164
|
-
if (!
|
|
34175
|
+
if (!existsSync17(dir)) {
|
|
34165
34176
|
mkdirSync7(dir, { recursive: true });
|
|
34166
34177
|
}
|
|
34167
|
-
|
|
34178
|
+
writeFileSync8(path, JSON.stringify(next, null, 2), "utf-8");
|
|
34168
34179
|
} catch (err) {
|
|
34169
34180
|
logger.warn("predictor", "Failed to write predictor state", {
|
|
34170
34181
|
error: err instanceof Error ? err.message : String(err)
|
|
@@ -35010,7 +35021,7 @@ var init_session_checkpoints = __esm(() => {
|
|
|
35010
35021
|
});
|
|
35011
35022
|
|
|
35012
35023
|
// ../daemon/src/session-memories.ts
|
|
35013
|
-
import { existsSync as
|
|
35024
|
+
import { existsSync as existsSync18 } from "fs";
|
|
35014
35025
|
import { homedir as homedir13 } from "os";
|
|
35015
35026
|
import { join as join21 } from "path";
|
|
35016
35027
|
function getMemoryDbPath() {
|
|
@@ -35018,7 +35029,7 @@ function getMemoryDbPath() {
|
|
|
35018
35029
|
return join21(agentsDir, "memory", "memories.db");
|
|
35019
35030
|
}
|
|
35020
35031
|
function recordSessionCandidates(sessionKey, candidates, injectedIds, agentId = "default") {
|
|
35021
|
-
if (!sessionKey || candidates.length === 0 || !
|
|
35032
|
+
if (!sessionKey || candidates.length === 0 || !existsSync18(getMemoryDbPath()))
|
|
35022
35033
|
return;
|
|
35023
35034
|
try {
|
|
35024
35035
|
getDbAccessor().withWriteTx((db) => {
|
|
@@ -35058,7 +35069,7 @@ function recordSessionCandidates(sessionKey, candidates, injectedIds, agentId =
|
|
|
35058
35069
|
}
|
|
35059
35070
|
}
|
|
35060
35071
|
function trackFtsHits(sessionKey, matchedIds, agentId = "default") {
|
|
35061
|
-
if (!sessionKey || matchedIds.length === 0 || !
|
|
35072
|
+
if (!sessionKey || matchedIds.length === 0 || !existsSync18(getMemoryDbPath()))
|
|
35062
35073
|
return;
|
|
35063
35074
|
try {
|
|
35064
35075
|
getDbAccessor().withWriteTx((db) => {
|
|
@@ -35120,7 +35131,7 @@ function recordAgentFeedbackInner(db, sessionKey, feedback, agentId = "default")
|
|
|
35120
35131
|
}
|
|
35121
35132
|
}
|
|
35122
35133
|
function recordAgentFeedback(sessionKey, feedback, agentId = "default") {
|
|
35123
|
-
if (!sessionKey || Object.keys(feedback).length === 0 || !
|
|
35134
|
+
if (!sessionKey || Object.keys(feedback).length === 0 || !existsSync18(getMemoryDbPath()))
|
|
35124
35135
|
return;
|
|
35125
35136
|
try {
|
|
35126
35137
|
getDbAccessor().withWriteTx((db) => {
|
|
@@ -35801,7 +35812,7 @@ function isMajorUpgrade(current, candidate) {
|
|
|
35801
35812
|
|
|
35802
35813
|
// ../daemon/src/update-system.ts
|
|
35803
35814
|
import { spawn as spawn2 } from "child_process";
|
|
35804
|
-
import { existsSync as
|
|
35815
|
+
import { existsSync as existsSync19, readFileSync as readFileSync17, writeFileSync as writeFileSync9 } from "fs";
|
|
35805
35816
|
import { join as join23 } from "path";
|
|
35806
35817
|
function initUpdateSystem(version, dir, onRestartNeeded) {
|
|
35807
35818
|
currentVersion2 = version;
|
|
@@ -35924,10 +35935,10 @@ function loadUpdateConfig() {
|
|
|
35924
35935
|
join23(agentsDir, "AGENT.yaml")
|
|
35925
35936
|
];
|
|
35926
35937
|
for (const p2 of paths) {
|
|
35927
|
-
if (!
|
|
35938
|
+
if (!existsSync19(p2))
|
|
35928
35939
|
continue;
|
|
35929
35940
|
try {
|
|
35930
|
-
const yaml = parseSimpleYaml(
|
|
35941
|
+
const yaml = parseSimpleYaml(readFileSync17(p2, "utf-8"));
|
|
35931
35942
|
const updates = yaml.updates || yaml.update;
|
|
35932
35943
|
if (updates) {
|
|
35933
35944
|
const autoInstallRaw = updates.autoInstall ?? updates.auto_install;
|
|
@@ -35967,10 +35978,10 @@ function persistUpdateConfig(config) {
|
|
|
35967
35978
|
join23(agentsDir, "AGENT.yaml")
|
|
35968
35979
|
];
|
|
35969
35980
|
for (const p2 of paths) {
|
|
35970
|
-
if (!
|
|
35981
|
+
if (!existsSync19(p2))
|
|
35971
35982
|
continue;
|
|
35972
35983
|
try {
|
|
35973
|
-
const current =
|
|
35984
|
+
const current = readFileSync17(p2, "utf-8");
|
|
35974
35985
|
const updatesSection = formatUpdatesSection(config);
|
|
35975
35986
|
const updatesPattern = /^updates:\n(?:[ \t].*(?:\n|$))*/m;
|
|
35976
35987
|
const trimmedCurrent = current.trimEnd();
|
|
@@ -35978,7 +35989,7 @@ function persistUpdateConfig(config) {
|
|
|
35978
35989
|
|
|
35979
35990
|
${updatesSection}` : updatesSection;
|
|
35980
35991
|
if (updated !== current) {
|
|
35981
|
-
|
|
35992
|
+
writeFileSync9(p2, updated);
|
|
35982
35993
|
}
|
|
35983
35994
|
return true;
|
|
35984
35995
|
} catch (e) {
|
|
@@ -36099,8 +36110,8 @@ function parseInstalledPackageVersion(packageJsonContent) {
|
|
|
36099
36110
|
}
|
|
36100
36111
|
function verifyInstalledVersion(family, packageName, expectedVersion, deps = {
|
|
36101
36112
|
resolveGlobalPackagePath: (family2, packageName2) => resolveGlobalPackagePath(family2, packageName2),
|
|
36102
|
-
existsSync: (path) =>
|
|
36103
|
-
readFileSync: (path, encoding) =>
|
|
36113
|
+
existsSync: (path) => existsSync19(path),
|
|
36114
|
+
readFileSync: (path, encoding) => readFileSync17(path, { encoding })
|
|
36104
36115
|
}) {
|
|
36105
36116
|
try {
|
|
36106
36117
|
const packagePath = deps.resolveGlobalPackagePath(family, packageName);
|
|
@@ -36348,7 +36359,7 @@ var init_update_system = __esm(() => {
|
|
|
36348
36359
|
});
|
|
36349
36360
|
|
|
36350
36361
|
// ../daemon/src/hooks.ts
|
|
36351
|
-
import { existsSync as
|
|
36362
|
+
import { existsSync as existsSync20, readFileSync as readFileSync18, realpathSync as realpathSync2 } from "fs";
|
|
36352
36363
|
import { homedir as homedir14 } from "os";
|
|
36353
36364
|
import { join as join25 } from "path";
|
|
36354
36365
|
function resetPromptDedup(sessionKey) {
|
|
@@ -36490,7 +36501,7 @@ function collectThreadHeads(nodes, limit) {
|
|
|
36490
36501
|
return selected;
|
|
36491
36502
|
}
|
|
36492
36503
|
function readPersistedThreadHeads(agentId, limit) {
|
|
36493
|
-
if (!
|
|
36504
|
+
if (!existsSync20(MEMORY_DB))
|
|
36494
36505
|
return [];
|
|
36495
36506
|
try {
|
|
36496
36507
|
return getDbAccessor().withReadDb((db) => {
|
|
@@ -36547,7 +36558,7 @@ function collectSynthesisMaterial(charBudget, agentId) {
|
|
|
36547
36558
|
const nodeBudget = Math.max(1200, Math.floor(charBudget * 0.45));
|
|
36548
36559
|
const scope = getAgentScope(agentId);
|
|
36549
36560
|
const memories = selectWithBudget(getAllScoredCandidates(undefined, 120, agentId, scope.readPolicy, scope.policyGroup), memoryBudget);
|
|
36550
|
-
if (!
|
|
36561
|
+
if (!existsSync20(MEMORY_DB)) {
|
|
36551
36562
|
return {
|
|
36552
36563
|
nodes: [],
|
|
36553
36564
|
memories,
|
|
@@ -36664,7 +36675,7 @@ function selectWithBudget(rows, charBudget) {
|
|
|
36664
36675
|
return selected;
|
|
36665
36676
|
}
|
|
36666
36677
|
function getSessionGapSummary() {
|
|
36667
|
-
if (!
|
|
36678
|
+
if (!existsSync20(MEMORY_DB))
|
|
36668
36679
|
return;
|
|
36669
36680
|
try {
|
|
36670
36681
|
return getDbAccessor().withReadDb((db) => {
|
|
@@ -36717,10 +36728,10 @@ function isDuplicate(db, content) {
|
|
|
36717
36728
|
}
|
|
36718
36729
|
function readIdentityFile(fileName, charBudget) {
|
|
36719
36730
|
const filePath = join25(AGENTS_DIR3, fileName);
|
|
36720
|
-
if (!
|
|
36731
|
+
if (!existsSync20(filePath))
|
|
36721
36732
|
return;
|
|
36722
36733
|
try {
|
|
36723
|
-
const content =
|
|
36734
|
+
const content = readFileSync18(filePath, "utf-8").trim();
|
|
36724
36735
|
if (!content)
|
|
36725
36736
|
return;
|
|
36726
36737
|
if (content.length <= charBudget)
|
|
@@ -36736,10 +36747,10 @@ function readMemoryMd(charBudget) {
|
|
|
36736
36747
|
}
|
|
36737
36748
|
function readAgentsMd(charBudget) {
|
|
36738
36749
|
const agentsMd = join25(AGENTS_DIR3, "AGENTS.md");
|
|
36739
|
-
if (!
|
|
36750
|
+
if (!existsSync20(agentsMd))
|
|
36740
36751
|
return;
|
|
36741
36752
|
try {
|
|
36742
|
-
const content =
|
|
36753
|
+
const content = readFileSync18(agentsMd, "utf-8").trim();
|
|
36743
36754
|
if (!content)
|
|
36744
36755
|
return;
|
|
36745
36756
|
if (content.length <= charBudget)
|
|
@@ -36756,7 +36767,7 @@ function clampScore01(value) {
|
|
|
36756
36767
|
return Math.max(0, Math.min(1, value));
|
|
36757
36768
|
}
|
|
36758
36769
|
function fetchTraversalCandidates(memoryIds, agentId) {
|
|
36759
|
-
if (memoryIds.length === 0 || !
|
|
36770
|
+
if (memoryIds.length === 0 || !existsSync20(MEMORY_DB))
|
|
36760
36771
|
return [];
|
|
36761
36772
|
try {
|
|
36762
36773
|
const placeholders = memoryIds.map(() => "?").join(", ");
|
|
@@ -36827,7 +36838,7 @@ Constraints for entities in scope. These always apply.
|
|
|
36827
36838
|
return compressedSection;
|
|
36828
36839
|
}
|
|
36829
36840
|
function getAllScoredCandidates(project, limit, agentId = "default", readPolicy = "isolated", policyGroup = null) {
|
|
36830
|
-
if (!
|
|
36841
|
+
if (!existsSync20(MEMORY_DB))
|
|
36831
36842
|
return [];
|
|
36832
36843
|
try {
|
|
36833
36844
|
const scope = buildAgentScopeClause(agentId, readPolicy, policyGroup);
|
|
@@ -36856,7 +36867,7 @@ function getAllScoredCandidates(project, limit, agentId = "default", readPolicy
|
|
|
36856
36867
|
}
|
|
36857
36868
|
}
|
|
36858
36869
|
function getPredictedContextMemories(project, limit, charBudget, excludeIds, agentId, readPolicy = "isolated", policyGroup = null) {
|
|
36859
|
-
if (!
|
|
36870
|
+
if (!existsSync20(MEMORY_DB))
|
|
36860
36871
|
return [];
|
|
36861
36872
|
try {
|
|
36862
36873
|
const summaryRows = getDbAccessor().withReadDb((db) => {
|
|
@@ -36922,7 +36933,7 @@ function getPredictedContextMemories(project, limit, charBudget, excludeIds, age
|
|
|
36922
36933
|
}
|
|
36923
36934
|
}
|
|
36924
36935
|
function updateAccessTracking(ids) {
|
|
36925
|
-
if (ids.length === 0 || !
|
|
36936
|
+
if (ids.length === 0 || !existsSync20(MEMORY_DB))
|
|
36926
36937
|
return;
|
|
36927
36938
|
try {
|
|
36928
36939
|
getDbAccessor().withWriteTx((db) => {
|
|
@@ -36939,11 +36950,11 @@ function updateAccessTracking(ids) {
|
|
|
36939
36950
|
}
|
|
36940
36951
|
function loadHooksConfig() {
|
|
36941
36952
|
const configPath = join25(AGENTS_DIR3, "agent.yaml");
|
|
36942
|
-
if (!
|
|
36953
|
+
if (!existsSync20(configPath)) {
|
|
36943
36954
|
return getDefaultConfig();
|
|
36944
36955
|
}
|
|
36945
36956
|
try {
|
|
36946
|
-
const content =
|
|
36957
|
+
const content = readFileSync18(configPath, "utf-8");
|
|
36947
36958
|
const parsed = parseSimpleYaml(content);
|
|
36948
36959
|
const hooks = parsed.hooks;
|
|
36949
36960
|
if (!hooks || typeof hooks !== "object") {
|
|
@@ -36999,9 +37010,9 @@ function isAgentConfig(value) {
|
|
|
36999
37010
|
}
|
|
37000
37011
|
function loadIdentity() {
|
|
37001
37012
|
const agentYaml = join25(AGENTS_DIR3, "agent.yaml");
|
|
37002
|
-
if (
|
|
37013
|
+
if (existsSync20(agentYaml)) {
|
|
37003
37014
|
try {
|
|
37004
|
-
const content =
|
|
37015
|
+
const content = readFileSync18(agentYaml, "utf-8");
|
|
37005
37016
|
const config = parseSimpleYaml(content);
|
|
37006
37017
|
const agent = config.agent;
|
|
37007
37018
|
if (isAgentConfig(agent) && agent.name) {
|
|
@@ -37013,9 +37024,9 @@ function loadIdentity() {
|
|
|
37013
37024
|
} catch {}
|
|
37014
37025
|
}
|
|
37015
37026
|
const identityMd = join25(AGENTS_DIR3, "IDENTITY.md");
|
|
37016
|
-
if (
|
|
37027
|
+
if (existsSync20(identityMd)) {
|
|
37017
37028
|
try {
|
|
37018
|
-
const content =
|
|
37029
|
+
const content = readFileSync18(identityMd, "utf-8");
|
|
37019
37030
|
const nameMatch = content.match(/name:\s*(.+)/i);
|
|
37020
37031
|
const descMatch = content.match(/creature:\s*(.+)/i) || content.match(/role:\s*(.+)/i);
|
|
37021
37032
|
return {
|
|
@@ -37027,7 +37038,7 @@ function loadIdentity() {
|
|
|
37027
37038
|
return { name: "Agent" };
|
|
37028
37039
|
}
|
|
37029
37040
|
function getRecentMemories(limit, recencyBias = 0.7) {
|
|
37030
|
-
if (!
|
|
37041
|
+
if (!existsSync20(MEMORY_DB))
|
|
37031
37042
|
return [];
|
|
37032
37043
|
try {
|
|
37033
37044
|
const rows = getDbAccessor().withReadDb((db) => {
|
|
@@ -37789,9 +37800,9 @@ async function handleUserPromptSubmit(req) {
|
|
|
37789
37800
|
}
|
|
37790
37801
|
if (req.sessionKey) {
|
|
37791
37802
|
let transcript = "";
|
|
37792
|
-
if (req.transcriptPath &&
|
|
37803
|
+
if (req.transcriptPath && existsSync20(req.transcriptPath)) {
|
|
37793
37804
|
try {
|
|
37794
|
-
const raw2 =
|
|
37805
|
+
const raw2 = readFileSync18(req.transcriptPath, "utf-8");
|
|
37795
37806
|
transcript = normalizeSessionTranscript(req.harness, raw2);
|
|
37796
37807
|
} catch {
|
|
37797
37808
|
logger.warn("hooks", "Could not read prompt transcript", {
|
|
@@ -37829,7 +37840,7 @@ ${now4} (${tz})
|
|
|
37829
37840
|
warnings
|
|
37830
37841
|
}, "disabled");
|
|
37831
37842
|
}
|
|
37832
|
-
if (keywordTerms.length < 1 || vectorQuery.length === 0 || !
|
|
37843
|
+
if (keywordTerms.length < 1 || vectorQuery.length === 0 || !existsSync20(MEMORY_DB)) {
|
|
37833
37844
|
return finalizeUserPromptSubmitSuccess(req, userMessage, start, {
|
|
37834
37845
|
inject: metadataHeader,
|
|
37835
37846
|
memoryCount: 0,
|
|
@@ -38004,9 +38015,9 @@ function handleSessionEnd(req) {
|
|
|
38004
38015
|
return { memoriesSaved: 0 };
|
|
38005
38016
|
}
|
|
38006
38017
|
let transcript = "";
|
|
38007
|
-
if (req.transcriptPath &&
|
|
38018
|
+
if (req.transcriptPath && existsSync20(req.transcriptPath)) {
|
|
38008
38019
|
try {
|
|
38009
|
-
const rawTranscript =
|
|
38020
|
+
const rawTranscript = readFileSync18(req.transcriptPath, "utf-8");
|
|
38010
38021
|
transcript = normalizeSessionTranscript(req.harness, rawTranscript);
|
|
38011
38022
|
} catch {
|
|
38012
38023
|
logger.warn("hooks", "Could not read transcript", {
|
|
@@ -38528,7 +38539,7 @@ function trimTrailingSlash(url) {
|
|
|
38528
38539
|
|
|
38529
38540
|
// ../daemon/src/pipeline/provider.ts
|
|
38530
38541
|
import { spawn as nodeSpawn } from "child_process";
|
|
38531
|
-
import { existsSync as
|
|
38542
|
+
import { existsSync as existsSync21 } from "fs";
|
|
38532
38543
|
import { homedir as homedir15 } from "os";
|
|
38533
38544
|
import { Readable as Readable4 } from "stream";
|
|
38534
38545
|
|
|
@@ -39385,7 +39396,7 @@ function resolveOpenCodeBin() {
|
|
|
39385
39396
|
if (found)
|
|
39386
39397
|
return found;
|
|
39387
39398
|
const fallback = `${homedir15()}/.opencode/bin/opencode`;
|
|
39388
|
-
if (
|
|
39399
|
+
if (existsSync21(fallback))
|
|
39389
39400
|
return fallback;
|
|
39390
39401
|
return null;
|
|
39391
39402
|
}
|
|
@@ -40466,7 +40477,7 @@ var init_predictor_comparison = __esm(() => {
|
|
|
40466
40477
|
});
|
|
40467
40478
|
|
|
40468
40479
|
// ../daemon/src/pipeline/summary-worker.ts
|
|
40469
|
-
import { existsSync as
|
|
40480
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync8, writeFileSync as writeFileSync10 } from "fs";
|
|
40470
40481
|
import { homedir as homedir16 } from "os";
|
|
40471
40482
|
import { join as join26 } from "path";
|
|
40472
40483
|
function buildPrompt3(transcript, date) {
|
|
@@ -40607,11 +40618,11 @@ function deriveSlug(summary, project) {
|
|
|
40607
40618
|
}
|
|
40608
40619
|
function uniqueFilename(dir, base, ext) {
|
|
40609
40620
|
const first = join26(dir, `${base}${ext}`);
|
|
40610
|
-
if (!
|
|
40621
|
+
if (!existsSync22(first))
|
|
40611
40622
|
return first;
|
|
40612
40623
|
for (let i3 = 2;i3 <= 20; i3++) {
|
|
40613
40624
|
const path = join26(dir, `${base}-${i3}${ext}`);
|
|
40614
|
-
if (!
|
|
40625
|
+
if (!existsSync22(path))
|
|
40615
40626
|
return path;
|
|
40616
40627
|
}
|
|
40617
40628
|
return join26(dir, `${base}-${Date.now()}${ext}`);
|
|
@@ -40668,7 +40679,7 @@ async function processJob(accessor2, provider2, job, memoryCfg) {
|
|
|
40668
40679
|
mkdirSync8(MEMORY_DIR, { recursive: true });
|
|
40669
40680
|
const slug = deriveSlug(result.summary, job.project);
|
|
40670
40681
|
const filename = uniqueFilename(MEMORY_DIR, `${today}-${slug}`, ".md");
|
|
40671
|
-
|
|
40682
|
+
writeFileSync10(filename, result.summary, "utf-8");
|
|
40672
40683
|
logger.info("summary-worker", "Wrote session summary", {
|
|
40673
40684
|
path: filename,
|
|
40674
40685
|
sessionKey: job.session_key,
|
|
@@ -41391,7 +41402,7 @@ var init_synthesis_llm = __esm(() => {
|
|
|
41391
41402
|
});
|
|
41392
41403
|
|
|
41393
41404
|
// ../daemon/src/pipeline/synthesis-worker.ts
|
|
41394
|
-
import { existsSync as
|
|
41405
|
+
import { existsSync as existsSync23, mkdirSync as mkdirSync9, readFileSync as readFileSync19, writeFileSync as writeFileSync11 } from "fs";
|
|
41395
41406
|
import { homedir as homedir17 } from "os";
|
|
41396
41407
|
import { join as join27 } from "path";
|
|
41397
41408
|
function getAgentsDir() {
|
|
@@ -41409,9 +41420,9 @@ function getLastSynthesisPath(agentId) {
|
|
|
41409
41420
|
function readLastSynthesisTime(agentId) {
|
|
41410
41421
|
try {
|
|
41411
41422
|
const path = getLastSynthesisPath(agentId);
|
|
41412
|
-
if (!
|
|
41423
|
+
if (!existsSync23(path))
|
|
41413
41424
|
return 0;
|
|
41414
|
-
const data = JSON.parse(
|
|
41425
|
+
const data = JSON.parse(readFileSync19(path, "utf-8"));
|
|
41415
41426
|
return typeof data.lastRunAt === "number" ? data.lastRunAt : 0;
|
|
41416
41427
|
} catch {
|
|
41417
41428
|
return 0;
|
|
@@ -41421,7 +41432,7 @@ function writeLastSynthesisTime(timestamp, agentId) {
|
|
|
41421
41432
|
try {
|
|
41422
41433
|
const path = getLastSynthesisPath(agentId);
|
|
41423
41434
|
mkdirSync9(join27(getAgentsDir(), ".daemon"), { recursive: true });
|
|
41424
|
-
|
|
41435
|
+
writeFileSync11(path, JSON.stringify({ lastRunAt: timestamp }));
|
|
41425
41436
|
} catch (e) {
|
|
41426
41437
|
logger.warn("synthesis", "Failed to persist synthesis timestamp", {
|
|
41427
41438
|
error: e instanceof Error ? e.message : String(e)
|
|
@@ -55392,7 +55403,7 @@ var init_cron = __esm(() => {
|
|
|
55392
55403
|
});
|
|
55393
55404
|
|
|
55394
55405
|
// ../daemon/src/scheduler/skill-resolver.ts
|
|
55395
|
-
import { readFileSync as
|
|
55406
|
+
import { readFileSync as readFileSync20 } from "fs";
|
|
55396
55407
|
import { homedir as homedir19 } from "os";
|
|
55397
55408
|
import { join as join29 } from "path";
|
|
55398
55409
|
function stripFrontmatter(content) {
|
|
@@ -55412,7 +55423,7 @@ function resolveSkillPrompt(basePrompt, skillName, skillMode) {
|
|
|
55412
55423
|
}
|
|
55413
55424
|
const skillPath = join29(AGENTS_DIR5, "skills", skillName, "SKILL.md");
|
|
55414
55425
|
try {
|
|
55415
|
-
const raw2 =
|
|
55426
|
+
const raw2 = readFileSync20(skillPath, "utf-8");
|
|
55416
55427
|
const content = stripFrontmatter(raw2);
|
|
55417
55428
|
return `${content}
|
|
55418
55429
|
|
|
@@ -64152,20 +64163,32 @@ var init_umap_projection = __esm(() => {
|
|
|
64152
64163
|
});
|
|
64153
64164
|
|
|
64154
64165
|
// ../daemon/src/watcher-ignore.ts
|
|
64155
|
-
import { isAbsolute as isAbsolute3, join as join31, normalize as normalize3, resolve as resolve5 } from "path";
|
|
64166
|
+
import { isAbsolute as isAbsolute3, join as join31, normalize as normalize3, relative as relative3, resolve as resolve5 } from "path";
|
|
64156
64167
|
function normalizePath4(path) {
|
|
64157
64168
|
return normalize3(path);
|
|
64158
64169
|
}
|
|
64159
64170
|
function resolveForComparison(path) {
|
|
64160
64171
|
return normalizePath4(isAbsolute3(path) ? path : resolve5(path));
|
|
64161
64172
|
}
|
|
64173
|
+
function relativePathWithin(root, target) {
|
|
64174
|
+
const rel = normalizePath4(relative3(root, target));
|
|
64175
|
+
if (rel === "" || rel === ".")
|
|
64176
|
+
return "";
|
|
64177
|
+
if (rel.startsWith("..") || isAbsolute3(rel))
|
|
64178
|
+
return null;
|
|
64179
|
+
return rel;
|
|
64180
|
+
}
|
|
64162
64181
|
function createAgentsWatcherIgnoreMatcher(agentsDir2) {
|
|
64163
64182
|
const defaultPredictorCheckpoint = normalizePath4(join31(agentsDir2, "memory", "predictor", "model.bin"));
|
|
64164
64183
|
const configuredPredictorCheckpoint = resolveForComparison(resolvePredictorCheckpointPath(loadMemoryConfig(agentsDir2).pipelineV2.predictor));
|
|
64184
|
+
const agentRoot = resolveForComparison(join31(agentsDir2, "agents"));
|
|
64165
64185
|
const ignoredPaths = new Set([defaultPredictorCheckpoint, configuredPredictorCheckpoint]);
|
|
64166
64186
|
return (path) => {
|
|
64167
64187
|
const normalizedPath = resolveForComparison(path);
|
|
64168
|
-
|
|
64188
|
+
const relativeToAgentsRoot = relativePathWithin(agentRoot, normalizedPath);
|
|
64189
|
+
const agentSegments = relativeToAgentsRoot === null ? [] : relativeToAgentsRoot.split(/[\\/]+/).filter(Boolean);
|
|
64190
|
+
const isGeneratedWorkspacePath = agentSegments.length === 3 && agentSegments[1] === "workspace" && agentSegments[2] === "AGENTS.md";
|
|
64191
|
+
return isGeneratedWorkspacePath || ignoredPaths.has(normalizedPath) || normalizedPath.endsWith(".db-wal") || normalizedPath.endsWith(".db-shm") || normalizedPath.endsWith(".db-journal");
|
|
64169
64192
|
};
|
|
64170
64193
|
}
|
|
64171
64194
|
var init_watcher_ignore = __esm(() => {
|
|
@@ -89192,49 +89215,49 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
89192
89215
|
schemelessOptions.skipEscape = true;
|
|
89193
89216
|
return serialize(resolved, schemelessOptions);
|
|
89194
89217
|
}
|
|
89195
|
-
function resolveComponent(base,
|
|
89218
|
+
function resolveComponent(base, relative4, options, skipNormalization) {
|
|
89196
89219
|
const target = {};
|
|
89197
89220
|
if (!skipNormalization) {
|
|
89198
89221
|
base = parse6(serialize(base, options), options);
|
|
89199
|
-
|
|
89222
|
+
relative4 = parse6(serialize(relative4, options), options);
|
|
89200
89223
|
}
|
|
89201
89224
|
options = options || {};
|
|
89202
|
-
if (!options.tolerant &&
|
|
89203
|
-
target.scheme =
|
|
89204
|
-
target.userinfo =
|
|
89205
|
-
target.host =
|
|
89206
|
-
target.port =
|
|
89207
|
-
target.path = removeDotSegments(
|
|
89208
|
-
target.query =
|
|
89225
|
+
if (!options.tolerant && relative4.scheme) {
|
|
89226
|
+
target.scheme = relative4.scheme;
|
|
89227
|
+
target.userinfo = relative4.userinfo;
|
|
89228
|
+
target.host = relative4.host;
|
|
89229
|
+
target.port = relative4.port;
|
|
89230
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
89231
|
+
target.query = relative4.query;
|
|
89209
89232
|
} else {
|
|
89210
|
-
if (
|
|
89211
|
-
target.userinfo =
|
|
89212
|
-
target.host =
|
|
89213
|
-
target.port =
|
|
89214
|
-
target.path = removeDotSegments(
|
|
89215
|
-
target.query =
|
|
89233
|
+
if (relative4.userinfo !== undefined || relative4.host !== undefined || relative4.port !== undefined) {
|
|
89234
|
+
target.userinfo = relative4.userinfo;
|
|
89235
|
+
target.host = relative4.host;
|
|
89236
|
+
target.port = relative4.port;
|
|
89237
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
89238
|
+
target.query = relative4.query;
|
|
89216
89239
|
} else {
|
|
89217
|
-
if (!
|
|
89240
|
+
if (!relative4.path) {
|
|
89218
89241
|
target.path = base.path;
|
|
89219
|
-
if (
|
|
89220
|
-
target.query =
|
|
89242
|
+
if (relative4.query !== undefined) {
|
|
89243
|
+
target.query = relative4.query;
|
|
89221
89244
|
} else {
|
|
89222
89245
|
target.query = base.query;
|
|
89223
89246
|
}
|
|
89224
89247
|
} else {
|
|
89225
|
-
if (
|
|
89226
|
-
target.path = removeDotSegments(
|
|
89248
|
+
if (relative4.path[0] === "/") {
|
|
89249
|
+
target.path = removeDotSegments(relative4.path);
|
|
89227
89250
|
} else {
|
|
89228
89251
|
if ((base.userinfo !== undefined || base.host !== undefined || base.port !== undefined) && !base.path) {
|
|
89229
|
-
target.path = "/" +
|
|
89252
|
+
target.path = "/" + relative4.path;
|
|
89230
89253
|
} else if (!base.path) {
|
|
89231
|
-
target.path =
|
|
89254
|
+
target.path = relative4.path;
|
|
89232
89255
|
} else {
|
|
89233
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
89256
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative4.path;
|
|
89234
89257
|
}
|
|
89235
89258
|
target.path = removeDotSegments(target.path);
|
|
89236
89259
|
}
|
|
89237
|
-
target.query =
|
|
89260
|
+
target.query = relative4.query;
|
|
89238
89261
|
}
|
|
89239
89262
|
target.userinfo = base.userinfo;
|
|
89240
89263
|
target.host = base.host;
|
|
@@ -89242,7 +89265,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
89242
89265
|
}
|
|
89243
89266
|
target.scheme = base.scheme;
|
|
89244
89267
|
}
|
|
89245
|
-
target.fragment =
|
|
89268
|
+
target.fragment = relative4.fragment;
|
|
89246
89269
|
return target;
|
|
89247
89270
|
}
|
|
89248
89271
|
function equal(uriA, uriB, options) {
|
|
@@ -101740,7 +101763,7 @@ var init_skill_graph = __esm(() => {
|
|
|
101740
101763
|
});
|
|
101741
101764
|
|
|
101742
101765
|
// ../daemon/src/pipeline/skill-reconciler.ts
|
|
101743
|
-
import { existsSync as
|
|
101766
|
+
import { existsSync as existsSync24, readdirSync as readdirSync5, readFileSync as readFileSync21 } from "fs";
|
|
101744
101767
|
import { join as join32, basename as basename6, dirname as dirname9 } from "path";
|
|
101745
101768
|
function skillsDir(agentsDir2) {
|
|
101746
101769
|
return join32(agentsDir2, "skills");
|
|
@@ -101750,7 +101773,7 @@ async function reconcileOnce(deps) {
|
|
|
101750
101773
|
let installed = 0;
|
|
101751
101774
|
let updated = 0;
|
|
101752
101775
|
let removed = 0;
|
|
101753
|
-
if (!
|
|
101776
|
+
if (!existsSync24(dir)) {
|
|
101754
101777
|
return { installed, updated, removed };
|
|
101755
101778
|
}
|
|
101756
101779
|
const diskSkills = new Map;
|
|
@@ -101759,13 +101782,13 @@ async function reconcileOnce(deps) {
|
|
|
101759
101782
|
if (!entry.isDirectory())
|
|
101760
101783
|
continue;
|
|
101761
101784
|
const skillMdPath = join32(dir, entry.name, "SKILL.md");
|
|
101762
|
-
if (
|
|
101785
|
+
if (existsSync24(skillMdPath)) {
|
|
101763
101786
|
diskSkills.set(entry.name, skillMdPath);
|
|
101764
101787
|
}
|
|
101765
101788
|
}
|
|
101766
101789
|
for (const [name, mdPath] of diskSkills) {
|
|
101767
101790
|
try {
|
|
101768
|
-
const content =
|
|
101791
|
+
const content = readFileSync21(mdPath, "utf-8");
|
|
101769
101792
|
const parsed = parseSkillFile(content);
|
|
101770
101793
|
if (!parsed)
|
|
101771
101794
|
continue;
|
|
@@ -101809,7 +101832,7 @@ async function reconcileOnce(deps) {
|
|
|
101809
101832
|
}
|
|
101810
101833
|
const graphSkills = deps.accessor.withReadDb((db) => db.prepare("SELECT entity_id, fs_path FROM skill_meta WHERE agent_id = 'default' AND uninstalled_at IS NULL").all());
|
|
101811
101834
|
for (const row of graphSkills) {
|
|
101812
|
-
if (!
|
|
101835
|
+
if (!existsSync24(row.fs_path)) {
|
|
101813
101836
|
const parts = row.entity_id.split(":");
|
|
101814
101837
|
const skillName = parts.slice(2).join(":");
|
|
101815
101838
|
if (skillName) {
|
|
@@ -101853,7 +101876,7 @@ function startReconciler(deps) {
|
|
|
101853
101876
|
});
|
|
101854
101877
|
}, intervalMs);
|
|
101855
101878
|
let watcher = null;
|
|
101856
|
-
if (
|
|
101879
|
+
if (existsSync24(dir)) {
|
|
101857
101880
|
watcher = watch(join32(dir, "*", "SKILL.md"), {
|
|
101858
101881
|
ignoreInitial: true,
|
|
101859
101882
|
awaitWriteFinish: { stabilityThreshold: 500 }
|
|
@@ -101892,11 +101915,11 @@ function startReconciler(deps) {
|
|
|
101892
101915
|
}
|
|
101893
101916
|
async function reconcileSkill(skillName, mdPath, deps) {
|
|
101894
101917
|
try {
|
|
101895
|
-
if (!
|
|
101918
|
+
if (!existsSync24(mdPath)) {
|
|
101896
101919
|
uninstallSkillNode({ skillName }, deps.accessor);
|
|
101897
101920
|
return;
|
|
101898
101921
|
}
|
|
101899
|
-
const content =
|
|
101922
|
+
const content = readFileSync21(mdPath, "utf-8");
|
|
101900
101923
|
const parsed = parseSkillFile(content);
|
|
101901
101924
|
if (!parsed)
|
|
101902
101925
|
return;
|
|
@@ -101936,7 +101959,7 @@ var init_skill_reconciler = __esm(() => {
|
|
|
101936
101959
|
|
|
101937
101960
|
// ../daemon/src/routes/skills.ts
|
|
101938
101961
|
import { spawn as spawn4 } from "child_process";
|
|
101939
|
-
import { existsSync as
|
|
101962
|
+
import { existsSync as existsSync25, readFileSync as readFileSync22, readdirSync as readdirSync6, rmSync, writeFileSync as writeFileSync12 } from "fs";
|
|
101940
101963
|
import { homedir as homedir21 } from "os";
|
|
101941
101964
|
import { join as join33 } from "path";
|
|
101942
101965
|
function getAgentsDir2() {
|
|
@@ -101979,14 +102002,14 @@ function parseSkillFrontmatter(content) {
|
|
|
101979
102002
|
};
|
|
101980
102003
|
}
|
|
101981
102004
|
function listInstalledSkills() {
|
|
101982
|
-
if (!
|
|
102005
|
+
if (!existsSync25(getSkillsDir()))
|
|
101983
102006
|
return [];
|
|
101984
102007
|
return readdirSync6(getSkillsDir(), { withFileTypes: true }).filter((d2) => d2.isDirectory()).flatMap((d2) => {
|
|
101985
102008
|
const skillMdPath = join33(getSkillsDir(), d2.name, "SKILL.md");
|
|
101986
|
-
if (!
|
|
102009
|
+
if (!existsSync25(skillMdPath))
|
|
101987
102010
|
return [];
|
|
101988
102011
|
try {
|
|
101989
|
-
const content =
|
|
102012
|
+
const content = readFileSync22(skillMdPath, "utf-8");
|
|
101990
102013
|
const meta3 = parseSkillFrontmatter(content);
|
|
101991
102014
|
return [{ name: d2.name, ...meta3, path: join33(getSkillsDir(), d2.name) }];
|
|
101992
102015
|
} catch {
|
|
@@ -102135,10 +102158,10 @@ async function onSkillInstalledInner(skillName) {
|
|
|
102135
102158
|
if (!accessor2)
|
|
102136
102159
|
return;
|
|
102137
102160
|
const skillMdPath = join33(getSkillsDir(), skillName, "SKILL.md");
|
|
102138
|
-
if (!
|
|
102161
|
+
if (!existsSync25(skillMdPath))
|
|
102139
102162
|
return;
|
|
102140
102163
|
try {
|
|
102141
|
-
const content =
|
|
102164
|
+
const content = readFileSync22(skillMdPath, "utf-8");
|
|
102142
102165
|
const parsed = parseSkillFile(content);
|
|
102143
102166
|
if (!parsed) {
|
|
102144
102167
|
logger.warn("skills", "Failed to parse SKILL.md frontmatter for graph", { skill: skillName });
|
|
@@ -102156,7 +102179,7 @@ async function onSkillInstalledInner(skillName) {
|
|
|
102156
102179
|
fsPath: skillMdPath
|
|
102157
102180
|
}, accessor2, memoryCfg.pipelineV2, memoryCfg.embedding, fetchEmbeddingFn, getProviderSafe());
|
|
102158
102181
|
if (result.enriched) {
|
|
102159
|
-
const freshContent =
|
|
102182
|
+
const freshContent = readFileSync22(skillMdPath, "utf-8");
|
|
102160
102183
|
const freshParsed = parseSkillFile(freshContent);
|
|
102161
102184
|
if (freshParsed) {
|
|
102162
102185
|
const enrichedFm = accessor2.withReadDb((db) => db.prepare("SELECT triggers, tags FROM skill_meta WHERE entity_id = ?").get(result.entityId));
|
|
@@ -102187,7 +102210,7 @@ async function onSkillInstalledInner(skillName) {
|
|
|
102187
102210
|
tags: patchTags
|
|
102188
102211
|
});
|
|
102189
102212
|
if (patched) {
|
|
102190
|
-
|
|
102213
|
+
writeFileSync12(skillMdPath, patched, "utf-8");
|
|
102191
102214
|
logger.info("skills", "Wrote enrichment back to SKILL.md", { skill: skillName });
|
|
102192
102215
|
}
|
|
102193
102216
|
}
|
|
@@ -102342,9 +102365,9 @@ function mountSkillsRoutes(app) {
|
|
|
102342
102365
|
return c2.json({ error: "Invalid skill name" }, 400);
|
|
102343
102366
|
}
|
|
102344
102367
|
const skillMdPath = join33(getSkillsDir(), name, "SKILL.md");
|
|
102345
|
-
if (
|
|
102368
|
+
if (existsSync25(skillMdPath)) {
|
|
102346
102369
|
try {
|
|
102347
|
-
const content =
|
|
102370
|
+
const content = readFileSync22(skillMdPath, "utf-8");
|
|
102348
102371
|
const meta3 = parseSkillFrontmatter(content);
|
|
102349
102372
|
return c2.json({
|
|
102350
102373
|
name,
|
|
@@ -102454,7 +102477,7 @@ function mountSkillsRoutes(app) {
|
|
|
102454
102477
|
return c2.json({ error: "Invalid skill name" }, 400);
|
|
102455
102478
|
}
|
|
102456
102479
|
const skillDir = join33(getSkillsDir(), name);
|
|
102457
|
-
if (!
|
|
102480
|
+
if (!existsSync25(skillDir)) {
|
|
102458
102481
|
return c2.json({ error: `Skill '${name}' not found` }, 404);
|
|
102459
102482
|
}
|
|
102460
102483
|
try {
|
|
@@ -105127,7 +105150,7 @@ var init_event_bus = __esm(() => {
|
|
|
105127
105150
|
});
|
|
105128
105151
|
|
|
105129
105152
|
// ../daemon/src/widget-gen.ts
|
|
105130
|
-
import { existsSync as
|
|
105153
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync10, readFileSync as readFileSync23, unlinkSync as unlinkSync3 } from "fs";
|
|
105131
105154
|
import { homedir as homedir22 } from "os";
|
|
105132
105155
|
import { join as join34 } from "path";
|
|
105133
105156
|
function agentsDir2() {
|
|
@@ -105141,7 +105164,7 @@ function widgetPath(serverId) {
|
|
|
105141
105164
|
}
|
|
105142
105165
|
function ensureWidgetDir() {
|
|
105143
105166
|
const dir = widgetDir();
|
|
105144
|
-
if (!
|
|
105167
|
+
if (!existsSync26(dir)) {
|
|
105145
105168
|
mkdirSync10(dir, { recursive: true });
|
|
105146
105169
|
}
|
|
105147
105170
|
}
|
|
@@ -105189,10 +105212,10 @@ function extractHtml(raw2) {
|
|
|
105189
105212
|
}
|
|
105190
105213
|
function loadCachedWidget(serverId) {
|
|
105191
105214
|
const path = widgetPath(serverId);
|
|
105192
|
-
if (!
|
|
105215
|
+
if (!existsSync26(path))
|
|
105193
105216
|
return null;
|
|
105194
105217
|
try {
|
|
105195
|
-
const content =
|
|
105218
|
+
const content = readFileSync23(path, "utf-8");
|
|
105196
105219
|
return content.length > 0 ? content : null;
|
|
105197
105220
|
} catch {
|
|
105198
105221
|
return null;
|
|
@@ -105200,7 +105223,7 @@ function loadCachedWidget(serverId) {
|
|
|
105200
105223
|
}
|
|
105201
105224
|
function deleteCachedWidget(serverId) {
|
|
105202
105225
|
const path = widgetPath(serverId);
|
|
105203
|
-
if (!
|
|
105226
|
+
if (!existsSync26(path))
|
|
105204
105227
|
return false;
|
|
105205
105228
|
try {
|
|
105206
105229
|
unlinkSync3(path);
|
|
@@ -105391,7 +105414,7 @@ var init_widget_gen = __esm(() => {
|
|
|
105391
105414
|
});
|
|
105392
105415
|
|
|
105393
105416
|
// ../daemon/src/mcp-probe.ts
|
|
105394
|
-
import { existsSync as
|
|
105417
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync11, readFileSync as readFileSync24, unlinkSync as unlinkSync4, writeFileSync as writeFileSync13 } from "fs";
|
|
105395
105418
|
import { homedir as homedir23 } from "os";
|
|
105396
105419
|
import { join as join35 } from "path";
|
|
105397
105420
|
function getAgentsDir3() {
|
|
@@ -105405,7 +105428,7 @@ function getAppTrayPath() {
|
|
|
105405
105428
|
}
|
|
105406
105429
|
function ensureManifestsDir() {
|
|
105407
105430
|
const dir = getManifestsDir();
|
|
105408
|
-
if (!
|
|
105431
|
+
if (!existsSync27(dir)) {
|
|
105409
105432
|
mkdirSync11(dir, { recursive: true });
|
|
105410
105433
|
}
|
|
105411
105434
|
}
|
|
@@ -105658,7 +105681,7 @@ async function probeServer(server) {
|
|
|
105658
105681
|
function storeProbeResult(result) {
|
|
105659
105682
|
ensureManifestsDir();
|
|
105660
105683
|
const manifestPath = join35(getManifestsDir(), `${result.serverId}.json`);
|
|
105661
|
-
|
|
105684
|
+
writeFileSync13(manifestPath, JSON.stringify(result, null, 2));
|
|
105662
105685
|
const tray = loadAppTray();
|
|
105663
105686
|
const now4 = new Date().toISOString();
|
|
105664
105687
|
const existingIndex = tray.findIndex((e) => e.id === result.serverId);
|
|
@@ -105684,7 +105707,7 @@ function storeProbeResult(result) {
|
|
|
105684
105707
|
} else {
|
|
105685
105708
|
tray.push(entry);
|
|
105686
105709
|
}
|
|
105687
|
-
|
|
105710
|
+
writeFileSync13(getAppTrayPath(), JSON.stringify(tray, null, 2));
|
|
105688
105711
|
logger.info("probe", `Stored probe result for ${result.serverId}`, {
|
|
105689
105712
|
hasDeclaredManifest: !!result.declaredManifest,
|
|
105690
105713
|
state: entry.state,
|
|
@@ -105703,10 +105726,10 @@ function storeProbeResult(result) {
|
|
|
105703
105726
|
}
|
|
105704
105727
|
function loadAppTray() {
|
|
105705
105728
|
const path = getAppTrayPath();
|
|
105706
|
-
if (!
|
|
105729
|
+
if (!existsSync27(path))
|
|
105707
105730
|
return [];
|
|
105708
105731
|
try {
|
|
105709
|
-
const raw2 = JSON.parse(
|
|
105732
|
+
const raw2 = JSON.parse(readFileSync24(path, "utf-8"));
|
|
105710
105733
|
if (!Array.isArray(raw2))
|
|
105711
105734
|
return [];
|
|
105712
105735
|
return raw2.filter((item) => isRecord10(item) && typeof item.id === "string" && typeof item.name === "string" && typeof item.state === "string");
|
|
@@ -105716,10 +105739,10 @@ function loadAppTray() {
|
|
|
105716
105739
|
}
|
|
105717
105740
|
function loadProbeResult(serverId) {
|
|
105718
105741
|
const path = join35(getManifestsDir(), `${serverId}.json`);
|
|
105719
|
-
if (!
|
|
105742
|
+
if (!existsSync27(path))
|
|
105720
105743
|
return null;
|
|
105721
105744
|
try {
|
|
105722
|
-
const raw2 = JSON.parse(
|
|
105745
|
+
const raw2 = JSON.parse(readFileSync24(path, "utf-8"));
|
|
105723
105746
|
if (!isRecord10(raw2) || typeof raw2.serverId !== "string")
|
|
105724
105747
|
return null;
|
|
105725
105748
|
return raw2;
|
|
@@ -105730,7 +105753,7 @@ function loadProbeResult(serverId) {
|
|
|
105730
105753
|
function removeProbeResult(serverId) {
|
|
105731
105754
|
const manifestPath = join35(getManifestsDir(), `${serverId}.json`);
|
|
105732
105755
|
try {
|
|
105733
|
-
if (
|
|
105756
|
+
if (existsSync27(manifestPath)) {
|
|
105734
105757
|
unlinkSync4(manifestPath);
|
|
105735
105758
|
}
|
|
105736
105759
|
} catch {
|
|
@@ -105739,7 +105762,7 @@ function removeProbeResult(serverId) {
|
|
|
105739
105762
|
const tray = loadAppTray();
|
|
105740
105763
|
const filtered = tray.filter((e) => e.id !== serverId);
|
|
105741
105764
|
if (filtered.length !== tray.length) {
|
|
105742
|
-
|
|
105765
|
+
writeFileSync13(getAppTrayPath(), JSON.stringify(filtered, null, 2));
|
|
105743
105766
|
}
|
|
105744
105767
|
}
|
|
105745
105768
|
async function reprobeServer(server) {
|
|
@@ -105766,7 +105789,7 @@ __export(exports_marketplace, {
|
|
|
105766
105789
|
mountMarketplaceRoutes: () => mountMarketplaceRoutes,
|
|
105767
105790
|
extractStandardMcpConfig: () => extractStandardMcpConfig
|
|
105768
105791
|
});
|
|
105769
|
-
import { existsSync as
|
|
105792
|
+
import { existsSync as existsSync28, mkdirSync as mkdirSync12, readFileSync as readFileSync25, writeFileSync as writeFileSync14 } from "fs";
|
|
105770
105793
|
import { homedir as homedir24 } from "os";
|
|
105771
105794
|
import { join as join36 } from "path";
|
|
105772
105795
|
function getAgentsDir4() {
|
|
@@ -105783,7 +105806,7 @@ function getExposurePolicyPath() {
|
|
|
105783
105806
|
}
|
|
105784
105807
|
function ensureMarketplaceDir() {
|
|
105785
105808
|
const dir = getMarketplaceDir();
|
|
105786
|
-
if (!
|
|
105809
|
+
if (!existsSync28(dir)) {
|
|
105787
105810
|
mkdirSync12(dir, { recursive: true });
|
|
105788
105811
|
}
|
|
105789
105812
|
}
|
|
@@ -105911,11 +105934,11 @@ function parseExposurePolicy(value) {
|
|
|
105911
105934
|
}
|
|
105912
105935
|
function readExposurePolicy() {
|
|
105913
105936
|
const path = getExposurePolicyPath();
|
|
105914
|
-
if (!
|
|
105937
|
+
if (!existsSync28(path)) {
|
|
105915
105938
|
return DEFAULT_EXPOSURE_POLICY;
|
|
105916
105939
|
}
|
|
105917
105940
|
try {
|
|
105918
|
-
const raw2 = JSON.parse(
|
|
105941
|
+
const raw2 = JSON.parse(readFileSync25(path, "utf-8"));
|
|
105919
105942
|
return parseExposurePolicy(raw2) ?? DEFAULT_EXPOSURE_POLICY;
|
|
105920
105943
|
} catch {
|
|
105921
105944
|
return DEFAULT_EXPOSURE_POLICY;
|
|
@@ -105923,7 +105946,7 @@ function readExposurePolicy() {
|
|
|
105923
105946
|
}
|
|
105924
105947
|
function writeExposurePolicy(policy) {
|
|
105925
105948
|
ensureMarketplaceDir();
|
|
105926
|
-
|
|
105949
|
+
writeFileSync14(getExposurePolicyPath(), JSON.stringify(policy, null, 2));
|
|
105927
105950
|
}
|
|
105928
105951
|
function extractContextFromRequest(c2) {
|
|
105929
105952
|
return extractScopeContext({
|
|
@@ -106335,10 +106358,10 @@ function parseInstalledServer(value) {
|
|
|
106335
106358
|
}
|
|
106336
106359
|
function readInstalledServers() {
|
|
106337
106360
|
const path = getInstalledMcpPath();
|
|
106338
|
-
if (!
|
|
106361
|
+
if (!existsSync28(path))
|
|
106339
106362
|
return [];
|
|
106340
106363
|
try {
|
|
106341
|
-
const raw2 = JSON.parse(
|
|
106364
|
+
const raw2 = JSON.parse(readFileSync25(path, "utf-8"));
|
|
106342
106365
|
if (!Array.isArray(raw2))
|
|
106343
106366
|
return [];
|
|
106344
106367
|
return raw2.map((item) => parseInstalledServer(item)).filter((item) => item !== null);
|
|
@@ -106348,7 +106371,7 @@ function readInstalledServers() {
|
|
|
106348
106371
|
}
|
|
106349
106372
|
function writeInstalledServers(servers) {
|
|
106350
106373
|
ensureMarketplaceDir();
|
|
106351
|
-
|
|
106374
|
+
writeFileSync14(getInstalledMcpPath(), JSON.stringify(servers, null, 2));
|
|
106352
106375
|
}
|
|
106353
106376
|
async function fetchMcpServersOrgDetail(catalogId) {
|
|
106354
106377
|
const url2 = `https://r.jina.ai/http://mcpservers.org/${MCPSERVERS_LOCALE}/servers/${catalogId}`;
|
|
@@ -107035,7 +107058,7 @@ var exports_marketplace_helpers = {};
|
|
|
107035
107058
|
__export(exports_marketplace_helpers, {
|
|
107036
107059
|
readInstalledServersPublic: () => readInstalledServersPublic
|
|
107037
107060
|
});
|
|
107038
|
-
import { existsSync as
|
|
107061
|
+
import { existsSync as existsSync29, readFileSync as readFileSync26 } from "fs";
|
|
107039
107062
|
import { homedir as homedir25 } from "os";
|
|
107040
107063
|
import { join as join37 } from "path";
|
|
107041
107064
|
function getAgentsDir5() {
|
|
@@ -107049,10 +107072,10 @@ function isRecord12(value) {
|
|
|
107049
107072
|
}
|
|
107050
107073
|
function readInstalledServersPublic() {
|
|
107051
107074
|
const path = getInstalledMcpPath2();
|
|
107052
|
-
if (!
|
|
107075
|
+
if (!existsSync29(path))
|
|
107053
107076
|
return [];
|
|
107054
107077
|
try {
|
|
107055
|
-
const raw2 = JSON.parse(
|
|
107078
|
+
const raw2 = JSON.parse(readFileSync26(path, "utf-8"));
|
|
107056
107079
|
if (!Array.isArray(raw2))
|
|
107057
107080
|
return [];
|
|
107058
107081
|
return raw2.filter((item) => isRecord12(item) && typeof item.id === "string" && typeof item.name === "string" && typeof item.enabled === "boolean");
|
|
@@ -107063,7 +107086,7 @@ function readInstalledServersPublic() {
|
|
|
107063
107086
|
var init_marketplace_helpers = () => {};
|
|
107064
107087
|
|
|
107065
107088
|
// ../daemon/src/routes/app-tray.ts
|
|
107066
|
-
import { existsSync as
|
|
107089
|
+
import { existsSync as existsSync30, mkdirSync as mkdirSync13, readFileSync as readFileSync27, writeFileSync as writeFileSync15 } from "fs";
|
|
107067
107090
|
import { join as join38 } from "path";
|
|
107068
107091
|
import { homedir as homedir26 } from "os";
|
|
107069
107092
|
function isValidState(s2) {
|
|
@@ -107141,7 +107164,7 @@ function mountAppTrayRoutes(app) {
|
|
|
107141
107164
|
const freshIds = new Set(fresh.map((e) => e.id));
|
|
107142
107165
|
const toAdd = stubs.filter((s2) => !freshIds.has(s2.id));
|
|
107143
107166
|
if (toAdd.length > 0) {
|
|
107144
|
-
|
|
107167
|
+
writeFileSync15(join38(getMarketplaceDir2(), "app-tray.json"), JSON.stringify([...fresh, ...toAdd], null, 2));
|
|
107145
107168
|
}
|
|
107146
107169
|
logger.info("os", `Synced ${toAdd.length} installed server(s) to app tray`);
|
|
107147
107170
|
} catch (err) {
|
|
@@ -107217,7 +107240,7 @@ function mountAppTrayRoutes(app) {
|
|
|
107217
107240
|
tray[index] = updated;
|
|
107218
107241
|
const agentsDir3 = process.env.SIGNET_PATH || join38(homedir26(), ".agents");
|
|
107219
107242
|
const trayPath = join38(agentsDir3, "marketplace", "app-tray.json");
|
|
107220
|
-
|
|
107243
|
+
writeFileSync15(trayPath, JSON.stringify(tray, null, 2));
|
|
107221
107244
|
return c2.json({ success: true, entry: updated });
|
|
107222
107245
|
});
|
|
107223
107246
|
app.post("/api/os/install", async (c2) => {
|
|
@@ -107276,7 +107299,7 @@ function mountAppTrayRoutes(app) {
|
|
|
107276
107299
|
};
|
|
107277
107300
|
const agentsDir3 = process.env.SIGNET_PATH || join38(homedir26(), ".agents");
|
|
107278
107301
|
const trayPath = join38(agentsDir3, "marketplace", "app-tray.json");
|
|
107279
|
-
|
|
107302
|
+
writeFileSync15(trayPath, JSON.stringify(tray, null, 2));
|
|
107280
107303
|
}
|
|
107281
107304
|
}
|
|
107282
107305
|
}
|
|
@@ -107303,7 +107326,7 @@ function getInstalledMcpPath3() {
|
|
|
107303
107326
|
}
|
|
107304
107327
|
function ensureMarketplaceDir2() {
|
|
107305
107328
|
const dir = getMarketplaceDir2();
|
|
107306
|
-
if (!
|
|
107329
|
+
if (!existsSync30(dir)) {
|
|
107307
107330
|
mkdirSync13(dir, { recursive: true });
|
|
107308
107331
|
}
|
|
107309
107332
|
}
|
|
@@ -107346,10 +107369,10 @@ function inferCategory2(text) {
|
|
|
107346
107369
|
}
|
|
107347
107370
|
function readInstalledServersRaw() {
|
|
107348
107371
|
const path = getInstalledMcpPath3();
|
|
107349
|
-
if (!
|
|
107372
|
+
if (!existsSync30(path))
|
|
107350
107373
|
return [];
|
|
107351
107374
|
try {
|
|
107352
|
-
const raw2 = JSON.parse(
|
|
107375
|
+
const raw2 = JSON.parse(readFileSync27(path, "utf-8"));
|
|
107353
107376
|
if (!Array.isArray(raw2))
|
|
107354
107377
|
return [];
|
|
107355
107378
|
return raw2;
|
|
@@ -107359,7 +107382,7 @@ function readInstalledServersRaw() {
|
|
|
107359
107382
|
}
|
|
107360
107383
|
function writeInstalledServersRaw(servers) {
|
|
107361
107384
|
ensureMarketplaceDir2();
|
|
107362
|
-
|
|
107385
|
+
writeFileSync15(getInstalledMcpPath3(), JSON.stringify(servers, null, 2));
|
|
107363
107386
|
}
|
|
107364
107387
|
function makeUniqueServerId2(baseId, installed) {
|
|
107365
107388
|
if (!installed.some((s2) => s2.id === baseId))
|
|
@@ -107434,7 +107457,7 @@ var init_app_tray = __esm(() => {
|
|
|
107434
107457
|
});
|
|
107435
107458
|
|
|
107436
107459
|
// ../daemon/src/routes/widget.ts
|
|
107437
|
-
import { existsSync as
|
|
107460
|
+
import { existsSync as existsSync31, statSync as statSync7 } from "fs";
|
|
107438
107461
|
import { join as join39 } from "path";
|
|
107439
107462
|
function mountWidgetRoutes(app) {
|
|
107440
107463
|
app.post("/api/os/widget/generate", async (c2) => {
|
|
@@ -107477,7 +107500,7 @@ function mountWidgetRoutes(app) {
|
|
|
107477
107500
|
const path = join39(widgetDir(), `${id}.html`);
|
|
107478
107501
|
let generatedAt = null;
|
|
107479
107502
|
try {
|
|
107480
|
-
if (
|
|
107503
|
+
if (existsSync31(path)) {
|
|
107481
107504
|
const stat5 = statSync7(path);
|
|
107482
107505
|
generatedAt = stat5.mtime.toISOString();
|
|
107483
107506
|
}
|
|
@@ -107565,7 +107588,7 @@ var init_event_bus2 = __esm(() => {
|
|
|
107565
107588
|
|
|
107566
107589
|
// ../daemon/src/routes/marketplace-reviews.ts
|
|
107567
107590
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
107568
|
-
import { existsSync as
|
|
107591
|
+
import { existsSync as existsSync32, mkdirSync as mkdirSync14, readFileSync as readFileSync28, writeFileSync as writeFileSync16 } from "fs";
|
|
107569
107592
|
import { homedir as homedir27 } from "os";
|
|
107570
107593
|
import { join as join40 } from "path";
|
|
107571
107594
|
function getAgentsDir7() {
|
|
@@ -107582,7 +107605,7 @@ function getReviewsConfigPath() {
|
|
|
107582
107605
|
}
|
|
107583
107606
|
function ensureMarketplaceDir3() {
|
|
107584
107607
|
const dir = getMarketplaceDir3();
|
|
107585
|
-
if (!
|
|
107608
|
+
if (!existsSync32(dir)) {
|
|
107586
107609
|
mkdirSync14(dir, { recursive: true });
|
|
107587
107610
|
}
|
|
107588
107611
|
}
|
|
@@ -107644,10 +107667,10 @@ function normalizeReview(value) {
|
|
|
107644
107667
|
}
|
|
107645
107668
|
function readReviews() {
|
|
107646
107669
|
const path = getReviewsPath();
|
|
107647
|
-
if (!
|
|
107670
|
+
if (!existsSync32(path))
|
|
107648
107671
|
return [];
|
|
107649
107672
|
try {
|
|
107650
|
-
const raw2 = JSON.parse(
|
|
107673
|
+
const raw2 = JSON.parse(readFileSync28(path, "utf-8"));
|
|
107651
107674
|
if (!Array.isArray(raw2))
|
|
107652
107675
|
return [];
|
|
107653
107676
|
return raw2.map(normalizeReview).filter((item) => item !== null);
|
|
@@ -107657,14 +107680,14 @@ function readReviews() {
|
|
|
107657
107680
|
}
|
|
107658
107681
|
function writeReviews(reviews) {
|
|
107659
107682
|
ensureMarketplaceDir3();
|
|
107660
|
-
|
|
107683
|
+
writeFileSync16(getReviewsPath(), JSON.stringify(reviews, null, 2), "utf-8");
|
|
107661
107684
|
}
|
|
107662
107685
|
function readConfig() {
|
|
107663
107686
|
const path = getReviewsConfigPath();
|
|
107664
|
-
if (!
|
|
107687
|
+
if (!existsSync32(path))
|
|
107665
107688
|
return DEFAULT_CONFIG3;
|
|
107666
107689
|
try {
|
|
107667
|
-
const raw2 = JSON.parse(
|
|
107690
|
+
const raw2 = JSON.parse(readFileSync28(path, "utf-8"));
|
|
107668
107691
|
if (!isRecord13(raw2))
|
|
107669
107692
|
return DEFAULT_CONFIG3;
|
|
107670
107693
|
return {
|
|
@@ -107679,7 +107702,7 @@ function readConfig() {
|
|
|
107679
107702
|
}
|
|
107680
107703
|
function writeConfig(config2) {
|
|
107681
107704
|
ensureMarketplaceDir3();
|
|
107682
|
-
|
|
107705
|
+
writeFileSync16(getReviewsConfigPath(), JSON.stringify(config2, null, 2), "utf-8");
|
|
107683
107706
|
}
|
|
107684
107707
|
function parseLimit(raw2) {
|
|
107685
107708
|
if (!raw2)
|
|
@@ -107876,7 +107899,7 @@ var init_marketplace_reviews = __esm(() => {
|
|
|
107876
107899
|
});
|
|
107877
107900
|
|
|
107878
107901
|
// ../daemon/src/routes/changelog.ts
|
|
107879
|
-
import { existsSync as
|
|
107902
|
+
import { existsSync as existsSync33, readFileSync as readFileSync29 } from "fs";
|
|
107880
107903
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
107881
107904
|
import { join as join41 } from "path";
|
|
107882
107905
|
function truncateChangelog(content, max = CHANGELOG_MAX_RELEASES) {
|
|
@@ -108002,9 +108025,9 @@ async function fetchAndRender(filename) {
|
|
|
108002
108025
|
}
|
|
108003
108026
|
if (!raw2) {
|
|
108004
108027
|
const localPath = join41(REPO_ROOT, filename);
|
|
108005
|
-
if (
|
|
108028
|
+
if (existsSync33(localPath)) {
|
|
108006
108029
|
try {
|
|
108007
|
-
raw2 =
|
|
108030
|
+
raw2 = readFileSync29(localPath, "utf-8");
|
|
108008
108031
|
source = "local";
|
|
108009
108032
|
} catch (err) {
|
|
108010
108033
|
logger.warn("changelog", `Local read failed for ${filename}`, err);
|
|
@@ -108746,14 +108769,14 @@ import { createHash as createHash4 } from "crypto";
|
|
|
108746
108769
|
import { copyFileSync as copyFileSync2 } from "fs";
|
|
108747
108770
|
import {
|
|
108748
108771
|
appendFileSync as appendFileSync2,
|
|
108749
|
-
existsSync as
|
|
108772
|
+
existsSync as existsSync34,
|
|
108750
108773
|
mkdirSync as mkdirSync15,
|
|
108751
|
-
readFileSync as
|
|
108774
|
+
readFileSync as readFileSync30,
|
|
108752
108775
|
readdirSync as readdirSync7,
|
|
108753
108776
|
realpathSync as realpathSync3,
|
|
108754
108777
|
statSync as statSync8,
|
|
108755
108778
|
unlinkSync as unlinkSync5,
|
|
108756
|
-
writeFileSync as
|
|
108779
|
+
writeFileSync as writeFileSync17
|
|
108757
108780
|
} from "fs";
|
|
108758
108781
|
import { homedir as homedir28 } from "os";
|
|
108759
108782
|
import { basename as basename7, dirname as dirname10, join as join42 } from "path";
|
|
@@ -108827,10 +108850,10 @@ function isAllowedOrigin(origin) {
|
|
|
108827
108850
|
function readConfiguredNetworkBinding(agentsDir3) {
|
|
108828
108851
|
for (const name of ["agent.yaml", "AGENT.yaml"]) {
|
|
108829
108852
|
const path = join42(agentsDir3, name);
|
|
108830
|
-
if (!
|
|
108853
|
+
if (!existsSync34(path))
|
|
108831
108854
|
continue;
|
|
108832
108855
|
try {
|
|
108833
|
-
return resolveNetworkBinding(readNetworkMode(parseSimpleYaml(
|
|
108856
|
+
return resolveNetworkBinding(readNetworkMode(parseSimpleYaml(readFileSync30(path, "utf-8"))));
|
|
108834
108857
|
} catch {}
|
|
108835
108858
|
}
|
|
108836
108859
|
return resolveNetworkBinding("localhost");
|
|
@@ -108946,12 +108969,12 @@ function resolveDaemonBinary() {
|
|
|
108946
108969
|
join42(process.cwd(), "packages", "daemon-rs", "target", "release", `signet-daemon${ext}`)
|
|
108947
108970
|
];
|
|
108948
108971
|
for (const p2 of devPaths) {
|
|
108949
|
-
if (
|
|
108972
|
+
if (existsSync34(p2))
|
|
108950
108973
|
return p2;
|
|
108951
108974
|
}
|
|
108952
108975
|
const name = `signet-daemon-${plat}-${arch2}${ext}`;
|
|
108953
108976
|
const npmPath = join42(import.meta.dir, "..", "bin", name);
|
|
108954
|
-
if (
|
|
108977
|
+
if (existsSync34(npmPath))
|
|
108955
108978
|
return npmPath;
|
|
108956
108979
|
return null;
|
|
108957
108980
|
}
|
|
@@ -108961,19 +108984,19 @@ function setupShadowDb(agentsDir3) {
|
|
|
108961
108984
|
mkdirSync15(shadowMemDir, { recursive: true });
|
|
108962
108985
|
const mainDb = join42(agentsDir3, "memory", "memories.db");
|
|
108963
108986
|
const shadowDb = join42(shadowMemDir, "memories.db");
|
|
108964
|
-
const stale = !
|
|
108965
|
-
if (stale &&
|
|
108987
|
+
const stale = !existsSync34(shadowDb) || Date.now() - statSync8(shadowDb).mtimeMs > 24 * 60 * 60 * 1000;
|
|
108988
|
+
if (stale && existsSync34(mainDb)) {
|
|
108966
108989
|
copyFileSync2(mainDb, shadowDb);
|
|
108967
108990
|
for (const ext of ["-wal", "-shm"]) {
|
|
108968
108991
|
const src = mainDb + ext;
|
|
108969
|
-
if (
|
|
108992
|
+
if (existsSync34(src))
|
|
108970
108993
|
copyFileSync2(src, shadowDb + ext);
|
|
108971
108994
|
}
|
|
108972
108995
|
logger.info("shadow", "Shadow DB refreshed");
|
|
108973
108996
|
}
|
|
108974
108997
|
const mainCfg = join42(agentsDir3, "agent.yaml");
|
|
108975
108998
|
const shadowCfg = join42(shadowRoot, "agent.yaml");
|
|
108976
|
-
if (
|
|
108999
|
+
if (existsSync34(mainCfg))
|
|
108977
109000
|
copyFileSync2(mainCfg, shadowCfg);
|
|
108978
109001
|
return shadowRoot;
|
|
108979
109002
|
}
|
|
@@ -109037,11 +109060,11 @@ function buildPredictorHealthParams() {
|
|
|
109037
109060
|
};
|
|
109038
109061
|
}
|
|
109039
109062
|
function getVersionFromPackageJson(packageJsonPath) {
|
|
109040
|
-
if (!
|
|
109063
|
+
if (!existsSync34(packageJsonPath)) {
|
|
109041
109064
|
return null;
|
|
109042
109065
|
}
|
|
109043
109066
|
try {
|
|
109044
|
-
const raw2 =
|
|
109067
|
+
const raw2 = readFileSync30(packageJsonPath, "utf8");
|
|
109045
109068
|
const parsed = JSON.parse(raw2);
|
|
109046
109069
|
return typeof parsed.version === "string" ? parsed.version : null;
|
|
109047
109070
|
} catch {
|
|
@@ -109168,10 +109191,10 @@ function getConfiguredProviderHints(agentsDir3) {
|
|
|
109168
109191
|
let extraction = null;
|
|
109169
109192
|
let synthesis = null;
|
|
109170
109193
|
for (const path of paths) {
|
|
109171
|
-
if (!
|
|
109194
|
+
if (!existsSync34(path))
|
|
109172
109195
|
continue;
|
|
109173
109196
|
try {
|
|
109174
|
-
const yaml = toRecord2(parseSimpleYaml(
|
|
109197
|
+
const yaml = toRecord2(parseSimpleYaml(readFileSync30(path, "utf-8")));
|
|
109175
109198
|
const mem = toRecord2(yaml?.memory);
|
|
109176
109199
|
const pipeline3 = toRecord2(mem?.pipelineV2);
|
|
109177
109200
|
const extractionObj = toRecord2(pipeline3?.extraction);
|
|
@@ -109296,7 +109319,7 @@ function isMissingEmbeddingsTableError(error48) {
|
|
|
109296
109319
|
}
|
|
109297
109320
|
async function runLegacyEmbeddingsExport(withVectors, limit, offset) {
|
|
109298
109321
|
const scriptPath = join42(AGENTS_DIR7, "memory", "scripts", "export_embeddings.py");
|
|
109299
|
-
if (!
|
|
109322
|
+
if (!existsSync34(scriptPath)) {
|
|
109300
109323
|
return null;
|
|
109301
109324
|
}
|
|
109302
109325
|
const args = [scriptPath, "--limit", String(limit), "--offset", String(offset)];
|
|
@@ -109475,7 +109498,7 @@ function getDashboardPath() {
|
|
|
109475
109498
|
join42(__dirname3, "dashboard")
|
|
109476
109499
|
];
|
|
109477
109500
|
for (const candidate of candidates) {
|
|
109478
|
-
if (
|
|
109501
|
+
if (existsSync34(join42(candidate, "index.html"))) {
|
|
109479
109502
|
return candidate;
|
|
109480
109503
|
}
|
|
109481
109504
|
}
|
|
@@ -110086,10 +110109,10 @@ function loadGitConfig() {
|
|
|
110086
110109
|
};
|
|
110087
110110
|
const paths = [join42(AGENTS_DIR7, "agent.yaml"), join42(AGENTS_DIR7, "AGENT.yaml")];
|
|
110088
110111
|
for (const p2 of paths) {
|
|
110089
|
-
if (!
|
|
110112
|
+
if (!existsSync34(p2))
|
|
110090
110113
|
continue;
|
|
110091
110114
|
try {
|
|
110092
|
-
const yaml = parseSimpleYaml(
|
|
110115
|
+
const yaml = parseSimpleYaml(readFileSync30(p2, "utf-8"));
|
|
110093
110116
|
const git = yaml.git;
|
|
110094
110117
|
if (git) {
|
|
110095
110118
|
if (git.enabled !== undefined)
|
|
@@ -110114,7 +110137,7 @@ function loadGitConfig() {
|
|
|
110114
110137
|
return defaults;
|
|
110115
110138
|
}
|
|
110116
110139
|
function isGitRepo(dir) {
|
|
110117
|
-
return
|
|
110140
|
+
return existsSync34(join42(dir, ".git"));
|
|
110118
110141
|
}
|
|
110119
110142
|
async function runCommand(cmd, args, options) {
|
|
110120
110143
|
return new Promise((resolve7) => {
|
|
@@ -110497,10 +110520,10 @@ async function getGitStatus() {
|
|
|
110497
110520
|
}
|
|
110498
110521
|
function ensureProtectedGitignore(dir) {
|
|
110499
110522
|
const gitignorePath = join42(dir, ".gitignore");
|
|
110500
|
-
const existingContent =
|
|
110523
|
+
const existingContent = existsSync34(gitignorePath) ? readFileSync30(gitignorePath, "utf-8") : "";
|
|
110501
110524
|
const nextContent = mergeSignetGitignoreEntries(existingContent);
|
|
110502
110525
|
if (nextContent !== existingContent) {
|
|
110503
|
-
|
|
110526
|
+
writeFileSync17(gitignorePath, nextContent, "utf-8");
|
|
110504
110527
|
}
|
|
110505
110528
|
}
|
|
110506
110529
|
async function gitUntrackProtectedFiles(dir) {
|
|
@@ -110603,9 +110626,9 @@ function scheduleAutoCommit(changedPath) {
|
|
|
110603
110626
|
}
|
|
110604
110627
|
async function syncHarnessConfigs() {
|
|
110605
110628
|
const agentsMdPath = join42(AGENTS_DIR7, "AGENTS.md");
|
|
110606
|
-
if (!
|
|
110629
|
+
if (!existsSync34(agentsMdPath))
|
|
110607
110630
|
return;
|
|
110608
|
-
const rawContent =
|
|
110631
|
+
const rawContent = readFileSync30(agentsMdPath, "utf-8");
|
|
110609
110632
|
const content = stripSignetBlock(rawContent);
|
|
110610
110633
|
const withBlock = buildSignetBlock() + content;
|
|
110611
110634
|
const buildHeader = (targetName) => {
|
|
@@ -110616,7 +110639,7 @@ async function syncHarnessConfigs() {
|
|
|
110616
110639
|
{ name: "MEMORY.md", desc: "Working memory context" },
|
|
110617
110640
|
{ name: "agent.yaml", desc: "Configuration & settings" }
|
|
110618
110641
|
];
|
|
110619
|
-
const existingFiles = files.filter((f2) =>
|
|
110642
|
+
const existingFiles = files.filter((f2) => existsSync34(join42(AGENTS_DIR7, f2.name)));
|
|
110620
110643
|
const fileList = existingFiles.map((f2) => `# - ~/.agents/${f2.name} (${f2.desc})`).join(`
|
|
110621
110644
|
`);
|
|
110622
110645
|
return `# ${targetName}
|
|
@@ -110641,10 +110664,10 @@ ${fileList}
|
|
|
110641
110664
|
};
|
|
110642
110665
|
const identityExtras = ["SOUL.md", "IDENTITY.md", "USER.md", "MEMORY.md"].map((name) => {
|
|
110643
110666
|
const p2 = join42(AGENTS_DIR7, name);
|
|
110644
|
-
if (!
|
|
110667
|
+
if (!existsSync34(p2))
|
|
110645
110668
|
return "";
|
|
110646
110669
|
try {
|
|
110647
|
-
const c2 =
|
|
110670
|
+
const c2 = readFileSync30(p2, "utf-8").trim();
|
|
110648
110671
|
if (!c2)
|
|
110649
110672
|
return "";
|
|
110650
110673
|
const header = name.replace(".md", "");
|
|
@@ -110659,9 +110682,9 @@ ${c2}`;
|
|
|
110659
110682
|
`);
|
|
110660
110683
|
const composed = withBlock + identityExtras;
|
|
110661
110684
|
const opencodeDir = join42(homedir28(), ".config", "opencode");
|
|
110662
|
-
if (
|
|
110685
|
+
if (existsSync34(opencodeDir)) {
|
|
110663
110686
|
try {
|
|
110664
|
-
|
|
110687
|
+
writeFileSync17(join42(opencodeDir, "AGENTS.md"), buildHeader("AGENTS.md") + composed);
|
|
110665
110688
|
logger.sync.harness("opencode", "~/.config/opencode/AGENTS.md");
|
|
110666
110689
|
} catch (e) {
|
|
110667
110690
|
logger.sync.failed("opencode", e);
|
|
@@ -110672,7 +110695,7 @@ ${c2}`;
|
|
|
110672
110695
|
}
|
|
110673
110696
|
function syncAgentWorkspaces(agentsDir3) {
|
|
110674
110697
|
const agentsRoot = join42(agentsDir3, "agents");
|
|
110675
|
-
if (!
|
|
110698
|
+
if (!existsSync34(agentsRoot))
|
|
110676
110699
|
return;
|
|
110677
110700
|
let entries;
|
|
110678
110701
|
try {
|
|
@@ -110684,17 +110707,17 @@ function syncAgentWorkspaces(agentsDir3) {
|
|
|
110684
110707
|
const agentDir = join42(agentsRoot, name);
|
|
110685
110708
|
const workspaceDir = join42(agentDir, "workspace");
|
|
110686
110709
|
const agentsMdPath = join42(agentsDir3, "AGENTS.md");
|
|
110687
|
-
if (!
|
|
110710
|
+
if (!existsSync34(agentsMdPath))
|
|
110688
110711
|
continue;
|
|
110689
110712
|
try {
|
|
110690
|
-
const base =
|
|
110713
|
+
const base = readFileSync30(agentsMdPath, "utf-8");
|
|
110691
110714
|
const agentIdentity = ["SOUL.md", "IDENTITY.md"].map((f2) => {
|
|
110692
110715
|
const override = join42(agentDir, f2);
|
|
110693
110716
|
const root = join42(agentsDir3, f2);
|
|
110694
|
-
const p2 =
|
|
110717
|
+
const p2 = existsSync34(override) ? override : existsSync34(root) ? root : null;
|
|
110695
110718
|
if (!p2)
|
|
110696
110719
|
return "";
|
|
110697
|
-
const c2 =
|
|
110720
|
+
const c2 = readFileSync30(p2, "utf-8").trim();
|
|
110698
110721
|
return c2 ? `
|
|
110699
110722
|
## ${f2.replace(".md", "")}
|
|
110700
110723
|
|
|
@@ -110703,9 +110726,9 @@ ${c2}` : "";
|
|
|
110703
110726
|
`);
|
|
110704
110727
|
const sharedIdentity = ["USER.md", "MEMORY.md"].map((f2) => {
|
|
110705
110728
|
const p2 = join42(agentsDir3, f2);
|
|
110706
|
-
if (!
|
|
110729
|
+
if (!existsSync34(p2))
|
|
110707
110730
|
return "";
|
|
110708
|
-
const c2 =
|
|
110731
|
+
const c2 = readFileSync30(p2, "utf-8").trim();
|
|
110709
110732
|
return c2 ? `
|
|
110710
110733
|
## ${f2.replace(".md", "")}
|
|
110711
110734
|
|
|
@@ -110714,8 +110737,10 @@ ${c2}` : "";
|
|
|
110714
110737
|
`);
|
|
110715
110738
|
const composed = base + agentIdentity + sharedIdentity;
|
|
110716
110739
|
mkdirSync15(workspaceDir, { recursive: true });
|
|
110717
|
-
|
|
110718
|
-
|
|
110740
|
+
const workspaceAgentsPath = join42(workspaceDir, "AGENTS.md");
|
|
110741
|
+
if (writeFileIfChanged(workspaceAgentsPath, composed)) {
|
|
110742
|
+
logger.sync.harness(`openclaw:${name}`, workspaceAgentsPath);
|
|
110743
|
+
}
|
|
110719
110744
|
} catch (e) {
|
|
110720
110745
|
logger.error("sync", `Failed to sync agent workspace: ${name}`, e);
|
|
110721
110746
|
}
|
|
@@ -110725,9 +110750,7 @@ function ensureArchitectureDoc() {
|
|
|
110725
110750
|
const archPath = join42(AGENTS_DIR7, "SIGNET-ARCHITECTURE.md");
|
|
110726
110751
|
try {
|
|
110727
110752
|
const archContent = buildArchitectureDoc();
|
|
110728
|
-
|
|
110729
|
-
if (existing !== archContent) {
|
|
110730
|
-
writeFileSync16(archPath, archContent);
|
|
110753
|
+
if (writeFileIfChanged(archPath, archContent)) {
|
|
110731
110754
|
logger.info("sync", "SIGNET-ARCHITECTURE.md updated");
|
|
110732
110755
|
}
|
|
110733
110756
|
} catch (e) {
|
|
@@ -110820,7 +110843,7 @@ function startFileWatcher() {
|
|
|
110820
110843
|
}
|
|
110821
110844
|
function startClaudeMemoryWatcher() {
|
|
110822
110845
|
const claudeProjectsDir = join42(homedir28(), ".claude", "projects");
|
|
110823
|
-
if (!
|
|
110846
|
+
if (!existsSync34(claudeProjectsDir))
|
|
110824
110847
|
return;
|
|
110825
110848
|
const claudeWatcher = watch(join42(claudeProjectsDir, "**", "memory", "MEMORY.md"), {
|
|
110826
110849
|
persistent: true,
|
|
@@ -110841,7 +110864,7 @@ async function syncExistingClaudeMemories(claudeProjectsDir) {
|
|
|
110841
110864
|
let totalSynced = 0;
|
|
110842
110865
|
for (const project of projects) {
|
|
110843
110866
|
const memoryFile = join42(claudeProjectsDir, project, "memory", "MEMORY.md");
|
|
110844
|
-
if (
|
|
110867
|
+
if (existsSync34(memoryFile)) {
|
|
110845
110868
|
const count2 = await syncClaudeMemoryFile(memoryFile);
|
|
110846
110869
|
totalSynced += count2;
|
|
110847
110870
|
}
|
|
@@ -110857,7 +110880,7 @@ async function syncExistingClaudeMemories(claudeProjectsDir) {
|
|
|
110857
110880
|
}
|
|
110858
110881
|
async function syncClaudeMemoryFile(filePath) {
|
|
110859
110882
|
try {
|
|
110860
|
-
const content =
|
|
110883
|
+
const content = readFileSync30(filePath, "utf-8");
|
|
110861
110884
|
if (!content.trim())
|
|
110862
110885
|
return 0;
|
|
110863
110886
|
const match2 = filePath.match(/projects\/([^/]+)\/memory/);
|
|
@@ -111062,7 +111085,7 @@ async function ingestMemoryMarkdown(filePath) {
|
|
|
111062
111085
|
return 0;
|
|
111063
111086
|
let content;
|
|
111064
111087
|
try {
|
|
111065
|
-
content =
|
|
111088
|
+
content = readFileSync30(filePath, "utf-8");
|
|
111066
111089
|
} catch (e) {
|
|
111067
111090
|
logger.error("watcher", "Failed to read memory file", undefined, {
|
|
111068
111091
|
path: filePath,
|
|
@@ -111137,7 +111160,7 @@ async function ingestMemoryMarkdown(filePath) {
|
|
|
111137
111160
|
}
|
|
111138
111161
|
async function importExistingMemoryFiles() {
|
|
111139
111162
|
const memoryDir = join42(AGENTS_DIR7, "memory");
|
|
111140
|
-
if (!
|
|
111163
|
+
if (!existsSync34(memoryDir)) {
|
|
111141
111164
|
logger.debug("daemon", "Memory directory does not exist, skipping initial import");
|
|
111142
111165
|
return 0;
|
|
111143
111166
|
}
|
|
@@ -111226,7 +111249,7 @@ async function cleanup() {
|
|
|
111226
111249
|
if (watcher) {
|
|
111227
111250
|
watcher.close();
|
|
111228
111251
|
}
|
|
111229
|
-
if (
|
|
111252
|
+
if (existsSync34(PID_FILE)) {
|
|
111230
111253
|
try {
|
|
111231
111254
|
unlinkSync5(PID_FILE);
|
|
111232
111255
|
} catch {}
|
|
@@ -111236,10 +111259,10 @@ function syncAgentRoster(agentsDir3) {
|
|
|
111236
111259
|
const paths = [join42(agentsDir3, "agent.yaml"), join42(agentsDir3, "AGENT.yaml")];
|
|
111237
111260
|
let roster = [];
|
|
111238
111261
|
for (const p2 of paths) {
|
|
111239
|
-
if (!
|
|
111262
|
+
if (!existsSync34(p2))
|
|
111240
111263
|
continue;
|
|
111241
111264
|
try {
|
|
111242
|
-
const yaml = parseSimpleYaml(
|
|
111265
|
+
const yaml = parseSimpleYaml(readFileSync30(p2, "utf-8"));
|
|
111243
111266
|
const agents = yaml.agents;
|
|
111244
111267
|
const raw2 = agents?.roster;
|
|
111245
111268
|
if (Array.isArray(raw2)) {
|
|
@@ -111810,7 +111833,7 @@ async function main() {
|
|
|
111810
111833
|
initDbAccessor(MEMORY_DB2, { agentsDir: AGENTS_DIR7 });
|
|
111811
111834
|
syncAgentRoster(AGENTS_DIR7);
|
|
111812
111835
|
invalidateTraversalCache();
|
|
111813
|
-
|
|
111836
|
+
writeFileSync17(PID_FILE, process.pid.toString());
|
|
111814
111837
|
logger.info("daemon", "Process ID", { pid: process.pid });
|
|
111815
111838
|
try {
|
|
111816
111839
|
migrateConfig(AGENTS_DIR7);
|
|
@@ -111950,11 +111973,11 @@ async function main() {
|
|
|
111950
111973
|
const healthStampPath = join42(DAEMON_DIR, "last-healthy-start");
|
|
111951
111974
|
try {
|
|
111952
111975
|
let previousVersion = null;
|
|
111953
|
-
if (
|
|
111954
|
-
const prev = JSON.parse(
|
|
111976
|
+
if (existsSync34(healthStampPath)) {
|
|
111977
|
+
const prev = JSON.parse(readFileSync30(healthStampPath, "utf-8"));
|
|
111955
111978
|
previousVersion = typeof prev.version === "string" ? prev.version : null;
|
|
111956
111979
|
}
|
|
111957
|
-
|
|
111980
|
+
writeFileSync17(healthStampPath, JSON.stringify({
|
|
111958
111981
|
version: CURRENT_VERSION,
|
|
111959
111982
|
startedAt: new Date().toISOString(),
|
|
111960
111983
|
pid: process.pid
|
|
@@ -111972,7 +111995,7 @@ async function main() {
|
|
|
111972
111995
|
logger.error("daemon", "Failed to import existing memory files", undefined, errDetails);
|
|
111973
111996
|
});
|
|
111974
111997
|
const claudeProjectsDir = join42(homedir28(), ".claude", "projects");
|
|
111975
|
-
if (
|
|
111998
|
+
if (existsSync34(claudeProjectsDir)) {
|
|
111976
111999
|
syncExistingClaudeMemories(claudeProjectsDir);
|
|
111977
112000
|
}
|
|
111978
112001
|
});
|
|
@@ -112010,6 +112033,7 @@ var init_daemon = __esm(() => {
|
|
|
112010
112033
|
init_memory_timeline();
|
|
112011
112034
|
init_memory_search();
|
|
112012
112035
|
init_agent_id();
|
|
112036
|
+
init_file_sync();
|
|
112013
112037
|
init_onepassword();
|
|
112014
112038
|
init_temporal_expand();
|
|
112015
112039
|
init_pipeline();
|
|
@@ -112470,7 +112494,7 @@ var init_daemon = __esm(() => {
|
|
|
112470
112494
|
const filePath = join42(AGENTS_DIR7, fileName);
|
|
112471
112495
|
const fileStat = statSync8(filePath);
|
|
112472
112496
|
if (fileStat.isFile()) {
|
|
112473
|
-
const content =
|
|
112497
|
+
const content = readFileSync30(filePath, "utf-8");
|
|
112474
112498
|
files.push({ name: fileName, content, size: fileStat.size });
|
|
112475
112499
|
}
|
|
112476
112500
|
}
|
|
@@ -112507,7 +112531,7 @@ var init_daemon = __esm(() => {
|
|
|
112507
112531
|
if (!file2.endsWith(".md") && !file2.endsWith(".yaml")) {
|
|
112508
112532
|
return c2.json({ error: "Invalid file type" }, 400);
|
|
112509
112533
|
}
|
|
112510
|
-
|
|
112534
|
+
writeFileSync17(join42(AGENTS_DIR7, file2), content, "utf-8");
|
|
112511
112535
|
logger.info("api", "Config file updated", { file: file2 });
|
|
112512
112536
|
return c2.json({ success: true });
|
|
112513
112537
|
} catch (e) {
|
|
@@ -112517,7 +112541,7 @@ var init_daemon = __esm(() => {
|
|
|
112517
112541
|
});
|
|
112518
112542
|
app.get("/api/identity", (c2) => {
|
|
112519
112543
|
try {
|
|
112520
|
-
const content =
|
|
112544
|
+
const content = readFileSync30(join42(AGENTS_DIR7, "IDENTITY.md"), "utf-8");
|
|
112521
112545
|
const lines = content.split(`
|
|
112522
112546
|
`);
|
|
112523
112547
|
const identity3 = {
|
|
@@ -114528,19 +114552,19 @@ var init_daemon = __esm(() => {
|
|
|
114528
114552
|
name: "Claude Code",
|
|
114529
114553
|
id: "claude-code",
|
|
114530
114554
|
path: join42(homedir28(), ".claude", "settings.json"),
|
|
114531
|
-
exists:
|
|
114555
|
+
exists: existsSync34(join42(homedir28(), ".claude", "settings.json"))
|
|
114532
114556
|
},
|
|
114533
114557
|
{
|
|
114534
114558
|
name: "OpenCode",
|
|
114535
114559
|
id: "opencode",
|
|
114536
114560
|
path: join42(homedir28(), ".config", "opencode", "AGENTS.md"),
|
|
114537
|
-
exists:
|
|
114561
|
+
exists: existsSync34(join42(homedir28(), ".config", "opencode", "AGENTS.md"))
|
|
114538
114562
|
},
|
|
114539
114563
|
{
|
|
114540
114564
|
name: "OpenClaw",
|
|
114541
114565
|
id: "openclaw",
|
|
114542
114566
|
path: join42(AGENTS_DIR7, "AGENTS.md"),
|
|
114543
|
-
exists:
|
|
114567
|
+
exists: existsSync34(join42(AGENTS_DIR7, "AGENTS.md"))
|
|
114544
114568
|
},
|
|
114545
114569
|
{
|
|
114546
114570
|
name: "Forge",
|
|
@@ -114561,7 +114585,7 @@ var init_daemon = __esm(() => {
|
|
|
114561
114585
|
app.post("/api/harnesses/regenerate", async (c2) => {
|
|
114562
114586
|
return new Promise((resolve7) => {
|
|
114563
114587
|
const script = join42(SCRIPTS_DIR, "generate-harness-configs.py");
|
|
114564
|
-
if (!
|
|
114588
|
+
if (!existsSync34(script)) {
|
|
114565
114589
|
resolve7(c2.json({ success: false, error: "Regeneration script not found" }, 404));
|
|
114566
114590
|
return;
|
|
114567
114591
|
}
|
|
@@ -115009,7 +115033,7 @@ var init_daemon = __esm(() => {
|
|
|
115009
115033
|
if (checkBypass(body)) {
|
|
115010
115034
|
return c2.json({ success: true, bypassed: true });
|
|
115011
115035
|
}
|
|
115012
|
-
if (!
|
|
115036
|
+
if (!existsSync34(MEMORY_DB2)) {
|
|
115013
115037
|
return c2.json({ error: "Memory database not found" }, 500);
|
|
115014
115038
|
}
|
|
115015
115039
|
const now4 = new Date().toISOString();
|
|
@@ -116063,8 +116087,8 @@ var init_daemon = __esm(() => {
|
|
|
116063
116087
|
let agentCreatedAt = null;
|
|
116064
116088
|
try {
|
|
116065
116089
|
for (const p2 of [join42(AGENTS_DIR7, "agent.yaml"), join42(AGENTS_DIR7, "AGENT.yaml")]) {
|
|
116066
|
-
if (
|
|
116067
|
-
const yaml = parseSimpleYaml(
|
|
116090
|
+
if (existsSync34(p2)) {
|
|
116091
|
+
const yaml = parseSimpleYaml(readFileSync30(p2, "utf-8"));
|
|
116068
116092
|
const agent = yaml.agent;
|
|
116069
116093
|
if (agent?.created) {
|
|
116070
116094
|
agentCreatedAt = String(agent.created);
|
|
@@ -116084,7 +116108,7 @@ var init_daemon = __esm(() => {
|
|
|
116084
116108
|
bindHost: BIND_HOST,
|
|
116085
116109
|
networkMode: NETWORK_MODE,
|
|
116086
116110
|
agentsDir: AGENTS_DIR7,
|
|
116087
|
-
memoryDb:
|
|
116111
|
+
memoryDb: existsSync34(MEMORY_DB2),
|
|
116088
116112
|
pipelineV2: config2.pipelineV2,
|
|
116089
116113
|
providerResolution: providerRuntimeResolution,
|
|
116090
116114
|
logging: {
|
|
@@ -116121,7 +116145,7 @@ var init_daemon = __esm(() => {
|
|
|
116121
116145
|
const soulPath = join42(AGENTS_DIR7, "SOUL.md");
|
|
116122
116146
|
let soulContent = "";
|
|
116123
116147
|
try {
|
|
116124
|
-
soulContent =
|
|
116148
|
+
soulContent = readFileSync30(soulPath, "utf-8").slice(0, 500);
|
|
116125
116149
|
} catch {}
|
|
116126
116150
|
const hour = new Date().getHours();
|
|
116127
116151
|
const timeOfDay = hour < 12 ? "morning" : hour < 17 ? "afternoon" : "evening";
|