@integrity-labs/agt-cli 0.27.8 → 0.27.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.
@@ -15,7 +15,7 @@ import {
15
15
  provisionOrientHook,
16
16
  provisionStopHook,
17
17
  requireHost
18
- } from "../chunk-IB655E5U.js";
18
+ } from "../chunk-AQVJKJBD.js";
19
19
  import {
20
20
  getProjectDir as getProjectDir2,
21
21
  getReadyTasks,
@@ -3166,7 +3166,7 @@ var cachedFrameworkVersion = null;
3166
3166
  var lastVersionCheckAt = 0;
3167
3167
  var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
3168
3168
  var lastResponsivenessProbeAt = 0;
3169
- var agtCliVersion = true ? "0.27.8" : "dev";
3169
+ var agtCliVersion = true ? "0.27.9" : "dev";
3170
3170
  function resolveBrewPath(execFileSync4) {
3171
3171
  try {
3172
3172
  const out = execFileSync4("which", ["brew"], { timeout: 5e3 }).toString().trim();
@@ -14368,6 +14368,50 @@ function isMode(value) {
14368
14368
  return value === "thinking" || value === "working" || value === "waiting";
14369
14369
  }
14370
14370
 
14371
+ // src/impersonation.ts
14372
+ var ENV_VAR = "AGT_ACT_AS_AGENT_ID";
14373
+ var OVERRIDE_ENV_VAR = "ENABLE_IMPERSONATION_CHANNELS";
14374
+ function isImpersonating() {
14375
+ return impersonatedAgentId() !== null;
14376
+ }
14377
+ function impersonatedAgentId() {
14378
+ const raw = process.env[ENV_VAR];
14379
+ if (typeof raw !== "string") return null;
14380
+ const trimmed = raw.trim();
14381
+ return trimmed.length > 0 ? trimmed : null;
14382
+ }
14383
+ function channelsEnabledOverride() {
14384
+ const raw = process.env[OVERRIDE_ENV_VAR];
14385
+ if (typeof raw !== "string") return false;
14386
+ const trimmed = raw.trim().toLowerCase();
14387
+ return trimmed === "1" || trimmed === "true" || trimmed === "yes" || trimmed === "on";
14388
+ }
14389
+ var IMPERSONATION_REFUSAL_CODE = "CHANNEL.IMPERSONATION_DISABLED";
14390
+ var IMPERSONATION_REFUSAL_MESSAGE = "Posting as an agent under impersonation is disabled in v0 \u2014 quit impersonation with `agt impersonate exit` to send as yourself.";
14391
+ function buildImpersonationRefusal(toolName) {
14392
+ return {
14393
+ content: [
14394
+ {
14395
+ type: "text",
14396
+ text: JSON.stringify({
14397
+ error: {
14398
+ code: IMPERSONATION_REFUSAL_CODE,
14399
+ message: IMPERSONATION_REFUSAL_MESSAGE,
14400
+ tool: toolName
14401
+ }
14402
+ })
14403
+ }
14404
+ ],
14405
+ isError: true
14406
+ };
14407
+ }
14408
+
14409
+ // src/channel-egress-tools.ts
14410
+ var DIRECT_CHAT_EGRESS_TOOLS = /* @__PURE__ */ new Set([
14411
+ "direct_chat.reply",
14412
+ "channel_request_input"
14413
+ ]);
14414
+
14371
14415
  // src/mcp-spawn-lock.ts
14372
14416
  import {
14373
14417
  existsSync,
@@ -14597,6 +14641,9 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
14597
14641
  }));
14598
14642
  mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
14599
14643
  const { name, arguments: args } = req.params;
14644
+ if (isImpersonating() && !channelsEnabledOverride() && DIRECT_CHAT_EGRESS_TOOLS.has(name)) {
14645
+ return buildImpersonationRefusal(name);
14646
+ }
14600
14647
  const progressResult = await progressRegistry.handle(name, args ?? {});
14601
14648
  if (progressResult !== void 0) return progressResult;
14602
14649
  if (name === "channel_request_input") {
@@ -14813,6 +14813,53 @@ function isMode(value) {
14813
14813
  return value === "thinking" || value === "working" || value === "waiting";
14814
14814
  }
14815
14815
 
14816
+ // src/impersonation.ts
14817
+ var ENV_VAR = "AGT_ACT_AS_AGENT_ID";
14818
+ var OVERRIDE_ENV_VAR = "ENABLE_IMPERSONATION_CHANNELS";
14819
+ function isImpersonating() {
14820
+ return impersonatedAgentId() !== null;
14821
+ }
14822
+ function impersonatedAgentId() {
14823
+ const raw = process.env[ENV_VAR];
14824
+ if (typeof raw !== "string") return null;
14825
+ const trimmed = raw.trim();
14826
+ return trimmed.length > 0 ? trimmed : null;
14827
+ }
14828
+ function channelsEnabledOverride() {
14829
+ const raw = process.env[OVERRIDE_ENV_VAR];
14830
+ if (typeof raw !== "string") return false;
14831
+ const trimmed = raw.trim().toLowerCase();
14832
+ return trimmed === "1" || trimmed === "true" || trimmed === "yes" || trimmed === "on";
14833
+ }
14834
+ var IMPERSONATION_REFUSAL_CODE = "CHANNEL.IMPERSONATION_DISABLED";
14835
+ var IMPERSONATION_REFUSAL_MESSAGE = "Posting as an agent under impersonation is disabled in v0 \u2014 quit impersonation with `agt impersonate exit` to send as yourself.";
14836
+ function buildImpersonationRefusal(toolName) {
14837
+ return {
14838
+ content: [
14839
+ {
14840
+ type: "text",
14841
+ text: JSON.stringify({
14842
+ error: {
14843
+ code: IMPERSONATION_REFUSAL_CODE,
14844
+ message: IMPERSONATION_REFUSAL_MESSAGE,
14845
+ tool: toolName
14846
+ }
14847
+ })
14848
+ }
14849
+ ],
14850
+ isError: true
14851
+ };
14852
+ }
14853
+
14854
+ // src/channel-egress-tools.ts
14855
+ var SLACK_EGRESS_TOOLS = /* @__PURE__ */ new Set([
14856
+ "slack.reply",
14857
+ "slack.react",
14858
+ "slack.send_structured",
14859
+ "slack.ask_user",
14860
+ "slack.upload_file"
14861
+ ]);
14862
+
14816
14863
  // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
14817
14864
  import process2 from "process";
14818
14865
 
@@ -16909,6 +16956,9 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
16909
16956
  }));
