@runeya/runeya 2.0.154 → 2.0.156
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/agent/index.js +315 -166
- package/agent/index.js.map +1 -1
- package/agent-manager-KDL4JWZN.js +13 -0
- package/chat-7V3FN2PU.js +28 -0
- package/{chunk-MGKGIHT4.js → chunk-ETPXJSVC.js} +2 -2
- package/{chunk-RVZATF7R.js → chunk-EZ35ISYR.js} +249 -1
- package/chunk-EZ35ISYR.js.map +1 -0
- package/{chunk-3C3R5ZVX.js → chunk-JAMAGUGN.js} +2 -2
- package/{chunk-TBNCGMDM.js → chunk-L3BEQ75K.js} +5 -5
- package/{chunk-QD2OVLK4.js → chunk-LUFAT2NW.js} +463 -6
- package/chunk-LUFAT2NW.js.map +1 -0
- package/{chunk-3O54EIGT.js → chunk-N4ZP7T6L.js} +4 -4
- package/{chunk-26Q43CB2.js → chunk-N5LP5TPS.js} +2 -2
- package/{chunk-VKYSHTYT.js → chunk-NJDF4CDG.js} +39 -23
- package/chunk-NJDF4CDG.js.map +1 -0
- package/{chunk-DTRZ5ZN7.js → chunk-NV7MBTNW.js} +5 -5
- package/{chunk-OLHL5NFP.js → chunk-S5M6KX5K.js} +30 -12
- package/chunk-S5M6KX5K.js.map +1 -0
- package/{chunk-PU6REPMY.js → chunk-SVKR7CYU.js} +4 -4
- package/{chunk-R4SKU6AO.js → chunk-TMX3NXMQ.js} +6 -6
- package/{chunk-2DIW5EUT.js → chunk-V7WTXGEJ.js} +6 -6
- package/{companion-3MW23ONE.js → companion-AF7G2FNC.js} +9 -9
- package/{desktop-installer-page-TBKSXVFD.js → desktop-installer-page-DCS2FLA5.js} +3 -3
- package/{desktop-launcher-WBYP3KTF.js → desktop-launcher-ER3J7KAW.js} +3 -3
- package/{environment-resolver-R2GH6QOX.js → environment-resolver-HT6GTSLA.js} +6 -6
- package/{external-UJ46WKBL.js → external-DHD7PLKK.js} +3 -3
- package/index.js +12 -12
- package/{install-gate-3UVXPA57.js → install-gate-L27RKPNM.js} +2 -2
- package/mcp-server/external.js +672 -36
- package/mcp-server/external.js.map +1 -1
- package/mcp-server/index.js +672 -36
- package/mcp-server/index.js.map +1 -1
- package/package.json +1 -1
- package/{project-store-GBKM34QP.js → project-store-6TFAYAWK.js} +7 -7
- package/settings-manager-OTVXDUJS.js +10 -0
- package/{src-6WZKSNN7.js → src-DBSSIQC7.js} +72 -2
- package/{src-K4E6GUCZ.js → src-YFOQ4ZCE.js} +427 -219
- package/src-YFOQ4ZCE.js.map +1 -0
- package/{vault-resolver-GGHULMG6.js → vault-resolver-G3G5YPNG.js} +3 -3
- package/web/assets/{AgentScalarChatInterface.vue-BtA-f77q.js → AgentScalarChatInterface.vue-CtkvKRSd.js} +1 -1
- package/web/assets/AgentTerminalPage-Dt9S2kZX.js +1 -0
- package/web/assets/{AiChatModals-BV3vIIqN.js → AiChatModals-BEpSEXmp.js} +1 -1
- package/web/assets/AppLayout-B1-D2-jx.css +1 -0
- package/web/assets/AppLayout-DIAQvecQ.js +1 -0
- package/web/assets/{AuditPage-DoKHFRJ7.js → AuditPage-BEt0m-rM.js} +1 -1
- package/web/assets/{CloudAccountPage-CDQNalgx.js → CloudAccountPage-BGijgepw.js} +1 -1
- package/web/assets/CloudMessagingPage-C9uWAT8S.js +2 -0
- package/web/assets/CloudMessagingPage-grbGyoki.css +1 -0
- package/web/assets/{DashboardPage-ClJR5DiP.js → DashboardPage-DFiL6A-k.js} +1 -1
- package/web/assets/{DirectoryPickerDialog-CVVg3SzI.js → DirectoryPickerDialog-C8dwWIUa.js} +1 -1
- package/web/assets/{EditorIcon-DksI79ZN.js → EditorIcon-Cx11i-sC.js} +1 -1
- package/web/assets/{EnvironmentForm-eMpLFv_-.js → EnvironmentForm-DZgZitCy.js} +1 -1
- package/web/assets/{EnvironmentFormPage-DXH2lgk_.js → EnvironmentFormPage-ubP8cX3l.js} +1 -1
- package/web/assets/{EnvironmentListPage-D-g_8lQw.js → EnvironmentListPage-CPs1uuvs.js} +1 -1
- package/web/assets/{FlagChip-DjC14z4J.js → FlagChip-UumVjPY9.js} +1 -1
- package/web/assets/KanbanBoardPage-C9NqOqdD.js +4 -0
- package/web/assets/KanbanBoardPage-Cy1VPXZs.css +1 -0
- package/web/assets/{KanbanListPage-DnhCC5ET.js → KanbanListPage-D_ZpIbT2.js} +1 -1
- package/web/assets/KnowledgeListPage-BjfZa5Wu.css +1 -0
- package/web/assets/KnowledgeListPage-BoaV9hBg.js +1 -0
- package/web/assets/KnowledgePagePage-UGJGJY4d.js +1 -0
- package/web/assets/KnowledgePagePage-qnvlYhD5.css +1 -0
- package/web/assets/{LaunchProjectPage-DyNqhic1.js → LaunchProjectPage-B0Lg5Kr5.js} +1 -1
- package/web/assets/{LaunchServicesPage-bI7pVeU7.js → LaunchServicesPage-D_pqkdXt.js} +1 -1
- package/web/assets/{LaunchShell-CokT4E5l.js → LaunchShell-CJtXkSUp.js} +1 -1
- package/web/assets/LogViewer-DLxO4-gP.js +3 -0
- package/web/assets/{LogViewer-OHdSLleq.css → LogViewer-nXZtMJDA.css} +1 -1
- package/web/assets/{OrgKeyPrompt-DtgelhnI.js → OrgKeyPrompt-Cbx4cLL0.js} +1 -1
- package/web/assets/{ProcessControls-CxlDLGiO.js → ProcessControls-Cx-QzqxQ.js} +1 -1
- package/web/assets/{ProcessDetailPage-D93cKCHb.js → ProcessDetailPage-Bxwv0984.js} +1 -1
- package/web/assets/{ProcessMetrics-C_7_boMv.js → ProcessMetrics-DisQYLu6.js} +1 -1
- package/web/assets/{ProjectCreateDialog-Bko_A5wp.js → ProjectCreateDialog-HcYVX36i.js} +1 -1
- package/web/assets/{ProjectLocationGate-jsy8WetY.js → ProjectLocationGate-PR92Tdos.js} +1 -1
- package/web/assets/{ProjectPublishDialog-7kR1zZAo.js → ProjectPublishDialog-YvOeVDCP.js} +1 -1
- package/web/assets/{RandomJobTestPage-Dp9prwa7.js → RandomJobTestPage-Bp9qone4.js} +1 -1
- package/web/assets/ScenarioEditorPage-Cjkkz3JB.js +14 -0
- package/web/assets/{SendToChatDialog-BVSbXcbf.js → SendToChatDialog-CQbi2P_L.js} +1 -1
- package/web/assets/{ServiceControlsBar-DFECGWL8.js → ServiceControlsBar-9jsN3h0c.js} +1 -1
- package/web/assets/ServiceDetailPage-COHMUw51.js +2 -0
- package/web/assets/{ServiceFormPage-ChsRsoLt.js → ServiceFormPage-B4n8scwP.js} +1 -1
- package/web/assets/{SettingsPage-BXKsN9Py.js → SettingsPage-C3PnwdxZ.js} +6 -6
- package/web/assets/{UnlockPage-DhEN16uX.js → UnlockPage-BIB0NtWF.js} +1 -1
- package/web/assets/{VaultMigrationPage-BgRNUuTP.js → VaultMigrationPage-D27SeEVr.js} +1 -1
- package/web/assets/{VersionBadge-CXJ-2h5V.js → VersionBadge-FeuuTMz7.js} +1 -1
- package/web/assets/{WikiPage-BT5a9d5Q.js → WikiPage-A8C0dEDX.js} +1 -1
- package/web/assets/{WikiView-BNReLsq5.js → WikiView-D3c0r5q8.js} +1 -1
- package/web/assets/{add-scalar-classes-C_lKfiMa.js → add-scalar-classes-Ohd6-7G3.js} +2 -2
- package/web/assets/{agent.store-B6OM7edC.js → agent.store-BwUoohNu.js} +1 -1
- package/web/assets/auth-DdEdmJV5.js +2 -0
- package/web/assets/{cloud-chat.store-Di38xQRJ.js → cloud-chat.store-za5cBdZx.js} +1 -1
- package/web/assets/{cloud-client-CEVx-bg6.js → cloud-client-zXY8HZtj.js} +2 -2
- package/web/assets/{cloud-session-w6eNQX1X.js → cloud-session-DqfQKW5D.js} +2 -2
- package/web/assets/devtools-DCoWQoU_-D2vs4YXr.js +1 -0
- package/web/assets/dist-Cx_klvkk.js +1 -0
- package/web/assets/i18n-B8hHo8g2.js +17 -0
- package/web/assets/{index-mvpLwxNT.js → index-CYcPxjSC.js} +93 -105
- package/web/assets/index-DozDRY7J.css +1 -0
- package/web/assets/knowledge-host-ButMqDET.js +6 -0
- package/web/assets/knowledge-host-CfNnk0oz.css +1 -0
- package/web/assets/{modal-Bslt0NZi.js → modal-B9eahS9q.js} +1 -1
- package/web/assets/{notification.store-CAG1kWYq.js → notification.store-CWs6iQmx.js} +1 -1
- package/web/assets/{project-launch.store-Im5SMon9.js → project-launch.store-DkD7Q9jW.js} +1 -1
- package/web/assets/{project.store-CITAykC3.js → project.store-CnflI3la.js} +1 -1
- package/web/assets/scenario-run-overrides-BqTAaZZz.js +1 -0
- package/web/assets/{scenario.store-C9sSoRzb.js → scenario.store-DGt8nNt5.js} +1 -1
- package/web/assets/{service.store-CZJuuJiv.js → service.store-yECOKc1C.js} +1 -1
- package/web/assets/{settings-scope-vcJEMNnD.js → settings-scope-Ca1LjLG1.js} +1 -1
- package/web/assets/{settings.store-CydW_2jh.js → settings.store-Cyop63CA.js} +1 -1
- package/web/assets/{src-CIOvFTGI.js → src-8YjxNhhv.js} +23 -23
- package/web/assets/src-B-YFvUDL.css +1 -0
- package/web/assets/{src-COZZWm-m.js → src-BD3q9_go.js} +1 -1
- package/web/assets/{src-Ck_MutzB.js → src-CcVk2-Gw.js} +1 -1
- package/web/assets/{trpc-BQ0mLnfI.js → trpc-DlM4IpMe.js} +3 -3
- package/web/assets/{useCloudOrg-CQvEbrZv.js → useCloudOrg-Ck6Ef1iD.js} +1 -1
- package/web/assets/useEnvVarAutocomplete-B0fhZK-_.js +1 -0
- package/web/assets/{useProjectCatalog-CWHpf3Yj.js → useProjectCatalog-D1RgJoOm.js} +1 -1
- package/web/assets/{useProjectCloudOrg-B3rNPes5.js → useProjectCloudOrg-tnlpo5R1.js} +1 -1
- package/web/assets/{useServiceUrlHost-BFfie_6h.js → useServiceUrlHost-Xzj6EOft.js} +1 -1
- package/web/assets/uuid-B2pLMyOM.js +1 -0
- package/web/assets/uuid-DfCowYZy.js +1 -0
- package/web/assets/vue-router--yRg_Dd_.js +1 -0
- package/web/index.html +20 -19
- package/agent-manager-SF4CAJJC.js +0 -13
- package/chat-COP27XB3.js +0 -28
- package/chunk-OLHL5NFP.js.map +0 -1
- package/chunk-QD2OVLK4.js.map +0 -1
- package/chunk-RVZATF7R.js.map +0 -1
- package/chunk-VKYSHTYT.js.map +0 -1
- package/settings-manager-VSOC3XGI.js +0 -10
- package/src-K4E6GUCZ.js.map +0 -1
- package/web/assets/AgentTerminalPage-2Ky-vEkw.js +0 -1
- package/web/assets/AppLayout-BgPr-urw.css +0 -1
- package/web/assets/AppLayout-DsczwAFI.js +0 -1
- package/web/assets/CloudMessagingPage-Cn3JhJsY.css +0 -1
- package/web/assets/CloudMessagingPage-DduCz3KB.js +0 -2
- package/web/assets/KanbanBoardPage-BeSkCN6I.js +0 -4
- package/web/assets/KanbanBoardPage-BrFqn87r.css +0 -1
- package/web/assets/LogViewer-Cs3Y8vaZ.js +0 -3
- package/web/assets/ScenarioEditorPage-fv9yLH75.js +0 -14
- package/web/assets/ServiceDetailPage-BQA74240.js +0 -2
- package/web/assets/auth-5bsz5kSC.js +0 -2
- package/web/assets/dist-C9Qdh18x.js +0 -1
- package/web/assets/i18n-DbgjJIf8.js +0 -1
- package/web/assets/index-DB3-fmza.css +0 -1
- package/web/assets/src-DrVR8mhy.css +0 -1
- package/web/assets/useEnvVarAutocomplete-hy3rO3SN.js +0 -1
- package/web/assets/uuid-XipkJWQw.js +0 -1
- package/web/assets/vue-router-fin80h5W.js +0 -1
- /package/{agent-manager-SF4CAJJC.js.map → agent-manager-KDL4JWZN.js.map} +0 -0
- /package/{chat-COP27XB3.js.map → chat-7V3FN2PU.js.map} +0 -0
- /package/{chunk-MGKGIHT4.js.map → chunk-ETPXJSVC.js.map} +0 -0
- /package/{chunk-3C3R5ZVX.js.map → chunk-JAMAGUGN.js.map} +0 -0
- /package/{chunk-TBNCGMDM.js.map → chunk-L3BEQ75K.js.map} +0 -0
- /package/{chunk-3O54EIGT.js.map → chunk-N4ZP7T6L.js.map} +0 -0
- /package/{chunk-26Q43CB2.js.map → chunk-N5LP5TPS.js.map} +0 -0
- /package/{chunk-DTRZ5ZN7.js.map → chunk-NV7MBTNW.js.map} +0 -0
- /package/{chunk-PU6REPMY.js.map → chunk-SVKR7CYU.js.map} +0 -0
- /package/{chunk-R4SKU6AO.js.map → chunk-TMX3NXMQ.js.map} +0 -0
- /package/{chunk-2DIW5EUT.js.map → chunk-V7WTXGEJ.js.map} +0 -0
- /package/{companion-3MW23ONE.js.map → companion-AF7G2FNC.js.map} +0 -0
- /package/{desktop-installer-page-TBKSXVFD.js.map → desktop-installer-page-DCS2FLA5.js.map} +0 -0
- /package/{desktop-launcher-WBYP3KTF.js.map → desktop-launcher-ER3J7KAW.js.map} +0 -0
- /package/{environment-resolver-R2GH6QOX.js.map → environment-resolver-HT6GTSLA.js.map} +0 -0
- /package/{external-UJ46WKBL.js.map → external-DHD7PLKK.js.map} +0 -0
- /package/{install-gate-3UVXPA57.js.map → install-gate-L27RKPNM.js.map} +0 -0
- /package/{project-store-GBKM34QP.js.map → project-store-6TFAYAWK.js.map} +0 -0
- /package/{settings-manager-VSOC3XGI.js.map → settings-manager-OTVXDUJS.js.map} +0 -0
- /package/{src-6WZKSNN7.js.map → src-DBSSIQC7.js.map} +0 -0
- /package/{vault-resolver-GGHULMG6.js.map → vault-resolver-G3G5YPNG.js.map} +0 -0
package/mcp-server/external.js
CHANGED
|
@@ -6,9 +6,207 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
6
6
|
// ../ai-capabilities/dist/index.js
|
|
7
7
|
import { z as z23 } from "zod";
|
|
8
8
|
|
|
9
|
-
// ../shared/dist/
|
|
9
|
+
// ../shared/dist/chunk-L6P7TAOW.js
|
|
10
10
|
import { z } from "zod";
|
|
11
|
+
var KNOWLEDGE_LIMITS = {
|
|
12
|
+
spaceName: 80,
|
|
13
|
+
spaceDescription: 500,
|
|
14
|
+
title: 200,
|
|
15
|
+
summary: 1e3,
|
|
16
|
+
alias: 100,
|
|
17
|
+
aliases: 20,
|
|
18
|
+
fieldKey: 40,
|
|
19
|
+
fieldValue: 2e3,
|
|
20
|
+
/** Clés de champ par page : bien plus que n'en déclare aucun type. */
|
|
21
|
+
fields: 30,
|
|
22
|
+
/** Sections données à la création d'une page. */
|
|
23
|
+
sections: 50,
|
|
24
|
+
sectionHeading: 200,
|
|
25
|
+
sectionMarkdown: 5e4,
|
|
26
|
+
/** Le corps entier, en Markdown : une section de plus qui le dépasserait est refusée. */
|
|
27
|
+
bodyMarkdown: 3e5,
|
|
28
|
+
themes: 20,
|
|
29
|
+
projects: 20,
|
|
30
|
+
links: 200,
|
|
31
|
+
sources: 50,
|
|
32
|
+
sourceLabel: 300,
|
|
33
|
+
url: 2e3,
|
|
34
|
+
query: 200,
|
|
35
|
+
searchResults: 50,
|
|
36
|
+
themeDepth: 5,
|
|
37
|
+
neighborsDepth: 3,
|
|
38
|
+
neighborsNodes: 100,
|
|
39
|
+
relatedPages: 20
|
|
40
|
+
};
|
|
41
|
+
var KnowledgeIdSchema = z.string().regex(/^[a-f0-9]{24}$/, "Invalid knowledge id.");
|
|
42
|
+
var KNOWLEDGE_PAGE_TYPES = ["theme", "concept", "decision", "procedure", "component", "reference", "lesson"];
|
|
43
|
+
var KnowledgePageTypeSchema = z.enum(KNOWLEDGE_PAGE_TYPES);
|
|
44
|
+
var KNOWLEDGE_LOCALES = ["fr", "en"];
|
|
45
|
+
var KnowledgeLocaleSchema = z.enum(KNOWLEDGE_LOCALES);
|
|
46
|
+
var KNOWLEDGE_TYPE_SPECS = {
|
|
47
|
+
theme: {
|
|
48
|
+
description: "A subject that groups pages. A theme can itself sit under broader themes: that is how themes form a hierarchy, from broad to precise.",
|
|
49
|
+
fields: [],
|
|
50
|
+
sections: { fr: ["P\xE9rim\xE8tre"], en: ["Scope"] }
|
|
51
|
+
},
|
|
52
|
+
concept: {
|
|
53
|
+
description: "A notion, a term of the domain or a business rule: what it means and how it is used.",
|
|
54
|
+
fields: [],
|
|
55
|
+
sections: { fr: ["D\xE9finition", "D\xE9tails", "Exemples"], en: ["Definition", "Details", "Examples"] }
|
|
56
|
+
},
|
|
57
|
+
decision: {
|
|
58
|
+
description: "A choice that was made, why it was made, and what follows from it.",
|
|
59
|
+
fields: [
|
|
60
|
+
{ key: "decidedOn", kind: "date", description: "The day the decision was taken (YYYY-MM-DD)." },
|
|
61
|
+
{ key: "decidedBy", kind: "text", description: "Who took the decision." }
|
|
62
|
+
],
|
|
63
|
+
sections: { fr: ["Contexte", "D\xE9cision", "Cons\xE9quences"], en: ["Context", "Decision", "Consequences"] }
|
|
64
|
+
},
|
|
65
|
+
procedure: {
|
|
66
|
+
description: "How to do something, step by step.",
|
|
67
|
+
fields: [{ key: "owner", kind: "text", description: "Who is responsible for this procedure." }],
|
|
68
|
+
sections: { fr: ["Pr\xE9requis", "\xC9tapes", "V\xE9rification"], en: ["Prerequisites", "Steps", "Verification"] }
|
|
69
|
+
},
|
|
70
|
+
component: {
|
|
71
|
+
description: "A part of the system: a service, an application, a library, a piece of infrastructure.",
|
|
72
|
+
fields: [
|
|
73
|
+
{ key: "owner", kind: "text", description: "The team or person in charge of the component." },
|
|
74
|
+
{ key: "location", kind: "url", description: "Where the component lives: repository, address, console (http or https URL)." }
|
|
75
|
+
],
|
|
76
|
+
sections: { fr: ["R\xF4le", "Fonctionnement", "Points d'attention"], en: ["Purpose", "How it works", "Caveats"] }
|
|
77
|
+
},
|
|
78
|
+
reference: {
|
|
79
|
+
description: "An external document or link worth keeping, with what matters in it.",
|
|
80
|
+
fields: [
|
|
81
|
+
{ key: "url", kind: "url", description: "The address of the document (http or https URL)." },
|
|
82
|
+
{ key: "author", kind: "text", description: "Who wrote or publishes the document." }
|
|
83
|
+
],
|
|
84
|
+
sections: { fr: ["Points cl\xE9s"], en: ["Key points"] }
|
|
85
|
+
},
|
|
86
|
+
lesson: {
|
|
87
|
+
description: "Something that happened (an incident, a mistake, a success) and what to remember from it.",
|
|
88
|
+
fields: [{ key: "occurredOn", kind: "date", description: "The day it happened (YYYY-MM-DD)." }],
|
|
89
|
+
sections: { fr: ["Ce qui s'est pass\xE9", "Cause", "Ce qu'on retient"], en: ["What happened", "Cause", "Takeaways"] }
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
var KNOWLEDGE_RELATIONS = ["related", "depends_on", "part_of", "refines", "contradicts"];
|
|
93
|
+
var KnowledgeRelationSchema = z.enum(KNOWLEDGE_RELATIONS);
|
|
94
|
+
var KNOWLEDGE_EDGE_KINDS = [...KNOWLEDGE_RELATIONS, "theme", "mentions", "superseded_by"];
|
|
95
|
+
var KnowledgeEdgeKindSchema = z.enum(KNOWLEDGE_EDGE_KINDS);
|
|
96
|
+
var KNOWLEDGE_STATUSES = ["active", "obsolete"];
|
|
97
|
+
var KnowledgeStatusSchema = z.enum(KNOWLEDGE_STATUSES);
|
|
98
|
+
var KnowledgeActorSchema = z.enum(["human", "ai"]);
|
|
99
|
+
function isWebUrl(value) {
|
|
100
|
+
try {
|
|
101
|
+
const url = new URL(value);
|
|
102
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
103
|
+
} catch {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
var WebUrlSchema = z.string().max(KNOWLEDGE_LIMITS.url).refine(isWebUrl, "Must be an http or https URL.");
|
|
108
|
+
var KnowledgeSourceSchema = z.object({
|
|
109
|
+
label: z.string().trim().min(1).max(KNOWLEDGE_LIMITS.sourceLabel),
|
|
110
|
+
url: WebUrlSchema.optional()
|
|
111
|
+
});
|
|
112
|
+
var KnowledgeFieldsSchema = z.record(
|
|
113
|
+
z.string().min(1).max(KNOWLEDGE_LIMITS.fieldKey),
|
|
114
|
+
z.string().max(KNOWLEDGE_LIMITS.fieldValue)
|
|
115
|
+
).refine((f) => Object.keys(f).length <= KNOWLEDGE_LIMITS.fields, { message: `At most ${KNOWLEDGE_LIMITS.fields} fields.` });
|
|
116
|
+
var KnowledgeSectionSchema = z.object({
|
|
117
|
+
heading: z.string().trim().max(KNOWLEDGE_LIMITS.sectionHeading),
|
|
118
|
+
markdown: z.string().max(KNOWLEDGE_LIMITS.sectionMarkdown)
|
|
119
|
+
});
|
|
120
|
+
var KnowledgeLinkSchema = z.object({
|
|
121
|
+
to: KnowledgeIdSchema,
|
|
122
|
+
relation: KnowledgeRelationSchema
|
|
123
|
+
});
|
|
124
|
+
var TitleSchema = z.string().trim().min(1).max(KNOWLEDGE_LIMITS.title);
|
|
125
|
+
var SummarySchema = z.string().trim().max(KNOWLEDGE_LIMITS.summary);
|
|
126
|
+
var KnowledgeAliasesSchema = z.array(z.string().trim().min(1).max(KNOWLEDGE_LIMITS.alias)).max(KNOWLEDGE_LIMITS.aliases);
|
|
127
|
+
var KnowledgeThemeIdsSchema = z.array(KnowledgeIdSchema).max(KNOWLEDGE_LIMITS.themes);
|
|
128
|
+
var KnowledgeProjectIdsSchema = z.array(z.string().min(1).max(128)).max(KNOWLEDGE_LIMITS.projects);
|
|
129
|
+
var KnowledgeSourcesSchema = z.array(KnowledgeSourceSchema).max(KNOWLEDGE_LIMITS.sources);
|
|
130
|
+
var KnowledgeSpaceInputSchema = z.object({
|
|
131
|
+
name: z.string().trim().min(1).max(KNOWLEDGE_LIMITS.spaceName),
|
|
132
|
+
description: z.string().trim().max(KNOWLEDGE_LIMITS.spaceDescription).optional()
|
|
133
|
+
});
|
|
134
|
+
var KnowledgeCreatePageInputSchema = z.object({
|
|
135
|
+
spaceId: KnowledgeIdSchema,
|
|
136
|
+
type: KnowledgePageTypeSchema,
|
|
137
|
+
title: TitleSchema,
|
|
138
|
+
summary: SummarySchema,
|
|
139
|
+
aliases: KnowledgeAliasesSchema.optional(),
|
|
140
|
+
fields: KnowledgeFieldsSchema.optional(),
|
|
141
|
+
themeIds: KnowledgeThemeIdsSchema.optional(),
|
|
142
|
+
projectIds: KnowledgeProjectIdsSchema.optional(),
|
|
143
|
+
sources: KnowledgeSourcesSchema.optional(),
|
|
144
|
+
/** Absentes : les sections du type, vides. */
|
|
145
|
+
sections: z.array(KnowledgeSectionSchema).max(KNOWLEDGE_LIMITS.sections).optional(),
|
|
146
|
+
links: z.array(KnowledgeLinkSchema).max(KNOWLEDGE_LIMITS.links).optional(),
|
|
147
|
+
/** La langue des sections posées d'office. */
|
|
148
|
+
locale: KnowledgeLocaleSchema.optional()
|
|
149
|
+
});
|
|
150
|
+
var KnowledgeUpdatePageInputSchema = z.object({
|
|
151
|
+
pageId: KnowledgeIdSchema,
|
|
152
|
+
type: KnowledgePageTypeSchema.optional(),
|
|
153
|
+
title: TitleSchema.optional(),
|
|
154
|
+
summary: SummarySchema.optional(),
|
|
155
|
+
aliases: KnowledgeAliasesSchema.optional(),
|
|
156
|
+
fields: KnowledgeFieldsSchema.optional(),
|
|
157
|
+
themeIds: KnowledgeThemeIdsSchema.optional(),
|
|
158
|
+
projectIds: KnowledgeProjectIdsSchema.optional(),
|
|
159
|
+
sources: KnowledgeSourcesSchema.optional(),
|
|
160
|
+
status: KnowledgeStatusSchema.optional(),
|
|
161
|
+
/** La page qui remplace celle-ci ; `null` retire le remplacement. */
|
|
162
|
+
supersededBy: KnowledgeIdSchema.nullable().optional()
|
|
163
|
+
});
|
|
164
|
+
var KnowledgeSectionModeSchema = z.enum(["replace", "append", "remove"]);
|
|
165
|
+
var KnowledgeSectionEditInputSchema = z.object({
|
|
166
|
+
pageId: KnowledgeIdSchema,
|
|
167
|
+
heading: z.string().trim().max(KNOWLEDGE_LIMITS.sectionHeading),
|
|
168
|
+
markdown: z.string().max(KNOWLEDGE_LIMITS.sectionMarkdown).optional(),
|
|
169
|
+
mode: KnowledgeSectionModeSchema.optional(),
|
|
170
|
+
/** Créer la section si elle n'existe pas ; sans lui, un titre inconnu est une erreur (faute de frappe). */
|
|
171
|
+
create: z.boolean().optional()
|
|
172
|
+
});
|
|
173
|
+
var KnowledgeTextEditInputSchema = z.object({
|
|
174
|
+
pageId: KnowledgeIdSchema,
|
|
175
|
+
find: z.string().min(1).max(KNOWLEDGE_LIMITS.sectionMarkdown),
|
|
176
|
+
replace: z.string().max(KNOWLEDGE_LIMITS.sectionMarkdown),
|
|
177
|
+
/** Ne chercher que dans cette section (titre, sans casse ni accents ; vide = l'introduction). */
|
|
178
|
+
heading: z.string().trim().max(KNOWLEDGE_LIMITS.sectionHeading).optional(),
|
|
179
|
+
/** Remplacer toutes les occurrences au lieu d'exiger un passage unique. */
|
|
180
|
+
all: z.boolean().optional()
|
|
181
|
+
});
|
|
182
|
+
var KnowledgeLinkInputSchema = z.object({
|
|
183
|
+
pageId: KnowledgeIdSchema,
|
|
184
|
+
to: KnowledgeIdSchema,
|
|
185
|
+
relation: KnowledgeRelationSchema
|
|
186
|
+
});
|
|
187
|
+
var KnowledgeUnlinkInputSchema = KnowledgeLinkInputSchema.extend({ relation: KnowledgeRelationSchema.optional() });
|
|
188
|
+
var KnowledgeSearchInputSchema = z.object({
|
|
189
|
+
organizationId: z.string().min(1).max(128),
|
|
190
|
+
spaceIds: z.array(KnowledgeIdSchema).max(50).optional(),
|
|
191
|
+
query: z.string().max(KNOWLEDGE_LIMITS.query).optional(),
|
|
192
|
+
types: z.array(KnowledgePageTypeSchema).max(KNOWLEDGE_PAGE_TYPES.length).optional(),
|
|
193
|
+
/** Les pages qui portent TOUS ces thèmes (ou un de leurs sous-thèmes, selon `themeDepth`). */
|
|
194
|
+
themeIds: KnowledgeThemeIdsSchema.optional(),
|
|
195
|
+
/** Combien de niveaux de sous-thèmes compter avec chaque thème : 0 = le thème seul. */
|
|
196
|
+
themeDepth: z.number().int().min(0).max(KNOWLEDGE_LIMITS.themeDepth).optional(),
|
|
197
|
+
projectId: z.string().min(1).max(128).optional(),
|
|
198
|
+
includeObsolete: z.boolean().optional(),
|
|
199
|
+
limit: z.number().int().min(1).max(KNOWLEDGE_LIMITS.searchResults).optional(),
|
|
200
|
+
/** Sans requête seulement : la suite d'une liste, telle que la réponse précédente l'a donnée (`nextCursor`). */
|
|
201
|
+
cursor: z.string().max(100).optional()
|
|
202
|
+
});
|
|
203
|
+
function foldText(value) {
|
|
204
|
+
return value.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase().replace(/\s+/g, " ").trim();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ../shared/dist/index.js
|
|
11
208
|
import { z as z2 } from "zod";
|
|
209
|
+
import { z as z22 } from "zod";
|
|
12
210
|
import { z as z3 } from "zod";
|
|
13
211
|
import { z as z7 } from "zod";
|
|
14
212
|
import { z as z5 } from "zod";
|
|
@@ -28,29 +226,29 @@ import { z as z18 } from "zod";
|
|
|
28
226
|
import { z as z19 } from "zod";
|
|
29
227
|
import { z as z20 } from "zod";
|
|
30
228
|
import { z as z21 } from "zod";
|
|
31
|
-
import { z as
|
|
229
|
+
import { z as z222 } from "zod";
|
|
32
230
|
import { createCipheriv, createDecipheriv, randomBytes, pbkdf2Sync } from "crypto";
|
|
33
231
|
import vm from "vm";
|
|
34
232
|
import * as Y from "yjs";
|
|
35
|
-
var UserSchema =
|
|
36
|
-
id: z.string().max(128),
|
|
37
|
-
email: z.string().email().max(320),
|
|
38
|
-
name: z.string().min(1).max(500),
|
|
39
|
-
avatar: z.string().url().max(2048).nullable().optional()
|
|
40
|
-
});
|
|
41
|
-
var OrgSchema = z2.object({
|
|
233
|
+
var UserSchema = z2.object({
|
|
42
234
|
id: z2.string().max(128),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
var
|
|
48
|
-
id:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
235
|
+
email: z2.string().email().max(320),
|
|
236
|
+
name: z2.string().min(1).max(500),
|
|
237
|
+
avatar: z2.string().url().max(2048).nullable().optional()
|
|
238
|
+
});
|
|
239
|
+
var OrgSchema = z22.object({
|
|
240
|
+
id: z22.string().max(128),
|
|
241
|
+
name: z22.string().min(1).max(100),
|
|
242
|
+
slug: z22.string().min(1).max(100).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/),
|
|
243
|
+
ownerId: z22.string().max(128)
|
|
244
|
+
});
|
|
245
|
+
var OrgMemberSchema = z22.object({
|
|
246
|
+
id: z22.string().max(128),
|
|
247
|
+
orgId: z22.string().max(128),
|
|
248
|
+
userId: z22.string().max(128),
|
|
249
|
+
globalRole: z22.enum(["owner", "admin", "member"]),
|
|
250
|
+
invitedAt: z22.coerce.date(),
|
|
251
|
+
joinedAt: z22.coerce.date().nullable().optional()
|
|
54
252
|
});
|
|
55
253
|
var ProjectSchema = z3.object({
|
|
56
254
|
id: z3.string().max(128),
|
|
@@ -1284,33 +1482,33 @@ var ConversationSearchHitSchema = IntegrationConversationSchema.extend({
|
|
|
1284
1482
|
preview: z21.string().max(500),
|
|
1285
1483
|
linkedCards: z21.array(z21.object({ boardId: z21.string().max(64), cardId: z21.string().max(64), title: z21.string().max(500) }))
|
|
1286
1484
|
});
|
|
1287
|
-
var ChangelogSurfaceSchema =
|
|
1288
|
-
var ChangelogChangeKindSchema =
|
|
1289
|
-
var ChangelogTextSchema =
|
|
1290
|
-
fr:
|
|
1291
|
-
en:
|
|
1485
|
+
var ChangelogSurfaceSchema = z222.enum(["app", "cloud"]);
|
|
1486
|
+
var ChangelogChangeKindSchema = z222.enum(["feature", "improvement", "fix", "breaking"]);
|
|
1487
|
+
var ChangelogTextSchema = z222.object({
|
|
1488
|
+
fr: z222.string().min(1).max(500),
|
|
1489
|
+
en: z222.string().min(1).max(500)
|
|
1292
1490
|
});
|
|
1293
|
-
var ChangelogChangeSchema =
|
|
1491
|
+
var ChangelogChangeSchema = z222.object({
|
|
1294
1492
|
kind: ChangelogChangeKindSchema,
|
|
1295
1493
|
text: ChangelogTextSchema
|
|
1296
1494
|
});
|
|
1297
1495
|
var ChangelogDraftSchema = ChangelogChangeSchema.extend({
|
|
1298
|
-
date:
|
|
1496
|
+
date: z222.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
1299
1497
|
title: ChangelogTextSchema.optional()
|
|
1300
1498
|
});
|
|
1301
|
-
var ChangelogReleaseSchema =
|
|
1499
|
+
var ChangelogReleaseSchema = z222.object({
|
|
1302
1500
|
surface: ChangelogSurfaceSchema,
|
|
1303
1501
|
/** `1.4.2` pour l'app (version npm publiée), `2026-09-03` — ou `2026-09-03.2` — pour le cloud. */
|
|
1304
|
-
version:
|
|
1502
|
+
version: z222.string().min(1).max(32).regex(/^[0-9][0-9.-]*$/),
|
|
1305
1503
|
/** Date de publication, `YYYY-MM-DD`. */
|
|
1306
|
-
date:
|
|
1504
|
+
date: z222.string().regex(/^\d{4}-\d{2}-\d{2}$/),
|
|
1307
1505
|
/** Facultatif : une version peut s'annoncer par son seul numéro. */
|
|
1308
1506
|
title: ChangelogTextSchema.optional(),
|
|
1309
1507
|
/** Une version sans changement n'a rien à annoncer : elle n'a pas sa place ici. */
|
|
1310
|
-
changes:
|
|
1508
|
+
changes: z222.array(ChangelogChangeSchema).min(1).max(50)
|
|
1311
1509
|
});
|
|
1312
1510
|
var ChangelogIndexItemSchema = ChangelogReleaseSchema.omit({ changes: true }).extend({
|
|
1313
|
-
changeCount:
|
|
1511
|
+
changeCount: z222.number().int().nonnegative()
|
|
1314
1512
|
});
|
|
1315
1513
|
var MASKED_VALUE = "***";
|
|
1316
1514
|
function maskLogSourceSecrets(sources) {
|
|
@@ -1491,6 +1689,435 @@ var refs = (scope) => BUILTIN_VARIABLES.filter((b) => b.scope === scope).map((b)
|
|
|
1491
1689
|
var BUILTINS_HELP = `Built-in references Runeya fills itself \u2014 filled when the service is deployed, from the service that receives the variable: ${refs("server")}, the numbered {{service.PORT_2}} / {{service.URL_2}}\u2026 for its other ports, and {{services.<slug>.PORT}}, .URL, .BASE_URL, .NAME, .ID for a sibling service of the project (slug = its name in lowercase-dashes). Filled on the machine when the service starts: ${refs("agent")}.`;
|
|
1492
1690
|
var CREATE_SERVICE_PARAMS = serviceParams(false);
|
|
1493
1691
|
var UPDATE_SERVICE_PARAMS = serviceParams(true);
|
|
1692
|
+
var KNOWLEDGE_TYPES_DOC = KNOWLEDGE_PAGE_TYPES.map((t) => {
|
|
1693
|
+
const spec = KNOWLEDGE_TYPE_SPECS[t];
|
|
1694
|
+
const fields = spec.fields.map((f) => `${f.key} (${f.description})`).join("; ");
|
|
1695
|
+
return `${t}: ${spec.description}${fields ? ` Fields: ${fields}.` : ""}`;
|
|
1696
|
+
}).join(" | ");
|
|
1697
|
+
var KNOWLEDGE_RELATIONS_DOC = `${KNOWLEDGE_RELATIONS.join(", ")} (related and contradicts read both ways)`;
|
|
1698
|
+
var kIds = z23.array(KnowledgeIdSchema).max(50);
|
|
1699
|
+
var kSearchLimit = z23.number().int().min(1).max(KNOWLEDGE_LIMITS.searchResults);
|
|
1700
|
+
var kSections = z23.array(KnowledgeSectionSchema).max(KNOWLEDGE_LIMITS.sections);
|
|
1701
|
+
var kThemeDepth = z23.number().int().min(0).max(KNOWLEDGE_LIMITS.themeDepth);
|
|
1702
|
+
var kDepth = z23.number().int().min(1).max(KNOWLEDGE_LIMITS.neighborsDepth);
|
|
1703
|
+
var kRelatedLimit = z23.number().int().min(1).max(KNOWLEDGE_LIMITS.relatedPages);
|
|
1704
|
+
var kNeighborLimit = z23.number().int().min(1).max(KNOWLEDGE_LIMITS.neighborsNodes);
|
|
1705
|
+
var kHistoryLimit = z23.number().int().min(1).max(500);
|
|
1706
|
+
var kSeedIds = z23.array(KnowledgeIdSchema).min(1).max(10);
|
|
1707
|
+
function knowledgePageFields(p) {
|
|
1708
|
+
const out = {};
|
|
1709
|
+
if (p.title !== void 0) out.title = p.title;
|
|
1710
|
+
if (p.summary !== void 0) out.summary = p.summary;
|
|
1711
|
+
if (p.type !== void 0) out.type = parseTyped("type", KnowledgePageTypeSchema, p.type);
|
|
1712
|
+
if (p.aliases !== void 0) out.aliases = parseTyped("aliases", KnowledgeAliasesSchema, p.aliases);
|
|
1713
|
+
if (p.fields !== void 0) out.fields = parseTyped("fields", KnowledgeFieldsSchema, p.fields);
|
|
1714
|
+
if (p.themeIds !== void 0) out.themeIds = parseTyped("themeIds", KnowledgeThemeIdsSchema, p.themeIds);
|
|
1715
|
+
if (p.projectIds !== void 0) out.projectIds = parseTyped("projectIds", KnowledgeProjectIdsSchema, p.projectIds);
|
|
1716
|
+
if (p.sources !== void 0) out.sources = parseTyped("sources", KnowledgeSourcesSchema, p.sources);
|
|
1717
|
+
return out;
|
|
1718
|
+
}
|
|
1719
|
+
function sectionNamed(sections, heading) {
|
|
1720
|
+
const found = sections.filter((x) => foldText(String(x.heading)) === foldText(heading));
|
|
1721
|
+
if (found.length) return found;
|
|
1722
|
+
const names = sections.map((x) => `"${String(x.heading)}"`).join(", ") || "none";
|
|
1723
|
+
throw new Error(`No section "${heading}" in this page. Sections: ${names}.`);
|
|
1724
|
+
}
|
|
1725
|
+
function withoutFullBody(result) {
|
|
1726
|
+
if (!result || typeof result !== "object" || !("page" in result)) return result;
|
|
1727
|
+
const page0 = result.page;
|
|
1728
|
+
if (page0 && typeof page0 === "object") {
|
|
1729
|
+
const { markdown: _markdown, ...page } = page0;
|
|
1730
|
+
return { ...result, page };
|
|
1731
|
+
}
|
|
1732
|
+
return result;
|
|
1733
|
+
}
|
|
1734
|
+
function editedSectionOnly(result) {
|
|
1735
|
+
const reduced = withoutFullBody(result);
|
|
1736
|
+
if (!reduced || typeof reduced !== "object") return reduced;
|
|
1737
|
+
const { changed, ...response } = reduced;
|
|
1738
|
+
const page = response.page;
|
|
1739
|
+
if (!page || typeof page !== "object") return reduced;
|
|
1740
|
+
const { sections, id, title, status, lock, updatedAt, updatedBy } = page;
|
|
1741
|
+
const edited = changed ?? [];
|
|
1742
|
+
const touched = new Set(edited.map((c) => c.heading));
|
|
1743
|
+
return {
|
|
1744
|
+
...response,
|
|
1745
|
+
page: {
|
|
1746
|
+
// Ce qui sert à vérifier l'écriture ; la fiche complète est dans knowledge_get_page.
|
|
1747
|
+
id,
|
|
1748
|
+
title,
|
|
1749
|
+
status,
|
|
1750
|
+
locked: Boolean(lock),
|
|
1751
|
+
updatedAt,
|
|
1752
|
+
updatedBy,
|
|
1753
|
+
editedSections: edited,
|
|
1754
|
+
otherSections: (sections ?? []).map((s) => s.heading).filter((h) => !touched.has(h))
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
var isRec = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
1759
|
+
function slimThemes(item) {
|
|
1760
|
+
if (!isRec(item) || !Array.isArray(item.themes)) return item;
|
|
1761
|
+
return { ...item, themes: item.themes.map((t) => ({ id: t.id, title: t.title })) };
|
|
1762
|
+
}
|
|
1763
|
+
function pageSheet(page) {
|
|
1764
|
+
return { id: page.id, title: page.title, status: page.status, locked: Boolean(page.lock ?? page.locked), updatedAt: page.updatedAt, updatedBy: page.updatedBy };
|
|
1765
|
+
}
|
|
1766
|
+
function mergedLinks(links) {
|
|
1767
|
+
const byId = /* @__PURE__ */ new Map();
|
|
1768
|
+
for (const l of Array.isArray(links) ? links : []) {
|
|
1769
|
+
const id = String(l.id);
|
|
1770
|
+
const seen = byId.get(id);
|
|
1771
|
+
if (seen) seen.kinds.push(l.kind);
|
|
1772
|
+
else byId.set(id, { id: l.id, title: l.title, type: l.type, status: l.status, kinds: [l.kind] });
|
|
1773
|
+
}
|
|
1774
|
+
return [...byId.values()];
|
|
1775
|
+
}
|
|
1776
|
+
function writeAnswer(pick) {
|
|
1777
|
+
return (result, input) => {
|
|
1778
|
+
const reduced = withoutFullBody(result);
|
|
1779
|
+
if (!isRec(reduced) || !isRec(reduced.page)) return reduced;
|
|
1780
|
+
return { ...reduced, page: { ...pageSheet(reduced.page), ...pick(reduced.page, isRec(input) ? input : {}) } };
|
|
1781
|
+
};
|
|
1782
|
+
}
|
|
1783
|
+
var headingsOf = (page) => Array.isArray(page.sections) ? page.sections.map((x) => String(x.heading)) : [];
|
|
1784
|
+
function readPageAnswer(result, input) {
|
|
1785
|
+
const reduced = withoutFullBody(result);
|
|
1786
|
+
if (!isRec(reduced) || !isRec(reduced.page)) return reduced;
|
|
1787
|
+
const page = slimThemes(reduced.page);
|
|
1788
|
+
const links = isRec(page.links) ? page.links : {};
|
|
1789
|
+
const heading = isRec(input) && typeof input.heading === "string" ? input.heading : void 0;
|
|
1790
|
+
const sections = Array.isArray(page.sections) ? page.sections : [];
|
|
1791
|
+
const picked = heading === void 0 ? sections : sectionNamed(sections, heading);
|
|
1792
|
+
return {
|
|
1793
|
+
...reduced,
|
|
1794
|
+
page: {
|
|
1795
|
+
...page,
|
|
1796
|
+
links: { outgoing: mergedLinks(links.outgoing), incoming: mergedLinks(links.incoming) },
|
|
1797
|
+
sections: picked,
|
|
1798
|
+
...heading === void 0 ? {} : { otherSections: headingsOf(page).filter((h) => foldText(h) !== foldText(heading)) },
|
|
1799
|
+
// Les sections encore vides : une page à compléter se voit sans relire le détail.
|
|
1800
|
+
...sections.some((x) => !String(x.markdown).trim()) ? { emptySections: sections.filter((x) => !String(x.markdown).trim()).map((x) => String(x.heading)) } : {}
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
var KNOWLEDGE_LOCK_NOTE = "A page locked by a person cannot be changed by you: the call is refused, tell the user what you would change instead.";
|
|
1805
|
+
var KNOWLEDGE_CAPABILITIES = [
|
|
1806
|
+
{
|
|
1807
|
+
name: "knowledge_list_spaces",
|
|
1808
|
+
description: "List the knowledge spaces of the organization (the team's long-term memory, kept in the cloud). Returns the organizationId actually queried and each space id, name, description and page count.",
|
|
1809
|
+
route: "knowledge.listSpaces",
|
|
1810
|
+
method: "GET",
|
|
1811
|
+
params: [{ name: "organizationId", description: "The organization. Optional when the machine has one.", required: false }],
|
|
1812
|
+
buildInput: (p) => p.organizationId ? { organizationId: p.organizationId } : {},
|
|
1813
|
+
usageHint: `"qu'est-ce qu'on sait sur\u2026" / "cherche dans la m\xE9moire" \u2192 knowledge_search before answering from your own assumptions.`
|
|
1814
|
+
},
|
|
1815
|
+
{
|
|
1816
|
+
name: "knowledge_search",
|
|
1817
|
+
description: `Search the knowledge base: free text (accent and case insensitive, French stemming; each word may be partial and is looked for in titles, aliases, summaries, fields and bodies; every remaining word must match, stop words are ignored), filtered by type, space, project and themes. Each hit gives its summary, theme ids (their titles are listed once in themes) and the number of linked pages, so you can choose without opening pages. Cross themes with themeIds: only pages carrying ALL the given themes are returned, each theme counting its sub-themes down to themeDepth levels (0 = the theme alone, default 1). Obsolete pages are left out unless includeObsolete. Without a query, pages come by last update and the answer gives nextCursor: pass it as cursor to get the next ones, until it is absent. With a query, nextCursor gives the next results of the same ranking, frozen for 15 minutes (pass the same query with it): nothing is skipped or repeated even if pages change meanwhile. incomplete: true means more pages match than were examined: refine the query (more words, a type, a theme, a space) rather than trusting the list as complete. Page types: ${KNOWLEDGE_TYPES_DOC}`,
|
|
1818
|
+
route: "knowledge.search",
|
|
1819
|
+
method: "GET",
|
|
1820
|
+
params: [
|
|
1821
|
+
{ name: "query", description: "Free text. Omit to list pages by last update.", required: false },
|
|
1822
|
+
{ name: "types", description: `Page types to keep: ${KNOWLEDGE_PAGE_TYPES.join(", ")}`, required: false, schema: z23.array(KnowledgePageTypeSchema) },
|
|
1823
|
+
{ name: "themeIds", description: "Theme page ids the pages must ALL carry (from knowledge_list_themes)", required: false, schema: KnowledgeThemeIdsSchema },
|
|
1824
|
+
{ name: "themeDepth", description: `Levels of sub-themes counted with each theme, 0 to ${KNOWLEDGE_LIMITS.themeDepth}`, required: false, schema: kThemeDepth },
|
|
1825
|
+
{ name: "spaceIds", description: "Restrict to these spaces", required: false, schema: kIds },
|
|
1826
|
+
// Pas `projectId` : ce nom est rempli d'office avec le projet de la
|
|
1827
|
+
// conversation (project-anchor), ce qui filtrait toute recherche sur lui.
|
|
1828
|
+
{ name: "onlyProjectId", description: "Only pages attached to this Runeya project. Omit to search the whole organization.", required: false },
|
|
1829
|
+
{ name: "includeObsolete", description: "Also return obsolete pages", required: false, schema: z23.boolean() },
|
|
1830
|
+
{ name: "limit", description: `At most this many hits (1-${KNOWLEDGE_LIMITS.searchResults}, default 20)`, required: false, schema: kSearchLimit },
|
|
1831
|
+
{ name: "organizationId", description: "The organization. Optional when the machine has one.", required: false },
|
|
1832
|
+
{ name: "cursor", description: "The nextCursor of the previous answer, to get the next pages (with a query, pass the same query)", required: false }
|
|
1833
|
+
],
|
|
1834
|
+
buildInput: (p) => ({
|
|
1835
|
+
...p.organizationId ? { organizationId: p.organizationId } : {},
|
|
1836
|
+
...p.query ? { query: p.query } : {},
|
|
1837
|
+
...p.onlyProjectId ? { projectId: p.onlyProjectId } : {},
|
|
1838
|
+
...p.types !== void 0 ? { types: parseTyped("types", z23.array(KnowledgePageTypeSchema), p.types) } : {},
|
|
1839
|
+
...p.themeIds !== void 0 ? { themeIds: parseTyped("themeIds", KnowledgeThemeIdsSchema, p.themeIds) } : {},
|
|
1840
|
+
...p.themeDepth !== void 0 ? { themeDepth: parseTyped("themeDepth", kThemeDepth, p.themeDepth) } : {},
|
|
1841
|
+
...p.spaceIds !== void 0 ? { spaceIds: parseTyped("spaceIds", kIds, p.spaceIds) } : {},
|
|
1842
|
+
...p.includeObsolete !== void 0 ? { includeObsolete: parseTyped("includeObsolete", z23.boolean(), p.includeObsolete) } : {},
|
|
1843
|
+
...p.limit !== void 0 ? { limit: parseTyped("limit", kSearchLimit, p.limit) } : {},
|
|
1844
|
+
...p.cursor !== void 0 ? { cursor: p.cursor } : {}
|
|
1845
|
+
}),
|
|
1846
|
+
// Les thèmes une seule fois, en tête : chaque résultat ne porte que leurs ids.
|
|
1847
|
+
transformOutput: (result) => {
|
|
1848
|
+
if (!isRec(result) || !Array.isArray(result.hits)) return result;
|
|
1849
|
+
const themes = {};
|
|
1850
|
+
const hits = result.hits.map((h) => {
|
|
1851
|
+
const ids = Array.isArray(h.themes) ? h.themes.map((t) => {
|
|
1852
|
+
themes[String(t.id)] = t.title;
|
|
1853
|
+
return t.id;
|
|
1854
|
+
}) : [];
|
|
1855
|
+
return { ...h, themes: ids };
|
|
1856
|
+
});
|
|
1857
|
+
return { ...result, themes, hits };
|
|
1858
|
+
}
|
|
1859
|
+
},
|
|
1860
|
+
{
|
|
1861
|
+
name: "knowledge_list_themes",
|
|
1862
|
+
description: "List the theme pages: each theme id, title, its broader themes (parentIds) and how many pages carry it. Themes form a hierarchy from broad to precise; use their ids in knowledge_search themeIds to cross pages by subject. A theme with similarTo has an almost identical title to those themes: probably a duplicate, prefer the one with the most pages.",
|
|
1863
|
+
route: "knowledge.listThemes",
|
|
1864
|
+
method: "GET",
|
|
1865
|
+
params: [
|
|
1866
|
+
{ name: "spaceId", description: "Only the themes of this space", required: false },
|
|
1867
|
+
{ name: "organizationId", description: "The organization. Optional when the machine has one.", required: false }
|
|
1868
|
+
],
|
|
1869
|
+
buildInput: (p) => ({ ...p.organizationId ? { organizationId: p.organizationId } : {}, ...p.spaceId ? { spaceId: p.spaceId } : {} })
|
|
1870
|
+
},
|
|
1871
|
+
{
|
|
1872
|
+
name: "knowledge_get_page",
|
|
1873
|
+
description: "Read one knowledge page: type, fields, summary, aliases, themes, sources, its sections in Markdown, links in both directions (each linked page once, with all its link kinds), what replaces it, and whether it is locked. Links to other pages in the body are written [title](kb:<pageId>).",
|
|
1874
|
+
route: "knowledge.getPage",
|
|
1875
|
+
method: "GET",
|
|
1876
|
+
params: [
|
|
1877
|
+
{ name: "pageId", description: "The page id", required: true },
|
|
1878
|
+
{ name: "heading", description: "Read only this section (heading, case and accents ignored); the others are listed by heading", required: false }
|
|
1879
|
+
],
|
|
1880
|
+
buildInput: (p) => ({ pageId: p.pageId, ...p.heading !== void 0 ? { heading: p.heading } : {} }),
|
|
1881
|
+
transformOutput: readPageAnswer
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
name: "knowledge_get_neighbors",
|
|
1885
|
+
description: "Walk the graph around a page, both directions, 1 to 3 hops: the pages reached (nearest first, with their distance and summary) and the edges between them. Obsolete pages are left out unless includeObsolete. Edge kinds: explicit relations, theme (a page and its theme), mentions (a [title](kb:id) link in a body), superseded_by.",
|
|
1886
|
+
route: "knowledge.getNeighbors",
|
|
1887
|
+
method: "GET",
|
|
1888
|
+
params: [
|
|
1889
|
+
{ name: "pageId", description: "The starting page", required: true },
|
|
1890
|
+
{ name: "depth", description: `Number of hops, 1 to ${KNOWLEDGE_LIMITS.neighborsDepth} (default 1)`, required: false, schema: kDepth },
|
|
1891
|
+
{ name: "kinds", description: "Only follow these edge kinds", required: false, schema: z23.array(KnowledgeEdgeKindSchema) },
|
|
1892
|
+
{ name: "limit", description: "At most this many pages, nearest first (default all)", required: false, schema: kNeighborLimit },
|
|
1893
|
+
{ name: "includeObsolete", description: "Also return obsolete pages (left out by default)", required: false, schema: z23.boolean() }
|
|
1894
|
+
],
|
|
1895
|
+
buildInput: (p) => ({
|
|
1896
|
+
pageId: p.pageId,
|
|
1897
|
+
...p.depth !== void 0 ? { depth: parseTyped("depth", kDepth, p.depth) } : {},
|
|
1898
|
+
...p.kinds !== void 0 ? { kinds: parseTyped("kinds", z23.array(KnowledgeEdgeKindSchema), p.kinds) } : {},
|
|
1899
|
+
...p.limit !== void 0 ? { limit: parseTyped("limit", kNeighborLimit, p.limit) } : {},
|
|
1900
|
+
...p.includeObsolete !== void 0 ? { includeObsolete: parseTyped("includeObsolete", z23.boolean(), p.includeObsolete) } : {}
|
|
1901
|
+
}),
|
|
1902
|
+
transformOutput: (result, input) => {
|
|
1903
|
+
if (!isRec(result) || !Array.isArray(result.nodes)) return result;
|
|
1904
|
+
const limit = isRec(input) && typeof input.limit === "number" ? input.limit : void 0;
|
|
1905
|
+
const all = result.nodes.map(slimThemes);
|
|
1906
|
+
const nodes = limit === void 0 ? all : all.slice(0, limit + 1);
|
|
1907
|
+
const kept = new Set(nodes.map((n) => n.id));
|
|
1908
|
+
const merged = /* @__PURE__ */ new Map();
|
|
1909
|
+
for (const e of Array.isArray(result.edges) ? result.edges : []) {
|
|
1910
|
+
if (!kept.has(e.from) || !kept.has(e.to)) continue;
|
|
1911
|
+
const key = `${String(e.from)}>${String(e.to)}`;
|
|
1912
|
+
const seen = merged.get(key);
|
|
1913
|
+
if (seen) seen.kinds.push(e.kind);
|
|
1914
|
+
else merged.set(key, { from: e.from, to: e.to, kinds: [e.kind] });
|
|
1915
|
+
}
|
|
1916
|
+
const edges = [...merged.values()];
|
|
1917
|
+
return { ...result, nodes, edges, truncated: Boolean(result.truncated) || nodes.length < all.length, omitted: all.length - nodes.length };
|
|
1918
|
+
}
|
|
1919
|
+
},
|
|
1920
|
+
{
|
|
1921
|
+
name: "knowledge_get_related",
|
|
1922
|
+
description: "Find the pages closest to one or several pages, even without a direct link: score = 3 \xD7 direct links + 2 \xD7 shared themes + 1 \xD7 shared neighbors. Obsolete pages are left out unless includeObsolete. Use it to gather everything on a subject before answering or writing.",
|
|
1923
|
+
route: "knowledge.getRelated",
|
|
1924
|
+
method: "GET",
|
|
1925
|
+
params: [
|
|
1926
|
+
{ name: "pageIds", description: "One to ten page ids", required: true, schema: kSeedIds },
|
|
1927
|
+
{ name: "limit", description: "At most this many pages (default 10)", required: false, schema: kRelatedLimit },
|
|
1928
|
+
{ name: "includeObsolete", description: "Also return obsolete pages (left out by default)", required: false, schema: z23.boolean() }
|
|
1929
|
+
],
|
|
1930
|
+
buildInput: (p) => ({
|
|
1931
|
+
pageIds: parseTyped("pageIds", kSeedIds, p.pageIds),
|
|
1932
|
+
...p.limit !== void 0 ? { limit: parseTyped("limit", kRelatedLimit, p.limit) } : {},
|
|
1933
|
+
...p.includeObsolete !== void 0 ? { includeObsolete: parseTyped("includeObsolete", z23.boolean(), p.includeObsolete) } : {}
|
|
1934
|
+
}),
|
|
1935
|
+
transformOutput: (result) => isRec(result) && Array.isArray(result.pages) ? { ...result, pages: result.pages.map(slimThemes) } : result
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
name: "knowledge_get_history",
|
|
1939
|
+
description: "Read the history of a page: its versions, newest first, each with its date (at), its author (a person or an AI) and the number of changes. Each AI write is its own version; close edits by one person are grouped. Read the content of a version with knowledge_get_version.",
|
|
1940
|
+
route: "knowledge.getHistory",
|
|
1941
|
+
method: "GET",
|
|
1942
|
+
params: [
|
|
1943
|
+
{ name: "pageId", description: "The page id", required: true },
|
|
1944
|
+
{ name: "limit", description: "At most this many versions, newest first (default all)", required: false, schema: kHistoryLimit }
|
|
1945
|
+
],
|
|
1946
|
+
buildInput: (p) => ({ pageId: p.pageId, ...p.limit !== void 0 ? { limit: parseTyped("limit", kHistoryLimit, p.limit) } : {} }),
|
|
1947
|
+
transformOutput: (result, input) => {
|
|
1948
|
+
if (!isRec(result) || !Array.isArray(result.versions)) return result;
|
|
1949
|
+
const limit = isRec(input) && typeof input.limit === "number" ? input.limit : void 0;
|
|
1950
|
+
const all = result.versions.map((v) => {
|
|
1951
|
+
const { from, ...rest } = v;
|
|
1952
|
+
return from === v.at ? rest : v;
|
|
1953
|
+
});
|
|
1954
|
+
const versions = limit === void 0 ? all : all.slice(0, limit);
|
|
1955
|
+
return { ...result, versions, omitted: all.length - versions.length };
|
|
1956
|
+
}
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
name: "knowledge_get_version",
|
|
1960
|
+
description: "Read a page as it was at a past date: title, summary, status, fields and sections in Markdown. Take the date (at) from knowledge_get_history. With compare, the answer also gives what changed since that version (sinceThen): changed paragraphs per section (previous = the version, paragraphs = now) and the sheet fields that differ. Restoring a version is left to people, in the app.",
|
|
1961
|
+
route: "knowledge.getVersion",
|
|
1962
|
+
method: "GET",
|
|
1963
|
+
params: [
|
|
1964
|
+
{ name: "pageId", description: "The page id", required: true },
|
|
1965
|
+
{ name: "at", description: "The date of the version, as given by knowledge_get_history (ISO 8601)", required: true, schema: z23.iso.datetime() },
|
|
1966
|
+
{ name: "heading", description: "Read only this section of the version", required: false },
|
|
1967
|
+
{ name: "compare", description: "Also give what changed since this version (sinceThen)", required: false, schema: z23.boolean() }
|
|
1968
|
+
],
|
|
1969
|
+
buildInput: (p) => ({ pageId: p.pageId, at: parseTyped("at", z23.iso.datetime(), p.at), ...p.heading !== void 0 ? { heading: p.heading } : {}, ...p.compare !== void 0 ? { compare: parseTyped("compare", z23.boolean(), p.compare) } : {} }),
|
|
1970
|
+
transformOutput: (result, input) => {
|
|
1971
|
+
if (!isRec(result) || !isRec(result.snapshot)) return result;
|
|
1972
|
+
const { markdown: _markdown, ...snapshot } = result.snapshot;
|
|
1973
|
+
const extra = result.sinceThen === void 0 ? {} : { sinceThen: result.sinceThen };
|
|
1974
|
+
const heading = isRec(input) && typeof input.heading === "string" ? input.heading : void 0;
|
|
1975
|
+
if (heading === void 0) return { snapshot, ...extra };
|
|
1976
|
+
const sections = Array.isArray(snapshot.sections) ? snapshot.sections : [];
|
|
1977
|
+
return { snapshot: { ...snapshot, sections: sectionNamed(sections, heading) }, ...extra };
|
|
1978
|
+
}
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
name: "knowledge_create_page",
|
|
1982
|
+
description: `Create a knowledge page. Search first: update an existing page rather than creating a duplicate. The answer lists pages with an almost identical title (similar): if one is the same subject, mark the new page obsolete and complete the existing one. Give a precise title, a one or two sentence summary (it is what searches show), aliases (other names people use), themes and links. Sections default to those of the type; give your own as [{"heading","markdown"}]. Cite other pages in Markdown as [title](kb:<pageId>). Types: ${KNOWLEDGE_TYPES_DOC}`,
|
|
1983
|
+
route: "knowledge.createPage",
|
|
1984
|
+
method: "POST",
|
|
1985
|
+
params: [
|
|
1986
|
+
{ name: "spaceId", description: "The space, from knowledge_list_spaces", required: true },
|
|
1987
|
+
{ name: "type", description: `One of ${KNOWLEDGE_PAGE_TYPES.join(", ")}`, required: true, schema: KnowledgePageTypeSchema },
|
|
1988
|
+
{ name: "title", description: "Page title", required: true },
|
|
1989
|
+
{ name: "summary", description: "One or two sentences", required: true },
|
|
1990
|
+
{ name: "aliases", description: "Other names for the subject", required: false, schema: KnowledgeAliasesSchema },
|
|
1991
|
+
{ name: "fields", description: "The fields of the type, as an object", required: false, schema: KnowledgeFieldsSchema },
|
|
1992
|
+
{ name: "themeIds", description: "Theme page ids", required: false, schema: KnowledgeThemeIdsSchema },
|
|
1993
|
+
{ name: "projectIds", description: "Runeya project ids the page is about", required: false, schema: KnowledgeProjectIdsSchema },
|
|
1994
|
+
{ name: "sources", description: 'Where the knowledge comes from: [{"label","url"?}]', required: false, schema: KnowledgeSourcesSchema },
|
|
1995
|
+
{ name: "sections", description: 'Body sections: [{"heading","markdown"}]', required: false, schema: kSections },
|
|
1996
|
+
{ name: "links", description: `Links to other pages: [{"to","relation"}], relation among ${KNOWLEDGE_RELATIONS_DOC}`, required: false, schema: z23.array(KnowledgeLinkSchema).max(200) },
|
|
1997
|
+
{ name: "locale", description: "Language of default section titles: fr or en", required: false, schema: KnowledgeLocaleSchema }
|
|
1998
|
+
],
|
|
1999
|
+
buildInput: (p) => ({
|
|
2000
|
+
spaceId: p.spaceId,
|
|
2001
|
+
...knowledgePageFields(p),
|
|
2002
|
+
...p.sections !== void 0 ? { sections: parseTyped("sections", kSections, p.sections) } : {},
|
|
2003
|
+
...p.links !== void 0 ? { links: parseTyped("links", z23.array(KnowledgeLinkSchema).max(200), p.links) } : {},
|
|
2004
|
+
...p.locale !== void 0 ? { locale: parseTyped("locale", KnowledgeLocaleSchema, p.locale) } : {}
|
|
2005
|
+
}),
|
|
2006
|
+
transformOutput: writeAnswer((page) => ({ themes: slimThemes(page).themes, sections: headingsOf(page) }))
|
|
2007
|
+
},
|
|
2008
|
+
{
|
|
2009
|
+
name: "knowledge_update_page",
|
|
2010
|
+
description: `Change the card of a page: title, summary, type, aliases, fields (merged; an empty value clears a field), themes, projects, sources (lists replace the current ones), status. To retire a page, set supersededBy to the page replacing it (it becomes obsolete) or status to obsolete: you cannot delete pages. ${KNOWLEDGE_LOCK_NOTE}`,
|
|
2011
|
+
route: "knowledge.updatePage",
|
|
2012
|
+
method: "POST",
|
|
2013
|
+
params: [
|
|
2014
|
+
{ name: "pageId", description: "The page id", required: true },
|
|
2015
|
+
{ name: "title", description: "New title", required: false },
|
|
2016
|
+
{ name: "summary", description: "New summary", required: false },
|
|
2017
|
+
{ name: "type", description: "New type", required: false, schema: KnowledgePageTypeSchema },
|
|
2018
|
+
{ name: "aliases", description: "Replaces the aliases", required: false, schema: KnowledgeAliasesSchema },
|
|
2019
|
+
{ name: "fields", description: "Fields to set or clear", required: false, schema: KnowledgeFieldsSchema },
|
|
2020
|
+
{ name: "themeIds", description: "Replaces the themes", required: false, schema: KnowledgeThemeIdsSchema },
|
|
2021
|
+
{ name: "projectIds", description: "Replaces the projects", required: false, schema: KnowledgeProjectIdsSchema },
|
|
2022
|
+
{ name: "sources", description: "Replaces the sources", required: false, schema: KnowledgeSourcesSchema },
|
|
2023
|
+
{ name: "status", description: "active or obsolete", required: false, schema: KnowledgeStatusSchema },
|
|
2024
|
+
{ name: "supersededBy", description: "The page replacing this one; null removes it", required: false, schema: KnowledgeIdSchema.nullable() }
|
|
2025
|
+
],
|
|
2026
|
+
buildInput: (p) => ({
|
|
2027
|
+
pageId: p.pageId,
|
|
2028
|
+
...knowledgePageFields(p),
|
|
2029
|
+
...p.status !== void 0 ? { status: parseTyped("status", KnowledgeStatusSchema, p.status) } : {},
|
|
2030
|
+
...p.supersededBy !== void 0 ? { supersededBy: parseTyped("supersededBy", KnowledgeIdSchema.nullable(), p.supersededBy) } : {}
|
|
2031
|
+
}),
|
|
2032
|
+
// Les seuls champs de la fiche que l'appel a donnés, tels qu'enregistrés.
|
|
2033
|
+
transformOutput: writeAnswer((page, input) => Object.fromEntries(Object.keys(input).flatMap((key) => {
|
|
2034
|
+
if (key === "pageId") return [];
|
|
2035
|
+
if (key === "themeIds") return [["themes", slimThemes(page).themes]];
|
|
2036
|
+
return [[key, page[key]]];
|
|
2037
|
+
})))
|
|
2038
|
+
},
|
|
2039
|
+
{
|
|
2040
|
+
name: "knowledge_update_section",
|
|
2041
|
+
description: `Write one section of a page body, named by its heading (case and accents ignored): replace its content, append to it, or remove it. A heading that does not exist is an error listing the sections (often a typo); set create to true to add it at the end. An empty heading is the text before the first section. Inside the markdown, use ### or deeper for subheadings: a # or ## line is refused. Other sections are left untouched, including what a person is typing in them. ${KNOWLEDGE_LOCK_NOTE}`,
|
|
2042
|
+
route: "knowledge.editSection",
|
|
2043
|
+
method: "POST",
|
|
2044
|
+
params: [
|
|
2045
|
+
{ name: "pageId", description: "The page id", required: true },
|
|
2046
|
+
{ name: "heading", description: "The section heading", required: true },
|
|
2047
|
+
{ name: "markdown", description: "The content, in Markdown (required unless mode is remove)", required: false },
|
|
2048
|
+
{ name: "mode", description: "replace (default), append or remove", required: false, schema: KnowledgeSectionModeSchema },
|
|
2049
|
+
{ name: "create", description: "Create the section at the end if no section has this heading", required: false, schema: z23.boolean() }
|
|
2050
|
+
],
|
|
2051
|
+
buildInput: (p) => {
|
|
2052
|
+
const started = typeof p.markdown === "string" ? [...p.markdown.matchAll(/^#{1,2}\s+(.+)$/gm)].map((m) => m[1].trim()) : [];
|
|
2053
|
+
if (started.length) {
|
|
2054
|
+
throw new Error(`The markdown would start new sections (${started.map((h) => `"${h}"`).join(", ")}). Use ### or deeper for subheadings inside a section, or write each section with its own call.`);
|
|
2055
|
+
}
|
|
2056
|
+
return {
|
|
2057
|
+
pageId: p.pageId,
|
|
2058
|
+
heading: p.heading ?? "",
|
|
2059
|
+
...p.markdown !== void 0 ? { markdown: p.markdown } : {},
|
|
2060
|
+
...p.mode !== void 0 ? { mode: parseTyped("mode", KnowledgeSectionModeSchema, p.mode) } : {},
|
|
2061
|
+
...p.create !== void 0 ? { create: parseTyped("create", z23.boolean(), p.create) } : {}
|
|
2062
|
+
};
|
|
2063
|
+
},
|
|
2064
|
+
transformOutput: writeAnswer((page, input) => {
|
|
2065
|
+
const heading = typeof input.heading === "string" ? input.heading : "";
|
|
2066
|
+
const sections = Array.isArray(page.sections) ? page.sections : [];
|
|
2067
|
+
return {
|
|
2068
|
+
section: sections.find((x) => foldText(String(x.heading)) === foldText(heading)) ?? null,
|
|
2069
|
+
otherSections: headingsOf(page).filter((h) => foldText(h) !== foldText(heading))
|
|
2070
|
+
};
|
|
2071
|
+
})
|
|
2072
|
+
},
|
|
2073
|
+
{
|
|
2074
|
+
name: "knowledge_edit_text",
|
|
2075
|
+
description: `Replace an exact passage of a page body, like a text editor: send only the old text and the new one, not the whole section. The passage is matched against the Markdown returned by knowledge_get_page (so bold is **\u2026**, a page link is [title](kb:id)) and must appear exactly once, in the given section or in the whole body; otherwise nothing is written and the error says whether it is missing or ambiguous. The answer gives the page id, title, status, lock and last update and, for each edited section, only the paragraphs that are new or changed, their previous version and how many were deleted without replacement (editedSections); the other sections are listed by heading, and the rest of the sheet (themes, fields, links) is left out: read it with knowledge_get_page. Prefer it to knowledge_update_section for a change inside a long section. To insert text, anchor on the words around the insertion point: to complete "We chose Mongo." send find "We chose Mongo." and replace "We chose Mongo for its flexibility.". ${KNOWLEDGE_LOCK_NOTE}`,
|
|
2076
|
+
route: "knowledge.editText",
|
|
2077
|
+
method: "POST",
|
|
2078
|
+
params: [
|
|
2079
|
+
{ name: "pageId", description: "The page id", required: true },
|
|
2080
|
+
{ name: "find", description: "The exact text to replace, as it appears in the page Markdown. Include enough surrounding words for it to be unique.", required: true },
|
|
2081
|
+
{ name: "replace", description: "The new text (empty to delete the passage)", required: true },
|
|
2082
|
+
{ name: "heading", description: "Look only in this section (heading, case and accents ignored; empty = text before the first section)", required: false },
|
|
2083
|
+
{ name: "all", description: "Replace every occurrence instead of requiring a unique one", required: false, schema: z23.boolean() }
|
|
2084
|
+
],
|
|
2085
|
+
buildInput: (p) => ({
|
|
2086
|
+
pageId: p.pageId,
|
|
2087
|
+
find: p.find,
|
|
2088
|
+
replace: p.replace ?? "",
|
|
2089
|
+
...p.heading !== void 0 ? { heading: p.heading } : {},
|
|
2090
|
+
...p.all !== void 0 ? { all: parseTyped("all", z23.boolean(), p.all) } : {}
|
|
2091
|
+
}),
|
|
2092
|
+
transformOutput: editedSectionOnly
|
|
2093
|
+
},
|
|
2094
|
+
{
|
|
2095
|
+
name: "knowledge_link_pages",
|
|
2096
|
+
description: `Declare a link from a page to another: ${KNOWLEDGE_RELATIONS_DOC}. The link belongs to the starting page, so you may link to a locked page. The answer says whether the link already existed (alreadyLinked). ${KNOWLEDGE_LOCK_NOTE}`,
|
|
2097
|
+
route: "knowledge.link",
|
|
2098
|
+
method: "POST",
|
|
2099
|
+
params: [
|
|
2100
|
+
{ name: "pageId", description: "The starting page", required: true },
|
|
2101
|
+
{ name: "to", description: "The target page", required: true },
|
|
2102
|
+
{ name: "relation", description: KNOWLEDGE_RELATIONS.join(", "), required: true, schema: KnowledgeRelationSchema }
|
|
2103
|
+
],
|
|
2104
|
+
buildInput: (p) => ({ pageId: p.pageId, to: p.to, relation: parseTyped("relation", KnowledgeRelationSchema, p.relation) }),
|
|
2105
|
+
transformOutput: writeAnswer((page) => ({ outgoingLinks: mergedLinks(isRec(page.links) ? page.links.outgoing : []) }))
|
|
2106
|
+
},
|
|
2107
|
+
{
|
|
2108
|
+
name: "knowledge_unlink_pages",
|
|
2109
|
+
description: `Remove a link declared by a page; without relation, every declared link to the target. The answer says how many were removed (removed). A mentions link comes from a [title](kb:id) in the body: remove it by editing the text (knowledge_edit_text), not with this tool. ${KNOWLEDGE_LOCK_NOTE}`,
|
|
2110
|
+
route: "knowledge.unlink",
|
|
2111
|
+
method: "POST",
|
|
2112
|
+
params: [
|
|
2113
|
+
{ name: "pageId", description: "The starting page", required: true },
|
|
2114
|
+
{ name: "to", description: "The target page", required: true },
|
|
2115
|
+
{ name: "relation", description: `${KNOWLEDGE_RELATIONS.join(", ")}. Omit it to remove every declared link to the target page.`, required: false, schema: KnowledgeRelationSchema }
|
|
2116
|
+
],
|
|
2117
|
+
buildInput: (p) => ({ pageId: p.pageId, to: p.to, ...p.relation !== void 0 ? { relation: parseTyped("relation", KnowledgeRelationSchema, p.relation) } : {} }),
|
|
2118
|
+
transformOutput: writeAnswer((page) => ({ outgoingLinks: mergedLinks(isRec(page.links) ? page.links.outgoing : []) }))
|
|
2119
|
+
}
|
|
2120
|
+
];
|
|
1494
2121
|
var RUNEYA_CAPABILITIES = [
|
|
1495
2122
|
{
|
|
1496
2123
|
name: "list_services",
|
|
@@ -2283,7 +2910,8 @@ var RUNEYA_CAPABILITIES = [
|
|
|
2283
2910
|
method: "GET",
|
|
2284
2911
|
params: [],
|
|
2285
2912
|
buildInput: () => void 0
|
|
2286
|
-
}
|
|
2913
|
+
},
|
|
2914
|
+
...KNOWLEDGE_CAPABILITIES
|
|
2287
2915
|
];
|
|
2288
2916
|
function buildMcpShape(cap) {
|
|
2289
2917
|
const shape = {};
|
|
@@ -2301,6 +2929,13 @@ function toRawParams(input, cap) {
|
|
|
2301
2929
|
v === null && typed.has(k) ? "null" : v == null ? void 0 : typeof v === "object" ? JSON.stringify(v) : String(v)
|
|
2302
2930
|
]));
|
|
2303
2931
|
}
|
|
2932
|
+
function withoutStack(error2) {
|
|
2933
|
+
if (!error2 || typeof error2 !== "object") return error2;
|
|
2934
|
+
const { data, ...rest } = error2;
|
|
2935
|
+
if (!data || typeof data !== "object") return error2;
|
|
2936
|
+
const { stack: _stack, ...cleanData } = data;
|
|
2937
|
+
return { ...rest, data: cleanData };
|
|
2938
|
+
}
|
|
2304
2939
|
async function callTrpc(baseUrl, route, method, input, authToken, fetchImpl = fetch) {
|
|
2305
2940
|
const headers = {
|
|
2306
2941
|
"Content-Type": "application/json",
|
|
@@ -2314,13 +2949,14 @@ async function callTrpc(baseUrl, route, method, input, authToken, fetchImpl = fe
|
|
|
2314
2949
|
signal: AbortSignal.timeout(15e3)
|
|
2315
2950
|
});
|
|
2316
2951
|
const json = await res.json();
|
|
2317
|
-
if (json["error"]) throw new Error(JSON.stringify(json["error"]));
|
|
2952
|
+
if (json["error"]) throw new Error(JSON.stringify(withoutStack(json["error"])));
|
|
2318
2953
|
const result = json["result"];
|
|
2319
2954
|
return result?.["data"] ?? result ?? json;
|
|
2320
2955
|
}
|
|
2321
2956
|
async function runCapability(cap, baseUrl, params, authToken, fetchImpl = fetch) {
|
|
2322
|
-
const
|
|
2323
|
-
|
|
2957
|
+
const input = cap.buildInput(params);
|
|
2958
|
+
const result = await callTrpc(baseUrl, cap.route, cap.method, input, authToken, fetchImpl);
|
|
2959
|
+
return cap.transformOutput ? cap.transformOutput(result, input) : result;
|
|
2324
2960
|
}
|
|
2325
2961
|
function applyProjectAnchor(cap, params, anchor) {
|
|
2326
2962
|
const accepts = (name) => cap.params.some((p) => p.name === name);
|