charness 4.0.0 → 4.1.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 +18 -0
- package/DEVELOPMENT.md +2 -1
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +2 -0
- package/agent-plugin/skills/charness-orchestration/SKILL.md +5 -0
- package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeCliAdapter.js +3 -2
- package/dist/adapters/claudeCliAdapter.js.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.d.ts +1 -0
- package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +19 -4
- package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
- package/dist/adapters/openCodeAdapter.d.ts +1 -0
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +11 -0
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +268 -268
- package/dist/bot.js.map +1 -1
- package/dist/connectors/telegram/answerSink.d.ts +12 -0
- package/dist/connectors/telegram/answerSink.d.ts.map +1 -1
- package/dist/connectors/telegram/answerSink.js +23 -0
- package/dist/connectors/telegram/answerSink.js.map +1 -1
- package/dist/connectors/telegram/botApiConnection.d.ts +2 -1
- package/dist/connectors/telegram/botApiConnection.d.ts.map +1 -1
- package/dist/connectors/telegram/botApiConnection.js +19 -1
- package/dist/connectors/telegram/botApiConnection.js.map +1 -1
- package/dist/connectors/telegram/commands/botCore.d.ts +13 -5
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.d.ts +1 -1
- package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.js +9 -5
- package/dist/connectors/telegram/commands/runners.js.map +1 -1
- package/dist/connectors/telegram/outbound.d.ts +1 -1
- package/dist/connectors/telegram/outbound.d.ts.map +1 -1
- package/dist/connectors/telegram/outbound.js +3 -1
- package/dist/connectors/telegram/outbound.js.map +1 -1
- package/dist/connectors/telegram/outputBacklogGlue.d.ts +1 -1
- package/dist/connectors/telegram/outputBacklogGlue.js +1 -1
- package/dist/connectors/telegram/outputFlushPlan.d.ts +23 -8
- package/dist/connectors/telegram/outputFlushPlan.d.ts.map +1 -1
- package/dist/connectors/telegram/outputFlushPlan.js +22 -13
- package/dist/connectors/telegram/outputFlushPlan.js.map +1 -1
- package/dist/connectors/telegram/pinnedNoticeSlot.d.ts +31 -0
- package/dist/connectors/telegram/pinnedNoticeSlot.d.ts.map +1 -0
- package/dist/connectors/telegram/pinnedNoticeSlot.js +43 -0
- package/dist/connectors/telegram/pinnedNoticeSlot.js.map +1 -0
- package/dist/connectors/telegram/sendOutcome.d.ts +48 -0
- package/dist/connectors/telegram/sendOutcome.d.ts.map +1 -0
- package/dist/connectors/telegram/sendOutcome.js +49 -0
- package/dist/connectors/telegram/sendOutcome.js.map +1 -0
- package/dist/connectors/telegram/telegramFailureRetry.d.ts +9 -0
- package/dist/connectors/telegram/telegramFailureRetry.d.ts.map +1 -0
- package/dist/connectors/telegram/telegramFailureRetry.js +21 -0
- package/dist/connectors/telegram/telegramFailureRetry.js.map +1 -0
- package/dist/connectors/telegram/unpinMessages.d.ts +1 -1
- package/dist/connectors/telegram/unpinMessages.d.ts.map +1 -1
- package/dist/connectors/telegram/unpinMessages.js +3 -18
- package/dist/connectors/telegram/unpinMessages.js.map +1 -1
- package/dist/hooks/claudeSkillsRestoreHook.d.ts +105 -0
- package/dist/hooks/claudeSkillsRestoreHook.d.ts.map +1 -0
- package/dist/hooks/claudeSkillsRestoreHook.js +276 -0
- package/dist/hooks/claudeSkillsRestoreHook.js.map +1 -0
- package/dist/platform/outbound.d.ts +4 -1
- package/dist/platform/outbound.d.ts.map +1 -1
- package/dist/platform/outbound.js.map +1 -1
- package/dist/rateLimiter.d.ts +33 -1
- package/dist/rateLimiter.d.ts.map +1 -1
- package/dist/rateLimiter.js +91 -5
- package/dist/rateLimiter.js.map +1 -1
- package/dist/runnerUtility/pueueDaemon.d.ts +7 -13
- package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
- package/dist/runnerUtility/pueueDaemon.js +8 -27
- package/dist/runnerUtility/pueueDaemon.js.map +1 -1
- package/dist/selfUpdate/selfCheck.d.ts.map +1 -1
- package/dist/selfUpdate/selfCheck.js +1 -1
- package/dist/selfUpdate/selfCheck.js.map +1 -1
- package/dist/testTimings.d.ts +4 -2
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +4 -1
- package/dist/testTimings.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agentPlugin.d.ts +7 -0
- package/dist/utils/agentPlugin.d.ts.map +1 -1
- package/dist/utils/agentPlugin.js +12 -0
- package/dist/utils/agentPlugin.js.map +1 -1
- package/dist/utils/claudeCompactHook.d.ts +73 -10
- package/dist/utils/claudeCompactHook.d.ts.map +1 -1
- package/dist/utils/claudeCompactHook.js +96 -17
- package/dist/utils/claudeCompactHook.js.map +1 -1
- package/dist/utils/claudeProfiles.d.ts +8 -0
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +12 -2
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeTranscriptEpoch.d.ts +15 -0
- package/dist/utils/claudeTranscriptEpoch.d.ts.map +1 -0
- package/dist/utils/claudeTranscriptEpoch.js +120 -0
- package/dist/utils/claudeTranscriptEpoch.js.map +1 -0
- package/dist/utils/clearStatusCoalescer.d.ts +24 -0
- package/dist/utils/clearStatusCoalescer.d.ts.map +1 -0
- package/dist/utils/clearStatusCoalescer.js +25 -0
- package/dist/utils/clearStatusCoalescer.js.map +1 -0
- package/dist/utils/compactOnIdle.d.ts +91 -34
- package/dist/utils/compactOnIdle.d.ts.map +1 -1
- package/dist/utils/compactOnIdle.js +149 -31
- package/dist/utils/compactOnIdle.js.map +1 -1
- package/dist/utils/groupOutputBacklog.d.ts +90 -0
- package/dist/utils/groupOutputBacklog.d.ts.map +1 -0
- package/dist/utils/groupOutputBacklog.js +134 -0
- package/dist/utils/groupOutputBacklog.js.map +1 -0
- package/dist/utils/messageSendService.d.ts +26 -3
- package/dist/utils/messageSendService.d.ts.map +1 -1
- package/dist/utils/messageSendService.js +35 -3
- package/dist/utils/messageSendService.js.map +1 -1
- package/dist/utils/openCodeCompactPlugin.d.ts +33 -0
- package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
- package/dist/utils/openCodeCompactPlugin.js +192 -1
- package/dist/utils/openCodeCompactPlugin.js.map +1 -1
- package/dist/utils/skillsRestore.d.ts +235 -0
- package/dist/utils/skillsRestore.d.ts.map +1 -0
- package/dist/utils/skillsRestore.js +515 -0
- package/dist/utils/skillsRestore.js.map +1 -0
- package/dist/utils/statusFlushDecision.js +1 -1
- package/dist/utils/streamedCompactionSummary.d.ts +4 -4
- package/dist/utils/streamedCompactionSummary.js +5 -5
- package/dist/utils/streamedCompactionSummary.js.map +1 -1
- package/dist/utils/streamedOutputLanding.d.ts +14 -0
- package/dist/utils/streamedOutputLanding.d.ts.map +1 -0
- package/dist/utils/streamedOutputLanding.js +45 -0
- package/dist/utils/streamedOutputLanding.js.map +1 -0
- package/dist/utils/typingLoopBackstop.d.ts +8 -7
- package/dist/utils/typingLoopBackstop.d.ts.map +1 -1
- package/dist/utils/typingLoopBackstop.js +6 -5
- package/dist/utils/typingLoopBackstop.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/dist/utils/clearThreadOutputQueues.d.ts +0 -44
- package/dist/utils/clearThreadOutputQueues.d.ts.map +0 -1
- package/dist/utils/clearThreadOutputQueues.js +0 -39
- package/dist/utils/clearThreadOutputQueues.js.map +0 -1
- package/dist/utils/groupFinalizePlan.d.ts +0 -36
- package/dist/utils/groupFinalizePlan.d.ts.map +0 -1
- package/dist/utils/groupFinalizePlan.js +0 -31
- package/dist/utils/groupFinalizePlan.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description The longest the bot waits for the text an agent streamed before a tool call to land in the topic before it posts
|
|
3
|
+
* what the call asks for (its answer, its messages, its question). The landing may take as long as Telegram does — a long text
|
|
4
|
+
* goes out in several paced messages — but a send that never finishes must not hold the agent's tool call, and with it its
|
|
5
|
+
* turn, for ever: a misplaced answer is better than a stuck agent.
|
|
6
|
+
*/
|
|
7
|
+
export declare const streamedOutputLandingLimitMs = 60000;
|
|
8
|
+
/**
|
|
9
|
+
* @description Start `land` now and resolve when it is over — it landed, it failed (logged, never thrown at the caller) or
|
|
10
|
+
* {@link streamedOutputLandingLimitMs} passed (warned about; the landing goes on in the background and its late end changes
|
|
11
|
+
* nothing). `owner` names the conversation in the log lines. Never rejects, so a caller may start it and await it later.
|
|
12
|
+
*/
|
|
13
|
+
export declare function landStreamedOutputWithinLimit(land: () => Promise<void>, owner: string): Promise<void>;
|
|
14
|
+
//# sourceMappingURL=streamedOutputLanding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamedOutputLanding.d.ts","sourceRoot":"","sources":["../../src/utils/streamedOutputLanding.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,QAAS,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BrG"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.streamedOutputLandingLimitMs = void 0;
|
|
4
|
+
exports.landStreamedOutputWithinLimit = landStreamedOutputWithinLimit;
|
|
5
|
+
/**
|
|
6
|
+
* @description The longest the bot waits for the text an agent streamed before a tool call to land in the topic before it posts
|
|
7
|
+
* what the call asks for (its answer, its messages, its question). The landing may take as long as Telegram does — a long text
|
|
8
|
+
* goes out in several paced messages — but a send that never finishes must not hold the agent's tool call, and with it its
|
|
9
|
+
* turn, for ever: a misplaced answer is better than a stuck agent.
|
|
10
|
+
*/
|
|
11
|
+
exports.streamedOutputLandingLimitMs = 60_000;
|
|
12
|
+
/**
|
|
13
|
+
* @description Start `land` now and resolve when it is over — it landed, it failed (logged, never thrown at the caller) or
|
|
14
|
+
* {@link streamedOutputLandingLimitMs} passed (warned about; the landing goes on in the background and its late end changes
|
|
15
|
+
* nothing). `owner` names the conversation in the log lines. Never rejects, so a caller may start it and await it later.
|
|
16
|
+
*/
|
|
17
|
+
function landStreamedOutputWithinLimit(land, owner) {
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
const limitTimer = setTimeout(() => {
|
|
20
|
+
console.warn(`[send] ${owner}: the streamed text was still going out ${exports.streamedOutputLandingLimitMs / 1000} s after it was asked for — going on without waiting for it`);
|
|
21
|
+
resolve();
|
|
22
|
+
}, exports.streamedOutputLandingLimitMs);
|
|
23
|
+
const reportFailure = (error) => {
|
|
24
|
+
console.error(`[send] ${owner}: the streamed text could not be landed before what follows it:`, error instanceof Error ? error.message : error);
|
|
25
|
+
};
|
|
26
|
+
const finish = () => {
|
|
27
|
+
clearTimeout(limitTimer);
|
|
28
|
+
resolve();
|
|
29
|
+
};
|
|
30
|
+
let landing;
|
|
31
|
+
try {
|
|
32
|
+
landing = land();
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
reportFailure(error instanceof Error ? error : String(error));
|
|
36
|
+
finish();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
landing.then(finish, (error) => {
|
|
40
|
+
reportFailure(error instanceof Error ? error : String(error));
|
|
41
|
+
finish();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=streamedOutputLanding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streamedOutputLanding.js","sourceRoot":"","sources":["../../src/utils/streamedOutputLanding.ts"],"names":[],"mappings":";;;AAaA,sEA0BC;AAvCD;;;;;GAKG;AACU,QAAA,4BAA4B,GAAG,MAAM,CAAC;AAEnD;;;;GAIG;AACH,SAAgB,6BAA6B,CAAC,IAAyB,EAAE,KAAa;IACpF,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;QACnC,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,EAAE;YACjC,OAAO,CAAC,IAAI,CAAC,UAAU,KAAK,2CAA2C,oCAA4B,GAAG,IAAI,6DAA6D,CAAC,CAAC;YACzK,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,oCAA4B,CAAC,CAAC;QACjC,MAAM,aAAa,GAAG,CAAC,KAA2D,EAAQ,EAAE;YAC1F,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,iEAAiE,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAClJ,CAAC,CAAC;QACF,MAAM,MAAM,GAAG,GAAS,EAAE;YACxB,YAAY,CAAC,UAAU,CAAC,CAAC;YACzB,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QACF,IAAI,OAAsB,CAAC;QAC3B,IAAI,CAAC;YACH,OAAO,GAAG,IAAI,EAAE,CAAC;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,aAAa,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9D,MAAM,EAAE,CAAC;YACT,OAAO;QACT,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAC7B,aAAa,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC9D,MAAM,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* `checkShouldKeepTyping` (`isOutputStreaming || isAdapterBusy`) goes false, and
|
|
8
8
|
* has NO absolute bound. `jsonStreamBusyWatchdog` already covers a stuck
|
|
9
9
|
* `isBusy` (a missed terminal `result`). This backstop covers the OTHER input:
|
|
10
|
-
* `isOutputStreaming`, which reads
|
|
11
|
-
* q.debounceTimer !== null
|
|
10
|
+
* `isOutputStreaming`, which reads "the backlog holds text || it is sending ||
|
|
11
|
+
* q.debounceTimer !== null". A leaked non-null `debounceTimer` (the `isFinal`
|
|
12
12
|
* fast-path in `queueOutput` cleared the timer but left the handle set) pins
|
|
13
13
|
* `isOutputStreaming` true forever → the indicator hangs unbounded even though
|
|
14
14
|
* the output queue is empty (live 2026-07-19, a json-stream group topic firing
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
* and on OpenCode it sets no busy flag at all → vetoed;
|
|
23
23
|
* - a live DM draft is a real stream (`isTransportStreaming`) → vetoed;
|
|
24
24
|
* - real text waiting to send (`hasPendingOutput`) or an in-flight send
|
|
25
|
-
* (`isProcessing
|
|
25
|
+
* (`isProcessing`: the backlog's send loop runs, which may legitimately be a
|
|
26
|
+
* slow API call) → vetoed.
|
|
26
27
|
* Only when the adapter is idle, nothing is drafting, the queue is empty AND an
|
|
27
28
|
* un-fired debounce handle lingers does it fire. A LIVE debounce is ALWAYS armed
|
|
28
|
-
* WITH pending text (both `queueOutput` and
|
|
29
|
-
*
|
|
29
|
+
* WITH pending text (both `queueOutput` and the retry of text a failure put back
|
|
30
|
+
* arm it only when the backlog holds text, nulling it the instant it fires), so "debounce armed +
|
|
30
31
|
* empty queue" can only be the dead/stale handle from the leak — never a real
|
|
31
32
|
* in-flight turn. The decision is therefore safe by construction: it truncates a
|
|
32
33
|
* leak, never work.
|
|
@@ -45,9 +46,9 @@ export interface TypingLoopBackstopInput {
|
|
|
45
46
|
isCompacting: boolean;
|
|
46
47
|
/** The output transport (DM draft cursor) reports an active live stream. */
|
|
47
48
|
isTransportStreaming: boolean;
|
|
48
|
-
/**
|
|
49
|
+
/** The topic's output backlog holds text (`checkHasPendingOutput`) — real agent text still waiting to be sent. */
|
|
49
50
|
hasPendingOutput: boolean;
|
|
50
|
-
/** `q.
|
|
51
|
+
/** `q.isDraining` — the backlog's send loop is awaiting a send (possibly slow). */
|
|
51
52
|
isProcessing: boolean;
|
|
52
53
|
/** `q.debounceTimer !== null` — a debounce timer HANDLE is present. */
|
|
53
54
|
hasDebounceTimer: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typingLoopBackstop.d.ts","sourceRoot":"","sources":["../../src/utils/typingLoopBackstop.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"typingLoopBackstop.d.ts","sourceRoot":"","sources":["../../src/utils/typingLoopBackstop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,MAAM,WAAW,uBAAuB;IACtC,iFAAiF;IACjF,aAAa,EAAE,OAAO,CAAC;IACvB;;;;;;;OAOG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB,4EAA4E;IAC5E,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kHAAkH;IAClH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,mFAAmF;IACnF,YAAY,EAAE,OAAO,CAAC;IACtB,uEAAuE;IACvE,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAiBhF"}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* `checkShouldKeepTyping` (`isOutputStreaming || isAdapterBusy`) goes false, and
|
|
9
9
|
* has NO absolute bound. `jsonStreamBusyWatchdog` already covers a stuck
|
|
10
10
|
* `isBusy` (a missed terminal `result`). This backstop covers the OTHER input:
|
|
11
|
-
* `isOutputStreaming`, which reads
|
|
12
|
-
* q.debounceTimer !== null
|
|
11
|
+
* `isOutputStreaming`, which reads "the backlog holds text || it is sending ||
|
|
12
|
+
* q.debounceTimer !== null". A leaked non-null `debounceTimer` (the `isFinal`
|
|
13
13
|
* fast-path in `queueOutput` cleared the timer but left the handle set) pins
|
|
14
14
|
* `isOutputStreaming` true forever → the indicator hangs unbounded even though
|
|
15
15
|
* the output queue is empty (live 2026-07-19, a json-stream group topic firing
|
|
@@ -23,11 +23,12 @@
|
|
|
23
23
|
* and on OpenCode it sets no busy flag at all → vetoed;
|
|
24
24
|
* - a live DM draft is a real stream (`isTransportStreaming`) → vetoed;
|
|
25
25
|
* - real text waiting to send (`hasPendingOutput`) or an in-flight send
|
|
26
|
-
* (`isProcessing
|
|
26
|
+
* (`isProcessing`: the backlog's send loop runs, which may legitimately be a
|
|
27
|
+
* slow API call) → vetoed.
|
|
27
28
|
* Only when the adapter is idle, nothing is drafting, the queue is empty AND an
|
|
28
29
|
* un-fired debounce handle lingers does it fire. A LIVE debounce is ALWAYS armed
|
|
29
|
-
* WITH pending text (both `queueOutput` and
|
|
30
|
-
*
|
|
30
|
+
* WITH pending text (both `queueOutput` and the retry of text a failure put back
|
|
31
|
+
* arm it only when the backlog holds text, nulling it the instant it fires), so "debounce armed +
|
|
31
32
|
* empty queue" can only be the dead/stale handle from the leak — never a real
|
|
32
33
|
* in-flight turn. The decision is therefore safe by construction: it truncates a
|
|
33
34
|
* leak, never work.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typingLoopBackstop.js","sourceRoot":"","sources":["../../src/utils/typingLoopBackstop.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"typingLoopBackstop.js","sourceRoot":"","sources":["../../src/utils/typingLoopBackstop.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;;AAgCH,4DAiBC;AAzBD;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,KAA8B;IACrE,+EAA+E;IAC/E,uDAAuD;IACvD,IAAI,KAAK,CAAC,aAAa;QAAE,OAAO,KAAK,CAAC;IACtC,+EAA+E;IAC/E,+DAA+D;IAC/D,IAAI,KAAK,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IACrC,gEAAgE;IAChE,IAAI,KAAK,CAAC,oBAAoB;QAAE,OAAO,KAAK,CAAC;IAC7C,0CAA0C;IAC1C,IAAI,KAAK,CAAC,gBAAgB;QAAE,OAAO,KAAK,CAAC;IACzC,2EAA2E;IAC3E,IAAI,KAAK,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IACrC,8EAA8E;IAC9E,+EAA+E;IAC/E,2EAA2E;IAC3E,OAAO,KAAK,CAAC,gBAAgB,CAAC;AAChC,CAAC"}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "charness",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "charness",
|
|
9
|
-
"version": "4.
|
|
9
|
+
"version": "4.1.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
12
12
|
"abort-controller": "^3.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "charness",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Sergei Solo",
|
|
6
6
|
"description": "Harness for running Claude Code / OpenCode agents in the cloud or on your laptop, controlled from Telegram or Jira.",
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { PendingOutputSegment } from '../connectors/telegram/outputFlushPlan';
|
|
2
|
-
/**
|
|
3
|
-
* @description Minimal shape of the bot's per-thread output queue that
|
|
4
|
-
* {@link clearThreadOutputQueues} needs to drop. Mirrors the load-bearing
|
|
5
|
-
* fields of `bot.ts`'s `OutputQueueState` so the clear logic stays a pure,
|
|
6
|
-
* unit-testable function instead of reaching into module-private maps.
|
|
7
|
-
*/
|
|
8
|
-
export interface ClearableOutputQueue {
|
|
9
|
-
/** Coalesced, not-yet-sent agent output, oldest first. Empty = nothing queued. */
|
|
10
|
-
pendingSegments: PendingOutputSegment[];
|
|
11
|
-
/** Armed debounce timer that would flush the pending segments. `null` = none. */
|
|
12
|
-
debounceTimer: NodeJS.Timeout | null;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @description Minimal shape of the bot's per-thread status coalescer that
|
|
16
|
-
* {@link clearThreadOutputQueues} needs to drop. Mirrors the load-bearing
|
|
17
|
-
* fields of `bot.ts`'s `StatusCoalesceState`.
|
|
18
|
-
*/
|
|
19
|
-
export interface ClearableStatusCoalescer {
|
|
20
|
-
/** Latest status frame not yet sent. `null` = nothing pending. */
|
|
21
|
-
pendingText: string | null;
|
|
22
|
-
/**
|
|
23
|
-
* Armed timer that would resume a flush deferred during a 429 cooldown.
|
|
24
|
-
* `null` = none. Optional so older callers that don't track it still type.
|
|
25
|
-
*/
|
|
26
|
-
deferRetryTimer?: NodeJS.Timeout | null;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* @description Atomically drop a thread's bot-side queued-but-unsent agent
|
|
30
|
-
* output when its session stops.
|
|
31
|
-
*
|
|
32
|
-
* Without this, output that was coalesced before the user stopped the agent
|
|
33
|
-
* keeps draining into the topic *after* the "stopped" confirmation — observed
|
|
34
|
-
* live when a Telegram 429 backlog delayed the flush. We only touch the
|
|
35
|
-
* bot-side queues: the stop confirmation and any already-in-flight Telegram
|
|
36
|
-
* send (`processOutputQueue` has already taken `out` locally; `flushStatusCoalescer`
|
|
37
|
-
* has already taken `text`) are at the API layer and are intentionally left
|
|
38
|
-
* alone — that single in-flight message may still land, but nothing queued
|
|
39
|
-
* behind it does.
|
|
40
|
-
*
|
|
41
|
-
* Idempotent: clearing an already-empty queue is a no-op.
|
|
42
|
-
*/
|
|
43
|
-
export declare function clearThreadOutputQueues(queue: ClearableOutputQueue | undefined, coalescer: ClearableStatusCoalescer | undefined): void;
|
|
44
|
-
//# sourceMappingURL=clearThreadOutputQueues.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clearThreadOutputQueues.d.ts","sourceRoot":"","sources":["../../src/utils/clearThreadOutputQueues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,kFAAkF;IAClF,eAAe,EAAE,oBAAoB,EAAE,CAAC;IACxC,iFAAiF;IACjF,aAAa,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,kEAAkE;IAClE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;CACzC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,oBAAoB,GAAG,SAAS,EACvC,SAAS,EAAE,wBAAwB,GAAG,SAAS,GAC9C,IAAI,CAmBN"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clearThreadOutputQueues = clearThreadOutputQueues;
|
|
4
|
-
/**
|
|
5
|
-
* @description Atomically drop a thread's bot-side queued-but-unsent agent
|
|
6
|
-
* output when its session stops.
|
|
7
|
-
*
|
|
8
|
-
* Without this, output that was coalesced before the user stopped the agent
|
|
9
|
-
* keeps draining into the topic *after* the "stopped" confirmation — observed
|
|
10
|
-
* live when a Telegram 429 backlog delayed the flush. We only touch the
|
|
11
|
-
* bot-side queues: the stop confirmation and any already-in-flight Telegram
|
|
12
|
-
* send (`processOutputQueue` has already taken `out` locally; `flushStatusCoalescer`
|
|
13
|
-
* has already taken `text`) are at the API layer and are intentionally left
|
|
14
|
-
* alone — that single in-flight message may still land, but nothing queued
|
|
15
|
-
* behind it does.
|
|
16
|
-
*
|
|
17
|
-
* Idempotent: clearing an already-empty queue is a no-op.
|
|
18
|
-
*/
|
|
19
|
-
function clearThreadOutputQueues(queue, coalescer) {
|
|
20
|
-
if (queue) {
|
|
21
|
-
queue.pendingSegments = [];
|
|
22
|
-
if (queue.debounceTimer) {
|
|
23
|
-
clearTimeout(queue.debounceTimer);
|
|
24
|
-
queue.debounceTimer = null;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (coalescer) {
|
|
28
|
-
// Nulling `pendingText` makes the running flush loop (if any) exit on its
|
|
29
|
-
// next iteration without sending a stale frame. The coalescer can also
|
|
30
|
-
// hold a defer-retry timer armed during a 429 cooldown — cancel it too,
|
|
31
|
-
// otherwise it would fire into a stopped session.
|
|
32
|
-
coalescer.pendingText = null;
|
|
33
|
-
if (coalescer.deferRetryTimer) {
|
|
34
|
-
clearTimeout(coalescer.deferRetryTimer);
|
|
35
|
-
coalescer.deferRetryTimer = null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=clearThreadOutputQueues.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clearThreadOutputQueues.js","sourceRoot":"","sources":["../../src/utils/clearThreadOutputQueues.ts"],"names":[],"mappings":";;AA6CA,0DAsBC;AArCD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,uBAAuB,CACrC,KAAuC,EACvC,SAA+C;IAE/C,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,CAAC,eAAe,GAAG,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACxB,YAAY,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;YAClC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,IAAI,SAAS,EAAE,CAAC;QACd,0EAA0E;QAC1E,uEAAuE;QACvE,wEAAwE;QACxE,kDAAkD;QAClD,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC;QAC7B,IAAI,SAAS,CAAC,eAAe,EAAE,CAAC;YAC9B,YAAY,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;YACxC,SAAS,CAAC,eAAe,GAAG,IAAI,CAAC;QACnC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description Pure decision for the GROUP output transport's `finalizeInFlight`
|
|
3
|
-
* (S2): given the thread's coalesced output-queue state at a settle/teardown
|
|
4
|
-
* boundary, decide whether there is an unsent remainder to force-deliver (so the
|
|
5
|
-
* agent's final answer is never discarded) or the turn is already fully
|
|
6
|
-
* delivered (a no-op — no duplicate post).
|
|
7
|
-
*
|
|
8
|
-
* Extracted from `bot.ts`'s `finalizeGroupOutput` so the "remainder vs no-op"
|
|
9
|
-
* + importance decision is unit-testable without the Telegraf / queue
|
|
10
|
-
* machinery. The bot-side function owns the imperative drain (snapshot + null
|
|
11
|
-
* the buffer, then `sendOutputImmediate`); this owns only the decision.
|
|
12
|
-
*
|
|
13
|
-
* The group queue already SEPARATES what landed from what is pending:
|
|
14
|
-
* `lastMessageText` holds the last landed message and the pending segments hold the
|
|
15
|
-
* coalesced-but-unsent remainder. So the "reconcile final accumulated vs last
|
|
16
|
-
* landed" reduces to: send the pending segments, in order, if there are any. No text
|
|
17
|
-
* diff is needed — the queue is the single source of the remainder.
|
|
18
|
-
*/
|
|
19
|
-
import type { PendingOutputSegment } from '../connectors/telegram/outputFlushPlan';
|
|
20
|
-
/** The load-bearing fields of `bot.ts`'s `OutputQueueState` the decision needs. */
|
|
21
|
-
export interface GroupFinalizeInput {
|
|
22
|
-
/** Coalesced, not-yet-sent agent output, oldest first. Empty = nothing pending. */
|
|
23
|
-
pendingSegments: readonly PendingOutputSegment[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @description The finalize plan: either nothing to do (fully delivered), or the
|
|
27
|
-
* exact remainder to send — segment by segment, each landing as it was queued.
|
|
28
|
-
*/
|
|
29
|
-
export type GroupFinalizePlan = {
|
|
30
|
-
action: 'noop';
|
|
31
|
-
} | {
|
|
32
|
-
action: 'send';
|
|
33
|
-
segments: PendingOutputSegment[];
|
|
34
|
-
};
|
|
35
|
-
export declare function getGroupFinalizePlan(input: GroupFinalizeInput): GroupFinalizePlan;
|
|
36
|
-
//# sourceMappingURL=groupFinalizePlan.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"groupFinalizePlan.d.ts","sourceRoot":"","sources":["../../src/utils/groupFinalizePlan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,mFAAmF;IACnF,eAAe,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,oBAAoB,EAAE,CAAA;CAAE,CAAC;AAEzD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,kBAAkB,GAAG,iBAAiB,CAOjF"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @description Pure decision for the GROUP output transport's `finalizeInFlight`
|
|
4
|
-
* (S2): given the thread's coalesced output-queue state at a settle/teardown
|
|
5
|
-
* boundary, decide whether there is an unsent remainder to force-deliver (so the
|
|
6
|
-
* agent's final answer is never discarded) or the turn is already fully
|
|
7
|
-
* delivered (a no-op — no duplicate post).
|
|
8
|
-
*
|
|
9
|
-
* Extracted from `bot.ts`'s `finalizeGroupOutput` so the "remainder vs no-op"
|
|
10
|
-
* + importance decision is unit-testable without the Telegraf / queue
|
|
11
|
-
* machinery. The bot-side function owns the imperative drain (snapshot + null
|
|
12
|
-
* the buffer, then `sendOutputImmediate`); this owns only the decision.
|
|
13
|
-
*
|
|
14
|
-
* The group queue already SEPARATES what landed from what is pending:
|
|
15
|
-
* `lastMessageText` holds the last landed message and the pending segments hold the
|
|
16
|
-
* coalesced-but-unsent remainder. So the "reconcile final accumulated vs last
|
|
17
|
-
* landed" reduces to: send the pending segments, in order, if there are any. No text
|
|
18
|
-
* diff is needed — the queue is the single source of the remainder.
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.getGroupFinalizePlan = getGroupFinalizePlan;
|
|
22
|
-
function getGroupFinalizePlan(input) {
|
|
23
|
-
// A fully-delivered turn (no pending remainder) — and segments holding only
|
|
24
|
-
// whitespace, which would earn a Telegram error and are not a real answer — is
|
|
25
|
-
// a no-op, so a settle/teardown never double-posts.
|
|
26
|
-
const segments = input.pendingSegments.filter((segment) => segment.output.trim() !== '');
|
|
27
|
-
if (segments.length === 0)
|
|
28
|
-
return { action: 'noop' };
|
|
29
|
-
return { action: 'send', segments };
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=groupFinalizePlan.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"groupFinalizePlan.js","sourceRoot":"","sources":["../../src/utils/groupFinalizePlan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAkBH,oDAOC;AAPD,SAAgB,oBAAoB,CAAC,KAAyB;IAC5D,4EAA4E;IAC5E,+EAA+E;IAC/E,oDAAoD;IACpD,MAAM,QAAQ,GAAG,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACzF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IACrD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACtC,CAAC"}
|