nexus-agents 2.85.0 → 2.87.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.
@@ -38,10 +38,11 @@ import {
38
38
  withAccessPolicy,
39
39
  withProgressHeartbeat,
40
40
  wrapToolWithTimeout,
41
+ writeJobCancelled,
41
42
  writeJobComplete,
42
43
  writeJobFailed,
43
44
  writeJobPending
44
- } from "./chunk-IF6TXCSE.js";
45
+ } from "./chunk-YYUNZPDK.js";
45
46
  import {
46
47
  REGISTRY_PATH,
47
48
  getProjectRoot,
@@ -81,7 +82,7 @@ import {
81
82
  DEFAULT_TASK_TTL_MS,
82
83
  DEFAULT_TOOL_RATE_LIMITS,
83
84
  clampTaskTtl
84
- } from "./chunk-OXVOUVKH.js";
85
+ } from "./chunk-T24NPT4A.js";
85
86
  import {
86
87
  getAvailabilityCache,
87
88
  resolveFallback
@@ -23546,10 +23547,10 @@ function calculateZStatistic(params) {
23546
23547
  function calculateDifferenceCI(p1, p2, total1, total2, confidence) {
23547
23548
  const difference = p1 - p2;
23548
23549
  const seDiff = Math.sqrt(p1 * (1 - p1) / (total1 || 1) + p2 * (1 - p2) / (total2 || 1));
23549
- const z109 = getZScore(confidence);
23550
+ const z111 = getZScore(confidence);
23550
23551
  return {
23551
- lower: difference - z109 * seDiff,
23552
- upper: difference + z109 * seDiff,
23552
+ lower: difference - z111 * seDiff,
23553
+ upper: difference + z111 * seDiff,
23553
23554
  estimate: difference,
23554
23555
  confidence,
23555
23556
  n: total1 + total2,
@@ -23572,11 +23573,11 @@ function proportionConfidenceInterval(successes, total, options = {}) {
23572
23573
  standardError: 0
23573
23574
  };
23574
23575
  }
23575
- const z109 = getZScore(opts.confidence);
23576
- const z210 = z109 * z109;
23576
+ const z111 = getZScore(opts.confidence);
23577
+ const z210 = z111 * z111;
23577
23578
  const denominator = 1 + z210 / n;
23578
23579
  const center = (p + z210 / (2 * n)) / denominator;
23579
- const margin = z109 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23580
+ const margin = z111 / denominator * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
23580
23581
  const lower = Math.max(0, center - margin);
23581
23582
  const upper = Math.min(1, center + margin);
23582
23583
  const standardError = Math.sqrt(p * (1 - p) / n);
@@ -23606,8 +23607,8 @@ function meanConfidenceInterval(values, options = {}) {
23606
23607
  const variance = values.reduce((sum, v) => sum + (v - mean) ** 2, 0) / (n - 1 || 1);
23607
23608
  const stdDev = Math.sqrt(variance);
23608
23609
  const standardError = stdDev / Math.sqrt(n);
23609
- const z109 = getZScore(opts.confidence);
23610
- const margin = z109 * standardError;
23610
+ const z111 = getZScore(opts.confidence);
23611
+ const margin = z111 * standardError;
23611
23612
  return {
23612
23613
  lower: mean - margin,
23613
23614
  upper: mean + margin,
@@ -43475,7 +43476,7 @@ ${contextBlock}`;
43475
43476
  const strategy = config.votingStrategy ?? "higher_order";
43476
43477
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
43477
43478
  try {
43478
- const { executeVoting } = await import("./consensus-vote-LPYEXUVC.js");
43479
+ const { executeVoting } = await import("./consensus-vote-ZP33MR4A.js");
43479
43480
  const votingResult = await executeVoting(
43480
43481
  {
43481
43482
  proposal: plan.slice(0, 4e3),
@@ -46422,12 +46423,258 @@ function registerListJobsTool(server, deps) {
46422
46423
  logger53.info("Registered list_jobs tool");
46423
46424
  }
46424
46425
 
46426
+ // src/mcp/tools/cancel-job-tool.ts
46427
+ import { z as z99 } from "zod";
46428
+ var CancelJobInputSchema = z99.object({
46429
+ jobId: z99.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
46430
+ reason: z99.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
46431
+ });
46432
+ function cancelJobHandler(args) {
46433
+ const parsed = CancelJobInputSchema.safeParse(args);
46434
+ if (!parsed.success) {
46435
+ return Promise.resolve(
46436
+ toolStructuredError({
46437
+ errorCategory: "validation",
46438
+ message: `Validation error: ${formatZodError(parsed.error)}`
46439
+ })
46440
+ );
46441
+ }
46442
+ const { jobId, reason } = parsed.data;
46443
+ const existing = readJobResult(jobId);
46444
+ if (existing === null) {
46445
+ const response2 = {
46446
+ jobId,
46447
+ outcome: "unknown_job",
46448
+ message: `No job record found for jobId "${jobId}". The job may never have been dispatched, or the sidecar file is unreadable.`
46449
+ };
46450
+ return Promise.resolve(toolSuccess(JSON.stringify(response2, null, 2)));
46451
+ }
46452
+ if (existing.status === "complete" || existing.status === "failed") {
46453
+ const response2 = {
46454
+ jobId,
46455
+ outcome: "already_complete",
46456
+ status: existing.status,
46457
+ message: `Job already terminated with status "${existing.status}" \u2014 cancel is a no-op.`
46458
+ };
46459
+ return Promise.resolve(toolSuccess(JSON.stringify(response2, null, 2)));
46460
+ }
46461
+ if (existing.status === "cancelled") {
46462
+ const response2 = {
46463
+ jobId,
46464
+ outcome: "already_cancelled",
46465
+ status: "cancelled",
46466
+ message: "Job is already cancelled \u2014 second cancel is an idempotent no-op."
46467
+ };
46468
+ return Promise.resolve(toolSuccess(JSON.stringify(response2, null, 2)));
46469
+ }
46470
+ writeJobCancelled(jobId, existing.toolName, reason);
46471
+ const response = {
46472
+ jobId,
46473
+ outcome: "cancelled",
46474
+ status: "cancelled",
46475
+ message: `Job ${jobId} marked cancelled. In-flight work in the dispatching process aborts via AbortSignal; cross-process workers need to poll get_job_result to observe.`
46476
+ };
46477
+ return Promise.resolve(toolSuccess(JSON.stringify(response, null, 2)));
46478
+ }
46479
+ function registerCancelJobTool(server, deps) {
46480
+ const logger53 = deps.logger ?? createLogger({ tool: "cancel_job" });
46481
+ const toolSchema = {
46482
+ jobId: z99.string().min(1).max(128).describe("Job ID returned by orchestrate / run_workflow / consensus_vote in async mode"),
46483
+ reason: z99.string().max(1e3).optional().describe('Optional human-readable note (e.g. "user clicked cancel").')
46484
+ };
46485
+ const description2 = "Mark an async-mode job as cancelled (#3042 Stage 1b / epic #2631). Same-process dispatcher unwinds via AbortSignal (#3035/#3038); cross-process workers observe via get_job_result. Idempotent \u2014 cancel-after-complete is a no-op (preserves the terminal record); second cancel returns already_cancelled.";
46486
+ const secureHandler = createSecureHandler(cancelJobHandler, {
46487
+ toolName: "cancel_job",
46488
+ rateLimiter: deps.rateLimiter,
46489
+ logger: logger53
46490
+ });
46491
+ const timeoutMs = getToolTimeout("cancel_job", deps.security);
46492
+ const wrappedHandler = wrapToolWithTimeout("cancel_job", secureHandler, {
46493
+ timeoutMs,
46494
+ logger: logger53
46495
+ });
46496
+ server.registerTool(
46497
+ "cancel_job",
46498
+ { description: description2, inputSchema: toolSchema, annotations: getToolAnnotations("cancel_job") },
46499
+ toSdkCallback(wrappedHandler)
46500
+ );
46501
+ logger53.info("Registered cancel_job tool");
46502
+ }
46503
+
46504
+ // src/mcp/tools/ci-health-check-tool.ts
46505
+ import { z as z100 } from "zod";
46506
+ var CiHealthStatusSchema = z100.enum(["healthy", "degraded", "outage", "unknown"]);
46507
+ var CiHealthCheckInputSchema = z100.object({
46508
+ /**
46509
+ * Repo to check for the recent-runs activity signal (in `owner/repo` form).
46510
+ * Optional — when omitted, only the status-page signal is consulted.
46511
+ */
46512
+ repo: z100.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, "Must be owner/repo form").optional().describe("GitHub repo (owner/repo) to check for recent CI activity. Optional."),
46513
+ /**
46514
+ * How far back to look for recent-runs activity (minutes). Default 30 —
46515
+ * matches the typical wedge-detection window from the #3070 / #3076 outages.
46516
+ */
46517
+ activityWindowMinutes: z100.number().int().min(5).max(180).default(30).describe("Recent-runs lookback window in minutes (5-180; default 30).")
46518
+ });
46519
+ var STATUS_PAGE_URL = "https://www.githubstatus.com/api/v2/components.json";
46520
+ function mapStatusPageStatus(raw) {
46521
+ if (raw === "operational") return "healthy";
46522
+ if (raw === "degraded_performance" || raw === "under_maintenance") return "degraded";
46523
+ if (raw === "partial_outage" || raw === "major_outage") return "outage";
46524
+ return "unknown";
46525
+ }
46526
+ async function checkGithubStatus(logger53) {
46527
+ try {
46528
+ const res = await fetch(STATUS_PAGE_URL, {
46529
+ // 5s budget — status page is fast, hangs here are themselves a degraded signal.
46530
+ signal: AbortSignal.timeout(5e3)
46531
+ });
46532
+ if (!res.ok) {
46533
+ return {
46534
+ source: "github-status",
46535
+ status: "unknown",
46536
+ evidence: `status page returned HTTP ${String(res.status)}`
46537
+ };
46538
+ }
46539
+ const payload = await res.json();
46540
+ const actions = payload.components?.find((c) => c.name === "GitHub Actions");
46541
+ if (actions?.status === void 0) {
46542
+ return {
46543
+ source: "github-status",
46544
+ status: "unknown",
46545
+ evidence: "GitHub Actions component not found in status page response"
46546
+ };
46547
+ }
46548
+ return {
46549
+ source: "github-status",
46550
+ status: mapStatusPageStatus(actions.status),
46551
+ evidence: `GitHub Actions component reports: ${actions.status}`
46552
+ };
46553
+ } catch (err2) {
46554
+ logger53.warn("Status page fetch failed", {
46555
+ error: err2 instanceof Error ? err2.message : String(err2)
46556
+ });
46557
+ return {
46558
+ source: "github-status",
46559
+ status: "unknown",
46560
+ evidence: `status page fetch failed: ${err2 instanceof Error ? err2.message : "network error"}`
46561
+ };
46562
+ }
46563
+ }
46564
+ function countRecentRuns(runs, sinceMs) {
46565
+ return runs.filter((r) => r.created_at !== void 0 && Date.parse(r.created_at) >= sinceMs).length;
46566
+ }
46567
+ async function checkRepoActivity(repo, windowMinutes, logger53) {
46568
+ const sinceMs = Date.now() - windowMinutes * 6e4;
46569
+ try {
46570
+ const res = await fetch(`https://api.github.com/repos/${repo}/actions/runs?per_page=30`, {
46571
+ signal: AbortSignal.timeout(8e3),
46572
+ headers: { Accept: "application/vnd.github+json" }
46573
+ });
46574
+ if (!res.ok) {
46575
+ return {
46576
+ source: "repo-activity-window",
46577
+ status: "unknown",
46578
+ evidence: `actions/runs API returned HTTP ${String(res.status)}`
46579
+ };
46580
+ }
46581
+ const payload = await res.json();
46582
+ const recentCount = countRecentRuns(payload.workflow_runs ?? [], sinceMs);
46583
+ if (recentCount === 0) {
46584
+ return {
46585
+ source: "repo-activity-window",
46586
+ status: "degraded",
46587
+ evidence: `no workflow runs in last ${String(windowMinutes)} min on ${repo} \u2014 could be wedge or quiet repo`
46588
+ };
46589
+ }
46590
+ return {
46591
+ source: "repo-activity-window",
46592
+ status: "healthy",
46593
+ evidence: `${String(recentCount)} workflow run(s) in last ${String(windowMinutes)} min on ${repo}`
46594
+ };
46595
+ } catch (err2) {
46596
+ logger53.warn("Repo activity check failed", {
46597
+ repo,
46598
+ error: err2 instanceof Error ? err2.message : String(err2)
46599
+ });
46600
+ return {
46601
+ source: "repo-activity-window",
46602
+ status: "unknown",
46603
+ evidence: `actions/runs API fetch failed: ${err2 instanceof Error ? err2.message : "network error"}`
46604
+ };
46605
+ }
46606
+ }
46607
+ function combineSignals(signals) {
46608
+ const PRIORITY = {
46609
+ outage: 3,
46610
+ degraded: 2,
46611
+ healthy: 1,
46612
+ unknown: 0
46613
+ };
46614
+ let worst = "unknown";
46615
+ for (const s of signals) {
46616
+ if (s.status !== "unknown" && PRIORITY[s.status] > PRIORITY[worst]) {
46617
+ worst = s.status;
46618
+ }
46619
+ }
46620
+ return worst;
46621
+ }
46622
+ async function ciHealthCheckHandler(args, logger53) {
46623
+ const parsed = CiHealthCheckInputSchema.safeParse(args);
46624
+ if (!parsed.success) {
46625
+ return toolStructuredError({
46626
+ errorCategory: "validation",
46627
+ message: `Validation error: ${formatZodError(parsed.error)}`
46628
+ });
46629
+ }
46630
+ const { repo, activityWindowMinutes } = parsed.data;
46631
+ const signals = [];
46632
+ signals.push(await checkGithubStatus(logger53));
46633
+ if (repo !== void 0) {
46634
+ signals.push(await checkRepoActivity(repo, activityWindowMinutes, logger53));
46635
+ }
46636
+ const response = {
46637
+ status: combineSignals(signals),
46638
+ checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
46639
+ signals
46640
+ };
46641
+ return toolSuccess(JSON.stringify(response, null, 2));
46642
+ }
46643
+ var DESCRIPTION = "Check CI infrastructure health before triggering / polling runs (#3076). Returns { status: healthy|degraded|outage|unknown, signals } composing GitHub status-page state + the configured repo's recent workflow-runs activity. Use BEFORE a long auto-merge wait to skip the wedge cycle when CI is broken org-wide. Read-only, idempotent, no network state mutated.";
46644
+ function registerCiHealthCheckTool(server, deps) {
46645
+ const logger53 = deps.logger ?? createLogger({ tool: "ci_health_check" });
46646
+ const toolSchema = {
46647
+ repo: z100.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, "Must be owner/repo form").optional().describe("GitHub repo (owner/repo) to check for recent CI activity. Optional."),
46648
+ activityWindowMinutes: z100.number().int().min(5).max(180).optional().describe("Recent-runs lookback window in minutes (5-180; default 30).")
46649
+ };
46650
+ const secureHandler = createSecureHandler((args) => ciHealthCheckHandler(args, logger53), {
46651
+ toolName: "ci_health_check",
46652
+ rateLimiter: deps.rateLimiter,
46653
+ logger: logger53
46654
+ });
46655
+ const timeoutMs = getToolTimeout("ci_health_check", deps.security);
46656
+ const wrappedHandler = wrapToolWithTimeout("ci_health_check", secureHandler, {
46657
+ timeoutMs,
46658
+ logger: logger53
46659
+ });
46660
+ server.registerTool(
46661
+ "ci_health_check",
46662
+ {
46663
+ description: DESCRIPTION,
46664
+ inputSchema: toolSchema,
46665
+ annotations: getToolAnnotations("ci_health_check")
46666
+ },
46667
+ toSdkCallback(wrappedHandler)
46668
+ );
46669
+ logger53.info("Registered ci_health_check tool");
46670
+ }
46671
+
46425
46672
  // src/mcp/tools/verify-audit-chain-tool.ts
