@botbuddy/cli 1.6.4 → 1.7.0
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/package.json +1 -1
- package/src/wait-profile.mjs +4 -0
- package/src/wait.mjs +24 -0
- package/src/botbuddy-release-repair.json +0 -1
package/package.json
CHANGED
package/src/wait-profile.mjs
CHANGED
|
@@ -79,6 +79,10 @@ export function withPrincipalReceipt(receipt, profile, registration = {}) {
|
|
|
79
79
|
profile: profile.name,
|
|
80
80
|
tenant_id: registration.sessionTenant ?? profile.tenant,
|
|
81
81
|
agent_id: registration.agentId ?? null,
|
|
82
|
+
// BOT-1467: the arming session's agent, when the relay attributed the wait
|
|
83
|
+
// to it instead of the profile agent (null for an ordinary profile wait).
|
|
84
|
+
session_id: registration.sessionId ?? null,
|
|
85
|
+
session_agent_id: registration.sessionAgentId ?? null,
|
|
82
86
|
},
|
|
83
87
|
};
|
|
84
88
|
}
|
package/src/wait.mjs
CHANGED
|
@@ -93,6 +93,7 @@ OPTIONS
|
|
|
93
93
|
--heartbeat keep this agent session alive while waiting (so it is not reaped)
|
|
94
94
|
--url <base> relay base URL (default $BOTBUDDY_RELAY_URL or https://api.bot-buddy.ai/functions/v1)
|
|
95
95
|
--profile <name> tenant-bound machine profile (normally read from .botbuddy-agent.json)
|
|
96
|
+
--session-id <uuid> attribute this wait to the arming session (the work-graph session id from register_agent); default $BOTBUDDY_SESSION_ID
|
|
96
97
|
--token <key> explicit agent key override; otherwise the profile-specific env is used
|
|
97
98
|
--help show this help
|
|
98
99
|
|
|
@@ -133,6 +134,9 @@ function parseArgv(argv) {
|
|
|
133
134
|
url: process.env.BOTBUDDY_RELAY_URL || "https://api.bot-buddy.ai/functions/v1",
|
|
134
135
|
token: null,
|
|
135
136
|
profile: null,
|
|
137
|
+
// BOT-1467: attribute this wait to the arming session's agent (the id from
|
|
138
|
+
// register_agent) instead of the tenant-bound profile agent. Env fallback.
|
|
139
|
+
sessionId: process.env.BOTBUDDY_SESSION_ID || null,
|
|
136
140
|
help: false,
|
|
137
141
|
};
|
|
138
142
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -155,6 +159,7 @@ function parseArgv(argv) {
|
|
|
155
159
|
else if (a === "--url") opts.url = optionValue();
|
|
156
160
|
else if (a === "--token") opts.token = optionValue();
|
|
157
161
|
else if (a === "--profile") opts.profile = optionValue();
|
|
162
|
+
else if (a === "--session-id") opts.sessionId = optionValue();
|
|
158
163
|
else if (a.startsWith("--")) opts.unknown = a;
|
|
159
164
|
else opts.conditions.push(a);
|
|
160
165
|
}
|
|
@@ -176,6 +181,9 @@ async function registerWait(opts, conditions, deadlineIso) {
|
|
|
176
181
|
action: "register",
|
|
177
182
|
profile: opts.agentProfile.name,
|
|
178
183
|
expected_tenant: opts.agentProfile.tenant,
|
|
184
|
+
// BOT-1467: name the arming work-graph session so the relay resolves and attributes
|
|
185
|
+
// the wait to its agent (validated same-owner) instead of the profile agent.
|
|
186
|
+
...(opts.sessionId ? { session_id: opts.sessionId } : {}),
|
|
179
187
|
client_version: VERSION,
|
|
180
188
|
wait_protocol_version: WAIT_PROTOCOL_VERSION,
|
|
181
189
|
conditions,
|
|
@@ -224,6 +232,11 @@ async function registerWait(opts, conditions, deadlineIso) {
|
|
|
224
232
|
// can't bind to one workspace (ci / pr-review / bare tenant-primary event). A hard
|
|
225
233
|
// stop — arming it untracked would only ever park to timeout.
|
|
226
234
|
"tenant_ambiguous",
|
|
235
|
+
// BOT-1467: a caller-actionable session-attribution rejection — a malformed
|
|
236
|
+
// --session-id, or one passed without a profile. Arming it untracked would
|
|
237
|
+
// only ever park to timeout, so it's a hard stop, not the live-only fallback.
|
|
238
|
+
"invalid_session_agent",
|
|
239
|
+
"session_agent_requires_profile",
|
|
227
240
|
]);
|
|
228
241
|
if (INVALID_CONDITION_CODES.has(body.error)) {
|
|
229
242
|
const err = new Error(body.detail || body.error);
|
|
@@ -293,6 +306,10 @@ async function registerWait(opts, conditions, deadlineIso) {
|
|
|
293
306
|
// new relay (the deploy-skew case, acceptable because waits are short-lived).
|
|
294
307
|
sessionTenant: body.session_tenant ?? null,
|
|
295
308
|
agentId: body.agent_id ?? null,
|
|
309
|
+
// BOT-1467: the session agent the relay attributed the wait to, if any (it
|
|
310
|
+
// echoes session_agent_id only when it overrode the profile agent).
|
|
311
|
+
sessionId: body.session_id ?? null,
|
|
312
|
+
sessionAgentId: body.session_agent_id ?? null,
|
|
296
313
|
};
|
|
297
314
|
}
|
|
298
315
|
|
|
@@ -565,6 +582,9 @@ export async function runWait(argv) {
|
|
|
565
582
|
// pre-BOT-1259 behaviour for a wait the server never scoped.
|
|
566
583
|
let sessionTenant;
|
|
567
584
|
let registeredAgentId = null;
|
|
585
|
+
// BOT-1467: the session agent the relay attributed the wait to (when overridden).
|
|
586
|
+
let registeredSessionAgentId = null;
|
|
587
|
+
let registeredSessionId = null;
|
|
568
588
|
if (needsRelay) {
|
|
569
589
|
try {
|
|
570
590
|
const reg = await registerWait(opts, conditions, new Date(deadlineMs).toISOString());
|
|
@@ -572,6 +592,8 @@ export async function runWait(argv) {
|
|
|
572
592
|
opts.waitSessionId = waitSessionId;
|
|
573
593
|
sessionTenant = reg.sessionTenant;
|
|
574
594
|
registeredAgentId = reg.agentId;
|
|
595
|
+
registeredSessionAgentId = reg.sessionAgentId;
|
|
596
|
+
registeredSessionId = reg.sessionId;
|
|
575
597
|
// BOT-1184: adopt the server's canonical host for each lock condition so the
|
|
576
598
|
// local matcher builds the same subject_key the availability/claim-grant
|
|
577
599
|
// signals carry (armed under an alias like 'jono-mac', the signal uses the
|
|
@@ -709,6 +731,8 @@ export async function runWait(argv) {
|
|
|
709
731
|
withClientIdentity(withPrincipalReceipt(receipt, opts.agentProfile, {
|
|
710
732
|
sessionTenant,
|
|
711
733
|
agentId: registeredAgentId,
|
|
734
|
+
sessionAgentId: registeredSessionAgentId,
|
|
735
|
+
sessionId: registeredSessionId,
|
|
712
736
|
})),
|
|
713
737
|
opts.receiptMaxBytes,
|
|
714
738
|
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"schema_version":1,"source_version":"1.6.3","source_identity":"2deb439f7afdbb1918d76fe15665ed6ca14c30bcfd5d65524083695cc939814c"}
|