charness 4.0.1 → 4.1.1
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 +37 -0
- package/DEVELOPMENT.md +3 -2
- package/SETUP.md +34 -8
- 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 +61 -5
- package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +147 -18
- 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 +430 -297
- package/dist/bot.js.map +1 -1
- package/dist/connectors/jira/answerSink.d.ts +8 -0
- package/dist/connectors/jira/answerSink.d.ts.map +1 -1
- package/dist/connectors/jira/answerSink.js +15 -0
- package/dist/connectors/jira/answerSink.js.map +1 -1
- package/dist/connectors/jira/config.d.ts +16 -0
- package/dist/connectors/jira/config.d.ts.map +1 -1
- package/dist/connectors/jira/config.js +21 -2
- package/dist/connectors/jira/config.js.map +1 -1
- package/dist/connectors/jira/connector.d.ts +10 -3
- package/dist/connectors/jira/connector.d.ts.map +1 -1
- package/dist/connectors/jira/connector.js +21 -3
- package/dist/connectors/jira/connector.js.map +1 -1
- package/dist/connectors/jira/inbound.d.ts +200 -18
- package/dist/connectors/jira/inbound.d.ts.map +1 -1
- package/dist/connectors/jira/inbound.js +814 -43
- package/dist/connectors/jira/inbound.js.map +1 -1
- package/dist/connectors/jira/prompt.d.ts +46 -0
- package/dist/connectors/jira/prompt.d.ts.map +1 -1
- package/dist/connectors/jira/prompt.js +123 -15
- package/dist/connectors/jira/prompt.js.map +1 -1
- package/dist/connectors/jira/trigger.d.ts +27 -4
- package/dist/connectors/jira/trigger.d.ts.map +1 -1
- package/dist/connectors/jira/trigger.js +35 -1
- package/dist/connectors/jira/trigger.js.map +1 -1
- package/dist/connectors/jira/triggerLog.d.ts +60 -5
- package/dist/connectors/jira/triggerLog.d.ts.map +1 -1
- package/dist/connectors/jira/triggerLog.js +116 -7
- package/dist/connectors/jira/triggerLog.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 +29 -2
- package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.js +84 -45
- 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 +50 -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 +17 -0
- package/dist/connectors/telegram/telegramFailureRetry.d.ts.map +1 -0
- package/dist/connectors/telegram/telegramFailureRetry.js +29 -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/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +4 -0
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +4 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +4 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +4 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +4 -0
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +4 -0
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +4 -0
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +4 -0
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +4 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +4 -0
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +4 -0
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +4 -0
- package/dist/i18n/zh.js.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +2 -1
- package/dist/i18n.js.map +1 -1
- 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/requests/requestHeader.d.ts.map +1 -1
- package/dist/requests/requestHeader.js +1 -0
- package/dist/requests/requestHeader.js.map +1 -1
- package/dist/requests/types.d.ts +4 -1
- package/dist/requests/types.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.d.ts +31 -1
- package/dist/requests/wakeUpEngine.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.js +94 -2
- package/dist/requests/wakeUpEngine.js.map +1 -1
- package/dist/requests/wakeUpRules.d.ts +7 -0
- package/dist/requests/wakeUpRules.d.ts.map +1 -1
- package/dist/requests/wakeUpRules.js +14 -0
- package/dist/requests/wakeUpRules.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/scheduler/engine.d.ts +17 -4
- package/dist/scheduler/engine.d.ts.map +1 -1
- package/dist/scheduler/engine.js +55 -10
- package/dist/scheduler/engine.js.map +1 -1
- package/dist/scheduler/mcpBoot.d.ts +6 -2
- package/dist/scheduler/mcpBoot.d.ts.map +1 -1
- package/dist/scheduler/mcpBoot.js +7 -1
- package/dist/scheduler/mcpBoot.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +18 -9
- package/dist/scheduler/mcpSurface.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/sendErrorClassifier.d.ts +6 -0
- package/dist/sendErrorClassifier.d.ts.map +1 -1
- package/dist/sendErrorClassifier.js +9 -0
- package/dist/sendErrorClassifier.js.map +1 -1
- package/dist/startupPromptBuffer.d.ts +8 -8
- package/dist/startupPromptBuffer.d.ts.map +1 -1
- package/dist/startupPromptBuffer.js +7 -5
- package/dist/startupPromptBuffer.js.map +1 -1
- package/dist/testTimings.d.ts +6 -3
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +7 -2
- package/dist/testTimings.js.map +1 -1
- package/dist/threadRouting.d.ts +23 -0
- package/dist/threadRouting.d.ts.map +1 -1
- package/dist/threadRouting.js +28 -0
- package/dist/threadRouting.js.map +1 -1
- package/dist/trackers/taskAgentSlots.d.ts +42 -3
- package/dist/trackers/taskAgentSlots.d.ts.map +1 -1
- package/dist/trackers/taskAgentSlots.js +31 -11
- package/dist/trackers/taskAgentSlots.js.map +1 -1
- package/dist/types.d.ts +16 -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/fileSendPlan.d.ts +30 -8
- package/dist/utils/fileSendPlan.d.ts.map +1 -1
- package/dist/utils/fileSendPlan.js +37 -12
- package/dist/utils/fileSendPlan.js.map +1 -1
- package/dist/utils/fileSendService.d.ts +1 -1
- package/dist/utils/fileSendService.d.ts.map +1 -1
- package/dist/utils/fileSendService.js +9 -1
- package/dist/utils/fileSendService.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/imageDimensions.d.ts +32 -0
- package/dist/utils/imageDimensions.d.ts.map +1 -0
- package/dist/utils/imageDimensions.js +181 -0
- package/dist/utils/imageDimensions.js.map +1 -0
- package/dist/utils/jsonStreamHost.d.ts +35 -9
- package/dist/utils/jsonStreamHost.d.ts.map +1 -1
- package/dist/utils/jsonStreamHost.js +59 -16
- package/dist/utils/jsonStreamHost.js.map +1 -1
- package/dist/utils/lostWork.d.ts +8 -2
- package/dist/utils/lostWork.d.ts.map +1 -1
- package/dist/utils/lostWork.js +9 -5
- package/dist/utils/lostWork.js.map +1 -1
- 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/promptDelivery.d.ts +11 -2
- package/dist/utils/promptDelivery.d.ts.map +1 -1
- package/dist/utils/promptDelivery.js +3 -3
- package/dist/utils/promptDelivery.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,515 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description What the bot puts back into an agent's context after a compaction so that the skills it had loaded keep
|
|
4
|
+
* applying — the owner's guarantee that a compaction never leaves an agent without the procedures it was following (plan
|
|
5
|
+
* `2026-11-12-skills-reload-after-compaction`, S2). Pure: no file is read here; the Claude hook
|
|
6
|
+
* (`hooks/claudeSkillsRestoreHook.ts`) reads the transcript and the skill files and hands them in, and the OpenCode plugin
|
|
7
|
+
* (`openCodeCompactPlugin.ts`) embeds the self-contained renderers below.
|
|
8
|
+
*
|
|
9
|
+
* skills = what the records show was loaded (newest first) ∪ what the summary's block names (OpenCode)
|
|
10
|
+
* resolve = each skill's CURRENT text, or "not available now", or "load it with the tool"
|
|
11
|
+
* payload = {@link skillsRestoreHeader}, the list (every skill, with where its text is), then each restored skill whole
|
|
12
|
+
*
|
|
13
|
+
* Claude: the transcript records, read back to the previous compaction — a skill loaded with the Skill tool or a slash
|
|
14
|
+
* command (its `Base directory for this skill: <dir>` message), Claude's own re-attach of the previous compaction
|
|
15
|
+
* (`invoked_skills`, which carries older epochs) and the bot's previous restore (which carries what Claude's re-attach
|
|
16
|
+
* dropped). Every skill comes back whole, also one Claude may re-attach itself ({@link planClaudeSkillsRestore} says why).
|
|
17
|
+
* OpenCode: a skill whose call is already after the summary is only named.
|
|
18
|
+
*/
|
|
19
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.claudeSkillRecordKeys = exports.claudeSkillBaseDirPrefix = exports.skillsRestorePartMaxChars = exports.skillsRestoreSlotCount = exports.openCodeSkillToolName = exports.claudeSkillToolName = exports.claudeSkillFileName = exports.skillsRestoreTexts = exports.skillsRestoreHeader = void 0;
|
|
24
|
+
exports.renderSkillsRestoreList = renderSkillsRestoreList;
|
|
25
|
+
exports.renderSkillsRestoreSection = renderSkillsRestoreSection;
|
|
26
|
+
exports.buildSkillsRestoreText = buildSkillsRestoreText;
|
|
27
|
+
exports.buildClaudeSkillsRestoreParts = buildClaudeSkillsRestoreParts;
|
|
28
|
+
exports.checkIsClaudeSkillRecordLine = checkIsClaudeSkillRecordLine;
|
|
29
|
+
exports.readSkillMessageBaseDir = readSkillMessageBaseDir;
|
|
30
|
+
exports.parseSkillsRestoreList = parseSkillsRestoreList;
|
|
31
|
+
exports.collectClaudeEpochSkills = collectClaudeEpochSkills;
|
|
32
|
+
exports.stripSkillFrontmatter = stripSkillFrontmatter;
|
|
33
|
+
exports.planClaudeSkillsRestore = planClaudeSkillsRestore;
|
|
34
|
+
exports.getOpenCodeLoadedSkills = getOpenCodeLoadedSkills;
|
|
35
|
+
exports.planOpenCodeSkillsRestore = planOpenCodeSkillsRestore;
|
|
36
|
+
const path_1 = __importDefault(require("path"));
|
|
37
|
+
const checkIsRecord_1 = require("./checkIsRecord");
|
|
38
|
+
/**
|
|
39
|
+
* What opens the context the bot's hook (Claude, `hooks/claudeSkillsRestoreHook.ts`) and plugin (OpenCode,
|
|
40
|
+
* `openCodeCompactPlugin.ts`) add after a compaction. Agent-facing only: the summary the person may see never names it.
|
|
41
|
+
*/
|
|
42
|
+
exports.skillsRestoreHeader = '[Charness: skills restored after compaction]';
|
|
43
|
+
/**
|
|
44
|
+
* The words of the restore. `{tool}` is the backend's skill tool (`Skill` / `skill`), `{dir}` a base directory, `{file}` the
|
|
45
|
+
* full path of a skill's `SKILL.md`, `{name}` a skill, `{i}` / `{n}` a part's number and the count, `{previous}` the part a
|
|
46
|
+
* long skill continues from.
|
|
47
|
+
*/
|
|
48
|
+
exports.skillsRestoreTexts = {
|
|
49
|
+
header: exports.skillsRestoreHeader,
|
|
50
|
+
partLabel: '(part {i} of {n})',
|
|
51
|
+
intro: 'These skills were loaded in this conversation before the compaction and stay in force: keep following them. Do not load them again with the {tool} tool, except where a line below says so.',
|
|
52
|
+
multiPartNote: 'This restore comes in several parts, labelled with their numbers, which may appear in any order: a skill too long for one part goes on in the part with the next number.',
|
|
53
|
+
listHeading: 'Skills loaded before the compaction (newest first):',
|
|
54
|
+
listContinuedHeading: 'Skills loaded before the compaction (continued):',
|
|
55
|
+
statuses: {
|
|
56
|
+
text: 'its current full text is below',
|
|
57
|
+
inContext: 'its full text is already in your context',
|
|
58
|
+
unavailable: 'was loaded before but is not available now',
|
|
59
|
+
loadWithTool: 'not restored here: load it with the {tool} tool',
|
|
60
|
+
},
|
|
61
|
+
skillFileSuffix: ' (skill file: {file})',
|
|
62
|
+
baseDirSuffix: ' (base directory: {dir})',
|
|
63
|
+
sectionHeading: '## Skill: {name}',
|
|
64
|
+
sectionContinued: '## Skill: {name} (continued from part {previous})',
|
|
65
|
+
baseDirLine: 'Base directory for this skill: {dir}',
|
|
66
|
+
skillFileLine: 'Skill file: {file}',
|
|
67
|
+
};
|
|
68
|
+
/** The file a Claude skill's text is in, inside its base directory. */
|
|
69
|
+
exports.claudeSkillFileName = 'SKILL.md';
|
|
70
|
+
/** The name of the skill tool of each backend, as the restore tells the agent to use it. */
|
|
71
|
+
exports.claudeSkillToolName = 'Skill';
|
|
72
|
+
exports.openCodeSkillToolName = 'skill';
|
|
73
|
+
/**
|
|
74
|
+
* @description The lines of the restore's list — the intro and every skill with where its text is — before any skill text.
|
|
75
|
+
* A skill's line ends with its skill file when known (the file to edit), else with its folder. Self-contained (it reads
|
|
76
|
+
* nothing outside its parameters): the OpenCode plugin embeds its source.
|
|
77
|
+
*/
|
|
78
|
+
function renderSkillsRestoreList(entries, texts, toolName) {
|
|
79
|
+
const lines = [texts.intro.split('{tool}').join(toolName), '', texts.listHeading];
|
|
80
|
+
for (const entry of entries) {
|
|
81
|
+
const status = texts.statuses[entry.status].split('{tool}').join(toolName);
|
|
82
|
+
let suffix = '';
|
|
83
|
+
if (entry.skillFile !== null)
|
|
84
|
+
suffix = texts.skillFileSuffix.split('{file}').join(entry.skillFile);
|
|
85
|
+
else if (entry.baseDir !== null)
|
|
86
|
+
suffix = texts.baseDirSuffix.split('{dir}').join(entry.baseDir);
|
|
87
|
+
lines.push(`- ${entry.name}: ${status}${suffix}`);
|
|
88
|
+
}
|
|
89
|
+
return lines;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @description The lines of one restored skill: its heading, its base directory (the line Claude's own skill message opens
|
|
93
|
+
* with, so relative paths in the skill resolve as they did), right under it the full path of its skill file (so an agent told
|
|
94
|
+
* to change the skill edits the right file), and its text. Self-contained, as {@link renderSkillsRestoreList}.
|
|
95
|
+
*/
|
|
96
|
+
function renderSkillsRestoreSection(entry, texts) {
|
|
97
|
+
const lines = [texts.sectionHeading.split('{name}').join(entry.name)];
|
|
98
|
+
if (entry.baseDir !== null)
|
|
99
|
+
lines.push(texts.baseDirLine.split('{dir}').join(entry.baseDir));
|
|
100
|
+
if (entry.skillFile !== null)
|
|
101
|
+
lines.push(texts.skillFileLine.split('{file}').join(entry.skillFile));
|
|
102
|
+
lines.push('');
|
|
103
|
+
return lines.concat((entry.body ?? '').split('\n'));
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @description The whole restore as ONE text (OpenCode: no size limit, one part): the header, the list, then every skill
|
|
107
|
+
* whose status is `text`, whole. `''` when there is no skill — nothing is added at all. Self-contained (it calls only the
|
|
108
|
+
* two renderers above), as the plugin embeds it.
|
|
109
|
+
*/
|
|
110
|
+
function buildSkillsRestoreText(entries, texts, toolName) {
|
|
111
|
+
if (entries.length === 0)
|
|
112
|
+
return '';
|
|
113
|
+
const blocks = [[texts.header].concat(renderSkillsRestoreList(entries, texts, toolName)).join('\n')];
|
|
114
|
+
for (const entry of entries) {
|
|
115
|
+
if (entry.status === 'text')
|
|
116
|
+
blocks.push(renderSkillsRestoreSection(entry, texts).join('\n'));
|
|
117
|
+
}
|
|
118
|
+
return blocks.join('\n\n');
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* How many `SessionStart` hook slots carry the Claude restore, and how long each part may be. Claude Code caps what ONE hook
|
|
122
|
+
* adds at 10,000 characters (a longer one becomes a file and a 2,000-character preview); several hooks of one event each
|
|
123
|
+
* get their own cap. Measured on Claude Code 2.1.322 (`-p`, stream-json, a manual `/compact`): 24 slots of 9,500 characters
|
|
124
|
+
* each, all full, reached the next model request whole — 228,000 characters, no preview, no total cap (the parts arrive in
|
|
125
|
+
* the order the hooks finished, not by slot number: hence the part labels). A slot with nothing to say prints nothing and
|
|
126
|
+
* costs nothing.
|
|
127
|
+
*/
|
|
128
|
+
exports.skillsRestoreSlotCount = 24;
|
|
129
|
+
exports.skillsRestorePartMaxChars = 9_500;
|
|
130
|
+
/** Room a line takes in a part: its characters and its newline. */
|
|
131
|
+
function getLineCost(line) {
|
|
132
|
+
return line.length + 1;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @description Cut `sections` into parts of at most `capacity` characters each (label not included): a section goes whole
|
|
136
|
+
* into the current part when it fits, else whole into a new one; a section longer than a part goes on over several, cut only
|
|
137
|
+
* at line ends — a line too long even for a part of its own is cut where the part ends — and every piece after the first
|
|
138
|
+
* opens with a "continued from part N" heading, since the parts reach the agent in no fixed order. The parts' lines, in
|
|
139
|
+
* order; their count may exceed any slot limit (the caller checks).
|
|
140
|
+
*/
|
|
141
|
+
function packRestoreSections(sections, texts, capacity) {
|
|
142
|
+
const parts = [];
|
|
143
|
+
let current = [];
|
|
144
|
+
let used = 0;
|
|
145
|
+
const push = (line) => {
|
|
146
|
+
current.push(line);
|
|
147
|
+
used += getLineCost(line);
|
|
148
|
+
};
|
|
149
|
+
const flush = () => {
|
|
150
|
+
if (current.length === 0)
|
|
151
|
+
return;
|
|
152
|
+
parts.push(current);
|
|
153
|
+
current = [];
|
|
154
|
+
used = 0;
|
|
155
|
+
};
|
|
156
|
+
for (const section of sections) {
|
|
157
|
+
const separatorCost = current.length > 0 ? getLineCost('') : 0;
|
|
158
|
+
const sectionCost = section.lines.reduce((sum, line) => sum + getLineCost(line), 0);
|
|
159
|
+
if (used + separatorCost + sectionCost <= capacity) {
|
|
160
|
+
if (separatorCost > 0)
|
|
161
|
+
push('');
|
|
162
|
+
for (const line of section.lines)
|
|
163
|
+
push(line);
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
flush();
|
|
167
|
+
const continuedHeading = section.skillName === null ? texts.listContinuedHeading : texts.sectionContinued.split('{name}').join(section.skillName);
|
|
168
|
+
for (const line of section.lines) {
|
|
169
|
+
let rest = line;
|
|
170
|
+
while (used + getLineCost(rest) > capacity) {
|
|
171
|
+
const headingCost = getLineCost(continuedHeading.split('{previous}').join(String(parts.length + 1)));
|
|
172
|
+
// Only a line that would not fit a new part either is cut; any other moves whole to the next part.
|
|
173
|
+
if (getLineCost(rest) + headingCost > capacity) {
|
|
174
|
+
const room = capacity - used - 1;
|
|
175
|
+
if (room > 0) {
|
|
176
|
+
push(rest.slice(0, room));
|
|
177
|
+
rest = rest.slice(room);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
flush();
|
|
181
|
+
push(continuedHeading.split('{previous}').join(String(parts.length)));
|
|
182
|
+
}
|
|
183
|
+
push(rest);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
flush();
|
|
187
|
+
return parts;
|
|
188
|
+
}
|
|
189
|
+
/** @description The label line a part opens with: the header, and `(part i of n)` when the restore has more than one part. */
|
|
190
|
+
function renderRestorePartLabel(texts, partNumber, partCount) {
|
|
191
|
+
return partCount > 1 ? `${texts.header} ${texts.partLabel.split('{i}').join(String(partNumber)).split('{n}').join(String(partCount))}` : texts.header;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* @description The Claude restore as the parts its `SessionStart` hook slots print, each at most `partMaxChars` long, label
|
|
195
|
+
* included. Every restored skill goes in WHOLE, newest first; one that would no longer fit into `slotCount` parts gets the
|
|
196
|
+
* "load it with the tool" line instead (the newer skills are kept first). `[]` when there is no skill.
|
|
197
|
+
*/
|
|
198
|
+
function buildClaudeSkillsRestoreParts(entries, texts, slotCount, partMaxChars) {
|
|
199
|
+
if (entries.length === 0)
|
|
200
|
+
return [];
|
|
201
|
+
// The label is counted at its longest (the slot count as the part count), then written exact.
|
|
202
|
+
const capacity = partMaxChars - getLineCost(renderRestorePartLabel(texts, slotCount, slotCount));
|
|
203
|
+
const pack = (decided, isWithMultiPartNote) => {
|
|
204
|
+
const list = renderSkillsRestoreList(decided, texts, exports.claudeSkillToolName);
|
|
205
|
+
if (isWithMultiPartNote)
|
|
206
|
+
list.splice(1, 0, texts.multiPartNote);
|
|
207
|
+
const sections = [{ skillName: null, lines: list }];
|
|
208
|
+
for (const entry of decided) {
|
|
209
|
+
if (entry.status === 'text')
|
|
210
|
+
sections.push({ skillName: entry.name, lines: renderSkillsRestoreSection(entry, texts) });
|
|
211
|
+
}
|
|
212
|
+
return packRestoreSections(sections, texts, capacity);
|
|
213
|
+
};
|
|
214
|
+
const countParts = (decided) => pack(decided, true).length;
|
|
215
|
+
const withoutText = (entry) => ({ ...entry, status: 'loadWithTool', body: null });
|
|
216
|
+
// Newest first: a skill keeps its text only while the restore with it (and the newer ones kept) still fits the slots.
|
|
217
|
+
let decided = entries.map((entry) => ({ ...entry }));
|
|
218
|
+
for (let index = 0; index < decided.length; index += 1) {
|
|
219
|
+
if (decided[index].status !== 'text')
|
|
220
|
+
continue;
|
|
221
|
+
const tried = decided.map((entry, entryIndex) => (entryIndex > index && entry.status === 'text' ? withoutText(entry) : entry));
|
|
222
|
+
if (countParts(tried) > slotCount)
|
|
223
|
+
decided[index] = withoutText(decided[index]);
|
|
224
|
+
}
|
|
225
|
+
// The list lines changed with the statuses; should that tip the count over, the oldest restored skills go.
|
|
226
|
+
while (countParts(decided) > slotCount) {
|
|
227
|
+
const oldestTextIndex = decided.map((entry) => entry.status).lastIndexOf('text');
|
|
228
|
+
if (oldestTextIndex < 0)
|
|
229
|
+
break;
|
|
230
|
+
decided = decided.map((entry, entryIndex) => (entryIndex === oldestTextIndex ? withoutText(entry) : entry));
|
|
231
|
+
}
|
|
232
|
+
// The note only matters with several parts; without it a restore that took several could fit one, and then needs none.
|
|
233
|
+
const noted = pack(decided, true);
|
|
234
|
+
const parts = noted.length > 1 ? noted : pack(decided, false);
|
|
235
|
+
return parts.map((lines, index) => `${renderRestorePartLabel(texts, index + 1, parts.length)}\n${lines.join('\n')}`);
|
|
236
|
+
}
|
|
237
|
+
// ── Claude: what the transcript shows ──
|
|
238
|
+
/** The line Claude's own skill message opens with (and the content of its re-attach). */
|
|
239
|
+
exports.claudeSkillBaseDirPrefix = 'Base directory for this skill: ';
|
|
240
|
+
/**
|
|
241
|
+
* The keys a transcript line must carry to matter to {@link collectClaudeEpochSkills} — checked on the raw line before
|
|
242
|
+
* `JSON.parse`, as a transcript can be a hundred megabytes and almost none of it is about skills.
|
|
243
|
+
*/
|
|
244
|
+
exports.claudeSkillRecordKeys = ['"Skill"', exports.claudeSkillBaseDirPrefix, '<command-name>', '"invoked_skills"', '"hook_additional_context"'];
|
|
245
|
+
/** @description Whether a raw transcript line can matter to {@link collectClaudeEpochSkills}. */
|
|
246
|
+
function checkIsClaudeSkillRecordLine(line) {
|
|
247
|
+
return exports.claudeSkillRecordKeys.some((key) => line.includes(key));
|
|
248
|
+
}
|
|
249
|
+
const commandNameRe = /<command-name>\/?([^<\s]+)<\/command-name>/;
|
|
250
|
+
/** The text of a message's content: a string, or its `text` blocks joined. */
|
|
251
|
+
function readMessageText(content) {
|
|
252
|
+
if (typeof content === 'string')
|
|
253
|
+
return content;
|
|
254
|
+
if (!Array.isArray(content))
|
|
255
|
+
return '';
|
|
256
|
+
return content.map((block) => ((0, checkIsRecord_1.checkIsRecord)(block) && block.type === 'text' && typeof block.text === 'string' ? block.text : '')).join('');
|
|
257
|
+
}
|
|
258
|
+
/** @description The folder a skill message names in its first line, or `null` when the text is no skill message. */
|
|
259
|
+
function readSkillMessageBaseDir(text) {
|
|
260
|
+
if (!text.startsWith(exports.claudeSkillBaseDirPrefix))
|
|
261
|
+
return null;
|
|
262
|
+
const firstLine = text.slice(exports.claudeSkillBaseDirPrefix.length).split('\n')[0].trim();
|
|
263
|
+
return firstLine === '' ? null : firstLine;
|
|
264
|
+
}
|
|
265
|
+
/** A skill name as the CLI writes it in a slash command or the Skill tool's input: without the leading slash. */
|
|
266
|
+
function normalizeSkillName(name) {
|
|
267
|
+
return name.trim().replace(/^\//, '');
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* @description The path a list line's suffix holds — `suffix` is the line's wording with `placeholder` where the path goes
|
|
271
|
+
* — or `null` when the line ends otherwise.
|
|
272
|
+
*/
|
|
273
|
+
function readListLineSuffix(line, nameEnd, suffix, placeholder) {
|
|
274
|
+
const [before, after] = suffix.split(placeholder);
|
|
275
|
+
const suffixAt = line.lastIndexOf(before);
|
|
276
|
+
if (suffixAt <= nameEnd || !line.endsWith(after))
|
|
277
|
+
return null;
|
|
278
|
+
const value = line.slice(suffixAt + before.length, line.length - after.length);
|
|
279
|
+
return value === '' ? null : value;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* @description The skills named by the list of a restore the bot wrote earlier ({@link renderSkillsRestoreList}), from the
|
|
283
|
+
* texts the hook gave (`hook_additional_context`): every `- <name>: …` line under the list's heading, with its base directory
|
|
284
|
+
* when the line gives one — the folder of its skill file (the current wording), or the folder itself (the wording of the
|
|
285
|
+
* restores written before the skill file was named). Lines of a skill's text never count — they come after the list. `[]`
|
|
286
|
+
* for texts that hold no restore of ours.
|
|
287
|
+
*/
|
|
288
|
+
function parseSkillsRestoreList(contextTexts, texts = exports.skillsRestoreTexts) {
|
|
289
|
+
const mentions = [];
|
|
290
|
+
for (const contextText of contextTexts) {
|
|
291
|
+
if (!contextText.startsWith(texts.header))
|
|
292
|
+
continue;
|
|
293
|
+
const lines = contextText.split('\n');
|
|
294
|
+
let isInList = false;
|
|
295
|
+
for (const line of lines) {
|
|
296
|
+
if (line === texts.listHeading || line === texts.listContinuedHeading) {
|
|
297
|
+
isInList = true;
|
|
298
|
+
continue;
|
|
299
|
+
}
|
|
300
|
+
if (!isInList)
|
|
301
|
+
continue;
|
|
302
|
+
if (!line.startsWith('- ')) {
|
|
303
|
+
if (line.trim() === '')
|
|
304
|
+
isInList = false;
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
const nameEnd = line.indexOf(': ', 2);
|
|
308
|
+
if (nameEnd < 0)
|
|
309
|
+
continue;
|
|
310
|
+
const name = line.slice(2, nameEnd);
|
|
311
|
+
if (name === '' || /\s/.test(name) || mentions.some((mention) => mention.name === name))
|
|
312
|
+
continue;
|
|
313
|
+
const skillFile = readListLineSuffix(line, nameEnd, texts.skillFileSuffix, '{file}');
|
|
314
|
+
const baseDir = skillFile === null ? readListLineSuffix(line, nameEnd, texts.baseDirSuffix, '{dir}') : path_1.default.dirname(skillFile);
|
|
315
|
+
mentions.push({ name, baseDir });
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return mentions;
|
|
319
|
+
}
|
|
320
|
+
/** @description Keep the LAST load of each name (the records come oldest first) and order them newest first. */
|
|
321
|
+
function getNewestFirstLoads(orderedLoads) {
|
|
322
|
+
const seen = new Set();
|
|
323
|
+
const newestFirst = [];
|
|
324
|
+
for (let index = orderedLoads.length - 1; index >= 0; index -= 1) {
|
|
325
|
+
const load = orderedLoads[index];
|
|
326
|
+
if (seen.has(load.name))
|
|
327
|
+
continue;
|
|
328
|
+
seen.add(load.name);
|
|
329
|
+
newestFirst.push(load);
|
|
330
|
+
}
|
|
331
|
+
return newestFirst;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* @description Read the skills out of the transcript lines since the previous compaction (oldest first, as in the file).
|
|
335
|
+
* A load is the skill message the CLI writes after a SUCCESSFUL load — `isMeta`, opening `Base directory for this skill:
|
|
336
|
+
* <dir>` — so a failed Skill call (no such message) counts for nothing. Its name: the Skill tool's `skill` input of the call
|
|
337
|
+
* the message answers (`sourceToolUseID`), else the slash command the message follows (`<command-name>/name</command-name>`
|
|
338
|
+
* in the record its `parentUuid` names — measured on Claude Code 2.1.322), else the folder's name. A sub-agent's records
|
|
339
|
+
* (`isSidechain`) and lines that are no records are skipped.
|
|
340
|
+
*/
|
|
341
|
+
function collectClaudeEpochSkills(epochLines) {
|
|
342
|
+
const toolSkillNames = new Map();
|
|
343
|
+
const loads = [];
|
|
344
|
+
let reattached = [];
|
|
345
|
+
let previousRestore = [];
|
|
346
|
+
/** The slash command each user record holds, by the record's `uuid`: what a skill message's `parentUuid` points at. */
|
|
347
|
+
const commandNamesByUuid = new Map();
|
|
348
|
+
for (const line of epochLines) {
|
|
349
|
+
if (!checkIsClaudeSkillRecordLine(line))
|
|
350
|
+
continue;
|
|
351
|
+
let record;
|
|
352
|
+
try {
|
|
353
|
+
record = JSON.parse(line);
|
|
354
|
+
}
|
|
355
|
+
catch {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
if (!(0, checkIsRecord_1.checkIsRecord)(record) || record.isSidechain === true)
|
|
359
|
+
continue;
|
|
360
|
+
const message = (0, checkIsRecord_1.checkIsRecord)(record.message) ? record.message : null;
|
|
361
|
+
if (record.type === 'assistant' && message && Array.isArray(message.content)) {
|
|
362
|
+
for (const block of message.content) {
|
|
363
|
+
if (!(0, checkIsRecord_1.checkIsRecord)(block) || block.type !== 'tool_use' || block.name !== exports.claudeSkillToolName || typeof block.id !== 'string')
|
|
364
|
+
continue;
|
|
365
|
+
const input = (0, checkIsRecord_1.checkIsRecord)(block.input) ? block.input : null;
|
|
366
|
+
if (input && typeof input.skill === 'string')
|
|
367
|
+
toolSkillNames.set(block.id, normalizeSkillName(input.skill));
|
|
368
|
+
}
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
if (record.type === 'user' && message) {
|
|
372
|
+
const text = readMessageText(message.content);
|
|
373
|
+
const baseDir = record.isMeta === true ? readSkillMessageBaseDir(text) : null;
|
|
374
|
+
if (baseDir !== null) {
|
|
375
|
+
const toolName = typeof record.sourceToolUseID === 'string' ? toolSkillNames.get(record.sourceToolUseID) : undefined;
|
|
376
|
+
const commandName = typeof record.parentUuid === 'string' ? commandNamesByUuid.get(record.parentUuid) : undefined;
|
|
377
|
+
loads.push({ name: toolName ?? commandName ?? path_1.default.basename(baseDir), baseDir });
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
const commandName = record.isMeta === true ? undefined : commandNameRe.exec(text)?.[1];
|
|
381
|
+
if (commandName !== undefined && typeof record.uuid === 'string')
|
|
382
|
+
commandNamesByUuid.set(record.uuid, normalizeSkillName(commandName));
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
if (record.type !== 'attachment' || !(0, checkIsRecord_1.checkIsRecord)(record.attachment))
|
|
386
|
+
continue;
|
|
387
|
+
const attachment = record.attachment;
|
|
388
|
+
if (attachment.type === 'invoked_skills' && Array.isArray(attachment.skills)) {
|
|
389
|
+
reattached = getNewestFirstLoads(attachment.skills
|
|
390
|
+
.flatMap((skill) => {
|
|
391
|
+
if (!(0, checkIsRecord_1.checkIsRecord)(skill) || typeof skill.name !== 'string' || typeof skill.content !== 'string')
|
|
392
|
+
return [];
|
|
393
|
+
const skillBaseDir = readSkillMessageBaseDir(skill.content);
|
|
394
|
+
return skillBaseDir === null ? [] : [{ name: normalizeSkillName(skill.name), baseDir: skillBaseDir }];
|
|
395
|
+
})
|
|
396
|
+
.reverse());
|
|
397
|
+
}
|
|
398
|
+
if (attachment.type === 'hook_additional_context' && Array.isArray(attachment.content)) {
|
|
399
|
+
const restored = parseSkillsRestoreList(attachment.content.filter((item) => typeof item === 'string'));
|
|
400
|
+
if (restored.length > 0)
|
|
401
|
+
previousRestore = restored;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return { loads: getNewestFirstLoads(loads), reattached, previousRestore };
|
|
405
|
+
}
|
|
406
|
+
/** @description A `SKILL.md`'s body as the CLI loads it: the frontmatter (between the first two `---` lines) and the blank lines after it dropped. */
|
|
407
|
+
function stripSkillFrontmatter(fileText) {
|
|
408
|
+
const text = fileText.replace(/\r\n/g, '\n');
|
|
409
|
+
if (!text.startsWith('---\n'))
|
|
410
|
+
return text.replace(/^\n+/, '');
|
|
411
|
+
const closingAt = text.indexOf('\n---', 3);
|
|
412
|
+
if (closingAt < 0)
|
|
413
|
+
return text;
|
|
414
|
+
const afterClosing = text.indexOf('\n', closingAt + 4);
|
|
415
|
+
return afterClosing < 0 ? '' : text.slice(afterClosing + 1).replace(/^\n+/, '');
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* @description The Claude restore's entries, newest first: every skill this epoch loaded, Claude's previous re-attach carried
|
|
419
|
+
* and the bot's previous restore named. A skill whose folder is inside `unavailableDir` (the bot's own skills, when this
|
|
420
|
+
* process was started without them) or whose `SKILL.md` is gone is "not available now"; a name with no known folder gets the
|
|
421
|
+
* "load it with the tool" line; EVERY other skill comes back with its CURRENT text.
|
|
422
|
+
*
|
|
423
|
+
* Also a skill Claude Code's own re-attach may carry whole. Measured on ONE process of Claude Code 2.1.322, that re-attach
|
|
424
|
+
* keeps a skill's message whole up to 20,000 characters and about 100,000 in all, newest first. But a process started with
|
|
425
|
+
* `--resume` — every per-turn turn, every json-stream process after an idle stop or a bot restart — re-attaches NONE of the
|
|
426
|
+
* skills an earlier process loaded: measured by the live probe's resume case on 2026-11-13 (the installed Claude Code,
|
|
427
|
+
* 2.1.323, the default account): skills loaded, the process stopped, `--resume`, `/compact` — its `invoked_skills` held []
|
|
428
|
+
* of [live-small, live-big]. A skill only named here would be lost until the next compaction while the agent is told not to
|
|
429
|
+
* load it; giving every one costs a second copy of a short skill only in a process that loaded it itself, once per
|
|
430
|
+
* compaction.
|
|
431
|
+
*/
|
|
432
|
+
function planClaudeSkillsRestore(epoch, folders, unavailableDir) {
|
|
433
|
+
const candidates = [];
|
|
434
|
+
for (const mention of [...epoch.loads, ...epoch.reattached, ...epoch.previousRestore]) {
|
|
435
|
+
const known = candidates.find((candidate) => candidate.name === mention.name);
|
|
436
|
+
if (known === undefined)
|
|
437
|
+
candidates.push({ name: mention.name, baseDir: mention.baseDir });
|
|
438
|
+
else if (known.baseDir === null)
|
|
439
|
+
known.baseDir = mention.baseDir;
|
|
440
|
+
}
|
|
441
|
+
return candidates.map((candidate) => {
|
|
442
|
+
const { name, baseDir } = candidate;
|
|
443
|
+
if (baseDir === null)
|
|
444
|
+
return { name, status: 'loadWithTool', baseDir: null, skillFile: null, body: null };
|
|
445
|
+
// The text below is read from exactly the file the restore names.
|
|
446
|
+
const skillFile = path_1.default.join(baseDir, exports.claudeSkillFileName);
|
|
447
|
+
const isInUnavailableDir = unavailableDir !== null && (baseDir === unavailableDir || baseDir.startsWith(`${unavailableDir}${path_1.default.sep}`));
|
|
448
|
+
const fileText = isInUnavailableDir ? null : folders.readSkillFile(skillFile);
|
|
449
|
+
if (fileText === null)
|
|
450
|
+
return { name, status: 'unavailable', baseDir, skillFile, body: null };
|
|
451
|
+
return { name, status: 'text', baseDir, skillFile, body: stripSkillFrontmatter(fileText) };
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* @description The skills an OpenCode session loaded, newest first, one per name: every COMPLETED `skill` tool call in
|
|
456
|
+
* `messages` (a failed one loaded nothing), named by the call's own record (`metadata.name`, else its input) with the folder
|
|
457
|
+
* it recorded. Self-contained (it reads nothing outside its parameters): the OpenCode plugin embeds its source.
|
|
458
|
+
*/
|
|
459
|
+
function getOpenCodeLoadedSkills(messages) {
|
|
460
|
+
const loaded = [];
|
|
461
|
+
for (let messageIndex = messages.length - 1; messageIndex >= 0; messageIndex -= 1) {
|
|
462
|
+
const parts = messages[messageIndex].parts ?? [];
|
|
463
|
+
for (let partIndex = parts.length - 1; partIndex >= 0; partIndex -= 1) {
|
|
464
|
+
const part = parts[partIndex];
|
|
465
|
+
if (part.type !== 'tool' || part.tool !== 'skill' || part.state?.status !== 'completed')
|
|
466
|
+
continue;
|
|
467
|
+
const name = part.state.metadata?.name ?? part.state.input?.name;
|
|
468
|
+
if (typeof name !== 'string' || name === '' || loaded.some((mention) => mention.name === name))
|
|
469
|
+
continue;
|
|
470
|
+
const dir = part.state.metadata?.dir;
|
|
471
|
+
loaded.push({ name, baseDir: typeof dir === 'string' && dir !== '' ? dir : null });
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return loaded;
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* @description The OpenCode restore's entries: the skills the history shows loaded (newest first), then the ones only the
|
|
478
|
+
* summary's block names. A skill whose call is already in what the model sees after the summary (the compaction's retained
|
|
479
|
+
* tail, or loaded again since) is only named; one the server offers now comes back with its CURRENT text; one it does not
|
|
480
|
+
* offer is "not available now"; with no answer from the server (`available` `null`) every other skill gets the "load it with
|
|
481
|
+
* the tool" line.
|
|
482
|
+
*
|
|
483
|
+
* A name ONLY the block holds gets its text only while the history is unknown (`isHistoryKnown` false: the block is then the
|
|
484
|
+
* best record there is); with the history known it gets the "load it with the tool" line — the history shows every completed
|
|
485
|
+
* skill call, so a block-only name is most likely the model listing the skills it COULD load, and each would put 10–25 KB into
|
|
486
|
+
* every request of the epoch. Self-contained, as {@link getOpenCodeLoadedSkills}.
|
|
487
|
+
*/
|
|
488
|
+
function planOpenCodeSkillsRestore(input) {
|
|
489
|
+
const mentions = input.loaded.slice();
|
|
490
|
+
const blockOnlyNames = [];
|
|
491
|
+
for (const name of input.blockNames) {
|
|
492
|
+
if (mentions.some((mention) => mention.name === name))
|
|
493
|
+
continue;
|
|
494
|
+
mentions.push({ name, baseDir: null });
|
|
495
|
+
blockOnlyNames.push(name);
|
|
496
|
+
}
|
|
497
|
+
return mentions.map((mention) => {
|
|
498
|
+
const offered = input.available === null ? undefined : input.available.find((skill) => skill.name === mention.name);
|
|
499
|
+
// The skill file is the one the server reads the skill from: only a skill it offers now has one.
|
|
500
|
+
const skillFile = offered === undefined || offered.location === '' ? null : offered.location;
|
|
501
|
+
const offeredDir = skillFile === null ? null : skillFile.slice(0, Math.max(skillFile.lastIndexOf('/'), 0)) || null;
|
|
502
|
+
const baseDir = offeredDir ?? mention.baseDir;
|
|
503
|
+
const located = { name: mention.name, baseDir, skillFile };
|
|
504
|
+
if (input.inContextNames.includes(mention.name))
|
|
505
|
+
return { ...located, status: 'inContext', body: null };
|
|
506
|
+
if (input.available === null)
|
|
507
|
+
return { ...located, status: 'loadWithTool', body: null };
|
|
508
|
+
if (offered === undefined)
|
|
509
|
+
return { ...located, status: 'unavailable', body: null };
|
|
510
|
+
if (input.isHistoryKnown && blockOnlyNames.includes(mention.name))
|
|
511
|
+
return { ...located, status: 'loadWithTool', body: null };
|
|
512
|
+
return { ...located, status: 'text', body: offered.content };
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
//# sourceMappingURL=skillsRestore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillsRestore.js","sourceRoot":"","sources":["../../src/utils/skillsRestore.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;AA2FH,0DAUC;AAOD,gEAMC;AAOD,wDAOC;AAwFD,sEAgCC;AAoCD,oEAEC;AAYD,0DAIC;AA0BD,wDA0BC;AAuBD,4DAyDC;AAGD,sDAOC;AAuBD,0DAiBC;AAmCD,0DAcC;AAcD,8DA2BC;AA5jBD,gDAAwB;AACxB,mDAAgD;AAEhD;;;GAGG;AACU,QAAA,mBAAmB,GAAG,8CAA8C,CAAC;AA4ClF;;;;GAIG;AACU,QAAA,kBAAkB,GAAuB;IACpD,MAAM,EAAE,2BAAmB;IAC3B,SAAS,EAAE,mBAAmB;IAC9B,KAAK,EAAE,6LA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
|
|
|
9
9
|
*
|
|
10
10
|
* Extracted from `bot.ts`'s `flushStatusCoalescer` so the rule is unit-testable
|
|
11
11
|
* without the Telegraf / bucket machinery (same pattern as
|
|
12
|
-
* `
|
|
12
|
+
* `clearStatusCoalescer.ts`). Status frames are disposable spinner ticks:
|
|
13
13
|
* during congestion it is correct to drop or defer them rather than burn the
|
|
14
14
|
* chat-wide send budget that interactive command replies and agent output need.
|
|
15
15
|
*
|
|
@@ -20,10 +20,10 @@ export interface StreamedSummaryDisplay {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* @description The display of a SHOWN streamed summary. Complete lines go through the summary line filter; the last,
|
|
23
|
-
* unfinished line is shown at once unless it could still become a marker
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* mid-line is never read as a marker.
|
|
23
|
+
* unfinished line is shown at once unless it could still become a marker, or the filter is inside the loaded-skills block
|
|
24
|
+
* (whose lines are hidden whole) — then it waits for its newline, or for the next tail to settle it. So a line that is not
|
|
25
|
+
* scaffolding is never kept back, and the last line of a summary that ends without a newline is not lost. Once part of a
|
|
26
|
+
* line is out, the rest of that line is passed on as it comes: a fragment that starts mid-line is never read as a marker.
|
|
27
27
|
*/
|
|
28
28
|
export declare function createStreamedSummaryDisplay(gapsHeader: string): StreamedSummaryDisplay;
|
|
29
29
|
/** One tail of a streamed summary and what the backend said about it. */
|
|
@@ -20,10 +20,10 @@ exports.createStreamedSummaryTracker = createStreamedSummaryTracker;
|
|
|
20
20
|
const compactOnIdle_1 = require("./compactOnIdle");
|
|
21
21
|
/**
|
|
22
22
|
* @description The display of a SHOWN streamed summary. Complete lines go through the summary line filter; the last,
|
|
23
|
-
* unfinished line is shown at once unless it could still become a marker
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* mid-line is never read as a marker.
|
|
23
|
+
* unfinished line is shown at once unless it could still become a marker, or the filter is inside the loaded-skills block
|
|
24
|
+
* (whose lines are hidden whole) — then it waits for its newline, or for the next tail to settle it. So a line that is not
|
|
25
|
+
* scaffolding is never kept back, and the last line of a summary that ends without a newline is not lost. Once part of a
|
|
26
|
+
* line is out, the rest of that line is passed on as it comes: a fragment that starts mid-line is never read as a marker.
|
|
27
27
|
*/
|
|
28
28
|
function createStreamedSummaryDisplay(gapsHeader) {
|
|
29
29
|
const filter = (0, compactOnIdle_1.createCompactionSummaryLineFilter)(gapsHeader);
|
|
@@ -50,7 +50,7 @@ function createStreamedSummaryDisplay(gapsHeader) {
|
|
|
50
50
|
shown += filter.pushLine(line).map((shownLine) => `${shownLine}\n`).join('');
|
|
51
51
|
if (unfinishedLine === '')
|
|
52
52
|
return shown;
|
|
53
|
-
if ((0, compactOnIdle_1.checkCouldBecomeCompactionScaffoldingLine)(unfinishedLine)) {
|
|
53
|
+
if (filter.checkIsInHiddenBlock() || (0, compactOnIdle_1.checkCouldBecomeCompactionScaffoldingLine)(unfinishedLine)) {
|
|
54
54
|
heldFragment = unfinishedLine;
|
|
55
55
|
return shown;
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamedCompactionSummary.js","sourceRoot":"","sources":["../../src/utils/streamedCompactionSummary.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAqBH,oEAgCC;AAsDD,oEAyCC;AAlJD,mDAIyB;AAQzB;;;;;;GAMG;AACH,SAAgB,4BAA4B,CAAC,UAAkB;IAC7D,MAAM,MAAM,GAAG,IAAA,iDAAiC,EAAC,UAAU,CAAC,CAAC;IAC7D,iFAAiF;IACjF,IAAI,YAAY,GAAG,EAAE,CAAC;IACtB,uFAAuF;IACvF,IAAI,SAAS,GAAG,KAAK,CAAC;IACtB,OAAO;QACL,IAAI,CAAC,IAAY;YACf,IAAI,OAAO,GAAG,GAAG,YAAY,GAAG,IAAI,EAAE,CAAC;YACvC,YAAY,GAAG,EAAE,CAAC;YAClB,IAAI,KAAK,GAAG,EAAE,CAAC;YACf,IAAI,SAAS,EAAE,CAAC;gBAC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