agent-nuvira 2.7.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/agents/writer-tool-calling.d.ts +14 -0
- package/dist/agents/agents/writer-tool-calling.d.ts.map +1 -1
- package/dist/agents/agents/writer-tool-calling.js +20 -0
- package/dist/agents/agents/writer-tool-calling.js.map +1 -1
- package/dist/agents/agents/writer.d.ts.map +1 -1
- package/dist/agents/agents/writer.js +15 -4
- package/dist/agents/agents/writer.js.map +1 -1
- package/dist/agents/edit-module.d.ts +7 -0
- package/dist/agents/edit-module.d.ts.map +1 -1
- package/dist/agents/edit-module.js +21 -6
- package/dist/agents/edit-module.js.map +1 -1
- package/dist/agents/orchestrator.d.ts +40 -0
- package/dist/agents/orchestrator.d.ts.map +1 -1
- package/dist/agents/orchestrator.js +116 -27
- package/dist/agents/orchestrator.js.map +1 -1
- package/dist/agents/tool-calling-agent.d.ts +19 -0
- package/dist/agents/tool-calling-agent.d.ts.map +1 -1
- package/dist/agents/tool-calling-agent.js +42 -2
- package/dist/agents/tool-calling-agent.js.map +1 -1
- package/dist/cli/chat.d.ts +55 -1
- package/dist/cli/chat.d.ts.map +1 -1
- package/dist/cli/chat.js +239 -63
- package/dist/cli/chat.js.map +1 -1
- package/dist/cli/cli-program.d.ts +6 -0
- package/dist/cli/cli-program.d.ts.map +1 -0
- package/dist/cli/cli-program.js +222 -0
- package/dist/cli/cli-program.js.map +1 -0
- package/dist/cli/edit.d.ts.map +1 -1
- package/dist/cli/edit.js +18 -3
- package/dist/cli/edit.js.map +1 -1
- package/dist/cli/execute.d.ts.map +1 -1
- package/dist/cli/execute.js +29 -5
- package/dist/cli/execute.js.map +1 -1
- package/dist/cli/failover-runner.d.ts +13 -0
- package/dist/cli/failover-runner.d.ts.map +1 -1
- package/dist/cli/failover-runner.js +11 -0
- package/dist/cli/failover-runner.js.map +1 -1
- package/dist/cli/gateway.d.ts +16 -0
- package/dist/cli/gateway.d.ts.map +1 -1
- package/dist/cli/gateway.js +108 -2
- package/dist/cli/gateway.js.map +1 -1
- package/dist/cli/loop-executor.d.ts.map +1 -1
- package/dist/cli/loop-executor.js +245 -12
- package/dist/cli/loop-executor.js.map +1 -1
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +20 -6
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/process-control.d.ts +10 -0
- package/dist/cli/process-control.d.ts.map +1 -1
- package/dist/cli/process-control.js +73 -7
- package/dist/cli/process-control.js.map +1 -1
- package/dist/cli/router.d.ts +16 -5
- package/dist/cli/router.d.ts.map +1 -1
- package/dist/cli/router.js +31 -206
- package/dist/cli/router.js.map +1 -1
- package/dist/config/paths.d.ts +23 -0
- package/dist/config/paths.d.ts.map +1 -1
- package/dist/config/paths.js +30 -0
- package/dist/config/paths.js.map +1 -1
- package/dist/config/provider-env.d.ts +37 -0
- package/dist/config/provider-env.d.ts.map +1 -0
- package/dist/config/provider-env.js +86 -0
- package/dist/config/provider-env.js.map +1 -0
- package/dist/context/history.d.ts.map +1 -1
- package/dist/context/history.js +24 -8
- package/dist/context/history.js.map +1 -1
- package/dist/context/session-recall.d.ts +30 -0
- package/dist/context/session-recall.d.ts.map +1 -1
- package/dist/context/session-recall.js +61 -0
- package/dist/context/session-recall.js.map +1 -1
- package/dist/file.js +0 -1
- package/dist/file.js.map +1 -1
- package/dist/gateway/adapters.d.ts +10 -0
- package/dist/gateway/adapters.d.ts.map +1 -1
- package/dist/gateway/adapters.js +4 -1
- package/dist/gateway/adapters.js.map +1 -1
- package/dist/gateway/dedup.d.ts +105 -0
- package/dist/gateway/dedup.d.ts.map +1 -0
- package/dist/gateway/dedup.js +160 -0
- package/dist/gateway/dedup.js.map +1 -0
- package/dist/gateway/heartbeat.d.ts +99 -0
- package/dist/gateway/heartbeat.d.ts.map +1 -0
- package/dist/gateway/heartbeat.js +122 -0
- package/dist/gateway/heartbeat.js.map +1 -0
- package/dist/gateway/inbox.d.ts +14 -1
- package/dist/gateway/inbox.d.ts.map +1 -1
- package/dist/gateway/inbox.js.map +1 -1
- package/dist/gateway/platform-config.d.ts +5 -0
- package/dist/gateway/platform-config.d.ts.map +1 -1
- package/dist/gateway/platform-config.js +8 -13
- package/dist/gateway/platform-config.js.map +1 -1
- package/dist/gateway/registry.d.ts +47 -0
- package/dist/gateway/registry.d.ts.map +1 -1
- package/dist/gateway/registry.js +227 -21
- package/dist/gateway/registry.js.map +1 -1
- package/dist/gateway/whatsapp/baileys-bridge.d.ts +11 -1
- package/dist/gateway/whatsapp/baileys-bridge.d.ts.map +1 -1
- package/dist/gateway/whatsapp/baileys-bridge.js +64 -1
- package/dist/gateway/whatsapp/baileys-bridge.js.map +1 -1
- package/dist/gateway/whatsapp/bridge.d.ts +4 -2
- package/dist/gateway/whatsapp/bridge.d.ts.map +1 -1
- package/dist/gateway/whatsapp/bridge.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inference/factory.d.ts +16 -0
- package/dist/inference/factory.d.ts.map +1 -1
- package/dist/inference/factory.js +42 -0
- package/dist/inference/factory.js.map +1 -1
- package/dist/inference/gemini-adapter.d.ts.map +1 -1
- package/dist/inference/gemini-adapter.js +3 -0
- package/dist/inference/gemini-adapter.js.map +1 -1
- package/dist/inference/interface.d.ts +12 -0
- package/dist/inference/interface.d.ts.map +1 -1
- package/dist/inference/local-adapter.d.ts +2 -0
- package/dist/inference/local-adapter.d.ts.map +1 -1
- package/dist/inference/local-adapter.js +36 -5
- package/dist/inference/local-adapter.js.map +1 -1
- package/dist/inference/native-tools.d.ts +8 -0
- package/dist/inference/native-tools.d.ts.map +1 -1
- package/dist/inference/native-tools.js +14 -3
- package/dist/inference/native-tools.js.map +1 -1
- package/dist/inference/tool-call-utils.d.ts +66 -7
- package/dist/inference/tool-call-utils.d.ts.map +1 -1
- package/dist/inference/tool-call-utils.js +134 -13
- package/dist/inference/tool-call-utils.js.map +1 -1
- package/dist/learning/auto-router.d.ts.map +1 -1
- package/dist/learning/auto-router.js +90 -5
- package/dist/learning/auto-router.js.map +1 -1
- package/dist/learning/context-budget.d.ts +133 -0
- package/dist/learning/context-budget.d.ts.map +1 -0
- package/dist/learning/context-budget.js +196 -0
- package/dist/learning/context-budget.js.map +1 -0
- package/dist/learning/cost-tracker.d.ts.map +1 -1
- package/dist/learning/cost-tracker.js +20 -8
- package/dist/learning/cost-tracker.js.map +1 -1
- package/dist/learning/eval-framework.d.ts.map +1 -1
- package/dist/learning/eval-framework.js +6 -2
- package/dist/learning/eval-framework.js.map +1 -1
- package/dist/learning/failure-bookkeeping.d.ts +19 -0
- package/dist/learning/failure-bookkeeping.d.ts.map +1 -1
- package/dist/learning/failure-bookkeeping.js +67 -2
- package/dist/learning/failure-bookkeeping.js.map +1 -1
- package/dist/learning/feedback.d.ts.map +1 -1
- package/dist/learning/feedback.js +19 -8
- package/dist/learning/feedback.js.map +1 -1
- package/dist/learning/model-harness.d.ts +76 -0
- package/dist/learning/model-harness.d.ts.map +1 -0
- package/dist/learning/model-harness.js +119 -0
- package/dist/learning/model-harness.js.map +1 -0
- package/dist/learning/model-selection.d.ts +15 -0
- package/dist/learning/model-selection.d.ts.map +1 -1
- package/dist/learning/model-selection.js +27 -1
- package/dist/learning/model-selection.js.map +1 -1
- package/dist/learning/provider-fallback.d.ts +12 -0
- package/dist/learning/provider-fallback.d.ts.map +1 -1
- package/dist/learning/provider-fallback.js +74 -0
- package/dist/learning/provider-fallback.js.map +1 -1
- package/dist/learning/provider-revival.d.ts +106 -0
- package/dist/learning/provider-revival.d.ts.map +1 -0
- package/dist/learning/provider-revival.js +154 -0
- package/dist/learning/provider-revival.js.map +1 -0
- package/dist/learning/resilient-call.d.ts.map +1 -1
- package/dist/learning/resilient-call.js +48 -3
- package/dist/learning/resilient-call.js.map +1 -1
- package/dist/nlu/conversation-gate.d.ts +37 -0
- package/dist/nlu/conversation-gate.d.ts.map +1 -1
- package/dist/nlu/conversation-gate.js +49 -0
- package/dist/nlu/conversation-gate.js.map +1 -1
- package/dist/nlu/schema.d.ts +2 -2
- package/dist/observability/dag-bridge.d.ts +69 -0
- package/dist/observability/dag-bridge.d.ts.map +1 -0
- package/dist/observability/dag-bridge.js +56 -0
- package/dist/observability/dag-bridge.js.map +1 -0
- package/dist/observability/event-bus.d.ts +5 -10
- package/dist/observability/event-bus.d.ts.map +1 -1
- package/dist/observability/event-bus.js +10 -42
- package/dist/observability/event-bus.js.map +1 -1
- package/dist/skills/execution-audit.d.ts.map +1 -1
- package/dist/skills/execution-audit.js +17 -5
- package/dist/skills/execution-audit.js.map +1 -1
- package/dist/skills/sandbox-executor.d.ts +12 -1
- package/dist/skills/sandbox-executor.d.ts.map +1 -1
- package/dist/skills/sandbox-executor.js +28 -6
- package/dist/skills/sandbox-executor.js.map +1 -1
- package/dist/skills/secret-capture.d.ts +45 -1
- package/dist/skills/secret-capture.d.ts.map +1 -1
- package/dist/skills/secret-capture.js +82 -19
- package/dist/skills/secret-capture.js.map +1 -1
- package/dist/skills/skill-env-inventory.d.ts +79 -0
- package/dist/skills/skill-env-inventory.d.ts.map +1 -0
- package/dist/skills/skill-env-inventory.js +167 -0
- package/dist/skills/skill-env-inventory.js.map +1 -0
- package/dist/skills/skill-executor.d.ts +2 -0
- package/dist/skills/skill-executor.d.ts.map +1 -1
- package/dist/skills/skill-executor.js +19 -24
- package/dist/skills/skill-executor.js.map +1 -1
- package/dist/tools/ask-user.d.ts +14 -1
- package/dist/tools/ask-user.d.ts.map +1 -1
- package/dist/tools/ask-user.js +25 -1
- package/dist/tools/ask-user.js.map +1 -1
- package/dist/tools/followup-utils.d.ts +64 -0
- package/dist/tools/followup-utils.d.ts.map +1 -0
- package/dist/tools/followup-utils.js +158 -0
- package/dist/tools/followup-utils.js.map +1 -0
- package/dist/tools/memory-tools.d.ts +35 -0
- package/dist/tools/memory-tools.d.ts.map +1 -1
- package/dist/tools/memory-tools.js +76 -0
- package/dist/tools/memory-tools.js.map +1 -1
- package/dist/tools/pipeline-tool.d.ts.map +1 -1
- package/dist/tools/pipeline-tool.js +8 -3
- package/dist/tools/pipeline-tool.js.map +1 -1
- package/dist/tools/registry.d.ts +25 -12
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +31 -6
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/skill-tool.d.ts.map +1 -1
- package/dist/tools/skill-tool.js +52 -5
- package/dist/tools/skill-tool.js.map +1 -1
- package/dist/tools/tool-loop.d.ts +63 -1
- package/dist/tools/tool-loop.d.ts.map +1 -1
- package/dist/tools/tool-loop.js +305 -66
- package/dist/tools/tool-loop.js.map +1 -1
- package/dist/tools/toolsets.d.ts +19 -3
- package/dist/tools/toolsets.d.ts.map +1 -1
- package/dist/tools/toolsets.js +21 -5
- package/dist/tools/toolsets.js.map +1 -1
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +9 -13
- package/dist/utils/env.js.map +1 -1
- package/dist/web-dashboard/chat-console.d.ts +13 -1
- package/dist/web-dashboard/chat-console.d.ts.map +1 -1
- package/dist/web-dashboard/chat-console.js +16 -2
- package/dist/web-dashboard/chat-console.js.map +1 -1
- package/dist/web-dashboard/hub-data.d.ts +2 -0
- package/dist/web-dashboard/hub-data.d.ts.map +1 -1
- package/dist/web-dashboard/hub-data.js +4 -0
- package/dist/web-dashboard/hub-data.js.map +1 -1
- package/dist/web-dashboard/server.d.ts +6 -0
- package/dist/web-dashboard/server.d.ts.map +1 -1
- package/dist/web-dashboard/server.js +192 -3
- package/dist/web-dashboard/server.js.map +1 -1
- package/dist/web-dashboard/src/types.d.ts +31 -1
- package/dist/web-dashboard/src/types.d.ts.map +1 -1
- package/package.json +11 -1
- package/src/web-dashboard/public/assets/index-56yPnN_m.js +207 -0
- package/src/web-dashboard/public/assets/index-56yPnN_m.js.map +1 -0
- package/src/web-dashboard/public/assets/{index-C507EUWf.css → index-Cyd6tIew.css} +1 -1
- package/src/web-dashboard/public/index.html +2 -2
- package/dist/example.d.ts +0 -1
- package/dist/example.d.ts.map +0 -1
- package/dist/example.js +0 -3
- package/dist/example.js.map +0 -1
- package/dist/fresh.d.ts +0 -2
- package/dist/fresh.d.ts.map +0 -1
- package/dist/fresh.js +0 -2
- package/dist/fresh.js.map +0 -1
- package/dist/mcp/mcp-dashboard-oauth.d.ts +0 -94
- package/dist/mcp/mcp-dashboard-oauth.d.ts.map +0 -1
- package/dist/mcp/mcp-dashboard-oauth.js +0 -140
- package/dist/mcp/mcp-dashboard-oauth.js.map +0 -1
- package/dist/memory/background-sync.d.ts +0 -107
- package/dist/memory/background-sync.d.ts.map +0 -1
- package/dist/memory/background-sync.js +0 -242
- package/dist/memory/background-sync.js.map +0 -1
- package/dist/memory/cross-session.d.ts +0 -68
- package/dist/memory/cross-session.d.ts.map +0 -1
- package/dist/memory/cross-session.js +0 -153
- package/dist/memory/cross-session.js.map +0 -1
- package/dist/memory/drift-detector.d.ts +0 -76
- package/dist/memory/drift-detector.d.ts.map +0 -1
- package/dist/memory/drift-detector.js +0 -216
- package/dist/memory/drift-detector.js.map +0 -1
- package/dist/memory/enhanced-manager.d.ts +0 -105
- package/dist/memory/enhanced-manager.d.ts.map +0 -1
- package/dist/memory/enhanced-manager.js +0 -280
- package/dist/memory/enhanced-manager.js.map +0 -1
- package/dist/memory/session-extraction.d.ts +0 -93
- package/dist/memory/session-extraction.d.ts.map +0 -1
- package/dist/memory/session-extraction.js +0 -290
- package/dist/memory/session-extraction.js.map +0 -1
- package/dist/memory/sqlite-store.d.ts +0 -208
- package/dist/memory/sqlite-store.d.ts.map +0 -1
- package/dist/memory/sqlite-store.js +0 -556
- package/dist/memory/sqlite-store.js.map +0 -1
- package/dist/skills/daytona-executor.d.ts +0 -78
- package/dist/skills/daytona-executor.d.ts.map +0 -1
- package/dist/skills/daytona-executor.js +0 -256
- package/dist/skills/daytona-executor.js.map +0 -1
- package/dist/skills/modal-executor.d.ts +0 -81
- package/dist/skills/modal-executor.d.ts.map +0 -1
- package/dist/skills/modal-executor.js +0 -285
- package/dist/skills/modal-executor.js.map +0 -1
- package/dist/sync/inventory.d.ts +0 -1
- package/dist/sync/inventory.d.ts.map +0 -1
- package/dist/sync/inventory.js +0 -3
- package/dist/sync/inventory.js.map +0 -1
- package/dist/sync/validate.d.ts +0 -1
- package/dist/sync/validate.d.ts.map +0 -1
- package/dist/sync/validate.js +0 -3
- package/dist/sync/validate.js.map +0 -1
- package/dist/test.d.ts +0 -2
- package/dist/test.d.ts.map +0 -1
- package/dist/test.js +0 -3
- package/dist/test.js.map +0 -1
- package/dist/tools/browser-tool.d.ts +0 -206
- package/dist/tools/browser-tool.d.ts.map +0 -1
- package/dist/tools/browser-tool.js +0 -726
- package/dist/tools/browser-tool.js.map +0 -1
- package/dist/tools/delegate-tool.d.ts +0 -109
- package/dist/tools/delegate-tool.d.ts.map +0 -1
- package/dist/tools/delegate-tool.js +0 -185
- package/dist/tools/delegate-tool.js.map +0 -1
- package/dist/tools/delegation-state.d.ts +0 -87
- package/dist/tools/delegation-state.d.ts.map +0 -1
- package/dist/tools/delegation-state.js +0 -278
- package/dist/tools/delegation-state.js.map +0 -1
- package/dist/tools/desktop-ui.d.ts +0 -148
- package/dist/tools/desktop-ui.d.ts.map +0 -1
- package/dist/tools/desktop-ui.js +0 -486
- package/dist/tools/desktop-ui.js.map +0 -1
- package/dist/tools/image-video-tool.d.ts +0 -88
- package/dist/tools/image-video-tool.d.ts.map +0 -1
- package/dist/tools/image-video-tool.js +0 -276
- package/dist/tools/image-video-tool.js.map +0 -1
- package/dist/tools/kanban-cron-tools.d.ts +0 -92
- package/dist/tools/kanban-cron-tools.d.ts.map +0 -1
- package/dist/tools/kanban-cron-tools.js +0 -197
- package/dist/tools/kanban-cron-tools.js.map +0 -1
- package/dist/tools/messaging-tool.d.ts +0 -127
- package/dist/tools/messaging-tool.d.ts.map +0 -1
- package/dist/tools/messaging-tool.js +0 -314
- package/dist/tools/messaging-tool.js.map +0 -1
- package/dist/tools/modality/generic-caller.d.ts +0 -43
- package/dist/tools/modality/generic-caller.d.ts.map +0 -1
- package/dist/tools/modality/generic-caller.js +0 -254
- package/dist/tools/modality/generic-caller.js.map +0 -1
- package/dist/tools/modality/modality-catalog.d.ts +0 -134
- package/dist/tools/modality/modality-catalog.d.ts.map +0 -1
- package/dist/tools/modality/modality-catalog.js +0 -445
- package/dist/tools/modality/modality-catalog.js.map +0 -1
- package/dist/tools/modality/tool-router.d.ts +0 -81
- package/dist/tools/modality/tool-router.d.ts.map +0 -1
- package/dist/tools/modality/tool-router.js +0 -84
- package/dist/tools/modality/tool-router.js.map +0 -1
- package/dist/tools/security-tools.d.ts +0 -107
- package/dist/tools/security-tools.d.ts.map +0 -1
- package/dist/tools/security-tools.js +0 -264
- package/dist/tools/security-tools.js.map +0 -1
- package/dist/tools/ssh-tool.d.ts +0 -130
- package/dist/tools/ssh-tool.d.ts.map +0 -1
- package/dist/tools/ssh-tool.js +0 -328
- package/dist/tools/ssh-tool.js.map +0 -1
- package/dist/tools/tts-tool.d.ts +0 -91
- package/dist/tools/tts-tool.d.ts.map +0 -1
- package/dist/tools/tts-tool.js +0 -406
- package/dist/tools/tts-tool.js.map +0 -1
- package/dist/utils/shell-detection.d.ts +0 -124
- package/dist/utils/shell-detection.d.ts.map +0 -1
- package/dist/utils/shell-detection.js +0 -305
- package/dist/utils/shell-detection.js.map +0 -1
- package/dist/utils/windows-paths.d.ts +0 -185
- package/dist/utils/windows-paths.d.ts.map +0 -1
- package/dist/utils/windows-paths.js +0 -472
- package/dist/utils/windows-paths.js.map +0 -1
- package/src/web-dashboard/public/assets/index-C4frng1Q.js +0 -207
- package/src/web-dashboard/public/assets/index-C4frng1Q.js.map +0 -1
|
@@ -16,6 +16,7 @@ import { join, extname, dirname, basename, resolve, isAbsolute } from 'node:path
|
|
|
16
16
|
import { fileURLToPath } from 'node:url';
|
|
17
17
|
import { homedir } from 'node:os';
|
|
18
18
|
import { parseRbacUsers } from '../enterprise/rbac.js';
|
|
19
|
+
import { registerDagHandlers } from '../observability/dag-bridge.js';
|
|
19
20
|
import { resolveBuffConfigDir, resolveBuffConfigPath, resolveNuviraHome } from '../config/paths.js';
|
|
20
21
|
import { loadEnv } from '../utils/env.js';
|
|
21
22
|
import { ConfigManager } from '../config/manager.js';
|
|
@@ -563,6 +564,20 @@ export function resetDAG() {
|
|
|
563
564
|
activeLoopTurn = null;
|
|
564
565
|
broadcastDAG();
|
|
565
566
|
}
|
|
567
|
+
// ─── Dependency inversion: publish the DAG API to producers ────────────────
|
|
568
|
+
// `observability/event-bus.ts` (imported by nearly everything) and
|
|
569
|
+
// `agents/orchestrator.ts` need to write this graph, but they must NOT import
|
|
570
|
+
// this module: doing so put the web layer in the agent's dependency closure and
|
|
571
|
+
// created an import cycle (they used `await import()` to dodge it, which still
|
|
572
|
+
// loaded 270 KB of dashboard in every CLI run). Instead they import the tiny
|
|
573
|
+
// `observability/dag-bridge.ts`, and this module registers the real
|
|
574
|
+
// implementation — the composition-root pattern, in the direction that keeps
|
|
575
|
+
// load order sane.
|
|
576
|
+
registerDagHandlers({
|
|
577
|
+
pushDAGUpdate: (update) => pushDAGUpdate(update),
|
|
578
|
+
updateDAGNode: (nodeId, patch) => updateDAGNode(nodeId, patch),
|
|
579
|
+
resetDAG: () => resetDAG(),
|
|
580
|
+
});
|
|
566
581
|
/** Broadcast current DAG state to all SSE clients */
|
|
567
582
|
function broadcastDAG() {
|
|
568
583
|
const dagData = {
|
|
@@ -2353,6 +2368,22 @@ let dashboardShutdownAction = () => {
|
|
|
2353
2368
|
export function setDashboardShutdownForTest(action) {
|
|
2354
2369
|
dashboardShutdownAction = action ?? (() => { });
|
|
2355
2370
|
}
|
|
2371
|
+
/**
|
|
2372
|
+
* The gateway-stop action behind `POST /api/admin/shutdown {target:'gateway'}`.
|
|
2373
|
+
* `null` (the default) → the REAL `stopGateway()`, which discovers the gateway
|
|
2374
|
+
* by command line and SIGTERMs it.
|
|
2375
|
+
*
|
|
2376
|
+
* Swappable because that discovery is machine-wide: running the test suite on a
|
|
2377
|
+
* machine with a LIVE gateway stops it (observed — the suite killed a supervised
|
|
2378
|
+
* gateway mid-run, and the test's own comment assumed "no `gateway start`
|
|
2379
|
+
* process running in the test sandbox"). A test asserting the ROUTE must not
|
|
2380
|
+
* reach out and kill a real service.
|
|
2381
|
+
*/
|
|
2382
|
+
let gatewayShutdownAction = null;
|
|
2383
|
+
/** Test hook: stub the gateway-stop action (null restores the real one). */
|
|
2384
|
+
export function setGatewayShutdownForTest(action) {
|
|
2385
|
+
gatewayShutdownAction = action;
|
|
2386
|
+
}
|
|
2356
2387
|
/** Invoke the current dashboard shutdown action (used by the shutdown route). */
|
|
2357
2388
|
function runDashboardShutdown() {
|
|
2358
2389
|
dashboardShutdownAction();
|
|
@@ -2527,6 +2558,41 @@ function handleRequest(req, res) {
|
|
|
2527
2558
|
}
|
|
2528
2559
|
return;
|
|
2529
2560
|
}
|
|
2561
|
+
// ── Skill execution audit (`ExecutionHistory` panel) ───────────────────
|
|
2562
|
+
// SKILL RUNS WERE INVISIBLE. `skills/execution-audit.ts` (a complete audit
|
|
2563
|
+
// backend: log/query/stats/cleanup/export) and `ExecutionHistory.tsx` (a
|
|
2564
|
+
// complete panel matching its entry shape field-for-field) were BOTH
|
|
2565
|
+
// unreferenced — nothing wrote the log and nothing could read it, so a skill
|
|
2566
|
+
// execution left no inspectable trace anywhere in the product.
|
|
2567
|
+
//
|
|
2568
|
+
// Runtime import keeps this module free of a static edge into the skills tree.
|
|
2569
|
+
// Filters mirror the panel: skillName / status / limit.
|
|
2570
|
+
if (pathname === '/api/executions') {
|
|
2571
|
+
const skillName = url.searchParams.get('skillName') ?? undefined;
|
|
2572
|
+
const statusParam = url.searchParams.get('status') ?? undefined;
|
|
2573
|
+
const limitParam = Number(url.searchParams.get('limit'));
|
|
2574
|
+
const filters = {
|
|
2575
|
+
skillName,
|
|
2576
|
+
status: statusParam || undefined,
|
|
2577
|
+
limit: Number.isFinite(limitParam) && limitParam > 0 ? limitParam : 100,
|
|
2578
|
+
};
|
|
2579
|
+
void (async () => {
|
|
2580
|
+
try {
|
|
2581
|
+
const { queryAuditEntries, getAuditStats } = await import('../skills/execution-audit.js');
|
|
2582
|
+
const [entries, stats] = await Promise.all([
|
|
2583
|
+
// The panel sends the status as a raw query string; the audit backend
|
|
2584
|
+
// validates it (an unknown value simply matches nothing).
|
|
2585
|
+
queryAuditEntries(filters),
|
|
2586
|
+
getAuditStats(),
|
|
2587
|
+
]);
|
|
2588
|
+
writeJson(res, 200, { entries, stats });
|
|
2589
|
+
}
|
|
2590
|
+
catch (err) {
|
|
2591
|
+
writeJson(res, 500, { error: err instanceof Error ? err.message : String(err) });
|
|
2592
|
+
}
|
|
2593
|
+
})();
|
|
2594
|
+
return;
|
|
2595
|
+
}
|
|
2530
2596
|
// ── Admin command-runner: run ALL state commands on demand ───────────
|
|
2531
2597
|
// The dashboard executes doctor/system/enterprise checks (one source with
|
|
2532
2598
|
// `nuvira doctor` — runAllChecks) so the user never types a command. Read
|
|
@@ -2656,6 +2722,13 @@ function handleRequest(req, res) {
|
|
|
2656
2722
|
return;
|
|
2657
2723
|
}
|
|
2658
2724
|
if (target === 'gateway') {
|
|
2725
|
+
if (gatewayShutdownAction) {
|
|
2726
|
+
const result = await gatewayShutdownAction();
|
|
2727
|
+
writeJson(res, 200, result.stopped
|
|
2728
|
+
? { ok: true, target, stopped: true, pid: result.pid }
|
|
2729
|
+
: { ok: true, target, stopped: false, reason: result.reason ?? 'no running gateway found' });
|
|
2730
|
+
return;
|
|
2731
|
+
}
|
|
2659
2732
|
const { stopGateway } = await import('../cli/process-control.js');
|
|
2660
2733
|
const result = await stopGateway();
|
|
2661
2734
|
if (result.stopped) {
|
|
@@ -2992,18 +3065,134 @@ function handleRequest(req, res) {
|
|
|
2992
3065
|
return;
|
|
2993
3066
|
}
|
|
2994
3067
|
const saved = [];
|
|
3068
|
+
// Vars that were WANTED but not stored, with the reason. Previously a
|
|
3069
|
+
// refused key was simply absent from `saved` and the UI said "Saved" — so
|
|
3070
|
+
// a blocked provider credential looked like a successful write.
|
|
3071
|
+
const refused = [];
|
|
3072
|
+
// Values that actually landed, kept here so the process-hydration step
|
|
3073
|
+
// below does not have to re-index the untyped request body.
|
|
3074
|
+
const applied = {};
|
|
2995
3075
|
try {
|
|
2996
3076
|
const { saveEnvValue } = await import('../skills/secret-capture.js');
|
|
2997
3077
|
for (const [key, value] of Object.entries(vars)) {
|
|
2998
3078
|
if (typeof key !== 'string' || typeof value !== 'string')
|
|
2999
3079
|
continue;
|
|
3000
|
-
if (!/^[A-Z][A-Z0-9_]+$/.test(key))
|
|
3080
|
+
if (!/^[A-Z][A-Z0-9_]+$/.test(key)) {
|
|
3081
|
+
refused.push({ name: key, reason: 'invalid-name' });
|
|
3001
3082
|
continue;
|
|
3083
|
+
}
|
|
3002
3084
|
const result = saveEnvValue(key, value);
|
|
3003
|
-
if (result.success)
|
|
3085
|
+
if (result.success) {
|
|
3004
3086
|
saved.push(key);
|
|
3087
|
+
applied[key] = value;
|
|
3088
|
+
}
|
|
3089
|
+
else {
|
|
3090
|
+
refused.push({ name: key, reason: result.reason ?? 'write-failed' });
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
if (saved.length > 0) {
|
|
3094
|
+
// Apply to THIS process so a read that goes through process.env sees
|
|
3095
|
+
// the new value without a dashboard restart. It does NOT make the
|
|
3096
|
+
// value visible to the agent's own process — that is why skill-tool
|
|
3097
|
+
// resolves declared vars through the env FILE (see its import note).
|
|
3098
|
+
try {
|
|
3099
|
+
const { applyEnvToProcess } = await import('../gateway/platform-config.js');
|
|
3100
|
+
applyEnvToProcess(applied);
|
|
3101
|
+
}
|
|
3102
|
+
catch {
|
|
3103
|
+
/* best-effort */
|
|
3104
|
+
}
|
|
3005
3105
|
}
|
|
3006
|
-
writeJson(res, 200, { ok: true, saved });
|
|
3106
|
+
writeJson(res, 200, { ok: true, saved, refused });
|
|
3107
|
+
}
|
|
3108
|
+
catch (err) {
|
|
3109
|
+
writeJson(res, 500, { ok: false, error: err instanceof Error ? err.message : String(err) });
|
|
3110
|
+
}
|
|
3111
|
+
})();
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
// ── PA5 — skill env-var inventory + delete + probe (dashboard editor) ─────
|
|
3115
|
+
// `EnvVarEditor` was written against exactly this data and had no producer,
|
|
3116
|
+
// so the panel was unreachable and the credential boundary it draws
|
|
3117
|
+
// (🔒 provider credentials are not editable here) was unenforced. Reads need
|
|
3118
|
+
// a session; mutating a secret needs routing.operate, same as the write path.
|
|
3119
|
+
if (pathname === '/api/skills/env' && req.method === 'GET') {
|
|
3120
|
+
void (async () => {
|
|
3121
|
+
const session = adminSessions.validate(bearerToken(req));
|
|
3122
|
+
if (!session) {
|
|
3123
|
+
writeJson(res, 401, { ok: false, error: 'Not authenticated — log in first.' });
|
|
3124
|
+
return;
|
|
3125
|
+
}
|
|
3126
|
+
try {
|
|
3127
|
+
const { readSkillEnvInventory } = await import('../skills/skill-env-inventory.js');
|
|
3128
|
+
writeJson(res, 200, { ok: true, vars: readSkillEnvInventory() });
|
|
3129
|
+
}
|
|
3130
|
+
catch (err) {
|
|
3131
|
+
writeJson(res, 500, { ok: false, error: err instanceof Error ? err.message : String(err) });
|
|
3132
|
+
}
|
|
3133
|
+
})();
|
|
3134
|
+
return;
|
|
3135
|
+
}
|
|
3136
|
+
if (pathname === '/api/skills/env/delete' && req.method === 'POST') {
|
|
3137
|
+
void (async () => {
|
|
3138
|
+
const session = adminSessions.validate(bearerToken(req));
|
|
3139
|
+
if (!session) {
|
|
3140
|
+
writeJson(res, 401, { ok: false, error: 'Not authenticated — log in first.' });
|
|
3141
|
+
return;
|
|
3142
|
+
}
|
|
3143
|
+
if (!roleCan(session.role, 'routing.operate')) {
|
|
3144
|
+
writeJson(res, 403, {
|
|
3145
|
+
ok: false,
|
|
3146
|
+
error: `Access denied — role '${session.role}' cannot delete secrets (requires admin or operator).`,
|
|
3147
|
+
});
|
|
3148
|
+
return;
|
|
3149
|
+
}
|
|
3150
|
+
const body = await readJsonBody(req);
|
|
3151
|
+
const name = typeof body?.name === 'string' ? body.name.trim() : '';
|
|
3152
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
|
|
3153
|
+
writeJson(res, 400, { ok: false, error: 'Invalid variable name.' });
|
|
3154
|
+
return;
|
|
3155
|
+
}
|
|
3156
|
+
try {
|
|
3157
|
+
const { deleteEnvValue } = await import('../skills/secret-capture.js');
|
|
3158
|
+
const result = deleteEnvValue(name);
|
|
3159
|
+
if (!result.success) {
|
|
3160
|
+
writeJson(res, 400, { ok: false, error: result.reason ?? 'delete failed' });
|
|
3161
|
+
return;
|
|
3162
|
+
}
|
|
3163
|
+
// Drop it from this process too, or the value would survive in memory
|
|
3164
|
+
// and keep being read via process.env until a restart.
|
|
3165
|
+
try {
|
|
3166
|
+
delete process.env[name];
|
|
3167
|
+
}
|
|
3168
|
+
catch {
|
|
3169
|
+
/* best-effort */
|
|
3170
|
+
}
|
|
3171
|
+
writeJson(res, 200, { ok: true, removed: result.removed });
|
|
3172
|
+
}
|
|
3173
|
+
catch (err) {
|
|
3174
|
+
writeJson(res, 500, { ok: false, error: err instanceof Error ? err.message : String(err) });
|
|
3175
|
+
}
|
|
3176
|
+
})();
|
|
3177
|
+
return;
|
|
3178
|
+
}
|
|
3179
|
+
if (pathname === '/api/skills/env/test' && req.method === 'POST') {
|
|
3180
|
+
void (async () => {
|
|
3181
|
+
const session = adminSessions.validate(bearerToken(req));
|
|
3182
|
+
if (!session) {
|
|
3183
|
+
writeJson(res, 401, { ok: false, error: 'Not authenticated — log in first.' });
|
|
3184
|
+
return;
|
|
3185
|
+
}
|
|
3186
|
+
const body = await readJsonBody(req);
|
|
3187
|
+
const name = typeof body?.name === 'string' ? body.name.trim() : '';
|
|
3188
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) {
|
|
3189
|
+
writeJson(res, 400, { ok: false, error: 'Invalid variable name.' });
|
|
3190
|
+
return;
|
|
3191
|
+
}
|
|
3192
|
+
try {
|
|
3193
|
+
const { probeSkillEnvVar } = await import('../skills/skill-env-inventory.js');
|
|
3194
|
+
const probe = probeSkillEnvVar(name);
|
|
3195
|
+
writeJson(res, 200, { ok: true, usable: probe.usable, detail: probe.detail });
|
|
3007
3196
|
}
|
|
3008
3197
|
catch (err) {
|
|
3009
3198
|
writeJson(res, 500, { ok: false, error: err instanceof Error ? err.message : String(err) });
|