@integrity-labs/agt-cli 0.21.7 → 0.21.9

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/dist/bin/agt.js CHANGED
@@ -50,7 +50,7 @@ import {
50
50
  success,
51
51
  table,
52
52
  warn
53
- } from "../chunk-QNNNH5IA.js";
53
+ } from "../chunk-3ZO3LKA2.js";
54
54
 
55
55
  // src/bin/agt.ts
56
56
  import { join as join10 } from "path";
@@ -3734,7 +3734,7 @@ import { execFileSync, execSync } from "child_process";
3734
3734
  import { existsSync as existsSync5, realpathSync } from "fs";
3735
3735
  import chalk17 from "chalk";
3736
3736
  import ora15 from "ora";
3737
- var cliVersion = true ? "0.21.7" : "dev";
3737
+ var cliVersion = true ? "0.21.9" : "dev";
3738
3738
  async function fetchLatestVersion() {
3739
3739
  const host2 = getHost();
3740
3740
  if (!host2) return null;
@@ -4266,7 +4266,7 @@ function handleError(err) {
4266
4266
  }
4267
4267
 
4268
4268
  // src/bin/agt.ts
4269
- var cliVersion2 = true ? "0.21.7" : "dev";
4269
+ var cliVersion2 = true ? "0.21.9" : "dev";
4270
4270
  var program = new Command();
4271
4271
  program.name("agt").description("Augmented CLI \u2014 agent provisioning and management").version(cliVersion2).option("--json", "Emit machine-readable JSON output (suppress spinners and colors)").option("--skip-update-check", "Skip the automatic update check on startup");
4272
4272
  program.hook("preAction", (thisCommand) => {
@@ -4323,6 +4323,92 @@ function provisionIsolationHook(codeName) {
4323
4323
  settings["hooks"] = hooks;
4324
4324
  writeFileSync5(settingsPath, JSON.stringify(settings, null, 2));
4325
4325
  }
4326
+ function provisionOrientHook(codeName) {
4327
+ const projectDir = getProjectDir(codeName);
4328
+ const claudeDir = join4(projectDir, ".claude");
4329
+ mkdirSync4(claudeDir, { recursive: true });
4330
+ const homeDir = getHomeDir3();
4331
+ const agentDir = join4(homeDir, ".augmented", codeName);
4332
+ const hookScriptPath = join4(claudeDir, "agt-orient-hook.sh");
4333
+ const hookScript = [
4334
+ "#!/bin/bash",
4335
+ "# Auto-generated by Augmented (ENG-5397) \u2014 SessionStart orientation hook.",
4336
+ "# stdout is injected into the new Claude Code session as additional context.",
4337
+ "set -uo pipefail",
4338
+ "# Soft-fail: any error must not block session boot. Print whatever we have.",
4339
+ `trap 'ec=$?; echo "(orient hook hit error code $ec at line $LINENO \u2014 partial context above)" >&2; exit 0' ERR`,
4340
+ "",
4341
+ `CODE_NAME="${codeName}"`,
4342
+ `AGENT_DIR="${agentDir}"`,
4343
+ "NOW_ISO=$(date -u +%Y-%m-%dT%H:%M:%SZ)",
4344
+ 'NOW_LOCAL=$(date "+%Y-%m-%d %H:%M %Z")',
4345
+ "",
4346
+ 'echo "# Orientation"',
4347
+ "echo",
4348
+ '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."',
4349
+ "echo",
4350
+ 'echo "- Current time: ${NOW_LOCAL} (${NOW_ISO})"',
4351
+ "",
4352
+ "# --- Pending-inbound counts -------------------------------------------",
4353
+ "# Channel MCPs queue inbound messages here while the claude process is",
4354
+ "# starting / down. A non-empty queue means there is unprocessed user",
4355
+ '# traffic to acknowledge once you respond "Ready.".',
4356
+ "echo",
4357
+ 'echo "## Pending inbound"',
4358
+ "pending_total=0",
4359
+ "for channel in slack telegram direct-chat; do",
4360
+ ' dir="${AGENT_DIR}/${channel}-pending-inbound"',
4361
+ ' if [ -d "$dir" ]; then',
4362
+ ' count=$(find "$dir" -maxdepth 1 -type f 2>/dev/null | wc -l | tr -d " ")',
4363
+ ' if [ "$count" -gt 0 ]; then',
4364
+ ' echo "- ${channel}: ${count} queued message(s)"',
4365
+ " pending_total=$((pending_total + count))",
4366
+ " fi",
4367
+ " fi",
4368
+ "done",
4369
+ 'if [ "$pending_total" -eq 0 ]; then',
4370
+ ' echo "- No queued messages on any channel."',
4371
+ "fi",
4372
+ "",
4373
+ "# --- Follow-up data sources (ENG-5397 follow-ups) ---------------------",
4374
+ "# TODO: kanban \u2014 query augmented API /agents/<id>/kanban for open items",
4375
+ "# TODO: audit_log \u2014 last N rows of recent agent activity",
4376
+ "# TODO: memory \u2014 entries written today / since last spawn",
4377
+ "# These need an auth-aware HTTP path; the Stop hook already shows the",
4378
+ "# /host/exchange + JWT pattern. Holding off here until those endpoints",
4379
+ "# exist and the orient skill in claudecode-plugin-augmented owns the",
4380
+ "# query shape.",
4381
+ "",
4382
+ "echo",
4383
+ 'echo "## Next step"',
4384
+ "echo",
4385
+ '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."',
4386
+ "exit 0"
4387
+ ].join("\n") + "\n";
4388
+ writeFileSync5(hookScriptPath, hookScript, { mode: 493 });
4389
+ const settingsPath = join4(claudeDir, "settings.local.json");
4390
+ let settings = {};
4391
+ try {
4392
+ settings = JSON.parse(readFileSync5(settingsPath, "utf-8"));
4393
+ } catch {
4394
+ }
4395
+ const hooks = settings["hooks"] ?? {};
4396
+ const existingSessionStart = Array.isArray(hooks["SessionStart"]) ? [...hooks["SessionStart"]] : [];
4397
+ const alreadyRegistered = existingSessionStart.some((entry) => {
4398
+ const matcher = entry.matcher;
4399
+ const entryHooks = entry.hooks;
4400
+ return matcher === "startup" && Array.isArray(entryHooks) && entryHooks.some((h) => typeof h === "object" && h !== null && h.type === "command" && h.command === hookScriptPath);
4401
+ });
4402
+ if (!alreadyRegistered) {
4403
+ existingSessionStart.push({
4404
+ matcher: "startup",
4405
+ hooks: [{ type: "command", command: hookScriptPath }]
4406
+ });
4407
+ }
4408
+ hooks["SessionStart"] = existingSessionStart;
4409
+ settings["hooks"] = hooks;
4410
+ writeFileSync5(settingsPath, JSON.stringify(settings, null, 2));
4411
+ }
4326
4412
  function modifyJsonConfig(filePath, fn) {
4327
4413
  let originalContent;
4328
4414
  let config;
@@ -9475,6 +9561,7 @@ export {
9475
9561
  extractCommandNotFound,
9476
9562
  provisionStopHook,
9477
9563
  provisionIsolationHook,
9564
+ provisionOrientHook,
9478
9565
  setJsonMode,
9479
9566
  isJsonMode,
9480
9567
  jsonOutput,
@@ -9526,4 +9613,4 @@ export {
9526
9613
  managerInstallSystemUnitCommand,
9527
9614
  managerUninstallSystemUnitCommand
9528
9615
  };
9529
- //# sourceMappingURL=chunk-QNNNH5IA.js.map
9616
+ //# sourceMappingURL=chunk-3ZO3LKA2.js.map