@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
@@ -1,6 +1,15 @@
1
+ import {
2
+ RUNEYA_CAPABILITIES,
3
+ applyProjectAnchor,
4
+ buildAnthropicTools,
5
+ buildOpenAITools,
6
+ buildToolSafetyInstruction,
7
+ runCapability,
8
+ toRawParams
9
+ } from "./chunk-6IBPK6UE.js";
1
10
  import {
2
11
  settingsManager
3
- } from "./chunk-FE53XX4M.js";
12
+ } from "./chunk-NPMSBYXC.js";
4
13
  import {
5
14
  COMPANION_SIGNATURE,
6
15
  activeSessionRegistry,
@@ -38,7 +47,7 @@ import {
38
47
  stopCompanion,
39
48
  syncConversationFromClaudeTranscript,
40
49
  verifyJwt
41
- } from "./chunk-Q4RPY3VW.js";
50
+ } from "./chunk-UD42LACH.js";
42
51
  import {
43
52
  StoreDiskCoordinator,
44
53
  agentManager,
@@ -57,7 +66,7 @@ import {
57
66
  recordLocalRemoval,
58
67
  refsOfProjectId,
59
68
  serviceStore
60
- } from "./chunk-QF56Z6LI.js";
69
+ } from "./chunk-KV4GJKXU.js";
61
70
  import {
62
71
  isCliAvailable,
63
72
  resolveCliInvocation
@@ -72,7 +81,7 @@ import {
72
81
  renameWithRetry,
73
82
  resolveConversationRunDir,
74
83
  wasRead
75
- } from "./chunk-NCO4OOYT.js";
84
+ } from "./chunk-4LJQIQMN.js";
76
85
  import {
77
86
  allVaultRoots,
78
87
  env,
@@ -83,12 +92,10 @@ import {
83
92
  machineRoot,
84
93
  orgVaultRoot,
85
94
  vaultIdOfRoot
86
- } from "./chunk-KS7A5CTW.js";
95
+ } from "./chunk-VPSQJOSN.js";
87
96
  import {
88
97
  AGENT_STOP_FETCH_TIMEOUT,
89
98
  ApiKeysFileSchema,
90
- BUILTIN_VARIABLES,
91
- BootstrapCommandSchema,
92
99
  CLAUDE_CODE_MODELS,
93
100
  DockerConfigSchema,
94
101
  HealthCheckSchema,
@@ -99,14 +106,12 @@ import {
99
106
  RestartStrategySchema,
100
107
  ScenarioSchema,
101
108
  ServiceCommandSchema,
102
- ServiceConfigSchema,
103
109
  ServiceShortcutSchema,
104
110
  ambiguousServiceSlugs,
105
111
  crossServiceValues,
106
112
  findUnresolvedReferences,
107
113
  interpolateBuiltinsInEnv,
108
114
  isSharedWithAi,
109
- maskLogSourceSecrets,
110
115
  nativeParsers,
111
116
  restoreLogSourceSecrets,
112
117
  servicePortValues,
@@ -117,7 +122,7 @@ import {
117
122
  } from "./chunk-MZSDTA4A.js";
118
123
 
119
124
  // ../server/src/trpc/routers/chat.ts
120
- import { z as z9 } from "zod";
125
+ import { z as z6 } from "zod";
121
126
  import Anthropic2 from "@anthropic-ai/sdk";
122
127
  import OpenAI2 from "openai";
123
128
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -178,6 +183,16 @@ function codexMcpArgs(env2) {
178
183
  }
179
184
  return ["-c", `mcp_servers.runeya={${fields.join(",")}}`];
180
185
  }
186
+ function codexRuneyaMcpArgs(env2, build = codexMcpArgs, warn = console.warn) {
187
+ const disabled = ["-c", "mcp_servers.runeya.enabled=false"];
188
+ if (!env2.RUNEYA_API_TOKEN) return disabled;
189
+ try {
190
+ return build(env2);
191
+ } catch (err) {
192
+ warn(`[codex] Failed to resolve MCP server path: ${err.message}`);
193
+ return disabled;
194
+ }
195
+ }
181
196
  function tomlString(value) {
182
197
  const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/[\u0000-\u001f\u007f]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
183
198
  return `"${escaped}"`;
@@ -500,7 +515,8 @@ var router = t.router;
500
515
  var createCallerFactory = t.createCallerFactory;
501
516
  var publicProcedure = t.procedure;
502
517
  var API_KEY_REGEX = /^[0-9a-f]{64}$/i;
503
- var authMiddleware = t.middleware(async ({ ctx, next }) => {
518
+ var MCP_CLIENT_ROUTES = /* @__PURE__ */ new Set([...RUNEYA_CAPABILITIES.map((c) => c.route), "project.containing"]);
519
+ var authMiddleware = t.middleware(async ({ ctx, next, path }) => {
504
520
  const { authorization } = ctx;
505
521
  if (authorization?.startsWith("Bearer ") && API_KEY_REGEX.test(authorization.slice(7))) {
506
522
  if (!hasEncryptionKey()) {
@@ -520,15 +536,24 @@ var authMiddleware = t.middleware(async ({ ctx, next }) => {
520
536
  throw new TRPCError({ code: "UNAUTHORIZED", message: "Missing or invalid Authorization header" });
521
537
  }
522
538
  const token = authorization.slice(7);
539
+ let mcpClientId = null;
523
540
  try {
524
- await verifyJwt(token);
541
+ mcpClientId = (await verifyJwt(token, { allowMcp: true })).mcpClientId ?? null;
525
542
  } catch {
526
543
  throw new TRPCError({ code: "UNAUTHORIZED", message: "Invalid or expired token" });
527
544
  }
528
- return next({ ctx: { ...ctx, callerType: "app", apiKey: null } });
545
+ if (mcpClientId && !MCP_CLIENT_ROUTES.has(path)) {
546
+ throw new TRPCError({ code: "FORBIDDEN", message: "An MCP client cannot call this route." });
547
+ }
548
+ return next({ ctx: { ...ctx, callerType: "app", apiKey: null, mcpClientId } });
529
549
  });
530
550
  var protectedProcedure = t.procedure.use(authMiddleware);
531
551
  var LOOPBACK = /* @__PURE__ */ new Set(["127.0.0.1", "::1", "::ffff:127.0.0.1"]);
552
+ function requireLoopback(ctx) {
553
+ if (!ctx.remoteAddress || !LOOPBACK.has(ctx.remoteAddress)) {
554
+ throw new TRPCError({ code: "FORBIDDEN", message: "This route only answers the local machine." });
555
+ }
556
+ }
532
557
  async function requireLoopbackOrToken(ctx) {
533
558
  if (ctx.remoteAddress && LOOPBACK.has(ctx.remoteAddress)) return;
534
559
  if (isCiMode()) return;
@@ -545,6 +570,11 @@ async function requireLoopbackOrToken(ctx) {
545
570
  throw new TRPCError({ code: "UNAUTHORIZED", message: "Invalid or expired token" });
546
571
  }
547
572
  }
573
+ function requireHuman(ctx) {
574
+ if (isCiMode() || ctx.callerType !== "app" || ctx.mcpClientId) {
575
+ throw new TRPCError({ code: "FORBIDDEN", message: "Only the Runeya app can do this." });
576
+ }
577
+ }
548
578
  function requireServiceAction(ctx, serviceId, action) {
549
579
  if (ctx.callerType !== "api") return;
550
580
  const perm = ctx.apiKey.scopes.services.find((p) => p.serviceId === serviceId);
@@ -1164,8 +1194,8 @@ var EnvironmentResolver = class {
1164
1194
  return secretKeys;
1165
1195
  }
1166
1196
  interpolatesSecretKey(rawValue, ctxSecretKeys) {
1167
- const refs2 = [...rawValue.matchAll(/\{\{environment\.([^}]+)\}\}/g)].map((m) => m[1]);
1168
- return refs2.some((ref) => ctxSecretKeys.has(ref));
1197
+ const refs = [...rawValue.matchAll(/\{\{environment\.([^}]+)\}\}/g)].map((m) => m[1]);
1198
+ return refs.some((ref) => ctxSecretKeys.has(ref));
1169
1199
  }
1170
1200
  /**
1171
1201
  * Build the interpolation context for an environment.
@@ -1368,1013 +1398,6 @@ var EnvironmentResolver = class {
1368
1398
  };
1369
1399
  var environmentResolver = new EnvironmentResolver();
1370
1400
 
1371
- // ../../packages/ai-capabilities/src/capabilities.ts
1372
- import { z as z3 } from "zod";
1373
- function toList(raw) {
1374
- if (!raw) return [];
1375
- const text = raw.trim();
1376
- if (text.startsWith("[")) {
1377
- try {
1378
- const parsed = JSON.parse(text);
1379
- if (Array.isArray(parsed)) return parsed.map((v) => String(v).trim()).filter(Boolean);
1380
- } catch {
1381
- }
1382
- }
1383
- return text.split(",").map((v) => v.trim().replace(/^["'[]+|["'\]]+$/g, "")).filter(Boolean);
1384
- }
1385
- function clearable(raw, parse, key) {
1386
- if (raw === void 0) return {};
1387
- const text = String(raw).trim();
1388
- if (!text || text === "null") return { [key]: null };
1389
- return { [key]: parse(text) };
1390
- }
1391
- function gitTarget(p) {
1392
- return {
1393
- ...p.serviceId ? { serviceId: p.serviceId } : {},
1394
- ...p.projectId ? { projectId: p.projectId } : {},
1395
- ...p.agentId ? { agentId: p.agentId } : {},
1396
- ...p.orgId ? { orgId: p.orgId } : {}
1397
- };
1398
- }
1399
- var toBool = (raw) => raw.trim().toLowerCase() === "true";
1400
- var newId = () => globalThis.crypto.randomUUID();
1401
- function listItem(raw) {
1402
- try {
1403
- return JSON.parse(raw);
1404
- } catch {
1405
- return raw;
1406
- }
1407
- }
1408
- function parseTyped(name, schema, raw) {
1409
- if (raw === void 0) return void 0;
1410
- let result = raw.trim() === "null" ? schema.safeParse(null) : schema.safeParse(raw);
1411
- if (!result.success && raw.trim() === "null") result = schema.safeParse(raw);
1412
- if (!result.success) {
1413
- const text = raw.trim();
1414
- const json = listItem(text);
1415
- if (json !== text) result = schema.safeParse(json);
1416
- if (!result.success && !/^[[{]/.test(text)) {
1417
- const list = schema.safeParse(toList(text).map(listItem));
1418
- if (list.success) result = list;
1419
- }
1420
- }
1421
- if (!result.success) throw new Error(`${name}: ${z3.prettifyError(result.error)}`);
1422
- return result.data;
1423
- }
1424
- function withIds(items) {
1425
- return items.map((item) => ({ ...item, id: item.id || newId() }));
1426
- }
1427
- var optionalId = (schema) => schema.extend({ id: z3.string().min(1).max(64).optional() });
1428
- var DockerConfigInput = DockerConfigSchema.extend({
1429
- bootstrapCommands: z3.array(optionalId(BootstrapCommandSchema)).max(20).default([])
1430
- }).refine((c) => !!c.image !== !!c.dockerfile, {
1431
- message: 'dockerConfig needs exactly one of "image" (an image to pull) or "dockerfile" (a Dockerfile to build)'
1432
- });
1433
- var SERVICE_FIELDS = [
1434
- { name: "description", description: "What the service is, in a sentence" },
1435
- { name: "agentId", description: "The agent that runs it, from list_agents. Omit to inherit from the environment.", clearable: true },
1436
- { 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 },
1437
- { name: "command", description: 'Shortcut for a single command line (e.g. "npm run dev"). Replaces every existing command. Use commands for several.' },
1438
- { 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: z3.array(optionalId(ServiceCommandSchema)).max(50) },
1439
- { 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() },
1440
- { name: "groups", description: "Groups the service belongs to. Replaces the current ones.", schema: ServiceConfigSchema.shape.groups.unwrap().unwrap() },
1441
- { name: "url", description: "URL where the service is reached" },
1442
- { 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() },
1443
- { name: "openapiUrl", description: "URL of its OpenAPI document" },
1444
- { name: "docsPath", description: "Where its markdown docs live, relative to cwd or absolute. Defaults to cwd." },
1445
- { name: "git", description: 'Its git repository: "remote" URL and "home" page', schema: ServiceConfigSchema.shape.git.unwrap(), clearable: true },
1446
- { name: "meta", description: "Free key/value metadata (strings)", schema: ServiceConfigSchema.shape.meta.unwrap(), clearable: true },
1447
- { 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() },
1448
- { 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 },
1449
- { 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 },
1450
- { name: "autoRestart", description: "Restart the service when it crashes", schema: z3.boolean() },
1451
- { name: "restartStrategy", description: "When to restart it", schema: RestartStrategySchema.unwrap() },
1452
- { name: "maxRestarts", description: "Give up after this many restarts", schema: ServiceConfigSchema.shape.maxRestarts.unwrap() },
1453
- { name: "restartBackoffMs", description: "Delay before a restart, in milliseconds", schema: ServiceConfigSchema.shape.restartBackoffMs.unwrap().unwrap() },
1454
- { name: "clearLogsOnStart", description: "Clear the logs each time the service starts", schema: z3.boolean() },
1455
- { 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: z3.array(optionalId(ServiceShortcutSchema)).max(50) },
1456
- { name: "parserIds", description: "Log parsers applied to its output, by id", schema: ServiceConfigSchema.shape.parserIds.unwrap() },
1457
- { 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() }
1458
- ];
1459
- function serviceParams(clearable2) {
1460
- return SERVICE_FIELDS.map((f) => {
1461
- const nullable = clearable2 && f.clearable;
1462
- const base = f.schema ?? (nullable ? z3.string() : void 0);
1463
- return {
1464
- name: f.name,
1465
- description: nullable ? `${f.description} null clears it.` : f.description,
1466
- required: false,
1467
- ...base ? { schema: nullable ? base.nullable() : base } : {}
1468
- };
1469
- });
1470
- }
1471
- function serviceFields(p, params) {
1472
- const out = {};
1473
- for (const param of params) {
1474
- if (p[param.name] === void 0 || param.name === "command") continue;
1475
- out[param.name] = param.schema ? parseTyped(param.name, param.schema, p[param.name]) : p[param.name];
1476
- }
1477
- if (p.command !== void 0 && p.commands === void 0) out["commands"] = [{ label: "", command: p.command, shell: true }];
1478
- if (Array.isArray(out["commands"])) out["commands"] = withIds(out["commands"]);
1479
- if (Array.isArray(out["shortcuts"])) out["shortcuts"] = withIds(out["shortcuts"]);
1480
- const docker = out["dockerConfig"];
1481
- if (docker?.bootstrapCommands) out["dockerConfig"] = { ...docker, bootstrapCommands: withIds(docker.bootstrapCommands) };
1482
- return out;
1483
- }
1484
- function maskServices(result) {
1485
- if (Array.isArray(result)) return result.map(maskServices);
1486
- if (result && typeof result === "object" && Array.isArray(result.logSources)) {
1487
- const service = result;
1488
- return { ...service, logSources: maskLogSourceSecrets(service.logSources) };
1489
- }
1490
- return result;
1491
- }
1492
- var refs = (scope) => BUILTIN_VARIABLES.filter((b) => b.scope === scope).map((b) => `{{${b.name}}}`).join(", ");
1493
- 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")}.`;
1494
- var CREATE_SERVICE_PARAMS = serviceParams(false);
1495
- var UPDATE_SERVICE_PARAMS = serviceParams(true);
1496
- var RUNEYA_CAPABILITIES = [
1497
- {
1498
- name: "list_services",
1499
- transformOutput: maskServices,
1500
- 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.",
1501
- route: "service.list",
1502
- method: "GET",
1503
- params: [
1504
- { name: "projectId", description: "Restrict to this project, from list_projects. Omit to list every service on the machine.", required: false },
1505
- { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
1506
- ],
1507
- buildInput: (p) => p.projectId ? { projectId: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} } : void 0
1508
- },
1509
- {
1510
- name: "get_service_status",
1511
- 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.",
1512
- route: "process.get",
1513
- method: "GET",
1514
- params: [
1515
- { name: "serviceId", description: "The service ID", required: true },
1516
- { name: "agentId", description: "The agent ID hosting this service", required: true }
1517
- ],
1518
- buildInput: (p) => ({ agentId: p.agentId, id: p.serviceId })
1519
- },
1520
- {
1521
- name: "get_logs",
1522
- description: "Get the recent buffered logs for a service.",
1523
- route: "process.logs",
1524
- method: "GET",
1525
- params: [
1526
- { name: "serviceId", description: "The service ID", required: true },
1527
- { name: "agentId", description: "The agent ID hosting this service", required: true }
1528
- ],
1529
- buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId })
1530
- },
1531
- {
1532
- name: "start_service",
1533
- description: "Start a service on an agent.",
1534
- route: "process.start",
1535
- method: "POST",
1536
- params: [
1537
- { name: "serviceId", description: "The service ID to start", required: true },
1538
- { name: "agentId", description: "The agent ID hosting this service", required: true }
1539
- ],
1540
- buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
1541
- destructive: true
1542
- },
1543
- {
1544
- name: "stop_service",
1545
- description: "Stop a running service on an agent.",
1546
- route: "process.stop",
1547
- method: "POST",
1548
- params: [
1549
- { name: "serviceId", description: "The service ID to stop", required: true },
1550
- { name: "agentId", description: "The agent ID hosting this service", required: true }
1551
- ],
1552
- buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
1553
- destructive: true
1554
- },
1555
- {
1556
- name: "restart_service",
1557
- description: "Restart a service on an agent (stop \u2192 redeploy \u2192 start).",
1558
- route: "process.restart",
1559
- method: "POST",
1560
- params: [
1561
- { name: "serviceId", description: "The service ID to restart", required: true },
1562
- { name: "agentId", description: "The agent ID hosting this service", required: true }
1563
- ],
1564
- buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId }),
1565
- destructive: true
1566
- },
1567
- // ─── Utility ─────────────────────────────────────────────────────────────
1568
- {
1569
- name: "wait",
1570
- description: "Wait for a given number of milliseconds before continuing.",
1571
- route: "utility.wait",
1572
- method: "POST",
1573
- params: [
1574
- { name: "ms", description: "Number of MILLISECONDS to wait. Convert from seconds: 1s=1000, 10s=10000, 1min=60000. Max 300000.", required: true }
1575
- ],
1576
- buildInput: (p) => ({ ms: Number(p.ms) }),
1577
- 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.'
1578
- },
1579
- // ─── Kanban ───────────────────────────────────────────────────────────────
1580
- {
1581
- name: "kanban_list_boards",
1582
- 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.",
1583
- route: "kanban.listBoards",
1584
- method: "GET",
1585
- params: [
1586
- { name: "includeArchived", description: 'Set to "true" to include archived boards. Default: false.', required: false },
1587
- { 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 }
1588
- ],
1589
- buildInput: (p) => ({
1590
- includeArchived: p.includeArchived === "true",
1591
- ...p.organizationId ? { organizationId: p.organizationId } : {}
1592
- })
1593
- },
1594
- {
1595
- name: "kanban_get_board",
1596
- 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.",
1597
- route: "kanban.getBoard",
1598
- method: "GET",
1599
- params: [
1600
- { name: "boardId", description: "The kanban board ID, from kanban_list_boards", required: true }
1601
- ],
1602
- buildInput: (p) => ({ boardId: p.boardId })
1603
- },
1604
- {
1605
- name: "kanban_get_card_comments",
1606
- 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.",
1607
- route: "kanban.getCardComments",
1608
- method: "GET",
1609
- params: [
1610
- { name: "boardId", description: "The kanban board ID", required: true },
1611
- { name: "cardId", description: "The card ID whose comments to read", required: true },
1612
- { name: "limit", description: "How many of the most recent comments to return (1-200). Default: 50.", required: false }
1613
- ],
1614
- buildInput: (p) => ({
1615
- boardId: p.boardId,
1616
- cardId: p.cardId,
1617
- ...p.limit ? { limit: Number(p.limit) } : {}
1618
- }),
1619
- 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.'
1620
- },
1621
- {
1622
- name: "kanban_search_cards",
1623
- 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.',
1624
- route: "kanban.searchCards",
1625
- method: "GET",
1626
- params: [
1627
- { name: "query", description: "Text to look for in card titles, bodies, comments and followed conversations. Optional when createdBy is given.", required: false },
1628
- { name: "createdBy", description: "Only cards created by this author: a user id, or a name (accent- and case-insensitive, partial match).", required: false },
1629
- { name: "boardId", description: "Restrict the search to this board. Omit to search all boards.", required: false },
1630
- { name: "limit", description: "Maximum number of cards to return (1-100). Default: 25.", required: false },
1631
- { 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 }
1632
- ],
1633
- buildInput: (p) => ({
1634
- ...p.query ? { query: p.query } : {},
1635
- ...p.createdBy ? { createdBy: p.createdBy } : {},
1636
- ...p.boardId ? { boardId: p.boardId } : {},
1637
- ...p.limit ? { limit: Number(p.limit) } : {},
1638
- ...p.organizationId ? { organizationId: p.organizationId } : {}
1639
- })
1640
- },
1641
- {
1642
- name: "kanban_download_attachment",
1643
- 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.",
1644
- route: "kanban.downloadAttachment",
1645
- method: "POST",
1646
- params: [
1647
- { name: "attachmentId", description: "The attachment ID, as listed on the card", required: true },
1648
- { 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 },
1649
- { 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 }
1650
- ],
1651
- buildInput: (p) => ({
1652
- attachmentId: p.attachmentId,
1653
- ...p.boardId ? { boardId: p.boardId } : {},
1654
- ...p.organizationId ? { orgId: p.organizationId } : {}
1655
- })
1656
- },
1657
- {
1658
- name: "kanban_move_card",
1659
- description: "Move a kanban card to another column. Use the exact column name.",
1660
- route: "kanban.moveCard",
1661
- method: "POST",
1662
- params: [
1663
- { name: "boardId", description: "The kanban board ID", required: true },
1664
- { name: "cardId", description: "The card ID to move", required: true },
1665
- { name: "targetColumn", description: "Exact name of the target column", required: true }
1666
- ],
1667
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, targetColumn: p.targetColumn })
1668
- },
1669
- {
1670
- name: "kanban_add_comment",
1671
- description: "Add a comment to a kanban card.",
1672
- route: "kanban.addComment",
1673
- method: "POST",
1674
- params: [
1675
- { name: "boardId", description: "The kanban board ID", required: true },
1676
- { name: "cardId", description: "The card ID", required: true },
1677
- { name: "comment", description: "The comment text (markdown supported)", required: true }
1678
- ],
1679
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, comment: p.comment })
1680
- },
1681
- {
1682
- name: "kanban_get_card_conversations",
1683
- 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.",
1684
- route: "kanban.getCardConversations",
1685
- method: "GET",
1686
- params: [
1687
- { name: "boardId", description: "The kanban board ID", required: true },
1688
- { name: "cardId", description: "The card ID whose conversations to read", required: true },
1689
- { name: "limit", description: "How many of the most recent messages to return per conversation (1-500). Default: 100.", required: false }
1690
- ],
1691
- buildInput: (p) => ({
1692
- boardId: p.boardId,
1693
- cardId: p.cardId,
1694
- ...p.limit ? { limit: Number(p.limit) } : {}
1695
- }),
1696
- usageHint: `"regarde la conversation Intercom de la carte" / "qu'a dit le client" \u2192 kanban_get_card_conversations(boardId, cardId).`
1697
- },
1698
- {
1699
- name: "kanban_search_conversations",
1700
- 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.",
1701
- route: "kanban.searchConversations",
1702
- method: "GET",
1703
- params: [
1704
- { name: "boardId", description: "Any kanban board ID of the organization to search in", required: true },
1705
- { name: "query", description: "Words of the conversation title, a conversation number, or a conversation URL", required: true }
1706
- ],
1707
- buildInput: (p) => ({ boardId: p.boardId, query: p.query })
1708
- },
1709
- {
1710
- name: "kanban_link_conversation",
1711
- 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.",
1712
- route: "kanban.linkConversation",
1713
- method: "POST",
1714
- params: [
1715
- { name: "boardId", description: "The kanban board ID of the card", required: true },
1716
- { name: "cardId", description: "The card to link the conversation to", required: true },
1717
- { name: "connectionId", description: "The connectionId of the search result", required: true },
1718
- { name: "externalId", description: "The externalId of the search result", required: true }
1719
- ],
1720
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, connectionId: p.connectionId, externalId: p.externalId })
1721
- },
1722
- {
1723
- name: "kanban_get_card_links",
1724
- 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.",
1725
- route: "kanban.getCardLinks",
1726
- method: "GET",
1727
- params: [
1728
- { name: "boardId", description: "The kanban board ID whose links to read", required: true }
1729
- ],
1730
- buildInput: (p) => ({ boardId: p.boardId })
1731
- },
1732
- {
1733
- name: "kanban_set_card_parent",
1734
- 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.",
1735
- route: "kanban.setCardParent",
1736
- method: "POST",
1737
- params: [
1738
- { name: "boardId", description: "The kanban board ID of the card being linked", required: true },
1739
- { name: "cardId", description: "The card that depends on the parent (the child)", required: true },
1740
- { name: "parentCardId", description: "The parent card ID. Omit to detach the card from its parent.", required: false },
1741
- { name: "parentBoardId", description: "The parent's board, when it lives on another board of the same organization. Defaults to boardId.", required: false }
1742
- ],
1743
- buildInput: (p) => ({
1744
- boardId: p.boardId,
1745
- cardId: p.cardId,
1746
- ...p.parentCardId ? { parentCardId: p.parentCardId } : {},
1747
- ...p.parentBoardId ? { parentBoardId: p.parentBoardId } : {}
1748
- })
1749
- },
1750
- {
1751
- name: "kanban_place_card",
1752
- 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.",
1753
- route: "kanban.placeCard",
1754
- method: "POST",
1755
- params: [
1756
- { name: "boardId", description: "The board to place the card on (not its own board)", required: true },
1757
- { name: "cardId", description: "The card to place", required: true },
1758
- { name: "column", description: "The column on that board: its ID or its title", required: true }
1759
- ],
1760
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, column: p.column })
1761
- },
1762
- {
1763
- name: "kanban_remove_card_placement",
1764
- 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.",
1765
- route: "kanban.unplaceCard",
1766
- method: "POST",
1767
- params: [
1768
- { name: "boardId", description: "The board the reference is on", required: true },
1769
- { name: "cardId", description: "The card to remove from that board", required: true }
1770
- ],
1771
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId })
1772
- },
1773
- {
1774
- name: "kanban_get_card_placements",
1775
- 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.",
1776
- route: "kanban.getCardPlacements",
1777
- method: "GET",
1778
- params: [
1779
- { name: "boardId", description: "Any board the card is on", required: true },
1780
- { name: "cardId", description: "The card", required: true }
1781
- ],
1782
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId })
1783
- },
1784
- {
1785
- name: "kanban_add_card",
1786
- description: "Add a new card to a kanban column.",
1787
- route: "kanban.addCard",
1788
- method: "POST",
1789
- params: [
1790
- { name: "boardId", description: "The kanban board ID", required: true },
1791
- { name: "column", description: "Exact name of the target column", required: true },
1792
- { name: "title", description: "Card title", required: true },
1793
- { name: "content", description: "Card content in markdown", required: false }
1794
- ],
1795
- buildInput: (p) => ({ boardId: p.boardId, column: p.column, title: p.title, content: p.content })
1796
- },
1797
- {
1798
- name: "kanban_get_card",
1799
- 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.",
1800
- route: "kanban.getCard",
1801
- method: "GET",
1802
- params: [
1803
- { name: "boardId", description: "The kanban board ID", required: true },
1804
- { name: "cardId", description: "The card ID", required: true }
1805
- ],
1806
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId })
1807
- },
1808
- {
1809
- name: "kanban_update_card",
1810
- 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.",
1811
- route: "kanban.updateCard",
1812
- method: "POST",
1813
- params: [
1814
- { name: "boardId", description: "The kanban board ID", required: true },
1815
- { name: "cardId", description: "The card ID", required: true },
1816
- { name: "title", description: "New title", required: false },
1817
- { name: "content", description: "New card content, in markdown", required: false },
1818
- { name: "priority", description: "Priority from 1 to 10, or null to clear it", required: false },
1819
- { name: "color", description: "Card colour, or null to clear it", required: false },
1820
- { name: "groups", description: "Labels, as a list of strings. Replaces the current ones.", required: false },
1821
- { name: "deadline", description: "Due date as YYYY-MM-DD, or null to clear it", required: false },
1822
- { name: "assignees", description: "User ids to assign, as a list. Replaces the current ones; use kanban_list_members to find the ids.", required: false }
1823
- ],
1824
- buildInput: (p) => ({
1825
- boardId: p.boardId,
1826
- cardId: p.cardId,
1827
- ...p.title !== void 0 ? { title: p.title } : {},
1828
- ...p.content !== void 0 ? { content: p.content } : {},
1829
- // Tout arrive en chaîne : un modèle n'écrit pas des nombres, des listes
1830
- // ni des `null` typés. `clearable` distingue « efface » de « ne touche
1831
- // pas » — sans quoi vider une couleur serait impossible à exprimer, et
1832
- // changer un titre risquerait de vider le reste.
1833
- ...clearable(p.priority, (v) => Number(v), "priority"),
1834
- ...clearable(p.color, (v) => v, "color"),
1835
- ...clearable(p.deadline, (v) => v, "deadline"),
1836
- ...p.groups !== void 0 ? { groups: toList(p.groups) } : {},
1837
- ...p.assignees !== void 0 ? { assignees: toList(p.assignees) } : {}
1838
- })
1839
- },
1840
- {
1841
- name: "kanban_set_card_archived",
1842
- 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.",
1843
- route: "kanban.setCardArchived",
1844
- method: "POST",
1845
- params: [
1846
- { name: "boardId", description: "The kanban board ID", required: true },
1847
- { name: "cardId", description: "The card ID", required: true },
1848
- { name: "archived", description: "true to archive, false to bring the card back", required: true }
1849
- ],
1850
- buildInput: (p) => ({ boardId: p.boardId, cardId: p.cardId, archived: p.archived === "true" })
1851
- },
1852
- {
1853
- name: "kanban_list_members",
1854
- 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.",
1855
- route: "kanban.listMembers",
1856
- method: "GET",
1857
- params: [
1858
- { name: "organizationId", description: "Which organization. Optional: needed only when the account belongs to several and the error message asks for it.", required: false }
1859
- ],
1860
- buildInput: (p) => p.organizationId ? { organizationId: p.organizationId } : {}
1861
- },
1862
- // ─── Lecture seule ───────────────────────────────────────────────────────
1863
- //
1864
- // Tout ce qui se consulte sans rien changer. Les écritures s'ajoutent au cas
1865
- // par cas : aujourd'hui les services et leurs variables, plus bas.
1866
- //
1867
- // Volontairement absentes, et à ne pas ajouter sans y regarder à deux fois,
1868
- // parce qu'elles rendent un secret : `environment.list` / `get` / `resolve` /
1869
- // `resolveFlat` (un `Environment` porte ses variables, valeurs comprises),
1870
- // `apiKeys.list` / `reveal`, `setup.getEncryptionKeyHex` et `getOrgKeys`
1871
- // (clés de chiffrement), `settings.get` et `settings.listAIProviders` (clés
1872
- // de fournisseurs d'IA — `settings.getPaths` et `getNetwork`, eux, ne
1873
- // rendent que des chemins et une adresse, d'où leur présence ci-dessous),
1874
- // `cloudAuth.session`, `agent.getPassthroughEnv`. Un agent n'a pas besoin de
1875
- // ces valeurs pour travailler, et ce qu'il lit finit dans une transcription.
1876
- //
1877
- // La seule exception est `service.getEnv` (`get_service_env` ci-dessous),
1878
- // et elle n'en est une que parce qu'elle filtre : les variables publiques, et
1879
- // les seuls secrets que leur auteur a partagés avec les IA (`isSharedWithAi`
1880
- // — « Lisible par l'IA », ou l'injection, qui vaut la lecture). Un secret non
1881
- // partagé n'y apparaît pas, pas même par son nom.
1882
- {
1883
- name: "list_processes",
1884
- 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.",
1885
- route: "process.list",
1886
- method: "GET",
1887
- params: [],
1888
- buildInput: () => void 0
1889
- },
1890
- {
1891
- name: "get_service",
1892
- transformOutput: maskServices,
1893
- description: "Read the full configuration of one service: its commands, ports, groups, runner, log sources and restart policy. list_services gives the ids.",
1894
- route: "service.get",
1895
- method: "GET",
1896
- params: [
1897
- { name: "serviceId", description: "The service ID", required: true }
1898
- ],
1899
- buildInput: (p) => ({ id: p.serviceId })
1900
- },
1901
- {
1902
- name: "get_service_env",
1903
- 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.',
1904
- route: "service.getEnv",
1905
- method: "GET",
1906
- params: [
1907
- { name: "serviceId", description: "The service ID", required: true },
1908
- { 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 }
1909
- ],
1910
- buildInput: (p) => ({ id: p.serviceId, ...p.environmentId ? { environmentId: p.environmentId } : {} })
1911
- },
1912
- // ─── Écrire un service et ses variables ────────────────────────────────────
1913
- //
1914
- // Les variables s'écrivent à l'aveugle (`environment.setVariableBlind`) : une
1915
- // IA remplace la valeur d'un secret sans la lire, et ne peut ni le rendre
1916
- // public, ni le partager avec les IA. La règle tient côté serveur, dans la
1917
- // route ; ces outils ne passent jamais par une route qui renvoie des valeurs
1918
- // (`upsertVariable`, `removeVariable`, `update` rendent l'environnement entier).
1919
- {
1920
- name: "create_service",
1921
- transformOutput: maskServices,
1922
- 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.",
1923
- route: "service.create",
1924
- method: "POST",
1925
- params: [
1926
- { name: "name", description: "The service name", required: true },
1927
- { 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 },
1928
- { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false },
1929
- ...CREATE_SERVICE_PARAMS
1930
- ],
1931
- buildInput: (p) => {
1932
- const fields = serviceFields(p, CREATE_SERVICE_PARAMS);
1933
- if (fields["runner"] === "docker" && !fields["dockerConfig"]) {
1934
- throw new Error('dockerConfig: required with runner "docker" \u2014 give an "image" or a "dockerfile"');
1935
- }
1936
- return {
1937
- name: p.name,
1938
- ...fields,
1939
- ...p.projectId ? { projectId: p.projectId } : {},
1940
- ...p.orgId ? { orgId: p.orgId } : {}
1941
- };
1942
- }
1943
- },
1944
- {
1945
- name: "add_service_to_project",
1946
- 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.",
1947
- route: "project.addService",
1948
- method: "POST",
1949
- params: [
1950
- { name: "projectId", description: "The project ID, from list_projects", required: true },
1951
- { name: "serviceId", description: "The service ID", required: true },
1952
- { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
1953
- ],
1954
- buildInput: (p) => ({ projectId: p.projectId, serviceId: p.serviceId, ...p.orgId ? { orgId: p.orgId } : {} })
1955
- },
1956
- {
1957
- name: "update_service",
1958
- transformOutput: maskServices,
1959
- 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.",
1960
- route: "service.update",
1961
- method: "POST",
1962
- params: [
1963
- { name: "serviceId", description: "The service ID", required: true },
1964
- { name: "name", description: "New name", required: false },
1965
- { name: "orgId", description: "Move the service to this organization vault. Leave unset unless asked.", required: false, schema: z3.string().max(128).nullable() },
1966
- ...UPDATE_SERVICE_PARAMS
1967
- ],
1968
- buildInput: (p) => ({
1969
- id: p.serviceId,
1970
- ...p.name ? { name: p.name } : {},
1971
- ...p.orgId !== void 0 ? { orgId: parseTyped("orgId", z3.string().max(128).nullable(), p.orgId) } : {},
1972
- ...serviceFields(p, UPDATE_SERVICE_PARAMS)
1973
- })
1974
- },
1975
- {
1976
- name: "list_environments",
1977
- 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.",
1978
- route: "environment.listForAi",
1979
- method: "GET",
1980
- params: [
1981
- { name: "projectId", description: "The project ID: the one your context names, or another from list_projects", required: true },
1982
- { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
1983
- ],
1984
- buildInput: (p) => ({ projectId: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} })
1985
- },
1986
- {
1987
- name: "resolve_environment",
1988
- 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.",
1989
- route: "environment.resolveForAi",
1990
- method: "GET",
1991
- params: [
1992
- { name: "environmentId", description: "The environment, from list_environments", required: true }
1993
- ],
1994
- buildInput: (p) => ({ environmentId: p.environmentId })
1995
- },
1996
- {
1997
- name: "set_environment_variable",
1998
- 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.`,
1999
- route: "environment.setVariableBlind",
2000
- method: "POST",
2001
- params: [
2002
- { name: "environmentId", description: "The environment that holds the variable, from list_environments", required: true },
2003
- { name: "key", description: "The variable name, e.g. DATABASE_URL", required: true },
2004
- { name: "value", description: "The new value, possibly with {{environment.KEY}} references. Omit to leave it unchanged.", required: false },
2005
- { name: "pre", description: 'Text put before the value (e.g. "https://"). Omit to leave it unchanged.', required: false },
2006
- { name: "post", description: 'Text put after the value (e.g. "/api"). Omit to leave it unchanged.', required: false },
2007
- { name: "isSecret", description: '"true" to store it as a secret. On an existing public variable, makes it secret.', required: false },
2008
- { name: "description", description: "What the variable is for, in markdown", required: false }
2009
- ],
2010
- buildInput: (p) => ({
2011
- environmentId: p.environmentId,
2012
- key: p.key,
2013
- ...p.value !== void 0 ? { value: p.value } : {},
2014
- ...p.pre !== void 0 ? { pre: p.pre } : {},
2015
- ...p.post !== void 0 ? { post: p.post } : {},
2016
- ...p.isSecret !== void 0 ? { isSecret: toBool(p.isSecret) } : {},
2017
- ...p.description !== void 0 ? { description: p.description } : {}
2018
- })
2019
- },
2020
- {
2021
- name: "set_environment_inheritance",
2022
- 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.",
2023
- route: "environment.setInheritanceBlind",
2024
- method: "POST",
2025
- params: [
2026
- { name: "environmentId", description: "A service environment (scope service), from list_environments", required: true },
2027
- { name: "inherit", description: '"true" to inherit from the global environment, "false" to isolate', required: true, schema: z3.boolean() }
2028
- ],
2029
- buildInput: (p) => ({ environmentId: p.environmentId, inherit: toBool(p.inherit ?? "true") })
2030
- },
2031
- {
2032
- name: "remove_environment_variable",
2033
- description: "Delete an environment variable, by name, from one environment. Its value is lost.",
2034
- route: "environment.removeVariableBlind",
2035
- method: "POST",
2036
- params: [
2037
- { name: "environmentId", description: "The environment that holds the variable", required: true },
2038
- { name: "key", description: "The variable name", required: true }
2039
- ],
2040
- buildInput: (p) => ({ environmentId: p.environmentId, key: p.key }),
2041
- destructive: true
2042
- },
2043
- {
2044
- name: "get_service_metrics",
2045
- description: "Read the CPU and memory currently used by a running service.",
2046
- route: "process.metrics",
2047
- method: "GET",
2048
- params: [
2049
- { name: "serviceId", description: "The service ID", required: true },
2050
- { name: "agentId", description: "The agent ID hosting this service", required: true }
2051
- ],
2052
- buildInput: (p) => ({ agentId: p.agentId, processId: p.serviceId })
2053
- },
2054
- {
2055
- name: "list_agents",
2056
- description: "List the agents connected to this Runeya, with their status and whether they run on this machine. Passphrases are never returned.",
2057
- route: "agent.list",
2058
- method: "GET",
2059
- params: [],
2060
- buildInput: () => void 0
2061
- },
2062
- {
2063
- name: "list_projects",
2064
- description: "List the projects known to this Runeya, with their ids and the services they hold.",
2065
- route: "project.list",
2066
- method: "GET",
2067
- params: [],
2068
- buildInput: () => void 0
2069
- },
2070
- {
2071
- name: "get_project",
2072
- description: "Read one project: its services, its active environment, its organization.",
2073
- route: "project.get",
2074
- method: "GET",
2075
- params: [
2076
- { name: "projectId", description: "The project ID, from list_projects", required: true },
2077
- { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
2078
- ],
2079
- buildInput: (p) => ({ id: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} })
2080
- },
2081
- {
2082
- name: "list_project_paths",
2083
- description: "Where each project lives on this machine. Use it to find the directory to work in before reading or editing files.",
2084
- route: "project.localPaths",
2085
- method: "GET",
2086
- params: [],
2087
- buildInput: () => void 0
2088
- },
2089
- {
2090
- name: "git_status",
2091
- description: "Read the git working tree of a service or a project: staged, modified and untracked files, current branch, ahead/behind counts.",
2092
- route: "git.status",
2093
- method: "GET",
2094
- params: [
2095
- { name: "serviceId", description: "Target the repository of this service", required: false },
2096
- { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
2097
- { name: "agentId", description: "The agent hosting the repository", required: false },
2098
- { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
2099
- ],
2100
- buildInput: (p) => gitTarget(p)
2101
- },
2102
- {
2103
- name: "git_log",
2104
- description: "Read the recent commits of a service or project repository: hash, author, date, message.",
2105
- route: "git.log",
2106
- method: "GET",
2107
- params: [
2108
- { name: "serviceId", description: "Target the repository of this service", required: false },
2109
- { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
2110
- { name: "agentId", description: "The agent hosting the repository", required: false },
2111
- { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false },
2112
- { name: "limit", description: "How many commits to return (1-200). Default: 50.", required: false }
2113
- ],
2114
- buildInput: (p) => ({ ...gitTarget(p), ...p.limit ? { limit: Number(p.limit) } : {} })
2115
- },
2116
- {
2117
- name: "git_branches",
2118
- description: "List the local and remote branches of a service or project repository.",
2119
- route: "git.branches",
2120
- method: "GET",
2121
- params: [
2122
- { name: "serviceId", description: "Target the repository of this service", required: false },
2123
- { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
2124
- { name: "agentId", description: "The agent hosting the repository", required: false },
2125
- { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
2126
- ],
2127
- buildInput: (p) => gitTarget(p)
2128
- },
2129
- {
2130
- name: "git_diff",
2131
- 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.",
2132
- route: "git.diff",
2133
- method: "GET",
2134
- params: [
2135
- { name: "serviceId", description: "Target the repository of this service", required: false },
2136
- { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
2137
- { name: "agentId", description: "The agent hosting the repository", required: false },
2138
- { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false },
2139
- { name: "path", description: "Restrict the diff to this file path", required: false },
2140
- { name: "staged", description: 'Set to "true" to read the staged diff instead of the working tree', required: false },
2141
- { name: "untracked", description: 'Set to "true" to include untracked files', required: false }
2142
- ],
2143
- buildInput: (p) => ({
2144
- ...gitTarget(p),
2145
- ...p.path ? { path: p.path } : {},
2146
- ...p.staged !== void 0 ? { staged: p.staged === "true" } : {},
2147
- ...p.untracked !== void 0 ? { untracked: p.untracked === "true" } : {}
2148
- })
2149
- },
2150
- {
2151
- name: "list_docs",
2152
- 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.",
2153
- route: "wiki.list",
2154
- method: "GET",
2155
- params: [
2156
- { name: "scope", description: `"global" for this Runeya, or "service:<serviceId>" for one service's repository`, required: true }
2157
- ],
2158
- buildInput: (p) => ({ scope: p.scope })
2159
- },
2160
- {
2161
- name: "read_doc",
2162
- description: "Read one markdown documentation file. Paths come from list_docs; only .md and .markdown can be read.",
2163
- route: "wiki.read",
2164
- method: "GET",
2165
- params: [
2166
- { name: "scope", description: `"global" for this Runeya, or "service:<serviceId>" for one service's repository`, required: true },
2167
- { name: "path", description: "Relative path of the file, as returned by list_docs", required: true }
2168
- ],
2169
- buildInput: (p) => ({ scope: p.scope, path: p.path })
2170
- },
2171
- {
2172
- name: "get_server_logs",
2173
- 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.",
2174
- route: "diagnostics.recentLogs",
2175
- method: "GET",
2176
- params: [
2177
- { name: "limit", description: "How many entries to return (1-2000). Default: 500.", required: false }
2178
- ],
2179
- buildInput: (p) => p.limit ? { limit: Number(p.limit) } : void 0
2180
- },
2181
- {
2182
- name: "get_kanban_queue_state",
2183
- 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.",
2184
- route: "kanbanQueue.getState",
2185
- method: "GET",
2186
- params: [],
2187
- buildInput: () => void 0
2188
- },
2189
- {
2190
- name: "export_project",
2191
- 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.",
2192
- route: "project.export",
2193
- method: "GET",
2194
- params: [
2195
- { name: "projectId", description: "The project ID, from list_projects", required: true },
2196
- { name: "orgId", description: "Its organization. Needed only when the same project id exists in several.", required: false }
2197
- ],
2198
- buildInput: (p) => ({ id: p.projectId, ...p.orgId ? { orgId: p.orgId } : {} })
2199
- },
2200
- {
2201
- name: "git_remotes",
2202
- description: "List the git remotes of a service or project repository, with their URLs.",
2203
- route: "git.remotes",
2204
- method: "GET",
2205
- params: [
2206
- { name: "serviceId", description: "Target the repository of this service", required: false },
2207
- { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
2208
- { name: "agentId", description: "The agent hosting the repository", required: false },
2209
- { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
2210
- ],
2211
- buildInput: (p) => gitTarget(p)
2212
- },
2213
- {
2214
- name: "git_stash_list",
2215
- description: "List the stashes of a service or project repository. Useful before assuming work was lost: it may simply be stashed.",
2216
- route: "git.stashList",
2217
- method: "GET",
2218
- params: [
2219
- { name: "serviceId", description: "Target the repository of this service", required: false },
2220
- { name: "projectId", description: "Target the repository of this project, when no service is given", required: false },
2221
- { name: "agentId", description: "The agent hosting the repository", required: false },
2222
- { name: "orgId", description: "Its organization, when a project id alone is ambiguous", required: false }
2223
- ],
2224
- buildInput: (p) => gitTarget(p)
2225
- },
2226
- {
2227
- name: "get_runeya_version",
2228
- 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.",
2229
- route: "health.versionInfo",
2230
- method: "GET",
2231
- params: [],
2232
- buildInput: () => void 0
2233
- },
2234
- {
2235
- name: "get_runeya_paths",
2236
- description: "Read where Runeya keeps its things on this machine: its launch directory, its data directory, and the machine-wide directory holding cloud projects.",
2237
- route: "settings.getPaths",
2238
- method: "GET",
2239
- params: [],
2240
- buildInput: () => void 0
2241
- },
2242
- {
2243
- name: "get_network_info",
2244
- 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.",
2245
- route: "settings.getNetwork",
2246
- method: "GET",
2247
- params: [],
2248
- buildInput: () => void 0
2249
- },
2250
- {
2251
- name: "list_runeya_instances",
2252
- 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.",
2253
- route: "diagnostics.instances",
2254
- method: "GET",
2255
- params: [],
2256
- buildInput: () => void 0
2257
- },
2258
- {
2259
- name: "get_cloud_status",
2260
- 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.",
2261
- route: "cloudAuth.status",
2262
- method: "GET",
2263
- params: [],
2264
- buildInput: () => void 0
2265
- }
2266
- ];
2267
-
2268
- // ../../packages/ai-capabilities/src/adapters/json-schema.ts
2269
- import { z as z4 } from "zod";
2270
- function paramJsonSchema(param) {
2271
- if (!param.schema) return { type: "string", description: param.description };
2272
- const { $schema: _ignored, ...schema } = z4.toJSONSchema(param.schema, { io: "input", unrepresentable: "any" });
2273
- return { ...schema, description: param.description };
2274
- }
2275
-
2276
- // ../../packages/ai-capabilities/src/adapters/anthropic.ts
2277
- function buildAnthropicTools(capabilities) {
2278
- return capabilities.map((cap) => ({
2279
- name: cap.name,
2280
- description: cap.description,
2281
- input_schema: {
2282
- type: "object",
2283
- properties: Object.fromEntries(
2284
- cap.params.map((p) => [p.name, paramJsonSchema(p)])
2285
- ),
2286
- required: cap.params.filter((p) => p.required).map((p) => p.name)
2287
- }
2288
- }));
2289
- }
2290
-
2291
- // ../../packages/ai-capabilities/src/adapters/openai.ts
2292
- function buildOpenAITools(capabilities) {
2293
- return capabilities.map((cap) => ({
2294
- type: "function",
2295
- function: {
2296
- name: cap.name,
2297
- description: cap.description,
2298
- parameters: {
2299
- type: "object",
2300
- properties: Object.fromEntries(
2301
- cap.params.map((p) => [p.name, paramJsonSchema(p)])
2302
- ),
2303
- required: cap.params.filter((p) => p.required).map((p) => p.name)
2304
- }
2305
- }
2306
- }));
2307
- }
2308
-
2309
- // ../../packages/ai-capabilities/src/adapters/prompt.ts
2310
- function buildToolSafetyInstruction(capabilities) {
2311
- const destructive = capabilities.filter((c) => c.destructive).map((c) => c.name);
2312
- const withHints = capabilities.filter((c) => c.usageHint);
2313
- const lines = ["## Tool use safety rules"];
2314
- if (destructive.length > 0) {
2315
- lines.push(`CRITICAL: Never call ${destructive.join(", ")} unless the user has EXPLICITLY and UNAMBIGUOUSLY requested it.`);
2316
- lines.push(`- Only call destructive tools (${destructive.join(", ")}) when the user explicitly uses action words for a specific service.`);
2317
- }
2318
- if (withHints.length > 0) {
2319
- lines.push("");
2320
- lines.push("## Tool usage hints");
2321
- for (const cap of withHints) {
2322
- lines.push(`- ${cap.usageHint}`);
2323
- }
2324
- }
2325
- return lines.join("\n");
2326
- }
2327
-
2328
- // ../../packages/ai-capabilities/src/adapters/mcp.ts
2329
- import { z as z5 } from "zod";
2330
- function toRawParams(input, cap) {
2331
- const typed = new Set(cap?.params.filter((p) => p.schema).map((p) => p.name));
2332
- return Object.fromEntries(Object.entries(input).map(([k, v]) => [
2333
- k,
2334
- v === null && typed.has(k) ? "null" : v == null ? void 0 : typeof v === "object" ? JSON.stringify(v) : String(v)
2335
- ]));
2336
- }
2337
-
2338
- // ../../packages/ai-capabilities/src/trpc-caller.ts
2339
- async function callTrpc(baseUrl, route, method, input, authToken, fetchImpl = fetch) {
2340
- const headers = {
2341
- "Content-Type": "application/json",
2342
- "Authorization": `Bearer ${authToken}`
2343
- };
2344
- const url = method === "GET" && input ? `${baseUrl}/api/trpc/${route}?input=${encodeURIComponent(JSON.stringify(input))}` : `${baseUrl}/api/trpc/${route}`;
2345
- const res = await fetchImpl(url, {
2346
- method,
2347
- headers,
2348
- ...method === "POST" ? { body: JSON.stringify(input ?? {}) } : {},
2349
- signal: AbortSignal.timeout(15e3)
2350
- });
2351
- const json = await res.json();
2352
- if (json["error"]) throw new Error(JSON.stringify(json["error"]));
2353
- const result = json["result"];
2354
- return result?.["data"] ?? result ?? json;
2355
- }
2356
- async function runCapability(cap, baseUrl, params, authToken, fetchImpl = fetch) {
2357
- const result = await callTrpc(baseUrl, cap.route, cap.method, cap.buildInput(params), authToken, fetchImpl);
2358
- return cap.transformOutput ? cap.transformOutput(result) : result;
2359
- }
2360
-
2361
- // ../../packages/ai-capabilities/src/project-anchor.ts
2362
- function applyProjectAnchor(cap, params, anchor) {
2363
- const accepts = (name) => cap.params.some((p) => p.name === name);
2364
- const anchored = { ...params };
2365
- const mayAnchorOrg = !params["projectId"] || params["projectId"] === anchor.projectId;
2366
- if (anchor.projectId && accepts("projectId") && !anchored["projectId"]) {
2367
- anchored["projectId"] = anchor.projectId;
2368
- }
2369
- if (mayAnchorOrg && anchor.orgId && !anchored["orgId"] && accepts("orgId")) {
2370
- anchored["orgId"] = anchor.orgId;
2371
- }
2372
- if (mayAnchorOrg && anchor.orgId && !anchored["organizationId"] && accepts("organizationId")) {
2373
- anchored["organizationId"] = anchor.orgId;
2374
- }
2375
- return anchored;
2376
- }
2377
-
2378
1401
  // ../server/src/services/llms-txt-generator.ts
2379
1402
  function generateAdminLlmsTxt(services, jwt, project) {
2380
1403
  const lines = [];
@@ -2584,7 +1607,7 @@ async function executeTool(rawName, input, apiKey, authToken, anchor = {}) {
2584
1607
  }
2585
1608
 
2586
1609
  // ../server/src/trpc/routers/service.ts
2587
- import { z as z6 } from "zod";
1610
+ import { z as z3 } from "zod";
2588
1611
  import { TRPCError as TRPCError2 } from "@trpc/server";
2589
1612
 
2590
1613
  // ../server/src/services/audit-service.ts
@@ -2977,7 +2000,7 @@ async function resolveServiceVariables(service, opts = {}) {
2977
2000
  }
2978
2001
  return resolvedService;
2979
2002
  }
2980
- var DockerConfigInput2 = DockerConfigSchema;
2003
+ var DockerConfigInput = DockerConfigSchema;
2981
2004
  var serviceRouter = router({
2982
2005
  /**
2983
2006
  * Sans filtre, la réponse couvre TOUT le poste : `serviceStore.list()` rend
@@ -2994,10 +2017,10 @@ var serviceRouter = router({
2994
2017
  * silencieux ferait croire au filtrage tout en rendant les services des
2995
2018
  * autres organisations.
2996
2019
  */
2997
- list: protectedProcedure.meta({ openapi: { method: "GET", path: "/services", tags: ["services"], summary: "List services (every project of the machine unless narrowed by project or organization)", protect: true } }).input(z6.object({
2998
- projectId: z6.string().max(128).optional(),
2999
- orgId: z6.string().max(128).nullable().optional()
3000
- }).optional()).output(z6.any()).query(async ({ input, ctx }) => {
2020
+ list: protectedProcedure.meta({ openapi: { method: "GET", path: "/services", tags: ["services"], summary: "List services (every project of the machine unless narrowed by project or organization)", protect: true } }).input(z3.object({
2021
+ projectId: z3.string().max(128).optional(),
2022
+ orgId: z3.string().max(128).nullable().optional()
2023
+ }).optional()).output(z3.any()).query(async ({ input, ctx }) => {
3001
2024
  const all = await serviceStore.list();
3002
2025
  const allowedIds = getAllowedServiceIds(ctx);
3003
2026
  let filtered = allowedIds ? all.filter((s) => allowedIds.has(s.id)) : all;
@@ -3017,7 +2040,7 @@ var serviceRouter = router({
3017
2040
  effectiveAgentId: await resolveEffectiveAgentId(s)
3018
2041
  })));
3019
2042
  }),
3020
- get: protectedProcedure.meta({ openapi: { method: "GET", path: "/services/{id}", tags: ["services"], summary: "Get a service by ID", protect: true } }).input(z6.object({ id: z6.string().max(128) })).output(z6.any()).query(async ({ input, ctx }) => {
2043
+ get: protectedProcedure.meta({ openapi: { method: "GET", path: "/services/{id}", tags: ["services"], summary: "Get a service by ID", protect: true } }).input(z3.object({ id: z3.string().max(128) })).output(z3.any()).query(async ({ input, ctx }) => {
3021
2044
  requireServiceAction(ctx, input.id, "service:read");
3022
2045
  const service = await serviceStore.get(input.id);
3023
2046
  if (!service) {
@@ -3043,11 +2066,11 @@ var serviceRouter = router({
3043
2066
  * valeurs** — où chacune est définie, ce que ses cases disent, et si ce
3044
2067
  * service la reçoit. Sans lui, un agent lisait l'effet sans la cause.
3045
2068
  */
3046
- getEnv: protectedProcedure.meta({ openapi: { method: "GET", path: "/services/{id}/env", tags: ["services"], summary: "Get a service's environment variables (unshared secrets masked) plus the project's value-free variable inventory", protect: true } }).input(z6.object({
3047
- id: z6.string().max(128),
2069
+ getEnv: protectedProcedure.meta({ openapi: { method: "GET", path: "/services/{id}/env", tags: ["services"], summary: "Get a service's environment variables (unshared secrets masked) plus the project's value-free variable inventory", protect: true } }).input(z3.object({
2070
+ id: z3.string().max(128),
3048
2071
  // Un environnement global du projet où résoudre, sans l'activer. Absent : l'actif.
3049
- environmentId: z6.string().max(128).optional()
3050
- })).output(z6.any()).query(async ({ input, ctx }) => {
2072
+ environmentId: z3.string().max(128).optional()
2073
+ })).output(z3.any()).query(async ({ input, ctx }) => {
3051
2074
  requireServiceAction(ctx, input.id, "service:read");
3052
2075
  const service = await serviceStore.get(input.id);
3053
2076
  if (!service) {
@@ -3094,38 +2117,38 @@ var serviceRouter = router({
3094
2117
  variables
3095
2118
  };
3096
2119
  }),
3097
- create: protectedProcedure.meta({ openapi: { method: "POST", path: "/services", tags: ["services"], summary: "Create a new service", protect: true } }).output(z6.any()).input(
3098
- z6.object({
3099
- agentId: z6.string().max(128).optional(),
3100
- name: z6.string().min(1).max(200),
3101
- commands: z6.array(ServiceCommandSchema).max(50).optional(),
3102
- cwd: z6.string().max(4096).optional(),
3103
- ports: z6.array(z6.number().int().min(1).max(65535)).max(20).optional(),
3104
- groups: z6.array(z6.string().max(200)).max(20).optional(),
3105
- description: z6.string().max(2e3).optional(),
3106
- docsPath: z6.string().max(4096).optional(),
3107
- url: z6.string().max(2048).optional(),
3108
- localUrls: z6.array(z6.object({
3109
- url: z6.string().max(253),
3110
- port: z6.number().int().min(1).max(65535)
2120
+ create: protectedProcedure.meta({ openapi: { method: "POST", path: "/services", tags: ["services"], summary: "Create a new service", protect: true } }).output(z3.any()).input(
2121
+ z3.object({
2122
+ agentId: z3.string().max(128).optional(),
2123
+ name: z3.string().min(1).max(200),
2124
+ commands: z3.array(ServiceCommandSchema).max(50).optional(),
2125
+ cwd: z3.string().max(4096).optional(),
2126
+ ports: z3.array(z3.number().int().min(1).max(65535)).max(20).optional(),
2127
+ groups: z3.array(z3.string().max(200)).max(20).optional(),
2128
+ description: z3.string().max(2e3).optional(),
2129
+ docsPath: z3.string().max(4096).optional(),
2130
+ url: z3.string().max(2048).optional(),
2131
+ localUrls: z3.array(z3.object({
2132
+ url: z3.string().max(253),
2133
+ port: z3.number().int().min(1).max(65535)
3111
2134
  })).max(20).optional(),
3112
- openapiUrl: z6.string().max(2048).optional(),
3113
- git: z6.object({ remote: z6.string().max(2048).optional(), home: z6.string().max(2048).optional() }).optional(),
3114
- meta: z6.record(z6.string().max(256), z6.string().max(2e3)).optional().refine((obj) => !obj || Object.keys(obj).length <= 100, { message: "Too many meta keys (max 100)" }),
3115
- runner: z6.enum(["native", "docker"]).optional().default("native"),
3116
- dockerConfig: DockerConfigInput2.optional(),
2135
+ openapiUrl: z3.string().max(2048).optional(),
2136
+ git: z3.object({ remote: z3.string().max(2048).optional(), home: z3.string().max(2048).optional() }).optional(),
2137
+ meta: z3.record(z3.string().max(256), z3.string().max(2e3)).optional().refine((obj) => !obj || Object.keys(obj).length <= 100, { message: "Too many meta keys (max 100)" }),
2138
+ runner: z3.enum(["native", "docker"]).optional().default("native"),
2139
+ dockerConfig: DockerConfigInput.optional(),
3117
2140
  healthCheck: HealthCheckSchema.optional(),
3118
- autoRestart: z6.boolean().optional().default(false),
3119
- clearLogsOnStart: z6.boolean().optional(),
2141
+ autoRestart: z3.boolean().optional().default(false),
2142
+ clearLogsOnStart: z3.boolean().optional(),
3120
2143
  restartStrategy: RestartStrategySchema.optional(),
3121
- maxRestarts: z6.number().int().nonnegative().optional(),
3122
- restartBackoffMs: z6.number().int().positive().optional().default(1e3),
3123
- orgId: z6.string().max(128).nullable().optional(),
3124
- logSources: z6.array(LogSourceConfigSchema).max(20).optional(),
2144
+ maxRestarts: z3.number().int().nonnegative().optional(),
2145
+ restartBackoffMs: z3.number().int().positive().optional().default(1e3),
2146
+ orgId: z3.string().max(128).nullable().optional(),
2147
+ logSources: z3.array(LogSourceConfigSchema).max(20).optional(),
3125
2148
  // Le projet qui va l'adopter : le service naît dans son coffre.
3126
- projectId: z6.string().max(128).optional(),
3127
- shortcuts: z6.array(ServiceShortcutSchema).max(50).optional(),
3128
- parserIds: z6.array(z6.string().max(128)).max(50).optional()
2149
+ projectId: z3.string().max(128).optional(),
2150
+ shortcuts: z3.array(ServiceShortcutSchema).max(50).optional(),
2151
+ parserIds: z3.array(z3.string().max(128)).max(50).optional()
3129
2152
  })
3130
2153
  ).mutation(async ({ input }) => {
3131
2154
  if (input.agentId) {
@@ -3151,38 +2174,38 @@ var serviceRouter = router({
3151
2174
  await auditService.log({ userId: "local", action: "create", entityType: "service", entityId: service.id, metadata: { name: input.name } });
3152
2175
  return service;
3153
2176
  }),
3154
- update: protectedProcedure.meta({ openapi: { method: "PATCH", path: "/services/{id}", tags: ["services"], summary: "Update a service", protect: true } }).output(z6.any()).input(
3155
- z6.object({
3156
- id: z6.string().max(128),
3157
- agentId: z6.string().max(128).nullable().optional(),
2177
+ update: protectedProcedure.meta({ openapi: { method: "PATCH", path: "/services/{id}", tags: ["services"], summary: "Update a service", protect: true } }).output(z3.any()).input(
2178
+ z3.object({
2179
+ id: z3.string().max(128),
2180
+ agentId: z3.string().max(128).nullable().optional(),
3158
2181
  // null = clear (inherit from env)
3159
- name: z6.string().min(1).max(200).optional(),
3160
- commands: z6.array(ServiceCommandSchema).max(50).optional(),
3161
- cwd: z6.string().max(4096).nullable().optional(),
3162
- ports: z6.array(z6.number().int().min(1).max(65535)).max(20).optional(),
3163
- groups: z6.array(z6.string().max(200)).max(20).optional(),
3164
- description: z6.string().max(2e3).optional(),
3165
- docsPath: z6.string().max(4096).optional(),
3166
- url: z6.string().max(2048).optional(),
3167
- localUrls: z6.array(z6.object({
3168
- url: z6.string().max(253),
3169
- port: z6.number().int().min(1).max(65535)
2182
+ name: z3.string().min(1).max(200).optional(),
2183
+ commands: z3.array(ServiceCommandSchema).max(50).optional(),
2184
+ cwd: z3.string().max(4096).nullable().optional(),
2185
+ ports: z3.array(z3.number().int().min(1).max(65535)).max(20).optional(),
2186
+ groups: z3.array(z3.string().max(200)).max(20).optional(),
2187
+ description: z3.string().max(2e3).optional(),
2188
+ docsPath: z3.string().max(4096).optional(),
2189
+ url: z3.string().max(2048).optional(),
2190
+ localUrls: z3.array(z3.object({
2191
+ url: z3.string().max(253),
2192
+ port: z3.number().int().min(1).max(65535)
3170
2193
  })).max(20).optional(),
3171
- openapiUrl: z6.string().max(2048).optional(),
3172
- git: z6.object({ remote: z6.string().max(2048).optional(), home: z6.string().max(2048).optional() }).nullable().optional(),
3173
- meta: z6.record(z6.string().max(256), z6.string().max(2e3)).nullable().optional().refine((obj) => !obj || Object.keys(obj).length <= 100, { message: "Too many meta keys (max 100)" }),
3174
- runner: z6.enum(["native", "docker"]).optional(),
3175
- dockerConfig: DockerConfigInput2.optional(),
2194
+ openapiUrl: z3.string().max(2048).optional(),
2195
+ git: z3.object({ remote: z3.string().max(2048).optional(), home: z3.string().max(2048).optional() }).nullable().optional(),
2196
+ meta: z3.record(z3.string().max(256), z3.string().max(2e3)).nullable().optional().refine((obj) => !obj || Object.keys(obj).length <= 100, { message: "Too many meta keys (max 100)" }),
2197
+ runner: z3.enum(["native", "docker"]).optional(),
2198
+ dockerConfig: DockerConfigInput.optional(),
3176
2199
  healthCheck: HealthCheckSchema.nullable().optional(),
3177
- autoRestart: z6.boolean().optional(),
3178
- clearLogsOnStart: z6.boolean().optional(),
2200
+ autoRestart: z3.boolean().optional(),
2201
+ clearLogsOnStart: z3.boolean().optional(),
3179
2202
  restartStrategy: RestartStrategySchema.optional(),
3180
- maxRestarts: z6.number().int().nonnegative().optional(),
3181
- restartBackoffMs: z6.number().int().positive().optional(),
3182
- orgId: z6.string().max(128).nullable().optional(),
3183
- shortcuts: z6.array(ServiceShortcutSchema).max(50).optional(),
3184
- parserIds: z6.array(z6.string().max(128)).max(50).optional(),
3185
- logSources: z6.array(LogSourceConfigSchema).max(20).optional()
2203
+ maxRestarts: z3.number().int().nonnegative().optional(),
2204
+ restartBackoffMs: z3.number().int().positive().optional(),
2205
+ orgId: z3.string().max(128).nullable().optional(),
2206
+ shortcuts: z3.array(ServiceShortcutSchema).max(50).optional(),
2207
+ parserIds: z3.array(z3.string().max(128)).max(50).optional(),
2208
+ logSources: z3.array(LogSourceConfigSchema).max(20).optional()
3186
2209
  })
3187
2210
  ).mutation(async ({ input }) => {
3188
2211
  const existing = await serviceStore.get(input.id);
@@ -3238,7 +2261,7 @@ var serviceRouter = router({
3238
2261
  await auditService.log({ userId: "local", action: "update", entityType: "service", entityId: input.id });
3239
2262
  return { ...service, effectiveAgentId: await resolveEffectiveAgentId(service), stoppedForAgentChange };
3240
2263
  }),
3241
- delete: protectedProcedure.meta({ openapi: { method: "DELETE", path: "/services/{id}", tags: ["services"], summary: "Delete a service", protect: true } }).input(z6.object({ id: z6.string().max(128) })).output(z6.object({ success: z6.literal(true) })).mutation(async ({ input }) => {
2264
+ delete: protectedProcedure.meta({ openapi: { method: "DELETE", path: "/services/{id}", tags: ["services"], summary: "Delete a service", protect: true } }).input(z3.object({ id: z3.string().max(128) })).output(z3.object({ success: z3.literal(true) })).mutation(async ({ input }) => {
3242
2265
  const deleted = await serviceStore.delete(input.id);
3243
2266
  if (!deleted) {
3244
2267
  throw new TRPCError2({ code: "NOT_FOUND", message: `Service ${input.id} not found` });
@@ -3246,7 +2269,7 @@ var serviceRouter = router({
3246
2269
  await auditService.log({ userId: "local", action: "delete", entityType: "service", entityId: input.id });
3247
2270
  return { success: true };
3248
2271
  }),
3249
- checkCwd: protectedProcedure.input(z6.object({ id: z6.string().max(128), checkReachability: z6.boolean().optional() })).query(async ({ input }) => {
2272
+ checkCwd: protectedProcedure.input(z3.object({ id: z3.string().max(128), checkReachability: z3.boolean().optional() })).query(async ({ input }) => {
3250
2273
  const service = await serviceStore.get(input.id);
3251
2274
  if (!service) {
3252
2275
  throw new TRPCError2({ code: "NOT_FOUND", message: `Service ${input.id} not found` });
@@ -3279,7 +2302,7 @@ var serviceRouter = router({
3279
2302
  }
3280
2303
  return { exists, canClone, unresolvedVars: [], resolvedCwd, gitMismatch };
3281
2304
  }),
3282
- cloneRepository: protectedProcedure.input(z6.object({ id: z6.string().max(128) })).mutation(async ({ input }) => {
2305
+ cloneRepository: protectedProcedure.input(z3.object({ id: z3.string().max(128) })).mutation(async ({ input }) => {
3283
2306
  const service = await serviceStore.get(input.id);
3284
2307
  if (!service) {
3285
2308
  throw new TRPCError2({ code: "NOT_FOUND", message: `Service ${input.id} not found` });
@@ -3683,9 +2706,9 @@ async function fetchProviderModels(provider, plaintextKey) {
3683
2706
  async function vaultOfProject(projectId) {
3684
2707
  if (!projectId) return void 0;
3685
2708
  await ensureProjectsLoaded();
3686
- const refs2 = refsOfProjectId(projectId);
3687
- if (refs2.length !== 1) return void 0;
3688
- return refs2[0]?.orgId ?? void 0;
2709
+ const refs = refsOfProjectId(projectId);
2710
+ if (refs.length !== 1) return void 0;
2711
+ return refs[0]?.orgId ?? void 0;
3689
2712
  }
3690
2713
 
3691
2714
  // ../server/src/services/image-storage.service.ts
@@ -3874,7 +2897,7 @@ async function resolveImagesToBase64(images, contextId) {
3874
2897
  }
3875
2898
 
3876
2899
  // ../server/src/trpc/routers/cloud-auth.ts
3877
- import { z as z8 } from "zod";
2900
+ import { z as z5 } from "zod";
3878
2901
  import { hostname } from "os";
3879
2902
  import { basename } from "path";
3880
2903
  import { TRPCError as TRPCError3 } from "@trpc/server";
@@ -4131,12 +3154,12 @@ var cloudSessionStore = new CloudSessionStore();
4131
3154
  import { networkInterfaces } from "os";
4132
3155
  import { readFile as readFile7, writeFile as writeFile4, mkdir as mkdir6 } from "fs/promises";
4133
3156
  import { join as join6 } from "path";
4134
- import { z as z7 } from "zod";
3157
+ import { z as z4 } from "zod";
4135
3158
  var LOOPBACK2 = "127.0.0.1";
4136
3159
  var ANY = "0.0.0.0";
4137
3160
  var NETWORK_FILE = "network.json";
4138
- var NetworkFileSchema = z7.object({
4139
- instances: z7.record(z7.string(), z7.object({ lanEnabled: z7.boolean().default(false) })).default({})
3161
+ var NetworkFileSchema = z4.object({
3162
+ instances: z4.record(z4.string(), z4.object({ lanEnabled: z4.boolean().default(false) })).default({})
4140
3163
  });
4141
3164
  var httpServer = null;
4142
3165
  function instanceKey() {
@@ -4261,12 +3284,12 @@ function getCloudApiUrl() {
4261
3284
  return (env.CLOUD_URL ?? DEFAULT_CLOUD_API_URL).replace(/\/+$/, "");
4262
3285
  }
4263
3286
  async function orgCloudUrl(orgId) {
4264
- const { readOrgClouds } = await import("./vault-resolver-PN3TYCLJ.js");
3287
+ const { readOrgClouds } = await import("./vault-resolver-E7KPKA5C.js");
4265
3288
  const clouds = await readOrgClouds();
4266
3289
  return (clouds[orgId] ?? getCloudApiUrl()).replace(/\/+$/, "");
4267
3290
  }
4268
3291
  async function accountForOrg(orgId) {
4269
- const { readOrgAccounts, readOrgClouds } = await import("./vault-resolver-PN3TYCLJ.js");
3292
+ const { readOrgAccounts, readOrgClouds } = await import("./vault-resolver-E7KPKA5C.js");
4270
3293
  const [stampedAccounts, stampedClouds, accounts] = await Promise.all([
4271
3294
  readOrgAccounts(),
4272
3295
  readOrgClouds(),
@@ -4429,15 +3452,15 @@ function isAllowedProxyPath(path) {
4429
3452
  const [pathname] = path.split("?");
4430
3453
  return PROXY_PREFIXES.some((p) => pathname === p || pathname.startsWith(p));
4431
3454
  }
4432
- var ScopeSchema = z8.object({
4433
- accountId: z8.string().min(1).max(64)
3455
+ var ScopeSchema = z5.object({
3456
+ accountId: z5.string().min(1).max(64)
4434
3457
  });
4435
3458
  function scopeOf(input) {
4436
3459
  return { accountId: input.accountId };
4437
3460
  }
4438
3461
  var cloudAuthRouter = router({
4439
3462
  /** Build the cloud authorization URL to open in the browser. */
4440
- startLogin: protectedProcedure.input(z8.object({ returnTo: z8.string().url().max(2048) })).mutation(async ({ input }) => {
3463
+ startLogin: protectedProcedure.input(z5.object({ returnTo: z5.string().url().max(2048) })).mutation(async ({ input }) => {
4441
3464
  const callback = callbackForReturnTo(input.returnTo);
4442
3465
  if (!callback) {
4443
3466
  throw new TRPCError3({
@@ -4475,7 +3498,7 @@ var cloudAuthRouter = router({
4475
3498
  * `null` quand rien ne rattache cette organisation à un compte de ce poste :
4476
3499
  * l'interface l'affiche comme déconnectée, ce qu'elle est.
4477
3500
  */
4478
- accountForOrg: protectedProcedure.input(z8.object({ orgId: z8.string().min(1).max(128) })).query(async ({ input }) => ({ accountId: await accountForOrg(input.orgId) })),
3501
+ accountForOrg: protectedProcedure.input(z5.object({ orgId: z5.string().min(1).max(128) })).query(async ({ input }) => ({ accountId: await accountForOrg(input.orgId) })),
4479
3502
  /**
4480
3503
  * Les comptes liés à ce poste, et l'organisation dont chacun répond.
4481
3504
  *
@@ -4483,7 +3506,7 @@ var cloudAuthRouter = router({
4483
3506
  * du projet ouvert, sous quel compte il se synchronise.
4484
3507
  */
4485
3508
  accounts: protectedProcedure.query(async () => {
4486
- const { readOrgAccounts } = await import("./vault-resolver-PN3TYCLJ.js");
3509
+ const { readOrgAccounts } = await import("./vault-resolver-E7KPKA5C.js");
4487
3510
  return { accounts: await cloudSessionStore.list(), orgAccounts: await readOrgAccounts() };
4488
3511
  }),
4489
3512
  /** The cloud session (user + org), fetched with the stored token. */
@@ -4501,7 +3524,7 @@ var cloudAuthRouter = router({
4501
3524
  const identity = await readCloudIdentity(account.cloudUrl, await cloudSessionStore.getToken(accountId) ?? "");
4502
3525
  if (identity) {
4503
3526
  const settled = await cloudSessionStore.describe(accountId, identity);
4504
- const { renameOrgAccount } = await import("./vault-resolver-PN3TYCLJ.js");
3527
+ const { renameOrgAccount } = await import("./vault-resolver-E7KPKA5C.js");
4505
3528
  await renameOrgAccount(accountId, settled);
4506
3529
  }
4507
3530
  }
@@ -4531,7 +3554,7 @@ var cloudAuthRouter = router({
4531
3554
  * drops the session, and the local token is dropped here too, so nothing is
4532
3555
  * left holding a dead credential.
4533
3556
  */
4534
- revokeDevice: protectedProcedure.input(ScopeSchema.extend({ id: z8.string().min(1).max(128) })).mutation(async ({ input }) => {
3557
+ revokeDevice: protectedProcedure.input(ScopeSchema.extend({ id: z5.string().min(1).max(128) })).mutation(async ({ input }) => {
4535
3558
  const { accountId } = input;
4536
3559
  if (!accountId) throw new TRPCError3({ code: "PRECONDITION_FAILED", message: "No cloud account for this scope." });
4537
3560
  const res = await cloudFetch2("/api/auth/device/revoke", {
@@ -4554,17 +3577,17 @@ var cloudAuthRouter = router({
4554
3577
  * the cloud: the web UI asks its own server, which holds the credential.
4555
3578
  */
4556
3579
  proxy: protectedProcedure.input(
4557
- z8.object({
4558
- path: z8.string().min(1).max(512),
4559
- method: z8.enum(["GET", "POST"]).default("GET"),
4560
- query: z8.record(z8.string().max(128), z8.string().max(2048)).optional(),
4561
- body: z8.unknown().optional(),
3580
+ z5.object({
3581
+ path: z5.string().min(1).max(512),
3582
+ method: z5.enum(["GET", "POST"]).default("GET"),
3583
+ query: z5.record(z5.string().max(128), z5.string().max(2048)).optional(),
3584
+ body: z5.unknown().optional(),
4562
3585
  // Obligatoire, et seul : c'est la porte par laquelle passent tous les
4563
3586
  // appels cloud de l'interface. La laisser optionnelle est ce qui a
4564
3587
  // permis aux composables partagées de n'envoyer aucune portée pendant
4565
3588
  // trente routes, et au serveur de retomber sur « le compte unique du
4566
3589
  // poste » — muet dès qu'il y en a eu deux.
4567
- accountId: z8.string().min(1).max(64)
3590
+ accountId: z5.string().min(1).max(64)
4568
3591
  })
4569
3592
  ).mutation(async ({ input }) => {
4570
3593
  if (!isAllowedProxyPath(input.path)) {
@@ -5431,7 +4454,7 @@ function tailTranscript(opts) {
5431
4454
 
5432
4455
  // ../server/src/services/ai-runners/claude-pty-runner.ts
5433
4456
  async function getAgentManager() {
5434
- const { agentManager: agentManager2 } = await import("./agent-manager-THV3LJOF.js");
4457
+ const { agentManager: agentManager2 } = await import("./agent-manager-R7BPQO6D.js");
5435
4458
  return agentManager2;
5436
4459
  }
5437
4460
  function buildPtyArgs(params, sessionId, opts) {
@@ -5931,18 +4954,6 @@ var ClaudeCodeRunner = class {
5931
4954
  import { spawn as spawn2 } from "child_process";
5932
4955
  import { createInterface } from "readline";
5933
4956
  import { EventEmitter } from "events";
5934
- function resolveMcpArgs(env2) {
5935
- if (!env2["RUNEYA_API_TOKEN"]) return [];
5936
- try {
5937
- return codexMcpArgs({
5938
- RUNEYA_BASE_URL: env2["RUNEYA_BASE_URL"],
5939
- RUNEYA_API_TOKEN: env2["RUNEYA_API_TOKEN"]
5940
- });
5941
- } catch (err) {
5942
- console.warn("[codex-app-server] Failed to resolve MCP server path:", err.message);
5943
- return [];
5944
- }
5945
- }
5946
4957
  var CodexAppServerClient = class extends EventEmitter {
5947
4958
  proc = null;
5948
4959
  rl = null;
@@ -5964,7 +4975,10 @@ var CodexAppServerClient = class extends EventEmitter {
5964
4975
  */
5965
4976
  async connect(runeyaEnv) {
5966
4977
  const env2 = { ...process.env, ...runeyaEnv };
5967
- const invocation = resolveCliInvocation("codex", [...resolveMcpArgs(env2), "app-server"]);
4978
+ const invocation = resolveCliInvocation("codex", [
4979
+ ...codexRuneyaMcpArgs({ RUNEYA_BASE_URL: env2["RUNEYA_BASE_URL"], RUNEYA_API_TOKEN: env2["RUNEYA_API_TOKEN"] }),
4980
+ "app-server"
4981
+ ]);
5968
4982
  this.proc = spawn2(invocation.command, invocation.args, {
5969
4983
  windowsHide: true,
5970
4984
  stdio: ["pipe", "pipe", "pipe"],
@@ -6125,7 +5139,7 @@ async function shutdownCodexAppServer() {
6125
5139
  }
6126
5140
  }
6127
5141
  async function getAgentManager2() {
6128
- const { agentManager: agentManager2 } = await import("./agent-manager-THV3LJOF.js");
5142
+ const { agentManager: agentManager2 } = await import("./agent-manager-R7BPQO6D.js");
6129
5143
  return agentManager2;
6130
5144
  }
6131
5145
  function parseRuneyaCurlCommand(command) {
@@ -6609,19 +5623,19 @@ function toConversationSummary(conv) {
6609
5623
  const { messages, ...rest } = conv;
6610
5624
  return { ...rest, messages: [], messagesOmitted: true, messageCount: messages.length };
6611
5625
  }
6612
- var MessageSchema = z9.object({
6613
- role: z9.enum(["user", "assistant"]),
6614
- content: z9.string().max(1e5)
5626
+ var MessageSchema = z6.object({
5627
+ role: z6.enum(["user", "assistant"]),
5628
+ content: z6.string().max(1e5)
6615
5629
  });
6616
- var ImagePartSchema = z9.object({
6617
- type: z9.literal("image"),
6618
- imageId: z9.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
6619
- url: z9.string().max(500),
6620
- mimeType: z9.string().max(100),
6621
- altText: z9.string().max(500).optional()
5630
+ var ImagePartSchema = z6.object({
5631
+ type: z6.literal("image"),
5632
+ imageId: z6.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5633
+ url: z6.string().max(500),
5634
+ mimeType: z6.string().max(100),
5635
+ altText: z6.string().max(500).optional()
6622
5636
  });
6623
- var ImagePartsSchema = z9.array(ImagePartSchema).max(5).optional();
6624
- var SectionNameSchema = z9.string().trim().min(1).max(80);
5637
+ var ImagePartsSchema = z6.array(ImagePartSchema).max(5).optional();
5638
+ var SectionNameSchema = z6.string().trim().min(1).max(80);
6625
5639
  var LANGUAGE_INSTRUCTION = "Always respond in the same language the user writes in.";
6626
5640
  async function buildSystemPrompt(apiKey) {
6627
5641
  const allServices = await serviceStore.list();
@@ -7018,24 +6032,24 @@ async function startCodexSession(convId, prompt, opts = {}) {
7018
6032
  });
7019
6033
  return { session, done };
7020
6034
  }
7021
- var MessagePartSchema = z9.discriminatedUnion("type", [
7022
- z9.object({ type: z9.literal("thinking"), text: z9.string().max(1e5) }),
7023
- z9.object({ type: z9.literal("text"), text: z9.string().max(1e5) }),
7024
- z9.object({
7025
- type: z9.literal("tool"),
6035
+ var MessagePartSchema = z6.discriminatedUnion("type", [
6036
+ z6.object({ type: z6.literal("thinking"), text: z6.string().max(1e5) }),
6037
+ z6.object({ type: z6.literal("text"), text: z6.string().max(1e5) }),
6038
+ z6.object({
6039
+ type: z6.literal("tool"),
7026
6040
  id: Id128Schema,
7027
6041
  name: Id128Schema,
7028
- input: z9.record(z9.string(), z9.unknown()).optional(),
7029
- rawInput: z9.string().max(1e4).optional(),
7030
- result: z9.unknown().optional(),
7031
- isError: z9.boolean().optional(),
7032
- pending: z9.boolean()
6042
+ input: z6.record(z6.string(), z6.unknown()).optional(),
6043
+ rawInput: z6.string().max(1e4).optional(),
6044
+ result: z6.unknown().optional(),
6045
+ isError: z6.boolean().optional(),
6046
+ pending: z6.boolean()
7033
6047
  })
7034
6048
  ]);
7035
- var StoredMessageSchema = z9.object({
7036
- role: z9.enum(["user", "assistant"]),
7037
- content: z9.string().max(1e5),
7038
- parts: z9.array(MessagePartSchema).max(200).optional()
6049
+ var StoredMessageSchema = z6.object({
6050
+ role: z6.enum(["user", "assistant"]),
6051
+ content: z6.string().max(1e5),
6052
+ parts: z6.array(MessagePartSchema).max(200).optional()
7039
6053
  });
7040
6054
  async function conversationCwd(conv) {
7041
6055
  return resolveConversationCwd(conv.id);
@@ -7052,7 +6066,7 @@ var chatRouter = router({
7052
6066
  * et sans le même filtre il y reversait toutes les conversations de la
7053
6067
  * machine, une seconde après un chargement pourtant filtré.
7054
6068
  */
7055
- onChanged: protectedProcedure.input(z9.object({
6069
+ onChanged: protectedProcedure.input(z6.object({
7056
6070
  projectId: Id128Schema.optional(),
7057
6071
  orgId: Id128Schema.nullable().optional()
7058
6072
  }).optional()).subscription(async function* ({ input }) {
@@ -7104,7 +6118,7 @@ var chatRouter = router({
7104
6118
  * reachable where they were written, without leaking into every other
7105
6119
  * organization's projects.
7106
6120
  */
7107
- list: protectedProcedure.input(z9.object({
6121
+ list: protectedProcedure.input(z6.object({
7108
6122
  projectId: Id128Schema.optional(),
7109
6123
  orgId: Id128Schema.nullable().optional()
7110
6124
  }).optional()).query(async ({ input }) => {
@@ -7112,24 +6126,24 @@ var chatRouter = router({
7112
6126
  const convs = projectId ? await conversationStore.listForProject({ id: projectId, orgId: input?.orgId }) : await conversationStore.list();
7113
6127
  return convs.map(toConversationSummary);
7114
6128
  }),
7115
- get: protectedProcedure.input(z9.object({ id: Id128Schema })).query(async ({ input }) => {
6129
+ get: protectedProcedure.input(z6.object({ id: Id128Schema })).query(async ({ input }) => {
7116
6130
  const conv = await conversationStore.get(input.id);
7117
6131
  if (!conv) throw new TRPCError4({ code: "NOT_FOUND", message: "Conversation not found" });
7118
6132
  return conv;
7119
6133
  }),
7120
- create: protectedProcedure.input(z9.object({
6134
+ create: protectedProcedure.input(z6.object({
7121
6135
  title: ShortString200Schema.optional(),
7122
- isCli: z9.boolean().optional(),
7123
- runner: z9.enum(["claude-code", "codex"]).optional(),
6136
+ isCli: z6.boolean().optional(),
6137
+ runner: z6.enum(["claude-code", "codex"]).optional(),
7124
6138
  providerId: Id128Schema.optional(),
7125
6139
  scenarioId: Id128Schema.optional(),
7126
- scenarioInput: z9.string().max(1e5).optional(),
6140
+ scenarioInput: z6.string().max(1e5).optional(),
7127
6141
  kanbanBoardId: Id128Schema.optional(),
7128
6142
  kanbanCardId: Id128Schema.optional(),
7129
6143
  // The project the conversation is about: only the caller knows which
7130
6144
  // one it is looking at.
7131
6145
  projectId: Id128Schema.optional(),
7132
- orgId: z9.string().max(128).nullable().optional(),
6146
+ orgId: z6.string().max(128).nullable().optional(),
7133
6147
  // L'agent où la conversation travaille. Absent = agent par défaut.
7134
6148
  agentId: Id128Schema.optional()
7135
6149
  })).mutation(async ({ input }) => {
@@ -7172,13 +6186,13 @@ var chatRouter = router({
7172
6186
  }
7173
6187
  return conv;
7174
6188
  }),
7175
- update: protectedProcedure.input(z9.object({
6189
+ update: protectedProcedure.input(z6.object({
7176
6190
  id: Id128Schema,
7177
6191
  title: ShortString200Schema.optional(),
7178
- messages: z9.array(StoredMessageSchema).max(500).optional(),
7179
- contextUsage: z9.object({
7180
- inputTokens: z9.number().int().nonnegative(),
7181
- contextWindow: z9.number().int().positive()
6192
+ messages: z6.array(StoredMessageSchema).max(500).optional(),
6193
+ contextUsage: z6.object({
6194
+ inputTokens: z6.number().int().nonnegative(),
6195
+ contextWindow: z6.number().int().positive()
7182
6196
  }).optional()
7183
6197
  })).mutation(async ({ input }) => {
7184
6198
  const conv = await conversationStore.update(input.id, { title: input.title, messages: input.messages, contextUsage: input.contextUsage });
@@ -7192,14 +6206,14 @@ var chatRouter = router({
7192
6206
  * messages, et un réglage qui voyage avec 500 messages se perdrait dans un
7193
6207
  * patch dont ce n'est pas le sujet.
7194
6208
  */
7195
- setCompanion: protectedProcedure.input(z9.object({
6209
+ setCompanion: protectedProcedure.input(z6.object({
7196
6210
  id: Id128Schema,
7197
- enabled: z9.boolean(),
7198
- runner: z9.enum(["claude-code", "codex"]).optional(),
6211
+ enabled: z6.boolean(),
6212
+ runner: z6.enum(["claude-code", "codex"]).optional(),
7199
6213
  /** Chaîne vide = modèle par défaut du runner. */
7200
- model: z9.string().max(200).optional(),
6214
+ model: z6.string().max(200).optional(),
7201
6215
  /** Chaîne vide = effort par défaut. */
7202
- effort: z9.enum(["low", "normal", "high", ""]).optional()
6216
+ effort: z6.enum(["low", "normal", "high", ""]).optional()
7203
6217
  })).mutation(async ({ input }) => {
7204
6218
  const existing = await conversationStore.get(input.id);
7205
6219
  if (!existing) throw new TRPCError4({ code: "NOT_FOUND", message: "Conversation not found" });
@@ -7225,7 +6239,7 @@ var chatRouter = router({
7225
6239
  * compagnon silencieux parce qu'il n'avait rien à dire et un message qui
7226
6240
  * n'a pas pu être transmis se ressemblent parfaitement sans cette trace.
7227
6241
  */
7228
- companionDelivery: protectedProcedure.input(z9.object({ id: Id128Schema })).query(async ({ input }) => {
6242
+ companionDelivery: protectedProcedure.input(z6.object({ id: Id128Schema })).query(async ({ input }) => {
7229
6243
  const conv = await conversationStore.get(input.id);
7230
6244
  const companionId = conv?.companionConversationId;
7231
6245
  const running = isCompanionThinking(input.id) || (companionId ? activeSessionRegistry.get(companionId)?.status === "running" : false);
@@ -7275,7 +6289,7 @@ var chatRouter = router({
7275
6289
  * route emprunte exactement le chemin de livraison, sans le jugement, et
7276
6290
  * rend PAR OÙ le message est passé.
7277
6291
  */
7278
- testCompanionBridge: protectedProcedure.input(z9.object({ id: Id128Schema })).mutation(async ({ input }) => {
6292
+ testCompanionBridge: protectedProcedure.input(z6.object({ id: Id128Schema })).mutation(async ({ input }) => {
7279
6293
  const conv = await conversationStore.get(input.id);
7280
6294
  if (!conv) throw new TRPCError4({ code: "NOT_FOUND", message: "Conversation not found" });
7281
6295
  const route = await deliverToMainConversation(
@@ -7296,7 +6310,7 @@ var chatRouter = router({
7296
6310
  * entier, bien plus qu'une requête ne doit rester ouverte. L'interface suit
7297
6311
  * l'avancement par l'état poussé « il relit », déjà en place.
7298
6312
  */
7299
- runCompanionNow: protectedProcedure.input(z9.object({ id: Id128Schema })).mutation(async ({ input }) => {
6313
+ runCompanionNow: protectedProcedure.input(z6.object({ id: Id128Schema })).mutation(async ({ input }) => {
7300
6314
  const conv = await conversationStore.get(input.id);
7301
6315
  if (!conv) throw new TRPCError4({ code: "NOT_FOUND", message: "Conversation not found" });
7302
6316
  if (conv.isCompanion) {
@@ -7313,7 +6327,7 @@ var chatRouter = router({
7313
6327
  });
7314
6328
  return { started: true };
7315
6329
  }),
7316
- delete: protectedProcedure.input(z9.object({ id: Id128Schema })).mutation(async ({ input }) => {
6330
+ delete: protectedProcedure.input(z6.object({ id: Id128Schema })).mutation(async ({ input }) => {
7317
6331
  const existing = await conversationStore.get(input.id);
7318
6332
  if (!existing) throw new TRPCError4({ code: "NOT_FOUND", message: "Conversation not found" });
7319
6333
  resetRelaunches(input.id);
@@ -7341,12 +6355,12 @@ var chatRouter = router({
7341
6355
  (err) => console.error("[chat.delete] Image cleanup error:", err)
7342
6356
  );
7343
6357
  }),
7344
- archive: protectedProcedure.input(z9.object({ id: Id128Schema, archived: z9.boolean() })).mutation(async ({ input }) => {
6358
+ archive: protectedProcedure.input(z6.object({ id: Id128Schema, archived: z6.boolean() })).mutation(async ({ input }) => {
7345
6359
  const conv = await conversationStore.update(input.id, { archived: input.archived });
7346
6360
  if (!conv) throw new TRPCError4({ code: "NOT_FOUND", message: "Conversation not found" });
7347
6361
  return conv;
7348
6362
  }),
7349
- pin: protectedProcedure.input(z9.object({ id: Id128Schema, pinned: z9.boolean() })).mutation(async ({ input }) => {
6363
+ pin: protectedProcedure.input(z6.object({ id: Id128Schema, pinned: z6.boolean() })).mutation(async ({ input }) => {
7350
6364
  const conv = await conversationStore.setPinned(input.id, input.pinned);
7351
6365
  if (!conv) throw new TRPCError4({ code: "NOT_FOUND", message: "Conversation not found" });
7352
6366
  return conv;
@@ -7354,16 +6368,16 @@ var chatRouter = router({
7354
6368
  // L'ordre ne vaut que pour les ids donnés : l'écran ne connaît que les
7355
6369
  // conversations du projet courant, et les épinglées des autres projets
7356
6370
  // n'ont pas à bouger parce qu'on a rangé celles-ci.
7357
- reorderPinned: protectedProcedure.input(z9.object({ ids: z9.array(Id128Schema).max(500) })).mutation(async ({ input }) => {
6371
+ reorderPinned: protectedProcedure.input(z6.object({ ids: z6.array(Id128Schema).max(500) })).mutation(async ({ input }) => {
7358
6372
  await conversationStore.reorderPinned(input.ids);
7359
6373
  }),
7360
6374
  // Ranger des conversations dans une section du projet, ou les en sortir
7361
6375
  // (`sectionId: null`). Une conversation d'un autre projet est refusée :
7362
6376
  // la section ne se verrait pas là où la conversation s'affiche.
7363
- setSection: protectedProcedure.input(z9.object({
6377
+ setSection: protectedProcedure.input(z6.object({
7364
6378
  projectId: Id128Schema,
7365
6379
  sectionId: Id128Schema.nullable(),
7366
- ids: z9.array(Id128Schema).max(500)
6380
+ ids: z6.array(Id128Schema).max(500)
7367
6381
  })).mutation(async ({ input }) => {
7368
6382
  if (input.sectionId !== null && !await conversationSectionStore.get(input.projectId, input.sectionId)) {
7369
6383
  throw new TRPCError4({ code: "NOT_FOUND", message: "Section not found" });
@@ -7379,28 +6393,28 @@ var chatRouter = router({
7379
6393
  }),
7380
6394
  // Les sections de la barre latérale, propres à chaque projet.
7381
6395
  sections: router({
7382
- list: protectedProcedure.input(z9.object({ projectId: Id128Schema })).query(({ input }) => conversationSectionStore.list(input.projectId)),
7383
- create: protectedProcedure.input(z9.object({ projectId: Id128Schema, name: SectionNameSchema })).mutation(({ input }) => conversationSectionStore.create(input.projectId, input.name)),
7384
- rename: protectedProcedure.input(z9.object({ projectId: Id128Schema, id: Id128Schema, name: SectionNameSchema })).mutation(async ({ input }) => {
6396
+ list: protectedProcedure.input(z6.object({ projectId: Id128Schema })).query(({ input }) => conversationSectionStore.list(input.projectId)),
6397
+ create: protectedProcedure.input(z6.object({ projectId: Id128Schema, name: SectionNameSchema })).mutation(({ input }) => conversationSectionStore.create(input.projectId, input.name)),
6398
+ rename: protectedProcedure.input(z6.object({ projectId: Id128Schema, id: Id128Schema, name: SectionNameSchema })).mutation(async ({ input }) => {
7385
6399
  const section = await conversationSectionStore.rename(input.projectId, input.id, input.name);
7386
6400
  if (!section) throw new TRPCError4({ code: "NOT_FOUND", message: "Section not found" });
7387
6401
  return section;
7388
6402
  }),
7389
6403
  // Les conversations de la section retombent dans la liste, rien n'est supprimé.
7390
- delete: protectedProcedure.input(z9.object({ projectId: Id128Schema, id: Id128Schema })).mutation(async ({ input }) => {
6404
+ delete: protectedProcedure.input(z6.object({ projectId: Id128Schema, id: Id128Schema })).mutation(async ({ input }) => {
7391
6405
  if (!await conversationSectionStore.remove(input.projectId, input.id)) {
7392
6406
  throw new TRPCError4({ code: "NOT_FOUND", message: "Section not found" });
7393
6407
  }
7394
6408
  await conversationStore.clearSection(input.id);
7395
6409
  }),
7396
- reorder: protectedProcedure.input(z9.object({ projectId: Id128Schema, ids: z9.array(Id128Schema).max(200) })).mutation(({ input }) => conversationSectionStore.reorder(input.projectId, input.ids))
6410
+ reorder: protectedProcedure.input(z6.object({ projectId: Id128Schema, ids: z6.array(Id128Schema).max(200) })).mutation(({ input }) => conversationSectionStore.reorder(input.projectId, input.ids))
7397
6411
  }),
7398
- listModels: protectedProcedure.input(z9.object({
6412
+ listModels: protectedProcedure.input(z6.object({
7399
6413
  providerId: Id128Schema.optional(),
7400
6414
  // Le projet dit de quelle organisation lire les fournisseurs ; absent,
7401
6415
  // ce sont ceux du poste.
7402
6416
  projectId: Id128Schema.optional(),
7403
- orgId: z9.string().max(128).nullable().optional()
6417
+ orgId: z6.string().max(128).nullable().optional()
7404
6418
  }).optional()).query(async ({ input }) => {
7405
6419
  const active = await getActiveProvider(
7406
6420
  input?.providerId,
@@ -7418,11 +6432,11 @@ var chatRouter = router({
7418
6432
  * `model/list` de l'app-server pour Codex, sur l'agent visé (celui par
7419
6433
  * défaut sinon). Liste vide si Codex ne répond pas.
7420
6434
  */
7421
- listCliModels: protectedProcedure.input(z9.object({
7422
- runner: z9.enum(["claude-code", "codex"]),
6435
+ listCliModels: protectedProcedure.input(z6.object({
6436
+ runner: z6.enum(["claude-code", "codex"]),
7423
6437
  agentId: Id128Schema.optional()
7424
6438
  })).query(async ({ input }) => ({ models: await listCliModels(input.runner, input.agentId) })),
7425
- checkCliAvailability: protectedProcedure.input(z9.object({ agentId: Id128Schema.optional() }).optional()).query(async ({ input }) => {
6439
+ checkCliAvailability: protectedProcedure.input(z6.object({ agentId: Id128Schema.optional() }).optional()).query(async ({ input }) => {
7426
6440
  if (input?.agentId) {
7427
6441
  try {
7428
6442
  const res = await agentManager.agentQuery(
@@ -7440,12 +6454,12 @@ var chatRouter = router({
7440
6454
  ]);
7441
6455
  return { available: claudeOk, codexAvailable: codexOk };
7442
6456
  }),
7443
- enhanceScenarioPrompt: protectedProcedure.input(z9.object({
7444
- text: z9.string().max(1e4),
6457
+ enhanceScenarioPrompt: protectedProcedure.input(z6.object({
6458
+ text: z6.string().max(1e4),
7445
6459
  providerId: Id128Schema.optional(),
7446
- model: z9.string().max(200).optional(),
6460
+ model: z6.string().max(200).optional(),
7447
6461
  projectId: Id128Schema.optional(),
7448
- orgId: z9.string().max(128).nullable().optional()
6462
+ orgId: z6.string().max(128).nullable().optional()
7449
6463
  })).mutation(async ({ input }) => {
7450
6464
  const active = await getActiveProvider(
7451
6465
  input.providerId,
@@ -7488,22 +6502,22 @@ Return ONLY the improved text, no explanation, no preamble.`;
7488
6502
  }),
7489
6503
  listClaudeCodeModels: protectedProcedure.query(() => ["opus", "sonnet", "haiku"]),
7490
6504
  getStreamingStatus: protectedProcedure.query(() => activeSessionRegistry.listActive()),
7491
- stopSession: protectedProcedure.input(z9.object({ conversationId: ConversationIdSchema })).mutation(({ input }) => {
6505
+ stopSession: protectedProcedure.input(z6.object({ conversationId: ConversationIdSchema })).mutation(({ input }) => {
7492
6506
  if (process.env.RUNEYA_DEBUG) console.log("[chat]: stopSession");
7493
6507
  const killed = activeSessionRegistry.kill(input.conversationId);
7494
6508
  if (!killed) throw new TRPCError4({ code: "NOT_FOUND", message: "No active session for this conversation" });
7495
6509
  return { ok: true };
7496
6510
  }),
7497
- streamViaClaudeCode: protectedProcedure.input(z9.object({
6511
+ streamViaClaudeCode: protectedProcedure.input(z6.object({
7498
6512
  conversationId: ConversationIdSchema,
7499
- prompt: z9.string().max(1e5),
7500
- contextNote: z9.string().max(2e5).optional(),
6513
+ prompt: z6.string().max(1e5),
6514
+ contextNote: z6.string().max(2e5).optional(),
7501
6515
  model: ShortString200Schema.optional(),
7502
- effort: z9.enum(["low", "medium", "high"]).optional(),
7503
- reconnect: z9.boolean().optional(),
6516
+ effort: z6.enum(["low", "medium", "high"]).optional(),
6517
+ reconnect: z6.boolean().optional(),
7504
6518
  agentId: Id128Schema.optional(),
7505
- environmentId: z9.string().max(128).optional(),
7506
- imageIds: z9.array(z9.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
6519
+ environmentId: z6.string().max(128).optional(),
6520
+ imageIds: z6.array(z6.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
7507
6521
  imageParts: ImagePartsSchema
7508
6522
  })).subscription(async function* ({ input, ctx, signal }) {
7509
6523
  if (process.env.RUNEYA_DEBUG) console.log("[chat]: Reconnect");
@@ -7605,15 +6619,15 @@ ${imagePaths.map((p) => `Image: ${p}`).join("\n")}` : cliPrompt;
7605
6619
  if (process.env.RUNEYA_DEBUG) console.log("[chat]: drainSession...");
7606
6620
  yield* drainSession(session, signal, false);
7607
6621
  }),
7608
- streamViaCodex: protectedProcedure.input(z9.object({
6622
+ streamViaCodex: protectedProcedure.input(z6.object({
7609
6623
  conversationId: ConversationIdSchema,
7610
- prompt: z9.string().max(1e5),
7611
- contextNote: z9.string().max(2e5).optional(),
6624
+ prompt: z6.string().max(1e5),
6625
+ contextNote: z6.string().max(2e5).optional(),
7612
6626
  model: ShortString200Schema.optional(),
7613
- reconnect: z9.boolean().optional(),
6627
+ reconnect: z6.boolean().optional(),
7614
6628
  agentId: Id128Schema.optional(),
7615
- environmentId: z9.string().max(128).optional(),
7616
- imageIds: z9.array(z9.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
6629
+ environmentId: z6.string().max(128).optional(),
6630
+ imageIds: z6.array(z6.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
7617
6631
  imageParts: ImagePartsSchema
7618
6632
  })).subscription(async function* ({ input, ctx, signal }) {
7619
6633
  const existingSession = activeSessionRegistry.get(input.conversationId);
@@ -7683,13 +6697,13 @@ ${input.prompt}` : input.prompt;
7683
6697
  });
7684
6698
  yield* drainSession(session, signal, false);
7685
6699
  }),
7686
- send: protectedProcedure.input(z9.object({
6700
+ send: protectedProcedure.input(z6.object({
7687
6701
  conversationId: ConversationIdSchema,
7688
- messages: z9.array(MessageSchema).min(0).max(100),
6702
+ messages: z6.array(MessageSchema).min(0).max(100),
7689
6703
  model: ShortString200Schema.optional(),
7690
- contextNote: z9.string().max(2e5).optional(),
7691
- reconnect: z9.boolean().optional(),
7692
- imageIds: z9.array(z9.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
6704
+ contextNote: z6.string().max(2e5).optional(),
6705
+ reconnect: z6.boolean().optional(),
6706
+ imageIds: z6.array(z6.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).max(5).optional(),
7693
6707
  imageParts: ImagePartsSchema
7694
6708
  })).subscription(async function* ({ input, ctx, signal }) {
7695
6709
  const existingSession = activeSessionRegistry.get(input.conversationId);
@@ -7806,25 +6820,25 @@ ${input.prompt}` : input.prompt;
7806
6820
  // ── PTY passthrough (interactive Claude Code session) ────────────────────
7807
6821
  pty: router({
7808
6822
  /** Start a PTY session running `claude --resume <sessionId>` (or fresh). */
7809
- start: protectedProcedure.input(z9.object({
7810
- agentId: z9.string().max(128).optional(),
7811
- sessionId: z9.string().max(128).optional(),
7812
- runner: z9.enum(["claude-code", "codex"]).default("claude-code"),
7813
- resume: z9.boolean().default(false),
7814
- model: z9.string().max(128).optional(),
7815
- cwd: z9.string().max(4096).optional(),
6823
+ start: protectedProcedure.input(z6.object({
6824
+ agentId: z6.string().max(128).optional(),
6825
+ sessionId: z6.string().max(128).optional(),
6826
+ runner: z6.enum(["claude-code", "codex"]).default("claude-code"),
6827
+ resume: z6.boolean().default(false),
6828
+ model: z6.string().max(128).optional(),
6829
+ cwd: z6.string().max(4096).optional(),
7816
6830
  /** Anchors the session when no explicit cwd is given. */
7817
- serviceId: z9.string().max(128).optional(),
6831
+ serviceId: z6.string().max(128).optional(),
7818
6832
  projectId: Id128Schema.optional(),
7819
- orgId: z9.string().max(128).nullable().optional(),
7820
- cols: z9.number().int().min(1).max(1e3).default(120),
7821
- rows: z9.number().int().min(1).max(1e3).default(30),
7822
- enableMcp: z9.boolean().default(false),
7823
- apiBaseUrl: z9.string().max(512).optional(),
7824
- environmentId: z9.string().max(128).optional(),
7825
- attachedContexts: z9.array(z9.object({
7826
- label: z9.string().max(200),
7827
- text: z9.string().max(1e6)
6833
+ orgId: z6.string().max(128).nullable().optional(),
6834
+ cols: z6.number().int().min(1).max(1e3).default(120),
6835
+ rows: z6.number().int().min(1).max(1e3).default(30),
6836
+ enableMcp: z6.boolean().default(false),
6837
+ apiBaseUrl: z6.string().max(512).optional(),
6838
+ environmentId: z6.string().max(128).optional(),
6839
+ attachedContexts: z6.array(z6.object({
6840
+ label: z6.string().max(200),
6841
+ text: z6.string().max(1e6)
7828
6842
  })).max(20).optional()
7829
6843
  })).mutation(async ({ input, ctx }) => {
7830
6844
  const t0 = Date.now();
@@ -7986,10 +7000,10 @@ Context:
7986
7000
  return { spawnId: res.spawnId, agentId, reattached: false };
7987
7001
  }),
7988
7002
  /** Subscribe to PTY output stream (raw text with ANSI). */
7989
- stream: protectedProcedure.input(z9.object({
7990
- agentId: z9.string().max(128).optional(),
7991
- spawnId: z9.string().max(128),
7992
- fromOffset: z9.number().int().min(0).default(0)
7003
+ stream: protectedProcedure.input(z6.object({
7004
+ agentId: z6.string().max(128).optional(),
7005
+ spawnId: z6.string().max(128),
7006
+ fromOffset: z6.number().int().min(0).default(0)
7993
7007
  })).subscription(async function* ({ input, signal }) {
7994
7008
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
7995
7009
  if (!agentId) throw new TRPCError4({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -8044,10 +7058,10 @@ Context:
8044
7058
  }
8045
7059
  }),
8046
7060
  /** Write input to a PTY session (keystrokes from xterm). */
8047
- write: protectedProcedure.input(z9.object({
8048
- agentId: z9.string().max(128).optional(),
8049
- spawnId: z9.string().max(128),
8050
- data: z9.string().max(1e6)
7061
+ write: protectedProcedure.input(z6.object({
7062
+ agentId: z6.string().max(128).optional(),
7063
+ spawnId: z6.string().max(128),
7064
+ data: z6.string().max(1e6)
8051
7065
  })).mutation(async ({ input }) => {
8052
7066
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
8053
7067
  if (!agentId) throw new TRPCError4({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -8057,11 +7071,11 @@ Context:
8057
7071
  });
8058
7072
  }),
8059
7073
  /** Resize a PTY session. */
8060
- resize: protectedProcedure.input(z9.object({
8061
- agentId: z9.string().max(128).optional(),
8062
- spawnId: z9.string().max(128),
8063
- cols: z9.number().int().min(1).max(1e3),
8064
- rows: z9.number().int().min(1).max(1e3)
7074
+ resize: protectedProcedure.input(z6.object({
7075
+ agentId: z6.string().max(128).optional(),
7076
+ spawnId: z6.string().max(128),
7077
+ cols: z6.number().int().min(1).max(1e3),
7078
+ rows: z6.number().int().min(1).max(1e3)
8065
7079
  })).mutation(async ({ input }) => {
8066
7080
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
8067
7081
  if (!agentId) throw new TRPCError4({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -8077,11 +7091,11 @@ Context:
8077
7091
  * picks it up. Returns the tmp path and which clipboard method succeeded
8078
7092
  * (null if none — caller should inject `@<path>` instead of Ctrl+V).
8079
7093
  */
8080
- pasteImage: protectedProcedure.input(z9.object({
8081
- agentId: z9.string().max(128).optional(),
8082
- sessionId: z9.string().max(128).optional(),
8083
- mimeType: z9.string().max(64),
8084
- base64: z9.string().max(15e6)
7094
+ pasteImage: protectedProcedure.input(z6.object({
7095
+ agentId: z6.string().max(128).optional(),
7096
+ sessionId: z6.string().max(128).optional(),
7097
+ mimeType: z6.string().max(64),
7098
+ base64: z6.string().max(15e6)
8085
7099
  })).mutation(async ({ input }) => {
8086
7100
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
8087
7101
  if (!agentId) throw new TRPCError4({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -8099,7 +7113,7 @@ Context:
8099
7113
  * Read the transcript Claude Code stores on disk for a given session.
8100
7114
  * Returns parsed JSONL entries (user / assistant messages, tool uses, etc.).
8101
7115
  */
8102
- transcript: protectedProcedure.input(z9.object({ sessionId: z9.string().max(128) })).query(async ({ input }) => {
7116
+ transcript: protectedProcedure.input(z6.object({ sessionId: z6.string().max(128) })).query(async ({ input }) => {
8103
7117
  return readClaudeTranscript(input.sessionId);
8104
7118
  }),
8105
7119
  /**
@@ -8107,9 +7121,9 @@ Context:
8107
7121
  * when was the transcript JSONL last touched? Used by the non-PTY view
8108
7122
  * to show a "Claude is thinking…" indicator while output streams.
8109
7123
  */
8110
- activity: protectedProcedure.input(z9.object({
8111
- agentId: z9.string().max(128).optional(),
8112
- sessionId: z9.string().max(128)
7124
+ activity: protectedProcedure.input(z6.object({
7125
+ agentId: z6.string().max(128).optional(),
7126
+ sessionId: z6.string().max(128)
8113
7127
  })).query(async ({ input }) => {
8114
7128
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
8115
7129
  let running = false;
@@ -8136,7 +7150,7 @@ Context:
8136
7150
  * them on the conversation, so the non-PTY chat view stays in sync.
8137
7151
  * Uses the conversation id as session id (PTY sessions are spawned that way).
8138
7152
  */
8139
- syncTranscript: protectedProcedure.input(z9.object({ conversationId: ConversationIdSchema })).mutation(async ({ input }) => {
7153
+ syncTranscript: protectedProcedure.input(z6.object({ conversationId: ConversationIdSchema })).mutation(async ({ input }) => {
8140
7154
  const conv = await conversationStore.get(input.conversationId);
8141
7155
  if (!conv) {
8142
7156
  throw new TRPCError4({ code: "NOT_FOUND", message: `Conversation ${input.conversationId} not found` });
@@ -8150,14 +7164,14 @@ Context:
8150
7164
  * with the given sessionId. Used to benchmark the PTY → tRPC → xterm.js
8151
7165
  * pipeline. Open the conversation in PTY mode to attach to it.
8152
7166
  */
8153
- debugStress: protectedProcedure.input(z9.object({
8154
- sessionId: z9.string().max(128),
8155
- agentId: z9.string().max(128).optional(),
8156
- bytesPerSec: z9.number().int().min(100).max(1e7).default(5e4),
8157
- chunkSize: z9.number().int().min(1).max(65536).default(256),
8158
- durationMs: z9.number().int().min(0).max(36e5).default(0),
8159
- cols: z9.number().int().min(1).max(1e3).default(120),
8160
- rows: z9.number().int().min(1).max(1e3).default(30)
7167
+ debugStress: protectedProcedure.input(z6.object({
7168
+ sessionId: z6.string().max(128),
7169
+ agentId: z6.string().max(128).optional(),
7170
+ bytesPerSec: z6.number().int().min(100).max(1e7).default(5e4),
7171
+ chunkSize: z6.number().int().min(1).max(65536).default(256),
7172
+ durationMs: z6.number().int().min(0).max(36e5).default(0),
7173
+ cols: z6.number().int().min(1).max(1e3).default(120),
7174
+ rows: z6.number().int().min(1).max(1e3).default(30)
8161
7175
  })).mutation(async ({ input }) => {
8162
7176
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
8163
7177
  if (!agentId) throw new TRPCError4({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -8204,9 +7218,9 @@ Context:
8204
7218
  return { spawnId: res.spawnId, agentId, stressSessionId };
8205
7219
  }),
8206
7220
  /** Kill a PTY session. */
8207
- kill: protectedProcedure.input(z9.object({
8208
- agentId: z9.string().max(128).optional(),
8209
- spawnId: z9.string().max(128)
7221
+ kill: protectedProcedure.input(z6.object({
7222
+ agentId: z6.string().max(128).optional(),
7223
+ spawnId: z6.string().max(128)
8210
7224
  })).mutation(async ({ input }) => {
8211
7225
  const agentId = input.agentId ?? agentManager.getDefaultAgentId();
8212
7226
  if (!agentId) throw new TRPCError4({ code: "PRECONDITION_FAILED", message: "No agent available" });
@@ -8224,7 +7238,9 @@ export {
8224
7238
  router,
8225
7239
  publicProcedure,
8226
7240
  protectedProcedure,
7241
+ requireLoopback,
8227
7242
  requireLoopbackOrToken,
7243
+ requireHuman,
8228
7244
  requireServiceAction,
8229
7245
  getAllowedServiceIds,
8230
7246
  requireEnvAction,
@@ -8276,6 +7292,7 @@ export {
8276
7292
  kanbanStore,
8277
7293
  executeKanbanCommands,
8278
7294
  executeKanbanBoardCommands,
7295
+ buildKanbanCardPrompt,
8279
7296
  ClaudeCodeRunner,
8280
7297
  shutdownCodexAppServer,
8281
7298
  CodexRunner,
@@ -8285,4 +7302,4 @@ export {
8285
7302
  startCliSession,
8286
7303
  chatRouter
8287
7304
  };
8288
- //# sourceMappingURL=chunk-ONVAH65J.js.map
7305
+ //# sourceMappingURL=chunk-SEPAURTQ.js.map