46426
46673
  import * as fs12 from "fs/promises";
46427
46674
  import * as path11 from "path";
46428
- import { z as z99 } from "zod";
46429
- var VerifyAuditChainInputSchema = z99.object({
46430
- logDir: z99.string().min(1).max(512).describe(
46675
+ import { z as z101 } from "zod";
46676
+ var VerifyAuditChainInputSchema = z101.object({
46677
+ logDir: z101.string().min(1).max(512).describe(
46431
46678
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
46432
46679
  )
46433
46680
  });
@@ -46504,7 +46751,7 @@ async function handler2(args, ctx) {
46504
46751
  function registerVerifyAuditChainTool(server, deps) {
46505
46752
  const logger53 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
46506
46753
  const toolSchema = {
46507
- logDir: z99.string().min(1).max(512).describe(
46754
+ logDir: z101.string().min(1).max(512).describe(
46508
46755
  "Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
46509
46756
  )
46510
46757
  };
@@ -46528,18 +46775,18 @@ function registerVerifyAuditChainTool(server, deps) {
46528
46775
  }
46529
46776
 
46530
46777
  // src/mcp/tools/pipeline-tool.ts
46531
- import { z as z100 } from "zod";
46778
+ import { z as z102 } from "zod";
46532
46779
  import * as fs13 from "fs";
46533
46780
  import * as path12 from "path";
46534
- var PipelineInputSchema = z100.object({
46781
+ var PipelineInputSchema = z102.object({
46535
46782
  /** The task to execute. */
46536
- task: z100.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
46783
+ task: z102.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
46537
46784
  /** Path to a spec file (.md, .yaml) to use as task input. */
46538
- specFile: z100.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
46785
+ specFile: z102.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
46539
46786
  /** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
46540
- template: z100.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
46787
+ template: z102.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
46541
46788
  /** Voting strategy for consensus stages. */
46542
- votingStrategy: z100.enum([
46789
+ votingStrategy: z102.enum([
46543
46790
  "simple_majority",
46544
46791
  "supermajority",
46545
46792
  "unanimous",
@@ -46550,13 +46797,13 @@ var PipelineInputSchema = z100.object({
46550
46797
  "Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
46551
46798
  ),
46552
46799
  /** Use 3 agents instead of 6 for faster voting. */
46553
- quickMode: z100.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
46800
+ quickMode: z102.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
46554
46801
  /** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
46555
- timeoutMs: z100.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
46802
+ timeoutMs: z102.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
46556
46803
  /** Stop after planning/voting (no implementation). */
46557
- dryRun: z100.boolean().default(false).describe("Stop after vote stage (no implementation)"),
46804
+ dryRun: z102.boolean().default(false).describe("Stop after vote stage (no implementation)"),
46558
46805
  /** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
46559
- simulateVotes: z100.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
46806
+ simulateVotes: z102.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
46560
46807
  });
46561
46808
  function buildOutput2(result) {
46562
46809
  return {
@@ -46658,7 +46905,7 @@ function registerPipelineTool(server, deps) {
46658
46905
  }
46659
46906
 
46660
46907
  // src/mcp/tools/supply-chain-tradeoff-panel.ts
46661
- import { z as z101 } from "zod";
46908
+ import { z as z103 } from "zod";
46662
46909
  var DEFAULT_AXES = [
46663
46910
  "build_time_determinism",
46664
46911
  "supply_chain_risk",
@@ -46678,16 +46925,16 @@ var FULL_PANEL = [
46678
46925
  "scope_steward"
46679
46926
  ];
46680
46927
  var QUICK_PANEL = ["architect", "security", "scope_steward"];
46681
- var SupplyChainTradeoffPanelInputSchema = z101.object({
46682
- proposal: z101.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
46683
- axes: z101.array(z101.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
46928
+ var SupplyChainTradeoffPanelInputSchema = z103.object({
46929
+ proposal: z103.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
46930
+ axes: z103.array(z103.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
46684
46931
  `Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
46685
46932
  ),
46686
- context: z101.string().max(MAX_CONTEXT_LENGTH).optional().describe(
46933
+ context: z103.string().max(MAX_CONTEXT_LENGTH).optional().describe(
46687
46934
  "Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
46688
46935
  ),
46689
- quickMode: z101.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
46690
- simulate: z101.boolean().optional().default(false).describe("Use simulated voters (testing only)")
46936
+ quickMode: z103.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
46937
+ simulate: z103.boolean().optional().default(false).describe("Use simulated voters (testing only)")
46691
46938
  });
46692
46939
  function buildTradeoffProposal(input) {
46693
46940
  const axes = input.axes ?? DEFAULT_AXES;
@@ -47353,6 +47600,25 @@ var TOOL_ANNOTATIONS = {
47353
47600
  }
47354
47601
  ]
47355
47602
  },
47603
+ cancel_job: {
47604
+ annotations: {
47605
+ title: "Cancel Job",
47606
+ readOnlyHint: false,
47607
+ destructiveHint: false,
47608
+ idempotentHint: true,
47609
+ openWorldHint: false
47610
+ },
47611
+ sideEffects: [
47612
+ {
47613
+ category: "explicit",
47614
+ description: "Writes cancellation record to the async-mode sidecar (#3042 Stage 1b)"
47615
+ },
47616
+ {
47617
+ category: "coupling",
47618
+ description: "Triggers AbortSignal unwind in same-process dispatcher (cross-process workers must poll)"
47619
+ }
47620
+ ]
47621
+ },
47356
47622
  verify_audit_chain: {
47357
47623
  annotations: {
47358
47624
  title: "Verify Audit Chain",
@@ -47368,6 +47634,22 @@ var TOOL_ANNOTATIONS = {
47368
47634
  }
47369
47635
  ]
47370
47636
  },
47637
+ ci_health_check: {
47638
+ annotations: {
47639
+ title: "CI Health Check",
47640
+ readOnlyHint: true,
47641
+ destructiveHint: false,
47642
+ idempotentHint: true,
47643
+ // Outbound network to githubstatus.com + GitHub API.
47644
+ openWorldHint: true
47645
+ },
47646
+ sideEffects: [
47647
+ {
47648
+ category: "implicit",
47649
+ description: "Fetches GitHub status-page + repo actions/runs to assess CI infrastructure health (#3076)"
47650
+ }
47651
+ ]
47652
+ },
47371
47653
  extract_symbols: {
47372
47654
  annotations: {
47373
47655
  title: "Extract Symbols",
@@ -47571,6 +47853,8 @@ var REGISTERED_TOOL_NAMES = [
47571
47853
  "query_task_state",
47572
47854
  "get_job_result",
47573
47855
  "list_jobs",
47856
+ "cancel_job",
47857
+ "ci_health_check",
47574
47858
  "verify_audit_chain",
47575
47859
  "repo_analyze",
47576
47860
  "repo_security_plan",
@@ -47715,40 +47999,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
47715
47999
  })(RiskLevel || {});
47716
48000
 
47717
48001
  // src/mcp/safety/stpa-schemas.ts
47718
- import { z as z102 } from "zod";
47719
- var HazardCategorySchema = z102.enum(HazardCategory);
47720
- var HazardSeveritySchema = z102.enum(HazardSeverity);
47721
- var ConstraintPrioritySchema = z102.enum(ConstraintPriority);
47722
- var RiskLevelSchema = z102.enum(RiskLevel);
47723
- var TriggerPatternSchema = z102.object({
47724
- parameter: z102.string().min(1),
47725
- matchType: z102.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
47726
- pattern: z102.string(),
47727
- reason: z102.string()
48002
+ import { z as z104 } from "zod";
48003
+ var HazardCategorySchema = z104.enum(HazardCategory);
48004
+ var HazardSeveritySchema = z104.enum(HazardSeverity);
48005
+ var ConstraintPrioritySchema = z104.enum(ConstraintPriority);
48006
+ var RiskLevelSchema = z104.enum(RiskLevel);
48007
+ var TriggerPatternSchema = z104.object({
48008
+ parameter: z104.string().min(1),
48009
+ matchType: z104.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
48010
+ pattern: z104.string(),
48011
+ reason: z104.string()
47728
48012
  });
47729
- var HazardSchema = z102.object({
47730
- id: z102.string().min(1),
47731
- description: z102.string(),
48013
+ var HazardSchema = z104.object({
48014
+ id: z104.string().min(1),
48015
+ description: z104.string(),
47732
48016
  category: HazardCategorySchema,
47733
48017
  severity: HazardSeveritySchema,
47734
- likelihood: z102.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
47735
- triggerConditions: z102.array(z102.string()),
47736
- consequences: z102.array(z102.string())
48018
+ likelihood: z104.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
48019
+ triggerConditions: z104.array(z104.string()),
48020
+ consequences: z104.array(z104.string())
47737
48021
  });
47738
- var UnsafeControlActionSchema = z102.object({
47739
- id: z102.string().min(1),
47740
- toolName: z102.string().min(1),
47741
- type: z102.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
47742
- description: z102.string(),
47743
- unsafeContext: z102.string(),
47744
- relatedHazards: z102.array(z102.string()),
47745
- triggerPatterns: z102.array(TriggerPatternSchema).optional()
48022
+ var UnsafeControlActionSchema = z104.object({
48023
+ id: z104.string().min(1),
48024
+ toolName: z104.string().min(1),
48025
+ type: z104.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
48026
+ description: z104.string(),
48027
+ unsafeContext: z104.string(),
48028
+ relatedHazards: z104.array(z104.string()),
48029
+ triggerPatterns: z104.array(TriggerPatternSchema).optional()
47746
48030
  });
47747
- var SafetyConstraintSchema = z102.object({
47748
- id: z102.string().min(1),
47749
- description: z102.string(),
47750
- mitigates: z102.array(z102.string()),
47751
- enforcement: z102.enum([
48031
+ var SafetyConstraintSchema = z104.object({
48032
+ id: z104.string().min(1),
48033
+ description: z104.string(),
48034
+ mitigates: z104.array(z104.string()),
48035
+ enforcement: z104.enum([
47752
48036
  "prevent",
47753
48037
  "require_confirmation",
47754
48038
  "alert",
@@ -47756,54 +48040,54 @@ var SafetyConstraintSchema = z102.object({
47756
48040
  "rate_limit",
47757
48041
  "require_privilege"
47758
48042
  ]),
47759
- validationFunction: z102.string().optional(),
48043
+ validationFunction: z104.string().optional(),
47760
48044
  priority: ConstraintPrioritySchema
47761
48045
  });
47762
- var PropertySchemaSchema = z102.object({
47763
- type: z102.string(),
47764
- description: z102.string().optional(),
47765
- enum: z102.array(z102.unknown()).optional(),
47766
- pattern: z102.string().optional(),
47767
- minimum: z102.number().optional(),
47768
- maximum: z102.number().optional()
48046
+ var PropertySchemaSchema = z104.object({
48047
+ type: z104.string(),
48048
+ description: z104.string().optional(),
48049
+ enum: z104.array(z104.unknown()).optional(),
48050
+ pattern: z104.string().optional(),
48051
+ minimum: z104.number().optional(),
48052
+ maximum: z104.number().optional()
47769
48053
  });
47770
- var ToolInputSchemaSchema = z102.object({
47771
- type: z102.string(),
47772
- properties: z102.record(z102.string(), PropertySchemaSchema).optional(),
47773
- required: z102.array(z102.string()).optional(),
47774
- additionalProperties: z102.boolean().optional()
48054
+ var ToolInputSchemaSchema = z104.object({
48055
+ type: z104.string(),
48056
+ properties: z104.record(z104.string(), PropertySchemaSchema).optional(),
48057
+ required: z104.array(z104.string()).optional(),
48058
+ additionalProperties: z104.boolean().optional()
47775
48059
  });
47776
- var ToolDefinitionSchema = z102.object({
47777
- name: z102.string().min(1),
47778
- description: z102.string(),
48060
+ var ToolDefinitionSchema = z104.object({
48061
+ name: z104.string().min(1),
48062
+ description: z104.string(),
47779
48063
  inputSchema: ToolInputSchemaSchema
47780
48064
  });
47781
- var AnalysisConfigurationSchema = z102.object({
47782
- includeLowSeverity: z102.boolean().default(true),
47783
- generateAllConstraints: z102.boolean().default(true),
47784
- checkInteractions: z102.boolean().default(true),
47785
- maxHazardsPerTool: z102.number().int().min(1).max(100).default(50),
47786
- categories: z102.array(HazardCategorySchema).default([])
48065
+ var AnalysisConfigurationSchema = z104.object({
48066
+ includeLowSeverity: z104.boolean().default(true),
48067
+ generateAllConstraints: z104.boolean().default(true),
48068
+ checkInteractions: z104.boolean().default(true),
48069
+ maxHazardsPerTool: z104.number().int().min(1).max(100).default(50),
48070
+ categories: z104.array(HazardCategorySchema).default([])
47787
48071
  });
47788
- var ConstraintViolationSchema = z102.object({
47789
- constraintId: z102.string().min(1),
47790
- constraintDescription: z102.string(),
48072
+ var ConstraintViolationSchema = z104.object({
48073
+ constraintId: z104.string().min(1),
48074
+ constraintDescription: z104.string(),
47791
48075
  severity: HazardSeveritySchema,
47792
- details: z102.string(),
47793
- remediation: z102.string()
48076
+ details: z104.string(),
48077
+ remediation: z104.string()
47794
48078
  });
47795
- var ValidationWarningSchema = z102.object({
47796
- code: z102.string().min(1),
47797
- message: z102.string(),
47798
- affected: z102.string()
48079
+ var ValidationWarningSchema = z104.object({
48080
+ code: z104.string().min(1),
48081
+ message: z104.string(),
48082
+ affected: z104.string()
47799
48083
  });
47800
- var ValidationResultSchema = z102.object({
47801
- valid: z102.boolean(),
47802
- toolName: z102.string().min(1),
47803
- violations: z102.array(ConstraintViolationSchema),
47804
- passed: z102.array(z102.string()),
47805
- warnings: z102.array(ValidationWarningSchema),
47806
- validatedAt: z102.date()
48084
+ var ValidationResultSchema = z104.object({
48085
+ valid: z104.boolean(),
48086
+ toolName: z104.string().min(1),
48087
+ violations: z104.array(ConstraintViolationSchema),
48088
+ passed: z104.array(z104.string()),
48089
+ warnings: z104.array(ValidationWarningSchema),
48090
+ validatedAt: z104.date()
47807
48091
  });
47808
48092
 
47809
48093
  // src/mcp/safety/stpa-types.ts
@@ -48888,43 +49172,43 @@ var GeminiResponseParser = class {
48888
49172
  };
48889
49173
 
48890
49174
  // src/cli-adapters/router-types.ts
48891
- import { z as z103 } from "zod";
48892
- var RouterConfigSchema = z103.object({
48893
- minCapacityThreshold: z103.number().min(0).max(1).default(0.1),
48894
- preferCostEfficient: z103.boolean().default(false),
48895
- maxDecisionTimeMs: z103.number().min(1).max(1e3).default(100)
49175
+ import { z as z105 } from "zod";
49176
+ var RouterConfigSchema = z105.object({
49177
+ minCapacityThreshold: z105.number().min(0).max(1).default(0.1),
49178
+ preferCostEfficient: z105.boolean().default(false),
49179
+ maxDecisionTimeMs: z105.number().min(1).max(1e3).default(100)
48896
49180
  });
48897
49181
 
48898
49182
  // src/cli-adapters/agreement-cascade-types.ts
48899
- import { z as z104 } from "zod";
48900
- var AgreementCascadeConfigSchema = z104.object({
48901
- agreementThreshold: z104.number().min(0.5).max(1).default(0.7),
48902
- maxStages: z104.number().int().min(1).max(5).default(3),
48903
- modelTimeoutMs: z104.number().int().min(1e3).max(3e5).default(6e4)
49183
+ import { z as z106 } from "zod";
49184
+ var AgreementCascadeConfigSchema = z106.object({
49185
+ agreementThreshold: z106.number().min(0.5).max(1).default(0.7),
49186
+ maxStages: z106.number().int().min(1).max(5).default(3),
49187
+ modelTimeoutMs: z106.number().int().min(1e3).max(3e5).default(6e4)
48904
49188
  });
48905
49189
 
48906
49190
  // src/cli-adapters/agreement-cascade-router.ts
48907
49191
  var logger43 = createLogger({ component: "agreement-cascade-router" });
48908
49192
 
48909
49193
  // src/cli-adapters/task-classifier.ts
48910
- import { z as z105 } from "zod";
48911
- var ClassificationPatternsSchema = z105.object({
48912
- code: z105.array(z105.string()).readonly(),
48913
- research: z105.array(z105.string()).readonly(),
48914
- documentation: z105.array(z105.string()).readonly(),
48915
- analysis: z105.array(z105.string()).readonly()
49194
+ import { z as z107 } from "zod";
49195
+ var ClassificationPatternsSchema = z107.object({
49196
+ code: z107.array(z107.string()).readonly(),
49197
+ research: z107.array(z107.string()).readonly(),
49198
+ documentation: z107.array(z107.string()).readonly(),
49199
+ analysis: z107.array(z107.string()).readonly()
48916
49200
  });
48917
49201
 
48918
49202
  // src/cli-adapters/response-cache-types.ts
48919
- import { z as z106 } from "zod";
48920
- var ResponseCacheConfigSchema = z106.object({
48921
- defaultTTL: z106.number().min(1e3).max(36e5).default(3e5),
49203
+ import { z as z108 } from "zod";
49204
+ var ResponseCacheConfigSchema = z108.object({
49205
+ defaultTTL: z108.number().min(1e3).max(36e5).default(3e5),
48922
49206
  // 5 minutes
48923
- maxEntries: z106.number().min(10).max(1e5).default(1e3),
48924
- maxMemoryMB: z106.number().min(1).max(1e3).default(50),
48925
- cleanupInterval: z106.number().min(1e3).max(6e5).default(6e4),
49207
+ maxEntries: z108.number().min(10).max(1e5).default(1e3),
49208
+ maxMemoryMB: z108.number().min(1).max(1e3).default(50),
49209
+ cleanupInterval: z108.number().min(1e3).max(6e5).default(6e4),
48926
49210
  // 1 minute
48927
- enableLogging: z106.boolean().default(false)
49211
+ enableLogging: z108.boolean().default(false)
48928
49212
  });
48929
49213
 
48930
49214
  // src/cli-adapters/response-cache-utils.ts
@@ -48932,12 +49216,12 @@ import { createHash as createHash4 } from "crypto";
48932
49216
  var logger44 = createLogger({ component: "ResponseCacheUtils" });
48933
49217
 
48934
49218
  // src/cli-adapters/unified-routing-types.ts
48935
- import { z as z107 } from "zod";
48936
- var UnifiedRoutingDecisionSchema = z107.object({
48937
- selectedCli: z107.string(),
48938
- confidence: z107.number().min(0).max(1),
48939
- reason: z107.string(),
48940
- strategy: z107.enum([
49219
+ import { z as z109 } from "zod";
49220
+ var UnifiedRoutingDecisionSchema = z109.object({
49221
+ selectedCli: z109.string(),
49222
+ confidence: z109.number().min(0).max(1),
49223
+ reason: z109.string(),
49224
+ strategy: z109.enum([
48941
49225
  "composite",
48942
49226
  "quality",
48943
49227
  "budget",
@@ -48949,57 +49233,57 @@ var UnifiedRoutingDecisionSchema = z107.object({
48949
49233
  "linucb",
48950
49234
  "direct"
48951
49235
  ]),
48952
- decisionTimeMs: z107.number().nonnegative(),
48953
- alternatives: z107.array(z107.string()).readonly(),
48954
- stagesExecuted: z107.array(z107.string()).readonly(),
48955
- withinBudget: z107.boolean().optional(),
48956
- estimatedComplexity: z107.enum(["simple", "moderate", "complex", "expert"]).optional(),
48957
- estimatedTokens: z107.number().int().positive().optional(),
48958
- topsisScore: z107.number().optional(),
48959
- ucbScore: z107.number().optional(),
48960
- resolvedAtStage: z107.number().int().nonnegative().optional(),
48961
- consensusReached: z107.boolean().optional(),
48962
- agreementScore: z107.number().min(0).max(1).optional(),
48963
- metadata: z107.record(z107.string(), z107.unknown()).optional()
49236
+ decisionTimeMs: z109.number().nonnegative(),
49237
+ alternatives: z109.array(z109.string()).readonly(),
49238
+ stagesExecuted: z109.array(z109.string()).readonly(),
49239
+ withinBudget: z109.boolean().optional(),
49240
+ estimatedComplexity: z109.enum(["simple", "moderate", "complex", "expert"]).optional(),
49241
+ estimatedTokens: z109.number().int().positive().optional(),
49242
+ topsisScore: z109.number().optional(),
49243
+ ucbScore: z109.number().optional(),
49244
+ resolvedAtStage: z109.number().int().nonnegative().optional(),
49245
+ consensusReached: z109.boolean().optional(),
49246
+ agreementScore: z109.number().min(0).max(1).optional(),
49247
+ metadata: z109.record(z109.string(), z109.unknown()).optional()
48964
49248
  });
48965
49249
 
48966
49250
  // src/learning/outcome-feedback-types.ts
48967
- import { z as z108 } from "zod";
48968
- var QualitySignalsSchema = z108.object({
48969
- testsPass: z108.boolean().optional(),
48970
- lintErrors: z108.number().int().min(0).optional(),
48971
- userApproved: z108.boolean().optional(),
48972
- retryCount: z108.number().int().min(0).default(0),
48973
- completionRatio: z108.number().min(0).max(1).default(1),
48974
- validStructure: z108.boolean().optional(),
48975
- coherenceScore: z108.number().min(0).max(1).optional()
49251
+ import { z as z110 } from "zod";
49252
+ var QualitySignalsSchema = z110.object({
49253
+ testsPass: z110.boolean().optional(),
49254
+ lintErrors: z110.number().int().min(0).optional(),
49255
+ userApproved: z110.boolean().optional(),
49256
+ retryCount: z110.number().int().min(0).default(0),
49257
+ completionRatio: z110.number().min(0).max(1).default(1),
49258
+ validStructure: z110.boolean().optional(),
49259
+ coherenceScore: z110.number().min(0).max(1).optional()
48976
49260
  });
48977
- var RoutingDecisionSchema = z108.object({
48978
- id: z108.uuid(),
48979
- timestamp: z108.iso.datetime(),
48980
- query: z108.string(),
48981
- routerType: z108.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
48982
- selectedModel: z108.string(),
48983
- selectedTier: z108.enum(["strong", "weak"]).optional(),
48984
- armIndex: z108.number().int().min(0).optional(),
48985
- banditContext: z108.record(z108.string(), z108.unknown()).optional(),
48986
- queryFeatures: z108.record(z108.string(), z108.unknown()).optional(),
48987
- ucbScore: z108.number().optional(),
48988
- confidence: z108.number().min(0).max(1).optional(),
48989
- traceId: z108.string(),
48990
- domain: z108.string().optional()
49261
+ var RoutingDecisionSchema = z110.object({
49262
+ id: z110.uuid(),
49263
+ timestamp: z110.iso.datetime(),
49264
+ query: z110.string(),
49265
+ routerType: z110.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
49266
+ selectedModel: z110.string(),
49267
+ selectedTier: z110.enum(["strong", "weak"]).optional(),
49268
+ armIndex: z110.number().int().min(0).optional(),
49269
+ banditContext: z110.record(z110.string(), z110.unknown()).optional(),
49270
+ queryFeatures: z110.record(z110.string(), z110.unknown()).optional(),
49271
+ ucbScore: z110.number().optional(),
49272
+ confidence: z110.number().min(0).max(1).optional(),
49273
+ traceId: z110.string(),
49274
+ domain: z110.string().optional()
48991
49275
  });
48992
- var TaskOutcomeSchema = z108.object({
48993
- routingDecisionId: z108.uuid(),
48994
- timestamp: z108.iso.datetime(),
48995
- outcomeClass: z108.enum(["success", "partial", "failure", "timeout", "error"]),
48996
- success: z108.boolean(),
48997
- qualityScore: z108.number().min(0).max(1),
48998
- durationMs: z108.number().min(0),
48999
- tokenUsage: z108.number().int().min(0),
49000
- errorMessage: z108.string().optional(),
49276
+ var TaskOutcomeSchema = z110.object({
49277
+ routingDecisionId: z110.uuid(),
49278
+ timestamp: z110.iso.datetime(),
49279
+ outcomeClass: z110.enum(["success", "partial", "failure", "timeout", "error"]),
49280
+ success: z110.boolean(),
49281
+ qualityScore: z110.number().min(0).max(1),
49282
+ durationMs: z110.number().min(0),
49283
+ tokenUsage: z110.number().int().min(0),
49284
+ errorMessage: z110.string().optional(),
49001
49285
  qualitySignals: QualitySignalsSchema,
49002
- traceId: z108.string()
49286
+ traceId: z110.string()
49003
49287
  });
49004
49288
  var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
49005
49289
  maxPendingDecisions: 1e3,
@@ -49014,17 +49298,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
49014
49298
  targetTokenUsage: 2e3,
49015
49299
  maxHistorySize: 1e4
49016
49300
  };
49017
- var FeedbackCollectorConfigSchema = z108.object({
49018
- maxPendingDecisions: z108.number().int().positive().default(1e3),
49019
- pendingTimeoutMs: z108.number().positive().default(3e5),
49020
- enableAutoReward: z108.boolean().default(true),
49021
- qualityWeight: z108.number().min(0).max(1).default(0.5),
49022
- speedWeight: z108.number().min(0).max(1).default(0.2),
49023
- efficiencyWeight: z108.number().min(0).max(1).default(0.2),
49024
- retryPenalty: z108.number().min(0).max(1).default(0.1),
49025
- targetDurationMs: z108.number().positive().default(5e3),
49026
- targetTokenUsage: z108.number().positive().default(2e3),
49027
- maxHistorySize: z108.number().int().positive().default(1e4)
49301
+ var FeedbackCollectorConfigSchema = z110.object({
49302
+ maxPendingDecisions: z110.number().int().positive().default(1e3),
49303
+ pendingTimeoutMs: z110.number().positive().default(3e5),
49304
+ enableAutoReward: z110.boolean().default(true),
49305
+ qualityWeight: z110.number().min(0).max(1).default(0.5),
49306
+ speedWeight: z110.number().min(0).max(1).default(0.2),
49307
+ efficiencyWeight: z110.number().min(0).max(1).default(0.2),
49308
+ retryPenalty: z110.number().min(0).max(1).default(0.1),
49309
+ targetDurationMs: z110.number().positive().default(5e3),
49310
+ targetTokenUsage: z110.number().positive().default(2e3),
49311
+ maxHistorySize: z110.number().int().positive().default(1e4)
49028
49312
  });
49029
49313
 
49030
49314
  // src/learning/outcome-feedback-helpers.ts
@@ -51270,6 +51554,8 @@ export {
51270
51554
  registerQueryTaskStateTool,
51271
51555
  registerGetJobResultTool,
51272
51556
  registerListJobsTool,
51557
+ registerCancelJobTool,
51558
+ registerCiHealthCheckTool,
51273
51559
  AuditError,
51274
51560
  AuditCategorySchema,
51275
51561
  AuditSeveritySchema,
@@ -51353,4 +51639,4 @@ export {
51353
51639
  detectBackend,
51354
51640
  createTaskTracker
51355
51641
  };
51356
- //# sourceMappingURL=chunk-6KZL5DMU.js.map
51642
+ //# sourceMappingURL=chunk-6NKQ5QX4.js.map