@integrity-labs/agt-cli 0.28.979 → 0.28.981
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 +5 -4
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-4K6ZLKIZ.js → chunk-AT643QAO.js} +2 -2
- package/dist/lib/manager-worker.js +2 -2
- package/dist/mcp/index.js +25 -3
- package/dist/mcp/teams-channel.js +60 -0
- package/dist/mcp/whatsapp-channel.js +68 -1
- package/package.json +1 -1
- /package/dist/{chunk-4K6ZLKIZ.js.map → chunk-AT643QAO.js.map} +0 -0
|
@@ -6967,7 +6967,7 @@ function exchangeFailureKind(err) {
|
|
|
6967
6967
|
}
|
|
6968
6968
|
|
|
6969
6969
|
// src/lib/api-client.ts
|
|
6970
|
-
var agtCliVersion = true ? "0.28.
|
|
6970
|
+
var agtCliVersion = true ? "0.28.981" : "dev";
|
|
6971
6971
|
var lastConfigHash = null;
|
|
6972
6972
|
function setConfigHash(hash) {
|
|
6973
6973
|
lastConfigHash = hash && hash.length > 0 ? hash : null;
|
|
@@ -11709,4 +11709,4 @@ export {
|
|
|
11709
11709
|
managerInstallSystemUnitCommand,
|
|
11710
11710
|
managerUninstallSystemUnitCommand
|
|
11711
11711
|
};
|
|
11712
|
-
//# sourceMappingURL=chunk-
|
|
11712
|
+
//# sourceMappingURL=chunk-AT643QAO.js.map
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
safeWriteJsonAtomic,
|
|
64
64
|
setConfigHash,
|
|
65
65
|
tripClass
|
|
66
|
-
} from "../chunk-
|
|
66
|
+
} from "../chunk-AT643QAO.js";
|
|
67
67
|
import {
|
|
68
68
|
getProjectDir as getProjectDir2,
|
|
69
69
|
getReadyTasks,
|
|
@@ -13955,7 +13955,7 @@ var agentRestartTimezoneInputs = /* @__PURE__ */ new Map();
|
|
|
13955
13955
|
var lastVersionCheckAt = 0;
|
|
13956
13956
|
var VERSION_CHECK_INTERVAL_MS = 5 * 60 * 1e3;
|
|
13957
13957
|
var lastResponsivenessProbeAt = 0;
|
|
13958
|
-
var agtCliVersion = true ? "0.28.
|
|
13958
|
+
var agtCliVersion = true ? "0.28.981" : "dev";
|
|
13959
13959
|
function resolveBrewPath(execFileSync2) {
|
|
13960
13960
|
try {
|
|
13961
13961
|
const out = execFileSync2("which", ["brew"], { timeout: 5e3 }).toString().trim();
|
package/dist/mcp/index.js
CHANGED
|
@@ -46674,6 +46674,21 @@ function describeAssignHumanResult(resp, email2) {
|
|
|
46674
46674
|
isError: false
|
|
46675
46675
|
};
|
|
46676
46676
|
}
|
|
46677
|
+
function extractApiErrorMessage(thrownMessage) {
|
|
46678
|
+
const sep3 = thrownMessage.indexOf(": ");
|
|
46679
|
+
if (sep3 === -1) return null;
|
|
46680
|
+
const body = thrownMessage.slice(sep3 + 2).trim();
|
|
46681
|
+
if (body.length === 0) return null;
|
|
46682
|
+
try {
|
|
46683
|
+
const parsed = JSON.parse(body);
|
|
46684
|
+
if (parsed && typeof parsed === "object") {
|
|
46685
|
+
const err = parsed.error;
|
|
46686
|
+
if (typeof err === "string" && err.trim().length > 0) return err.trim();
|
|
46687
|
+
}
|
|
46688
|
+
} catch {
|
|
46689
|
+
}
|
|
46690
|
+
return null;
|
|
46691
|
+
}
|
|
46677
46692
|
|
|
46678
46693
|
// src/artefact-source.ts
|
|
46679
46694
|
var SOURCE_READBACK_MAX_CHUNKS = 128;
|
|
@@ -46816,7 +46831,12 @@ ${mgr}` : head;
|
|
|
46816
46831
|
});
|
|
46817
46832
|
const peopleLines = people.map((p2) => {
|
|
46818
46833
|
const idClause = p2.person_id ? ` [person_id: ${p2.person_id}]` : "";
|
|
46819
|
-
|
|
46834
|
+
const head = ` \u2022 ${p2.name ?? p2.email} <${p2.email}>${slackTag(p2.slack_user_id)}${idClause}`;
|
|
46835
|
+
if (p2.assignable === false) {
|
|
46836
|
+
const via = p2.person_id ? `kanban_move waiting_on_person="${p2.person_id}"` : "kanban_move waiting_on_person (person_id unavailable on this entry)";
|
|
46837
|
+
return `${head} \u2192 CONTACT ONLY (no platform account, so they cannot be given a card): ${via}`;
|
|
46838
|
+
}
|
|
46839
|
+
return `${head} \u2192 assign_kanban_to_human assignee_email="${p2.email}"`;
|
|
46820
46840
|
});
|
|
46821
46841
|
const sections = [];
|
|
46822
46842
|
if (agents.length > 0) {
|
|
@@ -47832,8 +47852,10 @@ server.tool(
|
|
|
47832
47852
|
} catch (err) {
|
|
47833
47853
|
const msg = err instanceof Error ? err.message : String(err);
|
|
47834
47854
|
let text;
|
|
47835
|
-
if (/returned
|
|
47836
|
-
text = `Could not assign:
|
|
47855
|
+
if (/returned 422/.test(msg)) {
|
|
47856
|
+
text = `Could not assign: ${extractApiErrorMessage(msg) ?? msg}`;
|
|
47857
|
+
} else if (/returned 404/.test(msg)) {
|
|
47858
|
+
text = `Could not assign: no teammate found for "${params.assignee_email}" in your team's organization. Check the email address \u2014 or, if you took it from directory_lookup, re-read that entry: it marks who can be assigned and who can only be contacted.`;
|
|
47837
47859
|
} else if (/returned 409/.test(msg)) {
|
|
47838
47860
|
text = `Could not assign: "${params.assignee_email}" matches more than one person. Use a unique email address.`;
|
|
47839
47861
|
} else {
|
|
@@ -15227,6 +15227,59 @@ function teamsInboundId(conversationId, activityId) {
|
|
|
15227
15227
|
return hashInboundId(`${conversationId}|${activityId}`);
|
|
15228
15228
|
}
|
|
15229
15229
|
|
|
15230
|
+
// src/impersonation.ts
|
|
15231
|
+
var ENV_VAR = "AGT_ACT_AS_AGENT_ID";
|
|
15232
|
+
var OVERRIDE_ENV_VAR = "ENABLE_IMPERSONATION_CHANNELS";
|
|
15233
|
+
function isImpersonating() {
|
|
15234
|
+
return impersonatedAgentId() !== null;
|
|
15235
|
+
}
|
|
15236
|
+
function impersonatedAgentId() {
|
|
15237
|
+
const raw = process.env[ENV_VAR];
|
|
15238
|
+
if (typeof raw !== "string") return null;
|
|
15239
|
+
const trimmed = raw.trim();
|
|
15240
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
15241
|
+
}
|
|
15242
|
+
function channelsEnabledOverride() {
|
|
15243
|
+
const raw = process.env[OVERRIDE_ENV_VAR];
|
|
15244
|
+
if (typeof raw !== "string") return false;
|
|
15245
|
+
const trimmed = raw.trim().toLowerCase();
|
|
15246
|
+
return trimmed === "1" || trimmed === "true" || trimmed === "yes" || trimmed === "on";
|
|
15247
|
+
}
|
|
15248
|
+
var IMPERSONATION_REFUSAL_CODE = "CHANNEL.IMPERSONATION_DISABLED";
|
|
15249
|
+
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.";
|
|
15250
|
+
function buildImpersonationRefusal(toolName) {
|
|
15251
|
+
return {
|
|
15252
|
+
content: [
|
|
15253
|
+
{
|
|
15254
|
+
type: "text",
|
|
15255
|
+
text: JSON.stringify({
|
|
15256
|
+
error: {
|
|
15257
|
+
code: IMPERSONATION_REFUSAL_CODE,
|
|
15258
|
+
message: IMPERSONATION_REFUSAL_MESSAGE,
|
|
15259
|
+
tool: toolName
|
|
15260
|
+
}
|
|
15261
|
+
})
|
|
15262
|
+
}
|
|
15263
|
+
],
|
|
15264
|
+
isError: true
|
|
15265
|
+
};
|
|
15266
|
+
}
|
|
15267
|
+
function shouldRefuseImpersonatedEgress(toolName, egressTools) {
|
|
15268
|
+
if (!isImpersonating()) return null;
|
|
15269
|
+
if (channelsEnabledOverride()) return null;
|
|
15270
|
+
if (!egressTools.has(toolName)) return null;
|
|
15271
|
+
return buildImpersonationRefusal(toolName);
|
|
15272
|
+
}
|
|
15273
|
+
|
|
15274
|
+
// src/channel-egress-tools.ts
|
|
15275
|
+
var TEAMS_EGRESS_TOOLS = /* @__PURE__ */ new Set([
|
|
15276
|
+
"teams.reply",
|
|
15277
|
+
"teams.react",
|
|
15278
|
+
"teams.send_structured",
|
|
15279
|
+
"teams.ask_user",
|
|
15280
|
+
"teams.upload_file"
|
|
15281
|
+
]);
|
|
15282
|
+
|
|
15230
15283
|
// src/teams-channel.ts
|
|
15231
15284
|
var APP_ID = process.env.MSTEAMS_APP_ID ?? null;
|
|
15232
15285
|
var CLIENT_SECRET = process.env.MSTEAMS_CLIENT_SECRET ?? null;
|
|
@@ -15907,6 +15960,13 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
15907
15960
|
mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
15908
15961
|
const { name, arguments: args } = req.params;
|
|
15909
15962
|
const a = args ?? {};
|
|
15963
|
+
const impersonationRefusal = shouldRefuseImpersonatedEgress(
|
|
15964
|
+
name,
|
|
15965
|
+
TEAMS_EGRESS_TOOLS
|
|
15966
|
+
);
|
|
15967
|
+
if (impersonationRefusal) {
|
|
15968
|
+
return { ...impersonationRefusal };
|
|
15969
|
+
}
|
|
15910
15970
|
if (name === "teams.reply") return handleReply(a);
|
|
15911
15971
|
if (name === "teams.react") return handleReact(a);
|
|
15912
15972
|
if (name === "teams.read_thread") return handleReadThread(a);
|
|
@@ -155882,6 +155882,56 @@ async function startBaileysSession(opts) {
|
|
|
155882
155882
|
};
|
|
155883
155883
|
}
|
|
155884
155884
|
|
|
155885
|
+
// src/impersonation.ts
|
|
155886
|
+
var ENV_VAR = "AGT_ACT_AS_AGENT_ID";
|
|
155887
|
+
var OVERRIDE_ENV_VAR = "ENABLE_IMPERSONATION_CHANNELS";
|
|
155888
|
+
function isImpersonating() {
|
|
155889
|
+
return impersonatedAgentId() !== null;
|
|
155890
|
+
}
|
|
155891
|
+
function impersonatedAgentId() {
|
|
155892
|
+
const raw = process.env[ENV_VAR];
|
|
155893
|
+
if (typeof raw !== "string") return null;
|
|
155894
|
+
const trimmed = raw.trim();
|
|
155895
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
155896
|
+
}
|
|
155897
|
+
function channelsEnabledOverride() {
|
|
155898
|
+
const raw = process.env[OVERRIDE_ENV_VAR];
|
|
155899
|
+
if (typeof raw !== "string") return false;
|
|
155900
|
+
const trimmed = raw.trim().toLowerCase();
|
|
155901
|
+
return trimmed === "1" || trimmed === "true" || trimmed === "yes" || trimmed === "on";
|
|
155902
|
+
}
|
|
155903
|
+
var IMPERSONATION_REFUSAL_CODE = "CHANNEL.IMPERSONATION_DISABLED";
|
|
155904
|
+
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.";
|
|
155905
|
+
function buildImpersonationRefusal(toolName) {
|
|
155906
|
+
return {
|
|
155907
|
+
content: [
|
|
155908
|
+
{
|
|
155909
|
+
type: "text",
|
|
155910
|
+
text: JSON.stringify({
|
|
155911
|
+
error: {
|
|
155912
|
+
code: IMPERSONATION_REFUSAL_CODE,
|
|
155913
|
+
message: IMPERSONATION_REFUSAL_MESSAGE,
|
|
155914
|
+
tool: toolName
|
|
155915
|
+
}
|
|
155916
|
+
})
|
|
155917
|
+
}
|
|
155918
|
+
],
|
|
155919
|
+
isError: true
|
|
155920
|
+
};
|
|
155921
|
+
}
|
|
155922
|
+
function shouldRefuseImpersonatedEgress(toolName, egressTools) {
|
|
155923
|
+
if (!isImpersonating()) return null;
|
|
155924
|
+
if (channelsEnabledOverride()) return null;
|
|
155925
|
+
if (!egressTools.has(toolName)) return null;
|
|
155926
|
+
return buildImpersonationRefusal(toolName);
|
|
155927
|
+
}
|
|
155928
|
+
|
|
155929
|
+
// src/channel-egress-tools.ts
|
|
155930
|
+
var WHATSAPP_EGRESS_TOOLS = /* @__PURE__ */ new Set([
|
|
155931
|
+
"whatsapp.reply",
|
|
155932
|
+
"whatsapp.send_template"
|
|
155933
|
+
]);
|
|
155934
|
+
|
|
155885
155935
|
// src/whatsapp-channel.ts
|
|
155886
155936
|
var CODE_NAME = process.env["AGT_AGENT_CODE_NAME"] ?? "";
|
|
155887
155937
|
var PENDING_INBOUND_DIR = CODE_NAME ? join4(homedir(), ".augmented", CODE_NAME, "whatsapp-pending-inbound") : null;
|
|
@@ -156091,13 +156141,30 @@ var sendTemplateTool = {
|
|
|
156091
156141
|
};
|
|
156092
156142
|
mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
156093
156143
|
// Templates are a Cloud-API (kapso) concept — not exposed in baileys mode.
|
|
156094
|
-
|
|
156144
|
+
//
|
|
156145
|
+
// ENG-10753 — written as one array with a conditional tail rather than
|
|
156146
|
+
// `IS_BAILEYS ? [replyTool] : [replyTool, sendTemplateTool]`, which is the
|
|
156147
|
+
// same registration and was not readable. The egress test enumerates each
|
|
156148
|
+
// server's tools from this AST to assert every one is classified as egress
|
|
156149
|
+
// or read-only; the ternary form made that walk THROW, and a server whose
|
|
156150
|
+
// registration cannot be read is a server the classification test cannot
|
|
156151
|
+
// cover — which is how this file came to have no impersonation gate while
|
|
156152
|
+
// three of its siblings did. Keep both branches enumerable: a tool behind a
|
|
156153
|
+
// provider flag is still a tool, and still needs gating.
|
|
156154
|
+
tools: [replyTool, ...IS_BAILEYS ? [] : [sendTemplateTool]]
|
|
156095
156155
|
}));
|
|
156096
156156
|
var errResult = (text) => ({ content: [{ type: "text", text }], isError: true });
|
|
156097
156157
|
var stringArg = (a, k) => typeof a[k] === "string" && a[k].length > 0 ? a[k] : null;
|
|
156098
156158
|
mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
156099
156159
|
const { name, arguments: args } = req.params;
|
|
156100
156160
|
const a = args ?? {};
|
|
156161
|
+
const impersonationRefusal = shouldRefuseImpersonatedEgress(
|
|
156162
|
+
name,
|
|
156163
|
+
WHATSAPP_EGRESS_TOOLS
|
|
156164
|
+
);
|
|
156165
|
+
if (impersonationRefusal) {
|
|
156166
|
+
return { ...impersonationRefusal };
|
|
156167
|
+
}
|
|
156101
156168
|
if (name === "whatsapp.reply") return handleReply(a);
|
|
156102
156169
|
if (name === "whatsapp.send_template") return handleSendTemplate(a);
|
|
156103
156170
|
return errResult(`Unknown tool: ${name}`);
|
package/package.json
CHANGED
|
File without changes
|