16910
16957
  mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
16911
16958
  const { name, arguments: args } = req.params;
16959
+ if (isImpersonating() && !channelsEnabledOverride() && SLACK_EGRESS_TOOLS.has(name)) {
16960
+ return buildImpersonationRefusal(name);
16961
+ }
16912
16962
  const progressResult = await progressRegistry.handle(name, args ?? {});
16913
16963
  if (progressResult !== void 0) return progressResult;
16914
16964
  if (name === "slack.reply") {
@@ -15810,6 +15810,52 @@ function createTelegramProgressFlush(opts) {
15810
15810
  };
15811
15811
  }
15812
15812
 
15813
+ // src/impersonation.ts
15814
+ var ENV_VAR = "AGT_ACT_AS_AGENT_ID";
15815
+ var OVERRIDE_ENV_VAR = "ENABLE_IMPERSONATION_CHANNELS";
15816
+ function isImpersonating() {
15817
+ return impersonatedAgentId() !== null;
15818
+ }
15819
+ function impersonatedAgentId() {
15820
+ const raw = process.env[ENV_VAR];
15821
+ if (typeof raw !== "string") return null;
15822
+ const trimmed = raw.trim();
15823
+ return trimmed.length > 0 ? trimmed : null;
15824
+ }
15825
+ function channelsEnabledOverride() {
15826
+ const raw = process.env[OVERRIDE_ENV_VAR];
15827
+ if (typeof raw !== "string") return false;
15828
+ const trimmed = raw.trim().toLowerCase();
15829
+ return trimmed === "1" || trimmed === "true" || trimmed === "yes" || trimmed === "on";
15830
+ }
15831
+ var IMPERSONATION_REFUSAL_CODE = "CHANNEL.IMPERSONATION_DISABLED";
15832
+ var IMPERSONATION_REFUSAL_MESSAGE = "Posting as an agent under impersonation is disabled in v0 \u2014 quit impersonation with `agt impersonate exit` to send as yourself.";
15833
+ function buildImpersonationRefusal(toolName) {
15834
+ return {
15835
+ content: [
15836
+ {
15837
+ type: "text",
15838
+ text: JSON.stringify({
15839
+ error: {
15840
+ code: IMPERSONATION_REFUSAL_CODE,
15841
+ message: IMPERSONATION_REFUSAL_MESSAGE,
15842
+ tool: toolName
15843
+ }
15844
+ })
15845
+ }
15846
+ ],
15847
+ isError: true
15848
+ };
15849
+ }
15850
+
15851
+ // src/channel-egress-tools.ts
15852
+ var TELEGRAM_EGRESS_TOOLS = /* @__PURE__ */ new Set([
15853
+ "telegram.reply",
15854
+ "telegram.send_message",
15855
+ "telegram.react",
15856
+ "channel_request_input"
15857
+ ]);
15858
+
15813
15859
  // src/mcp-spawn-lock.ts
15814
15860
  import {
15815
15861
  existsSync,
@@ -16676,6 +16722,9 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
16676
16722
  }));
16677
16723
  mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
16678
16724
  const { name, arguments: args } = req.params;
16725
+ if (isImpersonating() && !channelsEnabledOverride() && TELEGRAM_EGRESS_TOOLS.has(name)) {
16726
+ return buildImpersonationRefusal(name);
16727
+ }
16679
16728
  const progressResult = await progressRegistry.handle(name, args ?? {});
16680
16729
  if (progressResult !== void 0) return progressResult;
16681
16730
  if (name === "channel_request_input") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.27.8",
3
+ "version": "0.27.9",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {