@integrity-labs/agt-cli 0.28.191 → 0.28.192

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
@@ -37,7 +37,7 @@ import {
37
37
  success,
38
38
  table,
39
39
  warn
40
- } from "../chunk-U4QYDMFA.js";
40
+ } from "../chunk-GRVRRNJD.js";
41
41
  import {
42
42
  CHANNEL_REGISTRY,
43
43
  DEFAULT_FRAMEWORK,
@@ -4749,7 +4749,7 @@ import { execFileSync, execSync } from "child_process";
4749
4749
  import { existsSync as existsSync10, realpathSync as realpathSync2 } from "fs";
4750
4750
  import chalk18 from "chalk";
4751
4751
  import ora16 from "ora";
4752
- var cliVersion = true ? "0.28.191" : "dev";
4752
+ var cliVersion = true ? "0.28.192" : "dev";
4753
4753
  async function fetchLatestVersion() {
4754
4754
  const host2 = getHost();
4755
4755
  if (!host2) return null;
@@ -5763,7 +5763,7 @@ function handleError(err) {
5763
5763
  }
5764
5764
 
5765
5765
  // src/bin/agt.ts
5766
- var cliVersion2 = true ? "0.28.191" : "dev";
5766
+ var cliVersion2 = true ? "0.28.192" : "dev";
5767
5767
  var program = new Command();
5768
5768
  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");
5769
5769
  program.hook("preAction", async (thisCommand, actionCommand) => {
@@ -6120,7 +6120,7 @@ function requireHost() {
6120
6120
  }
6121
6121
 
6122
6122
  // src/lib/api-client.ts
6123
- var agtCliVersion = true ? "0.28.191" : "dev";
6123
+ var agtCliVersion = true ? "0.28.192" : "dev";
6124
6124
  var lastConfigHash = null;
6125
6125
  function setConfigHash(hash) {
6126
6126
  lastConfigHash = hash && hash.length > 0 ? hash : null;
@@ -7425,4 +7425,4 @@ export {
7425
7425
  managerInstallSystemUnitCommand,
7426
7426
  managerUninstallSystemUnitCommand
7427
7427
  };
7428
- //# sourceMappingURL=chunk-U4QYDMFA.js.map
7428
+ //# sourceMappingURL=chunk-GRVRRNJD.js.map
@@ -28,7 +28,7 @@ import {
28
28
  requireHost,
29
29
  safeWriteJsonAtomic,
30
30
  setConfigHash
31
- } from "../chunk-U4QYDMFA.js";
31
+ } from "../chunk-GRVRRNJD.js";
32
32
  import {
33
33
  getProjectDir as getProjectDir2,
34
34
  getReadyTasks,
@@ -6681,7 +6681,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
6681
6681
  var lastVersionCheckAt = 0;
6682
6682
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
6683
6683
  var lastResponsivenessProbeAt = 0;
6684
- var agtCliVersion = true ? "0.28.191" : "dev";
6684
+ var agtCliVersion = true ? "0.28.192" : "dev";
6685
6685
  function resolveBrewPath(execFileSync4) {
6686
6686
  try {
6687
6687
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -6994,6 +6994,7 @@ __export(slack_block_kit_runtime_exports, {
6994
6994
  generateOptionToken: () => generateOptionToken,
6995
6995
  recordSlackDelivery: () => recordSlackDelivery,
6996
6996
  resolveInteractive: () => resolveInteractive,
6997
+ submitInteractive: () => submitInteractive,
6997
6998
  updatePendingInteractionMessageTs: () => updatePendingInteractionMessageTs,
6998
6999
  validateAskUserOptions: () => validateAskUserOptions,
6999
7000
  validateSlackBlocks: () => validateSlackBlocks,
@@ -7165,13 +7166,28 @@ async function resolveInteractive(cfg, input) {
7165
7166
  token: input.token,
7166
7167
  responded_by_user: input.respondedByUser,
7167
7168
  response_url: input.responseUrl,
7168
- original_blocks: input.originalBlocks
7169
+ original_blocks: input.originalBlocks,
7170
+ trigger_id: input.triggerId
7169
7171
  });
7170
7172
  if (!res.ok) {
7171
7173
  const body = await res.text().catch(() => "");
7172
7174
  throw new Error(`resolveInteractive failed (${res.status}): ${body.slice(0, 200)}`);
7173
7175
  }
7174
7176
  }
7177
+ async function submitInteractive(cfg, input) {
7178
+ const res = await apiCall(cfg, "POST", "/host/interactive/submit", {
7179
+ agent_id: cfg.agentId,
7180
+ callback_id: input.callbackId,
7181
+ state_values: input.stateValues,
7182
+ responded_by_user: input.respondedByUser
7183
+ });
7184
+ if (!res.ok) {
7185
+ const body = await res.text().catch(() => "");
7186
+ throw new Error(`submitInteractive failed (${res.status}): ${body.slice(0, 200)}`);
7187
+ }
7188
+ const json = await res.json().catch(() => ({}));
7189
+ return json.response_action === "errors" ? { action: "errors", errors: json.errors ?? {} } : { action: "close" };
7190
+ }
7175
7191
  async function recordSlackDelivery(cfg, input) {
7176
7192
  const res = await apiCall(
7177
7193
  cfg,
@@ -21040,7 +21056,8 @@ async function connectSocketMode() {
21040
21056
  ws.onmessage = async (event) => {
21041
21057
  try {
21042
21058
  const msg = JSON.parse(String(event.data));
21043
- if (msg.envelope_id) {
21059
+ const isViewSubmission = msg.type === "interactive" && msg.payload?.type === "view_submission";
21060
+ if (msg.envelope_id && !isViewSubmission) {
21044
21061
  ws.send(JSON.stringify({ envelope_id: msg.envelope_id }));
21045
21062
  }
21046
21063
  if (msg.type === "slash_commands" && msg.payload?.command) {
@@ -21074,12 +21091,62 @@ async function connectSocketMode() {
21074
21091
  token: decoded.token,
21075
21092
  respondedByUser: msg.payload.user?.id,
21076
21093
  originalBlocks: msg.payload.message?.blocks,
21077
- responseUrl: msg.payload.response_url
21094
+ responseUrl: msg.payload.response_url,
21095
+ // ENG-7170: needed by the resolver's form_request branch to
21096
+ // open the modal via views.open (ignored for other kinds).
21097
+ triggerId: msg.payload.trigger_id
21078
21098
  }
21079
21099
  );
21080
21100
  } catch (err) {
21081
21101
  process.stderr.write(
21082
21102
  `slack-channel(${AGENT_CODE_NAME}): resolveInteractive failed for ${hashId(decoded.callbackId)}: ${err.message}
21103
+ `
21104
+ );
21105
+ }
21106
+ return;
21107
+ }
21108
+ if (msg.type === "interactive" && msg.payload?.type === "view_submission") {
21109
+ const ackEmpty = () => {
21110
+ if (msg.envelope_id) ws.send(JSON.stringify({ envelope_id: msg.envelope_id }));
21111
+ };
21112
+ if (!forwardingHostAvailable()) {
21113
+ ackEmpty();
21114
+ return;
21115
+ }
21116
+ const view = msg.payload.view;
21117
+ const callbackId = view?.callback_id || view?.private_metadata;
21118
+ if (!callbackId) {
21119
+ ackEmpty();
21120
+ return;
21121
+ }
21122
+ try {
21123
+ const runtime = await Promise.resolve().then(() => (init_slack_block_kit_runtime(), slack_block_kit_runtime_exports));
21124
+ const result = await runtime.submitInteractive(
21125
+ {
21126
+ apiHost: AGT_HOST,
21127
+ apiKey: AGT_API_KEY,
21128
+ agentId: AGT_AGENT_ID
21129
+ },
21130
+ {
21131
+ callbackId,
21132
+ stateValues: view?.state?.values,
21133
+ respondedByUser: msg.payload.user?.id
21134
+ }
21135
+ );
21136
+ if (msg.envelope_id) {
21137
+ ws.send(
21138
+ JSON.stringify(
21139
+ result.action === "errors" ? {
21140
+ envelope_id: msg.envelope_id,
21141
+ payload: { response_action: "errors", errors: result.errors }
21142
+ } : { envelope_id: msg.envelope_id }
21143
+ )
21144
+ );
21145
+ }
21146
+ } catch (err) {
21147
+ ackEmpty();
21148
+ process.stderr.write(
21149
+ `slack-channel(${AGENT_CODE_NAME}): submitInteractive failed for ${hashId(callbackId)}: ${err.message}
21083
21150
  `
21084
21151
  );
21085
21152
  }
@@ -6994,6 +6994,7 @@ __export(slack_block_kit_runtime_exports, {
6994
6994
  generateOptionToken: () => generateOptionToken,
6995
6995
  recordSlackDelivery: () => recordSlackDelivery,
6996
6996
  resolveInteractive: () => resolveInteractive,
6997
+ submitInteractive: () => submitInteractive,
6997
6998
  updatePendingInteractionMessageTs: () => updatePendingInteractionMessageTs,
6998
6999
  validateAskUserOptions: () => validateAskUserOptions,
6999
7000
  validateSlackBlocks: () => validateSlackBlocks,
@@ -7165,13 +7166,28 @@ async function resolveInteractive(cfg, input) {
7165
7166
  token: input.token,
7166
7167
  responded_by_user: input.respondedByUser,
7167
7168
  response_url: input.responseUrl,
7168
- original_blocks: input.originalBlocks
7169
+ original_blocks: input.originalBlocks,
7170
+ trigger_id: input.triggerId
7169
7171
  });
7170
7172
  if (!res.ok) {
7171
7173
  const body = await res.text().catch(() => "");
7172
7174
  throw new Error(`resolveInteractive failed (${res.status}): ${body.slice(0, 200)}`);
7173
7175
  }
7174
7176
  }
7177
+ async function submitInteractive(cfg, input) {
7178
+ const res = await apiCall(cfg, "POST", "/host/interactive/submit", {
7179
+ agent_id: cfg.agentId,
7180
+ callback_id: input.callbackId,
7181
+ state_values: input.stateValues,
7182
+ responded_by_user: input.respondedByUser
7183
+ });
7184
+ if (!res.ok) {
7185
+ const body = await res.text().catch(() => "");
7186
+ throw new Error(`submitInteractive failed (${res.status}): ${body.slice(0, 200)}`);
7187
+ }
7188
+ const json = await res.json().catch(() => ({}));
7189
+ return json.response_action === "errors" ? { action: "errors", errors: json.errors ?? {} } : { action: "close" };
7190
+ }
7175
7191
  async function recordSlackDelivery(cfg, input) {
7176
7192
  const res = await apiCall(
7177
7193
  cfg,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.191",
3
+ "version": "0.28.192",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {