@integrity-labs/agt-cli 0.28.61 → 0.28.63

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.
@@ -17723,7 +17723,8 @@ function buildSlackHelpMessage(codeName) {
17723
17723
  "All commands are real Slack slash commands (autocomplete via `/`). For backward compatibility, `/help` and the restart command can also be typed as plain messages in any channel where the bot is present:",
17724
17724
  `\u2022 \`${agentSlashCommand("/help")}\` (or type \`/help\`) \u2014 show this help`,
17725
17725
  `\u2022 \`${agentSlashCommand("/restart")}\` \u2014 restart this agent`,
17726
- `\u2022 \`${agentSlashCommand("/resume-onboarding")}\` \u2014 re-run this agent's onboarding interview (allowlisted users)`,
17726
+ `\u2022 \`${agentSlashCommand("/onboard")}\` \u2014 restart this agent's onboarding from scratch (allowlisted users)`,
17727
+ `\u2022 \`${agentSlashCommand("/resume-onboarding")}\` \u2014 resume this agent's onboarding where it left off (allowlisted users)`,
17727
17728
  `\u2022 \`${agentSlashCommand("/status")}\` \u2014 this agent's model, session origin, uptime + connectivity`,
17728
17729
  "\u2022 `/watch <google-doc-url> [duration]` (type it in chat) \u2014 watch a Google Doc for comments that mention me (default 2h, max 7d; auto-pauses when the window ends). In a shared channel, address me as `/watch-<my-name>`.",
17729
17730
  "\u2022 `/kill` \u2014 silence all agents in this thread for 6h (use as a thread reply)",
@@ -17832,6 +17833,50 @@ async function postEphemeralViaResponseUrl(responseUrl, text, logTag) {
17832
17833
  );
17833
17834
  }
17834
17835
  }
17836
+ async function forwardOnboardingSlashCommand(opts) {
17837
+ const { verb, path, userId, responseUrl, codeName } = opts;
17838
+ const allowed = getEffectiveAllowedUsers();
17839
+ if (allowed.size > 0 && (!userId || !allowed.has(userId))) {
17840
+ await postEphemeralViaResponseUrl(
17841
+ responseUrl,
17842
+ `\u{1F6AB} \`${verb}\` denied \u2014 your Slack user is not in the allowlist for \`${codeName}\`.`,
17843
+ codeName
17844
+ );
17845
+ return;
17846
+ }
17847
+ if (!AGT_HOST || !AGT_API_KEY || !AGT_AGENT_ID) {
17848
+ await postEphemeralViaResponseUrl(
17849
+ responseUrl,
17850
+ `:warning: This agent has no host API wiring \u2014 \`${verb}\` needs the host runtime to be reachable.`,
17851
+ codeName
17852
+ );
17853
+ return;
17854
+ }
17855
+ try {
17856
+ const res = await fetch(`${AGT_HOST}/host${path}`, {
17857
+ method: "POST",
17858
+ headers: {
17859
+ "Content-Type": "application/json; charset=utf-8",
17860
+ Authorization: `Bearer ${AGT_API_KEY}`
17861
+ },
17862
+ body: JSON.stringify({ agent_id: AGT_AGENT_ID }),
17863
+ signal: AbortSignal.timeout(SLACK_DOWNLOAD_TIMEOUT_MS)
17864
+ });
17865
+ const data = await res.json();
17866
+ const text = data.ok ? `\u{1F504} ${data.message ?? "Onboarding updated."}` : `:x: \`${verb}\` failed${data.error ? `: ${data.error}` : "."}`;
17867
+ await postEphemeralViaResponseUrl(responseUrl, text, codeName);
17868
+ } catch (err) {
17869
+ process.stderr.write(
17870
+ `slack-channel(${codeName}): ${verb} forward failed: ${redactAugmentedPaths2(err.message)}
17871
+ `
17872
+ );
17873
+ await postEphemeralViaResponseUrl(
17874
+ responseUrl,
17875
+ `:x: \`${verb}\` forwarding failed \u2014 host runtime unreachable. Try again in a moment.`,
17876
+ codeName
17877
+ );
17878
+ }
17879
+ }
17835
17880
  var DEBUG_TAIL_WINDOW_MS = 12e4;
