@schlenkr/ragents 0.1.7 → 0.1.9

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 (187) hide show
  1. package/apps/server/src/config-definition.ts +24 -2
  2. package/apps/server/src/config.ts +0 -6
  3. package/apps/server/src/host-api.json +3 -10
  4. package/apps/server/src/host-api.ts +6 -7
  5. package/apps/server/src/plugin-build/build.ts +28 -5
  6. package/apps/server/src/plugin-build/plugin-description.ts +1 -1
  7. package/apps/server/src/plugin-build/typecheck.ts +2 -2
  8. package/apps/server/src/plugin-support/language-server/plugin.ts +8 -7
  9. package/apps/server/src/plugin-support/language-server/tools.ts +7 -6
  10. package/apps/server/src/plugin-support/model-aliases.ts +55 -25
  11. package/apps/server/src/plugin-support/plugin-folder.ts +2 -1
  12. package/apps/server/src/plugin-support/product-relay.ts +10 -2
  13. package/apps/server/src/plugin-support/workspace-sandbox-host.ts +18 -9
  14. package/apps/server/src/profile/bundle-manifest.ts +7 -3
  15. package/apps/server/src/profile/compose.ts +6 -0
  16. package/apps/server/src/profile/plugin-discovery.ts +6 -1
  17. package/apps/server/src/profile/provisioning.ts +6 -5
  18. package/apps/server/src/ragents/engine.ts +18 -12
  19. package/apps/server/src/ragents/host-services.ts +4 -0
  20. package/apps/server/src/ragents/session.ts +1 -1
  21. package/apps/server/src/server.ts +1 -0
  22. package/apps/server/tsconfig.json +2 -0
  23. package/apps/web/dist/assets/{highlighted-body-KPVGNVTW-CFhTJEmH.js → highlighted-body-KPVGNVTW-xXXhTDbh.js} +1 -1
  24. package/apps/web/dist/assets/{main-DlzW4t4c.js → main-C7JeZFjs.js} +1 -1
  25. package/apps/web/dist/assets/{mermaid-HWGCJPDP-kxkB991i.js → mermaid-HWGCJPDP-DfsU5ofC.js} +2 -2
  26. package/apps/web/dist/assets/{runPanel-BJEFQ__w.js → runPanel-ZT6TPDLM.js} +1 -1
  27. package/apps/web/dist/help/guide-clients.html +14 -6
  28. package/apps/web/dist/help/guide-clients.md +14 -6
  29. package/apps/web/dist/help/guide-distributed.html +12 -4
  30. package/apps/web/dist/help/guide-distributed.md +12 -4
  31. package/apps/web/dist/help/guide-getting-started.html +12 -8
  32. package/apps/web/dist/help/guide-getting-started.md +12 -8
  33. package/apps/web/dist/help/guide-plugins.html +6 -2
  34. package/apps/web/dist/help/guide-plugins.md +6 -2
  35. package/apps/web/dist/help/guide-runtime.html +2 -1
  36. package/apps/web/dist/help/guide-runtime.md +2 -1
  37. package/apps/web/dist/help/index.html +3328 -1135
  38. package/apps/web/dist/host-web.json +4 -4
  39. package/apps/web/dist/index.html +2 -2
  40. package/apps/web/dist/run-panel.html +2 -2
  41. package/apps/web/src/StartTiles.tsx +1 -1
  42. package/bundles/ragents.activity/ragents-bundle.json +3 -3
  43. package/bundles/ragents.actor-programs/ragents-bundle.json +3 -3
  44. package/bundles/ragents.ask/ragents-bundle.json +4 -4
  45. package/bundles/ragents.ask/server/index.js +42 -11
  46. package/bundles/ragents.ask/server/index.js.map +3 -3
  47. package/bundles/ragents.ask/web/chunks/chunk-WFN4374U.js +2 -0
  48. package/bundles/ragents.ask/web/chunks/chunk-WFN4374U.js.map +7 -0
  49. package/bundles/ragents.ask/web/classes.json +1 -1
  50. package/bundles/ragents.ask/web/exports/ask-payload.js +1 -1
  51. package/bundles/ragents.ask/web/index.js +1 -1
  52. package/bundles/ragents.ask/web/index.js.map +3 -3
  53. package/bundles/ragents.browser/executor/index.mjs +357 -0
  54. package/bundles/ragents.browser/executor/index.mjs.map +7 -0
  55. package/bundles/ragents.browser/ragents-bundle.json +5 -8
  56. package/bundles/ragents.browser/server/chunks/{chunk-2GKLLCBE.js → chunk-CWLX4VA5.js} +1 -1
  57. package/bundles/ragents.browser/server/chunks/chunk-CWLX4VA5.js.map +7 -0
  58. package/bundles/ragents.browser/server/exports/server/contract.js +1 -1
  59. package/bundles/ragents.browser/server/index.js +20 -9
  60. package/bundles/ragents.browser/server/index.js.map +4 -4
  61. package/bundles/ragents.documents/ragents-bundle.json +3 -3
  62. package/bundles/ragents.lsp-fsharp/executor/index.mjs +68 -0
  63. package/bundles/ragents.lsp-fsharp/executor/index.mjs.map +7 -0
  64. package/bundles/ragents.lsp-fsharp/ragents-bundle.json +5 -9
  65. package/bundles/ragents.lsp-fsharp/server/index.js +21 -6
  66. package/bundles/ragents.lsp-fsharp/server/index.js.map +4 -4
  67. package/bundles/ragents.lsp-roslyn/executor/index.mjs +68 -0
  68. package/bundles/ragents.lsp-roslyn/executor/index.mjs.map +7 -0
  69. package/bundles/ragents.lsp-roslyn/ragents-bundle.json +6 -8
  70. package/bundles/ragents.lsp-roslyn/server/index.js +54 -15
  71. package/bundles/ragents.lsp-roslyn/server/index.js.map +4 -4
  72. package/bundles/ragents.lsp-typescript/executor/index.mjs +49 -0
  73. package/bundles/ragents.lsp-typescript/executor/index.mjs.map +7 -0
  74. package/bundles/ragents.lsp-typescript/ragents-bundle.json +5 -7
  75. package/bundles/ragents.lsp-typescript/server/index.js +22 -2
  76. package/bundles/ragents.lsp-typescript/server/index.js.map +3 -3
  77. package/bundles/ragents.model-relay/ragents-bundle.json +4 -4
  78. package/bundles/ragents.model-relay/server/index.js +3 -2
  79. package/bundles/ragents.model-relay/server/index.js.map +2 -2
  80. package/bundles/ragents.orchestration/ragents-bundle.json +3 -3
  81. package/bundles/ragents.overseer/ragents-bundle.json +3 -3
  82. package/bundles/ragents.processes/ragents-bundle.json +3 -3
  83. package/bundles/ragents.product/ragents-bundle.json +3 -3
  84. package/bundles/ragents.profile-distribution/ragents-bundle.json +4 -4
  85. package/bundles/ragents.profile-distribution/server/index.js +1 -1
  86. package/bundles/ragents.profile-distribution/server/index.js.map +2 -2
  87. package/bundles/ragents.reference/ragents-bundle.json +3 -3
  88. package/bundles/ragents.todo/ragents-bundle.json +3 -3
  89. package/bundles/ragents.transcript/ragents-bundle.json +3 -3
  90. package/bundles/ragents.watch/ragents-bundle.json +3 -3
  91. package/bundles/ragents.workspace/ragents-bundle.json +11 -5
  92. package/bundles/ragents.workspace/server/index.js +101 -28
  93. package/bundles/ragents.workspace/server/index.js.map +3 -3
  94. package/bundles/ragents.workspace/web/classes.json +1 -1
  95. package/bundles/ragents.workspace/web/index.js +1 -1
  96. package/bundles/ragents.workspace/web/index.js.map +3 -3
  97. package/package.json +2 -2
  98. package/packages/agent/dist/core/agent-settings.d.ts +1 -7
  99. package/packages/agent/dist/core/compaction/compaction.d.ts +17 -13
  100. package/packages/agent/dist/core/model-runtime.d.ts +5 -4
  101. package/packages/agent/dist/core/provider-composer.d.ts +2 -1
  102. package/packages/agent/dist/core/tools/bash.d.ts +9 -3
  103. package/packages/agent/dist/index.d.ts +1 -1
  104. package/packages/agent/src/core/agent-settings.ts +1 -4
  105. package/packages/agent/src/core/compaction/compaction.ts +68 -30
  106. package/packages/agent/src/core/model-runtime.ts +12 -5
  107. package/packages/agent/src/core/provider-composer.ts +5 -0
  108. package/packages/agent/src/core/tools/bash.ts +36 -30
  109. package/packages/agent/src/index.ts +3 -0
  110. package/packages/ai/dist/types.d.ts +11 -0
  111. package/packages/ai/src/types.ts +12 -0
  112. package/packages/ragents/src/agents/plugins.ts +5 -0
  113. package/packages/ragents/src/domain/event-semantics.ts +3 -0
  114. package/packages/ragents/src/domain/event-validation.ts +15 -2
  115. package/packages/ragents/src/domain/events.ts +3 -0
  116. package/packages/ragents/src/domain/model.ts +2 -0
  117. package/packages/ragents/src/domain/projection.ts +1 -0
  118. package/packages/ragents/src/drivers/agent-runtime.ts +1 -1
  119. package/packages/ragents/src/drivers/agent-turn.ts +8 -6
  120. package/packages/ragents/src/index.ts +1 -0
  121. package/packages/ragents/src/plugin-host.ts +58 -10
  122. package/packages/ragents/src/plugin-types.ts +7 -2
  123. package/packages/ragents/src/runtime/decisions/inputs.ts +6 -2
  124. package/packages/ragents/src/runtime/journal-storage.ts +5 -4
  125. package/packages/workspace-executor/package.json +0 -1
  126. package/packages/workspace-executor/src/bash-launch.ts +56 -10
  127. package/packages/workspace-executor/src/context.ts +4 -0
  128. package/packages/workspace-executor/src/contributions.ts +150 -0
  129. package/packages/workspace-executor/src/executor.ts +1 -1
  130. package/packages/workspace-executor/src/index.ts +16 -19
  131. package/packages/workspace-executor/src/language-server/host.ts +3 -0
  132. package/packages/workspace-executor/src/language-server/module.ts +12 -2
  133. package/packages/workspace-executor/src/language-server/roots.ts +0 -5
  134. package/packages/workspace-executor/src/modules.ts +7 -6
  135. package/packages/workspace-executor/src/sandbox-tools.ts +3 -9
  136. package/packages/workspace-executor/src/shell-platform.ts +14 -3
  137. package/packages/workspace-executor/src/tools.ts +0 -3
  138. package/plugins/ragents.ask/ask-payload.ts +9 -0
  139. package/plugins/ragents.ask/server/ask-service.ts +53 -13
  140. package/plugins/ragents.ask/web/AskActionView.tsx +3 -2
  141. package/plugins/ragents.browser/executor/index.ts +5 -0
  142. package/{packages/workspace-executor/src/browser → plugins/ragents.browser/executor}/module.ts +25 -31
  143. package/{packages/workspace-executor/src/browser → plugins/ragents.browser/executor}/playwright.ts +9 -23
  144. package/plugins/ragents.browser/provision.ts +1 -1
  145. package/plugins/ragents.browser/server/browser.ts +3 -3
  146. package/plugins/ragents.browser/server/contract.ts +2 -2
  147. package/plugins/ragents.browser/server/index.ts +1 -1
  148. package/plugins/ragents.lsp-fsharp/executor.ts +80 -0
  149. package/plugins/ragents.lsp-fsharp/provision.ts +1 -1
  150. package/plugins/ragents.lsp-fsharp/server/index.ts +2 -2
  151. package/plugins/ragents.lsp-roslyn/executor.ts +64 -0
  152. package/plugins/ragents.lsp-roslyn/provision.ts +1 -1
  153. package/plugins/ragents.lsp-roslyn/server/index.ts +28 -5
  154. package/plugins/ragents.lsp-roslyn/server/solution-on-start.ts +18 -6
  155. package/plugins/ragents.lsp-typescript/executor.ts +50 -0
  156. package/plugins/ragents.lsp-typescript/server/index.ts +2 -2
  157. package/plugins/ragents.model-relay/server/config.ts +1 -1
  158. package/plugins/ragents.model-relay/server/relay.ts +4 -2
  159. package/plugins/ragents.profile-distribution/server/archive.ts +2 -1
  160. package/plugins/ragents.workspace/client/workspace-client.ts +111 -28
  161. package/plugins/ragents.workspace/contract.ts +33 -2
  162. package/plugins/ragents.workspace/server/binding.ts +10 -4
  163. package/plugins/ragents.workspace/server/clients.ts +56 -9
  164. package/plugins/ragents.workspace/server/config.ts +9 -0
  165. package/plugins/ragents.workspace/server/index.ts +13 -4
  166. package/plugins/ragents.workspace/server/runtime.ts +10 -0
  167. package/plugins/ragents.workspace/server/shell-platform.ts +6 -5
  168. package/plugins/ragents.workspace/web/WorkspaceBinding.tsx +1 -1
  169. package/ragents.config.core.ts +4 -1
  170. package/ragents.config.showcase.ts +4 -1
  171. package/scripts/agent/journal.ts +3 -1
  172. package/scripts/package/build-package.ts +3 -1
  173. package/scripts/package/publish-package.ts +4 -3
  174. package/scripts/provision/run-provision.ts +2 -2
  175. package/scripts/workspace-client/run-workspace-client.ts +7 -4
  176. package/apps/web/dist/help/screenshots/release-checklist-vscode.png +0 -0
  177. package/apps/web/dist/help/screenshots/release-checklist-web.png +0 -0
  178. package/bundles/ragents.ask/web/chunks/chunk-HGFDGTNC.js +0 -2
  179. package/bundles/ragents.ask/web/chunks/chunk-HGFDGTNC.js.map +0 -7
  180. package/bundles/ragents.browser/server/chunks/chunk-2GKLLCBE.js.map +0 -7
  181. package/packages/workspace-executor/src/language-server/adapters/fsharp.ts +0 -60
  182. package/packages/workspace-executor/src/language-server/adapters/index.ts +0 -7
  183. package/packages/workspace-executor/src/language-server/adapters/roslyn.ts +0 -56
  184. package/packages/workspace-executor/src/language-server/adapters/typescript.ts +0 -74
  185. package/packages/workspace-executor/src/language-server/solution.ts +0 -13
  186. /package/{packages/workspace-executor/src/browser → plugins/ragents.browser/executor}/contract.ts +0 -0
  187. /package/{packages/workspace-executor/src/browser → plugins/ragents.browser/executor}/pages.ts +0 -0
