@corbat-tech/coco 2.14.0 → 2.14.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/dist/cli/index.js CHANGED
@@ -8502,7 +8502,13 @@ function initializeContextManager(session, provider) {
8502
8502
  function updateContextTokens(session, provider, toolRegistry) {
8503
8503
  if (!session.contextManager) return;
8504
8504
  let totalTokens = 0;
8505
- {
8505
+ if (toolRegistry) {
8506
+ const effectiveMessages = getConversationContext(session, toolRegistry);
8507
+ for (const message of effectiveMessages) {
8508
+ const content = typeof message.content === "string" ? message.content : JSON.stringify(message.content);
8509
+ totalTokens += provider.countTokens(content);
8510
+ }
8511
+ } else {
8506
8512
  totalTokens += provider.countTokens(session.config.agent.systemPrompt);
8507
8513
  for (const message of session.messages) {
8508
8514
  const content = typeof message.content === "string" ? message.content : JSON.stringify(message.content);
@@ -8515,7 +8521,7 @@ async function checkAndCompactContext(session, provider, signal, toolRegistry) {
8515
8521
  if (!session.contextManager) {
8516
8522
  initializeContextManager(session, provider);
8517
8523
  }
8518
- updateContextTokens(session, provider);
8524
+ updateContextTokens(session, provider, toolRegistry);
8519
8525
  if (!session.contextManager.shouldCompact()) {
8520
8526
  return null;
8521
8527
  }
@@ -15165,7 +15171,18 @@ Examples:
15165
15171
  required,
15166
15172
  suggestions,
15167
15173
  maturity,
15168
- diff
15174
+ // Include full diff for skill access, but strip raw content from files
15175
+ // to prevent dumping thousands of lines into the LLM tool result.
15176
+ // Skills that need file content can access diff.files[].hunks,
15177
+ // but the serialised output stays lean (stats + file names only).
15178
+ diff: {
15179
+ ...diff,
15180
+ files: diff.files.map((f) => ({
15181
+ ...f,
15182
+ hunks: []
15183
+ // strip raw diff hunks — findings already extracted above
15184
+ }))
15185
+ }
15169
15186
  };
15170
15187
  if (diffWarnings.length > 0) {
15171
15188
  result.warnings = diffWarnings;
@@ -49419,7 +49436,8 @@ async function startRepl(options = {}) {
49419
49436
  const compactionResult = await checkAndCompactContext(
49420
49437
  session,
49421
49438
  provider,
49422
- compactAbort.signal
49439
+ compactAbort.signal,
49440
+ toolRegistry
49423
49441
  );
49424
49442
  if (compactionResult?.wasCompacted) {
49425
49443
  usageForDisplay = getContextUsagePercent(session);