17836
17881
  var DEBUG_TAIL_INTERVAL_MS = 3e3;
17837
17882
  var DEBUG_TAIL_MAX_CONSECUTIVE_FAILURES = 4;
@@ -18103,48 +18148,24 @@ async function handleSlashCommandEnvelope(payload) {
18103
18148
  }
18104
18149
  return;
18105
18150
  }
18151
+ if (matchesAgentCommand(command, "/onboard")) {
18152
+ await forwardOnboardingSlashCommand({
18153
+ verb: "/onboard",
18154
+ path: "/onboarding/reset",
18155
+ userId: payload.user_id,
18156
+ responseUrl,
18157
+ codeName
18158
+ });
18159
+ return;
18160
+ }
18106
18161
  if (matchesAgentCommand(command, "/resume-onboarding")) {
18107
- const allowed = getEffectiveAllowedUsers();
18108
- if (allowed.size > 0 && (!payload.user_id || !allowed.has(payload.user_id))) {
18109
- await postEphemeralViaResponseUrl(
18110
- responseUrl,
18111
- `\u{1F6AB} \`/resume-onboarding\` denied \u2014 your Slack user is not in the allowlist for \`${codeName}\`.`,
18112
- codeName
18113
- );
18114
- return;
18115
- }
18116
- if (!AGT_HOST || !AGT_API_KEY || !AGT_AGENT_ID) {
18117
- await postEphemeralViaResponseUrl(
18118
- responseUrl,
18119
- ":warning: This agent has no host API wiring \u2014 `/resume-onboarding` needs the host runtime to be reachable.",
18120
- codeName
18121
- );
18122
- return;
18123
- }
18124
- try {
18125
- const res = await fetch(`${AGT_HOST}/host/onboarding/reset`, {
18126
- method: "POST",
18127
- headers: {
18128
- "Content-Type": "application/json; charset=utf-8",
18129
- Authorization: `Bearer ${AGT_API_KEY}`
18130
- },
18131
- body: JSON.stringify({ agent_id: AGT_AGENT_ID }),
18132
- signal: AbortSignal.timeout(SLACK_DOWNLOAD_TIMEOUT_MS)
18133
- });
18134
- const data = await res.json();
18135
- const text = data.ok ? `\u{1F504} ${data.message ?? "Onboarding reset \u2014 I\u2019ll re-interview your manager."}` : `:x: \`/resume-onboarding\` failed${data.error ? `: ${data.error}` : "."}`;
18136
- await postEphemeralViaResponseUrl(responseUrl, text, codeName);
18137
- } catch (err) {
18138
- process.stderr.write(
18139
- `slack-channel(${codeName}): /resume-onboarding forward failed: ${err.message}
18140
- `
18141
- );
18142
- await postEphemeralViaResponseUrl(
18143
- responseUrl,
18144
- ":x: `/resume-onboarding` forwarding failed \u2014 host runtime unreachable. Try again in a moment.",
18145
- codeName
18146
- );
18147
- }
18162
+ await forwardOnboardingSlashCommand({
18163
+ verb: "/resume-onboarding",
18164
+ path: "/onboarding/resume",
18165
+ userId: payload.user_id,
18166
+ responseUrl,
18167
+ codeName
18168
+ });
18148
18169
  return;
18149
18170
  }
18150
18171
  if (command === "/debug" || matchesAgentCommand(command, "/investigate")) {
@@ -16972,6 +16972,8 @@ function buildTelegramHelpMessage(codeName) {
16972
16972
  `\u2022 /status \u2014 this agent's model, session origin, uptime + connectivity`,
16973
16973
  `\u2022 /watch <google-doc-url> [duration] \u2014 watch a Google Doc for comments that mention me (default 2h, max 7d; auto-pauses when the window ends)`,
16974
16974
  `\u2022 /restart \u2014 restart this agent`,
16975
+ `\u2022 /onboard \u2014 restart this agent's onboarding from scratch`,
16976
+ `\u2022 /resume-onboarding \u2014 resume this agent's onboarding where it left off`,
16975
16977
  `\u2022 /investigate-${codeName} \u2014 live tail of this agent's terminal pane (DM only; team owners/admins and the agent's reports-to person)`
16976
16978
  ].join("\n");
16977
16979
  }
