@integrity-labs/agt-cli 0.28.324 → 0.28.325

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.
@@ -14549,6 +14549,11 @@ function decideModeForward(evt, policy) {
14549
14549
  const label = extractAugmentedSlackLabel(evt);
14550
14550
  if (!label)
14551
14551
  return { forward: false, reason: "sender_policy" };
14552
+ if (policy.registeredAgentSlackUserIds !== void 0) {
14553
+ if (typeof evt.user !== "string" || !policy.registeredAgentSlackUserIds.has(evt.user)) {
14554
+ return { forward: false, reason: "sender_policy" };
14555
+ }
14556
+ }
14552
14557
  if (policy.mode === "team_agents_only" || policy.mode === "manager_only" || policy.mode === "team_only") {
14553
14558
  if (!policy.teamId || label.teamId !== policy.teamId) {
14554
14559
  return { forward: false, reason: "sender_policy" };
@@ -17726,7 +17731,8 @@ function parsePeersEnv(raw, gateRaw) {
17726
17731
  return [];
17727
17732
  const gateMap = /* @__PURE__ */ new Map();
17728
17733
  let gateConfigInvalid = false;
17729
- if (gateRaw && gateRaw.trim().length > 0) {
17734
+ const gatePresent = !!(gateRaw && gateRaw.trim().length > 0);
17735
+ if (gatePresent) {
17730
17736
  try {
17731
17737
  const gateParsed = JSON.parse(gateRaw);
17732
17738
  if (!gateParsed || typeof gateParsed !== "object" || Array.isArray(gateParsed)) {
@@ -17769,6 +17775,8 @@ function parsePeersEnv(raw, gateRaw) {
17769
17775
  peer.gate_path = null;
17770
17776
  } else if (gateMap.has(e.bot_user_id)) {
17771
17777
  peer.gate_path = gateMap.get(e.bot_user_id) ?? null;
17778
+ } else if (gatePresent) {
17779
+ peer.gate_path = null;
17772
17780
  }
17773
17781
  out.push(peer);
17774
17782
  }
@@ -18343,13 +18351,21 @@ var SLACK_SENDER_POLICY = (() => {
18343
18351
  );
18344
18352
  }
18345
18353
  const internalOnlyFields = internalOnly ? { internalOnly: true, homeTeamId } : {};
18346
- if (raw === "all") return { mode: "all", ...internalOnlyFields };
18347
- if (raw === "agents_only") return { mode: "agents_only", ...internalOnlyFields };
18354
+ const slackPeersRaw = process.env.SLACK_PEERS;
18355
+ const registryFields = slackPeersRaw && slackPeersRaw.trim().length > 0 ? {
18356
+ registeredAgentSlackUserIds: new Set(
18357
+ parsePeersEnv(slackPeersRaw, process.env.SLACK_PEERS_GATE).map(
18358
+ (p) => p.bot_user_id
18359
+ )
18360
+ )
18361
+ } : {};
18362
+ if (raw === "all") return { mode: "all", ...internalOnlyFields, ...registryFields };
18363
+ if (raw === "agents_only") return { mode: "agents_only", ...internalOnlyFields, ...registryFields };
18348
18364
  if (raw === "team_agents_only") {
18349
18365
  if (!AGT_TEAM_ID) {
18350
18366
  throw new Error("SLACK_SENDER_POLICY=team_agents_only requires AGT_TEAM_ID");
18351
18367
  }
18352
- return { mode: "team_agents_only", teamId: AGT_TEAM_ID, ...internalOnlyFields };
18368
+ return { mode: "team_agents_only", teamId: AGT_TEAM_ID, ...internalOnlyFields, ...registryFields };
18353
18369
  }
18354
18370
  if (raw === "team_only") {
18355
18371
  if (!AGT_TEAM_ID) {
@@ -18361,7 +18377,8 @@ var SLACK_SENDER_POLICY = (() => {
18361
18377
  mode: "team_only",
18362
18378
  teamId: AGT_TEAM_ID,
18363
18379
  teamPrincipalSlackUserIds,
18364
- ...internalOnlyFields
18380
+ ...internalOnlyFields,
18381
+ ...registryFields
18365
18382
  };
18366
18383
  }
18367
18384
  if (raw === "manager_only") {
@@ -18374,7 +18391,7 @@ var SLACK_SENDER_POLICY = (() => {
18374
18391
  "SLACK_SENDER_POLICY=manager_only requires SLACK_SENDER_POLICY_PRINCIPAL_ID. Set agent.reports_to_person with a slack_user_id in contact_preferences and re-run /host/refresh."
18375
18392
  );
18376
18393
  }
18377
- return { mode: "manager_only", teamId: AGT_TEAM_ID, principalSlackUserId, ...internalOnlyFields };
18394
+ return { mode: "manager_only", teamId: AGT_TEAM_ID, principalSlackUserId, ...internalOnlyFields, ...registryFields };
18378
18395
  }
18379
18396
  throw new Error(`Invalid SLACK_SENDER_POLICY=${JSON.stringify(process.env.SLACK_SENDER_POLICY)}`);
18380
18397
  })();
@@ -14796,7 +14796,13 @@ function decideTeamsActivityForward(input) {
14796
14796
  }
14797
14797
  if (allowedTeamIds.size > 0) {
14798
14798
  const teamId = activity.channelData?.team?.id;
14799
- if (teamId && !allowedTeamIds.has(teamId)) {
14799
+ const convType = activity.conversation?.conversationType;
14800
+ const isDirect = convType === "personal" || convType === "groupChat";
14801
+ if (isDirect) {
14802
+ if (teamId && !allowedTeamIds.has(teamId)) {
14803
+ return { forward: false, reason: "team_not_allowed" };
14804
+ }
14805
+ } else if (!teamId || !allowedTeamIds.has(teamId)) {
14800
14806
  return { forward: false, reason: "team_not_allowed" };
14801
14807
  }
14802
14808
  }
@@ -14922,7 +14922,8 @@ function parsePeersEnv(raw, gateRaw) {
14922
14922
  return [];
14923
14923
  const gateMap = /* @__PURE__ */ new Map();
14924
14924
  let gateConfigInvalid = false;
14925
- if (gateRaw && gateRaw.trim().length > 0) {
14925
+ const gatePresent = !!(gateRaw && gateRaw.trim().length > 0);
14926
+ if (gatePresent) {
14926
14927
  try {
14927
14928
  const gateParsed = JSON.parse(gateRaw);
14928
14929
  if (!gateParsed || typeof gateParsed !== "object" || Array.isArray(gateParsed)) {
@@ -14963,6 +14964,8 @@ function parsePeersEnv(raw, gateRaw) {
14963
14964
  const key2 = String(e.bot_id);
14964
14965
  if (gateMap.has(key2)) {
14965
14966
  peer.gate_path = gateMap.get(key2) ?? null;
14967
+ } else if (gatePresent) {
14968
+ peer.gate_path = null;
14966
14969
  }
14967
14970
  }
14968
14971
  out.push(peer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integrity-labs/agt-cli",
3
- "version": "0.28.324",
3
+ "version": "0.28.325",
4
4
  "description": "Augmented Team CLI — agent provisioning and management",
5
5
  "type": "module",
6
6
  "engines": {