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

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.
@@ -0,0 +1,396 @@
1
+ # SPDX-License-Identifier: MIT
2
+ # Copyright (C) 2025-2026 Polycode Limited
3
+ # .github/workflows/agentic-lib-flow.yml
4
+ #
5
+ # Uber workflow: runs the full pipeline end-to-end.
6
+ # Pattern: update → init → (test + bot + N×workflow) × 4 → test + bot → verify mission-complete
7
+ # Each sub-workflow dispatches at HEAD of main at dispatch time (not at uber job start).
8
+
9
+ name: agentic-lib-flow
10
+ run-name: "agentic-lib-flow [${{ github.ref_name }}] ${{ inputs.mission-seed }} (${{ inputs.workflow-runs }} runs)"
11
+
12
+ on:
13
+ workflow_dispatch:
14
+ inputs:
15
+ mode:
16
+ description: "Init mode (update/reseed/purge/skip)"
17
+ type: choice
18
+ required: false
19
+ default: "purge"
20
+ options:
21
+ - skip
22
+ - update
23
+ - reseed
24
+ - purge
25
+ mission-seed:
26
+ description: "Mission seed name (purge/reseed only)"
27
+ type: choice
28
+ required: false
29
+ default: "7-kyu-understand-fizz-buzz"
30
+ options:
31
+ - 8-kyu-remember-empty
32
+ - 8-kyu-remember-hello-world
33
+ - 7-kyu-understand-fizz-buzz
34
+ - 6-kyu-understand-hamming-distance
35
+ - 6-kyu-understand-roman-numerals
36
+ - 5-kyu-apply-ascii-face
37
+ - 5-kyu-apply-string-utils
38
+ - 4-kyu-apply-cron-engine
39
+ - 4-kyu-apply-dense-encoding
40
+ - 4-kyu-analyze-json-schema-diff
41
+ - 4-kyu-apply-owl-ontology
42
+ - 3-kyu-analyze-lunar-lander
43
+ - 3-kyu-evaluate-time-series-lab
44
+ - 2-kyu-create-markdown-compiler
45
+ - 2-kyu-create-plot-code-lib
46
+ - 1-kyu-create-ray-tracer
47
+ - 1-dan-create-c64-emulator
48
+ - 1-dan-create-planning-engine
49
+ - 2-dan-create-self-hosted
50
+ model:
51
+ description: "Copilot SDK model"
52
+ type: choice
53
+ required: false
54
+ default: ""
55
+ options:
56
+ - ""
57
+ - gpt-5-mini
58
+ - claude-sonnet-4
59
+ - gpt-4.1
60
+ profile:
61
+ description: "Tuning profile"
62
+ type: choice
63
+ required: false
64
+ default: ""
65
+ options:
66
+ - ""
67
+ - min
68
+ - recommended
69
+ - max
70
+ workflow-runs:
71
+ description: "Number of workflow iterations (1-16)"
72
+ type: choice
73
+ required: false
74
+ default: "4"
75
+ options:
76
+ - "1"
77
+ - "2"
78
+ - "4"
79
+ - "8"
80
+ - "12"
81
+ - "16"
82
+ schedule:
83
+ description: "Supervisor schedule after flow"
84
+ type: choice
85
+ required: false
86
+ default: "off"
87
+ options:
88
+ - "off"
89
+ - "weekly"
90
+ - "daily"
91
+ - "hourly"
92
+
93
+ permissions: write-all
94
+
95
+ jobs:
96
+ # ── Phase 0: Update agentic-lib package ────────────────────────────
97
+ update:
98
+ if: inputs.mode != 'skip'
99
+ uses: ./.github/workflows/agentic-lib-update.yml
100
+ secrets: inherit
101
+
102
+ # ── Phase 0b: Init (purge/reseed/update) ───────────────────────────
103
+ init:
104
+ needs: [update]
105
+ if: always() && inputs.mode != 'skip' && (needs.update.result == 'success' || needs.update.result == 'skipped')
106
+ uses: ./.github/workflows/agentic-lib-init.yml
107
+ with:
108
+ mode: ${{ inputs.mode }}
109
+ mission-seed: ${{ inputs.mission-seed }}
110
+ model: ${{ inputs.model }}
111
+ profile: ${{ inputs.profile }}
112
+ schedule: ${{ inputs.schedule }}
113
+ secrets: inherit
114
+
115
+ # ── Round 1: test + bot + up to 4 workflow runs ────────────────────
116
+ test-1:
117
+ needs: [init]
118
+ if: always() && (needs.init.result == 'success' || needs.init.result == 'skipped')
119
+ uses: ./.github/workflows/agentic-lib-test.yml
120
+ secrets: inherit
121
+
122
+ bot-1:
123
+ needs: [test-1]
124
+ if: always() && needs.test-1.result == 'success'
125
+ uses: ./.github/workflows/agentic-lib-bot.yml
126
+ secrets: inherit
127
+
128
+ workflow-1:
129
+ needs: [bot-1]
130
+ if: always() && needs.bot-1.result == 'success' && inputs.workflow-runs >= 1
131
+ uses: ./.github/workflows/agentic-lib-workflow.yml
132
+ secrets: inherit
133
+
134
+ workflow-2:
135
+ needs: [workflow-1]
136
+ if: always() && needs.workflow-1.result == 'success' && inputs.workflow-runs >= 2
137
+ uses: ./.github/workflows/agentic-lib-workflow.yml
138
+ secrets: inherit
139
+
140
+ workflow-3:
141
+ needs: [workflow-2]
142
+ if: always() && needs.workflow-2.result == 'success' && inputs.workflow-runs >= 3
143
+ uses: ./.github/workflows/agentic-lib-workflow.yml
144
+ secrets: inherit
145
+
146
+ workflow-4:
147
+ needs: [workflow-3]
148
+ if: always() && needs.workflow-3.result == 'success' && inputs.workflow-runs >= 4
149
+ uses: ./.github/workflows/agentic-lib-workflow.yml
150
+ secrets: inherit
151
+
152
+ # ── Round 2: test + bot + up to 4 more workflow runs ───────────────
153
+ test-2:
154
+ needs: [workflow-4]
155
+ if: always() && inputs.workflow-runs >= 5 && (needs.workflow-4.result == 'success' || needs.workflow-4.result == 'skipped')
156
+ uses: ./.github/workflows/agentic-lib-test.yml
157
+ secrets: inherit
158
+
159
+ bot-2:
160
+ needs: [test-2]
161
+ if: always() && needs.test-2.result == 'success'
162
+ uses: ./.github/workflows/agentic-lib-bot.yml
163
+ secrets: inherit
164
+
165
+ workflow-5:
166
+ needs: [bot-2]
167
+ if: always() && needs.bot-2.result == 'success' && inputs.workflow-runs >= 5
168
+ uses: ./.github/workflows/agentic-lib-workflow.yml
169
+ secrets: inherit
170
+
171
+ workflow-6:
172
+ needs: [workflow-5]
173
+ if: always() && needs.workflow-5.result == 'success' && inputs.workflow-runs >= 6
174
+ uses: ./.github/workflows/agentic-lib-workflow.yml
175
+ secrets: inherit
176
+
177
+ workflow-7:
178
+ needs: [workflow-6]
179
+ if: always() && needs.workflow-6.result == 'success' && inputs.workflow-runs >= 7
180
+ uses: ./.github/workflows/agentic-lib-workflow.yml
181
+ secrets: inherit
182
+
183
+ workflow-8:
184
+ needs: [workflow-7]
185
+ if: always() && needs.workflow-7.result == 'success' && inputs.workflow-runs >= 8
186
+ uses: ./.github/workflows/agentic-lib-workflow.yml
187
+ secrets: inherit
188
+
189
+ # ── Round 3: test + bot + up to 4 more workflow runs ───────────────
190
+ test-3:
191
+ needs: [workflow-8]
192
+ if: always() && inputs.workflow-runs >= 9 && (needs.workflow-8.result == 'success' || needs.workflow-8.result == 'skipped')
193
+ uses: ./.github/workflows/agentic-lib-test.yml
194
+ secrets: inherit
195
+
196
+ bot-3:
197
+ needs: [test-3]
198
+ if: always() && needs.test-3.result == 'success'
199
+ uses: ./.github/workflows/agentic-lib-bot.yml
200
+ secrets: inherit
201
+
202
+ workflow-9:
203
+ needs: [bot-3]
204
+ if: always() && needs.bot-3.result == 'success' && inputs.workflow-runs >= 9
205
+ uses: ./.github/workflows/agentic-lib-workflow.yml
206
+ secrets: inherit
207
+
208
+ workflow-10:
209
+ needs: [workflow-9]
210
+ if: always() && needs.workflow-9.result == 'success' && inputs.workflow-runs >= 10
211
+ uses: ./.github/workflows/agentic-lib-workflow.yml
212
+ secrets: inherit
213
+
214
+ workflow-11:
215
+ needs: [workflow-10]
216
+ if: always() && needs.workflow-10.result == 'success' && inputs.workflow-runs >= 11
217
+ uses: ./.github/workflows/agentic-lib-workflow.yml
218
+ secrets: inherit
219
+
220
+ workflow-12:
221
+ needs: [workflow-11]
222
+ if: always() && needs.workflow-11.result == 'success' && inputs.workflow-runs >= 12
223
+ uses: ./.github/workflows/agentic-lib-workflow.yml
224
+ secrets: inherit
225
+
226
+ # ── Round 4: test + bot + up to 4 more workflow runs ───────────────
227
+ test-4:
228
+ needs: [workflow-12]
229
+ if: always() && inputs.workflow-runs >= 13 && (needs.workflow-12.result == 'success' || needs.workflow-12.result == 'skipped')
230
+ uses: ./.github/workflows/agentic-lib-test.yml
231
+ secrets: inherit
232
+
233
+ bot-4:
234
+ needs: [test-4]
235
+ if: always() && needs.test-4.result == 'success'
236
+ uses: ./.github/workflows/agentic-lib-bot.yml
237
+ secrets: inherit
238
+
239
+ workflow-13:
240
+ needs: [bot-4]
241
+ if: always() && needs.bot-4.result == 'success' && inputs.workflow-runs >= 13
242
+ uses: ./.github/workflows/agentic-lib-workflow.yml
243
+ secrets: inherit
244
+
245
+ workflow-14:
246
+ needs: [workflow-13]
247
+ if: always() && needs.workflow-13.result == 'success' && inputs.workflow-runs >= 14
248
+ uses: ./.github/workflows/agentic-lib-workflow.yml
249
+ secrets: inherit
250
+
251
+ workflow-15:
252
+ needs: [workflow-14]
253
+ if: always() && needs.workflow-14.result == 'success' && inputs.workflow-runs >= 15
254
+ uses: ./.github/workflows/agentic-lib-workflow.yml
255
+ secrets: inherit
256
+
257
+ workflow-16:
258
+ needs: [workflow-15]
259
+ if: always() && needs.workflow-15.result == 'success' && inputs.workflow-runs >= 16
260
+ uses: ./.github/workflows/agentic-lib-workflow.yml
261
+ secrets: inherit
262
+
263
+ # ── Final: test + bot ──────────────────────────────────────────────
264
+ test-final:
265
+ needs: [workflow-4, workflow-8, workflow-12, workflow-16]
266
+ if: always()
267
+ uses: ./.github/workflows/agentic-lib-test.yml
268
+ secrets: inherit
269
+
270
+ bot-final:
271
+ needs: [test-final]
272
+ if: always() && needs.test-final.result == 'success'
273
+ uses: ./.github/workflows/agentic-lib-bot.yml
274
+ secrets: inherit
275
+
276
+ # ── Verify: MISSION_COMPLETE.md must exist ─────────────────────────
277
+ verify-mission-complete:
278
+ needs: [bot-final]
279
+ if: always()
280
+ runs-on: ubuntu-latest
281
+ steps:
282
+ - uses: actions/checkout@v6
283
+ with:
284
+ ref: main
285
+ fetch-depth: 1
286
+ - name: Check MISSION_COMPLETE.md
287
+ id: check
288
+ run: |
289
+ if [ -f MISSION_COMPLETE.md ]; then
290
+ echo "✅ Mission complete!"
291
+ cat MISSION_COMPLETE.md
292
+ echo "mission_complete=true" >> "$GITHUB_OUTPUT"
293
+ else
294
+ echo "❌ MISSION_COMPLETE.md not found after ${{ inputs.workflow-runs }} workflow runs"
295
+ echo "mission_complete=false" >> "$GITHUB_OUTPUT"
296
+ fi
297
+
298
+ # ── Generate benchmark report ──────────────────────────────────────
299
+ generate-report:
300
+ needs: [verify-mission-complete]
301
+ if: always()
302
+ runs-on: ubuntu-latest
303
+ steps:
304
+ - uses: actions/checkout@v6
305
+ with:
306
+ ref: main
307
+ fetch-depth: 1
308
+
309
+ - name: Fetch state and logs from logs branch
310
+ run: |
311
+ git fetch origin agentic-lib-logs --depth=1 2>/dev/null || true
312
+ git show origin/agentic-lib-logs:agentic-lib-state.toml > /tmp/state.toml 2>/dev/null || echo "# no state" > /tmp/state.toml
313
+ # List agent log files
314
+ git ls-tree origin/agentic-lib-logs --name-only 2>/dev/null | grep '^agent-log-' | sort > /tmp/log-files.txt || true
315
+
316
+ - name: Read source and mission
317
+ run: |
318
+ wc -l src/lib/main.js 2>/dev/null | awk '{print $1}' > /tmp/source-lines.txt || echo "0" > /tmp/source-lines.txt
319
+ cat MISSION.md > /tmp/mission.txt 2>/dev/null || echo "No MISSION.md" > /tmp/mission.txt
320
+ ls tests/unit/*.test.js 2>/dev/null | wc -l > /tmp/test-files.txt || echo "0" > /tmp/test-files.txt
321
+
322
+ - name: Generate report
323
+ run: |
324
+ REPORT_NUM=$(printf "%03d" $(( $(ls BENCHMARK_REPORT_*.md 2>/dev/null | wc -l) + 1 )))
325
+ MISSION_SEED="${{ inputs.mission-seed }}"
326
+ MODEL="${{ inputs.model || 'default' }}"
327
+ PROFILE="${{ inputs.profile || 'default' }}"
328
+ WORKFLOW_RUNS="${{ inputs.workflow-runs }}"
329
+ SOURCE_LINES=$(cat /tmp/source-lines.txt)
330
+ TEST_FILES=$(cat /tmp/test-files.txt)
331
+ MISSION_COMPLETE="NO"
332
+ if [ -f MISSION_COMPLETE.md ]; then MISSION_COMPLETE="YES"; fi
333
+
334
+ cat > "BENCHMARK_REPORT_FLOW_${REPORT_NUM}.md" << REPORT_EOF
335
+ # Flow Benchmark Report ${REPORT_NUM}
336
+
337
+ **Date**: $(date -u +%Y-%m-%d)
338
+ **Operator**: agentic-lib-flow (automated)
339
+ **agentic-lib version**: $(node -e "console.log(require('./package.json').version)" 2>/dev/null || echo "unknown")
340
+ **Run**: [${GITHUB_RUN_ID}](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})
341
+
342
+ ---
343
+
344
+ ## Configuration
345
+
346
+ | Parameter | Value |
347
+ |-----------|-------|
348
+ | Mission seed | ${MISSION_SEED} |
349
+ | Model | ${MODEL} |
350
+ | Profile | ${PROFILE} |
351
+ | Workflow runs | ${WORKFLOW_RUNS} |
352
+ | Init mode | ${{ inputs.mode }} |
353
+
354
+ ## State File
355
+
356
+ \`\`\`toml
357
+ $(cat /tmp/state.toml)
358
+ \`\`\`
359
+
360
+ ## Results
361
+
362
+ | Metric | Value |
363
+ |--------|-------|
364
+ | Mission complete | ${MISSION_COMPLETE} |
365
+ | Source lines | ${SOURCE_LINES} |
366
+ | Test files | ${TEST_FILES} |
367
+ | Agent log files | $(wc -l < /tmp/log-files.txt) |
368
+
369
+ ## Mission
370
+
371
+ \`\`\`
372
+ $(head -20 /tmp/mission.txt)
373
+ \`\`\`
374
+
375
+ ## Agent Log Files
376
+
377
+ $(cat /tmp/log-files.txt | while read f; do echo "- ${f}"; done)
378
+ REPORT_EOF
379
+
380
+ echo "Generated BENCHMARK_REPORT_FLOW_${REPORT_NUM}.md"
381
+ cat "BENCHMARK_REPORT_FLOW_${REPORT_NUM}.md"
382
+
383
+ - name: Commit report
384
+ run: |
385
+ git config user.name "github-actions[bot]"
386
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
387
+ git add BENCHMARK_REPORT_FLOW_*.md
388
+ git diff --staged --quiet && echo "No report to commit" && exit 0
389
+ git commit -m "flow: benchmark report for ${{ inputs.mission-seed }} (${{ inputs.workflow-runs }} runs) [skip ci]"
390
+ git push origin main || echo "Push failed — report saved as artifact"
391
+
392
+ - name: Upload report artifact
393
+ uses: actions/upload-artifact@v4
394
+ with:
395
+ name: benchmark-report
396
+ path: BENCHMARK_REPORT_FLOW_*.md
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.22",
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.22"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@playwright/test": "^1.58.0",