@integrity-labs/agt-cli 0.28.126 → 0.28.128

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.
@@ -22,7 +22,7 @@ import {
22
22
  resolveConnectivityProbe,
23
23
  worseConnectivityOutcome,
24
24
  wrapScheduledTaskPrompt
25
- } from "./chunk-7XL7JLHZ.js";
25
+ } from "./chunk-NCRDTQ54.js";
26
26
 
27
27
  // ../../packages/core/dist/integrations/registry.js
28
28
  var INTEGRATION_REGISTRY = [
@@ -5221,11 +5221,33 @@ function provisionOrientHook(codeName) {
5221
5221
  "NOW_ISO=$(date -u +%Y-%m-%dT%H:%M:%SZ)",
5222
5222
  'NOW_LOCAL=$(date "+%Y-%m-%d %H:%M %Z")',
5223
5223
  "",
5224
+ '# ENG-6703: the SessionStart "source" tells us whether this boot RESUMED the',
5225
+ "# prior conversation context (--resume) or is a FRESH respawn with no",
5226
+ "# transcript (wedge / new day / rotated session). Branch the orientation",
5227
+ "# framing on it so a resumed agent continues its in-flight work instead of",
5228
+ "# being told (wrongly) that its context is gone. Read stdin once; prefer",
5229
+ '# .source, fall back to .matcher (test harness), then "startup" if absent or',
5230
+ "# no jq on the host.",
5231
+ "HOOK_INPUT=$(cat 2>/dev/null || true)",
5232
+ '# Prefer .source, fall back to .matcher (test harness), then "startup".',
5233
+ "# Skip null AND empty-string values - jq's `//` only falls back on null/false,",
5234
+ "# so an explicit empty .source would otherwise win over a real .matcher",
5235
+ "# (CodeRabbit, PR #2385).",
5236
+ `SOURCE=$(printf "%s" "$HOOK_INPUT" | jq -r '[.source, .matcher] | map(select(. != null and . != "")) | (.[0] // "startup")' 2>/dev/null || echo startup)`,
5237
+ "# jq on empty/invalid input exits 0 with no output, so coerce a blank result",
5238
+ '# (and a literal jq "null") back to the fresh-boot default.',
5239
+ 'if [ -z "$SOURCE" ] || [ "$SOURCE" = "null" ]; then SOURCE=startup; fi',
5240
+ "",
5224
5241
  'echo "# Orientation"',
5225
5242
  "echo",
5226
- 'echo "You are **${CODE_NAME}**. This is a fresh session \u2014 your previous in-conversation context is not available. Use the signals below to orient yourself before responding to channel traffic."',
5243
+ 'if [ "$SOURCE" = "resume" ]; then',
5244
+ ' echo "You are **${CODE_NAME}**. You were just restarted, but this session RESUMED your prior conversation context (your earlier transcript is available above). You may have been interrupted mid-task. Re-read your last few messages, reconcile them with the signals below (recent kanban work and any queued messages), and CONTINUE whatever was in flight. Before repeating an action, check what you already did (your transcript plus the kanban card state) so you never duplicate a reply or a side effect."',
5245
+ "else",
5246
+ ' echo "You are **${CODE_NAME}**. This is a fresh session: your previous in-conversation context is NOT available. Reconstruct what you were doing from the signals below (recent kanban work and any queued messages) before responding, and continue any task that was in flight."',
5247
+ "fi",
5227
5248
  "echo",
5228
5249
  'echo "- Current time: ${NOW_LOCAL} (${NOW_ISO})"',
5250
+ 'echo "- Session source: ${SOURCE}"',
5229
5251
  "",
5230
5252
  "# --- Pending-inbound counts + details -----------------------------------",
5231
5253
  "# Channel MCPs queue inbound messages here while the claude process is",
@@ -5272,14 +5294,20 @@ function provisionOrientHook(codeName) {
5272
5294
  ' echo "- No queued messages on any channel."',
5273
5295
  "fi",
5274
5296
  "",
5275
- "# --- Follow-up data sources (ENG-5397 follow-ups) ---------------------",
5276
- "# TODO: kanban \u2014 query augmented API /agents/<id>/kanban for open items",
5277
- "# TODO: audit_log \u2014 last N rows of recent agent activity",
5278
- "# TODO: memory \u2014 entries written today / since last spawn",
5279
- "# These need an auth-aware HTTP path; the Stop hook already shows the",
5280
- "# /host/exchange + JWT pattern. Holding off here until those endpoints",
5281
- "# exist and the orient skill in claudecode-plugin-augmented owns the",
5282
- "# query shape.",
5297
+ "# --- Recent work (kanban) - ENG-6703 ----------------------------------",
5298
+ "# The kanban board is the DURABLE record of what this agent was doing - it",
5299
+ "# survives a restart even when the in-conversation transcript does not, so",
5300
+ "# it is the primary way a fresh respawn reconstructs in-flight work (and a",
5301
+ "# cross-check for a resumed one). We instruct the agent to query it via its",
5302
+ "# own kanban tools rather than fetching here: the agent already has",
5303
+ "# kanban_list (active + last 24h done) and kanban_search (older/closed),",
5304
+ "# scoped to its identity, so there is no auth-aware HTTP path to build in",
5305
+ "# the hook and no risk of embedding stale board state.",
5306
+ "# (audit_log + memory remain ENG-5397 follow-ups.)",
5307
+ "echo",
5308
+ 'echo "## Recent work (kanban)"',
5309
+ "echo",
5310
+ 'echo "Before you respond, call **kanban_list** to see your in-progress and recently-completed cards and reconstruct what you were working on. If a card is still \\"in_progress\\" (or a queued message above maps to one), that is almost certainly the work you were interrupted on - pick it back up. Use **kanban_search** for older or already-closed cards if needed. As you resume, update the card (kanban_progress / kanban_log) so the next restart has an even clearer trail. Do NOT re-do a card already marked done."',
5283
5311
  "",
5284
5312
  "echo",
5285
5313
  'echo "## Next step"',
@@ -5319,6 +5347,11 @@ function provisionOrientHook(codeName) {
5319
5347
  " else",
5320
5348
  ` echo "Respond \\"Ready.\\" once, then immediately work through the queued messages above, oldest first \u2014 they are real user messages from before this session started and will NOT be re-delivered. Use the addressing ids with the matching channel reply tool (slack.reply with channel + thread_ts, telegram.reply with chat_id, etc.). If a queue detail lacks the message content, first try the channel's thread/history tools to read the conversation (Slack threads can be re-read); only if the content is truly unrecoverable, say so honestly in your reply and ask the user to resend."`,
5321
5349
  " fi",
5350
+ 'elif [ "$SOURCE" = "resume" ]; then',
5351
+ " # ENG-6703: a resumed session with no queued message may still have been",
5352
+ " # interrupted mid-task - re-read context + kanban and continue rather than",
5353
+ " # idle-waiting (which would strand the in-flight work).",
5354
+ ' echo "Respond \\"Ready.\\" once. Re-read your recent transcript and your kanban (above): if you were mid-task, continue it now. Otherwise wait for the next user or channel message before running tools."',
5322
5355
  "else",
5323
5356
  ' echo "Respond \\"Ready.\\" once. Do not run any tools or load any data until a real user or channel message arrives. When you do receive a message, acknowledge it before tool use."',
5324
5357
  "fi",
@@ -5333,16 +5366,18 @@ function provisionOrientHook(codeName) {
5333
5366
  }
5334
5367
  const hooks = settings["hooks"] ?? {};
5335
5368
  const existingSessionStart = Array.isArray(hooks["SessionStart"]) ? [...hooks["SessionStart"]] : [];
5336
- const alreadyRegistered = existingSessionStart.some((entry) => {
5337
- const matcher = entry.matcher;
5338
- const entryHooks = entry.hooks;
5339
- return matcher === "startup" && Array.isArray(entryHooks) && entryHooks.some((h) => typeof h === "object" && h !== null && h.type === "command" && h.command === hookScriptPath);
5340
- });
5341
- if (!alreadyRegistered) {
5342
- existingSessionStart.push({
5343
- matcher: "startup",
5344
- hooks: [{ type: "command", command: hookScriptPath }]
5369
+ for (const matcher of ["startup", "resume"]) {
5370
+ const alreadyRegistered = existingSessionStart.some((entry) => {
5371
+ const entryMatcher = entry.matcher;
5372
+ const entryHooks = entry.hooks;
5373
+ return entryMatcher === matcher && Array.isArray(entryHooks) && entryHooks.some((h) => typeof h === "object" && h !== null && h.type === "command" && h.command === hookScriptPath);
5345
5374
  });
5375
+ if (!alreadyRegistered) {
5376
+ existingSessionStart.push({
5377
+ matcher,
5378
+ hooks: [{ type: "command", command: hookScriptPath }]
5379
+ });
5380
+ }
5346
5381
  }
5347
5382
  hooks["SessionStart"] = existingSessionStart;
5348
5383
  settings["hooks"] = hooks;
@@ -7653,7 +7688,7 @@ function requireHost() {
7653
7688
  }
7654
7689
 
7655
7690
  // src/lib/api-client.ts
7656
- var agtCliVersion = true ? "0.28.126" : "dev";
7691
+ var agtCliVersion = true ? "0.28.128" : "dev";
7657
7692
  var lastConfigHash = null;
7658
7693
  function setConfigHash(hash) {
7659
7694
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -8950,4 +8985,4 @@ export {
8950
8985
  managerInstallSystemUnitCommand,
8951
8986
  managerUninstallSystemUnitCommand
8952
8987
  };
8953
- //# sourceMappingURL=chunk-6XEUSG6Z.js.map
8988
+ //# sourceMappingURL=chunk-O55BMAX7.js.map