@goondocks/myco 0.12.10 → 0.14.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/README.md +6 -0
- package/dist/{agent-run-GUHXRNZB.js → agent-run-3WLMSLMJ.js} +8 -7
- package/dist/{agent-run-GUHXRNZB.js.map → agent-run-3WLMSLMJ.js.map} +1 -1
- package/dist/{agent-tasks-GWZI5WSB.js → agent-tasks-BQE2GEVS.js} +8 -7
- package/dist/{agent-tasks-GWZI5WSB.js.map → agent-tasks-BQE2GEVS.js.map} +1 -1
- package/dist/{chunk-PW5QVY44.js → chunk-4VF6KQ2Z.js} +371 -6
- package/dist/chunk-4VF6KQ2Z.js.map +1 -0
- package/dist/{chunk-QL2RBFIC.js → chunk-5YQ6VOFZ.js} +2 -2
- package/dist/{chunk-MCARJFBA.js → chunk-745SWTQX.js} +4 -4
- package/dist/{chunk-D4M2AV65.js → chunk-DTE3SHYK.js} +46 -3
- package/dist/chunk-DTE3SHYK.js.map +1 -0
- package/dist/{chunk-HLGPGHT7.js → chunk-EVPG26CR.js} +3 -3
- package/dist/{chunk-YRUJ5KGV.js → chunk-GDCSPMH4.js} +3 -3
- package/dist/{chunk-LUQBT2Y4.js → chunk-HHZ3RTEI.js} +2 -2
- package/dist/{chunk-TCGOSLW6.js → chunk-JJXVDCEX.js} +613 -98
- package/dist/chunk-JJXVDCEX.js.map +1 -0
- package/dist/{chunk-D4ESHOOJ.js → chunk-KNTJOMWY.js} +3 -3
- package/dist/{chunk-JHLALJPB.js → chunk-LD6U3L6O.js} +8 -8
- package/dist/{chunk-7NBDELZB.js → chunk-NVCGF2DS.js} +26 -8
- package/dist/{chunk-7NBDELZB.js.map → chunk-NVCGF2DS.js.map} +1 -1
- package/dist/{chunk-SW62AX75.js → chunk-OKCSSDFC.js} +2 -2
- package/dist/{chunk-RR75ZKEV.js → chunk-OQVKLTQY.js} +4 -4
- package/dist/{chunk-OAGY5APE.js → chunk-PSYLKCWQ.js} +83 -7
- package/dist/chunk-PSYLKCWQ.js.map +1 -0
- package/dist/{chunk-Q2AYS2QE.js → chunk-PX5KIOKY.js} +5 -7
- package/dist/chunk-PX5KIOKY.js.map +1 -0
- package/dist/chunk-QLCD77AN.js +93 -0
- package/dist/chunk-QLCD77AN.js.map +1 -0
- package/dist/{chunk-J3L2RTYK.js → chunk-RBFECYNA.js} +2 -2
- package/dist/{chunk-4VSNNMEU.js → chunk-S66YG6QK.js} +26 -3
- package/dist/{chunk-4VSNNMEU.js.map → chunk-S66YG6QK.js.map} +1 -1
- package/dist/chunk-SBVDG5JP.js +112 -0
- package/dist/chunk-SBVDG5JP.js.map +1 -0
- package/dist/{chunk-M5XWW7UI.js → chunk-SODRR3HE.js} +8 -1
- package/dist/chunk-SODRR3HE.js.map +1 -0
- package/dist/{chunk-SFC4GXEN.js → chunk-TNCBMGWB.js} +39 -104
- package/dist/chunk-TNCBMGWB.js.map +1 -0
- package/dist/{chunk-PIRWYDOH.js → chunk-TRA3R4EC.js} +7 -1
- package/dist/chunk-TRA3R4EC.js.map +1 -0
- package/dist/{chunk-LGPBVBFY.js → chunk-TVV6PZOC.js} +5 -7
- package/dist/chunk-TVV6PZOC.js.map +1 -0
- package/dist/{chunk-SVQAPEYH.js → chunk-UWXJCLCK.js} +22 -5
- package/dist/chunk-UWXJCLCK.js.map +1 -0
- package/dist/{chunk-JROOQQH6.js → chunk-X34OFKYU.js} +12 -7
- package/dist/chunk-X34OFKYU.js.map +1 -0
- package/dist/{chunk-FYGFMIS6.js → chunk-ZKXW46HZ.js} +2 -2
- package/dist/{cli-CFOIDXOY.js → cli-SKCINMJI.js} +41 -40
- package/dist/{cli-CFOIDXOY.js.map → cli-SKCINMJI.js.map} +1 -1
- package/dist/{client-ZBCGODTS.js → client-KZGZHHXT.js} +5 -5
- package/dist/{config-6RQ7FAEV.js → config-H657SF6B.js} +5 -3
- package/dist/{config-6RQ7FAEV.js.map → config-H657SF6B.js.map} +1 -1
- package/dist/{detect-providers-JFE3QLJI.js → detect-providers-PAVE2X6O.js} +4 -4
- package/dist/{doctor-W3I7RVU4.js → doctor-6FKSHJRU.js} +13 -11
- package/dist/{doctor-W3I7RVU4.js.map → doctor-6FKSHJRU.js.map} +1 -1
- package/dist/{executor-LKDWMGC7.js → executor-W5MKZH7B.js} +407 -46
- package/dist/executor-W5MKZH7B.js.map +1 -0
- package/dist/{init-M3HYJGHE.js → init-5QHCXBLF.js} +16 -15
- package/dist/{init-M3HYJGHE.js.map → init-5QHCXBLF.js.map} +1 -1
- package/dist/{init-wizard-C4WQA47U.js → init-wizard-HEY4HMG3.js} +12 -12
- package/dist/installer-25TSX4SR.js +13 -0
- package/dist/{llm-O46QYWEM.js → llm-T3QVHC3Y.js} +7 -7
- package/dist/{loader-4FMGOVWF.js → loader-JQLO6K44.js} +4 -2
- package/dist/{loader-BQ4X4K3F.js → loader-WQKVWL5D.js} +4 -4
- package/dist/{main-CMWNMCW2.js → main-IZ277SHB.js} +689 -124
- package/dist/main-IZ277SHB.js.map +1 -0
- package/dist/{open-4N7T37XV.js → open-S7YUWON4.js} +8 -7
- package/dist/{open-4N7T37XV.js.map → open-S7YUWON4.js.map} +1 -1
- package/dist/{openai-embeddings-HWAKOGUM.js → openai-embeddings-5T5ZP7LO.js} +4 -4
- package/dist/{openrouter-GXZK7JXR.js → openrouter-RD2COFC7.js} +4 -4
- package/dist/{post-compact-BPICHUPV.js → post-compact-EFKFT7TM.js} +7 -7
- package/dist/{post-tool-use-OHJ2EH7I.js → post-tool-use-624YC6ZH.js} +7 -7
- package/dist/{post-tool-use-failure-CBPY2TSN.js → post-tool-use-failure-QCHZAWQH.js} +7 -7
- package/dist/{pre-compact-ULAA4XIB.js → pre-compact-7DWH2EM3.js} +7 -7
- package/dist/{provider-check-CKZW3GQX.js → provider-check-QN7OGXZA.js} +4 -4
- package/dist/{registry-ZHUVXGPO.js → registry-2XQMCPA6.js} +5 -5
- package/dist/{remove-52PTVOCJ.js → remove-ESVIET5C.js} +10 -8
- package/dist/{remove-52PTVOCJ.js.map → remove-ESVIET5C.js.map} +1 -1
- package/dist/{resolution-events-WZHPQQMN.js → resolution-events-5EVUEWHS.js} +4 -4
- package/dist/{restart-O37BUPLH.js → restart-AZHV6OKM.js} +9 -8
- package/dist/{restart-O37BUPLH.js.map → restart-AZHV6OKM.js.map} +1 -1
- package/dist/{search-52YK2ZWU.js → search-JS4HXYGS.js} +9 -8
- package/dist/{search-52YK2ZWU.js.map → search-JS4HXYGS.js.map} +1 -1
- package/dist/{server-7OKRAJCM.js → server-KT5GW333.js} +115 -14
- package/dist/server-KT5GW333.js.map +1 -0
- package/dist/{session-57IAZYRK.js → session-JSI67FEM.js} +10 -9
- package/dist/{session-57IAZYRK.js.map → session-JSI67FEM.js.map} +1 -1
- package/dist/{session-end-WRKDJEWM.js → session-end-4CM462MC.js} +6 -6
- package/dist/{session-start-7VWGEVOX.js → session-start-ZGF7F6DE.js} +12 -12
- package/dist/{setup-llm-IDQPX22O.js → setup-llm-S2UYJYIS.js} +10 -9
- package/dist/{setup-llm-IDQPX22O.js.map → setup-llm-S2UYJYIS.js.map} +1 -1
- package/dist/src/agent/definitions/agent.yaml +2 -0
- package/dist/src/agent/definitions/tasks/digest-only.yaml +1 -0
- package/dist/src/agent/definitions/tasks/extract-only.yaml +1 -0
- package/dist/src/agent/definitions/tasks/full-intelligence.yaml +8 -0
- package/dist/src/agent/definitions/tasks/graph-maintenance.yaml +1 -0
- package/dist/src/agent/definitions/tasks/review-session.yaml +1 -0
- package/dist/src/agent/definitions/tasks/skill-evolve.yaml +155 -0
- package/dist/src/agent/definitions/tasks/skill-generate.yaml +210 -0
- package/dist/src/agent/definitions/tasks/skill-survey.yaml +149 -0
- package/dist/src/agent/definitions/tasks/supersession-sweep.yaml +1 -0
- package/dist/src/agent/definitions/tasks/title-summary.yaml +1 -0
- package/dist/src/agent/prompts/agent.md +29 -0
- package/dist/src/cli.js +1 -1
- package/dist/src/daemon/main.js +1 -1
- package/dist/src/hooks/post-tool-use.js +1 -1
- package/dist/src/hooks/session-end.js +1 -1
- package/dist/src/hooks/session-start.js +1 -1
- package/dist/src/hooks/stop.js +1 -1
- package/dist/src/hooks/user-prompt-submit.js +1 -1
- package/dist/src/mcp/server.js +1 -1
- package/dist/src/worker/src/index.ts +3 -0
- package/dist/src/worker/src/schema.ts +56 -0
- package/dist/{stats-D7U5HQ3L.js → stats-D2FM6ZXO.js} +10 -9
- package/dist/{stats-D7U5HQ3L.js.map → stats-D2FM6ZXO.js.map} +1 -1
- package/dist/{stop-VJU4AAOQ.js → stop-DQEKVNST.js} +6 -6
- package/dist/{stop-failure-ILPHO26U.js → stop-failure-EHH7AN5E.js} +7 -7
- package/dist/{subagent-start-77MY4UMP.js → subagent-start-6R52PAFA.js} +7 -7
- package/dist/{subagent-stop-DABERMXZ.js → subagent-stop-CLDFJKYQ.js} +7 -7
- package/dist/{task-completed-TBWBOAJ6.js → task-completed-V47JA3OV.js} +7 -7
- package/dist/{team-K6H4B3ZD.js → team-SJPDXELY.js} +45 -19
- package/dist/team-SJPDXELY.js.map +1 -0
- package/dist/turns-3ZQAF6HF.js +16 -0
- package/dist/turns-3ZQAF6HF.js.map +1 -0
- package/dist/ui/assets/index-BmsHIwjl.css +1 -0
- package/dist/ui/assets/index-Cn6cQwJy.js +842 -0
- package/dist/ui/index.html +2 -2
- package/dist/{update-GW774ZMW.js → update-ZNIYDQHJ.js} +8 -7
- package/dist/{update-GW774ZMW.js.map → update-ZNIYDQHJ.js.map} +1 -1
- package/dist/{user-prompt-submit-C47Y5Y5I.js → user-prompt-submit-6TX6VECI.js} +6 -6
- package/dist/{verify-MQAANTUR.js → verify-JHIMXTY5.js} +8 -8
- package/dist/{version-42DQW43N.js → version-UMEN7OJU.js} +2 -2
- package/dist/version-UMEN7OJU.js.map +1 -0
- package/package.json +6 -6
- package/dist/chunk-D4M2AV65.js.map +0 -1
- package/dist/chunk-JROOQQH6.js.map +0 -1
- package/dist/chunk-LGPBVBFY.js.map +0 -1
- package/dist/chunk-M5XWW7UI.js.map +0 -1
- package/dist/chunk-OAGY5APE.js.map +0 -1
- package/dist/chunk-PIRWYDOH.js.map +0 -1
- package/dist/chunk-PW5QVY44.js.map +0 -1
- package/dist/chunk-Q2AYS2QE.js.map +0 -1
- package/dist/chunk-SFC4GXEN.js.map +0 -1
- package/dist/chunk-SVQAPEYH.js.map +0 -1
- package/dist/chunk-TCGOSLW6.js.map +0 -1
- package/dist/executor-LKDWMGC7.js.map +0 -1
- package/dist/main-CMWNMCW2.js.map +0 -1
- package/dist/server-7OKRAJCM.js.map +0 -1
- package/dist/team-K6H4B3ZD.js.map +0 -1
- package/dist/ui/assets/index-BGbil7f1.css +0 -1
- package/dist/ui/assets/index-ZSGlKT25.js +0 -804
- /package/dist/{chunk-QL2RBFIC.js.map → chunk-5YQ6VOFZ.js.map} +0 -0
- /package/dist/{chunk-MCARJFBA.js.map → chunk-745SWTQX.js.map} +0 -0
- /package/dist/{chunk-HLGPGHT7.js.map → chunk-EVPG26CR.js.map} +0 -0
- /package/dist/{chunk-YRUJ5KGV.js.map → chunk-GDCSPMH4.js.map} +0 -0
- /package/dist/{chunk-LUQBT2Y4.js.map → chunk-HHZ3RTEI.js.map} +0 -0
- /package/dist/{chunk-D4ESHOOJ.js.map → chunk-KNTJOMWY.js.map} +0 -0
- /package/dist/{chunk-JHLALJPB.js.map → chunk-LD6U3L6O.js.map} +0 -0
- /package/dist/{chunk-SW62AX75.js.map → chunk-OKCSSDFC.js.map} +0 -0
- /package/dist/{chunk-RR75ZKEV.js.map → chunk-OQVKLTQY.js.map} +0 -0
- /package/dist/{chunk-J3L2RTYK.js.map → chunk-RBFECYNA.js.map} +0 -0
- /package/dist/{chunk-FYGFMIS6.js.map → chunk-ZKXW46HZ.js.map} +0 -0
- /package/dist/{client-ZBCGODTS.js.map → client-KZGZHHXT.js.map} +0 -0
- /package/dist/{detect-providers-JFE3QLJI.js.map → detect-providers-PAVE2X6O.js.map} +0 -0
- /package/dist/{init-wizard-C4WQA47U.js.map → init-wizard-HEY4HMG3.js.map} +0 -0
- /package/dist/{llm-O46QYWEM.js.map → installer-25TSX4SR.js.map} +0 -0
- /package/dist/{loader-4FMGOVWF.js.map → llm-T3QVHC3Y.js.map} +0 -0
- /package/dist/{loader-BQ4X4K3F.js.map → loader-JQLO6K44.js.map} +0 -0
- /package/dist/{openai-embeddings-HWAKOGUM.js.map → loader-WQKVWL5D.js.map} +0 -0
- /package/dist/{openrouter-GXZK7JXR.js.map → openai-embeddings-5T5ZP7LO.js.map} +0 -0
- /package/dist/{provider-check-CKZW3GQX.js.map → openrouter-RD2COFC7.js.map} +0 -0
- /package/dist/{post-compact-BPICHUPV.js.map → post-compact-EFKFT7TM.js.map} +0 -0
- /package/dist/{post-tool-use-OHJ2EH7I.js.map → post-tool-use-624YC6ZH.js.map} +0 -0
- /package/dist/{post-tool-use-failure-CBPY2TSN.js.map → post-tool-use-failure-QCHZAWQH.js.map} +0 -0
- /package/dist/{pre-compact-ULAA4XIB.js.map → pre-compact-7DWH2EM3.js.map} +0 -0
- /package/dist/{registry-ZHUVXGPO.js.map → provider-check-QN7OGXZA.js.map} +0 -0
- /package/dist/{resolution-events-WZHPQQMN.js.map → registry-2XQMCPA6.js.map} +0 -0
- /package/dist/{version-42DQW43N.js.map → resolution-events-5EVUEWHS.js.map} +0 -0
- /package/dist/{session-end-WRKDJEWM.js.map → session-end-4CM462MC.js.map} +0 -0
- /package/dist/{session-start-7VWGEVOX.js.map → session-start-ZGF7F6DE.js.map} +0 -0
- /package/dist/{stop-VJU4AAOQ.js.map → stop-DQEKVNST.js.map} +0 -0
- /package/dist/{stop-failure-ILPHO26U.js.map → stop-failure-EHH7AN5E.js.map} +0 -0
- /package/dist/{subagent-start-77MY4UMP.js.map → subagent-start-6R52PAFA.js.map} +0 -0
- /package/dist/{subagent-stop-DABERMXZ.js.map → subagent-stop-CLDFJKYQ.js.map} +0 -0
- /package/dist/{task-completed-TBWBOAJ6.js.map → task-completed-V47JA3OV.js.map} +0 -0
- /package/dist/{user-prompt-submit-C47Y5Y5I.js.map → user-prompt-submit-6TX6VECI.js.map} +0 -0
- /package/dist/{verify-MQAANTUR.js.map → verify-JHIMXTY5.js.map} +0 -0
|
@@ -1,33 +1,42 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
insertResolutionEvent
|
|
4
|
-
} from "./chunk-LGPBVBFY.js";
|
|
5
2
|
import {
|
|
6
3
|
STATUS_COMPLETED,
|
|
7
4
|
STATUS_FAILED,
|
|
8
5
|
STATUS_RUNNING,
|
|
9
6
|
createSporeLineage,
|
|
7
|
+
deleteCandidate,
|
|
8
|
+
deleteSkillRecordCascade,
|
|
10
9
|
errorMessage,
|
|
11
|
-
|
|
10
|
+
getCandidate,
|
|
11
|
+
getRunningRunForTask,
|
|
12
|
+
getSkillRecord,
|
|
13
|
+
getSkillRecordByName,
|
|
12
14
|
getUnprocessedBatches,
|
|
15
|
+
insertCandidate,
|
|
13
16
|
insertEntity,
|
|
14
17
|
insertGraphEdge,
|
|
18
|
+
insertLineage,
|
|
15
19
|
insertReport,
|
|
16
20
|
insertRun,
|
|
17
|
-
|
|
21
|
+
insertSkillRecord,
|
|
22
|
+
listCandidates,
|
|
18
23
|
listDigestExtracts,
|
|
19
24
|
listEntities,
|
|
20
25
|
listGraphEdges,
|
|
26
|
+
listSkillRecords,
|
|
21
27
|
markBatchProcessed,
|
|
28
|
+
notify,
|
|
29
|
+
updateCandidate,
|
|
22
30
|
updateRunStatus,
|
|
31
|
+
updateSkillRecord,
|
|
23
32
|
upsertDigestExtract
|
|
24
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-JJXVDCEX.js";
|
|
25
34
|
import {
|
|
26
35
|
fullTextSearch
|
|
27
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-DTE3SHYK.js";
|
|
28
37
|
import {
|
|
29
38
|
loadAllTasks
|
|
30
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-KNTJOMWY.js";
|
|
31
40
|
import {
|
|
32
41
|
getAgent,
|
|
33
42
|
getDefaultTask,
|
|
@@ -36,45 +45,52 @@ import {
|
|
|
36
45
|
loadSystemPrompt,
|
|
37
46
|
resolveDefinitionsDir,
|
|
38
47
|
resolveEffectiveConfig
|
|
39
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-NVCGF2DS.js";
|
|
49
|
+
import {
|
|
50
|
+
insertTurn
|
|
51
|
+
} from "./chunk-QLCD77AN.js";
|
|
52
|
+
import {
|
|
53
|
+
insertResolutionEvent
|
|
54
|
+
} from "./chunk-TVV6PZOC.js";
|
|
40
55
|
import "./chunk-IB76KGBY.js";
|
|
41
56
|
import {
|
|
42
57
|
DEFAULT_IMPORTANCE,
|
|
43
58
|
insertSpore,
|
|
44
59
|
listSpores,
|
|
45
60
|
updateSporeStatus
|
|
46
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-PX5KIOKY.js";
|
|
47
62
|
import {
|
|
48
63
|
listSessions,
|
|
49
64
|
updateSession
|
|
50
|
-
} from "./chunk-
|
|
51
|
-
import "./chunk-
|
|
65
|
+
} from "./chunk-X34OFKYU.js";
|
|
66
|
+
import "./chunk-S66YG6QK.js";
|
|
52
67
|
import {
|
|
53
68
|
createSchema
|
|
54
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-4VF6KQ2Z.js";
|
|
55
70
|
import {
|
|
56
71
|
loadConfig
|
|
57
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-PSYLKCWQ.js";
|
|
58
73
|
import {
|
|
59
74
|
getDatabase,
|
|
60
75
|
initDatabase,
|
|
61
76
|
vaultDbPath
|
|
62
77
|
} from "./chunk-MYX5NCRH.js";
|
|
78
|
+
import {
|
|
79
|
+
getPluginVersion
|
|
80
|
+
} from "./chunk-ZKXW46HZ.js";
|
|
81
|
+
import {
|
|
82
|
+
findPackageRoot
|
|
83
|
+
} from "./chunk-LPUQPDC2.js";
|
|
63
84
|
import {
|
|
64
85
|
DEFAULT_AGENT_ID,
|
|
86
|
+
DEFAULT_LIST_LIMIT,
|
|
65
87
|
MS_PER_SECOND,
|
|
66
88
|
PHASE_SUMMARY_MAX_CHARS,
|
|
67
89
|
SEARCH_SIMILARITY_THRESHOLD,
|
|
68
90
|
TEAM_SOURCE_PREFIX,
|
|
69
91
|
epochSeconds
|
|
70
|
-
} from "./chunk-
|
|
92
|
+
} from "./chunk-TRA3R4EC.js";
|
|
71
93
|
import "./chunk-S6I62FAH.js";
|
|
72
|
-
import {
|
|
73
|
-
getPluginVersion
|
|
74
|
-
} from "./chunk-FYGFMIS6.js";
|
|
75
|
-
import {
|
|
76
|
-
findPackageRoot
|
|
77
|
-
} from "./chunk-LPUQPDC2.js";
|
|
78
94
|
import "./chunk-D7TYRPRM.js";
|
|
79
95
|
import "./chunk-E4VLWIJC.js";
|
|
80
96
|
import {
|
|
@@ -84,9 +100,12 @@ import "./chunk-PZUWP5VK.js";
|
|
|
84
100
|
|
|
85
101
|
// src/agent/executor.ts
|
|
86
102
|
import crypto2 from "crypto";
|
|
103
|
+
import { resolve as resolve2 } from "path";
|
|
87
104
|
|
|
88
105
|
// src/agent/tools.ts
|
|
89
106
|
import crypto from "crypto";
|
|
107
|
+
import { writeFileSync, mkdirSync, rmSync } from "fs";
|
|
108
|
+
import { resolve } from "path";
|
|
90
109
|
import { tool, createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk";
|
|
91
110
|
|
|
92
111
|
// src/db/queries/agent-state.ts
|
|
@@ -139,7 +158,37 @@ var DEFAULT_EDGES_LIMIT = 50;
|
|
|
139
158
|
function textResult(data) {
|
|
140
159
|
return { content: [{ type: "text", text: JSON.stringify(data) }] };
|
|
141
160
|
}
|
|
142
|
-
|
|
161
|
+
var MAX_SKILL_LINES = 500;
|
|
162
|
+
var REQUIRED_FRONTMATTER_FIELDS = ["name", "description", "managed_by", "user-invocable", "allowed-tools"];
|
|
163
|
+
function validateSkillContent(content, dirName) {
|
|
164
|
+
const issues = [];
|
|
165
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
|
|
166
|
+
if (!fmMatch) {
|
|
167
|
+
issues.push("Missing YAML frontmatter (must start with --- and end with ---)");
|
|
168
|
+
return issues;
|
|
169
|
+
}
|
|
170
|
+
const frontmatter = fmMatch[1];
|
|
171
|
+
for (const field of REQUIRED_FRONTMATTER_FIELDS) {
|
|
172
|
+
if (!frontmatter.includes(`${field}:`)) {
|
|
173
|
+
issues.push(`Missing required frontmatter field: ${field}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const nameMatch = frontmatter.match(/^name:\s*(.+)$/m);
|
|
177
|
+
if (nameMatch && !nameMatch[1].trim().startsWith("myco:")) {
|
|
178
|
+
issues.push(`Skill name must start with "myco:" prefix. Got: "${nameMatch[1].trim()}"`);
|
|
179
|
+
}
|
|
180
|
+
const managedMatch = frontmatter.match(/^managed_by:\s*(.+)$/m);
|
|
181
|
+
if (managedMatch && managedMatch[1].trim() !== "myco") {
|
|
182
|
+
issues.push(`managed_by must be "myco". Got: "${managedMatch[1].trim()}"`);
|
|
183
|
+
}
|
|
184
|
+
const lineCount = content.split("\n").length;
|
|
185
|
+
if (lineCount > MAX_SKILL_LINES) {
|
|
186
|
+
issues.push(`Skill is ${lineCount} lines (max ${MAX_SKILL_LINES})`);
|
|
187
|
+
}
|
|
188
|
+
return issues;
|
|
189
|
+
}
|
|
190
|
+
function createVaultTools(agentId, runId, options) {
|
|
191
|
+
const { turnOffset = 0, embeddingManager, teamClient, machineId, projectRoot, vaultDir } = options ?? {};
|
|
143
192
|
let turnCounter = turnOffset;
|
|
144
193
|
function recordTurn(toolName, toolInput) {
|
|
145
194
|
turnCounter++;
|
|
@@ -214,10 +263,10 @@ function createVaultTools(agentId, runId, turnOffset = 0, embeddingManager, team
|
|
|
214
263
|
);
|
|
215
264
|
const vaultSearchFts = tool(
|
|
216
265
|
"vault_search_fts",
|
|
217
|
-
"Full-text search across prompt batches and activities using FTS5. Best for finding
|
|
266
|
+
"Full-text search across sessions, spores, prompt batches, and activities using FTS5. Best for finding exact keywords, file paths, function names, and specific text. Searches: session titles/summaries, spore content, user prompts, AI response summaries, tool calls.",
|
|
218
267
|
{
|
|
219
268
|
query: external_exports.string().describe("Search query text"),
|
|
220
|
-
type: external_exports.string().optional().describe("Restrict to a result type (prompt_batch, activity)"),
|
|
269
|
+
type: external_exports.string().optional().describe("Restrict to a result type (session, spore, prompt_batch, activity)"),
|
|
221
270
|
limit: external_exports.number().optional().describe("Maximum number of results to return")
|
|
222
271
|
},
|
|
223
272
|
async (args) => {
|
|
@@ -348,6 +397,7 @@ function createVaultTools(agentId, runId, turnOffset = 0, embeddingManager, team
|
|
|
348
397
|
const spore = insertSpore({
|
|
349
398
|
id,
|
|
350
399
|
agent_id: agentId,
|
|
400
|
+
machine_id: machineId,
|
|
351
401
|
observation_type: args.observation_type,
|
|
352
402
|
content: args.content,
|
|
353
403
|
session_id: args.session_id ?? null,
|
|
@@ -388,6 +438,7 @@ function createVaultTools(agentId, runId, turnOffset = 0, embeddingManager, team
|
|
|
388
438
|
const entity = insertEntity({
|
|
389
439
|
id,
|
|
390
440
|
agent_id: agentId,
|
|
441
|
+
machine_id: machineId,
|
|
391
442
|
type: args.type,
|
|
392
443
|
name: args.name,
|
|
393
444
|
properties: props,
|
|
@@ -416,6 +467,7 @@ function createVaultTools(agentId, runId, turnOffset = 0, embeddingManager, team
|
|
|
416
467
|
const props = args.properties ? JSON.stringify(args.properties) : void 0;
|
|
417
468
|
const edge = insertGraphEdge({
|
|
418
469
|
agent_id: agentId,
|
|
470
|
+
machine_id: machineId,
|
|
419
471
|
source_id: args.source_id,
|
|
420
472
|
source_type: args.source_type,
|
|
421
473
|
target_id: args.target_id,
|
|
@@ -455,6 +507,7 @@ function createVaultTools(agentId, runId, turnOffset = 0, embeddingManager, team
|
|
|
455
507
|
insertResolutionEvent({
|
|
456
508
|
id: eventId,
|
|
457
509
|
agent_id: agentId,
|
|
510
|
+
machine_id: machineId,
|
|
458
511
|
spore_id: args.spore_id,
|
|
459
512
|
action: args.action,
|
|
460
513
|
new_spore_id: args.new_spore_id ?? null,
|
|
@@ -582,6 +635,297 @@ function createVaultTools(agentId, runId, turnOffset = 0, embeddingManager, team
|
|
|
582
635
|
return textResult(report);
|
|
583
636
|
}
|
|
584
637
|
);
|
|
638
|
+
const vaultSkillCandidates = tool(
|
|
639
|
+
"vault_skill_candidates",
|
|
640
|
+
"Manage skill candidates (identified topics that may become skills). Supports list, get, create, and update actions.",
|
|
641
|
+
{
|
|
642
|
+
action: external_exports.enum(["list", "get", "create", "update", "delete"]).describe("Action to perform"),
|
|
643
|
+
id: external_exports.string().optional().describe("Candidate ID (required for get/update)"),
|
|
644
|
+
topic: external_exports.string().optional().describe("Skill topic (required for create)"),
|
|
645
|
+
rationale: external_exports.string().optional().describe("Why this should be a skill (required for create)"),
|
|
646
|
+
confidence: external_exports.number().optional().describe("Confidence score 0-1"),
|
|
647
|
+
status: external_exports.enum(["identified", "approved", "generated", "dismissed"]).optional().describe("Candidate status. Only these values are valid."),
|
|
648
|
+
source_ids: external_exports.string().optional().describe("JSON array of source spore/entity IDs"),
|
|
649
|
+
skill_id: external_exports.string().optional().describe("Associated skill record ID (after materialization)"),
|
|
650
|
+
limit: external_exports.number().optional().describe("Maximum candidates to return (for list)")
|
|
651
|
+
},
|
|
652
|
+
async (args) => {
|
|
653
|
+
recordTurn("vault_skill_candidates", args);
|
|
654
|
+
switch (args.action) {
|
|
655
|
+
case "list": {
|
|
656
|
+
const candidates = listCandidates({
|
|
657
|
+
agent_id: agentId,
|
|
658
|
+
status: args.status,
|
|
659
|
+
limit: args.limit ?? DEFAULT_LIST_LIMIT
|
|
660
|
+
});
|
|
661
|
+
return textResult(candidates);
|
|
662
|
+
}
|
|
663
|
+
case "get": {
|
|
664
|
+
if (!args.id) return textResult({ error: "id is required for get action" });
|
|
665
|
+
const candidate = getCandidate(args.id);
|
|
666
|
+
if (!candidate) return textResult({ error: `Candidate not found: ${args.id}` });
|
|
667
|
+
return textResult(candidate);
|
|
668
|
+
}
|
|
669
|
+
case "create": {
|
|
670
|
+
if (!args.topic || !args.rationale) {
|
|
671
|
+
return textResult({ error: "topic and rationale are required for create action" });
|
|
672
|
+
}
|
|
673
|
+
const now = epochSeconds();
|
|
674
|
+
const candidate = insertCandidate({
|
|
675
|
+
id: crypto.randomUUID(),
|
|
676
|
+
agent_id: agentId,
|
|
677
|
+
machine_id: machineId,
|
|
678
|
+
topic: args.topic,
|
|
679
|
+
rationale: args.rationale,
|
|
680
|
+
confidence: args.confidence,
|
|
681
|
+
status: args.status,
|
|
682
|
+
source_ids: args.source_ids,
|
|
683
|
+
created_at: now,
|
|
684
|
+
updated_at: now
|
|
685
|
+
});
|
|
686
|
+
notify(vaultDir, {
|
|
687
|
+
domain: "skills",
|
|
688
|
+
type: "skill.surveyed",
|
|
689
|
+
title: `Skill candidate: ${args.topic}`,
|
|
690
|
+
message: args.rationale.slice(0, 120),
|
|
691
|
+
link: "/skills?tab=candidates",
|
|
692
|
+
metadata: { candidateId: candidate.id, topic: args.topic }
|
|
693
|
+
});
|
|
694
|
+
return textResult(candidate);
|
|
695
|
+
}
|
|
696
|
+
case "update": {
|
|
697
|
+
if (!args.id) return textResult({ error: "id is required for update action" });
|
|
698
|
+
const now = epochSeconds();
|
|
699
|
+
const updated = updateCandidate(args.id, {
|
|
700
|
+
...args.topic !== void 0 ? { topic: args.topic } : {},
|
|
701
|
+
...args.rationale !== void 0 ? { rationale: args.rationale } : {},
|
|
702
|
+
...args.confidence !== void 0 ? { confidence: args.confidence } : {},
|
|
703
|
+
...args.status !== void 0 ? { status: args.status } : {},
|
|
704
|
+
...args.source_ids !== void 0 ? { source_ids: args.source_ids } : {},
|
|
705
|
+
...args.skill_id !== void 0 ? { skill_id: args.skill_id } : {},
|
|
706
|
+
updated_at: now
|
|
707
|
+
});
|
|
708
|
+
if (!updated) return textResult({ error: `Candidate not found: ${args.id}` });
|
|
709
|
+
return textResult(updated);
|
|
710
|
+
}
|
|
711
|
+
case "delete": {
|
|
712
|
+
if (!args.id) return textResult({ error: "id is required for delete action" });
|
|
713
|
+
const deleted = deleteCandidate(args.id);
|
|
714
|
+
if (!deleted) return textResult({ error: `Candidate not found: ${args.id}` });
|
|
715
|
+
return textResult({ deleted: true, id: args.id });
|
|
716
|
+
}
|
|
717
|
+
default:
|
|
718
|
+
return textResult({ error: `Unknown action: ${args.action}` });
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
);
|
|
722
|
+
const vaultSkillRecords = tool(
|
|
723
|
+
"vault_skill_records",
|
|
724
|
+
"Read, update, and delete skill records (materialized skills on disk). Supports list, get, update, and delete actions.",
|
|
725
|
+
{
|
|
726
|
+
action: external_exports.enum(["list", "get", "update", "delete"]).describe("Action to perform"),
|
|
727
|
+
id: external_exports.string().optional().describe("Skill record ID or name (required for get/update/delete)"),
|
|
728
|
+
status: external_exports.enum(["active", "stale", "retired"]).optional().describe("Filter by status"),
|
|
729
|
+
generation: external_exports.number().optional().describe("New generation number (for update)"),
|
|
730
|
+
source_ids: external_exports.string().optional().describe("JSON array of source IDs (for update)"),
|
|
731
|
+
description: external_exports.string().optional().describe("Updated description (for update)"),
|
|
732
|
+
limit: external_exports.number().optional().describe("Maximum records to return (for list)")
|
|
733
|
+
},
|
|
734
|
+
async (args) => {
|
|
735
|
+
recordTurn("vault_skill_records", args);
|
|
736
|
+
switch (args.action) {
|
|
737
|
+
case "list": {
|
|
738
|
+
const records = listSkillRecords({
|
|
739
|
+
agent_id: agentId,
|
|
740
|
+
status: args.status,
|
|
741
|
+
limit: args.limit ?? DEFAULT_LIST_LIMIT
|
|
742
|
+
});
|
|
743
|
+
return textResult(records);
|
|
744
|
+
}
|
|
745
|
+
case "get": {
|
|
746
|
+
if (!args.id) return textResult({ error: "id is required for get action" });
|
|
747
|
+
const record = getSkillRecord(args.id) ?? getSkillRecordByName(args.id);
|
|
748
|
+
if (!record) return textResult({ error: `Skill record not found: ${args.id}` });
|
|
749
|
+
return textResult(record);
|
|
750
|
+
}
|
|
751
|
+
case "update": {
|
|
752
|
+
if (!args.id) return textResult({ error: "id is required for update action" });
|
|
753
|
+
const existing = getSkillRecord(args.id) ?? getSkillRecordByName(args.id);
|
|
754
|
+
if (!existing) return textResult({ error: `Skill record not found: ${args.id}` });
|
|
755
|
+
const now = epochSeconds();
|
|
756
|
+
const updated = updateSkillRecord(existing.id, {
|
|
757
|
+
...args.status !== void 0 ? { status: args.status } : {},
|
|
758
|
+
...args.generation !== void 0 ? { generation: args.generation } : {},
|
|
759
|
+
...args.source_ids !== void 0 ? { source_ids: args.source_ids } : {},
|
|
760
|
+
...args.description !== void 0 ? { description: args.description } : {},
|
|
761
|
+
updated_at: now
|
|
762
|
+
});
|
|
763
|
+
if (!updated) return textResult({ error: `Failed to update skill record: ${existing.id}` });
|
|
764
|
+
return textResult(updated);
|
|
765
|
+
}
|
|
766
|
+
case "delete": {
|
|
767
|
+
if (!args.id) return textResult({ error: "id is required for delete action" });
|
|
768
|
+
const result = deleteSkillRecordCascade(args.id);
|
|
769
|
+
if (!result) return textResult({ error: `Skill record not found: ${args.id}` });
|
|
770
|
+
const root = projectRoot ?? process.cwd();
|
|
771
|
+
if (!/[/\\]|\.\./.test(result.name)) {
|
|
772
|
+
const skillDir = resolve(root, ".agents", "skills", result.name);
|
|
773
|
+
try {
|
|
774
|
+
rmSync(skillDir, { recursive: true, force: true });
|
|
775
|
+
} catch (err) {
|
|
776
|
+
console.warn("[vault_skill_records] Failed to remove skill directory:", err instanceof Error ? err.message : err);
|
|
777
|
+
}
|
|
778
|
+
try {
|
|
779
|
+
const { syncSkillSymlinks } = await import("./installer-25TSX4SR.js");
|
|
780
|
+
syncSkillSymlinks(root, result.name, { remove: true });
|
|
781
|
+
} catch (err) {
|
|
782
|
+
console.warn("[vault_skill_records] Failed to remove symlinks:", err instanceof Error ? err.message : err);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
return textResult({ deleted: true, id: result.id, name: result.name });
|
|
786
|
+
}
|
|
787
|
+
default:
|
|
788
|
+
return textResult({ error: `Unknown action: ${args.action}` });
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
);
|
|
792
|
+
const vaultWriteSkill = tool(
|
|
793
|
+
"vault_write_skill",
|
|
794
|
+
"Write a SKILL.md file to disk and create or update the corresponding skill record and lineage entry.",
|
|
795
|
+
{
|
|
796
|
+
name: external_exports.string().describe("Skill directory name (kebab-case, NO colon). The myco: prefix goes in the SKILL.md frontmatter name field, not here."),
|
|
797
|
+
display_name: external_exports.string().describe("Human-readable display name"),
|
|
798
|
+
description: external_exports.string().describe("Short description of what the skill does"),
|
|
799
|
+
content: external_exports.string().describe("Full SKILL.md content in markdown"),
|
|
800
|
+
source_ids: external_exports.string().optional().describe("JSON array of source spore/entity IDs"),
|
|
801
|
+
candidate_id: external_exports.string().optional().describe("Candidate ID that prompted this skill creation"),
|
|
802
|
+
rationale: external_exports.string().optional().describe("Why this skill was created or updated")
|
|
803
|
+
},
|
|
804
|
+
async (args) => {
|
|
805
|
+
const validationErrors = validateSkillContent(args.content, args.name);
|
|
806
|
+
if (validationErrors.length > 0) {
|
|
807
|
+
recordTurn("vault_write_skill", args);
|
|
808
|
+
return textResult({
|
|
809
|
+
error: "Skill validation failed. Fix these issues and try again.",
|
|
810
|
+
issues: validationErrors
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
if (!args.name || /[/\\]|\.\./.test(args.name)) {
|
|
814
|
+
recordTurn("vault_write_skill", args);
|
|
815
|
+
return textResult({
|
|
816
|
+
error: 'Invalid skill name: must be a simple directory name without path separators or ".."'
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
const root = projectRoot ?? process.cwd();
|
|
820
|
+
const skillDir = resolve(root, ".agents", "skills", args.name);
|
|
821
|
+
const skillPath = resolve(skillDir, "SKILL.md");
|
|
822
|
+
try {
|
|
823
|
+
mkdirSync(skillDir, { recursive: true });
|
|
824
|
+
writeFileSync(skillPath, args.content, "utf-8");
|
|
825
|
+
} catch (err) {
|
|
826
|
+
return textResult({ error: `Failed to write skill file: ${err instanceof Error ? err.message : String(err)}` });
|
|
827
|
+
}
|
|
828
|
+
try {
|
|
829
|
+
const { syncSkillSymlinks } = await import("./installer-25TSX4SR.js");
|
|
830
|
+
syncSkillSymlinks(root, args.name);
|
|
831
|
+
} catch (err) {
|
|
832
|
+
console.warn("[vault_write_skill] syncSkillSymlinks failed:", err instanceof Error ? err.message : err);
|
|
833
|
+
}
|
|
834
|
+
const now = epochSeconds();
|
|
835
|
+
const relativePath = `.agents/skills/${args.name}/SKILL.md`;
|
|
836
|
+
const existing = getSkillRecordByName(args.name);
|
|
837
|
+
let recordId = "";
|
|
838
|
+
let generation = 0;
|
|
839
|
+
const txDb = getDatabase();
|
|
840
|
+
txDb.transaction(() => {
|
|
841
|
+
if (existing) {
|
|
842
|
+
generation = existing.generation + 1;
|
|
843
|
+
recordId = existing.id;
|
|
844
|
+
updateSkillRecord(existing.id, {
|
|
845
|
+
display_name: args.display_name,
|
|
846
|
+
description: args.description,
|
|
847
|
+
generation,
|
|
848
|
+
...args.source_ids !== void 0 ? { source_ids: args.source_ids } : {},
|
|
849
|
+
path: relativePath,
|
|
850
|
+
updated_at: now
|
|
851
|
+
});
|
|
852
|
+
insertLineage({
|
|
853
|
+
id: crypto.randomUUID(),
|
|
854
|
+
skill_id: existing.id,
|
|
855
|
+
generation,
|
|
856
|
+
action: "updated",
|
|
857
|
+
rationale: args.rationale ?? "Skill content updated",
|
|
858
|
+
source_ids_added: args.source_ids,
|
|
859
|
+
content_snapshot: args.content,
|
|
860
|
+
created_at: now
|
|
861
|
+
});
|
|
862
|
+
} else {
|
|
863
|
+
recordId = crypto.randomUUID();
|
|
864
|
+
generation = 1;
|
|
865
|
+
insertSkillRecord({
|
|
866
|
+
id: recordId,
|
|
867
|
+
agent_id: agentId,
|
|
868
|
+
machine_id: machineId,
|
|
869
|
+
name: args.name,
|
|
870
|
+
display_name: args.display_name,
|
|
871
|
+
description: args.description,
|
|
872
|
+
candidate_id: args.candidate_id ?? null,
|
|
873
|
+
source_ids: args.source_ids,
|
|
874
|
+
path: relativePath,
|
|
875
|
+
created_at: now,
|
|
876
|
+
updated_at: now
|
|
877
|
+
});
|
|
878
|
+
insertLineage({
|
|
879
|
+
id: crypto.randomUUID(),
|
|
880
|
+
skill_id: recordId,
|
|
881
|
+
generation,
|
|
882
|
+
action: "created",
|
|
883
|
+
rationale: args.rationale ?? "Initial skill creation",
|
|
884
|
+
source_ids_added: args.source_ids,
|
|
885
|
+
content_snapshot: args.content,
|
|
886
|
+
created_at: now
|
|
887
|
+
});
|
|
888
|
+
const approvedCandidates = listCandidates({ status: "approved", limit: 10 });
|
|
889
|
+
let linkedCandidate = false;
|
|
890
|
+
if (args.candidate_id && !linkedCandidate) {
|
|
891
|
+
const exact = updateCandidate(args.candidate_id, {
|
|
892
|
+
status: "generated",
|
|
893
|
+
skill_id: recordId,
|
|
894
|
+
updated_at: now
|
|
895
|
+
});
|
|
896
|
+
if (exact) linkedCandidate = true;
|
|
897
|
+
}
|
|
898
|
+
if (args.candidate_id && !linkedCandidate) {
|
|
899
|
+
const prefixMatch = approvedCandidates.find((c) => c.id.startsWith(args.candidate_id));
|
|
900
|
+
if (prefixMatch) {
|
|
901
|
+
updateCandidate(prefixMatch.id, {
|
|
902
|
+
status: "generated",
|
|
903
|
+
skill_id: recordId,
|
|
904
|
+
updated_at: now
|
|
905
|
+
});
|
|
906
|
+
linkedCandidate = true;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
})();
|
|
911
|
+
const isNew = generation === 1;
|
|
912
|
+
notify(vaultDir, {
|
|
913
|
+
domain: "skills",
|
|
914
|
+
type: isNew ? "skill.created" : "skill.evolved",
|
|
915
|
+
title: isNew ? `Skill created: ${args.display_name}` : `Skill evolved: ${args.display_name}`,
|
|
916
|
+
message: args.description.slice(0, 120),
|
|
917
|
+
link: `/skills?skill=${encodeURIComponent(args.name)}`,
|
|
918
|
+
metadata: { skillId: recordId, name: args.name, generation }
|
|
919
|
+
});
|
|
920
|
+
recordTurn("vault_write_skill", args);
|
|
921
|
+
return textResult({
|
|
922
|
+
id: recordId,
|
|
923
|
+
name: args.name,
|
|
924
|
+
path: relativePath,
|
|
925
|
+
generation
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
);
|
|
585
929
|
return [
|
|
586
930
|
vaultUnprocessed,
|
|
587
931
|
vaultSpores,
|
|
@@ -600,19 +944,22 @@ function createVaultTools(agentId, runId, turnOffset = 0, embeddingManager, team
|
|
|
600
944
|
vaultReadDigest,
|
|
601
945
|
vaultWriteDigest,
|
|
602
946
|
vaultMarkProcessed,
|
|
603
|
-
vaultReport
|
|
947
|
+
vaultReport,
|
|
948
|
+
vaultSkillCandidates,
|
|
949
|
+
vaultSkillRecords,
|
|
950
|
+
vaultWriteSkill
|
|
604
951
|
];
|
|
605
952
|
}
|
|
606
|
-
function createVaultToolServer(agentId, runId,
|
|
607
|
-
const tools = createVaultTools(agentId, runId,
|
|
953
|
+
function createVaultToolServer(agentId, runId, options) {
|
|
954
|
+
const tools = createVaultTools(agentId, runId, options);
|
|
608
955
|
return createSdkMcpServer({
|
|
609
956
|
name: "myco-vault",
|
|
610
957
|
version: getPluginVersion(),
|
|
611
958
|
tools
|
|
612
959
|
});
|
|
613
960
|
}
|
|
614
|
-
function createScopedVaultToolServer(agentId, runId, toolNames,
|
|
615
|
-
const allTools = createVaultTools(agentId, runId,
|
|
961
|
+
function createScopedVaultToolServer(agentId, runId, toolNames, options) {
|
|
962
|
+
const allTools = createVaultTools(agentId, runId, options);
|
|
616
963
|
const nameSet = new Set(toolNames);
|
|
617
964
|
const scopedTools = allTools.filter((t) => nameSet.has(t.name));
|
|
618
965
|
return createSdkMcpServer({
|
|
@@ -997,7 +1344,7 @@ ${phase.prompt}`);
|
|
|
997
1344
|
var OLLAMA_PRELOAD_TIMEOUT_MS = 3e4;
|
|
998
1345
|
async function ensureOllamaContextVariant(model, contextLength) {
|
|
999
1346
|
const { execFileSync } = await import("child_process");
|
|
1000
|
-
const { writeFileSync, unlinkSync } = await import("fs");
|
|
1347
|
+
const { writeFileSync: writeFileSync2, unlinkSync } = await import("fs");
|
|
1001
1348
|
const { tmpdir } = await import("os");
|
|
1002
1349
|
const { join } = await import("path");
|
|
1003
1350
|
const baseName = model.replace(/:latest$/, "");
|
|
@@ -1009,7 +1356,7 @@ async function ensureOllamaContextVariant(model, contextLength) {
|
|
|
1009
1356
|
}
|
|
1010
1357
|
try {
|
|
1011
1358
|
const modelfilePath = join(tmpdir(), `myco-modelfile-${Date.now()}`);
|
|
1012
|
-
|
|
1359
|
+
writeFileSync2(modelfilePath, `FROM ${model}
|
|
1013
1360
|
PARAMETER num_ctx ${contextLength}
|
|
1014
1361
|
`);
|
|
1015
1362
|
execFileSync("ollama", ["create", variantName, "-f", modelfilePath], {
|
|
@@ -1128,9 +1475,9 @@ async function executePhase(query, phasePrompt, phaseModel, systemPrompt, toolSe
|
|
|
1128
1475
|
};
|
|
1129
1476
|
}
|
|
1130
1477
|
}
|
|
1131
|
-
async function executeSingleQuery(config, systemPrompt, taskPrompt, agentId, runId, provider, embeddingManager, abortController) {
|
|
1478
|
+
async function executeSingleQuery(config, systemPrompt, taskPrompt, agentId, runId, provider, embeddingManager, abortController, vaultDir) {
|
|
1132
1479
|
const { query } = await import("@anthropic-ai/claude-agent-sdk");
|
|
1133
|
-
const toolServer = createVaultToolServer(agentId, runId, embeddingManager);
|
|
1480
|
+
const toolServer = createVaultToolServer(agentId, runId, { embeddingManager, vaultDir });
|
|
1134
1481
|
const env = buildPhaseEnv(provider);
|
|
1135
1482
|
const effectiveModel = provider?.model ?? config.model;
|
|
1136
1483
|
let resultCostUsd = 0;
|
|
@@ -1157,7 +1504,7 @@ async function executeSingleQuery(config, systemPrompt, taskPrompt, agentId, run
|
|
|
1157
1504
|
}
|
|
1158
1505
|
return { tokensUsed: resultTokens, costUsd: resultCostUsd };
|
|
1159
1506
|
}
|
|
1160
|
-
async function executePhasedQuery(config, systemPrompt, vaultContext, agentId, runId, taskProviderOverride, phaseProviderOverrides, instruction, embeddingManager, abortController) {
|
|
1507
|
+
async function executePhasedQuery(config, systemPrompt, vaultContext, agentId, runId, taskProviderOverride, phaseProviderOverrides, instruction, embeddingManager, abortController, projectRoot, vaultDir) {
|
|
1161
1508
|
const { query } = await import("@anthropic-ai/claude-agent-sdk");
|
|
1162
1509
|
const phases = config.phases;
|
|
1163
1510
|
const phaseResults = [];
|
|
@@ -1209,8 +1556,12 @@ async function executePhasedQuery(config, systemPrompt, vaultContext, agentId, r
|
|
|
1209
1556
|
agentId,
|
|
1210
1557
|
runId,
|
|
1211
1558
|
phase.tools,
|
|
1212
|
-
|
|
1213
|
-
|
|
1559
|
+
{
|
|
1560
|
+
turnOffset: runningTurnCount + indexInWave * effectiveMaxTurns,
|
|
1561
|
+
embeddingManager,
|
|
1562
|
+
projectRoot,
|
|
1563
|
+
vaultDir
|
|
1564
|
+
}
|
|
1214
1565
|
);
|
|
1215
1566
|
const phaseProvider = phase.provider ?? phaseOverride?.provider ?? taskProviderOverride ?? config.execution?.provider;
|
|
1216
1567
|
const env = buildPhaseEnv(phaseProvider);
|
|
@@ -1257,13 +1608,19 @@ async function runAgent(vaultDir, options) {
|
|
|
1257
1608
|
const db = initDatabase(vaultDbPath(vaultDir));
|
|
1258
1609
|
createSchema(db);
|
|
1259
1610
|
const agentId = options?.agentId ?? DEFAULT_AGENT_ID;
|
|
1260
|
-
const
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1611
|
+
const requestedTask = options?.task;
|
|
1612
|
+
{
|
|
1613
|
+
const effectiveTask = requestedTask ?? getDefaultTask(agentId)?.id;
|
|
1614
|
+
if (effectiveTask) {
|
|
1615
|
+
const runningId = getRunningRunForTask(agentId, effectiveTask);
|
|
1616
|
+
if (runningId) {
|
|
1617
|
+
return {
|
|
1618
|
+
runId: runningId,
|
|
1619
|
+
status: STATUS_SKIPPED,
|
|
1620
|
+
reason: SKIP_REASON_ALREADY_RUNNING
|
|
1621
|
+
};
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1267
1624
|
}
|
|
1268
1625
|
const definitionsDir = resolveDefinitionsDir();
|
|
1269
1626
|
const definition = loadAgentDefinition(definitionsDir);
|
|
@@ -1358,6 +1715,7 @@ async function runAgent(vaultDir, options) {
|
|
|
1358
1715
|
let tokensUsed;
|
|
1359
1716
|
let costUsd;
|
|
1360
1717
|
if (config.phases && config.phases.length > 0) {
|
|
1718
|
+
const projectRoot = resolve2(vaultDir, "..");
|
|
1361
1719
|
const result = await executePhasedQuery(
|
|
1362
1720
|
config,
|
|
1363
1721
|
systemPrompt,
|
|
@@ -1368,7 +1726,9 @@ async function runAgent(vaultDir, options) {
|
|
|
1368
1726
|
phaseProviderOverrides,
|
|
1369
1727
|
options?.instruction,
|
|
1370
1728
|
options?.embeddingManager,
|
|
1371
|
-
taskAbortController
|
|
1729
|
+
taskAbortController,
|
|
1730
|
+
projectRoot,
|
|
1731
|
+
vaultDir
|
|
1372
1732
|
);
|
|
1373
1733
|
tokensUsed = result.tokensUsed;
|
|
1374
1734
|
costUsd = result.costUsd;
|
|
@@ -1389,7 +1749,8 @@ async function runAgent(vaultDir, options) {
|
|
|
1389
1749
|
runId,
|
|
1390
1750
|
singleProvider,
|
|
1391
1751
|
options?.embeddingManager,
|
|
1392
|
-
taskAbortController
|
|
1752
|
+
taskAbortController,
|
|
1753
|
+
vaultDir
|
|
1393
1754
|
);
|
|
1394
1755
|
tokensUsed = result.tokensUsed;
|
|
1395
1756
|
costUsd = result.costUsd;
|
|
@@ -1451,4 +1812,4 @@ export {
|
|
|
1451
1812
|
computeWaves,
|
|
1452
1813
|
runAgent
|
|
1453
1814
|
};
|
|
1454
|
-
//# sourceMappingURL=executor-
|
|
1815
|
+
//# sourceMappingURL=executor-W5MKZH7B.js.map
|