@@ -17090,6 +17092,62 @@ async function handleStatusCommand(opts) {
17090
17092
  );
17091
17093
  }
17092
17094
  }
17095
+ async function handleOnboardingCommand(opts) {
17096
+ const verb = opts.mode === "reset" ? "/onboard" : "/resume-onboarding";
17097
+ const reply = async (text) => {
17098
+ try {
17099
+ const resp = await telegramApiCall(
17100
+ "sendMessage",
17101
+ { chat_id: opts.chatId, text, reply_to_message_id: Number(opts.messageId) },
17102
+ 1e4
17103
+ );
17104
+ if (!resp.ok) {
17105
+ process.stderr.write(
17106
+ `telegram-channel(${AGENT_CODE_NAME}): ${verb} reply rejected (chat ${redactId(opts.chatId)}): ${resp.description ?? "unknown"}
17107
+ `
17108
+ );
17109
+ }
17110
+ } catch (err) {
17111
+ process.stderr.write(
17112
+ `telegram-channel(${AGENT_CODE_NAME}): ${verb} reply send failed: ${redactAugmentedPaths(err.message)}
17113
+ `
17114
+ );
17115
+ }
17116
+ };
17117
+ if (!AGT_HOST || !AGT_API_KEY || !AGT_AGENT_ID) {
17118
+ process.stderr.write(
17119
+ `telegram-channel(${AGENT_CODE_NAME}): ${verb} missing AGT_* env \u2014 cannot reach host runtime
17120
+ `
17121
+ );
17122
+ await reply(`\u26A0\uFE0F This agent has no host API wiring \u2014 ${verb} needs the host runtime to be reachable.`);
17123
+ return;
17124
+ }
17125
+ try {
17126
+ const res = await fetch(`${AGT_HOST}/host/onboarding/${opts.mode}`, {
17127
+ method: "POST",
17128
+ headers: {
17129
+ "Content-Type": "application/json; charset=utf-8",
17130
+ Authorization: `Bearer ${AGT_API_KEY}`
17131
+ },
17132
+ body: JSON.stringify({ agent_id: AGT_AGENT_ID }),
17133
+ signal: AbortSignal.timeout(1e4)
17134
+ });
17135
+ const data = await res.json();
17136
+ process.stderr.write(
17137
+ `telegram-channel(${AGENT_CODE_NAME}): ${verb} forwarded (ok=${data.ok}) from chat ${redactId(opts.chatId)}
17138
+ `
17139
+ );
17140
+ await reply(
17141
+ data.ok ? `\u{1F504} ${data.message ?? "Onboarding updated."}` : `\u274C ${verb} failed${data.error ? `: ${data.error}` : "."}`
17142
+ );
17143
+ } catch (err) {
17144
+ process.stderr.write(
17145
+ `telegram-channel(${AGENT_CODE_NAME}): ${verb} forward failed: ${redactAugmentedPaths(err.message)}
17146
+ `
17147
+ );
17148
+ await reply(`\u274C ${verb} forwarding failed \u2014 host runtime unreachable. Try again in a moment.`);
17149
+ }
17150
+ }
17093
17151
  async function handleRestartCommand(opts) {
17094
17152
  try {
17095
17153
  if (!existsSync5(RESTART_FLAGS_DIR)) {
@@ -17466,6 +17524,14 @@ var WATCH_SYNTAX_RE = /^\/watch(?:@([A-Za-z0-9_]{1,64}))?(?:\s|$)/;
17466
17524
  function isWatchSyntax(text) {
17467
17525
  return WATCH_SYNTAX_RE.test(text);
17468
17526
  }
17527
+ var ONBOARD_SYNTAX_RE = /^\/onboard(?:@([A-Za-z0-9_]{1,64}))?(?:\s|$)/;
17528
+ var RESUME_ONBOARDING_SYNTAX_RE = /^\/resume-onboarding(?:@([A-Za-z0-9_]{1,64}))?(?:\s|$)/;
17529
+ function isOnboardSyntax(text) {
17530
+ return ONBOARD_SYNTAX_RE.test(text);
17531
+ }
17532
+ function isResumeOnboardingSyntax(text) {
17533
+ return RESUME_ONBOARDING_SYNTAX_RE.test(text);
17534
+ }
17469
17535
  function isRestartSyntax(text) {
17470
17536
  return RESTART_SYNTAX_RE.test(text);
17471
17537
  }
@@ -18791,7 +18857,11 @@ async function pollLoop() {
18791
18857
  const trimmedContent = content.trim();
18792
18858
  const isFromBot = !!msg.from?.is_bot;
18793
18859
  const nowMs = Date.now();
18794
- const telegramCommand = isHelpSyntax(trimmedContent) ? "help" : isStatusSyntax(trimmedContent) ? "status" : isWatchSyntax(trimmedContent) ? "watch" : isRestartSyntax(trimmedContent) ? "restart" : isInvestigateSyntax(trimmedContent) ? "investigate" : void 0;
18860
+ const telegramCommand = isHelpSyntax(trimmedContent) ? "help" : isStatusSyntax(trimmedContent) ? "status" : isWatchSyntax(trimmedContent) ? "watch" : (
18861
+ // ENG-6511: check /resume-onboarding before /onboard for clarity
18862
+ // (the prefixes are disjoint, so order is not load-bearing).
18863
+ isResumeOnboardingSyntax(trimmedContent) ? "resume-onboarding" : isOnboardSyntax(trimmedContent) ? "onboard" : isRestartSyntax(trimmedContent) ? "restart" : isInvestigateSyntax(trimmedContent) ? "investigate" : void 0
18864
+ );
18795
18865
  let classification;
18796
18866
  let peerLeaf;
18797
18867
  if (isFromBot) {
@@ -18889,6 +18959,23 @@ async function pollLoop() {
18889
18959
  }
18890
18960
  continue;
18891
18961
  }
18962
+ if (access.kind === "command" && (access.command === "onboard" || access.command === "resume-onboarding")) {
18963
+ const cmdToken = access.command === "onboard" ? "/onboard" : "/resume-onboarding";
18964
+ const disposition = await classifyRestartCommand(
18965
+ trimmedContent.replace(
18966
+ new RegExp(`^${cmdToken}(@[A-Za-z0-9_]{1,64})?`),
18967
+ "/restart$1"
18968
+ )
18969
+ );
18970
+ if (disposition === "act") {
18971
+ await handleOnboardingCommand({
18972
+ chatId,
18973
+ messageId: String(msg.message_id),
18974
+ mode: access.command === "onboard" ? "reset" : "resume"
18975
+ });
18976
+ }
18977
+ continue;
18978
+ }
18892
18979
  if (access.kind === "command" && access.command === "restart") {
18893
18980
  const disposition = await classifyRestartCommand(trimmedContent);
18894
18981
  if (disposition === "act") {
@@ -25,8 +25,8 @@ import {
25
25
  takeZombieDetection,
26
26
  writeDirectChatSessionState,
27
27
  writePersistentClaudeWrapper
28
- } from "./chunk-YYOFXUCK.js";
29
- import "./chunk-BJ26X4HJ.js";
28
+ } from "./chunk-AKOF4VV5.js";
29
+ import "./chunk-7F2K3RRD.js";
30
30
  import "./chunk-XWVM4KPK.js";
31
31
  export {
32
32
  SEND_KEYS_ENTER_DELAY_MS,
@@ -56,4 +56,4 @@ export {
56
56
  writeDirectChatSessionState,
57
57
  writePersistentClaudeWrapper
58
58
  };
59
- //# sourceMappingURL=persistent-session-WSKVRZZD.js.map
59
+ //# sourceMappingURL=persistent-session-5PEPYSMG.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  paneLogPath
3
- } from "./chunk-YYOFXUCK.js";
4
- import "./chunk-BJ26X4HJ.js";
3
+ } from "./chunk-AKOF4VV5.js";
4
+ import "./chunk-7F2K3RRD.js";
5
5
  import "./chunk-XWVM4KPK.js";
6
6
 
7
7
  // src/lib/responsiveness-probe.ts
@@ -250,4 +250,4 @@ export {
250
250
  parkPendingInbound,
251
251
  readAndResetChannelDeflections
252
252
  };
253
- //# sourceMappingURL=responsiveness-probe-HTPGYQPY.js.map
253
+ //# sourceMappingURL=responsiveness-probe-HG23JDG2.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.61",
3
+ "version": "0.28.63",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {