@dotdrelle/wiki-manager 0.15.66 → 0.15.71

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 (72) hide show
  1. package/.env.example +10 -3
  2. package/README.md +57 -0
  3. package/agent-runtimes.example.json +68 -0
  4. package/agents.docker-compose.yml +39 -1
  5. package/docker-compose.yml +3 -3
  6. package/package.json +3 -2
  7. package/src/activity/activityAggregator.test.js +2 -2
  8. package/src/agent/graph.js +13 -11
  9. package/src/agent/skillRecursion.test.js +13 -12
  10. package/src/cli/wiki-manager.js +125 -37
  11. package/src/cli/wiki-manager.test.js +16 -16
  12. package/src/commands/slash.js +59 -5
  13. package/src/contracts/schemas.js +67 -0
  14. package/src/core/activity.js +5 -0
  15. package/src/core/agentEvents.js +139 -25
  16. package/src/core/agentEvents.test.js +26 -1
  17. package/src/core/buildInfo.json +2 -2
  18. package/src/core/commandFailure.test.js +2 -2
  19. package/src/core/currentArtifact.test.js +5 -5
  20. package/src/core/dockerCompose.test.js +8 -40
  21. package/src/core/env.js +14 -0
  22. package/src/core/env.test.js +19 -0
  23. package/src/core/googleGrants.test.js +1 -1
  24. package/src/core/mcp.js +1 -1
  25. package/src/core/mcp.test.js +1 -1
  26. package/src/core/otherWorkspacesRunning.test.js +6 -6
  27. package/src/core/runtimeEventAdapter.js +81 -0
  28. package/src/core/runtimeEventAdapter.test.js +61 -0
  29. package/src/core/runtimeLog.js +35 -1
  30. package/src/core/runtimeLog.test.js +27 -2
  31. package/src/core/skillChainView.test.js +2 -2
  32. package/src/core/skillCompiler.test.js +1 -1
  33. package/src/core/skillInvocation.js +13 -8
  34. package/src/core/skillInvocation.test.js +1 -1
  35. package/src/core/startupCheck.js +58 -0
  36. package/src/core/startupCheck.test.js +29 -1
  37. package/src/core/wikiSetup.js +25 -0
  38. package/src/core/wikiSetup.test.js +35 -0
  39. package/src/core/wikirc.test.js +6 -6
  40. package/src/core/workspaceInherit.test.js +14 -14
  41. package/src/orchestrator/agentRegistry.js +1 -22
  42. package/src/orchestrator/agentRegistry.test.js +6 -6
  43. package/src/orchestrator/assignmentManager.js +16 -4
  44. package/src/orchestrator/capabilityRegistry.js +8 -1
  45. package/src/orchestrator/dispatcher.js +405 -2
  46. package/src/orchestrator/dispatcher.test.js +158 -4
  47. package/src/orchestrator/objectiveResolver.js +10 -6
  48. package/src/orchestrator/objectiveResolver.test.js +26 -27
  49. package/src/orchestrator/providers/deepAgentsProvider.js +168 -0
  50. package/src/orchestrator/providers/deepAgentsProvider.test.js +178 -0
  51. package/src/orchestrator/providers/dispatcherExternalRuntime.test.js +409 -0
  52. package/src/orchestrator/providers/fakeRuntimeProvider.js +164 -0
  53. package/src/orchestrator/providers/fakeRuntimeProvider.test.js +201 -0
  54. package/src/orchestrator/providers/runtimeProvider.js +101 -0
  55. package/src/orchestrator/providers/runtimeProviders.js +378 -0
  56. package/src/orchestrator/providers/runtimeProviders.test.js +384 -0
  57. package/src/orchestrator/resultAggregator.js +35 -2
  58. package/src/orchestrator/resultAggregator.test.js +62 -0
  59. package/src/orchestrator/scheduler.test.js +4 -4
  60. package/src/runtime/delegation.test.js +11 -11
  61. package/src/runtime/recoveryManager.js +70 -5
  62. package/src/runtime/runner.test.js +1 -1
  63. package/src/runtime/server.test.js +2 -2
  64. package/src/runtime/skillChain.e2e.test.js +2 -2
  65. package/src/runtime/store.test.js +8 -5
  66. package/src/runtime/supervisor.js +5 -10
  67. package/src/runtime/workspaceIsolation.test.js +26 -26
  68. package/src/shell/RightPane.tsx +23 -3
  69. package/src/shell/StartupScreen.tsx +44 -7
  70. package/src/shell/repl.js +24 -2
  71. package/src/shell/repl.test.js +13 -0
  72. package/wiki-workspace +53 -3
