@integrity-labs/agt-cli 0.27.7-test.5 → 0.27.7-test.7
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/assets/impersonate-statusline.sh +88 -0
- package/dist/bin/agt.js +246 -85
- package/dist/bin/agt.js.map +1 -1
- package/dist/{chunk-WCY7QM3R.js → chunk-2G35ES7G.js} +1 -1
- package/dist/lib/manager-worker.js +9 -9
- package/dist/lib/manager-worker.js.map +1 -1
- package/dist/mcp/direct-chat-channel.js +47 -0
- package/dist/mcp/index.js +100 -81
- package/dist/mcp/slack-channel.js +50 -0
- package/dist/mcp/telegram-channel.js +50 -1
- package/package.json +3 -2
- /package/dist/{chunk-WCY7QM3R.js.map → chunk-2G35ES7G.js.map} +0 -0
|
@@ -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,
|
|
@@ -16519,7 +16565,7 @@ var mcp = new Server(
|
|
|
16519
16565
|
"CRITICAL: every response to a Telegram <channel> tag MUST go through telegram.reply with the chat_id from the tag. Text in your session WITHOUT a telegram.reply call never reaches the user.",
|
|
16520
16566
|
'Messages from Telegram arrive as <channel source="telegram" chat_id="..." user="..." user_name="..." message_id="...">. Pass reply_to_message_id from the tag so the response lands as a quote-reply in busy chats.',
|
|
16521
16567
|
"Inbound attachments: <channel> `files` is a JSON-serialised array \u2014 JSON.parse it. If an entry has `path`, the image is already downloaded \u2014 Read it directly, do NOT call telegram.download_attachment. Use that tool only for entries with `file_id` but NO `path` (PDF, docx, voice, audio, video, animations): pass file_id + chat_id verbatim, then Read the returned path. Single-image messages also get a top-level `image_path`. Caption arrives as channel content. Don't surface internal file-handling errors that don't affect the answer.",
|
|
16522
|
-
'For work >30s follow CLAUDE.md kanban flow:
|
|
16568
|
+
'For work >30s follow CLAUDE.md kanban flow: kanban_add \u2192 reply "On it \u2014 tracking here: <kanban URL>" \u2192 move to in_progress \u2192 do the work \u2192 reply with the result. Simple lookups skip kanban but still reply.',
|
|
16523
16569
|
"Address users by user_name; user is the numeric Telegram ID. Resolve ambiguous times against your own Timezone from CLAUDE.md \u2014 do not ask.",
|
|
16524
16570
|
"Reaction taxonomy (use telegram.react sparingly \u2014 prefer telegram.reply): \u{1F440} = ack (already auto-added on inbound, do not duplicate); \u{1F44D} or \u{1F389} = success. NEVER react to signal failure. On failure, telegram.reply with one sentence explaining what went wrong. Free-tier emoji: \u{1F44D} \u{1F44E} \u2764 \u{1F525} \u{1F389} \u{1F914} \u{1F92F} \u{1F64F} \u{1F44C} \u{1F440} \u{1F4AF} \u270D \u{1FAE1} \u{1F192} \u{1F973} \u{1F494}."
|
|
16525
16571
|
].join(" ")
|
|
@@ -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.7-test.
|
|
3
|
+
"version": "0.27.7-test.7",
|
|
4
4
|
"description": "Augmented Team CLI — agent provisioning and management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "tsup && npm run build:mcp-assets",
|
|
25
|
+
"build": "tsup && npm run build:mcp-assets && npm run build:cli-assets",
|
|
26
26
|
"build:mcp-assets": "mkdir -p dist/mcp && cp ../../packages/mcp/dist/index.js dist/mcp/index.js && cp ../../packages/mcp/dist/slack-channel.js dist/mcp/slack-channel.js && cp ../../packages/mcp/dist/direct-chat-channel.js dist/mcp/direct-chat-channel.js && cp ../../packages/mcp/dist/telegram-channel.js dist/mcp/telegram-channel.js",
|
|
27
|
+
"build:cli-assets": "mkdir -p dist/assets && cp assets/impersonate-statusline.sh dist/assets/impersonate-statusline.sh && chmod +x dist/assets/impersonate-statusline.sh",
|
|
27
28
|
"dev": "tsx watch src/bin/agt.ts",
|
|
28
29
|
"test": "vitest run",
|
|
29
30
|
"typecheck": "tsc --noEmit",
|
|
File without changes
|