@xn-intenton-z2a/agentic-lib 7.4.33 → 7.4.35
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/.github/workflows/agentic-lib-init.yml +8 -18
- package/.github/workflows/agentic-lib-schedule.yml +5 -49
- package/bin/agentic-lib.js +1 -0
- package/package.json +1 -1
- package/src/actions/agentic-step/tasks/direct.js +2 -2
- package/src/scripts/schedule-utils.cjs +117 -0
- package/src/seeds/zero-package.json +1 -1
|
@@ -296,26 +296,16 @@ jobs:
|
|
|
296
296
|
}
|
|
297
297
|
if (!model) model = 'gpt-5-mini';
|
|
298
298
|
|
|
299
|
-
//
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
weekly: '25 6 * * 1',
|
|
303
|
-
daily: '25 6 * * *',
|
|
304
|
-
hourly: '25 * * * *',
|
|
305
|
-
continuous: '5,25,45 * * * *',
|
|
306
|
-
};
|
|
299
|
+
// Shared schedule maps and helper (single source of truth)
|
|
300
|
+
const { updateAllSchedules } = require('./.github/agentic-lib/scripts/schedule-utils.cjs');
|
|
301
|
+
const logger = { info: core.info };
|
|
307
302
|
|
|
303
|
+
// Update all three workflow files proportionally
|
|
304
|
+
updateAllSchedules(frequency, logger);
|
|
305
|
+
|
|
306
|
+
// Stamp the workflow file with current date
|
|
308
307
|
if (fs.existsSync(workflowPath)) {
|
|
309
308
|
let content = fs.readFileSync(workflowPath, 'utf8');
|
|
310
|
-
const cron = SCHEDULE_MAP[frequency];
|
|
311
|
-
// Replace existing cron or insert new schedule block
|
|
312
|
-
const cronRegex = /- cron: "[^"]*"/;
|
|
313
|
-
if (cronRegex.test(content)) {
|
|
314
|
-
content = content.replace(cronRegex, `- cron: "${cron}"`);
|
|
315
|
-
} else {
|
|
316
|
-
const scheduleBlock = `\n schedule:\n - cron: "${cron}"\n`;
|
|
317
|
-
content = content.replace(/\non:\n/, `\non:${scheduleBlock}`);
|
|
318
|
-
}
|
|
319
309
|
const dateStamp = `# Schedule updated: ${new Date().toISOString()}`;
|
|
320
310
|
const stampRegex = /^# Schedule updated: .*/m;
|
|
321
311
|
if (stampRegex.test(content)) {
|
|
@@ -324,8 +314,8 @@ jobs:
|
|
|
324
314
|
content = content.replace(/^(# .*\n)+/m, (match) => match + dateStamp + '\n');
|
|
325
315
|
}
|
|
326
316
|
fs.writeFileSync(workflowPath, content);
|
|
327
|
-
core.info(`Updated schedule to: ${frequency}`);
|
|
328
317
|
}
|
|
318
|
+
core.info(`Updated proportional schedules to: ${frequency}`);
|
|
329
319
|
|
|
330
320
|
if (fs.existsSync(tomlPath)) {
|
|
331
321
|
let toml = fs.readFileSync(tomlPath, 'utf8');
|
|
@@ -168,56 +168,14 @@ jobs:
|
|
|
168
168
|
const isMaintenance = frequency === 'maintenance';
|
|
169
169
|
const effectiveFrequency = isMaintenance ? 'weekly' : frequency;
|
|
170
170
|
|
|
171
|
-
//
|
|
172
|
-
const WORKFLOW_SCHEDULE_MAP =
|
|
173
|
-
|
|
174
|
-
weekly: '25 6 * * 1', // Monday 6:25am
|
|
175
|
-
daily: '25 6 * * *', // Every day 6:25am
|
|
176
|
-
hourly: '25 * * * *', // Every hour at :25
|
|
177
|
-
continuous: '5,25,45 * * * *', // Every 20 min
|
|
178
|
-
};
|
|
179
|
-
const INIT_SCHEDULE_MAP = {
|
|
180
|
-
off: '0 0 31 2 *',
|
|
181
|
-
weekly: '0 4 1 * *', // 1st of month 4:00am
|
|
182
|
-
daily: '0 4 * * 1', // Monday 4:00am
|
|
183
|
-
hourly: '0 4 * * *', // Every day 4:00am
|
|
184
|
-
continuous: '0 1,5,9,13,17,21 * * *', // Every 4 hours
|
|
185
|
-
};
|
|
186
|
-
const TEST_SCHEDULE_MAP = {
|
|
187
|
-
off: '0 0 31 2 *',
|
|
188
|
-
weekly: '40 6 * * 1', // Monday 6:40am
|
|
189
|
-
daily: '40 6 * * *', // Every day 6:40am
|
|
190
|
-
hourly: '40 0,4,8,12,16,20 * * *', // Every 4 hours at :40
|
|
191
|
-
continuous: '40 * * * *', // Every hour at :40
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
// Helper: update cron in a workflow file
|
|
195
|
-
function updateWorkflowCron(path, cron, label) {
|
|
196
|
-
if (!fs.existsSync(path)) {
|
|
197
|
-
core.info(`${label}: file not found at ${path}, skipping`);
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
let content = fs.readFileSync(path, 'utf8');
|
|
201
|
-
const cronRegex = /- cron: "[^"]*"/;
|
|
202
|
-
if (cronRegex.test(content)) {
|
|
203
|
-
content = content.replace(cronRegex, `- cron: "${cron}"`);
|
|
204
|
-
} else {
|
|
205
|
-
const scheduleBlock = `\n schedule:\n - cron: "${cron}"\n`;
|
|
206
|
-
content = content.replace(/\non:\n/, `\non:${scheduleBlock}`);
|
|
207
|
-
}
|
|
208
|
-
fs.writeFileSync(path, content);
|
|
209
|
-
core.info(`${label}: set cron to "${cron}"`);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const workflowPath = '.github/workflows/agentic-lib-workflow.yml';
|
|
213
|
-
const initPath = '.github/workflows/agentic-lib-init.yml';
|
|
214
|
-
const testPath = '.github/workflows/agentic-lib-test.yml';
|
|
171
|
+
// Shared schedule maps and helper (single source of truth)
|
|
172
|
+
const { WORKFLOW_SCHEDULE_MAP, updateAllSchedules } = require('./.github/agentic-lib/scripts/schedule-utils.cjs');
|
|
173
|
+
const logger = { info: core.info };
|
|
215
174
|
|
|
216
175
|
const workflowCron = WORKFLOW_SCHEDULE_MAP[effectiveFrequency];
|
|
217
|
-
const initCron = INIT_SCHEDULE_MAP[effectiveFrequency];
|
|
218
|
-
const testCron = TEST_SCHEDULE_MAP[effectiveFrequency];
|
|
219
176
|
|
|
220
177
|
// Check if the frequency is already set — skip if no-op (but never skip maintenance)
|
|
178
|
+
const workflowPath = '.github/workflows/agentic-lib-workflow.yml';
|
|
221
179
|
const supervisorRegex2 = /^\s*supervisor\s*=\s*"([^"]*)"/m;
|
|
222
180
|
if (!isMaintenance && fs.existsSync(tomlPath)) {
|
|
223
181
|
const currentToml = fs.readFileSync(tomlPath, 'utf8');
|
|
@@ -236,9 +194,7 @@ jobs:
|
|
|
236
194
|
}
|
|
237
195
|
|
|
238
196
|
// Update all three workflow files proportionally
|
|
239
|
-
|
|
240
|
-
updateWorkflowCron(initPath, initCron, 'init');
|
|
241
|
-
updateWorkflowCron(testPath, testCron, 'test');
|
|
197
|
+
updateAllSchedules(effectiveFrequency, logger);
|
|
242
198
|
|
|
243
199
|
// Stamp the workflow file with current date
|
|
244
200
|
if (fs.existsSync(workflowPath)) {
|
package/bin/agentic-lib.js
CHANGED
package/package.json
CHANGED
|
@@ -124,7 +124,7 @@ async function buildMetricAssessment(ctx, config) {
|
|
|
124
124
|
/**
|
|
125
125
|
* Build the director prompt (lean version — model explores via tools).
|
|
126
126
|
*/
|
|
127
|
-
function buildPrompt(ctx, agentInstructions, metricAssessment) {
|
|
127
|
+
function buildPrompt(ctx, agentInstructions, metricAssessment, config) {
|
|
128
128
|
return [
|
|
129
129
|
"## Instructions",
|
|
130
130
|
agentInstructions,
|
|
@@ -508,7 +508,7 @@ export async function direct(context) {
|
|
|
508
508
|
|
|
509
509
|
// --- LLM decision via hybrid session ---
|
|
510
510
|
const agentInstructions = instructions || "You are the director. Evaluate mission readiness.";
|
|
511
|
-
const prompt = buildPrompt(ctx, agentInstructions, metricAssessment);
|
|
511
|
+
const prompt = buildPrompt(ctx, agentInstructions, metricAssessment, config);
|
|
512
512
|
|
|
513
513
|
const systemPrompt =
|
|
514
514
|
"You are the director of an autonomous coding repository. Your job is to evaluate whether the mission is complete, failed, or in progress. You produce a structured assessment — you do NOT dispatch workflows or create issues." +
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
|
+
// Copyright (C) 2025-2026 Polycode Limited
|
|
3
|
+
// schedule-utils.cjs — Shared schedule maps and helpers for workflow YAML updates.
|
|
4
|
+
//
|
|
5
|
+
// Used by agentic-lib-schedule.yml and agentic-lib-init.yml via:
|
|
6
|
+
// const { WORKFLOW_SCHEDULE_MAP, ... } = require('./.github/agentic-lib/scripts/schedule-utils.cjs');
|
|
7
|
+
//
|
|
8
|
+
// CRITICAL: These maps must stay in sync. That's the whole point of this file —
|
|
9
|
+
// a single source of truth for proportional schedule crons.
|
|
10
|
+
|
|
11
|
+
const fs = require("fs");
|
|
12
|
+
|
|
13
|
+
// Workflow (main pipeline) — runs most often
|
|
14
|
+
const WORKFLOW_SCHEDULE_MAP = {
|
|
15
|
+
off: "0 0 31 2 *",
|
|
16
|
+
weekly: "25 6 * * 1", // Monday 6:25am
|
|
17
|
+
daily: "25 6 * * *", // Every day 6:25am
|
|
18
|
+
hourly: "25 * * * *", // Every hour at :25
|
|
19
|
+
continuous: "5,25,45 * * * *", // Every 20 min
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Init (infrastructure updates) — runs least often
|
|
23
|
+
const INIT_SCHEDULE_MAP = {
|
|
24
|
+
off: "0 0 31 2 *",
|
|
25
|
+
weekly: "0 4 1 * *", // 1st of month 4:00am
|
|
26
|
+
daily: "0 4 * * 1", // Monday 4:00am
|
|
27
|
+
hourly: "0 4 * * *", // Every day 4:00am
|
|
28
|
+
continuous: "0 1,5,9,13,17,21 * * *", // Every 4 hours
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// Test (CI health checks) — more often than init, less than workflow
|
|
32
|
+
const TEST_SCHEDULE_MAP = {
|
|
33
|
+
off: "0 0 31 2 *",
|
|
34
|
+
weekly: "40 6 * * 1", // Monday 6:40am
|
|
35
|
+
daily: "40 6 * * *", // Every day 6:40am
|
|
36
|
+
hourly: "40 0,4,8,12,16,20 * * *", // Every 4 hours at :40
|
|
37
|
+
continuous: "40 * * * *", // Every hour at :40
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Update the cron schedule in a workflow YAML file.
|
|
42
|
+
* Handles duplicate schedule: block deduplication.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} path - Path to the workflow YAML file
|
|
45
|
+
* @param {string} cron - New cron expression
|
|
46
|
+
* @param {string} label - Label for log messages
|
|
47
|
+
* @param {Object} [logger] - Logger with .info() method (defaults to console)
|
|
48
|
+
*/
|
|
49
|
+
function updateWorkflowCron(path, cron, label, logger) {
|
|
50
|
+
const log = logger || { info: console.log };
|
|
51
|
+
if (!fs.existsSync(path)) {
|
|
52
|
+
log.info(`${label}: file not found at ${path}, skipping`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
let content = fs.readFileSync(path, "utf8");
|
|
56
|
+
// Remove any duplicate schedule: blocks (keep only the first)
|
|
57
|
+
const dupScheduleRegex =
|
|
58
|
+
/(\n schedule:\n - cron: "[^"]*"\n)(\s*schedule:\n\s*- cron: "[^"]*"\n)/;
|
|
59
|
+
if (dupScheduleRegex.test(content)) {
|
|
60
|
+
content = content.replace(dupScheduleRegex, "$1");
|
|
61
|
+
log.info(`${label}: removed duplicate schedule block`);
|
|
62
|
+
}
|
|
63
|
+
const cronRegex = /- cron: "[^"]*"/;
|
|
64
|
+
if (cronRegex.test(content)) {
|
|
65
|
+
content = content.replace(cronRegex, `- cron: "${cron}"`);
|
|
66
|
+
} else {
|
|
67
|
+
const scheduleBlock = `\n schedule:\n - cron: "${cron}"\n`;
|
|
68
|
+
content = content.replace(/\non:\n/, `\non:${scheduleBlock}`);
|
|
69
|
+
}
|
|
70
|
+
fs.writeFileSync(path, content);
|
|
71
|
+
log.info(`${label}: set cron to "${cron}"`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Update all three workflow crons proportionally for a given frequency.
|
|
76
|
+
*
|
|
77
|
+
* @param {string} frequency - off | weekly | daily | hourly | continuous
|
|
78
|
+
* @param {Object} [logger] - Logger with .info() method
|
|
79
|
+
*/
|
|
80
|
+
function updateAllSchedules(frequency, logger) {
|
|
81
|
+
const workflowCron = WORKFLOW_SCHEDULE_MAP[frequency];
|
|
82
|
+
const initCron = INIT_SCHEDULE_MAP[frequency];
|
|
83
|
+
const testCron = TEST_SCHEDULE_MAP[frequency];
|
|
84
|
+
|
|
85
|
+
if (workflowCron) {
|
|
86
|
+
updateWorkflowCron(
|
|
87
|
+
".github/workflows/agentic-lib-workflow.yml",
|
|
88
|
+
workflowCron,
|
|
89
|
+
"workflow",
|
|
90
|
+
logger,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
if (initCron) {
|
|
94
|
+
updateWorkflowCron(
|
|
95
|
+
".github/workflows/agentic-lib-init.yml",
|
|
96
|
+
initCron,
|
|
97
|
+
"init",
|
|
98
|
+
logger,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
if (testCron) {
|
|
102
|
+
updateWorkflowCron(
|
|
103
|
+
".github/workflows/agentic-lib-test.yml",
|
|
104
|
+
testCron,
|
|
105
|
+
"test",
|
|
106
|
+
logger,
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = {
|
|
112
|
+
WORKFLOW_SCHEDULE_MAP,
|
|
113
|
+
INIT_SCHEDULE_MAP,
|
|
114
|
+
TEST_SCHEDULE_MAP,
|
|
115
|
+
updateWorkflowCron,
|
|
116
|
+
updateAllSchedules,
|
|
117
|
+
};
|