package/wiki-workspace CHANGED
@@ -299,7 +299,12 @@ agents_compose() {
299
299
  local cacert_args=()
300
300
  local profile_args=()
301
301
  connectors_enabled && profile_args+=(--profile connectors)
302
- WORKSPACES_ROOT="$workspaces_root" AGENTS_DATA_DIR="$agents_data_dir" \
302
+ gateway_enabled && profile_args+=(--profile gateway)
303
+ # The gateway mounts the MANAGER's agent-runtimes.json — absolute path:
304
+ # compose resolves relative volume paths against the compose file's
305
+ # directory (the installed package), never the operator's state dir.
306
+ local agent_runtimes_file="$(dirname "$MANAGER_ENV_FILE")/agent-runtimes.json"
307
+ WORKSPACES_ROOT="$workspaces_root" AGENTS_DATA_DIR="$agents_data_dir" AGENT_RUNTIMES_FILE="$agent_runtimes_file" \
303
308
  read_lines_into_array cacert_args cacert_compose_args "$agents_compose_file" "agents.cacert.compose.yml"
304
309
  # User-owned override: optional external agents, proxy passthrough and
305
310
  # any local fix live in a file the user maintains under .wiki/compose —
@@ -307,7 +312,7 @@ agents_compose() {
307
312
  local override_args=()
308
313
  local user_override="$MANAGER_COMPOSE_DIR/agents.docker-compose.override.yml"
309
314
  [[ -f "$user_override" ]] && override_args+=(-f "$user_override")
310
- WORKSPACES_ROOT="$workspaces_root" AGENTS_DATA_DIR="$agents_data_dir" \
315
+ WORKSPACES_ROOT="$workspaces_root" AGENTS_DATA_DIR="$agents_data_dir" AGENT_RUNTIMES_FILE="$agent_runtimes_file" \
311
316
  COMPOSE_PROFILES= \
312
317
  docker compose --project-directory "$DEFAULT_MANAGER_DIR" \
313
318
  ${compose_env_args[@]+"${compose_env_args[@]}"} -f "$agents_compose_file" ${override_args[@]+"${override_args[@]}"} ${cacert_args[@]+"${cacert_args[@]}"} ${profile_args[@]+"${profile_args[@]}"} -p wiki-agents "$@"
@@ -331,12 +336,31 @@ agents_compose() {
331
336
  [[ -f "$MANAGER_ENV_FILE" ]] && compose_env_args+=(--env-file "$MANAGER_ENV_FILE")
332
337
  mkdir -p "$agents_data_dir/cme" "$agents_data_dir/documents/input" "$agents_data_dir/documents/output" "$agents_data_dir/documents/uploads"
333
338
  connectors_enabled && mkdir -p "$agents_data_dir/connectors"
339
+ gateway_enabled && mkdir -p "$agents_data_dir/gateway"
334
340
  mkdir -p "$workspaces_root"
335
341
  $do_pull && _agents_dc pull
336
342
  local up_args=(up -d)
337
343
  if [[ -n "$CACERT_PATH" ]]; then
338
344
  up_args+=(--force-recreate)
339
345
  fi
346
+ # Same lifecycle as the 7788 runtime: an agentic gateway already serving
347
+ # on the port is REUSED — a container started over it cannot bind, and
348
+ # the whole `up` would fail. Reuse applies only when the serving process
349
+ # is EXTERNAL to this compose project (a native runner): if the compose
350
+ # gateway container is the one running, the normal `up` leaves it alone.
351
+ # Only an EXPLICIT `agents up gateway` asks for the container; then a
352
+ # bind conflict is the honest answer.
353
+ local gateway_scale=()
354
+ local requested_list="${only_services[*]:-}"
355
+ local gateway_container_running=false
356
+ if _agents_dc ps --format '{{.Service}}' 2>/dev/null | grep -qx 'gateway'; then
357
+ gateway_container_running=true
358
+ fi
359
+ if gateway_enabled && ! $gateway_container_running && ! [[ " $requested_list " == *" gateway "* ]] && gateway_serving; then
360
+ printf 'Agentic gateway: already serving on :%s — reusing the existing runner (no container started).\n' "${GATEWAY_PORT:-7789}"
361
+ gateway_scale=(--scale gateway=0)
362
+ fi
363
+ up_args+=(${gateway_scale[@]+"${gateway_scale[@]}"})
340
364
  up_args+=(${only_services[@]+"${only_services[@]}"})
341
365
  _agents_dc "${up_args[@]}"
342
366
  printf 'Workspaces root: %s\n' "$workspaces_root"
@@ -345,6 +369,7 @@ agents_compose() {
345
369
  printf 'Agents: cme=:%s documents=:%s' \
346
370
  "${CME_MCP_PORT:-3336}" "${DOCUMENTS_MCP_PORT:-3337}"
347
371
  connectors_enabled && printf ' connectors=:%s' "${CONNECTORS_MCP_PORT:-3338}"
372
+ gateway_enabled && printf ' gateway=:%s' "${GATEWAY_PORT:-7789}"
348
373
  printf '\n'
349
374
  [[ ! -f "$MANAGER_COMPOSE_DIR/agents.docker-compose.override.yml" ]] || printf 'User override: %s\n' "$MANAGER_COMPOSE_DIR/agents.docker-compose.override.yml"
350
375
  ;;
@@ -509,7 +534,7 @@ ensure_agent_tokens() {
509
534
  # workspace and runtime tokens are generated. Leaving them empty made a
510
535
  # fresh install start agents nobody could talk to.
511
536
  local key token
512
- for key in CME_MCP_AUTH_TOKEN DOCUMENTS_MCP_AUTH_TOKEN; do
537
+ for key in CME_MCP_AUTH_TOKEN DOCUMENTS_MCP_AUTH_TOKEN GATEWAY_AUTH_TOKEN; do
513
538
  token="$(env_value "$MANAGER_ENV_FILE" "$key" "")"
514
539
  if [[ -z "$token" ]]; then
515
540
  token="$(generate_token)"
@@ -558,6 +583,31 @@ connectors_enabled() {
558
583
  esac
559
584
  }
560
585
 
586
+ gateway_enabled() {
587
+ local enabled
588
+ enabled="$(env_value "$MANAGER_ENV_FILE" GATEWAY_ENABLED "${GATEWAY_ENABLED:-true}")"
589
+ case "$enabled" in
590
+ 1|[Tt][Rr][Uu][Ee]|[Yy][Ee][Ss]|[Oo][Nn]) return 0 ;;
591
+ *) return 1 ;;
592
+ esac
593
+ }
594
+
595
+ # Same lifecycle discipline as the 7788 runtime: an agentic gateway ALREADY
596
+ # serving on the port is REUSED, never shadowed by a container that cannot
597
+ # bind. A native `node bin/wiki-agentic-gateway.js` answers without auth
598
+ # (dev); a token-configured gateway (the container, or a native one with
599
+ # GATEWAY_AUTH_TOKEN) answers only to the Bearer — probe both.
600
+ gateway_serving() {
601
+ local port="${GATEWAY_PORT:-7789}"
602
+ local token url
603
+ url="http://localhost:${port}/health"
604
+ token="$(env_value "$MANAGER_ENV_FILE" GATEWAY_AUTH_TOKEN "")"
605
+ if [[ -n "$token" ]]; then
606
+ curl -fsS -m 3 -H "Authorization: Bearer $token" "$url" >/dev/null 2>&1 && return 0
607
+ fi
608
+ curl -fsS -m 3 "$url" >/dev/null 2>&1
609
+ }
610
+
561
611
  ensure_endpoints_file() {
562
612
  # Without mcp.endpoints.json the shell never connects to the agents it
563
613
  # just started (and `agents status` refuses to run). Seed it from the