@dadado/agent-kit-cli 6.8.0 → 6.9.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.
@@ -39,6 +39,7 @@ import {
39
39
  } from "./lib/live-refresh.mjs";
40
40
  import { PIPELINE_CACHE_ENV, pipelineCacheJsonFromSnapshot } from "./lib/pipeline-cache.mjs";
41
41
  import { buildInventoryBaseline } from "./lib/semantic-model.mjs";
42
+ import { SHIP_LANE_CACHE_ENV, shipLaneCacheJsonFromSnapshot } from "./lib/ship-lane.mjs";
42
43
 
43
44
  const __dirname = dirname(fileURLToPath(import.meta.url));
44
45
  /** Kit tree that owns `dashboard/` static assets and serve.mjs. */
@@ -78,6 +79,8 @@ const dataScript = join(__dirname, "dashboard-data.mjs");
78
79
  let previousInventoryJson = null;
79
80
  /** Last attempted devops.pipeline (with fetchedAt); the data script reuses it while fresh. */
80
81
  let previousPipelineJson = null;
82
+ /** Last attempted shipLane.remote (with fetchedAt); reused for up to 120s (lib/ship-lane.mjs). */
83
+ let previousShipLaneJson = null;
81
84
 
82
85
  /**
83
86
  * @param {string} payload
@@ -113,6 +116,19 @@ function pipelineCacheJsonFromPayload(payload) {
113
116
  }
114
117
  }
115
118
 
119
+ /**
120
+ * @param {string} payload
121
+ * @returns {string|null}
122
+ */
123
+ function shipLaneCacheJsonFromPayload(payload) {
124
+ try {
125
+ const data = JSON.parse(payload);
126
+ return data && !data.error ? shipLaneCacheJsonFromSnapshot(data) : null;
127
+ } catch {
128
+ return null;
129
+ }
130
+ }
131
+
116
132
  function setCorsHeaders(req, res) {
117
133
  applyCorsHeaders(req, res, PORT);
118
134
  }
@@ -286,6 +302,7 @@ function runDataScript() {
286
302
  // Empty string = cold start (dashboard-data treats falsy as no previous).
287
303
  AGENT_KIT_PREV_INVENTORY: previousInventoryJson || "",
288
304
  [PIPELINE_CACHE_ENV]: previousPipelineJson || "",
305
+ [SHIP_LANE_CACHE_ENV]: previousShipLaneJson || "",
289
306
  };
290
307
  execFile(
291
308
  process.execPath,
@@ -310,6 +327,8 @@ function runDataScript() {
310
327
  if (baseline) previousInventoryJson = baseline;
311
328
  const pipelineCache = pipelineCacheJsonFromPayload(stdout);
312
329
  if (pipelineCache) previousPipelineJson = pipelineCache;
330
+ const shipLaneCache = shipLaneCacheJsonFromPayload(stdout);
331
+ if (shipLaneCache) previousShipLaneJson = shipLaneCache;
313
332
  // Chat titles are private: a broadcast (LAN, token-gated) server never serves them, even
314
333
  // if the child missed the bind env. Every route (/api/data, SSE connect, push) reads this.
315
334
  resolve(authResolved.broadcast ? withholdChatsFromPayload(stdout) : stdout);
package/dist/index.js CHANGED
@@ -240,9 +240,9 @@ var main = defineCommand({
240
240
  contribute: () => import("./contribute-VSVPRHQ7.js").then((m) => m.contributeCommand),
241
241
  handoff: () => import("./handoff-5AGE2D3T.js").then((m) => m.handoffCommand),
242
242
  "plan-index": () => import("./plan-index-BNLUU6T5.js").then((m) => m.planIndexCommand),
243
- run: () => import("./run-DXGTFYJK.js").then((m) => m.runCommand),
243
+ run: () => import("./run-VOVR5O7S.js").then((m) => m.runCommand),
244
244
  "run-plan": () => import("./run-plan-KWGS2SOZ.js").then((m) => m.runPlanCommand),
245
- "run-plan-all": () => import("./run-DXGTFYJK.js").then((m) => m.runPlanAllCommand),
245
+ "run-plan-all": () => import("./run-VOVR5O7S.js").then((m) => m.runPlanAllCommand),
246
246
  countdown: () => import("./countdown-XYRE4GZU.js").then((m) => m.countdownCommand),
247
247
  "ground-control": () => import("./ground-control-726LRB6Q.js").then((m) => m.groundControlCommand),
248
248
  dashboard: () => import("./dashboard-YNCFISNO.js").then((m) => m.dashboardCommand),
@@ -77,25 +77,46 @@ function projectQueueState(handoff) {
77
77
  if (queue.length === 0) return { cursor: null, total: 0, current: null, status: null };
78
78
  return { cursor, total: queue.length, current, status };
79
79
  }
80
- async function readQueueState(root) {
81
- let handoff = "";
80
+ async function readHandoffText(root) {
82
81
  try {
83
- handoff = await readFile(path.join(root, HANDOFF_REL), "utf8");
82
+ return await readFile(path.join(root, HANDOFF_REL), "utf8");
84
83
  } catch {
84
+ return null;
85
85
  }
86
- return projectQueueState(handoff);
86
+ }
87
+ async function readQueueState(root) {
88
+ return projectQueueState(await readHandoffText(root) ?? "");
87
89
  }
88
90
  function createQueueStateWatcher(opts) {
91
+ const read = opts.read ?? (() => readHandoffText(opts.root));
89
92
  let last = JSON.stringify(opts.initial);
93
+ let pending = null;
90
94
  let busy = null;
91
95
  let stopped = false;
92
- const check = async () => {
93
- const next = await readQueueState(opts.root);
94
- const key = JSON.stringify(next);
95
- if (key === last || stopped) return;
96
+ const emit = (next, key) => {
96
97
  last = key;
98
+ pending = null;
97
99
  opts.emitter.emit({ type: "queue_state", ...next });
98
100
  };
101
+ const sample = async () => {
102
+ const text = await read();
103
+ if (text !== null && text.trim() === "") return null;
104
+ const next = projectQueueState(text ?? "");
105
+ return { next, key: JSON.stringify(next) };
106
+ };
107
+ const check = async () => {
108
+ const got = await sample();
109
+ if (!got || stopped) return;
110
+ if (got.key === last) {
111
+ pending = null;
112
+ return;
113
+ }
114
+ if (got.key !== pending) {
115
+ pending = got.key;
116
+ return;
117
+ }
118
+ emit(got.next, got.key);
119
+ };
99
120
  const tick = () => {
100
121
  if (busy) return busy;
101
122
  busy = check().finally(() => {
@@ -111,7 +132,9 @@ function createQueueStateWatcher(opts) {
111
132
  return {
112
133
  flush: async () => {
113
134
  if (busy) await busy;
114
- await tick();
135
+ const got = await sample();
136
+ if (!got || stopped || got.key === last) return;
137
+ emit(got.next, got.key);
115
138
  },
116
139
  stop: () => {
117
140
  stopped = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dadado/agent-kit-cli",
3
- "version": "6.8.0",
3
+ "version": "6.9.0",
4
4
  "description": "Agent Kit CLI: HITL framework install and tooling for AI-assisted IDEs (rules, skills, plan/handoff, context).",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",