@adhdev/daemon-standalone 1.0.56-rc.4 → 1.0.56-rc.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adhdev/daemon-standalone",
3
- "version": "1.0.56-rc.4",
3
+ "version": "1.0.56-rc.5",
4
4
  "description": "ADHDev standalone daemon — embedded HTTP/WS server for local dashboard",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -37,7 +37,7 @@
37
37
  "license": "AGPL-3.0-or-later",
38
38
  "dependencies": {
39
39
  "@adhdev/ghostty-vt-node": "*",
40
- "@adhdev/session-host-core": "1.0.56-rc.4",
40
+ "@adhdev/session-host-core": "1.0.56-rc.5",
41
41
  "@xterm/addon-serialize": "^0.14.0",
42
42
  "@xterm/xterm": "^6.0.0",
43
43
  "chalk": "^5.3.0",
@@ -627,8 +627,9 @@ function buildMagiPanelProposal(detected, opts = {}) {
627
627
  var CANONICAL_MESH_TOOL_NAMES = [
628
628
  "mesh_status",
629
629
  "mesh_list_nodes",
630
- "mesh_enqueue_task",
630
+ // GRAPH-ORCHESTRATION Phase F — batch before task, mirroring ALL_MESH_TOOLS.
631
631
  "mesh_enqueue_batch",
632
+ "mesh_enqueue_task",
632
633
  "mesh_view_queue",
633
634
  // GRAPH-ORCHESTRATION Phase E — the coordinator gate + graph view surface.
634
635
  "mesh_graph_view",
@@ -1030,9 +1031,30 @@ var MESH_LIST_NODES_TOOL = {
1030
1031
  }
1031
1032
  }
1032
1033
  };
1034
+ var ENQUEUE_TOOL_GROUP = "mesh.enqueue";
1035
+ var ENQUEUE_TOOL_GROUP_MEMBERS = ["mesh_enqueue_batch", "mesh_enqueue_task"];
1036
+ var ENQUEUE_DISCOVERY_KEYWORDS = ["enqueue", "delegate", "task", "graph", "dependency"];
1037
+ var ENQUEUE_RANK_QUERIES = ["enqueue", "delegate"];
1038
+ var ENQUEUE_BATCH_DISCOVERY_META = {
1039
+ toolGroup: ENQUEUE_TOOL_GROUP,
1040
+ toolGroupMembers: ENQUEUE_TOOL_GROUP_MEMBERS,
1041
+ discoveryKeywords: ENQUEUE_DISCOVERY_KEYWORDS,
1042
+ discoveryRankQueries: ENQUEUE_RANK_QUERIES,
1043
+ discoveryRank: 0,
1044
+ enqueueRole: "default"
1045
+ };
1046
+ var ENQUEUE_TASK_DISCOVERY_META = {
1047
+ toolGroup: ENQUEUE_TOOL_GROUP,
1048
+ toolGroupMembers: ENQUEUE_TOOL_GROUP_MEMBERS,
1049
+ discoveryKeywords: ENQUEUE_DISCOVERY_KEYWORDS,
1050
+ discoveryRankQueries: ENQUEUE_RANK_QUERIES,
1051
+ discoveryRank: 10,
1052
+ enqueueRole: "single_task_fallback"
1053
+ };
1033
1054
  var MESH_ENQUEUE_TASK_TOOL = {
1034
1055
  name: "mesh_enqueue_task",
1035
- description: "Add a new task to the mesh work queue. Idle nodes will automatically pull and execute tasks from this queue. Use this instead of mesh_send_task when you do not need to target a specific node. For a dependency-wired MULTI-task graph prefer mesh_enqueue_batch: it inserts the whole set atomically and lets depends_on reference batch-local refs, so no half-registered chain can be left behind. Supports task-level priority (high tasks are pulled ahead of older normal/low tasks), not_before delayed execution (hold a task pending until a time), maxRetries (auto-fail after N requeues), and duplicate detection (by default warns in the response when an in-flight task with the same message+target already exists; pass block_duplicate=true to refuse instead, or allow_duplicate=true to silence the warning).",
1056
+ description: "SINGLE-TASK FALLBACK. Use only when exactly one new worker task is currently known and no downstream graph step can yet be declared. If two or more steps are known\u2014including steps that need outputs, worktree preparation, a condition, or a coordinator action\u2014load and use mesh_enqueue_batch instead. Same-session continuation belongs in mesh_send_task. Adds the task to the mesh work queue; idle nodes automatically pull and execute from it. Use this instead of mesh_send_task when you do not need to target a specific node. Supports task-level priority (high tasks are pulled ahead of older normal/low tasks), not_before delayed execution (hold a task pending until a time), maxRetries (auto-fail after N requeues), and duplicate detection (by default warns in the response when an in-flight task with the same message+target already exists; pass block_duplicate=true to refuse instead, or allow_duplicate=true to silence the warning).",
1057
+ _meta: ENQUEUE_TASK_DISCOVERY_META,
1036
1058
  inputSchema: {
1037
1059
  type: "object",
1038
1060
  properties: {
@@ -1070,7 +1092,8 @@ var MESH_ENQUEUE_TASK_TOOL = {
1070
1092
  };
1071
1093
  var MESH_ENQUEUE_BATCH_TOOL = {
1072
1094
  name: "mesh_enqueue_batch",
1073
- description: "G5: atomically enqueue a dependency-wired set of tasks \u2014 either EVERY task in the batch is inserted or NONE is (a mid-batch error such as a dependency cycle, invalid difficulty, or guardrail violation rolls the whole batch back). Use this instead of N sequential mesh_enqueue_task calls whenever you are wiring a multi-task graph: give each task a batch-local `ref` label and name sibling refs in `depends_on` (forward references allowed \u2014 array order does not matter). A depends_on value that is not a ref in this batch must be an EXISTING queue task id; anything else is rejected. Per-task fields are the same as mesh_enqueue_task. Top-level mission_id applies to every task that lacks its own. Beyond plain ordering it also accepts a full orchestration graph, so you can submit the WHOLE known plan once instead of enqueueing each step as the previous one finishes: `inputs_from` binds selected predecessor outputs into a later task (no hand-copying worker text), `run_if` branches on those outputs, `gates` declare steps that stop for a coordinator action (Refinery landing, approval, CI wait, publish, deploy) with downstream tasks pointing at them via `gated_by`, and `workspaces` + `workspace_ref` prepare a worktree later for a task that needs one. These are strictly additive: a batch using only message/depends_on behaves exactly as before. Only graph-using batches create a graph, inspectable with mesh_graph_view.",
1095
+ description: "DEFAULT enqueue surface for a plan with two or more known graph steps. Atomically persists the graph plan and worker queue entries. Supports batch-local refs, completion dependencies, selected predecessor outputs through `inputs_from`, declarative `run_if`, delayed `workspace_ref` preparation, and coordinator gates. Worker dispatch still requires the shared dependency predicate: all active worker dependencies completed and no system block. Git workspace preparation is a compensated saga and is reported separately from DB atomicity. Atomicity in detail: either EVERY task in the batch is inserted or NONE is (a mid-batch error such as a dependency cycle, invalid difficulty, or guardrail violation rolls the whole batch back). Give each task a batch-local `ref` label and name sibling refs in `depends_on` (forward references allowed \u2014 array order does not matter). A depends_on value that is not a ref in this batch must be an EXISTING queue task id; anything else is rejected. Per-task fields are the same as mesh_enqueue_task. Top-level mission_id applies to every task that lacks its own. `inputs_from` binds selected predecessor outputs into a later task (no hand-copying worker text), `run_if` branches on those outputs, `gates` declare steps that stop for a coordinator action (Refinery landing, approval, CI wait, publish, deploy) with downstream tasks pointing at them via `gated_by`, and `workspaces` + `workspace_ref` prepare a worktree later for a task that needs one. These are strictly additive: a batch using only message/depends_on behaves exactly as before. Only graph-using batches create a graph, inspectable with mesh_graph_view.",
1096
+ _meta: ENQUEUE_BATCH_DISCOVERY_META,
1074
1097
  inputSchema: {
1075
1098
  type: "object",
1076
1099
  properties: {
@@ -2083,8 +2106,11 @@ var MESH_COORDINATOR_PROMPT_APPEND_SET_TOOL = {
2083
2106
  var ALL_MESH_TOOLS = [
2084
2107
  MESH_STATUS_TOOL,
2085
2108
  MESH_LIST_NODES_TOOL,
2086
- MESH_ENQUEUE_TASK_TOOL,
2109
+ // GRAPH-ORCHESTRATION Phase F — batch BEFORE task. Registry order is what a
2110
+ // client that lists tools without ranking sees first, so the default enqueue
2111
+ // surface leads and the single-task fallback follows it.
2087
2112
  MESH_ENQUEUE_BATCH_TOOL,
2113
+ MESH_ENQUEUE_TASK_TOOL,
2088
2114
  MESH_VIEW_QUEUE_TOOL,
2089
2115
  // GRAPH-ORCHESTRATION Phase E — placed next to the queue/enqueue tools so a
2090
2116
  // coordinator that loaded the batch schema also discovers how to pass a gate.
@@ -2669,6 +2695,15 @@ function annotateRapidReadChatAdvisory(payload, options) {
2669
2695
  // src/tools/mesh-tools-internal.ts
2670
2696
  var import_daemon_core6 = require("@adhdev/daemon-core");
2671
2697
  var import_node_crypto = require("crypto");
2698
+ function recordMeshCoordinatorToolCall(ctx, tool) {
2699
+ const sessionId = ctx.coordinatorSessionId ?? null;
2700
+ return (0, import_daemon_core5.recordMeshToolCall)({
2701
+ meshId: ctx.mesh.id,
2702
+ tool,
2703
+ sessionId,
2704
+ callerRole: sessionId ? "coordinator" : "unknown"
2705
+ });
2706
+ }
2672
2707
  var SESSION_PROVIDER_METADATA_TTL_MS = 30 * 6e4;
2673
2708
  var meshSessionProviderMetadata = /* @__PURE__ */ new Map();
2674
2709
  function getSessionMetadata(key) {
@@ -4229,7 +4264,7 @@ function summarizePendingEventProtocolMetrics(pendingEvents) {
4229
4264
  };
4230
4265
  }
4231
4266
  async function meshStatus(ctx, args = {}) {
4232
- const rateResult = (0, import_daemon_core6.recordMeshToolCall)({ meshId: ctx.mesh.id, tool: "mesh_status" });
4267
+ const rateResult = recordMeshCoordinatorToolCall(ctx, "mesh_status");
4233
4268
  const compact = args.verbose === true ? false : args.compact ?? true;
4234
4269
  await refreshMeshFromDaemon(ctx);
4235
4270
  const { mesh, transport } = ctx;
@@ -4863,7 +4898,7 @@ function resolveGateSession(ctx, explicit) {
4863
4898
  return readString(explicit) || ctx.coordinatorSessionId || void 0;
4864
4899
  }
4865
4900
  async function meshGraphGateClaim(ctx, args) {
4866
- (0, import_daemon_core6.recordMeshToolCall)({ meshId: ctx.mesh.id, tool: "mesh_graph_gate_claim" });
4901
+ recordMeshCoordinatorToolCall(ctx, "mesh_graph_gate_claim");
4867
4902
  const gateId = readString(args.gate_id) || readString(args.gateId);
4868
4903
  if (!gateId) {
4869
4904
  return JSON.stringify({
@@ -4958,7 +4993,7 @@ function describeClaimRefusal(reason, state) {
4958
4993
  }
4959
4994
  }
4960
4995
  async function meshGraphGateRelease(ctx, args) {
4961
- (0, import_daemon_core6.recordMeshToolCall)({ meshId: ctx.mesh.id, tool: "mesh_graph_gate_release" });
4996
+ recordMeshCoordinatorToolCall(ctx, "mesh_graph_gate_release");
4962
4997
  const gateId = readString(args.gate_id) || readString(args.gateId);
4963
4998
  const fencingToken = readString(args.fencing_token) || readString(args.fencingToken);
4964
4999
  const leaseGeneration = readNumber(args.lease_generation ?? args.leaseGeneration);
@@ -5040,7 +5075,7 @@ async function meshGraphGateRelease(ctx, args) {
5040
5075
  }
5041
5076
  }
5042
5077
  async function meshGraphView(ctx, args) {
5043
- (0, import_daemon_core6.recordMeshToolCall)({ meshId: ctx.mesh.id, tool: "mesh_graph_view" });
5078
+ recordMeshCoordinatorToolCall(ctx, "mesh_graph_view");
5044
5079
  try {
5045
5080
  await refreshMeshFromDaemon(ctx);
5046
5081
  const graphId = readString(args.graph_id) || readString(args.graphId);
@@ -5637,7 +5672,7 @@ async function meshEnqueueBatch(ctx, args) {
5637
5672
  });
5638
5673
  }
5639
5674
  async function meshViewQueue(ctx, args) {
5640
- const rateResult = (0, import_daemon_core6.recordMeshToolCall)({ meshId: ctx.mesh.id, tool: "mesh_view_queue" });
5675
+ const rateResult = recordMeshCoordinatorToolCall(ctx, "mesh_view_queue");
5641
5676
  const compact = args.verbose === true ? false : args.compact ?? true;
5642
5677
  try {
5643
5678
  await refreshMeshFromDaemon(ctx);
@@ -8944,7 +8979,7 @@ async function meshAnswerQuestion(ctx, args) {
8944
8979
  return JSON.stringify(result, null, 2);
8945
8980
  }
8946
8981
  async function meshListPendingApprovals(ctx, _args = {}) {
8947
- (0, import_daemon_core6.recordMeshToolCall)({ meshId: ctx.mesh.id, tool: "mesh_list_pending_approvals" });
8982
+ recordMeshCoordinatorToolCall(ctx, "mesh_list_pending_approvals");
8948
8983
  await refreshMeshFromDaemon(ctx);
8949
8984
  const liveNodes = await collectMeshViewQueueNodesWithLiveSessions(ctx);
8950
8985
  let ledgerEntries = (0, import_daemon_core6.readLedgerEntries)(ctx.mesh.id, { tail: 200 });