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,235 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description What the bot puts back into an agent's context after a compaction so that the skills it had loaded keep
|
|
3
|
+
* applying — the owner's guarantee that a compaction never leaves an agent without the procedures it was following (plan
|
|
4
|
+
* `2026-11-12-skills-reload-after-compaction`, S2). Pure: no file is read here; the Claude hook
|
|
5
|
+
* (`hooks/claudeSkillsRestoreHook.ts`) reads the transcript and the skill files and hands them in, and the OpenCode plugin
|
|
6
|
+
* (`openCodeCompactPlugin.ts`) embeds the self-contained renderers below.
|
|
7
|
+
*
|
|
8
|
+
* skills = what the records show was loaded (newest first) ∪ what the summary's block names (OpenCode)
|
|
9
|
+
* resolve = each skill's CURRENT text, or "not available now", or "load it with the tool"
|
|
10
|
+
* payload = {@link skillsRestoreHeader}, the list (every skill, with where its text is), then each restored skill whole
|
|
11
|
+
*
|
|
12
|
+
* Claude: the transcript records, read back to the previous compaction — a skill loaded with the Skill tool or a slash
|
|
13
|
+
* command (its `Base directory for this skill: <dir>` message), Claude's own re-attach of the previous compaction
|
|
14
|
+
* (`invoked_skills`, which carries older epochs) and the bot's previous restore (which carries what Claude's re-attach
|
|
15
|
+
* dropped). Every skill comes back whole, also one Claude may re-attach itself ({@link planClaudeSkillsRestore} says why).
|
|
16
|
+
* OpenCode: a skill whose call is already after the summary is only named.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* What opens the context the bot's hook (Claude, `hooks/claudeSkillsRestoreHook.ts`) and plugin (OpenCode,
|
|
20
|
+
* `openCodeCompactPlugin.ts`) add after a compaction. Agent-facing only: the summary the person may see never names it.
|
|
21
|
+
*/
|
|
22
|
+
export declare const skillsRestoreHeader = "[Charness: skills restored after compaction]";
|
|
23
|
+
/** How a skill comes back. */
|
|
24
|
+
export type SkillsRestoreStatus = 'text' | 'inContext' | 'unavailable' | 'loadWithTool';
|
|
25
|
+
/** One skill of the restore: its name, where its text is, and that text when the restore carries it. */
|
|
26
|
+
export interface SkillsRestoreEntry {
|
|
27
|
+
name: string;
|
|
28
|
+
status: SkillsRestoreStatus;
|
|
29
|
+
/** The folder of its `SKILL.md`, when known: relative paths in the skill resolve from it. */
|
|
30
|
+
baseDir: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* The full path of the `SKILL.md` its text is read from, when known (Claude: `<baseDir>/SKILL.md`; OpenCode: the location
|
|
33
|
+
* the server reports) — the file an agent told to change the skill must edit.
|
|
34
|
+
*/
|
|
35
|
+
skillFile: string | null;
|
|
36
|
+
/** The skill's current text (frontmatter stripped), for {@link SkillsRestoreStatus} `text` only. */
|
|
37
|
+
body: string | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The agent-facing wording of the restore (English: an agent reads it, whatever the topic's language). One object, so the
|
|
41
|
+
* OpenCode plugin can carry it as JSON into the self-contained renderers it embeds.
|
|
42
|
+
*/
|
|
43
|
+
export interface SkillsRestoreTexts {
|
|
44
|
+
header: string;
|
|
45
|
+
/** A part's place among the parts: `{i}` of `{n}`. */
|
|
46
|
+
partLabel: string;
|
|
47
|
+
intro: string;
|
|
48
|
+
/** Added to the intro when the restore comes in more than one part. */
|
|
49
|
+
multiPartNote: string;
|
|
50
|
+
listHeading: string;
|
|
51
|
+
listContinuedHeading: string;
|
|
52
|
+
statuses: Record<SkillsRestoreStatus, string>;
|
|
53
|
+
/** After a list line whose skill file is known. */
|
|
54
|
+
skillFileSuffix: string;
|
|
55
|
+
/** After a list line that knows only the folder (and in the restores written before the skill file was named). */
|
|
56
|
+
baseDirSuffix: string;
|
|
57
|
+
sectionHeading: string;
|
|
58
|
+
sectionContinued: string;
|
|
59
|
+
baseDirLine: string;
|
|
60
|
+
skillFileLine: string;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The words of the restore. `{tool}` is the backend's skill tool (`Skill` / `skill`), `{dir}` a base directory, `{file}` the
|
|
64
|
+
* full path of a skill's `SKILL.md`, `{name}` a skill, `{i}` / `{n}` a part's number and the count, `{previous}` the part a
|
|
65
|
+
* long skill continues from.
|
|
66
|
+
*/
|
|
67
|
+
export declare const skillsRestoreTexts: SkillsRestoreTexts;
|
|
68
|
+
/** The file a Claude skill's text is in, inside its base directory. */
|
|
69
|
+
export declare const claudeSkillFileName = "SKILL.md";
|
|
70
|
+
/** The name of the skill tool of each backend, as the restore tells the agent to use it. */
|
|
71
|
+
export declare const claudeSkillToolName = "Skill";
|
|
72
|
+
export declare const 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
|
+
export declare function renderSkillsRestoreList(entries: readonly SkillsRestoreEntry[], texts: SkillsRestoreTexts, toolName: string): string[];
|
|
79
|
+
/**
|
|
80
|
+
* @description The lines of one restored skill: its heading, its base directory (the line Claude's own skill message opens
|
|
81
|
+
* 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
|
|
82
|
+
* to change the skill edits the right file), and its text. Self-contained, as {@link renderSkillsRestoreList}.
|
|
83
|
+
*/
|
|
84
|
+
export declare function renderSkillsRestoreSection(entry: SkillsRestoreEntry, texts: SkillsRestoreTexts): string[];
|
|
85
|
+
/**
|
|
86
|
+
* @description The whole restore as ONE text (OpenCode: no size limit, one part): the header, the list, then every skill
|
|
87
|
+
* whose status is `text`, whole. `''` when there is no skill — nothing is added at all. Self-contained (it calls only the
|
|
88
|
+
* two renderers above), as the plugin embeds it.
|
|
89
|
+
*/
|
|
90
|
+
export declare function buildSkillsRestoreText(entries: readonly SkillsRestoreEntry[], texts: SkillsRestoreTexts, toolName: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* How many `SessionStart` hook slots carry the Claude restore, and how long each part may be. Claude Code caps what ONE hook
|
|
93
|
+
* adds at 10,000 characters (a longer one becomes a file and a 2,000-character preview); several hooks of one event each
|
|
94
|
+
* get their own cap. Measured on Claude Code 2.1.322 (`-p`, stream-json, a manual `/compact`): 24 slots of 9,500 characters
|
|
95
|
+
* each, all full, reached the next model request whole — 228,000 characters, no preview, no total cap (the parts arrive in
|
|
96
|
+
* the order the hooks finished, not by slot number: hence the part labels). A slot with nothing to say prints nothing and
|
|
97
|
+
* costs nothing.
|
|
98
|
+
*/
|
|
99
|
+
export declare const skillsRestoreSlotCount = 24;
|
|
100
|
+
export declare const skillsRestorePartMaxChars = 9500;
|
|
101
|
+
/**
|
|
102
|
+
* @description The Claude restore as the parts its `SessionStart` hook slots print, each at most `partMaxChars` long, label
|
|
103
|
+
* included. Every restored skill goes in WHOLE, newest first; one that would no longer fit into `slotCount` parts gets the
|
|
104
|
+
* "load it with the tool" line instead (the newer skills are kept first). `[]` when there is no skill.
|
|
105
|
+
*/
|
|
106
|
+
export declare function buildClaudeSkillsRestoreParts(entries: readonly SkillsRestoreEntry[], texts: SkillsRestoreTexts, slotCount: number, partMaxChars: number): string[];
|
|
107
|
+
/** The line Claude's own skill message opens with (and the content of its re-attach). */
|
|
108
|
+
export declare const claudeSkillBaseDirPrefix = "Base directory for this skill: ";
|
|
109
|
+
/** One load of a skill the transcript shows: its name and its folder. */
|
|
110
|
+
export interface ClaudeSkillLoad {
|
|
111
|
+
name: string;
|
|
112
|
+
baseDir: string;
|
|
113
|
+
}
|
|
114
|
+
/** A skill the bot's previous restore named. */
|
|
115
|
+
export interface RestoredSkillMention {
|
|
116
|
+
name: string;
|
|
117
|
+
baseDir: string | null;
|
|
118
|
+
}
|
|
119
|
+
/** What the records since the previous compaction show about the skills. */
|
|
120
|
+
export interface ClaudeEpochSkills {
|
|
121
|
+
/** Loads since the previous compaction (Skill tool or slash command), newest first, one per skill. */
|
|
122
|
+
loads: ClaudeSkillLoad[];
|
|
123
|
+
/** Claude's own re-attach at the previous compaction (`invoked_skills`), in its order (newest first). */
|
|
124
|
+
reattached: ClaudeSkillLoad[];
|
|
125
|
+
/** The bot's previous restore, in its order. */
|
|
126
|
+
previousRestore: RestoredSkillMention[];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The keys a transcript line must carry to matter to {@link collectClaudeEpochSkills} — checked on the raw line before
|
|
130
|
+
* `JSON.parse`, as a transcript can be a hundred megabytes and almost none of it is about skills.
|
|
131
|
+
*/
|
|
132
|
+
export declare const claudeSkillRecordKeys: readonly string[];
|
|
133
|
+
/** @description Whether a raw transcript line can matter to {@link collectClaudeEpochSkills}. */
|
|
134
|
+
export declare function checkIsClaudeSkillRecordLine(line: string): boolean;
|
|
135
|
+
/** @description The folder a skill message names in its first line, or `null` when the text is no skill message. */
|
|
136
|
+
export declare function readSkillMessageBaseDir(text: string): string | null;
|
|
137
|
+
/**
|
|
138
|
+
* @description The skills named by the list of a restore the bot wrote earlier ({@link renderSkillsRestoreList}), from the
|
|
139
|
+
* texts the hook gave (`hook_additional_context`): every `- <name>: …` line under the list's heading, with its base directory
|
|
140
|
+
* when the line gives one — the folder of its skill file (the current wording), or the folder itself (the wording of the
|
|
141
|
+
* restores written before the skill file was named). Lines of a skill's text never count — they come after the list. `[]`
|
|
142
|
+
* for texts that hold no restore of ours.
|
|
143
|
+
*/
|
|
144
|
+
export declare function parseSkillsRestoreList(contextTexts: readonly string[], texts?: SkillsRestoreTexts): RestoredSkillMention[];
|
|
145
|
+
/**
|
|
146
|
+
* @description Read the skills out of the transcript lines since the previous compaction (oldest first, as in the file).
|
|
147
|
+
* A load is the skill message the CLI writes after a SUCCESSFUL load — `isMeta`, opening `Base directory for this skill:
|
|
148
|
+
* <dir>` — so a failed Skill call (no such message) counts for nothing. Its name: the Skill tool's `skill` input of the call
|
|
149
|
+
* the message answers (`sourceToolUseID`), else the slash command the message follows (`<command-name>/name</command-name>`
|
|
150
|
+
* in the record its `parentUuid` names — measured on Claude Code 2.1.322), else the folder's name. A sub-agent's records
|
|
151
|
+
* (`isSidechain`) and lines that are no records are skipped.
|
|
152
|
+
*/
|
|
153
|
+
export declare function collectClaudeEpochSkills(epochLines: readonly string[]): ClaudeEpochSkills;
|
|
154
|
+
/** @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. */
|
|
155
|
+
export declare function stripSkillFrontmatter(fileText: string): string;
|
|
156
|
+
/** How the hook reads a skill's file now. */
|
|
157
|
+
export interface SkillFolderReader {
|
|
158
|
+
/** The text of the skill file at `skillFile` (a full path), or `null` when it is gone or unreadable. */
|
|
159
|
+
readSkillFile(skillFile: string): string | null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* @description The Claude restore's entries, newest first: every skill this epoch loaded, Claude's previous re-attach carried
|
|
163
|
+
* and the bot's previous restore named. A skill whose folder is inside `unavailableDir` (the bot's own skills, when this
|
|
164
|
+
* process was started without them) or whose `SKILL.md` is gone is "not available now"; a name with no known folder gets the
|
|
165
|
+
* "load it with the tool" line; EVERY other skill comes back with its CURRENT text.
|
|
166
|
+
*
|
|
167
|
+
* 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
|
|
168
|
+
* keeps a skill's message whole up to 20,000 characters and about 100,000 in all, newest first. But a process started with
|
|
169
|
+
* `--resume` — every per-turn turn, every json-stream process after an idle stop or a bot restart — re-attaches NONE of the
|
|
170
|
+
* skills an earlier process loaded: measured by the live probe's resume case on 2026-11-13 (the installed Claude Code,
|
|
171
|
+
* 2.1.323, the default account): skills loaded, the process stopped, `--resume`, `/compact` — its `invoked_skills` held []
|
|
172
|
+
* of [live-small, live-big]. A skill only named here would be lost until the next compaction while the agent is told not to
|
|
173
|
+
* load it; giving every one costs a second copy of a short skill only in a process that loaded it itself, once per
|
|
174
|
+
* compaction.
|
|
175
|
+
*/
|
|
176
|
+
export declare function planClaudeSkillsRestore(epoch: ClaudeEpochSkills, folders: SkillFolderReader, unavailableDir: string | null): SkillsRestoreEntry[];
|
|
177
|
+
/** One part of an OpenCode message, as far as the restore reads it: a `skill` tool call and how it ended. */
|
|
178
|
+
export interface OpenCodeRestorePart {
|
|
179
|
+
type?: string;
|
|
180
|
+
tool?: string;
|
|
181
|
+
state?: {
|
|
182
|
+
status?: string;
|
|
183
|
+
input?: {
|
|
184
|
+
name?: string;
|
|
185
|
+
};
|
|
186
|
+
metadata?: {
|
|
187
|
+
name?: string;
|
|
188
|
+
dir?: string;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/** One message of an OpenCode session (the server's `{info, parts}`), as far as the restore reads it. */
|
|
193
|
+
export interface OpenCodeRestoreMessage {
|
|
194
|
+
info?: {
|
|
195
|
+
role?: string;
|
|
196
|
+
};
|
|
197
|
+
parts?: OpenCodeRestorePart[];
|
|
198
|
+
}
|
|
199
|
+
/** A skill the OpenCode server offers now (`GET /skill`): its name, the full path of its `SKILL.md`, its body. */
|
|
200
|
+
export interface OpenCodeAvailableSkill {
|
|
201
|
+
name: string;
|
|
202
|
+
location: string;
|
|
203
|
+
content: string;
|
|
204
|
+
}
|
|
205
|
+
/** A skill a session loaded: its name and folder (when the call recorded it). */
|
|
206
|
+
export interface LoadedSkillMention {
|
|
207
|
+
name: string;
|
|
208
|
+
baseDir: string | null;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* @description The skills an OpenCode session loaded, newest first, one per name: every COMPLETED `skill` tool call in
|
|
212
|
+
* `messages` (a failed one loaded nothing), named by the call's own record (`metadata.name`, else its input) with the folder
|
|
213
|
+
* it recorded. Self-contained (it reads nothing outside its parameters): the OpenCode plugin embeds its source.
|
|
214
|
+
*/
|
|
215
|
+
export declare function getOpenCodeLoadedSkills(messages: readonly OpenCodeRestoreMessage[]): LoadedSkillMention[];
|
|
216
|
+
/**
|
|
217
|
+
* @description The OpenCode restore's entries: the skills the history shows loaded (newest first), then the ones only the
|
|
218
|
+
* summary's block names. A skill whose call is already in what the model sees after the summary (the compaction's retained
|
|
219
|
+
* tail, or loaded again since) is only named; one the server offers now comes back with its CURRENT text; one it does not
|
|
220
|
+
* offer is "not available now"; with no answer from the server (`available` `null`) every other skill gets the "load it with
|
|
221
|
+
* the tool" line.
|
|
222
|
+
*
|
|
223
|
+
* A name ONLY the block holds gets its text only while the history is unknown (`isHistoryKnown` false: the block is then the
|
|
224
|
+
* best record there is); with the history known it gets the "load it with the tool" line — the history shows every completed
|
|
225
|
+
* 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
|
|
226
|
+
* every request of the epoch. Self-contained, as {@link getOpenCodeLoadedSkills}.
|
|
227
|
+
*/
|
|
228
|
+
export declare function planOpenCodeSkillsRestore(input: {
|
|
229
|
+
loaded: readonly LoadedSkillMention[];
|
|
230
|
+
blockNames: readonly string[];
|
|
231
|
+
inContextNames: readonly string[];
|
|
232
|
+
available: readonly OpenCodeAvailableSkill[] | null;
|
|
233
|
+
isHistoryKnown: boolean;
|
|
234
|
+
}): SkillsRestoreEntry[];
|
|
235
|
+
//# sourceMappingURL=skillsRestore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skillsRestore.d.ts","sourceRoot":"","sources":["../../src/utils/skillsRestore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,iDAAiD,CAAC;AAElF,8BAA8B;AAC9B,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;AAExF,wGAAwG;AACxG,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,mBAAmB,CAAC;IAC5B,6FAA6F;IA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