@sjawhar/pi-legion-envoy 7.11.1 → 7.11.2
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/legion.js +27 -9
- package/package.json +2 -2
package/dist/legion.js
CHANGED
|
@@ -18042,7 +18042,7 @@ function endInjectedUserTurns(sessionID) {
|
|
|
18042
18042
|
// package.json
|
|
18043
18043
|
var package_default = {
|
|
18044
18044
|
name: "@sjawhar/pi-legion-envoy",
|
|
18045
|
-
version: "7.11.
|
|
18045
|
+
version: "7.11.2",
|
|
18046
18046
|
license: "Apache-2.0",
|
|
18047
18047
|
type: "module",
|
|
18048
18048
|
omp: {
|
|
@@ -18055,7 +18055,7 @@ var package_default = {
|
|
|
18055
18055
|
]
|
|
18056
18056
|
},
|
|
18057
18057
|
legion: {
|
|
18058
|
-
daemonApiVersion:
|
|
18058
|
+
daemonApiVersion: 13
|
|
18059
18059
|
},
|
|
18060
18060
|
repository: {
|
|
18061
18061
|
type: "git",
|
|
@@ -18421,7 +18421,8 @@ var LegionGrantRequest = exports_external.strictObject({
|
|
|
18421
18421
|
sessionId: nonEmptyString,
|
|
18422
18422
|
secret: nonEmptyString,
|
|
18423
18423
|
tree: nonEmptyString,
|
|
18424
|
-
issue: nonEmptyString
|
|
18424
|
+
issue: nonEmptyString,
|
|
18425
|
+
push: exports_external.boolean().optional()
|
|
18425
18426
|
});
|
|
18426
18427
|
var LegionControllerGrantRequest = exports_external.strictObject({
|
|
18427
18428
|
sessionId: nonEmptyString,
|
|
@@ -19413,8 +19414,24 @@ function splitShellCommands(command) {
|
|
|
19413
19414
|
endCommand();
|
|
19414
19415
|
return commands;
|
|
19415
19416
|
}
|
|
19417
|
+
function commandMatch(words, name, sequence) {
|
|
19418
|
+
for (let index = 0;index < words.length; index += 1) {
|
|
19419
|
+
const word = words[index];
|
|
19420
|
+
if (word !== name && !word?.endsWith(`/${name}`))
|
|
19421
|
+
continue;
|
|
19422
|
+
if (sequence.every((expected, offset) => words[index + 1 + offset] === expected))
|
|
19423
|
+
return index;
|
|
19424
|
+
}
|
|
19425
|
+
return -1;
|
|
19426
|
+
}
|
|
19427
|
+
function isPushInvocation(words) {
|
|
19428
|
+
return commandMatch(words, "legion", ["push"]) !== -1;
|
|
19429
|
+
}
|
|
19430
|
+
function commandsRunPush(commands) {
|
|
19431
|
+
return commands?.some(isPushInvocation) ?? false;
|
|
19432
|
+
}
|
|
19416
19433
|
function jjLogRewriteInvocation(words) {
|
|
19417
|
-
const jj = words
|
|
19434
|
+
const jj = commandMatch(words, "jj", []);
|
|
19418
19435
|
if (jj === -1)
|
|
19419
19436
|
return;
|
|
19420
19437
|
const args = words.slice(jj + 1);
|
|
@@ -19430,7 +19447,7 @@ var LEGION_HANDOFF_COMPLETE_MENTION = /\blegion[\s"'`,[\]]+handoff[\s"'`,[\]]+co
|
|
|
19430
19447
|
var LEGION_HANDOFF_COMPLETE = {
|
|
19431
19448
|
mention: (text) => LEGION_HANDOFF_COMPLETE_MENTION.test(text) ? "legion handoff complete" : undefined,
|
|
19432
19449
|
invocation: (words) => {
|
|
19433
|
-
const legion = words
|
|
19450
|
+
const legion = commandMatch(words, "legion", ["handoff", "complete"]);
|
|
19434
19451
|
return legion === -1 ? undefined : words.slice(legion).join(" ");
|
|
19435
19452
|
},
|
|
19436
19453
|
refusal: (attempt) => `refused \`${attempt}\`: a phase is completed with the \`legion\` tool's ` + "`handoff_complete`, never a shell command: the tool call is what records the phase " + "complete. A root architect or a `task` subagent has no handoff actions: it leaves the " + "completion to the worker. Text that only names the command (a commit message, a PR body) " + "reads as the command: pass it in a file."
|
|
@@ -19477,14 +19494,13 @@ function nonFileWriteScheme(toolCall) {
|
|
|
19477
19494
|
return;
|
|
19478
19495
|
return NON_FILE_WRITE_URL.exec(writeTarget(toolCall.input.path))?.[1]?.toLowerCase();
|
|
19479
19496
|
}
|
|
19480
|
-
function paneRuleRefusal(toolCall, rules) {
|
|
19497
|
+
function paneRuleRefusal(toolCall, rules, commands) {
|
|
19481
19498
|
if (rules.length === 0)
|
|
19482
19499
|
return;
|
|
19483
19500
|
const { toolName, input } = toolCall;
|
|
19484
19501
|
if (toolName === "bash") {
|
|
19485
19502
|
if (typeof input.command !== "string")
|
|
19486
19503
|
return;
|
|
19487
|
-
const commands = splitShellCommands(input.command);
|
|
19488
19504
|
for (const rule of rules) {
|
|
19489
19505
|
const attempt = refusedCommand(input.command, commands, rule);
|
|
19490
19506
|
if (attempt !== undefined)
|
|
@@ -19584,7 +19600,8 @@ function legionExtension(pi) {
|
|
|
19584
19600
|
toolName: toolCall.toolName
|
|
19585
19601
|
});
|
|
19586
19602
|
paneRules ??= PANE_RULES[classifySession(process.env).kind] ?? [];
|
|
19587
|
-
const
|
|
19603
|
+
const commands = toolCall.toolName === "bash" && typeof toolCall.input.command === "string" ? splitShellCommands(toolCall.input.command) : undefined;
|
|
19604
|
+
const refusal = paneRuleRefusal(toolCall, paneRules, commands);
|
|
19588
19605
|
if (refusal !== undefined)
|
|
19589
19606
|
return { block: true, reason: refusal };
|
|
19590
19607
|
if (await checkSubagentSession(context))
|
|
@@ -19614,7 +19631,8 @@ function legionExtension(pi) {
|
|
|
19614
19631
|
tree: active.tree,
|
|
19615
19632
|
issue: active.issue,
|
|
19616
19633
|
sessionId: sessionID,
|
|
19617
|
-
secret: active.secret
|
|
19634
|
+
secret: active.secret,
|
|
19635
|
+
push: commandsRunPush(commands)
|
|
19618
19636
|
}));
|
|
19619
19637
|
});
|
|
19620
19638
|
pi.on("message_start", async (event, context) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sjawhar/pi-legion-envoy",
|
|
3
|
-
"version": "7.11.
|
|
3
|
+
"version": "7.11.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"omp": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
]
|
|
14
14
|
},
|
|
15
15
|
"legion": {
|
|
16
|
-
"daemonApiVersion":
|
|
16
|
+
"daemonApiVersion": 13
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|