charness 3.10.0 → 3.11.0
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/CHANGELOG.md +29 -0
- package/README.md +2 -1
- package/agent-plugin/skills/charness-manager/SKILL.md +6 -5
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +176 -135
- package/dist/bot.js.map +1 -1
- package/dist/connectors/telegram/commands/botCore.d.ts +1 -0
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.js +3 -3
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.js +11 -5
- package/dist/connectors/telegram/commands/runners.js.map +1 -1
- package/dist/connectors/telegram/foldedMessage.d.ts +24 -0
- package/dist/connectors/telegram/foldedMessage.d.ts.map +1 -0
- package/dist/connectors/telegram/foldedMessage.js +39 -0
- package/dist/connectors/telegram/foldedMessage.js.map +1 -0
- package/dist/connectors/telegram/inbound.d.ts +24 -1
- package/dist/connectors/telegram/inbound.d.ts.map +1 -1
- package/dist/connectors/telegram/inbound.js +77 -1
- package/dist/connectors/telegram/inbound.js.map +1 -1
- package/dist/connectors/telegram/renderAgentHtml.d.ts +15 -0
- package/dist/connectors/telegram/renderAgentHtml.d.ts.map +1 -1
- package/dist/connectors/telegram/renderAgentHtml.js +11 -1
- package/dist/connectors/telegram/renderAgentHtml.js.map +1 -1
- package/dist/connectors/telegram/unpinMessages.d.ts +12 -0
- package/dist/connectors/telegram/unpinMessages.d.ts.map +1 -0
- package/dist/connectors/telegram/unpinMessages.js +44 -0
- package/dist/connectors/telegram/unpinMessages.js.map +1 -0
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +11 -3
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +11 -3
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +11 -3
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +11 -3
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +11 -3
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +11 -3
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +11 -3
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +11 -3
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +11 -3
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +11 -3
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +11 -3
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +11 -3
- package/dist/i18n/zh.js.map +1 -1
- package/dist/outputTrace.d.ts +6 -0
- package/dist/outputTrace.d.ts.map +1 -1
- package/dist/outputTrace.js +13 -0
- package/dist/outputTrace.js.map +1 -1
- package/dist/runnerUtility/guiAgentHeal.js +2 -2
- package/dist/runnerUtility/guiAgentHeal.js.map +1 -1
- package/dist/runnerUtility/isolatedCommand.d.ts +0 -2
- package/dist/runnerUtility/isolatedCommand.d.ts.map +1 -1
- package/dist/runnerUtility/isolatedCommand.js +4 -11
- package/dist/runnerUtility/isolatedCommand.js.map +1 -1
- package/dist/scheduler/checkRun.d.ts +9 -10
- package/dist/scheduler/checkRun.d.ts.map +1 -1
- package/dist/scheduler/checkRun.js +8 -16
- package/dist/scheduler/checkRun.js.map +1 -1
- package/dist/scheduler/checkStatus.d.ts +2 -5
- package/dist/scheduler/checkStatus.d.ts.map +1 -1
- package/dist/scheduler/checkStatus.js +6 -11
- package/dist/scheduler/checkStatus.js.map +1 -1
- package/dist/scheduler/delivery.d.ts +79 -37
- package/dist/scheduler/delivery.d.ts.map +1 -1
- package/dist/scheduler/delivery.js +117 -68
- package/dist/scheduler/delivery.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +6 -2
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +39 -15
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/scheduler/recurrence.d.ts +32 -0
- package/dist/scheduler/recurrence.d.ts.map +1 -1
- package/dist/scheduler/recurrence.js +56 -18
- package/dist/scheduler/recurrence.js.map +1 -1
- package/dist/scheduler/scheduleText.d.ts +7 -0
- package/dist/scheduler/scheduleText.d.ts.map +1 -0
- package/dist/scheduler/scheduleText.js +55 -0
- package/dist/scheduler/scheduleText.js.map +1 -0
- package/dist/scheduler/store.d.ts +8 -2
- package/dist/scheduler/store.d.ts.map +1 -1
- package/dist/scheduler/store.js +25 -4
- package/dist/scheduler/store.js.map +1 -1
- package/dist/scheduler/types.d.ts +4 -10
- package/dist/scheduler/types.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.d.ts +24 -9
- package/dist/scheduler/workerWatch.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.js +29 -11
- package/dist/scheduler/workerWatch.js.map +1 -1
- package/dist/utils/claudeUsage.d.ts +3 -0
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +8 -1
- package/dist/utils/claudeUsage.js.map +1 -1
- package/dist/utils/claudeUsageRefresher.d.ts +27 -3
- package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
- package/dist/utils/claudeUsageRefresher.js +113 -14
- package/dist/utils/claudeUsageRefresher.js.map +1 -1
- package/dist/utils/forwardedMark.d.ts +54 -0
- package/dist/utils/forwardedMark.d.ts.map +1 -0
- package/dist/utils/forwardedMark.js +80 -0
- package/dist/utils/forwardedMark.js.map +1 -0
- package/dist/utils/limitHeldPrompts.d.ts +8 -2
- package/dist/utils/limitHeldPrompts.d.ts.map +1 -1
- package/dist/utils/limitHeldPrompts.js +11 -4
- package/dist/utils/limitHeldPrompts.js.map +1 -1
- package/dist/utils/messageContext.d.ts +54 -0
- package/dist/utils/messageContext.d.ts.map +1 -0
- package/dist/utils/messageContext.js +58 -0
- package/dist/utils/messageContext.js.map +1 -0
- package/dist/utils/openCodeUsage.d.ts +10 -3
- package/dist/utils/openCodeUsage.d.ts.map +1 -1
- package/dist/utils/openCodeUsage.js +19 -5
- package/dist/utils/openCodeUsage.js.map +1 -1
- package/dist/utils/replyQuote.d.ts +11 -26
- package/dist/utils/replyQuote.d.ts.map +1 -1
- package/dist/utils/replyQuote.js +9 -31
- package/dist/utils/replyQuote.js.map +1 -1
- package/dist/utils/stripControlCharacters.d.ts +8 -0
- package/dist/utils/stripControlCharacters.d.ts.map +1 -0
- package/dist/utils/stripControlCharacters.js +16 -0
- package/dist/utils/stripControlCharacters.js.map +1 -0
- package/dist/utils/telegramError.d.ts +6 -0
- package/dist/utils/telegramError.d.ts.map +1 -1
- package/dist/utils/telegramError.js +30 -0
- package/dist/utils/telegramError.js.map +1 -1
- package/dist/utils/topicRequest.d.ts +13 -0
- package/dist/utils/topicRequest.d.ts.map +1 -1
- package/dist/utils/topicRequest.js +10 -0
- package/dist/utils/topicRequest.js.map +1 -1
- package/dist/utils/usageRefreshBudget.d.ts.map +1 -1
- package/dist/utils/usageRefreshBudget.js +4 -10
- package/dist/utils/usageRefreshBudget.js.map +1 -1
- package/dist/utils/waitUpTo.d.ts +8 -0
- package/dist/utils/waitUpTo.d.ts.map +1 -0
- package/dist/utils/waitUpTo.js +20 -0
- package/dist/utils/waitUpTo.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkRun.d.ts","sourceRoot":"","sources":["../../src/scheduler/checkRun.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"checkRun.d.ts","sourceRoot":"","sources":["../../src/scheduler/checkRun.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC,uCAAuC;AACvC,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAE1C,oFAAoF;AACpF,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAQ7C;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,OAAO,CAAC;IACpB,oEAAoE;IACpE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAEnE;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,GAAG,WAAW,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,GAAG,kBAAkB,CAG5G;AAED,oGAAoG;AACpG,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAKvF;AAED,4FAA4F;AAC5F,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGpE;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CAeT;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAIvE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;CACxB,GAAG,OAAO,CAAC,cAAc,CAAC,CAoD1B"}
|
|
@@ -5,7 +5,6 @@ exports.checkIsCheckPassing = checkIsCheckPassing;
|
|
|
5
5
|
exports.getCheckAlertDecision = getCheckAlertDecision;
|
|
6
6
|
exports.describeCheckFailure = describeCheckFailure;
|
|
7
7
|
exports.getOutputTail = getOutputTail;
|
|
8
|
-
exports.getCheckAlertCommand = getCheckAlertCommand;
|
|
9
8
|
exports.buildCheckFailurePrompt = buildCheckFailurePrompt;
|
|
10
9
|
exports.buildCheckEnv = buildCheckEnv;
|
|
11
10
|
exports.runCheckCommand = runCheckCommand;
|
|
@@ -14,9 +13,10 @@ const node_child_process_1 = require("node:child_process");
|
|
|
14
13
|
* @description The `'check'` delivery kind: a watchdog the agent creates with
|
|
15
14
|
* `schedule_create` + `checkCommand`. At fire time the BOT runs the command in the
|
|
16
15
|
* topic's bound folder; exit 0 is a pass and stays silent. The first failure after
|
|
17
|
-
* a pass
|
|
18
|
-
* and the
|
|
19
|
-
*
|
|
16
|
+
* a pass posts one short silent notice (never the command; the output tail folded
|
|
17
|
+
* under it) and wakes the agent with the job's prompt plus the failure and the
|
|
18
|
+
* output tail; further failures stay silent until a run passes again, which posts
|
|
19
|
+
* one "is back to normal" line.
|
|
20
20
|
*
|
|
21
21
|
* WHY the bot runs it: a watcher the agent builds itself (a background loop,
|
|
22
22
|
* `nohup`, a `sleep` loop, a tmux pane) dies with the session, a bot restart or a
|
|
@@ -35,13 +35,11 @@ exports.maxCheckCommandLength = 1000;
|
|
|
35
35
|
/** Output kept from a run (its TAIL — the end of a log is where the failure is). */
|
|
36
36
|
exports.checkOutputMaxChars = 3000;
|
|
37
37
|
/**
|
|
38
|
-
* Output tail shown in the topic alert. Shorter than {@link checkOutputMaxChars}
|
|
39
|
-
* so the alert stays under Telegram's 4096-character message cap with the
|
|
40
|
-
*
|
|
38
|
+
* Output tail shown (folded) in the topic alert. Shorter than {@link checkOutputMaxChars}
|
|
39
|
+
* so the alert stays well under Telegram's 4096-character message cap with the
|
|
40
|
+
* job name and the failure around it; the agent gets the full kept tail.
|
|
41
41
|
*/
|
|
42
42
|
exports.checkAlertOutputMaxChars = 1500;
|
|
43
|
-
/** Command text shown in the topic alert. */
|
|
44
|
-
const checkAlertCommandMaxChars = 300;
|
|
45
43
|
/** Pause between SIGTERM and SIGKILL for a check that outlived its timeout. */
|
|
46
44
|
const checkKillGraceMs = 5000;
|
|
47
45
|
/** Environment variables a check never sees: its output is posted into the topic. */
|
|
@@ -54,7 +52,7 @@ function checkIsCheckPassing(result) {
|
|
|
54
52
|
* @description Alert on the passing → failing edge only, and announce the
|
|
55
53
|
* failing → passing edge once. A check that keeps failing stays quiet: it already
|
|
56
54
|
* raised its alert and woke the agent, and repeating that on every run would bury
|
|
57
|
-
* the topic in
|
|
55
|
+
* the topic in alerts.
|
|
58
56
|
*/
|
|
59
57
|
function getCheckAlertDecision(input) {
|
|
60
58
|
if (input.isPassing)
|
|
@@ -77,12 +75,6 @@ function getOutputTail(text, maxChars) {
|
|
|
77
75
|
return text;
|
|
78
76
|
return `…${text.slice(text.length - maxChars + 1)}`;
|
|
79
77
|
}
|
|
80
|
-
/** @description The command as the topic alert shows it, cut to a readable length. */
|
|
81
|
-
function getCheckAlertCommand(command) {
|
|
82
|
-
return command.length <= checkAlertCommandMaxChars
|
|
83
|
-
? command
|
|
84
|
-
: `${command.slice(0, checkAlertCommandMaxChars - 1)}…`;
|
|
85
|
-
}
|
|
86
78
|
/**
|
|
87
79
|
* @description The prompt the agent is woken with: what failed and how, the
|
|
88
80
|
* output tail, then the job's own prompt (what to do about it). English, like the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkRun.js","sourceRoot":"","sources":["../../src/scheduler/checkRun.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"checkRun.js","sourceRoot":"","sources":["../../src/scheduler/checkRun.ts"],"names":[],"mappings":";;;AA6DA,kDAEC;AAcD,sDAGC;AAGD,oDAKC;AAGD,sCAGC;AAOD,0DAqBC;AAGD,sCAIC;AASD,0CAyDC;AAnMD,2DAA2C;AAE3C;;;;;;;;;;;;;;;;GAgBG;AAEH,+EAA+E;AAClE,QAAA,sBAAsB,GAAG,EAAE,CAAC;AAEzC,2EAA2E;AAC9D,QAAA,kBAAkB,GAAG,GAAG,CAAC;AAEtC,uCAAuC;AAC1B,QAAA,qBAAqB,GAAG,IAAI,CAAC;AAE1C,oFAAoF;AACvE,QAAA,mBAAmB,GAAG,IAAI,CAAC;AAExC;;;;GAIG;AACU,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAE7C,+EAA+E;AAC/E,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,qFAAqF;AACrF,MAAM,mBAAmB,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAiBnD,0EAA0E;AAC1E,SAAgB,mBAAmB,CAAC,MAAsB;IACxD,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,CAAC;AACxF,CAAC;AAQD;;;;;GAK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CAAC"}
|
|
@@ -41,11 +41,6 @@ export declare function checkIsCheckStatusDue(input: {
|
|
|
41
41
|
}): boolean;
|
|
42
42
|
/** @description The instant a check's next line is counted from: its last line, else its creation. */
|
|
43
43
|
export declare function getCheckStatusSinceMs(job: Pick<ScheduleRecord, 'lastStatusAt' | 'createdAt'>): number;
|
|
44
|
-
/**
|
|
45
|
-
* @description Whether this is the LAST run the job will ever make (a `once` job, or the final run of an N-times cron): its
|
|
46
|
-
* line would be deleted at once by the finished check, so none is posted and the existing one goes.
|
|
47
|
-
*/
|
|
48
|
-
export declare function checkIsFinalCheckRun(job: Pick<ScheduleRecord, 'spec'>): boolean;
|
|
49
44
|
/**
|
|
50
45
|
* @description The ONE gate that decides whether a topic shows status lines: a Telegram conversation (a tracker issue gets no
|
|
51
46
|
* message, no comment, no edited note) whose view shows the agent's stream — the answers-only view shows nothing but answers.
|
|
@@ -66,6 +61,8 @@ export declare function formatCheckStatusActivity(text: string): string | null;
|
|
|
66
61
|
export declare function getCheckStatusActivityFromOutput(output: string): string | null;
|
|
67
62
|
/** @description «N min» under an hour, «H h M min» from an hour on (rounded to the nearest minute). */
|
|
68
63
|
export declare function getCheckStatusElapsedText(elapsedMs: number): string;
|
|
64
|
+
/** @description A check's name as the topic shows it: without the recipe's leading `watch ` (`watch builder S2` → `builder S2`). */
|
|
65
|
+
export declare function getCheckShownName(name: string): string;
|
|
69
66
|
/**
|
|
70
67
|
* @description The status line: `⏳ <name> · works <elapsed>[ · now: <activity>]`. The name is the check's own without the
|
|
71
68
|
* recipe's leading `watch `; the «now» part is left out when there is nothing readable to say.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkStatus.d.ts","sourceRoot":"","sources":["../../src/scheduler/checkStatus.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C;;;;;;;GAOG;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IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,MAAM,CAMhH"}
|
|
@@ -4,11 +4,11 @@ exports.checkStatusActivityMaxChars = exports.checkStatusSlackMs = exports.check
|
|
|
4
4
|
exports.getCheckStatusIntervalMs = getCheckStatusIntervalMs;
|
|
5
5
|
exports.checkIsCheckStatusDue = checkIsCheckStatusDue;
|
|
6
6
|
exports.getCheckStatusSinceMs = getCheckStatusSinceMs;
|
|
7
|
-
exports.checkIsFinalCheckRun = checkIsFinalCheckRun;
|
|
8
7
|
exports.checkIsCheckStatusShown = checkIsCheckStatusShown;
|
|
9
8
|
exports.formatCheckStatusActivity = formatCheckStatusActivity;
|
|
10
9
|
exports.getCheckStatusActivityFromOutput = getCheckStatusActivityFromOutput;
|
|
11
10
|
exports.getCheckStatusElapsedText = getCheckStatusElapsedText;
|
|
11
|
+
exports.getCheckShownName = getCheckShownName;
|
|
12
12
|
exports.buildCheckStatusLine = buildCheckStatusLine;
|
|
13
13
|
const i18n_1 = require("../i18n");
|
|
14
14
|
const surrogateSafeCut_1 = require("../utils/surrogateSafeCut");
|
|
@@ -63,14 +63,6 @@ function checkIsCheckStatusDue(input) {
|
|
|
63
63
|
function getCheckStatusSinceMs(job) {
|
|
64
64
|
return job.lastStatusAt ?? Date.parse(job.createdAt);
|
|
65
65
|
}
|
|
66
|
-
/**
|
|
67
|
-
* @description Whether this is the LAST run the job will ever make (a `once` job, or the final run of an N-times cron): its
|
|
68
|
-
* line would be deleted at once by the finished check, so none is posted and the existing one goes.
|
|
69
|
-
*/
|
|
70
|
-
function checkIsFinalCheckRun(job) {
|
|
71
|
-
const { spec } = job;
|
|
72
|
-
return spec.kind === 'once' || (typeof spec.remainingRuns === 'number' && spec.remainingRuns <= 1);
|
|
73
|
-
}
|
|
74
66
|
/**
|
|
75
67
|
* @description The ONE gate that decides whether a topic shows status lines: a Telegram conversation (a tracker issue gets no
|
|
76
68
|
* message, no comment, no edited note) whose view shows the agent's stream — the answers-only view shows nothing but answers.
|
|
@@ -107,14 +99,17 @@ function getCheckStatusElapsedText(elapsedMs) {
|
|
|
107
99
|
minutes: totalMinutes % minutesPerHour,
|
|
108
100
|
});
|
|
109
101
|
}
|
|
102
|
+
/** @description A check's name as the topic shows it: without the recipe's leading `watch ` (`watch builder S2` → `builder S2`). */
|
|
103
|
+
function getCheckShownName(name) {
|
|
104
|
+
return name.replace(leadingWatchWordPattern, '').trim() || name;
|
|
105
|
+
}
|
|
110
106
|
/**
|
|
111
107
|
* @description The status line: `⏳ <name> · works <elapsed>[ · now: <activity>]`. The name is the check's own without the
|
|
112
108
|
* recipe's leading `watch `; the «now» part is left out when there is nothing readable to say.
|
|
113
109
|
*/
|
|
114
110
|
function buildCheckStatusLine(input) {
|
|
115
|
-
const shownName = input.name.replace(leadingWatchWordPattern, '').trim() || input.name;
|
|
116
111
|
return (0, i18n_1.t)('schedule.statusLineText', {
|
|
117
|
-
name:
|
|
112
|
+
name: getCheckShownName(input.name),
|
|
118
113
|
elapsed: getCheckStatusElapsedText(input.elapsedMs),
|
|
119
114
|
activity: input.activity === null ? '' : (0, i18n_1.t)('schedule.statusLineActivity', { activity: input.activity }),
|
|
120
115
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkStatus.js","sourceRoot":"","sources":["../../src/scheduler/checkStatus.ts"],"names":[],"mappings":";;;AAqDA,4DAEC;AAMD,sDAGC;AAGD,sDAEC;AAMD,
|
|
1
|
+
{"version":3,"file":"checkStatus.js","sourceRoot":"","sources":["../../src/scheduler/checkStatus.ts"],"names":[],"mappings":";;;AAqDA,4DAEC;AAMD,sDAGC;AAGD,sDAEC;AAMD,0DAEC;AAMD,8DAKC;AAMD,4EAGC;AAGD,8DAOC;AAGD,8CAEC;AAMD,oDAMC;AA5HD,kCAA4B;AAC5B,gEAAiE;AACjE,kDAAwD;AAIxD;;;;;;;G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D,OAAO,EAAE,YAAY,GAAG,cAAc;KACvC,CAAC,CAAC;AACL,CAAC;AAED,oIAAoI;AACpI,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;AAClE,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,KAAmE;IACtG,OAAO,IAAA,QAAC,EAAC,yBAAyB,EAAE;QAClC,IAAI,EAAE,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC;QACnC,OAAO,EAAE,yBAAyB,CAAC,KAAK,CAAC,SAAS,CAAC;QACnD,QAAQ,EAAE,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,QAAC,EAAC,6BAA6B,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;KACxG,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -5,11 +5,10 @@ import { type PostToSessionDeps } from '../postToSession';
|
|
|
5
5
|
* @description Scheduler delivery (plan S4): the real `deliver(job, fireContext)`
|
|
6
6
|
* callback the engine (S3) invokes at fire time. The flow is locked by the plan:
|
|
7
7
|
*
|
|
8
|
-
* 1. announce — post a
|
|
9
|
-
* schedule
|
|
10
|
-
*
|
|
11
|
-
* default
|
|
12
|
-
* and the flow continues — the announcement is already visible.
|
|
8
|
+
* 1. announce — post a SILENT message into the topic: «⏰ Scheduled: <name> ·
|
|
9
|
+
* <human schedule>» (+ a "missed at HH:MM" note for a catch-up run), with the
|
|
10
|
+
* prompt folded under it (an agent instruction, not something to read by
|
|
11
|
+
* default). Never pinned: a scheduled run is ordinary output.
|
|
13
12
|
* 3–4. post the prefixed prompt to the session ({@link postToSession}, shared
|
|
14
13
|
* with the Jira connector): ensure a session (starting one with the job's
|
|
15
14
|
* `lastAdapterName` snapshot as the adapter fallback — a topic that never
|
|
@@ -18,19 +17,21 @@ import { type PostToSessionDeps } from '../postToSession';
|
|
|
18
17
|
* unbound topic → outcome `failed` with a distinct error string the engine
|
|
19
18
|
* records (S8 turns that into a pause).
|
|
20
19
|
*
|
|
21
|
-
* A REMINDER record (`deliveryKind: 'reminder'`)
|
|
22
|
-
* delivery IS the announcement plus its pin, which is what pierces a
|
|
23
|
-
* Steps 3–4 are skipped entirely, so a reminder
|
|
24
|
-
* General — there is no session to ensure,
|
|
25
|
-
* tell about the run.
|
|
20
|
+
* A REMINDER record (`deliveryKind: 'reminder'`) is the one thing still pinned:
|
|
21
|
+
* its whole delivery IS the announcement plus its pin, which is what pierces a
|
|
22
|
+
* muted topic, and it stops there. Steps 3–4 are skipped entirely, so a reminder
|
|
23
|
+
* fires in an unbound topic and in General — there is no session to ensure,
|
|
24
|
+
* nothing to interrupt, and no agent to tell about the run.
|
|
26
25
|
*
|
|
27
26
|
* A CHECK record (`deliveryKind: 'check'`) runs its command FIRST and decides
|
|
28
27
|
* from the result and its persisted failing flag: a pass after a pass, or a
|
|
29
28
|
* failure after a failure, posts nothing; a pass after a failure posts one
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* "is back to normal" line; the first failure posts a one-sentence silent notice
|
|
30
|
+
* (never the command; a worker watch says "finished" or "silent", any other check
|
|
31
|
+
* folds the output under "fired") and then wakes the agent through steps 3–4 with
|
|
32
|
+
* the command, the failure details and the output ahead of the job's prompt. An
|
|
33
|
+
* unbound topic fails with the same distinct error as a prompt job, so it is
|
|
34
|
+
* paused the same way.
|
|
34
35
|
*
|
|
35
36
|
* It owns NO bot.ts import: every side effect is injected via
|
|
36
37
|
* {@link ScheduleDeliveryDeps} (announce / pin / busy probe / ensure-session /
|
|
@@ -39,6 +40,24 @@ import { type PostToSessionDeps } from '../postToSession';
|
|
|
39
40
|
*/
|
|
40
41
|
/** Distinct error string the engine records when a fire hits an unbound topic. */
|
|
41
42
|
export declare const unboundDeliveryError = "thread is unbound";
|
|
43
|
+
/**
|
|
44
|
+
* @name ScheduleAnnounceOptions
|
|
45
|
+
* @description How a topic message of the scheduler is sent.
|
|
46
|
+
*/
|
|
47
|
+
export interface ScheduleAnnounceOptions {
|
|
48
|
+
/** Send without a notification: the bot's ordinary output. Absent only for a reminder, which is meant to ring. */
|
|
49
|
+
isSilent?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Text folded under the message: the reader opens it on demand (Telegram: an expandable quote). Plain text — the
|
|
52
|
+
* platform escapes it.
|
|
53
|
+
*/
|
|
54
|
+
foldedDetail?: string;
|
|
55
|
+
}
|
|
56
|
+
/** @name ScheduleAnnouncement @description What a fire or an alert says in the topic: the sentence, and the detail folded under it. */
|
|
57
|
+
export interface ScheduleAnnouncement {
|
|
58
|
+
text: string;
|
|
59
|
+
foldedDetail?: string;
|
|
60
|
+
}
|
|
42
61
|
/**
|
|
43
62
|
* @name ScheduleDeliveryDeps
|
|
44
63
|
* @description Everything the delivery callback needs from bot.ts, injected so
|
|
@@ -48,19 +67,24 @@ export declare const unboundDeliveryError = "thread is unbound";
|
|
|
48
67
|
*/
|
|
49
68
|
export interface ScheduleDeliveryDeps extends PostToSessionDeps {
|
|
50
69
|
/**
|
|
51
|
-
* Post
|
|
52
|
-
* `
|
|
53
|
-
|
|
70
|
+
* Post a message into the topic (the bot bakes in priority `'interactive'`). Resolves with the sent message id, or
|
|
71
|
+
* `null` when the send failed — a reminder's pin is skipped on `null`.
|
|
72
|
+
*/
|
|
73
|
+
announce: (threadKey: string, text: string, options?: ScheduleAnnounceOptions) => Promise<number | null>;
|
|
74
|
+
/** Pin a REMINDER's announcement, notifying (that is how a reminder pierces a muted topic). Rejects on failure. */
|
|
75
|
+
pin: (threadKey: string, messageId: number) => Promise<void>;
|
|
76
|
+
/**
|
|
77
|
+
* Unpin these messages of the topic and resolve with the ids that are STILL pinned and worth another try (Telegram did not
|
|
78
|
+
* answer, asked to slow down, failed on its side). A message that is gone, was never pinned or cannot be unpinned any more
|
|
79
|
+
* is final, so it is not in the list. Never rejects.
|
|
54
80
|
*/
|
|
55
|
-
|
|
56
|
-
/** Pin the announcement. `isSilent` ⇒ `disable_notification`. Rejects on failure. */
|
|
57
|
-
pin: (threadKey: string, messageId: number, isSilent: boolean) => Promise<void>;
|
|
81
|
+
unpinMessages: (threadKey: string, messageIds: readonly number[]) => Promise<number[]>;
|
|
58
82
|
/** Run a check job's command in the thread's bound folder; `null` when the thread is unbound. */
|
|
59
83
|
runCheck: (threadKey: string, command: string, timeoutMs: number) => Promise<CheckRunResult | null>;
|
|
60
84
|
/** Persist a check job's failing flag (it decides whether the next run alerts). */
|
|
61
85
|
setCheckFailing: (jobId: string, isFailing: boolean) => Promise<void>;
|
|
62
|
-
/**
|
|
63
|
-
|
|
86
|
+
/** Forget these alert pins of an earlier version on a job (`ScheduleRecord.alertPinMessageIds`), once they are unpinned. */
|
|
87
|
+
clearAlertPins: (jobId: string, releasedMessageIds: readonly number[]) => Promise<void>;
|
|
64
88
|
/** Whether this conversation shows status lines at all (a Telegram topic whose view shows the agent's stream). */
|
|
65
89
|
checkIsStatusShown: (threadKey: string) => boolean;
|
|
66
90
|
/**
|
|
@@ -94,23 +118,41 @@ export declare function prependScheduledRunMarker(jobName: string, prompt: strin
|
|
|
94
118
|
dueAtMs?: number;
|
|
95
119
|
}): string;
|
|
96
120
|
/**
|
|
97
|
-
* @description Build the visible fire
|
|
98
|
-
*
|
|
99
|
-
* reminder leads with its own text (the pin notification previews it, so the
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* instant) for a `catch-up` fire, empty for an `on-time` run — so a replayed run
|
|
103
|
-
* is annotated identically whichever kind it is.
|
|
121
|
+
* @description Build the visible fire announcement via i18n, per delivery kind. A prompt job says «⏰ Scheduled: <name> ·
|
|
122
|
+
* <schedule>» and folds its prompt under it: the prompt is an instruction for the agent, not something a person reads by
|
|
123
|
+
* default. A reminder leads with its own text (the pin notification previews it, so the operator reads the reminder
|
|
124
|
+
* without opening the topic) and carries nothing folded. Both interpolate the SAME `{missedNote}` — the catch-up annotation
|
|
125
|
+
* (host-local HH:MM of the missed instant) for a `catch-up` fire, empty for an `on-time` run.
|
|
104
126
|
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
|
|
109
|
-
|
|
127
|
+
* A reminder's `{schedule}` is always the LOCALIZED {@link getReminderScheduleText} — the very same words its `/reminders`
|
|
128
|
+
* list row and card show, because describing one reminder two different ways is a defect. A prompt job's goes through
|
|
129
|
+
* {@link getAnnouncedScheduleText}, which counts the next run from `nowMs` where nothing phrases the shape.
|
|
130
|
+
*/
|
|
131
|
+
export declare function buildFireAnnouncement(job: ScheduleRecord, fireContext: FireContext, nowMs: number): ScheduleAnnouncement;
|
|
132
|
+
/**
|
|
133
|
+
* @name CheckFailedAnnouncementInput
|
|
134
|
+
* @description What the notice of a check's first failure is built from: the job, the failed run, its short description
|
|
135
|
+
* ({@link describeCheckFailure}) and the instant the notice is made at (how long a worker ran).
|
|
136
|
+
*/
|
|
137
|
+
export interface CheckFailedAnnouncementInput {
|
|
138
|
+
job: ScheduleRecord;
|
|
139
|
+
result: CheckRunResult;
|
|
140
|
+
failure: string;
|
|
141
|
+
nowMs: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @description The topic notice of a check's first failure, in one sentence and never with the command (that goes to the
|
|
145
|
+
* agent's prompt only). A worker watch (a check with a status source of a worker's run directory) says what happened to
|
|
146
|
+
* the worker: finished (its process is gone) or silent for {@link workerWatchSilenceMinutes} minutes. Any other check — and a
|
|
147
|
+
* worker watch that failed some other way, a timeout say — says it fired, with what failed and the output tail folded under
|
|
148
|
+
* it, because the failure is the only thing a person can use to tell why.
|
|
149
|
+
*/
|
|
150
|
+
export declare function buildCheckFailedAnnouncement(input: CheckFailedAnnouncementInput): ScheduleAnnouncement;
|
|
151
|
+
/**
|
|
152
|
+
* @description The line for a check that passes again, in the words of its failure notice: a worker watch speaks of the worker
|
|
153
|
+
* (and its shown name, without the recipe's `watch `), any other check of the check.
|
|
110
154
|
*/
|
|
111
|
-
export declare function
|
|
112
|
-
/** @description The topic alert of a check's first failure: what failed, how, and the output tail. */
|
|
113
|
-
export declare function buildCheckFailedAnnouncement(job: ScheduleRecord, fireContext: FireContext, failure: string, output: string): string;
|
|
155
|
+
export declare function buildCheckRecoveredText(job: ScheduleRecord): string;
|
|
114
156
|
/**
|
|
115
157
|
* @description Take a job's status line out of the topic and out of its record — the ONE place that does it, for a failed or
|
|
116
158
|
* unbound run, a topic that stopped showing the stream, a final run, and the `/unbind` pause (`unbindPause.ts`). The record is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../../src/scheduler/delivery.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"delivery.d.ts","sourceRoot":"","sources":["../../src/scheduler/delivery.ts"],"names":[],"mappings":"AAGA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAcpB,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7F,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,kHAAkH;IAClH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,uIAAuI;AACvI,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAi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