@runeya/runeya 2.0.145 → 2.0.146

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.
Files changed (116) hide show
  1. package/agent/index.js +26 -21
  2. package/agent/index.js.map +1 -1
  3. package/agent-manager-R7BPQO6D.js +11 -0
  4. package/{chat-XYCHMTFE.js → chat-LPML22J5.js} +8 -7
  5. package/{chunk-NCO4OOYT.js → chunk-4LJQIQMN.js} +2 -2
  6. package/chunk-6IBPK6UE.js +1063 -0
  7. package/chunk-6IBPK6UE.js.map +1 -0
  8. package/{chunk-QF56Z6LI.js → chunk-KV4GJKXU.js} +3 -3
  9. package/{chunk-FE53XX4M.js → chunk-NPMSBYXC.js} +3 -3
  10. package/{chunk-ONVAH65J.js → chunk-SEPAURTQ.js} +283 -1266
  11. package/chunk-SEPAURTQ.js.map +1 -0
  12. package/{chunk-Q4RPY3VW.js → chunk-UD42LACH.js} +25 -11
  13. package/{chunk-Q4RPY3VW.js.map → chunk-UD42LACH.js.map} +1 -1
  14. package/{chunk-KS7A5CTW.js → chunk-VPSQJOSN.js} +12 -2
  15. package/{chunk-KS7A5CTW.js.map → chunk-VPSQJOSN.js.map} +1 -1
  16. package/{companion-HBYSY2D5.js → companion-W3UMZWGH.js} +5 -5
  17. package/external-NMKQPROK.js +387 -0
  18. package/external-NMKQPROK.js.map +1 -0
  19. package/index.js +15 -6
  20. package/index.js.map +1 -1
  21. package/{install-gate-JAEK4BDZ.js → install-gate-PVMGJDWE.js} +2 -2
  22. package/mcp-server/external.d.ts +44 -0
  23. package/mcp-server/external.js +2679 -0
  24. package/mcp-server/external.js.map +1 -0
  25. package/mcp-server/index.js +135 -39
  26. package/mcp-server/index.js.map +1 -1
  27. package/mcp-server/launch.d.ts +19 -1
  28. package/mcp-server/launch.js +20 -0
  29. package/mcp-server/launch.js.map +1 -1
  30. package/package.json +1 -1
  31. package/settings-manager-XPLBO35P.js +10 -0
  32. package/{src-IODFUZ7A.js → src-LEDGW5KP.js} +951 -499
  33. package/src-LEDGW5KP.js.map +1 -0
  34. package/{vault-resolver-PN3TYCLJ.js → vault-resolver-E7KPKA5C.js} +2 -2
  35. package/web/assets/{AgentScalarChatInterface.vue-npQgDxeP.js → AgentScalarChatInterface.vue-BYszptaB.js} +1 -1
  36. package/web/assets/{AgentTerminalPage-BTH3yCS2.js → AgentTerminalPage-C3TJ1NL9.js} +1 -1
  37. package/web/assets/{AiChatModals-It9jnB26.js → AiChatModals-D3scRE3S.js} +1 -1
  38. package/web/assets/{AppLayout-BTg2CADo.js → AppLayout-BMQUjPKe.js} +1 -1
  39. package/web/assets/{AuditPage-2PKKGLZs.js → AuditPage-CKcExBws.js} +1 -1
  40. package/web/assets/{CloudAccountPage-CHL61gLe.js → CloudAccountPage-B6oPg0BZ.js} +1 -1
  41. package/web/assets/{CloudMessagingPage-cgKnABPH.js → CloudMessagingPage-C5fwVe-F.js} +1 -1
  42. package/web/assets/{DashboardPage-CRntTMKY.js → DashboardPage-9RV7sx3e.js} +1 -1
  43. package/web/assets/{DirectoryPickerDialog-DCyhT3-W.js → DirectoryPickerDialog-C06BXyfJ.js} +1 -1
  44. package/web/assets/{EnvironmentForm-C96PFWRE.js → EnvironmentForm-CAvDoira.js} +1 -1
  45. package/web/assets/{EnvironmentFormPage-ChorAd63.js → EnvironmentFormPage-BmAxhN-m.js} +1 -1
  46. package/web/assets/{EnvironmentListPage-Dw9ziaI8.js → EnvironmentListPage-B8uATPBI.js} +1 -1
  47. package/web/assets/{KanbanBoardPage-BZHbEj-q.js → KanbanBoardPage-CQsOkRUf.js} +3 -3
  48. package/web/assets/{KanbanListPage-B0jlfKqs.js → KanbanListPage-CWZqkjD6.js} +1 -1
  49. package/web/assets/{LaunchProjectPage-BVs1JwbV.js → LaunchProjectPage-saSmC7Pr.js} +1 -1
  50. package/web/assets/{LaunchServicesPage-PBYJly9N.js → LaunchServicesPage-BkKyLMEz.js} +1 -1
  51. package/web/assets/{LaunchShell-CGNYr-do.js → LaunchShell-DUrSunB4.js} +1 -1
  52. package/web/assets/{LogViewer-BDObx29F.js → LogViewer-CZBYkH9J.js} +1 -1
  53. package/web/assets/{OrgKeyPrompt-BbcwiwGw.js → OrgKeyPrompt-DzQ7pwbs.js} +1 -1
  54. package/web/assets/{ProcessControls-DY0HTKde.js → ProcessControls-BEeoNlNV.js} +1 -1
  55. package/web/assets/{ProcessDetailPage-BZ9kIQqn.js → ProcessDetailPage-CQgu5uKm.js} +1 -1
  56. package/web/assets/{ProjectCreateDialog-C1wVDPcK.js → ProjectCreateDialog-BolrhRD-.js} +1 -1
  57. package/web/assets/{ProjectLocationGate-bUd_tFpI.js → ProjectLocationGate-DhMVdIjN.js} +1 -1
  58. package/web/assets/{ProjectPublishDialog-APUS1WEN.js → ProjectPublishDialog-DsZNWrfz.js} +1 -1
  59. package/web/assets/{RandomJobTestPage-BFNC827R.js → RandomJobTestPage-BUS2Ty6-.js} +1 -1
  60. package/web/assets/{ScenarioEditorPage-DFVsMVu5.js → ScenarioEditorPage-MIAGh2us.js} +1 -1
  61. package/web/assets/{SendToChatDialog-QHIkxNio.js → SendToChatDialog-BxWsyv29.js} +1 -1
  62. package/web/assets/{ServiceControlsBar-_UQXb6g0.js → ServiceControlsBar-DqDPAZt7.js} +1 -1
  63. package/web/assets/{ServiceDetailPage-DGIXgHwR.js → ServiceDetailPage-hkSAzZ-l.js} +1 -1
  64. package/web/assets/{ServiceFormPage-RliAfS3_.js → ServiceFormPage-DXqhqXg8.js} +1 -1
  65. package/web/assets/SettingsPage-4pKUgKPm.css +1 -0
  66. package/web/assets/SettingsPage-DS2YhMIM.js +2086 -0
  67. package/web/assets/{UnlockPage-17EgfpJs.js → UnlockPage-s8SgVcKk.js} +1 -1
  68. package/web/assets/{VaultMigrationPage-DeMxpXXJ.js → VaultMigrationPage-s0b44MDM.js} +1 -1
  69. package/web/assets/{VersionBadge-DBquJl76.js → VersionBadge-BmArk24p.js} +1 -1
  70. package/web/assets/{WikiPage-GtwpJPqf.js → WikiPage-DADu8WUA.js} +1 -1
  71. package/web/assets/{WikiView-BqaqxMxW.js → WikiView-DtGwIt_Q.js} +1 -1
  72. package/web/assets/{add-scalar-classes-DhSSqZ5l.js → add-scalar-classes-dWEWPlFD.js} +1 -1
  73. package/web/assets/{agent.store-Co44dMZf.js → agent.store-CKLAkF9a.js} +1 -1
  74. package/web/assets/{auth-Bk1GP5sB.js → auth-Cg9BWTfK.js} +2 -2
  75. package/web/assets/{cloud-chat.store-CadB14dZ.js → cloud-chat.store-b-BHGz7I.js} +1 -1
  76. package/web/assets/{cloud-client-0zD_NI6q.js → cloud-client-D_zCiW0s.js} +2 -2
  77. package/web/assets/{cloud-session-Cjw54Y--.js → cloud-session-DOaDpZTy.js} +2 -2
  78. package/web/assets/{editor.store-DmM6ZlTm.js → editor.store-DCAZSeVG.js} +1 -1
  79. package/web/assets/i18n-D0afQEGs.js +1 -0
  80. package/web/assets/{index-B9DJf2V0.js → index-D8VRbyoP.js} +36 -36
  81. package/web/assets/index-DsezNbSM.css +1 -0
  82. package/web/assets/{modal-UK8xRSnh.js → modal-qYgTMkYb.js} +1 -1
  83. package/web/assets/{project-launch.store-B5nhdGdh.js → project-launch.store-y7JBMNiE.js} +1 -1
  84. package/web/assets/{project.store-Bm2JWNbd.js → project.store-DGJr0Qr9.js} +1 -1
  85. package/web/assets/{scenario.store-88w6P6s2.js → scenario.store-YWHL2_wu.js} +3 -3
  86. package/web/assets/{service.store-XS50iGKo.js → service.store-5jWsJxPx.js} +1 -1
  87. package/web/assets/{settings-scope-CKPq86HZ.js → settings-scope-Bv7QGPrt.js} +1 -1
  88. package/web/assets/{settings.store-BCJ0LJQA.js → settings.store-bEsB7oKb.js} +1 -1
  89. package/web/assets/{src-DBipSD56.js → src-C-D_y7ou.js} +1 -1
  90. package/web/assets/{src-Cgix2VOi.js → src-Dnwk6NpV.js} +2 -2
  91. package/web/assets/{src-BDZKZr9n.css → src-g1DRo8xZ.css} +1 -1
  92. package/web/assets/{trpc-CfuFkKgp.js → trpc-Drabzwpd.js} +3 -3
  93. package/web/assets/{useCloudOrg-J8DAnocE.js → useCloudOrg-BAQEtFPl.js} +1 -1
  94. package/web/assets/{useEnvVarAutocomplete-C6zOXYqi.js → useEnvVarAutocomplete-BqGTODUv.js} +1 -1
  95. package/web/assets/{useProjectCatalog-BB5IR6o8.js → useProjectCatalog-yocjIKt6.js} +1 -1
  96. package/web/assets/{useProjectCloudOrg-BnlKts7x.js → useProjectCloudOrg-CEN9-_OA.js} +1 -1
  97. package/web/assets/{useServiceUrlHost-hKbKtPMu.js → useServiceUrlHost-BuoPEXZX.js} +1 -1
  98. package/web/assets/{vue-draggable-plus-D5ni4jMk.js → vue-draggable-plus-DX4rTBiu.js} +1 -1
  99. package/web/index.html +17 -17
  100. package/agent-manager-THV3LJOF.js +0 -11
  101. package/chunk-ONVAH65J.js.map +0 -1
  102. package/settings-manager-QVQRJO6V.js +0 -10
  103. package/src-IODFUZ7A.js.map +0 -1
  104. package/web/assets/SettingsPage-BSSHxxjM.js +0 -2086
  105. package/web/assets/SettingsPage-W8YszhUL.css +0 -1
  106. package/web/assets/i18n-8FjeJaKW.js +0 -1
  107. package/web/assets/index-teBqdnuv.css +0 -1
  108. /package/{agent-manager-THV3LJOF.js.map → agent-manager-R7BPQO6D.js.map} +0 -0
  109. /package/{chat-XYCHMTFE.js.map → chat-LPML22J5.js.map} +0 -0
  110. /package/{chunk-NCO4OOYT.js.map → chunk-4LJQIQMN.js.map} +0 -0
  111. /package/{chunk-QF56Z6LI.js.map → chunk-KV4GJKXU.js.map} +0 -0
  112. /package/{chunk-FE53XX4M.js.map → chunk-NPMSBYXC.js.map} +0 -0
  113. /package/{companion-HBYSY2D5.js.map → companion-W3UMZWGH.js.map} +0 -0
  114. /package/{install-gate-JAEK4BDZ.js.map → install-gate-PVMGJDWE.js.map} +0 -0
  115. /package/{settings-manager-QVQRJO6V.js.map → settings-manager-XPLBO35P.js.map} +0 -0
  116. /package/{vault-resolver-PN3TYCLJ.js.map → vault-resolver-E7KPKA5C.js.map} +0 -0
