@xn-intenton-z2a/agentic-lib 7.4.20 → 7.4.21

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xn-intenton-z2a/agentic-lib",
3
- "version": "7.4.20",
3
+ "version": "7.4.21",
4
4
  "description": "Agentic-lib Agentic Coding Systems SDK powering automated GitHub workflows.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -156,6 +156,8 @@ function buildPrompt(ctx, agentInstructions, metricAssessment) {
156
156
  "Use read_file to inspect source code and tests for completeness.",
157
157
  "Use git_diff or git_status for additional context if needed.",
158
158
  "Consider the implementation review findings — if critical gaps exist, do NOT declare mission-complete.",
159
+ "Check the acceptance criteria in the Mission section above. If all criteria are clearly satisfied by the current source code and tests (verified via read_file), you SHOULD declare mission-complete even if not all mechanical metrics are MET.",
160
+ "For simple missions (few functions, clear acceptance criteria), do not require elaborate test coverage or documentation beyond what the acceptance criteria specify.",
159
161
  "Then call report_director_decision with your determination.",
160
162
  "",
161
163
  "**You MUST call report_director_decision exactly once.**",
@@ -455,6 +457,7 @@ export async function direct(context) {
455
457
  if (logFilePath) attachments.push({ type: "file", path: logFilePath });
456
458
  if (screenshotFilePath) attachments.push({ type: "file", path: screenshotFilePath });
457
459
 
460
+ const sessionStartTime = Date.now();
458
461
  const result = await runCopilotSession({
459
462
  workspacePath: process.cwd(),
460
463
  model,
@@ -467,6 +470,8 @@ export async function direct(context) {
467
470
  excludedTools: ["write_file", "run_command", "run_tests", "dispatch_workflow", "close_issue", "label_issue", "post_discussion_comment", "create_issue", "comment_on_issue"],
468
471
  logger: { info: core.info, warning: core.warning, error: core.error, debug: core.debug },
469
472
  });
473
+ const sessionDurationMs = Date.now() - sessionStartTime;
474
+ core.info(`Director session completed in ${Math.round(sessionDurationMs / 1000)}s (${result.tokensIn + result.tokensOut} tokens)`);
470
475
 
471
476
  const tokensUsed = result.tokensIn + result.tokensOut;
472
477
 
@@ -482,14 +487,11 @@ export async function direct(context) {
482
487
 
483
488
  // Execute the decision
484
489
  let outcome = "directed";
485
- if (decision === "mission-complete" && metricAssessment.allMet) {
490
+ if (decision === "mission-complete") {
486
491
  if (process.env.GITHUB_REPOSITORY !== "xn-intenton-z2a/agentic-lib") {
487
492
  await executeMissionComplete(octokit, repo, reason);
488
493
  outcome = "mission-complete";
489
494
  }
490
- } else if (decision === "mission-complete" && !metricAssessment.allMet) {
491
- core.info("Director chose mission-complete but metrics are NOT all met — overriding to in-progress");
492
- outcome = "directed";
493
495
  } else if (decision === "mission-failed") {
494
496
  if (process.env.GITHUB_REPOSITORY !== "xn-intenton-z2a/agentic-lib") {
495
497
  await executeMissionFailed(octokit, repo, reason, metricAssessment);
@@ -838,7 +838,21 @@ export async function supervise(context) {
838
838
  type: "object",
839
839
  properties: {
840
840
  action: { type: "string", description: "Action name (e.g. dispatch:agentic-lib-workflow, github:create-issue, set-schedule:weekly, nop)" },
841
- params: { type: "object", description: "Action parameters (e.g. mode, issue-number, title, labels, message, discussion-url, frequency)" },
841
+ params: {
842
+ type: "object",
843
+ properties: {
844
+ title: { type: "string", description: "Issue title (REQUIRED for github:create-issue)" },
845
+ body: { type: "string", description: "Issue body or description" },
846
+ labels: { type: "string", description: "Comma-separated labels (e.g. 'automated,enhancement')" },
847
+ "issue-number": { type: "string", description: "Issue number for dispatch, label, or close actions" },
848
+ "pr-number": { type: "string", description: "PR number for dispatch actions" },
849
+ mode: { type: "string", description: "Workflow dispatch mode (e.g. 'dev-only', 'maintain-only')" },
850
+ frequency: { type: "string", description: "Schedule frequency for set-schedule action" },
851
+ message: { type: "string", description: "Message for respond:discussions action" },
852
+ "discussion-url": { type: "string", description: "Discussion URL for respond:discussions action" },
853
+ },
854
+ description: "Action parameters. For github:create-issue, 'title' is required.",
855
+ },
842
856
  },
843
857
  required: ["action"],
844
858
  },
@@ -852,12 +866,30 @@ export async function supervise(context) {
852
866
  planResult.reasoning = reasoning || "";
853
867
 
854
868
  // Execute each action using existing handlers
869
+ // W10: Track created issue titles for same-iteration dedup
870
+ const createdIssueTitles = new Set();
855
871
  const results = [];
856
872
  for (const { action, params } of (actions || [])) {
857
873
  try {
874
+ // W10: Skip duplicate create-issue within same plan
875
+ if ((action === "github:create-issue" || action.startsWith("github:create-issue")) && params?.title) {
876
+ const titleKey = (params.title || "").toLowerCase().substring(0, 40);
877
+ if (createdIssueTitles.has(titleKey)) {
878
+ results.push(`skipped:duplicate-same-session:${(params.title || "").substring(0, 50)}`);
879
+ logger.info(`Skipping duplicate issue in same session: ${params.title}`);
880
+ continue;
881
+ }
882
+ }
883
+
858
884
  const result = await executeAction(octokit, repo, action, params || {}, ctx);
859
885
  results.push(result);
860
886
  logger.info(`Action result: ${result}`);
887
+
888
+ // W10: Track created issues for dedup
889
+ if (result.startsWith("created-issue:")) {
890
+ const title = (params?.title || "").toLowerCase().substring(0, 40);
891
+ if (title) createdIssueTitles.add(title);
892
+ }
861
893
  } catch (err) {
862
894
  logger.warning(`Action ${action} failed: ${err.message}`);
863
895
  results.push(`error:${action}:${err.message}`);
@@ -877,6 +909,7 @@ export async function supervise(context) {
877
909
  if (logFilePath) attachments.push({ type: "file", path: logFilePath });
878
910
  if (screenshotFilePath) attachments.push({ type: "file", path: screenshotFilePath });
879
911
 
912
+ const sessionStartTime = Date.now();
880
913
  const result = await runCopilotSession({
881
914
  workspacePath: process.cwd(),
882
915
  model,
@@ -889,6 +922,7 @@ export async function supervise(context) {
889
922
  excludedTools: ["write_file", "run_command", "run_tests"],
890
923
  logger: { info: core.info, warning: core.warning, error: core.error, debug: core.debug },
891
924
  });
925
+ core.info(`Supervisor session completed in ${Math.round((Date.now() - sessionStartTime) / 1000)}s`);
892
926
 
893
927
  const tokensUsed = result.tokensIn + result.tokensOut;
894
928
 
@@ -187,6 +187,10 @@ export async function transform(context) {
187
187
  };
188
188
 
189
189
  // ── Run hybrid session ─────────────────────────────────────────────
190
+ // Cap tool calls to prevent unbounded sessions (W6: Benchmark 010 finding)
191
+ const maxToolCalls = Math.max(20, Math.floor((t.maxTokens || 200000) / 5000));
192
+
193
+ const sessionStartTime = Date.now();
190
194
  const result = await runCopilotSession({
191
195
  workspacePath: process.cwd(),
192
196
  model,
@@ -196,11 +200,12 @@ export async function transform(context) {
196
200
  writablePaths,
197
201
  createTools,
198
202
  attachments,
203
+ maxToolCalls,
199
204
  excludedTools: ["dispatch_workflow", "close_issue", "label_issue", "post_discussion_comment"],
200
205
  logger: { info: core.info, warning: core.warning, error: core.error, debug: core.debug },
201
206
  });
202
-
203
- core.info(`Transformation step completed (${result.tokensIn + result.tokensOut} tokens)`);
207
+ const sessionDurationMs = Date.now() - sessionStartTime;
208
+ core.info(`Transform session completed in ${Math.round(sessionDurationMs / 1000)}s (${result.tokensIn + result.tokensOut} tokens, maxToolCalls=${maxToolCalls})`);
204
209
 
205
210
  // Detect mission-complete hint
206
211
  const lowerResult = (result.agentMessage || "").toLowerCase();
@@ -17,7 +17,7 @@
17
17
  "author": "",
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
- "@xn-intenton-z2a/agentic-lib": "^7.4.20"
20
+ "@xn-intenton-z2a/agentic-lib": "^7.4.21"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@playwright/test": "^1.58.0",