rterm-backend 3.1.7 → 3.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 (2) hide show
  1. package/bin/gybackend.cjs +55 -5
  2. package/package.json +2 -2
package/bin/gybackend.cjs CHANGED
@@ -367406,6 +367406,10 @@ var AgentService_v2 = class {
367406
367406
  backgroundFileTransferCompleter = null;
367407
367407
  unfinishedBackgroundFileTransferProvider = null;
367408
367408
  imageAttachmentService = null;
367409
+ /** Plugin tools: name → handler (injected from PluginRegistry at boot). */
367410
+ pluginTools = /* @__PURE__ */ new Map();
367411
+ /** Plugin tool schemas (for toolsForModel injection). */
367412
+ pluginToolSchemas = [];
367409
367413
  passChatTempExportService = new PassChatTempExportService();
367410
367414
  fallbackCompactionHistoryExportService = null;
367411
367415
  activeAgentRunIdsBySession = /* @__PURE__ */ new Map();
@@ -367452,6 +367456,18 @@ var AgentService_v2 = class {
367452
367456
  setObservability(obs2) {
367453
367457
  this.observability = obs2 ?? void 0;
367454
367458
  }
367459
+ /** Wire plugin tools (from PluginRegistry) so the agent can call them in chat.
367460
+ * Each plugin tool has: name, description, params (schema), handler (async fn).
367461
+ * The tools are injected into toolsForModel (so the model sees them) and
367462
+ * pluginTools (so the dispatch switch's default case can call them). */
367463
+ setPluginTools(tools2) {
367464
+ this.pluginTools = new Map(tools2.map((t) => [t.name, t.handler]));
367465
+ this.pluginToolSchemas = tools2.map((t) => ({
367466
+ name: t.name,
367467
+ description: t.description,
367468
+ schema: t.params || {}
367469
+ }));
367470
+ }
367455
367471
  /** Wire a session-log handle so list_session_logs / read_session_log work. */
367456
367472
  setSessionLogger(logger) {
367457
367473
  this.sessionLogger = logger ?? void 0;
@@ -367640,6 +367656,7 @@ var AgentService_v2 = class {
367640
367656
  compactionItem?.apiKey ? compactionItem.profile : void 0
367641
367657
  );
367642
367658
  const toolsForModel = buildToolsForModel(readFileSupport);
367659
+ const allToolsForModel = [...toolsForModel, ...this.pluginToolSchemas];
367643
367660
  return {
367644
367661
  profileId,
367645
367662
  model,
@@ -367653,7 +367670,7 @@ var AgentService_v2 = class {
367653
367670
  compactionModelSupportsStructuredOutput,
367654
367671
  compactionModelSupportsObjectToolChoice,
367655
367672
  readFileSupport,
367656
- toolsForModel,
367673
+ toolsForModel: allToolsForModel,
367657
367674
  globalMaxTokens: typeof globalItem.maxTokens === "number" ? globalItem.maxTokens : 2e5,
367658
367675
  thinkingMaxTokens: typeof thinkingItem?.maxTokens === "number" ? thinkingItem.maxTokens : typeof globalItem.maxTokens === "number" ? globalItem.maxTokens : 2e5,
367659
367676
  compactionMaxTokens: typeof compactionItem?.maxTokens === "number" ? compactionItem.maxTokens : typeof thinkingItem?.maxTokens === "number" ? thinkingItem.maxTokens : typeof globalItem.maxTokens === "number" ? globalItem.maxTokens : 2e5
@@ -368952,8 +368969,21 @@ Actually, your intention might be different. Please re-read the description of t
368952
368969
  }
368953
368970
  break;
368954
368971
  }
368955
- default:
368956
- result = `Tool "${toolCall.name}" is not supported.`;
368972
+ default: {
368973
+ const pluginHandler = this.pluginTools.get(toolCall.name);
368974
+ if (pluginHandler) {
368975
+ try {
368976
+ const pluginArgs = typeof toolCall.args === "string" ? JSON.parse(toolCall.args) : toolCall.args || {};
368977
+ const pluginResult = await pluginHandler(pluginArgs);
368978
+ result = typeof pluginResult === "string" ? pluginResult : JSON.stringify(pluginResult);
368979
+ } catch (err) {
368980
+ result = `Plugin tool "${toolCall.name}" error: ${err.message}`;
368981
+ }
368982
+ } else {
368983
+ result = `Tool "${toolCall.name}" is not supported.`;
368984
+ }
368985
+ break;
368986
+ }
368957
368987
  }
368958
368988
  toolMessage.content = result;
368959
368989
  if (shouldInterruptPendingToolsForQueuedInsertion) {
@@ -375199,6 +375229,7 @@ function normalizeSynapseSettings(raw) {
375199
375229
  const hasAuth = auth2 && Object.keys(auth2).length > 0;
375200
375230
  return {
375201
375231
  enabled: src.enabled !== false,
375232
+ autoServe: src.autoServe !== false,
375202
375233
  ...url2 ? { url: url2 } : {},
375203
375234
  ...servers && servers.length > 0 ? { servers } : {},
375204
375235
  ...prefix ? { prefix } : {},
@@ -391945,8 +391976,6 @@ function createObservability(deps) {
391945
391976
  ),
391946
391977
  onLog: deps.onLog
391947
391978
  });
391948
- void pluginRegistry.reload().catch(() => {
391949
- });
391950
391979
  const prometheusRegistry = new PrometheusRegistry({ prefix: "rterm" });
391951
391980
  const otelEndpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT ?? process.env.RTERM_OTLP_METRICS_ENDPOINT;
391952
391981
  const otelExporter = otelEndpoint ? new OtelExporter({
@@ -394721,6 +394750,27 @@ async function startGyBackend() {
394721
394750
  settingsService.onDidChange?.(refreshObservabilityFromSettings);
394722
394751
  agentService.setObservability(observability);
394723
394752
  terminalService.setSessionRecorder(observability.recording);
394753
+ try {
394754
+ const pluginRecords = await observability.pluginRegistry.reload();
394755
+ const pluginTools = [];
394756
+ for (const record2 of pluginRecords) {
394757
+ if (record2.error || !record2.enabled) continue;
394758
+ for (const tool2 of record2.tools) {
394759
+ pluginTools.push({
394760
+ name: tool2.name,
394761
+ description: tool2.description ?? "",
394762
+ params: tool2.params ?? {},
394763
+ handler: tool2.handler
394764
+ });
394765
+ }
394766
+ }
394767
+ if (pluginTools.length > 0) {
394768
+ agentService.setPluginTools(pluginTools);
394769
+ console.log(`[gybackend] Wired ${pluginTools.length} plugin tools from ${pluginRecords.filter((r) => !r.error && r.enabled).length} plugins into the agent.`);
394770
+ }
394771
+ } catch (e) {
394772
+ console.warn("[gybackend] Plugin tool wiring failed:", e instanceof Error ? e.message : String(e));
394773
+ }
394724
394774
  if (settingsService.getSettings().sessionLogging?.enabled) {
394725
394775
  const logDir = import_node_path28.default.join(
394726
394776
  import_node_process2.default.env.GYSHELL_STORE_DIR || "",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rterm-backend",
3
- "version": "3.1.7",
4
- "description": "Headless AI-native backend for RTerm / neuralOS — v3.1.7: always-on full-duplex Synapse agent (auto-start responder on boot when synapse.enabled + autoServe). RTerm tasks other agents AND is tasked by them from boot. 11 plugins. Transports (SSH/serial/local), SQLite, and NATS libs install automatically.",
3
+ "version": "3.1.9",
4
+ "description": "Headless AI-native backend for RTerm / neuralOS — v3.1.9: fix plugin tool wiring race condition (all 11 plugins now callable in chat). 11 plugins. Transports (SSH/serial/local), SQLite, and NATS libs install automatically.",
5
5
  "main": "bin/gybackend.cjs",
6
6
  "bin": { "gybackend": "bin/gybackend.cjs" },
7
7
  "license": "MIT",