@xn-intenton-z2a/agentic-lib 7.4.17 → 7.4.18
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
CHANGED
|
@@ -541,8 +541,17 @@ function parseReasoning(content) {
|
|
|
541
541
|
async function executeDispatch(octokit, repo, actionName, params, ctx) {
|
|
542
542
|
const workflowFile = actionName.replace("dispatch:", "") + ".yml";
|
|
543
543
|
const inputs = {};
|
|
544
|
-
if (params["pr-number"]) inputs["pr-number"] = params["pr-number"];
|
|
545
|
-
if (params["issue-number"])
|
|
544
|
+
if (params["pr-number"]) inputs["pr-number"] = String(params["pr-number"]);
|
|
545
|
+
if (params["issue-number"]) {
|
|
546
|
+
const issueNum = String(params["issue-number"]);
|
|
547
|
+
// Guard: reject placeholder issue numbers from LLM (e.g. "<created_issue_number>")
|
|
548
|
+
if (/^\d+$/.test(issueNum)) {
|
|
549
|
+
inputs["issue-number"] = issueNum;
|
|
550
|
+
} else {
|
|
551
|
+
core.warning(`dispatch: ignoring non-numeric issue-number: ${issueNum}`);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
if (params.mode) inputs.mode = String(params.mode);
|
|
546
555
|
|
|
547
556
|
// Pass discussion-url when dispatching the bot
|
|
548
557
|
if (workflowFile === "agentic-lib-bot.yml" && ctx?.activeDiscussionUrl) {
|
|
@@ -735,13 +744,36 @@ async function executeSetSchedule(octokit, repo, frequency) {
|
|
|
735
744
|
}
|
|
736
745
|
|
|
737
746
|
async function executeAction(octokit, repo, action, params, ctx) {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
if (
|
|
743
|
-
|
|
744
|
-
|
|
747
|
+
// LLMs sometimes inline params in the action string as pipe-delimited key: value pairs
|
|
748
|
+
// e.g. "github:create-issue | title: foo | body: bar" instead of using the params object
|
|
749
|
+
let cleanAction = action;
|
|
750
|
+
let mergedParams = { ...params };
|
|
751
|
+
if (action.includes(" | ")) {
|
|
752
|
+
const parts = action.split(" | ");
|
|
753
|
+
cleanAction = parts[0].trim();
|
|
754
|
+
for (let i = 1; i < parts.length; i++) {
|
|
755
|
+
const colonIdx = parts[i].indexOf(":");
|
|
756
|
+
if (colonIdx > 0) {
|
|
757
|
+
const key = parts[i].substring(0, colonIdx).trim();
|
|
758
|
+
const value = parts[i].substring(colonIdx + 1).trim();
|
|
759
|
+
// Only add to params if not already set (explicit params take precedence)
|
|
760
|
+
if (!(key in mergedParams)) {
|
|
761
|
+
mergedParams[key] = value;
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
if (cleanAction !== action) {
|
|
766
|
+
core.info(`Parsed inline params from action string: ${cleanAction} + ${Object.keys(mergedParams).join(", ")}`);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
if (cleanAction.startsWith("dispatch:")) return executeDispatch(octokit, repo, cleanAction, mergedParams, ctx);
|
|
771
|
+
if (cleanAction.startsWith("set-schedule:")) return executeSetSchedule(octokit, repo, cleanAction.replace("set-schedule:", ""));
|
|
772
|
+
if (cleanAction === "nop") return "nop";
|
|
773
|
+
const handler = ACTION_HANDLERS[cleanAction];
|
|
774
|
+
if (handler) return handler(octokit, repo, mergedParams, ctx);
|
|
775
|
+
core.debug(`Ignoring unrecognised action: ${cleanAction}`);
|
|
776
|
+
return `unknown:${cleanAction}`;
|
|
745
777
|
}
|
|
746
778
|
|
|
747
779
|
/**
|