@integrity-labs/cloud-broker 0.4.3 → 0.4.5
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/index.js +34 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20996,6 +20996,7 @@ var BrokerClient = class {
|
|
|
20996
20996
|
host;
|
|
20997
20997
|
agentId;
|
|
20998
20998
|
runId;
|
|
20999
|
+
defaultSourceContext;
|
|
20999
21000
|
apiKey;
|
|
21000
21001
|
fetchImpl;
|
|
21001
21002
|
token;
|
|
@@ -21005,6 +21006,7 @@ var BrokerClient = class {
|
|
|
21005
21006
|
this.host = config2.host.replace(/\/+$/, "");
|
|
21006
21007
|
this.agentId = config2.agentId;
|
|
21007
21008
|
this.runId = config2.runId;
|
|
21009
|
+
this.defaultSourceContext = config2.defaultSourceContext;
|
|
21008
21010
|
this.apiKey = config2.apiKey;
|
|
21009
21011
|
this.fetchImpl = config2.fetchImpl ?? fetch;
|
|
21010
21012
|
this.token = config2.initialToken ?? "";
|
|
@@ -21120,7 +21122,13 @@ var BrokerClient = class {
|
|
|
21120
21122
|
if (!runId) {
|
|
21121
21123
|
throw makeBrokerError(400, "BrokerClient.requestAccess requires run_id (pass it in args, or set runId on BrokerClientConfig)");
|
|
21122
21124
|
}
|
|
21123
|
-
const
|
|
21125
|
+
const sourceContext = args.source_context ?? this.defaultSourceContext;
|
|
21126
|
+
const body = {
|
|
21127
|
+
...args,
|
|
21128
|
+
agent_id: agentId,
|
|
21129
|
+
run_id: runId,
|
|
21130
|
+
source_context: sourceContext
|
|
21131
|
+
};
|
|
21124
21132
|
return this.request("POST", "/aws/grants", { body });
|
|
21125
21133
|
}
|
|
21126
21134
|
pollGrant(args) {
|
|
@@ -21150,6 +21158,17 @@ var previewRequestSchema = external_exports.object({
|
|
|
21150
21158
|
regions: regionListSchema,
|
|
21151
21159
|
ttl_seconds: ttlSecondsSchema
|
|
21152
21160
|
});
|
|
21161
|
+
var sourceContextSchema = external_exports.object({
|
|
21162
|
+
channel_type: external_exports.string().min(1).max(64).describe(
|
|
21163
|
+
'Inbound channel type (e.g. "slack", "telegram", "direct-chat"). Defaults from AGT_INBOUND_CHANNEL_TYPE if set.'
|
|
21164
|
+
),
|
|
21165
|
+
channel_id: external_exports.string().min(1).max(256).describe(
|
|
21166
|
+
"Inbound channel/conversation id (Slack channel id, Telegram chat id, etc). Defaults from AGT_INBOUND_CHANNEL_ID."
|
|
21167
|
+
),
|
|
21168
|
+
thread_ts: external_exports.string().min(1).max(256).optional().describe(
|
|
21169
|
+
"Optional thread/parent identifier within channel_id (e.g. Slack thread_ts). Defaults from AGT_INBOUND_CHANNEL_THREAD_TS."
|
|
21170
|
+
)
|
|
21171
|
+
});
|
|
21153
21172
|
var requestAccessSchema = external_exports.object({
|
|
21154
21173
|
// ENG-4746: agent_id and run_id are optional. The MCP server fills them
|
|
21155
21174
|
// from AGT_AGENT_ID / AGT_RUN_ID env at provision time, so the agent
|
|
@@ -21169,6 +21188,9 @@ var requestAccessSchema = external_exports.object({
|
|
|
21169
21188
|
task_id: external_exports.string().min(1).optional().describe("Optional Augmented task identifier (e.g. kanban:task-7842)."),
|
|
21170
21189
|
reason: external_exports.string().min(1).max(500).optional().describe(
|
|
21171
21190
|
"One-sentence rationale shown to a human approver. Must be safe to render \u2014 never contains credentials."
|
|
21191
|
+
),
|
|
21192
|
+
source_context: sourceContextSchema.optional().describe(
|
|
21193
|
+
"Optional. Inbound conversation that triggered this request. The MCP server fills it from AGT_INBOUND_CHANNEL_* env vars when present. Persisted on the grant so the resolution notification can tell the agent to thread the answer back to the original conversation."
|
|
21172
21194
|
)
|
|
21173
21195
|
});
|
|
21174
21196
|
var pollGrantSchema = external_exports.object({
|
|
@@ -21200,6 +21222,14 @@ if (process.env.AGT_TEAM_SLUG) {
|
|
|
21200
21222
|
"cloud-broker: AGT_TEAM_SLUG is set but no longer required (the API derives team from agent_id). Safe to remove from .mcp.json env block."
|
|
21201
21223
|
);
|
|
21202
21224
|
}
|
|
21225
|
+
var AGT_INBOUND_CHANNEL_TYPE = process.env.AGT_INBOUND_CHANNEL_TYPE ?? "";
|
|
21226
|
+
var AGT_INBOUND_CHANNEL_ID = process.env.AGT_INBOUND_CHANNEL_ID ?? "";
|
|
21227
|
+
var AGT_INBOUND_CHANNEL_THREAD_TS = process.env.AGT_INBOUND_CHANNEL_THREAD_TS ?? "";
|
|
21228
|
+
var defaultSourceContext = AGT_INBOUND_CHANNEL_TYPE && AGT_INBOUND_CHANNEL_ID ? {
|
|
21229
|
+
channel_type: AGT_INBOUND_CHANNEL_TYPE,
|
|
21230
|
+
channel_id: AGT_INBOUND_CHANNEL_ID,
|
|
21231
|
+
thread_ts: AGT_INBOUND_CHANNEL_THREAD_TS || void 0
|
|
21232
|
+
} : void 0;
|
|
21203
21233
|
var broker = new BrokerClient({
|
|
21204
21234
|
host: AGT_HOST,
|
|
21205
21235
|
agentId: AGT_AGENT_ID,
|
|
@@ -21207,6 +21237,7 @@ var broker = new BrokerClient({
|
|
|
21207
21237
|
// Empty string is treated as absent — the broker client only fills runId
|
|
21208
21238
|
// on requestAccess if a non-empty value is provided.
|
|
21209
21239
|
runId: AGT_RUN_ID || void 0,
|
|
21240
|
+
defaultSourceContext,
|
|
21210
21241
|
initialToken: AGT_TOKEN || void 0,
|
|
21211
21242
|
apiKey: AGT_API_KEY || void 0
|
|
21212
21243
|
});
|
|
@@ -21249,7 +21280,7 @@ server.tool(
|
|
|
21249
21280
|
);
|
|
21250
21281
|
server.tool(
|
|
21251
21282
|
"request_access",
|
|
21252
|
-
|
|
21283
|
+
`Request scoped, TTL-bounded AWS credentials for the current task. agent_id and run_id are optional \u2014 the broker fills them from the host MCP env (AGT_AGENT_ID / AGT_RUN_ID). source_context is also optional \u2014 the broker fills channel_type/channel_id/thread_ts from AGT_INBOUND_CHANNEL_* env when the host runtime exposes them, so the resolution notification can tell you to thread the answer back to the original conversation. Pass source_context explicitly only when you know it differs from the inbound message you are currently handling (rare). Returns { grant_id, status, secret_ref?, expires_at?, denial_reason?, notification_status?, notification_failure_reason? }. status="active" means credentials are ready, use them now. status="denied" means the request was rejected (denial_reason explains). status="pending" means approval is still outstanding \u2014 DO NOT poll. The broker pushes the resolution to you via direct-chat the moment a human approves or denies, so save the grant_id, return control, and resume when the inbound message arrives. The notification body will include the source channel/thread to reply in \u2014 complete the user's task there, not in direct-chat. Only check notification_status if you need to flag a setup issue to the user: "sent" means a human was paged; "failed" or "not_attempted" means no human was paged (typically channel_not_found because the approval-bot is not a member of the configured channel) \u2014 quote grant_id + notification_failure_reason and recommend manual escalation. poll_grant exists as an escape hatch for explicit re-checks but the autonomous flow does not need it.`,
|
|
21253
21284
|
requestAccessShape,
|
|
21254
21285
|
async (args) => {
|
|
21255
21286
|
try {
|
|
@@ -21263,7 +21294,7 @@ server.tool(
|
|
|
21263
21294
|
);
|
|
21264
21295
|
server.tool(
|
|
21265
21296
|
"poll_grant",
|
|
21266
|
-
|
|
21297
|
+
"Single-shot status check for a grant. The broker pushes resolution updates to you via direct-chat automatically \u2014 you do NOT need to poll in the normal flow. Use this only as an escape hatch: explicit re-check after a notification, or if you suspect a notification was lost (e.g. you got `request_access` returning pending more than ~5 minutes ago and have heard nothing). Returns { grant_id, status, secret_ref?, expires_at?, denial_reason? }.",
|
|
21267
21298
|
pollGrantShape,
|
|
21268
21299
|
async (args) => {
|
|
21269
21300
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@integrity-labs/cloud-broker",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Cloud Access Broker — MCP server that mints scoped, TTL-bounded cloud credentials per agent task. v1 ships AWS support (request_access, poll_grant, release_access, describe_scope, preview_request — STS AssumeRole under the hood); GCP, Azure, and Cloudflare land alongside in the same package as the broker grows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|