@@ -1,5 +1,6 @@
1
1
  import { mkdir, realpath } from "node:fs/promises";
2
2
  import path from "node:path";
3
+ import { Value } from "typebox/value";
3
4
  import {
4
5
  DomainError,
5
6
  serviceToken,
@@ -28,6 +29,7 @@ import {
28
29
  type SessionIdent,
29
30
  type WorkspaceExecuteOptions,
30
31
  type WorkspaceExecutor,
32
+ type WorkspaceExecutorParts,
31
33
  type WorkspaceProcessContext,
32
34
  } from "@ragents/workspace-executor";
33
35
  import { hostRoot } from "../host-version.js";
@@ -70,6 +72,8 @@ export const sandboxServicesToken = serviceToken<SandboxServices>("ragents.works
70
72
 
71
73
  export interface WorkspaceSandboxHostOptions {
72
74
  contributorName: string;
75
+ /** Was die Plugins des Profils zum Executor dieses Servers beitragen; jeder Arbeitsplatz der Runs trägt dieselben Beiträge. */
76
+ contributions: readonly WorkspaceExecutorParts[];
73
77
  workspaceFor: (runId: string) => Promise<SessionWorkspace>;
74
78
  identFor: (runId: string) => Promise<SessionIdent | undefined>;
75
79
  skillPaths: () => Promise<readonly string[]>;
@@ -83,6 +87,10 @@ export interface WorkspaceSandboxHostOptions {
83
87
  processSandbox?: RunProcessSandboxes;
84
88
  /** Die Bash des Executors dieses Servers; unter Windows Pflicht, sonst ohne Angabe die des Systems. */
85
89
  bash?: string;
90
+ /** Das rg des Executors dieses Servers; ohne Angabe gilt eines im PATH. */
91
+ rg?: string;
92
+ /** Die Zeitgrenze von bash in Sekunden für Aufrufe ohne eigene, auf jeder Maschine der Runs; ohne Angabe die des Werkzeugs. */
93
+ bashTimeoutSeconds?: number;
86
94
  }
87
95
 
88
96
  const sandboxDescriptions: Readonly<Record<string, string>> = {
@@ -98,16 +106,13 @@ const describeSandboxTool = (definition: AgentToolDefinition): AgentToolDefiniti
98
106
  return { ...definition, description, longDescription: definition.description, nativeTool: true };
99
107
  };
100
108
 
101
- const sandboxDescriptorDefinitions = [
109
+ const sandboxDefinitions = (bashTimeoutSeconds: number | undefined): readonly AgentToolDefinition[] => [
102
110
  createReadToolDefinition("."),
103
111
  createEditToolDefinition("."),
104
112
  createWriteToolDefinition("."),
105
- createBashToolDefinition("."),
113
+ createBashToolDefinition(".", bashTimeoutSeconds === undefined ? {} : { defaultTimeoutSeconds: bashTimeoutSeconds }),
106
114
  ] as readonly AgentToolDefinition[];
107
115
 
108
- const sandboxDescriptors = sandboxDescriptorDefinitions.map((definition) =>
109
- toolDescriptorFrom(describeSandboxTool(definition), alwaysAvailable));
110
-
111
116
  const fileToolNames = new Set(["read", "edit", "write"]);
112
117
 
113
118
  interface StableRunParts {
@@ -142,6 +147,7 @@ const existingRoots = async (roots: readonly ResolvedWorkspaceRoot[]): Promise<R
142
147
  /** Der Executor des Servers mit den Wurzeln des Servers; eine Operation mit Alias läuft dort, jede andere beim Executor der Bindung des Runs. */
143
148
  export class WorkspaceSandboxHost implements SandboxServices {
144
149
  readonly #options: WorkspaceSandboxHostOptions;
150
+ readonly #definitions: readonly AgentToolDefinition[];
145
151
  readonly #workspaceRoots: RegisteredWorkspaceRoot[] = [];
146
152
  readonly #local: WorkspaceOperationExecutor;
147
153
  readonly #stable = new Map<string, Promise<StableRunParts>>();
@@ -150,9 +156,10 @@ export class WorkspaceSandboxHost implements SandboxServices {
150
156
 
151
157
  constructor(options: WorkspaceSandboxHostOptions) {
152
158
  this.#options = options;
159
+ this.#definitions = sandboxDefinitions(options.bashTimeoutSeconds);
153
160
  this.#local = new WorkspaceOperationExecutor({
154
161
  contextFor: (runId) => this.serverProcessContextFor(runId),
155
- modules: workspaceExecutorModules(),
162
+ modules: workspaceExecutorModules({ contributions: options.contributions }),
156
163
  });
157
164
  }
158
165
 
@@ -234,6 +241,7 @@ export class WorkspaceSandboxHost implements SandboxServices {
234
241
  runOperation: workspace.runOperation,
235
242
  ...(sandbox ? { sandbox } : {}),
236
243
  ...(this.#options.bash === undefined ? {} : { bash: this.#options.bash }),
244
+ ...(this.#options.rg === undefined ? {} : { rg: this.#options.rg }),
237
245
  });
238
246
  }
239
247
 
@@ -288,7 +296,7 @@ export class WorkspaceSandboxHost implements SandboxServices {
288
296
  workspaceTools(): ToolContributor {
289
297
  return {
290
298
  name: this.#options.contributorName,
291
- descriptors: sandboxDescriptors,
299
+ descriptors: this.#definitions.map((definition) => toolDescriptorFrom(describeSandboxTool(definition), alwaysAvailable)),
292
300
  tools: (context) => this.#workspaceToolsFor(context),
293
301
  };
294
302
  }
@@ -330,12 +338,13 @@ export class WorkspaceSandboxHost implements SandboxServices {
330
338
  }
331
339
 
332
340
  #workspaceToolsFor(context: PluginContext): Promise<RunFunction[]> {
333
- return Promise.resolve(sandboxDescriptorDefinitions.map((definition) => {
341
+ return Promise.resolve(this.#definitions.map((definition) => {
334
342
  const described = describeSandboxTool(definition);
335
343
  const proxy = {
336
344
  ...described,
345
+ // Die Vorgaben des Schemas, etwa die Zeitgrenze von bash, setzt der Server ein; so gilt auf jeder Maschine, was das Modell im Schema sieht.
337
346
  execute: (toolCallId: string, params: unknown, signal: AbortSignal | undefined) =>
338
- this.execute(context.runId, described.name, params, {
347
+ this.execute(context.runId, described.name, Value.Default(described.parameters, structuredClone(params)), {
339
348
  toolCallId,
340
349
  ...(signal ? { signal } : {}),
341
350
  }),
@@ -1,6 +1,7 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from "node:fs";
3
3
  import path from "node:path";
4
+ import { EXECUTOR_CONTRIBUTION_FILE } from "@ragents/workspace-executor";
4
5
  import { ragentsDataRoot } from "../data-directory.js";
5
6
  import { filesBelow } from "../folder-install.js";
6
7
  import { HOST_API_VERSION, type HostApiHalf } from "../host-api.js";
@@ -9,7 +10,7 @@ import { isCheckout } from "../host-web.js";
9
10
  import { bundlesRoot, pluginIdOf } from "../plugin-support/plugins-root.js";
10
11
 
11
12
  export const BUNDLE_MANIFEST_FILE = "ragents-bundle.json";
12
- export const BUNDLE_FORMAT = 3;
13
+ export const BUNDLE_FORMAT = 4;
13
14
 
14
15
  /** The value names a half imports from each module of the host API. */
15
16
  export type HostNames = Readonly<Record<string, readonly string[]>>;
@@ -27,12 +28,14 @@ export interface BundleManifest {
27
28
  readonly sourceStand: string;
28
29
  readonly server: string;
29
30
  readonly web?: { readonly entry: string; readonly css?: string; readonly classes: string };
31
+ /** The contribution to every executor, a self-contained file that any Node process loads. */
32
+ readonly executor?: typeof EXECUTOR_CONTRIBUTION_FILE;
30
33
  readonly exports: Readonly<Record<HostApiHalf, Readonly<Record<string, string>>>>;
31
34
  readonly uses: readonly string[];
32
35
  readonly assets: readonly string[];
33
36
  }
34
37
 
35
- const MANIFEST_KEYS = new Set(["format", "id", "api", "hostNames", "stand", "sourceStand", "server", "web", "exports", "uses", "assets"]);
38
+ const MANIFEST_KEYS = new Set(["format", "id", "api", "hostNames", "stand", "sourceStand", "server", "web", "executor", "exports", "uses", "assets"]);
36
39
  const SOURCE_MARKERS = ["ragents-plugin.json", "server/index.ts", "server/index.tsx"];
37
40
 
38
41
  const isRecord = (value: unknown): value is Record<string, unknown> =>
@@ -167,6 +170,7 @@ export const readBundleManifest = (folder: string): BundleManifest => {
167
170
  ...(typeof raw.sourceStand === "string" ? [] : ["sourceStand"]),
168
171
  ...(typeof raw.server === "string" ? [] : ["server"]),
169
172
  ...(isWeb(raw.web) ? [] : ["web"]),
173
+ ...(raw.executor === undefined || raw.executor === EXECUTOR_CONTRIBUTION_FILE ? [] : ["executor"]),
170
174
  ...(isRecord(raw.exports) && isPathRecord(raw.exports.server) && isPathRecord(raw.exports.web) ? [] : ["exports"]),
171
175
  ...(isStringList(raw.uses) ? [] : ["uses"]),
172
176
  ...(isStringList(raw.assets) ? [] : ["assets"]),
@@ -176,7 +180,7 @@ export const readBundleManifest = (folder: string): BundleManifest => {
176
180
  const webFiles = web === undefined ? [] : [web.entry, web.classes, ...(web.css === undefined ? [] : [web.css])];
177
181
  const misplaced = webFiles.filter((entry) => !entry.startsWith("web/") || entry.split("/").includes(".."));
178
182
  if (misplaced.length > 0) throw new Error(`${file}: ${misplaced.join(", ")} liegt nicht unter web/; ${rebuildHint(folder)}`);
179
- for (const required of [raw.server as string, ...webFiles]) {
183
+ for (const required of [raw.server as string, ...webFiles, ...(raw.executor === undefined ? [] : [EXECUTOR_CONTRIBUTION_FILE])]) {
180
184
  if (!statSync(path.join(folder, required), { throwIfNoEntry: false })?.isFile()) throw new Error(`Dem Bundle ${id} fehlt ${required}; ${rebuildHint(folder)}`);
181
185
  }
182
186
  return raw as unknown as BundleManifest;
@@ -1,4 +1,5 @@
1
1
  import { PluginHost, type PluginWebAddresses } from "@ragents/engine";
2
+ import { pluginToolsDirectory, prepareExecutorContribution, type LoadedExecutorContribution } from "@ragents/workspace-executor";
2
3
  import { config, HOST_SECRET_ENV_NAMES } from "../config.js";
3
4
  import { SESSION_MODE, SESSIONS_MODE } from "../layout.js";
4
5
  import { withFolderAssets } from "../plugin-support/plugin-folder.js";
@@ -6,6 +7,7 @@ import type { PluginModule } from "../plugin-support/plugin-module.js";
6
7
  import { runManagementToken } from "../ragents/global-chat.js";
7
8
  import { registerTypeScriptFunctions } from "../ragents/typescript-tools.js";
8
9
  import {
10
+ executorContributionsToken,
9
11
  hostAddressToken,
10
12
  runtimeProviderToken,
11
13
  secretEnvNamesToken,
@@ -27,6 +29,8 @@ export interface ProfileComposition {
27
29
  readonly modules: ReadonlyMap<string, PluginModule>;
28
30
  /** The plugins with a web half and where the browser loads it; the web loads exactly these. */
29
31
  readonly web: ReadonlyMap<string, PluginWebAddresses>;
32
+ /** Die Beiträge der Bundles zum Executor; der Server baut sie mit den Werkzeugordnern seines Datenordners. */
33
+ readonly executor: readonly LoadedExecutorContribution[];
30
34
  /** Die Vorlage aus defaultStartEntry der Profildatei; der Host lehnt eine nicht registrierte beim Versiegeln ab. */
31
35
  readonly defaultStartEntry?: string;
32
36
  }
@@ -43,6 +47,8 @@ export const composeProfile = (options: ProfileComposition, bridges: HostBridges
43
47
  host.provideHost(runWorkspaceProviderToken, bridges.sessionWorkspaceFor);
44
48
  host.provideHost(runtimeProviderToken, bridges.runtime);
45
49
  host.provideHost(hostAddressToken, () => bridges.apiBaseUrl);
50
+ host.provideHost(executorContributionsToken, options.executor.map((loaded) =>
51
+ prepareExecutorContribution(loaded, pluginToolsDirectory(config.dataDir, loaded.plugin))));
46
52
  host.provideHost(runManagementToken, () => {
47
53
  if (!bridges.sessions) throw new Error("Der Host stellt keine Sitzungsverwaltung bereit");
48
54
  return bridges.sessions();
@@ -2,6 +2,7 @@ import { existsSync, readdirSync, realpathSync, statSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import type { PluginWebAddresses } from "@ragents/engine";
5
+ import { loadExecutorContribution, type LoadedExecutorContribution } from "@ragents/workspace-executor";
5
6
  import { announceBundles } from "../host-resolution.js";
6
7
  import { checkedHostApiRecord } from "../host-version.js";
7
8
  import { isPluginModule, type PluginModule } from "../plugin-support/plugin-module.js";
@@ -133,6 +134,8 @@ export interface LoadedPlugins {
133
134
  readonly bundles: readonly ResolvedPlugin[];
134
135
  /** The plugins whose bundle carries a web half, with the addresses the browser loads it from. */
135
136
  readonly web: ReadonlyMap<string, PluginWebAddresses>;
137
+ /** The contributions to every executor, in the order of the plugin list; each machine builds them for itself. */
138
+ readonly executor: readonly LoadedExecutorContribution[];
136
139
  }
137
140
 
138
141
  export const loadPlugins = async (
@@ -160,5 +163,7 @@ export const loadPlugins = async (
160
163
  const addresses = webAddressesOf(plugin);
161
164
  return addresses === undefined ? [] : [[plugin.id, addresses] as const];
162
165
  }));
163
- return { known, ids, modules, bundles: plugins, web };
166
+ const executor = await Promise.all(plugins.flatMap((plugin) => plugin.manifest.executor === undefined ? []
167
+ : [loadExecutorContribution(plugin.id, path.join(plugin.folder, plugin.manifest.executor))]));
168
+ return { known, ids, modules, bundles: plugins, web, executor };
164
169
  };
@@ -1,10 +1,7 @@
1
1
  import { mkdir } from "node:fs/promises";
2
2
  import { hostDataDirectory, pluginToolsDirectory } from "@ragents/workspace-executor/src/tools.ts";
3
3
  import { isPluginProvision, type PluginProvision } from "../plugin-support/provision.js";
4
- import { importBundles, resolvePluginEntries, type ResolvedPlugin } from "./plugin-discovery.js";
5
-
6
- /** Die Plugins, deren Werkzeuge jeder Arbeitsplatz-Executor auf seiner Maschine braucht: Sprachserver und Browser. */
7
- export const WORKSPACE_PROVISION_PLUGINS = ["ragents.lsp-roslyn", "ragents.lsp-fsharp", "ragents.browser"] as const;
4
+ import { discoverPluginIds, importBundles, resolvePluginEntries, type ResolvedPlugin } from "./plugin-discovery.js";
8
5
 
9
6
  /** The provisioning a bundle exports next to its plugin, if it brings one. */
10
7
  const provisionOf = (plugin: ResolvedPlugin, exported: Readonly<Record<string, unknown>>): PluginProvision | undefined => {
@@ -81,5 +78,9 @@ const withUsedBundles = (ids: readonly string[]): readonly ResolvedPlugin[] => {
81
78
  return [...resolved.values()];
82
79
  };
83
80
 
81
+ /** Ein Arbeitsplatz hat kein Profil; er provisioniert die eingebauten Plugins seines Hosts, die zum Executor beitragen, denn deren Werkzeuge laufen auf ihm. */
82
+ export const workspaceProvisionPlugins = (): readonly ResolvedPlugin[] => withUsedBundles(
83
+ resolvePluginEntries(discoverPluginIds()).filter((plugin) => plugin.manifest.executor !== undefined).map((plugin) => plugin.id));
84
+
84
85
  export const provisionWorkspace = (log: (line: string) => void): Promise<readonly PluginProvisionReport[]> =>
85
- provisionPlugins(withUsedBundles(WORKSPACE_PROVISION_PLUGINS), hostDataDirectory(), log);
86
+ provisionPlugins(workspaceProvisionPlugins(), hostDataDirectory(), log);
@@ -206,7 +206,6 @@ export const createEngine = async (options: EngineOptions): Promise<Engine> => {
206
206
  resolveSkills: async (context) => globalChat?.isCoordinator(context.runId) ? []
207
207
  : (await options.plugins.skills.resolve(contributionContextFor(context))).map(skillOfDirectory),
208
208
  resolveHooks: (context) => globalChat?.isCoordinator(context.runId) ? [] : options.plugins.agentRuntime.resolve(contributionContextFor(context)),
209
- settings: { compaction: config.agentCompaction },
210
209
  });
211
210
  const configuredModels = await Promise.all(options.plugins.profiles.models().map(async (model) => {
212
211
  if (model.driver !== "agent") return model;
@@ -271,32 +270,39 @@ export const createEngine = async (options: EngineOptions): Promise<Engine> => {
271
270
  });
272
271
  const boundToTools = (entry: PublicPromptContribution, toolNames: readonly string[]): boolean =>
273
272
  entry.requiresTools.some((name) => toolNames.includes(name));
274
- /** Ein Beitrag darf je Run anders lauten, etwa die Shell-Plattform des Executors, der den Run ausführt. */
275
- const contentFor = (runId: string | null): ((entry: PublicPromptContribution) => string) => {
273
+ /** Ein Beitrag darf je Run anders lauten oder fehlen, etwa die Shell-Plattform des Executors oder ein Plugin, dessen Laufbedingung nicht zutrifft; das gilt auch für die gewählten Systemprompts. */
274
+ const contentFor = (runId: string | null, texts: () => readonly string[]): ((entry: PublicPromptContribution) => string) => {
276
275
  const overrides = runId === null ? undefined : options.plugins.prompts.runOverrides(runId);
277
- return (entry) => overrides?.get(entry.id) ?? entry.content;
276
+ return (entry) => overrides?.get(entry.id)
277
+ ?? (systemPromptSelectionPromptIds.has(entry.id) ? texts().join("\n\n") : entry.content);
278
278
  };
279
279
  const composeWith = (runId: string | null, texts: readonly string[], toolNames: readonly string[] | null): string => {
280
- const content = contentFor(runId);
280
+ const content = contentFor(runId, () => texts);
281
281
  return baseSnapshot
282
282
  .contributions
283
283
  .filter((entry) => entry.delivery === "initial")
284
284
  .filter((entry) => toolNames === null || entry.requiresTools.length === 0 || boundToTools(entry, toolNames))
285
- .map((entry) => systemPromptSelectionPromptIds.has(entry.id) ? texts.join("\n\n") : content(entry))
285
+ .map(content)
286
286
  .filter(Boolean)
287
287
  .join("\n\n");
288
288
  };
289
- const chaptersFor = async (toolNames: readonly string[]): Promise<string> => {
289
+ const chaptersFor = async (runId: string, toolNames: readonly string[]): Promise<string> => {
290
290
  const chapters = await options.plugins.prompts.describe({
291
291
  }, { delivery: "on-demand", toolNames });
292
- return chapters.map((entry) => entry.content).filter(Boolean).join("\n\n");
292
+ const content = contentFor(runId, () => []);
293
+ return chapters.map(content).filter(Boolean).join("\n\n");
293
294
  };
294
295
  const systemPromptFor = (runId: string): string => globalChat?.isCoordinator(runId)
295
296
  ? globalChat.prompt : composeWith(runId, textsFor(runId), null);
296
297
  const coordinatorPromptFor = (runId: string, toolNames: readonly string[]): string =>
297
298
  composeWith(runId, textsFor(runId), toolNames);
298
- const agentPromptFor = (runId: string): string =>
299
- storedSystemPrompt(journal.stateOf(runId)).shareWithAgents ? textsFor(runId).join("\n\n") : "";
299
+ const selectionPrompts = baseSnapshot.contributions.filter((entry) => systemPromptSelectionPromptIds.has(entry.id));
300
+ const agentPromptFor = (runId: string): string => {
301
+ if (!storedSystemPrompt(journal.stateOf(runId)).shareWithAgents) return "";
302
+ if (selectionPrompts.length === 0) return textsFor(runId).join("\n\n");
303
+ const content = contentFor(runId, () => textsFor(runId));
304
+ return selectionPrompts.map(content).filter(Boolean).join("\n\n");
305
+ };
300
306
  const systemPrompt = composeWith(
301
307
  null,
302
308
  selectedSystemPrompts(promptCatalog, promptCatalog.defaultIds).map((option) => optionTexts.get(option.id) ?? ""),
@@ -309,7 +315,7 @@ export const createEngine = async (options: EngineOptions): Promise<Engine> => {
309
315
  : [agentPromptFor(runId), actor.kind === "agent" ? actor.prompt : "",
310
316
  ...baseSnapshot.contributions
311
317
  .filter((entry) => entry.delivery === "initial" && boundToTools(entry, toolNames))
312
- .map(contentFor(runId)),
318
+ .map(contentFor(runId, () => textsFor(runId))),
313
319
  ].filter(Boolean).join("\n\n");
314
320
  return [prompt, productRuntime.contract(role), outputContractFor(role)]
315
321
  .filter(Boolean)
@@ -331,7 +337,7 @@ export const createEngine = async (options: EngineOptions): Promise<Engine> => {
331
337
  ...(workspaceToolNaming ? { workspaceToolNaming } : {}),
332
338
  basePrompt: basePromptFor,
333
339
  contract: (actor) => coreContractFor(actor),
334
- toolChapters: (_runId, _actor, toolNames) => chaptersFor(toolNames),
340
+ toolChapters: (runId, _actor, toolNames) => chaptersFor(runId, toolNames),
335
341
  onError: (error) => console.error(`Turn fehlgeschlagen: ${error instanceof Error ? error.stack ?? error.message : String(error)}`),
336
342
  });
337
343
  const stopExternal: RunStopBoundary = (runId, stopJournal) => scheduler.haltRun(runId, async (
@@ -5,6 +5,7 @@ import {
5
5
  type PluginHost,
6
6
  type ServiceToken,
7
7
  } from "@ragents/engine";
8
+ import type { PreparedExecutorContribution } from "@ragents/workspace-executor";
8
9
  import type { SessionWorkspace } from "./workspace-runtime.js";
9
10
  import type { RunManagement } from "./global-chat.js";
10
11
 
@@ -23,6 +24,9 @@ export const runtimeProviderToken: ServiceToken<() => Orchestration> = serviceTo
23
24
  /** Die Adresse, unter der dieser Server seine API anbietet, etwa http://127.0.0.1:4710; ohne HTTP (nur stdio) keine. */
24
25
  export const hostAddressToken: ServiceToken<() => string | undefined> = serviceToken("host.address");
25
26
 
27
+ /** Die Beiträge der Bundles dieses Profils zum Executor, gebaut für den Server; jeder Executor des Servers trägt sie, jeder Arbeitsplatz dieselben. */
28
+ export const executorContributionsToken: ServiceToken<readonly PreparedExecutorContribution[]> = serviceToken("host.executor-contributions");
29
+
26
30
  export interface HostBridges {
27
31
  ensureSession: (runId: string) => void;
28
32
  ensureWorkspaceAccess: (access: AccessContext, runId: string) => void;
@@ -464,7 +464,7 @@ export class RunChatSession implements ChatSessionLike {
464
464
  this.#engine.runtime.enqueueInput(
465
465
  { actorId: state.ownerId, commandId: `chat:${randomUUID()}` },
466
466
  this.id,
467
- { actorId: primaryActorId, content: text, artifactIds, sourceEventIds },
467
+ { actorId: primaryActorId, content: text, artifactIds, sourceEventIds, origin: "human" },
468
468
  );
469
469
  }
470
470
 
@@ -170,6 +170,7 @@ const composition: ProfileComposition = {
170
170
  pluginIds: loaded.ids,
171
171
  modules: loaded.modules,
172
172
  web: loaded.web,
173
+ executor: loaded.executor,
173
174
  ...(defaultStartEntry !== undefined ? { defaultStartEntry } : {}),
174
175
  };
175
176
 
@@ -33,6 +33,8 @@
33
33
  "src",
34
34
  "../../plugins/*/server",
35
35
  "../../plugins/*/contract.ts",
36
+ "../../plugins/*/executor.ts",
37
+ "../../plugins/*/executor",
36
38
  "../../ragents.config.*.ts"
37
39
  ]
38
40
  }
@@ -1 +1 @@
1
- import{r,S as d,E as p,j as E,c as f}from"./mermaid-HWGCJPDP-kxkB991i.js";var j=({code:i,language:e,maxHeight:o,raw:a,className:u,startLine:m,lineNumbers:n,...h})=>{let{shikiTheme:l}=r.useContext(d),t=p(),[c,s]=r.useState(a);return r.useEffect(()=>{if(!t){s(a);return}let g=t.highlight({code:i,language:e,themes:l},x=>{s(x)});g&&s(g)},[i,e,l,t,a]),E.jsx(f,{className:u,language:e,lineNumbers:n,maxHeight:o,result:c,startLine:m,...h})};export{j as HighlightedCodeBlockBody};
1
+ import{r,S as d,E as p,j as E,c as f}from"./mermaid-HWGCJPDP-DfsU5ofC.js";var j=({code:i,language:e,maxHeight:o,raw:a,className:u,startLine:m,lineNumbers:n,...h})=>{let{shikiTheme:l}=r.useContext(d),t=p(),[c,s]=r.useState(a);return r.useEffect(()=>{if(!t){s(a);return}let g=t.highlight({code:i,language:e,themes:l},x=>{s(x)});g&&s(g)},[i,e,l,t,a]),E.jsx(f,{className:u,language:e,lineNumbers:n,maxHeight:o,result:c,startLine:m,...h})};export{j as HighlightedCodeBlockBody};
@@ -1,4 +1,4 @@
1
- import{a as De,r as t,j as e,D as oe,b as ce,d as G,B as b,X as Le,M as Pe,C as de,e as Me,f as Oe,g as He,h as Ie,u as Be,i as _e,k as Fe,l as Ue,m as Ke,A as Te,n as qe,o as We,p as $e,U as Qe,P as Ve,W as Ge,R as Xe,q as ae,s as V,t as Je,v as Ye,w as Ze,x as et,y as tt,z as st,F as nt,Q as rt,G as at,H as it}from"./mermaid-HWGCJPDP-kxkB991i.js";/**
1
+ import{a as De,r as t,j as e,D as oe,b as ce,d as G,B as b,X as Le,M as Pe,C as de,e as Me,f as Oe,g as He,h as Ie,u as Be,i as _e,k as Fe,l as Ue,m as Ke,A as Te,n as qe,o as We,p as $e,U as Qe,P as Ve,W as Ge,R as Xe,q as ae,s as V,t as Je,v as Ye,w as Ze,x as et,y as tt,z as st,F as nt,Q as rt,G as at,H as it}from"./mermaid-HWGCJPDP-DfsU5ofC.js";/**
2
2
  * @license lucide-react v1.46.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.