@@ -0,0 +1,1063 @@
1
+ import {
2
+ BUILTIN_VARIABLES,
3
+ BootstrapCommandSchema,
4
+ DockerConfigSchema,
5
+ HealthCheckSchema,
6
+ RestartStrategySchema,
7
+ ServiceCommandSchema,
8
+ ServiceConfigSchema,
9
+ ServiceShortcutSchema,
10
+ maskLogSourceSecrets
11
+ } from "./chunk-MZSDTA4A.js";
12
+
13
+ // ../../packages/ai-capabilities/src/trpc-caller.ts
14
+ async function callTrpc(baseUrl, route, method, input, authToken, fetchImpl = fetch) {
15
+ const headers = {
16
+ "Content-Type": "application/json",
17
+ "Authorization": `Bearer ${authToken}`
18
+ };
19
+ const url = method === "GET" && input ? `${baseUrl}/api/trpc/${route}?input=${encodeURIComponent(JSON.stringify(input))}` : `${baseUrl}/api/trpc/${route}`;
20
+ const res = await fetchImpl(url, {
21
+ method,
22
+ headers,
23
+ ...method === "POST" ? { body: JSON.stringify(input ?? {}) } : {},
24
+ signal: AbortSignal.timeout(15e3)
25
+ });
26
+ const json = await res.json();
27
+ if (json["error"]) throw new Error(JSON.stringify(json["error"]));
28
+ const result = json["result"];
29
+ return result?.["data"] ?? result ?? json;
30
+ }
31
+ async function runCapability(cap, baseUrl, params, authToken, fetchImpl = fetch) {
32
+ const result = await callTrpc(baseUrl, cap.route, cap.method, cap.buildInput(params), authToken, fetchImpl);
33
+ return cap.transformOutput ? cap.transformOutput(result) : result;
34
+ }
35
+
36
+ // ../../packages/ai-capabilities/src/capabilities.ts
37
+ import { z } from "zod";
38
+ function toList(raw) {
39
+ if (!raw) return [];
40
+ const text = raw.trim();
41
+ if (text.startsWith("[")) {
42
+ try {
43
+ const parsed = JSON.parse(text);
44
+ if (Array.isArray(parsed)) return parsed.map((v) => String(v).trim()).filter(Boolean);
45
+ } catch {
46
+ }
47
+ }
48
+ return text.split(",").map((v) => v.trim().replace(/^["'[]+|["'\]]+$/g, "")).filter(Boolean);
49
+ }
50
+ function clearable(raw, parse, key) {
51
+ if (raw === void 0) return {};
52
+ const text = String(raw).trim();
53
+ if (!text || text === "null") return { [key]: null };
54
+ return { [key]: parse(text) };
55
+ }
56
+ function gitTarget(p) {
57
+ return {
58
+ ...p.serviceId ? { serviceId: p.serviceId } : {},
59
+ ...p.projectId ? { projectId: p.projectId } : {},
60
+ ...p.agentId ? { agentId: p.agentId } : {},
61
+ ...p.orgId ? { orgId: p.orgId } : {}
62
+ };
63
+ }
64
+ var toBool = (raw) => raw.trim().toLowerCase() === "true";
65
+ var newId = () => globalThis.crypto.randomUUID();
66
+ function listItem(raw) {
67
+ try {
68
+ return JSON.parse(raw);
69
+ } catch {
70
+ return raw;
71
+ }
72
+ }
73
+ function parseTyped(name, schema, raw) {
74
+ if (raw === void 0) return void 0;
75
+ let result = raw.trim() === "null" ? schema.safeParse(null) : schema.safeParse(raw);
76
+ if (!result.success && raw.trim() === "null") result = schema.safeParse(raw);
77
+ if (!result.success) {
78
+ const text = raw.trim();
79
+ const json = listItem(text);
80
+ if (json !== text) result = schema.safeParse(json);
81
+ if (!result.success && !/^[[{]/.test(text)) {
82
+ const list = schema.safeParse(toList(text).map(listItem));
83
+ if (list.success) result = list;
84
+ }
85
+ }
86
+ if (!result.success) throw new Error(`${name}: ${z.prettifyError(result.error)}`);
87
+ return result.data;
88
+ }
89
+ function withIds(items) {
90
+ return items.map((item) => ({ ...item, id: item.id || newId() }));
91
+ }
92
+ var optionalId = (schema) => schema.extend({ id: z.string().min(1).max(64).optional() });
93
+ var DockerConfigInput = DockerConfigSchema.extend({
94
+ bootstrapCommands: z.array(optionalId(BootstrapCommandSchema)).max(20).default([])
95
+ }).refine((c) => !!c.image !== !!c.dockerfile, {
96
+ message: 'dockerConfig needs exactly one of "image" (an image to pull) or "dockerfile" (a Dockerfile to build)'
97
+ });
98
+ var SERVICE_FIELDS = [
99
+ { name: "description", description: "What the service is, in a sentence" },
100
+ { name: "agentId", description: "The agent that runs it, from list_agents. Omit to inherit from the environment.", clearable: true },
101
+ { name: "cwd", description: `Working directory, RELATIVE to the project root (e.g. "apps/web", or omit for the root). The project is synced between machines and lives in a different folder on each: Runeya resolves a relative cwd against each machine's own project folder, while an absolute path (/home/you/\u2026) breaks on every other machine. Use an absolute path only for something outside the project, written with ~ or an environment variable ($NAME) rather than a literal home directory.`, clearable: true },
102
+ { name: "command", description: 'Shortcut for a single command line (e.g. "npm run dev"). Replaces every existing command. Use commands for several.' },
103
+ { name: "commands", description: 'The processes of the service. They all start AT THE SAME TIME, in parallel, and the service runs while they run \u2014 not one after another. Use several for processes that live side by side (a web server and a worker). Steps that must follow each other (build, then install, then launch) go in ONE command chained with &&. A one-off action the user triggers by hand (build, deploy, read logs) is a shortcut, not a command. Each command runs in the service cwd, or its own "cwd", relative to the project root. No absolute paths of this machine: the service is synced to other machines. Replaces every existing command. "id" is generated when omitted; "shell" runs the line through a shell (default true).', schema: z.array(optionalId(ServiceCommandSchema)).max(50) },
104
+ { name: "ports", description: "Ports the service listens on. Declare them: they become {{service.PORT}}, {{service.URL}} and {{services.<slug>.URL}} for the other services, which environment variables should reference instead of repeating the numbers.", schema: ServiceConfigSchema.shape.ports.unwrap().unwrap() },
105
+ { name: "groups", description: "Groups the service belongs to. Replaces the current ones.", schema: ServiceConfigSchema.shape.groups.unwrap().unwrap() },
106
+ { name: "url", description: "URL where the service is reached" },
107
+ { name: "localUrls", description: 'Local domain names routed to a port of the service (e.g. {"url":"api.localhost.dev","port":3000})', schema: ServiceConfigSchema.shape.localUrls.unwrap().unwrap() },
108
+ { name: "openapiUrl", description: "URL of its OpenAPI document" },
109
+ { name: "docsPath", description: "Where its markdown docs live, relative to cwd or absolute. Defaults to cwd." },
110
+ { name: "git", description: 'Its git repository: "remote" URL and "home" page', schema: ServiceConfigSchema.shape.git.unwrap(), clearable: true },
111
+ { name: "meta", description: "Free key/value metadata (strings)", schema: ServiceConfigSchema.shape.meta.unwrap(), clearable: true },
112
+ { name: "runner", description: '"native" runs the commands on the machine; "docker" runs the service in a container and then needs dockerConfig', schema: ServiceConfigSchema.shape.runner.unwrap().unwrap() },
113
+ { name: "dockerConfig", description: 'With runner "docker": the container. Exactly one of "image" (pull) or "dockerfile" (inline Dockerfile, built with "buildContext", "buildArgs", "targetStage"). Ports and volumes use Docker syntax ("8080:80", "./data:/data"); host paths in volumes relative to the service directory, never an absolute path of this machine. "useNativeCommand" runs the service commands inside the container instead of its CMD ("nativeCommandMode": one shared container or one per command). "bootstrapCommands" run once when the container starts. Replaces the whole Docker configuration: read it first with get_service to keep what you do not change.', schema: DockerConfigInput },
114
+ { name: "healthCheck", description: 'How to tell the service is ready: an HTTP "path" to call, or a "command" that must succeed', schema: HealthCheckSchema, clearable: true },
115
+ { name: "autoRestart", description: "Restart the service when it crashes", schema: z.boolean() },
116
+ { name: "restartStrategy", description: "When to restart it", schema: RestartStrategySchema.unwrap() },
117
+ { name: "maxRestarts", description: "Give up after this many restarts", schema: ServiceConfigSchema.shape.maxRestarts.unwrap() },
118
+ { name: "restartBackoffMs", description: "Delay before a restart, in milliseconds", schema: ServiceConfigSchema.shape.restartBackoffMs.unwrap().unwrap() },
119
+ { name: "clearLogsOnStart", description: "Clear the logs each time the service starts", schema: z.boolean() },
120
+ { name: "shortcuts", description: 'One-click actions shown on the service, run on demand and independently of the running commands (build, deploy, migrate, read logs). Same path rules as commands: relative to the project root, never an absolute path of this machine. Replaces the current ones. "id" is generated when omitted.', schema: z.array(optionalId(ServiceShortcutSchema)).max(50) },
121
+ { name: "parserIds", description: "Log parsers applied to its output, by id", schema: ServiceConfigSchema.shape.parserIds.unwrap() },
122
+ { name: "logSources", description: 'Extra log sources beyond the console output (files, databases\u2026). Replaces the current ones. Credentials (mongo connectionString, mysql password) read as "***": send "***" back to keep the stored value, or the real value to change it.', schema: ServiceConfigSchema.shape.logSources.unwrap().unwrap() }
123
+ ];
124
+ function serviceParams(clearable2) {
125
+ return SERVICE_FIELDS.map((f) => {
126
+ const nullable = clearable2 && f.clearable;
127
+ const base = f.schema ?? (nullable ? z.string() : void 0);
128
+ return {
129
+ name: f.name,
130
+ description: nullable ? `${f.description} null clears it.` : f.description,
131
+ required: false,
132
+ ...base ? { schema: nullable ? base.nullable() : base } : {}
133
+ };
134
+ });
135
+ }
136
+ function serviceFields(p, params) {
137
+ const out = {};
138
+ for (const param of params) {
139
+ if (p[param.name] === void 0 || param.name === "command") continue;
140
+ out[param.name] = param.schema ? parseTyped(param.name, param.schema, p[param.name]) : p[param.name];
141
+ }
142
+ if (p.command !== void 0 && p.commands === void 0) out["commands"] = [{ label: "", command: p.command, shell: true }];
143
+ if (Array.isArray(out["commands"])) out["commands"] = withIds(out["commands"]);
144
+ if (Array.isArray(out["shortcuts"])) out["shortcuts"] = withIds(out["shortcuts"]);
145
+ const docker = out["dockerConfig"];
146
+ if (docker?.bootstrapCommands) out["dockerConfig"] = { ...docker, bootstrapCommands: withIds(docker.bootstrapCommands) };
147
+ return out;
148
+ }
149
+ function maskServices(result) {
150
+ if (Array.isArray(result)) return result.map(maskServices);
151
+ if (result && typeof result === "object" && Array.isArray(result.logSources)) {
152
+ const service = result;
153
+ return { ...service, logSources: maskLogSourceSecrets(service.logSources) };
154
+ }
155
+ return result;
156
+ }
157
+ var refs = (scope) => BUILTIN_VARIABLES.filter((b) => b.scope === scope).map((b) => `{{${b.name}}}`).join(", ");
158
+ 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")}.`;
159
+ var CREATE_SERVICE_PARAMS = serviceParams(false);
160
+ var UPDATE_SERVICE_PARAMS = serviceParams(true);
161
+ var RUNEYA_CAPABILITIES = [
162
+ {
163
+ name: "list_services",
164
+ transformOutput: maskServices,
165
+ description: "List services, with the serviceId and agentId to use in other calls. Pass the projectId your context names to stay on the project the user is looking at, or another one from list_projects to look elsewhere. Called with no project, this can answer for every project of every organization on the machine \u2014 far more than the interface shows.",
166
+ route: "service.list",
167
+ method: "GET",
168
+ params: [
169
+ { name: "projectId", description: "Restrict to this project, from list_projects. Omit to list every service on the machine.", required: false },
170
+ { name: "orgId", description: "With projectId: its organization, needed only when the same project id exists in several. Alone: list the services of this whole organization.", required: false }
171
+ ],
172
+ // `orgId` seul est une portée à part entière, que `service.list` sait filtrer :
173
+ // l'omettre rendait toute la machine.
174
+ buildInput: (p) => {
175
+ if (p.projectId) return { projectId: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} };
176
+ return p.orgId ? { orgId: p.orgId } : void 0;
177
+ }
178
+ },
179
+ {
180
+ name: "get_service_status",
181
+ description: "Get the current status (running, stopped, etc.) of a service. A service that has never been started on this agent has no process yet, and this answers 404 Process not found \u2014 that means STOPPED, not forbidden and not missing. Start it, or read its configuration with get_service.",
182
+ route: "process.get",
183
+ method: "GET",
184
+ params: [
185
+ { name: "serviceId", description: "The service ID", required: true },
186
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
187
+ ],
188
+ buildInput: (p) => ({ agentId: p.agentId, id: p.serviceId })
189
+ },
190
+ {
191
+ name: "get_logs",
192
+ description: "Get the recent buffered logs for a service.",
193
+ route: "process.logs",
194
+ method: "GET",
195
+ params: [
196
+ { name: "serviceId", description: "The service ID", required: true },
197
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
198
+ ],
199
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId })
200
+ },
201
+ {
202
+ name: "start_service",
203
+ description: "Start a service on an agent.",
204
+ route: "process.start",
205
+ method: "POST",
206
+ params: [
207
+ { name: "serviceId", description: "The service ID to start", required: true },
208
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
209
+ ],
210
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
211
+ destructive: true
212
+ },
213
+ {
214
+ name: "stop_service",
215
+ description: "Stop a running service on an agent.",
216
+ route: "process.stop",
217
+ method: "POST",
218
+ params: [
219
+ { name: "serviceId", description: "The service ID to stop", required: true },
220
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
221
+ ],
222
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
223
+ destructive: true
224
+ },
225
+ {
226
+ name: "restart_service",
227
+ description: "Restart a service on an agent (stop \u2192 redeploy \u2192 start).",
228
+ route: "process.restart",
229
+ method: "POST",
230
+ params: [
231
+ { name: "serviceId", description: "The service ID to restart", required: true },
232
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
233
+ ],
234
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
235
+ destructive: true
236
+ },
237
+ // ─── Utility ─────────────────────────────────────────────────────────────
238
+ {
239
+ name: "wait",
240
+ description: "Wait for a given number of milliseconds before continuing.",
241
+ route: "utility.wait",
242
+ method: "POST",
243
+ params: [
244
+ { name: "ms", description: "Number of MILLISECONDS to wait. Convert from seconds: 1s=1000, 10s=10000, 1min=60000. Max 300000.", required: true }
245
+ ],
246
+ buildInput: (p) => ({ ms: Number(p.ms) }),
247
+ usageHint: '"wait 5s" \u2192 wait(ms=5000), "pause 10 seconds" \u2192 wait(ms=10000), "attends 3 secondes" \u2192 wait(ms=3000). Always convert to milliseconds.'
248
+ },
249
+ // ─── Kanban ───────────────────────────────────────────────────────────────
250
+ {
251
+ name: "kanban_list_boards",
252
+ description: "List the kanban boards of the organization. Returns the organizationId actually queried, the boardId to use in the other kanban tools, plus column and card counts. Cards themselves are not included \u2014 use kanban_get_board for those. An empty list means that organization really has no board: a failure to reach the cloud is reported as an error instead, never as an empty list.",
253
+ route: "kanban.listBoards",
254
+ method: "GET",
255
+ params: [
256
+ { name: "includeArchived", description: 'Set to "true" to include archived boards. Default: false.', required: false },
257
+ { name: "organizationId", description: "Which organization to read. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
258
+ ],
259
+ buildInput: (p) => ({
260
+ includeArchived: p.includeArchived === "true",
261
+ ...p.organizationId ? { organizationId: p.organizationId } : {}
262
+ })
263
+ },
264
+ {
265
+ name: "kanban_get_board",
266
+ description: "Read one kanban board: its columns, and the cards in each (id, title, markdown body, assignees, comment count, and attachment metadata \u2014 use kanban_download_attachment to fetch the bytes of a file). Use the exact column names it returns when moving or adding a card.",
267
+ route: "kanban.getBoard",
268
+ method: "GET",
269
+ params: [
270
+ { name: "boardId", description: "The kanban board ID, from kanban_list_boards", required: true }
271
+ ],
272
+ buildInput: (p) => ({ boardId: p.boardId })
273
+ },
274
+ {
275
+ name: "kanban_get_card_comments",
276
+ description: "Read the comment thread of one kanban card, newest last: who wrote each comment (ai or user, with the person's name), when, its text, and its attachments. The comments in your task context are a snapshot taken when the task started \u2014 call this to see anything written since, whenever someone tells you a comment was added or kanban_get_board reports a higher commentCount than you have.",
277
+ route: "kanban.getCardComments",
278
+ method: "GET",
279
+ params: [
280
+ { name: "boardId", description: "The kanban board ID", required: true },
281
+ { name: "cardId", description: "The card ID whose comments to read", required: true },
282
+ { name: "limit", description: "How many of the most recent comments to return (1-200). Default: 50.", required: false }
283
+ ],
284
+ buildInput: (p) => ({
285
+ boardId: p.boardId,
286
+ cardId: p.cardId,
287
+ ...p.limit ? { limit: Number(p.limit) } : {}
288
+ }),
289
+ usageHint: '"le support a ajout\xE9 un commentaire" / "regarde les nouveaux commentaires" \u2192 kanban_get_card_comments(boardId, cardId). Never answer from the snapshot in your context when fresh comments are mentioned.'
290
+ },
291
+ {
292
+ name: "kanban_search_cards",
293
+ description: 'Search kanban cards by free text, matched against their title, body, comments and the support conversations they follow (title, messages, internal notes, and the names of message authors) \u2014 accent- and case-insensitive. Archived cards are included. Searches every board of the organization unless boardId narrows it down. createdBy narrows to the cards someone created ("les cartes cr\xE9\xE9es par Isabelle"), alone or with a query.',
294
+ route: "kanban.searchCards",
295
+ method: "GET",
296
+ params: [
297
+ { name: "query", description: "Text to look for in card titles, bodies, comments and followed conversations. Optional when createdBy is given.", required: false },
298
+ { name: "createdBy", description: "Only cards created by this author: a user id, or a name (accent- and case-insensitive, partial match).", required: false },
299
+ { name: "boardId", description: "Restrict the search to this board. Omit to search all boards.", required: false },
300
+ { name: "limit", description: "Maximum number of cards to return (1-100). Default: 25.", required: false },
301
+ { name: "organizationId", description: "Which organization to search. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
302
+ ],
303
+ buildInput: (p) => ({
304
+ ...p.query ? { query: p.query } : {},
305
+ ...p.createdBy ? { createdBy: p.createdBy } : {},
306
+ ...p.boardId ? { boardId: p.boardId } : {},
307
+ ...p.limit ? { limit: Number(p.limit) } : {},
308
+ ...p.organizationId ? { organizationId: p.organizationId } : {}
309
+ })
310
+ },
311
+ {
312
+ name: "kanban_download_attachment",
313
+ description: "Download a kanban card attachment (image, PDF, any file) onto this machine and return its local path, so it can be opened with file-reading tools. Attachment ids come from the card context, from kanban_get_board, or from kanban_get_card_comments \u2014 a file attached to a comment downloads exactly like one attached to the card.",
314
+ route: "kanban.downloadAttachment",
315
+ method: "POST",
316
+ params: [
317
+ { name: "attachmentId", description: "The attachment ID, as listed on the card", required: true },
318
+ { name: "boardId", description: "The board the attachment comes from. Pass it whenever you know it: on a machine linked to several cloud accounts, it is what says which one holds the file.", required: false },
319
+ { name: "organizationId", description: "Which organization the attachment belongs to. Optional: needed only when neither the board id is known nor the machine has a single account.", required: false }
320
+ ],
321
+ buildInput: (p) => ({
322
+ attachmentId: p.attachmentId,
323
+ ...p.boardId ? { boardId: p.boardId } : {},
324
+ ...p.organizationId ? { orgId: p.organizationId } : {}
325
+ })
326
+ },
327
+ {
328
+ name: "kanban_move_card",
329
+ description: "Move a kanban card to another column. Use the exact column name.",
330
+ route: "kanban.moveCard",
331
+ method: "POST",
332
+ params: [
333
+ { name: "boardId", description: "The kanban board ID", required: true },
334
+ { name: "cardId", description: "The card ID to move", required: true },
335
+ { name: "targetColumn", description: "Exact name of the target column", required: true }
336
+ ],
337
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, targetColumn: p.targetColumn })
338
+ },
339
+ {
340
+ name: "kanban_add_comment",
341
+ description: "Add a comment to a kanban card.",
342
+ route: "kanban.addComment",
343
+ method: "POST",
344
+ params: [
345
+ { name: "boardId", description: "The kanban board ID", required: true },
346
+ { name: "cardId", description: "The card ID", required: true },
347
+ { name: "comment", description: "The comment text (markdown supported)", required: true }
348
+ ],
349
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, comment: p.comment })
350
+ },
351
+ {
352
+ name: "kanban_get_card_conversations",
353
+ description: "Read the customer support conversations (Intercom\u2026) linked to one kanban card: for each, its title, provider, state (open/resolved), link, the opening message and the thread of messages (author name, customer or team, internal note or not, date, text, attached files \u2014 fetch their bytes with kanban_download_attachment), plus the other cards following the same conversation. These messages are NOT comments of the card \u2014 read them here.",
354
+ route: "kanban.getCardConversations",
355
+ method: "GET",
356
+ params: [
357
+ { name: "boardId", description: "The kanban board ID", required: true },
358
+ { name: "cardId", description: "The card ID whose conversations to read", required: true },
359
+ { name: "limit", description: "How many of the most recent messages to return per conversation (1-500). Default: 100.", required: false }
360
+ ],
361
+ buildInput: (p) => ({
362
+ boardId: p.boardId,
363
+ cardId: p.cardId,
364
+ ...p.limit ? { limit: Number(p.limit) } : {}
365
+ }),
366
+ usageHint: `"regarde la conversation Intercom de la carte" / "qu'a dit le client" \u2192 kanban_get_card_conversations(boardId, cardId).`
367
+ },
368
+ {
369
+ name: "kanban_search_conversations",
370
+ description: "Search customer support conversations (Intercom\u2026) at the providers connected to the board's organization, by words of the conversation title, or by conversation number or URL. Read-only at the provider. Each result gives connectionId and externalId (needed to link it), title, state, a preview and the cards already following it.",
371
+ route: "kanban.searchConversations",
372
+ method: "GET",
373
+ params: [
374
+ { name: "boardId", description: "Any kanban board ID of the organization to search in", required: true },
375
+ { name: "query", description: "Words of the conversation title, a conversation number, or a conversation URL", required: true }
376
+ ],
377
+ buildInput: (p) => ({ boardId: p.boardId, query: p.query })
378
+ },
379
+ {
380
+ name: "kanban_link_conversation",
381
+ description: "Link a customer support conversation found with kanban_search_conversations to a kanban card. Its whole thread is imported and new messages keep arriving on the card. A conversation can be linked to several cards. Nothing is written at the provider.",
382
+ route: "kanban.linkConversation",
383
+ method: "POST",
384
+ params: [
385
+ { name: "boardId", description: "The kanban board ID of the card", required: true },
386
+ { name: "cardId", description: "The card to link the conversation to", required: true },
387
+ { name: "connectionId", description: "The connectionId of the search result", required: true },
388
+ { name: "externalId", description: "The externalId of the search result", required: true }
389
+ ],
390
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, connectionId: p.connectionId, externalId: p.externalId })
391
+ },
392
+ {
393
+ name: "kanban_get_card_links",
394
+ description: "Read the filiation of a board: which card depends on which. Returns one entry per link (child card \u2194 parent card), plus the title, board, column, assignees and comment count of any linked card living on another board. Use it when a card context says it has a parent or sub-cards and you need their ids to read them.",
395
+ route: "kanban.getCardLinks",
396
+ method: "GET",
397
+ params: [
398
+ { name: "boardId", description: "The kanban board ID whose links to read", required: true }
399
+ ],
400
+ buildInput: (p) => ({ boardId: p.boardId })
401
+ },
402
+ {
403
+ name: "kanban_set_card_parent",
404
+ description: "Link a kanban card to a parent card, or detach it. The parent is the card the other one depends on \u2014 an epic and its tasks, a bug and its follow-ups. A card has at most one parent, and setting a new one replaces it. Omit parentCardId to detach. kanban_get_board reports the current filiation as parentCardId / childCardIds on each card.",
405
+ route: "kanban.setCardParent",
406
+ method: "POST",
407
+ params: [
408
+ { name: "boardId", description: "The kanban board ID of the card being linked", required: true },
409
+ { name: "cardId", description: "The card that depends on the parent (the child)", required: true },
410
+ { name: "parentCardId", description: "The parent card ID. Omit to detach the card from its parent.", required: false },
411
+ { name: "parentBoardId", description: "The parent's board, when it lives on another board of the same organization. Defaults to boardId.", required: false }
412
+ ],
413
+ buildInput: (p) => ({
414
+ boardId: p.boardId,
415
+ cardId: p.cardId,
416
+ ...p.parentCardId ? { parentCardId: p.parentCardId } : {},
417
+ ...p.parentBoardId ? { parentBoardId: p.parentBoardId } : {}
418
+ })
419
+ },
420
+ {
421
+ name: "kanban_place_card",
422
+ description: "Place an existing kanban card on another board of the same organization, without copying it \u2014 a reference. The card stays on its origin board; the target board gives it a column of its own. Editing, commenting, archiving or deleting the card from either board acts on the same card; moving it on the target board only moves the reference. Use it to show an issue from an issue list on a team kanban, for instance.",
423
+ route: "kanban.placeCard",
424
+ method: "POST",
425
+ params: [
426
+ { name: "boardId", description: "The board to place the card on (not its own board)", required: true },
427
+ { name: "cardId", description: "The card to place", required: true },
428
+ { name: "column", description: "The column on that board: its ID or its title", required: true }
429
+ ],
430
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, column: p.column })
431
+ },
432
+ {
433
+ name: "kanban_remove_card_placement",
434
+ description: "Remove a card from a board where it was placed as a reference. The card itself is untouched and stays on its origin board.",
435
+ route: "kanban.unplaceCard",
436
+ method: "POST",
437
+ params: [
438
+ { name: "boardId", description: "The board the reference is on", required: true },
439
+ { name: "cardId", description: "The card to remove from that board", required: true }
440
+ ],
441
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId })
442
+ },
443
+ {
444
+ name: "kanban_get_card_placements",
445
+ description: "List where a kanban card is: its origin board (home: true), then every board it is placed on as a reference, with the column on each. kanban_get_board flags a referenced card with an `origin` field naming its origin board.",
446
+ route: "kanban.getCardPlacements",
447
+ method: "GET",
448
+ params: [
449
+ { name: "boardId", description: "Any board the card is on", required: true },
450
+ { name: "cardId", description: "The card", required: true }
451
+ ],
452
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId })
453
+ },
454
+ {
455
+ name: "kanban_add_card",
456
+ description: "Add a new card to a kanban column.",
457
+ route: "kanban.addCard",
458
+ method: "POST",
459
+ params: [
460
+ { name: "boardId", description: "The kanban board ID", required: true },
461
+ { name: "column", description: "Exact name of the target column", required: true },
462
+ { name: "title", description: "Card title", required: true },
463
+ { name: "content", description: "Card content in markdown", required: false }
464
+ ],
465
+ buildInput: (p) => ({ boardId: p.boardId, column: p.column, title: p.title, content: p.content })
466
+ },
467
+ {
468
+ name: "kanban_get_card",
469
+ description: "Read one kanban card by id, including archived ones. Cheaper than fetching the whole board, and the only way to read a card that has been archived.",
470
+ route: "kanban.getCard",
471
+ method: "GET",
472
+ params: [
473
+ { name: "boardId", description: "The kanban board ID", required: true },
474
+ { name: "cardId", description: "The card ID", required: true }
475
+ ],
476
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId })
477
+ },
478
+ {
479
+ name: "kanban_get_card_context",
480
+ description: "Load the working context of a kanban card: the card, the board's columns, the team's guidelines for the board and the expected ending (move the card if needed, then comment). Call it first when the user asks you to work on a card, then follow it. It is the context a session started from the card in Runeya receives.",
481
+ route: "kanban.cardContext",
482
+ method: "GET",
483
+ params: [
484
+ { name: "boardId", description: "The kanban board ID", required: true },
485
+ { name: "cardId", description: "The card ID", required: true },
486
+ { name: "projectId", description: "The project the work happens in, named in the context. Optional.", required: false },
487
+ { name: "orgId", description: "Its organization. Optional.", required: false }
488
+ ],
489
+ buildInput: (p) => ({
490
+ boardId: p.boardId,
491
+ cardId: p.cardId,
492
+ ...p.projectId ? { projectId: p.projectId } : {},
493
+ ...p.orgId ? { orgId: p.orgId } : {}
494
+ })
495
+ },
496
+ {
497
+ name: "kanban_update_card",
498
+ description: "Update an existing kanban card. Only the fields you pass are changed; passing null to priority, color or deadline clears it. Prefer this over creating a second card when something needs correcting.",
499
+ route: "kanban.updateCard",
500
+ method: "POST",
501
+ params: [
502
+ { name: "boardId", description: "The kanban board ID", required: true },
503
+ { name: "cardId", description: "The card ID", required: true },
504
+ { name: "title", description: "New title", required: false },
505
+ { name: "content", description: "New card content, in markdown", required: false },
506
+ { name: "priority", description: "Priority from 1 to 10, or null to clear it", required: false },
507
+ { name: "color", description: "Card colour, or null to clear it", required: false },
508
+ { name: "groups", description: "Labels, as a list of strings. Replaces the current ones.", required: false },
509
+ { name: "deadline", description: "Due date as YYYY-MM-DD, or null to clear it", required: false },
510
+ { name: "assignees", description: "User ids to assign, as a list. Replaces the current ones; use kanban_list_members to find the ids.", required: false }
511
+ ],
512
+ buildInput: (p) => ({
513
+ boardId: p.boardId,
514
+ cardId: p.cardId,
515
+ ...p.title !== void 0 ? { title: p.title } : {},
516
+ ...p.content !== void 0 ? { content: p.content } : {},
517
+ // Tout arrive en chaîne : un modèle n'écrit pas des nombres, des listes
518
+ // ni des `null` typés. `clearable` distingue « efface » de « ne touche
519
+ // pas » — sans quoi vider une couleur serait impossible à exprimer, et
520
+ // changer un titre risquerait de vider le reste.
521
+ ...clearable(p.priority, (v) => Number(v), "priority"),
522
+ ...clearable(p.color, (v) => v, "color"),
523
+ ...clearable(p.deadline, (v) => v, "deadline"),
524
+ ...p.groups !== void 0 ? { groups: toList(p.groups) } : {},
525
+ ...p.assignees !== void 0 ? { assignees: toList(p.assignees) } : {}
526
+ })
527
+ },
528
+ {
529
+ name: "kanban_set_card_archived",
530
+ description: "Archive a kanban card (it leaves the board but is not deleted) or bring it back. An unarchived card returns to the column it left.",
531
+ route: "kanban.setCardArchived",
532
+ method: "POST",
533
+ params: [
534
+ { name: "boardId", description: "The kanban board ID", required: true },
535
+ { name: "cardId", description: "The card ID", required: true },
536
+ { name: "archived", description: "true to archive, false to bring the card back", required: true }
537
+ ],
538
+ buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, archived: p.archived === "true" })
539
+ },
540
+ {
541
+ name: "kanban_list_members",
542
+ description: "List the people of the organization who can be assigned to a card, with their ids. Needed before assigning anyone with kanban_update_card.",
543
+ route: "kanban.listMembers",
544
+ method: "GET",
545
+ params: [
546
+ { name: "organizationId", description: "Which organization. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
547
+ ],
548
+ buildInput: (p) => p.organizationId ? { organizationId: p.organizationId } : {}
549
+ },
550
+ // ─── Lecture seule ───────────────────────────────────────────────────────
551
+ //
552
+ // Tout ce qui se consulte sans rien changer. Les écritures s'ajoutent au cas
553
+ // par cas : aujourd'hui les services et leurs variables, plus bas.
554
+ //
555
+ // Volontairement absentes, et à ne pas ajouter sans y regarder à deux fois,
556
+ // parce qu'elles rendent un secret : `environment.list` / `get` / `resolve` /
557
+ // `resolveFlat` (un `Environment` porte ses variables, valeurs comprises),
558
+ // `apiKeys.list` / `reveal`, `setup.getEncryptionKeyHex` et `getOrgKeys`
559
+ // (clés de chiffrement), `settings.get` et `settings.listAIProviders` (clés
560
+ // de fournisseurs d'IA — `settings.getPaths` et `getNetwork`, eux, ne
561
+ // rendent que des chemins et une adresse, d'où leur présence ci-dessous),
562
+ // `cloudAuth.session`, `agent.getPassthroughEnv`. Un agent n'a pas besoin de
563
+ // ces valeurs pour travailler, et ce qu'il lit finit dans une transcription.
564
+ //
565
+ // La seule exception est `service.getEnv` (`get_service_env` ci-dessous),
566
+ // et elle n'en est une que parce qu'elle filtre : les variables publiques, et
567
+ // les seuls secrets que leur auteur a partagés avec les IA (`isSharedWithAi`
568
+ // — « Lisible par l'IA », ou l'injection, qui vaut la lecture). Un secret non
569
+ // partagé n'y apparaît pas, pas même par son nom.
570
+ {
571
+ name: "list_processes",
572
+ description: "List every process across all agents with its current state (running, stopped, exit code, uptime). Use this to see the whole machine at once, rather than calling get_service_status service by service. An agent only learns about a service when it is first started, so this lists what is deployed, not what is configured: an empty list means nothing has been started, not that you cannot see them \u2014 list_services shows what exists.",
573
+ route: "process.list",
574
+ method: "GET",
575
+ params: [],
576
+ buildInput: () => void 0
577
+ },
578
+ {
579
+ name: "get_service",
580
+ transformOutput: maskServices,
581
+ description: "Read the full configuration of one service: its commands, ports, groups, runner, log sources and restart policy. list_services gives the ids.",
582
+ route: "service.get",
583
+ method: "GET",
584
+ params: [
585
+ { name: "serviceId", description: "The service ID", required: true }
586
+ ],
587
+ buildInput: (p) => ({ id: p.serviceId })
588
+ },
589
+ {
590
+ name: "get_service_env",
591
+ description: 'Read the environment variables a service runs with, and the project\'s variable inventory. `env` lists every key the service receives; a value reads "***" when it is a secret whose author did not share it with AI (sharing = ticking "AI read", or injecting it into the agents\' environment, which grants reading too). `envSecrets` says which keys are secret, `hiddenKeys` which ones are masked. A masked key is set on the service: never treat it as missing, never suggest adding it, and never pass "***" as a value \u2014 ask the user for it. `variables` describes every variable of the project \u2014 which environment defines it and its scope, its description, its flags, whether this machine overrides it, and `inService: false` for the ones this service does not receive. Use it to say where a variable must be changed instead of guessing. On an overridden variable, `sharedValue` is what the machine-local override replaces (the team\'s value, masked as "***" when unreadable); no other value appears there. This is the resolver: the values are what the service would receive \u2014 inheritance, {{environment.KEY}} references, this machine\'s overrides and server built-ins applied; agent built-ins stay as written until the service starts. Use it to check a variable you just composed. `unresolvedReferences` lists references nothing will fill (a typo, a variable that does not exist): fix them.',
592
+ route: "service.getEnv",
593
+ method: "GET",
594
+ params: [
595
+ { name: "serviceId", description: "The service ID", required: true },
596
+ { name: "environmentId", description: "A global environment of the project to resolve in instead of the active one, without activating it (from list_environments). Omit for the active one.", required: false }
597
+ ],
598
+ buildInput: (p) => ({ id: p.serviceId, ...p.environmentId ? { environmentId: p.environmentId } : {} })
599
+ },
600
+ // ─── Écrire un service et ses variables ────────────────────────────────────
601
+ //
602
+ // Les variables s'écrivent à l'aveugle (`environment.setVariableBlind`) : une
603
+ // IA remplace la valeur d'un secret sans la lire, et ne peut ni le rendre
604
+ // public, ni le partager avec les IA. La règle tient côté serveur, dans la
605
+ // route ; ces outils ne passent jamais par une route qui renvoie des valeurs
606
+ // (`upsertVariable`, `removeVariable`, `update` rendent l'environnement entier).
607
+ {
608
+ name: "create_service",
609
+ transformOutput: maskServices,
610
+ description: "Create a service, native or Docker, in a project: it joins the project and gets its environments in the same call. Pass the projectId your context names. Projects are synced between machines, so write paths relative to the project root and put machine-specific values (a device serial, a local token) in environment variables, referenced as $NAME in commands \u2014 see the cwd, commands and shortcuts parameters. Then set its variables with set_environment_variable.",
611
+ route: "service.create",
612
+ method: "POST",
613
+ params: [
614
+ { name: "name", description: "The service name", required: true },
615
+ { name: "projectId", description: "The project it joins: the one your context names, or another from list_projects. Without it, the service belongs to no project.", required: false },
616
+ { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false },
617
+ ...CREATE_SERVICE_PARAMS
618
+ ],
619
+ buildInput: (p) => {
620
+ const fields = serviceFields(p, CREATE_SERVICE_PARAMS);
621
+ if (fields["runner"] === "docker" && !fields["dockerConfig"]) {
622
+ throw new Error('dockerConfig: required with runner "docker" \u2014 give an "image" or a "dockerfile"');
623
+ }
624
+ return {
625
+ name: p.name,
626
+ ...fields,
627
+ ...p.projectId ? { projectId: p.projectId } : {},
628
+ ...p.orgId ? { orgId: p.orgId } : {}
629
+ };
630
+ }
631
+ },
632
+ {
633
+ name: "add_service_to_project",
634
+ description: "Add an existing service to a project, and create its environments \u2014 one for each of the project's environments, where its own variables go. Not needed after create_service, which already does it; calling it again changes nothing.",
635
+ route: "project.addService",
636
+ method: "POST",
637
+ params: [
638
+ { name: "projectId", description: "The project ID, from list_projects", required: true },
639
+ { name: "serviceId", description: "The service ID", required: true },
640
+ { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
641
+ ],
642
+ buildInput: (p) => ({ projectId: p.projectId, serviceId: p.serviceId, ...p.orgId ? { orgId: p.orgId } : {} })
643
+ },
644
+ {
645
+ name: "update_service",
646
+ transformOutput: maskServices,
647
+ description: "Change any part of a service configuration \u2014 commands, ports, health check, restart policy, shortcuts, log sources, whether it runs natively or in Docker (runner, dockerConfig)\u2026 Only the fields you pass change; a list or an object you pass replaces the current one whole. Read the service first with get_service.",
648
+ route: "service.update",
649
+ method: "POST",
650
+ params: [
651
+ { name: "serviceId", description: "The service ID", required: true },
652
+ { name: "name", description: "New name", required: false },
653
+ { name: "orgId", description: "Move the service to this organization vault. Leave unset unless asked.", required: false, schema: z.string().max(128).nullable() },
654
+ ...UPDATE_SERVICE_PARAMS
655
+ ],
656
+ buildInput: (p) => ({
657
+ id: p.serviceId,
658
+ ...p.name ? { name: p.name } : {},
659
+ ...p.orgId !== void 0 ? { orgId: parseTyped("orgId", z.string().max(128).nullable(), p.orgId) } : {},
660
+ ...serviceFields(p, UPDATE_SERVICE_PARAMS)
661
+ })
662
+ },
663
+ {
664
+ name: "list_environments",
665
+ description: "List the environments of a project, with no value: each one's id, name and scope (global = shared by the whole project, service = one service's own variables), which global environment is active, which service a service environment belongs to and which global environment activates it, its parents (it inherits their variables), `isolated` when a service environment does not inherit from its global one, and the variables it defines with their flags. Empty environments are listed too \u2014 a service you just created has one per global environment, where its own variables go. Use it to find the environmentId before set_environment_variable.",
666
+ route: "environment.listForAi",
667
+ method: "GET",
668
+ params: [
669
+ { name: "projectId", description: "The project ID: the one your context names, or another from list_projects", required: true },
670
+ { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
671
+ ],
672
+ buildInput: (p) => ({ projectId: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} })
673
+ },
674
+ {
675
+ name: "resolve_environment",
676
+ description: "Resolve one environment alone \u2014 its variables with those inherited from its parents and this machine's overrides \u2014 as an AI may read it: secrets not shared with AI read \"***\". Built-in references ({{service.*}}, {{services.*}}, {{agent.*}}\u2026) are NOT filled, since they depend on the service that receives the variable; use get_service_env for a service's final values. `unresolvedReferences` lists references nothing will fill: a misspelled {{environment.KEY}}, or a name that is no built-in.",
677
+ route: "environment.resolveForAi",
678
+ method: "GET",
679
+ params: [
680
+ { name: "environmentId", description: "The environment, from list_environments", required: true }
681
+ ],
682
+ buildInput: (p) => ({ environmentId: p.environmentId })
683
+ },
684
+ {
685
+ name: "set_environment_variable",
686
+ description: `Create or change an environment variable, by name, in one environment \u2014 global or service, same rules for both. Find the environmentId with list_environments. Where it belongs: a value shared by several services (a database host, an API base URL) goes ONCE in the active global environment; services inherit it. A value only one service needs goes in that service's environment (scope service, activated by the active global one), where it also overrides a global variable of the same name. Never hardcode what Runeya already knows: a service's own port is {{service.PORT}}, its own URL {{service.URL}}, another service's address {{services.<slug>.URL}} \u2014 a copied "3210" or "http://localhost:3211" breaks as soon as a port changes or the project runs on another machine. If the port a variable needs is not declared on its service, declare it there (update_service, ports) instead of writing the number. When a written value contains a port or URL of a project service, the response lists \`suggestions\`: rewrite the value with those references. Compose instead of copying: a value can reference another variable of the resolved environment as {{environment.KEY}} (e.g. "postgres://{{environment.DB_USER}}@{{environment.DB_HOST}}:5432"). ${BUILTINS_HELP} After writing, check the result with get_service_env (a service, optionally in another global environment) or resolve_environment (an environment alone). References are substituted in one pass: a reference to a variable whose own value is only a reference may stay unexpanded, so point at the variable that holds the actual value. $NAME is not a reference here: it only expands inside a shell command. pre and post are concatenated around the value, each resolved separately. You can replace a secret's value without reading it, and create a variable as secret. You cannot make a secret public nor make it readable by AI: that stays the user's decision. Never pass "***" as a value. The response never contains the value.`,
687
+ route: "environment.setVariableBlind",
688
+ method: "POST",
689
+ params: [
690
+ { name: "environmentId", description: "The environment that holds the variable, from list_environments", required: true },
691
+ { name: "key", description: "The variable name, e.g. DATABASE_URL", required: true },
692
+ { name: "value", description: "The new value, possibly with {{environment.KEY}} references. Omit to leave it unchanged.", required: false },
693
+ { name: "pre", description: 'Text put before the value (e.g. "https://"). Omit to leave it unchanged.', required: false },
694
+ { name: "post", description: 'Text put after the value (e.g. "/api"). Omit to leave it unchanged.', required: false },
695
+ { name: "isSecret", description: '"true" to store it as a secret. On an existing public variable, makes it secret.', required: false },
696
+ { name: "description", description: "What the variable is for, in markdown", required: false }
697
+ ],
698
+ buildInput: (p) => ({
699
+ environmentId: p.environmentId,
700
+ key: p.key,
701
+ ...p.value !== void 0 ? { value: p.value } : {},
702
+ ...p.pre !== void 0 ? { pre: p.pre } : {},
703
+ ...p.post !== void 0 ? { post: p.post } : {},
704
+ ...p.isSecret !== void 0 ? { isSecret: toBool(p.isSecret) } : {},
705
+ ...p.description !== void 0 ? { description: p.description } : {}
706
+ })
707
+ },
708
+ {
709
+ name: "set_environment_inheritance",
710
+ description: "Switch whether a service environment inherits the variables of the global environment that activates it (the default), or is isolated from it and receives only its own variables. list_environments shows this as `isolated`. Isolating a service is unusual: it loses every shared variable of the project. Do it only when the user asks, and never to work around a variable \u2014 override it in the service environment instead.",
711
+ route: "environment.setInheritanceBlind",
712
+ method: "POST",
713
+ params: [
714
+ { name: "environmentId", description: "A service environment (scope service), from list_environments", required: true },
715
+ { name: "inherit", description: '"true" to inherit from the global environment, "false" to isolate', required: true, schema: z.boolean() }
716
+ ],
717
+ buildInput: (p) => ({ environmentId: p.environmentId, inherit: toBool(p.inherit ?? "true") })
718
+ },
719
+ {
720
+ name: "remove_environment_variable",
721
+ description: "Delete an environment variable, by name, from one environment. Its value is lost.",
722
+ route: "environment.removeVariableBlind",
723
+ method: "POST",
724
+ params: [
725
+ { name: "environmentId", description: "The environment that holds the variable", required: true },
726
+ { name: "key", description: "The variable name", required: true }
727
+ ],
728
+ buildInput: (p) => ({ environmentId: p.environmentId, key: p.key }),
729
+ destructive: true
730
+ },
731
+ {
732
+ name: "get_service_metrics",
733
+ description: "Read the CPU and memory currently used by a running service.",
734
+ route: "process.metrics",
735
+ method: "GET",
736
+ params: [
737
+ { name: "serviceId", description: "The service ID", required: true },
738
+ { name: "agentId", description: "The agent ID hosting this service", required: true }
739
+ ],
740
+ buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId })
741
+ },
742
+ {
743
+ name: "list_agents",
744
+ description: "List the agents connected to this Runeya, with their status and whether they run on this machine. Passphrases are never returned.",
745
+ route: "agent.list",
746
+ method: "GET",
747
+ params: [],
748
+ buildInput: () => void 0
749
+ },
750
+ {
751
+ name: "list_projects",
752
+ description: "List the projects known to this Runeya, with their ids and the services they hold.",
753
+ route: "project.list",
754
+ method: "GET",
755
+ params: [],
756
+ buildInput: () => void 0
757
+ },
758
+ {
759
+ name: "get_project",
760
+ description: "Read one project: its services, its active environment, its organization.",
761
+ route: "project.get",
762
+ method: "GET",
763
+ params: [
764
+ { name: "projectId", description: "The project ID, from list_projects", required: true },
765
+ { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
766
+ ],
767
+ buildInput: (p) => ({ id: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} })
768
+ },
769
+ {
770
+ name: "list_project_paths",
771
+ description: "Where each project lives on this machine. Use it to find the directory to work in before reading or editing files.",
772
+ route: "project.localPaths",
773
+ method: "GET",
774
+ params: [],
775
+ buildInput: () => void 0
776
+ },
777
+ {
778
+ name: "git_status",
779
+ description: "Read the git working tree of a service or a project: staged, modified and untracked files, current branch, ahead/behind counts.",
780
+ route: "git.status",
781
+ method: "GET",
782
+ params: [
783
+ { name: "serviceId", description: "Target the repository of this service", required: false },
784
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
785
+ { name: "agentId", description: "The agent hosting the repository", required: false },
786
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
787
+ ],
788
+ buildInput: (p) => gitTarget(p)
789
+ },
790
+ {
791
+ name: "git_log",
792
+ description: "Read the recent commits of a service or project repository: hash, author, date, message.",
793
+ route: "git.log",
794
+ method: "GET",
795
+ params: [
796
+ { name: "serviceId", description: "Target the repository of this service", required: false },
797
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
798
+ { name: "agentId", description: "The agent hosting the repository", required: false },
799
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false },
800
+ { name: "limit", description: "How many commits to return (1-200). Default: 50.", required: false }
801
+ ],
802
+ buildInput: (p) => ({ ...gitTarget(p), ...p.limit ? { limit: Number(p.limit) } : {} })
803
+ },
804
+ {
805
+ name: "git_branches",
806
+ description: "List the local and remote branches of a service or project repository.",
807
+ route: "git.branches",
808
+ method: "GET",
809
+ params: [
810
+ { name: "serviceId", description: "Target the repository of this service", required: false },
811
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
812
+ { name: "agentId", description: "The agent hosting the repository", required: false },
813
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
814
+ ],
815
+ buildInput: (p) => gitTarget(p)
816
+ },
817
+ {
818
+ name: "git_diff",
819
+ description: "Read the diff of a service or project repository \u2014 everything, or one file. Use it to see what changed before describing or reviewing it.",
820
+ route: "git.diff",
821
+ method: "GET",
822
+ params: [
823
+ { name: "serviceId", description: "Target the repository of this service", required: false },
824
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
825
+ { name: "agentId", description: "The agent hosting the repository", required: false },
826
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false },
827
+ { name: "path", description: "Restrict the diff to this file path", required: false },
828
+ { name: "staged", description: 'Set to "true" to read the staged diff instead of the working tree', required: false },
829
+ { name: "untracked", description: 'Set to "true" to include untracked files', required: false }
830
+ ],
831
+ buildInput: (p) => ({
832
+ ...gitTarget(p),
833
+ ...p.path ? { path: p.path } : {},
834
+ ...p.staged !== void 0 ? { staged: p.staged === "true" } : {},
835
+ ...p.untracked !== void 0 ? { untracked: p.untracked === "true" } : {}
836
+ })
837
+ },
838
+ {
839
+ name: "list_docs",
840
+ description: "List the markdown documentation files of a scope, as a tree. Pair it with read_doc to answer from the project's own docs rather than from guesswork.",
841
+ route: "wiki.list",
842
+ method: "GET",
843
+ params: [
844
+ { name: "scope", description: `"global" for this Runeya, or "service:<serviceId>" for one service's repository`, required: true }
845
+ ],
846
+ buildInput: (p) => ({ scope: p.scope })
847
+ },
848
+ {
849
+ name: "read_doc",
850
+ description: "Read one markdown documentation file. Paths come from list_docs; only .md and .markdown can be read.",
851
+ route: "wiki.read",
852
+ method: "GET",
853
+ params: [
854
+ { name: "scope", description: `"global" for this Runeya, or "service:<serviceId>" for one service's repository`, required: true },
855
+ { name: "path", description: "Relative path of the file, as returned by list_docs", required: true }
856
+ ],
857
+ buildInput: (p) => ({ scope: p.scope, path: p.path })
858
+ },
859
+ {
860
+ name: "get_server_logs",
861
+ description: "Read Runeya's own recent log entries. Use it to explain why Runeya itself misbehaved \u2014 not to read a service's output, which is get_logs.",
862
+ route: "diagnostics.recentLogs",
863
+ method: "GET",
864
+ params: [
865
+ { name: "limit", description: "How many entries to return (1-2000). Default: 500.", required: false }
866
+ ],
867
+ buildInput: (p) => p.limit ? { limit: Number(p.limit) } : void 0
868
+ },
869
+ {
870
+ name: "get_kanban_queue_state",
871
+ description: "Read the state of the kanban task queue: what is running, what is waiting. Use it before queuing work, or to explain why a card has not started.",
872
+ route: "kanbanQueue.getState",
873
+ method: "GET",
874
+ params: [],
875
+ buildInput: () => void 0
876
+ },
877
+ {
878
+ name: "export_project",
879
+ description: "Read a project and every service it holds in one call, with secrets stripped out. Cheaper and safer than calling get_service for each service \u2014 prefer it whenever you need the whole picture of a project.",
880
+ route: "project.export",
881
+ method: "GET",
882
+ params: [
883
+ { name: "projectId", description: "The project ID, from list_projects", required: true },
884
+ { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
885
+ ],
886
+ buildInput: (p) => ({ id: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} })
887
+ },
888
+ {
889
+ name: "git_remotes",
890
+ description: "List the git remotes of a service or project repository, with their URLs.",
891
+ route: "git.remotes",
892
+ method: "GET",
893
+ params: [
894
+ { name: "serviceId", description: "Target the repository of this service", required: false },
895
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
896
+ { name: "agentId", description: "The agent hosting the repository", required: false },
897
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
898
+ ],
899
+ buildInput: (p) => gitTarget(p)
900
+ },
901
+ {
902
+ name: "git_stash_list",
903
+ description: "List the stashes of a service or project repository. Useful before assuming work was lost: it may simply be stashed.",
904
+ route: "git.stashList",
905
+ method: "GET",
906
+ params: [
907
+ { name: "serviceId", description: "Target the repository of this service", required: false },
908
+ { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
909
+ { name: "agentId", description: "The agent hosting the repository", required: false },
910
+ { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
911
+ ],
912
+ buildInput: (p) => gitTarget(p)
913
+ },
914
+ {
915
+ name: "get_runeya_version",
916
+ description: "Read the version of Runeya running here, the latest published one, and whether this install is up to date. Use it before blaming a bug on the code: the machine may simply be behind.",
917
+ route: "health.versionInfo",
918
+ method: "GET",
919
+ params: [],
920
+ buildInput: () => void 0
921
+ },
922
+ {
923
+ name: "get_runeya_paths",
924
+ description: "Read where Runeya keeps its things on this machine: its launch directory, its data directory, and the machine-wide directory holding cloud projects.",
925
+ route: "settings.getPaths",
926
+ method: "GET",
927
+ params: [],
928
+ buildInput: () => void 0
929
+ },
930
+ {
931
+ name: "get_network_info",
932
+ description: "Read where this Runeya listens (host and port) and whether it is reachable from the local network, with the URLs to use. Use it to give someone a working link instead of guessing one.",
933
+ route: "settings.getNetwork",
934
+ method: "GET",
935
+ params: [],
936
+ buildInput: () => void 0
937
+ },
938
+ {
939
+ name: "list_runeya_instances",
940
+ description: "List every Runeya answering on this machine, this one included, with its port and directory. Use it when a port is taken or when two instances seem to disagree.",
941
+ route: "diagnostics.instances",
942
+ method: "GET",
943
+ params: [],
944
+ buildInput: () => void 0
945
+ },
946
+ {
947
+ name: "get_cloud_status",
948
+ description: "Say whether this Runeya is linked to a cloud account, and to which cloud. A kanban tool failing for lack of a cloud link is explained here.",
949
+ route: "cloudAuth.status",
950
+ method: "GET",
951
+ params: [],
952
+ buildInput: () => void 0
953
+ }
954
+ ];
955
+
956
+ // ../../packages/ai-capabilities/src/adapters/json-schema.ts
957
+ import { z as z2 } from "zod";
958
+ function paramJsonSchema(param) {
959
+ if (!param.schema) return { type: "string", description: param.description };
960
+ const { $schema: _ignored, ...schema } = z2.toJSONSchema(param.schema, { io: "input", unrepresentable: "any" });
961
+ return { ...schema, description: param.description };
962
+ }
963
+
964
+ // ../../packages/ai-capabilities/src/adapters/anthropic.ts
965
+ function buildAnthropicTools(capabilities) {
966
+ return capabilities.map((cap) => ({
967
+ name: cap.name,
968
+ description: cap.description,
969
+ input_schema: {
970
+ type: "object",
971
+ properties: Object.fromEntries(
972
+ cap.params.map((p) => [p.name, paramJsonSchema(p)])
973
+ ),
974
+ required: cap.params.filter((p) => p.required).map((p) => p.name)
975
+ }
976
+ }));
977
+ }
978
+
979
+ // ../../packages/ai-capabilities/src/adapters/openai.ts
980
+ function buildOpenAITools(capabilities) {
981
+ return capabilities.map((cap) => ({
982
+ type: "function",
983
+ function: {
984
+ name: cap.name,
985
+ description: cap.description,
986
+ parameters: {
987
+ type: "object",
988
+ properties: Object.fromEntries(
989
+ cap.params.map((p) => [p.name, paramJsonSchema(p)])
990
+ ),
991
+ required: cap.params.filter((p) => p.required).map((p) => p.name)
992
+ }
993
+ }
994
+ }));
995
+ }
996
+
997
+ // ../../packages/ai-capabilities/src/adapters/prompt.ts
998
+ function buildToolSafetyInstruction(capabilities) {
999
+ const destructive = capabilities.filter((c) => c.destructive).map((c) => c.name);
1000
+ const withHints = capabilities.filter((c) => c.usageHint);
1001
+ const lines = ["## Tool use safety rules"];
1002
+ if (destructive.length > 0) {
1003
+ lines.push(`CRITICAL: Never call ${destructive.join(", ")} unless the user has EXPLICITLY and UNAMBIGUOUSLY requested it.`);
1004
+ lines.push(`- Only call destructive tools (${destructive.join(", ")}) when the user explicitly uses action words for a specific service.`);
1005
+ }
1006
+ if (withHints.length > 0) {
1007
+ lines.push("");
1008
+ lines.push("## Tool usage hints");
1009
+ for (const cap of withHints) {
1010
+ lines.push(`- ${cap.usageHint}`);
1011
+ }
1012
+ }
1013
+ return lines.join("\n");
1014
+ }
1015
+
1016
+ // ../../packages/ai-capabilities/src/adapters/mcp.ts
1017
+ import { z as z3 } from "zod";
1018
+ function buildMcpShape(cap) {
1019
+ const shape = {};
1020
+ for (const param of cap.params) {
1021
+ const base = (param.schema ?? z3.string()).describe(param.description);
1022
+ shape[param.name] = param.required ? base : base.optional();
1023
+ }
1024
+ shape["authToken"] = z3.string().describe("Bearer token for authentication").optional();
1025
+ return shape;
1026
+ }
1027
+ function toRawParams(input, cap) {
1028
+ const typed = new Set(cap?.params.filter((p) => p.schema).map((p) => p.name));
1029
+ return Object.fromEntries(Object.entries(input).map(([k, v]) => [
1030
+ k,
1031
+ v === null && typed.has(k) ? "null" : v == null ? void 0 : typeof v === "object" ? JSON.stringify(v) : String(v)
1032
+ ]));
1033
+ }
1034
+
1035
+ // ../../packages/ai-capabilities/src/project-anchor.ts
1036
+ function applyProjectAnchor(cap, params, anchor) {
1037
+ const accepts = (name) => cap.params.some((p) => p.name === name);
1038
+ const anchored = { ...params };
1039
+ const mayAnchorOrg = !params["projectId"] || params["projectId"] === anchor.projectId;
1040
+ if (anchor.projectId && accepts("projectId") && !anchored["projectId"]) {
1041
+ anchored["projectId"] = anchor.projectId;
1042
+ }
1043
+ if (mayAnchorOrg && anchor.orgId && !anchored["orgId"] && accepts("orgId")) {
1044
+ anchored["orgId"] = anchor.orgId;
1045
+ }
1046
+ if (mayAnchorOrg && anchor.orgId && !anchored["organizationId"] && accepts("organizationId")) {
1047
+ anchored["organizationId"] = anchor.orgId;
1048
+ }
1049
+ return anchored;
1050
+ }
1051
+
1052
+ export {
1053
+ RUNEYA_CAPABILITIES,
1054
+ buildAnthropicTools,
1055
+ buildOpenAITools,
1056
+ buildToolSafetyInstruction,
1057
+ buildMcpShape,
1058
+ toRawParams,
1059
+ callTrpc,
1060
+ runCapability,
1061
+ applyProjectAnchor
1062
+ };
1063
+ //# sourceMappingURL=chunk-6IBPK6UE.js.map